@ada-support/embed2 1.6.13 → 1.6.16
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";
|
|
2
1
|
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
|
|
10
|
-
export declare function setBrowserStorageItem<T extends
|
|
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;
|
|
@@ -0,0 +1,40 @@
|
|
|
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 {};
|
package/dist/npm-entry/index.js
CHANGED
|
@@ -1,109 +1,6 @@
|
|
|
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
|
-
|
|
107
4
|
/***/ 8580:
|
|
108
5
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
109
6
|
|
|
@@ -7313,7 +7210,7 @@ function now(){
|
|
|
7313
7210
|
/******/ };
|
|
7314
7211
|
/******/
|
|
7315
7212
|
/******/ // Execute the module function
|
|
7316
|
-
/******/ __webpack_modules__[moduleId]
|
|
7213
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
7317
7214
|
/******/
|
|
7318
7215
|
/******/ // Flag the module as loaded
|
|
7319
7216
|
/******/ module.loaded = true;
|
|
@@ -15909,7 +15806,7 @@ const client = new error_tracker_BrowserClient({
|
|
|
15909
15806
|
},
|
|
15910
15807
|
|
|
15911
15808
|
environment: "production",
|
|
15912
|
-
release: "1.6.
|
|
15809
|
+
release: "1.6.16-77eed6f",
|
|
15913
15810
|
sampleRate: 0.25,
|
|
15914
15811
|
autoSessionTracking: false,
|
|
15915
15812
|
// Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
|
|
@@ -16539,7 +16436,7 @@ function getEmbedURL(_ref) {
|
|
|
16539
16436
|
host = "http://".concat(window.location.hostname, ":9001");
|
|
16540
16437
|
}
|
|
16541
16438
|
|
|
16542
|
-
return "".concat(host, "/embed/").concat(frameName, "/").concat("
|
|
16439
|
+
return "".concat(host, "/embed/").concat(frameName, "/").concat("77eed6f", "/index.html");
|
|
16543
16440
|
}
|
|
16544
16441
|
|
|
16545
16442
|
function constructQueryString(query) {
|
|
@@ -16735,8 +16632,111 @@ const actions = {
|
|
|
16735
16632
|
};
|
|
16736
16633
|
}
|
|
16737
16634
|
};
|
|
16738
|
-
|
|
16739
|
-
|
|
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);
|
|
16740
16740
|
;// CONCATENATED MODULE: ./src/client/store/mutations/index.ts
|
|
16741
16741
|
|
|
16742
16742
|
|
|
@@ -16748,6 +16748,7 @@ function mutations_objectSpread(target) { for (var i = 1; i < arguments.length;
|
|
|
16748
16748
|
|
|
16749
16749
|
|
|
16750
16750
|
|
|
16751
|
+
|
|
16751
16752
|
const mutations = (state, action) => {
|
|
16752
16753
|
switch (action.type) {
|
|
16753
16754
|
case ActionTypes.TOGGLE_CHAT_TYPE:
|
|
@@ -16763,7 +16764,7 @@ const mutations = (state, action) => {
|
|
|
16763
16764
|
hasChatOpenedAfterProactiveMessagesShown = true;
|
|
16764
16765
|
}
|
|
16765
16766
|
|
|
16766
|
-
|
|
16767
|
+
safeLocalStorage.setItem(IS_DRAWER_OPEN_STORAGE_KEY, !state.isDrawerOpen);
|
|
16767
16768
|
return mutations_objectSpread(mutations_objectSpread({}, state), {}, {
|
|
16768
16769
|
isDrawerOpen: !state.isDrawerOpen,
|
|
16769
16770
|
isIntroShown: false,
|
|
@@ -17062,19 +17063,6 @@ function notificationPermListener(notificationPermChangeHandler) {
|
|
|
17062
17063
|
};
|
|
17063
17064
|
});
|
|
17064
17065
|
}
|
|
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));
|
|
17078
17066
|
;// CONCATENATED MODULE: ./src/client/store/state.ts
|
|
17079
17067
|
|
|
17080
17068
|
|
|
@@ -17082,7 +17070,7 @@ const CHATTER_STORAGE_KEY = (/* unused pure expression or super */ null && (CHAT
|
|
|
17082
17070
|
|
|
17083
17071
|
|
|
17084
17072
|
function getValueFromStorage(key) {
|
|
17085
|
-
return
|
|
17073
|
+
return safeLocalStorage.getItem(key) || safeSessionStorage.getItem(key);
|
|
17086
17074
|
}
|
|
17087
17075
|
|
|
17088
17076
|
const getInitialState = adaSettings => ({
|
|
@@ -17435,12 +17423,6 @@ function isStartOptions(input) {
|
|
|
17435
17423
|
;// CONCATENATED MODULE: ./src/campaigns/campaign.ts
|
|
17436
17424
|
|
|
17437
17425
|
|
|
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
|
-
|
|
17444
17426
|
|
|
17445
17427
|
|
|
17446
17428
|
|
|
@@ -17467,15 +17449,17 @@ function campaignShownWithinFrequency(campaign, handle) {
|
|
|
17467
17449
|
|
|
17468
17450
|
case "once-per-session":
|
|
17469
17451
|
{
|
|
17470
|
-
|
|
17471
|
-
|
|
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(",")) || [];
|
|
17472
17455
|
return includes_default()(perSessionCampaigns).call(perSessionCampaigns, campaign.campaign_key);
|
|
17473
17456
|
}
|
|
17474
17457
|
|
|
17475
17458
|
case "once-per-user":
|
|
17476
17459
|
{
|
|
17477
|
-
|
|
17478
|
-
|
|
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(",")) || [];
|
|
17479
17463
|
return includes_default()(perSessionCampaigns).call(perSessionCampaigns, campaign.campaign_key);
|
|
17480
17464
|
}
|
|
17481
17465
|
|
|
@@ -17490,27 +17474,25 @@ function addCampaignToStorageString(oldStorageValue, campaignId) {
|
|
|
17490
17474
|
|
|
17491
17475
|
|
|
17492
17476
|
function recordCampaignTrigger(campaignKey, frequency, handle) {
|
|
17477
|
+
const storageKey = "".concat(handle, "_marketing_campaigns_shown");
|
|
17478
|
+
|
|
17493
17479
|
switch (frequency) {
|
|
17494
17480
|
case "every-time":
|
|
17495
17481
|
break;
|
|
17496
17482
|
|
|
17497
17483
|
case "once-per-session":
|
|
17498
17484
|
{
|
|
17499
|
-
const
|
|
17500
|
-
const newStorageValue = addCampaignToStorageString(
|
|
17501
|
-
|
|
17502
|
-
[handle]: newStorageValue
|
|
17503
|
-
}));
|
|
17485
|
+
const oldStorageValue = safeSessionStorage.getItem(storageKey);
|
|
17486
|
+
const newStorageValue = addCampaignToStorageString(oldStorageValue, campaignKey);
|
|
17487
|
+
safeSessionStorage.setItem(storageKey, newStorageValue);
|
|
17504
17488
|
break;
|
|
17505
17489
|
}
|
|
17506
17490
|
|
|
17507
17491
|
case "once-per-user":
|
|
17508
17492
|
{
|
|
17509
|
-
const
|
|
17510
|
-
const newStorageValue = addCampaignToStorageString(
|
|
17511
|
-
|
|
17512
|
-
[handle]: newStorageValue
|
|
17513
|
-
}));
|
|
17493
|
+
const oldStorageValue = safeLocalStorage.getItem(storageKey);
|
|
17494
|
+
const newStorageValue = addCampaignToStorageString(oldStorageValue, campaignKey);
|
|
17495
|
+
safeLocalStorage.setItem(storageKey, newStorageValue);
|
|
17514
17496
|
break;
|
|
17515
17497
|
}
|
|
17516
17498
|
// If an unknown frequency type is found, do nothing
|
|
@@ -17662,21 +17644,12 @@ function unbindLocationChangeOverrides() {
|
|
|
17662
17644
|
window.removeEventListener("popstate", popStateListener);
|
|
17663
17645
|
}
|
|
17664
17646
|
;// 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
|
-
|
|
17673
17647
|
function storeRollout(handle, group, lastProb) {
|
|
17674
|
-
|
|
17675
|
-
|
|
17676
|
-
|
|
17677
|
-
|
|
17678
|
-
|
|
17679
|
-
}));
|
|
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
|
+
}
|
|
17680
17653
|
}
|
|
17681
17654
|
/**
|
|
17682
17655
|
* Reads the stored rollout group and probability
|
|
@@ -17688,10 +17661,15 @@ function readRollout(handle) {
|
|
|
17688
17661
|
group: null,
|
|
17689
17662
|
lastProb: null
|
|
17690
17663
|
};
|
|
17691
|
-
|
|
17692
|
-
|
|
17693
|
-
|
|
17694
|
-
|
|
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
|
+
}
|
|
17695
17673
|
}
|
|
17696
17674
|
|
|
17697
17675
|
function checkRollout(rollout, handle) {
|
|
@@ -18136,24 +18114,41 @@ function retrieveStorage(key, client, privateMode) {
|
|
|
18136
18114
|
}
|
|
18137
18115
|
|
|
18138
18116
|
if (persistence === PERSISTENCE_NORMAL) {
|
|
18139
|
-
return
|
|
18117
|
+
return safeLocalStorage.getItem(key);
|
|
18140
18118
|
}
|
|
18141
18119
|
|
|
18142
18120
|
if (persistence === PERSISTENCE_SESSION) {
|
|
18143
|
-
return
|
|
18121
|
+
return safeSessionStorage.getItem(key);
|
|
18144
18122
|
}
|
|
18145
18123
|
|
|
18146
18124
|
return null;
|
|
18147
18125
|
}
|
|
18148
18126
|
function setBrowserStorageItem(key, value, persistenceSetting) {
|
|
18149
18127
|
if (persistenceSetting === PERSISTENCE_NORMAL) {
|
|
18150
|
-
|
|
18128
|
+
safeLocalStorage.setItem(key, value);
|
|
18151
18129
|
}
|
|
18152
18130
|
|
|
18153
18131
|
if (persistenceSetting === PERSISTENCE_SESSION) {
|
|
18154
|
-
|
|
18132
|
+
safeSessionStorage.setItem(key, value);
|
|
18155
18133
|
}
|
|
18156
18134
|
}
|
|
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
|
+
};
|
|
18157
18152
|
// EXTERNAL MODULE: ./node_modules/lodash.memoize/index.js
|
|
18158
18153
|
var lodash_memoize = __webpack_require__(773);
|
|
18159
18154
|
var lodash_memoize_default = /*#__PURE__*/__webpack_require__.n(lodash_memoize);
|
|
@@ -18197,9 +18192,9 @@ async function log(message, extra, options) {
|
|
|
18197
18192
|
service: "embed",
|
|
18198
18193
|
env: "production",
|
|
18199
18194
|
embedVersion: 2,
|
|
18200
|
-
version: "1.6.
|
|
18195
|
+
version: "1.6.16",
|
|
18201
18196
|
isNpm: true,
|
|
18202
|
-
commitHash: "
|
|
18197
|
+
commitHash: "77eed6f"
|
|
18203
18198
|
}))
|
|
18204
18199
|
});
|
|
18205
18200
|
}
|
|
@@ -18282,10 +18277,10 @@ const getChatVersionFromManifest = manifest => {
|
|
|
18282
18277
|
}
|
|
18283
18278
|
|
|
18284
18279
|
const manifestString = JSON.stringify(manifest);
|
|
18285
|
-
const manifestCache =
|
|
18280
|
+
const manifestCache = persistence.get("ada-embed_chat-manifest-cache");
|
|
18286
18281
|
|
|
18287
18282
|
if (manifestString === manifestCache) {
|
|
18288
|
-
const assignedVersion =
|
|
18283
|
+
const assignedVersion = persistence.get("ada-embed_chat-assigned-version");
|
|
18289
18284
|
/* istanbul ignore else */
|
|
18290
18285
|
|
|
18291
18286
|
if (assignedVersion) {
|
|
@@ -18312,8 +18307,8 @@ const getChatVersionFromManifest = manifest => {
|
|
|
18312
18307
|
}
|
|
18313
18308
|
}
|
|
18314
18309
|
|
|
18315
|
-
|
|
18316
|
-
|
|
18310
|
+
persistence.set("ada-embed_chat-assigned-version", hash);
|
|
18311
|
+
persistence.set("ada-embed_chat-manifest-cache", manifestString);
|
|
18317
18312
|
return hash;
|
|
18318
18313
|
};
|
|
18319
18314
|
const getChatVersion = async adaSettings => {
|
|
@@ -18769,7 +18764,7 @@ class ChatFrame extends d {
|
|
|
18769
18764
|
const hostPageUrlParams = new (url_default())(window.location.href).searchParams;
|
|
18770
18765
|
const smsToken = hostPageUrlParams.get("adaSMSToken");
|
|
18771
18766
|
const queryParams = {
|
|
18772
|
-
embedVersion: "
|
|
18767
|
+
embedVersion: "77eed6f".slice(0, 7),
|
|
18773
18768
|
greeting,
|
|
18774
18769
|
language,
|
|
18775
18770
|
skipGreeting,
|
|
@@ -19118,11 +19113,11 @@ class ChatFrame extends d {
|
|
|
19118
19113
|
|
|
19119
19114
|
const storage = (() => {
|
|
19120
19115
|
if (client.persistence === PERSISTENCE_NORMAL) {
|
|
19121
|
-
return
|
|
19116
|
+
return safeLocalStorage;
|
|
19122
19117
|
}
|
|
19123
19118
|
|
|
19124
19119
|
if (client.persistence === PERSISTENCE_SESSION) {
|
|
19125
|
-
return
|
|
19120
|
+
return safeSessionStorage;
|
|
19126
19121
|
}
|
|
19127
19122
|
|
|
19128
19123
|
return null;
|
|
@@ -19165,15 +19160,15 @@ class ChatFrame extends d {
|
|
|
19165
19160
|
});
|
|
19166
19161
|
|
|
19167
19162
|
if (zdMessagingExternalUserId === null) {
|
|
19168
|
-
|
|
19163
|
+
safeLocalStorage.removeItem(ZD_MESSAGING_EXTERNAL_USER_ID_STORAGE_KEY);
|
|
19169
19164
|
} else {
|
|
19170
|
-
|
|
19165
|
+
safeLocalStorage.setItem(ZD_MESSAGING_EXTERNAL_USER_ID_STORAGE_KEY, zdMessagingExternalUserId);
|
|
19171
19166
|
}
|
|
19172
19167
|
|
|
19173
19168
|
if (zdMessagingChatterCreated === null) {
|
|
19174
|
-
|
|
19169
|
+
safeLocalStorage.removeItem(ZD_MESSAGING_CHATTER_CREATED_STORAGE_KEY);
|
|
19175
19170
|
} else {
|
|
19176
|
-
|
|
19171
|
+
safeLocalStorage.setItem(ZD_MESSAGING_CHATTER_CREATED_STORAGE_KEY, zdMessagingChatterCreated);
|
|
19177
19172
|
}
|
|
19178
19173
|
|
|
19179
19174
|
break;
|
|
@@ -19201,9 +19196,9 @@ class ChatFrame extends d {
|
|
|
19201
19196
|
|
|
19202
19197
|
|
|
19203
19198
|
if (client.persistence === PERSISTENCE_NORMAL) {
|
|
19204
|
-
|
|
19199
|
+
safeLocalStorage.setItem(IN_LIVE_CHAT_STORAGE_KEY, inLiveChat);
|
|
19205
19200
|
} else if (client.persistence === PERSISTENCE_SESSION) {
|
|
19206
|
-
|
|
19201
|
+
safeSessionStorage.setItem(IN_LIVE_CHAT_STORAGE_KEY, inLiveChat);
|
|
19207
19202
|
}
|
|
19208
19203
|
|
|
19209
19204
|
break;
|
|
@@ -20245,10 +20240,10 @@ class Container extends d {
|
|
|
20245
20240
|
|
|
20246
20241
|
xStorageChannel.postMessage(DELETE_HISTORY_EVENT, undefined); // Clear chatter data from local storage
|
|
20247
20242
|
|
|
20248
|
-
|
|
20249
|
-
|
|
20250
|
-
|
|
20251
|
-
|
|
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
|
|
20252
20247
|
|
|
20253
20248
|
newState = Container_objectSpread(Container_objectSpread({}, newState), {}, {
|
|
20254
20249
|
chatterToken: null,
|
|
@@ -20283,10 +20278,10 @@ class Container extends d {
|
|
|
20283
20278
|
} // Clear chatter data from local storage
|
|
20284
20279
|
|
|
20285
20280
|
|
|
20286
|
-
|
|
20287
|
-
|
|
20288
|
-
|
|
20289
|
-
|
|
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
|
|
20290
20285
|
|
|
20291
20286
|
await setState({
|
|
20292
20287
|
chatterToken: null,
|
|
@@ -20985,7 +20980,7 @@ class Embed {
|
|
|
20985
20980
|
|
|
20986
20981
|
}
|
|
20987
20982
|
|
|
20988
|
-
_defineProperty(Embed, "embed2Version", "
|
|
20983
|
+
_defineProperty(Embed, "embed2Version", "77eed6f");
|
|
20989
20984
|
;// CONCATENATED MODULE: ./src/common/helpers/startup.ts
|
|
20990
20985
|
|
|
20991
20986
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ada-support/embed2",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.16",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/npm-entry",
|
|
6
6
|
"typings": "dist/npm-entry/index-npm.d.ts",
|
|
@@ -83,8 +83,7 @@
|
|
|
83
83
|
"webpack-dev-server": "^4.3.1"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@ada-support/embed-types": "^1.6.
|
|
87
|
-
"@ada-support/web-storage": "^0.10.0",
|
|
86
|
+
"@ada-support/embed-types": "^1.6.3",
|
|
88
87
|
"@babel/core": "^7.16.12",
|
|
89
88
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
90
89
|
"@babel/plugin-proposal-numeric-separator": "^7.16.7",
|