@braze/web-sdk 5.6.0 → 5.7.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/README.md +1 -1
- package/index.d.ts +14 -4
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +20 -20
- package/shared-lib/indexed-db-adapter.js +15 -15
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +14 -14
- package/src/Banner/banner-provider.js +53 -50
- package/src/Banner/banner.js +1 -1
- package/src/Banner/get-all-banners.js +2 -2
- package/src/Banner/get-banner.js +2 -2
- package/src/Banner/log-banner-click.js +1 -1
- package/src/Banner/log-banner-impressions.js +4 -4
- package/src/Banner/request-banners-refresh.js +2 -2
- package/src/Banner/subscribe-to-banners-updates.js +5 -5
- package/src/Card/card-manager.js +10 -10
- package/src/Card/models/captioned-image.js +1 -1
- package/src/Card/models/card.js +3 -3
- package/src/Card/models/classic-card.js +1 -1
- package/src/Card/models/control-card.js +1 -1
- package/src/Card/models/image-only.js +1 -1
- package/src/ContentCards/content-cards-provider.js +139 -180
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +10 -10
- package/src/ContentCards/ui/show-content-cards.js +3 -3
- package/src/Core/disable-sdk.js +3 -3
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/log-custom-event.js +3 -3
- package/src/Core/log-purchase.js +1 -1
- package/src/Core/open-session.js +6 -6
- package/src/Core/wipe-data.js +4 -4
- package/src/FeatureFlags/feature-flag.js +1 -1
- package/src/FeatureFlags/feature-flags-provider.js +81 -78
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/log-feature-flag-impression.js +4 -4
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/Feed/feed-provider.js +34 -34
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +9 -9
- package/src/InAppMessage/display/in-app-message-to-html.js +16 -16
- package/src/InAppMessage/display/modal-utils.js +5 -5
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager.js +115 -91
- package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-html-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-impression.js +2 -2
- package/src/InAppMessage/models/full-screen-message.js +5 -5
- package/src/InAppMessage/models/html-message.js +10 -10
- package/src/InAppMessage/models/in-app-message-button.js +5 -5
- package/src/InAppMessage/models/in-app-message.js +37 -37
- package/src/InAppMessage/models/modal-message.js +5 -5
- package/src/InAppMessage/models/slide-up-message.js +7 -7
- 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 +14 -14
- 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.js +88 -88
- package/src/Push/utils/push-utils.js +12 -12
- package/src/User/user-manager.js +10 -10
- package/src/User/user.js +46 -34
- package/src/common/constants.js +1 -1
- package/src/common/event-logger.js +3 -3
- package/src/common/feed-display.js +10 -10
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +10 -10
- package/src/managers/braze-instance.js +110 -110
- package/src/managers/device-manager.js +17 -17
- package/src/managers/network-manager.js +180 -143
- package/src/managers/server-config-manager.js +65 -65
- package/src/managers/session-manager.js +22 -22
- package/src/managers/storage-manager-factory.js +9 -9
- package/src/managers/storage-manager.js +134 -134
- package/src/managers/subscription-manager.js +8 -8
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +8 -8
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +10 -10
- package/src/models/push-token.js +8 -8
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +158 -146
- package/src/triggers/models/custom-event-data.js +5 -5
- package/src/triggers/models/custom-event-property-data.js +6 -6
- package/src/triggers/models/filter-set.js +6 -6
- package/src/triggers/models/filter.js +16 -16
- package/src/triggers/models/in-app-message-click-data.js +2 -2
- package/src/triggers/models/purchase-data.js +2 -2
- package/src/triggers/models/purchase-property-data.js +4 -4
- package/src/triggers/models/push-click-data.js +2 -2
- package/src/triggers/models/trigger-condition.js +36 -36
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +11 -11
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +37 -37
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/iam-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +11 -10
- package/src/util/client-hints-parser.js +3 -3
- package/src/util/component-utils.js +2 -2
- package/src/util/dom-utils.js +3 -3
- package/src/util/html-display-utils.js +1 -0
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +22 -23
- package/src/util/request-header-utils.js +23 -20
- package/src/util/user-agent-parser.js +14 -14
- package/src/util/validation-utils.js +14 -14
- package/src/util/window-utils.js +2 -2
|
@@ -13,30 +13,30 @@ 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
|
+
$h: "ab.storage.deviceId",
|
|
17
|
+
Hl: "ab.storage.sessionId",
|
|
18
18
|
},
|
|
19
|
-
|
|
19
|
+
gs: {
|
|
20
20
|
ec: "ab.test",
|
|
21
21
|
tE: "ab.storage.events",
|
|
22
22
|
eE: "ab.storage.attributes",
|
|
23
23
|
sE: "ab.storage.attributes.anonymous_user",
|
|
24
|
-
|
|
24
|
+
$a: "ab.storage.device",
|
|
25
25
|
qu: "ab.storage.sdk_metadata",
|
|
26
26
|
Au: "ab.storage.session_id_for_cached_metadata",
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
Bn: "ab.storage.pushToken",
|
|
28
|
+
Hi: "ab.storage.newsFeed",
|
|
29
|
+
Ji: "ab.storage.lastNewsFeedRefresh",
|
|
30
30
|
Ct: "ab.storage.cardImpressions",
|
|
31
|
-
|
|
31
|
+
dl: "ab.storage.serverConfig",
|
|
32
32
|
rE: "ab.storage.triggers",
|
|
33
33
|
oE: "ab.storage.triggers.ts",
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
kl: "ab.storage.messagingSessionStart",
|
|
35
|
+
di: "ab.storage.cc",
|
|
36
|
+
bi: "ab.storage.ccLastFullSync",
|
|
37
|
+
vi: "ab.storage.ccLastCardUpdated",
|
|
38
|
+
Wu: "ab.storage.globalRateLimitCurrentTokenCount",
|
|
39
|
+
Qu: "ab.storage.dynamicRateLimitCurrentTokenCount",
|
|
40
40
|
ot: "ab.storage.ccClicks",
|
|
41
41
|
vt: "ab.storage.ccImpressions",
|
|
42
42
|
gt: "ab.storage.ccDismissals",
|
|
@@ -44,42 +44,42 @@ export const STORAGE_KEYS = {
|
|
|
44
44
|
aE: "ab.storage.lastDisplayedTriggerTime",
|
|
45
45
|
iE: "ab.storage.triggerFireInstancesById",
|
|
46
46
|
qh: "ab.storage.signature",
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
EE: "ab.storage.brazeSyncRetryCount",
|
|
48
|
+
yi: "ab.storage.sdkVersion",
|
|
49
|
+
xe: "ab.storage.ff",
|
|
50
|
+
$e: "ab.storage.ffImpressions",
|
|
51
|
+
Je: "ab.storage.ffLastRefreshAt",
|
|
52
|
+
Ae: "ab.storage.ff.sessionId",
|
|
53
|
+
lE: "ab.storage.lastReqToEndpoint",
|
|
54
|
+
SE: "ab.storage.requestAttempts",
|
|
55
|
+
on: "ab.storage.deferredIam",
|
|
56
56
|
xu: "ab.storage.lastSdkReq",
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
_E: "ab.storage.alias",
|
|
58
|
+
ps: "ab.storage.banners",
|
|
59
|
+
ks: "ab.storage.banners.impressions",
|
|
60
60
|
ys: "ab.storage.banners.sessionId",
|
|
61
61
|
},
|
|
62
62
|
ae: "ab.optOut",
|
|
63
63
|
};
|
|
64
64
|
export default class ne {
|
|
65
65
|
constructor(t, e) {
|
|
66
|
-
(this.
|
|
66
|
+
(this.uE = t), (this.cE = e), (this.uE = t), (this.cE = e);
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
Fa(t) {
|
|
69
69
|
const e = y(STORAGE_KEYS.iu),
|
|
70
70
|
s = new ne.ne(t);
|
|
71
71
|
for (const t of e) s.remove(STORAGE_KEYS.iu[t]);
|
|
72
72
|
}
|
|
73
73
|
uu(t, e) {
|
|
74
74
|
let s = null;
|
|
75
|
-
null != e && e instanceof _t && (s = e.
|
|
75
|
+
null != e && e instanceof _t && (s = e.bs()), this.uE.store(t, s);
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
TE(t) {
|
|
78
78
|
const e = this.tu(t);
|
|
79
|
-
null != e && ((e.
|
|
79
|
+
null != e && ((e.Il = new Date().valueOf()), this.uu(t, e));
|
|
80
80
|
}
|
|
81
81
|
tu(t) {
|
|
82
|
-
const e = this.
|
|
82
|
+
const e = this.uE.gr(t),
|
|
83
83
|
s = ((t) => {
|
|
84
84
|
let e;
|
|
85
85
|
try {
|
|
@@ -90,44 +90,44 @@ export default class ne {
|
|
|
90
90
|
return e;
|
|
91
91
|
})(e);
|
|
92
92
|
let r;
|
|
93
|
-
if (s) (r = _t.
|
|
93
|
+
if (s) (r = _t.Yn(s) || null), r && this.uu(t, r);
|
|
94
94
|
else {
|
|
95
|
-
const s = _t.
|
|
96
|
-
(r = _t.
|
|
95
|
+
const s = _t.hE(e);
|
|
96
|
+
(r = _t.Yn(s) || null), s !== e && r && this.uu(t, r);
|
|
97
97
|
}
|
|
98
98
|
return r;
|
|
99
99
|
}
|
|
100
|
-
|
|
101
|
-
this.
|
|
100
|
+
Ol(t) {
|
|
101
|
+
this.uE.remove(t);
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
Ka() {
|
|
104
104
|
const t = y(STORAGE_KEYS.iu);
|
|
105
105
|
let e;
|
|
106
106
|
for (const s of t)
|
|
107
107
|
(e = this.tu(STORAGE_KEYS.iu[s])),
|
|
108
108
|
null != e && this.uu(STORAGE_KEYS.iu[s], e);
|
|
109
109
|
}
|
|
110
|
-
|
|
110
|
+
Go(t) {
|
|
111
111
|
let e;
|
|
112
112
|
if (null == t || 0 === t.length) return !1;
|
|
113
113
|
e = w(t) ? t : [t];
|
|
114
|
-
let s = this.
|
|
114
|
+
let s = this.cE.gr(STORAGE_KEYS.gs.tE);
|
|
115
115
|
(null != s && w(s)) || (s = []);
|
|
116
|
-
for (let t = 0; t < e.length; t++) s.push(e[t].
|
|
117
|
-
return this.
|
|
116
|
+
for (let t = 0; t < e.length; t++) s.push(e[t].bs());
|
|
117
|
+
return this.cE.store(STORAGE_KEYS.gs.tE, s);
|
|
118
118
|
}
|
|
119
|
-
|
|
120
|
-
return null != t && this.
|
|
119
|
+
Jl(t) {
|
|
120
|
+
return null != t && this.Go([t]);
|
|
121
121
|
}
|
|
122
|
-
|
|
123
|
-
let t = this.
|
|
124
|
-
this.
|
|
122
|
+
AE() {
|
|
123
|
+
let t = this.cE.gr(STORAGE_KEYS.gs.tE);
|
|
124
|
+
this.cE.remove(STORAGE_KEYS.gs.tE), null == t && (t = []);
|
|
125
125
|
const e = [];
|
|
126
126
|
let s = !1,
|
|
127
127
|
r = null;
|
|
128
128
|
if (w(t))
|
|
129
129
|
for (let s = 0; s < t.length; s++)
|
|
130
|
-
ve.
|
|
130
|
+
ve.RE(t[s]) ? e.push(ve.Yn(t[s])) : (r = s);
|
|
131
131
|
else s = !0;
|
|
132
132
|
if (s || null != r) {
|
|
133
133
|
let o = "Stored events could not be deserialized as Events";
|
|
@@ -140,121 +140,121 @@ export default class ne {
|
|
|
140
140
|
typeof t +
|
|
141
141
|
": " +
|
|
142
142
|
JSON.stringify(t)),
|
|
143
|
-
e.push(new ve(null, d.
|
|
143
|
+
e.push(new ve(null, d.Tu, new Date().valueOf(), null, { e: o }));
|
|
144
144
|
}
|
|
145
145
|
return e;
|
|
146
146
|
}
|
|
147
|
-
|
|
147
|
+
Bs(t, e) {
|
|
148
148
|
return (
|
|
149
149
|
!!ta(
|
|
150
|
-
STORAGE_KEYS.
|
|
150
|
+
STORAGE_KEYS.gs,
|
|
151
151
|
t,
|
|
152
152
|
"StorageManager cannot store object.",
|
|
153
153
|
"STORAGE_KEYS.OBJECTS",
|
|
154
|
-
) && this.
|
|
154
|
+
) && this.cE.store(t, e)
|
|
155
155
|
);
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
vs(t) {
|
|
158
158
|
return (
|
|
159
159
|
!!ta(
|
|
160
|
-
STORAGE_KEYS.
|
|
160
|
+
STORAGE_KEYS.gs,
|
|
161
161
|
t,
|
|
162
162
|
"StorageManager cannot retrieve object.",
|
|
163
163
|
"STORAGE_KEYS.OBJECTS",
|
|
164
|
-
) && this.
|
|
164
|
+
) && this.cE.gr(t)
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
Es(t) {
|
|
168
168
|
return (
|
|
169
169
|
!!ta(
|
|
170
|
-
STORAGE_KEYS.
|
|
170
|
+
STORAGE_KEYS.gs,
|
|
171
171
|
t,
|
|
172
172
|
"StorageManager cannot remove object.",
|
|
173
173
|
"STORAGE_KEYS.OBJECTS",
|
|
174
|
-
) && (this.
|
|
174
|
+
) && (this.cE.remove(t), !0)
|
|
175
175
|
);
|
|
176
176
|
}
|
|
177
177
|
clearData() {
|
|
178
178
|
const t = y(STORAGE_KEYS.iu),
|
|
179
|
-
e = y(STORAGE_KEYS.
|
|
179
|
+
e = y(STORAGE_KEYS.gs);
|
|
180
180
|
for (let e = 0; e < t.length; e++) {
|
|
181
181
|
const s = t[e];
|
|
182
|
-
this.
|
|
182
|
+
this.uE.remove(STORAGE_KEYS.iu[s]);
|
|
183
183
|
}
|
|
184
184
|
for (let t = 0; t < e.length; t++) {
|
|
185
185
|
const s = e[t];
|
|
186
|
-
this.
|
|
186
|
+
this.cE.remove(STORAGE_KEYS.gs[s]);
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
|
|
190
|
-
return t || STORAGE_KEYS.
|
|
189
|
+
gE(t) {
|
|
190
|
+
return t || STORAGE_KEYS.gs.sE;
|
|
191
191
|
}
|
|
192
|
-
|
|
193
|
-
let e = this.
|
|
192
|
+
ju(t) {
|
|
193
|
+
let e = this.cE.gr(STORAGE_KEYS.gs.eE);
|
|
194
194
|
null == e && (e = {});
|
|
195
|
-
const s = this.
|
|
195
|
+
const s = this.gE(t[User.fu]),
|
|
196
196
|
r = e[s];
|
|
197
197
|
for (const o in t)
|
|
198
|
-
o !== User.
|
|
198
|
+
o !== User.fu &&
|
|
199
199
|
(null == e[s] || (r && null == r[o])) &&
|
|
200
|
-
this.mu(t[User.
|
|
200
|
+
this.mu(t[User.fu], o, t[o]);
|
|
201
201
|
}
|
|
202
202
|
mu(t, e, s) {
|
|
203
|
-
let r = this.
|
|
203
|
+
let r = this.cE.gr(STORAGE_KEYS.gs.eE);
|
|
204
204
|
null == r && (r = {});
|
|
205
|
-
const o = this.
|
|
205
|
+
const o = this.gE(t);
|
|
206
206
|
let n = r[o];
|
|
207
207
|
if (
|
|
208
|
-
(null == n && ((n = {}), null != t && (n[User.
|
|
208
|
+
(null == n && ((n = {}), null != t && (n[User.fu] = t)), e === User.lu)
|
|
209
209
|
) {
|
|
210
210
|
null == n[e] && (n[e] = {});
|
|
211
211
|
for (const t in s) n[e][t] = s[t];
|
|
212
212
|
} else n[e] = s;
|
|
213
|
-
return (r[o] = n), this.
|
|
213
|
+
return (r[o] = n), this.cE.store(STORAGE_KEYS.gs.eE, r);
|
|
214
214
|
}
|
|
215
|
-
|
|
216
|
-
const t = this.
|
|
217
|
-
this.
|
|
215
|
+
OE() {
|
|
216
|
+
const t = this.cE.gr(STORAGE_KEYS.gs.eE);
|
|
217
|
+
this.cE.remove(STORAGE_KEYS.gs.eE);
|
|
218
218
|
const e = [];
|
|
219
219
|
for (const s in t) null != t[s] && e.push(t[s]);
|
|
220
220
|
return e;
|
|
221
221
|
}
|
|
222
222
|
ru(t) {
|
|
223
|
-
const e = this.
|
|
223
|
+
const e = this.cE.gr(STORAGE_KEYS.gs.eE);
|
|
224
224
|
if (null != e) {
|
|
225
|
-
const s = this.
|
|
225
|
+
const s = this.gE(null),
|
|
226
226
|
r = e[s];
|
|
227
227
|
null != r &&
|
|
228
228
|
((e[s] = void 0),
|
|
229
|
-
this.
|
|
230
|
-
(r[User.
|
|
231
|
-
this
|
|
229
|
+
this.cE.store(STORAGE_KEYS.gs.eE, e),
|
|
230
|
+
(r[User.fu] = t),
|
|
231
|
+
this.ju(r));
|
|
232
232
|
}
|
|
233
|
-
const s = this.tu(STORAGE_KEYS.iu.
|
|
233
|
+
const s = this.tu(STORAGE_KEYS.iu.Hl);
|
|
234
234
|
let r = null;
|
|
235
235
|
null != s && (r = s.eu);
|
|
236
|
-
const o = this.
|
|
236
|
+
const o = this.AE();
|
|
237
237
|
if (null != o)
|
|
238
238
|
for (let e = 0; e < o.length; e++) {
|
|
239
239
|
const s = o[e];
|
|
240
|
-
null == s.userId && s.sessionId == r && (s.userId = t), this.
|
|
240
|
+
null == s.userId && s.sessionId == r && (s.userId = t), this.Jl(s);
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
|
|
244
|
-
return this.
|
|
243
|
+
IE() {
|
|
244
|
+
return this.cE.dE;
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
(ne.
|
|
247
|
+
(ne.ac = class {
|
|
248
248
|
constructor(t) {
|
|
249
|
-
(this.
|
|
249
|
+
(this.fn = t), (this.fn = t), (this.dE = ro.fE() ? 3 : 10);
|
|
250
250
|
}
|
|
251
|
-
|
|
252
|
-
return t + "." + this.
|
|
251
|
+
bE(t) {
|
|
252
|
+
return t + "." + this.fn;
|
|
253
253
|
}
|
|
254
254
|
store(t, e) {
|
|
255
255
|
const s = { v: e };
|
|
256
256
|
try {
|
|
257
|
-
return localStorage.setItem(this.
|
|
257
|
+
return localStorage.setItem(this.bE(t), JSON.stringify(s)), !0;
|
|
258
258
|
} catch (t) {
|
|
259
259
|
return N.info("Storage failure: " + si(t)), !1;
|
|
260
260
|
}
|
|
@@ -262,7 +262,7 @@ export default class ne {
|
|
|
262
262
|
gr(t) {
|
|
263
263
|
try {
|
|
264
264
|
let e = null;
|
|
265
|
-
const s = localStorage.getItem(this.
|
|
265
|
+
const s = localStorage.getItem(this.bE(t));
|
|
266
266
|
return null != s && (e = JSON.parse(s)), null == e ? null : e.v;
|
|
267
267
|
} catch (t) {
|
|
268
268
|
return N.info("Storage retrieval failure: " + si(t)), null;
|
|
@@ -270,30 +270,30 @@ export default class ne {
|
|
|
270
270
|
}
|
|
271
271
|
remove(t) {
|
|
272
272
|
try {
|
|
273
|
-
localStorage.removeItem(this.
|
|
273
|
+
localStorage.removeItem(this.bE(t));
|
|
274
274
|
} catch (t) {
|
|
275
275
|
return N.info("Storage removal failure: " + si(t)), !1;
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
}),
|
|
279
|
-
(ne.
|
|
279
|
+
(ne.nc = class {
|
|
280
280
|
constructor() {
|
|
281
|
-
(this.
|
|
281
|
+
(this.KE = {}), (this.mE = 5242880), (this.dE = 3);
|
|
282
282
|
}
|
|
283
283
|
store(t, e) {
|
|
284
284
|
const s = { value: e },
|
|
285
|
-
r = this.
|
|
286
|
-
return r > this.
|
|
285
|
+
r = this.YE(e);
|
|
286
|
+
return r > this.mE
|
|
287
287
|
? (N.info(
|
|
288
288
|
"Storage failure: object is ≈" +
|
|
289
289
|
r +
|
|
290
290
|
" bytes which is greater than the max of " +
|
|
291
|
-
this.
|
|
291
|
+
this.mE,
|
|
292
292
|
),
|
|
293
293
|
!1)
|
|
294
|
-
: ((this.
|
|
294
|
+
: ((this.KE[t] = s), !0);
|
|
295
295
|
}
|
|
296
|
-
|
|
296
|
+
YE(t) {
|
|
297
297
|
const e = [],
|
|
298
298
|
s = [t];
|
|
299
299
|
let r = 0;
|
|
@@ -311,26 +311,26 @@ export default class ne {
|
|
|
311
311
|
return r;
|
|
312
312
|
}
|
|
313
313
|
gr(t) {
|
|
314
|
-
const e = this.
|
|
314
|
+
const e = this.KE[t];
|
|
315
315
|
return null == e ? null : e.value;
|
|
316
316
|
}
|
|
317
317
|
remove(t) {
|
|
318
|
-
this.
|
|
318
|
+
this.KE[t] = null;
|
|
319
319
|
}
|
|
320
320
|
}),
|
|
321
321
|
(ne.ne = class {
|
|
322
322
|
constructor(t, e) {
|
|
323
|
-
(this.
|
|
324
|
-
(this.
|
|
325
|
-
(this.
|
|
326
|
-
(this.
|
|
327
|
-
(this.
|
|
328
|
-
(this.
|
|
323
|
+
(this.fn = t),
|
|
324
|
+
(this.NE = e),
|
|
325
|
+
(this.fn = t),
|
|
326
|
+
(this.GE = this.DE()),
|
|
327
|
+
(this.CE = 576e3),
|
|
328
|
+
(this.NE = !!e);
|
|
329
329
|
}
|
|
330
|
-
|
|
331
|
-
return null != this.
|
|
330
|
+
bE(t) {
|
|
331
|
+
return null != this.fn ? t + "." + this.fn : t;
|
|
332
332
|
}
|
|
333
|
-
|
|
333
|
+
DE() {
|
|
334
334
|
let t = 0,
|
|
335
335
|
e = document.location.hostname;
|
|
336
336
|
const s = e.split("."),
|
|
@@ -347,9 +347,9 @@ export default class ne {
|
|
|
347
347
|
}
|
|
348
348
|
se() {
|
|
349
349
|
const t = new Date();
|
|
350
|
-
return t.setTime(t.getTime() + 60 * this.
|
|
350
|
+
return t.setTime(t.getTime() + 60 * this.CE * 1e3), t.getFullYear();
|
|
351
351
|
}
|
|
352
|
-
|
|
352
|
+
ME() {
|
|
353
353
|
const t = Rt(STORAGE_KEYS.iu),
|
|
354
354
|
e = document.cookie.split(";");
|
|
355
355
|
for (let s = 0; s < e.length; s++) {
|
|
@@ -363,19 +363,19 @@ export default class ne {
|
|
|
363
363
|
}
|
|
364
364
|
if (o) {
|
|
365
365
|
const t = r.split("=")[0];
|
|
366
|
-
-1 === t.indexOf("." + this.
|
|
366
|
+
-1 === t.indexOf("." + this.fn) && this.pE(t);
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
store(t, e) {
|
|
371
|
-
this.
|
|
371
|
+
this.ME();
|
|
372
372
|
const s = new Date();
|
|
373
|
-
s.setTime(s.getTime() + 60 * this.
|
|
373
|
+
s.setTime(s.getTime() + 60 * this.CE * 1e3);
|
|
374
374
|
const r = "expires=" + s.toUTCString(),
|
|
375
|
-
o = "domain=" + this.
|
|
375
|
+
o = "domain=" + this.GE;
|
|
376
376
|
let n;
|
|
377
|
-
n = this.
|
|
378
|
-
const a = this.
|
|
377
|
+
n = this.NE ? e : encodeURIComponent(e);
|
|
378
|
+
const a = this.bE(t) + "=" + n + ";" + r + ";" + o + ";path=/";
|
|
379
379
|
return a.length >= 4093
|
|
380
380
|
? (N.info(
|
|
381
381
|
"Storage failure: string is " +
|
|
@@ -387,7 +387,7 @@ export default class ne {
|
|
|
387
387
|
}
|
|
388
388
|
gr(t) {
|
|
389
389
|
const e = [],
|
|
390
|
-
s = this.
|
|
390
|
+
s = this.bE(t) + "=",
|
|
391
391
|
r = document.cookie.split(";");
|
|
392
392
|
for (let o = 0; o < r.length; o++) {
|
|
393
393
|
let n = r[o];
|
|
@@ -395,7 +395,7 @@ export default class ne {
|
|
|
395
395
|
if (0 === n.indexOf(s))
|
|
396
396
|
try {
|
|
397
397
|
let t;
|
|
398
|
-
(t = this.
|
|
398
|
+
(t = this.NE
|
|
399
399
|
? n.substring(s.length, n.length)
|
|
400
400
|
: decodeURIComponent(n.substring(s.length, n.length))),
|
|
401
401
|
e.push(t);
|
|
@@ -410,37 +410,37 @@ export default class ne {
|
|
|
410
410
|
return e.length > 0 ? e[e.length - 1] : null;
|
|
411
411
|
}
|
|
412
412
|
remove(t) {
|
|
413
|
-
this.
|
|
413
|
+
this.pE(this.bE(t));
|
|
414
414
|
}
|
|
415
|
-
|
|
415
|
+
pE(t) {
|
|
416
416
|
const e = t + "=;expires=" + new Date(0).toUTCString();
|
|
417
417
|
(document.cookie = e), (document.cookie = e + ";path=/");
|
|
418
|
-
const s = e + ";domain=" + this.
|
|
418
|
+
const s = e + ";domain=" + this.GE;
|
|
419
419
|
(document.cookie = s), (document.cookie = s + ";path=/");
|
|
420
420
|
}
|
|
421
421
|
}),
|
|
422
|
-
(ne.
|
|
422
|
+
(ne.rc = class {
|
|
423
423
|
constructor(t, e, s) {
|
|
424
|
-
(this.
|
|
425
|
-
(this.
|
|
426
|
-
e && this.
|
|
427
|
-
s && this.
|
|
428
|
-
this.
|
|
424
|
+
(this.fn = t),
|
|
425
|
+
(this.vE = []),
|
|
426
|
+
e && this.vE.push(new ne.ne(t)),
|
|
427
|
+
s && this.vE.push(new ne.ac(t)),
|
|
428
|
+
this.vE.push(new ne.nc());
|
|
429
429
|
}
|
|
430
430
|
store(t, e) {
|
|
431
431
|
let s = !0;
|
|
432
|
-
for (let r = 0; r < this.
|
|
432
|
+
for (let r = 0; r < this.vE.length; r++) s = this.vE[r].store(t, e) && s;
|
|
433
433
|
return s;
|
|
434
434
|
}
|
|
435
435
|
gr(t) {
|
|
436
|
-
for (let e = 0; e < this.
|
|
437
|
-
const s = this.
|
|
436
|
+
for (let e = 0; e < this.vE.length; e++) {
|
|
437
|
+
const s = this.vE[e].gr(t);
|
|
438
438
|
if (null != s) return s;
|
|
439
439
|
}
|
|
440
440
|
return null;
|
|
441
441
|
}
|
|
442
442
|
remove(t) {
|
|
443
|
-
new ne.ne(this.
|
|
444
|
-
for (let e = 0; e < this.
|
|
443
|
+
new ne.ne(this.fn).remove(t);
|
|
444
|
+
for (let e = 0; e < this.vE.length; e++) this.vE[e].remove(t);
|
|
445
445
|
}
|
|
446
446
|
});
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { Guid as G } from "../../shared-lib/index.js";
|
|
2
2
|
export default class u {
|
|
3
3
|
constructor() {
|
|
4
|
-
this.
|
|
4
|
+
this._i = {};
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
Fs(t) {
|
|
7
7
|
if ("function" != typeof t) return null;
|
|
8
8
|
const i = G.Rt();
|
|
9
|
-
return (this.
|
|
9
|
+
return (this._i[i] = t), i;
|
|
10
10
|
}
|
|
11
11
|
removeSubscription(t) {
|
|
12
|
-
delete this.
|
|
12
|
+
delete this._i[t];
|
|
13
13
|
}
|
|
14
14
|
removeAllSubscriptions() {
|
|
15
|
-
this.
|
|
15
|
+
this._i = {};
|
|
16
16
|
}
|
|
17
17
|
ic() {
|
|
18
|
-
return Object.keys(this.
|
|
18
|
+
return Object.keys(this._i).length;
|
|
19
19
|
}
|
|
20
20
|
X(t) {
|
|
21
21
|
const i = [];
|
|
22
|
-
for (const s in this.
|
|
23
|
-
const r = this.
|
|
22
|
+
for (const s in this._i) {
|
|
23
|
+
const r = this._i[s];
|
|
24
24
|
i.push(r(t));
|
|
25
25
|
}
|
|
26
26
|
return i;
|
package/src/managers/utils.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
Nu: "invalid_api_key",
|
|
3
|
+
wu: "blacklisted",
|
|
4
|
+
Cu: "no_device_identifier",
|
|
5
|
+
yu: "invalid_json_response",
|
|
6
|
+
ku: "empty_response",
|
|
7
7
|
__: "sdk_auth_error",
|
|
8
8
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { getAlias as
|
|
3
|
-
import { isObject as
|
|
2
|
+
import { getAlias as Ht } from "../managers/utils.js";
|
|
3
|
+
import { isObject as yt } from "../util/code-utils.js";
|
|
4
4
|
import {
|
|
5
5
|
convertMsToSeconds as L,
|
|
6
6
|
timestampOrNow as Qt,
|
|
@@ -18,7 +18,7 @@ export default class ve {
|
|
|
18
18
|
(this.sessionId = r),
|
|
19
19
|
(this.data = e);
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
Qr() {
|
|
22
22
|
var t;
|
|
23
23
|
const s = {
|
|
24
24
|
name: this.type,
|
|
@@ -29,12 +29,12 @@ export default class ve {
|
|
|
29
29
|
null != this.userId && (s.user_id = this.userId);
|
|
30
30
|
const i = (null === (t = r.Sr()) || void 0 === t ? void 0 : t.jh()) || !1;
|
|
31
31
|
if (!s.user_id && !i) {
|
|
32
|
-
const t =
|
|
32
|
+
const t = Ht(r.j());
|
|
33
33
|
t && (s.alias = t);
|
|
34
34
|
}
|
|
35
35
|
return s;
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
bs() {
|
|
38
38
|
return {
|
|
39
39
|
u: this.userId,
|
|
40
40
|
t: this.type,
|
|
@@ -46,10 +46,10 @@ export default class ve {
|
|
|
46
46
|
static fromJson(t) {
|
|
47
47
|
return new ve(t.user_id, t.name, t.time, t.session_id, t.data);
|
|
48
48
|
}
|
|
49
|
-
static
|
|
50
|
-
return null != t &&
|
|
49
|
+
static RE(t) {
|
|
50
|
+
return null != t && yt(t) && null != t.t && "" !== t.t;
|
|
51
51
|
}
|
|
52
|
-
static
|
|
52
|
+
static Yn(t) {
|
|
53
53
|
return new ve(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 Gt {
|
|
|
2
2
|
constructor(s) {
|
|
3
3
|
(this.id = s), (this.id = s);
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
Qr() {
|
|
6
6
|
const s = {};
|
|
7
7
|
return (
|
|
8
8
|
null != this.browser && (s.browser = this.browser),
|
|
9
|
-
null != this.
|
|
9
|
+
null != this.Ha && (s.browser_version = this.Ha),
|
|
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),
|