@braze/web-sdk 6.3.1 → 6.4.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 +35 -3
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +23 -23
- package/shared-lib/guid.js +2 -2
- package/shared-lib/indexed-db-adapter.js +7 -7
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +22 -21
- package/src/Banner/display/banner-to-html.js +2 -2
- package/src/Banner/display/detect-banner-impressions.js +7 -7
- package/src/Banner/index.js +2 -0
- package/src/Banner/request-banners-refresh.js +6 -6
- package/src/Banner/ui/insert-banner.js +4 -4
- package/src/Card/card-manager-factory.js +5 -5
- package/src/Card/card-manager.js +4 -4
- package/src/Card/display/card-display.js +7 -7
- package/src/Card/log-card-dismissal.js +3 -3
- package/src/Card/log-content-card-click.js +3 -3
- package/src/Card/log-content-card-impressions.js +6 -6
- package/src/Card/models/card.js +7 -7
- package/src/Card/util/card-factory.js +6 -6
- package/src/ContentCards/content-cards-provider-factory.js +14 -10
- package/src/ContentCards/content-cards-provider.js +28 -28
- package/src/ContentCards/content-cards.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 +3 -3
- package/src/ContentCards/ui/show-content-cards.js +8 -8
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +5 -5
- package/src/Core/disable-sdk.js +3 -3
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/get-user.js +1 -1
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +9 -9
- package/src/Core/log-purchase.js +7 -7
- package/src/Core/open-session.js +11 -11
- package/src/Core/set-sdk-authentication-signature.js +2 -2
- package/src/Core/wipe-data.js +5 -5
- package/src/DUST/dust-provider-factory.js +20 -0
- package/src/DUST/dust-provider.js +288 -0
- package/src/DUST/index.js +3 -0
- package/src/DUST/subscribe-to-dust.js +24 -0
- package/src/DUST/types.js +1 -0
- package/src/FeatureFlags/feature-flags-provider-factory.js +9 -9
- package/src/FeatureFlags/feature-flags-provider.js +38 -38
- package/src/FeatureFlags/get-all-feature-flags.js +3 -3
- package/src/FeatureFlags/get-feature-flag.js +3 -3
- package/src/FeatureFlags/log-feature-flag-impression.js +5 -5
- package/src/FeatureFlags/refresh-feature-flags.js +5 -5
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +3 -3
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +5 -5
- package/src/InAppMessage/display/in-app-message-to-html.js +22 -22
- package/src/InAppMessage/display/modal-utils.js +5 -5
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager.js +80 -80
- package/src/InAppMessage/log-in-app-message-button-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-html-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/control-message.js +1 -1
- package/src/InAppMessage/models/full-screen-message.js +12 -12
- package/src/InAppMessage/models/html-message.js +14 -14
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +119 -121
- package/src/InAppMessage/models/modal-message.js +12 -12
- package/src/InAppMessage/models/slide-up-message.js +21 -21
- 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/remove-all-visible-in-app-messages.js +18 -0
- package/src/InAppMessage/ui/show-in-app-message.js +24 -24
- package/src/Push/is-push-blocked.js +2 -2
- package/src/Push/is-push-permission-granted.js +2 -2
- package/src/Push/is-push-supported.js +2 -2
- package/src/Push/push-manager-factory.js +8 -8
- package/src/Push/push-manager.js +90 -90
- package/src/Push/utils/push-utils.js +17 -17
- package/src/User/user-manager.js +12 -12
- package/src/User/user.js +48 -48
- package/src/common/constants.js +1 -0
- package/src/common/content-cards-display.js +20 -20
- package/src/common/event-logger.js +4 -4
- package/src/common/properties-base.js +16 -16
- package/src/l10n/l10n-manager-factory.js +2 -2
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +29 -29
- package/src/managers/braze-instance.js +141 -133
- package/src/managers/device-manager.js +18 -18
- package/src/managers/network-manager.js +139 -139
- package/src/managers/server-config-manager.js +99 -82
- package/src/managers/session-manager.js +32 -32
- package/src/managers/storage-manager-factory.js +8 -8
- package/src/managers/storage-manager.js +76 -74
- package/src/managers/subscription-manager.js +10 -10
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +9 -9
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +12 -12
- package/src/models/push-token.js +12 -12
- package/src/models/request-result.js +1 -1
- package/src/models/server-config.js +38 -34
- package/src/request-controller.js +136 -134
- 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 +8 -8
- package/src/triggers/models/filter.js +30 -30
- package/src/triggers/models/in-app-message-click-data.js +1 -1
- 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 +1 -1
- package/src/triggers/models/trigger-condition.js +36 -36
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +15 -15
- package/src/triggers/triggers-provider-factory.js +3 -3
- package/src/triggers/triggers-provider.js +25 -25
- package/src/ui/js/attach-css.js +3 -3
- package/src/ui/js/load-font-awesome.js +2 -2
- package/src/util/base-device-parser.js +3 -3
- package/src/util/braze-actions.js +3 -3
- package/src/util/browser-detector.js +13 -13
- package/src/util/client-hints-parser.js +6 -6
- package/src/util/component-utils.js +1 -1
- package/src/util/dom-utils.js +10 -10
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +1 -1
- package/src/util/request-header-utils.js +22 -22
- package/src/util/user-agent-parser.js +14 -14
- package/src/util/validation-utils.js +9 -9
- package/src/util/window-utils.js +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ue from "../models/braze-event.js";
|
|
2
2
|
import _t from "../models/identifier.js";
|
|
3
3
|
import {
|
|
4
|
-
isArray as
|
|
4
|
+
isArray as z,
|
|
5
5
|
keys as C,
|
|
6
6
|
validateValueIsFromEnum as ta,
|
|
7
7
|
values as Pt,
|
|
@@ -13,49 +13,51 @@ import { getErrorMessage as si } from "../util/error-utils.js";
|
|
|
13
13
|
export const STORAGE_KEYS = {
|
|
14
14
|
iu: {
|
|
15
15
|
su: "ab.storage.userId",
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
Oa: "ab.storage.deviceId",
|
|
17
|
+
Ql: "ab.storage.sessionId",
|
|
18
18
|
},
|
|
19
19
|
ct: {
|
|
20
|
-
|
|
20
|
+
lc: "ab.test",
|
|
21
21
|
tE: "ab.storage.events",
|
|
22
22
|
eE: "ab.storage.attributes",
|
|
23
23
|
sE: "ab.storage.attributes.anonymous_user",
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
ac: "ab.storage.device",
|
|
25
|
+
ku: "ab.storage.sdk_metadata",
|
|
26
|
+
wu: "ab.storage.session_id_for_cached_metadata",
|
|
27
|
+
Wo: "ab.storage.pushToken",
|
|
28
28
|
rE: "ab.storage.cardImpressions",
|
|
29
|
-
|
|
29
|
+
jl: "ab.storage.serverConfig",
|
|
30
30
|
oE: "ab.storage.triggers",
|
|
31
31
|
nE: "ab.storage.triggers.ts",
|
|
32
|
-
|
|
32
|
+
Vl: "ab.storage.messagingSessionStart",
|
|
33
33
|
Ps: "ab.storage.cc",
|
|
34
34
|
Gs: "ab.storage.ccLastFullSync",
|
|
35
35
|
Hs: "ab.storage.ccLastCardUpdated",
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
ol: "ab.storage.globalRateLimitCurrentTokenCount",
|
|
37
|
+
ul: "ab.storage.dynamicRateLimitCurrentTokenCount",
|
|
38
38
|
Et: "ab.storage.ccClicks",
|
|
39
39
|
Pt: "ab.storage.ccImpressions",
|
|
40
40
|
Lt: "ab.storage.ccDismissals",
|
|
41
41
|
aE: "ab.storage.lastDisplayedTriggerTimesById",
|
|
42
42
|
iE: "ab.storage.lastDisplayedTriggerTime",
|
|
43
43
|
EE: "ab.storage.triggerFireInstancesById",
|
|
44
|
-
|
|
44
|
+
xh: "ab.storage.signature",
|
|
45
45
|
lE: "ab.storage.brazeSyncRetryCount",
|
|
46
46
|
Qs: "ab.storage.sdkVersion",
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
Se: "ab.storage.ff",
|
|
48
|
+
Ne: "ab.storage.ffImpressions",
|
|
49
|
+
Ee: "ab.storage.ffLastRefreshAt",
|
|
50
|
+
Xe: "ab.storage.ff.sessionId",
|
|
51
51
|
SE: "ab.storage.lastReqToEndpoint",
|
|
52
52
|
_E: "ab.storage.requestAttempts",
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
yn: "ab.storage.deferredIam",
|
|
54
|
+
tl: "ab.storage.lastSdkReq",
|
|
55
55
|
uE: "ab.storage.alias",
|
|
56
56
|
ut: "ab.storage.banners",
|
|
57
57
|
It: "ab.storage.banners.impressions",
|
|
58
58
|
gt: "ab.storage.banners.sessionId",
|
|
59
|
+
qi: "ab.storage.dust.mite",
|
|
60
|
+
zi: "ab.storage.dust.host",
|
|
59
61
|
},
|
|
60
62
|
ie: "ab.optOut",
|
|
61
63
|
};
|
|
@@ -63,7 +65,7 @@ export default class ee {
|
|
|
63
65
|
constructor(t, e) {
|
|
64
66
|
(this.cE = t), (this.TE = e), (this.cE = t), (this.TE = e);
|
|
65
67
|
}
|
|
66
|
-
|
|
68
|
+
Xa(t) {
|
|
67
69
|
const e = C(STORAGE_KEYS.iu),
|
|
68
70
|
s = new ee.ne(t);
|
|
69
71
|
for (const t of e) s.remove(STORAGE_KEYS.iu[t]);
|
|
@@ -74,10 +76,10 @@ export default class ee {
|
|
|
74
76
|
}
|
|
75
77
|
hE(t) {
|
|
76
78
|
const e = this.tu(t);
|
|
77
|
-
null != e && ((e.
|
|
79
|
+
null != e && ((e.Zl = new Date().valueOf()), this.uu(t, e));
|
|
78
80
|
}
|
|
79
81
|
tu(t) {
|
|
80
|
-
const e = this.cE.
|
|
82
|
+
const e = this.cE.jr(t),
|
|
81
83
|
s = ((t) => {
|
|
82
84
|
let e;
|
|
83
85
|
try {
|
|
@@ -88,44 +90,44 @@ export default class ee {
|
|
|
88
90
|
return e;
|
|
89
91
|
})(e);
|
|
90
92
|
let r;
|
|
91
|
-
if (s) (r = _t.
|
|
93
|
+
if (s) (r = _t.Vo(s) || null), r && this.uu(t, r);
|
|
92
94
|
else {
|
|
93
95
|
const s = _t.AE(e);
|
|
94
|
-
(r = _t.
|
|
96
|
+
(r = _t.Vo(s) || null), s !== e && r && this.uu(t, r);
|
|
95
97
|
}
|
|
96
98
|
return r;
|
|
97
99
|
}
|
|
98
|
-
|
|
100
|
+
im(t) {
|
|
99
101
|
this.cE.remove(t);
|
|
100
102
|
}
|
|
101
|
-
|
|
103
|
+
Za() {
|
|
102
104
|
const t = C(STORAGE_KEYS.iu);
|
|
103
105
|
let e;
|
|
104
106
|
for (const s of t)
|
|
105
107
|
(e = this.tu(STORAGE_KEYS.iu[s])),
|
|
106
108
|
null != e && this.uu(STORAGE_KEYS.iu[s], e);
|
|
107
109
|
}
|
|
108
|
-
|
|
110
|
+
Go(t) {
|
|
109
111
|
let e;
|
|
110
112
|
if (null == t || 0 === t.length) return !1;
|
|
111
|
-
e =
|
|
112
|
-
let s = this.TE.
|
|
113
|
-
(null != s &&
|
|
113
|
+
e = z(t) ? t : [t];
|
|
114
|
+
let s = this.TE.jr(STORAGE_KEYS.ct.tE);
|
|
115
|
+
(null != s && z(s)) || (s = []);
|
|
114
116
|
for (let t = 0; t < e.length; t++) s.push(e[t].dt());
|
|
115
117
|
return this.TE.store(STORAGE_KEYS.ct.tE, s);
|
|
116
118
|
}
|
|
117
|
-
|
|
118
|
-
return null != t && this.
|
|
119
|
+
$l(t) {
|
|
120
|
+
return null != t && this.Go([t]);
|
|
119
121
|
}
|
|
120
122
|
RE() {
|
|
121
|
-
let t = this.TE.
|
|
123
|
+
let t = this.TE.jr(STORAGE_KEYS.ct.tE);
|
|
122
124
|
this.TE.remove(STORAGE_KEYS.ct.tE), null == t && (t = []);
|
|
123
125
|
const e = [];
|
|
124
126
|
let s = !1,
|
|
125
127
|
r = null;
|
|
126
|
-
if (
|
|
128
|
+
if (z(t))
|
|
127
129
|
for (let s = 0; s < t.length; s++)
|
|
128
|
-
ue.gE(t[s]) ? e.push(ue.
|
|
130
|
+
ue.gE(t[s]) ? e.push(ue.Vo(t[s])) : (r = s);
|
|
129
131
|
else s = !0;
|
|
130
132
|
if (s || null != r) {
|
|
131
133
|
let o = "Stored events could not be deserialized as Events";
|
|
@@ -138,7 +140,7 @@ export default class ee {
|
|
|
138
140
|
typeof t +
|
|
139
141
|
": " +
|
|
140
142
|
JSON.stringify(t)),
|
|
141
|
-
e.push(new ue(null, m.
|
|
143
|
+
e.push(new ue(null, m.ju, new Date().valueOf(), null, { e: o }));
|
|
142
144
|
}
|
|
143
145
|
return e;
|
|
144
146
|
}
|
|
@@ -159,7 +161,7 @@ export default class ee {
|
|
|
159
161
|
t,
|
|
160
162
|
"StorageManager cannot retrieve object.",
|
|
161
163
|
"STORAGE_KEYS.OBJECTS",
|
|
162
|
-
) && this.TE.
|
|
164
|
+
) && this.TE.jr(t)
|
|
163
165
|
);
|
|
164
166
|
}
|
|
165
167
|
Nt(t) {
|
|
@@ -187,23 +189,23 @@ export default class ee {
|
|
|
187
189
|
OE(t) {
|
|
188
190
|
return t || STORAGE_KEYS.ct.sE;
|
|
189
191
|
}
|
|
190
|
-
|
|
191
|
-
let e = this.TE.
|
|
192
|
+
Pu(t) {
|
|
193
|
+
let e = this.TE.jr(STORAGE_KEYS.ct.eE);
|
|
192
194
|
null == e && (e = {});
|
|
193
|
-
const s = this.OE(t[User.
|
|
195
|
+
const s = this.OE(t[User.Uu]),
|
|
194
196
|
r = e[s];
|
|
195
197
|
for (const o in t)
|
|
196
|
-
o !== User.
|
|
198
|
+
o !== User.Uu &&
|
|
197
199
|
(null == e[s] || (r && null == r[o])) &&
|
|
198
|
-
this.mu(t[User.
|
|
200
|
+
this.mu(t[User.Uu], o, t[o]);
|
|
199
201
|
}
|
|
200
202
|
mu(t, e, s) {
|
|
201
|
-
let r = this.TE.
|
|
203
|
+
let r = this.TE.jr(STORAGE_KEYS.ct.eE);
|
|
202
204
|
null == r && (r = {});
|
|
203
205
|
const o = this.OE(t);
|
|
204
206
|
let n = r[o];
|
|
205
207
|
if (
|
|
206
|
-
(null == n && ((n = {}), null != t && (n[User.
|
|
208
|
+
(null == n && ((n = {}), null != t && (n[User.Uu] = t)), e === User.lu)
|
|
207
209
|
) {
|
|
208
210
|
null == n[e] && (n[e] = {});
|
|
209
211
|
for (const t in s) n[e][t] = s[t];
|
|
@@ -211,43 +213,43 @@ export default class ee {
|
|
|
211
213
|
return (r[o] = n), this.TE.store(STORAGE_KEYS.ct.eE, r);
|
|
212
214
|
}
|
|
213
215
|
IE() {
|
|
214
|
-
const t = this.TE.
|
|
216
|
+
const t = this.TE.jr(STORAGE_KEYS.ct.eE);
|
|
215
217
|
this.TE.remove(STORAGE_KEYS.ct.eE);
|
|
216
218
|
const e = [];
|
|
217
219
|
for (const s in t) null != t[s] && e.push(t[s]);
|
|
218
220
|
return e;
|
|
219
221
|
}
|
|
220
222
|
ru(t) {
|
|
221
|
-
const e = this.TE.
|
|
223
|
+
const e = this.TE.jr(STORAGE_KEYS.ct.eE);
|
|
222
224
|
if (null != e) {
|
|
223
225
|
const s = this.OE(null),
|
|
224
226
|
r = e[s];
|
|
225
227
|
null != r &&
|
|
226
228
|
((e[s] = void 0),
|
|
227
229
|
this.TE.store(STORAGE_KEYS.ct.eE, e),
|
|
228
|
-
(r[User.
|
|
229
|
-
this.
|
|
230
|
+
(r[User.Uu] = t),
|
|
231
|
+
this.Pu(r));
|
|
230
232
|
}
|
|
231
|
-
const s = this.tu(STORAGE_KEYS.iu.
|
|
233
|
+
const s = this.tu(STORAGE_KEYS.iu.Ql);
|
|
232
234
|
let r = null;
|
|
233
235
|
null != s && (r = s.eu);
|
|
234
236
|
const o = this.RE();
|
|
235
237
|
if (null != o)
|
|
236
238
|
for (let e = 0; e < o.length; e++) {
|
|
237
239
|
const s = o[e];
|
|
238
|
-
null == s.userId && s.sessionId == r && (s.userId = t), this
|
|
240
|
+
null == s.userId && s.sessionId == r && (s.userId = t), this.$l(s);
|
|
239
241
|
}
|
|
240
242
|
}
|
|
241
243
|
dE() {
|
|
242
|
-
return this.TE.
|
|
244
|
+
return this.TE.bE;
|
|
243
245
|
}
|
|
244
246
|
}
|
|
245
|
-
(ee.
|
|
247
|
+
(ee.dc = class {
|
|
246
248
|
constructor(t) {
|
|
247
|
-
(this.
|
|
249
|
+
(this.Pn = t), (this.Pn = t), (this.bE = ro.fE() ? 3 : 10);
|
|
248
250
|
}
|
|
249
251
|
mE(t) {
|
|
250
|
-
return t + "." + this.
|
|
252
|
+
return t + "." + this.Pn;
|
|
251
253
|
}
|
|
252
254
|
store(t, e) {
|
|
253
255
|
const s = { v: e };
|
|
@@ -257,7 +259,7 @@ export default class ee {
|
|
|
257
259
|
return E.info("Storage failure: " + si(t)), !1;
|
|
258
260
|
}
|
|
259
261
|
}
|
|
260
|
-
|
|
262
|
+
jr(t) {
|
|
261
263
|
try {
|
|
262
264
|
let e = null;
|
|
263
265
|
const s = localStorage.getItem(this.mE(t));
|
|
@@ -274,9 +276,9 @@ export default class ee {
|
|
|
274
276
|
}
|
|
275
277
|
}
|
|
276
278
|
}),
|
|
277
|
-
(ee.
|
|
279
|
+
(ee.mc = class {
|
|
278
280
|
constructor() {
|
|
279
|
-
(this.KE = {}), (this.YE = 5242880), (this.
|
|
281
|
+
(this.KE = {}), (this.YE = 5242880), (this.bE = 3);
|
|
280
282
|
}
|
|
281
283
|
store(t, e) {
|
|
282
284
|
const s = { value: e },
|
|
@@ -308,7 +310,7 @@ export default class ee {
|
|
|
308
310
|
}
|
|
309
311
|
return r;
|
|
310
312
|
}
|
|
311
|
-
|
|
313
|
+
jr(t) {
|
|
312
314
|
const e = this.KE[t];
|
|
313
315
|
return null == e ? null : e.value;
|
|
314
316
|
}
|
|
@@ -318,17 +320,17 @@ export default class ee {
|
|
|
318
320
|
}),
|
|
319
321
|
(ee.ne = class {
|
|
320
322
|
constructor(t, e) {
|
|
321
|
-
(this.
|
|
323
|
+
(this.Pn = t),
|
|
322
324
|
(this.GE = e),
|
|
323
|
-
(this.
|
|
324
|
-
(this.
|
|
325
|
+
(this.Pn = t),
|
|
326
|
+
(this.DE = this.CE()),
|
|
325
327
|
(this.ME = 576e3),
|
|
326
328
|
(this.GE = !!e);
|
|
327
329
|
}
|
|
328
330
|
mE(t) {
|
|
329
|
-
return null != this.
|
|
331
|
+
return null != this.Pn ? t + "." + this.Pn : t;
|
|
330
332
|
}
|
|
331
|
-
|
|
333
|
+
CE() {
|
|
332
334
|
let t = 0,
|
|
333
335
|
e = document.location.hostname;
|
|
334
336
|
const s = e.split("."),
|
|
@@ -361,7 +363,7 @@ export default class ee {
|
|
|
361
363
|
}
|
|
362
364
|
if (o) {
|
|
363
365
|
const t = r.split("=")[0];
|
|
364
|
-
-1 === t.indexOf("." + this.
|
|
366
|
+
-1 === t.indexOf("." + this.Pn) && this.vE(t);
|
|
365
367
|
}
|
|
366
368
|
}
|
|
367
369
|
}
|
|
@@ -370,7 +372,7 @@ export default class ee {
|
|
|
370
372
|
const s = new Date();
|
|
371
373
|
s.setTime(s.getTime() + 60 * this.ME * 1e3);
|
|
372
374
|
const r = "expires=" + s.toUTCString(),
|
|
373
|
-
o = "domain=" + this.
|
|
375
|
+
o = "domain=" + this.DE;
|
|
374
376
|
let n;
|
|
375
377
|
n = this.GE ? e : encodeURIComponent(e);
|
|
376
378
|
const a = this.mE(t) + "=" + n + ";" + r + ";" + o + ";path=/";
|
|
@@ -383,7 +385,7 @@ export default class ee {
|
|
|
383
385
|
!1)
|
|
384
386
|
: ((document.cookie = a), !0);
|
|
385
387
|
}
|
|
386
|
-
|
|
388
|
+
jr(t) {
|
|
387
389
|
const e = [],
|
|
388
390
|
s = this.mE(t) + "=",
|
|
389
391
|
r = document.cookie.split(";");
|
|
@@ -413,32 +415,32 @@ export default class ee {
|
|
|
413
415
|
vE(t) {
|
|
414
416
|
const e = t + "=;expires=" + new Date(0).toUTCString();
|
|
415
417
|
(document.cookie = e), (document.cookie = e + ";path=/");
|
|
416
|
-
const s = e + ";domain=" + this.
|
|
418
|
+
const s = e + ";domain=" + this.DE;
|
|
417
419
|
(document.cookie = s), (document.cookie = s + ";path=/");
|
|
418
420
|
}
|
|
419
421
|
}),
|
|
420
|
-
(ee.
|
|
422
|
+
(ee.uc = class {
|
|
421
423
|
constructor(t, e, s) {
|
|
422
|
-
(this.
|
|
424
|
+
(this.Pn = t),
|
|
423
425
|
(this.UE = []),
|
|
424
426
|
e && this.UE.push(new ee.ne(t)),
|
|
425
|
-
s && this.UE.push(new ee.
|
|
426
|
-
this.UE.push(new ee.
|
|
427
|
+
s && this.UE.push(new ee.dc(t)),
|
|
428
|
+
this.UE.push(new ee.mc());
|
|
427
429
|
}
|
|
428
430
|
store(t, e) {
|
|
429
431
|
let s = !0;
|
|
430
432
|
for (let r = 0; r < this.UE.length; r++) s = this.UE[r].store(t, e) && s;
|
|
431
433
|
return s;
|
|
432
434
|
}
|
|
433
|
-
|
|
435
|
+
jr(t) {
|
|
434
436
|
for (let e = 0; e < this.UE.length; e++) {
|
|
435
|
-
const s = this.UE[e].
|
|
437
|
+
const s = this.UE[e].jr(t);
|
|
436
438
|
if (null != s) return s;
|
|
437
439
|
}
|
|
438
440
|
return null;
|
|
439
441
|
}
|
|
440
442
|
remove(t) {
|
|
441
|
-
new ee.ne(this.
|
|
443
|
+
new ee.ne(this.Pn).remove(t);
|
|
442
444
|
for (let e = 0; e < this.UE.length; e++) this.UE[e].remove(t);
|
|
443
445
|
}
|
|
444
446
|
});
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Guid as
|
|
1
|
+
import { Guid as L } from "../../shared-lib/index.js";
|
|
2
2
|
export default class u {
|
|
3
3
|
constructor() {
|
|
4
|
-
this.
|
|
4
|
+
this.Mr = {};
|
|
5
5
|
}
|
|
6
6
|
wt(t) {
|
|
7
7
|
if ("function" != typeof t) return null;
|
|
8
|
-
const i =
|
|
9
|
-
return (this.
|
|
8
|
+
const i = L.oe();
|
|
9
|
+
return (this.Mr[i] = t), i;
|
|
10
10
|
}
|
|
11
11
|
removeSubscription(t) {
|
|
12
|
-
delete this.
|
|
12
|
+
delete this.Mr[t];
|
|
13
13
|
}
|
|
14
14
|
removeAllSubscriptions() {
|
|
15
|
-
this.
|
|
15
|
+
this.Mr = {};
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
return Object.keys(this.
|
|
17
|
+
he() {
|
|
18
|
+
return Object.keys(this.Mr).length;
|
|
19
19
|
}
|
|
20
20
|
L(t) {
|
|
21
21
|
const i = [];
|
|
22
|
-
for (const s in this.
|
|
23
|
-
const r = this.
|
|
22
|
+
for (const s in this.Mr) {
|
|
23
|
+
const r = this.Mr[s];
|
|
24
24
|
i.push(r(t));
|
|
25
25
|
}
|
|
26
26
|
return i;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
$u: "invalid_api_key",
|
|
3
|
+
Xu: "blacklisted",
|
|
4
|
+
Lu: "no_device_identifier",
|
|
5
|
+
Mu: "invalid_json_response",
|
|
6
|
+
zu: "empty_response",
|
|
7
7
|
__: "sdk_auth_error",
|
|
8
8
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { getAlias as
|
|
3
|
-
import { isObject as
|
|
2
|
+
import { getAlias as ve } from "../managers/utils.js";
|
|
3
|
+
import { isObject as yt } from "../util/code-utils.js";
|
|
4
4
|
import {
|
|
5
|
-
convertMsToSeconds as
|
|
5
|
+
convertMsToSeconds as P,
|
|
6
6
|
timestampOrNow as ts,
|
|
7
7
|
} from "../util/date-utils.js";
|
|
8
8
|
export default class ue {
|
|
@@ -18,18 +18,18 @@ export default class ue {
|
|
|
18
18
|
(this.sessionId = r),
|
|
19
19
|
(this.data = e);
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
pn() {
|
|
22
22
|
var t;
|
|
23
23
|
const s = {
|
|
24
24
|
name: this.type,
|
|
25
|
-
time:
|
|
25
|
+
time: P(this.time),
|
|
26
26
|
data: this.data || {},
|
|
27
27
|
session_id: this.sessionId,
|
|
28
28
|
};
|
|
29
29
|
null != this.userId && (s.user_id = this.userId);
|
|
30
|
-
const i = (null === (t = r.Sr()) || void 0 === t ? void 0 : t.
|
|
30
|
+
const i = (null === (t = r.Sr()) || void 0 === t ? void 0 : t.wh()) || !1;
|
|
31
31
|
if (!s.user_id && !i) {
|
|
32
|
-
const t =
|
|
32
|
+
const t = ve(r.p());
|
|
33
33
|
t && (s.alias = t);
|
|
34
34
|
}
|
|
35
35
|
return s;
|
|
@@ -47,9 +47,9 @@ export default class ue {
|
|
|
47
47
|
return new ue(t.user_id, t.name, t.time, t.session_id, t.data);
|
|
48
48
|
}
|
|
49
49
|
static gE(t) {
|
|
50
|
-
return null != t &&
|
|
50
|
+
return null != t && yt(t) && null != t.t && "" !== t.t;
|
|
51
51
|
}
|
|
52
|
-
static
|
|
52
|
+
static Vo(t) {
|
|
53
53
|
return new ue(t.u, t.t, t.ts, t.s, t.d);
|
|
54
54
|
}
|
|
55
55
|
}
|
package/src/models/device.js
CHANGED
|
@@ -2,11 +2,11 @@ export default class Qt {
|
|
|
2
2
|
constructor(s) {
|
|
3
3
|
(this.id = s), (this.id = s);
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
pn() {
|
|
6
6
|
const s = {};
|
|
7
7
|
return (
|
|
8
8
|
null != this.browser && (s.browser = this.browser),
|
|
9
|
-
null != this.
|
|
9
|
+
null != this.ec && (s.browser_version = this.ec),
|
|
10
10
|
null != this.os && (s.os_version = this.os),
|
|
11
11
|
null != this.resolution && (s.resolution = this.resolution),
|
|
12
12
|
null != this.language && (s.locale = this.language),
|
package/src/models/identifier.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Guid as
|
|
2
|
-
import { isArray as
|
|
1
|
+
import { Guid as L, logger as E } from "../../shared-lib/index.js";
|
|
2
|
+
import { isArray as z } from "../util/code-utils.js";
|
|
3
3
|
import { getErrorMessage as si } from "../util/error-utils.js";
|
|
4
4
|
export default class _t {
|
|
5
5
|
constructor(t, e, i) {
|
|
6
6
|
(this.eu = t),
|
|
7
|
-
null == t && (t =
|
|
8
|
-
!i || isNaN(i) ? (this.
|
|
7
|
+
null == t && (t = L.oe()),
|
|
8
|
+
!i || isNaN(i) ? (this.Ol = new Date().valueOf()) : (this.Ol = i),
|
|
9
9
|
(this.eu = t),
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
10
|
+
(this.Zl = new Date().valueOf()),
|
|
11
|
+
(this.Yl = e);
|
|
12
12
|
}
|
|
13
13
|
dt() {
|
|
14
|
-
return `g:${encodeURIComponent(this.eu)}|e:${this.
|
|
15
|
-
this.
|
|
14
|
+
return `g:${encodeURIComponent(this.eu)}|e:${this.Yl}|c:${this.Ol}|l:${
|
|
15
|
+
this.Zl
|
|
16
16
|
}`;
|
|
17
17
|
}
|
|
18
18
|
static AE(t) {
|
|
@@ -26,19 +26,19 @@ export default class _t {
|
|
|
26
26
|
(t = t.replace(i, `g:${n}`))
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
|
-
static
|
|
29
|
+
static Vo(t) {
|
|
30
30
|
let e;
|
|
31
31
|
if ("string" == typeof t)
|
|
32
32
|
try {
|
|
33
33
|
const i = t.split("|");
|
|
34
|
-
if (!
|
|
34
|
+
if (!z(i) || 4 !== i.length) return null;
|
|
35
35
|
const r = (t) => t.split(":")[1],
|
|
36
36
|
n = (t) => {
|
|
37
37
|
const e = parseInt(r(t));
|
|
38
38
|
if (!isNaN(e)) return e;
|
|
39
39
|
};
|
|
40
40
|
(e = new _t(decodeURIComponent(r(i[0])), n(i[1]), n(i[2]))),
|
|
41
|
-
(e.
|
|
41
|
+
(e.Zl = n(i[3]));
|
|
42
42
|
} catch (e) {
|
|
43
43
|
E.info(
|
|
44
44
|
`Unable to parse cookie string ${t}, failed with error: ${si(e)}`,
|
|
@@ -46,7 +46,7 @@ export default class _t {
|
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
48
|
if (null == t || null == t.g) return null;
|
|
49
|
-
(e = new _t(t.g, t.e, t.c)), (e.
|
|
49
|
+
(e = new _t(t.g, t.e, t.c)), (e.Zl = t.l);
|
|
50
50
|
}
|
|
51
51
|
return e;
|
|
52
52
|
}
|
package/src/models/push-token.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { rehydrateDateAfterJsonization as
|
|
1
|
+
import { rehydrateDateAfterJsonization as Q } from "../util/date-utils.js";
|
|
2
2
|
export default class ti {
|
|
3
3
|
constructor(t, i, s, l, h) {
|
|
4
4
|
(this.endpoint = t),
|
|
5
|
-
(this.
|
|
5
|
+
(this._o = i),
|
|
6
6
|
(this.publicKey = s),
|
|
7
|
-
(this.
|
|
8
|
-
(this.
|
|
7
|
+
(this.hc = l),
|
|
8
|
+
(this.xl = h),
|
|
9
9
|
(this.endpoint = t || null),
|
|
10
|
-
(this.
|
|
10
|
+
(this._o = i || null),
|
|
11
11
|
(this.publicKey = s || null),
|
|
12
|
-
(this.
|
|
13
|
-
(this.
|
|
12
|
+
(this.hc = l || null),
|
|
13
|
+
(this.xl = h || null);
|
|
14
14
|
}
|
|
15
15
|
dt() {
|
|
16
16
|
return {
|
|
17
17
|
e: this.endpoint,
|
|
18
|
-
c: this.
|
|
18
|
+
c: this._o,
|
|
19
19
|
p: this.publicKey,
|
|
20
|
-
u: this.
|
|
21
|
-
v: this.
|
|
20
|
+
u: this.hc,
|
|
21
|
+
v: this.xl,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
static
|
|
25
|
-
return new ti(t.e,
|
|
24
|
+
static Vo(t) {
|
|
25
|
+
return new ti(t.e, Q(t.c), t.p, t.u, t.v);
|
|
26
26
|
}
|
|
27
27
|
}
|