@ada-support/embed2 1.8.12 → 1.8.14

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.
@@ -13949,7 +13949,7 @@ const client = new BrowserClient({
13949
13949
  return event;
13950
13950
  },
13951
13951
  environment: "production",
13952
- release: "1.8.12-e3b82f6",
13952
+ release: "1.8.14-123ab9c",
13953
13953
  sampleRate: 0.25,
13954
13954
  autoSessionTracking: false,
13955
13955
  // Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
@@ -14526,7 +14526,7 @@ function getEmbedURL(_ref) {
14526
14526
  } else {
14527
14527
  host = `http://${handle}.localhost:9001`;
14528
14528
  }
14529
- return `${host}/embed/${frameName}/${"e3b82f6"}/index.html`;
14529
+ return `${host}/embed/${frameName}/${"123ab9c"}/index.html`;
14530
14530
  }
14531
14531
  function constructQueryString(query) {
14532
14532
  return Object.keys(query).map(key => {
@@ -15721,9 +15721,9 @@ async function log(message, extra, options) {
15721
15721
  service: "embed",
15722
15722
  env: "production",
15723
15723
  embedVersion: 2,
15724
- version: "1.8.12",
15724
+ version: "1.8.14",
15725
15725
  isNpm: true,
15726
- commitHash: "e3b82f6"
15726
+ commitHash: "123ab9c"
15727
15727
  }))
15728
15728
  });
15729
15729
  }
@@ -16294,6 +16294,7 @@ function recordProactiveTrigger(proactiveConversationKey, frequency, handle) {
16294
16294
  function proactiveTriggerImpl(_ref) {
16295
16295
  let {
16296
16296
  proactiveConversation,
16297
+ triggerMethod,
16297
16298
  adaSettings,
16298
16299
  messageService,
16299
16300
  language,
@@ -16339,11 +16340,12 @@ function proactiveTriggerImpl(_ref) {
16339
16340
  return;
16340
16341
  }
16341
16342
  }
16342
-
16343
- // Check if the proactive message has been shown within the specified frequency
16344
- const doesPassFrequencyCheck = !proactiveShownWithinFrequency(messageKey, frequency, handle);
16345
- if (!doesPassFrequencyCheck) {
16346
- return;
16343
+ if (triggerMethod === "url") {
16344
+ // Check if the proactive message has been shown within the specified frequency
16345
+ const doesPassFrequencyCheck = !proactiveShownWithinFrequency(messageKey, frequency, handle);
16346
+ if (!doesPassFrequencyCheck) {
16347
+ return;
16348
+ }
16347
16349
  }
16348
16350
 
16349
16351
  // Record the proactive message as being shown
@@ -16898,7 +16900,7 @@ class ChatFrame extends d {
16898
16900
  const hostPageUrlParams = new URL(window.location.href).searchParams;
16899
16901
  const smsToken = hostPageUrlParams.get("adaSMSToken");
16900
16902
  const queryParams = {
16901
- embedVersion: "e3b82f6".slice(0, 7),
16903
+ embedVersion: "123ab9c".slice(0, 7),
16902
16904
  greeting,
16903
16905
  language,
16904
16906
  skipGreeting,
@@ -17782,6 +17784,7 @@ class Container extends d {
17782
17784
  chatVersion: undefined,
17783
17785
  readyToRenderChatFrame: false,
17784
17786
  proactiveConversation: null,
17787
+ proactiveConversationTriggerMethod: null,
17785
17788
  recentProactiveConversationConfig: null
17786
17789
  });
17787
17790
  _defineProperty(this, "resetChatBound", this.resetChat.bind(this));
@@ -17907,6 +17910,7 @@ class Container extends d {
17907
17910
  campaignTriggerOptions,
17908
17911
  followUpResponseId,
17909
17912
  proactiveConversation,
17913
+ proactiveConversationTriggerMethod,
17910
17914
  recentProactiveConversationConfig
17911
17915
  } = this.state;
17912
17916
 
@@ -17936,6 +17940,7 @@ class Container extends d {
17936
17940
  if (proactiveConversation && appConnectionState === ConnectionState.Done) {
17937
17941
  proactiveTriggerImpl({
17938
17942
  proactiveConversation,
17943
+ triggerMethod: proactiveConversationTriggerMethod,
17939
17944
  adaSettings,
17940
17945
  messageService,
17941
17946
  language: language || get_browser_language(),
@@ -18213,7 +18218,7 @@ class Container extends d {
18213
18218
  if (chatConfig.active && !isTemplate && evaluateUrlTriggerConditions(chatConfig.url_trigger_conditions, currentUrl)) {
18214
18219
  this.handleProactiveTrigger(Container_objectSpread({
18215
18220
  key
18216
- }, conversation));
18221
+ }, conversation), "url");
18217
18222
  }
18218
18223
  });
18219
18224
  }
@@ -18238,15 +18243,14 @@ class Container extends d {
18238
18243
  });
18239
18244
  localChannel.postMessage(SET_DEVICE_TOKEN_RESPONSE, null, id);
18240
18245
  }
18241
- handleProactiveTrigger(proactiveConversation) {
18246
+ handleProactiveTrigger(proactiveConversation, triggerMethod) {
18242
18247
  const {
18243
18248
  isDrawerOpen
18244
18249
  } = this.props;
18245
- if (isDrawerOpen) {
18246
- return;
18247
- }
18250
+ if (isDrawerOpen) return;
18248
18251
  this.setState({
18249
- proactiveConversation
18252
+ proactiveConversation,
18253
+ proactiveConversationTriggerMethod: triggerMethod
18250
18254
  });
18251
18255
  }
18252
18256
  async handleEmbedAction(type, payload, id) {
@@ -18506,7 +18510,7 @@ class Container extends d {
18506
18510
  this.handleProactiveTrigger(Container_objectSpread(Container_objectSpread({}, proactiveConversation), {}, {
18507
18511
  key: messageKey,
18508
18512
  params
18509
- }));
18513
+ }), "programmatic");
18510
18514
  } else {
18511
18515
  warn(`Proactive message with key ${messageKey} not found`);
18512
18516
  }
@@ -1,8 +1,9 @@
1
1
  import type { StartOptions } from "@ada-support/embed-types";
2
2
  import type { MessageService } from "client/lib/message-service";
3
- import type { ProactiveConversation, ProactiveConversationUrlTriggerConditions, RecentProactiveConversationConfig } from "./types";
4
- export declare function proactiveTriggerImpl({ proactiveConversation, adaSettings, messageService, language, setRecentProactiveConversationConfig, clearProactiveConversation, }: {
3
+ import type { ProactiveConversation, ProactiveConversationTriggerMethod, ProactiveConversationUrlTriggerConditions, RecentProactiveConversationConfig } from "./types";
4
+ export declare function proactiveTriggerImpl({ proactiveConversation, triggerMethod, adaSettings, messageService, language, setRecentProactiveConversationConfig, clearProactiveConversation, }: {
5
5
  proactiveConversation: ProactiveConversation;
6
+ triggerMethod: ProactiveConversationTriggerMethod | null;
6
7
  adaSettings: StartOptions;
7
8
  messageService: MessageService;
8
9
  language: string;
@@ -29,3 +29,4 @@ export interface UrlTriggerCondition {
29
29
  type: ProactiveConversationUrlTriggerConditionType;
30
30
  value: string;
31
31
  }
32
+ export declare type ProactiveConversationTriggerMethod = "url" | "programmatic";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.8.12",
3
+ "version": "1.8.14",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index-npm.d.ts",