{"version":3,"sources":["../src/library/SDK.ts"],"sourcesContent":["import { fetcher, FetcherResponse } from \"../helpers/fetcher\";\nimport { rememberMeCookie } from \"../helpers/cookieManagement\";\nimport { Queue } from \"./Queue\";\nimport { Event } from \"./Event\";\nimport { EventManager } from \"./EventManager\";\nimport { BaseEvents } from \"../types/events/BaseEvents\";\nimport { Events } from \"../types/events/Events\";\nimport { Currency } from \"../types/Currency\";\nimport {\n\tSDKResponse,\n\tSDKConfig,\n\tHandleSuccessfulFetchOptions,\n\tHandleErrorCaughtOptions,\n\tHandleApiCallOptions,\n} from \"../types/sdk\";\nimport { ActionError } from \"./ActionError\";\nimport {\n\tPageApi,\n\tPageFolderListResponse,\n\tPagePreviewResponse,\n\tPageResponse,\n} from \"../types/api/page\";\nimport { normaliseUrl, generateQueryString } from \"../helpers/urlHelpers\";\nimport { AcceptedQueryTypes } from \"../types/Query\";\nimport { ServerOptions } from \"../types/cookieHandling/ServerOptions\";\nimport {\n\tDEFAULT_SESSION_LIFETIME,\n\tSDK_NOT_CONFIGURED_ERROR_MESSAGE,\n} from \"../constants\";\nimport { dependencyContainer } from \"./DependencyContainer\";\nimport { CookieHandler } from \"./CookieHandler\";\nimport { AcceptedPayloadTypes } from \"../types/Payload\";\nimport { RedirectResponse } from \"../types/api/page/RedirectResponse\";\nimport { Guid } from \"./Guid\";\nimport { RedactionManager } from \"../types/redactionHandling/RedactionManager\";\nimport { RedactionHandler } from \"./RedactionHandler\";\nimport { RedactionManagerConfig } from \"../types/redactionHandling/RedactionManagerConfig\";\nimport { defaultRedactionRules } from \"../constants/defaultRedactionRules\";\n\nexport class SDK<ExtensionEvents extends Events> extends EventManager<\n\tBaseEvents & ExtensionEvents\n> {\n\tprivate _hasBeenConfigured: boolean;\n\tprivate _actionQueue: Queue;\n\n\tprivate _endpoint!: string;\n\tprivate _locale!: string;\n\tprivate _currency!: Currency;\n\tprivate _extensionVersion!: string;\n\tprivate _useCurrencyInLocale!: boolean;\n\tprivate _sessionLifetime!: number;\n\tprivate _customHeaderValue?: string;\n\n\tprivate setEndpoint(url: string): void {\n\t\turl = normaliseUrl(url);\n\t\tif (url.indexOf(\"http\") === -1) {\n\t\t\turl = `https://${url}`;\n\t\t\t// Note the below doesn't support websocket connections but much more work would\n\t\t\t// be required for this anyway\n\t\t\tconsole.warn(\n\t\t\t\t`Protocol not supplied to endpoint, defaulting to https - ${url}`\n\t\t\t);\n\t\t}\n\t\t// remove \"/frontastic\" if applied\n\t\tthis._endpoint = url.split(\"/frontastic\")[0];\n\t}\n\n\t/**\n\t * A function returning the full url endpoint to be called, to be set within the {@link configure} method.\n\t */\n\tendpoint(): string {\n\t\treturn this._endpoint;\n\t}\n\n\t/**\n\t * A function returning the [BCP 47 language tag](http://tools.ietf.org/html/rfc5646) locale, to be set within the {@link configure} method.\n\t *\n\t * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).\n\t */\n\tlocale(): string {\n\t\treturn this._locale;\n\t}\n\n\tprivate apiHubLocale(): string {\n\t\tconst apiFormattedLocale = this._locale.replace(\"-\", \"_\");\n\n\t\tif (this._useCurrencyInLocale) {\n\t\t\treturn `${apiFormattedLocale}@${this._currency}`;\n\t\t} else {\n\t\t\treturn apiFormattedLocale;\n\t\t}\n\t}\n\n\t/**\n\t * A function returning the string representing the ISO 4217 3-Letter Currency Code, to be set within the {@link configure} method.\n\t */\n\tcurrency(): Currency {\n\t\treturn this._currency;\n\t}\n\n\t/**\n\t * A function returning the string optionally set within the {@link configure} method, the value to assign to a \"coFE-Custom-Configuration\" header value in every API call. Overriden on single calls by explicity set customHeaderValue passed in {@link callAction} and {@link PageApi} methods.\n\t */\n\tcustomHeaderValue() {\n\t\treturn this._customHeaderValue;\n\t}\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._hasBeenConfigured = false;\n\t\tthis._actionQueue = new Queue();\n\t}\n\n\tprivate throwIfNotConfigured() {\n\t\tif (!this._hasBeenConfigured) {\n\t\t\tthrow new Error(SDK_NOT_CONFIGURED_ERROR_MESSAGE);\n\t\t}\n\t}\n\n\tprivate isRedactionManager(\n\t\tconfig?: RedactionManager | RedactionManagerConfig\n\t): config is RedactionManager {\n\t\treturn Boolean(\n\t\t\t(config as RedactionManager)?.redact &&\n\t\t\t\t(config as RedactionManager)?.redactUrl\n\t\t);\n\t}\n\n\t/**\n\t * The method that must be called prior to any other methods to configure the connection to the backend. An error is throw if not called prior.\n\t *\n\t * @param {string} config.locale - A string representing the combination of the ISO 639-1 language and ISO 3166-1 country code. For example \"en-DE\" or \"en_DE\".\n\t * @param {string} config.currency - A string representing the ISO 4217 3-Letter Currency Code, for example EUR.\n\t * @param {string} config.endpoint - A string representing the full URL of the endpoint to be called.\n\t * @param {string} config.extensionVersion - A string representing the next public extension build ID, to specify the extension version in which to connect.\n\t * @param {boolean} [config.useCurrencyInLocale=false] - An optional boolean, default false. To be set to true if currency is required in config.locale, for example en-GB@EUR.\n\t * @param {string} [config.sessionLifetime=7776000000] - An optional number of milliseconds in which to persist the session lifeTime, to override the {@link DEFAULT_SESSION_LIFETIME} of 3 months.\n\t * @param {boolean} [options.customHeaderValue] - An optional string, the value to assign to a \"coFE-Custom-Configuration\" header value in every API call. Overriden on single calls by explicity set customHeaderValue passed in {@link callAction} and {@link PageApi} methods.\n\t * @param {CookieManager} [config.cookieHandlingOverride] - An optional cookie manager interface that contains all the cookie handling methods.\n\t * @param {RedactionManager | RedactionManagerConfig} [config.redactionHandlingOverride] - An optional class/object implementing the {@link RedactionManager} interface or {@link RedactionManagerConfig} to replace the default {@link defaultRedactionRules} passed to the inbuilt {@link RedactionHandler}.\n\t *\n\t * @returns {void} Void.\n\t */\n\tconfigure(config: SDKConfig) {\n\t\tdependencyContainer().configure({\n\t\t\tcookieHandler: config.cookieHandlingOverride ?? new CookieHandler(),\n\t\t\tredactHandler: this.isRedactionManager(\n\t\t\t\tconfig.redactionHandlingOverride\n\t\t\t)\n\t\t\t\t? config.redactionHandlingOverride\n\t\t\t\t: new RedactionHandler(\n\t\t\t\t\t\tconfig.redactionHandlingOverride ??\n\t\t\t\t\t\t\tdefaultRedactionRules\n\t\t\t\t  ),\n\t\t});\n\t\tthis.setEndpoint(config.endpoint);\n\t\tthis.configureLocale(config);\n\t\tthis._useCurrencyInLocale = config.useCurrencyInLocale ?? false;\n\t\tthis._extensionVersion = config.extensionVersion;\n\t\tthis._sessionLifetime =\n\t\t\tconfig.sessionLifetime ?? DEFAULT_SESSION_LIFETIME;\n\t\tthis._customHeaderValue = config.customHeaderValue;\n\n\t\tthis._hasBeenConfigured = true;\n\t}\n\n\t/**\n\t * Invalidates the current session by deleting session cookies and stopping the action queue.\n\t * Use this method during logout to prevent \"zombie sessions\" where stale session cookies persist.\n\t *\n\t * This method:\n\t * 1. Stops the action queue to prevent new requests from being queued\n\t * 2. Optionally waits for pending requests to complete\n\t * 3. Deletes the `frontastic-session` cookie\n\t * 4. Removes the `__rememberMe` cookie\n\t *\n\t * @param {Object} [options] - Optional configuration.\n\t * @param {ServerOptions} [options.serverOptions] - Server request/response objects for SSR.\n\t * @param {boolean} [options.waitForPending=true] - Whether to wait for pending requests to complete.\n\t * @param {number} [options.timeoutMs=5000] - Maximum time to wait for pending requests (ms).\n\t *\n\t * @returns {Promise<void>} Resolves when session is invalidated.\n\t *\n\t * @example\n\t * // Client-side logout\n\t * await sdk.invalidateSession();\n\t *\n\t * @example\n\t * // Server-side logout\n\t * await sdk.invalidateSession({ serverOptions: { req, res } });\n\t *\n\t * @example\n\t * // Immediate invalidation without waiting for pending requests\n\t * await sdk.invalidateSession({ waitForPending: false });\n\t */\n\tasync invalidateSession(options?: {\n\t\tserverOptions?: ServerOptions;\n\t\twaitForPending?: boolean;\n\t\ttimeoutMs?: number;\n\t}): Promise<void> {\n\t\tthis.throwIfNotConfigured();\n\n\t\tconst {\n\t\t\tserverOptions,\n\t\t\twaitForPending = true,\n\t\t\ttimeoutMs = 5000,\n\t\t} = options ?? {};\n\n\t\t// Stop the action queue to prevent new requests\n\t\tthis._actionQueue.stop();\n\n\t\t// Wait for pending requests to complete (with timeout)\n\t\tif (waitForPending) {\n\t\t\tawait this._actionQueue.flush(timeoutMs);\n\t\t}\n\n\t\t// Delete session cookies\n\t\tawait Promise.all([\n\t\t\tdependencyContainer()\n\t\t\t\t.cookieHandler()\n\t\t\t\t.deleteCookie(\"frontastic-session\", serverOptions),\n\t\t\trememberMeCookie.remove(serverOptions),\n\t\t]);\n\n\t\t// Restart the queue for potential re-login\n\t\tthis._actionQueue.restart();\n\t}\n\n\t/**\n\t * The method called to standardise the locale and currency inputs.\n\t *\n\t * @param {string} config.locale - A string representing the combination of the ISO 639-1 language and ISO 3166-1 country code. For example en-GB or en_GB.\n\t * @param {string} config.currency - A string representing the ISO 3-Letter Currency Code, for example EUR.\n\t *\n\t * @returns {void} Void.\n\t */\n\tconfigureLocale(config: Pick<SDKConfig, \"locale\" | \"currency\">) {\n\t\t// currency present in locale (posix modifier)\n\t\tconst [locale, currency] = config.locale.split(\"@\");\n\t\tif (currency) {\n\t\t\tthis._currency = currency as Currency;\n\t\t}\n\n\t\t// explicitly defined currency overrides that\n\t\tif (config.currency) {\n\t\t\tthis._currency = config.currency;\n\t\t}\n\n\t\tthis._locale = locale.replace(/_/g, \"-\");\n\t}\n\n\tprivate handleApiCall(options: HandleApiCallOptions) {\n\t\tconst specificEventName =\n\t\t\toptions.type === \"pageAPI\" ? \"pageApiMethodCalled\" : \"actionCalled\";\n\n\t\t// Performance: skip if no handlers registered\n\t\tif (\n\t\t\t!this.hasEventHandlers(specificEventName) &&\n\t\t\t!this.hasEventHandlers(\"fetchCalled\")\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Only clone the data that will be mutated by redaction\n\t\tconst redactHandler = dependencyContainer().redactHandler();\n\t\tconst redactedParameters = redactHandler.redact(\n\t\t\toptions.parameters ? { ...options.parameters } : {}\n\t\t);\n\t\tconst redactedUrl = redactHandler.redactUrl(options.url);\n\n\t\tconst baseEventData = {\n\t\t\t...(options.type === \"pageAPI\"\n\t\t\t\t? { method: options.method }\n\t\t\t\t: { actionName: options.actionName }),\n\t\t\tparameters: redactedParameters,\n\t\t\turl: redactedUrl,\n\t\t\ttracing: options.tracing,\n\t\t};\n\n\t\tif (this.hasEventHandlers(specificEventName)) {\n\t\t\tthis.trigger(\n\t\t\t\t// @ts-ignore\n\t\t\t\tnew Event({\n\t\t\t\t\teventName: specificEventName,\n\t\t\t\t\tdata: baseEventData,\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\n\t\tif (this.hasEventHandlers(\"fetchCalled\")) {\n\t\t\tthis.trigger(\n\t\t\t\t// @ts-ignore\n\t\t\t\tnew Event({\n\t\t\t\t\teventName: \"fetchCalled\",\n\t\t\t\t\tdata: { ...baseEventData, type: options.type },\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate handleSuccesfulCall(options: HandleSuccessfulFetchOptions) {\n\t\tconst specificEventName =\n\t\t\toptions.type === \"pageAPI\"\n\t\t\t\t? \"pageApiFetchSuccessful\"\n\t\t\t\t: \"actionFetchSuccessful\";\n\n\t\t// Performance: skip if no handlers registered\n\t\tif (\n\t\t\t!this.hasEventHandlers(specificEventName) &&\n\t\t\t!this.hasEventHandlers(\"fetchSuccessful\")\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Only clone/redact data that needs it - avoid deep cloning large response payloads\n\t\tconst redactHandler = dependencyContainer().redactHandler();\n\t\tconst redactedParameters = redactHandler.redact(\n\t\t\toptions.parameters ? { ...options.parameters } : {}\n\t\t);\n\t\tconst redactedUrl = redactHandler.redactUrl(options.url);\n\t\t// Deep clone dataResponse before redaction since redact() mutates its input\n\t\tconst redactedDataResponse = redactHandler.redact(\n\t\t\toptions.dataResponse ? JSON.parse(JSON.stringify(options.dataResponse)) : {}\n\t\t);\n\n\t\tconst baseEventData = {\n\t\t\t...(options.type === \"pageAPI\"\n\t\t\t\t? { method: options.method }\n\t\t\t\t: { actionName: options.actionName }),\n\t\t\tparameters: redactedParameters,\n\t\t\turl: redactedUrl,\n\t\t\tdataResponse: redactedDataResponse,\n\t\t\ttracing: options.tracing,\n\t\t};\n\n\t\tif (this.hasEventHandlers(specificEventName)) {\n\t\t\tthis.trigger(\n\t\t\t\t// @ts-ignore\n\t\t\t\tnew Event({\n\t\t\t\t\teventName: specificEventName,\n\t\t\t\t\tdata: baseEventData,\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\n\t\tif (this.hasEventHandlers(\"fetchSuccessful\")) {\n\t\t\tthis.trigger(\n\t\t\t\t// @ts-ignore\n\t\t\t\tnew Event({\n\t\t\t\t\teventName: \"fetchSuccessful\",\n\t\t\t\t\tdata: { ...baseEventData, type: options.type },\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate handleError<T>(options: HandleErrorCaughtOptions): SDKResponse<T> {\n\t\tconst specificEventName =\n\t\t\toptions.type === \"action\"\n\t\t\t\t? \"actionErrorCaught\"\n\t\t\t\t: \"pageApiErrorCaught\";\n\n\t\t// Performance: only process events if handlers exist\n\t\tconst hasSpecificHandler = this.hasEventHandlers(specificEventName);\n\t\tconst hasGenericHandler = this.hasEventHandlers(\"errorCaught\");\n\n\t\tif (hasSpecificHandler || hasGenericHandler) {\n\t\t\tconst redactHandler = dependencyContainer().redactHandler();\n\t\t\tconst redactedParameters = redactHandler.redact(\n\t\t\t\toptions.parameters ? { ...options.parameters } : {}\n\t\t\t);\n\t\t\tconst redactedUrl = redactHandler.redactUrl(options.url);\n\n\t\t\tconst baseEventData = {\n\t\t\t\t...(options.type === \"action\"\n\t\t\t\t\t? { actionName: options.actionName }\n\t\t\t\t\t: { method: options.method }),\n\t\t\t\tparameters: redactedParameters,\n\t\t\t\turl: redactedUrl,\n\t\t\t\ttracing: options.tracing,\n\t\t\t\terror: options.error,\n\t\t\t};\n\n\t\t\tif (hasSpecificHandler) {\n\t\t\t\tthis.trigger(\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\tnew Event({\n\t\t\t\t\t\teventName: specificEventName,\n\t\t\t\t\t\tdata: baseEventData,\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (hasGenericHandler) {\n\t\t\t\tthis.trigger(\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\tnew Event({\n\t\t\t\t\t\teventName: \"errorCaught\",\n\t\t\t\t\t\tdata: { ...baseEventData, type: options.type },\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tisError: true,\n\t\t\ttracing: options.tracing,\n\t\t\terror: options.error,\n\t\t};\n\t}\n\n\tprivate getDefaultAPIHeaders(customHeaderValue?: string) {\n\t\tconst customValue = customHeaderValue ?? this._customHeaderValue;\n\t\tconst customHeader: {\n\t\t\t\"coFE-Custom-Configuration\"?: string;\n\t\t} = customValue ? { \"coFE-Custom-Configuration\": customValue } : {};\n\t\treturn {\n\t\t\t\"Frontastic-Locale\": this.apiHubLocale(),\n\t\t\t\"Frontastic-Currency\": this._currency,\n\t\t\t\"Commercetools-Frontend-Extension-Version\": this._extensionVersion,\n\t\t\t...customHeader,\n\t\t};\n\t}\n\n\t/**\n\t * The method used to call extension actions.\n\t *\n\t * @param {string} options.actionName - The name of the action corresponding to the location of the extension, for example \"product/getProduct\".\n\t * @param {unknown} [options.payload] - An optional key, value pair object payload to be serialised into the body of the request.\n\t * @param {Object.<string, number, boolean, string[], number[], boolean[]>} [options.query] - An optional key, value pair object to be serialised into the url query.\n\t * @param {boolean} [options.parallel] - An optional boolean, default true indicating whether the action should executed asyncronously or be added to a queue and executed in sequence. Useful to supply false on actions you may think have race conditions.\n\t * @param {string} [options.customHeaderValue] - An optional string, the value to assign to a \"coFE-Custom-Configuration\" header value. Overrides customHeaderValue passed in {@link configure}.\n\t * @param {Object} [options.serverOptions] - An optional object containing the res and req objects for ServerResponse and IncomingMessage with cookies respectively. Required for server-side rendering session management.\n\t *\n\t * @returns {PromiseLike<Object>} An object with a boolean isError property, and either an error or data property for true and false respectively. Type of data will match generic argument supplied to method.\n\t */\n\tasync callAction<ReturnData>(options: {\n\t\tactionName: string;\n\t\tpayload?: AcceptedPayloadTypes;\n\t\tquery?: AcceptedQueryTypes;\n\t\tparallel?: boolean;\n\t\tcustomHeaderValue?: string;\n\t\tserverOptions?: ServerOptions;\n\t}): Promise<SDKResponse<ReturnData>> {\n\t\tthis.throwIfNotConfigured();\n\t\tconst params = options.query ? generateQueryString(options.query) : \"\";\n\t\tconst fetcherOptions = {\n\t\t\tmethod: \"POST\",\n\t\t\tbody: JSON.stringify(options.payload ?? {}),\n\t\t\theaders: this.getDefaultAPIHeaders(options.customHeaderValue),\n\t\t};\n\n\t\tlet response: FetcherResponse<ReturnData>;\n\t\tconst url = normaliseUrl(\n\t\t\t`${this._endpoint}/frontastic/action/${options.actionName}${params}`\n\t\t);\n\t\tconst action = () =>\n\t\t\tfetcher<ReturnData>(\n\t\t\t\turl,\n\t\t\t\tfetcherOptions,\n\t\t\t\toptions.serverOptions,\n\t\t\t\tthis._sessionLifetime\n\t\t\t);\n\n\t\tconst frontendRequestId = Guid.NewGuid();\n\t\tthis.handleApiCall({\n\t\t\ttype: \"action\",\n\t\t\tactionName: options.actionName,\n\t\t\tparameters: {\n\t\t\t\tquery: options.query,\n\t\t\t\tbody: options.payload,\n\t\t\t},\n\t\t\turl,\n\t\t\ttracing: {\n\t\t\t\tfrontendRequestId,\n\t\t\t},\n\t\t});\n\n\t\ttry {\n\t\t\tif (options.parallel === false) {\n\t\t\t\tresponse = await this._actionQueue.add<ReturnData>(action);\n\t\t\t} else {\n\t\t\t\tresponse = await action();\n\t\t\t}\n\t\t} catch (error) {\n\t\t\treturn this.handleError<ReturnData>({\n\t\t\t\ttype: \"action\",\n\t\t\t\tparameters: {\n\t\t\t\t\tquery: options.query,\n\t\t\t\t\tbody: options.payload,\n\t\t\t\t},\n\t\t\t\turl,\n\t\t\t\tactionName: options.actionName,\n\t\t\t\ttracing: {\n\t\t\t\t\tfrontendRequestId,\n\t\t\t\t\tfrontasticRequestId: \"\",\n\t\t\t\t},\n\t\t\t\terror: new ActionError({\n\t\t\t\t\terror: error as Error,\n\t\t\t\t}),\n\t\t\t});\n\t\t}\n\t\tif (response.isError) {\n\t\t\treturn this.handleError<ReturnData>({\n\t\t\t\ttype: \"action\",\n\t\t\t\tparameters: {\n\t\t\t\t\tquery: options.query,\n\t\t\t\t\tbody: options.payload,\n\t\t\t\t},\n\t\t\t\turl,\n\t\t\t\tactionName: options.actionName,\n\t\t\t\ttracing: {\n\t\t\t\t\tfrontendRequestId,\n\t\t\t\t\tfrontasticRequestId: response.frontasticRequestId,\n\t\t\t\t},\n\t\t\t\terror: new ActionError({\n\t\t\t\t\terror: response.error,\n\t\t\t\t}),\n\t\t\t});\n\t\t}\n\n\t\tthis.handleSuccesfulCall({\n\t\t\ttype: \"action\",\n\t\t\tactionName: options.actionName,\n\t\t\tparameters: {\n\t\t\t\tquery: options.query,\n\t\t\t\tbody: options.payload,\n\t\t\t},\n\t\t\turl,\n\t\t\tdataResponse: response.data,\n\t\t\ttracing: {\n\t\t\t\tfrontendRequestId,\n\t\t\t\tfrontasticRequestId: response.frontasticRequestId,\n\t\t\t},\n\t\t});\n\n\t\treturn {\n\t\t\tisError: false,\n\t\t\ttracing: {\n\t\t\t\tfrontendRequestId,\n\t\t\t\tfrontasticRequestId: response.frontasticRequestId,\n\t\t\t},\n\t\t\tdata: response.data,\n\t\t};\n\t}\n\n\t/**\n\t * The domain to call page methods on the API hub.\n\t */\n\tpage: PageApi = {\n\t\tgetPage: async (options: {\n\t\t\tpath: string;\n\t\t\tquery?: AcceptedQueryTypes;\n\t\t\tcustomHeaderValue?: string;\n\t\t\tserverOptions?: ServerOptions;\n\t\t}) => {\n\t\t\tthis.throwIfNotConfigured();\n\t\t\tconst params = options.query\n\t\t\t\t? generateQueryString(options.query)\n\t\t\t\t: \"\";\n\t\t\tconst fetcherOptions = {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\theaders: {\n\t\t\t\t\t\"Frontastic-Path\": options.path,\n\t\t\t\t\t...this.getDefaultAPIHeaders(options.customHeaderValue),\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tlet response: FetcherResponse<PageResponse | RedirectResponse>;\n\t\t\tconst url = normaliseUrl(\n\t\t\t\t`${this._endpoint}/frontastic/page${params}`\n\t\t\t);\n\n\t\t\tconst frontendRequestId = Guid.NewGuid();\n\t\t\tthis.handleApiCall({\n\t\t\t\ttype: \"pageAPI\",\n\t\t\t\tmethod: \"getPage\",\n\t\t\t\tparameters: {\n\t\t\t\t\tquery: options.query,\n\t\t\t\t},\n\t\t\t\turl,\n\t\t\t\ttracing: {\n\t\t\t\t\tfrontendRequestId,\n\t\t\t\t},\n\t\t\t});\n\n\t\t\ttry {\n\t\t\t\tresponse = await fetcher<PageResponse | RedirectResponse>(\n\t\t\t\t\turl,\n\t\t\t\t\tfetcherOptions,\n\t\t\t\t\toptions.serverOptions,\n\t\t\t\t\tthis._sessionLifetime\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\treturn this.handleError<PageResponse | RedirectResponse>({\n\t\t\t\t\ttype: \"pageAPI\",\n\t\t\t\t\tparameters: {\n\t\t\t\t\t\tquery: options.query,\n\t\t\t\t\t},\n\t\t\t\t\turl,\n\t\t\t\t\tmethod: \"getPage\",\n\t\t\t\t\ttracing: {\n\t\t\t\t\t\tfrontendRequestId,\n\t\t\t\t\t\tfrontasticRequestId: \"\",\n\t\t\t\t\t},\n\t\t\t\t\terror: new ActionError({\n\t\t\t\t\t\terror: error as Error,\n\t\t\t\t\t}),\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (response.isError) {\n\t\t\t\treturn this.handleError<PageResponse | RedirectResponse>({\n\t\t\t\t\ttype: \"pageAPI\",\n\t\t\t\t\tparameters: {\n\t\t\t\t\t\tquery: options.query,\n\t\t\t\t\t},\n\t\t\t\t\turl,\n\t\t\t\t\tmethod: \"getPage\",\n\t\t\t\t\ttracing: {\n\t\t\t\t\t\tfrontendRequestId,\n\t\t\t\t\t\tfrontasticRequestId: response.frontasticRequestId,\n\t\t\t\t\t},\n\t\t\t\t\terror: new ActionError({\n\t\t\t\t\t\terror: response.error,\n\t\t\t\t\t}),\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.handleSuccesfulCall({\n\t\t\t\ttype: \"pageAPI\",\n\t\t\t\tmethod: \"getPage\",\n\t\t\t\tparameters: {\n\t\t\t\t\tquery: options.query,\n\t\t\t\t},\n\t\t\t\turl,\n\t\t\t\tdataResponse: response.data,\n\t\t\t\ttracing: {\n\t\t\t\t\tfrontendRequestId,\n\t\t\t\t\tfrontasticRequestId: response.frontasticRequestId,\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\tisError: false,\n\t\t\t\ttracing: {\n\t\t\t\t\tfrontendRequestId,\n\t\t\t\t\tfrontasticRequestId: response.frontasticRequestId,\n\t\t\t\t},\n\t\t\t\tdata: response.data,\n\t\t\t};\n\t\t},\n\t\tgetPreview: async (options: {\n\t\t\tpreviewId: string;\n\t\t\tcustomHeaderValue?: string;\n\t\t\tserverOptions?: ServerOptions;\n\t\t}) => {\n\t\t\tthis.throwIfNotConfigured();\n\t\t\tconst fetcherOptions = {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\theaders: this.getDefaultAPIHeaders(options.customHeaderValue),\n\t\t\t};\n\t\t\tlet response: FetcherResponse<PagePreviewResponse>;\n\t\t\tconst query = {\n\t\t\t\tpreviewId: options.previewId,\n\t\t\t\tlocale: this.apiHubLocale(),\n\t\t\t};\n\t\t\tconst url = normaliseUrl(\n\t\t\t\t`${this._endpoint}/frontastic/preview${generateQueryString(\n\t\t\t\t\tquery\n\t\t\t\t)}`\n\t\t\t);\n\n\t\t\tconst frontendRequestId = Guid.NewGuid();\n\t\t\tthis.handleApiCall({\n\t\t\t\ttype: \"pageAPI\",\n\t\t\t\tmethod: \"getPreview\",\n\t\t\t\tparameters: {\n\t\t\t\t\tquery,\n\t\t\t\t},\n\t\t\t\turl,\n\t\t\t\ttracing: {\n\t\t\t\t\tfrontendRequestId,\n\t\t\t\t},\n\t\t\t});\n\n\t\t\ttry {\n\t\t\t\tresponse = await fetcher<PagePreviewResponse>(\n\t\t\t\t\turl,\n\t\t\t\t\tfetcherOptions,\n\t\t\t\t\toptions.serverOptions,\n\t\t\t\t\tthis._sessionLifetime\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\treturn this.handleError<PagePreviewResponse>({\n\t\t\t\t\ttype: \"pageAPI\",\n\t\t\t\t\tparameters: {\n\t\t\t\t\t\tquery,\n\t\t\t\t\t},\n\t\t\t\t\turl,\n\t\t\t\t\tmethod: \"getPreview\",\n\t\t\t\t\ttracing: {\n\t\t\t\t\t\tfrontendRequestId,\n\t\t\t\t\t\tfrontasticRequestId: \"\",\n\t\t\t\t\t},\n\t\t\t\t\terror: new ActionError({\n\t\t\t\t\t\terror: error as Error,\n\t\t\t\t\t}),\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (response.isError) {\n\t\t\t\treturn this.handleError<PagePreviewResponse>({\n\t\t\t\t\ttype: \"pageAPI\",\n\t\t\t\t\tparameters: {\n\t\t\t\t\t\tquery,\n\t\t\t\t\t},\n\t\t\t\t\turl,\n\t\t\t\t\tmethod: \"getPreview\",\n\t\t\t\t\ttracing: {\n\t\t\t\t\t\tfrontendRequestId,\n\t\t\t\t\t\tfrontasticRequestId: response.frontasticRequestId,\n\t\t\t\t\t},\n\t\t\t\t\terror: new ActionError({\n\t\t\t\t\t\terror: response.error,\n\t\t\t\t\t}),\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.handleSuccesfulCall({\n\t\t\t\ttype: \"pageAPI\",\n\t\t\t\tmethod: \"getPreview\",\n\t\t\t\tparameters: {\n\t\t\t\t\tquery,\n\t\t\t\t},\n\t\t\t\turl,\n\t\t\t\tdataResponse: response.data,\n\t\t\t\ttracing: {\n\t\t\t\t\tfrontendRequestId,\n\t\t\t\t\tfrontasticRequestId: response.frontasticRequestId,\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\tisError: false,\n\t\t\t\ttracing: {\n\t\t\t\t\tfrontendRequestId,\n\t\t\t\t\tfrontasticRequestId: response.frontasticRequestId,\n\t\t\t\t},\n\t\t\t\tdata: response.data,\n\t\t\t};\n\t\t},\n\t\tgetPages: async (\n\t\t\toptions: {\n\t\t\t\tpath?: string;\n\t\t\t\tdepth?: number;\n\t\t\t\ttypes?: \"static\";\n\t\t\t\tcustomHeaderValue?: string;\n\t\t\t\tserverOptions?: ServerOptions;\n\t\t\t} = {\n\t\t\t\tdepth: 16,\n\t\t\t\ttypes: \"static\",\n\t\t\t}\n\t\t) => {\n\t\t\tthis.throwIfNotConfigured();\n\t\t\toptions.depth = options.depth ?? 16;\n\t\t\toptions.types = options.types ?? \"static\";\n\t\t\tconst fetcherOptions = {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\theaders: this.getDefaultAPIHeaders(options.customHeaderValue),\n\t\t\t};\n\n\t\t\tlet response: FetcherResponse<PageFolderListResponse>;\n\n\t\t\tconst query = {\n\t\t\t\tlocale: this.apiHubLocale(),\n\t\t\t\tpath: options.path ?? \"\",\n\t\t\t\tdepth: options.depth,\n\t\t\t};\n\t\t\tconst url = normaliseUrl(\n\t\t\t\t`${this._endpoint}/frontastic/structure${generateQueryString(\n\t\t\t\t\tquery\n\t\t\t\t)}`\n\t\t\t);\n\n\t\t\tconst frontendRequestId = Guid.NewGuid();\n\t\t\tthis.handleApiCall({\n\t\t\t\ttype: \"pageAPI\",\n\t\t\t\tmethod: \"getPages\",\n\t\t\t\tparameters: {\n\t\t\t\t\tquery,\n\t\t\t\t},\n\t\t\t\turl,\n\t\t\t\ttracing: {\n\t\t\t\t\tfrontendRequestId,\n\t\t\t\t},\n\t\t\t});\n\n\t\t\ttry {\n\t\t\t\tresponse = await fetcher<PageFolderListResponse>(\n\t\t\t\t\turl,\n\t\t\t\t\tfetcherOptions,\n\t\t\t\t\toptions.serverOptions,\n\t\t\t\t\tthis._sessionLifetime\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\treturn this.handleError<PageFolderListResponse>({\n\t\t\t\t\ttype: \"pageAPI\",\n\t\t\t\t\tparameters: {\n\t\t\t\t\t\tquery,\n\t\t\t\t\t},\n\t\t\t\t\turl,\n\t\t\t\t\tmethod: \"getPages\",\n\t\t\t\t\ttracing: {\n\t\t\t\t\t\tfrontendRequestId,\n\t\t\t\t\t\tfrontasticRequestId: \"\",\n\t\t\t\t\t},\n\t\t\t\t\terror: new ActionError({\n\t\t\t\t\t\terror: error as Error,\n\t\t\t\t\t}),\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (response.isError) {\n\t\t\t\treturn this.handleError<PageFolderListResponse>({\n\t\t\t\t\ttype: \"pageAPI\",\n\t\t\t\t\tparameters: {\n\t\t\t\t\t\tquery,\n\t\t\t\t\t},\n\t\t\t\t\turl,\n\t\t\t\t\tmethod: \"getPages\",\n\t\t\t\t\ttracing: {\n\t\t\t\t\t\tfrontendRequestId,\n\t\t\t\t\t\tfrontasticRequestId: response.frontasticRequestId,\n\t\t\t\t\t},\n\t\t\t\t\terror: new ActionError({\n\t\t\t\t\t\terror: response.error,\n\t\t\t\t\t}),\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.handleSuccesfulCall({\n\t\t\t\ttype: \"pageAPI\",\n\t\t\t\tmethod: \"getPages\",\n\t\t\t\tparameters: {\n\t\t\t\t\tquery,\n\t\t\t\t},\n\t\t\t\turl,\n\t\t\t\tdataResponse: response.data,\n\t\t\t\ttracing: {\n\t\t\t\t\tfrontendRequestId,\n\t\t\t\t\tfrontasticRequestId: response.frontasticRequestId,\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\tisError: false,\n\t\t\t\ttracing: {\n\t\t\t\t\tfrontendRequestId,\n\t\t\t\t\tfrontasticRequestId: response.frontasticRequestId,\n\t\t\t\t},\n\t\t\t\tdata: <PageFol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