@braze/web-sdk 4.6.3 → 4.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/index.d.ts +13 -8
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +2 -2
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +18 -17
- package/shared-lib/indexed-db-adapter.js +2 -2
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +15 -15
- package/src/Core/handle-braze-action.js +40 -34
- package/src/Core/log-custom-event.js +2 -7
- package/src/Core/log-purchase.js +3 -3
- package/src/Core/wipe-data.js +2 -2
- package/src/FeatureFlags/feature-flag.js +33 -16
- package/src/FeatureFlags/feature-flags-provider.js +86 -75
- package/src/FeatureFlags/get-all-feature-flags.js +5 -5
- package/src/FeatureFlags/get-feature-flag.js +6 -6
- package/src/FeatureFlags/refresh-feature-flags.js +1 -1
- package/src/FeatureFlags/types.js +1 -0
- package/src/Feed/feed-provider.js +17 -17
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +135 -120
- package/src/InAppMessage/display/in-app-message-to-html.js +21 -21
- package/src/InAppMessage/display/modal-utils.js +6 -6
- package/src/InAppMessage/in-app-message-factory.js +3 -3
- package/src/InAppMessage/in-app-message-manager-factory.js +3 -3
- package/src/InAppMessage/in-app-message-manager.js +65 -65
- package/src/InAppMessage/log-in-app-message-button-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-impression.js +3 -3
- package/src/InAppMessage/models/full-screen-message.js +1 -1
- 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 +80 -80
- package/src/InAppMessage/models/modal-message.js +2 -2
- package/src/InAppMessage/models/slide-up-message.js +8 -8
- package/src/InAppMessage/models/templated-in-app-message.js +4 -4
- 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.js +216 -209
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +11 -8
- package/src/User/user.js +52 -41
- package/src/common/base-feed.js +1 -1
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +2 -0
- package/src/common/feed-display.js +6 -6
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/managers/auth-manager.js +24 -24
- package/src/managers/braze-instance.js +120 -120
- package/src/managers/device-manager.js +11 -11
- package/src/managers/network-manager.js +63 -54
- package/src/managers/server-config-manager.js +20 -20
- package/src/managers/session-manager.js +29 -29
- package/src/managers/storage-manager-factory.js +4 -4
- package/src/managers/storage-manager.js +104 -104
- package/src/managers/subscription-manager.js +6 -6
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +7 -7
- package/src/models/device.js +1 -1
- package/src/models/identifier.js +6 -6
- package/src/models/push-token.js +3 -3
- package/src/models/server-config.js +15 -15
- package/src/request-controller.js +92 -88
- package/src/triggers/models/custom-event-data.js +4 -4
- package/src/triggers/models/custom-event-property-data.js +9 -9
- package/src/triggers/models/filter-set.js +9 -9
- package/src/triggers/models/filter.js +63 -63
- package/src/triggers/models/in-app-message-click-data.js +5 -5
- package/src/triggers/models/purchase-data.js +3 -3
- package/src/triggers/models/purchase-property-data.js +9 -9
- package/src/triggers/models/push-click-data.js +5 -5
- package/src/triggers/models/trigger-condition.js +48 -48
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +29 -29
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +87 -89
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/feed-css.js +4 -4
- package/src/ui/js/iam-css.js +4 -4
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +2 -2
- package/src/util/braze-actions.js +8 -8
- package/src/util/browser-detector.js +8 -8
- package/src/util/client-hints-parser.js +3 -3
- package/src/util/code-utils.js +10 -3
- package/src/util/component-utils.js +1 -1
- package/src/util/date-utils.js +2 -2
- package/src/util/device-constants.js +1 -1
- package/src/util/dom-utils.js +9 -9
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +3 -3
- package/src/util/user-agent-parser.js +4 -4
- package/src/util/validation-utils.js +155 -74
- package/src/util/window-utils.js +1 -1
|
@@ -3,9 +3,9 @@ import ue from "../models/braze-event.js";
|
|
|
3
3
|
import _t from "../models/identifier.js";
|
|
4
4
|
import {
|
|
5
5
|
isArray as p,
|
|
6
|
-
keys as
|
|
6
|
+
keys as or,
|
|
7
7
|
validateValueIsFromEnum as F,
|
|
8
|
-
values as
|
|
8
|
+
values as Lt
|
|
9
9
|
} from "../util/code-utils.js";
|
|
10
10
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
11
11
|
import { User } from "../User/index.js";
|
|
@@ -13,79 +13,79 @@ export const STORAGE_KEYS = {
|
|
|
13
13
|
eu: {
|
|
14
14
|
su: "ab.storage.userId",
|
|
15
15
|
Jo: "ab.storage.deviceId",
|
|
16
|
-
|
|
16
|
+
xh: "ab.storage.sessionId"
|
|
17
17
|
},
|
|
18
18
|
q: {
|
|
19
19
|
Sa: "ab.test",
|
|
20
20
|
Ta: "ab.storage.events",
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
Aa: "ab.storage.attributes",
|
|
22
|
+
Ia: "ab.storage.attributes.anonymous_user",
|
|
23
|
+
Qo: "ab.storage.device",
|
|
24
|
+
sa: "ab.storage.sdk_metadata",
|
|
25
|
+
oa: "ab.storage.session_id_for_cached_metadata",
|
|
26
|
+
vn: "ab.storage.pushToken",
|
|
27
|
+
Di: "ab.storage.newsFeed",
|
|
28
|
+
xi: "ab.storage.lastNewsFeedRefresh",
|
|
29
29
|
P: "ab.storage.cardImpressions",
|
|
30
30
|
hl: "ab.storage.serverConfig",
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
Ka: "ab.storage.triggers",
|
|
32
|
+
Ya: "ab.storage.triggers.ts",
|
|
33
|
+
Gh: "ab.storage.messagingSessionStart",
|
|
34
34
|
Yt: "ab.storage.cc",
|
|
35
35
|
vs: "ab.storage.ccLastFullSync",
|
|
36
36
|
ys: "ab.storage.ccLastCardUpdated",
|
|
37
37
|
$: "ab.storage.ccClicks",
|
|
38
38
|
O: "ab.storage.ccImpressions",
|
|
39
39
|
K: "ab.storage.ccDismissals",
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
Da: "ab.storage.lastDisplayedTriggerTimesById",
|
|
41
|
+
Ga: "ab.storage.lastDisplayedTriggerTime",
|
|
42
|
+
Na: "ab.storage.triggerFireInstancesById",
|
|
43
|
+
Ln: "ab.storage.signature",
|
|
44
44
|
As: "ab.storage.brazeSyncRetryCount",
|
|
45
45
|
_s: "ab.storage.sdkVersion",
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
di: "ab.storage.ff",
|
|
47
|
+
vi: "ab.storage.ffLastRefreshAt"
|
|
48
48
|
},
|
|
49
49
|
ae: "ab.optOut"
|
|
50
50
|
};
|
|
51
51
|
export default class G {
|
|
52
52
|
constructor(t, e) {
|
|
53
|
-
(this.
|
|
53
|
+
(this.va = t), (this.Ma = e);
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
uu(t, e) {
|
|
56
56
|
let s = e;
|
|
57
|
-
null != e && e instanceof _t && (s = e.ss()), this.
|
|
57
|
+
null != e && e instanceof _t && (s = e.ss()), this.va.store(t, s);
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
Ca(t) {
|
|
60
60
|
const e = this.tu(t);
|
|
61
|
-
null != e && ((e.
|
|
61
|
+
null != e && ((e.Wh = new Date().valueOf()), this.uu(t, e));
|
|
62
62
|
}
|
|
63
63
|
tu(t) {
|
|
64
|
-
return _t.
|
|
64
|
+
return _t.Pn(this.va.lr(t));
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
this.
|
|
66
|
+
Jh(t) {
|
|
67
|
+
this.va.remove(t);
|
|
68
68
|
}
|
|
69
69
|
bo(t) {
|
|
70
70
|
if (null == t || 0 === t.length) return !1;
|
|
71
71
|
p(t) || (t = [t]);
|
|
72
|
-
let e = this.
|
|
72
|
+
let e = this.Ma.lr(STORAGE_KEYS.q.Ta);
|
|
73
73
|
(null != e && p(e)) || (e = []);
|
|
74
74
|
for (let s = 0; s < t.length; s++) e.push(t[s].ss());
|
|
75
|
-
return this.
|
|
75
|
+
return this.Ma.store(STORAGE_KEYS.q.Ta, e);
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
qh(t) {
|
|
78
78
|
return null != t && this.bo([t]);
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
let t = this.
|
|
82
|
-
this.
|
|
80
|
+
ya() {
|
|
81
|
+
let t = this.Ma.lr(STORAGE_KEYS.q.Ta);
|
|
82
|
+
this.Ma.remove(STORAGE_KEYS.q.Ta), null == t && (t = []);
|
|
83
83
|
const e = [];
|
|
84
84
|
let s = !1,
|
|
85
85
|
o = null;
|
|
86
86
|
if (p(t))
|
|
87
87
|
for (let s = 0; s < t.length; s++)
|
|
88
|
-
ue.
|
|
88
|
+
ue.Ua(t[s]) ? e.push(ue.Pn(t[s])) : (o = s);
|
|
89
89
|
else s = !0;
|
|
90
90
|
if (s || null != o) {
|
|
91
91
|
let n = "Stored events could not be deserialized as Events";
|
|
@@ -109,7 +109,7 @@ export default class G {
|
|
|
109
109
|
t,
|
|
110
110
|
"StorageManager cannot store object.",
|
|
111
111
|
"STORAGE_KEYS.OBJECTS"
|
|
112
|
-
) && this.
|
|
112
|
+
) && this.Ma.store(t, e)
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
115
|
I(t) {
|
|
@@ -119,7 +119,7 @@ export default class G {
|
|
|
119
119
|
t,
|
|
120
120
|
"StorageManager cannot retrieve object.",
|
|
121
121
|
"STORAGE_KEYS.OBJECTS"
|
|
122
|
-
) && this.
|
|
122
|
+
) && this.Ma.lr(t)
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
125
|
Xs(t) {
|
|
@@ -129,96 +129,96 @@ export default class G {
|
|
|
129
129
|
t,
|
|
130
130
|
"StorageManager cannot remove object.",
|
|
131
131
|
"STORAGE_KEYS.OBJECTS"
|
|
132
|
-
) && (this.
|
|
132
|
+
) && (this.Ma.remove(t), !0)
|
|
133
133
|
);
|
|
134
134
|
}
|
|
135
135
|
clearData() {
|
|
136
|
-
const t =
|
|
137
|
-
e =
|
|
136
|
+
const t = or(STORAGE_KEYS.eu),
|
|
137
|
+
e = or(STORAGE_KEYS.q);
|
|
138
138
|
for (let e = 0; e < t.length; e++) {
|
|
139
139
|
const s = t[e];
|
|
140
|
-
this.
|
|
140
|
+
this.va.remove(STORAGE_KEYS.eu[s]);
|
|
141
141
|
}
|
|
142
142
|
for (let t = 0; t < e.length; t++) {
|
|
143
143
|
const s = e[t];
|
|
144
|
-
this.
|
|
144
|
+
this.Ma.remove(STORAGE_KEYS.q[s]);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
|
|
148
|
-
return t || STORAGE_KEYS.q.
|
|
147
|
+
Fa(t) {
|
|
148
|
+
return t || STORAGE_KEYS.q.Ia;
|
|
149
149
|
}
|
|
150
|
-
|
|
151
|
-
let e = this.
|
|
150
|
+
ga(t) {
|
|
151
|
+
let e = this.Ma.lr(STORAGE_KEYS.q.Aa);
|
|
152
152
|
null == e && (e = {});
|
|
153
|
-
const s = this.
|
|
153
|
+
const s = this.Fa(t[User.Dn]);
|
|
154
154
|
for (let r in t)
|
|
155
|
-
r === User.
|
|
155
|
+
r === User.Dn ||
|
|
156
156
|
(null != e[s] && null != e[s][r]) ||
|
|
157
|
-
this.mu(t[User.
|
|
157
|
+
this.mu(t[User.Dn], r, t[r]);
|
|
158
158
|
}
|
|
159
159
|
mu(t, e, s) {
|
|
160
|
-
let r = this.
|
|
160
|
+
let r = this.Ma.lr(STORAGE_KEYS.q.Aa);
|
|
161
161
|
null == r && (r = {});
|
|
162
|
-
const o = this.
|
|
162
|
+
const o = this.Fa(t);
|
|
163
163
|
let n = r[o];
|
|
164
164
|
if (
|
|
165
|
-
(null == n && ((n = {}), null != t && (n[User.
|
|
165
|
+
(null == n && ((n = {}), null != t && (n[User.Dn] = t)), e === User.lu)
|
|
166
166
|
) {
|
|
167
167
|
null == n[e] && (n[e] = {});
|
|
168
168
|
for (let t in s) n[e][t] = s[t];
|
|
169
169
|
} else n[e] = s;
|
|
170
|
-
return (r[o] = n), this.
|
|
170
|
+
return (r[o] = n), this.Ma.store(STORAGE_KEYS.q.Aa, r);
|
|
171
171
|
}
|
|
172
|
-
|
|
173
|
-
const t = this.
|
|
174
|
-
this.
|
|
172
|
+
La() {
|
|
173
|
+
const t = this.Ma.lr(STORAGE_KEYS.q.Aa);
|
|
174
|
+
this.Ma.remove(STORAGE_KEYS.q.Aa);
|
|
175
175
|
const e = [];
|
|
176
176
|
for (let s in t) null != t[s] && e.push(t[s]);
|
|
177
177
|
return e;
|
|
178
178
|
}
|
|
179
179
|
ou(t) {
|
|
180
|
-
const e = this.
|
|
180
|
+
const e = this.Ma.lr(STORAGE_KEYS.q.Aa);
|
|
181
181
|
if (null != e) {
|
|
182
|
-
const s = this.
|
|
182
|
+
const s = this.Fa(null),
|
|
183
183
|
r = e[s];
|
|
184
184
|
null != r &&
|
|
185
185
|
((e[s] = void 0),
|
|
186
|
-
this.
|
|
187
|
-
(r[User.
|
|
188
|
-
this.
|
|
186
|
+
this.Ma.store(STORAGE_KEYS.q.Aa, e),
|
|
187
|
+
(r[User.Dn] = t),
|
|
188
|
+
this.ga(r));
|
|
189
189
|
}
|
|
190
|
-
const s = this.tu(STORAGE_KEYS.eu.
|
|
190
|
+
const s = this.tu(STORAGE_KEYS.eu.xh);
|
|
191
191
|
let r = null;
|
|
192
192
|
null != s && (r = s.iu);
|
|
193
|
-
const o = this.
|
|
193
|
+
const o = this.ya();
|
|
194
194
|
if (null != o)
|
|
195
195
|
for (let e = 0; e < o.length; e++) {
|
|
196
196
|
const s = o[e];
|
|
197
|
-
null == s.userId && s.sessionId == r && (s.userId = t), this.
|
|
197
|
+
null == s.userId && s.sessionId == r && (s.userId = t), this.qh(s);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
|
|
201
|
-
return this.
|
|
200
|
+
Ba() {
|
|
201
|
+
return this.Ma.Pa;
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
G._a = class {
|
|
205
205
|
constructor(t) {
|
|
206
|
-
(this._r = t), (this.
|
|
206
|
+
(this._r = t), (this.Pa = ot.xa() ? 3 : 10);
|
|
207
207
|
}
|
|
208
|
-
|
|
208
|
+
Ja(t) {
|
|
209
209
|
return t + "." + this._r;
|
|
210
210
|
}
|
|
211
211
|
store(t, e) {
|
|
212
212
|
const s = { v: e };
|
|
213
213
|
try {
|
|
214
|
-
return localStorage.setItem(this.
|
|
214
|
+
return localStorage.setItem(this.Ja(t), JSON.stringify(s)), !0;
|
|
215
215
|
} catch (t) {
|
|
216
216
|
return r.D.info("Storage failure: " + t.message), !1;
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
lr(t) {
|
|
220
220
|
try {
|
|
221
|
-
const e = JSON.parse(localStorage.getItem(this.
|
|
221
|
+
const e = JSON.parse(localStorage.getItem(this.Ja(t)));
|
|
222
222
|
return null == e ? null : e.v;
|
|
223
223
|
} catch (t) {
|
|
224
224
|
return r.D.info("Storage retrieval failure: " + t.message), null;
|
|
@@ -226,7 +226,7 @@ G._a = class {
|
|
|
226
226
|
}
|
|
227
227
|
remove(t) {
|
|
228
228
|
try {
|
|
229
|
-
localStorage.removeItem(this.
|
|
229
|
+
localStorage.removeItem(this.Ja(t));
|
|
230
230
|
} catch (t) {
|
|
231
231
|
return r.D.info("Storage removal failure: " + t.message), !1;
|
|
232
232
|
}
|
|
@@ -234,12 +234,12 @@ G._a = class {
|
|
|
234
234
|
};
|
|
235
235
|
G.ne = class {
|
|
236
236
|
constructor(t, e) {
|
|
237
|
-
(this._r = t), (this.
|
|
237
|
+
(this._r = t), (this.ka = this.Va()), (this.za = 576e3), (this.Qa = !!e);
|
|
238
238
|
}
|
|
239
|
-
|
|
239
|
+
Ja(t) {
|
|
240
240
|
return null != this._r ? t + "." + this._r : t;
|
|
241
241
|
}
|
|
242
|
-
|
|
242
|
+
Va() {
|
|
243
243
|
let t = 0,
|
|
244
244
|
e = document.location.hostname;
|
|
245
245
|
const s = e.split("."),
|
|
@@ -256,10 +256,10 @@ G.ne = class {
|
|
|
256
256
|
}
|
|
257
257
|
ie() {
|
|
258
258
|
const t = new Date();
|
|
259
|
-
return t.setTime(t.getTime() + 60 * this.
|
|
259
|
+
return t.setTime(t.getTime() + 60 * this.za * 1e3), t.getFullYear();
|
|
260
260
|
}
|
|
261
|
-
|
|
262
|
-
const t =
|
|
261
|
+
Ha() {
|
|
262
|
+
const t = Lt(STORAGE_KEYS.eu),
|
|
263
263
|
e = document.cookie.split(";");
|
|
264
264
|
for (let s = 0; s < e.length; s++) {
|
|
265
265
|
let r = e[s];
|
|
@@ -272,19 +272,19 @@ G.ne = class {
|
|
|
272
272
|
}
|
|
273
273
|
if (o) {
|
|
274
274
|
const t = r.split("=")[0];
|
|
275
|
-
-1 === t.indexOf("." + this._r) && this
|
|
275
|
+
-1 === t.indexOf("." + this._r) && this.Wa(t);
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
store(t, e) {
|
|
280
|
-
this.
|
|
280
|
+
this.Ha();
|
|
281
281
|
const s = new Date();
|
|
282
|
-
s.setTime(s.getTime() + 60 * this.
|
|
282
|
+
s.setTime(s.getTime() + 60 * this.za * 1e3);
|
|
283
283
|
const o = "expires=" + s.toUTCString(),
|
|
284
|
-
n = "domain=" + this.
|
|
284
|
+
n = "domain=" + this.ka;
|
|
285
285
|
let i;
|
|
286
|
-
i = this.
|
|
287
|
-
const a = this.
|
|
286
|
+
i = this.Qa ? e : encodeURIComponent(JSON.stringify(e));
|
|
287
|
+
const a = this.Ja(t) + "=" + i + ";" + o + ";" + n + ";path=/";
|
|
288
288
|
return a.length >= 4093
|
|
289
289
|
? (r.D.info(
|
|
290
290
|
"Storage failure: string is " +
|
|
@@ -296,7 +296,7 @@ G.ne = class {
|
|
|
296
296
|
}
|
|
297
297
|
lr(t) {
|
|
298
298
|
const e = [],
|
|
299
|
-
s = this.
|
|
299
|
+
s = this.Ja(t) + "=",
|
|
300
300
|
o = document.cookie.split(";");
|
|
301
301
|
for (let n = 0; n < o.length; n++) {
|
|
302
302
|
let i = o[n];
|
|
@@ -304,7 +304,7 @@ G.ne = class {
|
|
|
304
304
|
if (0 === i.indexOf(s))
|
|
305
305
|
try {
|
|
306
306
|
let t;
|
|
307
|
-
(t = this.
|
|
307
|
+
(t = this.Qa
|
|
308
308
|
? i.substring(s.length, i.length)
|
|
309
309
|
: JSON.parse(decodeURIComponent(i.substring(s.length, i.length)))),
|
|
310
310
|
e.push(t);
|
|
@@ -319,33 +319,33 @@ G.ne = class {
|
|
|
319
319
|
return e.length > 0 ? e[e.length - 1] : null;
|
|
320
320
|
}
|
|
321
321
|
remove(t) {
|
|
322
|
-
this
|
|
322
|
+
this.Wa(this.Ja(t));
|
|
323
323
|
}
|
|
324
|
-
|
|
324
|
+
Wa(t) {
|
|
325
325
|
const e = t + "=;expires=" + new Date(0).toGMTString();
|
|
326
326
|
(document.cookie = e), (document.cookie = e + ";path=/");
|
|
327
|
-
const s = e + ";domain=" + this.
|
|
327
|
+
const s = e + ";domain=" + this.ka;
|
|
328
328
|
(document.cookie = s), (document.cookie = s + ";path=/");
|
|
329
329
|
}
|
|
330
330
|
};
|
|
331
331
|
G.Oa = class {
|
|
332
332
|
constructor() {
|
|
333
|
-
(this.
|
|
333
|
+
(this.Xa = {}), (this.Za = 5242880), (this.Pa = 3);
|
|
334
334
|
}
|
|
335
335
|
store(t, e) {
|
|
336
336
|
const s = { value: e },
|
|
337
|
-
o = this
|
|
338
|
-
return o > this.
|
|
337
|
+
o = this.$a(e);
|
|
338
|
+
return o > this.Za
|
|
339
339
|
? (r.D.info(
|
|
340
340
|
"Storage failure: object is ≈" +
|
|
341
341
|
o +
|
|
342
342
|
" bytes which is greater than the max of " +
|
|
343
|
-
this.
|
|
343
|
+
this.Za
|
|
344
344
|
),
|
|
345
345
|
!1)
|
|
346
|
-
: ((this.
|
|
346
|
+
: ((this.Xa[t] = s), !0);
|
|
347
347
|
}
|
|
348
|
-
|
|
348
|
+
$a(t) {
|
|
349
349
|
const e = [],
|
|
350
350
|
s = [t];
|
|
351
351
|
let r = 0;
|
|
@@ -362,33 +362,33 @@ G.Oa = class {
|
|
|
362
362
|
return r;
|
|
363
363
|
}
|
|
364
364
|
lr(t) {
|
|
365
|
-
const e = this.
|
|
365
|
+
const e = this.Xa[t];
|
|
366
366
|
return null == e ? null : e.value;
|
|
367
367
|
}
|
|
368
368
|
remove(t) {
|
|
369
|
-
this.
|
|
369
|
+
this.Xa[t] = null;
|
|
370
370
|
}
|
|
371
371
|
};
|
|
372
372
|
G.wa = class {
|
|
373
373
|
constructor(t, e, s) {
|
|
374
|
-
(this.
|
|
375
|
-
e && this.
|
|
376
|
-
s && this.
|
|
377
|
-
this.
|
|
374
|
+
(this.El = []),
|
|
375
|
+
e && this.El.push(new G.ne(t)),
|
|
376
|
+
s && this.El.push(new G._a(t)),
|
|
377
|
+
this.El.push(new G.Oa(t));
|
|
378
378
|
}
|
|
379
379
|
store(t, e) {
|
|
380
380
|
let s = !0;
|
|
381
|
-
for (let r = 0; r < this.
|
|
381
|
+
for (let r = 0; r < this.El.length; r++) s = this.El[r].store(t, e) && s;
|
|
382
382
|
return s;
|
|
383
383
|
}
|
|
384
384
|
lr(t) {
|
|
385
|
-
for (let e = 0; e < this.
|
|
386
|
-
const s = this.
|
|
385
|
+
for (let e = 0; e < this.El.length; e++) {
|
|
386
|
+
const s = this.El[e].lr(t);
|
|
387
387
|
if (null != s) return s;
|
|
388
388
|
}
|
|
389
389
|
return null;
|
|
390
390
|
}
|
|
391
391
|
remove(t) {
|
|
392
|
-
for (let e = 0; e < this.
|
|
392
|
+
for (let e = 0; e < this.El.length; e++) this.El[e].remove(t);
|
|
393
393
|
}
|
|
394
394
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
2
2
|
export default class u {
|
|
3
3
|
constructor() {
|
|
4
|
-
this.
|
|
4
|
+
this.Se = {};
|
|
5
5
|
}
|
|
6
6
|
ut(t) {
|
|
7
7
|
if ("function" != typeof t) return null;
|
|
8
8
|
const i = r.it.nt();
|
|
9
|
-
return (this.
|
|
9
|
+
return (this.Se[i] = t), i;
|
|
10
10
|
}
|
|
11
11
|
removeSubscription(t) {
|
|
12
|
-
delete this.
|
|
12
|
+
delete this.Se[t];
|
|
13
13
|
}
|
|
14
14
|
removeAllSubscriptions() {
|
|
15
|
-
this.
|
|
15
|
+
this.Se = {};
|
|
16
16
|
}
|
|
17
17
|
bu() {
|
|
18
|
-
return Object.keys(this.
|
|
18
|
+
return Object.keys(this.Se).length;
|
|
19
19
|
}
|
|
20
20
|
St(t) {
|
|
21
21
|
const i = [];
|
|
22
|
-
for (let r in this.
|
|
22
|
+
for (let r in this.Se) i.push(this.Se[r](t));
|
|
23
23
|
return i;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
fa: "invalid_api_key",
|
|
3
|
+
ma: "blacklisted",
|
|
4
|
+
pa: "no_device_identifier",
|
|
5
|
+
la: "invalid_json_response",
|
|
6
|
+
ca: "empty_response",
|
|
7
7
|
__: "sdk_auth_error"
|
|
8
8
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { isObject as
|
|
1
|
+
import { isObject as yt } from "../util/code-utils.js";
|
|
2
2
|
import {
|
|
3
3
|
convertMsToSeconds as l,
|
|
4
|
-
timestampOrNow as
|
|
4
|
+
timestampOrNow as Jt
|
|
5
5
|
} from "../util/date-utils.js";
|
|
6
6
|
export default class ue {
|
|
7
7
|
constructor(t, i, s, r, e) {
|
|
8
8
|
(this.userId = t),
|
|
9
9
|
(this.type = i),
|
|
10
|
-
(this.time =
|
|
10
|
+
(this.time = Jt(s)),
|
|
11
11
|
(this.sessionId = r),
|
|
12
12
|
(this.data = e);
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
Pi() {
|
|
15
15
|
const t = {
|
|
16
16
|
name: this.type,
|
|
17
17
|
time: l(this.time),
|
|
@@ -32,10 +32,10 @@ export default class ue {
|
|
|
32
32
|
static fromJson(t) {
|
|
33
33
|
return new ue(t.user_id, t.name, t.time, t.session_id, t.data);
|
|
34
34
|
}
|
|
35
|
-
static
|
|
36
|
-
return null != t &&
|
|
35
|
+
static Ua(t) {
|
|
36
|
+
return null != t && yt(t) && null != t.t && "" !== t.t;
|
|
37
37
|
}
|
|
38
|
-
static
|
|
38
|
+
static Pn(t) {
|
|
39
39
|
return new ue(t.u, t.t, t.ts, t.s, t.d);
|
|
40
40
|
}
|
|
41
41
|
}
|
package/src/models/device.js
CHANGED
package/src/models/identifier.js
CHANGED
|
@@ -5,16 +5,16 @@ export default class _t {
|
|
|
5
5
|
(s = parseInt(s)),
|
|
6
6
|
(isNaN(s) || 0 === s) && (s = new Date().valueOf()),
|
|
7
7
|
(this.iu = t),
|
|
8
|
-
(this.
|
|
9
|
-
(this.
|
|
10
|
-
(this.
|
|
8
|
+
(this.jh = s),
|
|
9
|
+
(this.Wh = new Date().valueOf()),
|
|
10
|
+
(this.Hh = e);
|
|
11
11
|
}
|
|
12
12
|
ss() {
|
|
13
|
-
return { g: this.iu, e: this.
|
|
13
|
+
return { g: this.iu, e: this.Hh, c: this.jh, l: this.Wh };
|
|
14
14
|
}
|
|
15
|
-
static
|
|
15
|
+
static Pn(t) {
|
|
16
16
|
if (null == t || null == t.g) return null;
|
|
17
17
|
const e = new _t(t.g, t.e, t.c);
|
|
18
|
-
return (e.
|
|
18
|
+
return (e.Wh = t.l), e;
|
|
19
19
|
}
|
|
20
20
|
}
|
package/src/models/push-token.js
CHANGED
|
@@ -2,7 +2,7 @@ import { rehydrateDateAfterJsonization as w } from "../util/date-utils.js";
|
|
|
2
2
|
export default class ei {
|
|
3
3
|
constructor(t, i, l, s, u) {
|
|
4
4
|
(this.endpoint = t || null),
|
|
5
|
-
(this.
|
|
5
|
+
(this.kn = i || null),
|
|
6
6
|
(this.publicKey = l || null),
|
|
7
7
|
(this.zl = s || null),
|
|
8
8
|
(this.gl = u || null);
|
|
@@ -10,13 +10,13 @@ export default class ei {
|
|
|
10
10
|
ss() {
|
|
11
11
|
return {
|
|
12
12
|
e: this.endpoint,
|
|
13
|
-
c: this.
|
|
13
|
+
c: this.kn,
|
|
14
14
|
p: this.publicKey,
|
|
15
15
|
u: this.zl,
|
|
16
16
|
v: this.gl
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
static
|
|
19
|
+
static Pn(t) {
|
|
20
20
|
return new ei(t.e, w(t.c), t.p, t.u, t.v);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
export default class
|
|
1
|
+
export default class Kt {
|
|
2
2
|
constructor(t, s, i, h, l, e, r, u) {
|
|
3
3
|
(this.ol = t || 0),
|
|
4
|
-
(this.
|
|
5
|
-
(this.
|
|
6
|
-
(this.
|
|
7
|
-
(this.
|
|
8
|
-
(null != l && "" !== l) || (this.
|
|
4
|
+
(this.fl = s || []),
|
|
5
|
+
(this.bl = i || []),
|
|
6
|
+
(this.dl = h || []),
|
|
7
|
+
(this.wl = l),
|
|
8
|
+
(null != l && "" !== l) || (this.wl = null),
|
|
9
9
|
(this.gl = e || null),
|
|
10
10
|
(this.ml = r || {}),
|
|
11
|
-
(this.
|
|
11
|
+
(this.hi = u || {});
|
|
12
12
|
}
|
|
13
13
|
ss() {
|
|
14
14
|
return {
|
|
15
|
-
s: "4.
|
|
15
|
+
s: "4.7.0",
|
|
16
16
|
l: this.ol,
|
|
17
|
-
e: this.
|
|
18
|
-
a: this.
|
|
19
|
-
p: this.
|
|
20
|
-
m: this.
|
|
17
|
+
e: this.fl,
|
|
18
|
+
a: this.bl,
|
|
19
|
+
p: this.dl,
|
|
20
|
+
m: this.wl,
|
|
21
21
|
v: this.gl,
|
|
22
22
|
c: this.ml,
|
|
23
|
-
f: this.
|
|
23
|
+
f: this.hi
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
static
|
|
26
|
+
static Pn(t) {
|
|
27
27
|
let s = t.l;
|
|
28
28
|
return (
|
|
29
|
-
"4.
|
|
29
|
+
"4.7.0" !== t.s && (s = 0), new Kt(s, t.e, t.a, t.p, t.m, t.v, t.c, t.f)
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
}
|