Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 38x 38x 38x 38x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x 54x | import ApolloClient from 'apollo-client';
import { InMemoryCache } from 'apollo-cache-inmemory';
import createCommerceToolsLink from './helpers/createCommerceToolsLink';
import getProduct from './api/getProduct';
import getCategory from './api/getCategory';
import createCart from './api/createCart';
import updateCart from './api/updateCart';
import getCart from './api/getCart';
import addToCart from './api/addToCart';
import removeFromCart from './api/removeFromCart';
import updateCartQuantity from './api/updateCartQuantity';
import getMe from './api/getMe';
import createMyOrderFromCart from './api/createMyOrderFromCart';
import getShippingMethods from './api/getShippingMethods';
import updateShippingDetails from './api/updateShippingDetails';
import customerSignMeUp from './api/customerSignMeUp';
import customerSignMeIn from './api/customerSignMeIn';
import customerSignOut from './api/customerSignOut';
import getOrders from './api/getMyOrders';
import applyCartCoupon from './api/applyCartCoupon';
import removeCartCoupon from './api/removeCartCoupon';
import customerChangeMyPassword from './api/customerChangeMyPassword';
import customerUpdateMe from './api/customerUpdateMe';
import deleteCart from './api/deleteCart';
import createAccessToken from './helpers/createAccessToken';
import { apiClientFactory } from '@vue-storefront/core';
import { Config, ConfigurableConfig } from './types/setup';
let apolloClient: ApolloClient<any> = null;
const onSetup = (config: Config) => {
config.languageMap = config.languageMap || {};
config.acceptLanguage = config.languageMap[config.locale] || config.acceptLanguage;
apolloClient = new ApolloClient({
link: createCommerceToolsLink(),
cache: new InMemoryCache(),
...config.customOptions
});
config.client = apolloClient;
};
const { setup, update, getSettings } = apiClientFactory<Config, ConfigurableConfig>({
onSetup,
defaultSettings: {
locale: 'en',
acceptLanguage: ['en'],
auth: {
onTokenChange: () => {}
},
cookies: {
currencyCookieName: 'vsf-currency',
countryCookieName: 'vsf-country',
localeCookieName: 'vsf-locale'
}
}
});
export {
getSettings,
createAccessToken,
apolloClient,
setup,
update,
getProduct,
getCategory,
getOrders,
createCart,
updateCart,
getCart,
deleteCart,
addToCart,
removeFromCart,
getMe,
updateCartQuantity,
createMyOrderFromCart,
getShippingMethods,
updateShippingDetails,
customerSignMeUp,
customerSignMeIn,
customerSignOut,
applyCartCoupon,
removeCartCoupon,
customerChangeMyPassword,
customerUpdateMe
};
export * from './types/Api';
export * from './types/GraphQL';
export * from './types/setup';
export * from './helpers/token';
export * from './helpers/queries';
export * as cartActions from './helpers/cart/actions';
|