@ada-cx/messaging-sdk 1.11.7 → 1.11.9
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/client/client-host-runtime.d.ts +1 -0
- package/dist/client/client-types.d.ts +17 -0
- package/dist/client/client.d.ts +26 -3
- package/dist/client/config-helpers.d.ts +7 -0
- package/dist/client/embed-interface.d.ts +3 -3
- package/dist/client/frame-titles.d.ts +0 -1
- package/dist/embed-host/registry.d.ts +4 -0
- package/dist/frame-channel/types.d.ts +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/npm/index.cjs +1 -1
- package/dist/npm/index.cjs.map +1 -1
- package/dist/npm/index.d.cts +2 -2
- package/dist/npm/index.d.ts +1 -1
- package/dist/npm/index.js +1 -1
- package/dist/npm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -48,6 +48,15 @@ export interface AdaMessagingSettings {
|
|
|
48
48
|
* precedence over a saved language choice. Omit to restore a saved choice.
|
|
49
49
|
*/
|
|
50
50
|
language?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Regional language tag for the chat text, such as `"fr-CA"`. The widget
|
|
53
|
+
* declares it as `lang` only while the chat language is the same language,
|
|
54
|
+
* so `"fr-CA"` applies to French and is ignored for English. A screen reader
|
|
55
|
+
* uses it to pick a regional voice, and reads the text in its default voice
|
|
56
|
+
* for the language when no regional voice is installed. A value that is not
|
|
57
|
+
* a language tag of 35 characters or fewer is ignored with a warning.
|
|
58
|
+
*/
|
|
59
|
+
locale?: string;
|
|
51
60
|
/** Answer response id to trigger as the initial greeting (legacy CDN parity). */
|
|
52
61
|
greeting?: string;
|
|
53
62
|
/** When true, skip automatic greetings for this page load, including resets and core reloads, while allowing explicit answers. */
|
|
@@ -244,6 +253,14 @@ export interface TriggerPlaybookOptions {
|
|
|
244
253
|
metaFields?: Record<string, unknown>;
|
|
245
254
|
sensitiveMetaFields?: Record<string, unknown>;
|
|
246
255
|
}
|
|
256
|
+
/** Options for setLanguage(). */
|
|
257
|
+
export interface SetLanguageOptions {
|
|
258
|
+
/**
|
|
259
|
+
* Regional language tag for the chat text, such as `"fr-CA"`. Replaces the
|
|
260
|
+
* `locale` setting. Omit it to keep the current one.
|
|
261
|
+
*/
|
|
262
|
+
locale?: string;
|
|
263
|
+
}
|
|
247
264
|
/** Result returned by sendMessage() once Messaging accepts the user message. */
|
|
248
265
|
export interface SendMessageResult {
|
|
249
266
|
id: string;
|
package/dist/client/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AdaMessagingClientConfig, AdaMessagingStartOptions, AdaSdkEventCallback, ConversationInfo, Delegate, MetaFieldValue, PublicMessage, ResetParams, SendMessageResult, TriggerPlaybookOptions, WindowInfo } from "./client-types.js";
|
|
1
|
+
import type { AdaMessagingClientConfig, AdaMessagingStartOptions, AdaSdkEventCallback, ConversationInfo, Delegate, MetaFieldValue, PublicMessage, ResetParams, SendMessageResult, SetLanguageOptions, TriggerPlaybookOptions, WindowInfo } from "./client-types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Ada Messaging Client — thin coordinator
|
|
4
4
|
*
|
|
@@ -188,6 +188,7 @@ declare class AdaMessagingClient {
|
|
|
188
188
|
private _chatFallbackArmedAt;
|
|
189
189
|
private _chatFallbackElapsedBeforeWait;
|
|
190
190
|
private _coreFrameReloadTimer;
|
|
191
|
+
private _coreReloadListener;
|
|
191
192
|
private _chatHideTimer;
|
|
192
193
|
private _chatViewportCleanup;
|
|
193
194
|
private _pageScrollLocked;
|
|
@@ -217,6 +218,7 @@ declare class AdaMessagingClient {
|
|
|
217
218
|
* restore the existing chatter, then sync the supplied fields and reactivate.
|
|
218
219
|
*/
|
|
219
220
|
private _historyPreservingResetAfterCoreReload;
|
|
221
|
+
private _holdResetForStartup;
|
|
220
222
|
private _pendingClearAckRequestId;
|
|
221
223
|
private _pendingClearAckResponseType;
|
|
222
224
|
private _pendingClearPersistenceScope;
|
|
@@ -440,11 +442,12 @@ declare class AdaMessagingClient {
|
|
|
440
442
|
* Set the display language for the chat interface.
|
|
441
443
|
*
|
|
442
444
|
* @param language - A BCP-47 language tag (e.g. `"en"`, `"fr"`, `"es-MX"`).
|
|
445
|
+
* @param options - `locale` replaces the regional language tag, such as `"fr-CA"`.
|
|
443
446
|
*
|
|
444
447
|
* @example
|
|
445
|
-
* window.adaEmbed.setLanguage("fr");
|
|
448
|
+
* window.adaEmbed.setLanguage("fr", { locale: "fr-CA" });
|
|
446
449
|
*/
|
|
447
|
-
setLanguage(language: string): void;
|
|
450
|
+
setLanguage(language: string, options?: SetLanguageOptions): void;
|
|
448
451
|
/**
|
|
449
452
|
* Change the chat widget's color scheme at runtime.
|
|
450
453
|
* Takes effect immediately without reset or reload.
|
|
@@ -857,8 +860,22 @@ declare class AdaMessagingClient {
|
|
|
857
860
|
/** Re-arm only the inactivity fallback; the public diagnostic remains one-shot. */
|
|
858
861
|
private _rearmChatFallbackTimeout;
|
|
859
862
|
private _maybeShowChatTimeoutFallback;
|
|
863
|
+
private _cancelCoreReload;
|
|
860
864
|
private _disconnectCoreChannel;
|
|
861
865
|
private _showChatTimeoutFallback;
|
|
866
|
+
/**
|
|
867
|
+
* A document that core reloads gets core's own URL as its referrer, so it
|
|
868
|
+
* locks the wrong parent origin and drops sdk.config.set. Navigate the frame
|
|
869
|
+
* from the host page again to give the new document the host origin.
|
|
870
|
+
*/
|
|
871
|
+
private _resetActivationTracking;
|
|
872
|
+
private _replaceReloadedCore;
|
|
873
|
+
/**
|
|
874
|
+
* Queue the soft reset that a replacement core uses to restore one exact
|
|
875
|
+
* chatter. It keeps the identity storage scope, and it never creates a new
|
|
876
|
+
* chatter, also when the SDK resumed the session without engagement.
|
|
877
|
+
*/
|
|
878
|
+
private _queueExactRestore;
|
|
862
879
|
private _reloadCoreFrame;
|
|
863
880
|
private _invalidateStartupConfigForCoreReplacement;
|
|
864
881
|
private _prepareSessionForChannel;
|
|
@@ -880,6 +897,12 @@ declare class AdaMessagingClient {
|
|
|
880
897
|
private _applyResetOverridesToConfig;
|
|
881
898
|
private _sendPendingHistoryPreservingReset;
|
|
882
899
|
private _markCoreProtocolReady;
|
|
900
|
+
/**
|
|
901
|
+
* In a core document that the SDK loads again, a soft reset waits until
|
|
902
|
+
* core's public startup settles. Core aborts the in-flight startup fetch
|
|
903
|
+
* when the reset arrives, and the exact restore then fails.
|
|
904
|
+
*/
|
|
905
|
+
private _holdsForReset;
|
|
883
906
|
/**
|
|
884
907
|
* Freeze the host's declared metaFields as the immutable opt-out reset baseline.
|
|
885
908
|
* Called from the constructor and from start() when the host explicitly supplies
|
|
@@ -20,6 +20,13 @@ export declare function normalizeCrossWindowPersistence(value: unknown): boolean
|
|
|
20
20
|
* promise a console warning here without a debug opt-in.
|
|
21
21
|
*/
|
|
22
22
|
export declare function normalizeAppUrlOverride(value: unknown): string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Read a host `locale`, warning when a supplied value is dropped. Core
|
|
25
|
+
* re-validates it, because a host page can post to the core frame directly.
|
|
26
|
+
*
|
|
27
|
+
* @param source - The setting or action the value came from, named in the warning.
|
|
28
|
+
*/
|
|
29
|
+
export declare function normalizeHostLocale(value: unknown, source?: string): string | undefined;
|
|
23
30
|
/**
|
|
24
31
|
* The `allow` extension the core frame needs for a loopback `appUrl`, or
|
|
25
32
|
* `undefined` for every other configuration. Chromium 142+ requires the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AdaMessagingStartOptions, AdaSdkEventCallback, ConversationInfo, Delegate, MetaFieldValue, PublicMessage, ResetParams, SendMessageResult, TriggerPlaybookOptions, WindowInfo } from "./client-types.js";
|
|
1
|
+
import type { AdaMessagingStartOptions, AdaSdkEventCallback, ConversationInfo, Delegate, MetaFieldValue, PublicMessage, ResetParams, SendMessageResult, SetLanguageOptions, TriggerPlaybookOptions, WindowInfo } from "./client-types.js";
|
|
2
2
|
/** One queued call captured by the embed loader before the SDK was ready. */
|
|
3
3
|
export interface LoaderQueueAction {
|
|
4
4
|
method: string;
|
|
@@ -97,8 +97,8 @@ export interface AdaEmbedInterface {
|
|
|
97
97
|
open: () => Promise<void>;
|
|
98
98
|
/** Close the chat drawer. */
|
|
99
99
|
close: () => Promise<void>;
|
|
100
|
-
/** Switch the conversation language (e.g. "en", "fr"). */
|
|
101
|
-
setLanguage: (language: string) => Promise<void>;
|
|
100
|
+
/** Switch the conversation language (e.g. "en", "fr"), with an optional regional `locale` such as "fr-CA". */
|
|
101
|
+
setLanguage: (language: string, options?: SetLanguageOptions) => Promise<void>;
|
|
102
102
|
/** Set the color scheme; "auto" follows the OS preference. */
|
|
103
103
|
setTheme: (theme: "light" | "dark" | "auto") => Promise<void>;
|
|
104
104
|
/** Register a push-notification device token for this chatter. */
|
|
@@ -55,6 +55,7 @@ export declare const CONFIG_CLASSIFICATION: {
|
|
|
55
55
|
readonly onAdaEmbedLoaded: "embed_owned";
|
|
56
56
|
readonly deviceToken: "passthrough";
|
|
57
57
|
readonly language: "passthrough";
|
|
58
|
+
readonly locale: "passthrough";
|
|
58
59
|
readonly greeting: "passthrough";
|
|
59
60
|
readonly skipGreeting: "passthrough";
|
|
60
61
|
readonly identityToken: "passthrough";
|
|
@@ -94,6 +95,7 @@ export declare const FLOATING_CONFIG_CLASSIFICATION: {
|
|
|
94
95
|
readonly onAdaEmbedLoaded: "embed_owned";
|
|
95
96
|
readonly deviceToken: "passthrough";
|
|
96
97
|
readonly language: "passthrough";
|
|
98
|
+
readonly locale: "passthrough";
|
|
97
99
|
readonly greeting: "passthrough";
|
|
98
100
|
readonly skipGreeting: "passthrough";
|
|
99
101
|
readonly identityToken: "passthrough";
|
|
@@ -134,6 +136,7 @@ export declare const CONFIG_CLASSIFICATION_BY_MODE: {
|
|
|
134
136
|
readonly onAdaEmbedLoaded: "embed_owned";
|
|
135
137
|
readonly deviceToken: "passthrough";
|
|
136
138
|
readonly language: "passthrough";
|
|
139
|
+
readonly locale: "passthrough";
|
|
137
140
|
readonly greeting: "passthrough";
|
|
138
141
|
readonly skipGreeting: "passthrough";
|
|
139
142
|
readonly identityToken: "passthrough";
|
|
@@ -173,6 +176,7 @@ export declare const CONFIG_CLASSIFICATION_BY_MODE: {
|
|
|
173
176
|
readonly onAdaEmbedLoaded: "embed_owned";
|
|
174
177
|
readonly deviceToken: "passthrough";
|
|
175
178
|
readonly language: "passthrough";
|
|
179
|
+
readonly locale: "passthrough";
|
|
176
180
|
readonly greeting: "passthrough";
|
|
177
181
|
readonly skipGreeting: "passthrough";
|
|
178
182
|
readonly identityToken: "passthrough";
|
|
@@ -167,6 +167,8 @@ export interface SdkToFrameEvents {
|
|
|
167
167
|
handle: string;
|
|
168
168
|
cluster?: string | null;
|
|
169
169
|
language?: string;
|
|
170
|
+
/** Host regional language tag, such as `fr-CA`; core re-validates it. */
|
|
171
|
+
locale?: string;
|
|
170
172
|
greeting?: string;
|
|
171
173
|
/** Legacy adaSettings.greeting Answer id, higher priority than an Intro. */
|
|
172
174
|
configuredGreetingResponseId?: string;
|
|
@@ -380,6 +382,7 @@ export interface SdkToFrameEvents {
|
|
|
380
382
|
/** Set the display language (SDK → core) */
|
|
381
383
|
"sdk.language.set": {
|
|
382
384
|
language: string;
|
|
385
|
+
locale?: string;
|
|
383
386
|
};
|
|
384
387
|
/** Update metafield key/value pairs (SDK → core) */
|
|
385
388
|
"sdk.metaFields.set": {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { AdaMessagingClient } from "./client/client.js";
|
|
2
|
-
export type { AdaMessagingBranding, AdaMessagingBrandingLauncher, AdaMessagingClientConfig, AdaMessagingLocalizedText, AdaMessagingSettings, AdaMessagingStartOptions, AdaReadyCallbackParams, AdaSdkEventCallback, AdaSdkEventContext, AdaSdkEventKey, BeforeSend, ConversationInfo, Delegate, MetaFieldValue, PublicAgentInfo, PublicMessage, ResetParams, SendMessageResult, TriggerPlaybookOptions, WindowInfo, } from "./client/client-types.js";
|
|
2
|
+
export type { AdaMessagingBranding, AdaMessagingBrandingLauncher, AdaMessagingClientConfig, AdaMessagingLocalizedText, AdaMessagingSettings, AdaMessagingStartOptions, AdaReadyCallbackParams, AdaSdkEventCallback, AdaSdkEventContext, AdaSdkEventKey, BeforeSend, ConversationInfo, Delegate, MetaFieldValue, PublicAgentInfo, PublicMessage, ResetParams, SendMessageResult, SetLanguageOptions, TriggerPlaybookOptions, WindowInfo, } from "./client/client-types.js";
|
|
3
3
|
export { type ChatHtmlConfig, resolveChatHtmlConfig, } from "./client/config-helpers.js";
|
|
4
4
|
export type { AdaEmbedInterface, LoaderQueueAction, LoaderQueueActionOutcome, LoaderQueueActionOutcomeHandler, } from "./client/embed-interface.js";
|
|
5
5
|
export { createAdaEmbedInterface, dispatchEmbedLoaderInitialActionQueue, dispatchEmbedLoaderInitialActionQueueForAtomicHandoff, } from "./client/embed-interface.js";
|
package/dist/npm/index.cjs
CHANGED
|
@@ -69,7 +69,7 @@ var UNSTAMPED_SHA_PATTERN = /^0{40}$/;
|
|
|
69
69
|
* unstamped 40-zero placeholder ({@link isCdnBuildShaStamped} returns
|
|
70
70
|
* `false`); only published tarballs carry a real SHA.
|
|
71
71
|
*/
|
|
72
|
-
var CDN_BUILD_SHA = "
|
|
72
|
+
var CDN_BUILD_SHA = "e39b6d29bec746347832ec710147ac2c6a6d4450";
|
|
73
73
|
/**
|
|
74
74
|
* Whether `sha` (default {@link CDN_BUILD_SHA}) is a stamped full git commit
|
|
75
75
|
* SHA rather than the unstamped repo placeholder.
|
package/dist/npm/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../shared/utils/src/browser-polyfills.ts","../../src/npm/build-info.ts","../../src/client/embed-lifecycle.ts","../../src/npm/loader.ts"],"sourcesContent":["/**\n * Defence in depth for engines just below the declared browser floor.\n * The floor is defined in `messaging/vite.browser-targets.mjs`.\n *\n * Internal Ada code should prefer direct helpers, such as `hasOwn(...)` from\n * `guards.ts`. Every Ada bundle includes these fallbacks, including the host-page\n * SDK. These fallbacks also ship inside the customer-held npm tarballs of the SDK\n * and bridge. Each fallback defines a member only when it is missing. These\n * fallbacks do not extend browser support below the floor required by the shipped CSS.\n */\n\nconst objectHasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction defineValue(\n\ttarget: object,\n\tname: PropertyKey,\n\tvalue: (...args: unknown[]) => unknown,\n): void {\n\tObject.defineProperty(target, name, {\n\t\tvalue,\n\t\tconfigurable: true,\n\t\twritable: true,\n\t});\n}\n\nif (!Object.hasOwn) {\n\tdefineValue(Object, \"hasOwn\", (object: unknown, key: unknown) => {\n\t\tif (object == null) {\n\t\t\tthrow new TypeError(\n\t\t\t\t\"ada browser-polyfills: Cannot convert undefined or null to object\",\n\t\t\t);\n\t\t}\n\t\treturn objectHasOwnProperty.call(Object(object), key as PropertyKey);\n\t});\n}\n\nfunction at<T>(\n\tthis: { length: number; [index: number]: T },\n\tindex: unknown,\n): T | undefined {\n\tconst length = Math.trunc(Number(this.length)) || 0;\n\tlet relativeIndex = Math.trunc(Number(index)) || 0;\n\tif (relativeIndex < 0) {\n\t\trelativeIndex += length;\n\t}\n\treturn relativeIndex < 0 || relativeIndex >= length\n\t\t? undefined\n\t\t: this[relativeIndex];\n}\n\nfunction stringAt(this: string, index: unknown): string | undefined {\n\tconst value = String(this);\n\tconst length = value.length;\n\tlet relativeIndex = Math.trunc(Number(index)) || 0;\n\tif (relativeIndex < 0) {\n\t\trelativeIndex += length;\n\t}\n\treturn relativeIndex < 0 || relativeIndex >= length\n\t\t? undefined\n\t\t: value.charAt(relativeIndex);\n}\n\nconst typedArrayConstructors = [\n\tglobalThis.Int8Array,\n\tglobalThis.Uint8Array,\n\tglobalThis.Uint8ClampedArray,\n\tglobalThis.Int16Array,\n\tglobalThis.Uint16Array,\n\tglobalThis.Int32Array,\n\tglobalThis.Uint32Array,\n\tglobalThis.Float32Array,\n\tglobalThis.Float64Array,\n\tglobalThis.BigInt64Array,\n\tglobalThis.BigUint64Array,\n].filter(Boolean);\n\nif (!Array.prototype.at) {\n\tdefineValue(Array.prototype, \"at\", at);\n}\n\nif (!String.prototype.at) {\n\tdefineValue(String.prototype, \"at\", stringAt);\n}\n\nfor (const TypedArrayConstructor of typedArrayConstructors) {\n\tconst prototype = TypedArrayConstructor.prototype;\n\tif (!prototype.at) {\n\t\tdefineValue(prototype, \"at\", at);\n\t}\n}\n","// The repo copy carries the 40-zero placeholder; the publish workflow\n// (.github/workflows/messaging-publish-web-packages.yml) stamps the real\n// commit SHA into the built output via scripts/stamp-cdn-build-sha.mjs and\n// verifies the packed tarball before `npm publish`. Keep the placeholder as\n// a single 40-zero string literal: the stamp is a same-length text\n// replacement, so source maps stay valid.\nconst GIT_SHA_PATTERN = /^[0-9a-f]{40}$/;\nconst UNSTAMPED_SHA_PATTERN = /^0{40}$/;\n\n/**\n * Git commit SHA of the monorepo commit this npm version was published from.\n * The CDN pipeline deploys each main commit's runtime under an immutable\n * SHA root, so this value names the CDN build associated with this npm\n * version. Pass it as the `pinBuildSha` loader option to load exactly that\n * runtime build — not recommended for production (see the README).\n *\n * In the repository, and in any locally built copy, the value is the\n * unstamped 40-zero placeholder ({@link isCdnBuildShaStamped} returns\n * `false`); only published tarballs carry a real SHA.\n */\nexport const CDN_BUILD_SHA: string = \"8046d6981dd5321ddc7fedef8280e3ffff72b981\";\n\n/**\n * Whether `sha` (default {@link CDN_BUILD_SHA}) is a stamped full git commit\n * SHA rather than the unstamped repo placeholder.\n */\nexport function isCdnBuildShaStamped(sha: string = CDN_BUILD_SHA): boolean {\n\tconst normalized = sha.trim().toLowerCase();\n\treturn (\n\t\tGIT_SHA_PATTERN.test(normalized) && !UNSTAMPED_SHA_PATTERN.test(normalized)\n\t);\n}\n","/**\n * Lifecycle channel between `createAdaEmbedInterface` and the npm loader's\n * memo: a non-enumerable getter over closure state, so the loader never\n * mutates the public surface and `Object.freeze` on the facade still works.\n * `Symbol.for` because the loader and the CDN runtime are separate builds;\n * a runtime that predates the getter yields `undefined` — degrade gracefully.\n */\nexport const EMBED_LIFECYCLE_STOPPED = Symbol.for(\n\t\"ada-cx/messaging-sdk/embed-stopped\",\n);\n\n/** Read the host-initiated stop flag; `undefined` when the runtime predates it. */\nexport function readEmbedStoppedFlag(ada: object): boolean | undefined {\n\tconst value = (ada as Record<symbol, unknown>)[EMBED_LIFECYCLE_STOPPED];\n\treturn typeof value === \"boolean\" ? value : undefined;\n}\n\n/** Define the getter at facade creation time, before any host freeze. */\nexport function defineEmbedStoppedFlag(\n\tada: object,\n\treadStopped: () => boolean,\n): void {\n\tObject.defineProperty(ada, EMBED_LIFECYCLE_STOPPED, {\n\t\tget: readStopped,\n\t\tenumerable: false,\n\t\tconfigurable: false,\n\t});\n}\n","import type { AdaMessagingClient } from \"../client/client\";\nimport type { AdaMessagingStartOptions } from \"../client/client-types\";\nimport type {\n\tAdaEmbedInterface,\n\tcreateAdaEmbedInterface,\n\tdispatchEmbedLoaderInitialActionQueue,\n\tdispatchEmbedLoaderInitialActionQueueForAtomicHandoff,\n} from \"../client/embed-interface\";\nimport { readEmbedStoppedFlag } from \"../client/embed-lifecycle\";\nimport type {\n\tmountAdaWebViewRuntime,\n\tresolveAdaWebViewRuntimeAssets,\n} from \"../mobile-webview-runtime\";\n\n/**\n * Production CDN root the loader resolves the SDK bootstrap from when no\n * `cdnBase` override is given. The npm package never pins a runtime version;\n * the bootstrap at this root resolves the current rollout at load time.\n */\nexport const DEFAULT_MESSAGING_CDN_BASE =\n\t\"https://messaging-assets.ada.support/\";\n\nexport const FALLBACK_MESSAGING_CDN_BASE =\n\t\"https://static.ada.support/messaging/\";\n\nconst SDK_BOOTSTRAP_FILENAME = \"sdk.js\";\n\n// The CDN pipeline deploys each main commit's runtime as an immutable\n// SHA-rooted entry (`<cdnBase>/<sha>/sdk/index.js`); the mutable `sdk.js`\n// bootstrap resolves the current rollout to one of those roots at load time.\n// A pin bypasses the bootstrap and imports one root directly.\nconst PINNED_SDK_ENTRY_PATH = \"sdk/index.js\";\n\n// Strict on purpose: the pin is interpolated into a CDN path, so only a full\n// lowercase 40-hex git SHA may pass (mirrors scripts/sdk.js's\n// VERSION_OVERRIDE_PATTERN security boundary, minus the short-SHA and pr-N\n// forms — the npm surface pins exactly what CDN_BUILD_SHA carries).\nconst PINNED_BUILD_SHA_PATTERN = /^[0-9a-f]{40}$/;\nconst UNSTAMPED_BUILD_SHA_PATTERN = /^0{40}$/;\n\n/** Why a {@link MessagingSdkLoadError} was raised. */\nexport type MessagingSdkLoadErrorCode =\n\t/**\n\t * The `cdnBase` option is not a valid `https:` URL (plain `http:` is\n\t * allowed only for loopback hosts).\n\t */\n\t| \"invalid_cdn_base\"\n\t/** The `pinBuildSha` option is not a full 40-character hex git SHA. */\n\t| \"invalid_build_sha\"\n\t/**\n\t * The `pinBuildSha` option is the unstamped 40-zero placeholder: this\n\t * copy of the package was built from the repository, not published, so\n\t * its `CDN_BUILD_SHA` names no CDN build.\n\t */\n\t| \"unstamped_build_sha\"\n\t/** The dynamic import of the CDN bootstrap failed (fetch or evaluation). */\n\t| \"sdk_import_failed\"\n\t/** The imported module does not expose the Ada Messaging SDK surface. */\n\t| \"sdk_module_invalid\";\n\n/** Typed failure raised by {@link loadMessagingSdk} and {@link loadAdaMessaging}. */\nexport class MessagingSdkLoadError extends Error {\n\treadonly code: MessagingSdkLoadErrorCode;\n\tdeclare readonly fallbackCause?: MessagingSdkLoadError;\n\n\tconstructor(\n\t\tmessage: string,\n\t\tcode: MessagingSdkLoadErrorCode,\n\t\tcause?: unknown,\n\t\tfallbackCause?: MessagingSdkLoadError,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"MessagingSdkLoadError\";\n\t\tthis.code = code;\n\t\tif (cause !== undefined) {\n\t\t\tthis.cause = cause;\n\t\t}\n\t\tif (fallbackCause !== undefined) {\n\t\t\tObject.defineProperty(this, \"fallbackCause\", {\n\t\t\t\tvalue: fallbackCause,\n\t\t\t\tenumerable: true,\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * The programmatic messaging interface {@link loadAdaMessaging} resolves. An\n * alias of the runtime's `AdaEmbedInterface`, which keeps that name because it\n * is also the legacy `window.adaEmbed` compat facade.\n * Includes `selectQuickReply(messageId, index)` for Web SDK integrations.\n */\nexport type AdaMessagingInterface = AdaEmbedInterface;\n\n/**\n * The public surface of the CDN-resolved SDK module, as loaded from\n * `<cdnBase>/sdk.js`. Types only — the implementation always comes from the\n * CDN at load time and is never part of this npm package.\n */\nexport interface MessagingSdkModule {\n\tAdaMessagingClient: typeof AdaMessagingClient;\n\tcreateAdaEmbedInterface: typeof createAdaEmbedInterface;\n\tdispatchEmbedLoaderInitialActionQueue: typeof dispatchEmbedLoaderInitialActionQueue;\n\tdispatchEmbedLoaderInitialActionQueueForAtomicHandoff: typeof dispatchEmbedLoaderInitialActionQueueForAtomicHandoff;\n\tmountAdaWebViewRuntime: typeof mountAdaWebViewRuntime;\n\tresolveAdaWebViewRuntimeAssets: typeof resolveAdaWebViewRuntimeAssets;\n}\n\ntype ImportSdkModule = (url: string) => Promise<unknown>;\n\nexport interface LoadMessagingSdkOptions {\n\t/**\n\t * CDN root to resolve `sdk.js` from. Must be an `https:` URL; plain\n\t * `http:` is accepted only for loopback hosts (`localhost`, `127.0.0.1`,\n\t * `[::1]`, `*.localhost`) during local development. Defaults to the\n\t * production root ({@link DEFAULT_MESSAGING_CDN_BASE}). An explicit value,\n\t * including {@link FALLBACK_MESSAGING_CDN_BASE}, disables the automatic\n\t * static-root fallback.\n\t */\n\tcdnBase?: string;\n\t/**\n\t * Full 40-character git commit SHA of a deployed CDN build. When set, the\n\t * loader skips the rollout bootstrap and imports that build's immutable\n\t * entry (`<cdnBase>/<sha>/sdk/index.js`) directly. Pass the package's\n\t * `CDN_BUILD_SHA` export to pin the build associated with this npm\n\t * version. NOT recommended for production: a pinned runtime misses Ada's\n\t * fixes and rollouts, and may predate server contract changes. Composes\n\t * with `cdnBase` for staged validation.\n\t */\n\tpinBuildSha?: string;\n\t/**\n\t * Import seam for unit tests. Defaults to a native dynamic `import()` of\n\t * the resolved bootstrap URL.\n\t */\n\timportModule?: ImportSdkModule;\n}\n\n// Both annotations are load-bearing: bundlers rewrite bare dynamic imports,\n// and this specifier must reach the browser untouched so the runtime always\n// resolves from Ada's CDN. The npm build for this entry is unminified so the\n// annotations survive into the published output.\nconst defaultImportModule: ImportSdkModule = (url) =>\n\timport(/* webpackIgnore: true */ /* @vite-ignore */ url);\n\n// Keyed by import seam so production memoizes on the module-level default\n// while each injected test seam gets an isolated cache.\ninterface SdkLoaderState {\n\timports: Map<string, Promise<MessagingSdkModule>>;\n\tdefaultLoads: Map<string, Promise<MessagingSdkModule>>;\n}\n\nconst loadsByImporter = new WeakMap<ImportSdkModule, SdkLoaderState>();\n\n// Share the warning across independently bundled copies of this loader.\nconst FALLBACK_WARNING_KEY = Symbol.for(\"ada.messaging.sdk.fallbackWarning\");\nconst warningScope = globalThis as typeof globalThis & {\n\t[FALLBACK_WARNING_KEY]?: boolean;\n};\n\n// Mirrors the loopback semantics of the shared `isLoopbackHost` /\n// `validateMessagingEndpoint` (shared/utils/src/url.ts) and the bridge\n// loader's copy (packages/bridge/src/npm/loader.ts). Inlined because the\n// published loader must stay dependency-free; keep the host set in sync.\nconst LOOPBACK_HOSTS = new Set([\"localhost\", \"127.0.0.1\", \"[::1]\", \"::1\"]);\n\nfunction isLoopbackHostname(hostname: string): boolean {\n\tconst normalized = hostname.trim().toLowerCase();\n\t// `*.localhost` resolves to the loopback interface and is \"potentially\n\t// trustworthy\" per the Secure Contexts spec; no production host ends in\n\t// `.localhost`.\n\treturn LOOPBACK_HOSTS.has(normalized) || normalized.endsWith(\".localhost\");\n}\n\nfunction resolvePinnedBuildSha(pinBuildSha: string): string {\n\tconst sha = pinBuildSha.trim().toLowerCase();\n\tif (!PINNED_BUILD_SHA_PATTERN.test(sha)) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The pinBuildSha option must be a full 40-character hex git SHA: \"${pinBuildSha}\".`,\n\t\t\t\"invalid_build_sha\",\n\t\t);\n\t}\n\tif (UNSTAMPED_BUILD_SHA_PATTERN.test(sha)) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t\"The pinBuildSha option is the unstamped CDN_BUILD_SHA placeholder. Only the published npm package carries a stamped SHA; a repository or local build cannot pin a CDN build.\",\n\t\t\t\"unstamped_build_sha\",\n\t\t);\n\t}\n\treturn sha;\n}\n\n/**\n * The runtime this URL serves carries the SDK's security logic (endpoint\n * validation, session handling, the origin checks), so a cleartext transport\n * would let an on-path attacker replace it wholesale: `https:` is required,\n * with a loopback-only `http:` exception for local development.\n */\nfunction resolveSdkBootstrapUrl(\n\tcdnBase: string | undefined,\n\tpinBuildSha: string | undefined,\n): string {\n\tconst base = (cdnBase ?? DEFAULT_MESSAGING_CDN_BASE).trim();\n\t// Resolving against a base without a trailing slash would drop its last\n\t// path segment, so normalize before building the bootstrap URL.\n\tconst normalizedBase = base.endsWith(\"/\") ? base : `${base}/`;\n\tconst entryPath =\n\t\tpinBuildSha === undefined\n\t\t\t? SDK_BOOTSTRAP_FILENAME\n\t\t\t: `${resolvePinnedBuildSha(pinBuildSha)}/${PINNED_SDK_ENTRY_PATH}`;\n\tlet url: URL;\n\ttry {\n\t\turl = new URL(entryPath, normalizedBase);\n\t} catch (cause) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The cdnBase option is not a valid URL: \"${base}\".`,\n\t\t\t\"invalid_cdn_base\",\n\t\t\tcause,\n\t\t);\n\t}\n\tconst isHttps = url.protocol === \"https:\";\n\tconst isLoopbackHttp =\n\t\turl.protocol === \"http:\" && isLoopbackHostname(url.hostname);\n\tif (!isHttps && !isLoopbackHttp) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The cdnBase option must use https (plain http is allowed only for loopback hosts): \"${base}\".`,\n\t\t\t\"invalid_cdn_base\",\n\t\t);\n\t}\n\treturn url.toString();\n}\n\n// A partial CDN module (mid-deploy, or a rolled-back build missing a newer\n// export) must fail here as a typed sdk_module_invalid error, not later as a\n// TypeError on the first missing call — so every export is checked. The\n// `satisfies` clause rejects names that are not interface members; the\n// exhaustiveness type below is what forces this list to grow with it.\nconst REQUIRED_SDK_EXPORTS = [\n\t\"AdaMessagingClient\",\n\t\"createAdaEmbedInterface\",\n\t\"dispatchEmbedLoaderInitialActionQueue\",\n\t\"dispatchEmbedLoaderInitialActionQueueForAtomicHandoff\",\n\t\"mountAdaWebViewRuntime\",\n\t\"resolveAdaWebViewRuntimeAssets\",\n] as const satisfies readonly (keyof MessagingSdkModule)[];\n\n// Compile-time exhaustiveness: adding a MessagingSdkModule member without\n// listing it in REQUIRED_SDK_EXPORTS turns this type into `never`, failing\n// the `true` assignment below.\ntype AllSdkExportsListed =\n\tExclude<\n\t\tkeyof MessagingSdkModule,\n\t\t(typeof REQUIRED_SDK_EXPORTS)[number]\n\t> extends never\n\t\t? true\n\t\t: never;\nconst _allSdkExportsListed: AllSdkExportsListed = true;\nvoid _allSdkExportsListed;\n\nfunction isMessagingSdkModule(value: unknown): value is MessagingSdkModule {\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\tconst candidate = value as Record<string, unknown>;\n\treturn REQUIRED_SDK_EXPORTS.every(\n\t\t(key) => typeof candidate[key] === \"function\",\n\t);\n}\n\nasync function importSdkModule(\n\turl: string,\n\timportModule: ImportSdkModule,\n): Promise<MessagingSdkModule> {\n\tlet loaded: unknown;\n\ttry {\n\t\tloaded = await importModule(url);\n\t} catch (cause) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The Ada Messaging SDK failed to load from ${url}.`,\n\t\t\t\"sdk_import_failed\",\n\t\t\tcause,\n\t\t);\n\t}\n\tif (!isMessagingSdkModule(loaded)) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The module at ${url} does not expose the Ada Messaging SDK interface.`,\n\t\t\t\"sdk_module_invalid\",\n\t\t);\n\t}\n\treturn loaded;\n}\n\nfunction memoizeLoad(\n\tcache: Map<string, Promise<MessagingSdkModule>>,\n\turl: string,\n\tload: () => Promise<MessagingSdkModule>,\n): Promise<MessagingSdkModule> {\n\tconst existing = cache.get(url);\n\tif (existing) {\n\t\treturn existing;\n\t}\n\tconst pending = load();\n\tcache.set(url, pending);\n\tpending.catch(() => {\n\t\tif (cache.get(url) === pending) {\n\t\t\tcache.delete(url);\n\t\t}\n\t});\n\treturn pending;\n}\n\n/**\n * Load the Ada Messaging SDK module from Ada's CDN.\n *\n * The returned promise is memoized per resolved URL: concurrent and repeated\n * calls share one in-flight import. A failed load clears the memo so a later\n * call retries. Without `cdnBase`, an import failure at the default root is\n * retried once from {@link FALLBACK_MESSAGING_CDN_BASE}. Rejections are always\n * {@link MessagingSdkLoadError}.\n *\n * @example\n * const { createAdaEmbedInterface } = await loadMessagingSdk();\n */\nexport function loadMessagingSdk(\n\toptions: LoadMessagingSdkOptions = {},\n): Promise<MessagingSdkModule> {\n\tconst importModule = options.importModule ?? defaultImportModule;\n\tlet url: string;\n\tlet fallbackUrl: string | undefined;\n\ttry {\n\t\turl = resolveSdkBootstrapUrl(options.cdnBase, options.pinBuildSha);\n\t\tif (options.cdnBase === undefined) {\n\t\t\tfallbackUrl = resolveSdkBootstrapUrl(\n\t\t\t\tFALLBACK_MESSAGING_CDN_BASE,\n\t\t\t\toptions.pinBuildSha,\n\t\t\t);\n\t\t}\n\t} catch (error) {\n\t\treturn Promise.reject(error);\n\t}\n\n\tconst state = loadsByImporter.get(importModule) ?? {\n\t\timports: new Map<string, Promise<MessagingSdkModule>>(),\n\t\tdefaultLoads: new Map<string, Promise<MessagingSdkModule>>(),\n\t};\n\tloadsByImporter.set(importModule, state);\n\tconst load = (entryUrl: string) =>\n\t\tmemoizeLoad(state.imports, entryUrl, () =>\n\t\t\timportSdkModule(entryUrl, importModule),\n\t\t);\n\tif (fallbackUrl === undefined) {\n\t\treturn load(url);\n\t}\n\n\tconst retryUrl = fallbackUrl;\n\t// Keep fallback outcomes separate so explicit-root callers share the import,\n\t// but never inherit another caller's permission to retry a different root.\n\treturn memoizeLoad(state.defaultLoads, url, () =>\n\t\tload(url).catch(async (error: unknown) => {\n\t\t\tif (\n\t\t\t\t!(error instanceof MessagingSdkLoadError) ||\n\t\t\t\terror.code !== \"sdk_import_failed\"\n\t\t\t) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\t// CSP rejects import() without a network request, so this retry adds no\n\t\t\t// user-visible delay; retrying a genuine network failure once is acceptable too.\n\t\t\tlet module: MessagingSdkModule;\n\t\t\ttry {\n\t\t\t\tmodule = await load(retryUrl);\n\t\t\t} catch (cause) {\n\t\t\t\tif (!(cause instanceof MessagingSdkLoadError)) {\n\t\t\t\t\tthrow cause;\n\t\t\t\t}\n\t\t\t\tthrow new MessagingSdkLoadError(\n\t\t\t\t\tcause.code === \"sdk_import_failed\"\n\t\t\t\t\t\t? `The Ada Messaging SDK failed to load from both ${url} and ${retryUrl}.`\n\t\t\t\t\t\t: cause.message,\n\t\t\t\t\tcause.code,\n\t\t\t\t\terror,\n\t\t\t\t\tcause,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!warningScope[FALLBACK_WARNING_KEY]) {\n\t\t\t\twarningScope[FALLBACK_WARNING_KEY] = true;\n\t\t\t\tconst cause = error.cause;\n\t\t\t\t// Browsers reject blocked, unreachable, or missing imports with TypeError.\n\t\t\t\t// An evaluation-time TypeError still looks like a fetch failure, as before;\n\t\t\t\t// this heuristic narrows diagnostic noise but cannot prove the cause.\n\t\t\t\twarnHost(\n\t\t\t\t\tcause instanceof TypeError\n\t\t\t\t\t\t? `Loaded the Messaging SDK from ${FALLBACK_MESSAGING_CDN_BASE} because the default root ${DEFAULT_MESSAGING_CDN_BASE} was blocked or unavailable. Add https://messaging-assets.ada.support to script-src, connect-src and frame-src, or pass cdnBase: \"${FALLBACK_MESSAGING_CDN_BASE}\".`\n\t\t\t\t\t\t: `Loaded the Messaging SDK from ${FALLBACK_MESSAGING_CDN_BASE} because the module at ${url} failed to evaluate (${describeRejection(cause)}). This is an Ada-side problem, not your host's CSP. Report it to Ada.`,\n\t\t\t\t\tcause,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn module;\n\t\t}),\n\t);\n}\n\n// Keyed by import seam like the module memo above: production memoizes on\n// the module-level default while each injected test seam gets an isolated\n// cache. `ada` is set when the promise resolves, so the stopped-interface\n// diagnostic can consult the resolved facade without wrapping it.\ninterface StartedInterfaceMemo {\n\tpromise: Promise<AdaMessagingInterface>;\n\tsettings: AdaMessagingStartOptions;\n\tada?: AdaMessagingInterface;\n}\n\nconst startedInterfaceByImporter = new WeakMap<\n\tImportSdkModule,\n\tStartedInterfaceMemo\n>();\n\n// A rejection can be any value, including one that throws on String(); a\n// diagnostic must never turn a successful fallback into a rejected load.\nfunction describeRejection(cause: unknown): string {\n\ttry {\n\t\treturn cause instanceof Error\n\t\t\t? `${cause.name}: ${cause.message}`\n\t\t\t: String(cause);\n\t} catch {\n\t\treturn \"unknown error\";\n\t}\n}\n\n// Ungated like the runtime logger's dropped-host-value channel so host\n// configuration diagnostics remain visible without debug logging.\nfunction warnHost(message: string, cause?: unknown): void {\n\ttry {\n\t\t// biome-ignore lint/suspicious/noConsole: the loader's sanctioned host-page diagnostic sink\n\t\tconsole.warn(`[Ada] ${message}`, ...(cause === undefined ? [] : [cause]));\n\t} catch {\n\t\t// A host may replace console methods; diagnostics must not throw.\n\t}\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n}\n\n// Structural equality over the settings surface. Two functions compare equal:\n// fresh inline callbacks on a re-run (React Strict Mode effects) are not a\n// settings change worth a warning. Exotic objects compare by reference.\nfunction settingsEqual(a: unknown, b: unknown): boolean {\n\tif (Object.is(a, b)) {\n\t\treturn true;\n\t}\n\tif (typeof a === \"function\" && typeof b === \"function\") {\n\t\treturn true;\n\t}\n\tif (Array.isArray(a) && Array.isArray(b)) {\n\t\treturn (\n\t\t\ta.length === b.length &&\n\t\t\ta.every((item, index) => settingsEqual(item, b[index]))\n\t\t);\n\t}\n\tif (isPlainObject(a) && isPlainObject(b)) {\n\t\tconst aKeys = Object.keys(a);\n\t\tconst bKeys = new Set(Object.keys(b));\n\t\treturn (\n\t\t\taKeys.length === bKeys.size &&\n\t\t\taKeys.every((key) => bKeys.has(key) && settingsEqual(a[key], b[key]))\n\t\t);\n\t}\n\treturn false;\n}\n\n// Observes the facade's symbol-keyed lifecycle getter (embed-lifecycle.ts)\n// instead of wrapping stop/start, so the customer's interface is never\n// mutated; a pinned runtime that predates the getter yields no flag and the\n// stopped-interface diagnostic is skipped rather than guessed.\nfunction isInterfaceStopped(ada: AdaMessagingInterface): boolean {\n\treturn readEmbedStoppedFlag(ada) === true;\n}\n\nasync function startAdaMessaging(\n\tsettings: AdaMessagingStartOptions,\n\toptions: LoadMessagingSdkOptions,\n): Promise<AdaMessagingInterface> {\n\tconst sdkModule = await loadMessagingSdk(options);\n\tconst ada = sdkModule.createAdaEmbedInterface();\n\tawait ada.start(settings);\n\treturn ada;\n}\n\n/**\n * Load the SDK, create the messaging interface, and start the widget —\n * the npm-first equivalent of the script-tag + `window.adaSettings` setup.\n *\n * One widget per page: the returned promise is memoized, so repeated and\n * concurrent calls resolve to the same interface and the first\n * call's settings win. A failed load or start clears the memo so a later\n * call retries.\n *\n * If the bot's web chat setting is off, startup resolves without mounting the\n * widget. The interface stays memoized. Enable web chat in the\n * bot's settings before calling `start(settings)` again.\n *\n * Manage the running widget through the returned interface:\n * `stop()` tears it down and a later `start(settings)` on the same interface\n * runs again. Calling {@link loadAdaMessaging} after `stop()` returns the\n * same stopped interface without restarting it. Both memo outcomes log a\n * console warning: ignored differing settings, and a resolved interface\n * whose widget was stopped by the host.\n *\n * Never assigns the interface to `window` or any other global: the returned\n * reference is the only handle, so hold it in module scope. A reference in\n * module scope is reachable only by your own code, never by other scripts on\n * the page.\n *\n * @example\n * // module scope: your code keeps the only reference\n * const ada = await loadAdaMessaging({\n * handle: \"my-bot\",\n * enableProgrammaticControl: true,\n * });\n * await ada.sendMessage(\"Hello\");\n */\nexport function loadAdaMessaging(\n\tsettings: AdaMessagingStartOptions,\n\toptions: LoadMessagingSdkOptions = {},\n): Promise<AdaMessagingInterface> {\n\tconst importModule = options.importModule ?? defaultImportModule;\n\tconst existing = startedInterfaceByImporter.get(importModule);\n\tif (existing) {\n\t\tif (!settingsEqual(settings, existing.settings)) {\n\t\t\twarnHost(\n\t\t\t\t\"loadAdaMessaging() was already called: the new settings are ignored and the existing interface is returned. To apply new settings, call stop() then start(settings) on it.\",\n\t\t\t);\n\t\t}\n\t\tif (existing.ada && isInterfaceStopped(existing.ada)) {\n\t\t\twarnHost(\n\t\t\t\t\"loadAdaMessaging() resolved an interface whose widget was stopped and never restarts it. Call start(settings) on it to run the widget again.\",\n\t\t\t);\n\t\t}\n\t\treturn existing.promise;\n\t}\n\tconst memo: StartedInterfaceMemo = {\n\t\tpromise: startAdaMessaging(settings, options),\n\t\tsettings,\n\t};\n\tstartedInterfaceByImporter.set(importModule, memo);\n\tmemo.promise.then(\n\t\t(ada) => {\n\t\t\tmemo.ada = ada;\n\t\t},\n\t\t() => {\n\t\t\tif (startedInterfaceByImporter.get(importModule) === memo) {\n\t\t\t\tstartedInterfaceByImporter.delete(importModule);\n\t\t\t}\n\t\t},\n\t);\n\treturn memo.promise;\n}\n"],"mappings":";;;;;;;;;;;;AAWA,IAAM,uBAAuB,OAAO,UAAU;AAE9C,SAAS,YACR,QACA,MACA,OACO;CACP,OAAO,eAAe,QAAQ,MAAM;EACnC;EACA,cAAc;EACd,UAAU;CACX,CAAC;AACF;AAEA,IAAI,CAAC,OAAO,QACX,YAAY,QAAQ,WAAW,QAAiB,QAAiB;CAChE,IAAI,UAAU,MACb,MAAM,IAAI,UACT,mEACD;CAED,OAAO,qBAAqB,KAAK,OAAO,MAAM,GAAG,GAAkB;AACpE,CAAC;AAGF,S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A,SAAgB,iBACf,UACA,UAAmC,CAAC,GACH;CACjC,MAAM,eAAe,QAAQ,gBAAgB;CAC7C,MAAM,WAAW,2BAA2B,IAAI,YAAY;CAC5D,IAAI,UAAU;EACb,IAAI,CAAC,cAAc,UAAU,SAAS,QAAQ,GAC7C,SACC,4KACD;EAED,IAAI,SAAS,OAAO,mBAAmB,SAAS,GAAG,GAClD,SACC,8IACD;EAED,OAAO,SAAS;CACjB;CACA,MAAM,OAA6B;EAClC,SAAS,kBAAkB,UAAU,OAAO;EAC5C;CACD;CACA,2BAA2B,IAAI,cAAc,IAAI;CACjD,KAAK,QAAQ,MACX,QAAQ;EACR,KAAK,MAAM;CACZ,SACM;EACL,IAAI,2BAA2B,IAAI,YAAY,MAAM,MACpD,2BAA2B,OAAO,YAAY;CAEhD,CACD;CACA,OAAO,KAAK;AACb"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../shared/utils/src/browser-polyfills.ts","../../src/npm/build-info.ts","../../src/client/embed-lifecycle.ts","../../src/npm/loader.ts"],"sourcesContent":["/**\n * Defence in depth for engines just below the declared browser floor.\n * The floor is defined in `messaging/vite.browser-targets.mjs`.\n *\n * Internal Ada code should prefer direct helpers, such as `hasOwn(...)` from\n * `guards.ts`. Every Ada bundle includes these fallbacks, including the host-page\n * SDK. These fallbacks also ship inside the customer-held npm tarballs of the SDK\n * and bridge. Each fallback defines a member only when it is missing. These\n * fallbacks do not extend browser support below the floor required by the shipped CSS.\n */\n\nconst objectHasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction defineValue(\n\ttarget: object,\n\tname: PropertyKey,\n\tvalue: (...args: unknown[]) => unknown,\n): void {\n\tObject.defineProperty(target, name, {\n\t\tvalue,\n\t\tconfigurable: true,\n\t\twritable: true,\n\t});\n}\n\nif (!Object.hasOwn) {\n\tdefineValue(Object, \"hasOwn\", (object: unknown, key: unknown) => {\n\t\tif (object == null) {\n\t\t\tthrow new TypeError(\n\t\t\t\t\"ada browser-polyfills: Cannot convert undefined or null to object\",\n\t\t\t);\n\t\t}\n\t\treturn objectHasOwnProperty.call(Object(object), key as PropertyKey);\n\t});\n}\n\nfunction at<T>(\n\tthis: { length: number; [index: number]: T },\n\tindex: unknown,\n): T | undefined {\n\tconst length = Math.trunc(Number(this.length)) || 0;\n\tlet relativeIndex = Math.trunc(Number(index)) || 0;\n\tif (relativeIndex < 0) {\n\t\trelativeIndex += length;\n\t}\n\treturn relativeIndex < 0 || relativeIndex >= length\n\t\t? undefined\n\t\t: this[relativeIndex];\n}\n\nfunction stringAt(this: string, index: unknown): string | undefined {\n\tconst value = String(this);\n\tconst length = value.length;\n\tlet relativeIndex = Math.trunc(Number(index)) || 0;\n\tif (relativeIndex < 0) {\n\t\trelativeIndex += length;\n\t}\n\treturn relativeIndex < 0 || relativeIndex >= length\n\t\t? undefined\n\t\t: value.charAt(relativeIndex);\n}\n\nconst typedArrayConstructors = [\n\tglobalThis.Int8Array,\n\tglobalThis.Uint8Array,\n\tglobalThis.Uint8ClampedArray,\n\tglobalThis.Int16Array,\n\tglobalThis.Uint16Array,\n\tglobalThis.Int32Array,\n\tglobalThis.Uint32Array,\n\tglobalThis.Float32Array,\n\tglobalThis.Float64Array,\n\tglobalThis.BigInt64Array,\n\tglobalThis.BigUint64Array,\n].filter(Boolean);\n\nif (!Array.prototype.at) {\n\tdefineValue(Array.prototype, \"at\", at);\n}\n\nif (!String.prototype.at) {\n\tdefineValue(String.prototype, \"at\", stringAt);\n}\n\nfor (const TypedArrayConstructor of typedArrayConstructors) {\n\tconst prototype = TypedArrayConstructor.prototype;\n\tif (!prototype.at) {\n\t\tdefineValue(prototype, \"at\", at);\n\t}\n}\n","// The repo copy carries the 40-zero placeholder; the publish workflow\n// (.github/workflows/messaging-publish-web-packages.yml) stamps the real\n// commit SHA into the built output via scripts/stamp-cdn-build-sha.mjs and\n// verifies the packed tarball before `npm publish`. Keep the placeholder as\n// a single 40-zero string literal: the stamp is a same-length text\n// replacement, so source maps stay valid.\nconst GIT_SHA_PATTERN = /^[0-9a-f]{40}$/;\nconst UNSTAMPED_SHA_PATTERN = /^0{40}$/;\n\n/**\n * Git commit SHA of the monorepo commit this npm version was published from.\n * The CDN pipeline deploys each main commit's runtime under an immutable\n * SHA root, so this value names the CDN build associated with this npm\n * version. Pass it as the `pinBuildSha` loader option to load exactly that\n * runtime build — not recommended for production (see the README).\n *\n * In the repository, and in any locally built copy, the value is the\n * unstamped 40-zero placeholder ({@link isCdnBuildShaStamped} returns\n * `false`); only published tarballs carry a real SHA.\n */\nexport const CDN_BUILD_SHA: string = \"e39b6d29bec746347832ec710147ac2c6a6d4450\";\n\n/**\n * Whether `sha` (default {@link CDN_BUILD_SHA}) is a stamped full git commit\n * SHA rather than the unstamped repo placeholder.\n */\nexport function isCdnBuildShaStamped(sha: string = CDN_BUILD_SHA): boolean {\n\tconst normalized = sha.trim().toLowerCase();\n\treturn (\n\t\tGIT_SHA_PATTERN.test(normalized) && !UNSTAMPED_SHA_PATTERN.test(normalized)\n\t);\n}\n","/**\n * Lifecycle channel between `createAdaEmbedInterface` and the npm loader's\n * memo: a non-enumerable getter over closure state, so the loader never\n * mutates the public surface and `Object.freeze` on the facade still works.\n * `Symbol.for` because the loader and the CDN runtime are separate builds;\n * a runtime that predates the getter yields `undefined` — degrade gracefully.\n */\nexport const EMBED_LIFECYCLE_STOPPED = Symbol.for(\n\t\"ada-cx/messaging-sdk/embed-stopped\",\n);\n\n/** Read the host-initiated stop flag; `undefined` when the runtime predates it. */\nexport function readEmbedStoppedFlag(ada: object): boolean | undefined {\n\tconst value = (ada as Record<symbol, unknown>)[EMBED_LIFECYCLE_STOPPED];\n\treturn typeof value === \"boolean\" ? value : undefined;\n}\n\n/** Define the getter at facade creation time, before any host freeze. */\nexport function defineEmbedStoppedFlag(\n\tada: object,\n\treadStopped: () => boolean,\n): void {\n\tObject.defineProperty(ada, EMBED_LIFECYCLE_STOPPED, {\n\t\tget: readStopped,\n\t\tenumerable: false,\n\t\tconfigurable: false,\n\t});\n}\n","import type { AdaMessagingClient } from \"../client/client\";\nimport type { AdaMessagingStartOptions } from \"../client/client-types\";\nimport type {\n\tAdaEmbedInterface,\n\tcreateAdaEmbedInterface,\n\tdispatchEmbedLoaderInitialActionQueue,\n\tdispatchEmbedLoaderInitialActionQueueForAtomicHandoff,\n} from \"../client/embed-interface\";\nimport { readEmbedStoppedFlag } from \"../client/embed-lifecycle\";\nimport type {\n\tmountAdaWebViewRuntime,\n\tresolveAdaWebViewRuntimeAssets,\n} from \"../mobile-webview-runtime\";\n\n/**\n * Production CDN root the loader resolves the SDK bootstrap from when no\n * `cdnBase` override is given. The npm package never pins a runtime version;\n * the bootstrap at this root resolves the current rollout at load time.\n */\nexport const DEFAULT_MESSAGING_CDN_BASE =\n\t\"https://messaging-assets.ada.support/\";\n\nexport const FALLBACK_MESSAGING_CDN_BASE =\n\t\"https://static.ada.support/messaging/\";\n\nconst SDK_BOOTSTRAP_FILENAME = \"sdk.js\";\n\n// The CDN pipeline deploys each main commit's runtime as an immutable\n// SHA-rooted entry (`<cdnBase>/<sha>/sdk/index.js`); the mutable `sdk.js`\n// bootstrap resolves the current rollout to one of those roots at load time.\n// A pin bypasses the bootstrap and imports one root directly.\nconst PINNED_SDK_ENTRY_PATH = \"sdk/index.js\";\n\n// Strict on purpose: the pin is interpolated into a CDN path, so only a full\n// lowercase 40-hex git SHA may pass (mirrors scripts/sdk.js's\n// VERSION_OVERRIDE_PATTERN security boundary, minus the short-SHA and pr-N\n// forms — the npm surface pins exactly what CDN_BUILD_SHA carries).\nconst PINNED_BUILD_SHA_PATTERN = /^[0-9a-f]{40}$/;\nconst UNSTAMPED_BUILD_SHA_PATTERN = /^0{40}$/;\n\n/** Why a {@link MessagingSdkLoadError} was raised. */\nexport type MessagingSdkLoadErrorCode =\n\t/**\n\t * The `cdnBase` option is not a valid `https:` URL (plain `http:` is\n\t * allowed only for loopback hosts).\n\t */\n\t| \"invalid_cdn_base\"\n\t/** The `pinBuildSha` option is not a full 40-character hex git SHA. */\n\t| \"invalid_build_sha\"\n\t/**\n\t * The `pinBuildSha` option is the unstamped 40-zero placeholder: this\n\t * copy of the package was built from the repository, not published, so\n\t * its `CDN_BUILD_SHA` names no CDN build.\n\t */\n\t| \"unstamped_build_sha\"\n\t/** The dynamic import of the CDN bootstrap failed (fetch or evaluation). */\n\t| \"sdk_import_failed\"\n\t/** The imported module does not expose the Ada Messaging SDK surface. */\n\t| \"sdk_module_invalid\";\n\n/** Typed failure raised by {@link loadMessagingSdk} and {@link loadAdaMessaging}. */\nexport class MessagingSdkLoadError extends Error {\n\treadonly code: MessagingSdkLoadErrorCode;\n\tdeclare readonly fallbackCause?: MessagingSdkLoadError;\n\n\tconstructor(\n\t\tmessage: string,\n\t\tcode: MessagingSdkLoadErrorCode,\n\t\tcause?: unknown,\n\t\tfallbackCause?: MessagingSdkLoadError,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"MessagingSdkLoadError\";\n\t\tthis.code = code;\n\t\tif (cause !== undefined) {\n\t\t\tthis.cause = cause;\n\t\t}\n\t\tif (fallbackCause !== undefined) {\n\t\t\tObject.defineProperty(this, \"fallbackCause\", {\n\t\t\t\tvalue: fallbackCause,\n\t\t\t\tenumerable: true,\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * The programmatic messaging interface {@link loadAdaMessaging} resolves. An\n * alias of the runtime's `AdaEmbedInterface`, which keeps that name because it\n * is also the legacy `window.adaEmbed` compat facade.\n * Includes `selectQuickReply(messageId, index)` for Web SDK integrations.\n */\nexport type AdaMessagingInterface = AdaEmbedInterface;\n\n/**\n * The public surface of the CDN-resolved SDK module, as loaded from\n * `<cdnBase>/sdk.js`. Types only — the implementation always comes from the\n * CDN at load time and is never part of this npm package.\n */\nexport interface MessagingSdkModule {\n\tAdaMessagingClient: typeof AdaMessagingClient;\n\tcreateAdaEmbedInterface: typeof createAdaEmbedInterface;\n\tdispatchEmbedLoaderInitialActionQueue: typeof dispatchEmbedLoaderInitialActionQueue;\n\tdispatchEmbedLoaderInitialActionQueueForAtomicHandoff: typeof dispatchEmbedLoaderInitialActionQueueForAtomicHandoff;\n\tmountAdaWebViewRuntime: typeof mountAdaWebViewRuntime;\n\tresolveAdaWebViewRuntimeAssets: typeof resolveAdaWebViewRuntimeAssets;\n}\n\ntype ImportSdkModule = (url: string) => Promise<unknown>;\n\nexport interface LoadMessagingSdkOptions {\n\t/**\n\t * CDN root to resolve `sdk.js` from. Must be an `https:` URL; plain\n\t * `http:` is accepted only for loopback hosts (`localhost`, `127.0.0.1`,\n\t * `[::1]`, `*.localhost`) during local development. Defaults to the\n\t * production root ({@link DEFAULT_MESSAGING_CDN_BASE}). An explicit value,\n\t * including {@link FALLBACK_MESSAGING_CDN_BASE}, disables the automatic\n\t * static-root fallback.\n\t */\n\tcdnBase?: string;\n\t/**\n\t * Full 40-character git commit SHA of a deployed CDN build. When set, the\n\t * loader skips the rollout bootstrap and imports that build's immutable\n\t * entry (`<cdnBase>/<sha>/sdk/index.js`) directly. Pass the package's\n\t * `CDN_BUILD_SHA` export to pin the build associated with this npm\n\t * version. NOT recommended for production: a pinned runtime misses Ada's\n\t * fixes and rollouts, and may predate server contract changes. Composes\n\t * with `cdnBase` for staged validation.\n\t */\n\tpinBuildSha?: string;\n\t/**\n\t * Import seam for unit tests. Defaults to a native dynamic `import()` of\n\t * the resolved bootstrap URL.\n\t */\n\timportModule?: ImportSdkModule;\n}\n\n// Both annotations are load-bearing: bundlers rewrite bare dynamic imports,\n// and this specifier must reach the browser untouched so the runtime always\n// resolves from Ada's CDN. The npm build for this entry is unminified so the\n// annotations survive into the published output.\nconst defaultImportModule: ImportSdkModule = (url) =>\n\timport(/* webpackIgnore: true */ /* @vite-ignore */ url);\n\n// Keyed by import seam so production memoizes on the module-level default\n// while each injected test seam gets an isolated cache.\ninterface SdkLoaderState {\n\timports: Map<string, Promise<MessagingSdkModule>>;\n\tdefaultLoads: Map<string, Promise<MessagingSdkModule>>;\n}\n\nconst loadsByImporter = new WeakMap<ImportSdkModule, SdkLoaderState>();\n\n// Share the warning across independently bundled copies of this loader.\nconst FALLBACK_WARNING_KEY = Symbol.for(\"ada.messaging.sdk.fallbackWarning\");\nconst warningScope = globalThis as typeof globalThis & {\n\t[FALLBACK_WARNING_KEY]?: boolean;\n};\n\n// Mirrors the loopback semantics of the shared `isLoopbackHost` /\n// `validateMessagingEndpoint` (shared/utils/src/url.ts) and the bridge\n// loader's copy (packages/bridge/src/npm/loader.ts). Inlined because the\n// published loader must stay dependency-free; keep the host set in sync.\nconst LOOPBACK_HOSTS = new Set([\"localhost\", \"127.0.0.1\", \"[::1]\", \"::1\"]);\n\nfunction isLoopbackHostname(hostname: string): boolean {\n\tconst normalized = hostname.trim().toLowerCase();\n\t// `*.localhost` resolves to the loopback interface and is \"potentially\n\t// trustworthy\" per the Secure Contexts spec; no production host ends in\n\t// `.localhost`.\n\treturn LOOPBACK_HOSTS.has(normalized) || normalized.endsWith(\".localhost\");\n}\n\nfunction resolvePinnedBuildSha(pinBuildSha: string): string {\n\tconst sha = pinBuildSha.trim().toLowerCase();\n\tif (!PINNED_BUILD_SHA_PATTERN.test(sha)) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The pinBuildSha option must be a full 40-character hex git SHA: \"${pinBuildSha}\".`,\n\t\t\t\"invalid_build_sha\",\n\t\t);\n\t}\n\tif (UNSTAMPED_BUILD_SHA_PATTERN.test(sha)) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t\"The pinBuildSha option is the unstamped CDN_BUILD_SHA placeholder. Only the published npm package carries a stamped SHA; a repository or local build cannot pin a CDN build.\",\n\t\t\t\"unstamped_build_sha\",\n\t\t);\n\t}\n\treturn sha;\n}\n\n/**\n * The runtime this URL serves carries the SDK's security logic (endpoint\n * validation, session handling, the origin checks), so a cleartext transport\n * would let an on-path attacker replace it wholesale: `https:` is required,\n * with a loopback-only `http:` exception for local development.\n */\nfunction resolveSdkBootstrapUrl(\n\tcdnBase: string | undefined,\n\tpinBuildSha: string | undefined,\n): string {\n\tconst base = (cdnBase ?? DEFAULT_MESSAGING_CDN_BASE).trim();\n\t// Resolving against a base without a trailing slash would drop its last\n\t// path segment, so normalize before building the bootstrap URL.\n\tconst normalizedBase = base.endsWith(\"/\") ? base : `${base}/`;\n\tconst entryPath =\n\t\tpinBuildSha === undefined\n\t\t\t? SDK_BOOTSTRAP_FILENAME\n\t\t\t: `${resolvePinnedBuildSha(pinBuildSha)}/${PINNED_SDK_ENTRY_PATH}`;\n\tlet url: URL;\n\ttry {\n\t\turl = new URL(entryPath, normalizedBase);\n\t} catch (cause) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The cdnBase option is not a valid URL: \"${base}\".`,\n\t\t\t\"invalid_cdn_base\",\n\t\t\tcause,\n\t\t);\n\t}\n\tconst isHttps = url.protocol === \"https:\";\n\tconst isLoopbackHttp =\n\t\turl.protocol === \"http:\" && isLoopbackHostname(url.hostname);\n\tif (!isHttps && !isLoopbackHttp) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The cdnBase option must use https (plain http is allowed only for loopback hosts): \"${base}\".`,\n\t\t\t\"invalid_cdn_base\",\n\t\t);\n\t}\n\treturn url.toString();\n}\n\n// A partial CDN module (mid-deploy, or a rolled-back build missing a newer\n// export) must fail here as a typed sdk_module_invalid error, not later as a\n// TypeError on the first missing call — so every export is checked. The\n// `satisfies` clause rejects names that are not interface members; the\n// exhaustiveness type below is what forces this list to grow with it.\nconst REQUIRED_SDK_EXPORTS = [\n\t\"AdaMessagingClient\",\n\t\"createAdaEmbedInterface\",\n\t\"dispatchEmbedLoaderInitialActionQueue\",\n\t\"dispatchEmbedLoaderInitialActionQueueForAtomicHandoff\",\n\t\"mountAdaWebViewRuntime\",\n\t\"resolveAdaWebViewRuntimeAssets\",\n] as const satisfies readonly (keyof MessagingSdkModule)[];\n\n// Compile-time exhaustiveness: adding a MessagingSdkModule member without\n// listing it in REQUIRED_SDK_EXPORTS turns this type into `never`, failing\n// the `true` assignment below.\ntype AllSdkExportsListed =\n\tExclude<\n\t\tkeyof MessagingSdkModule,\n\t\t(typeof REQUIRED_SDK_EXPORTS)[number]\n\t> extends never\n\t\t? true\n\t\t: never;\nconst _allSdkExportsListed: AllSdkExportsListed = true;\nvoid _allSdkExportsListed;\n\nfunction isMessagingSdkModule(value: unknown): value is MessagingSdkModule {\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\tconst candidate = value as Record<string, unknown>;\n\treturn REQUIRED_SDK_EXPORTS.every(\n\t\t(key) => typeof candidate[key] === \"function\",\n\t);\n}\n\nasync function importSdkModule(\n\turl: string,\n\timportModule: ImportSdkModule,\n): Promise<MessagingSdkModule> {\n\tlet loaded: unknown;\n\ttry {\n\t\tloaded = await importModule(url);\n\t} catch (cause) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The Ada Messaging SDK failed to load from ${url}.`,\n\t\t\t\"sdk_import_failed\",\n\t\t\tcause,\n\t\t);\n\t}\n\tif (!isMessagingSdkModule(loaded)) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The module at ${url} does not expose the Ada Messaging SDK interface.`,\n\t\t\t\"sdk_module_invalid\",\n\t\t);\n\t}\n\treturn loaded;\n}\n\nfunction memoizeLoad(\n\tcache: Map<string, Promise<MessagingSdkModule>>,\n\turl: string,\n\tload: () => Promise<MessagingSdkModule>,\n): Promise<MessagingSdkModule> {\n\tconst existing = cache.get(url);\n\tif (existing) {\n\t\treturn existing;\n\t}\n\tconst pending = load();\n\tcache.set(url, pending);\n\tpending.catch(() => {\n\t\tif (cache.get(url) === pending) {\n\t\t\tcache.delete(url);\n\t\t}\n\t});\n\treturn pending;\n}\n\n/**\n * Load the Ada Messaging SDK module from Ada's CDN.\n *\n * The returned promise is memoized per resolved URL: concurrent and repeated\n * calls share one in-flight import. A failed load clears the memo so a later\n * call retries. Without `cdnBase`, an import failure at the default root is\n * retried once from {@link FALLBACK_MESSAGING_CDN_BASE}. Rejections are always\n * {@link MessagingSdkLoadError}.\n *\n * @example\n * const { createAdaEmbedInterface } = await loadMessagingSdk();\n */\nexport function loadMessagingSdk(\n\toptions: LoadMessagingSdkOptions = {},\n): Promise<MessagingSdkModule> {\n\tconst importModule = options.importModule ?? defaultImportModule;\n\tlet url: string;\n\tlet fallbackUrl: string | undefined;\n\ttry {\n\t\turl = resolveSdkBootstrapUrl(options.cdnBase, options.pinBuildSha);\n\t\tif (options.cdnBase === undefined) {\n\t\t\tfallbackUrl = resolveSdkBootstrapUrl(\n\t\t\t\tFALLBACK_MESSAGING_CDN_BASE,\n\t\t\t\toptions.pinBuildSha,\n\t\t\t);\n\t\t}\n\t} catch (error) {\n\t\treturn Promise.reject(error);\n\t}\n\n\tconst state = loadsByImporter.get(importModule) ?? {\n\t\timports: new Map<string, Promise<MessagingSdkModule>>(),\n\t\tdefaultLoads: new Map<string, Promise<MessagingSdkModule>>(),\n\t};\n\tloadsByImporter.set(importModule, state);\n\tconst load = (entryUrl: string) =>\n\t\tmemoizeLoad(state.imports, entryUrl, () =>\n\t\t\timportSdkModule(entryUrl, importModule),\n\t\t);\n\tif (fallbackUrl === undefined) {\n\t\treturn load(url);\n\t}\n\n\tconst retryUrl = fallbackUrl;\n\t// Keep fallback outcomes separate so explicit-root callers share the import,\n\t// but never inherit another caller's permission to retry a different root.\n\treturn memoizeLoad(state.defaultLoads, url, () =>\n\t\tload(url).catch(async (error: unknown) => {\n\t\t\tif (\n\t\t\t\t!(error instanceof MessagingSdkLoadError) ||\n\t\t\t\terror.code !== \"sdk_import_failed\"\n\t\t\t) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\t// CSP rejects import() without a network request, so this retry adds no\n\t\t\t// user-visible delay; retrying a genuine network failure once is acceptable too.\n\t\t\tlet module: MessagingSdkModule;\n\t\t\ttry {\n\t\t\t\tmodule = await load(retryUrl);\n\t\t\t} catch (cause) {\n\t\t\t\tif (!(cause instanceof MessagingSdkLoadError)) {\n\t\t\t\t\tthrow cause;\n\t\t\t\t}\n\t\t\t\tthrow new MessagingSdkLoadError(\n\t\t\t\t\tcause.code === \"sdk_import_failed\"\n\t\t\t\t\t\t? `The Ada Messaging SDK failed to load from both ${url} and ${retryUrl}.`\n\t\t\t\t\t\t: cause.message,\n\t\t\t\t\tcause.code,\n\t\t\t\t\terror,\n\t\t\t\t\tcause,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!warningScope[FALLBACK_WARNING_KEY]) {\n\t\t\t\twarningScope[FALLBACK_WARNING_KEY] = true;\n\t\t\t\tconst cause = error.cause;\n\t\t\t\t// Browsers reject blocked, unreachable, or missing imports with TypeError.\n\t\t\t\t// An evaluation-time TypeError still looks like a fetch failure, as before;\n\t\t\t\t// this heuristic narrows diagnostic noise but cannot prove the cause.\n\t\t\t\twarnHost(\n\t\t\t\t\tcause instanceof TypeError\n\t\t\t\t\t\t? `Loaded the Messaging SDK from ${FALLBACK_MESSAGING_CDN_BASE} because the default root ${DEFAULT_MESSAGING_CDN_BASE} was blocked or unavailable. Add https://messaging-assets.ada.support to script-src, connect-src and frame-src, or pass cdnBase: \"${FALLBACK_MESSAGING_CDN_BASE}\".`\n\t\t\t\t\t\t: `Loaded the Messaging SDK from ${FALLBACK_MESSAGING_CDN_BASE} because the module at ${url} failed to evaluate (${describeRejection(cause)}). This is an Ada-side problem, not your host's CSP. Report it to Ada.`,\n\t\t\t\t\tcause,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn module;\n\t\t}),\n\t);\n}\n\n// Keyed by import seam like the module memo above: production memoizes on\n// the module-level default while each injected test seam gets an isolated\n// cache. `ada` is set when the promise resolves, so the stopped-interface\n// diagnostic can consult the resolved facade without wrapping it.\ninterface StartedInterfaceMemo {\n\tpromise: Promise<AdaMessagingInterface>;\n\tsettings: AdaMessagingStartOptions;\n\tada?: AdaMessagingInterface;\n}\n\nconst startedInterfaceByImporter = new WeakMap<\n\tImportSdkModule,\n\tStartedInterfaceMemo\n>();\n\n// A rejection can be any value, including one that throws on String(); a\n// diagnostic must never turn a successful fallback into a rejected load.\nfunction describeRejection(cause: unknown): string {\n\ttry {\n\t\treturn cause instanceof Error\n\t\t\t? `${cause.name}: ${cause.message}`\n\t\t\t: String(cause);\n\t} catch {\n\t\treturn \"unknown error\";\n\t}\n}\n\n// Ungated like the runtime logger's dropped-host-value channel so host\n// configuration diagnostics remain visible without debug logging.\nfunction warnHost(message: string, cause?: unknown): void {\n\ttry {\n\t\t// biome-ignore lint/suspicious/noConsole: the loader's sanctioned host-page diagnostic sink\n\t\tconsole.warn(`[Ada] ${message}`, ...(cause === undefined ? [] : [cause]));\n\t} catch {\n\t\t// A host may replace console methods; diagnostics must not throw.\n\t}\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n}\n\n// Structural equality over the settings surface. Two functions compare equal:\n// fresh inline callbacks on a re-run (React Strict Mode effects) are not a\n// settings change worth a warning. Exotic objects compare by reference.\nfunction settingsEqual(a: unknown, b: unknown): boolean {\n\tif (Object.is(a, b)) {\n\t\treturn true;\n\t}\n\tif (typeof a === \"function\" && typeof b === \"function\") {\n\t\treturn true;\n\t}\n\tif (Array.isArray(a) && Array.isArray(b)) {\n\t\treturn (\n\t\t\ta.length === b.length &&\n\t\t\ta.every((item, index) => settingsEqual(item, b[index]))\n\t\t);\n\t}\n\tif (isPlainObject(a) && isPlainObject(b)) {\n\t\tconst aKeys = Object.keys(a);\n\t\tconst bKeys = new Set(Object.keys(b));\n\t\treturn (\n\t\t\taKeys.length === bKeys.size &&\n\t\t\taKeys.every((key) => bKeys.has(key) && settingsEqual(a[key], b[key]))\n\t\t);\n\t}\n\treturn false;\n}\n\n// Observes the facade's symbol-keyed lifecycle getter (embed-lifecycle.ts)\n// instead of wrapping stop/start, so the customer's interface is never\n// mutated; a pinned runtime that predates the getter yields no flag and the\n// stopped-interface diagnostic is skipped rather than guessed.\nfunction isInterfaceStopped(ada: AdaMessagingInterface): boolean {\n\treturn readEmbedStoppedFlag(ada) === true;\n}\n\nasync function startAdaMessaging(\n\tsettings: AdaMessagingStartOptions,\n\toptions: LoadMessagingSdkOptions,\n): Promise<AdaMessagingInterface> {\n\tconst sdkModule = await loadMessagingSdk(options);\n\tconst ada = sdkModule.createAdaEmbedInterface();\n\tawait ada.start(settings);\n\treturn ada;\n}\n\n/**\n * Load the SDK, create the messaging interface, and start the widget —\n * the npm-first equivalent of the script-tag + `window.adaSettings` setup.\n *\n * One widget per page: the returned promise is memoized, so repeated and\n * concurrent calls resolve to the same interface and the first\n * call's settings win. A failed load or start clears the memo so a later\n * call retries.\n *\n * If the bot's web chat setting is off, startup resolves without mounting the\n * widget. The interface stays memoized. Enable web chat in the\n * bot's settings before calling `start(settings)` again.\n *\n * Manage the running widget through the returned interface:\n * `stop()` tears it down and a later `start(settings)` on the same interface\n * runs again. Calling {@link loadAdaMessaging} after `stop()` returns the\n * same stopped interface without restarting it. Both memo outcomes log a\n * console warning: ignored differing settings, and a resolved interface\n * whose widget was stopped by the host.\n *\n * Never assigns the interface to `window` or any other global: the returned\n * reference is the only handle, so hold it in module scope. A reference in\n * module scope is reachable only by your own code, never by other scripts on\n * the page.\n *\n * @example\n * // module scope: your code keeps the only reference\n * const ada = await loadAdaMessaging({\n * handle: \"my-bot\",\n * enableProgrammaticControl: true,\n * });\n * await ada.sendMessage(\"Hello\");\n */\nexport function loadAdaMessaging(\n\tsettings: AdaMessagingStartOptions,\n\toptions: LoadMessagingSdkOptions = {},\n): Promise<AdaMessagingInterface> {\n\tconst importModule = options.importModule ?? defaultImportModule;\n\tconst existing = startedInterfaceByImporter.get(importModule);\n\tif (existing) {\n\t\tif (!settingsEqual(settings, existing.settings)) {\n\t\t\twarnHost(\n\t\t\t\t\"loadAdaMessaging() was already called: the new settings are ignored and the existing interface is returned. To apply new settings, call stop() then start(settings) on it.\",\n\t\t\t);\n\t\t}\n\t\tif (existing.ada && isInterfaceStopped(existing.ada)) {\n\t\t\twarnHost(\n\t\t\t\t\"loadAdaMessaging() resolved an interface whose widget was stopped and never restarts it. Call start(settings) on it to run the widget again.\",\n\t\t\t);\n\t\t}\n\t\treturn existing.promise;\n\t}\n\tconst memo: StartedInterfaceMemo = {\n\t\tpromise: startAdaMessaging(settings, options),\n\t\tsettings,\n\t};\n\tstartedInterfaceByImporter.set(importModule, memo);\n\tmemo.promise.then(\n\t\t(ada) => {\n\t\t\tmemo.ada = ada;\n\t\t},\n\t\t() => {\n\t\t\tif (startedInterfaceByImporter.get(importModule) === memo) {\n\t\t\t\tstartedInterfaceByImporter.delete(importModule);\n\t\t\t}\n\t\t},\n\t);\n\treturn memo.promise;\n}\n"],"mappings":";;;;;;;;;;;;AAWA,IAAM,uBAAuB,OAAO,UAAU;AAE9C,SAAS,YACR,QACA,MACA,OACO;CACP,OAAO,eAAe,QAAQ,MAAM;EACnC;EACA,cAAc;EACd,UAAU;CACX,CAAC;AACF;AAEA,IAAI,CAAC,OAAO,QACX,YAAY,QAAQ,WAAW,QAAiB,QAAiB;CAChE,IAAI,UAAU,MACb,MAAM,IAAI,UACT,mEACD;CAED,OAAO,qBAAqB,KAAK,OAAO,MAAM,GAAG,GAAkB;AACpE,CAAC;AAGF,SAAS,GAER,OACgB;CAChB,MAAM,SAAS,KAAK,MAAM,OAAO,KAAK,MAAM,CAAC,KAAK;CAClD,IAAI,gBAAgB,KAAK,MAAM,OAAO,KAAK,CAAC,KAAK;CACjD,IAAI,gBAAgB,GACnB,iBAAiB;CAElB,OAAO,gBAAgB,KAAK,iBAAiB,SAC1C,KAAA,IACA,KAAK;AACT;AAEA,SAAS,SAAuB,OAAoC;CACnE,MAAM,QAAQ,OAAO,IAAI;CACzB,MAAM,SAAS,MAAM;CACrB,IAAI,gBAAgB,KAAK,MAAM,OAAO,KAAK,CAAC,KAAK;CACjD,IAAI,gBAAgB,GACnB,iBAAiB;CAElB,OAAO,gBAAgB,KAAK,iBAAi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,2BAA2B,IAAI,YAAY,MAAM,MACpD,2BAA2B,OAAO,YAAY;CAEhD,CACD;CACA,OAAO,KAAK;AACb"}
|
package/dist/npm/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AdaMessagingClient } from "../client/client.js" with { "resolution-mode": "import" };
|
|
2
2
|
export type { AdaMessagingClient };
|
|
3
|
-
import type { AdaMessagingBranding, AdaMessagingBrandingLauncher, AdaMessagingClientConfig, AdaMessagingLocalizedText, AdaMessagingSettings, AdaMessagingStartOptions, AdaReadyCallbackParams, AdaSdkEventCallback, AdaSdkEventContext, AdaSdkEventKey, BeforeSend, ConversationInfo, Delegate, MetaFieldValue, PublicAgentInfo, PublicMessage, ResetParams, SendMessageResult, TriggerPlaybookOptions, WindowInfo, } from "../client/client-types.js" with { "resolution-mode": "import" };
|
|
4
|
-
export type { AdaMessagingBranding, AdaMessagingBrandingLauncher, AdaMessagingClientConfig, AdaMessagingLocalizedText, AdaMessagingSettings, AdaMessagingStartOptions, AdaReadyCallbackParams, AdaSdkEventCallback, AdaSdkEventContext, AdaSdkEventKey, BeforeSend, ConversationInfo, Delegate, MetaFieldValue, PublicAgentInfo, PublicMessage, ResetParams, SendMessageResult, TriggerPlaybookOptions, WindowInfo };
|
|
3
|
+
import type { AdaMessagingBranding, AdaMessagingBrandingLauncher, AdaMessagingClientConfig, AdaMessagingLocalizedText, AdaMessagingSettings, AdaMessagingStartOptions, AdaReadyCallbackParams, AdaSdkEventCallback, AdaSdkEventContext, AdaSdkEventKey, BeforeSend, ConversationInfo, Delegate, MetaFieldValue, PublicAgentInfo, PublicMessage, ResetParams, SendMessageResult, SetLanguageOptions, TriggerPlaybookOptions, WindowInfo, } from "../client/client-types.js" with { "resolution-mode": "import" };
|
|
4
|
+
export type { AdaMessagingBranding, AdaMessagingBrandingLauncher, AdaMessagingClientConfig, AdaMessagingLocalizedText, AdaMessagingSettings, AdaMessagingStartOptions, AdaReadyCallbackParams, AdaSdkEventCallback, AdaSdkEventContext, AdaSdkEventKey, BeforeSend, ConversationInfo, Delegate, MetaFieldValue, PublicAgentInfo, PublicMessage, ResetParams, SendMessageResult, SetLanguageOptions, TriggerPlaybookOptions, WindowInfo };
|
|
5
5
|
import type { ChatHtmlConfig, resolveChatHtmlConfig, } from "../client/config-helpers.js" with { "resolution-mode": "import" };
|
|
6
6
|
export type { ChatHtmlConfig, resolveChatHtmlConfig };
|
|
7
7
|
import type { AdaEmbedInterface, createAdaEmbedInterface, dispatchEmbedLoaderInitialActionQueue, dispatchEmbedLoaderInitialActionQueueForAtomicHandoff, LoaderQueueAction, LoaderQueueActionOutcome, LoaderQueueActionOutcomeHandler, } from "../client/embed-interface.js" with { "resolution-mode": "import" };
|
package/dist/npm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { AdaMessagingClient } from "../client/client.js";
|
|
2
|
-
export type { AdaMessagingBranding, AdaMessagingBrandingLauncher, AdaMessagingClientConfig, AdaMessagingLocalizedText, AdaMessagingSettings, AdaMessagingStartOptions, AdaReadyCallbackParams, AdaSdkEventCallback, AdaSdkEventContext, AdaSdkEventKey, BeforeSend, ConversationInfo, Delegate, MetaFieldValue, PublicAgentInfo, PublicMessage, ResetParams, SendMessageResult, TriggerPlaybookOptions, WindowInfo, } from "../client/client-types.js";
|
|
2
|
+
export type { AdaMessagingBranding, AdaMessagingBrandingLauncher, AdaMessagingClientConfig, AdaMessagingLocalizedText, AdaMessagingSettings, AdaMessagingStartOptions, AdaReadyCallbackParams, AdaSdkEventCallback, AdaSdkEventContext, AdaSdkEventKey, BeforeSend, ConversationInfo, Delegate, MetaFieldValue, PublicAgentInfo, PublicMessage, ResetParams, SendMessageResult, SetLanguageOptions, TriggerPlaybookOptions, WindowInfo, } from "../client/client-types.js";
|
|
3
3
|
export type { ChatHtmlConfig, resolveChatHtmlConfig, } from "../client/config-helpers.js";
|
|
4
4
|
export type { AdaEmbedInterface, createAdaEmbedInterface, dispatchEmbedLoaderInitialActionQueue, dispatchEmbedLoaderInitialActionQueueForAtomicHandoff, LoaderQueueAction, LoaderQueueActionOutcome, LoaderQueueActionOutcomeHandler, } from "../client/embed-interface.js";
|
|
5
5
|
export type { FrameChannel, FrameChild, FrameMessage, FrameName, FrameToSdkEvents, SdkToFrameEvents, } from "../frame-channel/index.js";
|
package/dist/npm/index.js
CHANGED
|
@@ -68,7 +68,7 @@ var UNSTAMPED_SHA_PATTERN = /^0{40}$/;
|
|
|
68
68
|
* unstamped 40-zero placeholder ({@link isCdnBuildShaStamped} returns
|
|
69
69
|
* `false`); only published tarballs carry a real SHA.
|
|
70
70
|
*/
|
|
71
|
-
var CDN_BUILD_SHA = "
|
|
71
|
+
var CDN_BUILD_SHA = "e39b6d29bec746347832ec710147ac2c6a6d4450";
|
|
72
72
|
/**
|
|
73
73
|
* Whether `sha` (default {@link CDN_BUILD_SHA}) is a stamped full git commit
|
|
74
74
|
* SHA rather than the unstamped repo placeholder.
|
package/dist/npm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../shared/utils/src/browser-polyfills.ts","../../src/npm/build-info.ts","../../src/client/embed-lifecycle.ts","../../src/npm/loader.ts"],"sourcesContent":["/**\n * Defence in depth for engines just below the declared browser floor.\n * The floor is defined in `messaging/vite.browser-targets.mjs`.\n *\n * Internal Ada code should prefer direct helpers, such as `hasOwn(...)` from\n * `guards.ts`. Every Ada bundle includes these fallbacks, including the host-page\n * SDK. These fallbacks also ship inside the customer-held npm tarballs of the SDK\n * and bridge. Each fallback defines a member only when it is missing. These\n * fallbacks do not extend browser support below the floor required by the shipped CSS.\n */\n\nconst objectHasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction defineValue(\n\ttarget: object,\n\tname: PropertyKey,\n\tvalue: (...args: unknown[]) => unknown,\n): void {\n\tObject.defineProperty(target, name, {\n\t\tvalue,\n\t\tconfigurable: true,\n\t\twritable: true,\n\t});\n}\n\nif (!Object.hasOwn) {\n\tdefineValue(Object, \"hasOwn\", (object: unknown, key: unknown) => {\n\t\tif (object == null) {\n\t\t\tthrow new TypeError(\n\t\t\t\t\"ada browser-polyfills: Cannot convert undefined or null to object\",\n\t\t\t);\n\t\t}\n\t\treturn objectHasOwnProperty.call(Object(object), key as PropertyKey);\n\t});\n}\n\nfunction at<T>(\n\tthis: { length: number; [index: number]: T },\n\tindex: unknown,\n): T | undefined {\n\tconst length = Math.trunc(Number(this.length)) || 0;\n\tlet relativeIndex = Math.trunc(Number(index)) || 0;\n\tif (relativeIndex < 0) {\n\t\trelativeIndex += length;\n\t}\n\treturn relativeIndex < 0 || relativeIndex >= length\n\t\t? undefined\n\t\t: this[relativeIndex];\n}\n\nfunction stringAt(this: string, index: unknown): string | undefined {\n\tconst value = String(this);\n\tconst length = value.length;\n\tlet relativeIndex = Math.trunc(Number(index)) || 0;\n\tif (relativeIndex < 0) {\n\t\trelativeIndex += length;\n\t}\n\treturn relativeIndex < 0 || relativeIndex >= length\n\t\t? undefined\n\t\t: value.charAt(relativeIndex);\n}\n\nconst typedArrayConstructors = [\n\tglobalThis.Int8Array,\n\tglobalThis.Uint8Array,\n\tglobalThis.Uint8ClampedArray,\n\tglobalThis.Int16Array,\n\tglobalThis.Uint16Array,\n\tglobalThis.Int32Array,\n\tglobalThis.Uint32Array,\n\tglobalThis.Float32Array,\n\tglobalThis.Float64Array,\n\tglobalThis.BigInt64Array,\n\tglobalThis.BigUint64Array,\n].filter(Boolean);\n\nif (!Array.prototype.at) {\n\tdefineValue(Array.prototype, \"at\", at);\n}\n\nif (!String.prototype.at) {\n\tdefineValue(String.prototype, \"at\", stringAt);\n}\n\nfor (const TypedArrayConstructor of typedArrayConstructors) {\n\tconst prototype = TypedArrayConstructor.prototype;\n\tif (!prototype.at) {\n\t\tdefineValue(prototype, \"at\", at);\n\t}\n}\n","// The repo copy carries the 40-zero placeholder; the publish workflow\n// (.github/workflows/messaging-publish-web-packages.yml) stamps the real\n// commit SHA into the built output via scripts/stamp-cdn-build-sha.mjs and\n// verifies the packed tarball before `npm publish`. Keep the placeholder as\n// a single 40-zero string literal: the stamp is a same-length text\n// replacement, so source maps stay valid.\nconst GIT_SHA_PATTERN = /^[0-9a-f]{40}$/;\nconst UNSTAMPED_SHA_PATTERN = /^0{40}$/;\n\n/**\n * Git commit SHA of the monorepo commit this npm version was published from.\n * The CDN pipeline deploys each main commit's runtime under an immutable\n * SHA root, so this value names the CDN build associated with this npm\n * version. Pass it as the `pinBuildSha` loader option to load exactly that\n * runtime build — not recommended for production (see the README).\n *\n * In the repository, and in any locally built copy, the value is the\n * unstamped 40-zero placeholder ({@link isCdnBuildShaStamped} returns\n * `false`); only published tarballs carry a real SHA.\n */\nexport const CDN_BUILD_SHA: string = \"8046d6981dd5321ddc7fedef8280e3ffff72b981\";\n\n/**\n * Whether `sha` (default {@link CDN_BUILD_SHA}) is a stamped full git commit\n * SHA rather than the unstamped repo placeholder.\n */\nexport function isCdnBuildShaStamped(sha: string = CDN_BUILD_SHA): boolean {\n\tconst normalized = sha.trim().toLowerCase();\n\treturn (\n\t\tGIT_SHA_PATTERN.test(normalized) && !UNSTAMPED_SHA_PATTERN.test(normalized)\n\t);\n}\n","/**\n * Lifecycle channel between `createAdaEmbedInterface` and the npm loader's\n * memo: a non-enumerable getter over closure state, so the loader never\n * mutates the public surface and `Object.freeze` on the facade still works.\n * `Symbol.for` because the loader and the CDN runtime are separate builds;\n * a runtime that predates the getter yields `undefined` — degrade gracefully.\n */\nexport const EMBED_LIFECYCLE_STOPPED = Symbol.for(\n\t\"ada-cx/messaging-sdk/embed-stopped\",\n);\n\n/** Read the host-initiated stop flag; `undefined` when the runtime predates it. */\nexport function readEmbedStoppedFlag(ada: object): boolean | undefined {\n\tconst value = (ada as Record<symbol, unknown>)[EMBED_LIFECYCLE_STOPPED];\n\treturn typeof value === \"boolean\" ? value : undefined;\n}\n\n/** Define the getter at facade creation time, before any host freeze. */\nexport function defineEmbedStoppedFlag(\n\tada: object,\n\treadStopped: () => boolean,\n): void {\n\tObject.defineProperty(ada, EMBED_LIFECYCLE_STOPPED, {\n\t\tget: readStopped,\n\t\tenumerable: false,\n\t\tconfigurable: false,\n\t});\n}\n","import type { AdaMessagingClient } from \"../client/client\";\nimport type { AdaMessagingStartOptions } from \"../client/client-types\";\nimport type {\n\tAdaEmbedInterface,\n\tcreateAdaEmbedInterface,\n\tdispatchEmbedLoaderInitialActionQueue,\n\tdispatchEmbedLoaderInitialActionQueueForAtomicHandoff,\n} from \"../client/embed-interface\";\nimport { readEmbedStoppedFlag } from \"../client/embed-lifecycle\";\nimport type {\n\tmountAdaWebViewRuntime,\n\tresolveAdaWebViewRuntimeAssets,\n} from \"../mobile-webview-runtime\";\n\n/**\n * Production CDN root the loader resolves the SDK bootstrap from when no\n * `cdnBase` override is given. The npm package never pins a runtime version;\n * the bootstrap at this root resolves the current rollout at load time.\n */\nexport const DEFAULT_MESSAGING_CDN_BASE =\n\t\"https://messaging-assets.ada.support/\";\n\nexport const FALLBACK_MESSAGING_CDN_BASE =\n\t\"https://static.ada.support/messaging/\";\n\nconst SDK_BOOTSTRAP_FILENAME = \"sdk.js\";\n\n// The CDN pipeline deploys each main commit's runtime as an immutable\n// SHA-rooted entry (`<cdnBase>/<sha>/sdk/index.js`); the mutable `sdk.js`\n// bootstrap resolves the current rollout to one of those roots at load time.\n// A pin bypasses the bootstrap and imports one root directly.\nconst PINNED_SDK_ENTRY_PATH = \"sdk/index.js\";\n\n// Strict on purpose: the pin is interpolated into a CDN path, so only a full\n// lowercase 40-hex git SHA may pass (mirrors scripts/sdk.js's\n// VERSION_OVERRIDE_PATTERN security boundary, minus the short-SHA and pr-N\n// forms — the npm surface pins exactly what CDN_BUILD_SHA carries).\nconst PINNED_BUILD_SHA_PATTERN = /^[0-9a-f]{40}$/;\nconst UNSTAMPED_BUILD_SHA_PATTERN = /^0{40}$/;\n\n/** Why a {@link MessagingSdkLoadError} was raised. */\nexport type MessagingSdkLoadErrorCode =\n\t/**\n\t * The `cdnBase` option is not a valid `https:` URL (plain `http:` is\n\t * allowed only for loopback hosts).\n\t */\n\t| \"invalid_cdn_base\"\n\t/** The `pinBuildSha` option is not a full 40-character hex git SHA. */\n\t| \"invalid_build_sha\"\n\t/**\n\t * The `pinBuildSha` option is the unstamped 40-zero placeholder: this\n\t * copy of the package was built from the repository, not published, so\n\t * its `CDN_BUILD_SHA` names no CDN build.\n\t */\n\t| \"unstamped_build_sha\"\n\t/** The dynamic import of the CDN bootstrap failed (fetch or evaluation). */\n\t| \"sdk_import_failed\"\n\t/** The imported module does not expose the Ada Messaging SDK surface. */\n\t| \"sdk_module_invalid\";\n\n/** Typed failure raised by {@link loadMessagingSdk} and {@link loadAdaMessaging}. */\nexport class MessagingSdkLoadError extends Error {\n\treadonly code: MessagingSdkLoadErrorCode;\n\tdeclare readonly fallbackCause?: MessagingSdkLoadError;\n\n\tconstructor(\n\t\tmessage: string,\n\t\tcode: MessagingSdkLoadErrorCode,\n\t\tcause?: unknown,\n\t\tfallbackCause?: MessagingSdkLoadError,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"MessagingSdkLoadError\";\n\t\tthis.code = code;\n\t\tif (cause !== undefined) {\n\t\t\tthis.cause = cause;\n\t\t}\n\t\tif (fallbackCause !== undefined) {\n\t\t\tObject.defineProperty(this, \"fallbackCause\", {\n\t\t\t\tvalue: fallbackCause,\n\t\t\t\tenumerable: true,\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * The programmatic messaging interface {@link loadAdaMessaging} resolves. An\n * alias of the runtime's `AdaEmbedInterface`, which keeps that name because it\n * is also the legacy `window.adaEmbed` compat facade.\n * Includes `selectQuickReply(messageId, index)` for Web SDK integrations.\n */\nexport type AdaMessagingInterface = AdaEmbedInterface;\n\n/**\n * The public surface of the CDN-resolved SDK module, as loaded from\n * `<cdnBase>/sdk.js`. Types only — the implementation always comes from the\n * CDN at load time and is never part of this npm package.\n */\nexport interface MessagingSdkModule {\n\tAdaMessagingClient: typeof AdaMessagingClient;\n\tcreateAdaEmbedInterface: typeof createAdaEmbedInterface;\n\tdispatchEmbedLoaderInitialActionQueue: typeof dispatchEmbedLoaderInitialActionQueue;\n\tdispatchEmbedLoaderInitialActionQueueForAtomicHandoff: typeof dispatchEmbedLoaderInitialActionQueueForAtomicHandoff;\n\tmountAdaWebViewRuntime: typeof mountAdaWebViewRuntime;\n\tresolveAdaWebViewRuntimeAssets: typeof resolveAdaWebViewRuntimeAssets;\n}\n\ntype ImportSdkModule = (url: string) => Promise<unknown>;\n\nexport interface LoadMessagingSdkOptions {\n\t/**\n\t * CDN root to resolve `sdk.js` from. Must be an `https:` URL; plain\n\t * `http:` is accepted only for loopback hosts (`localhost`, `127.0.0.1`,\n\t * `[::1]`, `*.localhost`) during local development. Defaults to the\n\t * production root ({@link DEFAULT_MESSAGING_CDN_BASE}). An explicit value,\n\t * including {@link FALLBACK_MESSAGING_CDN_BASE}, disables the automatic\n\t * static-root fallback.\n\t */\n\tcdnBase?: string;\n\t/**\n\t * Full 40-character git commit SHA of a deployed CDN build. When set, the\n\t * loader skips the rollout bootstrap and imports that build's immutable\n\t * entry (`<cdnBase>/<sha>/sdk/index.js`) directly. Pass the package's\n\t * `CDN_BUILD_SHA` export to pin the build associated with this npm\n\t * version. NOT recommended for production: a pinned runtime misses Ada's\n\t * fixes and rollouts, and may predate server contract changes. Composes\n\t * with `cdnBase` for staged validation.\n\t */\n\tpinBuildSha?: string;\n\t/**\n\t * Import seam for unit tests. Defaults to a native dynamic `import()` of\n\t * the resolved bootstrap URL.\n\t */\n\timportModule?: ImportSdkModule;\n}\n\n// Both annotations are load-bearing: bundlers rewrite bare dynamic imports,\n// and this specifier must reach the browser untouched so the runtime always\n// resolves from Ada's CDN. The npm build for this entry is unminified so the\n// annotations survive into the published output.\nconst defaultImportModule: ImportSdkModule = (url) =>\n\timport(/* webpackIgnore: true */ /* @vite-ignore */ url);\n\n// Keyed by import seam so production memoizes on the module-level default\n// while each injected test seam gets an isolated cache.\ninterface SdkLoaderState {\n\timports: Map<string, Promise<MessagingSdkModule>>;\n\tdefaultLoads: Map<string, Promise<MessagingSdkModule>>;\n}\n\nconst loadsByImporter = new WeakMap<ImportSdkModule, SdkLoaderState>();\n\n// Share the warning across independently bundled copies of this loader.\nconst FALLBACK_WARNING_KEY = Symbol.for(\"ada.messaging.sdk.fallbackWarning\");\nconst warningScope = globalThis as typeof globalThis & {\n\t[FALLBACK_WARNING_KEY]?: boolean;\n};\n\n// Mirrors the loopback semantics of the shared `isLoopbackHost` /\n// `validateMessagingEndpoint` (shared/utils/src/url.ts) and the bridge\n// loader's copy (packages/bridge/src/npm/loader.ts). Inlined because the\n// published loader must stay dependency-free; keep the host set in sync.\nconst LOOPBACK_HOSTS = new Set([\"localhost\", \"127.0.0.1\", \"[::1]\", \"::1\"]);\n\nfunction isLoopbackHostname(hostname: string): boolean {\n\tconst normalized = hostname.trim().toLowerCase();\n\t// `*.localhost` resolves to the loopback interface and is \"potentially\n\t// trustworthy\" per the Secure Contexts spec; no production host ends in\n\t// `.localhost`.\n\treturn LOOPBACK_HOSTS.has(normalized) || normalized.endsWith(\".localhost\");\n}\n\nfunction resolvePinnedBuildSha(pinBuildSha: string): string {\n\tconst sha = pinBuildSha.trim().toLowerCase();\n\tif (!PINNED_BUILD_SHA_PATTERN.test(sha)) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The pinBuildSha option must be a full 40-character hex git SHA: \"${pinBuildSha}\".`,\n\t\t\t\"invalid_build_sha\",\n\t\t);\n\t}\n\tif (UNSTAMPED_BUILD_SHA_PATTERN.test(sha)) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t\"The pinBuildSha option is the unstamped CDN_BUILD_SHA placeholder. Only the published npm package carries a stamped SHA; a repository or local build cannot pin a CDN build.\",\n\t\t\t\"unstamped_build_sha\",\n\t\t);\n\t}\n\treturn sha;\n}\n\n/**\n * The runtime this URL serves carries the SDK's security logic (endpoint\n * validation, session handling, the origin checks), so a cleartext transport\n * would let an on-path attacker replace it wholesale: `https:` is required,\n * with a loopback-only `http:` exception for local development.\n */\nfunction resolveSdkBootstrapUrl(\n\tcdnBase: string | undefined,\n\tpinBuildSha: string | undefined,\n): string {\n\tconst base = (cdnBase ?? DEFAULT_MESSAGING_CDN_BASE).trim();\n\t// Resolving against a base without a trailing slash would drop its last\n\t// path segment, so normalize before building the bootstrap URL.\n\tconst normalizedBase = base.endsWith(\"/\") ? base : `${base}/`;\n\tconst entryPath =\n\t\tpinBuildSha === undefined\n\t\t\t? SDK_BOOTSTRAP_FILENAME\n\t\t\t: `${resolvePinnedBuildSha(pinBuildSha)}/${PINNED_SDK_ENTRY_PATH}`;\n\tlet url: URL;\n\ttry {\n\t\turl = new URL(entryPath, normalizedBase);\n\t} catch (cause) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The cdnBase option is not a valid URL: \"${base}\".`,\n\t\t\t\"invalid_cdn_base\",\n\t\t\tcause,\n\t\t);\n\t}\n\tconst isHttps = url.protocol === \"https:\";\n\tconst isLoopbackHttp =\n\t\turl.protocol === \"http:\" && isLoopbackHostname(url.hostname);\n\tif (!isHttps && !isLoopbackHttp) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The cdnBase option must use https (plain http is allowed only for loopback hosts): \"${base}\".`,\n\t\t\t\"invalid_cdn_base\",\n\t\t);\n\t}\n\treturn url.toString();\n}\n\n// A partial CDN module (mid-deploy, or a rolled-back build missing a newer\n// export) must fail here as a typed sdk_module_invalid error, not later as a\n// TypeError on the first missing call — so every export is checked. The\n// `satisfies` clause rejects names that are not interface members; the\n// exhaustiveness type below is what forces this list to grow with it.\nconst REQUIRED_SDK_EXPORTS = [\n\t\"AdaMessagingClient\",\n\t\"createAdaEmbedInterface\",\n\t\"dispatchEmbedLoaderInitialActionQueue\",\n\t\"dispatchEmbedLoaderInitialActionQueueForAtomicHandoff\",\n\t\"mountAdaWebViewRuntime\",\n\t\"resolveAdaWebViewRuntimeAssets\",\n] as const satisfies readonly (keyof MessagingSdkModule)[];\n\n// Compile-time exhaustiveness: adding a MessagingSdkModule member without\n// listing it in REQUIRED_SDK_EXPORTS turns this type into `never`, failing\n// the `true` assignment below.\ntype AllSdkExportsListed =\n\tExclude<\n\t\tkeyof MessagingSdkModule,\n\t\t(typeof REQUIRED_SDK_EXPORTS)[number]\n\t> extends never\n\t\t? true\n\t\t: never;\nconst _allSdkExportsListed: AllSdkExportsListed = true;\nvoid _allSdkExportsListed;\n\nfunction isMessagingSdkModule(value: unknown): value is MessagingSdkModule {\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\tconst candidate = value as Record<string, unknown>;\n\treturn REQUIRED_SDK_EXPORTS.every(\n\t\t(key) => typeof candidate[key] === \"function\",\n\t);\n}\n\nasync function importSdkModule(\n\turl: string,\n\timportModule: ImportSdkModule,\n): Promise<MessagingSdkModule> {\n\tlet loaded: unknown;\n\ttry {\n\t\tloaded = await importModule(url);\n\t} catch (cause) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The Ada Messaging SDK failed to load from ${url}.`,\n\t\t\t\"sdk_import_failed\",\n\t\t\tcause,\n\t\t);\n\t}\n\tif (!isMessagingSdkModule(loaded)) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The module at ${url} does not expose the Ada Messaging SDK interface.`,\n\t\t\t\"sdk_module_invalid\",\n\t\t);\n\t}\n\treturn loaded;\n}\n\nfunction memoizeLoad(\n\tcache: Map<string, Promise<MessagingSdkModule>>,\n\turl: string,\n\tload: () => Promise<MessagingSdkModule>,\n): Promise<MessagingSdkModule> {\n\tconst existing = cache.get(url);\n\tif (existing) {\n\t\treturn existing;\n\t}\n\tconst pending = load();\n\tcache.set(url, pending);\n\tpending.catch(() => {\n\t\tif (cache.get(url) === pending) {\n\t\t\tcache.delete(url);\n\t\t}\n\t});\n\treturn pending;\n}\n\n/**\n * Load the Ada Messaging SDK module from Ada's CDN.\n *\n * The returned promise is memoized per resolved URL: concurrent and repeated\n * calls share one in-flight import. A failed load clears the memo so a later\n * call retries. Without `cdnBase`, an import failure at the default root is\n * retried once from {@link FALLBACK_MESSAGING_CDN_BASE}. Rejections are always\n * {@link MessagingSdkLoadError}.\n *\n * @example\n * const { createAdaEmbedInterface } = await loadMessagingSdk();\n */\nexport function loadMessagingSdk(\n\toptions: LoadMessagingSdkOptions = {},\n): Promise<MessagingSdkModule> {\n\tconst importModule = options.importModule ?? defaultImportModule;\n\tlet url: string;\n\tlet fallbackUrl: string | undefined;\n\ttry {\n\t\turl = resolveSdkBootstrapUrl(options.cdnBase, options.pinBuildSha);\n\t\tif (options.cdnBase === undefined) {\n\t\t\tfallbackUrl = resolveSdkBootstrapUrl(\n\t\t\t\tFALLBACK_MESSAGING_CDN_BASE,\n\t\t\t\toptions.pinBuildSha,\n\t\t\t);\n\t\t}\n\t} catch (error) {\n\t\treturn Promise.reject(error);\n\t}\n\n\tconst state = loadsByImporter.get(importModule) ?? {\n\t\timports: new Map<string, Promise<MessagingSdkModule>>(),\n\t\tdefaultLoads: new Map<string, Promise<MessagingSdkModule>>(),\n\t};\n\tloadsByImporter.set(importModule, state);\n\tconst load = (entryUrl: string) =>\n\t\tmemoizeLoad(state.imports, entryUrl, () =>\n\t\t\timportSdkModule(entryUrl, importModule),\n\t\t);\n\tif (fallbackUrl === undefined) {\n\t\treturn load(url);\n\t}\n\n\tconst retryUrl = fallbackUrl;\n\t// Keep fallback outcomes separate so explicit-root callers share the import,\n\t// but never inherit another caller's permission to retry a different root.\n\treturn memoizeLoad(state.defaultLoads, url, () =>\n\t\tload(url).catch(async (error: unknown) => {\n\t\t\tif (\n\t\t\t\t!(error instanceof MessagingSdkLoadError) ||\n\t\t\t\terror.code !== \"sdk_import_failed\"\n\t\t\t) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\t// CSP rejects import() without a network request, so this retry adds no\n\t\t\t// user-visible delay; retrying a genuine network failure once is acceptable too.\n\t\t\tlet module: MessagingSdkModule;\n\t\t\ttry {\n\t\t\t\tmodule = await load(retryUrl);\n\t\t\t} catch (cause) {\n\t\t\t\tif (!(cause instanceof MessagingSdkLoadError)) {\n\t\t\t\t\tthrow cause;\n\t\t\t\t}\n\t\t\t\tthrow new MessagingSdkLoadError(\n\t\t\t\t\tcause.code === \"sdk_import_failed\"\n\t\t\t\t\t\t? `The Ada Messaging SDK failed to load from both ${url} and ${retryUrl}.`\n\t\t\t\t\t\t: cause.message,\n\t\t\t\t\tcause.code,\n\t\t\t\t\terror,\n\t\t\t\t\tcause,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!warningScope[FALLBACK_WARNING_KEY]) {\n\t\t\t\twarningScope[FALLBACK_WARNING_KEY] = true;\n\t\t\t\tconst cause = error.cause;\n\t\t\t\t// Browsers reject blocked, unreachable, or missing imports with TypeError.\n\t\t\t\t// An evaluation-time TypeError still looks like a fetch failure, as before;\n\t\t\t\t// this heuristic narrows diagnostic noise but cannot prove the cause.\n\t\t\t\twarnHost(\n\t\t\t\t\tcause instanceof TypeError\n\t\t\t\t\t\t? `Loaded the Messaging SDK from ${FALLBACK_MESSAGING_CDN_BASE} because the default root ${DEFAULT_MESSAGING_CDN_BASE} was blocked or unavailable. Add https://messaging-assets.ada.support to script-src, connect-src and frame-src, or pass cdnBase: \"${FALLBACK_MESSAGING_CDN_BASE}\".`\n\t\t\t\t\t\t: `Loaded the Messaging SDK from ${FALLBACK_MESSAGING_CDN_BASE} because the module at ${url} failed to evaluate (${describeRejection(cause)}). This is an Ada-side problem, not your host's CSP. Report it to Ada.`,\n\t\t\t\t\tcause,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn module;\n\t\t}),\n\t);\n}\n\n// Keyed by import seam like the module memo above: production memoizes on\n// the module-level default while each injected test seam gets an isolated\n// cache. `ada` is set when the promise resolves, so the stopped-interface\n// diagnostic can consult the resolved facade without wrapping it.\ninterface StartedInterfaceMemo {\n\tpromise: Promise<AdaMessagingInterface>;\n\tsettings: AdaMessagingStartOptions;\n\tada?: AdaMessagingInterface;\n}\n\nconst startedInterfaceByImporter = new WeakMap<\n\tImportSdkModule,\n\tStartedInterfaceMemo\n>();\n\n// A rejection can be any value, including one that throws on String(); a\n// diagnostic must never turn a successful fallback into a rejected load.\nfunction describeRejection(cause: unknown): string {\n\ttry {\n\t\treturn cause instanceof Error\n\t\t\t? `${cause.name}: ${cause.message}`\n\t\t\t: String(cause);\n\t} catch {\n\t\treturn \"unknown error\";\n\t}\n}\n\n// Ungated like the runtime logger's dropped-host-value channel so host\n// configuration diagnostics remain visible without debug logging.\nfunction warnHost(message: string, cause?: unknown): void {\n\ttry {\n\t\t// biome-ignore lint/suspicious/noConsole: the loader's sanctioned host-page diagnostic sink\n\t\tconsole.warn(`[Ada] ${message}`, ...(cause === undefined ? [] : [cause]));\n\t} catch {\n\t\t// A host may replace console methods; diagnostics must not throw.\n\t}\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n}\n\n// Structural equality over the settings surface. Two functions compare equal:\n// fresh inline callbacks on a re-run (React Strict Mode effects) are not a\n// settings change worth a warning. Exotic objects compare by reference.\nfunction settingsEqual(a: unknown, b: unknown): boolean {\n\tif (Object.is(a, b)) {\n\t\treturn true;\n\t}\n\tif (typeof a === \"function\" && typeof b === \"function\") {\n\t\treturn true;\n\t}\n\tif (Array.isArray(a) && Array.isArray(b)) {\n\t\treturn (\n\t\t\ta.length === b.length &&\n\t\t\ta.every((item, index) => settingsEqual(item, b[index]))\n\t\t);\n\t}\n\tif (isPlainObject(a) && isPlainObject(b)) {\n\t\tconst aKeys = Object.keys(a);\n\t\tconst bKeys = new Set(Object.keys(b));\n\t\treturn (\n\t\t\taKeys.length === bKeys.size &&\n\t\t\taKeys.every((key) => bKeys.has(key) && settingsEqual(a[key], b[key]))\n\t\t);\n\t}\n\treturn false;\n}\n\n// Observes the facade's symbol-keyed lifecycle getter (embed-lifecycle.ts)\n// instead of wrapping stop/start, so the customer's interface is never\n// mutated; a pinned runtime that predates the getter yields no flag and the\n// stopped-interface diagnostic is skipped rather than guessed.\nfunction isInterfaceStopped(ada: AdaMessagingInterface): boolean {\n\treturn readEmbedStoppedFlag(ada) === true;\n}\n\nasync function startAdaMessaging(\n\tsettings: AdaMessagingStartOptions,\n\toptions: LoadMessagingSdkOptions,\n): Promise<AdaMessagingInterface> {\n\tconst sdkModule = await loadMessagingSdk(options);\n\tconst ada = sdkModule.createAdaEmbedInterface();\n\tawait ada.start(settings);\n\treturn ada;\n}\n\n/**\n * Load the SDK, create the messaging interface, and start the widget —\n * the npm-first equivalent of the script-tag + `window.adaSettings` setup.\n *\n * One widget per page: the returned promise is memoized, so repeated and\n * concurrent calls resolve to the same interface and the first\n * call's settings win. A failed load or start clears the memo so a later\n * call retries.\n *\n * If the bot's web chat setting is off, startup resolves without mounting the\n * widget. The interface stays memoized. Enable web chat in the\n * bot's settings before calling `start(settings)` again.\n *\n * Manage the running widget through the returned interface:\n * `stop()` tears it down and a later `start(settings)` on the same interface\n * runs again. Calling {@link loadAdaMessaging} after `stop()` returns the\n * same stopped interface without restarting it. Both memo outcomes log a\n * console warning: ignored differing settings, and a resolved interface\n * whose widget was stopped by the host.\n *\n * Never assigns the interface to `window` or any other global: the returned\n * reference is the only handle, so hold it in module scope. A reference in\n * module scope is reachable only by your own code, never by other scripts on\n * the page.\n *\n * @example\n * // module scope: your code keeps the only reference\n * const ada = await loadAdaMessaging({\n * handle: \"my-bot\",\n * enableProgrammaticControl: true,\n * });\n * await ada.sendMessage(\"Hello\");\n */\nexport function loadAdaMessaging(\n\tsettings: AdaMessagingStartOptions,\n\toptions: LoadMessagingSdkOptions = {},\n): Promise<AdaMessagingInterface> {\n\tconst importModule = options.importModule ?? defaultImportModule;\n\tconst existing = startedInterfaceByImporter.get(importModule);\n\tif (existing) {\n\t\tif (!settingsEqual(settings, existing.settings)) {\n\t\t\twarnHost(\n\t\t\t\t\"loadAdaMessaging() was already called: the new settings are ignored and the existing interface is returned. To apply new settings, call stop() then start(settings) on it.\",\n\t\t\t);\n\t\t}\n\t\tif (existing.ada && isInterfaceStopped(existing.ada)) {\n\t\t\twarnHost(\n\t\t\t\t\"loadAdaMessaging() resolved an interface whose widget was stopped and never restarts it. Call start(settings) on it to run the widget again.\",\n\t\t\t);\n\t\t}\n\t\treturn existing.promise;\n\t}\n\tconst memo: StartedInterfaceMemo = {\n\t\tpromise: startAdaMessaging(settings, options),\n\t\tsettings,\n\t};\n\tstartedInterfaceByImporter.set(importModule, memo);\n\tmemo.promise.then(\n\t\t(ada) => {\n\t\t\tmemo.ada = ada;\n\t\t},\n\t\t() => {\n\t\t\tif (startedInterfaceByImporter.get(importModule) === memo) {\n\t\t\t\tstartedInterfaceByImporter.delete(importModule);\n\t\t\t}\n\t\t},\n\t);\n\treturn memo.promise;\n}\n"],"mappings":";;;;;;;;;;;AAWA,IAAM,uBAAuB,OAAO,UAAU;AAE9C,SAAS,YACR,QACA,MACA,OACO;CACP,OAAO,eAAe,QAAQ,MAAM;EACnC;EACA,cAAc;EACd,UAAU;CACX,CAAC;AACF;AAEA,IAAI,CAAC,OAAO,QACX,YAAY,QAAQ,WAAW,QAAiB,QAAiB;CAChE,IAAI,UAAU,MACb,MAAM,IAAI,UACT,mEACD;CAED,OAAO,qBAAqB,KAAK,OAAO,MAAM,GAAG,GAAkB;AACpE,CAAC;AAGF,SAAS,GAER,OACgB;CAChB,MAAM,SAAS,KAAK,MAAM,OAAO,KAAK,MAAM,CAAC,KAAK;CAClD,IAAI,gBAAgB,KAAK,MAAM,OAAO,KAAK,CAAC,KAAK;CACjD,IAAI,gBAAgB,GACnB,iBAAiB;CAElB,OAAO,gBAAgB,KAAK,iBAAiB,SAC1C,KAAA,IACA,KAAK;AACT;AAEA,SAAS,SAAuB,OAAoC;CACnE,MAAM,QAAQ,OAAO,IAAI;CACzB,MAAM,SAAS,MAAM;CACrB,IAAI,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EAC5C;CACD;CACA,2BAA2B,IAAI,cAAc,IAAI;CACjD,KAAK,QAAQ,MACX,QAAQ;EACR,KAAK,MAAM;CACZ,SACM;EACL,IAAI,2BAA2B,IAAI,YAAY,MAAM,MACpD,2BAA2B,OAAO,YAAY;CAEhD,CACD;CACA,OAAO,KAAK;AACb"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../shared/utils/src/browser-polyfills.ts","../../src/npm/build-info.ts","../../src/client/embed-lifecycle.ts","../../src/npm/loader.ts"],"sourcesContent":["/**\n * Defence in depth for engines just below the declared browser floor.\n * The floor is defined in `messaging/vite.browser-targets.mjs`.\n *\n * Internal Ada code should prefer direct helpers, such as `hasOwn(...)` from\n * `guards.ts`. Every Ada bundle includes these fallbacks, including the host-page\n * SDK. These fallbacks also ship inside the customer-held npm tarballs of the SDK\n * and bridge. Each fallback defines a member only when it is missing. These\n * fallbacks do not extend browser support below the floor required by the shipped CSS.\n */\n\nconst objectHasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction defineValue(\n\ttarget: object,\n\tname: PropertyKey,\n\tvalue: (...args: unknown[]) => unknown,\n): void {\n\tObject.defineProperty(target, name, {\n\t\tvalue,\n\t\tconfigurable: true,\n\t\twritable: true,\n\t});\n}\n\nif (!Object.hasOwn) {\n\tdefineValue(Object, \"hasOwn\", (object: unknown, key: unknown) => {\n\t\tif (object == null) {\n\t\t\tthrow new TypeError(\n\t\t\t\t\"ada browser-polyfills: Cannot convert undefined or null to object\",\n\t\t\t);\n\t\t}\n\t\treturn objectHasOwnProperty.call(Object(object), key as PropertyKey);\n\t});\n}\n\nfunction at<T>(\n\tthis: { length: number; [index: number]: T },\n\tindex: unknown,\n): T | undefined {\n\tconst length = Math.trunc(Number(this.length)) || 0;\n\tlet relativeIndex = Math.trunc(Number(index)) || 0;\n\tif (relativeIndex < 0) {\n\t\trelativeIndex += length;\n\t}\n\treturn relativeIndex < 0 || relativeIndex >= length\n\t\t? undefined\n\t\t: this[relativeIndex];\n}\n\nfunction stringAt(this: string, index: unknown): string | undefined {\n\tconst value = String(this);\n\tconst length = value.length;\n\tlet relativeIndex = Math.trunc(Number(index)) || 0;\n\tif (relativeIndex < 0) {\n\t\trelativeIndex += length;\n\t}\n\treturn relativeIndex < 0 || relativeIndex >= length\n\t\t? undefined\n\t\t: value.charAt(relativeIndex);\n}\n\nconst typedArrayConstructors = [\n\tglobalThis.Int8Array,\n\tglobalThis.Uint8Array,\n\tglobalThis.Uint8ClampedArray,\n\tglobalThis.Int16Array,\n\tglobalThis.Uint16Array,\n\tglobalThis.Int32Array,\n\tglobalThis.Uint32Array,\n\tglobalThis.Float32Array,\n\tglobalThis.Float64Array,\n\tglobalThis.BigInt64Array,\n\tglobalThis.BigUint64Array,\n].filter(Boolean);\n\nif (!Array.prototype.at) {\n\tdefineValue(Array.prototype, \"at\", at);\n}\n\nif (!String.prototype.at) {\n\tdefineValue(String.prototype, \"at\", stringAt);\n}\n\nfor (const TypedArrayConstructor of typedArrayConstructors) {\n\tconst prototype = TypedArrayConstructor.prototype;\n\tif (!prototype.at) {\n\t\tdefineValue(prototype, \"at\", at);\n\t}\n}\n","// The repo copy carries the 40-zero placeholder; the publish workflow\n// (.github/workflows/messaging-publish-web-packages.yml) stamps the real\n// commit SHA into the built output via scripts/stamp-cdn-build-sha.mjs and\n// verifies the packed tarball before `npm publish`. Keep the placeholder as\n// a single 40-zero string literal: the stamp is a same-length text\n// replacement, so source maps stay valid.\nconst GIT_SHA_PATTERN = /^[0-9a-f]{40}$/;\nconst UNSTAMPED_SHA_PATTERN = /^0{40}$/;\n\n/**\n * Git commit SHA of the monorepo commit this npm version was published from.\n * The CDN pipeline deploys each main commit's runtime under an immutable\n * SHA root, so this value names the CDN build associated with this npm\n * version. Pass it as the `pinBuildSha` loader option to load exactly that\n * runtime build — not recommended for production (see the README).\n *\n * In the repository, and in any locally built copy, the value is the\n * unstamped 40-zero placeholder ({@link isCdnBuildShaStamped} returns\n * `false`); only published tarballs carry a real SHA.\n */\nexport const CDN_BUILD_SHA: string = \"e39b6d29bec746347832ec710147ac2c6a6d4450\";\n\n/**\n * Whether `sha` (default {@link CDN_BUILD_SHA}) is a stamped full git commit\n * SHA rather than the unstamped repo placeholder.\n */\nexport function isCdnBuildShaStamped(sha: string = CDN_BUILD_SHA): boolean {\n\tconst normalized = sha.trim().toLowerCase();\n\treturn (\n\t\tGIT_SHA_PATTERN.test(normalized) && !UNSTAMPED_SHA_PATTERN.test(normalized)\n\t);\n}\n","/**\n * Lifecycle channel between `createAdaEmbedInterface` and the npm loader's\n * memo: a non-enumerable getter over closure state, so the loader never\n * mutates the public surface and `Object.freeze` on the facade still works.\n * `Symbol.for` because the loader and the CDN runtime are separate builds;\n * a runtime that predates the getter yields `undefined` — degrade gracefully.\n */\nexport const EMBED_LIFECYCLE_STOPPED = Symbol.for(\n\t\"ada-cx/messaging-sdk/embed-stopped\",\n);\n\n/** Read the host-initiated stop flag; `undefined` when the runtime predates it. */\nexport function readEmbedStoppedFlag(ada: object): boolean | undefined {\n\tconst value = (ada as Record<symbol, unknown>)[EMBED_LIFECYCLE_STOPPED];\n\treturn typeof value === \"boolean\" ? value : undefined;\n}\n\n/** Define the getter at facade creation time, before any host freeze. */\nexport function defineEmbedStoppedFlag(\n\tada: object,\n\treadStopped: () => boolean,\n): void {\n\tObject.defineProperty(ada, EMBED_LIFECYCLE_STOPPED, {\n\t\tget: readStopped,\n\t\tenumerable: false,\n\t\tconfigurable: false,\n\t});\n}\n","import type { AdaMessagingClient } from \"../client/client\";\nimport type { AdaMessagingStartOptions } from \"../client/client-types\";\nimport type {\n\tAdaEmbedInterface,\n\tcreateAdaEmbedInterface,\n\tdispatchEmbedLoaderInitialActionQueue,\n\tdispatchEmbedLoaderInitialActionQueueForAtomicHandoff,\n} from \"../client/embed-interface\";\nimport { readEmbedStoppedFlag } from \"../client/embed-lifecycle\";\nimport type {\n\tmountAdaWebViewRuntime,\n\tresolveAdaWebViewRuntimeAssets,\n} from \"../mobile-webview-runtime\";\n\n/**\n * Production CDN root the loader resolves the SDK bootstrap from when no\n * `cdnBase` override is given. The npm package never pins a runtime version;\n * the bootstrap at this root resolves the current rollout at load time.\n */\nexport const DEFAULT_MESSAGING_CDN_BASE =\n\t\"https://messaging-assets.ada.support/\";\n\nexport const FALLBACK_MESSAGING_CDN_BASE =\n\t\"https://static.ada.support/messaging/\";\n\nconst SDK_BOOTSTRAP_FILENAME = \"sdk.js\";\n\n// The CDN pipeline deploys each main commit's runtime as an immutable\n// SHA-rooted entry (`<cdnBase>/<sha>/sdk/index.js`); the mutable `sdk.js`\n// bootstrap resolves the current rollout to one of those roots at load time.\n// A pin bypasses the bootstrap and imports one root directly.\nconst PINNED_SDK_ENTRY_PATH = \"sdk/index.js\";\n\n// Strict on purpose: the pin is interpolated into a CDN path, so only a full\n// lowercase 40-hex git SHA may pass (mirrors scripts/sdk.js's\n// VERSION_OVERRIDE_PATTERN security boundary, minus the short-SHA and pr-N\n// forms — the npm surface pins exactly what CDN_BUILD_SHA carries).\nconst PINNED_BUILD_SHA_PATTERN = /^[0-9a-f]{40}$/;\nconst UNSTAMPED_BUILD_SHA_PATTERN = /^0{40}$/;\n\n/** Why a {@link MessagingSdkLoadError} was raised. */\nexport type MessagingSdkLoadErrorCode =\n\t/**\n\t * The `cdnBase` option is not a valid `https:` URL (plain `http:` is\n\t * allowed only for loopback hosts).\n\t */\n\t| \"invalid_cdn_base\"\n\t/** The `pinBuildSha` option is not a full 40-character hex git SHA. */\n\t| \"invalid_build_sha\"\n\t/**\n\t * The `pinBuildSha` option is the unstamped 40-zero placeholder: this\n\t * copy of the package was built from the repository, not published, so\n\t * its `CDN_BUILD_SHA` names no CDN build.\n\t */\n\t| \"unstamped_build_sha\"\n\t/** The dynamic import of the CDN bootstrap failed (fetch or evaluation). */\n\t| \"sdk_import_failed\"\n\t/** The imported module does not expose the Ada Messaging SDK surface. */\n\t| \"sdk_module_invalid\";\n\n/** Typed failure raised by {@link loadMessagingSdk} and {@link loadAdaMessaging}. */\nexport class MessagingSdkLoadError extends Error {\n\treadonly code: MessagingSdkLoadErrorCode;\n\tdeclare readonly fallbackCause?: MessagingSdkLoadError;\n\n\tconstructor(\n\t\tmessage: string,\n\t\tcode: MessagingSdkLoadErrorCode,\n\t\tcause?: unknown,\n\t\tfallbackCause?: MessagingSdkLoadError,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"MessagingSdkLoadError\";\n\t\tthis.code = code;\n\t\tif (cause !== undefined) {\n\t\t\tthis.cause = cause;\n\t\t}\n\t\tif (fallbackCause !== undefined) {\n\t\t\tObject.defineProperty(this, \"fallbackCause\", {\n\t\t\t\tvalue: fallbackCause,\n\t\t\t\tenumerable: true,\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * The programmatic messaging interface {@link loadAdaMessaging} resolves. An\n * alias of the runtime's `AdaEmbedInterface`, which keeps that name because it\n * is also the legacy `window.adaEmbed` compat facade.\n * Includes `selectQuickReply(messageId, index)` for Web SDK integrations.\n */\nexport type AdaMessagingInterface = AdaEmbedInterface;\n\n/**\n * The public surface of the CDN-resolved SDK module, as loaded from\n * `<cdnBase>/sdk.js`. Types only — the implementation always comes from the\n * CDN at load time and is never part of this npm package.\n */\nexport interface MessagingSdkModule {\n\tAdaMessagingClient: typeof AdaMessagingClient;\n\tcreateAdaEmbedInterface: typeof createAdaEmbedInterface;\n\tdispatchEmbedLoaderInitialActionQueue: typeof dispatchEmbedLoaderInitialActionQueue;\n\tdispatchEmbedLoaderInitialActionQueueForAtomicHandoff: typeof dispatchEmbedLoaderInitialActionQueueForAtomicHandoff;\n\tmountAdaWebViewRuntime: typeof mountAdaWebViewRuntime;\n\tresolveAdaWebViewRuntimeAssets: typeof resolveAdaWebViewRuntimeAssets;\n}\n\ntype ImportSdkModule = (url: string) => Promise<unknown>;\n\nexport interface LoadMessagingSdkOptions {\n\t/**\n\t * CDN root to resolve `sdk.js` from. Must be an `https:` URL; plain\n\t * `http:` is accepted only for loopback hosts (`localhost`, `127.0.0.1`,\n\t * `[::1]`, `*.localhost`) during local development. Defaults to the\n\t * production root ({@link DEFAULT_MESSAGING_CDN_BASE}). An explicit value,\n\t * including {@link FALLBACK_MESSAGING_CDN_BASE}, disables the automatic\n\t * static-root fallback.\n\t */\n\tcdnBase?: string;\n\t/**\n\t * Full 40-character git commit SHA of a deployed CDN build. When set, the\n\t * loader skips the rollout bootstrap and imports that build's immutable\n\t * entry (`<cdnBase>/<sha>/sdk/index.js`) directly. Pass the package's\n\t * `CDN_BUILD_SHA` export to pin the build associated with this npm\n\t * version. NOT recommended for production: a pinned runtime misses Ada's\n\t * fixes and rollouts, and may predate server contract changes. Composes\n\t * with `cdnBase` for staged validation.\n\t */\n\tpinBuildSha?: string;\n\t/**\n\t * Import seam for unit tests. Defaults to a native dynamic `import()` of\n\t * the resolved bootstrap URL.\n\t */\n\timportModule?: ImportSdkModule;\n}\n\n// Both annotations are load-bearing: bundlers rewrite bare dynamic imports,\n// and this specifier must reach the browser untouched so the runtime always\n// resolves from Ada's CDN. The npm build for this entry is unminified so the\n// annotations survive into the published output.\nconst defaultImportModule: ImportSdkModule = (url) =>\n\timport(/* webpackIgnore: true */ /* @vite-ignore */ url);\n\n// Keyed by import seam so production memoizes on the module-level default\n// while each injected test seam gets an isolated cache.\ninterface SdkLoaderState {\n\timports: Map<string, Promise<MessagingSdkModule>>;\n\tdefaultLoads: Map<string, Promise<MessagingSdkModule>>;\n}\n\nconst loadsByImporter = new WeakMap<ImportSdkModule, SdkLoaderState>();\n\n// Share the warning across independently bundled copies of this loader.\nconst FALLBACK_WARNING_KEY = Symbol.for(\"ada.messaging.sdk.fallbackWarning\");\nconst warningScope = globalThis as typeof globalThis & {\n\t[FALLBACK_WARNING_KEY]?: boolean;\n};\n\n// Mirrors the loopback semantics of the shared `isLoopbackHost` /\n// `validateMessagingEndpoint` (shared/utils/src/url.ts) and the bridge\n// loader's copy (packages/bridge/src/npm/loader.ts). Inlined because the\n// published loader must stay dependency-free; keep the host set in sync.\nconst LOOPBACK_HOSTS = new Set([\"localhost\", \"127.0.0.1\", \"[::1]\", \"::1\"]);\n\nfunction isLoopbackHostname(hostname: string): boolean {\n\tconst normalized = hostname.trim().toLowerCase();\n\t// `*.localhost` resolves to the loopback interface and is \"potentially\n\t// trustworthy\" per the Secure Contexts spec; no production host ends in\n\t// `.localhost`.\n\treturn LOOPBACK_HOSTS.has(normalized) || normalized.endsWith(\".localhost\");\n}\n\nfunction resolvePinnedBuildSha(pinBuildSha: string): string {\n\tconst sha = pinBuildSha.trim().toLowerCase();\n\tif (!PINNED_BUILD_SHA_PATTERN.test(sha)) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The pinBuildSha option must be a full 40-character hex git SHA: \"${pinBuildSha}\".`,\n\t\t\t\"invalid_build_sha\",\n\t\t);\n\t}\n\tif (UNSTAMPED_BUILD_SHA_PATTERN.test(sha)) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t\"The pinBuildSha option is the unstamped CDN_BUILD_SHA placeholder. Only the published npm package carries a stamped SHA; a repository or local build cannot pin a CDN build.\",\n\t\t\t\"unstamped_build_sha\",\n\t\t);\n\t}\n\treturn sha;\n}\n\n/**\n * The runtime this URL serves carries the SDK's security logic (endpoint\n * validation, session handling, the origin checks), so a cleartext transport\n * would let an on-path attacker replace it wholesale: `https:` is required,\n * with a loopback-only `http:` exception for local development.\n */\nfunction resolveSdkBootstrapUrl(\n\tcdnBase: string | undefined,\n\tpinBuildSha: string | undefined,\n): string {\n\tconst base = (cdnBase ?? DEFAULT_MESSAGING_CDN_BASE).trim();\n\t// Resolving against a base without a trailing slash would drop its last\n\t// path segment, so normalize before building the bootstrap URL.\n\tconst normalizedBase = base.endsWith(\"/\") ? base : `${base}/`;\n\tconst entryPath =\n\t\tpinBuildSha === undefined\n\t\t\t? SDK_BOOTSTRAP_FILENAME\n\t\t\t: `${resolvePinnedBuildSha(pinBuildSha)}/${PINNED_SDK_ENTRY_PATH}`;\n\tlet url: URL;\n\ttry {\n\t\turl = new URL(entryPath, normalizedBase);\n\t} catch (cause) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The cdnBase option is not a valid URL: \"${base}\".`,\n\t\t\t\"invalid_cdn_base\",\n\t\t\tcause,\n\t\t);\n\t}\n\tconst isHttps = url.protocol === \"https:\";\n\tconst isLoopbackHttp =\n\t\turl.protocol === \"http:\" && isLoopbackHostname(url.hostname);\n\tif (!isHttps && !isLoopbackHttp) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The cdnBase option must use https (plain http is allowed only for loopback hosts): \"${base}\".`,\n\t\t\t\"invalid_cdn_base\",\n\t\t);\n\t}\n\treturn url.toString();\n}\n\n// A partial CDN module (mid-deploy, or a rolled-back build missing a newer\n// export) must fail here as a typed sdk_module_invalid error, not later as a\n// TypeError on the first missing call — so every export is checked. The\n// `satisfies` clause rejects names that are not interface members; the\n// exhaustiveness type below is what forces this list to grow with it.\nconst REQUIRED_SDK_EXPORTS = [\n\t\"AdaMessagingClient\",\n\t\"createAdaEmbedInterface\",\n\t\"dispatchEmbedLoaderInitialActionQueue\",\n\t\"dispatchEmbedLoaderInitialActionQueueForAtomicHandoff\",\n\t\"mountAdaWebViewRuntime\",\n\t\"resolveAdaWebViewRuntimeAssets\",\n] as const satisfies readonly (keyof MessagingSdkModule)[];\n\n// Compile-time exhaustiveness: adding a MessagingSdkModule member without\n// listing it in REQUIRED_SDK_EXPORTS turns this type into `never`, failing\n// the `true` assignment below.\ntype AllSdkExportsListed =\n\tExclude<\n\t\tkeyof MessagingSdkModule,\n\t\t(typeof REQUIRED_SDK_EXPORTS)[number]\n\t> extends never\n\t\t? true\n\t\t: never;\nconst _allSdkExportsListed: AllSdkExportsListed = true;\nvoid _allSdkExportsListed;\n\nfunction isMessagingSdkModule(value: unknown): value is MessagingSdkModule {\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\tconst candidate = value as Record<string, unknown>;\n\treturn REQUIRED_SDK_EXPORTS.every(\n\t\t(key) => typeof candidate[key] === \"function\",\n\t);\n}\n\nasync function importSdkModule(\n\turl: string,\n\timportModule: ImportSdkModule,\n): Promise<MessagingSdkModule> {\n\tlet loaded: unknown;\n\ttry {\n\t\tloaded = await importModule(url);\n\t} catch (cause) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The Ada Messaging SDK failed to load from ${url}.`,\n\t\t\t\"sdk_import_failed\",\n\t\t\tcause,\n\t\t);\n\t}\n\tif (!isMessagingSdkModule(loaded)) {\n\t\tthrow new MessagingSdkLoadError(\n\t\t\t`The module at ${url} does not expose the Ada Messaging SDK interface.`,\n\t\t\t\"sdk_module_invalid\",\n\t\t);\n\t}\n\treturn loaded;\n}\n\nfunction memoizeLoad(\n\tcache: Map<string, Promise<MessagingSdkModule>>,\n\turl: string,\n\tload: () => Promise<MessagingSdkModule>,\n): Promise<MessagingSdkModule> {\n\tconst existing = cache.get(url);\n\tif (existing) {\n\t\treturn existing;\n\t}\n\tconst pending = load();\n\tcache.set(url, pending);\n\tpending.catch(() => {\n\t\tif (cache.get(url) === pending) {\n\t\t\tcache.delete(url);\n\t\t}\n\t});\n\treturn pending;\n}\n\n/**\n * Load the Ada Messaging SDK module from Ada's CDN.\n *\n * The returned promise is memoized per resolved URL: concurrent and repeated\n * calls share one in-flight import. A failed load clears the memo so a later\n * call retries. Without `cdnBase`, an import failure at the default root is\n * retried once from {@link FALLBACK_MESSAGING_CDN_BASE}. Rejections are always\n * {@link MessagingSdkLoadError}.\n *\n * @example\n * const { createAdaEmbedInterface } = await loadMessagingSdk();\n */\nexport function loadMessagingSdk(\n\toptions: LoadMessagingSdkOptions = {},\n): Promise<MessagingSdkModule> {\n\tconst importModule = options.importModule ?? defaultImportModule;\n\tlet url: string;\n\tlet fallbackUrl: string | undefined;\n\ttry {\n\t\turl = resolveSdkBootstrapUrl(options.cdnBase, options.pinBuildSha);\n\t\tif (options.cdnBase === undefined) {\n\t\t\tfallbackUrl = resolveSdkBootstrapUrl(\n\t\t\t\tFALLBACK_MESSAGING_CDN_BASE,\n\t\t\t\toptions.pinBuildSha,\n\t\t\t);\n\t\t}\n\t} catch (error) {\n\t\treturn Promise.reject(error);\n\t}\n\n\tconst state = loadsByImporter.get(importModule) ?? {\n\t\timports: new Map<string, Promise<MessagingSdkModule>>(),\n\t\tdefaultLoads: new Map<string, Promise<MessagingSdkModule>>(),\n\t};\n\tloadsByImporter.set(importModule, state);\n\tconst load = (entryUrl: string) =>\n\t\tmemoizeLoad(state.imports, entryUrl, () =>\n\t\t\timportSdkModule(entryUrl, importModule),\n\t\t);\n\tif (fallbackUrl === undefined) {\n\t\treturn load(url);\n\t}\n\n\tconst retryUrl = fallbackUrl;\n\t// Keep fallback outcomes separate so explicit-root callers share the import,\n\t// but never inherit another caller's permission to retry a different root.\n\treturn memoizeLoad(state.defaultLoads, url, () =>\n\t\tload(url).catch(async (error: unknown) => {\n\t\t\tif (\n\t\t\t\t!(error instanceof MessagingSdkLoadError) ||\n\t\t\t\terror.code !== \"sdk_import_failed\"\n\t\t\t) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\t// CSP rejects import() without a network request, so this retry adds no\n\t\t\t// user-visible delay; retrying a genuine network failure once is acceptable too.\n\t\t\tlet module: MessagingSdkModule;\n\t\t\ttry {\n\t\t\t\tmodule = await load(retryUrl);\n\t\t\t} catch (cause) {\n\t\t\t\tif (!(cause instanceof MessagingSdkLoadError)) {\n\t\t\t\t\tthrow cause;\n\t\t\t\t}\n\t\t\t\tthrow new MessagingSdkLoadError(\n\t\t\t\t\tcause.code === \"sdk_import_failed\"\n\t\t\t\t\t\t? `The Ada Messaging SDK failed to load from both ${url} and ${retryUrl}.`\n\t\t\t\t\t\t: cause.message,\n\t\t\t\t\tcause.code,\n\t\t\t\t\terror,\n\t\t\t\t\tcause,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!warningScope[FALLBACK_WARNING_KEY]) {\n\t\t\t\twarningScope[FALLBACK_WARNING_KEY] = true;\n\t\t\t\tconst cause = error.cause;\n\t\t\t\t// Browsers reject blocked, unreachable, or missing imports with TypeError.\n\t\t\t\t// An evaluation-time TypeError still looks like a fetch failure, as before;\n\t\t\t\t// this heuristic narrows diagnostic noise but cannot prove the cause.\n\t\t\t\twarnHost(\n\t\t\t\t\tcause instanceof TypeError\n\t\t\t\t\t\t? `Loaded the Messaging SDK from ${FALLBACK_MESSAGING_CDN_BASE} because the default root ${DEFAULT_MESSAGING_CDN_BASE} was blocked or unavailable. Add https://messaging-assets.ada.support to script-src, connect-src and frame-src, or pass cdnBase: \"${FALLBACK_MESSAGING_CDN_BASE}\".`\n\t\t\t\t\t\t: `Loaded the Messaging SDK from ${FALLBACK_MESSAGING_CDN_BASE} because the module at ${url} failed to evaluate (${describeRejection(cause)}). This is an Ada-side problem, not your host's CSP. Report it to Ada.`,\n\t\t\t\t\tcause,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn module;\n\t\t}),\n\t);\n}\n\n// Keyed by import seam like the module memo above: production memoizes on\n// the module-level default while each injected test seam gets an isolated\n// cache. `ada` is set when the promise resolves, so the stopped-interface\n// diagnostic can consult the resolved facade without wrapping it.\ninterface StartedInterfaceMemo {\n\tpromise: Promise<AdaMessagingInterface>;\n\tsettings: AdaMessagingStartOptions;\n\tada?: AdaMessagingInterface;\n}\n\nconst startedInterfaceByImporter = new WeakMap<\n\tImportSdkModule,\n\tStartedInterfaceMemo\n>();\n\n// A rejection can be any value, including one that throws on String(); a\n// diagnostic must never turn a successful fallback into a rejected load.\nfunction describeRejection(cause: unknown): string {\n\ttry {\n\t\treturn cause instanceof Error\n\t\t\t? `${cause.name}: ${cause.message}`\n\t\t\t: String(cause);\n\t} catch {\n\t\treturn \"unknown error\";\n\t}\n}\n\n// Ungated like the runtime logger's dropped-host-value channel so host\n// configuration diagnostics remain visible without debug logging.\nfunction warnHost(message: string, cause?: unknown): void {\n\ttry {\n\t\t// biome-ignore lint/suspicious/noConsole: the loader's sanctioned host-page diagnostic sink\n\t\tconsole.warn(`[Ada] ${message}`, ...(cause === undefined ? [] : [cause]));\n\t} catch {\n\t\t// A host may replace console methods; diagnostics must not throw.\n\t}\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n}\n\n// Structural equality over the settings surface. Two functions compare equal:\n// fresh inline callbacks on a re-run (React Strict Mode effects) are not a\n// settings change worth a warning. Exotic objects compare by reference.\nfunction settingsEqual(a: unknown, b: unknown): boolean {\n\tif (Object.is(a, b)) {\n\t\treturn true;\n\t}\n\tif (typeof a === \"function\" && typeof b === \"function\") {\n\t\treturn true;\n\t}\n\tif (Array.isArray(a) && Array.isArray(b)) {\n\t\treturn (\n\t\t\ta.length === b.length &&\n\t\t\ta.every((item, index) => settingsEqual(item, b[index]))\n\t\t);\n\t}\n\tif (isPlainObject(a) && isPlainObject(b)) {\n\t\tconst aKeys = Object.keys(a);\n\t\tconst bKeys = new Set(Object.keys(b));\n\t\treturn (\n\t\t\taKeys.length === bKeys.size &&\n\t\t\taKeys.every((key) => bKeys.has(key) && settingsEqual(a[key], b[key]))\n\t\t);\n\t}\n\treturn false;\n}\n\n// Observes the facade's symbol-keyed lifecycle getter (embed-lifecycle.ts)\n// instead of wrapping stop/start, so the customer's interface is never\n// mutated; a pinned runtime that predates the getter yields no flag and the\n// stopped-interface diagnostic is skipped rather than guessed.\nfunction isInterfaceStopped(ada: AdaMessagingInterface): boolean {\n\treturn readEmbedStoppedFlag(ada) === true;\n}\n\nasync function startAdaMessaging(\n\tsettings: AdaMessagingStartOptions,\n\toptions: LoadMessagingSdkOptions,\n): Promise<AdaMessagingInterface> {\n\tconst sdkModule = await loadMessagingSdk(options);\n\tconst ada = sdkModule.createAdaEmbedInterface();\n\tawait ada.start(settings);\n\treturn ada;\n}\n\n/**\n * Load the SDK, create the messaging interface, and start the widget —\n * the npm-first equivalent of the script-tag + `window.adaSettings` setup.\n *\n * One widget per page: the returned promise is memoized, so repeated and\n * concurrent calls resolve to the same interface and the first\n * call's settings win. A failed load or start clears the memo so a later\n * call retries.\n *\n * If the bot's web chat setting is off, startup resolves without mounting the\n * widget. The interface stays memoized. Enable web chat in the\n * bot's settings before calling `start(settings)` again.\n *\n * Manage the running widget through the returned interface:\n * `stop()` tears it down and a later `start(settings)` on the same interface\n * runs again. Calling {@link loadAdaMessaging} after `stop()` returns the\n * same stopped interface without restarting it. Both memo outcomes log a\n * console warning: ignored differing settings, and a resolved interface\n * whose widget was stopped by the host.\n *\n * Never assigns the interface to `window` or any other global: the returned\n * reference is the only handle, so hold it in module scope. A reference in\n * module scope is reachable only by your own code, never by other scripts on\n * the page.\n *\n * @example\n * // module scope: your code keeps the only reference\n * const ada = await loadAdaMessaging({\n * handle: \"my-bot\",\n * enableProgrammaticControl: true,\n * });\n * await ada.sendMessage(\"Hello\");\n */\nexport function loadAdaMessaging(\n\tsettings: AdaMessagingStartOptions,\n\toptions: LoadMessagingSdkOptions = {},\n): Promise<AdaMessagingInterface> {\n\tconst importModule = options.importModule ?? defaultImportModule;\n\tconst existing = startedInterfaceByImporter.get(importModule);\n\tif (existing) {\n\t\tif (!settingsEqual(settings, existing.settings)) {\n\t\t\twarnHost(\n\t\t\t\t\"loadAdaMessaging() was already called: the new settings are ignored and the existing interface is returned. To apply new settings, call stop() then start(settings) on it.\",\n\t\t\t);\n\t\t}\n\t\tif (existing.ada && isInterfaceStopped(existing.ada)) {\n\t\t\twarnHost(\n\t\t\t\t\"loadAdaMessaging() resolved an interface whose widget was stopped and never restarts it. Call start(settings) on it to run the widget again.\",\n\t\t\t);\n\t\t}\n\t\treturn existing.promise;\n\t}\n\tconst memo: StartedInterfaceMemo = {\n\t\tpromise: startAdaMessaging(settings, options),\n\t\tsettings,\n\t};\n\tstartedInterfaceByImporter.set(importModule, memo);\n\tmemo.promise.then(\n\t\t(ada) => {\n\t\t\tmemo.ada = ada;\n\t\t},\n\t\t() => {\n\t\t\tif (startedInterfaceByImporter.get(importModule) === memo) {\n\t\t\t\tstartedInterfaceByImporter.delete(importModule);\n\t\t\t}\n\t\t},\n\t);\n\treturn memo.promise;\n}\n"],"mappings":";;;;;;;;;;;AAWA,IAAM,uBAAuB,OAAO,UAAU;AAE9C,SAAS,YACR,QACA,MACA,OACO;CACP,OAAO,eAAe,QAAQ,MAAM;EACnC;EACA,cAAc;EACd,UAAU;CACX,CAAC;AACF;AAEA,IAAI,CAAC,OAAO,QACX,YAAY,QAAQ,WAAW,QAAiB,QAAiB;CAChE,IAAI,UAAU,MACb,MAAM,IAAI,UACT,mEACD;CAED,OAAO,qBAAqB,KAAK,OAAO,MAAM,GAAG,GAAkB;AACpE,CAAC;AAGF,SAAS,GAER,OACgB;CAChB,MAAM,SAAS,KAAK,MAAM,OAAO,KAAK,MAAM,CAAC,KAAK;CAClD,IAAI,gBAAgB,KAAK,MAAM,OAAO,KAAK,CAAC,KAAK;CACjD,IAAI,gBAAgB,GACnB,iBAAiB;CAElB,OAAO,gBAAgB,KAAK,iBAAiB,SAC1C,KAAA,IACA,KAAK;AACT;AAEA,SAAS,SAAuB,OAAoC;CACnE,MAAM,QAAQ,OAAO,IAAI;CACzB,MAAM,SAAS,MAAM;CACrB,IAAI,gBAAgB,KAAK,MAAM,OAAO,KAAK,CAAC,KAAK;CACjD,IAAI,gBAAgB,GACnB,iBAAiB;CAElB,OAAO,gBAAgB,KAAK,iBAAiB,SAC1C,KAAA,IACA,MAAM,OAAO,aAAa;AAC9B;AAEA,IAAM,yBAAyB;CAC9B,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;AACZ,CAAC,CAAC,OAAO,OAAO;AAEhB,IAAI,CAAC,MAAM,UAAU,IACpB,YAAY,MAAM,WAAW,MAAM,EAAE;AAGtC,IAAI,CAAC,OAAO,UAAU,IACrB,YAAY,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AAQ,OAAO,KAAK,CAAC;EAC3B,MAAM,QAAQ,IAAI,IAAI,OAAO,KAAK,CAAC,CAAC;EACpC,OACC,MAAM,WAAW,MAAM,QACvB,MAAM,OAAO,QAAQ,MAAM,IAAI,GAAG,KAAK,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC;CAEtE;CACA,OAAO;AACR;AAMA,SAAS,mBAAmB,KAAqC;CAChE,OAAO,qBAAqB,GAAG,MAAM;AACtC;AAEA,eAAe,kBACd,UACA,SACiC;CAEjC,MAAM,OAAM,MADY,iBAAiB,OAAO,EAAA,CAC1B,wBAAwB;CAC9C,MAAM,IAAI,MAAM,QAAQ;CACxB,OAAO;AACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAgB,iBACf,UACA,UAAmC,CAAC,GACH;CACjC,MAAM,eAAe,QAAQ,gBAAgB;CAC7C,MAAM,WAAW,2BAA2B,IAAI,YAAY;CAC5D,IAAI,UAAU;EACb,IAAI,CAAC,cAAc,UAAU,SAAS,QAAQ,GAC7C,SACC,4KACD;EAED,IAAI,SAAS,OAAO,mBAAmB,SAAS,GAAG,GAClD,SACC,8IACD;EAED,OAAO,SAAS;CACjB;CACA,MAAM,OAA6B;EAClC,SAAS,kBAAkB,UAAU,OAAO;EAC5C;CACD;CACA,2BAA2B,IAAI,cAAc,IAAI;CACjD,KAAK,QAAQ,MACX,QAAQ;EACR,KAAK,MAAM;CACZ,SACM;EACL,IAAI,2BAA2B,IAAI,YAAY,MAAM,MACpD,2BAA2B,OAAO,YAAY;CAEhD,CACD;CACA,OAAO,KAAK;AACb"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ada-cx/messaging-sdk",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.9",
|
|
4
4
|
"description": "TypeScript types, test mocks, and a thin CDN loader for the Ada Messaging SDK. The runtime always resolves from Ada's CDN and is never bundled into this package.",
|
|
5
5
|
"homepage": "https://docs.ada.cx",
|
|
6
6
|
"keywords": [
|