@ada-support/embed2 1.8.6 → 1.8.10

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.
@@ -38,6 +38,7 @@ export interface EmbedRequestPayloadByEvent {
38
38
  INJECT_PROACTIVE_CONVERSATION: {
39
39
  key: string;
40
40
  messageParams: Record<string, string>;
41
+ language: string;
41
42
  };
42
43
  }
43
44
  export declare type EmbedRequestEvent = keyof EmbedRequestPayloadByEvent;
@@ -13949,7 +13949,7 @@ const client = new BrowserClient({
13949
13949
  return event;
13950
13950
  },
13951
13951
  environment: "production",
13952
- release: "1.8.6-e6fb8a1",
13952
+ release: "1.8.10-b7d62d8",
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}/${"e6fb8a1"}/index.html`;
14529
+ return `${host}/embed/${frameName}/${"b7d62d8"}/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.6",
15724
+ version: "1.8.10",
15725
15725
  isNpm: true,
15726
- commitHash: "e6fb8a1"
15726
+ commitHash: "b7d62d8"
15727
15727
  }))
15728
15728
  });
15729
15729
  }
@@ -16257,7 +16257,6 @@ function proactiveConversation_objectSpread(e) { for (var r = 1; r < arguments.l
16257
16257
 
16258
16258
 
16259
16259
 
16260
-
16261
16260
  function proactiveShownWithinFrequency(proactiveConversationKey, frequency, handle) {
16262
16261
  switch (frequency) {
16263
16262
  case "always":
@@ -16297,6 +16296,7 @@ function proactiveTriggerImpl(_ref) {
16297
16296
  proactiveConversation,
16298
16297
  adaSettings,
16299
16298
  messageService,
16299
+ language,
16300
16300
  setRecentProactiveConversationConfig,
16301
16301
  clearProactiveConversation
16302
16302
  } = _ref;
@@ -16315,8 +16315,7 @@ function proactiveTriggerImpl(_ref) {
16315
16315
  frequency,
16316
16316
  active
16317
16317
  } = proactiveConversation.modality_config.chat;
16318
- const lang = adaSettings.language || get_browser_language();
16319
- let proactiveMessage = proactiveConversation.messages[lang][0];
16318
+ let proactiveMessage = proactiveConversation.messages[language][0];
16320
16319
  if (!active) {
16321
16320
  warn("Proactive message is not active");
16322
16321
  return;
@@ -16362,7 +16361,7 @@ function proactiveTriggerImpl(_ref) {
16362
16361
  });
16363
16362
  log("Proactive message displayed", {
16364
16363
  handle,
16365
- language: lang,
16364
+ language,
16366
16365
  duration,
16367
16366
  delay
16368
16367
  });
@@ -16899,7 +16898,7 @@ class ChatFrame extends d {
16899
16898
  const hostPageUrlParams = new URL(window.location.href).searchParams;
16900
16899
  const smsToken = hostPageUrlParams.get("adaSMSToken");
16901
16900
  const queryParams = {
16902
- embedVersion: "e6fb8a1".slice(0, 7),
16901
+ embedVersion: "b7d62d8".slice(0, 7),
16903
16902
  greeting,
16904
16903
  language,
16905
16904
  skipGreeting,
@@ -17873,7 +17872,8 @@ class Container extends d {
17873
17872
  chatterInLiveChat,
17874
17873
  messageService,
17875
17874
  wasCampaignShownButNowClosed,
17876
- setGlobalState
17875
+ setGlobalState,
17876
+ language
17877
17877
  } = this.props;
17878
17878
  const {
17879
17879
  toggleCallback
@@ -17924,6 +17924,7 @@ class Container extends d {
17924
17924
  proactiveConversation,
17925
17925
  adaSettings,
17926
17926
  messageService,
17927
+ language: language || get_browser_language(),
17927
17928
  setRecentProactiveConversationConfig: config => this.setState({
17928
17929
  recentProactiveConversationConfig: config
17929
17930
  }),
@@ -17958,12 +17959,13 @@ class Container extends d {
17958
17959
  // This can be used by the AI manager to customize the greeting
17959
17960
  setGlobalState({
17960
17961
  metaFields: {
17961
- proactive_conversation: true
17962
+ proactive_conversation: recentProactiveConversationConfig.key
17962
17963
  }
17963
17964
  });
17964
17965
  chatChannel.postMessage(INJECT_PROACTIVE_CONVERSATION, {
17965
17966
  key: recentProactiveConversationConfig.key,
17966
- messageParams: recentProactiveConversationConfig.params
17967
+ messageParams: recentProactiveConversationConfig.params,
17968
+ language: language || get_browser_language()
17967
17969
  });
17968
17970
  log("Proactive message clicked", {
17969
17971
  handle: adaSettings.handle,
@@ -1,10 +1,11 @@
1
1
  import type { StartOptions } from "@ada-support/embed-types";
2
2
  import type { MessageService } from "client/lib/message-service";
3
3
  import type { ProactiveConversation, RecentProactiveConversationConfig, UrlTriggerCondition } from "./types";
4
- export declare function proactiveTriggerImpl({ proactiveConversation, adaSettings, messageService, setRecentProactiveConversationConfig, clearProactiveConversation, }: {
4
+ export declare function proactiveTriggerImpl({ proactiveConversation, adaSettings, messageService, language, setRecentProactiveConversationConfig, clearProactiveConversation, }: {
5
5
  proactiveConversation: ProactiveConversation;
6
6
  adaSettings: StartOptions;
7
7
  messageService: MessageService;
8
+ language: string;
8
9
  setRecentProactiveConversationConfig: (config: RecentProactiveConversationConfig) => void;
9
10
  clearProactiveConversation: () => void;
10
11
  }): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.8.6",
3
+ "version": "1.8.10",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index-npm.d.ts",
@@ -77,8 +77,8 @@
77
77
  "eslint-plugin-compat": "^4.0.2",
78
78
  "eslint-plugin-cypress": "^2.12.1",
79
79
  "eslint-plugin-sonarjs": "^0.11.0",
80
- "husky": "^7.0.0",
81
80
  "html-webpack-plugin": "^5.5.0",
81
+ "husky": "^7.0.0",
82
82
  "jest": "^27.5.1",
83
83
  "jest-localstorage-mock": "^2.4.0",
84
84
  "lint-staged": "^11.2.3",