Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
import { getTyped } from 'composition';
import { client } from 'src/bootstrap/client/apolloClient';
import { SelectShippingMethod, GetShippingMethodsList } from './queries';
import { createShippingMethodListResponseFixture, fixtureSetShippingMethodSuccessResponse, } from './fixture';
/**
 * @note was `properties.cartinfo.shippingmethods.0.shippingmethods`
 * @alias updateShippingMethods
 * @name selectShippingMethodBinding
 */
async function selectShippingMethod(variables) {
    try {
        const response = await client.mutate({
            mutation: SelectShippingMethod,
            variables,
        });
        const shippingMethodsResponse = getTyped(response).obj('data.selectShippingMethod');
        return { shippingMethodsResponse, response };
    }
    catch (graphqlNotFinished) {
        console.error(graphqlNotFinished);
        return {
            shippingMethodsResponse: fixtureSetShippingMethodSuccessResponse,
        };
    }
}
/**
 * @name getShippingMethodsListBinding
 */
async function getShippingMethodsList(cartItemId) {
    try {
        const response = await client.query({
            query: GetShippingMethodsList,
            fetchPolicy: 'no-cache',
            variables: {
                cartItemId,
            },
        });
        const shippingMethodsResponse = getTyped(response).obj('data.shippingMethodList');
        return { shippingMethodsResponse, response };
    }
    catch (graphqlNotFinished) {
        console.error(graphqlNotFinished);
        return {
            shippingMethodsResponse: {
                list: createShippingMethodListResponseFixture(),
            },
        };
    }
}
export { selectShippingMethod, getShippingMethodsList };
//# sourceMappingURL=bindings.js.map