@ada-support/embed2 1.4.21 → 1.5.1

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.
@@ -10,7 +10,7 @@ export declare class CustomEventChannel extends Channel {
10
10
  protected trackedTimeouts: Set<number>;
11
11
  protected eventType: string;
12
12
  isConnected: boolean;
13
- postMessage<T extends EmbedEvent>(eventName: T, data?: PayloadByEvent[T], id?: string, status?: FetchEventStatusType): void;
13
+ postMessage<T extends EmbedEvent>(eventName: T, data: PayloadByEvent[T], id?: string, status?: FetchEventStatusType): void;
14
14
  addEventListener(handler: (type: string, payload?: unknown, id?: string, status?: FetchEventStatusType) => void): Refhandler;
15
15
  constructObjectToSend<T extends EmbedEvent>(type: T, payload?: PayloadByEvent[T], id?: string, status?: FetchEventStatusType): AdaCustomEvent;
16
16
  }
@@ -10,7 +10,7 @@ export interface EmbedRequestPayloadByEvent {
10
10
  duration: number | null;
11
11
  responseId?: string | null;
12
12
  };
13
- DELETE_HISTORY: unknown;
13
+ DELETE_HISTORY: undefined;
14
14
  DISPATCH: StoreDispatchPayload;
15
15
  EVAL_CAMPAIGN_CONDITIONS: CampaignParams;
16
16
  GET: StoreGetPayload;
@@ -28,6 +28,9 @@ export interface EmbedRequestPayloadByEvent {
28
28
  SET_DEVICE_TOKEN: {
29
29
  token: string;
30
30
  };
31
+ TRIGGER_ANSWER: {
32
+ answerId: string;
33
+ };
31
34
  }
32
35
  export declare type EmbedRequestEvent = keyof EmbedRequestPayloadByEvent;
33
36
  export interface EmbedResponsePayloadByEvent {
@@ -21,9 +21,9 @@ export interface TrackEventParams {
21
21
  value?: number;
22
22
  meta?: {};
23
23
  }
24
- export interface SendGreetingParams {
24
+ export declare type SendGreetingParams = {
25
25
  responseId?: string;
26
- }
26
+ } | undefined;
27
27
  export interface TriggerCampaignParams {
28
28
  campaignKey: string;
29
29
  ignoreStatus?: boolean;
@@ -15806,7 +15806,7 @@ const client = new error_tracker_BrowserClient({
15806
15806
  },
15807
15807
 
15808
15808
  environment: "production",
15809
- release: "1.4.21-01ef787",
15809
+ release: "1.5.1-7730260",
15810
15810
  sampleRate: 0.25,
15811
15811
  autoSessionTracking: false,
15812
15812
  // Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
@@ -16436,7 +16436,7 @@ function getEmbedURL(_ref) {
16436
16436
  host = "http://".concat(window.location.hostname, ":9001");
16437
16437
  }
16438
16438
 
16439
- return "".concat(host, "/embed/").concat(frameName, "/").concat("01ef787", "/index.html");
16439
+ return "".concat(host, "/embed/").concat(frameName, "/").concat("7730260", "/index.html");
16440
16440
  }
16441
16441
 
16442
16442
  function constructQueryString(query) {
@@ -18186,9 +18186,9 @@ async function log(message, extra, options) {
18186
18186
  service: "embed",
18187
18187
  env: "production",
18188
18188
  embedVersion: 2,
18189
- version: "1.4.21",
18189
+ version: "1.5.1",
18190
18190
  isNpm: true,
18191
- commitHash: "01ef787"
18191
+ commitHash: "7730260"
18192
18192
  }))
18193
18193
  });
18194
18194
  }
@@ -18761,7 +18761,7 @@ class ChatFrame extends d {
18761
18761
  const hostPageUrlParams = new (url_default())(window.location.href).searchParams;
18762
18762
  const smsToken = hostPageUrlParams.get("adaSMSToken");
18763
18763
  const queryParams = {
18764
- embedVersion: "01ef787".slice(0, 7),
18764
+ embedVersion: "7730260".slice(0, 7),
18765
18765
  greeting,
18766
18766
  language,
18767
18767
  skipGreeting,
@@ -19819,7 +19819,7 @@ class Container extends d {
19819
19819
  });
19820
19820
  } else {
19821
19821
  // otherwise, send the bot's default greeting answer (if the conversation has messages already, `chat` will ignore this message)
19822
- chatChannel.postMessage(SEND_GREETING);
19822
+ chatChannel.postMessage(SEND_GREETING, undefined);
19823
19823
  }
19824
19824
 
19825
19825
  this.setState({
@@ -20235,7 +20235,7 @@ class Container extends d {
20235
20235
  throw new AdaEmbedError("`xStorageChannel` is null");
20236
20236
  }
20237
20237
 
20238
- xStorageChannel.postMessage(DELETE_HISTORY_EVENT); // Clear chatter data from local storage
20238
+ xStorageChannel.postMessage(DELETE_HISTORY_EVENT, undefined); // Clear chatter data from local storage
20239
20239
 
20240
20240
  safeLocalStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
20241
20241
  safeSessionStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
@@ -20284,7 +20284,7 @@ class Container extends d {
20284
20284
  chatterToken: null,
20285
20285
  chatterCreated: null
20286
20286
  });
20287
- xStorageChannel.postMessage(DELETE_HISTORY_EVENT);
20287
+ xStorageChannel.postMessage(DELETE_HISTORY_EVENT, undefined);
20288
20288
  localChannel.postMessage(DELETE_HISTORY_RESPONSE, null, id);
20289
20289
  break;
20290
20290
  }
@@ -20336,7 +20336,7 @@ class Container extends d {
20336
20336
  const chatChannel = messageService.getChannel(CHAT_IFRAME);
20337
20337
 
20338
20338
  if (chatChannel) {
20339
- chatChannel.postMessage(CLOSE_CAMPAIGN);
20339
+ chatChannel.postMessage(CLOSE_CAMPAIGN, undefined);
20340
20340
  }
20341
20341
 
20342
20342
  localChannel.postMessage(CLOSE_CAMPAIGN_RESPONSE, null, id);
@@ -20532,7 +20532,7 @@ class Container extends d {
20532
20532
  throw new AdaEmbedError("`xStorageChannel` is null");
20533
20533
  }
20534
20534
 
20535
- xStorageChannel.postMessage(DELETE_HISTORY_EVENT);
20535
+ xStorageChannel.postMessage(DELETE_HISTORY_EVENT, undefined);
20536
20536
 
20537
20537
  if (chatHasBeenRendered) {
20538
20538
  this.setState({
@@ -20976,7 +20976,7 @@ class Embed {
20976
20976
 
20977
20977
  }
20978
20978
 
20979
- _defineProperty(Embed, "embed2Version", "01ef787");
20979
+ _defineProperty(Embed, "embed2Version", "7730260");
20980
20980
  ;// CONCATENATED MODULE: ./src/common/helpers/startup.ts
20981
20981
 
20982
20982
 
@@ -21150,6 +21150,14 @@ function createEmbedObject() {
21150
21150
 
21151
21151
  (_embed15 = embed) === null || _embed15 === void 0 ? void 0 : _embed15.toggle();
21152
21152
  }
21153
+ },
21154
+ triggerAnswer: answerId => {
21155
+ var _embed16;
21156
+
21157
+ const channel = (_embed16 = embed) === null || _embed16 === void 0 ? void 0 : _embed16.messageService.getChannel("chat");
21158
+ channel === null || channel === void 0 ? void 0 : channel.postMessage("TRIGGER_ANSWER", {
21159
+ answerId
21160
+ });
21153
21161
  }
21154
21162
  });
21155
21163
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.4.21",
3
+ "version": "1.5.1",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index-npm.d.ts",