import type { Action } from '@reduxjs/toolkit'; import { type CommerceEngine, type CommerceEngineOptions } from '../../../app/commerce-engine/commerce-engine.js'; import type { Controller } from '../../../controllers/controller/headless-controller.js'; import { SolutionType } from '../types/controller-constants.js'; import type { ControllerDefinitionsMap } from '../types/controller-definitions.js'; import type { BuildParameters, CommerceControllerDefinitionsMap, EngineDefinitionOptions } from '../types/engine.js'; /** * The SSR commerce engine. * * @group Engine */ export interface SSRCommerceEngine extends CommerceEngine { /** * Waits for the request to be completed and returns a promise that resolves to an `Action`. */ waitForRequestCompletedAction(): Promise[]; } /** * SSR-specific commerce engine options with deprecated context property. */ export type SSRCommerceEngineOptions = Omit & { configuration: Omit & { /** * @deprecated In the future major release, context should be provided through `fetchStaticState` rather than in the engine definition. * * @example * ```ts * engineDefinition = defineCommerceEngine({...}); * engineDefinition.fetchStaticState({ * context: {...}, * }); * ``` */ context: CommerceEngineOptions['configuration']['context']; }; }; export type CommerceEngineDefinitionOptions = ControllerDefinitionsMap> = EngineDefinitionOptions & { /** * Callback invoked when the access token changes. */ onAccessTokenUpdate?: (updateCallback: (token: string) => void, owner: object) => void; }; /** * Internal options describing the lifecycle of the engines a factory produces. * @internal */ export interface BuildFactoryOptions { /** * Set by paths that produce an engine outliving the call that created it, namely client-side * hydration. Such an engine keeps its subscription to the definition's shared access token even * when a per-request token is supplied, so a later `setAccessToken()` still reaches it. */ engineOutlivesRequest?: boolean; } export declare const buildFactory: (controllerDefinitions: TControllerDefinitions | undefined, options: CommerceEngineDefinitionOptions, factoryOptions?: BuildFactoryOptions) => (solutionType: T) => (...[buildOptions]: BuildParameters) => Promise<{ engine: SSRCommerceEngine; controllers: import("../types/controller-inference.js").InferControllersMapFromDefinition; }>;