@braze/web-sdk 5.8.1 → 5.9.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 +14 -9
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +19 -19
- package/shared-lib/guid.js +2 -2
- package/shared-lib/indexed-db-adapter.js +3 -3
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +11 -11
- package/src/Banner/banner-provider.js +22 -19
- package/src/Banner/display/banner-to-html.js +32 -27
- package/src/Banner/get-all-banners.js +11 -5
- package/src/Banner/get-banner.js +6 -3
- package/src/Banner/log-banner-click.js +2 -2
- package/src/Banner/log-banner-impressions.js +4 -4
- package/src/Banner/request-banners-refresh.js +5 -2
- package/src/Banner/subscribe-to-banners-updates.js +2 -2
- package/src/Banner/ui/insert-banner.js +2 -2
- package/src/Card/card-manager.js +9 -9
- package/src/Card/display/card-display.js +5 -5
- package/src/Card/log-card-click.js +2 -2
- package/src/Card/log-card-dismissal.js +2 -2
- package/src/Card/log-card-impressions.js +2 -2
- package/src/Card/models/captioned-image.js +17 -17
- package/src/Card/models/card.js +58 -58
- package/src/Card/models/classic-card.js +17 -17
- package/src/Card/models/control-card.js +8 -8
- package/src/Card/models/image-only.js +15 -15
- package/src/Card/util/card-factory.js +24 -24
- package/src/ContentCards/content-cards-provider.js +77 -75
- 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 +3 -3
- package/src/ContentCards/ui/show-content-cards.js +3 -3
- package/src/Core/change-user.js +1 -1
- package/src/Core/disable-sdk.js +4 -4
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/handle-braze-action.js +2 -2
- package/src/Core/is-initialized.js +1 -1
- package/src/Core/open-session.js +4 -4
- package/src/Core/request-immediate-data-flush.js +1 -1
- package/src/Core/wipe-data.js +7 -5
- package/src/FeatureFlags/feature-flag-factory.js +4 -4
- package/src/FeatureFlags/feature-flag.js +3 -3
- package/src/FeatureFlags/feature-flags-provider.js +17 -11
- 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 +1 -1
- package/src/Feed/feed-provider-factory.js +1 -1
- package/src/Feed/feed-provider.js +12 -12
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +8 -8
- package/src/InAppMessage/display/in-app-message-to-html.js +18 -18
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/in-app-message-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager.js +70 -70
- package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/control-message.js +2 -2
- package/src/InAppMessage/models/full-screen-message.js +6 -6
- package/src/InAppMessage/models/html-message.js +7 -7
- package/src/InAppMessage/models/in-app-message-button.js +3 -3
- package/src/InAppMessage/models/in-app-message.js +36 -36
- package/src/InAppMessage/models/modal-message.js +6 -6
- package/src/InAppMessage/models/slide-up-message.js +8 -8
- 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 +13 -13
- package/src/Push/push-manager.js +81 -81
- package/src/Push/request-push-permission.js +1 -1
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +10 -10
- package/src/User/user.js +15 -15
- package/src/common/constants.js +2 -0
- package/src/common/event-logger.js +2 -2
- package/src/common/feed-display.js +6 -6
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/managers/auth-manager.js +30 -30
- package/src/managers/braze-instance.js +94 -93
- package/src/managers/device-manager.js +14 -14
- package/src/managers/network-manager.js +123 -117
- package/src/managers/server-config-manager.js +91 -79
- package/src/managers/session-manager.js +8 -8
- package/src/managers/storage-manager-factory.js +5 -5
- package/src/managers/storage-manager.js +48 -48
- package/src/managers/subscription-manager.js +4 -4
- package/src/models/backend-errors.js +4 -4
- package/src/models/braze-event.js +9 -9
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +3 -3
- package/src/models/push-token.js +4 -4
- package/src/models/request-result.js +2 -2
- package/src/models/server-config.js +18 -18
- package/src/request-controller.js +86 -85
- package/src/triggers/models/custom-event-data.js +1 -1
- package/src/triggers/models/custom-event-property-data.js +2 -2
- package/src/triggers/models/filter-set.js +4 -4
- package/src/triggers/models/filter.js +6 -6
- 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 +33 -33
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +12 -12
- package/src/triggers/triggers-provider-factory.js +3 -3
- package/src/triggers/triggers-provider.js +17 -17
- package/src/ui/js/attach-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 +5 -5
- package/src/util/client-hints-parser.js +1 -1
- package/src/util/component-utils.js +2 -2
- package/src/util/dom-utils.js +3 -3
- package/src/util/html-display-utils.js +14 -14
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +2 -2
- package/src/util/request-header-utils.js +13 -13
- package/src/util/user-agent-parser.js +1 -1
- package/src/util/validation-utils.js +2 -2
- package/src/util/window-utils.js +2 -2
|
@@ -2,17 +2,17 @@ import l 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 P } from "../util/date-utils.js";
|
|
6
|
+
import { isURIJavascriptOrData as Y } from "../util/url-utils.js";
|
|
7
7
|
import {
|
|
8
|
-
newCardFromContentCardsJson as
|
|
9
|
-
newCardFromSerializedValue as
|
|
8
|
+
newCardFromContentCardsJson as Z,
|
|
9
|
+
newCardFromSerializedValue as tt,
|
|
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 a } from "../util/math.js";
|
|
15
|
-
import { logger as N, IndexedDBAdapter as
|
|
15
|
+
import { logger as N, IndexedDBAdapter as st } from "../../shared-lib/index.js";
|
|
16
16
|
export default class Q extends t {
|
|
17
17
|
constructor(t, s, i, e, h) {
|
|
18
18
|
super(),
|
|
@@ -27,46 +27,46 @@ export default class Q extends t {
|
|
|
27
27
|
(this.Ss = e),
|
|
28
28
|
(this.S = h),
|
|
29
29
|
(this.Ts = new u()),
|
|
30
|
-
r.
|
|
30
|
+
r.F(this.Ts),
|
|
31
31
|
(this.Rs = 0),
|
|
32
32
|
(this.Us = 0),
|
|
33
33
|
(this.cards = []),
|
|
34
34
|
this.Ds();
|
|
35
|
-
const n =
|
|
36
|
-
new
|
|
35
|
+
const n = st.Ls.Fs;
|
|
36
|
+
new st(n, N).Ns(n.Ms.Js, (t) => {
|
|
37
37
|
this.$s(t);
|
|
38
38
|
}),
|
|
39
|
+
(this.Bs = null),
|
|
40
|
+
(this.N = null),
|
|
39
41
|
(this.Es = null),
|
|
40
|
-
(this.k = null),
|
|
41
42
|
(this.Ps = null),
|
|
42
|
-
(this.Xs =
|
|
43
|
-
(this._s = 10);
|
|
43
|
+
(this.Xs = 10);
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
return this.
|
|
45
|
+
_s() {
|
|
46
|
+
return this.Bs;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
this.
|
|
48
|
+
Gs(t) {
|
|
49
|
+
this.Bs = t;
|
|
50
50
|
}
|
|
51
51
|
Ct() {
|
|
52
|
-
return this.
|
|
52
|
+
return this.N;
|
|
53
53
|
}
|
|
54
54
|
Tt(t) {
|
|
55
|
-
this.
|
|
55
|
+
this.N = t;
|
|
56
56
|
}
|
|
57
57
|
Ds() {
|
|
58
58
|
if (!this.C) return;
|
|
59
|
-
const t = this.C.ft(s.gt.
|
|
59
|
+
const t = this.C.ft(s.gt.Hs) || [],
|
|
60
60
|
i = [];
|
|
61
61
|
for (let s = 0; s < t.length; s++) {
|
|
62
|
-
const e =
|
|
62
|
+
const e = tt(t[s]);
|
|
63
63
|
null != e && i.push(e);
|
|
64
64
|
}
|
|
65
|
-
(this.cards = this.
|
|
66
|
-
(this.Rs = this.C.ft(s.gt.
|
|
67
|
-
(this.Us = this.C.ft(s.gt.
|
|
65
|
+
(this.cards = this.Is(this.Ks(i, !1))),
|
|
66
|
+
(this.Rs = this.C.ft(s.gt.Os) || this.Rs),
|
|
67
|
+
(this.Us = this.C.ft(s.gt.Qs) || this.Us);
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
Vs(t, i = !1, e = 0, h = 0) {
|
|
70
70
|
let r;
|
|
71
71
|
if (i) {
|
|
72
72
|
r = [];
|
|
@@ -81,10 +81,10 @@ export default class Q extends t {
|
|
|
81
81
|
break;
|
|
82
82
|
}
|
|
83
83
|
if (i) {
|
|
84
|
-
const t =
|
|
84
|
+
const t = Z(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 = Z(e);
|
|
88
88
|
null != t && r.push(t);
|
|
89
89
|
} else {
|
|
90
90
|
if (!h.ri(e))
|
|
@@ -95,27 +95,27 @@ export default class Q extends t {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
(this.cards = this.
|
|
99
|
-
this.
|
|
98
|
+
(this.cards = this.Is(this.Ks(r, i))),
|
|
99
|
+
this.Ws(),
|
|
100
100
|
(this.Rs = e),
|
|
101
101
|
(this.Us = h),
|
|
102
|
-
this.C && (this.C.Bt(s.gt.
|
|
102
|
+
this.C && (this.C.Bt(s.gt.Os, this.Rs), this.C.Bt(s.gt.Qs, this.Us));
|
|
103
103
|
}
|
|
104
104
|
U(t) {
|
|
105
|
-
if (this.
|
|
106
|
-
this.C && this.C.Bt(s.gt.
|
|
105
|
+
if (this.Ys() && null != t && t.cards) {
|
|
106
|
+
this.C && this.C.Bt(s.gt.Zs, r.fi());
|
|
107
107
|
const i = t.full_sync;
|
|
108
108
|
i || this.Ds(),
|
|
109
|
-
this.
|
|
110
|
-
this.Ts.X(this.
|
|
109
|
+
this.Vs(t.cards, i, t.last_full_sync_at, t.last_card_updated_at),
|
|
110
|
+
this.Ts.X(this.di(!0));
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
|
|
114
|
-
this.
|
|
113
|
+
pi(t) {
|
|
114
|
+
this.Ci(), (this.Es = t);
|
|
115
115
|
}
|
|
116
116
|
$s(t) {
|
|
117
117
|
var s;
|
|
118
|
-
if (!this.
|
|
118
|
+
if (!this.Ys()) return;
|
|
119
119
|
this.Ds();
|
|
120
120
|
const i = this.cards.slice();
|
|
121
121
|
let e = null;
|
|
@@ -130,7 +130,7 @@ export default class Q extends t {
|
|
|
130
130
|
break;
|
|
131
131
|
}
|
|
132
132
|
if (null == h) {
|
|
133
|
-
const t =
|
|
133
|
+
const t = Z(e);
|
|
134
134
|
null != t && i.push(t);
|
|
135
135
|
} else {
|
|
136
136
|
if (!h.ri(e))
|
|
@@ -141,9 +141,9 @@ export default class Q extends t {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
(this.cards = this.
|
|
144
|
+
(this.cards = this.Is(this.Ks(i, !1))), this.Ws(), this.Ts.X(this.di(!0));
|
|
145
145
|
}
|
|
146
|
-
|
|
146
|
+
Ks(t, i) {
|
|
147
147
|
let e = {},
|
|
148
148
|
h = {},
|
|
149
149
|
r = {};
|
|
@@ -168,7 +168,7 @@ export default class Q extends t {
|
|
|
168
168
|
t
|
|
169
169
|
);
|
|
170
170
|
}
|
|
171
|
-
|
|
171
|
+
Is(t) {
|
|
172
172
|
const i = [],
|
|
173
173
|
e = new Date();
|
|
174
174
|
let h = {};
|
|
@@ -176,7 +176,7 @@ export default class Q 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.Ss && n &&
|
|
179
|
+
if (!this.Ss && n && Y(n)) {
|
|
180
180
|
N.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
|
);
|
|
@@ -193,40 +193,40 @@ export default class Q extends t {
|
|
|
193
193
|
}
|
|
194
194
|
return r && this.C && this.C.Bt(s.gt.Vt, h), i;
|
|
195
195
|
}
|
|
196
|
-
|
|
196
|
+
Ws() {
|
|
197
197
|
var t;
|
|
198
198
|
const i = [];
|
|
199
199
|
for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].bt());
|
|
200
|
-
null === (t = this.C) || void 0 === t || t.Bt(s.gt.
|
|
200
|
+
null === (t = this.C) || void 0 === t || t.Bt(s.gt.Hs, i);
|
|
201
201
|
}
|
|
202
|
-
|
|
203
|
-
this.
|
|
202
|
+
Ci() {
|
|
203
|
+
this.Es && (clearTimeout(this.Es), (this.Es = null));
|
|
204
204
|
}
|
|
205
|
-
|
|
205
|
+
bi(t, i, e = !1) {
|
|
206
206
|
var n;
|
|
207
207
|
const o = this.S,
|
|
208
208
|
u = this.C;
|
|
209
209
|
if (!o || !u) return void ("function" == typeof i && i());
|
|
210
|
-
if ((e && (h.
|
|
210
|
+
if ((e && (h.vi(u, h.O.wi), this.Ci()), !this.Ys()))
|
|
211
211
|
return void (
|
|
212
212
|
null === (n = this.B) ||
|
|
213
213
|
void 0 === n ||
|
|
214
|
-
n.
|
|
215
|
-
this.
|
|
214
|
+
n.gi(() => {
|
|
215
|
+
this.bi(t, i, !0);
|
|
216
216
|
})
|
|
217
217
|
);
|
|
218
218
|
const c = o.H({}, !0);
|
|
219
|
-
u.ft(s.gt.
|
|
219
|
+
u.ft(s.gt.Zs) !== r.fi() && this.ji(),
|
|
220
220
|
(c.last_full_sync_at = this.Rs),
|
|
221
221
|
(c.last_card_updated_at = this.Us);
|
|
222
|
-
const f = o.J(c, h.O.
|
|
222
|
+
const f = o.J(c, h.O.wi, e);
|
|
223
223
|
let d = !1;
|
|
224
224
|
o.V(
|
|
225
225
|
c,
|
|
226
226
|
(s = -1) => {
|
|
227
227
|
if (this.C) {
|
|
228
228
|
const t = new Date().valueOf();
|
|
229
|
-
h.W(this.C, h.O.
|
|
229
|
+
h.W(this.C, h.O.wi, t);
|
|
230
230
|
}
|
|
231
231
|
-1 !== s && f.push(["X-Braze-Req-Tokens-Remaining", s.toString()]),
|
|
232
232
|
l.Y({
|
|
@@ -246,30 +246,30 @@ export default class Q extends t {
|
|
|
246
246
|
nt: (s, e) => {
|
|
247
247
|
let r;
|
|
248
248
|
if (d) {
|
|
249
|
-
let t = this.
|
|
250
|
-
(null == t || t < 1e3 * this.
|
|
251
|
-
(r = Math.min(3e5, a(1e3 * this.
|
|
249
|
+
let t = this.Ps;
|
|
250
|
+
(null == t || t < 1e3 * this.Xs) && (t = 1e3 * this.Xs),
|
|
251
|
+
(r = Math.min(3e5, a(1e3 * this.Xs, 3 * t)));
|
|
252
252
|
}
|
|
253
253
|
o.rt(
|
|
254
254
|
e,
|
|
255
255
|
() => {
|
|
256
|
-
this.
|
|
256
|
+
this.bi(t, i, !1);
|
|
257
257
|
},
|
|
258
|
-
h.O.
|
|
259
|
-
(t) => this.
|
|
260
|
-
() => this.
|
|
258
|
+
h.O.wi,
|
|
259
|
+
(t) => this.pi(t),
|
|
260
|
+
() => this.Ci(),
|
|
261
261
|
r,
|
|
262
262
|
);
|
|
263
263
|
},
|
|
264
264
|
});
|
|
265
265
|
},
|
|
266
|
-
h.O.
|
|
266
|
+
h.O.wi,
|
|
267
267
|
i,
|
|
268
268
|
);
|
|
269
269
|
}
|
|
270
|
-
|
|
270
|
+
di(t) {
|
|
271
271
|
t || this.Ds();
|
|
272
|
-
const i = this.
|
|
272
|
+
const i = this.Is(this.cards);
|
|
273
273
|
i.sort((t, s) =>
|
|
274
274
|
t.pinned && !s.pinned
|
|
275
275
|
? -1
|
|
@@ -284,28 +284,29 @@ export default class Q extends t {
|
|
|
284
284
|
let e = Math.max(this.Us || 0, this.Rs || 0);
|
|
285
285
|
return (
|
|
286
286
|
0 === e && (e = void 0),
|
|
287
|
-
this.C && this.C.ft(s.gt.
|
|
288
|
-
new ContentCards(i,
|
|
287
|
+
this.C && this.C.ft(s.gt.Qs) === this.Us && void 0 === e && (e = this.Us),
|
|
288
|
+
new ContentCards(i, P(e))
|
|
289
289
|
);
|
|
290
290
|
}
|
|
291
291
|
qt(t) {
|
|
292
|
-
return this.Ts.
|
|
292
|
+
return this.Ts.Dt(t);
|
|
293
293
|
}
|
|
294
|
-
|
|
294
|
+
ji() {
|
|
295
295
|
(this.Rs = 0),
|
|
296
296
|
(this.Us = 0),
|
|
297
|
-
this.C && (this.C.Ut(s.gt.
|
|
297
|
+
this.C && (this.C.Ut(s.gt.Os), this.C.Ut(s.gt.Qs));
|
|
298
298
|
}
|
|
299
299
|
changeUser(t) {
|
|
300
300
|
t ||
|
|
301
301
|
((this.cards = []),
|
|
302
302
|
this.Ts.X(new ContentCards(this.cards.slice(), null)),
|
|
303
303
|
this.C &&
|
|
304
|
-
(this.C.Ut(s.gt.
|
|
304
|
+
(this.C.Ut(s.gt.Hs),
|
|
305
305
|
this.C.Ut(s.gt.Kt),
|
|
306
306
|
this.C.Ut(s.gt.Yt),
|
|
307
307
|
this.C.Ut(s.gt.Vt))),
|
|
308
|
-
this.
|
|
308
|
+
this.Ci(),
|
|
309
|
+
this.ji();
|
|
309
310
|
}
|
|
310
311
|
clearData(t) {
|
|
311
312
|
(this.Rs = 0),
|
|
@@ -314,17 +315,18 @@ export default class Q extends t {
|
|
|
314
315
|
this.Ts.X(new ContentCards(this.cards.slice(), null)),
|
|
315
316
|
t &&
|
|
316
317
|
this.C &&
|
|
317
|
-
(this.C.Ut(s.gt.
|
|
318
|
+
(this.C.Ut(s.gt.Hs),
|
|
318
319
|
this.C.Ut(s.gt.Kt),
|
|
319
320
|
this.C.Ut(s.gt.Yt),
|
|
320
321
|
this.C.Ut(s.gt.Vt),
|
|
321
|
-
this.C.Ut(s.gt.
|
|
322
|
-
this.C.Ut(s.gt.
|
|
322
|
+
this.C.Ut(s.gt.Os),
|
|
323
|
+
this.C.Ut(s.gt.Qs)),
|
|
324
|
+
this.Ci();
|
|
323
325
|
}
|
|
324
|
-
|
|
325
|
-
return !!this.B && (!!this.B.
|
|
326
|
+
Ys() {
|
|
327
|
+
return !!this.B && (!!this.B.yi() || (0 !== this.B.Et() && this.Ri(), !1));
|
|
326
328
|
}
|
|
327
|
-
|
|
328
|
-
this.Ts.X(new ContentCards([], new Date())), this.C && this.C.Ut(s.gt.
|
|
329
|
+
Ri() {
|
|
330
|
+
this.Ts.X(new ContentCards([], new Date())), this.C && this.C.Ut(s.gt.Hs);
|
|
329
331
|
}
|
|
330
332
|
}
|
|
@@ -5,10 +5,10 @@ export function subscribeToContentCardsUpdates(o) {
|
|
|
5
5
|
const t = W.m(),
|
|
6
6
|
n = t.qt(o);
|
|
7
7
|
if (!t.Ct()) {
|
|
8
|
-
const o = r.
|
|
8
|
+
const o = r.rn();
|
|
9
9
|
if (o) {
|
|
10
|
-
const r = o.
|
|
11
|
-
t.
|
|
10
|
+
const r = o.on(() => {
|
|
11
|
+
t.bi(void 0, void 0, !0);
|
|
12
12
|
});
|
|
13
13
|
r && t.Tt(r);
|
|
14
14
|
}
|
|
@@ -19,11 +19,11 @@ export function showContentCards(n, t) {
|
|
|
19
19
|
let e = !1;
|
|
20
20
|
null == n && ((n = document.body), (e = !0));
|
|
21
21
|
const o = r.ee(w.tn) || r.ee(w.en) || !1,
|
|
22
|
-
i = W.m().
|
|
22
|
+
i = W.m().di(!1);
|
|
23
23
|
"function" == typeof t && an(i, t(i.cards.slice()), i.lastUpdated, null, o);
|
|
24
24
|
const a = tn(i, o, e),
|
|
25
25
|
s = W.m(),
|
|
26
|
-
f = s.
|
|
26
|
+
f = s._s();
|
|
27
27
|
(null == i.lastUpdated ||
|
|
28
28
|
new Date().valueOf() - i.lastUpdated.valueOf() > ContentCards.dr) &&
|
|
29
29
|
(null == f || new Date().valueOf() - f > ContentCards.dr) &&
|
|
@@ -31,7 +31,7 @@ export function showContentCards(n, t) {
|
|
|
31
31
|
`Cached content cards were older than max TTL of ${ContentCards.dr} ms, requesting an update from the server.`,
|
|
32
32
|
),
|
|
33
33
|
on(i, a),
|
|
34
|
-
s.
|
|
34
|
+
s.Gs(new Date().valueOf()));
|
|
35
35
|
const l = new Date().valueOf(),
|
|
36
36
|
c = subscribeToContentCardsUpdates(function (n) {
|
|
37
37
|
const e = a.querySelectorAll(".ab-refresh-button")[0];
|
package/src/Core/change-user.js
CHANGED
|
@@ -12,6 +12,6 @@ export function changeUser(e, i) {
|
|
|
12
12
|
`Rejected user id "${e}" because it is longer than ${User.ur} bytes.`,
|
|
13
13
|
);
|
|
14
14
|
if (null != i && !ir(i, "set signature for new user", "signature")) return;
|
|
15
|
-
const t = r.
|
|
15
|
+
const t = r.rn();
|
|
16
16
|
t && t.changeUser(e.toString(), r.ar(), i);
|
|
17
17
|
}
|
package/src/Core/disable-sdk.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { logger as N, IndexedDBAdapter as
|
|
2
|
+
import { logger as N, IndexedDBAdapter as st } from "../../shared-lib/index.js";
|
|
3
3
|
import ne, { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
4
4
|
export function disableSDK() {
|
|
5
|
-
const e = r.
|
|
5
|
+
const e = r.rn();
|
|
6
6
|
e && e.requestImmediateDataFlush();
|
|
7
7
|
const n = new ne.se(null, !0),
|
|
8
8
|
a = "This-cookie-will-expire-in-" + n.le();
|
|
9
9
|
n.store(s.me, a);
|
|
10
|
-
const i =
|
|
11
|
-
new
|
|
10
|
+
const i = st.Ls.Fs;
|
|
11
|
+
new st(i, N).setItem(i.Ms.pe, i.be, !0),
|
|
12
12
|
N.info("disableSDK was called"),
|
|
13
13
|
r.destroy(!1),
|
|
14
14
|
r.fe(!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 N, IndexedDBAdapter as
|
|
2
|
+
import { logger as N, IndexedDBAdapter as st } from "../../shared-lib/index.js";
|
|
3
3
|
import ne, { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
4
4
|
export function enableSDK() {
|
|
5
5
|
new ne.se(null, !0).remove(s.me);
|
|
6
|
-
const e =
|
|
7
|
-
new
|
|
6
|
+
const e = st.Ls.Fs;
|
|
7
|
+
new st(e, N).ge(e.Ms.pe, e.be),
|
|
8
8
|
N.info("enableSDK was called"),
|
|
9
9
|
r.destroy(!1),
|
|
10
10
|
r.fe(!1);
|
|
@@ -41,7 +41,7 @@ export function _handleBrazeAction(o, e, s) {
|
|
|
41
41
|
case oo.types.logCustomEvent:
|
|
42
42
|
import("./log-custom-event.js").then(
|
|
43
43
|
({ logCustomEvent: logCustomEvent }) => {
|
|
44
|
-
r.
|
|
44
|
+
r.nn()
|
|
45
45
|
? ((t = Array.prototype.slice.call(e)),
|
|
46
46
|
logCustomEvent(...t))
|
|
47
47
|
: N.error(p);
|
|
@@ -51,7 +51,7 @@ export function _handleBrazeAction(o, e, s) {
|
|
|
51
51
|
case oo.types.requestPushPermission:
|
|
52
52
|
import("../Push/request-push-permission.js").then(
|
|
53
53
|
({ requestPushPermission: requestPushPermission }) => {
|
|
54
|
-
r.
|
|
54
|
+
r.nn()
|
|
55
55
|
? "Safari" === ro.browser && ro.OS === so.ao
|
|
56
56
|
? window.navigator.standalone && requestPushPermission()
|
|
57
57
|
: requestPushPermission()
|
package/src/Core/open-session.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { logger as N, IndexedDBAdapter as
|
|
2
|
+
import { logger as N, IndexedDBAdapter as st } from "../../shared-lib/index.js";
|
|
3
3
|
import et from "../triggers/models/trigger-events.js";
|
|
4
4
|
import { TriggersProviderFactory as ot } from "../triggers/triggers-provider-factory.js";
|
|
5
5
|
export function openSession() {
|
|
6
6
|
if (!r.rr()) return;
|
|
7
|
-
const i = r.
|
|
7
|
+
const i = r.rn();
|
|
8
8
|
if (!i) return;
|
|
9
9
|
i.openSession();
|
|
10
|
-
const t =
|
|
11
|
-
o = new
|
|
10
|
+
const t = st.Ls.Fs,
|
|
11
|
+
o = new st(t, N);
|
|
12
12
|
o.cr(t.Ms.jr, (r, n) => {
|
|
13
13
|
const e = n.lastClick,
|
|
14
14
|
s = n.trackingString;
|
package/src/Core/wipe-data.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { keys as
|
|
3
|
-
import { logger as N, IndexedDBAdapter as
|
|
2
|
+
import { keys as C } from "../util/code-utils.js";
|
|
3
|
+
import { logger as N, IndexedDBAdapter as st } from "../../shared-lib/index.js";
|
|
4
4
|
import { BRAZE_MUST_BE_INITIALIZED_ERROR as p } from "../common/constants.js";
|
|
5
5
|
export function wipeData() {
|
|
6
6
|
const o = r.j();
|
|
7
7
|
if (null == o) return void N.warn(p);
|
|
8
8
|
o.clearData();
|
|
9
|
-
const t =
|
|
9
|
+
const t = C(st.Ls);
|
|
10
10
|
for (let o = 0; o < t.length; o++) {
|
|
11
11
|
const n = t[o],
|
|
12
|
-
r =
|
|
13
|
-
new
|
|
12
|
+
r = st.Ls[n];
|
|
13
|
+
new st(r, N).clearData();
|
|
14
14
|
}
|
|
15
15
|
if (r.rr()) for (const o of r.ar()) o.clearData(!0);
|
|
16
|
+
const n = r.g();
|
|
17
|
+
n && n.fo();
|
|
16
18
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { logger as N } from "../../shared-lib/index.js";
|
|
2
2
|
import FeatureFlag from "./feature-flag.js";
|
|
3
3
|
export function newFeatureFlagFromJson(e) {
|
|
4
|
-
if (e[FeatureFlag.ui.
|
|
4
|
+
if (e[FeatureFlag.ui.ds] && "boolean" == typeof e[FeatureFlag.ui.Fe])
|
|
5
5
|
return new FeatureFlag(
|
|
6
|
-
e[FeatureFlag.ui.
|
|
6
|
+
e[FeatureFlag.ui.ds],
|
|
7
7
|
e[FeatureFlag.ui.Fe],
|
|
8
8
|
e[FeatureFlag.ui.we],
|
|
9
9
|
e[FeatureFlag.ui.xe],
|
|
@@ -11,9 +11,9 @@ export function newFeatureFlagFromJson(e) {
|
|
|
11
11
|
N.info(`Unable to create feature flag from ${JSON.stringify(e, null, 2)}`);
|
|
12
12
|
}
|
|
13
13
|
export function newFeatureFlagFromSerializedValue(e) {
|
|
14
|
-
if (e[FeatureFlag.es.
|
|
14
|
+
if (e[FeatureFlag.es.ds] && "boolean" == typeof e[FeatureFlag.es.Fe])
|
|
15
15
|
return new FeatureFlag(
|
|
16
|
-
e[FeatureFlag.es.
|
|
16
|
+
e[FeatureFlag.es.ds],
|
|
17
17
|
e[FeatureFlag.es.Fe],
|
|
18
18
|
e[FeatureFlag.es.we],
|
|
19
19
|
e[FeatureFlag.es.xe],
|
|
@@ -35,7 +35,7 @@ export default class FeatureFlag {
|
|
|
35
35
|
bt() {
|
|
36
36
|
const t = {};
|
|
37
37
|
return (
|
|
38
|
-
(t[FeatureFlag.es.
|
|
38
|
+
(t[FeatureFlag.es.ds] = this.id),
|
|
39
39
|
(t[FeatureFlag.es.Fe] = this.enabled),
|
|
40
40
|
(t[FeatureFlag.es.we] = this.properties),
|
|
41
41
|
(t[FeatureFlag.es.xe] = this.trackingString),
|
|
@@ -71,5 +71,5 @@ export default class FeatureFlag {
|
|
|
71
71
|
return "datetime" === t.type && "number" == typeof t.value;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
(FeatureFlag.es = {
|
|
75
|
-
(FeatureFlag.ui = {
|
|
74
|
+
(FeatureFlag.es = { ds: "id", Fe: "e", we: "pr", xe: "fts" }),
|
|
75
|
+
(FeatureFlag.ui = { ds: "id", Fe: "enabled", we: "properties", xe: "fts" });
|
|
@@ -6,7 +6,7 @@ import u from "../managers/subscription-manager.js";
|
|
|
6
6
|
import { randomInclusive as a } from "../util/math.js";
|
|
7
7
|
import l from "../util/net.js";
|
|
8
8
|
import {
|
|
9
|
-
newFeatureFlagFromJson as
|
|
9
|
+
newFeatureFlagFromJson as at,
|
|
10
10
|
newFeatureFlagFromSerializedValue as ht,
|
|
11
11
|
} from "./feature-flag-factory.js";
|
|
12
12
|
import h from "../util/request-header-utils.js";
|
|
@@ -24,28 +24,28 @@ export default class tr extends t {
|
|
|
24
24
|
(this.C = e),
|
|
25
25
|
(this.T = i),
|
|
26
26
|
(this.ze = null),
|
|
27
|
-
(this.
|
|
27
|
+
(this.Ue = new u()),
|
|
28
28
|
(this.R = 10),
|
|
29
29
|
(this.I = null),
|
|
30
30
|
(this.q = null),
|
|
31
|
-
r.
|
|
31
|
+
r.F(this.Ue);
|
|
32
32
|
}
|
|
33
33
|
U(t) {
|
|
34
34
|
var s;
|
|
35
35
|
if (
|
|
36
|
-
(null === (s = this.B) || void 0 === s ? void 0 : s.
|
|
36
|
+
(null === (s = this.B) || void 0 === s ? void 0 : s.ke()) &&
|
|
37
37
|
null != t &&
|
|
38
38
|
t.feature_flags
|
|
39
39
|
) {
|
|
40
40
|
this.De = [];
|
|
41
41
|
for (const s of t.feature_flags) {
|
|
42
|
-
const t =
|
|
42
|
+
const t = at(s);
|
|
43
43
|
t && this.De.push(t);
|
|
44
44
|
}
|
|
45
|
-
(this.qe = new Date().getTime()), this.
|
|
45
|
+
(this.qe = new Date().getTime()), this.Be(), this.Ue.X(this.De);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
Me() {
|
|
49
49
|
let t = {};
|
|
50
50
|
this.C && (t = this.C.ft(s.gt.Xe));
|
|
51
51
|
const e = {};
|
|
@@ -65,11 +65,11 @@ export default class tr extends t {
|
|
|
65
65
|
this.C && this.C.Bt(s.gt.Ge, t);
|
|
66
66
|
}
|
|
67
67
|
qt(t) {
|
|
68
|
-
return this.
|
|
68
|
+
return this.Ue.Dt(t);
|
|
69
69
|
}
|
|
70
70
|
refreshFeatureFlags(t, s, e = !1, i = !0) {
|
|
71
71
|
const r = () => {
|
|
72
|
-
"function" == typeof s && s(), this.
|
|
72
|
+
"function" == typeof s && s(), this.Ue.X(this.De);
|
|
73
73
|
};
|
|
74
74
|
if (!this.Je(e))
|
|
75
75
|
return (
|
|
@@ -150,7 +150,7 @@ export default class tr extends t {
|
|
|
150
150
|
N.info(`Feature flag refreshes were rate limited to ${t} seconds`), !1
|
|
151
151
|
);
|
|
152
152
|
}
|
|
153
|
-
return this.B.
|
|
153
|
+
return this.B.ke();
|
|
154
154
|
}
|
|
155
155
|
Qe() {
|
|
156
156
|
var t;
|
|
@@ -170,7 +170,7 @@ export default class tr extends t {
|
|
|
170
170
|
e = this.Qe();
|
|
171
171
|
return null == e || s === e;
|
|
172
172
|
}
|
|
173
|
-
|
|
173
|
+
Be() {
|
|
174
174
|
if (!this.C) return;
|
|
175
175
|
const t = {};
|
|
176
176
|
for (const s of this.De) {
|
|
@@ -179,4 +179,10 @@ export default class tr extends t {
|
|
|
179
179
|
}
|
|
180
180
|
this.C.Bt(s.gt.Xe, t), this.C.Bt(s.gt.Ze, this.qe), this.We();
|
|
181
181
|
}
|
|
182
|
+
changeUser() {
|
|
183
|
+
this.G();
|
|
184
|
+
}
|
|
185
|
+
clearData() {
|
|
186
|
+
this.G();
|
|
187
|
+
}
|
|
182
188
|
}
|
|
@@ -3,7 +3,7 @@ import nr from "./feature-flags-provider-factory.js";
|
|
|
3
3
|
export function getFeatureFlag(t) {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
5
|
const e = r.v();
|
|
6
|
-
if (e && !e.
|
|
7
|
-
const n = nr.m().
|
|
6
|
+
if (e && !e.ke()) return null;
|
|
7
|
+
const n = nr.m().Me();
|
|
8
8
|
return n[t] ? n[t] : null;
|
|
9
9
|
}
|
|
@@ -7,7 +7,7 @@ export function logFeatureFlagImpression(e) {
|
|
|
7
7
|
if (!e) return !1;
|
|
8
8
|
const t =
|
|
9
9
|
"Not logging a feature flag impression. The feature flag was not part of any matching experiment.",
|
|
10
|
-
o = nr.m().
|
|
10
|
+
o = nr.m().Me();
|
|
11
11
|
if (!o[e]) return N.info(t), !1;
|
|
12
12
|
const n = o[e].trackingString;
|
|
13
13
|
if (!n) return N.info(t), !1;
|