@getuserfeedback/sdk 0.15.2 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"import type { InlineFlow } from \"@getuserfeedback/protocol/internal/inline-flow\";\nimport type { InlineFlowRun } from \"./inline-flow\";\n\n/** @internal Versioned package bridge shared by the SDK root and internal entry. */\nexport type InlineFlowClientBridge = {\n\tcreateInlineFlowRun: (flow: InlineFlow) => InlineFlowRun;\n};\n\n// This bridge is package compatibility, not caller authorization. Same-window\n// host code already owns the realm in which the SDK and Loader execute.\nconst INLINE_FLOW_CLIENT_BRIDGE_SYMBOL = Symbol.for(\n\t\"@getuserfeedback/sdk/internal/inline-flow-client-bridge/1\",\n);\n\nexport const attachInlineFlowClientBridge = (\n\tclient: object,\n\tbridge: InlineFlowClientBridge,\n): void => {\n\tObject.defineProperty(client, INLINE_FLOW_CLIENT_BRIDGE_SYMBOL, {\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\tvalue: bridge,\n\t\twritable: false,\n\t});\n};\n\nexport const getInlineFlowClientBridge = (\n\tclient: object,\n): InlineFlowClientBridge => {\n\tconst bridge = Reflect.get(client, INLINE_FLOW_CLIENT_BRIDGE_SYMBOL);\n\tif (\n\t\ttypeof bridge !== \"object\" ||\n\t\tbridge === null ||\n\t\t!(\"createInlineFlowRun\" in bridge) ||\n\t\ttypeof Reflect.get(bridge, \"createInlineFlowRun\") !== \"function\"\n\t) {\n\t\tthrow new Error(\n\t\t\t\"Inline flows require a compatible client created by @getuserfeedback/sdk.\",\n\t\t);\n\t}\n\treturn bridge as InlineFlowClientBridge;\n};\n",
|
|
17
17
|
"type TransportAdmissionResult<TResult> =\n\t| { status: \"superseded\" }\n\t| { status: \"settled\"; result: TResult };\n\ntype TransportHandoff<TResult> = {\n\tsettlement: Promise<TResult>;\n};\n\ntype TransportOperationScope = {\n\tattemptHandoff<TResult>(options: {\n\t\tprepare: () => void | Promise<void>;\n\t\thandOff: () => TransportHandoff<TResult>;\n\t}): Promise<TResult>;\n};\n\ntype BarrierGate = {\n\tstate: \"pending\" | \"resolved\" | \"rejected\";\n\tfallback: BarrierGate | null;\n\tpromise: Promise<void>;\n\tresolve: () => void;\n\treject: (error: unknown) => void;\n};\n\ntype OrderGate = {\n\tstate: \"pending\" | \"resolved\";\n\tpromise: Promise<void>;\n\tresolve: () => void;\n};\n\ntype OperationState =\n\t| \"registered\"\n\t| \"preparing\"\n\t| \"handing-off\"\n\t| \"handed-off\"\n\t| \"settlement-failed\"\n\t| \"handoff-failed\"\n\t| \"attempt-settled\"\n\t| \"settled\";\n\ntype PendingOperation = {\n\tgeneration: number;\n\tbarrierGate: BarrierGate;\n\tstate: OperationState;\n\tactiveAttempt: boolean;\n\tattemptCount: number;\n\teverHandedOff: boolean;\n\thasLastSettlementError: boolean;\n\tlastSettlementError?: unknown;\n\tsuperseded: boolean;\n\touterSettled: boolean;\n\tsettleAfterBarrier: () => void;\n};\n\nconst OPERATION_SUPERSEDED = Symbol(\"operation-superseded\");\n\nconst createBarrierGate = (fallback: BarrierGate): BarrierGate => {\n\tlet resolvePromise: (() => void) | undefined;\n\tlet rejectPromise: ((error: unknown) => void) | undefined;\n\tconst promise = new Promise<void>((resolve, reject) => {\n\t\tresolvePromise = resolve;\n\t\trejectPromise = reject;\n\t});\n\tlet settled = false;\n\tconst gate: BarrierGate = {\n\t\tstate: \"pending\",\n\t\tfallback,\n\t\tpromise,\n\t\tresolve: () => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tgate.state = \"resolved\";\n\t\t\tresolvePromise?.();\n\t\t},\n\t\treject: (error) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tgate.state = \"rejected\";\n\t\t\trejectPromise?.(error);\n\t\t},\n\t};\n\treturn gate;\n};\n\nconst RESOLVED_BARRIER_GATE: BarrierGate = {\n\tstate: \"resolved\",\n\tfallback: null,\n\tpromise: Promise.resolve(),\n\tresolve: () => {},\n\treject: () => {},\n};\n\nconst createOrderGate = (resolved = false): OrderGate => {\n\tlet resolvePromise: (() => void) | undefined;\n\tconst promise = new Promise<void>((resolve) => {\n\t\tresolvePromise = resolve;\n\t});\n\tconst gate: OrderGate = {\n\t\tstate: resolved ? \"resolved\" : \"pending\",\n\t\tpromise: resolved ? Promise.resolve() : promise,\n\t\tresolve: () => {\n\t\t\tif (gate.state === \"resolved\") return;\n\t\t\tgate.state = \"resolved\";\n\t\t\tresolvePromise?.();\n\t\t},\n\t};\n\treturn gate;\n};\n\nconst isPromiseLike = (value: unknown): value is PromiseLike<void> =>\n\ttypeof value === \"object\" &&\n\tvalue !== null &&\n\t\"then\" in value &&\n\ttypeof value.then === \"function\";\n\n/**\n * Owns caller-generation admission before the SDK hands a command to its host.\n * Handle FIFO, stale classification, and settlement publication remain with the\n * Flow command controller.\n *\n * @see docs/specs/2026-08-02-flow-interaction-model.md\n */\nexport const createClientTransportAdmission = () => {\n\tlet generation = 0;\n\tlet latestBarrierGate = RESOLVED_BARRIER_GATE;\n\tlet barrierOrderTail = createOrderGate(true);\n\tconst pendingOperations = new Set<PendingOperation>();\n\n\tconst runOperation = <TResult>(\n\t\texecute: (scope: TransportOperationScope) => Promise<TResult>,\n\t): Promise<TransportAdmissionResult<TResult>> => {\n\t\tlet resolveBarrierOutcome:\n\t\t\t| ((result: TransportAdmissionResult<TResult>) => void)\n\t\t\t| undefined;\n\t\tlet rejectBarrierOutcome: ((error: unknown) => void) | undefined;\n\t\tconst barrierOutcome = new Promise<TransportAdmissionResult<TResult>>(\n\t\t\t(resolve, reject) => {\n\t\t\t\tresolveBarrierOutcome = resolve;\n\t\t\t\trejectBarrierOutcome = reject;\n\t\t\t},\n\t\t);\n\t\tconst operation: PendingOperation = {\n\t\t\tgeneration,\n\t\t\tbarrierGate: latestBarrierGate,\n\t\t\tstate: \"registered\",\n\t\t\tactiveAttempt: false,\n\t\t\tattemptCount: 0,\n\t\t\teverHandedOff: false,\n\t\t\thasLastSettlementError: false,\n\t\t\tsuperseded: false,\n\t\t\touterSettled: false,\n\t\t\tsettleAfterBarrier: () => {\n\t\t\t\tif (operation.everHandedOff && operation.hasLastSettlementError) {\n\t\t\t\t\trejectBarrierOutcome?.(operation.lastSettlementError);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tresolveBarrierOutcome?.({ status: \"superseded\" });\n\t\t\t},\n\t\t};\n\t\tpendingOperations.add(operation);\n\n\t\tconst throwSuperseded = (): never => {\n\t\t\tif (operation.everHandedOff && operation.hasLastSettlementError) {\n\t\t\t\tthrow operation.lastSettlementError;\n\t\t\t}\n\t\t\tthrow OPERATION_SUPERSEDED;\n\t\t};\n\t\tconst assertCurrent = (): void => {\n\t\t\tif (operation.outerSettled) {\n\t\t\t\tthrow new Error(\"Transport operation has already settled\");\n\t\t\t}\n\t\t\tif (operation.superseded || operation.generation !== generation) {\n\t\t\t\tthrowSuperseded();\n\t\t\t}\n\t\t};\n\n\t\tconst attemptHandoff: TransportOperationScope[\"attemptHandoff\"] = async <\n\t\t\tTHandoffResult,\n\t\t>({\n\t\t\tprepare,\n\t\t\thandOff,\n\t\t}: {\n\t\t\tprepare: () => void | Promise<void>;\n\t\t\thandOff: () => TransportHandoff<THandoffResult>;\n\t\t}): Promise<THandoffResult> => {\n\t\t\tassertCurrent();\n\t\t\tif (operation.activeAttempt) {\n\t\t\t\tthrow new Error(\"A transport handoff attempt is already active\");\n\t\t\t}\n\t\t\tif (\n\t\t\t\toperation.attemptCount > 0 &&\n\t\t\t\toperation.state !== \"settlement-failed\"\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"A transport handoff may retry only after a failed settlement\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (operation.attemptCount >= 2) {\n\t\t\t\tthrow new Error(\"A transport operation may retry at most once\");\n\t\t\t}\n\n\t\t\toperation.activeAttempt = true;\n\t\t\toperation.attemptCount += 1;\n\t\t\toperation.state = \"preparing\";\n\t\t\ttry {\n\t\t\t\tif (operation.barrierGate.state !== \"resolved\") {\n\t\t\t\t\tawait operation.barrierGate.promise;\n\t\t\t\t}\n\t\t\t\tassertCurrent();\n\t\t\t\tconst preparation = prepare();\n\t\t\t\tif (isPromiseLike(preparation)) {\n\t\t\t\t\tawait preparation;\n\t\t\t\t}\n\t\t\t\tassertCurrent();\n\t\t\t\toperation.state = \"handing-off\";\n\t\t\t\tlet settlement: Promise<THandoffResult>;\n\t\t\t\ttry {\n\t\t\t\t\tsettlement = handOff().settlement;\n\t\t\t\t} catch (error) {\n\t\t\t\t\toperation.activeAttempt = false;\n\t\t\t\t\toperation.state = \"handoff-failed\";\n\t\t\t\t\tif (operation.superseded || operation.generation !== generation) {\n\t\t\t\t\t\toperation.settleAfterBarrier();\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\n\t\t\t\toperation.everHandedOff = true;\n\t\t\t\toperation.state = \"handed-off\";\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await settlement;\n\t\t\t\t\toperation.activeAttempt = false;\n\t\t\t\t\toperation.hasLastSettlementError = false;\n\t\t\t\t\toperation.lastSettlementError = undefined;\n\t\t\t\t\toperation.state = \"attempt-settled\";\n\t\t\t\t\treturn result;\n\t\t\t\t} catch (error) {\n\t\t\t\t\toperation.activeAttempt = false;\n\t\t\t\t\toperation.hasLastSettlementError = true;\n\t\t\t\t\toperation.lastSettlementError = error;\n\t\t\t\t\toperation.state = \"settlement-failed\";\n\t\t\t\t\tif (operation.superseded || operation.generation !== generation) {\n\t\t\t\t\t\toperation.settleAfterBarrier();\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (operation.activeAttempt) {\n\t\t\t\t\toperation.activeAttempt = false;\n\t\t\t\t\toperation.state = \"handoff-failed\";\n\t\t\t\t}\n\t\t\t\tif (operation.superseded || operation.generation !== generation) {\n\t\t\t\t\toperation.settleAfterBarrier();\n\t\t\t\t\tthrowSuperseded();\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t};\n\n\t\tlet internalRun: Promise<TResult>;\n\t\ttry {\n\t\t\tinternalRun = Promise.resolve(execute({ attemptHandoff }));\n\t\t} catch (error) {\n\t\t\tinternalRun = Promise.reject(error);\n\t\t}\n\t\tconst observedRun: Promise<TransportAdmissionResult<TResult>> =\n\t\t\tinternalRun.then(\n\t\t\t\t(result) => {\n\t\t\t\t\toperation.outerSettled = true;\n\t\t\t\t\toperation.state = \"settled\";\n\t\t\t\t\tpendingOperations.delete(operation);\n\t\t\t\t\treturn { status: \"settled\" as const, result };\n\t\t\t\t},\n\t\t\t\t(error) => {\n\t\t\t\t\toperation.outerSettled = true;\n\t\t\t\t\toperation.state = \"settled\";\n\t\t\t\t\tpendingOperations.delete(operation);\n\t\t\t\t\tif (error === OPERATION_SUPERSEDED && !operation.everHandedOff) {\n\t\t\t\t\t\treturn { status: \"superseded\" as const };\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t},\n\t\t\t);\n\n\t\treturn Promise.race([observedRun, barrierOutcome]);\n\t};\n\n\tconst runBarrier = <TResult>({\n\t\tonGenerationAdvanced,\n\t\tprepare,\n\t\thandOff,\n\t}: {\n\t\tonGenerationAdvanced: () => void;\n\t\tprepare: () => void | Promise<void>;\n\t\thandOff: () => TransportHandoff<TResult>;\n\t}): Promise<TResult> => {\n\t\tgeneration += 1;\n\t\tconst previousOrderTail = barrierOrderTail;\n\t\tconst previousAdmissionGate = latestBarrierGate;\n\t\tconst currentOrderTail = createOrderGate();\n\t\tbarrierOrderTail = currentOrderTail;\n\t\tconst currentGate = createBarrierGate(previousAdmissionGate);\n\t\tlatestBarrierGate = currentGate;\n\t\tvoid currentGate.promise.catch(() => {});\n\n\t\tfor (const operation of pendingOperations) {\n\t\t\tif (operation.generation >= generation) continue;\n\t\t\toperation.superseded = true;\n\t\t\tif (\n\t\t\t\toperation.state !== \"handing-off\" &&\n\t\t\t\toperation.state !== \"handed-off\" &&\n\t\t\t\toperation.state !== \"attempt-settled\"\n\t\t\t) {\n\t\t\t\toperation.settleAfterBarrier();\n\t\t\t}\n\t\t}\n\n\t\tconst rejectAdmissionGate = (error: unknown): void => {\n\t\t\tcurrentGate.reject(error);\n\t\t\tif (latestBarrierGate === currentGate) {\n\t\t\t\tlet fallback = previousAdmissionGate;\n\t\t\t\twhile (fallback.state === \"rejected\" && fallback.fallback) {\n\t\t\t\t\tfallback = fallback.fallback;\n\t\t\t\t}\n\t\t\t\tlatestBarrierGate = fallback;\n\t\t\t}\n\t\t};\n\n\t\ttry {\n\t\t\tonGenerationAdvanced();\n\t\t} catch (error) {\n\t\t\trejectAdmissionGate(error);\n\t\t\tif (previousOrderTail.state === \"resolved\") {\n\t\t\t\tcurrentOrderTail.resolve();\n\t\t\t} else {\n\t\t\t\tvoid previousOrderTail.promise.then(currentOrderTail.resolve);\n\t\t\t}\n\t\t\treturn Promise.reject(error);\n\t\t}\n\n\t\tconst performHandoff = (): Promise<TResult> => {\n\t\t\tlet settlement: Promise<TResult>;\n\t\t\ttry {\n\t\t\t\tsettlement = handOff().settlement;\n\t\t\t} catch (error) {\n\t\t\t\trejectAdmissionGate(error);\n\t\t\t\tcurrentOrderTail.resolve();\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tcurrentGate.fallback = null;\n\t\t\tcurrentGate.resolve();\n\t\t\tcurrentOrderTail.resolve();\n\t\t\treturn settlement;\n\t\t};\n\t\tconst prepareAndHandOff = (): Promise<TResult> => {\n\t\t\ttry {\n\t\t\t\tconst preparation = prepare();\n\t\t\t\tif (isPromiseLike(preparation)) {\n\t\t\t\t\treturn Promise.resolve(preparation).then(performHandoff, (error) => {\n\t\t\t\t\t\trejectAdmissionGate(error);\n\t\t\t\t\t\tcurrentOrderTail.resolve();\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn performHandoff();\n\t\t\t} catch (error) {\n\t\t\t\trejectAdmissionGate(error);\n\t\t\t\tcurrentOrderTail.resolve();\n\t\t\t\treturn Promise.reject(error);\n\t\t\t}\n\t\t};\n\n\t\treturn previousOrderTail.state === \"resolved\"\n\t\t\t? prepareAndHandOff()\n\t\t\t: previousOrderTail.promise.then(prepareAndHandOff);\n\t};\n\n\treturn { runOperation, runBarrier };\n};\n",
|
|
18
18
|
"declare const __GX_SDK_VERSION__: string | undefined;\n\nconst sdkVersion =\n\ttypeof __GX_SDK_VERSION__ === \"string\" ? __GX_SDK_VERSION__.trim() : \"\";\n\n// Build scripts inject __GX_SDK_VERSION__ for published artifacts.\n// Source-linked workspace usage may not inject defines, so keep a safe fallback.\nexport const SDK_VERSION = sdkVersion.length > 0 ? sdkVersion : \"0.0.0-local\";\n",
|
|
19
|
-
"import type {\n\tCaptureInstanceFeedbackRequest,\n\tCaptureInstanceFeedbackResponse,\n\tListInstanceFeedbackMineRequest,\n\tListInstanceFeedbackMineResponse,\n} from \"@getuserfeedback/protocol\";\nimport {\n\ttype AppEventCapability,\n\ttype AppEventFlag,\n\tassertNoSegmentExternalIdsInValueArgument,\n\ttype CapabilitiesInput,\n\ttype ClientMeta,\n\ttype ClientOptions,\n\ttype Command,\n\ttype CommandEnvelope,\n\tCommandSettlementError,\n\tCommandSettlementTimeoutError,\n\ttype ConfigureOptions,\n\ttype ContainerPolicy,\n\tcreateCommandEnvelope,\n\tcreateCommandRequestId,\n\tcreateCommandSettlementDispatch,\n\tcreateFlowCommandHandleController,\n\tFLOW_LAYOUT_UPDATES_CAPABILITY,\n\ttype FlagsInput,\n\ttype FlowLayoutUpdatedDetail,\n\tgetFeedbackReadFromSettlementDetail,\n\tgetFeedbackSubmissionFromSettlementDetail,\n\tgetFlowHandleFromSettlementDetail,\n\ttype FlowRenderState as HostFlowRenderState,\n\ttype IdentifyOptions,\n\ttype InitOptions,\n\tLOADER_RUNTIME_GLOBAL_KEY,\n\tLOADER_RUNTIME_PROTOCOL_VERSION,\n\tOPEN_URL_ACTION_CAPABILITY,\n\tOPEN_URL_ACTION_V1_CAPABILITY,\n\tOPEN_URL_ACTION_VERSION,\n\ttype ResponseMetadataInput,\n\tSDK_PROTOCOL_CAPABILITIES,\n\ttype WidgetLayoutTimedTransitionPolicy,\n\ttype WidgetLayoutTransitionPolicy,\n\twaitForCommandSettlement,\n} from \"@getuserfeedback/protocol/host\";\nimport { UNIFIED_FLOW_RUNTIME_V1_CAPABILITY } from \"@getuserfeedback/protocol/internal/core-host-command-settlement\";\nimport { suppliedOnlyLocalInitOptionsSchema } from \"@getuserfeedback/protocol/internal/core-init-options\";\nimport type { InternalHostCommandEnvelope } from \"@getuserfeedback/protocol/internal/host-command-envelope\";\nimport type {\n\tInternalHostInlineFlowCommandPayload,\n\tInternalHostSuppliedOnlyLocalInitCommandPayload,\n} from \"@getuserfeedback/protocol/internal/host-command-payload\";\nimport type { InlineFlow } from \"@getuserfeedback/protocol/internal/inline-flow\";\nimport { createClientTransportAdmission } from \"./internal/client-transport-admission\";\nimport {\n\tbuildCustomerOccurrenceCommand,\n\ttype EventOptions,\n\ttype EventProperties,\n} from \"./internal/customer-occurrence-command\";\nimport { createFlowOpenRequestController } from \"./internal/flow-open-request-controller\";\nimport type { InlineFlowRun } from \"./internal/inline-flow\";\nimport { attachInlineFlowClientBridge } from \"./internal/inline-flow-client-bridge\";\nimport { SDK_VERSION } from \"./version\";\n\nexport type {\n\tEventOptions,\n\tEventProperties,\n} from \"./internal/customer-occurrence-command\";\nexport type { ClientOptions };\n\n/** Feedback captured as an evaluation of the current app or a specific target. */\nexport type FeedbackInput = CaptureInstanceFeedbackRequest;\n\n/** Receipt returned after feedback has been accepted. */\nexport type SubmitFeedbackResult = CaptureInstanceFeedbackResponse;\n\n/** Selectors used to read the current authenticated user's feedback. */\nexport type FetchFeedbackInput = ListInstanceFeedbackMineRequest;\n\n/** Feedback matching each requested selector, in selector order. */\nexport type FetchFeedbackResult = ListInstanceFeedbackMineResponse;\n\n/** Operations for submitting and reading feedback through the current SDK client. */\nexport type FeedbackOperations = {\n\t/**\n\t * Read feedback matching each selector for the JWT-authenticated user.\n\t * Requires `auth.jwt` configuration; `identify()` alone does not authorize readback.\n\t */\n\tfetch: (input: FetchFeedbackInput) => Promise<FetchFeedbackResult>;\n\tsubmit: (input: FeedbackInput) => Promise<SubmitFeedbackResult>;\n};\n\n/** One endpoint in a directed relationship observation. */\nexport type GraphRelationshipRef = {\n\tcollection: string;\n\tid: string;\n};\n\n/** A directed relationship observation recorded through the analytics pipeline. */\nexport type GraphRelationship = {\n\tfrom: GraphRelationshipRef;\n\tto: GraphRelationshipRef;\n};\n\n/** Operations for recording relationship observations as product events. */\nexport type GraphOperations = {\n\tconnect: (relationship: GraphRelationship) => Promise<void>;\n\tdisconnect: (relationship: GraphRelationship) => Promise<void>;\n};\n\nimport { type ActionRegistry, createActionRegistry } from \"./action-registry\";\nimport { createClientHostEventHub } from \"./client-host-event-hub\";\nimport { createOpenRequestBridge } from \"./open-request-bridge\";\nimport type { OpenRequestedEvent as OpenRequestDispatcherEvent } from \"./open-request-dispatcher\";\nimport { resolveStartupRuntimeUrls } from \"./runtime-url-defaults\";\n\n/** @internal */\ndeclare global {\n\tinterface Window {\n\t\t__getuserfeedback_queue?: Array<\n\t\t\tCommandEnvelope | InternalHostCommandEnvelope\n\t\t>;\n\t\t[LOADER_RUNTIME_GLOBAL_KEY]?: {\n\t\t\talive?: boolean;\n\t\t\tprotocolVersion?: string;\n\t\t\tfeatures?: readonly string[];\n\t\t};\n\t}\n}\n\ntype FlowHandleId = string;\n\ntype FlowRunTarget = { flowId: string } | { flow: InlineFlow };\n\n/** Durable state of a flow run (open/loading + dimensions when known). */\nexport interface FlowState extends HostFlowRenderState {\n\t/**\n\t * @deprecated Stop reading this field. SDK state snapshots and subscriptions\n\t * never populate it, and there is no replacement SDK state field.\n\t */\n\ttransitionPolicy?: WidgetLayoutTransitionPolicy;\n}\n\n/** Callback invoked when flow state changes. */\nexport type FlowStateCallback = (state: FlowState) => void;\ntype IdentifyTraits = Record<string, unknown>;\nexport type OpenRequestedEvent = OpenRequestDispatcherEvent;\nexport type OpenRequestedCallback = (event: OpenRequestedEvent) => void;\ntype StableJsonObject = { [key: string]: StableJsonValue };\ntype StableJsonValue =\n\t| string\n\t| number\n\t| boolean\n\t| null\n\t| StableJsonValue[]\n\t| StableJsonObject;\n\n/** Options for opening a flow run. */\nexport type OpenFlowOptions = {\n\t/** Host container used for this open request. Omit to use default floating mounting; pass null to wait for a custom container. */\n\tcontainer?: HTMLElement | null;\n\t/**\n\t * Optional response metadata to preserve with the eventual submission.\n\t * These tags are attached when the flow is opened and do not affect prerendering.\n\t */\n\tmetadata?: ResponseMetadataInput;\n\t/**\n\t * When `true`, the flow view does not show a close button.\n\t * Useful for mobile or embedded contexts where the host handles dismissal (e.g. via a drawer or back gesture).\n\t */\n\thideCloseButton?: boolean;\n};\n\n/** Options for prerendering a flow run. */\nexport type PrerenderFlowOptions = {\n\t/**\n\t * When `true`, the prerendered view does not show a close button.\n\t */\n\thideCloseButton?: boolean;\n};\n\n/** Options for subscribing to flow state updates. */\nexport type SubscribeFlowStateOptions = {\n\t/** Emit the current snapshot immediately. Default `true`. */\n\temitInitial?: boolean;\n\t/** Auto-unsubscribe when the signal is aborted. */\n\tsignal?: AbortSignal;\n};\n\n/** One timed geometry update emitted by the loader for a custom host. */\nexport type FlowLayoutUpdate = {\n\twidth: number;\n\theight: number;\n\ttransitionPolicy: WidgetLayoutTimedTransitionPolicy;\n};\n\nexport type FlowLayoutUpdateCallback = (update: FlowLayoutUpdate) => void;\n\n/** Options for subscribing to one-shot flow layout updates. */\nexport type SubscribeFlowLayoutUpdatesOptions = {\n\t/** Auto-unsubscribe when the signal is aborted. */\n\tsignal?: AbortSignal;\n};\n\nconst DEFAULT_FLOW_STATE: FlowState = {\n\tisOpen: false,\n\tisLoading: false,\n\twidth: undefined,\n\theight: undefined,\n};\nconst STALE_HANDLE_ERROR_CODE = \"STALE_HANDLE\" as const;\n\nconst isStaleHandleError = (error: unknown): boolean => {\n\tif (error instanceof CommandSettlementError) {\n\t\treturn error.code === STALE_HANDLE_ERROR_CODE;\n\t}\n\tif (!(error instanceof Error)) {\n\t\treturn false;\n\t}\n\treturn error.message.includes(\"flowHandleId is stale\");\n};\n\n/** Instance for a specific flow: open, prefetch, prerender, close, and subscribe to flow state. */\nexport type FlowRun = {\n\t/** The flow/survey ID this instance refers to. */\n\tflowId: string;\n\t/** Open the flow (show the survey). */\n\topen: (options?: OpenFlowOptions) => Promise<void>;\n\t/** Prefetch the flow so it opens faster when you call `open()`. */\n\tprefetch: () => Promise<void>;\n\t/** Prerender the flow into a container (e.g. for a custom dialog). */\n\tprerender: (options?: PrerenderFlowOptions) => Promise<void>;\n\t/** Attach or detach this flow to a specific host container. */\n\tsetContainer: (element: HTMLElement | null) => void;\n\t/** Close this flow. */\n\tclose: () => Promise<void>;\n\t/** Return the latest known flow state snapshot. */\n\tgetFlowState: () => FlowState;\n\t/** Subscribe to open/loading/dimensions; returns an unsubscribe function. */\n\tsubscribeFlowState: (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t) => () => void;\n\t/** Subscribe to timed geometry updates without replaying durable state. */\n\tsubscribeLayoutUpdates: (\n\t\tcallback: FlowLayoutUpdateCallback,\n\t\toptions?: SubscribeFlowLayoutUpdatesOptions,\n\t) => () => void;\n};\n\n/**\n * getuserfeedback client for loading the widget, opening flows, configuring\n * consent/auth, identifying users, and tracking events.\n *\n * @see https://getuserfeedback.com/docs/reference/javascript-sdk-reference\n */\nexport type Client = {\n\t/** Load the widget script. Call when you created the client with `disableAutoLoad: true`. */\n\tload: () => void;\n\t/** Set how this instance should choose default containers for flows. */\n\tsetDefaultContainerPolicy: (policy: ContainerPolicy) => void;\n\t/** Return the latest known instance-level flow state snapshot. */\n\tgetFlowState: () => FlowState;\n\t/** Subscribe to instance-level flow state updates (eg targeting-triggered opens). */\n\tsubscribeFlowState: (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t) => () => void;\n\t/** Return a flow instance; call .open(), .prefetch(), .prerender(), .close() on it. */\n\tflow: (flowId: string) => FlowRun;\n\t/** Close all open flows. */\n\tclose: () => Promise<void>;\n\t/** Reset widget state and user identity. */\n\treset: () => Promise<void>;\n\t/**\n\t * Update color scheme, consent, or auth. Pass a fresh JWT here after login\n\t * and whenever your auth provider refreshes the session token.\n\t *\n\t * @see https://getuserfeedback.com/docs/security-and-privacy/jwt-auth\n\t */\n\tconfigure: (updates: ConfigureOptions) => Promise<void>;\n\t/**\n\t * Associate the current user with a user ID, traits, and optional external IDs.\n\t *\n\t * Use `options.externalIds` for Segment-compatible identifiers from another\n\t * system. Without a user ID, pass options as `client.identify(traits, options)`,\n\t * or use `client.identify(traits, undefined, options)` when your call site needs\n\t * the explicit three-argument form. Do not put Segment-shaped `externalIds` in\n\t * traits.\n\t *\n\t * @see https://getuserfeedback.com/docs/guides/identity-resolution\n\t */\n\tidentify: {\n\t\t(\n\t\t\tuserId: string,\n\t\t\ttraits?: IdentifyTraits,\n\t\t\toptions?: IdentifyOptions,\n\t\t): Promise<void>;\n\t\t(\n\t\t\ttraits: IdentifyTraits,\n\t\t\tplaceholder: undefined,\n\t\t\toptions?: IdentifyOptions,\n\t\t): Promise<void>;\n\t\t(traits: IdentifyTraits, options?: IdentifyOptions): Promise<void>;\n\t};\n\t/**\n\t * Track a product event from the browser.\n\t *\n\t * Use `options.externalIds` when the event carries a Segment-compatible\n\t * identifier from another system. Do not put Segment-shaped `externalIds` in\n\t * properties.\n\t *\n\t * @see https://getuserfeedback.com/docs/reference/events\n\t */\n\ttrack: (\n\t\teventName: string,\n\t\tproperties?: EventProperties,\n\t\toptions?: EventOptions,\n\t) => Promise<void>;\n\t/** Record the current browser page or a named page location. */\n\tpage: (\n\t\tname?: string,\n\t\tproperties?: EventProperties,\n\t\toptions?: EventOptions,\n\t) => Promise<void>;\n\t/** Record directed relationship observations through the analytics pipeline. */\n\tgraph: GraphOperations;\n\t/** Submit feedback or read the authenticated user's matching feedback. */\n\tfeedback: FeedbackOperations;\n\t/** Subscribe to open flow requests or suppress them — for example if you know the user should not be interrupted.\n\t * For example, when the user is filling out a form, or is in the middle of a multi-step flow.\n\t * The system will retry after a short delay with exponential backoff.\n\t *\n\t * @example — suppress open flow requests if the user is busy\n\t * ```ts\n\t * client.onOpenRequested((event) => {\n\t * if (userIsBusy()) {\n\t * event.preventDefault();\n\t * }\n\t * });\n\t * ```\n\t */\n\tonOpenRequested: (callback: OpenRequestedCallback) => () => void;\n};\n\ntype ClientRegistryEntry = {\n\tclient: Client;\n\tupdateOptions: (\n\t\toptions: ClientOptions,\n\t\tactionRegistry: ActionRegistry,\n\t) => void;\n};\n\nconst openRequestBridgeByClient = new WeakMap<\n\tClient,\n\tReturnType<typeof createOpenRequestBridge>\n>();\n\nconst clientRegistry = new Map<object, Map<string, ClientRegistryEntry>>();\n\nexport const getOpenRequestBridge = (\n\tclient: Client,\n): ReturnType<typeof createOpenRequestBridge> => {\n\tconst bridge = openRequestBridgeByClient.get(client);\n\tif (!bridge) {\n\t\tthrow new Error(\"Open request bridge not found for client instance.\");\n\t}\n\treturn bridge;\n};\n\nconst createClientInstanceId = (): string => {\n\tif (\n\t\ttypeof globalThis.crypto !== \"undefined\" &&\n\t\ttypeof globalThis.crypto.randomUUID === \"function\"\n\t) {\n\t\treturn globalThis.crypto.randomUUID();\n\t}\n\treturn `sdk-${Date.now()}-${Math.random().toString(16).slice(2)}`;\n};\n\nconst toIdentifyCommandPayload = (\n\tidentifyInput: string | IdentifyTraits,\n\ttraitsOrOptions?: IdentifyTraits | IdentifyOptions,\n\toptions?: IdentifyOptions,\n): Extract<Command, { kind: \"identify\" }> => {\n\tif (typeof identifyInput === \"string\") {\n\t\tassertNoSegmentExternalIdsInValueArgument({\n\t\t\targument: traitsOrOptions,\n\t\t\tcommandName: \"identify\",\n\t\t\tvalueArgumentName: \"traits\",\n\t\t\tcallShape: \"identify(userId, traits, { externalIds })\",\n\t\t});\n\t\treturn {\n\t\t\tkind: \"identify\",\n\t\t\tuserId: identifyInput,\n\t\t\ttraits: traitsOrOptions,\n\t\t\toptions,\n\t\t};\n\t}\n\tassertNoSegmentExternalIdsInValueArgument({\n\t\targument: identifyInput,\n\t\tcommandName: \"identify\",\n\t\tvalueArgumentName: \"traits\",\n\t\tcallShape: \"identify(traits, { externalIds })\",\n\t});\n\treturn {\n\t\tkind: \"identify\",\n\t\ttraits: identifyInput,\n\t\toptions: options ?? traitsOrOptions,\n\t};\n};\n\nconst toFlags = (input: FlagsInput | undefined): AppEventFlag[] | undefined => {\n\tif (input === undefined) {\n\t\treturn;\n\t}\n\tif (Array.isArray(input)) {\n\t\treturn input.map((flag) => ({ ...flag }));\n\t}\n\treturn Object.entries(input)\n\t\t.sort(([leftKey], [rightKey]) => leftKey.localeCompare(rightKey))\n\t\t.map(([key, value]) => ({ key, value }));\n};\n\nconst toCapabilities = (\n\tinput: CapabilitiesInput | undefined,\n): AppEventCapability[] | undefined => {\n\tif (input === undefined) {\n\t\treturn;\n\t}\n\treturn input.map((capability) =>\n\t\ttypeof capability === \"string\" ? { key: capability } : { ...capability },\n\t);\n};\n\nconst CIRCULAR_TARGETING_CONTEXT_ERROR =\n\t\"Targeting context cannot contain circular values\";\n\nconst toStableJsonValue = (\n\tvalue: unknown,\n\tancestors: WeakSet<object> = new WeakSet(),\n): StableJsonValue => {\n\tif (\n\t\tvalue === null ||\n\t\ttypeof value === \"string\" ||\n\t\ttypeof value === \"number\" ||\n\t\ttypeof value === \"boolean\"\n\t) {\n\t\treturn value;\n\t}\n\tif (Array.isArray(value)) {\n\t\tif (ancestors.has(value)) {\n\t\t\tthrow new Error(CIRCULAR_TARGETING_CONTEXT_ERROR);\n\t\t}\n\t\tancestors.add(value);\n\t\ttry {\n\t\t\treturn value.map((entryValue) =>\n\t\t\t\ttoStableJsonValue(entryValue, ancestors),\n\t\t\t);\n\t\t} finally {\n\t\t\tancestors.delete(value);\n\t\t}\n\t}\n\tif (typeof value === \"object\") {\n\t\tif (ancestors.has(value)) {\n\t\t\tthrow new Error(CIRCULAR_TARGETING_CONTEXT_ERROR);\n\t\t}\n\t\tancestors.add(value);\n\t\tconst objectValue: StableJsonObject = {};\n\t\ttry {\n\t\t\tfor (const [key, entryValue] of Object.entries(value).sort(\n\t\t\t\t([leftKey], [rightKey]) => leftKey.localeCompare(rightKey),\n\t\t\t)) {\n\t\t\t\tif (entryValue !== undefined) {\n\t\t\t\t\tobjectValue[key] = toStableJsonValue(entryValue, ancestors);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn objectValue;\n\t\t} finally {\n\t\t\tancestors.delete(value);\n\t\t}\n\t}\n\treturn null;\n};\n\nconst toCanonicalTargetingValues = (\n\tvalues: unknown[] | undefined,\n): StableJsonValue[] | null => {\n\tif (values === undefined || values.length === 0) {\n\t\treturn null;\n\t}\n\treturn values\n\t\t.map((value) => {\n\t\t\tconst stableValue = toStableJsonValue(value);\n\t\t\treturn { key: JSON.stringify(stableValue), value: stableValue };\n\t\t})\n\t\t.sort(({ key: leftKey }, { key: rightKey }) =>\n\t\t\tleftKey.localeCompare(rightKey),\n\t\t)\n\t\t.map(({ value }) => value);\n};\n\nconst resolveTargetingContextRegistryKey = (options: ClientOptions): string =>\n\tJSON.stringify({\n\t\tflags: toCanonicalTargetingValues(toFlags(options.flags)),\n\t\tcapabilities: toCanonicalTargetingValues(\n\t\t\ttoCapabilities(options.capabilities),\n\t\t),\n\t});\n\nconst LOADER_RUNTIME_PROBE_TIMEOUT_MS = 120;\n// Once Loader registration has been enqueued, it is ordinary command settlement\n// rather than a short ownership probe. Keep supplied-flow handoff behind that\n// settlement so Core capability negotiation can complete before admission.\nconst LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS = 30_000;\nconst INVALID_COMMAND_ERROR_CODE = \"INVALID_COMMAND\";\nconst SUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL = Symbol.for(\n\t\"@getuserfeedback/sdk/internal/supplied-only-local-client-options/1\",\n);\nconst BUNDLED_DOCS_LOCAL_API_KEY = \"@getuserfeedback/internal/bundled-docs\";\n\ntype MarkedSuppliedOnlyLocalClientOptions = ClientOptions & {\n\t[SUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL]: true;\n};\n\n/** Private runtime inputs for the deployment-owned bundled-docs client. */\nexport type BundledDocsClientOptions = {\n\tloaderUrl: string;\n\tcoreUrl: string;\n\tcolorScheme?: ClientOptions[\"colorScheme\"];\n\tdisableAutoLoad?: boolean;\n};\n\n/**\n * Build options that the public React provider can pass through to the SDK root\n * without exposing local registration in the public options type.\n * Pass the returned object intact; cloning or serializing it deliberately fails\n * closed instead of falling back to persisted registration.\n * See docs/specs/2026-08-02-flow-interaction-model.md.\n */\nexport const createBundledDocsClientOptions = (\n\toptions: BundledDocsClientOptions,\n): ClientOptions => {\n\tconst clientOptions: ClientOptions = {\n\t\tapiKey: BUNDLED_DOCS_LOCAL_API_KEY,\n\t\t_loaderUrl: options.loaderUrl,\n\t\t_coreUrl: options.coreUrl,\n\t\t...(options.colorScheme === undefined\n\t\t\t? {}\n\t\t\t: { colorScheme: options.colorScheme }),\n\t\t...(options.disableAutoLoad === undefined\n\t\t\t? {}\n\t\t\t: { disableAutoLoad: options.disableAutoLoad }),\n\t};\n\tObject.defineProperty(\n\t\tclientOptions,\n\t\tSUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL,\n\t\t{\n\t\t\tconfigurable: false,\n\t\t\tenumerable: false,\n\t\t\tvalue: true,\n\t\t\twritable: false,\n\t\t},\n\t);\n\treturn clientOptions;\n};\n\nconst isSuppliedOnlyLocalClientOptions = (\n\toptions: ClientOptions,\n): options is MarkedSuppliedOnlyLocalClientOptions =>\n\tReflect.get(options, SUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL) === true;\n\nconst resolveRegistryKey = (\n\toptions: ClientOptions,\n\tregistrationKind: \"persisted\" | \"supplied-only-local\",\n): string =>\n\t`${registrationKind}:${options.apiKey}:${resolveTargetingContextRegistryKey(options)}`;\n\nconst haveSameActionDefinitions = (left: string[], right: string[]): boolean =>\n\tJSON.stringify(left) === JSON.stringify(right);\n\nconst resolveRegistryScope = (): object =>\n\ttypeof window === \"undefined\" ? globalThis : window;\n\nconst getRegistryForScope = (): Map<string, ClientRegistryEntry> => {\n\tconst scope = resolveRegistryScope();\n\tconst existing = clientRegistry.get(scope);\n\tif (existing) {\n\t\treturn existing;\n\t}\n\tconst created = new Map<string, ClientRegistryEntry>();\n\tclientRegistry.set(scope, created);\n\treturn created;\n};\n\n/**\n * Create a getuserfeedback client. Reuses an existing logical client for the\n * same `apiKey` and targeting context. Host-action definitions may change\n * before loading starts; afterward, changing their canonical identities throws\n * while equivalent definitions refresh their handlers.\n */\nexport const createClient = (options: ClientOptions): Client => {\n\tconst suppliedOnlyLocal = isSuppliedOnlyLocalClientOptions(options);\n\tif (!suppliedOnlyLocal && options.apiKey === BUNDLED_DOCS_LOCAL_API_KEY) {\n\t\tthrow new Error(\n\t\t\t\"Bundled docs client options must be passed intact without cloning or serialization.\",\n\t\t);\n\t}\n\tconst {\n\t\tapiKey,\n\t\t_loaderUrl,\n\t\t_coreUrl,\n\t\t_apiUrl,\n\t\t_realtimeUrl,\n\t\tdisableAutoLoad = false,\n\t\tcolorScheme,\n\t\tdisableTelemetry = false,\n\t\tenableDebug = false,\n\t\tdefaultConsent,\n\t\tflags,\n\t\tcapabilities,\n\t\tactions,\n\t} = options;\n\tconst initialActionRegistry = createActionRegistry(actions);\n\tconst registryKey = resolveRegistryKey(\n\t\t{\n\t\t\tapiKey,\n\t\t\t_loaderUrl,\n\t\t\t_coreUrl,\n\t\t\t_apiUrl,\n\t\t\t_realtimeUrl,\n\t\t\tdisableAutoLoad,\n\t\t\tcolorScheme,\n\t\t\tdisableTelemetry,\n\t\t\tenableDebug,\n\t\t\tdefaultConsent,\n\t\t\tflags,\n\t\t\tcapabilities,\n\t\t\tactions,\n\t\t},\n\t\tsuppliedOnlyLocal ? \"supplied-only-local\" : \"persisted\",\n\t);\n\tconst registry = getRegistryForScope();\n\tconst existing = registry.get(registryKey);\n\tif (existing) {\n\t\texisting.updateOptions(\n\t\t\t{\n\t\t\t\tapiKey,\n\t\t\t\t_loaderUrl,\n\t\t\t\t_coreUrl,\n\t\t\t\t_apiUrl,\n\t\t\t\t_realtimeUrl,\n\t\t\t\tdisableAutoLoad,\n\t\t\t\tcolorScheme,\n\t\t\t\tdisableTelemetry,\n\t\t\t\tenableDebug,\n\t\t\t\tdefaultConsent,\n\t\t\t\tflags,\n\t\t\t\tcapabilities,\n\t\t\t\tactions,\n\t\t\t},\n\t\t\tinitialActionRegistry,\n\t\t);\n\t\tif (!disableAutoLoad) {\n\t\t\texisting.client.load();\n\t\t}\n\t\treturn existing.client;\n\t}\n\n\tlet loaderUrlConfig = _loaderUrl;\n\tlet coreUrlConfig = _coreUrl;\n\tlet apiUrlConfig = _apiUrl;\n\tlet realtimeUrlConfig = _realtimeUrl;\n\n\tconst notifyError = (_error: unknown): void => {\n\t\t// No-op: track/use hooks removed from public API.\n\t};\n\tconst hostWindow =\n\t\ttypeof window !== \"undefined\" &&\n\t\ttypeof window.addEventListener === \"function\" &&\n\t\ttypeof window.removeEventListener === \"function\"\n\t\t\t? window\n\t\t\t: null;\n\tconst hostDocument =\n\t\ttypeof document !== \"undefined\" &&\n\t\ttypeof document.createElement === \"function\" &&\n\t\tdocument.head !== null\n\t\t\t? document\n\t\t\t: null;\n\n\tconst sdkVersion = SDK_VERSION;\n\tconst clientInstanceId = createClientInstanceId();\n\tconst openRequestBridge = createOpenRequestBridge();\n\tconst clientMeta: ClientMeta = {\n\t\tloader: \"sdk\",\n\t\tclientName: \"@getuserfeedback/sdk\",\n\t\tclientVersion: sdkVersion,\n\t\tprotocolCapabilities: [FLOW_LAYOUT_UPDATES_CAPABILITY],\n\t\ttransport: \"snippet\",\n\t};\n\n\tlet defaultConsentConfig = defaultConsent;\n\tlet colorSchemeConfig = colorScheme;\n\tlet flagsConfig = toFlags(flags);\n\tlet capabilitiesConfig = toCapabilities(capabilities);\n\tlet actionRegistry = initialActionRegistry;\n\n\tconst buildRuntimeEndpoints = (): InitOptions[\"runtimeEndpoints\"] => {\n\t\tif (!(coreUrlConfig || apiUrlConfig || realtimeUrlConfig)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn {\n\t\t\t...(coreUrlConfig !== undefined ? { coreUrl: coreUrlConfig } : {}),\n\t\t\t...(apiUrlConfig !== undefined ? { apiUrl: apiUrlConfig } : {}),\n\t\t\t...(realtimeUrlConfig !== undefined\n\t\t\t\t? { realtimeUrl: realtimeUrlConfig }\n\t\t\t\t: {}),\n\t\t};\n\t};\n\n\tconst buildInitOpts = (includeHostActions = true): InitOptions => {\n\t\tconst runtimeEndpoints = buildRuntimeEndpoints();\n\t\tconst hostActionDefinitions = includeHostActions\n\t\t\t? actionRegistry.listDefinitions()\n\t\t\t: [];\n\t\tconst protocolCapabilities = [\n\t\t\t...SDK_PROTOCOL_CAPABILITIES,\n\t\t\t...(actionRegistry.getOpenUrlHandler()\n\t\t\t\t? [OPEN_URL_ACTION_CAPABILITY, OPEN_URL_ACTION_V1_CAPABILITY]\n\t\t\t\t: []),\n\t\t];\n\t\treturn {\n\t\t\tapiKey,\n\t\t\tclientMeta,\n\t\t\tcapabilities: [...protocolCapabilities],\n\t\t\t...(flagsConfig !== undefined && {\n\t\t\t\tflags: flagsConfig.map((flag) => ({ ...flag })),\n\t\t\t}),\n\t\t\t...(capabilitiesConfig !== undefined && {\n\t\t\t\thostCapabilities: capabilitiesConfig.map((capability) => ({\n\t\t\t\t\t...capability,\n\t\t\t\t})),\n\t\t\t}),\n\t\t\t...(hostActionDefinitions.length > 0 && {\n\t\t\t\thostActions: hostActionDefinitions,\n\t\t\t}),\n\t\t\t...(runtimeEndpoints !== undefined ? { runtimeEndpoints } : {}),\n\t\t\t...(colorSchemeConfig !== undefined && {\n\t\t\t\tcolorScheme: colorSchemeConfig,\n\t\t\t}),\n\t\t\t...(disableTelemetry !== undefined && { disableTelemetry }),\n\t\t\t...(enableDebug !== undefined && { enableDebug }),\n\t\t\t...(defaultConsentConfig !== undefined && {\n\t\t\t\tdefaultConsent: defaultConsentConfig,\n\t\t\t}),\n\t\t};\n\t};\n\n\tlet loaderRequested = false;\n\tlet pendingLoad: Promise<void> | null = null;\n\tlet pendingRegistrationProbe: Promise<void> | null = null;\n\tlet disableAutoLoadConfig = disableAutoLoad;\n\tconst flowStateByHandle = new Map<FlowHandleId, FlowState>();\n\tconst claimedFlowStateHandles = new Set<FlowHandleId>();\n\tconst pendingFlowStateHandles = new Set<FlowHandleId>();\n\tlet isFlowHandleAllocationActive = false;\n\tlet isFlowHandleAllocationLocked = false;\n\tconst flowHandleAllocationWaiters: Array<(release: () => void) => void> = [];\n\tlet instanceFlowState: FlowState = DEFAULT_FLOW_STATE;\n\tconst hostEventHub = createClientHostEventHub({\n\t\tinstanceId: clientInstanceId,\n\t\tonNavigationRequested: (detail) => {\n\t\t\tconst target =\n\t\t\t\tdetail.version === 1 && detail.target === \"_blank\"\n\t\t\t\t\t? undefined\n\t\t\t\t\t: detail.version === OPEN_URL_ACTION_VERSION &&\n\t\t\t\t\t\t\t(detail.target === undefined ||\n\t\t\t\t\t\t\t\tdetail.target === \"self\" ||\n\t\t\t\t\t\t\t\tdetail.target === \"blank\")\n\t\t\t\t\t\t? detail.target\n\t\t\t\t\t\t: null;\n\t\t\tif (target === null) {\n\t\t\t\treturn \"unhandled\";\n\t\t\t}\n\t\t\tconst handler = actionRegistry.getOpenUrlHandler();\n\t\t\tif (!handler) {\n\t\t\t\treturn \"unhandled\";\n\t\t\t}\n\t\t\tconst outcome = handler({\n\t\t\t\turl: detail.url,\n\t\t\t\t...(target === undefined ? {} : { target }),\n\t\t\t});\n\t\t\tif (outcome === \"handled\") {\n\t\t\t\treturn \"succeeded\";\n\t\t\t}\n\t\t\tif (outcome === \"unhandled\") {\n\t\t\t\treturn \"unhandled\";\n\t\t\t}\n\t\t\tthrow new TypeError(\n\t\t\t\t'Registered open-url action must return \"handled\" or \"unhandled\" synchronously.',\n\t\t\t);\n\t\t},\n\t\twindowRef: hostWindow,\n\t});\n\n\tconst resolveRequiredRuntimeUrls = (): {\n\t\tloaderUrl: string;\n\t\tcoreUrl: string;\n\t\tapiUrl: string;\n\t\trealtimeUrl?: string;\n\t} => {\n\t\tconst runtimeUrls = resolveStartupRuntimeUrls({\n\t\t\tapiKey,\n\t\t\t_loaderUrl: loaderUrlConfig,\n\t\t\t_coreUrl: coreUrlConfig,\n\t\t\t_apiUrl: apiUrlConfig,\n\t\t\t_realtimeUrl: realtimeUrlConfig,\n\t\t});\n\t\tloaderUrlConfig = runtimeUrls.loaderUrl;\n\t\tcoreUrlConfig = runtimeUrls.coreUrl;\n\t\tapiUrlConfig = runtimeUrls.apiUrl;\n\t\trealtimeUrlConfig = runtimeUrls.realtimeUrl;\n\t\treturn runtimeUrls;\n\t};\n\n\tconst cloneFlowState = (state: FlowState): FlowState => ({\n\t\tisOpen: state.isOpen,\n\t\tisLoading: state.isLoading,\n\t\twidth: state.width,\n\t\theight: state.height,\n\t});\n\n\tconst getFlowStateForHandle = (flowHandleId: FlowHandleId): FlowState => {\n\t\tconst existing = flowStateByHandle.get(flowHandleId);\n\t\tif (!existing) {\n\t\t\treturn cloneFlowState(DEFAULT_FLOW_STATE);\n\t\t}\n\t\treturn cloneFlowState(existing);\n\t};\n\n\tconst setFlowStateForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t\tstate: FlowState,\n\t): void => {\n\t\tflowStateByHandle.set(flowHandleId, cloneFlowState(state));\n\t};\n\n\t// Core can publish state for a newly allocated supplied Flow before the\n\t// command settlement tells its FlowRun which handle was allocated. Keep the\n\t// client-owned snapshot current so binding that handle can replay the state\n\t// instead of losing the first open transition.\n\thostEventHub.subscribeFlowState((detail): void => {\n\t\tconst isClaimedHandle = claimedFlowStateHandles.has(detail.flowHandleId);\n\t\tif (!isClaimedHandle && !isFlowHandleAllocationActive) {\n\t\t\treturn;\n\t\t}\n\t\tsetFlowStateForHandle(detail.flowHandleId, {\n\t\t\tisOpen: detail.isOpen,\n\t\t\tisLoading: detail.isLoading,\n\t\t\twidth: detail.width,\n\t\t\theight: detail.height,\n\t\t});\n\t\tif (!isClaimedHandle) {\n\t\t\tpendingFlowStateHandles.add(detail.flowHandleId);\n\t\t}\n\t});\n\tconst beginFlowHandleAllocation = (): void => {\n\t\tisFlowHandleAllocationActive = true;\n\t};\n\tconst clearPendingFlowHandleState = (): void => {\n\t\tfor (const flowHandleId of pendingFlowStateHandles) {\n\t\t\tflowStateByHandle.delete(flowHandleId);\n\t\t}\n\t\tpendingFlowStateHandles.clear();\n\t};\n\tconst endFlowHandleAllocation = (): void => {\n\t\tisFlowHandleAllocationActive = false;\n\t\tclearPendingFlowHandleState();\n\t};\n\t/**\n\t * Flow-state events do not carry the allocating command requestId. Serialize\n\t * only handle-free handoffs so a pre-settlement snapshot has one possible\n\t * owner. Other commands remain concurrent. If allocation concurrency becomes\n\t * a product requirement, add explicit event correlation instead of a ledger.\n\t */\n\tconst createFlowHandleAllocationRelease = (): (() => void) => {\n\t\tlet released = false;\n\t\treturn () => {\n\t\t\tif (released) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treleased = true;\n\t\t\tconst next = flowHandleAllocationWaiters.shift();\n\t\t\tif (next) {\n\t\t\t\tnext(createFlowHandleAllocationRelease());\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tisFlowHandleAllocationLocked = false;\n\t\t};\n\t};\n\tconst acquireFlowHandleAllocation = ():\n\t\t| (() => void)\n\t\t| Promise<() => void> => {\n\t\tif (!isFlowHandleAllocationLocked) {\n\t\t\tisFlowHandleAllocationLocked = true;\n\t\t\treturn createFlowHandleAllocationRelease();\n\t\t}\n\t\treturn new Promise<() => void>((resolve) => {\n\t\t\tflowHandleAllocationWaiters.push(resolve);\n\t\t});\n\t};\n\n\tconst getInstanceFlowState = (): FlowState =>\n\t\tcloneFlowState(instanceFlowState);\n\n\tconst setInstanceFlowState = (state: FlowState): void => {\n\t\tinstanceFlowState = cloneFlowState(state);\n\t};\n\n\tconst ensureFlowStateForHandle = (flowHandleId: FlowHandleId): void => {\n\t\tif (!flowStateByHandle.has(flowHandleId)) {\n\t\t\tsetFlowStateForHandle(flowHandleId, DEFAULT_FLOW_STATE);\n\t\t}\n\t};\n\n\tconst subscribeFlowHandleInvalidation = (\n\t\tsubscriber: (flowHandleId: FlowHandleId) => void,\n\t): (() => void) => hostEventHub.subscribeFlowHandleInvalidation(subscriber);\n\n\tconst subscribeFlowStateCacheForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t): (() => void) =>\n\t\thostEventHub.subscribeFlowStateForHandle(flowHandleId, (detail): void => {\n\t\t\tconst nextState: FlowState = {\n\t\t\t\tisOpen: detail.isOpen,\n\t\t\t\tisLoading: detail.isLoading,\n\t\t\t\twidth: detail.width,\n\t\t\t\theight: detail.height,\n\t\t\t};\n\t\t\tsetFlowStateForHandle(flowHandleId, nextState);\n\t\t});\n\n\tconst isLoaderRequested = (): boolean => loaderRequested;\n\n\tconst enqueue = (\n\t\tenvelope: CommandEnvelope | InternalHostCommandEnvelope,\n\t): void => {\n\t\tif (!hostWindow) {\n\t\t\treturn;\n\t\t}\n\t\tif (!hostWindow.__getuserfeedback_queue) {\n\t\t\thostWindow.__getuserfeedback_queue = [];\n\t\t}\n\t\t// Stamp instanceId and clientMeta so the loader can route commands.\n\t\tconst stamped: CommandEnvelope | InternalHostCommandEnvelope = {\n\t\t\t...envelope,\n\t\t\tinstanceId: envelope.instanceId ?? clientInstanceId,\n\t\t\tclientMeta: envelope.clientMeta ?? clientMeta,\n\t\t};\n\t\thostWindow.__getuserfeedback_queue.push(stamped);\n\t};\n\n\tconst enqueueInstanceRegistration = (\n\t\trequestId?: string,\n\t\tincludeHostActions = true,\n\t): string => {\n\t\tif (suppliedOnlyLocal) {\n\t\t\tif (!coreUrlConfig) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"_coreUrl is not resolved for bundled docs registration\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst localRequestId = requestId ?? createCommandRequestId();\n\t\t\tconst command: InternalHostSuppliedOnlyLocalInitCommandPayload = {\n\t\t\t\tkind: \"init\",\n\t\t\t\topts: suppliedOnlyLocalInitOptionsSchema.parse({\n\t\t\t\t\tregistration: {\n\t\t\t\t\t\tkind: \"supplied-only-local\",\n\t\t\t\t\t\tprofile: \"bundled-docs\",\n\t\t\t\t\t},\n\t\t\t\t\t...(colorSchemeConfig === undefined\n\t\t\t\t\t\t? {}\n\t\t\t\t\t\t: { colorScheme: colorSchemeConfig }),\n\t\t\t\t}),\n\t\t\t\truntimeEndpoints: { coreUrl: coreUrlConfig },\n\t\t\t};\n\t\t\tenqueue({\n\t\t\t\tversion: \"1\",\n\t\t\t\trequestId: localRequestId,\n\t\t\t\tidempotencyKey: localRequestId,\n\t\t\t\tcommand,\n\t\t\t});\n\t\t\treturn localRequestId;\n\t\t}\n\t\tconst envelope = createCommandEnvelope({\n\t\t\tinstanceId: clientInstanceId,\n\t\t\trequestId,\n\t\t\tcommand: { kind: \"init\", opts: buildInitOpts(includeHostActions) },\n\t\t});\n\t\tenqueue(envelope);\n\t\treturn envelope.requestId;\n\t};\n\n\tconst runAfterRegistrationProbe = (run: () => void): void => {\n\t\tconst registrationProbe = pendingRegistrationProbe;\n\t\tif (!registrationProbe) {\n\t\t\trun();\n\t\t\treturn;\n\t\t}\n\t\tvoid registrationProbe.then(run);\n\t};\n\n\tconst enqueueSetDefaultContainerPolicy = (policy: ContainerPolicy): void => {\n\t\trunAfterRegistrationProbe(() => {\n\t\t\tenqueue(\n\t\t\t\tcreateCommandEnvelope({\n\t\t\t\t\tcommand: { kind: \"setDefaultContainerPolicy\", policy },\n\t\t\t\t}),\n\t\t\t);\n\t\t});\n\t};\n\n\tconst enqueueSetContainer = (\n\t\tflowHandleId: FlowHandleId,\n\t\telement: HTMLElement | null,\n\t): void => {\n\t\tenqueue(\n\t\t\tcreateCommandEnvelope({\n\t\t\t\tcommand: { kind: \"setContainer\", flowHandleId, container: element },\n\t\t\t}),\n\t\t);\n\t};\n\n\tconst reportAsyncError = <T>(promise: Promise<T>): Promise<T> => {\n\t\treturn promise.catch((error) => {\n\t\t\tnotifyError(error);\n\t\t\tthrow error;\n\t\t});\n\t};\n\n\tconst ensureCommandsCanRun = (): void => {\n\t\tif (!hostWindow) {\n\t\t\treturn;\n\t\t}\n\t\tif (!isLoaderRequested()) {\n\t\t\tif (disableAutoLoadConfig) {\n\t\t\t\tthrow new Error(\"Widget not loaded. Call client.load() first.\");\n\t\t\t}\n\t\t\tload();\n\t\t}\n\t};\n\n\tconst assertInlineFlowRuntimeSupport = (): void => {\n\t\tconst runtimeMarker = hostWindow?.[LOADER_RUNTIME_GLOBAL_KEY];\n\t\tif (!runtimeMarker?.alive) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Inline flows require an active compatible Loader runtime.\",\n\t\t\t);\n\t\t}\n\t\tif (runtimeMarker.protocolVersion !== LOADER_RUNTIME_PROTOCOL_VERSION) {\n\t\t\tthrow new Error(\n\t\t\t\t`Incompatible loader runtime protocol: expected ${LOADER_RUNTIME_PROTOCOL_VERSION}, received ${runtimeMarker.protocolVersion ?? \"unknown\"}`,\n\t\t\t);\n\t\t}\n\t\tif (!runtimeMarker.features?.includes(UNIFIED_FLOW_RUNTIME_V1_CAPABILITY)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Inline flows require Loader feature ${UNIFIED_FLOW_RUNTIME_V1_CAPABILITY}.`,\n\t\t\t);\n\t\t}\n\t};\n\n\t/** Enqueue a command and await its settlement.\n\t * The loader resolves instanceId from the instance registry. */\n\tconst rawSettlementDispatch = createCommandSettlementDispatch((cmd) =>\n\t\tenqueue(cmd),\n\t);\n\t// createCommandSettlementDispatch inserts the envelope synchronously before\n\t// returning its settlement promise, which makes invocation the handoff edge.\n\tconst handOffCommand = (input: Command) => rawSettlementDispatch(input);\n\tconst handOffInlineFlowCommand = (\n\t\tinput: InternalHostInlineFlowCommandPayload,\n\t) => {\n\t\tconst requestId = createCommandRequestId();\n\t\tenqueue({\n\t\t\tversion: \"1\",\n\t\t\trequestId,\n\t\t\tidempotencyKey: requestId,\n\t\t\tcommand: input,\n\t\t});\n\t\treturn waitForCommandSettlement({\n\t\t\trequestId,\n\t\t\twindowRef: hostWindow ?? undefined,\n\t\t});\n\t};\n\tconst transportAdmission = createClientTransportAdmission();\n\tconst prepareCommandHandoff = (): void | Promise<void> => {\n\t\tensureCommandsCanRun();\n\t\tconst registrationProbe = pendingRegistrationProbe;\n\t\tif (registrationProbe) {\n\t\t\treturn registrationProbe;\n\t\t}\n\t};\n\tconst prepareInlineFlowCommandHandoff = (): void | Promise<void> => {\n\t\tensureCommandsCanRun();\n\t\tconst startup = pendingLoad ?? pendingRegistrationProbe;\n\t\tif (startup) {\n\t\t\treturn startup.then(assertInlineFlowRuntimeSupport);\n\t\t}\n\t\tassertInlineFlowRuntimeSupport();\n\t};\n\tconst dispatch = async (input: Command): Promise<void> => {\n\t\tconst preparation = prepareCommandHandoff();\n\t\tif (preparation) {\n\t\t\tawait preparation;\n\t\t}\n\t\tawait rawSettlementDispatch(input);\n\t};\n\n\tconst enqueueConfigUpdate = (opts: ConfigureOptions): void => {\n\t\tif (!isLoaderRequested()) {\n\t\t\treturn;\n\t\t}\n\t\trunAfterRegistrationProbe(() => {\n\t\t\tenqueue(\n\t\t\t\tcreateCommandEnvelope({\n\t\t\t\t\tcommand: { kind: \"configure\", opts },\n\t\t\t\t}),\n\t\t\t);\n\t\t});\n\t};\n\n\tconst toConfigureCommandOptions = (\n\t\tupdates: ConfigureOptions,\n\t): ConfigureOptions => {\n\t\tconst nextCapabilities = toCapabilities(updates.capabilities);\n\t\treturn {\n\t\t\t...(updates.colorScheme !== undefined && {\n\t\t\t\tcolorScheme: updates.colorScheme,\n\t\t\t}),\n\t\t\t...(updates.consent !== undefined && { consent: updates.consent }),\n\t\t\t...(updates.auth !== undefined && { auth: updates.auth }),\n\t\t\t...(nextCapabilities !== undefined && {\n\t\t\t\tcapabilities: nextCapabilities,\n\t\t\t}),\n\t\t};\n\t};\n\n\tconst updateOptions = (\n\t\tnext: ClientOptions,\n\t\tnextActionRegistry: ActionRegistry,\n\t): void => {\n\t\tconst definitionsChanged = !haveSameActionDefinitions(\n\t\t\tactionRegistry.listRegistrationIdentities(),\n\t\t\tnextActionRegistry.listRegistrationIdentities(),\n\t\t);\n\t\tif (definitionsChanged && (isLoaderRequested() || pendingLoad !== null)) {\n\t\t\tconst error = new Error(\n\t\t\t\t\"actions definitions cannot be changed after widget init; keeping original registrations\",\n\t\t\t);\n\t\t\tnotifyError(error);\n\t\t\tthrow error;\n\t\t}\n\t\tactionRegistry = nextActionRegistry;\n\t\tdisableAutoLoadConfig = next.disableAutoLoad ?? disableAutoLoadConfig;\n\t\tdefaultConsentConfig = next.defaultConsent ?? defaultConsentConfig;\n\t\tif (!isLoaderRequested() && pendingLoad === null) {\n\t\t\tif (next.colorScheme !== undefined) {\n\t\t\t\tcolorSchemeConfig = next.colorScheme;\n\t\t\t}\n\t\t\tif (next.flags !== undefined) {\n\t\t\t\tflagsConfig = toFlags(next.flags);\n\t\t\t}\n\t\t\tif (next.capabilities !== undefined) {\n\t\t\t\tcapabilitiesConfig = toCapabilities(next.capabilities);\n\t\t\t}\n\t\t}\n\n\t\tif (next._loaderUrl !== undefined && next._loaderUrl !== loaderUrlConfig) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_loaderUrl cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\tloaderUrlConfig = next._loaderUrl;\n\t\t\t}\n\t\t}\n\n\t\tif (next._coreUrl !== undefined && next._coreUrl !== coreUrlConfig) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_coreUrl cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\tcoreUrlConfig = next._coreUrl;\n\t\t\t}\n\t\t}\n\n\t\tif (next._apiUrl !== undefined && next._apiUrl !== apiUrlConfig) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_apiUrl cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\tapiUrlConfig = next._apiUrl;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tnext._realtimeUrl !== undefined &&\n\t\t\tnext._realtimeUrl !== realtimeUrlConfig\n\t\t) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_realtimeUrl cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\trealtimeUrlConfig = next._realtimeUrl;\n\t\t\t}\n\t\t}\n\n\t\tapplyStartupConfig(next);\n\n\t\tif (!disableAutoLoadConfig && !isLoaderRequested()) {\n\t\t\tload();\n\t\t}\n\t};\n\n\tconst applyStartupConfig = (next: ClientOptions): void => {\n\t\t// Send configure payload from next (colorScheme only from ClientOptions).\n\t\tif (!isLoaderRequested()) return;\n\t\tconst opts: ConfigureOptions = {};\n\t\tif (next.colorScheme !== undefined) opts.colorScheme = next.colorScheme;\n\t\tif (next.capabilities !== undefined) {\n\t\t\tcapabilitiesConfig = toCapabilities(next.capabilities);\n\t\t\topts.capabilities = capabilitiesConfig;\n\t\t}\n\t\tenqueueConfigUpdate(opts);\n\t};\n\n\tconst load = (): void => {\n\t\tif (!hostWindow || !hostDocument) {\n\t\t\treturn;\n\t\t}\n\t\tif (isLoaderRequested() || pendingLoad) {\n\t\t\treturn;\n\t\t}\n\t\tconst runtimeUrls = resolveRequiredRuntimeUrls();\n\n\t\tconst appendLoaderScript = (): void => {\n\t\t\tconst scriptUrl = runtimeUrls.loaderUrl;\n\t\t\tif (\n\t\t\t\t!hostDocument.querySelector(`link[href=\"${scriptUrl}\"][rel=\"preload\"]`)\n\t\t\t) {\n\t\t\t\tconst preload = hostDocument.createElement(\"link\");\n\t\t\t\tpreload.rel = \"preload\";\n\t\t\t\tpreload.as = \"script\";\n\t\t\t\tpreload.href = scriptUrl;\n\t\t\t\thostDocument.head.appendChild(preload);\n\t\t\t}\n\n\t\t\tconst script = hostDocument.createElement(\"script\");\n\t\t\tscript.src = scriptUrl;\n\t\t\tscript.async = true;\n\t\t\tif (script.dataset) {\n\t\t\t\tscript.dataset.disableAutoRegister = \"true\";\n\t\t\t} else if (typeof script.setAttribute === \"function\") {\n\t\t\t\tscript.setAttribute(\"data-disable-auto-register\", \"true\");\n\t\t\t}\n\t\t\thostDocument.head.appendChild(script);\n\t\t};\n\n\t\tconst runtimeMarker = hostWindow[LOADER_RUNTIME_GLOBAL_KEY];\n\t\tif (runtimeMarker?.alive) {\n\t\t\tconst protocolVersion = runtimeMarker.protocolVersion;\n\t\t\tif (protocolVersion !== LOADER_RUNTIME_PROTOCOL_VERSION) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Incompatible loader runtime protocol: expected ${LOADER_RUNTIME_PROTOCOL_VERSION}, received ${protocolVersion ?? \"unknown\"}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst requestId = enqueueInstanceRegistration();\n\t\t\tloaderRequested = true;\n\t\t\tif (\n\t\t\t\t!runtimeMarker.features?.includes(UNIFIED_FLOW_RUNTIME_V1_CAPABILITY)\n\t\t\t) {\n\t\t\t\tlet trackedPending: Promise<void>;\n\t\t\t\tconst pending = waitForCommandSettlement({\n\t\t\t\t\trequestId,\n\t\t\t\t\twindowRef: hostWindow,\n\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t\t})\n\t\t\t\t\t.then(() => {})\n\t\t\t\t\t.catch((error) => {\n\t\t\t\t\t\tnotifyError(error);\n\t\t\t\t\t});\n\t\t\t\ttrackedPending = pending.finally(() => {\n\t\t\t\t\tif (pendingRegistrationProbe === trackedPending) {\n\t\t\t\t\t\tpendingRegistrationProbe = null;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tpendingRegistrationProbe = trackedPending;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst hasCommandQueue = Array.isArray(hostWindow.__getuserfeedback_queue);\n\t\tif (!hasCommandQueue) {\n\t\t\tconst requestId = enqueueInstanceRegistration();\n\t\t\tappendLoaderScript();\n\t\t\tloaderRequested = true;\n\t\t\tlet trackedPending: Promise<void>;\n\t\t\tconst pending = waitForCommandSettlement({\n\t\t\t\trequestId,\n\t\t\t\twindowRef: hostWindow,\n\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t})\n\t\t\t\t.then(() => {})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tnotifyError(error);\n\t\t\t\t});\n\t\t\ttrackedPending = pending.finally(() => {\n\t\t\t\tif (pendingLoad === trackedPending) {\n\t\t\t\t\tpendingLoad = null;\n\t\t\t\t}\n\t\t\t});\n\t\t\tpendingLoad = trackedPending;\n\t\t\treturn;\n\t\t}\n\n\t\tloaderRequested = true;\n\n\t\tlet trackedPending: Promise<void>;\n\t\tconst pending = (async () => {\n\t\t\tconst requestId = createCommandRequestId();\n\t\t\tenqueueInstanceRegistration(requestId);\n\t\t\ttry {\n\t\t\t\tawait waitForCommandSettlement({\n\t\t\t\t\trequestId,\n\t\t\t\t\twindowRef: hostWindow,\n\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_PROBE_TIMEOUT_MS,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof CommandSettlementTimeoutError) {\n\t\t\t\t\tappendLoaderScript();\n\t\t\t\t\tawait waitForCommandSettlement({\n\t\t\t\t\t\trequestId,\n\t\t\t\t\t\twindowRef: hostWindow,\n\t\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\terror instanceof CommandSettlementError &&\n\t\t\t\t\terror.code === INVALID_COMMAND_ERROR_CODE &&\n\t\t\t\t\tactionRegistry.listDefinitions().length > 0\n\t\t\t\t) {\n\t\t\t\t\tconst fallbackRequestId = createCommandRequestId();\n\t\t\t\t\tenqueueInstanceRegistration(fallbackRequestId, false);\n\t\t\t\t\tawait waitForCommandSettlement({\n\t\t\t\t\t\trequestId: fallbackRequestId,\n\t\t\t\t\t\twindowRef: hostWindow,\n\t\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t})().catch((error) => {\n\t\t\tnotifyError(error);\n\t\t});\n\t\ttrackedPending = pending.finally(() => {\n\t\t\tif (pendingLoad === trackedPending) {\n\t\t\t\tpendingLoad = null;\n\t\t\t}\n\t\t\tif (pendingRegistrationProbe === trackedPending) {\n\t\t\t\tpendingRegistrationProbe = null;\n\t\t\t}\n\t\t});\n\t\tpendingLoad = trackedPending;\n\t\tif (actionRegistry.listDefinitions().length > 0) {\n\t\t\tpendingRegistrationProbe = trackedPending;\n\t\t}\n\t};\n\n\tconst subscribeFlowStateForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t): (() => void) => {\n\t\tif (options?.emitInitial ?? true) {\n\t\t\tcallback(getFlowStateForHandle(flowHandleId));\n\t\t}\n\t\treturn hostEventHub.subscribeFlowStateForHandle(\n\t\t\tflowHandleId,\n\t\t\t(detail): void => {\n\t\t\t\tconst nextState: FlowState = {\n\t\t\t\t\tisOpen: detail.isOpen,\n\t\t\t\t\tisLoading: detail.isLoading,\n\t\t\t\t\twidth: detail.width,\n\t\t\t\t\theight: detail.height,\n\t\t\t\t};\n\t\t\t\tsetFlowStateForHandle(flowHandleId, nextState);\n\t\t\t\tcallback(cloneFlowState(nextState));\n\t\t\t},\n\t\t\t{ signal: options?.signal },\n\t\t);\n\t};\n\n\tconst subscribeFlowStateForInstance = (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t): (() => void) => {\n\t\tif (options?.emitInitial ?? true) {\n\t\t\tcallback(getInstanceFlowState());\n\t\t}\n\t\treturn hostEventHub.subscribeInstanceFlowState(\n\t\t\t(detail): void => {\n\t\t\t\tconst nextState: FlowState = {\n\t\t\t\t\tisOpen: detail.isOpen,\n\t\t\t\t\tisLoading: detail.isLoading,\n\t\t\t\t\twidth: detail.width,\n\t\t\t\t\theight: detail.height,\n\t\t\t\t};\n\t\t\t\tsetInstanceFlowState(nextState);\n\t\t\t\tcallback(cloneFlowState(nextState));\n\t\t\t},\n\t\t\t{ signal: options?.signal },\n\t\t);\n\t};\n\n\tconst notifyLayoutUpdateSubscriber = (\n\t\tcallback: FlowLayoutUpdateCallback,\n\t\tdetail: FlowLayoutUpdatedDetail,\n\t): void => {\n\t\ttry {\n\t\t\tcallback({\n\t\t\t\twidth: detail.width,\n\t\t\t\theight: detail.height,\n\t\t\t\ttransitionPolicy: {\n\t\t\t\t\t...detail.transitionPolicy,\n\t\t\t\t\teasing: [...detail.transitionPolicy.easing],\n\t\t\t\t},\n\t\t\t});\n\t\t} catch {\n\t\t\t// Public observers cannot interrupt the remaining host-event subscribers.\n\t\t}\n\t};\n\n\tconst resetFlowRunsForClientBarrier = new Set<() => void>();\n\tlet deferredFlowRunNotifications: Array<() => void> | null = null;\n\n\tfunction createFlowRun(target: { flowId: string }): FlowRun;\n\tfunction createFlowRun(target: { flow: InlineFlow }): InlineFlowRun;\n\tfunction createFlowRun(target: FlowRunTarget): FlowRun | InlineFlowRun {\n\t\tconst openRequestController = createFlowOpenRequestController();\n\t\tlet latestContainer: HTMLElement | null | undefined;\n\t\tlet unsubscribeFlowStateCache: (() => void) | null = null;\n\t\ttype SubscriberEntry = {\n\t\t\tcallback: FlowStateCallback;\n\t\t\toptions?: SubscribeFlowStateOptions;\n\t\t\tunsubscribe: (() => void) | null;\n\t\t};\n\t\ttype LayoutSubscriberEntry = {\n\t\t\tcallback: FlowLayoutUpdateCallback;\n\t\t\tpendingByHandle: Map<FlowHandleId, FlowLayoutUpdatedDetail>;\n\t\t\tunsubscribe: () => void;\n\t\t};\n\t\tconst activeSubscribers = new Set<SubscriberEntry>();\n\t\tconst activeLayoutSubscribers = new Set<LayoutSubscriberEntry>();\n\t\tconst clearPendingLayoutUpdates = (): void => {\n\t\t\tfor (const subscriber of activeLayoutSubscribers) {\n\t\t\t\tsubscriber.pendingByHandle.clear();\n\t\t\t}\n\t\t};\n\t\tconst handleClient = createFlowCommandHandleController<\n\t\t\tFlowHandleId,\n\t\t\t{\n\t\t\t\tok: boolean;\n\t\t\t\tkind: string;\n\t\t\t\tresult?: unknown;\n\t\t\t}\n\t\t>({\n\t\t\tgetHandleIdFromSettlement: (settlement) => {\n\t\t\t\tconst handle = getFlowHandleFromSettlementDetail(settlement);\n\t\t\t\treturn handle?.flowHandleId;\n\t\t\t},\n\t\t\tisStaleHandleError,\n\t\t\tonClearResolvedHandle: (previousFlowHandleId) => {\n\t\t\t\tclaimedFlowStateHandles.delete(previousFlowHandleId);\n\t\t\t\tpendingFlowStateHandles.delete(previousFlowHandleId);\n\t\t\t\tif (unsubscribeFlowStateCache) {\n\t\t\t\t\tunsubscribeFlowStateCache();\n\t\t\t\t\tunsubscribeFlowStateCache = null;\n\t\t\t\t}\n\t\t\t\tsetFlowStateForHandle(previousFlowHandleId, DEFAULT_FLOW_STATE);\n\t\t\t\trebindSubscribersToCurrentHandle();\n\t\t\t\tclearPendingLayoutUpdates();\n\t\t\t\tconst subscribersAtReset = [...activeSubscribers];\n\t\t\t\tconst notify = (): void =>\n\t\t\t\t\tnotifySubscribersWithDefaultState(subscribersAtReset);\n\t\t\t\tif (deferredFlowRunNotifications) {\n\t\t\t\t\tdeferredFlowRunNotifications.push(notify);\n\t\t\t\t} else {\n\t\t\t\t\tnotify();\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tconst bindSubscriberToCurrentHandle = (\n\t\t\tsubscriber: SubscriberEntry,\n\t\t\temitCurrent = false,\n\t\t): void => {\n\t\t\tif (subscriber.unsubscribe) {\n\t\t\t\tsubscriber.unsubscribe();\n\t\t\t\tsubscriber.unsubscribe = null;\n\t\t\t}\n\t\t\tif (subscriber.options?.signal?.aborted) {\n\t\t\t\tactiveSubscribers.delete(subscriber);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\tif (!flowHandleId) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst notifySubscriber = (state: FlowState): void => {\n\t\t\t\ttry {\n\t\t\t\t\tsubscriber.callback(state);\n\t\t\t\t} catch {\n\t\t\t\t\t// Public observers cannot interrupt handle publication or prevent\n\t\t\t\t\t// the remaining lifecycle projections from binding.\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst unsubscribe = subscribeFlowStateForHandle(\n\t\t\t\tflowHandleId,\n\t\t\t\tnotifySubscriber,\n\t\t\t\temitCurrent\n\t\t\t\t\t? { ...subscriber.options, emitInitial: true }\n\t\t\t\t\t: subscriber.options,\n\t\t\t);\n\t\t\tif (subscriber.options?.signal?.aborted) {\n\t\t\t\tunsubscribe();\n\t\t\t\tactiveSubscribers.delete(subscriber);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (\n\t\t\t\thandleClient.getHandleId() !== flowHandleId ||\n\t\t\t\t!activeSubscribers.has(subscriber)\n\t\t\t) {\n\t\t\t\tunsubscribe();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsubscriber.unsubscribe = unsubscribe;\n\t\t};\n\n\t\tconst rebindSubscribersToCurrentHandle = (emitCurrent = false): void => {\n\t\t\tfor (const subscriber of activeSubscribers) {\n\t\t\t\tbindSubscriberToCurrentHandle(subscriber, emitCurrent);\n\t\t\t}\n\t\t};\n\n\t\tconst flushPendingLayoutUpdates = (flowHandleId: FlowHandleId): void => {\n\t\t\tconst deliveries: Array<{\n\t\t\t\tcallback: FlowLayoutUpdateCallback;\n\t\t\t\tdetail: FlowLayoutUpdatedDetail;\n\t\t\t}> = [];\n\t\t\tfor (const subscriber of activeLayoutSubscribers) {\n\t\t\t\tconst pending = subscriber.pendingByHandle.get(flowHandleId);\n\t\t\t\tsubscriber.pendingByHandle.clear();\n\t\t\t\tif (pending) {\n\t\t\t\t\tdeliveries.push({ callback: subscriber.callback, detail: pending });\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const delivery of deliveries) {\n\t\t\t\tnotifyLayoutUpdateSubscriber(delivery.callback, delivery.detail);\n\t\t\t}\n\t\t};\n\n\t\tconst notifySubscribersWithDefaultState = (\n\t\t\tsubscribersAtReset: readonly SubscriberEntry[],\n\t\t): void => {\n\t\t\tfor (const subscriber of subscribersAtReset) {\n\t\t\t\tif (!activeSubscribers.has(subscriber)) continue;\n\t\t\t\ttry {\n\t\t\t\t\tsubscriber.callback(cloneFlowState(DEFAULT_FLOW_STATE));\n\t\t\t\t} catch {\n\t\t\t\t\t// A subscriber cannot prevent later reset observers from seeing the\n\t\t\t\t\t// already-completed client-wide transition.\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst rebindFlowStateCache = (): void => {\n\t\t\tif (unsubscribeFlowStateCache) {\n\t\t\t\tunsubscribeFlowStateCache();\n\t\t\t\tunsubscribeFlowStateCache = null;\n\t\t\t}\n\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\tif (!flowHandleId) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tunsubscribeFlowStateCache =\n\t\t\t\tsubscribeFlowStateCacheForHandle(flowHandleId);\n\t\t};\n\n\t\tconst clearOpenIntent = (): void => {\n\t\t\topenRequestController.clear();\n\t\t};\n\n\t\tconst flushPendingForResolvedHandle = (): void => {\n\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\tif (!flowHandleId) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst shouldReplayPendingState =\n\t\t\t\tpendingFlowStateHandles.delete(flowHandleId);\n\t\t\tclaimedFlowStateHandles.add(flowHandleId);\n\t\t\tensureFlowStateForHandle(flowHandleId);\n\t\t\tif (latestContainer !== undefined) {\n\t\t\t\tenqueueSetContainer(flowHandleId, latestContainer);\n\t\t\t}\n\t\t\trebindSubscribersToCurrentHandle(shouldReplayPendingState);\n\t\t\tflushPendingLayoutUpdates(flowHandleId);\n\t\t\trebindFlowStateCache();\n\t\t};\n\n\t\thandleClient.subscribeHandle(() => {\n\t\t\tflushPendingForResolvedHandle();\n\t\t});\n\t\tsubscribeFlowHandleInvalidation((flowHandleId) => {\n\t\t\thandleClient.invalidateResolvedHandle(flowHandleId);\n\t\t});\n\t\ttype HandleCommandPayload =\n\t\t\t| Extract<\n\t\t\t\t\tCommand,\n\t\t\t\t\t{ kind: \"open\" } | { kind: \"prefetch\" } | { kind: \"prerender\" }\n\t\t\t >\n\t\t\t| InternalHostInlineFlowCommandPayload;\n\n\t\tconst handOffHandleCommand = (payload: HandleCommandPayload) =>\n\t\t\t\"flow\" in payload\n\t\t\t\t? handOffInlineFlowCommand(payload)\n\t\t\t\t: handOffCommand(payload);\n\n\t\tconst enqueueAndWaitForSettlement = async (\n\t\t\tbuildPayload: (\n\t\t\t\tflowHandleId: FlowHandleId | undefined,\n\t\t\t) => HandleCommandPayload,\n\t\t): Promise<\"settled\" | \"superseded\"> => {\n\t\t\tconst result = await transportAdmission.runOperation(\n\t\t\t\t({ attemptHandoff }) => {\n\t\t\t\t\tlet releaseFlowHandleAllocation: (() => void) | null = null;\n\t\t\t\t\treturn handleClient\n\t\t\t\t\t\t.runCommand(buildPayload, (payload) => {\n\t\t\t\t\t\t\tconst isHandleFree =\n\t\t\t\t\t\t\t\t!(\"flowHandleId\" in payload) ||\n\t\t\t\t\t\t\t\tpayload.flowHandleId === undefined;\n\t\t\t\t\t\t\tconst requiresSerializedAllocation =\n\t\t\t\t\t\t\t\t\"flow\" in target && isHandleFree;\n\t\t\t\t\t\t\tconst handOff = (): Promise<{\n\t\t\t\t\t\t\t\tok: boolean;\n\t\t\t\t\t\t\t\tkind: string;\n\t\t\t\t\t\t\t\tresult?: unknown;\n\t\t\t\t\t\t\t}> =>\n\t\t\t\t\t\t\t\tattemptHandoff({\n\t\t\t\t\t\t\t\t\tprepare:\n\t\t\t\t\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t\t\t\t\t? prepareInlineFlowCommandHandoff\n\t\t\t\t\t\t\t\t\t\t\t: prepareCommandHandoff,\n\t\t\t\t\t\t\t\t\thandOff: () => ({\n\t\t\t\t\t\t\t\t\t\tsettlement: handOffHandleCommand(payload),\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (!requiresSerializedAllocation) {\n\t\t\t\t\t\t\t\treturn handOff();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst handOffAllocation = () =>\n\t\t\t\t\t\t\t\thandOff().catch((error) => {\n\t\t\t\t\t\t\t\t\tclearPendingFlowHandleState();\n\t\t\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (releaseFlowHandleAllocation) {\n\t\t\t\t\t\t\t\treturn handOffAllocation();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst acquisition = acquireFlowHandleAllocation();\n\t\t\t\t\t\t\tif (typeof acquisition === \"function\") {\n\t\t\t\t\t\t\t\treleaseFlowHandleAllocation = acquisition;\n\t\t\t\t\t\t\t\tbeginFlowHandleAllocation();\n\t\t\t\t\t\t\t\treturn handOffAllocation();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn acquisition.then((release) => {\n\t\t\t\t\t\t\t\treleaseFlowHandleAllocation = release;\n\t\t\t\t\t\t\t\tbeginFlowHandleAllocation();\n\t\t\t\t\t\t\t\treturn handOffAllocation();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.finally(() => {\n\t\t\t\t\t\t\tif (releaseFlowHandleAllocation) {\n\t\t\t\t\t\t\t\tendFlowHandleAllocation();\n\t\t\t\t\t\t\t\treleaseFlowHandleAllocation();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn result.status;\n\t\t};\n\n\t\tconst openFlow = (options?: OpenFlowOptions): Promise<void> => {\n\t\t\treturn openRequestController.run(() =>\n\t\t\t\treportAsyncError(\n\t\t\t\t\tenqueueAndWaitForSettlement((flowHandleId) =>\n\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tkind: \"open\",\n\t\t\t\t\t\t\t\t\tflow: target.flow,\n\t\t\t\t\t\t\t\t\t...(flowHandleId === undefined ? {} : { flowHandleId }),\n\t\t\t\t\t\t\t\t\t...(flowHandleId === undefined &&\n\t\t\t\t\t\t\t\t\tlatestContainer !== undefined\n\t\t\t\t\t\t\t\t\t\t? { container: null }\n\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\tmetadata: options?.metadata,\n\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tkind: \"open\",\n\t\t\t\t\t\t\t\t\tflowId: target.flowId,\n\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t\tcontainer: options?.container,\n\t\t\t\t\t\t\t\t\tmetadata: options?.metadata,\n\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t).then(() => {}),\n\t\t\t\t),\n\t\t\t);\n\t\t};\n\n\t\tconst resetForClientBarrier = (): void => {\n\t\t\tclearOpenIntent();\n\t\t\tclearPendingLayoutUpdates();\n\t\t\thandleClient.reset();\n\t\t};\n\t\tresetFlowRunsForClientBarrier.add(resetForClientBarrier);\n\n\t\tconst run: InlineFlowRun = {\n\t\t\topen: openFlow,\n\t\t\tprefetch: () => {\n\t\t\t\treturn reportAsyncError(\n\t\t\t\t\tenqueueAndWaitForSettlement((flowHandleId) =>\n\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tkind: \"prefetch\",\n\t\t\t\t\t\t\t\t\tflow: target.flow,\n\t\t\t\t\t\t\t\t\t...(flowHandleId === undefined ? {} : { flowHandleId }),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tkind: \"prefetch\",\n\t\t\t\t\t\t\t\t\tflowId: target.flowId,\n\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t).then(() => {}),\n\t\t\t\t);\n\t\t\t},\n\t\t\tprerender: (options?: PrerenderFlowOptions) => {\n\t\t\t\treturn reportAsyncError(\n\t\t\t\t\tenqueueAndWaitForSettlement((flowHandleId) =>\n\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tkind: \"prerender\",\n\t\t\t\t\t\t\t\t\tflow: target.flow,\n\t\t\t\t\t\t\t\t\t...(flowHandleId === undefined ? {} : { flowHandleId }),\n\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tkind: \"prerender\",\n\t\t\t\t\t\t\t\t\tflowId: target.flowId,\n\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t).then(() => {}),\n\t\t\t\t);\n\t\t\t},\n\t\t\tclose: () => {\n\t\t\t\tclearOpenIntent();\n\t\t\t\treturn reportAsyncError(\n\t\t\t\t\ttransportAdmission\n\t\t\t\t\t\t.runOperation(({ attemptHandoff }) => {\n\t\t\t\t\t\t\treturn handleClient.runResolvedHandleCommand(\n\t\t\t\t\t\t\t\t(flowHandleId) => ({\n\t\t\t\t\t\t\t\t\tkind: \"close\" as const,\n\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t(payload) =>\n\t\t\t\t\t\t\t\t\tattemptHandoff({\n\t\t\t\t\t\t\t\t\t\tprepare:\n\t\t\t\t\t\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t\t\t\t\t\t? prepareInlineFlowCommandHandoff\n\t\t\t\t\t\t\t\t\t\t\t\t: prepareCommandHandoff,\n\t\t\t\t\t\t\t\t\t\thandOff: () => ({\n\t\t\t\t\t\t\t\t\t\t\tsettlement: handOffCommand(payload).then(() => {}),\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.then(() => {}),\n\t\t\t\t);\n\t\t\t},\n\t\t\tsetContainer: (element: HTMLElement | null) => {\n\t\t\t\tlatestContainer = element;\n\t\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\t\tif (!flowHandleId) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tenqueueSetContainer(flowHandleId, element);\n\t\t\t},\n\t\t\tgetFlowState: () => {\n\t\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\t\treturn flowHandleId\n\t\t\t\t\t? getFlowStateForHandle(flowHandleId)\n\t\t\t\t\t: cloneFlowState(DEFAULT_FLOW_STATE);\n\t\t\t},\n\t\t\tsubscribeFlowState: (\n\t\t\t\tcallback: FlowStateCallback,\n\t\t\t\toptions?: SubscribeFlowStateOptions,\n\t\t\t) => {\n\t\t\t\tif (options?.signal?.aborted) {\n\t\t\t\t\treturn () => {};\n\t\t\t\t}\n\t\t\t\tconst subscriber: SubscriberEntry = {\n\t\t\t\t\tcallback,\n\t\t\t\t\toptions,\n\t\t\t\t\tunsubscribe: null,\n\t\t\t\t};\n\t\t\t\tactiveSubscribers.add(subscriber);\n\t\t\t\tconst unsubscribeSubscriber = (): void => {\n\t\t\t\t\tif (subscriber.unsubscribe) {\n\t\t\t\t\t\tsubscriber.unsubscribe();\n\t\t\t\t\t\tsubscriber.unsubscribe = null;\n\t\t\t\t\t}\n\t\t\t\t\tactiveSubscribers.delete(subscriber);\n\t\t\t\t};\n\t\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\t\tif (!flowHandleId) {\n\t\t\t\t\tconst signal = options?.signal;\n\t\t\t\t\tif (signal) {\n\t\t\t\t\t\tconst onAbort = (): void => {\n\t\t\t\t\t\t\tsubscriber.unsubscribe = null;\n\t\t\t\t\t\t\tactiveSubscribers.delete(subscriber);\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\t\t\t\tsubscriber.unsubscribe = () => {\n\t\t\t\t\t\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tif (options?.emitInitial !== false) {\n\t\t\t\t\t\tcallback(cloneFlowState(DEFAULT_FLOW_STATE));\n\t\t\t\t\t}\n\t\t\t\t\treturn unsubscribeSubscriber;\n\t\t\t\t}\n\t\t\t\tbindSubscriberToCurrentHandle(subscriber);\n\t\t\t\treturn unsubscribeSubscriber;\n\t\t\t},\n\t\t\tsubscribeLayoutUpdates: (\n\t\t\t\tcallback: FlowLayoutUpdateCallback,\n\t\t\t\toptions?: SubscribeFlowLayoutUpdatesOptions,\n\t\t\t) => {\n\t\t\t\tif (options?.signal?.aborted) return () => {};\n\t\t\t\tconst pendingByHandle = new Map<\n\t\t\t\t\tFlowHandleId,\n\t\t\t\t\tFlowLayoutUpdatedDetail\n\t\t\t\t>();\n\t\t\t\tconst subscriber: LayoutSubscriberEntry = {\n\t\t\t\t\tcallback,\n\t\t\t\t\tpendingByHandle,\n\t\t\t\t\tunsubscribe: () => {},\n\t\t\t\t};\n\t\t\t\tsubscriber.unsubscribe = hostEventHub.subscribeFlowLayoutUpdates(\n\t\t\t\t\t(detail) => {\n\t\t\t\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\t\t\t\tif (flowHandleId === detail.flowHandleId) {\n\t\t\t\t\t\t\tnotifyLayoutUpdateSubscriber(callback, detail);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!flowHandleId && handleClient.hasPendingCommands()) {\n\t\t\t\t\t\t\tpendingByHandle.set(detail.flowHandleId, detail);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tconst unsubscribe = (): void => {\n\t\t\t\t\toptions?.signal?.removeEventListener(\"abort\", unsubscribe);\n\t\t\t\t\tsubscriber.unsubscribe();\n\t\t\t\t\tpendingByHandle.clear();\n\t\t\t\t\tactiveLayoutSubscribers.delete(subscriber);\n\t\t\t\t};\n\t\t\t\tactiveLayoutSubscribers.add(subscriber);\n\t\t\t\toptions?.signal?.addEventListener(\"abort\", unsubscribe, { once: true });\n\t\t\t\treturn unsubscribe;\n\t\t\t},\n\t\t};\n\n\t\treturn \"flow\" in target ? run : { flowId: target.flowId, ...run };\n\t}\n\n\tconst flowRunByFlowId = new Map<string, FlowRun>();\n\tconst flow = (flowIdInput: string): FlowRun => {\n\t\tconst flowId = flowIdInput.trim();\n\t\tif (!flowId) {\n\t\t\tthrow new Error(\"flowId must be a non-empty string\");\n\t\t}\n\t\tconst existing = flowRunByFlowId.get(flowId);\n\t\tif (existing) return existing;\n\t\tconst run = createFlowRun({ flowId });\n\t\tflowRunByFlowId.set(flowId, run);\n\t\treturn run;\n\t};\n\n\tconst runClientBarrier = (kind: \"close\" | \"reset\"): Promise<void> => {\n\t\tconst flowRunResets = [...resetFlowRunsForClientBarrier];\n\t\treturn reportAsyncError(\n\t\t\ttransportAdmission.runBarrier({\n\t\t\t\tonGenerationAdvanced: () => {\n\t\t\t\t\tconst notifications: Array<() => void> = [];\n\t\t\t\t\tdeferredFlowRunNotifications = notifications;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfor (const resetFlowRun of flowRunResets) {\n\t\t\t\t\t\t\tresetFlowRun();\n\t\t\t\t\t\t}\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tdeferredFlowRunNotifications = null;\n\t\t\t\t\t}\n\t\t\t\t\tfor (const notify of notifications) {\n\t\t\t\t\t\tnotify();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tprepare: hostWindow ? prepareCommandHandoff : () => {},\n\t\t\t\thandOff: hostWindow\n\t\t\t\t\t? () => ({ settlement: handOffCommand({ kind }).then(() => {}) })\n\t\t\t\t\t: () => ({ settlement: Promise.resolve() }),\n\t\t\t}),\n\t\t);\n\t};\n\n\tconst close = (): Promise<void> => runClientBarrier(\"close\");\n\n\tconst reset = (): Promise<void> => runClientBarrier(\"reset\");\n\n\tfunction identify(\n\t\tuserId: string,\n\t\ttraits?: IdentifyTraits,\n\t\toptions?: IdentifyOptions,\n\t): Promise<void>;\n\tfunction identify(\n\t\ttraits: IdentifyTraits,\n\t\toptions?: IdentifyOptions,\n\t): Promise<void>;\n\tfunction identify(\n\t\tidentifyInput: string | IdentifyTraits,\n\t\ttraitsOrOptions?: IdentifyTraits | IdentifyOptions,\n\t\toptions?: IdentifyOptions,\n\t): Promise<void> {\n\t\tif (!hostWindow) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(\n\t\t\tdispatch(\n\t\t\t\ttoIdentifyCommandPayload(identifyInput, traitsOrOptions, options),\n\t\t\t),\n\t\t);\n\t}\n\n\tconst track = (\n\t\teventName: string,\n\t\tproperties?: EventProperties,\n\t\toptions?: EventOptions,\n\t): Promise<void> => {\n\t\tif (!hostWindow) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(\n\t\t\tdispatch(\n\t\t\t\tbuildCustomerOccurrenceCommand({\n\t\t\t\t\ttype: \"track\",\n\t\t\t\t\tevent: eventName,\n\t\t\t\t\tproperties,\n\t\t\t\t\toptions,\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t};\n\n\tconst page = (\n\t\tname?: string,\n\t\tproperties?: EventProperties,\n\t\toptions?: EventOptions,\n\t): Promise<void> => {\n\t\tif (!hostWindow) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(\n\t\t\tdispatch(\n\t\t\t\tbuildCustomerOccurrenceCommand({\n\t\t\t\t\ttype: \"page\",\n\t\t\t\t\tevent: name ?? (hostWindow.location.pathname || \"/\"),\n\t\t\t\t\tproperties,\n\t\t\t\t\toptions,\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t};\n\n\tconst submitFeedback = async (\n\t\tinput: FeedbackInput,\n\t): Promise<SubmitFeedbackResult> => {\n\t\tif (!hostWindow) {\n\t\t\tthrow new Error(\"Feedback submission requires a browser environment.\");\n\t\t}\n\t\tensureCommandsCanRun();\n\t\tconst registrationProbe = pendingRegistrationProbe;\n\t\tif (registrationProbe) {\n\t\t\tawait registrationProbe;\n\t\t}\n\t\tconst settlement = await reportAsyncError(\n\t\t\trawSettlementDispatch({\n\t\t\t\tkind: \"instanceFeedback.capture\",\n\t\t\t\tpayload: input,\n\t\t\t}),\n\t\t);\n\t\tif (!settlement.ok) {\n\t\t\tthrow new Error(\"Feedback submission failed.\");\n\t\t}\n\t\tconst result = getFeedbackSubmissionFromSettlementDetail(settlement);\n\t\tif (!result) {\n\t\t\tthrow new Error(\"Invalid feedback submission result.\");\n\t\t}\n\t\treturn result;\n\t};\n\n\tconst fetchFeedback = async (\n\t\tinput: FetchFeedbackInput,\n\t): Promise<FetchFeedbackResult> => {\n\t\tif (!hostWindow) {\n\t\t\tthrow new Error(\"Feedback reads require a browser environment.\");\n\t\t}\n\t\tensureCommandsCanRun();\n\t\tconst registrationProbe = pendingRegistrationProbe;\n\t\tif (registrationProbe) {\n\t\t\tawait registrationProbe;\n\t\t}\n\t\tconst settlement = await reportAsyncError(\n\t\t\trawSettlementDispatch({\n\t\t\t\tkind: \"instanceFeedback.listMine\",\n\t\t\t\tpayload: input,\n\t\t\t}),\n\t\t);\n\t\tif (!settlement.ok) {\n\t\t\tthrow new Error(\"Feedback read failed.\");\n\t\t}\n\t\tconst result = getFeedbackReadFromSettlementDetail(settlement);\n\t\tif (!result) {\n\t\t\tthrow new Error(\"Invalid feedback read result.\");\n\t\t}\n\t\treturn result;\n\t};\n\n\tconst configure = (updates: ConfigureOptions): Promise<void> => {\n\t\tif (!hostWindow) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\tif (!isLoaderRequested()) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\t// Send updates as-is; loader merges and forwards deltas to core.\n\t\treturn reportAsyncError(\n\t\t\tdispatch({ kind: \"configure\", opts: toConfigureCommandOptions(updates) }),\n\t\t);\n\t};\n\n\thostEventHub.subscribeOpenRequested((detail, hostEvent) => {\n\t\topenRequestBridge.observeFromLoader(detail, {\n\t\t\tpreventHostDefault: () => {\n\t\t\t\thostEvent.preventDefault();\n\t\t\t},\n\t\t});\n\t});\n\thostEventHub.subscribeHostActionRequested((detail, hostEvent) => {\n\t\tconst handler = actionRegistry.getHandler(detail.definition);\n\t\tif (!handler) {\n\t\t\tdetail.settle(\"unavailable\");\n\t\t\treturn;\n\t\t}\n\t\t// This adapter event stays inside the trusted host realm. Sandboxed Views\n\t\t// can request an action only through Core's empty, authorized RPC.\n\t\thostEvent.preventDefault();\n\t\tvoid Promise.resolve()\n\t\t\t.then(() => handler())\n\t\t\t.then(\n\t\t\t\t() => detail.settle(\"success\"),\n\t\t\t\t() => detail.settle(\"failure\"),\n\t\t\t);\n\t});\n\n\tconst client: Client = {\n\t\tload,\n\t\tsetDefaultContainerPolicy: (policy: ContainerPolicy) => {\n\t\t\tenqueueSetDefaultContainerPolicy(policy);\n\t\t},\n\t\tgetFlowState: () => getInstanceFlowState(),\n\t\tsubscribeFlowState: (\n\t\t\tcallback: FlowStateCallback,\n\t\t\toptions?: SubscribeFlowStateOptions,\n\t\t) => subscribeFlowStateForInstance(callback, options),\n\t\tflow,\n\t\tclose,\n\t\treset,\n\t\tconfigure,\n\t\tidentify,\n\t\ttrack,\n\t\tpage,\n\t\tgraph: {\n\t\t\tconnect: (relationship) =>\n\t\t\t\ttrack(\"gx.graph.relationship.connected\", relationship),\n\t\t\tdisconnect: (relationship) =>\n\t\t\t\ttrack(\"gx.graph.relationship.disconnected\", relationship),\n\t\t},\n\t\tfeedback: { fetch: fetchFeedback, submit: submitFeedback },\n\t\tonOpenRequested: (callback) => openRequestBridge.subscribe(callback),\n\t};\n\tattachInlineFlowClientBridge(client, {\n\t\tcreateInlineFlowRun: (inlineFlow) => createFlowRun({ flow: inlineFlow }),\n\t});\n\n\topenRequestBridgeByClient.set(client, openRequestBridge);\n\n\tregistry.set(registryKey, {\n\t\tclient,\n\t\tupdateOptions,\n\t});\n\n\tif (!disableAutoLoadConfig) {\n\t\tclient.load();\n\t}\n\n\treturn client;\n};\n",
|
|
19
|
+
"import type {\n\tCaptureInstanceFeedbackRequest,\n\tCaptureInstanceFeedbackResponse,\n\tListInstanceFeedbackMineRequest,\n\tListInstanceFeedbackMineResponse,\n} from \"@getuserfeedback/protocol\";\nimport {\n\ttype AppEventCapability,\n\ttype AppEventFlag,\n\tassertNoSegmentExternalIdsInValueArgument,\n\ttype CapabilitiesInput,\n\ttype ClientMeta,\n\ttype ClientOptions,\n\ttype Command,\n\ttype CommandEnvelope,\n\tCommandSettlementError,\n\tCommandSettlementTimeoutError,\n\ttype ConfigureOptions,\n\ttype ContainerPolicy,\n\tcreateCommandEnvelope,\n\tcreateCommandRequestId,\n\tcreateCommandSettlementDispatch,\n\tcreateFlowCommandHandleController,\n\ttype FlagsInput,\n\tgetFeedbackReadFromSettlementDetail,\n\tgetFeedbackSubmissionFromSettlementDetail,\n\tgetFlowHandleFromSettlementDetail,\n\ttype FlowRenderState as HostFlowRenderState,\n\ttype IdentifyOptions,\n\ttype InitOptions,\n\tLOADER_RUNTIME_GLOBAL_KEY,\n\tLOADER_RUNTIME_PROTOCOL_VERSION,\n\tOPEN_URL_ACTION_CAPABILITY,\n\tOPEN_URL_ACTION_V1_CAPABILITY,\n\tOPEN_URL_ACTION_VERSION,\n\ttype ResponseMetadataInput,\n\tSDK_PROTOCOL_CAPABILITIES,\n\ttype WidgetLayoutTransitionPolicy,\n\twaitForCommandSettlement,\n} from \"@getuserfeedback/protocol/host\";\nimport { UNIFIED_FLOW_RUNTIME_V1_CAPABILITY } from \"@getuserfeedback/protocol/internal/core-host-command-settlement\";\nimport { suppliedOnlyLocalInitOptionsSchema } from \"@getuserfeedback/protocol/internal/core-init-options\";\nimport type { InternalHostCommandEnvelope } from \"@getuserfeedback/protocol/internal/host-command-envelope\";\nimport type {\n\tInternalHostInlineFlowCommandPayload,\n\tInternalHostSuppliedOnlyLocalInitCommandPayload,\n} from \"@getuserfeedback/protocol/internal/host-command-payload\";\nimport type { InlineFlow } from \"@getuserfeedback/protocol/internal/inline-flow\";\nimport { createClientTransportAdmission } from \"./internal/client-transport-admission\";\nimport {\n\tbuildCustomerOccurrenceCommand,\n\ttype EventOptions,\n\ttype EventProperties,\n} from \"./internal/customer-occurrence-command\";\nimport { createFlowOpenRequestController } from \"./internal/flow-open-request-controller\";\nimport type { InlineFlowRun } from \"./internal/inline-flow\";\nimport { attachInlineFlowClientBridge } from \"./internal/inline-flow-client-bridge\";\nimport { SDK_VERSION } from \"./version\";\n\nexport type {\n\tEventOptions,\n\tEventProperties,\n} from \"./internal/customer-occurrence-command\";\nexport type { ClientOptions };\n\n/** Feedback captured as an evaluation of the current app or a specific target. */\nexport type FeedbackInput = CaptureInstanceFeedbackRequest;\n\n/** Receipt returned after feedback has been accepted. */\nexport type SubmitFeedbackResult = CaptureInstanceFeedbackResponse;\n\n/** Selectors used to read the current authenticated user's feedback. */\nexport type FetchFeedbackInput = ListInstanceFeedbackMineRequest;\n\n/** Feedback matching each requested selector, in selector order. */\nexport type FetchFeedbackResult = ListInstanceFeedbackMineResponse;\n\n/** Operations for submitting and reading feedback through the current SDK client. */\nexport type FeedbackOperations = {\n\t/**\n\t * Read feedback matching each selector for the JWT-authenticated user.\n\t * Requires `auth.jwt` configuration; `identify()` alone does not authorize readback.\n\t */\n\tfetch: (input: FetchFeedbackInput) => Promise<FetchFeedbackResult>;\n\tsubmit: (input: FeedbackInput) => Promise<SubmitFeedbackResult>;\n};\n\n/** One endpoint in a directed relationship observation. */\nexport type GraphRelationshipRef = {\n\tcollection: string;\n\tid: string;\n};\n\n/** A directed relationship observation recorded through the analytics pipeline. */\nexport type GraphRelationship = {\n\tfrom: GraphRelationshipRef;\n\tto: GraphRelationshipRef;\n};\n\n/** Operations for recording relationship observations as product events. */\nexport type GraphOperations = {\n\tconnect: (relationship: GraphRelationship) => Promise<void>;\n\tdisconnect: (relationship: GraphRelationship) => Promise<void>;\n};\n\nimport { type ActionRegistry, createActionRegistry } from \"./action-registry\";\nimport { createClientHostEventHub } from \"./client-host-event-hub\";\nimport { createOpenRequestBridge } from \"./open-request-bridge\";\nimport type { OpenRequestedEvent as OpenRequestDispatcherEvent } from \"./open-request-dispatcher\";\nimport { resolveStartupRuntimeUrls } from \"./runtime-url-defaults\";\n\n/** @internal */\ndeclare global {\n\tinterface Window {\n\t\t__getuserfeedback_queue?: Array<\n\t\t\tCommandEnvelope | InternalHostCommandEnvelope\n\t\t>;\n\t\t[LOADER_RUNTIME_GLOBAL_KEY]?: {\n\t\t\talive?: boolean;\n\t\t\tprotocolVersion?: string;\n\t\t\tfeatures?: readonly string[];\n\t\t};\n\t}\n}\n\ntype FlowHandleId = string;\n\ntype FlowRunTarget = { flowId: string } | { flow: InlineFlow };\n\n/** Durable state of a flow run (open/loading + dimensions when known). */\nexport interface FlowState extends HostFlowRenderState {\n\t/**\n\t * @deprecated Stop reading this field. SDK state snapshots and subscriptions\n\t * never populate it, and there is no replacement SDK state field.\n\t */\n\ttransitionPolicy?: WidgetLayoutTransitionPolicy;\n}\n\n/** Callback invoked when flow state changes. */\nexport type FlowStateCallback = (state: FlowState) => void;\ntype IdentifyTraits = Record<string, unknown>;\nexport type OpenRequestedEvent = OpenRequestDispatcherEvent;\nexport type OpenRequestedCallback = (event: OpenRequestedEvent) => void;\ntype StableJsonObject = { [key: string]: StableJsonValue };\ntype StableJsonValue =\n\t| string\n\t| number\n\t| boolean\n\t| null\n\t| StableJsonValue[]\n\t| StableJsonObject;\n\n/** Options for opening a flow run. */\nexport type OpenFlowOptions = {\n\t/** Host container used for this open request. Omit to use default floating mounting; pass null to wait for a custom container. */\n\tcontainer?: HTMLElement | null;\n\t/**\n\t * Optional response metadata to preserve with the eventual submission.\n\t * These tags are attached when the flow is opened and do not affect prerendering.\n\t */\n\tmetadata?: ResponseMetadataInput;\n\t/**\n\t * When `true`, the flow view does not show a close button.\n\t * Useful for mobile or embedded contexts where the host handles dismissal (e.g. via a drawer or back gesture).\n\t */\n\thideCloseButton?: boolean;\n};\n\n/** Options for prerendering a flow run. */\nexport type PrerenderFlowOptions = {\n\t/**\n\t * When `true`, the prerendered view does not show a close button.\n\t */\n\thideCloseButton?: boolean;\n};\n\n/** Options for subscribing to flow state updates. */\nexport type SubscribeFlowStateOptions = {\n\t/** Emit the current snapshot immediately. Default `true`. */\n\temitInitial?: boolean;\n\t/** Auto-unsubscribe when the signal is aborted. */\n\tsignal?: AbortSignal;\n};\n\nconst DEFAULT_FLOW_STATE: FlowState = {\n\tisOpen: false,\n\tisLoading: false,\n\twidth: undefined,\n\theight: undefined,\n};\nconst STALE_HANDLE_ERROR_CODE = \"STALE_HANDLE\" as const;\n\nconst isStaleHandleError = (error: unknown): boolean => {\n\tif (error instanceof CommandSettlementError) {\n\t\treturn error.code === STALE_HANDLE_ERROR_CODE;\n\t}\n\tif (!(error instanceof Error)) {\n\t\treturn false;\n\t}\n\treturn error.message.includes(\"flowHandleId is stale\");\n};\n\n/** Instance for a specific flow: open, prefetch, prerender, close, and subscribe to flow state. */\nexport type FlowRun = {\n\t/** The flow/survey ID this instance refers to. */\n\tflowId: string;\n\t/** Open the flow (show the survey). */\n\topen: (options?: OpenFlowOptions) => Promise<void>;\n\t/** Prefetch the flow so it opens faster when you call `open()`. */\n\tprefetch: () => Promise<void>;\n\t/** Prerender the flow into a container (e.g. for a custom dialog). */\n\tprerender: (options?: PrerenderFlowOptions) => Promise<void>;\n\t/** Attach or detach this flow to a specific host container. */\n\tsetContainer: (element: HTMLElement | null) => void;\n\t/** Close this flow. */\n\tclose: () => Promise<void>;\n\t/** Return the latest known flow state snapshot. */\n\tgetFlowState: () => FlowState;\n\t/** Subscribe to open/loading/dimensions; returns an unsubscribe function. */\n\tsubscribeFlowState: (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t) => () => void;\n};\n\n/**\n * getuserfeedback client for loading the widget, opening flows, configuring\n * consent/auth, identifying users, and tracking events.\n *\n * @see https://getuserfeedback.com/docs/reference/javascript-sdk-reference\n */\nexport type Client = {\n\t/** Load the widget script. Call when you created the client with `disableAutoLoad: true`. */\n\tload: () => void;\n\t/** Set how this instance should choose default containers for flows. */\n\tsetDefaultContainerPolicy: (policy: ContainerPolicy) => void;\n\t/** Return the latest known instance-level flow state snapshot. */\n\tgetFlowState: () => FlowState;\n\t/** Subscribe to instance-level flow state updates (eg targeting-triggered opens). */\n\tsubscribeFlowState: (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t) => () => void;\n\t/** Return a flow instance; call .open(), .prefetch(), .prerender(), .close() on it. */\n\tflow: (flowId: string) => FlowRun;\n\t/** Close all open flows. */\n\tclose: () => Promise<void>;\n\t/** Reset widget state and user identity. */\n\treset: () => Promise<void>;\n\t/**\n\t * Update color scheme, consent, or auth. Pass a fresh JWT here after login\n\t * and whenever your auth provider refreshes the session token.\n\t *\n\t * @see https://getuserfeedback.com/docs/security-and-privacy/jwt-auth\n\t */\n\tconfigure: (updates: ConfigureOptions) => Promise<void>;\n\t/**\n\t * Associate the current user with a user ID, traits, and optional external IDs.\n\t *\n\t * Use `options.externalIds` for Segment-compatible identifiers from another\n\t * system. Without a user ID, pass options as `client.identify(traits, options)`,\n\t * or use `client.identify(traits, undefined, options)` when your call site needs\n\t * the explicit three-argument form. Do not put Segment-shaped `externalIds` in\n\t * traits.\n\t *\n\t * @see https://getuserfeedback.com/docs/guides/identity-resolution\n\t */\n\tidentify: {\n\t\t(\n\t\t\tuserId: string,\n\t\t\ttraits?: IdentifyTraits,\n\t\t\toptions?: IdentifyOptions,\n\t\t): Promise<void>;\n\t\t(\n\t\t\ttraits: IdentifyTraits,\n\t\t\tplaceholder: undefined,\n\t\t\toptions?: IdentifyOptions,\n\t\t): Promise<void>;\n\t\t(traits: IdentifyTraits, options?: IdentifyOptions): Promise<void>;\n\t};\n\t/**\n\t * Track a product event from the browser.\n\t *\n\t * Use `options.externalIds` when the event carries a Segment-compatible\n\t * identifier from another system. Do not put Segment-shaped `externalIds` in\n\t * properties.\n\t *\n\t * @see https://getuserfeedback.com/docs/reference/events\n\t */\n\ttrack: (\n\t\teventName: string,\n\t\tproperties?: EventProperties,\n\t\toptions?: EventOptions,\n\t) => Promise<void>;\n\t/** Record the current browser page or a named page location. */\n\tpage: (\n\t\tname?: string,\n\t\tproperties?: EventProperties,\n\t\toptions?: EventOptions,\n\t) => Promise<void>;\n\t/** Record directed relationship observations through the analytics pipeline. */\n\tgraph: GraphOperations;\n\t/** Submit feedback or read the authenticated user's matching feedback. */\n\tfeedback: FeedbackOperations;\n\t/** Subscribe to explicit SDK and client-side targeting open requests, or suppress them — for example if you know the user should not be interrupted.\n\t * For example, when the user is filling out a form, or is in the middle of a multi-step flow.\n\t * Prevention applies only to that presentation attempt; it does not create a\n\t * public retry schedule.\n\t *\n\t * @example — suppress open flow requests if the user is busy\n\t * ```ts\n\t * client.onOpenRequested((event) => {\n\t * if (userIsBusy()) {\n\t * event.preventDefault();\n\t * }\n\t * });\n\t * ```\n\t */\n\tonOpenRequested: (callback: OpenRequestedCallback) => () => void;\n};\n\ntype ClientRegistryEntry = {\n\tclient: Client;\n\tupdateOptions: (\n\t\toptions: ClientOptions,\n\t\tactionRegistry: ActionRegistry,\n\t) => void;\n};\n\nconst openRequestBridgeByClient = new WeakMap<\n\tClient,\n\tReturnType<typeof createOpenRequestBridge>\n>();\n\nconst clientRegistry = new Map<object, Map<string, ClientRegistryEntry>>();\n\nexport const getOpenRequestBridge = (\n\tclient: Client,\n): ReturnType<typeof createOpenRequestBridge> => {\n\tconst bridge = openRequestBridgeByClient.get(client);\n\tif (!bridge) {\n\t\tthrow new Error(\"Open request bridge not found for client instance.\");\n\t}\n\treturn bridge;\n};\n\nconst createClientInstanceId = (): string => {\n\tif (\n\t\ttypeof globalThis.crypto !== \"undefined\" &&\n\t\ttypeof globalThis.crypto.randomUUID === \"function\"\n\t) {\n\t\treturn globalThis.crypto.randomUUID();\n\t}\n\treturn `sdk-${Date.now()}-${Math.random().toString(16).slice(2)}`;\n};\n\nconst toIdentifyCommandPayload = (\n\tidentifyInput: string | IdentifyTraits,\n\ttraitsOrOptions?: IdentifyTraits | IdentifyOptions,\n\toptions?: IdentifyOptions,\n): Extract<Command, { kind: \"identify\" }> => {\n\tif (typeof identifyInput === \"string\") {\n\t\tassertNoSegmentExternalIdsInValueArgument({\n\t\t\targument: traitsOrOptions,\n\t\t\tcommandName: \"identify\",\n\t\t\tvalueArgumentName: \"traits\",\n\t\t\tcallShape: \"identify(userId, traits, { externalIds })\",\n\t\t});\n\t\treturn {\n\t\t\tkind: \"identify\",\n\t\t\tuserId: identifyInput,\n\t\t\ttraits: traitsOrOptions,\n\t\t\toptions,\n\t\t};\n\t}\n\tassertNoSegmentExternalIdsInValueArgument({\n\t\targument: identifyInput,\n\t\tcommandName: \"identify\",\n\t\tvalueArgumentName: \"traits\",\n\t\tcallShape: \"identify(traits, { externalIds })\",\n\t});\n\treturn {\n\t\tkind: \"identify\",\n\t\ttraits: identifyInput,\n\t\toptions: options ?? traitsOrOptions,\n\t};\n};\n\nconst toFlags = (input: FlagsInput | undefined): AppEventFlag[] | undefined => {\n\tif (input === undefined) {\n\t\treturn;\n\t}\n\tif (Array.isArray(input)) {\n\t\treturn input.map((flag) => ({ ...flag }));\n\t}\n\treturn Object.entries(input)\n\t\t.sort(([leftKey], [rightKey]) => leftKey.localeCompare(rightKey))\n\t\t.map(([key, value]) => ({ key, value }));\n};\n\nconst toCapabilities = (\n\tinput: CapabilitiesInput | undefined,\n): AppEventCapability[] | undefined => {\n\tif (input === undefined) {\n\t\treturn;\n\t}\n\treturn input.map((capability) =>\n\t\ttypeof capability === \"string\" ? { key: capability } : { ...capability },\n\t);\n};\n\nconst CIRCULAR_TARGETING_CONTEXT_ERROR =\n\t\"Targeting context cannot contain circular values\";\n\nconst toStableJsonValue = (\n\tvalue: unknown,\n\tancestors: WeakSet<object> = new WeakSet(),\n): StableJsonValue => {\n\tif (\n\t\tvalue === null ||\n\t\ttypeof value === \"string\" ||\n\t\ttypeof value === \"number\" ||\n\t\ttypeof value === \"boolean\"\n\t) {\n\t\treturn value;\n\t}\n\tif (Array.isArray(value)) {\n\t\tif (ancestors.has(value)) {\n\t\t\tthrow new Error(CIRCULAR_TARGETING_CONTEXT_ERROR);\n\t\t}\n\t\tancestors.add(value);\n\t\ttry {\n\t\t\treturn value.map((entryValue) =>\n\t\t\t\ttoStableJsonValue(entryValue, ancestors),\n\t\t\t);\n\t\t} finally {\n\t\t\tancestors.delete(value);\n\t\t}\n\t}\n\tif (typeof value === \"object\") {\n\t\tif (ancestors.has(value)) {\n\t\t\tthrow new Error(CIRCULAR_TARGETING_CONTEXT_ERROR);\n\t\t}\n\t\tancestors.add(value);\n\t\tconst objectValue: StableJsonObject = {};\n\t\ttry {\n\t\t\tfor (const [key, entryValue] of Object.entries(value).sort(\n\t\t\t\t([leftKey], [rightKey]) => leftKey.localeCompare(rightKey),\n\t\t\t)) {\n\t\t\t\tif (entryValue !== undefined) {\n\t\t\t\t\tobjectValue[key] = toStableJsonValue(entryValue, ancestors);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn objectValue;\n\t\t} finally {\n\t\t\tancestors.delete(value);\n\t\t}\n\t}\n\treturn null;\n};\n\nconst toCanonicalTargetingValues = (\n\tvalues: unknown[] | undefined,\n): StableJsonValue[] | null => {\n\tif (values === undefined || values.length === 0) {\n\t\treturn null;\n\t}\n\treturn values\n\t\t.map((value) => {\n\t\t\tconst stableValue = toStableJsonValue(value);\n\t\t\treturn { key: JSON.stringify(stableValue), value: stableValue };\n\t\t})\n\t\t.sort(({ key: leftKey }, { key: rightKey }) =>\n\t\t\tleftKey.localeCompare(rightKey),\n\t\t)\n\t\t.map(({ value }) => value);\n};\n\nconst resolveTargetingContextRegistryKey = (options: ClientOptions): string =>\n\tJSON.stringify({\n\t\tflags: toCanonicalTargetingValues(toFlags(options.flags)),\n\t\tcapabilities: toCanonicalTargetingValues(\n\t\t\ttoCapabilities(options.capabilities),\n\t\t),\n\t});\n\nconst LOADER_RUNTIME_PROBE_TIMEOUT_MS = 120;\n// Once Loader registration has been enqueued, it is ordinary command settlement\n// rather than a short ownership probe. Keep supplied-flow handoff behind that\n// settlement so Core capability negotiation can complete before admission.\nconst LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS = 30_000;\nconst INVALID_COMMAND_ERROR_CODE = \"INVALID_COMMAND\";\nconst SUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL = Symbol.for(\n\t\"@getuserfeedback/sdk/internal/supplied-only-local-client-options/1\",\n);\nconst BUNDLED_DOCS_LOCAL_API_KEY = \"@getuserfeedback/internal/bundled-docs\";\n\ntype MarkedSuppliedOnlyLocalClientOptions = ClientOptions & {\n\t[SUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL]: true;\n};\n\n/** Private runtime inputs for the deployment-owned bundled-docs client. */\nexport type BundledDocsClientOptions = {\n\tloaderUrl: string;\n\tcoreUrl: string;\n\tcolorScheme?: ClientOptions[\"colorScheme\"];\n\tdisableAutoLoad?: boolean;\n};\n\n/**\n * Build options that the public React provider can pass through to the SDK root\n * without exposing local registration in the public options type.\n * Pass the returned object intact; cloning or serializing it deliberately fails\n * closed instead of falling back to persisted registration.\n * See docs/specs/2026-08-02-flow-interaction-model.md.\n */\nexport const createBundledDocsClientOptions = (\n\toptions: BundledDocsClientOptions,\n): ClientOptions => {\n\tconst clientOptions: ClientOptions = {\n\t\tapiKey: BUNDLED_DOCS_LOCAL_API_KEY,\n\t\t_loaderUrl: options.loaderUrl,\n\t\t_coreUrl: options.coreUrl,\n\t\t...(options.colorScheme === undefined\n\t\t\t? {}\n\t\t\t: { colorScheme: options.colorScheme }),\n\t\t...(options.disableAutoLoad === undefined\n\t\t\t? {}\n\t\t\t: { disableAutoLoad: options.disableAutoLoad }),\n\t};\n\tObject.defineProperty(\n\t\tclientOptions,\n\t\tSUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL,\n\t\t{\n\t\t\tconfigurable: false,\n\t\t\tenumerable: false,\n\t\t\tvalue: true,\n\t\t\twritable: false,\n\t\t},\n\t);\n\treturn clientOptions;\n};\n\nconst isSuppliedOnlyLocalClientOptions = (\n\toptions: ClientOptions,\n): options is MarkedSuppliedOnlyLocalClientOptions =>\n\tReflect.get(options, SUPPLIED_ONLY_LOCAL_CLIENT_OPTIONS_SYMBOL) === true;\n\nconst resolveRegistryKey = (\n\toptions: ClientOptions,\n\tregistrationKind: \"persisted\" | \"supplied-only-local\",\n): string =>\n\t`${registrationKind}:${options.apiKey}:${resolveTargetingContextRegistryKey(options)}`;\n\nconst haveSameActionDefinitions = (left: string[], right: string[]): boolean =>\n\tJSON.stringify(left) === JSON.stringify(right);\n\nconst resolveRegistryScope = (): object =>\n\ttypeof window === \"undefined\" ? globalThis : window;\n\nconst getRegistryForScope = (): Map<string, ClientRegistryEntry> => {\n\tconst scope = resolveRegistryScope();\n\tconst existing = clientRegistry.get(scope);\n\tif (existing) {\n\t\treturn existing;\n\t}\n\tconst created = new Map<string, ClientRegistryEntry>();\n\tclientRegistry.set(scope, created);\n\treturn created;\n};\n\n/**\n * Create a getuserfeedback client. Reuses an existing logical client for the\n * same `apiKey` and targeting context. Host-action definitions may change\n * before loading starts; afterward, changing their canonical identities throws\n * while equivalent definitions refresh their handlers.\n */\nexport const createClient = (options: ClientOptions): Client => {\n\tconst suppliedOnlyLocal = isSuppliedOnlyLocalClientOptions(options);\n\tif (!suppliedOnlyLocal && options.apiKey === BUNDLED_DOCS_LOCAL_API_KEY) {\n\t\tthrow new Error(\n\t\t\t\"Bundled docs client options must be passed intact without cloning or serialization.\",\n\t\t);\n\t}\n\tconst {\n\t\tapiKey,\n\t\t_loaderUrl,\n\t\t_coreUrl,\n\t\t_apiUrl,\n\t\t_realtimeUrl,\n\t\tdisableAutoLoad = false,\n\t\tcolorScheme,\n\t\tdisableTelemetry = false,\n\t\tenableDebug = false,\n\t\tdefaultConsent,\n\t\tflags,\n\t\tcapabilities,\n\t\tactions,\n\t} = options;\n\tconst initialActionRegistry = createActionRegistry(actions);\n\tconst registryKey = resolveRegistryKey(\n\t\t{\n\t\t\tapiKey,\n\t\t\t_loaderUrl,\n\t\t\t_coreUrl,\n\t\t\t_apiUrl,\n\t\t\t_realtimeUrl,\n\t\t\tdisableAutoLoad,\n\t\t\tcolorScheme,\n\t\t\tdisableTelemetry,\n\t\t\tenableDebug,\n\t\t\tdefaultConsent,\n\t\t\tflags,\n\t\t\tcapabilities,\n\t\t\tactions,\n\t\t},\n\t\tsuppliedOnlyLocal ? \"supplied-only-local\" : \"persisted\",\n\t);\n\tconst registry = getRegistryForScope();\n\tconst existing = registry.get(registryKey);\n\tif (existing) {\n\t\texisting.updateOptions(\n\t\t\t{\n\t\t\t\tapiKey,\n\t\t\t\t_loaderUrl,\n\t\t\t\t_coreUrl,\n\t\t\t\t_apiUrl,\n\t\t\t\t_realtimeUrl,\n\t\t\t\tdisableAutoLoad,\n\t\t\t\tcolorScheme,\n\t\t\t\tdisableTelemetry,\n\t\t\t\tenableDebug,\n\t\t\t\tdefaultConsent,\n\t\t\t\tflags,\n\t\t\t\tcapabilities,\n\t\t\t\tactions,\n\t\t\t},\n\t\t\tinitialActionRegistry,\n\t\t);\n\t\tif (!disableAutoLoad) {\n\t\t\texisting.client.load();\n\t\t}\n\t\treturn existing.client;\n\t}\n\n\tlet loaderUrlConfig = _loaderUrl;\n\tlet coreUrlConfig = _coreUrl;\n\tlet apiUrlConfig = _apiUrl;\n\tlet realtimeUrlConfig = _realtimeUrl;\n\n\tconst notifyError = (_error: unknown): void => {\n\t\t// No-op: track/use hooks removed from public API.\n\t};\n\tconst hostWindow =\n\t\ttypeof window !== \"undefined\" &&\n\t\ttypeof window.addEventListener === \"function\" &&\n\t\ttypeof window.removeEventListener === \"function\"\n\t\t\t? window\n\t\t\t: null;\n\tconst hostDocument =\n\t\ttypeof document !== \"undefined\" &&\n\t\ttypeof document.createElement === \"function\" &&\n\t\tdocument.head !== null\n\t\t\t? document\n\t\t\t: null;\n\n\tconst sdkVersion = SDK_VERSION;\n\tconst clientInstanceId = createClientInstanceId();\n\tconst openRequestBridge = createOpenRequestBridge();\n\tconst clientMeta: ClientMeta = {\n\t\tloader: \"sdk\",\n\t\tclientName: \"@getuserfeedback/sdk\",\n\t\tclientVersion: sdkVersion,\n\t\ttransport: \"snippet\",\n\t};\n\n\tlet defaultConsentConfig = defaultConsent;\n\tlet colorSchemeConfig = colorScheme;\n\tlet flagsConfig = toFlags(flags);\n\tlet capabilitiesConfig = toCapabilities(capabilities);\n\tlet actionRegistry = initialActionRegistry;\n\n\tconst buildRuntimeEndpoints = (): InitOptions[\"runtimeEndpoints\"] => {\n\t\tif (!(coreUrlConfig || apiUrlConfig || realtimeUrlConfig)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn {\n\t\t\t...(coreUrlConfig !== undefined ? { coreUrl: coreUrlConfig } : {}),\n\t\t\t...(apiUrlConfig !== undefined ? { apiUrl: apiUrlConfig } : {}),\n\t\t\t...(realtimeUrlConfig !== undefined\n\t\t\t\t? { realtimeUrl: realtimeUrlConfig }\n\t\t\t\t: {}),\n\t\t};\n\t};\n\n\tconst buildInitOpts = (includeHostActions = true): InitOptions => {\n\t\tconst runtimeEndpoints = buildRuntimeEndpoints();\n\t\tconst hostActionDefinitions = includeHostActions\n\t\t\t? actionRegistry.listDefinitions()\n\t\t\t: [];\n\t\tconst protocolCapabilities = [\n\t\t\t...SDK_PROTOCOL_CAPABILITIES,\n\t\t\t...(actionRegistry.getOpenUrlHandler()\n\t\t\t\t? [OPEN_URL_ACTION_CAPABILITY, OPEN_URL_ACTION_V1_CAPABILITY]\n\t\t\t\t: []),\n\t\t];\n\t\treturn {\n\t\t\tapiKey,\n\t\t\tclientMeta,\n\t\t\tcapabilities: [...protocolCapabilities],\n\t\t\t...(flagsConfig !== undefined && {\n\t\t\t\tflags: flagsConfig.map((flag) => ({ ...flag })),\n\t\t\t}),\n\t\t\t...(capabilitiesConfig !== undefined && {\n\t\t\t\thostCapabilities: capabilitiesConfig.map((capability) => ({\n\t\t\t\t\t...capability,\n\t\t\t\t})),\n\t\t\t}),\n\t\t\t...(hostActionDefinitions.length > 0 && {\n\t\t\t\thostActions: hostActionDefinitions,\n\t\t\t}),\n\t\t\t...(runtimeEndpoints !== undefined ? { runtimeEndpoints } : {}),\n\t\t\t...(colorSchemeConfig !== undefined && {\n\t\t\t\tcolorScheme: colorSchemeConfig,\n\t\t\t}),\n\t\t\t...(disableTelemetry !== undefined && { disableTelemetry }),\n\t\t\t...(enableDebug !== undefined && { enableDebug }),\n\t\t\t...(defaultConsentConfig !== undefined && {\n\t\t\t\tdefaultConsent: defaultConsentConfig,\n\t\t\t}),\n\t\t};\n\t};\n\n\tlet loaderRequested = false;\n\tlet pendingLoad: Promise<void> | null = null;\n\tlet pendingRegistrationProbe: Promise<void> | null = null;\n\tlet disableAutoLoadConfig = disableAutoLoad;\n\tconst flowStateByHandle = new Map<FlowHandleId, FlowState>();\n\tconst claimedFlowStateHandles = new Set<FlowHandleId>();\n\tconst pendingFlowStateHandles = new Set<FlowHandleId>();\n\tlet isFlowHandleAllocationActive = false;\n\tlet isFlowHandleAllocationLocked = false;\n\tconst flowHandleAllocationWaiters: Array<(release: () => void) => void> = [];\n\tlet instanceFlowState: FlowState = DEFAULT_FLOW_STATE;\n\tconst hostEventHub = createClientHostEventHub({\n\t\tinstanceId: clientInstanceId,\n\t\tonNavigationRequested: (detail) => {\n\t\t\tconst target =\n\t\t\t\tdetail.version === 1 && detail.target === \"_blank\"\n\t\t\t\t\t? undefined\n\t\t\t\t\t: detail.version === OPEN_URL_ACTION_VERSION &&\n\t\t\t\t\t\t\t(detail.target === undefined ||\n\t\t\t\t\t\t\t\tdetail.target === \"self\" ||\n\t\t\t\t\t\t\t\tdetail.target === \"blank\")\n\t\t\t\t\t\t? detail.target\n\t\t\t\t\t\t: null;\n\t\t\tif (target === null) {\n\t\t\t\treturn \"unhandled\";\n\t\t\t}\n\t\t\tconst handler = actionRegistry.getOpenUrlHandler();\n\t\t\tif (!handler) {\n\t\t\t\treturn \"unhandled\";\n\t\t\t}\n\t\t\tconst outcome = handler({\n\t\t\t\turl: detail.url,\n\t\t\t\t...(target === undefined ? {} : { target }),\n\t\t\t});\n\t\t\tif (outcome === \"handled\") {\n\t\t\t\treturn \"succeeded\";\n\t\t\t}\n\t\t\tif (outcome === \"unhandled\") {\n\t\t\t\treturn \"unhandled\";\n\t\t\t}\n\t\t\tthrow new TypeError(\n\t\t\t\t'Registered open-url action must return \"handled\" or \"unhandled\" synchronously.',\n\t\t\t);\n\t\t},\n\t\twindowRef: hostWindow,\n\t});\n\n\tconst resolveRequiredRuntimeUrls = (): {\n\t\tloaderUrl: string;\n\t\tcoreUrl: string;\n\t\tapiUrl: string;\n\t\trealtimeUrl?: string;\n\t} => {\n\t\tconst runtimeUrls = resolveStartupRuntimeUrls({\n\t\t\tapiKey,\n\t\t\t_loaderUrl: loaderUrlConfig,\n\t\t\t_coreUrl: coreUrlConfig,\n\t\t\t_apiUrl: apiUrlConfig,\n\t\t\t_realtimeUrl: realtimeUrlConfig,\n\t\t});\n\t\tloaderUrlConfig = runtimeUrls.loaderUrl;\n\t\tcoreUrlConfig = runtimeUrls.coreUrl;\n\t\tapiUrlConfig = runtimeUrls.apiUrl;\n\t\trealtimeUrlConfig = runtimeUrls.realtimeUrl;\n\t\treturn runtimeUrls;\n\t};\n\n\tconst cloneFlowState = (state: FlowState): FlowState => ({\n\t\tisOpen: state.isOpen,\n\t\tisLoading: state.isLoading,\n\t\twidth: state.width,\n\t\theight: state.height,\n\t});\n\n\tconst getFlowStateForHandle = (flowHandleId: FlowHandleId): FlowState => {\n\t\tconst existing = flowStateByHandle.get(flowHandleId);\n\t\tif (!existing) {\n\t\t\treturn cloneFlowState(DEFAULT_FLOW_STATE);\n\t\t}\n\t\treturn cloneFlowState(existing);\n\t};\n\n\tconst setFlowStateForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t\tstate: FlowState,\n\t): void => {\n\t\tflowStateByHandle.set(flowHandleId, cloneFlowState(state));\n\t};\n\n\t// Core can publish state for a newly allocated supplied Flow before the\n\t// command settlement tells its FlowRun which handle was allocated. Keep the\n\t// client-owned snapshot current so binding that handle can replay the state\n\t// instead of losing the first open transition.\n\thostEventHub.subscribeFlowState((detail): void => {\n\t\tconst isClaimedHandle = claimedFlowStateHandles.has(detail.flowHandleId);\n\t\tif (!isClaimedHandle && !isFlowHandleAllocationActive) {\n\t\t\treturn;\n\t\t}\n\t\tsetFlowStateForHandle(detail.flowHandleId, {\n\t\t\tisOpen: detail.isOpen,\n\t\t\tisLoading: detail.isLoading,\n\t\t\twidth: detail.width,\n\t\t\theight: detail.height,\n\t\t});\n\t\tif (!isClaimedHandle) {\n\t\t\tpendingFlowStateHandles.add(detail.flowHandleId);\n\t\t}\n\t});\n\tconst beginFlowHandleAllocation = (): void => {\n\t\tisFlowHandleAllocationActive = true;\n\t};\n\tconst clearPendingFlowHandleState = (): void => {\n\t\tfor (const flowHandleId of pendingFlowStateHandles) {\n\t\t\tflowStateByHandle.delete(flowHandleId);\n\t\t}\n\t\tpendingFlowStateHandles.clear();\n\t};\n\tconst endFlowHandleAllocation = (): void => {\n\t\tisFlowHandleAllocationActive = false;\n\t\tclearPendingFlowHandleState();\n\t};\n\t/**\n\t * Flow-state events do not carry the allocating command requestId. Serialize\n\t * only handle-free handoffs so a pre-settlement snapshot has one possible\n\t * owner. Other commands remain concurrent. If allocation concurrency becomes\n\t * a product requirement, add explicit event correlation instead of a ledger.\n\t */\n\tconst createFlowHandleAllocationRelease = (): (() => void) => {\n\t\tlet released = false;\n\t\treturn () => {\n\t\t\tif (released) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treleased = true;\n\t\t\tconst next = flowHandleAllocationWaiters.shift();\n\t\t\tif (next) {\n\t\t\t\tnext(createFlowHandleAllocationRelease());\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tisFlowHandleAllocationLocked = false;\n\t\t};\n\t};\n\tconst acquireFlowHandleAllocation = ():\n\t\t| (() => void)\n\t\t| Promise<() => void> => {\n\t\tif (!isFlowHandleAllocationLocked) {\n\t\t\tisFlowHandleAllocationLocked = true;\n\t\t\treturn createFlowHandleAllocationRelease();\n\t\t}\n\t\treturn new Promise<() => void>((resolve) => {\n\t\t\tflowHandleAllocationWaiters.push(resolve);\n\t\t});\n\t};\n\n\tconst getInstanceFlowState = (): FlowState =>\n\t\tcloneFlowState(instanceFlowState);\n\n\tconst setInstanceFlowState = (state: FlowState): void => {\n\t\tinstanceFlowState = cloneFlowState(state);\n\t};\n\n\tconst ensureFlowStateForHandle = (flowHandleId: FlowHandleId): void => {\n\t\tif (!flowStateByHandle.has(flowHandleId)) {\n\t\t\tsetFlowStateForHandle(flowHandleId, DEFAULT_FLOW_STATE);\n\t\t}\n\t};\n\n\tconst subscribeFlowHandleInvalidation = (\n\t\tsubscriber: (flowHandleId: FlowHandleId) => void,\n\t): (() => void) => hostEventHub.subscribeFlowHandleInvalidation(subscriber);\n\n\tconst subscribeFlowStateCacheForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t): (() => void) =>\n\t\thostEventHub.subscribeFlowStateForHandle(flowHandleId, (detail): void => {\n\t\t\tconst nextState: FlowState = {\n\t\t\t\tisOpen: detail.isOpen,\n\t\t\t\tisLoading: detail.isLoading,\n\t\t\t\twidth: detail.width,\n\t\t\t\theight: detail.height,\n\t\t\t};\n\t\t\tsetFlowStateForHandle(flowHandleId, nextState);\n\t\t});\n\n\tconst isLoaderRequested = (): boolean => loaderRequested;\n\n\tconst enqueue = (\n\t\tenvelope: CommandEnvelope | InternalHostCommandEnvelope,\n\t): void => {\n\t\tif (!hostWindow) {\n\t\t\treturn;\n\t\t}\n\t\tif (!hostWindow.__getuserfeedback_queue) {\n\t\t\thostWindow.__getuserfeedback_queue = [];\n\t\t}\n\t\t// Stamp instanceId and clientMeta so the loader can route commands.\n\t\tconst stamped: CommandEnvelope | InternalHostCommandEnvelope = {\n\t\t\t...envelope,\n\t\t\tinstanceId: envelope.instanceId ?? clientInstanceId,\n\t\t\tclientMeta: envelope.clientMeta ?? clientMeta,\n\t\t};\n\t\thostWindow.__getuserfeedback_queue.push(stamped);\n\t};\n\n\tconst enqueueInstanceRegistration = (\n\t\trequestId?: string,\n\t\tincludeHostActions = true,\n\t): string => {\n\t\tif (suppliedOnlyLocal) {\n\t\t\tif (!coreUrlConfig) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"_coreUrl is not resolved for bundled docs registration\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst localRequestId = requestId ?? createCommandRequestId();\n\t\t\tconst command: InternalHostSuppliedOnlyLocalInitCommandPayload = {\n\t\t\t\tkind: \"init\",\n\t\t\t\topts: suppliedOnlyLocalInitOptionsSchema.parse({\n\t\t\t\t\tregistration: {\n\t\t\t\t\t\tkind: \"supplied-only-local\",\n\t\t\t\t\t\tprofile: \"bundled-docs\",\n\t\t\t\t\t},\n\t\t\t\t\t...(colorSchemeConfig === undefined\n\t\t\t\t\t\t? {}\n\t\t\t\t\t\t: { colorScheme: colorSchemeConfig }),\n\t\t\t\t}),\n\t\t\t\truntimeEndpoints: { coreUrl: coreUrlConfig },\n\t\t\t};\n\t\t\tenqueue({\n\t\t\t\tversion: \"1\",\n\t\t\t\trequestId: localRequestId,\n\t\t\t\tidempotencyKey: localRequestId,\n\t\t\t\tcommand,\n\t\t\t});\n\t\t\treturn localRequestId;\n\t\t}\n\t\tconst envelope = createCommandEnvelope({\n\t\t\tinstanceId: clientInstanceId,\n\t\t\trequestId,\n\t\t\tcommand: { kind: \"init\", opts: buildInitOpts(includeHostActions) },\n\t\t});\n\t\tenqueue(envelope);\n\t\treturn envelope.requestId;\n\t};\n\n\tconst runAfterRegistrationProbe = (run: () => void): void => {\n\t\tconst registrationProbe = pendingRegistrationProbe;\n\t\tif (!registrationProbe) {\n\t\t\trun();\n\t\t\treturn;\n\t\t}\n\t\tvoid registrationProbe.then(run);\n\t};\n\n\tconst enqueueSetDefaultContainerPolicy = (policy: ContainerPolicy): void => {\n\t\trunAfterRegistrationProbe(() => {\n\t\t\tenqueue(\n\t\t\t\tcreateCommandEnvelope({\n\t\t\t\t\tcommand: { kind: \"setDefaultContainerPolicy\", policy },\n\t\t\t\t}),\n\t\t\t);\n\t\t});\n\t};\n\n\tconst enqueueSetContainer = (\n\t\tflowHandleId: FlowHandleId,\n\t\telement: HTMLElement | null,\n\t): void => {\n\t\tenqueue(\n\t\t\tcreateCommandEnvelope({\n\t\t\t\tcommand: { kind: \"setContainer\", flowHandleId, container: element },\n\t\t\t}),\n\t\t);\n\t};\n\n\tconst reportAsyncError = <T>(promise: Promise<T>): Promise<T> => {\n\t\treturn promise.catch((error) => {\n\t\t\tnotifyError(error);\n\t\t\tthrow error;\n\t\t});\n\t};\n\n\tconst ensureCommandsCanRun = (): void => {\n\t\tif (!hostWindow) {\n\t\t\treturn;\n\t\t}\n\t\tif (!isLoaderRequested()) {\n\t\t\tif (disableAutoLoadConfig) {\n\t\t\t\tthrow new Error(\"Widget not loaded. Call client.load() first.\");\n\t\t\t}\n\t\t\tload();\n\t\t}\n\t};\n\n\tconst assertInlineFlowRuntimeSupport = (): void => {\n\t\tconst runtimeMarker = hostWindow?.[LOADER_RUNTIME_GLOBAL_KEY];\n\t\tif (!runtimeMarker?.alive) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Inline flows require an active compatible Loader runtime.\",\n\t\t\t);\n\t\t}\n\t\tif (runtimeMarker.protocolVersion !== LOADER_RUNTIME_PROTOCOL_VERSION) {\n\t\t\tthrow new Error(\n\t\t\t\t`Incompatible loader runtime protocol: expected ${LOADER_RUNTIME_PROTOCOL_VERSION}, received ${runtimeMarker.protocolVersion ?? \"unknown\"}`,\n\t\t\t);\n\t\t}\n\t\tif (!runtimeMarker.features?.includes(UNIFIED_FLOW_RUNTIME_V1_CAPABILITY)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Inline flows require Loader feature ${UNIFIED_FLOW_RUNTIME_V1_CAPABILITY}.`,\n\t\t\t);\n\t\t}\n\t};\n\n\t/** Enqueue a command and await its settlement.\n\t * The loader resolves instanceId from the instance registry. */\n\tconst rawSettlementDispatch = createCommandSettlementDispatch((cmd) =>\n\t\tenqueue(cmd),\n\t);\n\t// createCommandSettlementDispatch inserts the envelope synchronously before\n\t// returning its settlement promise, which makes invocation the handoff edge.\n\tconst handOffCommand = (input: Command) => rawSettlementDispatch(input);\n\tconst handOffInlineFlowCommand = (\n\t\tinput: InternalHostInlineFlowCommandPayload,\n\t) => {\n\t\tconst requestId = createCommandRequestId();\n\t\tenqueue({\n\t\t\tversion: \"1\",\n\t\t\trequestId,\n\t\t\tidempotencyKey: requestId,\n\t\t\tcommand: input,\n\t\t});\n\t\treturn waitForCommandSettlement({\n\t\t\trequestId,\n\t\t\twindowRef: hostWindow ?? undefined,\n\t\t});\n\t};\n\tconst transportAdmission = createClientTransportAdmission();\n\tconst prepareCommandHandoff = (): void | Promise<void> => {\n\t\tensureCommandsCanRun();\n\t\tconst registrationProbe = pendingRegistrationProbe;\n\t\tif (registrationProbe) {\n\t\t\treturn registrationProbe;\n\t\t}\n\t};\n\tconst prepareInlineFlowCommandHandoff = (): void | Promise<void> => {\n\t\tensureCommandsCanRun();\n\t\tconst startup = pendingLoad ?? pendingRegistrationProbe;\n\t\tif (startup) {\n\t\t\treturn startup.then(assertInlineFlowRuntimeSupport);\n\t\t}\n\t\tassertInlineFlowRuntimeSupport();\n\t};\n\tconst dispatch = async (input: Command): Promise<void> => {\n\t\tconst preparation = prepareCommandHandoff();\n\t\tif (preparation) {\n\t\t\tawait preparation;\n\t\t}\n\t\tawait rawSettlementDispatch(input);\n\t};\n\n\tconst enqueueConfigUpdate = (opts: ConfigureOptions): void => {\n\t\tif (!isLoaderRequested()) {\n\t\t\treturn;\n\t\t}\n\t\trunAfterRegistrationProbe(() => {\n\t\t\tenqueue(\n\t\t\t\tcreateCommandEnvelope({\n\t\t\t\t\tcommand: { kind: \"configure\", opts },\n\t\t\t\t}),\n\t\t\t);\n\t\t});\n\t};\n\n\tconst toConfigureCommandOptions = (\n\t\tupdates: ConfigureOptions,\n\t): ConfigureOptions => {\n\t\tconst nextCapabilities = toCapabilities(updates.capabilities);\n\t\treturn {\n\t\t\t...(updates.colorScheme !== undefined && {\n\t\t\t\tcolorScheme: updates.colorScheme,\n\t\t\t}),\n\t\t\t...(updates.consent !== undefined && { consent: updates.consent }),\n\t\t\t...(updates.auth !== undefined && { auth: updates.auth }),\n\t\t\t...(nextCapabilities !== undefined && {\n\t\t\t\tcapabilities: nextCapabilities,\n\t\t\t}),\n\t\t};\n\t};\n\n\tconst updateOptions = (\n\t\tnext: ClientOptions,\n\t\tnextActionRegistry: ActionRegistry,\n\t): void => {\n\t\tconst definitionsChanged = !haveSameActionDefinitions(\n\t\t\tactionRegistry.listRegistrationIdentities(),\n\t\t\tnextActionRegistry.listRegistrationIdentities(),\n\t\t);\n\t\tif (definitionsChanged && (isLoaderRequested() || pendingLoad !== null)) {\n\t\t\tconst error = new Error(\n\t\t\t\t\"actions definitions cannot be changed after widget init; keeping original registrations\",\n\t\t\t);\n\t\t\tnotifyError(error);\n\t\t\tthrow error;\n\t\t}\n\t\tactionRegistry = nextActionRegistry;\n\t\tdisableAutoLoadConfig = next.disableAutoLoad ?? disableAutoLoadConfig;\n\t\tdefaultConsentConfig = next.defaultConsent ?? defaultConsentConfig;\n\t\tif (!isLoaderRequested() && pendingLoad === null) {\n\t\t\tif (next.colorScheme !== undefined) {\n\t\t\t\tcolorSchemeConfig = next.colorScheme;\n\t\t\t}\n\t\t\tif (next.flags !== undefined) {\n\t\t\t\tflagsConfig = toFlags(next.flags);\n\t\t\t}\n\t\t\tif (next.capabilities !== undefined) {\n\t\t\t\tcapabilitiesConfig = toCapabilities(next.capabilities);\n\t\t\t}\n\t\t}\n\n\t\tif (next._loaderUrl !== undefined && next._loaderUrl !== loaderUrlConfig) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_loaderUrl cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\tloaderUrlConfig = next._loaderUrl;\n\t\t\t}\n\t\t}\n\n\t\tif (next._coreUrl !== undefined && next._coreUrl !== coreUrlConfig) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_coreUrl cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\tcoreUrlConfig = next._coreUrl;\n\t\t\t}\n\t\t}\n\n\t\tif (next._apiUrl !== undefined && next._apiUrl !== apiUrlConfig) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_apiUrl cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\tapiUrlConfig = next._apiUrl;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tnext._realtimeUrl !== undefined &&\n\t\t\tnext._realtimeUrl !== realtimeUrlConfig\n\t\t) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_realtimeUrl cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\trealtimeUrlConfig = next._realtimeUrl;\n\t\t\t}\n\t\t}\n\n\t\tapplyStartupConfig(next);\n\n\t\tif (!disableAutoLoadConfig && !isLoaderRequested()) {\n\t\t\tload();\n\t\t}\n\t};\n\n\tconst applyStartupConfig = (next: ClientOptions): void => {\n\t\t// Send configure payload from next (colorScheme only from ClientOptions).\n\t\tif (!isLoaderRequested()) return;\n\t\tconst opts: ConfigureOptions = {};\n\t\tif (next.colorScheme !== undefined) opts.colorScheme = next.colorScheme;\n\t\tif (next.capabilities !== undefined) {\n\t\t\tcapabilitiesConfig = toCapabilities(next.capabilities);\n\t\t\topts.capabilities = capabilitiesConfig;\n\t\t}\n\t\tenqueueConfigUpdate(opts);\n\t};\n\n\tconst load = (): void => {\n\t\tif (!hostWindow || !hostDocument) {\n\t\t\treturn;\n\t\t}\n\t\tif (isLoaderRequested() || pendingLoad) {\n\t\t\treturn;\n\t\t}\n\t\tconst runtimeUrls = resolveRequiredRuntimeUrls();\n\n\t\tconst appendLoaderScript = (): void => {\n\t\t\tconst scriptUrl = runtimeUrls.loaderUrl;\n\t\t\tif (\n\t\t\t\t!hostDocument.querySelector(`link[href=\"${scriptUrl}\"][rel=\"preload\"]`)\n\t\t\t) {\n\t\t\t\tconst preload = hostDocument.createElement(\"link\");\n\t\t\t\tpreload.rel = \"preload\";\n\t\t\t\tpreload.as = \"script\";\n\t\t\t\tpreload.href = scriptUrl;\n\t\t\t\thostDocument.head.appendChild(preload);\n\t\t\t}\n\n\t\t\tconst script = hostDocument.createElement(\"script\");\n\t\t\tscript.src = scriptUrl;\n\t\t\tscript.async = true;\n\t\t\tif (script.dataset) {\n\t\t\t\tscript.dataset.disableAutoRegister = \"true\";\n\t\t\t} else if (typeof script.setAttribute === \"function\") {\n\t\t\t\tscript.setAttribute(\"data-disable-auto-register\", \"true\");\n\t\t\t}\n\t\t\thostDocument.head.appendChild(script);\n\t\t};\n\n\t\tconst runtimeMarker = hostWindow[LOADER_RUNTIME_GLOBAL_KEY];\n\t\tif (runtimeMarker?.alive) {\n\t\t\tconst protocolVersion = runtimeMarker.protocolVersion;\n\t\t\tif (protocolVersion !== LOADER_RUNTIME_PROTOCOL_VERSION) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Incompatible loader runtime protocol: expected ${LOADER_RUNTIME_PROTOCOL_VERSION}, received ${protocolVersion ?? \"unknown\"}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst requestId = enqueueInstanceRegistration();\n\t\t\tloaderRequested = true;\n\t\t\tif (\n\t\t\t\t!runtimeMarker.features?.includes(UNIFIED_FLOW_RUNTIME_V1_CAPABILITY)\n\t\t\t) {\n\t\t\t\tlet trackedPending: Promise<void>;\n\t\t\t\tconst pending = waitForCommandSettlement({\n\t\t\t\t\trequestId,\n\t\t\t\t\twindowRef: hostWindow,\n\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t\t})\n\t\t\t\t\t.then(() => {})\n\t\t\t\t\t.catch((error) => {\n\t\t\t\t\t\tnotifyError(error);\n\t\t\t\t\t});\n\t\t\t\ttrackedPending = pending.finally(() => {\n\t\t\t\t\tif (pendingRegistrationProbe === trackedPending) {\n\t\t\t\t\t\tpendingRegistrationProbe = null;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tpendingRegistrationProbe = trackedPending;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst hasCommandQueue = Array.isArray(hostWindow.__getuserfeedback_queue);\n\t\tif (!hasCommandQueue) {\n\t\t\tconst requestId = enqueueInstanceRegistration();\n\t\t\tappendLoaderScript();\n\t\t\tloaderRequested = true;\n\t\t\tlet trackedPending: Promise<void>;\n\t\t\tconst pending = waitForCommandSettlement({\n\t\t\t\trequestId,\n\t\t\t\twindowRef: hostWindow,\n\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t})\n\t\t\t\t.then(() => {})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tnotifyError(error);\n\t\t\t\t});\n\t\t\ttrackedPending = pending.finally(() => {\n\t\t\t\tif (pendingLoad === trackedPending) {\n\t\t\t\t\tpendingLoad = null;\n\t\t\t\t}\n\t\t\t});\n\t\t\tpendingLoad = trackedPending;\n\t\t\treturn;\n\t\t}\n\n\t\tloaderRequested = true;\n\n\t\tlet trackedPending: Promise<void>;\n\t\tconst pending = (async () => {\n\t\t\tconst requestId = createCommandRequestId();\n\t\t\tenqueueInstanceRegistration(requestId);\n\t\t\ttry {\n\t\t\t\tawait waitForCommandSettlement({\n\t\t\t\t\trequestId,\n\t\t\t\t\twindowRef: hostWindow,\n\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_PROBE_TIMEOUT_MS,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof CommandSettlementTimeoutError) {\n\t\t\t\t\tappendLoaderScript();\n\t\t\t\t\tawait waitForCommandSettlement({\n\t\t\t\t\t\trequestId,\n\t\t\t\t\t\twindowRef: hostWindow,\n\t\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\terror instanceof CommandSettlementError &&\n\t\t\t\t\terror.code === INVALID_COMMAND_ERROR_CODE &&\n\t\t\t\t\tactionRegistry.listDefinitions().length > 0\n\t\t\t\t) {\n\t\t\t\t\tconst fallbackRequestId = createCommandRequestId();\n\t\t\t\t\tenqueueInstanceRegistration(fallbackRequestId, false);\n\t\t\t\t\tawait waitForCommandSettlement({\n\t\t\t\t\t\trequestId: fallbackRequestId,\n\t\t\t\t\t\twindowRef: hostWindow,\n\t\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t})().catch((error) => {\n\t\t\tnotifyError(error);\n\t\t});\n\t\ttrackedPending = pending.finally(() => {\n\t\t\tif (pendingLoad === trackedPending) {\n\t\t\t\tpendingLoad = null;\n\t\t\t}\n\t\t\tif (pendingRegistrationProbe === trackedPending) {\n\t\t\t\tpendingRegistrationProbe = null;\n\t\t\t}\n\t\t});\n\t\tpendingLoad = trackedPending;\n\t\tif (actionRegistry.listDefinitions().length > 0) {\n\t\t\tpendingRegistrationProbe = trackedPending;\n\t\t}\n\t};\n\n\tconst subscribeFlowStateForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t): (() => void) => {\n\t\tif (options?.emitInitial ?? true) {\n\t\t\tcallback(getFlowStateForHandle(flowHandleId));\n\t\t}\n\t\treturn hostEventHub.subscribeFlowStateForHandle(\n\t\t\tflowHandleId,\n\t\t\t(detail): void => {\n\t\t\t\tconst nextState: FlowState = {\n\t\t\t\t\tisOpen: detail.isOpen,\n\t\t\t\t\tisLoading: detail.isLoading,\n\t\t\t\t\twidth: detail.width,\n\t\t\t\t\theight: detail.height,\n\t\t\t\t};\n\t\t\t\tsetFlowStateForHandle(flowHandleId, nextState);\n\t\t\t\tcallback(cloneFlowState(nextState));\n\t\t\t},\n\t\t\t{ signal: options?.signal },\n\t\t);\n\t};\n\n\tconst subscribeFlowStateForInstance = (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t): (() => void) => {\n\t\tif (options?.emitInitial ?? true) {\n\t\t\tcallback(getInstanceFlowState());\n\t\t}\n\t\treturn hostEventHub.subscribeInstanceFlowState(\n\t\t\t(detail): void => {\n\t\t\t\tconst nextState: FlowState = {\n\t\t\t\t\tisOpen: detail.isOpen,\n\t\t\t\t\tisLoading: detail.isLoading,\n\t\t\t\t\twidth: detail.width,\n\t\t\t\t\theight: detail.height,\n\t\t\t\t};\n\t\t\t\tsetInstanceFlowState(nextState);\n\t\t\t\tcallback(cloneFlowState(nextState));\n\t\t\t},\n\t\t\t{ signal: options?.signal },\n\t\t);\n\t};\n\n\tconst resetFlowRunsForClientBarrier = new Set<() => void>();\n\tlet deferredFlowRunNotifications: Array<() => void> | null = null;\n\n\tfunction createFlowRun(target: { flowId: string }): FlowRun;\n\tfunction createFlowRun(target: { flow: InlineFlow }): InlineFlowRun;\n\tfunction createFlowRun(target: FlowRunTarget): FlowRun | InlineFlowRun {\n\t\tconst openRequestController = createFlowOpenRequestController();\n\t\tlet latestContainer: HTMLElement | null | undefined;\n\t\tlet unsubscribeFlowStateCache: (() => void) | null = null;\n\t\ttype SubscriberEntry = {\n\t\t\tcallback: FlowStateCallback;\n\t\t\toptions?: SubscribeFlowStateOptions;\n\t\t\tunsubscribe: (() => void) | null;\n\t\t};\n\t\tconst activeSubscribers = new Set<SubscriberEntry>();\n\t\tconst handleClient = createFlowCommandHandleController<\n\t\t\tFlowHandleId,\n\t\t\t{\n\t\t\t\tok: boolean;\n\t\t\t\tkind: string;\n\t\t\t\tresult?: unknown;\n\t\t\t}\n\t\t>({\n\t\t\tgetHandleIdFromSettlement: (settlement) => {\n\t\t\t\tconst handle = getFlowHandleFromSettlementDetail(settlement);\n\t\t\t\treturn handle?.flowHandleId;\n\t\t\t},\n\t\t\tisStaleHandleError,\n\t\t\tonClearResolvedHandle: (previousFlowHandleId) => {\n\t\t\t\tclaimedFlowStateHandles.delete(previousFlowHandleId);\n\t\t\t\tpendingFlowStateHandles.delete(previousFlowHandleId);\n\t\t\t\tif (unsubscribeFlowStateCache) {\n\t\t\t\t\tunsubscribeFlowStateCache();\n\t\t\t\t\tunsubscribeFlowStateCache = null;\n\t\t\t\t}\n\t\t\t\tsetFlowStateForHandle(previousFlowHandleId, DEFAULT_FLOW_STATE);\n\t\t\t\trebindSubscribersToCurrentHandle();\n\t\t\t\tconst subscribersAtReset = [...activeSubscribers];\n\t\t\t\tconst notify = (): void =>\n\t\t\t\t\tnotifySubscribersWithDefaultState(subscribersAtReset);\n\t\t\t\tif (deferredFlowRunNotifications) {\n\t\t\t\t\tdeferredFlowRunNotifications.push(notify);\n\t\t\t\t} else {\n\t\t\t\t\tnotify();\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tconst bindSubscriberToCurrentHandle = (\n\t\t\tsubscriber: SubscriberEntry,\n\t\t\temitCurrent = false,\n\t\t): void => {\n\t\t\tif (subscriber.unsubscribe) {\n\t\t\t\tsubscriber.unsubscribe();\n\t\t\t\tsubscriber.unsubscribe = null;\n\t\t\t}\n\t\t\tif (subscriber.options?.signal?.aborted) {\n\t\t\t\tactiveSubscribers.delete(subscriber);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\tif (!flowHandleId) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst notifySubscriber = (state: FlowState): void => {\n\t\t\t\ttry {\n\t\t\t\t\tsubscriber.callback(state);\n\t\t\t\t} catch {\n\t\t\t\t\t// Public observers cannot interrupt handle publication or prevent\n\t\t\t\t\t// the remaining lifecycle projections from binding.\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst unsubscribe = subscribeFlowStateForHandle(\n\t\t\t\tflowHandleId,\n\t\t\t\tnotifySubscriber,\n\t\t\t\temitCurrent\n\t\t\t\t\t? { ...subscriber.options, emitInitial: true }\n\t\t\t\t\t: subscriber.options,\n\t\t\t);\n\t\t\tif (subscriber.options?.signal?.aborted) {\n\t\t\t\tunsubscribe();\n\t\t\t\tactiveSubscribers.delete(subscriber);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (\n\t\t\t\thandleClient.getHandleId() !== flowHandleId ||\n\t\t\t\t!activeSubscribers.has(subscriber)\n\t\t\t) {\n\t\t\t\tunsubscribe();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsubscriber.unsubscribe = unsubscribe;\n\t\t};\n\n\t\tconst rebindSubscribersToCurrentHandle = (emitCurrent = false): void => {\n\t\t\tfor (const subscriber of activeSubscribers) {\n\t\t\t\tbindSubscriberToCurrentHandle(subscriber, emitCurrent);\n\t\t\t}\n\t\t};\n\n\t\tconst notifySubscribersWithDefaultState = (\n\t\t\tsubscribersAtReset: readonly SubscriberEntry[],\n\t\t): void => {\n\t\t\tfor (const subscriber of subscribersAtReset) {\n\t\t\t\tif (!activeSubscribers.has(subscriber)) continue;\n\t\t\t\ttry {\n\t\t\t\t\tsubscriber.callback(cloneFlowState(DEFAULT_FLOW_STATE));\n\t\t\t\t} catch {\n\t\t\t\t\t// A subscriber cannot prevent later reset observers from seeing the\n\t\t\t\t\t// already-completed client-wide transition.\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst rebindFlowStateCache = (): void => {\n\t\t\tif (unsubscribeFlowStateCache) {\n\t\t\t\tunsubscribeFlowStateCache();\n\t\t\t\tunsubscribeFlowStateCache = null;\n\t\t\t}\n\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\tif (!flowHandleId) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tunsubscribeFlowStateCache =\n\t\t\t\tsubscribeFlowStateCacheForHandle(flowHandleId);\n\t\t};\n\n\t\tconst clearOpenIntent = (): void => {\n\t\t\topenRequestController.clear();\n\t\t};\n\n\t\tconst flushPendingForResolvedHandle = (): void => {\n\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\tif (!flowHandleId) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst shouldReplayPendingState =\n\t\t\t\tpendingFlowStateHandles.delete(flowHandleId);\n\t\t\tclaimedFlowStateHandles.add(flowHandleId);\n\t\t\tensureFlowStateForHandle(flowHandleId);\n\t\t\tif (latestContainer !== undefined) {\n\t\t\t\tenqueueSetContainer(flowHandleId, latestContainer);\n\t\t\t}\n\t\t\trebindSubscribersToCurrentHandle(shouldReplayPendingState);\n\t\t\trebindFlowStateCache();\n\t\t};\n\n\t\thandleClient.subscribeHandle(() => {\n\t\t\tflushPendingForResolvedHandle();\n\t\t});\n\t\tsubscribeFlowHandleInvalidation((flowHandleId) => {\n\t\t\thandleClient.invalidateResolvedHandle(flowHandleId);\n\t\t});\n\t\ttype HandleCommandPayload =\n\t\t\t| Extract<\n\t\t\t\t\tCommand,\n\t\t\t\t\t{ kind: \"open\" } | { kind: \"prefetch\" } | { kind: \"prerender\" }\n\t\t\t >\n\t\t\t| InternalHostInlineFlowCommandPayload;\n\n\t\tconst handOffHandleCommand = (payload: HandleCommandPayload) =>\n\t\t\t\"flow\" in payload\n\t\t\t\t? handOffInlineFlowCommand(payload)\n\t\t\t\t: handOffCommand(payload);\n\n\t\tconst enqueueAndWaitForSettlement = async (\n\t\t\tbuildPayload: (\n\t\t\t\tflowHandleId: FlowHandleId | undefined,\n\t\t\t) => HandleCommandPayload,\n\t\t): Promise<\"settled\" | \"superseded\"> => {\n\t\t\tconst result = await transportAdmission.runOperation(\n\t\t\t\t({ attemptHandoff }) => {\n\t\t\t\t\tlet releaseFlowHandleAllocation: (() => void) | null = null;\n\t\t\t\t\treturn handleClient\n\t\t\t\t\t\t.runCommand(buildPayload, (payload) => {\n\t\t\t\t\t\t\tconst isHandleFree =\n\t\t\t\t\t\t\t\t!(\"flowHandleId\" in payload) ||\n\t\t\t\t\t\t\t\tpayload.flowHandleId === undefined;\n\t\t\t\t\t\t\tconst requiresSerializedAllocation =\n\t\t\t\t\t\t\t\t\"flow\" in target && isHandleFree;\n\t\t\t\t\t\t\tconst handOff = (): Promise<{\n\t\t\t\t\t\t\t\tok: boolean;\n\t\t\t\t\t\t\t\tkind: string;\n\t\t\t\t\t\t\t\tresult?: unknown;\n\t\t\t\t\t\t\t}> =>\n\t\t\t\t\t\t\t\tattemptHandoff({\n\t\t\t\t\t\t\t\t\tprepare:\n\t\t\t\t\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t\t\t\t\t? prepareInlineFlowCommandHandoff\n\t\t\t\t\t\t\t\t\t\t\t: prepareCommandHandoff,\n\t\t\t\t\t\t\t\t\thandOff: () => ({\n\t\t\t\t\t\t\t\t\t\tsettlement: handOffHandleCommand(payload),\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (!requiresSerializedAllocation) {\n\t\t\t\t\t\t\t\treturn handOff();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst handOffAllocation = () =>\n\t\t\t\t\t\t\t\thandOff().catch((error) => {\n\t\t\t\t\t\t\t\t\tclearPendingFlowHandleState();\n\t\t\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (releaseFlowHandleAllocation) {\n\t\t\t\t\t\t\t\treturn handOffAllocation();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst acquisition = acquireFlowHandleAllocation();\n\t\t\t\t\t\t\tif (typeof acquisition === \"function\") {\n\t\t\t\t\t\t\t\treleaseFlowHandleAllocation = acquisition;\n\t\t\t\t\t\t\t\tbeginFlowHandleAllocation();\n\t\t\t\t\t\t\t\treturn handOffAllocation();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn acquisition.then((release) => {\n\t\t\t\t\t\t\t\treleaseFlowHandleAllocation = release;\n\t\t\t\t\t\t\t\tbeginFlowHandleAllocation();\n\t\t\t\t\t\t\t\treturn handOffAllocation();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.finally(() => {\n\t\t\t\t\t\t\tif (releaseFlowHandleAllocation) {\n\t\t\t\t\t\t\t\tendFlowHandleAllocation();\n\t\t\t\t\t\t\t\treleaseFlowHandleAllocation();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn result.status;\n\t\t};\n\n\t\tconst openFlow = (options?: OpenFlowOptions): Promise<void> => {\n\t\t\treturn openRequestController.run(() =>\n\t\t\t\treportAsyncError(\n\t\t\t\t\tenqueueAndWaitForSettlement((flowHandleId) =>\n\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tkind: \"open\",\n\t\t\t\t\t\t\t\t\tflow: target.flow,\n\t\t\t\t\t\t\t\t\t...(flowHandleId === undefined ? {} : { flowHandleId }),\n\t\t\t\t\t\t\t\t\t...(flowHandleId === undefined &&\n\t\t\t\t\t\t\t\t\tlatestContainer !== undefined\n\t\t\t\t\t\t\t\t\t\t? { container: null }\n\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\tmetadata: options?.metadata,\n\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tkind: \"open\",\n\t\t\t\t\t\t\t\t\tflowId: target.flowId,\n\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t\tcontainer: options?.container,\n\t\t\t\t\t\t\t\t\tmetadata: options?.metadata,\n\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t).then(() => {}),\n\t\t\t\t),\n\t\t\t);\n\t\t};\n\n\t\tconst resetForClientBarrier = (): void => {\n\t\t\tclearOpenIntent();\n\t\t\thandleClient.reset();\n\t\t};\n\t\tresetFlowRunsForClientBarrier.add(resetForClientBarrier);\n\n\t\tconst run: InlineFlowRun = {\n\t\t\topen: openFlow,\n\t\t\tprefetch: () => {\n\t\t\t\treturn reportAsyncError(\n\t\t\t\t\tenqueueAndWaitForSettlement((flowHandleId) =>\n\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tkind: \"prefetch\",\n\t\t\t\t\t\t\t\t\tflow: target.flow,\n\t\t\t\t\t\t\t\t\t...(flowHandleId === undefined ? {} : { flowHandleId }),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tkind: \"prefetch\",\n\t\t\t\t\t\t\t\t\tflowId: target.flowId,\n\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t).then(() => {}),\n\t\t\t\t);\n\t\t\t},\n\t\t\tprerender: (options?: PrerenderFlowOptions) => {\n\t\t\t\treturn reportAsyncError(\n\t\t\t\t\tenqueueAndWaitForSettlement((flowHandleId) =>\n\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tkind: \"prerender\",\n\t\t\t\t\t\t\t\t\tflow: target.flow,\n\t\t\t\t\t\t\t\t\t...(flowHandleId === undefined ? {} : { flowHandleId }),\n\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tkind: \"prerender\",\n\t\t\t\t\t\t\t\t\tflowId: target.flowId,\n\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t).then(() => {}),\n\t\t\t\t);\n\t\t\t},\n\t\t\tclose: () => {\n\t\t\t\tclearOpenIntent();\n\t\t\t\treturn reportAsyncError(\n\t\t\t\t\ttransportAdmission\n\t\t\t\t\t\t.runOperation(({ attemptHandoff }) => {\n\t\t\t\t\t\t\treturn handleClient.runResolvedHandleCommand(\n\t\t\t\t\t\t\t\t(flowHandleId) => ({\n\t\t\t\t\t\t\t\t\tkind: \"close\" as const,\n\t\t\t\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t(payload) =>\n\t\t\t\t\t\t\t\t\tattemptHandoff({\n\t\t\t\t\t\t\t\t\t\tprepare:\n\t\t\t\t\t\t\t\t\t\t\t\"flow\" in target\n\t\t\t\t\t\t\t\t\t\t\t\t? prepareInlineFlowCommandHandoff\n\t\t\t\t\t\t\t\t\t\t\t\t: prepareCommandHandoff,\n\t\t\t\t\t\t\t\t\t\thandOff: () => ({\n\t\t\t\t\t\t\t\t\t\t\tsettlement: handOffCommand(payload).then(() => {}),\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.then(() => {}),\n\t\t\t\t);\n\t\t\t},\n\t\t\tsetContainer: (element: HTMLElement | null) => {\n\t\t\t\tlatestContainer = element;\n\t\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\t\tif (!flowHandleId) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tenqueueSetContainer(flowHandleId, element);\n\t\t\t},\n\t\t\tgetFlowState: () => {\n\t\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\t\treturn flowHandleId\n\t\t\t\t\t? getFlowStateForHandle(flowHandleId)\n\t\t\t\t\t: cloneFlowState(DEFAULT_FLOW_STATE);\n\t\t\t},\n\t\t\tsubscribeFlowState: (\n\t\t\t\tcallback: FlowStateCallback,\n\t\t\t\toptions?: SubscribeFlowStateOptions,\n\t\t\t) => {\n\t\t\t\tif (options?.signal?.aborted) {\n\t\t\t\t\treturn () => {};\n\t\t\t\t}\n\t\t\t\tconst subscriber: SubscriberEntry = {\n\t\t\t\t\tcallback,\n\t\t\t\t\toptions,\n\t\t\t\t\tunsubscribe: null,\n\t\t\t\t};\n\t\t\t\tactiveSubscribers.add(subscriber);\n\t\t\t\tconst unsubscribeSubscriber = (): void => {\n\t\t\t\t\tif (subscriber.unsubscribe) {\n\t\t\t\t\t\tsubscriber.unsubscribe();\n\t\t\t\t\t\tsubscriber.unsubscribe = null;\n\t\t\t\t\t}\n\t\t\t\t\tactiveSubscribers.delete(subscriber);\n\t\t\t\t};\n\t\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\t\tif (!flowHandleId) {\n\t\t\t\t\tconst signal = options?.signal;\n\t\t\t\t\tif (signal) {\n\t\t\t\t\t\tconst onAbort = (): void => {\n\t\t\t\t\t\t\tsubscriber.unsubscribe = null;\n\t\t\t\t\t\t\tactiveSubscribers.delete(subscriber);\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\t\t\t\tsubscriber.unsubscribe = () => {\n\t\t\t\t\t\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tif (options?.emitInitial !== false) {\n\t\t\t\t\t\tcallback(cloneFlowState(DEFAULT_FLOW_STATE));\n\t\t\t\t\t}\n\t\t\t\t\treturn unsubscribeSubscriber;\n\t\t\t\t}\n\t\t\t\tbindSubscriberToCurrentHandle(subscriber);\n\t\t\t\treturn unsubscribeSubscriber;\n\t\t\t},\n\t\t};\n\n\t\treturn \"flow\" in target ? run : { flowId: target.flowId, ...run };\n\t}\n\n\tconst flowRunByFlowId = new Map<string, FlowRun>();\n\tconst flow = (flowIdInput: string): FlowRun => {\n\t\tconst flowId = flowIdInput.trim();\n\t\tif (!flowId) {\n\t\t\tthrow new Error(\"flowId must be a non-empty string\");\n\t\t}\n\t\tconst existing = flowRunByFlowId.get(flowId);\n\t\tif (existing) return existing;\n\t\tconst run = createFlowRun({ flowId });\n\t\tflowRunByFlowId.set(flowId, run);\n\t\treturn run;\n\t};\n\n\tconst runClientBarrier = (kind: \"close\" | \"reset\"): Promise<void> => {\n\t\tconst flowRunResets = [...resetFlowRunsForClientBarrier];\n\t\treturn reportAsyncError(\n\t\t\ttransportAdmission.runBarrier({\n\t\t\t\tonGenerationAdvanced: () => {\n\t\t\t\t\tconst notifications: Array<() => void> = [];\n\t\t\t\t\tdeferredFlowRunNotifications = notifications;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfor (const resetFlowRun of flowRunResets) {\n\t\t\t\t\t\t\tresetFlowRun();\n\t\t\t\t\t\t}\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tdeferredFlowRunNotifications = null;\n\t\t\t\t\t}\n\t\t\t\t\tfor (const notify of notifications) {\n\t\t\t\t\t\tnotify();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tprepare: hostWindow ? prepareCommandHandoff : () => {},\n\t\t\t\thandOff: hostWindow\n\t\t\t\t\t? () => ({ settlement: handOffCommand({ kind }).then(() => {}) })\n\t\t\t\t\t: () => ({ settlement: Promise.resolve() }),\n\t\t\t}),\n\t\t);\n\t};\n\n\tconst close = (): Promise<void> => runClientBarrier(\"close\");\n\n\tconst reset = (): Promise<void> => runClientBarrier(\"reset\");\n\n\tfunction identify(\n\t\tuserId: string,\n\t\ttraits?: IdentifyTraits,\n\t\toptions?: IdentifyOptions,\n\t): Promise<void>;\n\tfunction identify(\n\t\ttraits: IdentifyTraits,\n\t\toptions?: IdentifyOptions,\n\t): Promise<void>;\n\tfunction identify(\n\t\tidentifyInput: string | IdentifyTraits,\n\t\ttraitsOrOptions?: IdentifyTraits | IdentifyOptions,\n\t\toptions?: IdentifyOptions,\n\t): Promise<void> {\n\t\tif (!hostWindow) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(\n\t\t\tdispatch(\n\t\t\t\ttoIdentifyCommandPayload(identifyInput, traitsOrOptions, options),\n\t\t\t),\n\t\t);\n\t}\n\n\tconst track = (\n\t\teventName: string,\n\t\tproperties?: EventProperties,\n\t\toptions?: EventOptions,\n\t): Promise<void> => {\n\t\tif (!hostWindow) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(\n\t\t\tdispatch(\n\t\t\t\tbuildCustomerOccurrenceCommand({\n\t\t\t\t\ttype: \"track\",\n\t\t\t\t\tevent: eventName,\n\t\t\t\t\tproperties,\n\t\t\t\t\toptions,\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t};\n\n\tconst page = (\n\t\tname?: string,\n\t\tproperties?: EventProperties,\n\t\toptions?: EventOptions,\n\t): Promise<void> => {\n\t\tif (!hostWindow) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(\n\t\t\tdispatch(\n\t\t\t\tbuildCustomerOccurrenceCommand({\n\t\t\t\t\ttype: \"page\",\n\t\t\t\t\tevent: name ?? (hostWindow.location.pathname || \"/\"),\n\t\t\t\t\tproperties,\n\t\t\t\t\toptions,\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t};\n\n\tconst submitFeedback = async (\n\t\tinput: FeedbackInput,\n\t): Promise<SubmitFeedbackResult> => {\n\t\tif (!hostWindow) {\n\t\t\tthrow new Error(\"Feedback submission requires a browser environment.\");\n\t\t}\n\t\tensureCommandsCanRun();\n\t\tconst registrationProbe = pendingRegistrationProbe;\n\t\tif (registrationProbe) {\n\t\t\tawait registrationProbe;\n\t\t}\n\t\tconst settlement = await reportAsyncError(\n\t\t\trawSettlementDispatch({\n\t\t\t\tkind: \"instanceFeedback.capture\",\n\t\t\t\tpayload: input,\n\t\t\t}),\n\t\t);\n\t\tif (!settlement.ok) {\n\t\t\tthrow new Error(\"Feedback submission failed.\");\n\t\t}\n\t\tconst result = getFeedbackSubmissionFromSettlementDetail(settlement);\n\t\tif (!result) {\n\t\t\tthrow new Error(\"Invalid feedback submission result.\");\n\t\t}\n\t\treturn result;\n\t};\n\n\tconst fetchFeedback = async (\n\t\tinput: FetchFeedbackInput,\n\t): Promise<FetchFeedbackResult> => {\n\t\tif (!hostWindow) {\n\t\t\tthrow new Error(\"Feedback reads require a browser environment.\");\n\t\t}\n\t\tensureCommandsCanRun();\n\t\tconst registrationProbe = pendingRegistrationProbe;\n\t\tif (registrationProbe) {\n\t\t\tawait registrationProbe;\n\t\t}\n\t\tconst settlement = await reportAsyncError(\n\t\t\trawSettlementDispatch({\n\t\t\t\tkind: \"instanceFeedback.listMine\",\n\t\t\t\tpayload: input,\n\t\t\t}),\n\t\t);\n\t\tif (!settlement.ok) {\n\t\t\tthrow new Error(\"Feedback read failed.\");\n\t\t}\n\t\tconst result = getFeedbackReadFromSettlementDetail(settlement);\n\t\tif (!result) {\n\t\t\tthrow new Error(\"Invalid feedback read result.\");\n\t\t}\n\t\treturn result;\n\t};\n\n\tconst configure = (updates: ConfigureOptions): Promise<void> => {\n\t\tif (!hostWindow) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\tif (!isLoaderRequested()) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\t// Send updates as-is; loader merges and forwards deltas to core.\n\t\treturn reportAsyncError(\n\t\t\tdispatch({ kind: \"configure\", opts: toConfigureCommandOptions(updates) }),\n\t\t);\n\t};\n\n\thostEventHub.subscribeOpenRequested((detail, hostEvent) => {\n\t\topenRequestBridge.observeFromLoader(detail, {\n\t\t\tpreventHostDefault: () => {\n\t\t\t\thostEvent.preventDefault();\n\t\t\t},\n\t\t});\n\t});\n\thostEventHub.subscribeHostActionRequested((detail, hostEvent) => {\n\t\tconst handler = actionRegistry.getHandler(detail.definition);\n\t\tif (!handler) {\n\t\t\tdetail.settle(\"unavailable\");\n\t\t\treturn;\n\t\t}\n\t\t// This adapter event stays inside the trusted host realm. Sandboxed Views\n\t\t// can request an action only through Core's empty, authorized RPC.\n\t\thostEvent.preventDefault();\n\t\tvoid Promise.resolve()\n\t\t\t.then(() => handler())\n\t\t\t.then(\n\t\t\t\t() => detail.settle(\"success\"),\n\t\t\t\t() => detail.settle(\"failure\"),\n\t\t\t);\n\t});\n\n\tconst client: Client = {\n\t\tload,\n\t\tsetDefaultContainerPolicy: (policy: ContainerPolicy) => {\n\t\t\tenqueueSetDefaultContainerPolicy(policy);\n\t\t},\n\t\tgetFlowState: () => getInstanceFlowState(),\n\t\tsubscribeFlowState: (\n\t\t\tcallback: FlowStateCallback,\n\t\t\toptions?: SubscribeFlowStateOptions,\n\t\t) => subscribeFlowStateForInstance(callback, options),\n\t\tflow,\n\t\tclose,\n\t\treset,\n\t\tconfigure,\n\t\tidentify,\n\t\ttrack,\n\t\tpage,\n\t\tgraph: {\n\t\t\tconnect: (relationship) =>\n\t\t\t\ttrack(\"gx.graph.relationship.connected\", relationship),\n\t\t\tdisconnect: (relationship) =>\n\t\t\t\ttrack(\"gx.graph.relationship.disconnected\", relationship),\n\t\t},\n\t\tfeedback: { fetch: fetchFeedback, submit: submitFeedback },\n\t\tonOpenRequested: (callback) => openRequestBridge.subscribe(callback),\n\t};\n\tattachInlineFlowClientBridge(client, {\n\t\tcreateInlineFlowRun: (inlineFlow) => createFlowRun({ flow: inlineFlow }),\n\t});\n\n\topenRequestBridgeByClient.set(client, openRequestBridge);\n\n\tregistry.set(registryKey, {\n\t\tclient,\n\t\tupdateOptions,\n\t});\n\n\tif (!disableAutoLoadConfig) {\n\t\tclient.load();\n\t}\n\n\treturn client;\n};\n",
|
|
20
20
|
"import {\n\tINLINE_FLOW_PERSISTED_IDENTITY_FIELDS,\n\ttype InlineFlow,\n\tinlineFlowSchema,\n} from \"@getuserfeedback/protocol/internal/inline-flow\";\nimport type { Client, FlowRun, OpenFlowOptions } from \"../client\";\nimport { getInlineFlowClientBridge } from \"./inline-flow-client-bridge\";\n\nexport type { BundledDocsClientOptions } from \"../client\";\nexport { createBundledDocsClientOptions } from \"../client\";\n\n/** Internal supplied-flow run using the normal Flow lifecycle. */\nexport type InlineFlowRun = Omit<FlowRun, \"flowId\" | \"open\"> & {\n\topen: (options?: Omit<OpenFlowOptions, \"container\">) => Promise<void>;\n};\n\nconst ARRAY_INDEX_KEY_PATTERN = /^(0|[1-9]\\d*)$/;\n\nconst invalidJsonSnapshot = (): never => {\n\tthrow new Error(\"Inline flow must contain only JSON values.\");\n};\n\nconst toJsonSnapshot = (\n\tvalue: unknown,\n\tancestors = new Set<object>(),\n): unknown => {\n\tif (\n\t\tvalue === null ||\n\t\ttypeof value === \"string\" ||\n\t\ttypeof value === \"boolean\"\n\t) {\n\t\treturn value;\n\t}\n\tif (typeof value === \"number\") {\n\t\treturn Number.isFinite(value) ? value : invalidJsonSnapshot();\n\t}\n\tif (typeof value !== \"object\" || ancestors.has(value)) {\n\t\treturn invalidJsonSnapshot();\n\t}\n\n\tancestors.add(value);\n\ttry {\n\t\tif (Array.isArray(value)) {\n\t\t\tif (Object.getPrototypeOf(value) !== Array.prototype) {\n\t\t\t\treturn invalidJsonSnapshot();\n\t\t\t}\n\t\t\tconst ownKeys = Reflect.ownKeys(value);\n\t\t\tif (\n\t\t\t\townKeys.length !== value.length + 1 ||\n\t\t\t\townKeys.some(\n\t\t\t\t\t(key) =>\n\t\t\t\t\t\tkey !== \"length\" &&\n\t\t\t\t\t\t(typeof key !== \"string\" ||\n\t\t\t\t\t\t\t!ARRAY_INDEX_KEY_PATTERN.test(key) ||\n\t\t\t\t\t\t\tNumber(key) >= value.length),\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn invalidJsonSnapshot();\n\t\t\t}\n\t\t\tconst snapshot: unknown[] = [];\n\t\t\tfor (let index = 0; index < value.length; index += 1) {\n\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(\n\t\t\t\t\tvalue,\n\t\t\t\t\tString(index),\n\t\t\t\t);\n\t\t\t\tif (!descriptor?.enumerable || !(\"value\" in descriptor)) {\n\t\t\t\t\treturn invalidJsonSnapshot();\n\t\t\t\t}\n\t\t\t\tsnapshot.push(toJsonSnapshot(descriptor.value, ancestors));\n\t\t\t}\n\t\t\treturn snapshot;\n\t\t}\n\n\t\tconst prototype = Object.getPrototypeOf(value);\n\t\tif (prototype !== Object.prototype && prototype !== null) {\n\t\t\treturn invalidJsonSnapshot();\n\t\t}\n\t\tconst snapshot: Record<string, unknown> = {};\n\t\tfor (const key of Reflect.ownKeys(value)) {\n\t\t\tif (typeof key !== \"string\" || key === \"__proto__\") {\n\t\t\t\treturn invalidJsonSnapshot();\n\t\t\t}\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(value, key);\n\t\t\tif (!descriptor?.enumerable || !(\"value\" in descriptor)) {\n\t\t\t\treturn invalidJsonSnapshot();\n\t\t\t}\n\t\t\tif (descriptor.value === undefined) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tObject.defineProperty(snapshot, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: toJsonSnapshot(descriptor.value, ancestors),\n\t\t\t\twritable: true,\n\t\t\t});\n\t\t}\n\t\treturn snapshot;\n\t} finally {\n\t\tancestors.delete(value);\n\t}\n};\n\nconst snapshotInlineFlowInput = (flow: unknown): Record<string, unknown> => {\n\tif (\n\t\ttypeof flow !== \"object\" ||\n\t\tflow === null ||\n\t\tArray.isArray(flow) ||\n\t\t(Object.getPrototypeOf(flow) !== Object.prototype &&\n\t\t\tObject.getPrototypeOf(flow) !== null)\n\t) {\n\t\treturn invalidJsonSnapshot();\n\t}\n\treturn toJsonSnapshot(flow) as Record<string, unknown>;\n};\n\nconst freezeJsonSnapshot = <Value>(value: Value): Value => {\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn value;\n\t}\n\tfor (const child of Object.values(value)) {\n\t\tfreezeJsonSnapshot(child);\n\t}\n\treturn Object.freeze(value);\n};\n\nconst snapshotInlineFlow = (flow: InlineFlow): InlineFlow => {\n\tconst snapshot = inlineFlowSchema.parse(snapshotInlineFlowInput(flow));\n\tconst definition = snapshot.definition;\n\tif (\n\t\ttypeof definition === \"object\" &&\n\t\tdefinition !== null &&\n\t\t!Array.isArray(definition)\n\t) {\n\t\tconst field = INLINE_FLOW_PERSISTED_IDENTITY_FIELDS.find(\n\t\t\t(candidate) => candidate in definition,\n\t\t);\n\t\tif (field) {\n\t\t\tthrow new Error(\n\t\t\t\t`Inline flow definitions cannot include persisted field \"${field}\".`,\n\t\t\t);\n\t\t}\n\t}\n\treturn freezeJsonSnapshot(snapshot);\n};\n\n/** First-party supplied-flow entrypoint; intentionally absent from the public SDK root. */\nexport const createInlineFlow = (\n\tclient: Client,\n\tflow: InlineFlow,\n): InlineFlowRun =>\n\tgetInlineFlowClientBridge(client).createInlineFlowRun(\n\t\tsnapshotInlineFlow(flow),\n\t);\n\nexport type { InlineFlow };\n"
|
|
21
21
|
],
|
|
22
|
-
"mappings": "AAAA,IAAI,EAK4B,SAAS,CAAY,CAAC,EAAM,EAAa,EAAQ,CAC7E,SAAS,CAAI,CAAC,EAAM,EAAK,CACrB,GAAI,CAAC,EAAK,KACN,OAAO,eAAe,EAAM,OAAQ,CAChC,MAAO,CACH,MACA,OAAQ,EACR,OAAQ,IAAI,GAChB,EACA,WAAY,EAChB,CAAC,EAEL,GAAI,EAAK,KAAK,OAAO,IAAI,CAAI,EACzB,OAEJ,EAAK,KAAK,OAAO,IAAI,CAAI,EACzB,EAAY,EAAM,CAAG,EAErB,IAAM,EAAQ,EAAE,UACV,EAAO,OAAO,KAAK,CAAK,EAC9B,QAAS,EAAI,EAAG,EAAI,EAAK,OAAQ,IAAK,CAClC,IAAM,EAAI,EAAK,GACf,GAAI,EAAE,KAAK,GACP,EAAK,GAAK,EAAM,GAAG,KAAK,CAAI,GAKxC,IAAM,EAAS,GAAQ,QAAU,OACjC,MAAM,UAAmB,CAAO,CAChC,CACA,OAAO,eAAe,EAAY,OAAQ,CAAE,MAA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ACD,EAAU,OAAO,CAAK,IAIlB,GAA0B,CAAC,IAA2C,CAC3E,GACC,OAAO,IAAS,UAChB,IAAS,MACT,MAAM,QAAQ,CAAI,GACjB,OAAO,eAAe,CAAI,IAAM,OAAO,WACvC,OAAO,eAAe,CAAI,IAAM,KAEjC,OAAO,EAAoB,EAE5B,OAAO,EAAe,CAAI,GAGrB,GAAqB,CAAQ,IAAwB,CAC1D,GAAI,OAAO,IAAU,UAAY,IAAU,KAC1C,OAAO,EAER,QAAW,KAAS,OAAO,OAAO,CAAK,EACtC,GAAmB,CAAK,EAEzB,OAAO,OAAO,OAAO,CAAK,GAGrB,GAAqB,CAAC,IAAiC,CAC5D,IAAM,EAAW,GAAiB,MAAM,GAAwB,CAAI,CAAC,EAC/D,EAAa,EAAS,WAC5B,GACC,OAAO,IAAe,UACtB,IAAe,MACf,CAAC,MAAM,QAAQ,CAAU,EACxB,CACD,IAAM,EAAQ,GAAsC,KACnD,CAAC,KAAc,KAAa,EAC7B,EACA,GAAI,EACH,MAAU,MACT,2DAA2D,KAC5D,EAGF,OAAO,GAAmB,CAAQ,GAItB,GAAmB,CAC/B,EACA,IAEA,GAA0B,CAAM,EAAE,oBACjC,GAAmB,CAAI,CACxB",
|
|
23
|
+
"debugId": "FBA84832ABCCEC4964756E2164756E21",
|
|
24
24
|
"names": []
|
|
25
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getuserfeedback/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"description": "getuserfeedback Typescript SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"getuserfeedback",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"dist"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@getuserfeedback/protocol": "^5.3.
|
|
52
|
+
"@getuserfeedback/protocol": "^5.3.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"rollup": "^4.57.1",
|