@ada-support/embed2 1.2.11 → 1.2.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.
@@ -15811,7 +15811,7 @@ const client = new error_tracker_BrowserClient({
15811
15811
  },
15812
15812
 
15813
15813
  environment: "production",
15814
- release: "1.2.11-4375ed8",
15814
+ release: "1.2.14-1aa8551",
15815
15815
  sampleRate: 0.25,
15816
15816
  autoSessionTracking: false,
15817
15817
  // Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
@@ -16426,7 +16426,7 @@ function getEmbedURL(_ref) {
16426
16426
  host = "http://".concat(window.location.hostname, ":9001");
16427
16427
  }
16428
16428
 
16429
- return "".concat(host, "/embed/").concat(frameName, "/").concat("4375ed8", "/index.html");
16429
+ return "".concat(host, "/embed/").concat(frameName, "/").concat("1aa8551", "/index.html");
16430
16430
  }
16431
16431
  /**
16432
16432
  * Generate the Chat / API URL
@@ -17848,6 +17848,7 @@ function _objectWithoutProperties(source, excluded) {
17848
17848
 
17849
17849
 
17850
17850
  const _excluded = ["chat", "chat_button", "features", "handle", "language", "persistence", "privacy", "rollout", "tint"];
17851
+
17851
17852
  class Client {
17852
17853
  constructor(clientResponse) {
17853
17854
  _defineProperty(this, "tint", void 0);
@@ -17914,7 +17915,7 @@ function getButtonText(client) {
17914
17915
  var _client$ui_settings, _client$ui_settings$e;
17915
17916
 
17916
17917
  const buttonTextMap = client === null || client === void 0 ? void 0 : (_client$ui_settings = client.ui_settings) === null || _client$ui_settings === void 0 ? void 0 : (_client$ui_settings$e = _client$ui_settings.embed) === null || _client$ui_settings$e === void 0 ? void 0 : _client$ui_settings$e.button_text;
17917
- const languageKey = (client === null || client === void 0 ? void 0 : client.language) || "en";
17918
+ const languageKey = get_browser_language();
17918
17919
 
17919
17920
  if (!buttonTextMap || !buttonTextMap[languageKey]) {
17920
17921
  return "Chat";
@@ -18001,9 +18002,9 @@ async function log(message, extra, options) {
18001
18002
  service: "embed",
18002
18003
  env: "production",
18003
18004
  embedVersion: 2,
18004
- version: "1.2.11",
18005
+ version: "1.2.14",
18005
18006
  isNpm: true,
18006
- commitHash: "4375ed8"
18007
+ commitHash: "1aa8551"
18007
18008
  }))
18008
18009
  });
18009
18010
  }
@@ -18430,7 +18431,7 @@ class ChatFrame extends d {
18430
18431
  const hostPageUrlParams = new (url_default())(window.location.href).searchParams;
18431
18432
  const smsToken = hostPageUrlParams.get("adaSMSToken");
18432
18433
  const queryParams = {
18433
- embedVersion: "4375ed8".slice(0, 7),
18434
+ embedVersion: "1aa8551".slice(0, 7),
18434
18435
  greeting,
18435
18436
  language,
18436
18437
  skipGreeting,
@@ -19698,6 +19699,28 @@ class Container extends d {
19698
19699
  }
19699
19700
  }
19700
19701
 
19702
+ async handleSettingDeviceToken(localChannel, payload, id) {
19703
+ const {
19704
+ setState,
19705
+ sensitiveMetaFields,
19706
+ metaFields
19707
+ } = this.props;
19708
+ const sdkType = (metaFields === null || metaFields === void 0 ? void 0 : metaFields.sdkType) || "WEB"; // If using react native then send os type as android since react native uses Firebase Cloud Messaging
19709
+
19710
+ const deviceOS = sdkType === "REACTNATIVE" ? "ANDROID" : sdkType;
19711
+ const {
19712
+ token
19713
+ } = payload;
19714
+ await setState({
19715
+ deviceToken: token,
19716
+ sensitiveMetaFields: Container_objectSpread(Container_objectSpread({}, sensitiveMetaFields), {}, {
19717
+ device_token: token,
19718
+ device_os: deviceOS
19719
+ })
19720
+ });
19721
+ localChannel.postMessage(SET_DEVICE_TOKEN_RESPONSE, null, id);
19722
+ }
19723
+
19701
19724
  async handleEmbedAction(type, payload, id) {
19702
19725
  const {
19703
19726
  client,
@@ -19953,16 +19976,7 @@ class Container extends d {
19953
19976
 
19954
19977
  case SET_DEVICE_TOKEN:
19955
19978
  {
19956
- const {
19957
- setState
19958
- } = this.props;
19959
- const {
19960
- token
19961
- } = payload;
19962
- await setState({
19963
- deviceToken: token
19964
- });
19965
- localChannel.postMessage(SET_DEVICE_TOKEN_RESPONSE, null, id);
19979
+ this.handleSettingDeviceToken(localChannel, payload, id);
19966
19980
  break;
19967
19981
  }
19968
19982
 
@@ -20574,7 +20588,7 @@ class Embed {
20574
20588
 
20575
20589
  }
20576
20590
 
20577
- _defineProperty(Embed, "embed2Version", "4375ed8");
20591
+ _defineProperty(Embed, "embed2Version", "1aa8551");
20578
20592
  ;// CONCATENATED MODULE: ./src/common/helpers/startup.ts
20579
20593
 
20580
20594
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.2.11",
3
+ "version": "1.2.14",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index-npm.d.ts",