@ada-support/embed2 1.6.7 → 1.6.9

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.
@@ -1,10 +1,10 @@
1
+ import type { AdaStorageKey, AdaStorageValueByKey } from "@ada-support/web-storage";
1
2
  import type { Client } from "common/models/client";
2
- import type { StorageKey, StorageValueByKey } from "frames/lib/safe-storage";
3
3
  export declare const PERSISTENCE_NORMAL = "normal";
4
4
  export declare const PERSISTENCE_SESSION = "session";
5
5
  /**
6
6
  * Retrieves items from local or session storage, depending on the client's
7
7
  * persistence setting. If privateMode is set, it returns null.
8
8
  */
9
- export declare function retrieveStorage<T extends StorageKey>(key: T, client: Client, privateMode?: boolean): StorageValueByKey[T] | null;
10
- export declare function setBrowserStorageItem<T extends StorageKey>(key: T, value: StorageValueByKey[T], persistenceSetting: Client["persistence"]): void;
9
+ export declare function retrieveStorage<T extends AdaStorageKey>(key: T, client: Client, privateMode?: boolean): AdaStorageValueByKey[T] | null;
10
+ export declare function setBrowserStorageItem<T extends AdaStorageKey>(key: T, value: AdaStorageValueByKey[T], persistenceSetting: Client["persistence"]): void;
@@ -1,6 +1,109 @@
1
1
  /******/ (function() { // webpackBootstrap
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
+ /***/ 2740:
5
+ /***/ (function(__unused_webpack_module, exports) {
6
+
7
+ "use strict";
8
+
9
+ var __assign = (this && this.__assign) || function () {
10
+ __assign = Object.assign || function(t) {
11
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
12
+ s = arguments[i];
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
14
+ t[p] = s[p];
15
+ }
16
+ return t;
17
+ };
18
+ return __assign.apply(this, arguments);
19
+ };
20
+ exports.__esModule = true;
21
+ exports.createStorage = void 0;
22
+ var WEB_STORAGE_ACCESS_ERROR_MESSAGE = "Cannot access Web Storage API";
23
+ var createStorage = function (storageProvider) {
24
+ var storage = {
25
+ setItem: function (key, value) {
26
+ try {
27
+ storageProvider.setItem(key, JSON.stringify(value));
28
+ }
29
+ catch (e) {
30
+ console.warn(WEB_STORAGE_ACCESS_ERROR_MESSAGE);
31
+ }
32
+ },
33
+ getItem: function (key) {
34
+ try {
35
+ var rawStorageValue = storageProvider.getItem(key);
36
+ return rawStorageValue && JSON.parse(rawStorageValue);
37
+ }
38
+ catch (e) {
39
+ console.warn(WEB_STORAGE_ACCESS_ERROR_MESSAGE);
40
+ return null;
41
+ }
42
+ },
43
+ removeItem: function (key) {
44
+ try {
45
+ storageProvider.removeItem(key);
46
+ }
47
+ catch (e) {
48
+ console.warn(WEB_STORAGE_ACCESS_ERROR_MESSAGE);
49
+ }
50
+ },
51
+ clear: function () {
52
+ try {
53
+ storageProvider.clear();
54
+ }
55
+ catch (e) {
56
+ console.warn(WEB_STORAGE_ACCESS_ERROR_MESSAGE);
57
+ }
58
+ },
59
+ /** Stores a key/value pair within `ada-functional-storage` Storage key */
60
+ setFnItem: function (key, value) {
61
+ var _a;
62
+ var currentValue = storage.getItem("ada-functional-storage") || {};
63
+ var newValue = __assign(__assign({}, currentValue), (_a = {}, _a[key] = value, _a));
64
+ storage.setItem("ada-functional-storage", newValue);
65
+ },
66
+ /** Gets a value under `ada-functional-storage` Storage key */
67
+ getFnItem: function (key) {
68
+ var value = storage.getItem("ada-functional-storage");
69
+ return (value && value[key]) || null;
70
+ }
71
+ };
72
+ return storage;
73
+ };
74
+ exports.createStorage = createStorage;
75
+
76
+
77
+ /***/ }),
78
+
79
+ /***/ 1110:
80
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
81
+
82
+ "use strict";
83
+ var __webpack_unused_export__;
84
+
85
+ __webpack_unused_export__ = true;
86
+ __webpack_unused_export__ = exports.Dp = exports.wG = void 0;
87
+ var create_storage_1 = __webpack_require__(2740);
88
+ exports.wG = (0, create_storage_1.createStorage)(localStorage);
89
+ exports.Dp = (0, create_storage_1.createStorage)(sessionStorage);
90
+ /** Checks if Web Storage API is supported */
91
+ var isWebStorageSupported = function () {
92
+ try {
93
+ var key = "key_to_test_local_storage";
94
+ localStorage.setItem(key, key);
95
+ localStorage.removeItem(key);
96
+ return true;
97
+ }
98
+ catch (e) {
99
+ return false;
100
+ }
101
+ };
102
+ __webpack_unused_export__ = isWebStorageSupported;
103
+
104
+
105
+ /***/ }),
106
+
4
107
  /***/ 8580:
5
108
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
6
109
 
@@ -7210,7 +7313,7 @@ function now(){
7210
7313
  /******/ };
7211
7314
  /******/
7212
7315
  /******/ // Execute the module function
7213
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
7316
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
7214
7317
  /******/
7215
7318
  /******/ // Flag the module as loaded
7216
7319
  /******/ module.loaded = true;
@@ -15806,7 +15909,7 @@ const client = new error_tracker_BrowserClient({
15806
15909
  },
15807
15910
 
15808
15911
  environment: "production",
15809
- release: "1.6.7-882cb6f",
15912
+ release: "1.6.9-968961c",
15810
15913
  sampleRate: 0.25,
15811
15914
  autoSessionTracking: false,
15812
15915
  // Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
@@ -16436,7 +16539,7 @@ function getEmbedURL(_ref) {
16436
16539
  host = "http://".concat(window.location.hostname, ":9001");
16437
16540
  }
16438
16541
 
16439
- return "".concat(host, "/embed/").concat(frameName, "/").concat("882cb6f", "/index.html");
16542
+ return "".concat(host, "/embed/").concat(frameName, "/").concat("968961c", "/index.html");
16440
16543
  }
16441
16544
 
16442
16545
  function constructQueryString(query) {
@@ -16632,111 +16735,8 @@ const actions = {
16632
16735
  };
16633
16736
  }
16634
16737
  };
16635
- ;// CONCATENATED MODULE: ./src/common/constants/storage-keys.ts
16636
- const CHATTER_TOKEN_STORAGE_KEY = "chatter";
16637
- const CHATTER_CREATED_STORAGE_KEY = "ada-embed_chatter-created";
16638
- const SESSION_AUTH_TOKEN_STORAGE_KEY = "ada-embed_session-token";
16639
- const IN_LIVE_CHAT_STORAGE_KEY = "inLiveChat";
16640
- const ZD_SESSION_STORAGE_KEY = "ada-embed_zd-session-id";
16641
- const ZD_PREVIOUS_TAGS_STORAGE_KEY = "ada-embed_zd-previous-tags";
16642
- const IS_DRAWER_OPEN_STORAGE_KEY = "ada-embed_is-drawer-open";
16643
- const ZD_MESSAGING_EXTERNAL_USER_ID_STORAGE_KEY = "ada-embed_zd-messaging-external-user-id";
16644
- const ZD_MESSAGING_CHATTER_CREATED_STORAGE_KEY = "ada-embed_zd-messaging-chatter-created";
16645
- /** @deprecated - Use CHATTER_TOKEN_STORAGE_KEY */
16646
-
16647
- const CHATTER_STORAGE_KEY = (/* unused pure expression or super */ null && (CHATTER_TOKEN_STORAGE_KEY));
16648
- ;// CONCATENATED MODULE: ./src/frames/lib/safe-storage/index.ts
16649
-
16650
-
16651
- let StorageTypes;
16652
-
16653
- (function (StorageTypes) {
16654
- StorageTypes["Local"] = "local";
16655
- StorageTypes["Session"] = "session";
16656
- })(StorageTypes || (StorageTypes = {}));
16657
-
16658
- /**
16659
- * local and session storage can throw exceptions when trying to access them
16660
- * from the Window object and third-party cookies are disabled. SafeStorage
16661
- * wraps common Storage methods in try catch blocks.
16662
- */
16663
- class SafeStorage {
16664
- constructor(storageType) {
16665
- _defineProperty(this, "storageType", void 0);
16666
-
16667
- _defineProperty(this, "storage", null);
16668
-
16669
- this.storageType = storageType;
16670
-
16671
- try {
16672
- this.storage = storageType === "local" ? window.localStorage : window.sessionStorage;
16673
- } catch (e) {
16674
- warn("".concat(this.storageType, "Storage is disabled. This is likely because your browser is blocking third-party cookies."));
16675
- }
16676
- } // eslint-disable-next-line class-methods-use-this
16677
-
16678
-
16679
- seralizeItem(value) {
16680
- try {
16681
- return JSON.stringify(value);
16682
- } catch (error) {
16683
- warn("Attempt to seralize failed: ".concat(error));
16684
- }
16685
-
16686
- return null;
16687
- } // eslint-disable-next-line class-methods-use-this
16688
-
16689
-
16690
- deserializeItem(value) {
16691
- try {
16692
- return JSON.parse(value);
16693
- } catch (error) {
16694
- warn("Attempt to deserialize failed: ".concat(error));
16695
- }
16696
-
16697
- return null;
16698
- }
16699
-
16700
- getItem(key) {
16701
- try {
16702
- if (!this.storage) {
16703
- throw new AdaEmbedError("`storage` is null");
16704
- }
16705
-
16706
- return this.deserializeItem(this.storage.getItem(key));
16707
- } catch (e) {
16708
- warn("Cannot getItem from ".concat(this.storageType, "Storage."));
16709
- return null;
16710
- }
16711
- }
16712
-
16713
- setItem(key, value) {
16714
- try {
16715
- if (!this.storage) {
16716
- throw new AdaEmbedError("`storage` is null");
16717
- }
16718
-
16719
- this.storage.setItem(key, this.seralizeItem(value));
16720
- } catch (e) {
16721
- warn("Cannot setItem in ".concat(this.storageType, "Storage."));
16722
- }
16723
- }
16724
-
16725
- removeItem(key) {
16726
- try {
16727
- if (!this.storage) {
16728
- throw new AdaEmbedError("`storage` is null");
16729
- }
16730
-
16731
- this.storage.removeItem(key);
16732
- } catch (e) {
16733
- warn("Cannot removeItem from ".concat(this.storageType, "Storage."));
16734
- }
16735
- }
16736
-
16737
- }
16738
- const safeLocalStorage = new SafeStorage(StorageTypes.Local);
16739
- const safeSessionStorage = new SafeStorage(StorageTypes.Session);
16738
+ // EXTERNAL MODULE: ./node_modules/@ada-support/web-storage/dist/index.js
16739
+ var dist = __webpack_require__(1110);
16740
16740
  ;// CONCATENATED MODULE: ./src/client/store/mutations/index.ts
16741
16741
 
16742
16742
 
@@ -16748,7 +16748,6 @@ function mutations_objectSpread(target) { for (var i = 1; i < arguments.length;
16748
16748
 
16749
16749
 
16750
16750
 
16751
-
16752
16751
  const mutations = (state, action) => {
16753
16752
  switch (action.type) {
16754
16753
  case ActionTypes.TOGGLE_CHAT_TYPE:
@@ -16764,7 +16763,7 @@ const mutations = (state, action) => {
16764
16763
  hasChatOpenedAfterProactiveMessagesShown = true;
16765
16764
  }
16766
16765
 
16767
- safeLocalStorage.setItem(IS_DRAWER_OPEN_STORAGE_KEY, !state.isDrawerOpen);
16766
+ dist/* adaLocalStorage.setItem */.wG.setItem("ada-embed_is-drawer-open", !state.isDrawerOpen);
16768
16767
  return mutations_objectSpread(mutations_objectSpread({}, state), {}, {
16769
16768
  isDrawerOpen: !state.isDrawerOpen,
16770
16769
  isIntroShown: false,
@@ -17063,6 +17062,19 @@ function notificationPermListener(notificationPermChangeHandler) {
17063
17062
  };
17064
17063
  });
17065
17064
  }
17065
+ ;// CONCATENATED MODULE: ./src/common/constants/storage-keys.ts
17066
+ const CHATTER_TOKEN_STORAGE_KEY = "chatter";
17067
+ const CHATTER_CREATED_STORAGE_KEY = "ada-embed_chatter-created";
17068
+ const SESSION_AUTH_TOKEN_STORAGE_KEY = "ada-embed_session-token";
17069
+ const IN_LIVE_CHAT_STORAGE_KEY = "inLiveChat";
17070
+ const ZD_SESSION_STORAGE_KEY = "ada-embed_zd-session-id";
17071
+ const ZD_PREVIOUS_TAGS_STORAGE_KEY = "ada-embed_zd-previous-tags";
17072
+ const IS_DRAWER_OPEN_STORAGE_KEY = "ada-embed_is-drawer-open";
17073
+ const ZD_MESSAGING_EXTERNAL_USER_ID_STORAGE_KEY = "ada-embed_zd-messaging-external-user-id";
17074
+ const ZD_MESSAGING_CHATTER_CREATED_STORAGE_KEY = "ada-embed_zd-messaging-chatter-created";
17075
+ /** @deprecated - Use CHATTER_TOKEN_STORAGE_KEY */
17076
+
17077
+ const CHATTER_STORAGE_KEY = (/* unused pure expression or super */ null && (CHATTER_TOKEN_STORAGE_KEY));
17066
17078
  ;// CONCATENATED MODULE: ./src/client/store/state.ts
17067
17079
 
17068
17080
 
@@ -17070,7 +17082,7 @@ function notificationPermListener(notificationPermChangeHandler) {
17070
17082
 
17071
17083
 
17072
17084
  function getValueFromStorage(key) {
17073
- return safeLocalStorage.getItem(key) || safeSessionStorage.getItem(key);
17085
+ return dist/* adaLocalStorage.getItem */.wG.getItem(key) || dist/* adaSessionStorage.getItem */.Dp.getItem(key);
17074
17086
  }
17075
17087
 
17076
17088
  const getInitialState = adaSettings => ({
@@ -17423,6 +17435,12 @@ function isStartOptions(input) {
17423
17435
  ;// CONCATENATED MODULE: ./src/campaigns/campaign.ts
17424
17436
 
17425
17437
 
17438
+ function campaign_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17439
+
17440
+ function campaign_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? campaign_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : campaign_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17441
+
17442
+
17443
+
17426
17444
 
17427
17445
 
17428
17446
 
@@ -17449,17 +17467,15 @@ function campaignShownWithinFrequency(campaign, handle) {
17449
17467
 
17450
17468
  case "once-per-session":
17451
17469
  {
17452
- var _safeSessionStorage$g;
17453
-
17454
- const perSessionCampaigns = ((_safeSessionStorage$g = safeSessionStorage.getItem("".concat(handle, "_marketing_campaigns_shown"))) === null || _safeSessionStorage$g === void 0 ? void 0 : _safeSessionStorage$g.split(",")) || [];
17470
+ const storageValue = dist/* adaSessionStorage.getFnItem */.Dp.getFnItem("marketing_campaigns_shown");
17471
+ const perSessionCampaigns = storageValue ? (storageValue[handle] || "").split(",") : [];
17455
17472
  return includes_default()(perSessionCampaigns).call(perSessionCampaigns, campaign.campaign_key);
17456
17473
  }
17457
17474
 
17458
17475
  case "once-per-user":
17459
17476
  {
17460
- var _safeLocalStorage$get;
17461
-
17462
- const perSessionCampaigns = ((_safeLocalStorage$get = safeLocalStorage.getItem("".concat(handle, "_marketing_campaigns_shown"))) === null || _safeLocalStorage$get === void 0 ? void 0 : _safeLocalStorage$get.split(",")) || [];
17477
+ const storageValue = dist/* adaLocalStorage.getFnItem */.wG.getFnItem("marketing_campaigns_shown");
17478
+ const perSessionCampaigns = storageValue ? (storageValue[handle] || "").split(",") : [];
17463
17479
  return includes_default()(perSessionCampaigns).call(perSessionCampaigns, campaign.campaign_key);
17464
17480
  }
17465
17481
 
@@ -17474,25 +17490,27 @@ function addCampaignToStorageString(oldStorageValue, campaignId) {
17474
17490
 
17475
17491
 
17476
17492
  function recordCampaignTrigger(campaignKey, frequency, handle) {
17477
- const storageKey = "".concat(handle, "_marketing_campaigns_shown");
17478
-
17479
17493
  switch (frequency) {
17480
17494
  case "every-time":
17481
17495
  break;
17482
17496
 
17483
17497
  case "once-per-session":
17484
17498
  {
17485
- const oldStorageValue = safeSessionStorage.getItem(storageKey);
17486
- const newStorageValue = addCampaignToStorageString(oldStorageValue, campaignKey);
17487
- safeSessionStorage.setItem(storageKey, newStorageValue);
17499
+ const currentStorageValue = dist/* adaSessionStorage.getFnItem */.Dp.getFnItem("marketing_campaigns_shown");
17500
+ const newStorageValue = addCampaignToStorageString(currentStorageValue ? currentStorageValue[handle] || "" : "", campaignKey);
17501
+ dist/* adaSessionStorage.setFnItem */.Dp.setFnItem("marketing_campaigns_shown", campaign_objectSpread(campaign_objectSpread({}, currentStorageValue), {}, {
17502
+ [handle]: newStorageValue
17503
+ }));
17488
17504
  break;
17489
17505
  }
17490
17506
 
17491
17507
  case "once-per-user":
17492
17508
  {
17493
- const oldStorageValue = safeLocalStorage.getItem(storageKey);
17494
- const newStorageValue = addCampaignToStorageString(oldStorageValue, campaignKey);
17495
- safeLocalStorage.setItem(storageKey, newStorageValue);
17509
+ const currentStorageValue = dist/* adaSessionStorage.getFnItem */.Dp.getFnItem("marketing_campaigns_shown");
17510
+ const newStorageValue = addCampaignToStorageString(currentStorageValue ? currentStorageValue[handle] || "" : "", campaignKey);
17511
+ dist/* adaLocalStorage.setFnItem */.wG.setFnItem("marketing_campaigns_shown", campaign_objectSpread(campaign_objectSpread({}, currentStorageValue), {}, {
17512
+ [handle]: newStorageValue
17513
+ }));
17496
17514
  break;
17497
17515
  }
17498
17516
  // If an unknown frequency type is found, do nothing
@@ -17644,12 +17662,21 @@ function unbindLocationChangeOverrides() {
17644
17662
  window.removeEventListener("popstate", popStateListener);
17645
17663
  }
17646
17664
  ;// CONCATENATED MODULE: ./src/client/helpers/rollout.ts
17665
+
17666
+
17667
+ function rollout_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17668
+
17669
+ function rollout_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? rollout_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : rollout_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17670
+
17671
+
17672
+
17647
17673
  function storeRollout(handle, group, lastProb) {
17648
- try {
17649
- window.localStorage.setItem("".concat(handle, "_ada_chap_rollout_group"), group);
17650
- window.localStorage.setItem("".concat(handle, "_ada_chap_rollout_last_prob"), lastProb.toString());
17651
- } catch (e) {// Failed to set to localStorage
17652
- }
17674
+ dist/* adaLocalStorage.setFnItem */.wG.setFnItem("rolloutGroup", rollout_objectSpread(rollout_objectSpread({}, dist/* adaLocalStorage.getFnItem */.wG.getFnItem("rolloutGroup")), {}, {
17675
+ [handle]: group
17676
+ }));
17677
+ dist/* adaLocalStorage.setFnItem */.wG.setFnItem("rolloutLastValue", rollout_objectSpread(rollout_objectSpread({}, dist/* adaLocalStorage.getFnItem */.wG.getFnItem("rolloutLastValue")), {}, {
17678
+ [handle]: lastProb
17679
+ }));
17653
17680
  }
17654
17681
  /**
17655
17682
  * Reads the stored rollout group and probability
@@ -17661,15 +17688,10 @@ function readRollout(handle) {
17661
17688
  group: null,
17662
17689
  lastProb: null
17663
17690
  };
17664
-
17665
- try {
17666
- rollout.group = window.localStorage.getItem("".concat(handle, "_ada_chap_rollout_group"));
17667
- rollout.lastProb = JSON.parse(window.localStorage.getItem("".concat(handle, "_ada_chap_rollout_last_prob")) || "null");
17668
- return rollout;
17669
- } catch (e) {
17670
- // Failed to read localStorage
17671
- return rollout;
17672
- }
17691
+ rollout.group = // I don't know what ESLint is complaining about here
17692
+ (dist/* adaLocalStorage.getFnItem */.wG.getFnItem("rolloutGroup") || {})[handle] || null;
17693
+ rollout.lastProb = (dist/* adaLocalStorage.getFnItem */.wG.getFnItem("rolloutLastValue") || {})[handle] || null;
17694
+ return rollout;
17673
17695
  }
17674
17696
 
17675
17697
  function checkRollout(rollout, handle) {
@@ -18114,41 +18136,24 @@ function retrieveStorage(key, client, privateMode) {
18114
18136
  }
18115
18137
 
18116
18138
  if (persistence === PERSISTENCE_NORMAL) {
18117
- return safeLocalStorage.getItem(key);
18139
+ return dist/* adaLocalStorage.getItem */.wG.getItem(key);
18118
18140
  }
18119
18141
 
18120
18142
  if (persistence === PERSISTENCE_SESSION) {
18121
- return safeSessionStorage.getItem(key);
18143
+ return dist/* adaSessionStorage.getItem */.Dp.getItem(key);
18122
18144
  }
18123
18145
 
18124
18146
  return null;
18125
18147
  }
18126
18148
  function setBrowserStorageItem(key, value, persistenceSetting) {
18127
18149
  if (persistenceSetting === PERSISTENCE_NORMAL) {
18128
- safeLocalStorage.setItem(key, value);
18150
+ dist/* adaLocalStorage.setItem */.wG.setItem(key, value);
18129
18151
  }
18130
18152
 
18131
18153
  if (persistenceSetting === PERSISTENCE_SESSION) {
18132
- safeSessionStorage.setItem(key, value);
18154
+ dist/* adaSessionStorage.setItem */.Dp.setItem(key, value);
18133
18155
  }
18134
18156
  }
18135
- ;// CONCATENATED MODULE: ./src/services/persistence/index.ts
18136
- const persistence = {
18137
- get: item => {
18138
- try {
18139
- return localStorage.getItem(item);
18140
- } catch (e) {
18141
- /* istanbul ignore next */
18142
- return null;
18143
- }
18144
- },
18145
- set: (item, value) => {
18146
- try {
18147
- localStorage.setItem(item, value);
18148
- } catch (e) {// Do nothing
18149
- }
18150
- }
18151
- };
18152
18157
  // EXTERNAL MODULE: ./node_modules/lodash.memoize/index.js
18153
18158
  var lodash_memoize = __webpack_require__(773);
18154
18159
  var lodash_memoize_default = /*#__PURE__*/__webpack_require__.n(lodash_memoize);
@@ -18192,9 +18197,9 @@ async function log(message, extra, options) {
18192
18197
  service: "embed",
18193
18198
  env: "production",
18194
18199
  embedVersion: 2,
18195
- version: "1.6.7",
18200
+ version: "1.6.9",
18196
18201
  isNpm: true,
18197
- commitHash: "882cb6f"
18202
+ commitHash: "968961c"
18198
18203
  }))
18199
18204
  });
18200
18205
  }
@@ -18277,10 +18282,10 @@ const getChatVersionFromManifest = manifest => {
18277
18282
  }
18278
18283
 
18279
18284
  const manifestString = JSON.stringify(manifest);
18280
- const manifestCache = persistence.get("ada-embed_chat-manifest-cache");
18285
+ const manifestCache = dist/* adaLocalStorage.getItem */.wG.getItem("ada-embed_chat-manifest-cache");
18281
18286
 
18282
18287
  if (manifestString === manifestCache) {
18283
- const assignedVersion = persistence.get("ada-embed_chat-assigned-version");
18288
+ const assignedVersion = dist/* adaLocalStorage.getItem */.wG.getItem("ada-embed_chat-assigned-version");
18284
18289
  /* istanbul ignore else */
18285
18290
 
18286
18291
  if (assignedVersion) {
@@ -18307,8 +18312,8 @@ const getChatVersionFromManifest = manifest => {
18307
18312
  }
18308
18313
  }
18309
18314
 
18310
- persistence.set("ada-embed_chat-assigned-version", hash);
18311
- persistence.set("ada-embed_chat-manifest-cache", manifestString);
18315
+ dist/* adaLocalStorage.setItem */.wG.setItem("ada-embed_chat-assigned-version", hash);
18316
+ dist/* adaLocalStorage.setItem */.wG.setItem("ada-embed_chat-manifest-cache", manifestString);
18312
18317
  return hash;
18313
18318
  };
18314
18319
  const getChatVersion = async adaSettings => {
@@ -18764,7 +18769,7 @@ class ChatFrame extends d {
18764
18769
  const hostPageUrlParams = new (url_default())(window.location.href).searchParams;
18765
18770
  const smsToken = hostPageUrlParams.get("adaSMSToken");
18766
18771
  const queryParams = {
18767
- embedVersion: "882cb6f".slice(0, 7),
18772
+ embedVersion: "968961c".slice(0, 7),
18768
18773
  greeting,
18769
18774
  language,
18770
18775
  skipGreeting,
@@ -19113,11 +19118,11 @@ class ChatFrame extends d {
19113
19118
 
19114
19119
  const storage = (() => {
19115
19120
  if (client.persistence === PERSISTENCE_NORMAL) {
19116
- return safeLocalStorage;
19121
+ return dist/* adaLocalStorage */.wG;
19117
19122
  }
19118
19123
 
19119
19124
  if (client.persistence === PERSISTENCE_SESSION) {
19120
- return safeSessionStorage;
19125
+ return dist/* adaSessionStorage */.Dp;
19121
19126
  }
19122
19127
 
19123
19128
  return null;
@@ -19160,15 +19165,15 @@ class ChatFrame extends d {
19160
19165
  });
19161
19166
 
19162
19167
  if (zdMessagingExternalUserId === null) {
19163
- safeLocalStorage.removeItem(ZD_MESSAGING_EXTERNAL_USER_ID_STORAGE_KEY);
19168
+ dist/* adaLocalStorage.removeItem */.wG.removeItem(ZD_MESSAGING_EXTERNAL_USER_ID_STORAGE_KEY);
19164
19169
  } else {
19165
- safeLocalStorage.setItem(ZD_MESSAGING_EXTERNAL_USER_ID_STORAGE_KEY, zdMessagingExternalUserId);
19170
+ dist/* adaLocalStorage.setItem */.wG.setItem(ZD_MESSAGING_EXTERNAL_USER_ID_STORAGE_KEY, zdMessagingExternalUserId);
19166
19171
  }
19167
19172
 
19168
19173
  if (zdMessagingChatterCreated === null) {
19169
- safeLocalStorage.removeItem(ZD_MESSAGING_CHATTER_CREATED_STORAGE_KEY);
19174
+ dist/* adaLocalStorage.removeItem */.wG.removeItem(ZD_MESSAGING_CHATTER_CREATED_STORAGE_KEY);
19170
19175
  } else {
19171
- safeLocalStorage.setItem(ZD_MESSAGING_CHATTER_CREATED_STORAGE_KEY, zdMessagingChatterCreated);
19176
+ dist/* adaLocalStorage.setItem */.wG.setItem(ZD_MESSAGING_CHATTER_CREATED_STORAGE_KEY, zdMessagingChatterCreated);
19172
19177
  }
19173
19178
 
19174
19179
  break;
@@ -19196,9 +19201,9 @@ class ChatFrame extends d {
19196
19201
 
19197
19202
 
19198
19203
  if (client.persistence === PERSISTENCE_NORMAL) {
19199
- safeLocalStorage.setItem(IN_LIVE_CHAT_STORAGE_KEY, inLiveChat);
19204
+ dist/* adaLocalStorage.setItem */.wG.setItem(IN_LIVE_CHAT_STORAGE_KEY, inLiveChat);
19200
19205
  } else if (client.persistence === PERSISTENCE_SESSION) {
19201
- safeSessionStorage.setItem(IN_LIVE_CHAT_STORAGE_KEY, inLiveChat);
19206
+ dist/* adaSessionStorage.setItem */.Dp.setItem(IN_LIVE_CHAT_STORAGE_KEY, inLiveChat);
19202
19207
  }
19203
19208
 
19204
19209
  break;
@@ -20240,10 +20245,10 @@ class Container extends d {
20240
20245
 
20241
20246
  xStorageChannel.postMessage(DELETE_HISTORY_EVENT, undefined); // Clear chatter data from local storage
20242
20247
 
20243
- safeLocalStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
20244
- safeSessionStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
20245
- safeLocalStorage.removeItem(CHATTER_CREATED_STORAGE_KEY);
20246
- safeSessionStorage.removeItem(CHATTER_CREATED_STORAGE_KEY); // And from state
20248
+ dist/* adaLocalStorage.removeItem */.wG.removeItem(CHATTER_TOKEN_STORAGE_KEY);
20249
+ dist/* adaSessionStorage.removeItem */.Dp.removeItem(CHATTER_TOKEN_STORAGE_KEY);
20250
+ dist/* adaLocalStorage.removeItem */.wG.removeItem(CHATTER_CREATED_STORAGE_KEY);
20251
+ dist/* adaSessionStorage.removeItem */.Dp.removeItem(CHATTER_CREATED_STORAGE_KEY); // And from state
20247
20252
 
20248
20253
  newState = Container_objectSpread(Container_objectSpread({}, newState), {}, {
20249
20254
  chatterToken: null,
@@ -20278,10 +20283,10 @@ class Container extends d {
20278
20283
  } // Clear chatter data from local storage
20279
20284
 
20280
20285
 
20281
- safeLocalStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
20282
- safeSessionStorage.removeItem(CHATTER_TOKEN_STORAGE_KEY);
20283
- safeLocalStorage.removeItem(CHATTER_CREATED_STORAGE_KEY);
20284
- safeSessionStorage.removeItem(CHATTER_CREATED_STORAGE_KEY); // And from state
20286
+ dist/* adaLocalStorage.removeItem */.wG.removeItem(CHATTER_TOKEN_STORAGE_KEY);
20287
+ dist/* adaSessionStorage.removeItem */.Dp.removeItem(CHATTER_TOKEN_STORAGE_KEY);
20288
+ dist/* adaLocalStorage.removeItem */.wG.removeItem(CHATTER_CREATED_STORAGE_KEY);
20289
+ dist/* adaSessionStorage.removeItem */.Dp.removeItem(CHATTER_CREATED_STORAGE_KEY); // And from state
20285
20290
 
20286
20291
  await setState({
20287
20292
  chatterToken: null,
@@ -20980,7 +20985,7 @@ class Embed {
20980
20985
 
20981
20986
  }
20982
20987
 
20983
- _defineProperty(Embed, "embed2Version", "882cb6f");
20988
+ _defineProperty(Embed, "embed2Version", "968961c");
20984
20989
  ;// CONCATENATED MODULE: ./src/common/helpers/startup.ts
20985
20990
 
20986
20991
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.6.7",
3
+ "version": "1.6.9",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index-npm.d.ts",
@@ -84,6 +84,7 @@
84
84
  },
85
85
  "dependencies": {
86
86
  "@ada-support/embed-types": "^1.6.4",
87
+ "@ada-support/web-storage": "^0.10.0",
87
88
  "@babel/core": "^7.16.12",
88
89
  "@babel/plugin-proposal-class-properties": "^7.16.7",
89
90
  "@babel/plugin-proposal-numeric-separator": "^7.16.7",
@@ -1,40 +0,0 @@
1
- import type { CHATTER_CREATED_STORAGE_KEY, CHATTER_TOKEN_STORAGE_KEY, IN_LIVE_CHAT_STORAGE_KEY, SESSION_AUTH_TOKEN_STORAGE_KEY, ZD_MESSAGING_CHATTER_CREATED_STORAGE_KEY, ZD_MESSAGING_EXTERNAL_USER_ID_STORAGE_KEY, ZD_PREVIOUS_TAGS_STORAGE_KEY, ZD_SESSION_STORAGE_KEY } from "common/constants/storage-keys";
2
- export declare enum StorageTypes {
3
- Local = "local",
4
- Session = "session"
5
- }
6
- declare type StorageTypesType = StorageTypes.Local | StorageTypes.Session;
7
- export declare type StorageValueType = string | number | boolean | unknown[];
8
- export interface StorageValueByKey {
9
- [CHATTER_CREATED_STORAGE_KEY]: string;
10
- [CHATTER_TOKEN_STORAGE_KEY]: string;
11
- [SESSION_AUTH_TOKEN_STORAGE_KEY]: string;
12
- [IN_LIVE_CHAT_STORAGE_KEY]: boolean;
13
- [ZD_SESSION_STORAGE_KEY]: string;
14
- [ZD_PREVIOUS_TAGS_STORAGE_KEY]: string;
15
- [ZD_MESSAGING_EXTERNAL_USER_ID_STORAGE_KEY]: string;
16
- [ZD_MESSAGING_CHATTER_CREATED_STORAGE_KEY]: string;
17
- liveChatPending: boolean;
18
- "ada-embed_is-drawer-open": boolean;
19
- "[handle]_marketing_campaigns_shown": string;
20
- test: string;
21
- }
22
- export declare type StorageKey = keyof StorageValueByKey;
23
- /**
24
- * local and session storage can throw exceptions when trying to access them
25
- * from the Window object and third-party cookies are disabled. SafeStorage
26
- * wraps common Storage methods in try catch blocks.
27
- */
28
- export declare class SafeStorage {
29
- storageType: StorageTypesType;
30
- storage: Storage | null;
31
- constructor(storageType: StorageTypesType);
32
- seralizeItem(value: StorageValueType): string | null;
33
- deserializeItem<T extends StorageValueType>(value: string | null): T | null;
34
- getItem<T extends StorageKey>(key: T): StorageValueByKey[T] | null;
35
- setItem<T extends StorageKey>(key: T, value: StorageValueByKey[T]): void;
36
- removeItem(key: StorageKey): void;
37
- }
38
- export declare const safeLocalStorage: SafeStorage;
39
- export declare const safeSessionStorage: SafeStorage;
40
- export {};
@@ -1,6 +0,0 @@
1
- declare type PersistenceKey = "ada-embed_chat-manifest-cache" | "ada-embed_chat-assigned-version";
2
- export declare const persistence: {
3
- get: (item: PersistenceKey) => string;
4
- set: (item: PersistenceKey, value: string) => void;
5
- };
6
- export {};