Alokai

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

NameRequiredTypeDescription
acceptLanguageOptionalstring[]An array of supported locales
apiRequiredApiConfigCredentials for requesting access tokens for guest, anonymous, and user sessions
apolloAgentKeepAliveOptionsOptionalAgentKeepAlive.HttpsOptionsConfiguration passed to the AgentKeepAlive for the ApolloClient
apolloFetchOptionsOptionalHttpOptions["fetchOptions"]Configuration passed to the fetch options for the ApolloClient
channelRequiredstringDefault channel, used when request doesn't contain channel cookie
clientOptionalApolloClient<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
clientForceRecreateOptionalbooleanIndicates if integration should create dedicated Apollo client for every request
cookie_optionsOptionalCookieOptionsListCustomizable cookie options.
cookiesOptionalCookiesConfigNames of the cookies for user currency, country, locale, and store
countriesOptionalLocaleItem[]
countryOptionalstringDefault country, used when request doesn't contain store cookie
currenciesOptionalLocaleItem[]
currencyOptionalstringDefault currency, used when request doesn't contain store cookie
customOptionsOptionalApolloClientOptions<TCacheShape>Configuration passed to the ApolloClient during initialization. Use client if you want to use custom GraphQL client
customRetryOptional(options: { count: number; error: any; operation: Operation; }) => boolean | Promise<boolean>Handler for retrying failed requests
customTokenOptional(options: { apolloContext: DefaultContext; apolloReq: GraphQLRequest; configuration: Config<TCacheShape>; isServer: boolean; }) => anyHandler for providing custom access token to the request sent to commercetools
facetingRequiredRecord<string, any>
forceTokenOptionalboolean
handleIsGuestRequired(context: any) => booleanHandler for checking if visitor is a guest, used in the isGuest API endpoint
handleIsLoggedInRequired(context: any) => booleanHandler for checking if visitor is logged in, used in the isLoggedIn API endpoint
handleIsTokenUserSessionRequired(token: Token) => boolean
inventoryModeOptionalInventoryModeInventory mode used when creating a cart
itemsPerPageRequirednumberItems per page number
languageMapOptionalRecord<string, any>An object used to map a locale to the accepted languages
localeOptionalstringDefault locale, used when request doesn't contain store cookie
localesOptionalLocaleItem[]
mergeGuestOrdersOptionalbooleanIndicates if commercetools should merge orders of guest when we sign in/up
sdkAuthOptionalSdkAuthSdkAuth instance
serverApiRequiredServerApiConfigurationCredentials for requesting access token with elevated permissions that users should not have
storeRequiredstringDefault store, used when request doesn't contain store cookie

Referenced Types

On this page