@ada-support/embed2 1.0.28 → 1.0.32
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/npm-entry/client/components/ButtonFrame/index.d.ts +4 -1
- package/dist/npm-entry/client/components/ChatFrame/index.d.ts +3 -2
- package/dist/npm-entry/client/components/Container/index.d.ts +3 -2
- package/dist/npm-entry/client/components/IFrame/index.d.ts +2 -2
- package/dist/npm-entry/client/components/IntroFrame/index.d.ts +2 -1
- package/dist/npm-entry/client/components/MaskFrame/index.d.ts +2 -1
- package/dist/npm-entry/client/components/XStorageFrame/index.d.ts +2 -1
- package/dist/npm-entry/client/index.d.ts +1 -1
- package/dist/npm-entry/client/lib/ce.d.ts +1 -1
- package/dist/npm-entry/client/lib/connect.d.ts +2 -2
- package/dist/npm-entry/client/lib/contexts.d.ts +2 -1
- package/dist/npm-entry/client/lib/message-service.d.ts +0 -1
- package/dist/npm-entry/client/lib/store-proxy.d.ts +3 -4
- package/dist/npm-entry/common/constants/storage-keys.d.ts +6 -1
- package/dist/npm-entry/common/helpers/getAlignment.d.ts +2 -0
- package/dist/npm-entry/common/helpers/isRTL.d.ts +1 -0
- package/dist/npm-entry/common/lib/ConnectContainer/index.d.ts +9 -9
- package/dist/npm-entry/common/lib/channel.d.ts +1 -1
- package/dist/npm-entry/common/lib/fc/index.d.ts +2 -2
- package/dist/npm-entry/common/types/channels.d.ts +1 -1
- package/dist/npm-entry/common/types/store-state.d.ts +36 -31
- package/dist/npm-entry/common/types/store.d.ts +3 -3
- package/dist/npm-entry/frames/components/x-storage/index.d.ts +12 -0
- package/dist/npm-entry/frames/helpers/frame-init.d.ts +3 -0
- package/dist/npm-entry/frames/helpers/storage/index.d.ts +1 -1
- package/dist/npm-entry/frames/lib/error-tracker.d.ts +6 -0
- package/dist/npm-entry/frames/lib/frame-fc.d.ts +3 -0
- package/dist/npm-entry/frames/lib/safe-storage/index.d.ts +8 -4
- package/dist/npm-entry/frames/lib/store-proxy.d.ts +2 -0
- package/dist/npm-entry/index.js +1192 -535
- package/package.json +6 -5
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { h } from "preact";
|
|
2
|
+
import { StartOptions } from "common/types/store-state";
|
|
1
3
|
interface OwnProps {
|
|
2
4
|
frameWidth: number;
|
|
5
|
+
adaSettings: StartOptions;
|
|
3
6
|
}
|
|
4
|
-
declare const _default:
|
|
7
|
+
declare const _default: (ownProps: OwnProps) => h.JSX.Element;
|
|
5
8
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { h } from "preact";
|
|
1
2
|
import MessageService from "client/lib/message-service";
|
|
2
|
-
import StoreProxy from "client/lib/store-proxy";
|
|
3
|
+
import type { StoreProxy } from "client/lib/store-proxy";
|
|
3
4
|
import { Module } from "common/types/modules";
|
|
4
5
|
import { StartOptions } from "common/types/store-state";
|
|
5
6
|
interface OwnProps {
|
|
@@ -11,5 +12,5 @@ interface OwnProps {
|
|
|
11
12
|
resetChat: () => void;
|
|
12
13
|
skipGreeting: boolean;
|
|
13
14
|
}
|
|
14
|
-
declare const _default:
|
|
15
|
+
declare const _default: (ownProps: OwnProps) => h.JSX.Element;
|
|
15
16
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { h } from "preact";
|
|
1
2
|
import MessageService from "client/lib/message-service";
|
|
2
|
-
import StoreProxy from "client/lib/store-proxy";
|
|
3
|
+
import type { StoreProxy } from "client/lib/store-proxy";
|
|
3
4
|
import { StartOptions } from "common/types/store-state";
|
|
4
5
|
interface OwnProps {
|
|
5
6
|
store: StoreProxy;
|
|
@@ -10,5 +11,5 @@ interface OwnProps {
|
|
|
10
11
|
initializationResolve: () => void;
|
|
11
12
|
initializationReject: (error: Error) => void;
|
|
12
13
|
}
|
|
13
|
-
declare const _default:
|
|
14
|
+
declare const _default: (ownProps: OwnProps) => h.JSX.Element;
|
|
14
15
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h } from "preact";
|
|
2
2
|
import MessageService from "client/lib/message-service";
|
|
3
|
-
import StoreProxy from "client/lib/store-proxy";
|
|
3
|
+
import type { StoreProxy } from "client/lib/store-proxy";
|
|
4
4
|
import { Module } from "common/types/modules";
|
|
5
5
|
interface OwnProps {
|
|
6
6
|
name: Module;
|
|
@@ -10,5 +10,5 @@ interface OwnProps {
|
|
|
10
10
|
onTransitionEnd?: h.JSX.TransitionEventHandler<HTMLIFrameElement>;
|
|
11
11
|
title?: string;
|
|
12
12
|
}
|
|
13
|
-
declare const _default:
|
|
13
|
+
declare const _default: (ownProps: OwnProps) => h.JSX.Element;
|
|
14
14
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventSubscriptionCallback } from "client/helpers/event-subscriptions";
|
|
2
2
|
import MessageService from "client/lib/message-service";
|
|
3
|
-
import StoreProxy from "client/lib/store-proxy";
|
|
3
|
+
import { StoreProxy } from "client/lib/store-proxy";
|
|
4
4
|
import "client/lib/error-tracker";
|
|
5
5
|
import Client from "common/models/client";
|
|
6
6
|
import { EvaluateCampaignParams, ResetParams, WindowInfo } from "common/types";
|
|
@@ -10,6 +10,6 @@ export declare class CE extends Channel {
|
|
|
10
10
|
protected eventType: string;
|
|
11
11
|
isConnected: boolean;
|
|
12
12
|
postMessage<T extends EmbedEvent>(eventName: T, data?: PayloadByEvent[T], id?: string, status?: FetchEventStatusType): void;
|
|
13
|
-
addEventListener
|
|
13
|
+
addEventListener(handler: (type: string, payload?: unknown, id?: string, status?: FetchEventStatusType) => void): Refhandler;
|
|
14
14
|
constructObjectToSend<T extends EmbedEvent>(type: T, payload?: PayloadByEvent[T], id?: string, status?: FetchEventStatusType): AdaCustomEvent;
|
|
15
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentType,
|
|
1
|
+
import { ComponentType, h } from "preact";
|
|
2
2
|
import { ActionCreators } from "common/constants/actions";
|
|
3
3
|
import { Dispatch, MapDispatchToProps, MapStateToProps } from "common/types/store";
|
|
4
|
-
export declare function connect<
|
|
4
|
+
export declare function connect<MSP extends MapStateToProps, MDP extends MapDispatchToProps>(mapStateToProps?: MSP, mapDispatchToProps?: MDP): <O>(WrappedComponent: ComponentType<O & ReturnType<MSP> & ReturnType<MDP>>) => (ownProps: O) => h.JSX.Element;
|
|
5
5
|
export declare function bindActionCreators(action: Partial<ActionCreators>, dispatch: Dispatch): (payload?: object) => Promise<import("../../common/types/store-state").StoreState>;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import type { StoreProxy } from "client/lib/store-proxy";
|
|
2
|
+
export declare const StoreContext: import("preact").Context<StoreProxy>;
|
|
2
3
|
export declare const MessageServiceContext: import("preact").Context<any>;
|
|
@@ -5,7 +5,6 @@ import { CE } from "./ce";
|
|
|
5
5
|
export default class MessageService {
|
|
6
6
|
channels: Channels;
|
|
7
7
|
registerFrameChannel(name: Module, targetWindow: Window, targetOrigin?: string): FC;
|
|
8
|
-
registerLocalChannel(): CE;
|
|
9
8
|
unregisterChannel(name: keyof Channels): void;
|
|
10
9
|
getChannel(name: keyof Channels): FC | CE | null;
|
|
11
10
|
getAllChannels(): (CE | FC)[];
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import MessageService from "client/lib/message-service";
|
|
2
2
|
import { Store } from "client/store";
|
|
3
3
|
import { Channels } from "common/types/channels";
|
|
4
|
-
import { MessagePayload } from "common/types/events";
|
|
5
4
|
import { StoreProxyInterface } from "common/types/store";
|
|
6
5
|
import { StoreState } from "common/types/store-state";
|
|
7
6
|
import { CE } from "./ce";
|
|
8
|
-
export
|
|
7
|
+
export declare class StoreProxy implements StoreProxyInterface {
|
|
9
8
|
localChannel: CE;
|
|
10
9
|
store: Store;
|
|
11
|
-
registeredCallbacks: ((payload:
|
|
10
|
+
registeredCallbacks: ((payload: StoreState) => void)[];
|
|
12
11
|
constructor(messageService: MessageService);
|
|
13
12
|
get: <K extends keyof StoreState>(key: K) => Promise<StoreState[K]>;
|
|
14
13
|
getState: () => Promise<StoreState>;
|
|
15
14
|
dispatch: (actionKey: string, payload?: {}) => Promise<StoreState>;
|
|
16
|
-
subscribe: (callback: (payload:
|
|
15
|
+
subscribe: (callback: (payload: StoreState) => unknown) => void;
|
|
17
16
|
addChannelListener: (name: keyof Channels) => void;
|
|
18
17
|
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const CHATTER_TOKEN_STORAGE_KEY = "chatter";
|
|
2
|
+
export declare const CHATTER_CREATED_STORAGE_KEY = "ada-embed_chatter-created";
|
|
2
3
|
export declare const IN_LIVE_CHAT_STORAGE_KEY = "inLiveChat";
|
|
4
|
+
export declare const ZD_SESSION_STORAGE_KEY = "ada-embed_zd-session-id";
|
|
5
|
+
export declare const ZD_PREVIOUS_TAGS_STORAGE_KEY = "ada-embed_zd-previous-tags";
|
|
6
|
+
/** @deprecated - Use CHATTER_TOKEN_STORAGE_KEY */
|
|
7
|
+
export declare const CHATTER_STORAGE_KEY = "chatter";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { StoreState } from "common/types/store-state";
|
|
2
|
+
export declare const isRTLLanguage: (language: StoreState["language"] | undefined) => boolean;
|
|
2
3
|
export declare const isRTL: (client: StoreState["client"] | undefined, language: StoreState["language"] | undefined) => boolean;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Component, ComponentType, h } from "preact";
|
|
2
|
-
import {
|
|
2
|
+
import { MapDispatchToProps, MapStateToProps, StoreProxyInterface } from "common/types/store";
|
|
3
3
|
import { StoreState } from "common/types/store-state";
|
|
4
|
-
|
|
4
|
+
declare type Props<O, MSP extends MapStateToProps, MDP extends MapDispatchToProps> = {
|
|
5
5
|
store: StoreProxyInterface;
|
|
6
|
-
WrappedComponent: ComponentType
|
|
7
|
-
mapStateToProps
|
|
8
|
-
mapDispatchToProps
|
|
9
|
-
}
|
|
10
|
-
export
|
|
6
|
+
WrappedComponent: ComponentType<O & ReturnType<MSP> & ReturnType<MDP>>;
|
|
7
|
+
mapStateToProps?: MSP;
|
|
8
|
+
mapDispatchToProps?: MDP;
|
|
9
|
+
} & O;
|
|
10
|
+
export declare class ConnectContainer<O, MSP extends MapStateToProps, MDP extends MapDispatchToProps> extends Component<Props<O, MSP, MDP>> {
|
|
11
11
|
state: {
|
|
12
12
|
initialized: boolean;
|
|
13
|
-
propsFromState:
|
|
14
|
-
propsFromDispatch:
|
|
13
|
+
propsFromState: ReturnType<MSP>;
|
|
14
|
+
propsFromDispatch: ReturnType<MDP>;
|
|
15
15
|
};
|
|
16
16
|
componentDidMount(): void;
|
|
17
17
|
mapStateAndDispatch(state: StoreState): object;
|
|
@@ -64,7 +64,7 @@ export declare abstract class Channel {
|
|
|
64
64
|
protected abstract eventType: string;
|
|
65
65
|
abstract isConnected: boolean;
|
|
66
66
|
abstract postMessage<T extends EmbedEvent>(eventName: T, data?: PayloadByEvent[T], id?: string): void;
|
|
67
|
-
abstract addEventListener
|
|
67
|
+
abstract addEventListener(handler: (type: string, payload?: unknown, id?: string) => void): Refhandler;
|
|
68
68
|
abstract constructObjectToSend(type: string, payload?: Record<string, unknown>, id?: string, status?: FetchEventStatusType): AdaCustomEvent | string;
|
|
69
69
|
removeEventListener<T extends EmbedEvent>(ref: Refhandler<T>): void;
|
|
70
70
|
clearTrackedTimeout(ref: number): void;
|
|
@@ -19,6 +19,6 @@ export default class FC extends Channel {
|
|
|
19
19
|
constructor(name: string, targetWindow: Window, targetOrigin?: string);
|
|
20
20
|
private static isMessageEvent;
|
|
21
21
|
postMessage<T extends EmbedEvent>(eventName: T, data?: PayloadByEvent[T], id?: string, status?: FetchEventStatusType): void;
|
|
22
|
-
addEventListener
|
|
23
|
-
constructObjectToSend(type?: string, payload?:
|
|
22
|
+
addEventListener(handler: (type: string, payload?: object, id?: string, status?: FetchEventStatusType) => void): Refhandler;
|
|
23
|
+
constructObjectToSend(type?: string, payload?: unknown, id?: string, status?: FetchEventStatusType): string;
|
|
24
24
|
}
|
|
@@ -4,7 +4,7 @@ import { PartialRecord } from "common/types/helpers";
|
|
|
4
4
|
import { Module } from "common/types/modules";
|
|
5
5
|
declare type FrameChannels = PartialRecord<Module, FC>;
|
|
6
6
|
interface LocalChannel {
|
|
7
|
-
local
|
|
7
|
+
local: CE;
|
|
8
8
|
}
|
|
9
9
|
export declare type Channels = FrameChannels & LocalChannel;
|
|
10
10
|
export {};
|
|
@@ -2,37 +2,6 @@ import { ConnectionState } from "common/constants/events";
|
|
|
2
2
|
import Client from "common/models/client";
|
|
3
3
|
import { ChatterEventPayload } from "common/types/events";
|
|
4
4
|
import { ValueOf } from "common/types/helpers";
|
|
5
|
-
export interface StoreState extends StartOptionsNoFunction {
|
|
6
|
-
client: Client;
|
|
7
|
-
isDrawerOpen: boolean;
|
|
8
|
-
drawerHasBeenOpened: boolean;
|
|
9
|
-
isIntroShown: boolean;
|
|
10
|
-
isButtonShown: boolean;
|
|
11
|
-
introDimensions: {
|
|
12
|
-
height?: number;
|
|
13
|
-
width?: number;
|
|
14
|
-
};
|
|
15
|
-
initialURL: string;
|
|
16
|
-
wasIntroShown: boolean;
|
|
17
|
-
unreadMessageCount: number;
|
|
18
|
-
embedStyles?: string;
|
|
19
|
-
chatterToken: string;
|
|
20
|
-
connections: {
|
|
21
|
-
[key: string]: ConnectionState;
|
|
22
|
-
};
|
|
23
|
-
appConnectionState: ConnectionState;
|
|
24
|
-
notificationsPermission: NotificationPermission;
|
|
25
|
-
browserHasNotificationSupport: boolean;
|
|
26
|
-
chatDimensions: {
|
|
27
|
-
height?: number;
|
|
28
|
-
width?: number;
|
|
29
|
-
};
|
|
30
|
-
isChatWebsocketConnected: boolean;
|
|
31
|
-
latestCampaignKey: string;
|
|
32
|
-
hasChatOpenedAfterProactiveMessagesShown: boolean;
|
|
33
|
-
chatterInLiveChat: boolean;
|
|
34
|
-
language?: string;
|
|
35
|
-
}
|
|
36
5
|
export interface StartOptions {
|
|
37
6
|
handle?: string;
|
|
38
7
|
lazy?: boolean;
|
|
@@ -67,6 +36,42 @@ export interface StartOptions {
|
|
|
67
36
|
};
|
|
68
37
|
preload?: boolean;
|
|
69
38
|
conversationEndCallback?(payload: ChatterEventPayload): void;
|
|
39
|
+
align?: "right" | "left" | "auto";
|
|
40
|
+
}
|
|
41
|
+
export interface StoreState extends StartOptionsNoFunction {
|
|
42
|
+
chatterCreated?: string | null;
|
|
43
|
+
chatterToken?: string | null;
|
|
44
|
+
client: Client;
|
|
45
|
+
isDrawerOpen: boolean;
|
|
46
|
+
zdSessionId?: string | null;
|
|
47
|
+
zdPreviousTags?: string | null;
|
|
48
|
+
drawerHasBeenOpened: boolean;
|
|
49
|
+
isIntroShown: boolean;
|
|
50
|
+
isButtonShown: boolean;
|
|
51
|
+
introDimensions: {
|
|
52
|
+
height?: number;
|
|
53
|
+
width?: number;
|
|
54
|
+
};
|
|
55
|
+
initialURL: string;
|
|
56
|
+
wasIntroShown: boolean;
|
|
57
|
+
unreadMessageCount: number;
|
|
58
|
+
embedStyles?: string;
|
|
59
|
+
connections: {
|
|
60
|
+
[key: string]: ConnectionState;
|
|
61
|
+
};
|
|
62
|
+
appConnectionState: ConnectionState;
|
|
63
|
+
notificationsPermission: NotificationPermission;
|
|
64
|
+
browserHasNotificationSupport: boolean;
|
|
65
|
+
chatDimensions: {
|
|
66
|
+
height?: number;
|
|
67
|
+
width?: number;
|
|
68
|
+
};
|
|
69
|
+
isChatWebsocketConnected: boolean;
|
|
70
|
+
latestCampaignKey: string;
|
|
71
|
+
hasChatOpenedAfterProactiveMessagesShown: boolean;
|
|
72
|
+
chatterInLiveChat: boolean;
|
|
73
|
+
language?: string;
|
|
74
|
+
adaSettings: StartOptions;
|
|
70
75
|
}
|
|
71
76
|
export interface StartOptionsNoFunction {
|
|
72
77
|
handle?: string;
|
|
@@ -6,9 +6,9 @@ export declare type GetState = () => Promise<StoreState>;
|
|
|
6
6
|
*/
|
|
7
7
|
export declare type DirectDispatch = (actionKey: string, payload?: {}) => void;
|
|
8
8
|
export declare type Dispatch = (actionKey: string, payload?: {}) => Promise<StoreState>;
|
|
9
|
-
export declare type Subscribe = (callback: (payload:
|
|
10
|
-
export declare type MapStateToProps = (storeState: StoreState) =>
|
|
11
|
-
export declare type MapDispatchToProps = (dispatch: Dispatch) =>
|
|
9
|
+
export declare type Subscribe = (callback: (payload: StoreState) => void) => void;
|
|
10
|
+
export declare type MapStateToProps<R = object> = (storeState: StoreState) => R;
|
|
11
|
+
export declare type MapDispatchToProps<R = object> = (dispatch: Dispatch) => R;
|
|
12
12
|
export interface StoreProxyInterface {
|
|
13
13
|
get: Get;
|
|
14
14
|
getState: GetState;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "frames/lib/error-tracker";
|
|
2
|
+
export declare const LIVE_CHAT_PENDING_STORAGE_KEY = "liveChatPending";
|
|
3
|
+
export declare const IS_DRAWER_OPEN_STORAGE_KEY = "ada-embed_is-drawer-open";
|
|
4
|
+
/**
|
|
5
|
+
* NOTE: If you import this file into any other file
|
|
6
|
+
* it will trigger the init() function below - may cause errors!
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Auto-opens the chat door if crossWindowPersistence is one, the chatter is in
|
|
10
|
+
* a live chat, and if the drawer was previously opened.
|
|
11
|
+
*/
|
|
12
|
+
export declare function setIsDrawerOpen(): Promise<void>;
|
|
@@ -6,4 +6,4 @@ export declare const PERSISTENCE_SESSION = "session";
|
|
|
6
6
|
* Retrieves items from local or session storage, depending on the client's
|
|
7
7
|
* persistence setting. If privateMode is set, it returns null.
|
|
8
8
|
*/
|
|
9
|
-
export declare function retrieveStorage<T extends StorageKey>(key: T, client: Client, privateMode
|
|
9
|
+
export declare function retrieveStorage<T extends StorageKey>(key: T, client: Client, privateMode?: boolean): StorageValueByKey[T] | null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CHATTER_CREATED_STORAGE_KEY, CHATTER_TOKEN_STORAGE_KEY, IN_LIVE_CHAT_STORAGE_KEY, ZD_PREVIOUS_TAGS_STORAGE_KEY, ZD_SESSION_STORAGE_KEY } from "common/constants/storage-keys";
|
|
1
2
|
export declare enum StorageTypes {
|
|
2
3
|
Local = "local",
|
|
3
4
|
Session = "session"
|
|
@@ -5,8 +6,11 @@ export declare enum StorageTypes {
|
|
|
5
6
|
declare type StorageTypesType = StorageTypes.Local | StorageTypes.Session;
|
|
6
7
|
export declare type StorageValueType = string | number | boolean | unknown[];
|
|
7
8
|
export interface StorageValueByKey {
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
[CHATTER_CREATED_STORAGE_KEY]: string;
|
|
10
|
+
[CHATTER_TOKEN_STORAGE_KEY]: string;
|
|
11
|
+
[IN_LIVE_CHAT_STORAGE_KEY]: boolean;
|
|
12
|
+
[ZD_SESSION_STORAGE_KEY]: string;
|
|
13
|
+
[ZD_PREVIOUS_TAGS_STORAGE_KEY]: string;
|
|
10
14
|
"liveChatPending": boolean;
|
|
11
15
|
"ada-embed_is-drawer-open": boolean;
|
|
12
16
|
"[handle]_marketing_campaigns_shown": string;
|
|
@@ -25,8 +29,8 @@ export declare class SafeStorage {
|
|
|
25
29
|
seralizeItem(value: StorageValueType): string | null;
|
|
26
30
|
deserializeItem<T extends StorageValueType>(value: string | null): T | null;
|
|
27
31
|
getItem<T extends StorageKey>(key: T): StorageValueByKey[T] | null;
|
|
28
|
-
setItem(key:
|
|
29
|
-
removeItem(key:
|
|
32
|
+
setItem<T extends StorageKey>(key: T, value: StorageValueByKey[T]): void;
|
|
33
|
+
removeItem(key: StorageKey): void;
|
|
30
34
|
}
|
|
31
35
|
export declare const safeLocalStorage: SafeStorage;
|
|
32
36
|
export declare const safeSessionStorage: SafeStorage;
|