@braze/web-sdk 6.7.0 → 6.8.0
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.
- package/index.d.ts +74 -27
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +2 -2
- package/shared-lib/event-types.js +13 -13
- package/shared-lib/indexed-db-adapter.js +3 -3
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +8 -8
- package/src/Banner/log-banner-impressions.js +20 -11
- package/src/ContentCards/content-cards-provider-factory.js +13 -11
- package/src/ContentCards/content-cards-provider.js +4 -4
- package/src/ContentCards/get-cached-content-cards.js +2 -2
- package/src/ContentCards/request-content-cards-refresh.js +2 -2
- package/src/ContentCards/subscribe-to-content-cards-updates.js +10 -10
- package/src/ContentCards/ui/show-content-cards.js +3 -3
- package/src/Core/change-user.js +2 -2
- package/src/Core/index.js +1 -0
- package/src/Core/log-ecommerce-event.js +29 -0
- package/src/Core/log-purchase.js +17 -192
- package/src/Core/open-session.js +6 -6
- package/src/Core/set-sdk-authentication-signature.js +1 -1
- package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -1
- package/src/DUST/dust-connection-core.js +1 -0
- package/src/DUST/dust-provider-factory.js +10 -10
- package/src/DUST/dust-provider.js +181 -158
- package/src/DUST/dust-shared-worker-code.js +1 -1
- package/src/DUST/dust-shared-worker-impl.js +93 -100
- package/src/DUST/dust-worker-bridge.js +27 -27
- package/src/DUST/subscribe-to-dust.js +7 -7
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/in-app-message-to-html.js +16 -16
- package/src/InAppMessage/display/modal-utils.js +2 -2
- package/src/InAppMessage/in-app-message-manager.js +64 -64
- package/src/InAppMessage/log-in-app-message-button-click.js +1 -1
- package/src/InAppMessage/log-in-app-message-click.js +1 -1
- package/src/InAppMessage/log-in-app-message-html-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/full-screen-message.js +7 -7
- package/src/InAppMessage/models/html-message.js +1 -1
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +22 -22
- package/src/InAppMessage/models/modal-message.js +5 -5
- package/src/InAppMessage/models/slide-up-message.js +6 -6
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +20 -20
- package/src/Push/push-manager-factory.js +2 -2
- package/src/Push/push-manager.js +8 -8
- package/src/Push/utils/push-utils.js +6 -6
- package/src/User/user-manager.js +5 -5
- package/src/User/user.js +8 -8
- package/src/common/constants.js +1 -0
- package/src/common/content-cards-display.js +2 -2
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/braze-instance.js +21 -21
- package/src/managers/device-manager.js +6 -6
- package/src/managers/network-manager.js +93 -92
- package/src/managers/server-config-manager.js +68 -68
- package/src/managers/session-manager.js +2 -2
- package/src/managers/storage-manager-factory.js +4 -4
- package/src/managers/storage-manager.js +120 -120
- package/src/managers/subscription-manager.js +1 -1
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +3 -3
- package/src/models/device.js +1 -1
- package/src/models/identifier.js +3 -3
- package/src/models/push-token.js +5 -5
- package/src/models/server-config.js +27 -27
- package/src/request-controller.js +99 -99
- package/src/triggers/models/custom-event-data.js +4 -4
- package/src/triggers/models/custom-event-property-data.js +5 -5
- package/src/triggers/models/filter-set.js +2 -2
- package/src/triggers/models/filter.js +1 -1
- package/src/triggers/models/in-app-message-click-data.js +5 -5
- package/src/triggers/models/purchase-data.js +1 -1
- package/src/triggers/models/purchase-property-data.js +2 -2
- package/src/triggers/models/push-click-data.js +5 -5
- package/src/triggers/models/trigger-condition.js +42 -42
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +10 -10
- package/src/triggers/triggers-provider-factory.js +1 -1
- package/src/triggers/triggers-provider.js +30 -30
- package/src/types.js +5 -1
- package/src/ui/js/attach-css.js +1 -1
- package/src/util/braze-actions.js +5 -5
- package/src/util/browser-detector.js +13 -13
- package/src/util/client-hints-parser.js +2 -2
- package/src/util/dom-utils.js +2 -2
- package/src/util/ecommerce-event-validation.js +326 -0
- package/src/util/iso-4217-currency-codes.js +176 -0
- package/src/util/net.js +3 -3
- package/src/util/request-header-utils.js +18 -18
- package/src/util/user-agent-parser.js +14 -14
- package/src/util/validation-utils.js +2 -2
- package/src/util/window-utils.js +2 -2
|
@@ -6,7 +6,7 @@ const Zt = {
|
|
|
6
6
|
a = Zt.sl(),
|
|
7
7
|
n = new ne.Ec(o, r && !t, a, e);
|
|
8
8
|
let c;
|
|
9
|
-
return (c = a ? new ne.wc(o) : new ne.
|
|
9
|
+
return (c = a ? new ne.wc(o) : new ne._c()), new ne(n, c);
|
|
10
10
|
},
|
|
11
11
|
Sc: function () {
|
|
12
12
|
return (
|
|
@@ -22,9 +22,9 @@ const Zt = {
|
|
|
22
22
|
try {
|
|
23
23
|
if (localStorage && localStorage.getItem)
|
|
24
24
|
try {
|
|
25
|
-
localStorage.setItem(s.Tt.
|
|
26
|
-
localStorage.getItem(s.Tt.
|
|
27
|
-
? (localStorage.removeItem(s.Tt.
|
|
25
|
+
localStorage.setItem(s.Tt.xc, "true"),
|
|
26
|
+
localStorage.getItem(s.Tt.xc)
|
|
27
|
+
? (localStorage.removeItem(s.Tt.xc), (o = !0))
|
|
28
28
|
: (o = !1);
|
|
29
29
|
} catch (t) {
|
|
30
30
|
if (
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { logger as E, EventTypes as p } from "../../shared-lib/index.js";
|
|
10
10
|
import { User } from "../User/index.js";
|
|
11
11
|
import ro from "../util/browser-detector.js";
|
|
12
|
-
import { getErrorMessage as
|
|
12
|
+
import { getErrorMessage as hi } from "../util/error-utils.js";
|
|
13
13
|
export const STORAGE_KEYS = {
|
|
14
14
|
Ou: {
|
|
15
15
|
Cu: "ab.storage.userId",
|
|
@@ -17,57 +17,57 @@ export const STORAGE_KEYS = {
|
|
|
17
17
|
um: "ab.storage.sessionId",
|
|
18
18
|
},
|
|
19
19
|
Tt: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
xc: "ab.test",
|
|
21
|
+
ZE: "ab.storage.events",
|
|
22
|
+
$E: "ab.storage.attributes",
|
|
23
|
+
tS: "ab.storage.attributes.anonymous_user",
|
|
24
|
+
Ka: "ab.storage.device",
|
|
25
|
+
Ua: "ab.storage.sdk_metadata",
|
|
26
|
+
Wa: "ab.storage.session_id_for_cached_metadata",
|
|
27
27
|
Uu: "ab.storage.pushToken",
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
eS: "ab.storage.cardImpressions",
|
|
29
|
+
sc: "ab.storage.serverConfig",
|
|
30
|
+
sS: "ab.storage.triggers",
|
|
31
|
+
rS: "ab.storage.triggers.ts",
|
|
32
32
|
dm: "ab.storage.messagingSessionStart",
|
|
33
33
|
Ci: "ab.storage.cc",
|
|
34
34
|
gi: "ab.storage.ccLastFullSync",
|
|
35
35
|
ji: "ab.storage.ccLastCardUpdated",
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
$l: "ab.storage.globalRateLimitCurrentTokenCount",
|
|
37
|
+
Fl: "ab.storage.dynamicRateLimitCurrentTokenCount",
|
|
38
38
|
ns: "ab.storage.ccClicks",
|
|
39
39
|
hs: "ab.storage.ccImpressions",
|
|
40
40
|
us: "ab.storage.ccDismissals",
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
oS: "ab.storage.lastDisplayedTriggerTimesById",
|
|
42
|
+
nS: "ab.storage.lastDisplayedTriggerTime",
|
|
43
|
+
aS: "ab.storage.triggerFireInstancesById",
|
|
44
44
|
fh: "ab.storage.signature",
|
|
45
|
-
|
|
45
|
+
iS: "ab.storage.brazeSyncRetryCount",
|
|
46
46
|
ki: "ab.storage.sdkVersion",
|
|
47
47
|
Fo: "ab.storage.ff",
|
|
48
48
|
jo: "ab.storage.ffImpressions",
|
|
49
49
|
qo: "ab.storage.ffLastRefreshAt",
|
|
50
50
|
Do: "ab.storage.ff.sessionId",
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
ES: "ab.storage.lastReqToEndpoint",
|
|
52
|
+
SS: "ab.storage.requestAttempts",
|
|
53
|
+
fa: "ab.storage.deferredIam",
|
|
54
|
+
Sl: "ab.storage.lastSdkReq",
|
|
55
|
+
lS: "ab.storage.alias",
|
|
56
56
|
St: "ab.storage.banners",
|
|
57
57
|
Wt: "ab.storage.banners.impressions",
|
|
58
58
|
Mt: "ab.storage.banners.dismissals",
|
|
59
59
|
_t: "ab.storage.banners.sessionId",
|
|
60
60
|
Gt: "ab.storage.banners.lastRequestedTime",
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
Qe: "ab.storage.dust.mite",
|
|
62
|
+
Xe: "ab.storage.dust.host",
|
|
63
|
+
Ye: "ab.storage.dust.auth",
|
|
64
|
+
Ze: "ab.storage.dust.expiration",
|
|
65
65
|
},
|
|
66
66
|
ce: "ab.optOut",
|
|
67
67
|
};
|
|
68
68
|
export default class ne {
|
|
69
69
|
constructor(t, e) {
|
|
70
|
-
(this.
|
|
70
|
+
(this._S = t), (this.uS = e), (this._S = t), (this.uS = e);
|
|
71
71
|
}
|
|
72
72
|
hl(t) {
|
|
73
73
|
const e = D(STORAGE_KEYS.Ou),
|
|
@@ -76,14 +76,14 @@ export default class ne {
|
|
|
76
76
|
}
|
|
77
77
|
Iu(t, e) {
|
|
78
78
|
let s = null;
|
|
79
|
-
null != e && e instanceof _t && (s = e.qt()), this.
|
|
79
|
+
null != e && e instanceof _t && (s = e.qt()), this._S.store(t, s);
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
cS(t) {
|
|
82
82
|
const e = this.$u(t);
|
|
83
83
|
null != e && ((e.pm = new Date().valueOf()), this.Iu(t, e));
|
|
84
84
|
}
|
|
85
85
|
$u(t) {
|
|
86
|
-
const e = this.
|
|
86
|
+
const e = this._S.wr(t),
|
|
87
87
|
s = ((t) => {
|
|
88
88
|
let e;
|
|
89
89
|
try {
|
|
@@ -96,13 +96,13 @@ export default class ne {
|
|
|
96
96
|
let r;
|
|
97
97
|
if (s) (r = _t._u(s) || null), r && this.Iu(t, r);
|
|
98
98
|
else {
|
|
99
|
-
const s = _t.
|
|
99
|
+
const s = _t.TS(e);
|
|
100
100
|
(r = _t._u(s) || null), s !== e && r && this.Iu(t, r);
|
|
101
101
|
}
|
|
102
102
|
return r;
|
|
103
103
|
}
|
|
104
104
|
jm(t) {
|
|
105
|
-
this.
|
|
105
|
+
this._S.remove(t);
|
|
106
106
|
}
|
|
107
107
|
ll() {
|
|
108
108
|
const t = D(STORAGE_KEYS.Ou);
|
|
@@ -115,23 +115,23 @@ export default class ne {
|
|
|
115
115
|
let e;
|
|
116
116
|
if (null == t || 0 === t.length) return !1;
|
|
117
117
|
e = g(t) ? t : [t];
|
|
118
|
-
let s = this.
|
|
118
|
+
let s = this.uS.wr(STORAGE_KEYS.Tt.ZE);
|
|
119
119
|
(null != s && g(s)) || (s = []);
|
|
120
120
|
for (let t = 0; t < e.length; t++) s.push(e[t].qt());
|
|
121
|
-
return this.
|
|
121
|
+
return this.uS.store(STORAGE_KEYS.Tt.ZE, s);
|
|
122
122
|
}
|
|
123
123
|
gm(t) {
|
|
124
124
|
return null != t && this.ol([t]);
|
|
125
125
|
}
|
|
126
|
-
|
|
127
|
-
let t = this.
|
|
128
|
-
this.
|
|
126
|
+
hS() {
|
|
127
|
+
let t = this.uS.wr(STORAGE_KEYS.Tt.ZE);
|
|
128
|
+
this.uS.remove(STORAGE_KEYS.Tt.ZE), null == t && (t = []);
|
|
129
129
|
const e = [];
|
|
130
130
|
let s = !1,
|
|
131
131
|
r = null;
|
|
132
132
|
if (g(t))
|
|
133
133
|
for (let s = 0; s < t.length; s++)
|
|
134
|
-
Ie.
|
|
134
|
+
Ie.AS(t[s]) ? e.push(Ie._u(t[s])) : (r = s);
|
|
135
135
|
else s = !0;
|
|
136
136
|
if (s || null != r) {
|
|
137
137
|
let o = "Stored events could not be deserialized as Events";
|
|
@@ -144,7 +144,7 @@ export default class ne {
|
|
|
144
144
|
typeof t +
|
|
145
145
|
": " +
|
|
146
146
|
JSON.stringify(t)),
|
|
147
|
-
e.push(new Ie(null, p.
|
|
147
|
+
e.push(new Ie(null, p.Va, new Date().valueOf(), null, { e: o }));
|
|
148
148
|
}
|
|
149
149
|
return e;
|
|
150
150
|
}
|
|
@@ -155,7 +155,7 @@ export default class ne {
|
|
|
155
155
|
t,
|
|
156
156
|
"StorageManager cannot store object.",
|
|
157
157
|
"STORAGE_KEYS.OBJECTS",
|
|
158
|
-
) && this.
|
|
158
|
+
) && this.uS.store(t, e)
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
161
|
Rt(t) {
|
|
@@ -165,7 +165,7 @@ export default class ne {
|
|
|
165
165
|
t,
|
|
166
166
|
"StorageManager cannot retrieve object.",
|
|
167
167
|
"STORAGE_KEYS.OBJECTS",
|
|
168
|
-
) && this.
|
|
168
|
+
) && this.uS.wr(t)
|
|
169
169
|
);
|
|
170
170
|
}
|
|
171
171
|
Qt(t) {
|
|
@@ -175,7 +175,7 @@ export default class ne {
|
|
|
175
175
|
t,
|
|
176
176
|
"StorageManager cannot remove object.",
|
|
177
177
|
"STORAGE_KEYS.OBJECTS",
|
|
178
|
-
) && (this.
|
|
178
|
+
) && (this.uS.remove(t), !0)
|
|
179
179
|
);
|
|
180
180
|
}
|
|
181
181
|
clearData() {
|
|
@@ -183,121 +183,121 @@ export default class ne {
|
|
|
183
183
|
e = D(STORAGE_KEYS.Tt);
|
|
184
184
|
for (let e = 0; e < t.length; e++) {
|
|
185
185
|
const s = t[e];
|
|
186
|
-
this.
|
|
186
|
+
this._S.remove(STORAGE_KEYS.Ou[s]);
|
|
187
187
|
}
|
|
188
188
|
for (let t = 0; t < e.length; t++) {
|
|
189
189
|
const s = e[t];
|
|
190
|
-
this.
|
|
190
|
+
this.uS.remove(STORAGE_KEYS.Tt[s]);
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
|
|
194
|
-
return t || STORAGE_KEYS.Tt
|
|
193
|
+
gS(t) {
|
|
194
|
+
return t || STORAGE_KEYS.Tt.tS;
|
|
195
195
|
}
|
|
196
|
-
|
|
197
|
-
let e = this.
|
|
196
|
+
gl(t) {
|
|
197
|
+
let e = this.uS.wr(STORAGE_KEYS.Tt.$E);
|
|
198
198
|
null == e && (e = {});
|
|
199
|
-
const s = this.
|
|
199
|
+
const s = this.gS(t[User.Aa]),
|
|
200
200
|
r = e[s];
|
|
201
201
|
for (const o in t)
|
|
202
|
-
o !== User.
|
|
202
|
+
o !== User.Aa &&
|
|
203
203
|
(null == e[s] || (r && null == r[o])) &&
|
|
204
|
-
this.Eu(t[User.
|
|
204
|
+
this.Eu(t[User.Aa], o, t[o]);
|
|
205
205
|
}
|
|
206
206
|
Eu(t, e, s) {
|
|
207
|
-
let r = this.
|
|
207
|
+
let r = this.uS.wr(STORAGE_KEYS.Tt.$E);
|
|
208
208
|
null == r && (r = {});
|
|
209
|
-
const o = this.
|
|
209
|
+
const o = this.gS(t);
|
|
210
210
|
let n = r[o];
|
|
211
211
|
if (
|
|
212
|
-
(null == n && ((n = {}), null != t && (n[User.
|
|
212
|
+
(null == n && ((n = {}), null != t && (n[User.Aa] = t)), e === User.Bu)
|
|
213
213
|
) {
|
|
214
214
|
null == n[e] && (n[e] = {});
|
|
215
215
|
for (const t in s) n[e][t] = s[t];
|
|
216
216
|
} else n[e] = s;
|
|
217
|
-
return (r[o] = n), this.
|
|
217
|
+
return (r[o] = n), this.uS.store(STORAGE_KEYS.Tt.$E, r);
|
|
218
218
|
}
|
|
219
|
-
|
|
220
|
-
const t = this.
|
|
221
|
-
this.
|
|
219
|
+
RS() {
|
|
220
|
+
const t = this.uS.wr(STORAGE_KEYS.Tt.$E);
|
|
221
|
+
this.uS.remove(STORAGE_KEYS.Tt.$E);
|
|
222
222
|
const e = [];
|
|
223
223
|
for (const s in t) null != t[s] && e.push(t[s]);
|
|
224
224
|
return e;
|
|
225
225
|
}
|
|
226
226
|
Lu(t) {
|
|
227
|
-
const e = this.
|
|
227
|
+
const e = this.uS.wr(STORAGE_KEYS.Tt.$E);
|
|
228
228
|
if (null != e) {
|
|
229
|
-
const s = this.
|
|
229
|
+
const s = this.gS(null),
|
|
230
230
|
r = e[s];
|
|
231
231
|
null != r &&
|
|
232
232
|
((e[s] = void 0),
|
|
233
|
-
this.
|
|
234
|
-
(r[User.
|
|
235
|
-
this.
|
|
233
|
+
this.uS.store(STORAGE_KEYS.Tt.$E, e),
|
|
234
|
+
(r[User.Aa] = t),
|
|
235
|
+
this.gl(r));
|
|
236
236
|
}
|
|
237
237
|
const s = this.$u(STORAGE_KEYS.Ou.um);
|
|
238
238
|
let r = null;
|
|
239
239
|
null != s && (r = s.Tu);
|
|
240
|
-
const o = this.
|
|
240
|
+
const o = this.hS();
|
|
241
241
|
if (null != o)
|
|
242
242
|
for (let e = 0; e < o.length; e++) {
|
|
243
243
|
const s = o[e];
|
|
244
244
|
null == s.userId && s.sessionId == r && (s.userId = t), this.gm(s);
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
|
|
248
|
-
return this.
|
|
247
|
+
dS() {
|
|
248
|
+
return this.uS.IS;
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
(ne.wc = class {
|
|
252
252
|
constructor(t) {
|
|
253
|
-
(this.tu = t), (this.tu = t), (this.
|
|
253
|
+
(this.tu = t), (this.tu = t), (this.IS = ro.bS() ? 3 : 10);
|
|
254
254
|
}
|
|
255
|
-
|
|
255
|
+
fS(t) {
|
|
256
256
|
return t + "." + this.tu;
|
|
257
257
|
}
|
|
258
258
|
store(t, e) {
|
|
259
259
|
const s = { v: e };
|
|
260
260
|
try {
|
|
261
|
-
return localStorage.setItem(this.
|
|
261
|
+
return localStorage.setItem(this.fS(t), JSON.stringify(s)), !0;
|
|
262
262
|
} catch (t) {
|
|
263
|
-
return E.info("Storage failure: " +
|
|
263
|
+
return E.info("Storage failure: " + hi(t)), !1;
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
wr(t) {
|
|
267
267
|
try {
|
|
268
268
|
let e = null;
|
|
269
|
-
const s = localStorage.getItem(this.
|
|
269
|
+
const s = localStorage.getItem(this.fS(t));
|
|
270
270
|
return null != s && (e = JSON.parse(s)), null == e ? null : e.v;
|
|
271
271
|
} catch (t) {
|
|
272
|
-
return E.info("Storage retrieval failure: " +
|
|
272
|
+
return E.info("Storage retrieval failure: " + hi(t)), null;
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
remove(t) {
|
|
276
276
|
try {
|
|
277
|
-
localStorage.removeItem(this.
|
|
277
|
+
localStorage.removeItem(this.fS(t));
|
|
278
278
|
} catch (t) {
|
|
279
|
-
return E.info("Storage removal failure: " +
|
|
279
|
+
return E.info("Storage removal failure: " + hi(t)), !1;
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
}),
|
|
283
|
-
(ne.
|
|
283
|
+
(ne._c = class {
|
|
284
284
|
constructor() {
|
|
285
|
-
(this.
|
|
285
|
+
(this.mS = {}), (this.KS = 5242880), (this.IS = 3);
|
|
286
286
|
}
|
|
287
287
|
store(t, e) {
|
|
288
288
|
const s = { value: e },
|
|
289
|
-
r = this.
|
|
290
|
-
return r > this.
|
|
289
|
+
r = this.YS(e);
|
|
290
|
+
return r > this.KS
|
|
291
291
|
? (E.info(
|
|
292
292
|
"Storage failure: object is ≈" +
|
|
293
293
|
r +
|
|
294
294
|
" bytes which is greater than the max of " +
|
|
295
|
-
this.
|
|
295
|
+
this.KS,
|
|
296
296
|
),
|
|
297
297
|
!1)
|
|
298
|
-
: ((this.
|
|
298
|
+
: ((this.mS[t] = s), !0);
|
|
299
299
|
}
|
|
300
|
-
|
|
300
|
+
YS(t) {
|
|
301
301
|
const e = [],
|
|
302
302
|
s = [t];
|
|
303
303
|
let r = 0;
|
|
@@ -315,23 +315,23 @@ export default class ne {
|
|
|
315
315
|
return r;
|
|
316
316
|
}
|
|
317
317
|
wr(t) {
|
|
318
|
-
const e = this.
|
|
318
|
+
const e = this.mS[t];
|
|
319
319
|
return null == e ? null : e.value;
|
|
320
320
|
}
|
|
321
321
|
remove(t) {
|
|
322
|
-
this.
|
|
322
|
+
this.mS[t] = null;
|
|
323
323
|
}
|
|
324
324
|
}),
|
|
325
325
|
(ne.le = class {
|
|
326
326
|
constructor(t, e, s) {
|
|
327
|
-
(this.tu = t), (this.
|
|
327
|
+
(this.tu = t), (this.NS = e), (this.tu = t), (this.DS = this.GS());
|
|
328
328
|
const r = "number" == typeof s && s > 0 ? s : 400;
|
|
329
|
-
(this.
|
|
329
|
+
(this.CS = 24 * r * 60), (this.MS = {}), (this.NS = !!e);
|
|
330
330
|
}
|
|
331
|
-
|
|
331
|
+
fS(t) {
|
|
332
332
|
return null != this.tu ? t + "." + this.tu : t;
|
|
333
333
|
}
|
|
334
|
-
|
|
334
|
+
GS() {
|
|
335
335
|
let t = 0,
|
|
336
336
|
e = document.location.hostname;
|
|
337
337
|
const s = e.split("."),
|
|
@@ -348,9 +348,9 @@ export default class ne {
|
|
|
348
348
|
}
|
|
349
349
|
me() {
|
|
350
350
|
const t = new Date();
|
|
351
|
-
return t.setTime(t.getTime() + 60 * this.
|
|
351
|
+
return t.setTime(t.getTime() + 60 * this.CS * 1e3), t.getFullYear();
|
|
352
352
|
}
|
|
353
|
-
|
|
353
|
+
pS() {
|
|
354
354
|
const t = Wt(STORAGE_KEYS.Ou),
|
|
355
355
|
e = document.cookie.split(";");
|
|
356
356
|
for (let s = 0; s < e.length; s++) {
|
|
@@ -364,19 +364,19 @@ export default class ne {
|
|
|
364
364
|
}
|
|
365
365
|
if (o) {
|
|
366
366
|
const t = r.split("=")[0];
|
|
367
|
-
-1 === t.indexOf("." + this.tu) && this.
|
|
367
|
+
-1 === t.indexOf("." + this.tu) && this.vS(t);
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
371
|
store(t, e) {
|
|
372
|
-
this.
|
|
373
|
-
const s = this.
|
|
372
|
+
this.pS();
|
|
373
|
+
const s = this.fS(t),
|
|
374
374
|
r = new Date();
|
|
375
|
-
r.setTime(r.getTime() + 60 * this.
|
|
375
|
+
r.setTime(r.getTime() + 60 * this.CS * 1e3);
|
|
376
376
|
const o = "expires=" + r.toUTCString(),
|
|
377
|
-
n = "domain=" + this.
|
|
377
|
+
n = "domain=" + this.DS;
|
|
378
378
|
let a;
|
|
379
|
-
a = this.
|
|
379
|
+
a = this.NS ? e : encodeURIComponent(e);
|
|
380
380
|
const i = s + "=" + a + ";" + o + ";" + n + ";path=/";
|
|
381
381
|
if (i.length >= 4093)
|
|
382
382
|
return (
|
|
@@ -385,30 +385,30 @@ export default class ne {
|
|
|
385
385
|
i.length +
|
|
386
386
|
" chars which is too large to store as a cookie.",
|
|
387
387
|
),
|
|
388
|
-
(this.
|
|
389
|
-
this.
|
|
388
|
+
(this.MS[s] = !0),
|
|
389
|
+
this.vS(s),
|
|
390
390
|
!1
|
|
391
391
|
);
|
|
392
392
|
try {
|
|
393
393
|
document.cookie = i;
|
|
394
394
|
} catch (t) {
|
|
395
|
-
return E.info("Storage failure: " +
|
|
395
|
+
return E.info("Storage failure: " + hi(t)), (this.MS[s] = !0), !1;
|
|
396
396
|
}
|
|
397
|
-
const S = this.
|
|
398
|
-
return this.
|
|
397
|
+
const S = this.NS ? String(a) : decodeURIComponent(a);
|
|
398
|
+
return this.US(s) !== S
|
|
399
399
|
? (E.info(
|
|
400
400
|
`Storage failure: unable to verify cookie write for "${s}". Falling back to other storage.`,
|
|
401
401
|
),
|
|
402
|
-
(this.
|
|
403
|
-
this.
|
|
402
|
+
(this.MS[s] = !0),
|
|
403
|
+
this.vS(s),
|
|
404
404
|
!1)
|
|
405
|
-
: (delete this.
|
|
405
|
+
: (delete this.MS[s], !0);
|
|
406
406
|
}
|
|
407
407
|
wr(t) {
|
|
408
|
-
const e = this.
|
|
409
|
-
return this.
|
|
408
|
+
const e = this.fS(t);
|
|
409
|
+
return this.MS[e] ? null : this.US(e);
|
|
410
410
|
}
|
|
411
|
-
|
|
411
|
+
US(t) {
|
|
412
412
|
const e = [],
|
|
413
413
|
s = t + "=",
|
|
414
414
|
r = document.cookie.split(";");
|
|
@@ -418,50 +418,50 @@ export default class ne {
|
|
|
418
418
|
if (0 === n.indexOf(s))
|
|
419
419
|
try {
|
|
420
420
|
let t;
|
|
421
|
-
(t = this.
|
|
421
|
+
(t = this.NS
|
|
422
422
|
? n.substring(s.length, n.length)
|
|
423
423
|
: decodeURIComponent(n.substring(s.length, n.length))),
|
|
424
424
|
e.push(t);
|
|
425
425
|
} catch (e) {
|
|
426
426
|
return (
|
|
427
|
-
E.info("Storage retrieval failure: " +
|
|
427
|
+
E.info("Storage retrieval failure: " + hi(e)), this.vS(t), null
|
|
428
428
|
);
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
431
|
return e.length > 0 ? e[e.length - 1] : null;
|
|
432
432
|
}
|
|
433
433
|
remove(t) {
|
|
434
|
-
this.
|
|
434
|
+
this.vS(this.fS(t));
|
|
435
435
|
}
|
|
436
|
-
|
|
436
|
+
vS(t) {
|
|
437
437
|
const e = t + "=;expires=" + new Date(0).toUTCString();
|
|
438
438
|
(document.cookie = e), (document.cookie = e + ";path=/");
|
|
439
|
-
const s = e + ";domain=" + this.
|
|
439
|
+
const s = e + ";domain=" + this.DS;
|
|
440
440
|
(document.cookie = s), (document.cookie = s + ";path=/");
|
|
441
441
|
}
|
|
442
442
|
}),
|
|
443
443
|
(ne.Ec = class {
|
|
444
444
|
constructor(t, e, s, r) {
|
|
445
445
|
(this.tu = t),
|
|
446
|
-
(this.
|
|
447
|
-
e && this.
|
|
448
|
-
s && this.
|
|
449
|
-
this.
|
|
446
|
+
(this.yS = []),
|
|
447
|
+
e && this.yS.push(new ne.le(t, void 0, r)),
|
|
448
|
+
s && this.yS.push(new ne.wc(t)),
|
|
449
|
+
this.yS.push(new ne._c());
|
|
450
450
|
}
|
|
451
451
|
store(t, e) {
|
|
452
452
|
let s = !0;
|
|
453
|
-
for (let r = 0; r < this.
|
|
453
|
+
for (let r = 0; r < this.yS.length; r++) s = this.yS[r].store(t, e) && s;
|
|
454
454
|
return s;
|
|
455
455
|
}
|
|
456
456
|
wr(t) {
|
|
457
|
-
for (let e = 0; e < this.
|
|
458
|
-
const s = this.
|
|
457
|
+
for (let e = 0; e < this.yS.length; e++) {
|
|
458
|
+
const s = this.yS[e].wr(t);
|
|
459
459
|
if (null != s) return s;
|
|
460
460
|
}
|
|
461
461
|
return null;
|
|
462
462
|
}
|
|
463
463
|
remove(t) {
|
|
464
464
|
new ne.le(this.tu).remove(t);
|
|
465
|
-
for (let e = 0; e < this.
|
|
465
|
+
for (let e = 0; e < this.yS.length; e++) this.yS[e].remove(t);
|
|
466
466
|
}
|
|
467
467
|
});
|
package/src/managers/utils.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
dl: "invalid_api_key",
|
|
3
|
+
fl: "blacklisted",
|
|
4
|
+
ml: "no_device_identifier",
|
|
5
|
+
Za: "invalid_json_response",
|
|
6
|
+
Qa: "empty_response",
|
|
7
7
|
__: "sdk_auth_error",
|
|
8
8
|
};
|
|
@@ -18,7 +18,7 @@ export default class Ie {
|
|
|
18
18
|
(this.sessionId = r),
|
|
19
19
|
(this.data = e);
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
oa() {
|
|
22
22
|
var t;
|
|
23
23
|
const s = {
|
|
24
24
|
name: this.type,
|
|
@@ -27,7 +27,7 @@ export default class Ie {
|
|
|
27
27
|
session_id: this.sessionId,
|
|
28
28
|
};
|
|
29
29
|
null != this.userId && (s.user_id = this.userId);
|
|
30
|
-
const i = (null === (t = r.
|
|
30
|
+
const i = (null === (t = r.Er()) || void 0 === t ? void 0 : t.Fh()) || !1;
|
|
31
31
|
if (!s.user_id && !i) {
|
|
32
32
|
const t = He(r.p());
|
|
33
33
|
t && (s.alias = t);
|
|
@@ -46,7 +46,7 @@ export default class Ie {
|
|
|
46
46
|
static fromJson(t) {
|
|
47
47
|
return new Ie(t.user_id, t.name, t.time, t.session_id, t.data);
|
|
48
48
|
}
|
|
49
|
-
static
|
|
49
|
+
static AS(t) {
|
|
50
50
|
return null != t && Ct(t) && null != t.t && "" !== t.t;
|
|
51
51
|
}
|
|
52
52
|
static _u(t) {
|
package/src/models/device.js
CHANGED
package/src/models/identifier.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Guid as V, logger as E } from "../../shared-lib/index.js";
|
|
2
2
|
import { isArray as g } from "../util/code-utils.js";
|
|
3
|
-
import { getErrorMessage as
|
|
3
|
+
import { getErrorMessage as hi } from "../util/error-utils.js";
|
|
4
4
|
export default class _t {
|
|
5
5
|
constructor(t, e, i) {
|
|
6
6
|
(this.Tu = t),
|
|
@@ -15,7 +15,7 @@ export default class _t {
|
|
|
15
15
|
this.pm
|
|
16
16
|
}`;
|
|
17
17
|
}
|
|
18
|
-
static
|
|
18
|
+
static TS(t) {
|
|
19
19
|
if ("string" != typeof t) return null;
|
|
20
20
|
const e = t.lastIndexOf("|e:"),
|
|
21
21
|
i = t.substring(0, e),
|
|
@@ -41,7 +41,7 @@ export default class _t {
|
|
|
41
41
|
(e.pm = n(i[3]));
|
|
42
42
|
} catch (e) {
|
|
43
43
|
E.info(
|
|
44
|
-
`Unable to parse cookie string ${t}, failed with error: ${
|
|
44
|
+
`Unable to parse cookie string ${t}, failed with error: ${hi(e)}`,
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
else {
|
package/src/models/push-token.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { rehydrateDateAfterJsonization as ee } from "../util/date-utils.js";
|
|
2
|
-
export default class
|
|
2
|
+
export default class ui {
|
|
3
3
|
constructor(t, i, s, l, h) {
|
|
4
4
|
(this.endpoint = t),
|
|
5
5
|
(this.Wu = i),
|
|
6
6
|
(this.publicKey = s),
|
|
7
7
|
(this.zc = l),
|
|
8
|
-
(this.
|
|
8
|
+
(this.uc = h),
|
|
9
9
|
(this.endpoint = t || null),
|
|
10
10
|
(this.Wu = i || null),
|
|
11
11
|
(this.publicKey = s || null),
|
|
12
12
|
(this.zc = l || null),
|
|
13
|
-
(this.
|
|
13
|
+
(this.uc = h || null);
|
|
14
14
|
}
|
|
15
15
|
qt() {
|
|
16
16
|
return {
|
|
@@ -18,10 +18,10 @@ export default class oi {
|
|
|
18
18
|
c: this.Wu,
|
|
19
19
|
p: this.publicKey,
|
|
20
20
|
u: this.zc,
|
|
21
|
-
v: this.
|
|
21
|
+
v: this.uc,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
static _u(t) {
|
|
25
|
-
return new
|
|
25
|
+
return new ui(t.e, ee(t.c), t.p, t.u, t.v);
|
|
26
26
|
}
|
|
27
27
|
}
|