@ada-cx/messaging-sdk 1.0.0-setup.0
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/README.md +211 -0
- package/dist/client/ada-settings-reader.d.ts +10 -0
- package/dist/client/client-channel-handlers.d.ts +92 -0
- package/dist/client/client-errors.d.ts +7 -0
- package/dist/client/client-frame-constants.d.ts +41 -0
- package/dist/client/client-frame-runtime.d.ts +54 -0
- package/dist/client/client-host-runtime.d.ts +73 -0
- package/dist/client/client-types.d.ts +231 -0
- package/dist/client/client.d.ts +843 -0
- package/dist/client/config-helpers.d.ts +157 -0
- package/dist/client/constants.d.ts +61 -0
- package/dist/client/core-channel-test-harness.d.ts +47 -0
- package/dist/client/embed-interface.d.ts +172 -0
- package/dist/client/embed-lifecycle.d.ts +12 -0
- package/dist/client/fallback-html.d.ts +1 -0
- package/dist/client/frame-manager.d.ts +64 -0
- package/dist/client/frame-styles.d.ts +164 -0
- package/dist/client/frame-visibility.d.ts +53 -0
- package/dist/client/integration-manager.d.ts +73 -0
- package/dist/client/legacy-callback-adapter.d.ts +22 -0
- package/dist/client/mask-element.d.ts +19 -0
- package/dist/client/proactive/index.d.ts +5 -0
- package/dist/client/proactive/proactive-channel.d.ts +33 -0
- package/dist/client/proactive/proactive-runtime.d.ts +65 -0
- package/dist/client/proactive/proactive-utils.d.ts +51 -0
- package/dist/client/sdk-error-reporter.d.ts +22 -0
- package/dist/client/sdk-event-bus.d.ts +116 -0
- package/dist/client/service-worker-notifications.d.ts +1 -0
- package/dist/client/url-business-events.d.ts +19 -0
- package/dist/frame-channel/frame-channel.d.ts +64 -0
- package/dist/frame-channel/frame-child.d.ts +45 -0
- package/dist/frame-channel/index.d.ts +3 -0
- package/dist/frame-channel/types.d.ts +736 -0
- package/dist/helpers/rollout.d.ts +18 -0
- package/dist/host-telemetry.d.ts +15 -0
- package/dist/index.d.ts +8 -0
- package/dist/logger.d.ts +59 -0
- package/dist/mobile-webview-runtime.d.ts +122 -0
- package/dist/npm/build-info.d.cts +17 -0
- package/dist/npm/build-info.d.ts +17 -0
- package/dist/npm/index.cjs +276 -0
- package/dist/npm/index.cjs.map +1 -0
- package/dist/npm/index.d.cts +15 -0
- package/dist/npm/index.d.ts +9 -0
- package/dist/npm/index.js +270 -0
- package/dist/npm/index.js.map +1 -0
- package/dist/npm/loader.d.cts +120 -0
- package/dist/npm/loader.d.ts +120 -0
- package/dist/npm/testing.cjs +155 -0
- package/dist/npm/testing.cjs.map +1 -0
- package/dist/npm/testing.d.cts +39 -0
- package/dist/npm/testing.d.ts +39 -0
- package/dist/npm/testing.js +154 -0
- package/dist/npm/testing.js.map +1 -0
- package/dist/sdk-module-loader.d.ts +1 -0
- package/dist/shared-utils/clusters.d.ts +5 -0
- package/dist/shared-utils/csat.d.ts +116 -0
- package/dist/shared-utils/host-telemetry.d.ts +35 -0
- package/dist/shared-utils/index.d.ts +3 -0
- package/dist/voice/voice-manager.d.ts +120 -0
- package/package.json +77 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { FrameMessage } from "./types.js";
|
|
2
|
+
type MessageHandler = (message: FrameMessage) => void;
|
|
3
|
+
/**
|
|
4
|
+
* Type-safe postMessage wrapper for cross-iframe communication.
|
|
5
|
+
*
|
|
6
|
+
* Each FrameChannel instance manages communication with a single
|
|
7
|
+
* iframe, tracking its origin for secure message targeting and
|
|
8
|
+
* supporting request/response correlation via UUIDs.
|
|
9
|
+
*/
|
|
10
|
+
export declare class FrameChannel {
|
|
11
|
+
private _name;
|
|
12
|
+
private _target;
|
|
13
|
+
private _targetOrigin;
|
|
14
|
+
private _expectedIncomingName;
|
|
15
|
+
private _pendingMessages;
|
|
16
|
+
private _handlers;
|
|
17
|
+
private _pendingRequests;
|
|
18
|
+
private _boundListener;
|
|
19
|
+
private _lastOverflowEventMs;
|
|
20
|
+
constructor(name: string);
|
|
21
|
+
private _normalizeMessageName;
|
|
22
|
+
/**
|
|
23
|
+
* Connect to a target window (the iframe's contentWindow)
|
|
24
|
+
* and begin listening for incoming messages.
|
|
25
|
+
*/
|
|
26
|
+
connect(target: Window, targetOrigin?: string, expectedIncomingName?: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Stop listening and release the target reference.
|
|
29
|
+
*/
|
|
30
|
+
disconnect(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Update the target origin for secure message delivery.
|
|
33
|
+
* Call this once the iframe reports its actual origin.
|
|
34
|
+
*/
|
|
35
|
+
setTargetOrigin(origin: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Send a message to the connected iframe.
|
|
38
|
+
* Uses structured clone (native objects) instead of JSON serialization.
|
|
39
|
+
*/
|
|
40
|
+
send<T = unknown>(type: string, payload?: T): void;
|
|
41
|
+
/**
|
|
42
|
+
* Send a request and wait for a correlated response.
|
|
43
|
+
*
|
|
44
|
+
* Returns a Promise that resolves when a message with a matching
|
|
45
|
+
* `id` is received, or rejects after `timeoutMs`.
|
|
46
|
+
*/
|
|
47
|
+
request<TReq = unknown, TRes = unknown>(requestType: string, responseType: string, payload?: TReq, timeoutMs?: number): Promise<FrameMessage<TRes>>;
|
|
48
|
+
/**
|
|
49
|
+
* Register a handler for a specific message type.
|
|
50
|
+
*/
|
|
51
|
+
on(type: string, handler: MessageHandler): void;
|
|
52
|
+
/**
|
|
53
|
+
* Remove a specific handler for a message type.
|
|
54
|
+
*/
|
|
55
|
+
off(type: string, handler: MessageHandler): void;
|
|
56
|
+
/**
|
|
57
|
+
* Register a one-time handler that auto-removes after first invocation.
|
|
58
|
+
*/
|
|
59
|
+
once(type: string, handler: MessageHandler): void;
|
|
60
|
+
private _handleMessage;
|
|
61
|
+
private _queuePendingMessage;
|
|
62
|
+
private _flushPendingMessages;
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightweight frame-side helper for child iframes to communicate
|
|
3
|
+
* with the parent SDK via postMessage.
|
|
4
|
+
*
|
|
5
|
+
* This is used by frame-side TypeScript entry points and keeps
|
|
6
|
+
* origin normalization aligned with the shared utility package.
|
|
7
|
+
*/
|
|
8
|
+
interface FrameMessage<T = unknown> {
|
|
9
|
+
name: string;
|
|
10
|
+
type: string;
|
|
11
|
+
payload: T;
|
|
12
|
+
id?: string;
|
|
13
|
+
}
|
|
14
|
+
type MessageHandler = (message: FrameMessage) => void;
|
|
15
|
+
export declare class FrameChild {
|
|
16
|
+
private _name;
|
|
17
|
+
private _parentOrigin;
|
|
18
|
+
private _expectedParentName;
|
|
19
|
+
private _handlers;
|
|
20
|
+
private _boundListener;
|
|
21
|
+
private _pendingMessages;
|
|
22
|
+
constructor(name: string, expectedParentName?: string | null);
|
|
23
|
+
/** Report our origin to the parent SDK */
|
|
24
|
+
reportOrigin(): void;
|
|
25
|
+
/** Signal to the parent SDK that this frame is ready */
|
|
26
|
+
signalReady(): void;
|
|
27
|
+
/** Report an error to the parent SDK */
|
|
28
|
+
reportError(error: string): void;
|
|
29
|
+
/** Send a message to the parent window using structured clone */
|
|
30
|
+
send<T = unknown>(type: string, payload?: T, id?: string): void;
|
|
31
|
+
/** Reply to a specific request by echoing its id */
|
|
32
|
+
reply<T = unknown>(originalMessage: FrameMessage, type: string, payload?: T): void;
|
|
33
|
+
/** Register a handler for a specific message type */
|
|
34
|
+
on(type: string, handler: MessageHandler): void;
|
|
35
|
+
/** Remove a handler */
|
|
36
|
+
off(type: string, handler: MessageHandler): void;
|
|
37
|
+
/** Set the allowed parent origin for outgoing messages */
|
|
38
|
+
setParentOrigin(origin: string): void;
|
|
39
|
+
private static _normalizeName;
|
|
40
|
+
/** Remove the message listener and clean up handlers */
|
|
41
|
+
destroy(): void;
|
|
42
|
+
private _flushPendingMessages;
|
|
43
|
+
private _handleMessage;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { FrameChannel } from "./frame-channel.js";
|
|
2
|
+
export { FrameChild } from "./frame-child.js";
|
|
3
|
+
export type { ClearPersistenceAckResponseType, FrameMessage, FrameName, FrameRegistry, FrameToSdkEvents, SdkToFrameEvents, StartupConfig, StartupConfigFallbackUi, StartupConfigIntro, StartupConfigProactiveConversation, } from "./types.js";
|