@ada-support/embed2 1.8.1 → 1.8.3

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.1-14fcfd6",
13952
+ release: "1.8.3-500613b",
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
@@ -14524,7 +14524,7 @@ function getEmbedURL(_ref) {
14524
14524
  } else {
14525
14525
  host = `http://${handle}.localhost:9001`;
14526
14526
  }
14527
- return `${host}/embed/${frameName}/${"14fcfd6"}/index.html`;
14527
+ return `${host}/embed/${frameName}/${"500613b"}/index.html`;
14528
14528
  }
14529
14529
  function constructQueryString(query) {
14530
14530
  return Object.keys(query).map(key => {
@@ -15702,9 +15702,9 @@ async function log(message, extra, options) {
15702
15702
  service: "embed",
15703
15703
  env: "production",
15704
15704
  embedVersion: 2,
15705
- version: "1.8.1",
15705
+ version: "1.8.3",
15706
15706
  isNpm: true,
15707
- commitHash: "14fcfd6"
15707
+ commitHash: "500613b"
15708
15708
  }))
15709
15709
  });
15710
15710
  }
@@ -16237,6 +16237,8 @@ function proactiveConversation_objectSpread(e) { for (var r = 1; r < arguments.l
16237
16237
 
16238
16238
 
16239
16239
 
16240
+
16241
+
16240
16242
  function proactiveShownWithinFrequency(proactiveConversationKey, frequency, handle) {
16241
16243
  switch (frequency) {
16242
16244
  case "always":
@@ -16286,8 +16288,13 @@ function proactiveTriggerImpl(_ref) {
16286
16288
  const {
16287
16289
  duration,
16288
16290
  delay,
16289
- frequency
16291
+ frequency,
16292
+ active
16290
16293
  } = proactiveConversation.modality_config.chat;
16294
+ if (!active) {
16295
+ warn("Proactive message is not active");
16296
+ return;
16297
+ }
16291
16298
 
16292
16299
  // Check if the proactive message has been shown within the specified frequency
16293
16300
  const doesPassFrequencyCheck = !proactiveShownWithinFrequency(messageKey, frequency, handle);
@@ -16307,6 +16314,12 @@ function proactiveTriggerImpl(_ref) {
16307
16314
  duration,
16308
16315
  delay
16309
16316
  });
16317
+ log("Proactive message displayed", {
16318
+ handle,
16319
+ language: lang,
16320
+ duration,
16321
+ delay
16322
+ });
16310
16323
  }
16311
16324
  function evaluateUrlTriggerConditions(conditions, url) {
16312
16325
  if (!conditions.length) {
@@ -16840,7 +16853,7 @@ class ChatFrame extends d {
16840
16853
  const hostPageUrlParams = new URL(window.location.href).searchParams;
16841
16854
  const smsToken = hostPageUrlParams.get("adaSMSToken");
16842
16855
  const queryParams = {
16843
- embedVersion: "14fcfd6".slice(0, 7),
16856
+ embedVersion: "500613b".slice(0, 7),
16844
16857
  greeting,
16845
16858
  language,
16846
16859
  skipGreeting,
@@ -17813,7 +17826,8 @@ class Container extends d {
17813
17826
  adaSettings,
17814
17827
  chatterInLiveChat,
17815
17828
  messageService,
17816
- wasCampaignShownButNowClosed
17829
+ wasCampaignShownButNowClosed,
17830
+ setGlobalState
17817
17831
  } = this.props;
17818
17832
  const {
17819
17833
  toggleCallback
@@ -17895,9 +17909,20 @@ class Container extends d {
17895
17909
  if (isChatWebsocketConnected && isDrawerOpen && recentProactiveConversationKey) {
17896
17910
  const chatChannel = messageService.getChannel(CHAT_IFRAME);
17897
17911
  if (chatChannel) {
17912
+ // Set meta field to indicate that a proactive conversation has been injected
17913
+ // This can be used by the AI manager to customize the greeting
17914
+ setGlobalState({
17915
+ metaFields: {
17916
+ proactive_conversation: true
17917
+ }
17918
+ });
17898
17919
  chatChannel.postMessage(INJECT_PROACTIVE_CONVERSATION, {
17899
17920
  key: recentProactiveConversationKey
17900
17921
  });
17922
+ log("Proactive message clicked", {
17923
+ handle: adaSettings.handle,
17924
+ embedSettings: adaSettings
17925
+ });
17901
17926
  this.setState({
17902
17927
  recentProactiveConversationKey: null
17903
17928
  });
@@ -18414,13 +18439,9 @@ class Container extends d {
18414
18439
  } = payload;
18415
18440
  if ((_client$proactive_con = client.proactive_conversations) !== null && _client$proactive_con !== void 0 && _client$proactive_con[messageKey]) {
18416
18441
  const proactiveConversation = client.proactive_conversations[messageKey];
18417
- if (proactiveConversation.modality_config.chat.active) {
18418
- this.handleProactiveTrigger(Container_objectSpread(Container_objectSpread({}, proactiveConversation), {}, {
18419
- key: messageKey
18420
- }));
18421
- } else {
18422
- warn("Proactive message is not active");
18423
- }
18442
+ this.handleProactiveTrigger(Container_objectSpread(Container_objectSpread({}, proactiveConversation), {}, {
18443
+ key: messageKey
18444
+ }));
18424
18445
  } else {
18425
18446
  warn(`Proactive message with key ${messageKey} not found`);
18426
18447
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.8.1",
3
+ "version": "1.8.3",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index-npm.d.ts",