@ada-support/embed2 1.0.44 → 1.0.50

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.
@@ -2,7 +2,7 @@ import type { EventSubscriptionCallback } from "client/helpers/event-subscriptio
2
2
  import { MessageService } from "client/lib/message-service";
3
3
  import { StoreProxy } from "client/lib/store-proxy";
4
4
  import "client/lib/error-tracker";
5
- import type Client from "common/models/client";
5
+ import type { Client } from "common/models/client";
6
6
  import type { EvaluateCampaignParams, ResetParams, WindowInfo } from "common/types";
7
7
  import type { MetaFieldPayload } from "common/types/store";
8
8
  import type { StartOptions } from "common/types/store-state";
@@ -1,7 +1,7 @@
1
- import { ClientObject, ClientResponse } from "common/types/http";
2
- export declare function clientMatchesExpectedFormat(client: ClientObject): boolean;
1
+ import type { ClientObject, ClientResponse } from "common/types/http";
2
+ export declare function isClientObject(client: Record<string, unknown>): client is ClientObject;
3
3
  /**
4
4
  * Tries fetching the client from cache. If this fails, tries fetching it from API.
5
5
  * If this also fails, returns null.
6
6
  */
7
- export declare function fetchClient(handle: string, cluster: string, domain: string, language: string): Promise<ClientResponse>;
7
+ export declare function fetchClient(handle: string, cluster: string, domain: string, language: string): Promise<ClientResponse | null>;
@@ -1,5 +1,5 @@
1
- import { CurrentIntro, Intro } from "common/types/http";
1
+ import type { CurrentIntro, Intro } from "common/types/http";
2
2
  export declare function getProcessedPath(path: string): string;
3
3
  export declare function getPathSearchRegex(path: string): RegExp;
4
4
  export declare function doesUrlMatchPath(url: string, path: string): boolean;
5
- export declare function getIntroForCurrentUrl(intros: Intro[], language: string): CurrentIntro | null;
5
+ export declare function getIntroForCurrentUrl(intros: Intro[], language: string): CurrentIntro | undefined;
@@ -1,4 +1,4 @@
1
- import { AdaEmbedAPI } from "common/types/index";
1
+ import type { AdaEmbedAPI } from "common/types/index";
2
2
  /**
3
3
  * Returns the public Embed methods to be bound to the window object.
4
4
  */
@@ -11,7 +11,7 @@ export interface CSInterface {
11
11
  domain?: string;
12
12
  route?: string;
13
13
  qp?: {
14
- [key: string]: string | boolean | number;
14
+ [key: string]: string | boolean | number | null | undefined;
15
15
  };
16
16
  isEmbedFramed?: boolean;
17
17
  }
@@ -1,8 +1,8 @@
1
- import { FetchEventStatusType } from "common/constants/events";
2
- import { AdaCustomEvent, Refhandler } from "common/types/events";
3
- import { EvaluateCampaignParams, ResetParams, SendGreetingParams, StoreDispatchPayload, StoreGetPayload, TrackEventParams } from "common/types/index";
4
- import { MetaFieldPayload } from "common/types/store";
5
- import { StoreState } from "common/types/store-state";
1
+ import type { FetchEventStatusType } from "common/constants/events";
2
+ import type { AdaCustomEvent, Refhandler } from "common/types/events";
3
+ import type { EvaluateCampaignParams, ResetParams, SendGreetingParams, StoreDispatchPayload, StoreGetPayload, TrackEventParams } from "common/types/index";
4
+ import type { MetaFieldPayload } from "common/types/store";
5
+ import type { StoreState } from "common/types/store-state";
6
6
  export interface EmbedRequestPayloadByEvent {
7
7
  CREATE_PROACTIVE: {
8
8
  body: string;
@@ -15,7 +15,6 @@ export declare class FrameChannel extends Channel {
15
15
  name: string;
16
16
  targetWindow: Window;
17
17
  targetOrigin: string;
18
- eventTarget: Window;
19
18
  isConnected: boolean;
20
19
  constructor(name: string, targetWindow: Window, targetOrigin?: string);
21
20
  private static isMessageEvent;
@@ -1,14 +1,14 @@
1
- import { BusinessEvent } from "businessEvents/types";
2
- import { ChatButton, ClientResponse, CurrentIntro, Features } from "common/types/http";
3
- import { LanguageMap } from "common/types/languages";
4
- import { MarketingCampaign } from "src/campaigns/types";
5
- export default class Client {
1
+ import type { BusinessEvent } from "businessEvents/types";
2
+ import type { ChatButton, ClientResponse, CurrentIntro, Features } from "common/types/http";
3
+ import type { LanguageKey, LanguageMap } from "common/types/languages";
4
+ import type { MarketingCampaign } from "src/campaigns/types";
5
+ export declare class Client {
6
6
  tint: string;
7
7
  chat: boolean;
8
8
  intro?: CurrentIntro;
9
9
  handle: string;
10
10
  rollout: number;
11
- language: keyof LanguageMap;
11
+ language: LanguageKey;
12
12
  privacy: boolean;
13
13
  features: Features;
14
14
  persistence: string;
@@ -1,4 +1,5 @@
1
- import { BusinessEvent } from "businessEvents/types";
1
+ import type { BusinessEvent } from "businessEvents/types";
2
+ import type { LanguageKey } from "common/types/languages";
2
3
  export interface ChatButton {
3
4
  size: number;
4
5
  background_color: string;
@@ -43,20 +44,21 @@ export interface ClientObject {
43
44
  rollout: number;
44
45
  chat: boolean;
45
46
  persistence: string;
46
- language: string;
47
+ language: LanguageKey;
47
48
  privacy: boolean;
48
49
  tint: string;
49
50
  chat_button: ChatButton | null;
50
51
  intro?: CurrentIntro;
51
52
  features: Features;
52
53
  marketing_campaigns_order?: string[];
54
+ [key: string]: unknown;
53
55
  }
54
56
  export interface CachedClientObject {
55
57
  handle: string;
56
58
  rollout: number;
57
59
  chat: boolean;
58
60
  persistence: string;
59
- language: string;
61
+ language: LanguageKey;
60
62
  privacy: boolean;
61
63
  tint: string;
62
64
  chat_button: ChatButton | null;
@@ -64,6 +66,7 @@ export interface CachedClientObject {
64
66
  features: Features;
65
67
  business_events?: BusinessEvent[];
66
68
  marketing_campaigns_order?: string[];
69
+ [key: string]: unknown;
67
70
  }
68
71
  export interface ClientResponse {
69
72
  client: ClientObject;
@@ -1,5 +1,4 @@
1
- declare type LanguageKeys = "en" | "da" | "de" | "es" | "fi" | "fr" | "hi" | "ht" | "id" | "it" | "ja" | "km" | "ko" | "ms" | "my" | "no" | "nl" | "pa" | "pt" | "ru" | "sv" | "ta" | "th" | "tl" | "tr" | "vi" | "zh" | "zh-tw" | "bg" | "ro" | "el" | "hu" | "pl" | "cs" | "et" | "hr" | "lt" | "lv" | "sl" | "sk" | "is" | "ar" | "he";
1
+ export declare type LanguageKey = "en" | "da" | "de" | "es" | "fi" | "fr" | "hi" | "ht" | "id" | "it" | "ja" | "km" | "ko" | "ms" | "my" | "no" | "nl" | "pa" | "pt" | "ru" | "sv" | "ta" | "th" | "tl" | "tr" | "vi" | "zh" | "zh-tw" | "bg" | "ro" | "el" | "hu" | "pl" | "cs" | "et" | "hr" | "lt" | "lv" | "sl" | "sk" | "is" | "ar" | "he";
2
2
  export declare type LanguageMap = {
3
- [K in LanguageKeys]?: string;
3
+ [K in LanguageKey]?: string;
4
4
  };
5
- export {};
@@ -1,5 +1,5 @@
1
1
  import type { ConnectionState } from "common/constants/events";
2
- import type Client from "common/models/client";
2
+ import type { Client } from "common/models/client";
3
3
  import type { ChatterEventPayload } from "common/types/events";
4
4
  export interface StartOptions {
5
5
  handle?: string;
@@ -22,7 +22,7 @@ export interface StartOptions {
22
22
  onAdaEmbedLoaded?(): void;
23
23
  toggleCallback?(isDrawerOpen: boolean): void;
24
24
  eventCallbacks?: {
25
- [eventName: string]: (customJavascriptEvent: object) => void;
25
+ [eventName: string]: ((customJavascriptEvent: object) => void) | undefined;
26
26
  };
27
27
  zdChatterAuthCallback?(callback: (token: string) => void): void;
28
28
  embedStyles?: string;
@@ -1,5 +1,5 @@
1
- import Client from "common/models/client";
2
- import { StorageKey, StorageValueByKey } from "frames/lib/safe-storage";
1
+ import type { Client } from "common/models/client";
2
+ import type { StorageKey, StorageValueByKey } from "frames/lib/safe-storage";
3
3
  export declare const PERSISTENCE_NORMAL = "normal";
4
4
  export declare const PERSISTENCE_SESSION = "session";
5
5
  /**