@ada-support/embed2 1.0.29 → 1.0.33

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.
@@ -1,6 +1,8 @@
1
1
  import { h } from "preact";
2
+ import { StartOptions } from "common/types/store-state";
2
3
  interface OwnProps {
3
4
  frameWidth: number;
5
+ adaSettings: StartOptions;
4
6
  }
5
7
  declare const _default: (ownProps: OwnProps) => h.JSX.Element;
6
8
  export default _default;
@@ -1,2 +1,7 @@
1
- export declare const CHATTER_STORAGE_KEY = "chatter";
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";
@@ -0,0 +1,2 @@
1
+ import { StartOptions } from "common/types/store-state";
2
+ export declare function getAlignment(adaSettings: StartOptions): "right" | "left";
@@ -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;
@@ -20,5 +20,5 @@ export default class FC extends Channel {
20
20
  private static isMessageEvent;
21
21
  postMessage<T extends EmbedEvent>(eventName: T, data?: PayloadByEvent[T], id?: string, status?: FetchEventStatusType): void;
22
22
  addEventListener(handler: (type: string, payload?: object, id?: string, status?: FetchEventStatusType) => void): Refhandler;
23
- constructObjectToSend(type?: string, payload?: {}, id?: string, status?: FetchEventStatusType): string;
23
+ constructObjectToSend(type?: string, payload?: unknown, id?: string, status?: FetchEventStatusType): string;
24
24
  }
@@ -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;
@@ -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>;
@@ -0,0 +1,3 @@
1
+ import { StoreState } from "common/types/store-state";
2
+ export declare function initializeFrame(waitForOtherFrames?: boolean, initialState?: Partial<StoreState>): Promise<boolean>;
3
+ export declare function addCustomStyles(styles: string, hasUICustomization: boolean): void;
@@ -0,0 +1,6 @@
1
+ import * as Sentry from "@sentry/browser";
2
+ declare const errorTracker: {
3
+ trackException(error: Error): void;
4
+ addBreadCrumb(category: string, message: string, data: object, level?: Sentry.Severity): void;
5
+ };
6
+ export default errorTracker;
@@ -0,0 +1,3 @@
1
+ import FC from "common/lib/fc";
2
+ declare const _default: FC;
3
+ export default _default;
@@ -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
- "chatter": string;
9
- "inLiveChat": boolean;
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: string, value: StorageValueType): void;
29
- removeItem(key: string): void;
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;
@@ -0,0 +1,2 @@
1
+ import { StoreProxyInterface } from "common/types/store";
2
+ export declare const store: StoreProxyInterface;