@braze/web-sdk 6.3.0 → 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 +25 -6
- 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 +14 -13
- package/src/util/window-utils.js +1 -1
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
3
|
-
const
|
|
2
|
+
import W from "./content-cards-provider.js";
|
|
3
|
+
const Y = {
|
|
4
4
|
i: !1,
|
|
5
5
|
provider: null,
|
|
6
6
|
o: () => (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
((
|
|
10
|
-
r.v(
|
|
11
|
-
|
|
7
|
+
Y.t(),
|
|
8
|
+
Y.provider ||
|
|
9
|
+
((Y.provider = new W(r.ir(), r.p(), r.l(), r.nr(), r.m())),
|
|
10
|
+
r.v(Y.provider),
|
|
11
|
+
r.tr("ccr", () => {
|
|
12
|
+
var r;
|
|
13
|
+
null === (r = Y.provider) || void 0 === r || r.ar();
|
|
14
|
+
})),
|
|
15
|
+
Y.provider
|
|
12
16
|
),
|
|
13
17
|
t: () => {
|
|
14
|
-
|
|
18
|
+
Y.i || (r.g(Y), (Y.i = !0));
|
|
15
19
|
},
|
|
16
20
|
destroy: () => {
|
|
17
|
-
(
|
|
21
|
+
(Y.provider = null), (Y.i = !1);
|
|
18
22
|
},
|
|
19
23
|
};
|
|
20
|
-
export default
|
|
24
|
+
export default Y;
|
|
@@ -2,18 +2,18 @@ import a from "../util/net.js";
|
|
|
2
2
|
import t from "../common/base-provider.js";
|
|
3
3
|
import r from "../managers/braze-instance.js";
|
|
4
4
|
import ContentCards from "./content-cards.js";
|
|
5
|
-
import { dateFromUnixTimestamp as
|
|
6
|
-
import { isURIJavascriptOrData as
|
|
5
|
+
import { dateFromUnixTimestamp as X } from "../util/date-utils.js";
|
|
6
|
+
import { isURIJavascriptOrData as Z } from "../util/url-utils.js";
|
|
7
7
|
import {
|
|
8
|
-
newCardFromContentCardsJson as
|
|
9
|
-
newCardFromSerializedValue as
|
|
8
|
+
newCardFromContentCardsJson as tt,
|
|
9
|
+
newCardFromSerializedValue as st,
|
|
10
10
|
} from "../Card/util/card-factory.js";
|
|
11
11
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
12
12
|
import u from "../managers/subscription-manager.js";
|
|
13
13
|
import h from "../util/request-header-utils.js";
|
|
14
14
|
import { randomInclusive as l } from "../util/math.js";
|
|
15
|
-
import { logger as E, IndexedDBAdapter as
|
|
16
|
-
export default class
|
|
15
|
+
import { logger as E, IndexedDBAdapter as it } from "../../shared-lib/index.js";
|
|
16
|
+
export default class W extends t {
|
|
17
17
|
constructor(t, s, i, e, h) {
|
|
18
18
|
super(),
|
|
19
19
|
(this.Cs = t),
|
|
@@ -32,8 +32,8 @@ export default class Z extends t {
|
|
|
32
32
|
(this.Ss = 0),
|
|
33
33
|
(this.cards = []),
|
|
34
34
|
this.Ts();
|
|
35
|
-
const n =
|
|
36
|
-
new
|
|
35
|
+
const n = it.Us.Rs;
|
|
36
|
+
new it(n, E).Ds(n.Fs.As, (t) => {
|
|
37
37
|
this.Ls(t);
|
|
38
38
|
}),
|
|
39
39
|
(this.Ns = null),
|
|
@@ -59,7 +59,7 @@ export default class Z extends t {
|
|
|
59
59
|
const t = this.j.lt(s.ct.Ps) || [],
|
|
60
60
|
i = [];
|
|
61
61
|
for (let s = 0; s < t.length; s++) {
|
|
62
|
-
const e =
|
|
62
|
+
const e = st(t[s]);
|
|
63
63
|
null != e && i.push(e);
|
|
64
64
|
}
|
|
65
65
|
(this.cards = this.Xs(this._s(i, !1))),
|
|
@@ -81,10 +81,10 @@ export default class Z extends t {
|
|
|
81
81
|
break;
|
|
82
82
|
}
|
|
83
83
|
if (i) {
|
|
84
|
-
const t =
|
|
84
|
+
const t = tt(e);
|
|
85
85
|
null != h && h.viewed && t && (t.viewed = !0), null != t && r.push(t);
|
|
86
86
|
} else if (null == h) {
|
|
87
|
-
const t =
|
|
87
|
+
const t = tt(e);
|
|
88
88
|
null != t && r.push(t);
|
|
89
89
|
} else {
|
|
90
90
|
if (!h.ri(e))
|
|
@@ -130,7 +130,7 @@ export default class Z extends t {
|
|
|
130
130
|
break;
|
|
131
131
|
}
|
|
132
132
|
if (null == h) {
|
|
133
|
-
const t =
|
|
133
|
+
const t = tt(e);
|
|
134
134
|
null != t && i.push(t);
|
|
135
135
|
} else {
|
|
136
136
|
if (!h.ri(e))
|
|
@@ -176,7 +176,7 @@ export default class Z extends t {
|
|
|
176
176
|
let r = !1;
|
|
177
177
|
for (let s = 0; s < t.length; s++) {
|
|
178
178
|
const n = t[s].url;
|
|
179
|
-
if (!this.vs && n &&
|
|
179
|
+
if (!this.vs && n && Z(n)) {
|
|
180
180
|
E.error(
|
|
181
181
|
`Card with url ${n} will not be displayed because Javascript URLs are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable this card.`,
|
|
182
182
|
);
|
|
@@ -202,31 +202,31 @@ export default class Z extends t {
|
|
|
202
202
|
Zs() {
|
|
203
203
|
this.Js && (clearTimeout(this.Js), (this.Js = null));
|
|
204
204
|
}
|
|
205
|
-
|
|
205
|
+
ar(t, i, e = !1) {
|
|
206
206
|
var n;
|
|
207
207
|
const o = this.B,
|
|
208
208
|
u = this.j;
|
|
209
209
|
if (!o || !u) return void ("function" == typeof i && i());
|
|
210
|
-
if ((e && (h.
|
|
210
|
+
if ((e && (h.fi(u, h.H.Ci), this.Zs()), !this.Os()))
|
|
211
211
|
return void (
|
|
212
212
|
null === (n = this.h) ||
|
|
213
213
|
void 0 === n ||
|
|
214
|
-
n.
|
|
215
|
-
this.
|
|
214
|
+
n.bi(() => {
|
|
215
|
+
this.ar(t, i, !0);
|
|
216
216
|
})
|
|
217
217
|
);
|
|
218
218
|
const c = o.$({}, !0);
|
|
219
|
-
u.lt(s.ct.Qs) !== r.Vs() && this.
|
|
219
|
+
u.lt(s.ct.Qs) !== r.Vs() && this.vi(),
|
|
220
220
|
(c.last_full_sync_at = this.ys),
|
|
221
221
|
(c.last_card_updated_at = this.Ss);
|
|
222
|
-
const f = o.A(c, h.H.
|
|
222
|
+
const f = o.A(c, h.H.Ci, e);
|
|
223
223
|
let d = !1;
|
|
224
224
|
o.J(
|
|
225
225
|
c,
|
|
226
226
|
(s = -1) => {
|
|
227
227
|
if (this.j) {
|
|
228
228
|
const t = new Date().valueOf();
|
|
229
|
-
h.K(this.j, h.H.
|
|
229
|
+
h.K(this.j, h.H.Ci, t);
|
|
230
230
|
}
|
|
231
231
|
-1 !== s && f.push(["X-Braze-Req-Tokens-Remaining", s.toString()]),
|
|
232
232
|
a.O({
|
|
@@ -253,9 +253,9 @@ export default class Z extends t {
|
|
|
253
253
|
o.st(
|
|
254
254
|
e,
|
|
255
255
|
() => {
|
|
256
|
-
this.
|
|
256
|
+
this.ar(t, i, !1);
|
|
257
257
|
},
|
|
258
|
-
h.H.
|
|
258
|
+
h.H.Ci,
|
|
259
259
|
(t) => this.Ys(t),
|
|
260
260
|
() => this.Zs(),
|
|
261
261
|
r,
|
|
@@ -263,7 +263,7 @@ export default class Z extends t {
|
|
|
263
263
|
},
|
|
264
264
|
});
|
|
265
265
|
},
|
|
266
|
-
h.H.
|
|
266
|
+
h.H.Ci,
|
|
267
267
|
i,
|
|
268
268
|
);
|
|
269
269
|
}
|
|
@@ -285,13 +285,13 @@ export default class Z extends t {
|
|
|
285
285
|
return (
|
|
286
286
|
0 === e && (e = void 0),
|
|
287
287
|
this.j && this.j.lt(s.ct.Hs) === this.Ss && void 0 === e && (e = this.Ss),
|
|
288
|
-
new ContentCards(i,
|
|
288
|
+
new ContentCards(i, X(e))
|
|
289
289
|
);
|
|
290
290
|
}
|
|
291
291
|
St(t) {
|
|
292
292
|
return this.ws.wt(t);
|
|
293
293
|
}
|
|
294
|
-
|
|
294
|
+
vi() {
|
|
295
295
|
(this.ys = 0),
|
|
296
296
|
(this.Ss = 0),
|
|
297
297
|
this.j && (this.j.Nt(s.ct.Gs), this.j.Nt(s.ct.Hs));
|
|
@@ -306,7 +306,7 @@ export default class Z extends t {
|
|
|
306
306
|
this.j.Nt(s.ct.Pt),
|
|
307
307
|
this.j.Nt(s.ct.Lt))),
|
|
308
308
|
this.Zs(),
|
|
309
|
-
this.
|
|
309
|
+
this.vi();
|
|
310
310
|
}
|
|
311
311
|
clearData(t) {
|
|
312
312
|
(this.ys = 0),
|
|
@@ -324,9 +324,9 @@ export default class Z extends t {
|
|
|
324
324
|
this.Zs();
|
|
325
325
|
}
|
|
326
326
|
Os() {
|
|
327
|
-
return !!this.h && (!!this.h.
|
|
327
|
+
return !!this.h && (!!this.h.wi() || (0 !== this.h.Ft() && this.gi(), !1));
|
|
328
328
|
}
|
|
329
|
-
|
|
329
|
+
gi() {
|
|
330
330
|
this.ws.L(new ContentCards([], new Date())), this.j && this.j.Nt(s.ct.Ps);
|
|
331
331
|
}
|
|
332
332
|
}
|
|
@@ -19,14 +19,14 @@ export default class ContentCards {
|
|
|
19
19
|
sr(r) {
|
|
20
20
|
logContentCardImpressions(r);
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
dr(r) {
|
|
23
23
|
return logContentCardClick(r);
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
ur() {
|
|
26
26
|
requestContentCardsRefresh();
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
cr() {
|
|
29
29
|
return !0;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
(ContentCards.
|
|
32
|
+
(ContentCards.Cr = 6e4), (ContentCards.hr = 500), (ContentCards.lr = 1e4);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Y from "./content-cards-provider-factory.js";
|
|
2
2
|
import r from "../managers/braze-instance.js";
|
|
3
3
|
export function getCachedContentCards() {
|
|
4
|
-
if (r.rr()) return
|
|
4
|
+
if (r.rr()) return Y.o().Ws(!1);
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import Y from "./content-cards-provider-factory.js";
|
|
3
3
|
export function requestContentCardsRefresh(e, t) {
|
|
4
|
-
if (r.rr()) return
|
|
4
|
+
if (r.rr()) return Y.o().ar(e, t, !0);
|
|
5
5
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import Y from "./content-cards-provider-factory.js";
|
|
3
3
|
export function subscribeToContentCardsUpdates(o) {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
|
-
const t =
|
|
5
|
+
const t = Y.o(),
|
|
6
6
|
n = t.St(o);
|
|
7
7
|
if (!t.jt()) {
|
|
8
8
|
const o = r.nn();
|
|
9
9
|
if (o) {
|
|
10
10
|
const r = o.rn(() => {
|
|
11
|
-
t.
|
|
11
|
+
t.ar(void 0, void 0, !0);
|
|
12
12
|
});
|
|
13
13
|
r && t.yt(r);
|
|
14
14
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import r, { OPTIONS as
|
|
1
|
+
import r, { OPTIONS as q } from "../../managers/braze-instance.js";
|
|
2
2
|
import { ContentCards, subscribeToContentCardsUpdates } from "../index.js";
|
|
3
|
-
import
|
|
3
|
+
import Y from "../content-cards-provider-factory.js";
|
|
4
4
|
import { setCardHeight as tn } from "../../Card/display/card-display.js";
|
|
5
5
|
import { logger as E } from "../../../shared-lib/index.js";
|
|
6
6
|
import {
|
|
@@ -18,17 +18,17 @@ export function showContentCards(n, t) {
|
|
|
18
18
|
fn();
|
|
19
19
|
let e = !1;
|
|
20
20
|
null == n && ((n = document.body), (e = !0));
|
|
21
|
-
const o = r.ee(
|
|
22
|
-
s =
|
|
21
|
+
const o = r.ee(q.tn) || !1,
|
|
22
|
+
s = Y.o().Ws(!1);
|
|
23
23
|
"function" == typeof t && cn(s, t(s.cards.slice()), s.lastUpdated, null, o);
|
|
24
24
|
const a = on(s, o, e),
|
|
25
|
-
i =
|
|
25
|
+
i = Y.o(),
|
|
26
26
|
c = i.Bs();
|
|
27
27
|
(null == s.lastUpdated ||
|
|
28
|
-
new Date().valueOf() - s.lastUpdated.valueOf() > ContentCards.
|
|
29
|
-
(null == c || new Date().valueOf() - c > ContentCards.
|
|
28
|
+
new Date().valueOf() - s.lastUpdated.valueOf() > ContentCards.Cr) &&
|
|
29
|
+
(null == c || new Date().valueOf() - c > ContentCards.Cr) &&
|
|
30
30
|
(E.info(
|
|
31
|
-
`Cached content cards were older than max TTL of ${ContentCards.
|
|
31
|
+
`Cached content cards were older than max TTL of ${ContentCards.Cr} ms, requesting an update from the server.`,
|
|
32
32
|
),
|
|
33
33
|
sn(s, a),
|
|
34
34
|
i.Es(new Date().valueOf()));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import aa from "../managers/braze-instance.js";
|
|
2
2
|
import BrazeSdkMetadata from "./braze-sdk-metadata.js";
|
|
3
3
|
import {
|
|
4
|
-
isArray as
|
|
4
|
+
isArray as z,
|
|
5
5
|
validateValueIsFromEnum as ta,
|
|
6
6
|
} from "../util/code-utils.js";
|
|
7
7
|
import { logger as E } from "../../shared-lib/index.js";
|
|
@@ -9,7 +9,7 @@ export function addSdkMetadata(a) {
|
|
|
9
9
|
if (!aa.rr()) return;
|
|
10
10
|
const t = aa.m();
|
|
11
11
|
if (t) {
|
|
12
|
-
if (!
|
|
12
|
+
if (!z(a))
|
|
13
13
|
return (
|
|
14
14
|
E.error("Cannot set SDK metadata because metadata is not an array."), !1
|
|
15
15
|
);
|
package/src/Core/change-user.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { getByteLength as
|
|
2
|
+
import { getByteLength as rr } from "../util/string-utils.js";
|
|
3
3
|
import { logger as E } from "../../shared-lib/index.js";
|
|
4
4
|
import { User } from "../User/index.js";
|
|
5
|
-
import { validateStandardString as
|
|
5
|
+
import { validateStandardString as er } from "../util/validation-utils.js";
|
|
6
6
|
export function changeUser(e, i) {
|
|
7
7
|
if (!r.rr()) return;
|
|
8
8
|
if (null == e || 0 === e.length || e != e)
|
|
9
9
|
return void E.error("changeUser requires a non-empty userId.");
|
|
10
|
-
if (
|
|
10
|
+
if (rr(e) > User.mr)
|
|
11
11
|
return void E.error(
|
|
12
12
|
`Rejected user id "${e}" because it is longer than ${User.mr} bytes.`,
|
|
13
13
|
);
|
|
14
|
-
if (null != i && !
|
|
14
|
+
if (null != i && !er(i, "set signature for new user", "signature")) return;
|
|
15
15
|
const t = r.nn();
|
|
16
|
-
t && t.changeUser(e.toString(), r.
|
|
16
|
+
t && t.changeUser(e.toString(), r.gr(), i);
|
|
17
17
|
}
|
package/src/Core/disable-sdk.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { logger as E, IndexedDBAdapter as
|
|
2
|
+
import { logger as E, IndexedDBAdapter as it } from "../../shared-lib/index.js";
|
|
3
3
|
import ee, { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
4
4
|
export function disableSDK() {
|
|
5
5
|
const e = r.nn();
|
|
@@ -7,8 +7,8 @@ export function disableSDK() {
|
|
|
7
7
|
const n = new ee.ne(null, !0),
|
|
8
8
|
a = "This-cookie-will-expire-in-" + n.se();
|
|
9
9
|
n.store(s.ie, a);
|
|
10
|
-
const i =
|
|
11
|
-
new
|
|
10
|
+
const i = it.Us.Rs;
|
|
11
|
+
new it(i, E).setItem(i.Fs.le, i.me, !0),
|
|
12
12
|
E.info("disableSDK was called"),
|
|
13
13
|
r.destroy(!1),
|
|
14
14
|
r.ce(!0);
|
package/src/Core/enable-sdk.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { logger as E, IndexedDBAdapter as
|
|
2
|
+
import { logger as E, IndexedDBAdapter as it } from "../../shared-lib/index.js";
|
|
3
3
|
import ee, { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
4
4
|
export function enableSDK() {
|
|
5
5
|
new ee.ne(null, !0).remove(s.ie);
|
|
6
|
-
const e =
|
|
7
|
-
new
|
|
6
|
+
const e = it.Us.Rs;
|
|
7
|
+
new it(e, E).be(e.Fs.le, e.me),
|
|
8
8
|
E.info("enableSDK was called"),
|
|
9
9
|
r.destroy(!1),
|
|
10
10
|
r.ce(!1);
|
package/src/Core/get-user.js
CHANGED
package/src/Core/is-disabled.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
2
|
import c from "../common/event-logger.js";
|
|
3
3
|
import { logger as E, EventTypes as m } from "../../shared-lib/index.js";
|
|
4
|
-
import
|
|
5
|
-
import { TriggersProviderFactory as
|
|
4
|
+
import et from "../triggers/models/trigger-events.js";
|
|
5
|
+
import { TriggersProviderFactory as ot } from "../triggers/triggers-provider-factory.js";
|
|
6
6
|
import {
|
|
7
|
-
validateCustomProperties as
|
|
8
|
-
validateCustomString as
|
|
7
|
+
validateCustomProperties as rt,
|
|
8
|
+
validateCustomString as nt,
|
|
9
9
|
} from "../util/validation-utils.js";
|
|
10
|
-
import { LOG_CUSTOM_EVENT_STRING as
|
|
10
|
+
import { LOG_CUSTOM_EVENT_STRING as mt } from "../common/constants.js";
|
|
11
11
|
export function logCustomEvent(t, e) {
|
|
12
12
|
if (!r.rr()) return !1;
|
|
13
13
|
if (null == t || t.length <= 0)
|
|
@@ -17,10 +17,10 @@ export function logCustomEvent(t, e) {
|
|
|
17
17
|
),
|
|
18
18
|
!1
|
|
19
19
|
);
|
|
20
|
-
if (!
|
|
21
|
-
const [o, n] =
|
|
20
|
+
if (!nt(t, "log custom event", "the event name")) return !1;
|
|
21
|
+
const [o, n] = rt(
|
|
22
22
|
e,
|
|
23
|
-
|
|
23
|
+
mt,
|
|
24
24
|
"eventProperties",
|
|
25
25
|
`log custom event "${t}"`,
|
|
26
26
|
"event",
|
|
@@ -32,7 +32,7 @@ export function logCustomEvent(t, e) {
|
|
|
32
32
|
const s = c.rt(m.CustomEvent, { n: t, p: n });
|
|
33
33
|
if (s.W) {
|
|
34
34
|
E.info(`Logged custom event "${t}".`);
|
|
35
|
-
for (const o of s.ue)
|
|
35
|
+
for (const o of s.ue) ot.o().ve(et.pe, [t, e], o);
|
|
36
36
|
}
|
|
37
37
|
return s.W;
|
|
38
38
|
}
|
package/src/Core/log-purchase.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
2
|
import { MAX_PURCHASE_QUANTITY as or } from "../common/constants.js";
|
|
3
3
|
import { logger as E, EventTypes as m } from "../../shared-lib/index.js";
|
|
4
|
-
import
|
|
5
|
-
import { TriggersProviderFactory as
|
|
4
|
+
import et from "../triggers/models/trigger-events.js";
|
|
5
|
+
import { TriggersProviderFactory as ot } from "../triggers/triggers-provider-factory.js";
|
|
6
6
|
import {
|
|
7
|
-
validateCustomProperties as
|
|
8
|
-
validateCustomString as
|
|
7
|
+
validateCustomProperties as rt,
|
|
8
|
+
validateCustomString as nt,
|
|
9
9
|
} from "../util/validation-utils.js";
|
|
10
10
|
import c from "../common/event-logger.js";
|
|
11
11
|
export function logPurchase(e, o, i, n, t) {
|
|
@@ -19,7 +19,7 @@ export function logPurchase(e, o, i, n, t) {
|
|
|
19
19
|
),
|
|
20
20
|
!1
|
|
21
21
|
);
|
|
22
|
-
if (!
|
|
22
|
+
if (!nt(e, "log purchase", "the purchase name")) return !1;
|
|
23
23
|
if (null == o || isNaN(parseFloat(o.toString())))
|
|
24
24
|
return (
|
|
25
25
|
E.error(`logPurchase requires a numeric price, got ${o}, ignoring.`), !1
|
|
@@ -219,7 +219,7 @@ export function logPurchase(e, o, i, n, t) {
|
|
|
219
219
|
E.error(`logPurchase requires a valid currencyCode, got ${i}, ignoring.`),
|
|
220
220
|
!1
|
|
221
221
|
);
|
|
222
|
-
const [u, a] =
|
|
222
|
+
const [u, a] = rt(
|
|
223
223
|
t,
|
|
224
224
|
"logPurchase",
|
|
225
225
|
"purchaseProperties",
|
|
@@ -233,7 +233,7 @@ export function logPurchase(e, o, i, n, t) {
|
|
|
233
233
|
const P = c.rt(m.Pr, { pid: e, c: i, p: s, q: D, pr: a });
|
|
234
234
|
if (P.W) {
|
|
235
235
|
E.info(`Logged ${D} purchase${D > 1 ? "s" : ""} of "${e}" for ${i} ${s}.`);
|
|
236
|
-
for (const r of P.ue)
|
|
236
|
+
for (const r of P.ue) ot.o().ve(et.Rr, [e, t], r);
|
|
237
237
|
}
|
|
238
238
|
return P.W;
|
|
239
239
|
}
|
package/src/Core/open-session.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { logger as E, IndexedDBAdapter as
|
|
3
|
-
import
|
|
4
|
-
import { TriggersProviderFactory as
|
|
2
|
+
import { logger as E, IndexedDBAdapter as it } from "../../shared-lib/index.js";
|
|
3
|
+
import et from "../triggers/models/trigger-events.js";
|
|
4
|
+
import { TriggersProviderFactory as ot } from "../triggers/triggers-provider-factory.js";
|
|
5
5
|
export function openSession() {
|
|
6
6
|
if (!r.rr()) return;
|
|
7
7
|
const i = r.nn();
|
|
8
8
|
if (!i) return;
|
|
9
9
|
i.openSession();
|
|
10
|
-
const t =
|
|
11
|
-
o = new
|
|
12
|
-
o.
|
|
10
|
+
const t = it.Us.Rs,
|
|
11
|
+
o = new it(t, E);
|
|
12
|
+
o.kr(t.Fs.vr, (r, n) => {
|
|
13
13
|
const e = n.lastClick,
|
|
14
14
|
s = n.trackingString;
|
|
15
15
|
E.info(`Firing push click trigger from ${s} push click at ${e}`);
|
|
16
|
-
const c = i
|
|
16
|
+
const c = i.$r(e, s),
|
|
17
17
|
g = function () {
|
|
18
|
-
|
|
18
|
+
ot.o().ve(et.wr, [s], c);
|
|
19
19
|
};
|
|
20
|
-
i
|
|
20
|
+
i.yr(g, g), o.be(t.Fs.vr, r);
|
|
21
21
|
}),
|
|
22
|
-
o.Ds(t.Fs.
|
|
23
|
-
i.
|
|
22
|
+
o.Ds(t.Fs.zr, function (r) {
|
|
23
|
+
i.Fr(r);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { validateStandardString as
|
|
2
|
+
import { validateStandardString as er } from "../util/validation-utils.js";
|
|
3
3
|
export function setSdkAuthenticationSignature(t) {
|
|
4
4
|
if (!r.rr()) return !1;
|
|
5
|
-
if ("" === t || !
|
|
5
|
+
if ("" === t || !er(t, "set signature", "signature", !1)) return !1;
|
|
6
6
|
const i = r.Sr();
|
|
7
7
|
return !!i && (i.setSdkAuthenticationSignature(t), !0);
|
|
8
8
|
}
|
package/src/Core/wipe-data.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
2
|
import { keys as C } from "../util/code-utils.js";
|
|
3
|
-
import { logger as E, IndexedDBAdapter as
|
|
3
|
+
import { logger as E, IndexedDBAdapter as it } from "../../shared-lib/index.js";
|
|
4
4
|
import { BRAZE_MUST_BE_INITIALIZED_ERROR as w } from "../common/constants.js";
|
|
5
5
|
export function wipeData() {
|
|
6
6
|
const o = r.p();
|
|
7
7
|
if (null == o) return void E.warn(w);
|
|
8
8
|
o.clearData();
|
|
9
|
-
const t = C(
|
|
9
|
+
const t = C(it.Us);
|
|
10
10
|
for (let o = 0; o < t.length; o++) {
|
|
11
11
|
const n = t[o],
|
|
12
|
-
r =
|
|
13
|
-
new
|
|
12
|
+
r = it.Us[n];
|
|
13
|
+
new it(r, E).clearData();
|
|
14
14
|
}
|
|
15
|
-
if (r.rr()) for (const o of r.
|
|
15
|
+
if (r.rr()) for (const o of r.gr()) o.clearData(!0);
|
|
16
16
|
const n = r.m();
|
|
17
17
|
n && n.fo();
|
|
18
18
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import r from "../managers/braze-instance.js";
|
|
2
|
+
import tr from "./dust-provider.js";
|
|
3
|
+
const ir = {
|
|
4
|
+
i: !1,
|
|
5
|
+
provider: null,
|
|
6
|
+
o: () => {
|
|
7
|
+
if ((ir.t(), !ir.provider)) {
|
|
8
|
+
const t = r.ee("dustHost");
|
|
9
|
+
(ir.provider = new tr(r.m(), r.p(), t)), r.v(ir.provider);
|
|
10
|
+
}
|
|
11
|
+
return ir.provider;
|
|
12
|
+
},
|
|
13
|
+
t: () => {
|
|
14
|
+
ir.i || (r.g(ir), (ir.i = !0));
|
|
15
|
+
},
|
|
16
|
+
destroy: () => {
|
|
17
|
+
ir.provider && ir.provider.destroy(), (ir.provider = null), (ir.i = !1);
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
export default ir;
|