@ada-support/embed2 1.9.2 → 1.10.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.
@@ -1,6 +1,6 @@
1
- export declare type GoalEvent = unknown;
2
- export declare type CampaignFrequency = "every-time" | "once-per-session" | "once-per-user";
3
- export declare type TriggerCondition = URLMatchTriggerCondition | DateTimeTriggerCondition;
1
+ export type GoalEvent = unknown;
2
+ export type CampaignFrequency = "every-time" | "once-per-session" | "once-per-user";
3
+ export type TriggerCondition = URLMatchTriggerCondition | DateTimeTriggerCondition;
4
4
  export interface URLMatchTriggerCondition {
5
5
  type: "url-match";
6
6
  conditions_any: [
@@ -34,7 +34,7 @@ interface PropsFromDispatch {
34
34
  setGlobalState: (payload: Partial<StoreState>) => Promise<StoreState>;
35
35
  toggleChat: () => Promise<StoreState>;
36
36
  }
37
- declare type ChatFrameProps = PropsFromState & OwnProps & PropsFromDispatch;
37
+ type ChatFrameProps = PropsFromState & OwnProps & PropsFromDispatch;
38
38
  interface ChatFrameState {
39
39
  isMounted: boolean;
40
40
  closeTransitionTime: number;
@@ -22,4 +22,4 @@ export declare function createEmbed(adaSettings: StartOptions): {
22
22
  readonly setDeviceToken: (token: string) => Promise<void>;
23
23
  readonly triggerProactive: (triggerProactiveParams: TriggerProactiveParams) => Promise<void>;
24
24
  };
25
- export declare type Embed = ReturnType<typeof createEmbed>;
25
+ export type Embed = ReturnType<typeof createEmbed>;
@@ -85,4 +85,4 @@ export declare enum FetchEventStatus {
85
85
  Success = "SUCCESS",
86
86
  Failure = "FAILURE"
87
87
  }
88
- export declare type FetchEventStatusType = FetchEventStatus.Success | FetchEventStatus.Failure;
88
+ export type FetchEventStatusType = FetchEventStatus.Success | FetchEventStatus.Failure;
@@ -2,7 +2,7 @@ import type { ComponentType } from "preact";
2
2
  import { Component, h } from "preact";
3
3
  import type { MapDispatchToProps, MapStateToProps, StoreProxyInterface } from "common/types/store";
4
4
  import type { StoreState } from "common/types/store-state";
5
- declare type Props<O, MSP extends MapStateToProps, MDP extends MapDispatchToProps> = {
5
+ type Props<O, MSP extends MapStateToProps, MDP extends MapDispatchToProps> = {
6
6
  store: StoreProxyInterface;
7
7
  WrappedComponent: ComponentType<O & ReturnType<MSP> & ReturnType<MDP>>;
8
8
  mapStateToProps?: MSP;
@@ -41,7 +41,7 @@ export interface EmbedRequestPayloadByEvent {
41
41
  language: string;
42
42
  };
43
43
  }
44
- export declare type EmbedRequestEvent = keyof EmbedRequestPayloadByEvent;
44
+ export type EmbedRequestEvent = keyof EmbedRequestPayloadByEvent;
45
45
  export interface EmbedResponsePayloadByEvent {
46
46
  "ALL_FRAMES_LOADED": unknown;
47
47
  "BROWSER_HAS_NOTIFICATIONS_RESPONSE": unknown;
@@ -74,9 +74,9 @@ export interface EmbedResponsePayloadByEvent {
74
74
  "SET_DEVICE_TOKEN_RESPONSE": unknown;
75
75
  "TRIGGER_PROACTIVE_RESPONSE": unknown;
76
76
  }
77
- export declare type EmbedResponseEvent = keyof EmbedResponsePayloadByEvent;
78
- export declare type EmbedEvent = EmbedRequestEvent | EmbedResponseEvent;
79
- export declare type PayloadByEvent = EmbedRequestPayloadByEvent & EmbedResponsePayloadByEvent;
77
+ export type EmbedResponseEvent = keyof EmbedResponsePayloadByEvent;
78
+ export type EmbedEvent = EmbedRequestEvent | EmbedResponseEvent;
79
+ export type PayloadByEvent = EmbedRequestPayloadByEvent & EmbedResponsePayloadByEvent;
80
80
  export declare abstract class Channel {
81
81
  protected abstract trackedListeners: Set<Refhandler>;
82
82
  protected abstract trackedTimeouts: Set<number>;
@@ -2,9 +2,9 @@ import type { CustomEventChannel } from "client/lib/ce";
2
2
  import type { FrameChannel } from "common/lib/fc";
3
3
  import type { PartialRecord } from "common/types/helpers";
4
4
  import type { Module } from "common/types/modules";
5
- export declare type FrameChannels = PartialRecord<Module, FrameChannel>;
5
+ export type FrameChannels = PartialRecord<Module, FrameChannel>;
6
6
  interface LocalChannel {
7
7
  local: CustomEventChannel;
8
8
  }
9
- export declare type Channels = FrameChannels & LocalChannel;
9
+ export type Channels = FrameChannels & LocalChannel;
10
10
  export {};
@@ -24,4 +24,4 @@ export interface AdaCustomEvent<E extends EmbedEvent | string = string> {
24
24
  id?: string;
25
25
  status?: FetchEventStatusType;
26
26
  }
27
- export declare type Refhandler<E extends EmbedRequestEvent | string = string> = (handleEvent: MessageEvent | CustomEventInit<AdaCustomEvent<E>>) => void;
27
+ export type Refhandler<E extends EmbedRequestEvent | string = string> = (handleEvent: MessageEvent | CustomEventInit<AdaCustomEvent<E>>) => void;
@@ -1,3 +1,3 @@
1
- export declare type PartialRecord<K extends keyof any, T> = {
1
+ export type PartialRecord<K extends keyof any, T> = {
2
2
  [P in K]?: T;
3
3
  };
@@ -21,7 +21,7 @@ export interface TrackEventParams {
21
21
  value?: number;
22
22
  meta?: {};
23
23
  }
24
- export declare type SendGreetingParams = {
24
+ export type SendGreetingParams = {
25
25
  responseId?: string;
26
26
  } | undefined;
27
27
  export interface TriggerCampaignParams {
@@ -1 +1 @@
1
- export declare type AdaCluster = "att" | "ca" | "eu" | "ficanex" | "maple" | undefined;
1
+ export type AdaCluster = "att" | "ca" | "eu" | "ficanex" | "maple" | undefined;
@@ -45,7 +45,7 @@ export declare const Languages: {
45
45
  readonly ar: "ar";
46
46
  readonly he: "he";
47
47
  };
48
- export declare type LanguageKey = keyof typeof Languages;
49
- export declare type LanguageMap = {
48
+ export type LanguageKey = keyof typeof Languages;
49
+ export type LanguageMap = {
50
50
  [K in LanguageKey]?: string;
51
51
  };
@@ -5,4 +5,4 @@ export declare const INTRO_IFRAME = "intro";
5
5
  export declare const BUTTON_IFRAME = "button";
6
6
  export declare const MASK_IFRAME = "drawer-mask";
7
7
  export declare const XSTORAGE_IFRAME = "x-storage";
8
- export declare type Module = typeof CHAT_IFRAME | typeof ENTRY_SCRIPT | typeof EMBED_SCRIPT | typeof INTRO_IFRAME | typeof BUTTON_IFRAME | typeof MASK_IFRAME | typeof XSTORAGE_IFRAME;
8
+ export type Module = typeof CHAT_IFRAME | typeof ENTRY_SCRIPT | typeof EMBED_SCRIPT | typeof INTRO_IFRAME | typeof BUTTON_IFRAME | typeof MASK_IFRAME | typeof XSTORAGE_IFRAME;
@@ -1,19 +1,19 @@
1
1
  import type { StoreState } from "./store-state";
2
- export declare type Get = <K extends keyof StoreState>(key: K) => Promise<StoreState[K]>;
3
- export declare type GetState = () => Promise<StoreState>;
2
+ export type Get = <K extends keyof StoreState>(key: K) => Promise<StoreState[K]>;
3
+ export type GetState = () => Promise<StoreState>;
4
4
  /**
5
5
  * DirectDispatch does the same thing as Dispatch, except
6
6
  */
7
- export declare type DirectDispatch = (actionKey: string, payload?: {}) => void;
8
- export declare type Dispatch = (actionKey: string, payload?: {}) => Promise<StoreState>;
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;
7
+ export type DirectDispatch = (actionKey: string, payload?: {}) => void;
8
+ export type Dispatch = (actionKey: string, payload?: {}) => Promise<StoreState>;
9
+ export type Subscribe = (callback: (payload: StoreState) => void) => void;
10
+ export type MapStateToProps<R = object> = (storeState: StoreState) => R;
11
+ export type MapDispatchToProps<R = object> = (dispatch: Dispatch) => R;
12
12
  export interface StoreProxyInterface {
13
13
  get: Get;
14
14
  getState: GetState;
15
15
  dispatch: Dispatch;
16
16
  subscribe: Subscribe;
17
17
  }
18
- export declare type MetaFieldValue = string | number | boolean | null;
19
- export declare type MetaFieldPayload = Record<string, MetaFieldValue>;
18
+ export type MetaFieldValue = string | number | boolean | null;
19
+ export type MetaFieldPayload = Record<string, MetaFieldValue>;
@@ -15919,7 +15919,7 @@ const client = new BrowserClient({
15919
15919
  return event;
15920
15920
  },
15921
15921
  environment: "production",
15922
- release: "1.9.2-a21b3af",
15922
+ release: "1.10.0-3873935",
15923
15923
  sampleRate: 0.25,
15924
15924
  autoSessionTracking: false,
15925
15925
  // Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
@@ -16496,7 +16496,7 @@ function getEmbedURL(_ref) {
16496
16496
  } else {
16497
16497
  host = `http://${handle}.localhost:9001`;
16498
16498
  }
16499
- return `${host}/embed/${frameName}/${"a21b3af"}/index.html`;
16499
+ return `${host}/embed/${frameName}/${"3873935"}/index.html`;
16500
16500
  }
16501
16501
  function constructQueryString(query) {
16502
16502
  return Object.keys(query).map(key => {
@@ -17676,9 +17676,9 @@ async function log(message, extra, options) {
17676
17676
  service: "embed",
17677
17677
  env: "production",
17678
17678
  embedVersion: 2,
17679
- version: "1.9.2",
17679
+ version: "1.10.0",
17680
17680
  isNpm: true,
17681
- commitHash: "a21b3af"
17681
+ commitHash: "3873935"
17682
17682
  }))
17683
17683
  });
17684
17684
  }
@@ -18852,7 +18852,7 @@ class ChatFrame extends d {
18852
18852
  const hostPageUrlParams = new URL(window.location.href).searchParams;
18853
18853
  const smsToken = hostPageUrlParams.get("adaSMSToken");
18854
18854
  const queryParams = {
18855
- embedVersion: "a21b3af".slice(0, 7),
18855
+ embedVersion: "3873935".slice(0, 7),
18856
18856
  greeting,
18857
18857
  language,
18858
18858
  skipGreeting,
@@ -1,4 +1,4 @@
1
- export declare type ProactiveConversationUrlTriggerConditions = UrlTriggerCondition[] | null;
1
+ export type ProactiveConversationUrlTriggerConditions = UrlTriggerCondition[] | null;
2
2
  export interface ProactiveConversation {
3
3
  messages: {
4
4
  [language: string]: string[];
@@ -23,10 +23,10 @@ export interface RecentProactiveConversationConfig {
23
23
  key: string;
24
24
  params: Record<string, string>;
25
25
  }
26
- export declare type ProactiveConversationFrequency = "always" | "session";
27
- export declare type ProactiveConversationUrlTriggerConditionType = "equals" | "ends-with" | "regex" | "contains";
26
+ export type ProactiveConversationFrequency = "always" | "session";
27
+ export type ProactiveConversationUrlTriggerConditionType = "equals" | "ends-with" | "regex" | "contains";
28
28
  export interface UrlTriggerCondition {
29
29
  type: ProactiveConversationUrlTriggerConditionType;
30
30
  value: string;
31
31
  }
32
- export declare type ProactiveConversationTriggerMethod = "url" | "programmatic";
32
+ export type ProactiveConversationTriggerMethod = "url" | "programmatic";
@@ -1,4 +1,3 @@
1
- /// <reference types="lodash" />
2
1
  export declare const DEFAULT_LOG_SAMPLE_RATE = 0.01;
3
2
  export declare const shouldLog: ((sampleRate?: number) => boolean) & import("lodash").MemoizedFunction;
4
3
  /**
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.9.2",
3
+ "version": "1.10.0",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index-npm.d.ts",
7
7
  "engines": {
8
- "node": ">=16"
8
+ "node": ">=20"
9
9
  },
10
10
  "scripts": {
11
11
  "build": "TS_NODE_PROJECT=wp.tsconfig.json NODE_ENV=production npx webpack --config webpack.prod.ts",
@@ -53,12 +53,12 @@
53
53
  "@babel/preset-env": "^7.23.2",
54
54
  "@babel/preset-typescript": "^7.23.2",
55
55
  "@testing-library/preact": "^2.0.1",
56
- "@types/enzyme": "^3.10.11",
56
+ "@types/enzyme": "^3.10.18",
57
57
  "@types/jest": "^27.0.2",
58
58
  "@types/json-stable-stringify": "^1.0.33",
59
59
  "@types/lodash.debounce": "^4.0.6",
60
60
  "@types/lodash.memoize": "^4.1.6",
61
- "@types/node": "^16.7.1",
61
+ "@types/node": "^20.17.58",
62
62
  "@types/uniqid": "^5.3.2",
63
63
  "@types/webpack": "^5.28.0",
64
64
  "@types/webpack-bundle-analyzer": "^4.4.1",
@@ -88,7 +88,7 @@
88
88
  "start-server-and-test": "^2.0.4",
89
89
  "ts-node": "^10.2.1",
90
90
  "tsconfig-paths": "^3.11.0",
91
- "typescript": "^4.6.2",
91
+ "typescript": "^5.6.3",
92
92
  "webpack": "^5.76.0",
93
93
  "webpack-bundle-analyzer": "^4.5.0",
94
94
  "webpack-cli": "^5.1.4",
@@ -96,7 +96,7 @@
96
96
  "webpack-merge": "^5.8.0"
97
97
  },
98
98
  "dependencies": {
99
- "@ada-support/embed-types": "^1.9.1",
99
+ "@ada-support/embed-types": "^1.9.2",
100
100
  "@ada-support/web-storage": "^1.2.9",
101
101
  "@babel/runtime-corejs3": "^7.26.10",
102
102
  "@sentry/browser": "^8.33.0",