@monterosa/sdk-launcher-kit 2.0.0-rc.2 → 2.0.0-rc.4
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.
- package/dist/index.cjs +1945 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +21 -15
- package/dist/index.js.map +1 -1
- package/dist/src/utils/bridge/public_types.d.ts +7 -2
- package/package.json +8 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/constants.ts","../src/logger.ts","../src/utils/bridge/public_types.ts","../src/types.ts","../src/utils/bridge/types.ts","../src/utils/bridge/config.ts","../src/utils/bridge/helpers.ts","../src/utils/bridge/sideeffects.ts","../src/utils/bridge/constants.ts","../src/utils/bridge/bridge_impl.ts","../src/utils/bridge/api.ts","../src/experience_impl.ts","../src/integrations.ts","../src/state.ts","../src/loader.ts","../src/api.ts","../src/custom_element.ts","../src/autoresize.ts","../src/parent_application_impl.ts","../src/parent_application.ts","../src/child_helpers.ts","../src/share.ts"],"sourcesContent":["/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2022 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nexport const RESIZE_THROTTLE_TIMEOUT = 25;\n\n/**\n * Duration of the loader fade IN/OUT animation\n */\nexport const LOADER_ANIMATION_DURATION = 750;\n\n/**\n * Final cut off timeout for the loader after which it will be hidden even\n * though Experience UI may ne not yet ready\n */\nexport const LOADER_TIMEOUT = 5000;\n\n/**\n * Bumper timeout during which the loader still visible even though Experience\n * UI may be ready\n *\n * (!) At the moment its value is 0 as loader has a fade in effect what already\n * adds a small bumper delay before Experience is injected on the page\n */\nexport const LOADER_BUMPER_TIMEOUT = 0;\n\nexport const DEFAULT_HEIGHT = 250;\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2023 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { Logger } from '@monterosa/sdk-core';\n\nexport const logger = new Logger('@monterosa/sdk-launcher-kit');\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2022-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { Emitter } from '@monterosa/sdk-util';\n\n/**\n * Android SDK registers the following functions:\n * - calls `window.monterosaSdk.receiveMessage()` if wants to send a message\n * - registers `window.monterosaSdk.postMessage()` to receive a message\n * iOS SDK:\n * - calls `window.monterosaSdk.receiveMessage()` if wants to send a message\n * - registers `window.webkit.messageHandlers.monterosaSdk.postMessage()` to receive a message\n */\n\ntype GlobalMonterosaSdk = {\n initialised: boolean;\n emitter: Emitter;\n // send message to Android\n postMessage?: (message: string) => void;\n // receive a message from Android or iOS\n receiveMessage: (message: Message) => void;\n};\n\ntype GlobalWebkitType = {\n messageHandlers?: {\n monterosaSdk: {\n // post message to iOS\n postMessage: (message: string) => void;\n };\n };\n};\n\ndeclare global {\n /**\n * Declare variables in globalThis. This solution only works by declaring\n * variables with `var`: https://stackoverflow.com/a/69429093\n */\n\n // eslint-disable-next-line\n var monterosaSdk: GlobalMonterosaSdk | undefined;\n\n // eslint-disable-next-line\n var webkit: GlobalWebkitType | undefined;\n\n interface Window {\n monterosaSdk?: GlobalWebkitType;\n webkit?: GlobalWebkitType;\n }\n}\n\n/**\n * A key-value hash object representing the content of a bridge message.\n */\nexport type Payload = { [string: string]: any };\n\n/**\n * The Message interface is used to define the structure of a message that\n * is passed between two applications via a communication bridge.\n */\nexport interface Message {\n /**\n * Id of the message. Its autogenerated by the communication bridge\n */\n id: string;\n /**\n * Id of the message this message responds to.\n */\n respondingTo: string | null;\n /**\n * The source of message. Used to distinguish Monterosa SDK messages from other\n * broadcasted messages. In the future can be used for a more fine grade targeting\n */\n sourceName: Source | string;\n /**\n * The current timestamp in milliseconds\n */\n timestamp: number;\n /**\n * Defines the message action\n */\n action: Action | string;\n /**\n * Hash of key-value pairs. Values constrained by json format:\n * four primitive types (strings, numbers, booleans,\n * and null) and two structured types (objects and arrays).\n */\n payload: Payload;\n /**\n * Used to identify if the message belongs to the communication\n * bridge established between parent and child\n */\n bridgeId: string;\n /**\n * Message protocol version\n */\n version: string;\n}\n\n/**\n * @internal\n */\nexport interface Bridge extends Emitter {\n id: string;\n iFrameId: string;\n iFrameSelector: string;\n childIFrame: HTMLIFrameElement | null;\n send: (\n action: string,\n payload?: Payload,\n sourceName?: Source,\n id?: string,\n ) => Message;\n request: (\n action: string,\n payload?: Payload,\n timeout?: number,\n sourceName?: Source,\n ) => Promise<Message>;\n}\n\n/**\n * @internal\n */\nexport interface Bridged {\n bridge: Bridge;\n}\n\n/**\n * A list of possible actions in communications between\n * parent application and child Experience\n *\n * @internal\n */\nexport enum Action {\n /**\n * Notifies that the communication bridge transport is ready.\n * Auto-sent when the child bridge is created — no developer action needed.\n */\n OnBridgeInitialised = 'onBridgeInitialised',\n /**\n * Notifies that the Experience has initialised and is ready to receive messages.\n * Sent explicitly by the developer via `sendInitialised()`.\n * This triggers the `initialised` lifecycle state.\n */\n OnExperienceInitialised = 'onExperienceInitialised',\n /**\n * Notifies that UI of child Experience is loaded and ready to be visible.\n * When this action is fired the loader will be hidden and\n * the `ready` lifecycle state is triggered.\n */\n OnReady = 'onReady',\n /**\n * Notifies that intrinsic size of child Experience has changed\n */\n OnResize = 'onIntrinsicSizeChanged',\n /**\n * Notifies child Experience about the request to load more data\n */\n OnMoreDataRequested = 'onMoreDataRequested',\n /**\n * Notifies about a share request\n */\n OnShare = 'onShare',\n}\n\n/**\n * @internal\n */\nexport enum Source {\n Sdk = 'sdk',\n User = 'user',\n}\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2022-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { MonterosaSdk } from '@monterosa/sdk-core';\n\nimport { Bridged } from './utils/bridge/public_types';\n\n/**\n * Represents the lifecycle state of an Experience.\n *\n * The Experience progresses through states in a linear sequence:\n * `unmounted` → `mounted` → `initialised` → `ready`\n *\n * - `unmounted`: Initial state after {@link getExperience} or after {@link unembed}\n * - `mounted`: Experience iframe is injected into the DOM via {@link embed}\n * - `initialised`: Experience has initialised and is ready to receive messages\n * - `ready`: Experience UI is fully loaded and visible to the user\n */\nexport type ExperienceState = 'unmounted' | 'mounted' | 'initialised' | 'ready';\n\n/**\n * Interface representing the `<monterosa-experience>` custom element.\n *\n * This interface provides access to the custom element's attributes and\n * properties when an Experience is embedded declaratively via HTML.\n */\nexport interface MonterosaExperienceElement extends HTMLElement {\n /**\n * The host URL for the Experience.\n */\n host: string;\n /**\n * The Project identifier.\n */\n projectId: string;\n /**\n * The Event identifier (optional).\n */\n eventId?: string;\n}\n\n/**\n * Reserved query parameter names for controlling the behaviour of Experience.\n */\nexport enum QueryParam {\n /**\n * Represents the host of the application. This parameter is added by Studio\n * and the embed URL already contains it.\n */\n Host = 'h',\n /**\n * Represents the Project ID of the application. This parameter is added by\n * Studio and the embed URL already contains it.\n */\n Project = 'p',\n /**\n * Represents the Event ID of the application. This parameter is added to the\n * Experience URL when the eventId is provided in the Experience config.\n */\n Event = 'e',\n /**\n * Used to identify the unique ID of the communication bridge between\n * the parent application and the child experience.\n */\n BridgeId = 'micBridgeId',\n /**\n * Determines whether the header and footer views of the application should be\n * hidden. This parameter can be used to control the visibility of the\n * application's header and footer components.\n */\n HideHeaderAndFooter = 'micHideHeaderAndFooter',\n /**\n * Determines whether autoresize is enabled for the application. When autoresize\n * is enabled, the application's height will adjust automatically based on its\n * content.\n */\n AutoresizesHeight = 'micAutoresizesHeight',\n}\n\n/**\n * Represents an Experience instance. Obtain one via\n * {@link getExperience}, then pass to {@link embed} to\n * render it.\n */\nexport interface Experience extends Bridged {\n /**\n * Instance of SDK used to configure this Experience.\n */\n sdk: MonterosaSdk;\n /**\n * Unique identifier of the Experience instance.\n */\n id: string;\n /**\n * Config\n */\n config: ExperienceConfiguration;\n /**\n * The current lifecycle state of the Experience.\n *\n * States progress linearly: `unmounted` → `mounted` → `initialised` → `ready`\n *\n * Use {@link onStateChanged} to observe state transitions.\n */\n state: ExperienceState;\n /**\n * Reference to the custom element if this Experience was created via the\n * `<monterosa-experience>` web component. Will be `null` when the\n * Experience is embedded programmatically via {@link embed}.\n */\n customElement: MonterosaExperienceElement | null;\n /**\n * Generates the URL to use when embedding the Experience.\n *\n * @remarks\n * The URL is built by reconciling multiple data sources:\n *\n * 1. The embed URL as specified in App spec and obtained via Listings\n *\n * 2. The `host` and `projectId` used to configure the SDK instance\n *\n * 3. The `experienceUrl` passed via {@link ExperienceConfiguration}\n *\n * 4. `host`, `projectId` and `eventId` parameters passed via {@link ExperienceConfiguration}\n *\n * 5. Custom `parameters` dictionary passed via {@link ExperienceConfiguration}\n *\n * The SDK always prioritises values lower in the list above.\n * {@link QueryParam | Reserved parameters} are stripped out from\n * embed URL, `experienceURL` and custom\n * {@link ExperienceConfiguration | parameters dictionary}.\n * `h`, `e`, `p` query parameters provided in custom parameters dictionary\n * will be ignored.\n *\n * @returns the URL to use when embedding the Experience.\n */\n getUrl(): Promise<string>;\n}\n\n/**\n * Interface of parent application\n *\n * @remarks\n * Parent application is a reference to the parent window where Experience\n * resides. It is used to establish communication bridge between Experience and\n * parent application. It can be get with {@link getParentApplication}\n */\nexport interface ParentApplication extends Bridged {}\n\n/**\n * Configuration options for an Experience. Pass to\n * {@link getExperience} to customise embedding behaviour.\n */\nexport interface ExperienceConfiguration {\n /**\n * The user is able to override the default Experience URL. If it is not empty,\n * the default Experience URL will be overwritten with the provided one. At the\n * same time URL query parameters will remain.\n */\n experienceUrl?: string | null;\n /**\n * Overrides the host portion of the resulting Experience URL. This property\n * takes precedence over `experienceUrl`. For example, if `experienceUrl` is\n * \"https://example.com?h=h1\" and the `host` is set to \"h2\", the resulting URL\n * will be: https://example.com?h=h2\n */\n host?: string;\n /**\n * Overrides the Project ID portion of the resulting Experience URL. This\n * property takes precedence over `experienceUrl`. For example, if\n * `experienceUrl` is \"https://example.com?p=p1\" and the `projectId` is set\n * to \"p2\", the resulting URL will be: https://example.com?p=p2\n */\n projectId?: string;\n /**\n * If Event ID is provided, Experience can automatically display Elements\n * associated with this Event. It is worth mentioning that the behaviour of\n * Experiences depend on their implementation and can vary.\n *\n * This property takes precedence over `experienceUrl`. For example, if\n * `experienceUrl` is \"https://example.com?e=e1\" and the `eventId` is set to\n * \"e2\", the resulting URL will be: https://example.com?e=e2\n */\n eventId?: string;\n /**\n * A key/value dictionary of custom parameters that will be passed on to the\n * embedded Experience as URL query parameter. There are several reserved\n * parameter keys: \"p\", \"h\", \"e\", \"micHideHeaderAndFooter\" and \"micBridgeId\".\n * When one of reserved keys is provided it will be ignored.\n */\n parameters?: { [key: string]: string };\n /**\n * If true the container adjusts its height according to the intrinsic\n * height of embedded Experience\n */\n autoresizesHeight?: boolean;\n /**\n * If true removes the headers and footers of embedded Experience,\n * so that the resulting UI does not display two headers/footers.\n */\n hidesHeadersAndFooters?: boolean;\n /**\n * The user is able to control wether loading state is enabled or disabled\n * using this property. By default, it is true meaning that the loading state\n * will be enabled.\n */\n supportsLoadingState?: boolean;\n /**\n * Loading template is a function that returns html markup which can be used\n * to substitute default loader UI. Make sure that the template is wrapped in\n * a single html element, e.g. `() => '<div>...loading...</div>'`\n */\n loadingTemplate?: () => string;\n /**\n * Defines a Permissions Policy for the `<iframe>`. This policy outlines the\n * available features for the `<iframe>` (e.g., access to the microphone,\n * camera, battery, web-share, etc.) based on the origin of the request.\n *\n * Additional information can be found at: {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Permissions_Policy}\n */\n allow?: string;\n /**\n * Set this to true to enable iframe's fullscreen mode compatibility with\n * older browsers.\n */\n allowFullScreen?: boolean;\n /**\n * Custom title for the iframe element. If provided, this title will be set\n * on the iframe's title attribute in the generated embed code.\n */\n title?: string;\n}\n\n/**\n * @internal\n */\nexport interface Integration {\n experience: Experience;\n container: HTMLElement;\n controller: AbortController;\n}\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2024 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\n/**\n * Defines a set of error codes that may be encountered when using the\n * Launcher Kit bridge\n *\n * @example\n * ```javascript\n * try {\n * // some code that uses the LauncherKit's bridge\n * } catch (err) {\n * if (err.code === BridgeError.InvalidRequestTimeoutError) {\n * // handle invalid request timeout error\n * } else {\n * // handle other error types\n * }\n * }\n * ```\n *\n * @remarks\n * - The `BridgeError` enum provides a convenient way to handle errors\n * encountered when using the `LauncherKit` module. By checking the code\n * property of the caught error against the values of the enum, the error\n * type can be determined and appropriate action taken.\n *\n * - The `BridgeError` enum is not intended to be instantiated or extended.\n */\nexport enum BridgeError {\n /**\n * Indicates an error occurred due to an invalid timeout value being provided.\n * This error is thrown when the specified timeout is not a positive number.\n */\n InvalidRequestTimeoutError = 'invalid_request_timeout_error',\n /**\n * Indicates a request timed out waiting for a response.\n * This error is thrown when a bridge request exceeds the specified timeout duration.\n */\n RequestTimeoutError = 'request_timeout_error',\n}\n\nexport const BridgeErrorMessages = {\n [BridgeError.InvalidRequestTimeoutError]: () =>\n 'Request timeout must be greater than 0',\n [BridgeError.RequestTimeoutError]: (action: string, timeout: number) =>\n `Request timeout: action \"${action}\" did not receive a response within ${timeout}ms`,\n};\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2024 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { createError } from '@monterosa/sdk-util';\n\nimport { BridgeError, BridgeErrorMessages } from './types';\n\n/**\n * @internal\n */\nconst Config = {\n requestTimeout: 20_000,\n};\n\n/**\n * Sets a new timeout value for requests (default is 20,000 ms).\n *\n * @remarks\n * This function updates the request timeout in the application's configuration.\n * It ensures that the new timeout value is a positive number, and throws\n * an error if the value is non-positive.\n *\n * @param newTimeout - The new timeout value in milliseconds. Must be\n * a positive number.\n *\n * @throws\n * Throws {@link BridgeError | BridgeError.InvalidRequestTimeoutError}\n * if `newTimeout` is less than or equal to 0.\n *\n * @example\n * ```javascript\n * // Set the request timeout to 3000 milliseconds\n * setRequestTimeout(3000);\n * ```\n */\nexport function setRequestTimeout(newTimeout: number) {\n if (newTimeout <= 0) {\n throw createError(\n BridgeError.InvalidRequestTimeoutError,\n BridgeErrorMessages,\n );\n }\n\n Config.requestTimeout = newTimeout;\n}\n\nexport default Config;\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2022 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { Message } from './public_types';\n\nexport function isMessage(message: Message | any): message is Message {\n return (\n message instanceof Object &&\n Object.prototype.hasOwnProperty.call(message, 'bridgeId')\n );\n}\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2022 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\n/* eslint no-console: \"off\" */\n\nimport { Emitter, getGlobal, getErrorMessage } from '@monterosa/sdk-util';\n\nimport { isMessage } from './helpers';\n\nconst globals = getGlobal();\n\nconst receiveMessage = (message: any) => {\n if (!isMessage(message)) {\n // data does not match message format\n return;\n }\n\n globals.monterosaSdk!.emitter.emit('message', message);\n};\n\nfunction handleWindowMessage({ data }: MessageEvent) {\n try {\n if (typeof data !== 'string') {\n // ignore non string data\n return;\n }\n\n const message = JSON.parse(data);\n\n receiveMessage(message);\n } catch (err) {\n console.error(getErrorMessage(err));\n }\n}\n\n/**\n * Since this code operates as a side effect while updating the global space,\n * we must be very careful because it may run twice, for example, when two apps\n * using the SDK run on the same page. Additionally, the global namespace may\n * already be updated by the Android or iOS SDKs.\n */\n\n// The Monterosa SDK namespace may already exist, either because it was created\n// by a native SDK or by another web app using the JS SDK from the same scope.\nglobals.monterosaSdk ??= {\n initialised: false,\n emitter: new Emitter(),\n receiveMessage,\n};\n\n// Each of nullish coalescing assignments will only be applied when\n// the Monterosa SDK namespace exists at that moment and one of its properties\n// is not defined.\nglobals.monterosaSdk.initialised ??= false;\nglobals.monterosaSdk.emitter ??= new Emitter();\nglobals.monterosaSdk.receiveMessage ??= receiveMessage;\n\nif (!globals.monterosaSdk.initialised) {\n // Subscribe to the message only once for each app that uses the SDK on this page.\n if (typeof globals.addEventListener !== 'undefined') {\n globals.addEventListener('message', handleWindowMessage);\n }\n\n globals.monterosaSdk.initialised = true;\n}\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2022 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { getGlobal } from '@monterosa/sdk-util';\n\nconst globals = getGlobal();\n\n/**\n * @internal\n */\nexport const IFRAME_ID_PREFIX = 'micBridge';\n\nexport const IS_IOS =\n !!globals.webkit?.messageHandlers?.monterosaSdk?.postMessage;\nexport const IS_ANDROID = !!globals.monterosaSdk?.postMessage;\nexport const IS_WEB = globals.self !== globals.parent;\n\n/**\n * @internal\n */\nexport const VERSION = '1.0.0';\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2022-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport {\n getGlobal,\n Emitter,\n createError,\n generateUUID,\n} from '@monterosa/sdk-util';\n\nimport './sideeffects';\n\nimport { Message, Bridge, Payload, Source, Action } from './public_types';\nimport {\n IFRAME_ID_PREFIX,\n VERSION,\n IS_IOS,\n IS_WEB,\n IS_ANDROID,\n} from './constants';\nimport Config from './config';\nimport { BridgeError, BridgeErrorMessages } from './types';\n\nimport { logger } from '../../logger';\n\nconst globals = getGlobal();\n\n/**\n * @internal\n */\nclass BridgeImpl extends Emitter implements Bridge {\n private recipientInitialised: boolean = false;\n private messagesQueue: Message[] = [];\n\n constructor(public id: string = generateUUID()) {\n super();\n\n globals.monterosaSdk!.emitter.on('message', this.handleMessage.bind(this));\n }\n\n static isMessage(message: Message | any): message is Message {\n return (\n message instanceof Object &&\n Object.prototype.hasOwnProperty.call(message, 'bridgeId') &&\n Object.prototype.hasOwnProperty.call(message, 'action')\n );\n }\n\n get iFrameId(): string {\n return `${IFRAME_ID_PREFIX}-${this.id}`;\n }\n\n get iFrameSelector(): string {\n return `iframe#${this.iFrameId}`;\n }\n\n get childIFrame(): HTMLIFrameElement | null {\n return document.querySelector(this.iFrameSelector);\n }\n\n private handleMessage(message: Message) {\n const { id, bridgeId, action, respondingTo } = message;\n\n if (bridgeId !== this.id) {\n return;\n }\n\n logger.log(\n `Received a ${respondingTo === null ? 'message' : 'response'}`,\n message,\n );\n\n if (action === Action.OnBridgeInitialised) {\n this.recipientInitialised = true;\n\n if (respondingTo === null) {\n this.send(Action.OnBridgeInitialised, {}, Source.Sdk, id);\n }\n\n while (this.messagesQueue.length > 0) {\n this.postMessage(this.messagesQueue.shift()!);\n }\n\n return;\n }\n\n this.emit('message', message);\n }\n\n private createMessage(\n action: string,\n payload: Payload,\n sourceName: Source,\n respondingTo: string | null = null,\n ): Message {\n return {\n id: generateUUID(),\n respondingTo,\n action,\n sourceName,\n\n bridgeId: this.id,\n\n payload,\n version: VERSION,\n timestamp: Date.now(),\n };\n }\n\n postMessage(message: Message) {\n if (\n !this.recipientInitialised &&\n message.action !== Action.OnBridgeInitialised\n ) {\n this.messagesQueue.push(message);\n\n return;\n }\n\n const json = JSON.stringify(message);\n\n if (IS_IOS) {\n globals.webkit?.messageHandlers?.monterosaSdk.postMessage(json);\n }\n\n if (IS_ANDROID) {\n if (globals.monterosaSdk?.postMessage) {\n globals.monterosaSdk.postMessage(json);\n }\n }\n\n if (IS_WEB) {\n globals.parent.postMessage(json, '*');\n }\n\n if (this.childIFrame) {\n this.childIFrame.contentWindow?.postMessage(json, '*');\n }\n }\n\n send(\n action: string,\n payload: Payload = {},\n sourceName = Source.Sdk,\n respondingTo?: string,\n ): Message {\n const message = this.createMessage(\n action,\n payload,\n sourceName,\n respondingTo,\n );\n\n logger.log(\n `Sending a ${message.respondingTo === null ? 'message' : 'response'}`,\n message,\n );\n\n this.postMessage(message);\n\n return message;\n }\n\n async request(\n action: string,\n payload: Payload = {},\n timeout: number = Config.requestTimeout,\n sourceName = Source.Sdk,\n ): Promise<Message> {\n let timeoutRef: ReturnType<typeof setTimeout>;\n let handler: (message: Message) => void;\n\n const message = this.createMessage(action, payload, sourceName);\n\n logger.log('Sending a request', message);\n\n /**\n * Start the timeout, when it finishes it should reject Promise.race below\n */\n const countdown: Promise<any> = new Promise((_, reject) => {\n timeoutRef = setTimeout(() => {\n reject(\n createError(\n BridgeError.RequestTimeoutError,\n BridgeErrorMessages,\n action,\n timeout,\n ),\n );\n }, timeout);\n });\n\n /**\n * Start the request and wait for the message with the respondingTo\n * equal to message id we sent\n */\n const request: Promise<Message> = new Promise((resolve) => {\n handler = (responseMessage: Message) => {\n if (responseMessage.respondingTo === message.id) {\n resolve(responseMessage);\n }\n };\n\n globals.monterosaSdk!.emitter.on('message', handler);\n\n this.postMessage(message);\n });\n\n /**\n * Start race between timeout and request\n * - if timeout wins the promise will be rejected\n * - if request wins then Message will be resolved\n */\n\n return (\n Promise.race([countdown, request])\n /**\n * As the matter of clean up we need to clear timeout id\n * and unsubscribe from the message event\n */\n .finally(() => {\n clearTimeout(timeoutRef);\n globals.monterosaSdk!.emitter.off('message', handler);\n })\n );\n }\n}\n\nexport default BridgeImpl;\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2022-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { Unsubscribe, subscribe } from '@monterosa/sdk-util';\n\nimport {\n Action,\n Bridge,\n Bridged,\n Message,\n Source,\n Payload,\n} from './public_types';\n\nimport { QueryParam } from '../../types';\n\nimport Config from './config';\nimport BridgeImpl from './bridge_impl';\n\nlet parentBridge: Bridge;\n\nconst bridges: Map<string, BridgeImpl> = new Map();\n\n/**\n * @internal\n */\nexport function getBridge(id: string): BridgeImpl {\n if (bridges.has(id)) {\n return bridges.get(id) as BridgeImpl;\n }\n\n const bridge = new BridgeImpl(id);\n\n bridges.set(id, bridge);\n\n return bridge;\n}\n\n/**\n * Returns true if the page is inside an iframe.\n *\n * @internal\n */\nexport function isInsideIframe(): boolean {\n if (typeof window === 'undefined') {\n return false;\n }\n\n try {\n return window.self !== window.top;\n } catch {\n // SecurityError is thrown when accessing window.top in a cross-origin iframe.\n // If we can't access it, we're definitely in an iframe.\n return true;\n }\n}\n\n/**\n * @internal\n */\nexport function getParentBridge(): Bridge | null {\n if (typeof window === 'undefined') {\n return null;\n }\n\n if (parentBridge !== undefined) {\n return parentBridge;\n }\n\n if (!isInsideIframe()) {\n return null;\n }\n\n const url = new URL(window.location.href);\n\n const bridgeId = url.searchParams.get(QueryParam.BridgeId);\n\n if (bridgeId === null) {\n return null;\n }\n\n parentBridge = new BridgeImpl(bridgeId);\n\n parentBridge.send(Action.OnBridgeInitialised, {}, Source.Sdk);\n\n return parentBridge;\n}\n\n/**\n * @internal\n */\nexport function sendSdkMessage(\n bridged: Bridged,\n action: string,\n payload: Payload = {},\n) {\n return bridged.bridge.send(action, payload, Source.Sdk);\n}\n\n/**\n * Sends a message with an action name and payload to a parent application or child Experience.\n *\n * @remarks\n * Usage example in parent application:\n *\n * @example\n * ```typescript\n * const experience = getExperience();\n *\n * // message to Experience can be sent only when its initialised\n * onStateChanged(experience, (state) => {\n * if (state === 'initialised') {\n * sendMessage(\n * experience,\n * 'my_action',\n * { key: 'value' }\n * );\n * }\n * });\n *\n * embed(experience);\n * ```\n *\n * Usage example in child Experience:\n *\n * @example\n * ```typescript\n * const parentApp = getParentApplication();\n *\n * if (parentApp !== null) {\n * sendMessage(\n * parentApp,\n * 'my_action',\n * { key: 'value' }\n * );\n * }\n * ```\n *\n * @param bridged - Instance of either {@link ParentApplication} or {@link Experience}\n * @param action - Arbitrary action name that defines purpose of the message\n * @param payload - A key-value object that is sent in a message\n * @returns Returns {@link Message | message}\n */\nexport function sendMessage(\n bridged: Bridged,\n action: string,\n payload: Payload = {},\n) {\n return bridged.bridge.send(action, payload, Source.User);\n}\n\n/**\n * @internal\n */\nexport function sendSdkRequest(\n bridged: Bridged,\n action: string,\n payload: Payload = {},\n timeout = Config.requestTimeout,\n) {\n return bridged.bridge.request(action, payload, timeout, Source.Sdk);\n}\n\n/**\n * Sends a request and returns a Promise that resolves when the recipient responds.\n *\n * @remarks\n * Similar to {@link sendMessage} but returns a Promise which\n * resolves if the recipient responds with {@link respondToMessage}. Otherwise it\n * rejects after a certain timeout.\n *\n * Usage example in parent application:\n *\n * @example\n * ```typescript\n * const experience = getExperience();\n *\n * // request to Experience can be sent only when its initialised\n * onStateChanged(experience, async (state) => {\n * if (state === 'initialised') {\n * const response = await sendRequest(\n * experience,\n * 'my_action',\n * { key: 'value' }\n * );\n *\n * console.log(response);\n * }\n * });\n *\n * embed(experience);\n * ```\n *\n * Usage example in child Experience:\n *\n * @example\n * ```typescript\n * const parentApp = getParentApplication();\n *\n * // parent application can be null if Experience is running stand alone\n * if (parentApp !== null) {\n * const response = await sendRequest(\n * parentApp,\n * 'my_action',\n * { key: 'value' }\n * );\n *\n * console.log(response);\n * }\n * ```\n *\n * @param bridged - Instance of either {@link ParentApplication} or {@link Experience}\n * @param action - Arbitrary action name that defines purpose of the message\n * @param payload - A key-value object that is sent as in request\n * @param timeout - Configurable request timeout, if there is no response by\n * the end of this timeout then returned Promise will be rejected.\n */\nexport function sendRequest(\n bridged: Bridged,\n action: string,\n payload: Payload = {},\n timeout = Config.requestTimeout,\n) {\n return bridged.bridge.request(action, payload, timeout, Source.User);\n}\n\n/**\n * @internal\n */\nexport function respondToSdkMessage(\n bridged: Bridged,\n message: Message,\n payload: Payload = {},\n) {\n bridged.bridge.send(message.action, payload, Source.Sdk, message.id);\n}\n\n/**\n * Respond to a received message. It is used to reply to a\n * {@link sendRequest | user request}.\n *\n * @param bridged - Instance of either {@link ParentApplication} or {@link Experience}\n * @param message - {@link Message | Message} to respond to\n * @param payload - A key-value object that is sent as in response\n */\nexport function respondToMessage(\n bridged: Bridged,\n message: Message,\n payload: Payload = {},\n) {\n bridged.bridge.send(message.action, payload, Source.User, message.id);\n}\n\nfunction onMessageFunc(\n bridged: Bridged,\n source: Source,\n callback: (message: Message) => void,\n) {\n return subscribe(bridged.bridge, 'message', (message: Message) => {\n if (message.sourceName === source) {\n callback(message);\n }\n });\n}\n\n/**\n * @internal\n */\nexport function onSdkMessage(\n bridged: Bridged,\n callback: (message: Message) => void,\n): Unsubscribe {\n return onMessageFunc(bridged, Source.Sdk, callback);\n}\n\n/**\n * @internal\n *\n * Adds an observer for when user message is received\n *\n * @param bridged - Instance of either {@link ParentApplication} or {@link Experience}\n * @param callback - The callback that is triggered when user message is received\n * @returns The unsubscribe function. When it's called,\n * the observer will be removed and user messages will no longer be received\n */\nexport function onMessage(\n bridged: Bridged,\n callback: (message: Message) => void,\n): Unsubscribe {\n return onMessageFunc(bridged, Source.User, callback);\n}\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2022-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { MonterosaSdk } from '@monterosa/sdk-core';\nimport { fetchListings } from '@monterosa/sdk-interact-interop';\nimport { generateUUID } from '@monterosa/sdk-util';\n\nimport {\n QueryParam,\n Experience,\n ExperienceConfiguration,\n ExperienceState,\n MonterosaExperienceElement,\n} from './types';\nimport { getBridge, Bridge } from './utils/bridge';\n\n/**\n * @internal\n */\nexport class ExperienceImpl implements Experience {\n readonly _config: Readonly<ExperienceConfiguration>;\n private _parameters: { [key: string]: string } = {};\n readonly bridge: Bridge;\n embedUrl!: string;\n id: string = generateUUID();\n state: ExperienceState = 'unmounted';\n customElement: MonterosaExperienceElement | null = null;\n\n constructor(public sdk: MonterosaSdk, config: ExperienceConfiguration) {\n this._config = config;\n this.bridge = getBridge(this.id);\n\n if (config.parameters !== undefined) {\n const reserved = Object.values(QueryParam) as string[];\n const ignored: string[] = [];\n\n Object.entries(config.parameters).forEach(([key, value]) => {\n if (reserved.includes(key)) {\n ignored.push(key);\n } else {\n this._parameters[key] = value;\n }\n });\n\n if (ignored.length === 1) {\n console.warn(\n `Parameter \"${ignored[0]}\" ignored as it matches reserved words`,\n );\n }\n\n if (ignored.length > 1) {\n console.warn(\n `Parameters \"${ignored.join(\n '\", \"',\n )}\" ignored as they match reserved words`,\n );\n }\n }\n }\n\n get config() {\n return Object.assign(this._config, {\n autoresizesHeight: this._config.autoresizesHeight ?? false,\n hidesHeadersAndFooters: this._config.hidesHeadersAndFooters ?? true,\n supportsLoadingState: this._config.supportsLoadingState ?? true,\n experienceUrl: this._config.experienceUrl ?? null,\n });\n }\n\n async getEmbedUrl() {\n if (this.embedUrl) {\n return Promise.resolve(this.embedUrl);\n }\n\n const {\n options: { host, projectId },\n } = this.sdk;\n\n const listings = await fetchListings(host, projectId);\n\n this.embedUrl = listings.project.embed;\n\n return this.embedUrl;\n }\n\n async getUrl(): Promise<string> {\n const embedUrl = await this.getEmbedUrl();\n\n // sanitise and create an object from an url\n let url = new URL(ExperienceImpl.sanitiseUrl(embedUrl));\n\n // override host and project with those that are set in SDK instance\n url.searchParams.set(QueryParam.Host, this.sdk.options.host);\n url.searchParams.set(QueryParam.Project, this.sdk.options.projectId);\n\n // if custom experienceUrl is set:\n // * take experienceUrl as the base\n // * search params from experienceUrl have priority\n if (this.config.experienceUrl !== null) {\n // sanitise and create an object from a custom url\n const customUrl = new URL(\n ExperienceImpl.sanitiseUrl(this.config.experienceUrl),\n );\n\n // apply embedUrl query parameters if they don't exist in experienceUrl\n Array.from(url.searchParams.entries())\n .filter(([key]) => !customUrl.searchParams.has(key))\n .forEach(([key, value]) => customUrl.searchParams.set(key, value));\n\n url = customUrl;\n }\n\n // Prepare a final list of query parameters\n const queryParameters = {\n ...(this.config.host !== undefined && {\n [QueryParam.Host]: this.config.host,\n }),\n\n ...(this.config.projectId !== undefined && {\n [QueryParam.Project]: this.config.projectId,\n }),\n\n ...(this.config.eventId !== undefined && {\n [QueryParam.Event]: this.config.eventId,\n }),\n\n [QueryParam.BridgeId]: this.bridge.id,\n\n [QueryParam.HideHeaderAndFooter]: this.config.hidesHeadersAndFooters\n ? '1'\n : '0',\n\n [QueryParam.AutoresizesHeight]: this.config.autoresizesHeight ? '1' : '0',\n\n // Adding user defined parameters to the URL search parameters if exists\n ...this._parameters,\n };\n\n Object.entries(queryParameters).forEach(([key, value]) => {\n url.searchParams.set(key, value);\n });\n\n return url.href;\n }\n\n private static sanitiseUrl(\n url: string,\n options?: {\n stripReservedParameters?: 'all' | 'mic';\n },\n ): string {\n const stripReservedParameters = options?.stripReservedParameters || 'mic';\n\n // Ensure the URL includes a protocol.\n if (/^http/.test(url) === false) {\n // If none are found, use the same as the document.\n url = `${document.location.protocol}${url}`;\n }\n\n const urlObj = new URL(url);\n\n Object.values(QueryParam)\n .filter((key) => {\n if (stripReservedParameters === 'mic') {\n return key.startsWith('mic');\n }\n\n return key;\n })\n .forEach((key) => urlObj.searchParams.delete(key));\n\n return urlObj.href;\n }\n}\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2025-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport type { Integration, Experience } from './types';\n\nconst integrations: Map<HTMLElement, Integration> = new Map();\n\nexport function addIntegration(\n container: HTMLElement,\n integration: Integration,\n) {\n integrations.set(container, integration);\n}\n\nexport function getIntegration(container: HTMLElement): Integration | void;\n\nexport function getIntegration(experience: Experience): Integration | void;\n\nexport function getIntegration(\n containerOrExperience: HTMLElement | Experience,\n): Integration | void {\n if (containerOrExperience instanceof HTMLElement) {\n return integrations.get(containerOrExperience);\n }\n\n return Array.from(integrations.values()).find(\n (integration) => integration.experience === containerOrExperience,\n );\n}\n\nexport function getIntegrations(): Array<Integration> {\n return Array.from(integrations.values());\n}\n\nexport function deleteIntegration(container: HTMLElement) {\n integrations.delete(container);\n}\n\nexport function hasIntegration(container: HTMLElement): boolean;\n\nexport function hasIntegration(experience: Experience): boolean;\n\nexport function hasIntegration(\n containerOrExperience: HTMLElement | Experience,\n): boolean {\n if (containerOrExperience instanceof HTMLElement) {\n return integrations.has(containerOrExperience);\n }\n\n return Array.from(integrations.values()).some(\n (integration) => integration.experience === containerOrExperience,\n );\n}\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { Emitter, Unsubscribe } from '@monterosa/sdk-util';\n\nimport type { Experience, ExperienceState } from './types';\nimport type { ExperienceImpl } from './experience_impl';\n\n/**\n * Event emitter for Experience state changes.\n *\n * @internal\n */\nexport const stateEmitter = new Emitter();\n\n/**\n * Updates the Experience state and emits a state change event.\n *\n * @param experience - The Experience instance to update\n * @param newState - The target state to transition to\n *\n * @internal\n */\nexport function updateExperienceState(\n experience: Experience,\n newState: ExperienceState,\n): void {\n const currentState = experience.state;\n\n // No-op if already in the target state\n if (currentState === newState) {\n return;\n }\n\n // Cast to ExperienceImpl to access the mutable state property\n (experience as ExperienceImpl).state = newState;\n\n stateEmitter.emit('stateChanged', experience, newState);\n}\n\n/**\n * Callback type for global state change handler.\n */\nexport type GlobalStateChangedCallback = (\n experience: Experience,\n state: ExperienceState,\n) => void;\n\n/**\n * Callback type for instance-specific state change handler.\n */\nexport type InstanceStateChangedCallback = (state: ExperienceState) => void;\n\n/**\n * Subscribe to state changes for all Experiences.\n *\n * This is useful for no-build (CMS) scenarios where you want to react to\n * state changes across all Experiences declaratively.\n *\n * @param callback - Called when any Experience changes state\n * @returns Function to unsubscribe from state changes\n *\n * @example\n * ```typescript\n * import { onStateChanged } from '@monterosa/sdk-launcher-kit';\n *\n * const unsubscribe = onStateChanged((experience, state) => {\n * console.log(`Experience ${experience.id} is now ${state}`);\n *\n * if (state === 'initialised') {\n * // Configure the Experience\n * sendMessage(experience, 'configure', { theme: 'dark' });\n * }\n * });\n *\n * // Later, to stop listening:\n * unsubscribe();\n * ```\n */\nexport function onStateChanged(\n callback: GlobalStateChangedCallback,\n): Unsubscribe;\n\n/**\n * Subscribe to state changes for a specific Experience.\n *\n * This is useful for build (JS) scenarios where you have a reference to\n * a specific Experience and want to react to its state changes.\n *\n * @param experience - The Experience to observe\n * @param callback - Called when the Experience changes state\n * @returns Function to unsubscribe from state changes\n *\n * @example\n * ```typescript\n * import { getExperience, embed, onStateChanged } from '@monterosa/sdk-launcher-kit';\n *\n * const experience = getExperience(sdk, { eventId: 'poll-123' });\n *\n * onStateChanged(experience, (state) => {\n * if (state === 'initialised') {\n * sendMessage(experience, 'configure', { theme: 'dark' });\n * }\n * });\n *\n * embed(experience, container);\n * ```\n */\nexport function onStateChanged(\n experience: Experience,\n callback: InstanceStateChangedCallback,\n): Unsubscribe;\n\nexport function onStateChanged(\n experienceOrCallback: Experience | GlobalStateChangedCallback,\n callback?: InstanceStateChangedCallback,\n): Unsubscribe {\n if (typeof experienceOrCallback === 'function') {\n // Global handler: onStateChanged(callback)\n const globalCallback = experienceOrCallback;\n\n stateEmitter.on('stateChanged', globalCallback);\n\n return () => {\n stateEmitter.off('stateChanged', globalCallback);\n };\n }\n\n // Instance handler: onStateChanged(experience, callback)\n const experience = experienceOrCallback;\n const instanceCallback = callback!;\n\n const wrappedCallback: GlobalStateChangedCallback = (exp, state) => {\n if (exp === experience) {\n instanceCallback(state);\n }\n };\n\n stateEmitter.on('stateChanged', wrappedCallback);\n\n return () => {\n stateEmitter.off('stateChanged', wrappedCallback);\n };\n}\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2022 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { delay } from '@monterosa/sdk-util';\n\nimport { LOADER_ANIMATION_DURATION, DEFAULT_HEIGHT } from './constants';\n\n/* eslint-disable */\ntype CSSProperties = keyof Omit<\n CSSStyleDeclaration,\n | typeof Symbol.iterator\n | number\n | 'length'\n | 'parentRule'\n | 'getPropertyPriority'\n | 'getPropertyValue'\n | 'item'\n | 'removeProperty'\n | 'setProperty'\n>;\n/* eslint-enable */\n\nfunction getLoadingTemplate(): string {\n return `\n <div>\n <style type=\"text/css\">\n .__mic-loader {\n position: absolute;\n width: 100%;\n height: 100%;\n z-index: 9;\n box-sizing: border-box;\n text-align: center;\n background: #fff;\n }\n\n .__mic-loader__container {\n padding: 20px 0;\n gap: 20px;\n min-height: ${DEFAULT_HEIGHT}px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n .__mic-loader__spinner {\n position: relative;\n width: 10px;\n height: 10px;\n border-radius: 5px;\n background-color: #0b0f1c;\n color: #0b0f1c;\n animation: mic-loader__animation 1s infinite linear alternate;\n animation-delay: 0.5s; \n }\n\n .__mic-loader__spinner::before,\n .__mic-loader__spinner::after {\n content: \"\";\n display: inline-block;\n position: absolute;\n top: 0;\n }\n\n .__mic-loader__spinner::before {\n left: -15px;\n width: 10px;\n height: 10px;\n border-radius: 5px;\n background-color: #0b0f1c;\n color: #0b0f1c;\n animation: mic-loader__animation 1s infinite alternate;\n animation-delay: 0s;\n }\n\n .__mic-loader__spinner::after {\n left: 15px;\n width: 10px;\n height: 10px;\n border-radius: 5px;\n background-color: #0b0f1c;\n color: #0b0f1c;\n animation: mic-loader__animation 1s infinite alternate;\n animation-delay: 1s;\n }\n\n @keyframes mic-loader__animation {\n 0% {\n background-color: #0b0f1c;\n }\n 50%, 100% {\n background-color: rgba(11, 15, 28, 0.2);\n }\n }\n </style>\n <div class=\"__mic-loader\">\n <div class=\"__mic-loader__container\">\n <div class=\"__mic-loader__spinner\"></div>\n </div>\n </div>\n </div>\n `;\n}\n\nexport function embed(\n container: HTMLElement,\n loadingTemplate: () => string = getLoadingTemplate,\n): HTMLElement {\n /**\n * Return existing element if it exists\n */\n let loaderElement: HTMLElement | null =\n container.querySelector('[data-role=loader]');\n\n if (loaderElement !== null) {\n return loaderElement;\n }\n\n /**\n * Stash and apply some custom styles to container element\n */\n stashStyles(container, ['minHeight', 'position']);\n\n container.style.minHeight = `${DEFAULT_HEIGHT}px`;\n\n /**\n * Inject loader element built from the html markup template\n */\n const templateElement = document.createElement('template');\n templateElement.innerHTML = loadingTemplate().trim();\n\n loaderElement = container.appendChild(\n templateElement.content.firstElementChild as Element,\n ) as HTMLElement;\n\n /**\n * Setting custom data attribute to be able to distinguish element along\n * other injected html elements if any\n */\n loaderElement.setAttribute('data-role', 'loader');\n\n return loaderElement;\n}\n\nexport function unmount(container: HTMLElement): void {\n const loaderElement = container.querySelector('[data-role=loader]');\n\n if (loaderElement === null) {\n return;\n }\n\n loaderElement.parentElement?.removeChild(loaderElement);\n\n unstashStyles(container);\n}\n\nexport async function show(\n container: HTMLElement,\n loadingTemplate: () => string = getLoadingTemplate,\n): Promise<void> {\n const loaderElement = embed(container, loadingTemplate);\n\n const { position } = getComputedStyle(container);\n\n /**\n * In order to properly position the loader,\n * the container's position should be anything but 'static'.\n */\n if (position === 'static') {\n container.style.position = 'relative';\n }\n\n /**\n * Setting styles to the loader for a nice fade in animation\n */\n loaderElement.style.opacity = '0';\n\n /**\n * Kicking fade animation in.\n */\n setTimeout(() => {\n loaderElement.style.transition = `all ${LOADER_ANIMATION_DURATION}ms`;\n loaderElement.style.opacity = '1';\n }, 0);\n\n /**\n * Wait until the animation is finished. We do not use \"transitionend\" event\n * here as it will just make the code more bloated and unnecessary complex.\n */\n await delay(LOADER_ANIMATION_DURATION);\n}\n\nexport async function hide(container: HTMLElement): Promise<void> {\n const loaderElement: HTMLElement | null =\n container.querySelector('[data-role=loader]');\n\n if (loaderElement === null) {\n return;\n }\n\n /**\n * Kicking fade out animation.\n */\n setTimeout(() => {\n loaderElement.style.opacity = '0';\n }, 0);\n\n /**\n * Wait until the animation is finished. We do not use \"transitionend\" event\n * here as it will just make the code more bloated and unnecessary complex.\n */\n await delay(LOADER_ANIMATION_DURATION);\n\n unstashStyles(container);\n unmount(container);\n}\n\nfunction stashStyles(element: HTMLElement, props: CSSProperties[]) {\n const styles = getComputedStyle(element);\n\n const stash = props\n .map((prop) => `${String(prop)}=${styles[prop]}`)\n .join(';');\n\n element.setAttribute('data-stash', stash);\n}\n\nfunction unstashStyles(element: HTMLElement) {\n const stash = element.getAttribute('data-stash');\n\n if (stash === null) {\n return;\n }\n\n const attributes: [attr: CSSProperties, value: string][] = stash\n .split(';')\n .map((attr) => attr.split('=') as [attr: CSSProperties, value: string]);\n\n for (const [attr, value] of attributes) {\n element.style[attr] = value;\n }\n\n element.removeAttribute('data-stash');\n}\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2022-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { MonterosaSdk, Sdk, getSdk, LogLevel } from '@monterosa/sdk-core';\nimport { delay } from '@monterosa/sdk-util';\n\nimport { Experience, ExperienceConfiguration, Integration } from './types';\n\nimport { LOADER_TIMEOUT, LOADER_BUMPER_TIMEOUT } from './constants';\n\nimport { logger } from './logger';\n\nimport { sendSdkMessage, onSdkMessage, Action } from './utils/bridge';\n\nimport { ExperienceImpl } from './experience_impl';\nimport {\n addIntegration,\n getIntegration,\n deleteIntegration,\n hasIntegration,\n} from './integrations';\nimport { updateExperienceState } from './state';\n\nimport { show as showLoader, hide as hideLoader } from './loader';\n\nimport { version } from '../package.json';\n\n/**\n * The current SDK version.\n *\n * @internal\n */\nexport const VERSION = version;\n\n/**\n * Creates an iframe with the provided parameters.\n *\n * @param url Url of the web app.\n *\n * @private\n */\nfunction createIFrame(\n url: string,\n options: {\n id?: string;\n scrolling?: boolean;\n allow?: string;\n allowFullScreen?: boolean;\n title?: string;\n } = {},\n): HTMLIFrameElement {\n const iframe = document.createElement('iframe');\n iframe.style.width = '100%';\n iframe.style.height = '100%';\n iframe.style.border = '0';\n iframe.style.display = 'block';\n iframe.style.boxSizing = 'border-box';\n\n iframe.setAttribute('src', url);\n\n if (options.id !== undefined) {\n iframe.setAttribute('id', options.id);\n }\n\n if (options.allow !== undefined) {\n iframe.setAttribute('allow', options.allow);\n }\n\n if (options.allowFullScreen === true) {\n iframe.setAttribute('allowfullscreen', '');\n }\n\n if (options.title !== undefined) {\n iframe.setAttribute('title', options.title);\n }\n\n /**\n * Though scrolling attribute is deprecated we still have to rely on it as some\n * browsers (e.g. Chrome, as of now version 103) just ignores overflow: hidden.\n * Hence we are setting scrolling to no in order to eliminate scroll and calculate\n * width of the child Experience correctly. If scroll persists it appears on each\n * content change what leads to incorrect width calculation.\n *\n * Later we will look into alternatives such as iframeless Experience embed\n */\n if (!options.scrolling) {\n iframe.style.overflow = 'hidden';\n iframe.setAttribute('scrolling', 'no');\n }\n\n return iframe;\n}\n\nfunction concealIFrame(iframe: HTMLIFrameElement) {\n iframe.style.opacity = '0';\n}\n\nfunction revealIFrame(iframe: HTMLIFrameElement) {\n iframe.style.opacity = '1';\n}\n\nfunction isSdk(value: MonterosaSdk | any): value is MonterosaSdk {\n return value instanceof Sdk;\n}\n\n/**\n * Returns Experience for the default SDK instance.\n *\n * @param config - Optional config\n * @returns The Experience instance.\n */\nexport function getExperience(config?: ExperienceConfiguration): Experience;\n\n/**\n * Returns Experience for the given SDK instance.\n *\n * @param sdk - Optional SDK instance whose Experience to return.\n * If no SDK is provided, it will attempt to use the default one\n * @param config - Optional config\n * @returns The Experience instance.\n */\nexport function getExperience(\n sdk?: MonterosaSdk,\n config?: ExperienceConfiguration,\n): Experience;\n\nexport function getExperience(\n sdkOrConfig?: MonterosaSdk | ExperienceConfiguration,\n config?: ExperienceConfiguration,\n): Experience {\n let sdk: MonterosaSdk;\n let experienceConfig: ExperienceConfiguration;\n\n if (isSdk(sdkOrConfig)) {\n /**\n * Interface: getExperience(sdk, config?)\n */\n\n sdk = sdkOrConfig;\n\n if (config !== undefined) {\n experienceConfig = config;\n } else {\n experienceConfig = {};\n }\n } else if (sdkOrConfig !== undefined) {\n /**\n * Interface: getExperience(config)\n */\n\n sdk = getSdk();\n experienceConfig = sdkOrConfig;\n } else {\n /**\n * Interface: getExperience()\n */\n\n sdk = getSdk();\n experienceConfig = {};\n }\n\n const experience = new ExperienceImpl(sdk, experienceConfig);\n\n return experience;\n}\n\nasync function waitForAction(experience: Experience, action: Action) {\n return new Promise<void>((resolve) => {\n const unsubscribe = onSdkMessage(experience, (message) => {\n if (message.action === action) {\n unsubscribe();\n resolve();\n }\n });\n });\n}\n\nasync function experienceReady(experience: Experience) {\n /**\n * Bumper delay during which loading state can't be hidden even\n * if Experience loaded earlier than timer reached bumper timeout\n */\n const bumper = delay(LOADER_BUMPER_TIMEOUT);\n\n /**\n * Final cut off timeout delay after which loading state must\n * be hidden even if Experience is still loading\n */\n const timeout = delay(LOADER_TIMEOUT);\n\n const loaded = waitForAction(experience, Action.OnReady);\n\n const hasFullyLoadedExperience = Promise.all([bumper, loaded]);\n\n const eitherTimeoutOrFullyLoaded = Promise.race([\n timeout,\n hasFullyLoadedExperience,\n ]);\n\n return eitherTimeoutOrFullyLoaded;\n}\n\n/**\n * Embeds a web Experience app into an iframe.\n *\n * @remarks\n * There is only one app that can be associated with an Experience and it is\n * configured in Monterosa / Interaction Cloud. Please refer to the developer\n * guide for more information:\n * {@link https://products.monterosa.co/mic/developer-guides/whats-an-app}\n *\n * @example\n * ```javascript\n * const experience = getExperience();\n *\n * embed(experience, 'container-id');\n * ```\n * @param experience - An instance of Experience\n * @param containerOrId - HTML element instance or\n * element id where iframe is embedded into.\n *\n * @public\n */\nexport async function embed(\n experience: Experience,\n containerOrId: HTMLElement | string,\n): Promise<void> {\n const container =\n containerOrId instanceof HTMLElement\n ? containerOrId\n : document.getElementById(containerOrId);\n\n if (container === null) {\n throw new Error(\n `Container element \"${containerOrId}\" not found in DOM. ` +\n 'Please ensure the element exists before calling embed().',\n );\n }\n\n if (hasIntegration(container)) {\n throw new Error(\n 'Container already contains an embedded experience. Use unmount() first ' +\n 'to remove the existing experience before embedding a new one.',\n );\n }\n\n if (hasIntegration(experience)) {\n throw new Error(\n 'This experience is already embedded in another container. Use unmount() ' +\n 'to remove it from that container before embedding it into this one.',\n );\n }\n\n const controller = new AbortController();\n\n const integration: Integration = {\n container,\n experience,\n controller,\n };\n\n addIntegration(container, integration);\n\n if (experience.config.supportsLoadingState === true) {\n // Although showLoader is an asynchronous function, we execute\n // it synchronously to embed the iframe as quickly as possible.\n showLoader(container, experience.config.loadingTemplate);\n }\n\n const url = await experience.getUrl();\n\n if (controller.signal.aborted) {\n return;\n }\n\n const iframe = createIFrame(url, {\n id: experience.bridge.iFrameId,\n scrolling: !experience.config.autoresizesHeight,\n allow: experience.config.allow,\n allowFullScreen: experience.config.allowFullScreen,\n title: experience.config.title,\n });\n\n container.appendChild(iframe);\n\n concealIFrame(iframe);\n\n updateExperienceState(experience, 'mounted');\n\n await waitForAction(experience, Action.OnExperienceInitialised);\n\n if (controller.signal.aborted) {\n return;\n }\n\n updateExperienceState(experience, 'initialised');\n\n await experienceReady(experience);\n\n if (controller.signal.aborted) {\n return;\n }\n\n updateExperienceState(experience, 'ready');\n\n revealIFrame(iframe);\n\n if (experience.config.supportsLoadingState === true) {\n await hideLoader(container);\n }\n}\n\n/**\n * Removes an Experience from its container and resets its state to `unmounted`.\n *\n * This is the preferred method for removing an embedded Experience.\n * Use {@link onStateChanged} to observe when the Experience transitions\n * to the `unmounted` state.\n *\n * @example\n * ```javascript\n * const experience = getExperience(sdk, { eventId: 'poll-123' });\n * embed(experience, container);\n *\n * // Later, to remove:\n * unembed(experience);\n * ```\n *\n * @param experience - The Experience instance to unembed\n *\n * @public\n */\nexport function unembed(experience: Experience): void {\n const integration = getIntegration(experience);\n\n if (!integration) {\n throw new Error(\n 'This Experience is not currently embedded. ' +\n 'Please ensure the Experience is embedded before calling unembed().',\n );\n }\n\n const { container } = integration;\n\n integration.controller.abort();\n\n while (container.lastElementChild) {\n container.removeChild(container.lastElementChild);\n }\n\n deleteIntegration(container);\n\n container.style.height = '';\n\n updateExperienceState(experience, 'unmounted');\n}\n\n/**\n * Unmounts web Experience app which was previously embedded in the container.\n *\n * @deprecated Use {@link unembed} instead, which takes an Experience instance\n * rather than a container.\n *\n * @example\n * ```javascript\n * unmount('container-id');\n * ```\n *\n * @param {HTMLElement | string} containerOrId - HTML element instance or\n * element id where iframe is embedded into.\n *\n * @public\n */\nexport function unmount(containerOrId: HTMLElement | string): void {\n console.warn(\n '[launcher-kit] unmount() is deprecated. Use unembed(experience) instead.',\n );\n const container =\n containerOrId instanceof HTMLElement\n ? containerOrId\n : document.getElementById(containerOrId);\n\n if (container === null) {\n throw new Error(\n `Container element \"${containerOrId}\" not found in DOM. ` +\n 'Please ensure the element exists before calling unmount().',\n );\n }\n\n const integration = getIntegration(container);\n\n if (!integration) {\n throw new Error(\n `No Experience found embedded in container \"${containerOrId}\". ` +\n 'Please ensure the Experience is embedded before calling unmount().',\n );\n }\n\n integration.controller.abort();\n\n while (container.lastElementChild) {\n container.removeChild(container.lastElementChild);\n }\n\n deleteIntegration(container);\n\n container.style.height = '';\n\n updateExperienceState(integration.experience, 'unmounted');\n}\n\n/**\n * Informs the Experience that more data should be loaded and displayed on the UI.\n *\n * @remarks\n * One example is when Experience renders items feed partially. Once a user scrolled\n * to the bottom edge of the app, more elements to load is requested.\n *\n * @param experience - Experience instance\n */\nexport function requestMoreData(experience: Experience): void {\n sendSdkMessage(experience, Action.OnMoreDataRequested);\n}\n\n/**\n * Enables logging with the specified log level.\n *\n * @param logLevel - The log level or flag to determine the logging\n * behaviour. If a log level is provided, it will be used to set\n * the log level. If a boolean flag is provided, logging will be\n * enabled or disabled based on the flag value.\n */\nexport function enableLogging(logLevel?: LogLevel): void;\n\n/**\n * Enables or disables logging based on the provided flag.\n *\n * @param enable - The flag to determine the logging\n * behaviour. If a boolean flag is provided, logging will\n * be enabled or disabled based on the flag value.\n */\nexport function enableLogging(enable?: boolean): void;\n\nexport function enableLogging(logLevelOrFlag: LogLevel | boolean = true) {\n if (typeof logLevelOrFlag === 'boolean') {\n logger.logLevel = logLevelOrFlag ? LogLevel.Verbose : LogLevel.Silent;\n\n return;\n }\n\n logger.logLevel = logLevelOrFlag;\n}\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2022-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { configure } from '@monterosa/sdk-core';\n\nimport type { Experience } from './types';\nimport { getExperience, embed, unembed } from './api';\nimport { Action, onSdkMessage } from './utils/bridge';\nimport type { ExperienceImpl } from './experience_impl';\n\nconst ELEMENT_NAME = 'monterosa-experience';\n\nclass MonterosaExperienceElement extends HTMLElement {\n private _experience: Experience | null = null;\n /**\n * The host URL for the Experience.\n */\n get host(): string {\n return this.getAttribute('host') || '';\n }\n\n /**\n * The project identifier.\n */\n get projectId(): string {\n return this.getAttribute('projectId') || '';\n }\n\n /**\n * The event identifier (optional).\n */\n get eventId(): string | undefined {\n return this.getAttribute('eventId') || undefined;\n }\n\n async connectedCallback() {\n const host = this.getAttribute('host');\n\n if (host === null) {\n throw new Error('Host attribute is not set for Experience element');\n }\n\n const projectId = this.getAttribute('projectId');\n\n if (projectId === null) {\n throw new Error('Project attribute is not set for Experience element');\n }\n\n const autoresizesHeight = this.getAttribute('autoresizesHeight') !== null;\n\n const hidesHeadersAndFooters =\n this.getAttribute('hidesHeadersAndFooters') !== null;\n\n const eventId =\n this.getAttribute('eventId') !== null\n ? (this.getAttribute('eventId') as string)\n : undefined;\n\n const experienceUrl =\n this.getAttribute('experienceUrl') !== null\n ? this.getAttribute('experienceUrl')!\n : undefined;\n\n const allow =\n this.getAttribute('allow') !== null\n ? this.getAttribute('allow')!\n : undefined;\n\n const allowFullScreen = this.getAttribute('allowFullScreen') !== null;\n\n const parameters: { [key: string]: string } = {};\n\n for (let i = 0; i < this.attributes.length; i++) {\n const attr = this.attributes[i];\n\n if (attr.name.startsWith('param-')) {\n const paramName = attr.name.split('param-')[1];\n\n parameters[paramName] = attr.value;\n }\n }\n\n const title =\n this.getAttribute('title') !== null\n ? (this.getAttribute('title') as string)\n : undefined;\n\n const sdk = configure(\n {\n host,\n projectId,\n },\n `${host}-${projectId}`,\n );\n\n const experience = getExperience(sdk, {\n autoresizesHeight,\n eventId,\n hidesHeadersAndFooters,\n experienceUrl,\n allow,\n allowFullScreen,\n parameters,\n title,\n });\n\n // Link the custom element to the experience\n (experience as ExperienceImpl).customElement = this;\n this._experience = experience;\n\n embed(experience, this);\n\n // eslint-disable-next-line\n onSdkMessage(experience, ({ payload, action }) => {\n switch (action) {\n case Action.OnExperienceInitialised:\n break;\n case Action.OnResize: {\n // const { width, height } = payload;\n break;\n }\n case Action.OnReady:\n this.dispatchEvent(\n new CustomEvent('ready', {\n bubbles: true,\n cancelable: false,\n composed: true,\n }),\n );\n break;\n }\n });\n }\n\n disconnectedCallback() {\n const experience = this._experience;\n this._experience = null;\n if (experience) {\n try {\n unembed(experience);\n } catch {\n // Experience may already have been unembedded\n }\n }\n }\n}\n\nif (!customElements.get(ELEMENT_NAME)) {\n customElements.define(ELEMENT_NAME, MonterosaExperienceElement);\n}\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2025-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { Experience } from './types';\n\nimport { Action, onSdkMessage } from './utils/bridge';\n\nimport { getIntegration } from './integrations';\nimport { onStateChanged } from './state';\n\nconst unsubs: Map<string, () => void> = new Map();\n\nfunction handleExperienceEmbedded(experience: Experience): void {\n if (!experience.config.autoresizesHeight) {\n return;\n }\n\n const integration = getIntegration(experience);\n\n if (!integration) {\n return;\n }\n\n const { container } = integration;\n\n const unsub = onSdkMessage(experience, ({ action, payload }) => {\n if (action === Action.OnResize) {\n /**\n * Container width is maintained the same as it is defined in the parent\n * page to preserve its behaviour. Only the height is updated\n */\n // container.style.width = `${payload.width}px`;\n container.style.height = `${payload.height}px`;\n }\n });\n\n unsubs.set(experience.id, unsub);\n}\n\nfunction handleExperienceUnmounted(experience: Experience): void {\n const unsub = unsubs.get(experience.id);\n\n if (unsub) {\n unsub();\n unsubs.delete(experience.id);\n }\n}\n\nonStateChanged((experience, state) => {\n if (state === 'mounted') {\n handleExperienceEmbedded(experience);\n } else if (state === 'unmounted') {\n handleExperienceUnmounted(experience);\n }\n});\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2022 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { Bridge } from './utils/bridge';\nimport { ParentApplication } from './types';\n\n/**\n * @internal\n */\nexport class ParentApplicationImpl implements ParentApplication {\n constructor(public bridge: Bridge) {}\n}\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2023 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { ParentApplication } from './types';\n\nimport { ParentApplicationImpl } from './parent_application_impl';\n\nimport { getParentBridge } from './utils/bridge';\n\nlet parentApplication: ParentApplication;\n\n/**\n * Returns instance of parent application.\n *\n * @returns Returns {@link ParentApplication}\n * if an Experience resides within the parent application, and it was embedded\n * using {@link embed} function. Otherwise it returns `null`.\n */\nexport function getParentApplication(): ParentApplication | null {\n if (parentApplication !== undefined) {\n return parentApplication;\n }\n\n const parentBridge = getParentBridge();\n\n if (parentBridge === null) {\n return null;\n }\n\n parentApplication = new ParentApplicationImpl(parentBridge);\n\n return parentApplication;\n}\n","/**\n * @license\n * @monterosa/sdk-launcher-kit\n *\n * Copyright © 2022-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { Unsubscribe, throttle } from '@monterosa/sdk-util';\n\nimport { RESIZE_THROTTLE_TIMEOUT } from './constants';\n\nimport { QueryParam, Experience } from './types';\n\nimport { getParentApplication } from './parent_application';\nimport { sendSdkMessage, onSdkMessage, Action } from './utils/bridge';\n\nfunction getUrlParam(param: string) {\n let queryString = {};\n\n if (typeof window !== 'undefined') {\n queryString = window.location.search;\n }\n\n const urlParams = new URLSearchParams(queryString);\n\n return urlParams.get(param);\n}\n\n/**\n * Returns whether the Experience should hide its header and footer.\n *\n * @remarks\n * The SDK on the parent application will by default request a child\n * Experience to hide its header and footer by setting a query parameter called\n * `micHideHeaderAndFooter` to `1`.\n *\n * When true, the developer of a child Experience is expected to hide it's headers\n * and footers as the parent application is actively providing them.\n *\n * You can test whether you are respecting this correctly by adding the following query\n * to your URL:\n *\n * \"?micHideHeaderAndFooter=1\"\n *\n * @returns Whether the header and footer views should be hidden.\n */\nexport function shouldHideHeaderAndFooter() {\n return getUrlParam(QueryParam.HideHeaderAndFooter) === '1';\n}\n\n/**\n * This function will returns true if experience is embedded in autoresize height mode.\n */\nexport function isAutoresizesHeight() {\n return getUrlParam(QueryParam.AutoresizesHeight) === '1';\n}\n\n/**\n * Notifies the parent application that the Experience has initialised and\n * is ready to receive messages. This triggers the `initialised` lifecycle state.\n *\n * Call this method when your Experience has completed its initial setup and\n * is ready to receive configuration or other messages from the parent application.\n *\n * @example\n * ```javascript\n * import { sendInitialised } from '@monterosa/sdk-launcher-kit';\n *\n * // After your Experience has initialised\n * sendInitialised();\n * ```\n */\nexport function sendInitialised(): void {\n const parentApp = getParentApplication();\n\n if (parentApp === null) {\n console.log(\n 'Unable to send initialised message, as there is no parent application',\n );\n\n return;\n }\n\n sendSdkMessage(parentApp, Action.OnExperienceInitialised);\n}\n\n/**\n * Notifies the parent application that the Experience UI is fully loaded\n * and ready to be displayed. This triggers the `ready` lifecycle state.\n *\n * @remarks\n * Call this method when your UI has completed loading and you are ready to\n * display data to the user. This can be when your network calls have successfully\n * requested data and you have updated the DOM, or when an error has occurred and\n * you want to take over the UI to provide details to the user.\n *\n * The SDK will use this message to dismiss the loading indicator, allowing a\n * seamless transition between a native loading UI and the fully loaded Experience.\n *\n * If this call is not made, the parent SDK will add a grace period to ensure\n * the web app has sufficient time to load, and eventually dismiss the loading\n * state to avoid infinite loading scenarios.\n *\n * @example\n * ```javascript\n * import { sendReady } from '@monterosa/sdk-launcher-kit';\n *\n * // After your UI has finished loading\n * sendReady();\n * ```\n */\nexport function sendReady(): void {\n const parentApp = getParentApplication();\n\n if (parentApp === null) {\n console.log(\n 'Unable to send ready message, as there is no parent application',\n );\n\n return;\n }\n\n sendSdkMessage(parentApp, Action.OnReady);\n}\n\n/**\n * @deprecated Use {@link sendReady} instead.\n *\n * Sends a message to the SDK of the parent application informing it that\n * the UI of this Experience has completed loading.\n */\nexport function sendFinishedLoadingUI(): void {\n console.warn(\n '[launcher-kit] sendFinishedLoadingUI() is deprecated. Use sendReady() instead.',\n );\n sendReady();\n}\n\n/**\n * Adds an observer for when more data is requested by the parent application\n *\n * @param callback - The callback that is triggered when a request for more data\n * is received\n * @returns The unsubscribe function. When it's called,\n * the observer will be removed and requests for data will no longer be received\n */\nexport function onMoreDataRequested(callback: () => void): Unsubscribe {\n const parentApp = getParentApplication();\n\n if (parentApp === null) {\n console.log(\n 'Unable to subscribe to more data event, as there is no parent application',\n );\n\n return () => {};\n }\n\n return onSdkMessage(parentApp, ({ action }) => {\n if (action === Action.OnMoreDataRequested) {\n callback();\n }\n });\n}\n\n/**\n * Adds an observer for when experience is fully embedded and ready to accept\n * incoming messages\n *\n * @deprecated Use `onStateChanged(experience, (state) => {\n * if (state === 'initialised') ...\n * })` instead.\n *\n * @param experience - Experience instance\n * @param callback - The callback that is triggered when experience is embedded\n * @returns The unsubscribe function. When it's called, the observer will be\n * removed and ready event will not be received\n */\nexport function onReady(\n experience: Experience,\n callback: () => void,\n): Unsubscribe {\n console.warn(\n '[launcher-kit] onReady() is deprecated. Use onStateChanged(' +\n \"experience, (state) => { if (state === 'initialised') ... }) instead.\",\n );\n return onSdkMessage(experience, ({ action }) => {\n if (action === Action.OnExperienceInitialised) {\n callback();\n }\n });\n}\n\n/**\n * @internal\n */\nexport const sendExperienceSizeThrottled: (\n width: number,\n height: number,\n) => void = throttle(\n (width: number, height: number) => {\n const parentApp = getParentApplication();\n\n if (parentApp !== null) {\n sendSdkMessage(parentApp, Action.OnResize, { width, height });\n }\n },\n RESIZE_THROTTLE_TIMEOUT,\n {\n leading: true,\n trailing: true,\n },\n);\n\n/**\n * Sends the Experience size to the parent page.\n *\n * @param width - The width of the Experience.\n * @param height - The height of the Experience.\n */\nexport function sendExperienceSize(width: number, height: number) {\n sendExperienceSizeThrottled(width, height);\n}\n\n/**\n * Sets up an observer to watch for the element dimensions change and\n * automatically reports their changes to the parent application.\n *\n * @param element - HTML element whose dimensions need to be watched\n * @returns The unsubscribe function. When it's called,\n * the observer will be removed and element dimensions are no longer tracked\n */\nexport function reportExperienceSizeChanges(element: HTMLElement): () => void {\n const observer = new ResizeObserver(() => {\n const width = Math.max(element.offsetWidth, element.scrollWidth);\n const height = Math.max(element.offsetHeight, element.scrollHeight);\n\n sendExperienceSize(width, height);\n });\n\n observer.observe(element);\n\n return () => observer.unobserve(element);\n}\n","/**\n * @license\n * share.ts\n * launcher-kit\n *\n * Copyright © 2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { Unsubscribe, createError, getErrorMessage } from '@monterosa/sdk-util';\n\nimport { Experience } from './types';\n\nimport { getParentApplication } from './parent_application';\n\nimport {\n sendSdkRequest,\n respondToSdkMessage,\n onSdkMessage,\n Action,\n} from './utils/bridge';\n\nimport { onStateChanged } from './state';\n\n/**\n * Share requests block on the native share tray which waits for user\n * interaction (composing a message, picking a target app, etc.). The default\n * bridge timeout of 20 seconds is too short for this. 5 minutes gives users\n * ample time while still acting as a safety net against lost messages.\n */\nconst SHARE_REQUEST_TIMEOUT = 300_000;\n\nexport interface ShareData {\n url: string;\n title?: string;\n description?: string;\n imageUrl?: string;\n}\n\nexport enum ShareError {\n ParentAppError = 'parent_app_error',\n ShareFailed = 'share_failed',\n}\n\nexport const ShareErrorMessages = {\n [ShareError.ParentAppError]: (error: string) =>\n `Parent application error: ${error}`,\n [ShareError.ShareFailed]: (error: string) => `Share failed: ${error}`,\n};\n\nexport type ShareResult = 'success' | 'cancelled';\n\n/**\n * Executes share using the Web Share API.\n *\n * @internal\n */\nexport async function executeShare(data: ShareData): Promise<ShareResult> {\n try {\n await navigator.share({\n url: data.url,\n title: data.title,\n text: data.description,\n });\n return 'success';\n } catch (err) {\n if (err instanceof DOMException && err.name === 'AbortError') {\n return 'cancelled';\n }\n throw createError(\n ShareError.ShareFailed,\n ShareErrorMessages,\n getErrorMessage(err),\n );\n }\n}\n\n/**\n * Initiates a share action. When running inside a parent application,\n * the share request is sent to the parent via the communication bridge.\n * When running standalone, `navigator.share()` is called directly.\n *\n * @param data - The data to share\n */\nexport async function share(data: ShareData): Promise<void> {\n const parentApp = getParentApplication();\n\n if (parentApp !== null) {\n const response = await sendSdkRequest(\n parentApp,\n Action.OnShare,\n data,\n SHARE_REQUEST_TIMEOUT,\n );\n\n if (response.payload.error !== undefined) {\n throw createError(\n ShareError.ParentAppError,\n ShareErrorMessages,\n response.payload.error as string,\n );\n }\n\n // 'success' and 'cancelled' both resolve silently\n return;\n }\n\n await executeShare(data);\n}\n\n/**\n * Registers a callback to be called when a share request is received\n * from a child Experience.\n *\n * @param experience - The Experience instance to listen on\n * @param callback - Called with ShareData when a share request is received\n * @returns Unsubscribe function\n */\nexport function onShare(\n experience: Experience,\n callback: (data: ShareData) => void,\n): Unsubscribe {\n return onSdkMessage(experience, (message) => {\n if (message.action === Action.OnShare) {\n callback(message.payload as ShareData);\n }\n });\n}\n\nconst unsubs: Map<string, () => void> = new Map();\n\nfunction handleExperienceEmbedded(experience: Experience): void {\n const unsub = onSdkMessage(experience, async (message) => {\n if (message.action !== Action.OnShare) {\n return;\n }\n\n try {\n const parentApp = getParentApplication();\n let payload;\n\n if (parentApp !== null) {\n const response = await sendSdkRequest(\n parentApp,\n Action.OnShare,\n message.payload,\n SHARE_REQUEST_TIMEOUT,\n );\n\n payload = response.payload;\n } else {\n const result = await executeShare(message.payload as ShareData);\n\n payload = {\n result,\n message:\n result === 'success' ? 'Share successful' : 'Share cancelled',\n data: {},\n };\n }\n\n respondToSdkMessage(experience, message, payload);\n } catch (err) {\n respondToSdkMessage(experience, message, {\n error: getErrorMessage(err),\n });\n }\n });\n\n unsubs.set(experience.id, unsub);\n}\n\nfunction handleExperienceUnmounted(experience: Experience): void {\n const unsub = unsubs.get(experience.id);\n\n if (unsub) {\n unsub();\n unsubs.delete(experience.id);\n }\n}\n\nonStateChanged((experience, state) => {\n if (state === 'mounted') {\n handleExperienceEmbedded(experience);\n } else if (state === 'unmounted') {\n handleExperienceUnmounted(experience);\n }\n});\n"],"names":["Logger","Action","Source","QueryParam","BridgeError","createError","globals","getGlobal","getErrorMessage","_a","Emitter","_b","_c","_d","VERSION","generateUUID","subscribe","fetchListings","embed","unmount","delay","Sdk","getSdk","showLoader","hideLoader","LogLevel","configure","unsubs","handleExperienceEmbedded","handleExperienceUnmounted","throttle","ShareError"],"mappings":";;;;;;;;AAAA;;;;;;;AAOG;AAEI,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAE1C;;AAEG;AACI,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAE7C;;;AAGG;AACI,MAAM,cAAc,GAAG,IAAI,CAAC;AAEnC;;;;;;AAMG;AACI,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEhC,MAAM,cAAc,GAAG,GAAG;;AC/BjC;;;;;;;AAOG;AAII,MAAM,MAAM,GAAG,IAAIA,cAAM,CAAC,6BAA6B,CAAC;;ACX/D;;;;;;;AAOG;AA8HH;;;;;AAKG;AACSC,wBA8BX;AA9BD,CAAA,UAAY,MAAM,EAAA;AAChB;;;AAGG;AACH,IAA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AAC;AAC5B,aAAA,CAAC,CAAC;AACJ,SAAA;AACH,KAAC,CAAC,CAAC;IAEH,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,yBAAyB,CAAC,UAAsB,EAAA;IACvD,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AAExC,IAAA,IAAI,KAAK,EAAE;AACT,QAAA,KAAK,EAAE,CAAC;AACR,QAAA,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AAC9B,KAAA;AACH,CAAC;AAED,cAAc,CAAC,CAAC,UAAU,EAAE,KAAK,KAAI;IACnC,IAAI,KAAK,KAAK,SAAS,EAAE;QACvB,wBAAwB,CAAC,UAAU,CAAC,CAAC;AACtC,KAAA;SAAM,IAAI,KAAK,KAAK,WAAW,EAAE;QAChC,yBAAyB,CAAC,UAAU,CAAC,CAAC;AACvC,KAAA;AACH,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -56,12 +56,17 @@ const logger = new Logger('@monterosa/sdk-launcher-kit');
|
|
|
56
56
|
*/
|
|
57
57
|
var Action;
|
|
58
58
|
(function (Action) {
|
|
59
|
+
/**
|
|
60
|
+
* Notifies that the communication bridge transport is ready.
|
|
61
|
+
* Auto-sent when the child bridge is created — no developer action needed.
|
|
62
|
+
*/
|
|
63
|
+
Action["OnBridgeInitialised"] = "onBridgeInitialised";
|
|
59
64
|
/**
|
|
60
65
|
* Notifies that the Experience has initialised and is ready to receive messages.
|
|
61
|
-
*
|
|
66
|
+
* Sent explicitly by the developer via `sendInitialised()`.
|
|
62
67
|
* This triggers the `initialised` lifecycle state.
|
|
63
68
|
*/
|
|
64
|
-
Action["
|
|
69
|
+
Action["OnExperienceInitialised"] = "onExperienceInitialised";
|
|
65
70
|
/**
|
|
66
71
|
* Notifies that UI of child Experience is loaded and ready to be visible.
|
|
67
72
|
* When this action is fired the loader will be hidden and
|
|
@@ -363,14 +368,15 @@ class BridgeImpl extends Emitter {
|
|
|
363
368
|
return;
|
|
364
369
|
}
|
|
365
370
|
logger.log(`Received a ${respondingTo === null ? 'message' : 'response'}`, message);
|
|
366
|
-
if (action === Action.
|
|
371
|
+
if (action === Action.OnBridgeInitialised) {
|
|
367
372
|
this.recipientInitialised = true;
|
|
368
373
|
if (respondingTo === null) {
|
|
369
|
-
this.send(Action.
|
|
374
|
+
this.send(Action.OnBridgeInitialised, {}, Source.Sdk, id);
|
|
370
375
|
}
|
|
371
376
|
while (this.messagesQueue.length > 0) {
|
|
372
377
|
this.postMessage(this.messagesQueue.shift());
|
|
373
378
|
}
|
|
379
|
+
return;
|
|
374
380
|
}
|
|
375
381
|
this.emit('message', message);
|
|
376
382
|
}
|
|
@@ -388,7 +394,8 @@ class BridgeImpl extends Emitter {
|
|
|
388
394
|
}
|
|
389
395
|
postMessage(message) {
|
|
390
396
|
var _a, _b, _c, _d;
|
|
391
|
-
if (!this.recipientInitialised &&
|
|
397
|
+
if (!this.recipientInitialised &&
|
|
398
|
+
message.action !== Action.OnBridgeInitialised) {
|
|
392
399
|
this.messagesQueue.push(message);
|
|
393
400
|
return;
|
|
394
401
|
}
|
|
@@ -515,6 +522,7 @@ function getParentBridge() {
|
|
|
515
522
|
return null;
|
|
516
523
|
}
|
|
517
524
|
parentBridge = new BridgeImpl(bridgeId);
|
|
525
|
+
parentBridge.send(Action.OnBridgeInitialised, {}, Source.Sdk);
|
|
518
526
|
return parentBridge;
|
|
519
527
|
}
|
|
520
528
|
/**
|
|
@@ -1064,7 +1072,7 @@ function unstashStyles(element) {
|
|
|
1064
1072
|
element.removeAttribute('data-stash');
|
|
1065
1073
|
}
|
|
1066
1074
|
|
|
1067
|
-
var version = "2.0.0-rc.
|
|
1075
|
+
var version = "2.0.0-rc.4";
|
|
1068
1076
|
|
|
1069
1077
|
/**
|
|
1070
1078
|
* @license
|
|
@@ -1255,7 +1263,7 @@ async function embed(experience, containerOrId) {
|
|
|
1255
1263
|
container.appendChild(iframe);
|
|
1256
1264
|
concealIFrame(iframe);
|
|
1257
1265
|
updateExperienceState(experience, 'mounted');
|
|
1258
|
-
await waitForAction(experience, Action.
|
|
1266
|
+
await waitForAction(experience, Action.OnExperienceInitialised);
|
|
1259
1267
|
if (controller.signal.aborted) {
|
|
1260
1268
|
return;
|
|
1261
1269
|
}
|
|
@@ -1448,7 +1456,7 @@ class MonterosaExperienceElement extends HTMLElement {
|
|
|
1448
1456
|
// eslint-disable-next-line
|
|
1449
1457
|
onSdkMessage(experience, ({ payload, action }) => {
|
|
1450
1458
|
switch (action) {
|
|
1451
|
-
case Action.
|
|
1459
|
+
case Action.OnExperienceInitialised:
|
|
1452
1460
|
break;
|
|
1453
1461
|
case Action.OnResize: {
|
|
1454
1462
|
// const { width, height } = payload;
|
|
@@ -1636,7 +1644,7 @@ function sendInitialised() {
|
|
|
1636
1644
|
console.log('Unable to send initialised message, as there is no parent application');
|
|
1637
1645
|
return;
|
|
1638
1646
|
}
|
|
1639
|
-
|
|
1647
|
+
sendSdkMessage(parentApp, Action.OnExperienceInitialised);
|
|
1640
1648
|
}
|
|
1641
1649
|
/**
|
|
1642
1650
|
* Notifies the parent application that the Experience UI is fully loaded
|
|
@@ -1718,7 +1726,7 @@ function onReady(experience, callback) {
|
|
|
1718
1726
|
console.warn('[launcher-kit] onReady() is deprecated. Use onStateChanged(' +
|
|
1719
1727
|
"experience, (state) => { if (state === 'initialised') ... }) instead.");
|
|
1720
1728
|
return onSdkMessage(experience, ({ action }) => {
|
|
1721
|
-
if (action === Action.
|
|
1729
|
+
if (action === Action.OnExperienceInitialised) {
|
|
1722
1730
|
callback();
|
|
1723
1731
|
}
|
|
1724
1732
|
});
|
|
@@ -1819,8 +1827,8 @@ async function share(data) {
|
|
|
1819
1827
|
const parentApp = getParentApplication();
|
|
1820
1828
|
if (parentApp !== null) {
|
|
1821
1829
|
const response = await sendSdkRequest(parentApp, Action.OnShare, data, SHARE_REQUEST_TIMEOUT);
|
|
1822
|
-
if (response.payload.
|
|
1823
|
-
throw createError(ShareError.ParentAppError, ShareErrorMessages, response.payload.
|
|
1830
|
+
if (response.payload.error !== undefined) {
|
|
1831
|
+
throw createError(ShareError.ParentAppError, ShareErrorMessages, response.payload.error);
|
|
1824
1832
|
}
|
|
1825
1833
|
// 'success' and 'cancelled' both resolve silently
|
|
1826
1834
|
return;
|
|
@@ -1867,9 +1875,7 @@ function handleExperienceEmbedded(experience) {
|
|
|
1867
1875
|
}
|
|
1868
1876
|
catch (err) {
|
|
1869
1877
|
respondToSdkMessage(experience, message, {
|
|
1870
|
-
|
|
1871
|
-
message: getErrorMessage(err),
|
|
1872
|
-
data: {},
|
|
1878
|
+
error: getErrorMessage(err),
|
|
1873
1879
|
});
|
|
1874
1880
|
}
|
|
1875
1881
|
});
|