Config
Integration configuration after initialization and merging defaults
interface Config<TCacheShape = any> {
acceptLanguage?: string[];
api: ApiConfig;
apolloAgentKeepAliveOptions?: AgentKeepAlive.HttpsOptions;
apolloFetchOptions?: HttpOptions["fetchOptions"];
channel: string;
client?: ApolloClient<TCacheShape>;
clientForceRecreate?: boolean;
cookie_options?: CookieOptionsList;
cookies?: CookiesConfig;
countries?: LocaleItem[];
country?: string;
currencies?: LocaleItem[];
currency?: string;
customOptions?: ApolloClientOptions<TCacheShape>;
customRetry?: (options: {
count: number;
error: any;
operation: Operation;
}) => boolean | Promise<boolean>;
customToken?: (options: {
apolloContext: DefaultContext;
apolloReq: GraphQLRequest;
configuration: Config<TCacheShape>;
isServer: boolean;
}) => any;
faceting: Record<string, any>;
forceToken?: boolean;
handleIsGuest: (context: any) => boolean;
handleIsLoggedIn: (context: any) => boolean;
handleIsTokenUserSession: (token: Token) => boolean;
inventoryMode?: InventoryMode;
itemsPerPage: number;
languageMap?: Record<string, any>;
locale?: string;
locales?: LocaleItem[];
mergeGuestOrders?: boolean;
sdkAuth?: SdkAuth;
serverApi: ServerApiConfiguration;
store: string;
}Properties
| Name | Required | Type | Description |
|---|---|---|---|
acceptLanguage | Optional | string[] | An array of supported locales |
api | Required | ApiConfig | Credentials for requesting access tokens for guest, anonymous, and user sessions |
apolloAgentKeepAliveOptions | Optional | AgentKeepAlive.HttpsOptions | Configuration passed to the AgentKeepAlive for the ApolloClient |
apolloFetchOptions | Optional | HttpOptions["fetchOptions"] | Configuration passed to the fetch options for the ApolloClient |
channel | Required | string | Default channel, used when request doesn't contain channel cookie |
client | Optional | ApolloClient<TCacheShape> | Custom GraphQL client to be used instead of the default one. Use customOptions if you only want to override configuration passed to the ApolloClient |
clientForceRecreate | Optional | boolean | Indicates if integration should create dedicated Apollo client for every request |
cookie_options | Optional | CookieOptionsList | Customizable cookie options. |
cookies | Optional | CookiesConfig | Names of the cookies for user currency, country, locale, and store |
countries | Optional | LocaleItem[] | |
country | Optional | string | Default country, used when request doesn't contain store cookie |
currencies | Optional | LocaleItem[] | |
currency | Optional | string | Default currency, used when request doesn't contain store cookie |
customOptions | Optional | ApolloClientOptions<TCacheShape> | Configuration passed to the ApolloClient during initialization. Use client if you want to use custom GraphQL client |
customRetry | Optional | (options: { count: number; error: any; operation: Operation; }) => boolean | Promise<boolean> | Handler for retrying failed requests |
customToken | Optional | (options: { apolloContext: DefaultContext; apolloReq: GraphQLRequest; configuration: Config<TCacheShape>; isServer: boolean; }) => any | Handler for providing custom access token to the request sent to commercetools |
faceting | Required | Record<string, any> | |
forceToken | Optional | boolean | |
handleIsGuest | Required | (context: any) => boolean | Handler for checking if visitor is a guest, used in the isGuest API endpoint |
handleIsLoggedIn | Required | (context: any) => boolean | Handler for checking if visitor is logged in, used in the isLoggedIn API endpoint |
handleIsTokenUserSession | Required | (token: Token) => boolean | |
inventoryMode | Optional | InventoryMode | Inventory mode used when creating a cart |
itemsPerPage | Required | number | Items per page number |
languageMap | Optional | Record<string, any> | An object used to map a locale to the accepted languages |
locale | Optional | string | Default locale, used when request doesn't contain store cookie |
locales | Optional | LocaleItem[] | |
mergeGuestOrders | Optional | boolean | Indicates if commercetools should merge orders of guest when we sign in/up |
sdkAuth | Optional | SdkAuth | SdkAuth instance |
serverApi | Required | ServerApiConfiguration | Credentials for requesting access token with elevated permissions that users should not have |
store | Required | string | Default store, used when request doesn't contain store cookie |
Referenced Types
- ApiConfig
AgentKeepAlive.HttpsOptionsHttpOptionsApolloClient- CookiesConfig
- LocaleItem
ApolloClientOptionsOperationDefaultContextGraphQLRequest- Config
- Token
- InventoryMode
- ServerApiConfiguration