@braze/web-sdk 6.4.0 → 6.5.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 +6 -5
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +3 -3
- package/shared-lib/event-types.js +30 -30
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +58 -58
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +14 -14
- package/src/Banner/banner-provider.js +95 -81
- package/src/Banner/banner.js +9 -9
- package/src/Banner/constants.js +4 -0
- package/src/Banner/display/banner-to-html.js +1 -1
- package/src/Banner/display/destroy-banner-html.js +3 -3
- package/src/Banner/display/detect-banner-impressions.js +14 -14
- package/src/Banner/get-all-banners.js +4 -4
- package/src/Banner/get-banner.js +5 -4
- package/src/Banner/log-banner-click.js +2 -2
- package/src/Banner/log-banner-impressions.js +6 -6
- package/src/Banner/request-banners-refresh.js +18 -20
- package/src/Banner/subscribe-to-banners-updates.js +5 -5
- package/src/Banner/ui/insert-banner.js +17 -14
- package/src/Card/card-manager-factory.js +3 -3
- package/src/Card/card-manager.js +32 -32
- package/src/Card/constants.js +1 -0
- package/src/Card/display/card-display.js +11 -11
- package/src/Card/log-card-dismissal.js +2 -2
- package/src/Card/log-content-card-click.js +2 -2
- package/src/Card/log-content-card-impressions.js +5 -5
- package/src/Card/models/captioned-image.js +3 -3
- package/src/Card/models/card.js +16 -16
- package/src/Card/models/classic-card.js +3 -3
- package/src/Card/models/control-card.js +3 -3
- package/src/Card/models/image-only.js +3 -3
- package/src/Card/util/card-factory.js +6 -6
- package/src/ContentCards/content-cards-provider-factory.js +11 -11
- package/src/ContentCards/content-cards-provider.js +110 -96
- 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 +5 -5
- package/src/ContentCards/ui/show-content-cards.js +5 -5
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +4 -4
- package/src/Core/disable-sdk.js +7 -7
- package/src/Core/enable-sdk.js +5 -5
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/handle-braze-action.js +3 -3
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +13 -13
- package/src/Core/log-purchase.js +10 -10
- package/src/Core/open-session.js +7 -7
- package/src/Core/set-sdk-authentication-signature.js +2 -2
- package/src/Core/wipe-data.js +6 -6
- package/src/DUST/dust-connection-core.js +23 -0
- package/src/DUST/dust-provider-factory.js +10 -8
- package/src/DUST/dust-provider.js +408 -176
- package/src/DUST/dust-shared-worker-code.js +2 -0
- package/src/DUST/dust-shared-worker-impl.js +240 -0
- package/src/DUST/dust-worker-bridge.js +136 -0
- package/src/DUST/index.js +10 -0
- package/src/DUST/subscribe-to-dust.js +13 -13
- package/src/FeatureFlags/feature-flag-factory.js +8 -8
- package/src/FeatureFlags/feature-flag.js +6 -6
- package/src/FeatureFlags/feature-flags-provider-factory.js +9 -9
- package/src/FeatureFlags/feature-flags-provider.js +98 -84
- 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 +7 -7
- package/src/FeatureFlags/refresh-feature-flags.js +2 -2
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -4
- package/src/InAppMessage/constants.js +4 -0
- package/src/InAppMessage/defer-in-app-message.js +2 -2
- package/src/InAppMessage/display/get-animation-effect.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +6 -6
- package/src/InAppMessage/display/in-app-message-to-html.js +40 -40
- package/src/InAppMessage/display/modal-utils.js +16 -16
- package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager-factory.js +7 -7
- package/src/InAppMessage/in-app-message-manager.js +97 -97
- package/src/InAppMessage/log-in-app-message-button-click.js +14 -14
- package/src/InAppMessage/log-in-app-message-click.js +13 -13
- package/src/InAppMessage/log-in-app-message-html-click.js +11 -11
- package/src/InAppMessage/log-in-app-message-impression.js +8 -8
- package/src/InAppMessage/models/control-message.js +5 -5
- package/src/InAppMessage/models/full-screen-message.js +17 -17
- package/src/InAppMessage/models/html-message.js +19 -19
- package/src/InAppMessage/models/in-app-message-button.js +7 -7
- package/src/InAppMessage/models/in-app-message.js +121 -119
- package/src/InAppMessage/models/modal-message.js +17 -17
- package/src/InAppMessage/models/slide-up-message.js +22 -22
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +5 -5
- package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +8 -8
- package/src/InAppMessage/ui/show-in-app-message.js +34 -34
- package/src/Push/push-manager-factory.js +14 -14
- package/src/Push/push-manager.js +90 -90
- package/src/Push/request-push-permission.js +1 -1
- package/src/Push/unregister-push.js +1 -1
- package/src/Push/utils/push-utils.js +9 -9
- package/src/User/user-manager.js +32 -32
- package/src/User/user.js +71 -71
- package/src/common/constants.js +8 -11
- package/src/common/content-cards-display.js +32 -32
- package/src/common/event-logger.js +10 -10
- package/src/common/properties-base.js +16 -16
- package/src/l10n/l10n-manager-factory.js +11 -11
- package/src/l10n/l10n-manager.js +2 -2
- package/src/managers/auth-manager.js +14 -14
- package/src/managers/braze-instance.js +152 -152
- package/src/managers/device-manager.js +11 -11
- package/src/managers/network-manager.js +153 -153
- package/src/managers/server-config-manager.js +116 -88
- package/src/managers/session-manager.js +41 -41
- package/src/managers/storage-manager-factory.js +10 -10
- package/src/managers/storage-manager.js +137 -135
- package/src/managers/subscription-manager.js +12 -12
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +10 -10
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +17 -17
- package/src/models/push-token.js +14 -14
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +41 -37
- package/src/request-controller.js +163 -160
- 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 +8 -8
- package/src/triggers/models/filter.js +7 -7
- package/src/triggers/models/in-app-message-click-data.js +13 -13
- package/src/triggers/models/purchase-data.js +2 -2
- package/src/triggers/models/purchase-property-data.js +6 -6
- package/src/triggers/models/push-click-data.js +6 -6
- package/src/triggers/models/trigger-condition.js +47 -47
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +42 -42
- package/src/triggers/triggers-provider-factory.js +5 -5
- package/src/triggers/triggers-provider.js +66 -66
- 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 +8 -8
- package/src/util/braze-actions.js +5 -5
- package/src/util/browser-detector.js +33 -33
- package/src/util/client-hints-parser.js +10 -10
- package/src/util/component-utils.js +5 -5
- package/src/util/dom-utils.js +13 -13
- package/src/util/html-display-utils.js +7 -7
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +5 -5
- package/src/util/request-header-utils.js +26 -26
- package/src/util/user-agent-parser.js +20 -20
- package/src/util/validation-utils.js +16 -16
- package/src/util/window-utils.js +3 -3
|
@@ -1,39 +1,44 @@
|
|
|
1
|
-
import
|
|
1
|
+
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 V } from "../util/date-utils.js";
|
|
6
|
+
import { isURIJavascriptOrData as tt } from "../util/url-utils.js";
|
|
7
7
|
import {
|
|
8
|
-
newCardFromContentCardsJson as
|
|
9
|
-
newCardFromSerializedValue as
|
|
8
|
+
newCardFromContentCardsJson as st,
|
|
9
|
+
newCardFromSerializedValue as it,
|
|
10
10
|
} from "../Card/util/card-factory.js";
|
|
11
11
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
12
|
-
import
|
|
12
|
+
import m from "../managers/subscription-manager.js";
|
|
13
13
|
import h from "../util/request-header-utils.js";
|
|
14
|
-
import { randomInclusive as
|
|
15
|
-
import {
|
|
16
|
-
|
|
14
|
+
import { randomInclusive as a } from "../util/math.js";
|
|
15
|
+
import {
|
|
16
|
+
REQUEST_BACKOFF_MAX_SLEEP_MS_DEFAULT as u,
|
|
17
|
+
REQUEST_BACKOFF_MIN_SLEEP_MS_DEFAULT as c,
|
|
18
|
+
REQUEST_BACKOFF_SCALE_FACTOR_DEFAULT as d,
|
|
19
|
+
} from "../common/constants.js";
|
|
20
|
+
import { logger as E, IndexedDBAdapter as et } from "../../shared-lib/index.js";
|
|
21
|
+
export default class Z extends t {
|
|
17
22
|
constructor(t, s, i, e, h) {
|
|
18
23
|
super(),
|
|
19
|
-
(this.
|
|
20
|
-
(this.
|
|
24
|
+
(this.vs = t),
|
|
25
|
+
(this.B = s),
|
|
21
26
|
(this.h = i),
|
|
22
|
-
(this.
|
|
23
|
-
(this.
|
|
24
|
-
(this.
|
|
25
|
-
(this.
|
|
27
|
+
(this.Cs = e),
|
|
28
|
+
(this.j = h),
|
|
29
|
+
(this.vs = t),
|
|
30
|
+
(this.B = s),
|
|
26
31
|
(this.h = i),
|
|
27
|
-
(this.
|
|
28
|
-
(this.
|
|
29
|
-
(this.ws = new
|
|
32
|
+
(this.Cs = e),
|
|
33
|
+
(this.j = h),
|
|
34
|
+
(this.ws = new m()),
|
|
30
35
|
r.q(this.ws),
|
|
31
36
|
(this.ys = 0),
|
|
32
37
|
(this.Ss = 0),
|
|
33
38
|
(this.cards = []),
|
|
34
39
|
this.Ts();
|
|
35
|
-
const n =
|
|
36
|
-
new
|
|
40
|
+
const n = et.Us.Rs;
|
|
41
|
+
new et(n, E).Ds(n.Fs.As, (t) => {
|
|
37
42
|
this.Ls(t);
|
|
38
43
|
}),
|
|
39
44
|
(this.Ns = null),
|
|
@@ -48,23 +53,23 @@ export default class W extends t {
|
|
|
48
53
|
Es(t) {
|
|
49
54
|
this.Ns = t;
|
|
50
55
|
}
|
|
51
|
-
|
|
56
|
+
St() {
|
|
52
57
|
return this.D;
|
|
53
58
|
}
|
|
54
|
-
|
|
59
|
+
wt(t) {
|
|
55
60
|
this.D = t;
|
|
56
61
|
}
|
|
57
62
|
Ts() {
|
|
58
|
-
if (!this.
|
|
59
|
-
const t = this.
|
|
63
|
+
if (!this.B) return;
|
|
64
|
+
const t = this.B.dt(s.ft.Ps) || [],
|
|
60
65
|
i = [];
|
|
61
66
|
for (let s = 0; s < t.length; s++) {
|
|
62
|
-
const e =
|
|
67
|
+
const e = it(t[s]);
|
|
63
68
|
null != e && i.push(e);
|
|
64
69
|
}
|
|
65
70
|
(this.cards = this.Xs(this._s(i, !1))),
|
|
66
|
-
(this.ys = this.
|
|
67
|
-
(this.Ss = this.
|
|
71
|
+
(this.ys = this.B.dt(s.ft.Gs) || this.ys),
|
|
72
|
+
(this.Ss = this.B.dt(s.ft.Hs) || this.Ss);
|
|
68
73
|
}
|
|
69
74
|
Is(t, i = !1, e = 0, h = 0) {
|
|
70
75
|
let r;
|
|
@@ -81,10 +86,10 @@ export default class W extends t {
|
|
|
81
86
|
break;
|
|
82
87
|
}
|
|
83
88
|
if (i) {
|
|
84
|
-
const t =
|
|
89
|
+
const t = st(e);
|
|
85
90
|
null != h && h.viewed && t && (t.viewed = !0), null != t && r.push(t);
|
|
86
91
|
} else if (null == h) {
|
|
87
|
-
const t =
|
|
92
|
+
const t = st(e);
|
|
88
93
|
null != t && r.push(t);
|
|
89
94
|
} else {
|
|
90
95
|
if (!h.ri(e))
|
|
@@ -99,11 +104,11 @@ export default class W extends t {
|
|
|
99
104
|
this.Ks(),
|
|
100
105
|
(this.ys = e),
|
|
101
106
|
(this.Ss = h),
|
|
102
|
-
this.
|
|
107
|
+
this.B && (this.B.bt(s.ft.Gs, this.ys), this.B.bt(s.ft.Hs, this.Ss));
|
|
103
108
|
}
|
|
104
109
|
N(t) {
|
|
105
110
|
if (this.Os() && null != t && t.cards) {
|
|
106
|
-
this.
|
|
111
|
+
this.B && this.B.bt(s.ft.Qs, r.Vs());
|
|
107
112
|
const i = t.full_sync;
|
|
108
113
|
i || this.Ts(),
|
|
109
114
|
this.Is(t.cards, i, t.last_full_sync_at, t.last_card_updated_at),
|
|
@@ -119,7 +124,7 @@ export default class W extends t {
|
|
|
119
124
|
this.Ts();
|
|
120
125
|
const i = this.cards.slice();
|
|
121
126
|
let e = null;
|
|
122
|
-
e = null === (s = this.
|
|
127
|
+
e = null === (s = this.vs) || void 0 === s ? void 0 : s.getUserId();
|
|
123
128
|
for (let s = 0; s < t.length; s++)
|
|
124
129
|
if (e === t[s].userId || (null == e && null == t[s].userId)) {
|
|
125
130
|
const e = t[s].card;
|
|
@@ -130,7 +135,7 @@ export default class W extends t {
|
|
|
130
135
|
break;
|
|
131
136
|
}
|
|
132
137
|
if (null == h) {
|
|
133
|
-
const t =
|
|
138
|
+
const t = st(e);
|
|
134
139
|
null != t && i.push(t);
|
|
135
140
|
} else {
|
|
136
141
|
if (!h.ri(e))
|
|
@@ -147,10 +152,10 @@ export default class W extends t {
|
|
|
147
152
|
let e = {},
|
|
148
153
|
h = {},
|
|
149
154
|
r = {};
|
|
150
|
-
this.
|
|
151
|
-
((e = this.
|
|
152
|
-
(h = this.
|
|
153
|
-
(r = this.
|
|
155
|
+
this.B &&
|
|
156
|
+
((e = this.B.dt(s.ft.Jt) || {}),
|
|
157
|
+
(h = this.B.dt(s.ft.Vt) || {}),
|
|
158
|
+
(r = this.B.dt(s.ft.Pt) || {}));
|
|
154
159
|
const n = {},
|
|
155
160
|
o = {},
|
|
156
161
|
l = {};
|
|
@@ -163,8 +168,8 @@ export default class W extends t {
|
|
|
163
168
|
}
|
|
164
169
|
return (
|
|
165
170
|
i &&
|
|
166
|
-
this.
|
|
167
|
-
(this.
|
|
171
|
+
this.B &&
|
|
172
|
+
(this.B.bt(s.ft.Jt, n), this.B.bt(s.ft.Vt, o), this.B.bt(s.ft.Pt, l)),
|
|
168
173
|
t
|
|
169
174
|
);
|
|
170
175
|
}
|
|
@@ -172,11 +177,11 @@ export default class W extends t {
|
|
|
172
177
|
const i = [],
|
|
173
178
|
e = new Date();
|
|
174
179
|
let h = {};
|
|
175
|
-
this.
|
|
180
|
+
this.B && (h = this.B.dt(s.ft.Pt) || {});
|
|
176
181
|
let r = !1;
|
|
177
182
|
for (let s = 0; s < t.length; s++) {
|
|
178
183
|
const n = t[s].url;
|
|
179
|
-
if (!this.
|
|
184
|
+
if (!this.Cs && n && tt(n)) {
|
|
180
185
|
E.error(
|
|
181
186
|
`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
187
|
);
|
|
@@ -191,79 +196,88 @@ export default class W extends t {
|
|
|
191
196
|
i && (h[i] = !0), (r = !0);
|
|
192
197
|
}
|
|
193
198
|
}
|
|
194
|
-
return r && this.
|
|
199
|
+
return r && this.B && this.B.bt(s.ft.Pt, h), i;
|
|
195
200
|
}
|
|
196
201
|
Ks() {
|
|
197
202
|
var t;
|
|
198
203
|
const i = [];
|
|
199
|
-
for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].
|
|
200
|
-
null === (t = this.
|
|
204
|
+
for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].gt());
|
|
205
|
+
null === (t = this.B) || void 0 === t || t.bt(s.ft.Ps, i);
|
|
201
206
|
}
|
|
202
207
|
Zs() {
|
|
203
208
|
this.Js && (clearTimeout(this.Js), (this.Js = null));
|
|
204
209
|
}
|
|
205
210
|
ar(t, i, e = !1) {
|
|
206
211
|
var n;
|
|
207
|
-
const o = this.
|
|
208
|
-
|
|
209
|
-
if (!o || !
|
|
210
|
-
if ((e && (h.fi(
|
|
212
|
+
const o = this.j,
|
|
213
|
+
f = this.B;
|
|
214
|
+
if (!o || !f) return void ("function" == typeof i && i());
|
|
215
|
+
if ((e && (h.fi(f, h.H.vi), this.Zs()), !this.Os()))
|
|
211
216
|
return void (
|
|
212
217
|
null === (n = this.h) ||
|
|
213
218
|
void 0 === n ||
|
|
214
|
-
n.
|
|
219
|
+
n.Ci(() => {
|
|
215
220
|
this.ar(t, i, !0);
|
|
216
221
|
})
|
|
217
222
|
);
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
(
|
|
221
|
-
(
|
|
222
|
-
const
|
|
223
|
-
let
|
|
223
|
+
const m = o.$({}, !0);
|
|
224
|
+
f.dt(s.ft.Qs) !== r.Vs() && this.bi(),
|
|
225
|
+
(m.last_full_sync_at = this.ys),
|
|
226
|
+
(m.last_card_updated_at = this.Ss);
|
|
227
|
+
const p = o.A(m, h.H.vi, e);
|
|
228
|
+
let v = !1;
|
|
224
229
|
o.J(
|
|
225
|
-
|
|
230
|
+
m,
|
|
226
231
|
(s = -1) => {
|
|
227
|
-
if (this.
|
|
232
|
+
if (this.B) {
|
|
228
233
|
const t = new Date().valueOf();
|
|
229
|
-
h.K(this.
|
|
234
|
+
h.K(this.B, h.H.vi, t);
|
|
230
235
|
}
|
|
231
|
-
-1 !== s &&
|
|
232
|
-
|
|
236
|
+
-1 !== s && p.push(["X-Braze-Req-Tokens-Remaining", s.toString()]),
|
|
237
|
+
l.O({
|
|
233
238
|
url: `${o.V()}/content_cards/sync`,
|
|
234
|
-
data:
|
|
235
|
-
headers:
|
|
239
|
+
data: m,
|
|
240
|
+
headers: p,
|
|
236
241
|
W: (s) => {
|
|
237
|
-
if (!o.Y(
|
|
238
|
-
return (
|
|
239
|
-
o.Z(), this.N(s), (
|
|
242
|
+
if (!o.Y(m, s, p))
|
|
243
|
+
return (v = !0), void ("function" == typeof i && i());
|
|
244
|
+
o.Z(), this.N(s), (v = !1), "function" == typeof t && t();
|
|
240
245
|
},
|
|
241
246
|
error: (t) => {
|
|
242
247
|
o._(t, "retrieving content cards"),
|
|
243
|
-
(
|
|
248
|
+
(v = !0),
|
|
244
249
|
"function" == typeof i && i();
|
|
245
250
|
},
|
|
246
251
|
tt: (s, e) => {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
+
var r, n, l;
|
|
253
|
+
let f;
|
|
254
|
+
if (v) {
|
|
255
|
+
const t =
|
|
256
|
+
(null === (r = this.h) || void 0 === r ? void 0 : r.st()) ||
|
|
257
|
+
c,
|
|
258
|
+
s =
|
|
259
|
+
(null === (n = this.h) || void 0 === n ? void 0 : n.it()) ||
|
|
260
|
+
d,
|
|
261
|
+
i =
|
|
262
|
+
(null === (l = this.h) || void 0 === l ? void 0 : l.nt()) ||
|
|
263
|
+
u;
|
|
264
|
+
let e = this.Ms;
|
|
265
|
+
(null == e || e < t) && (e = t), (f = Math.min(i, a(t, e * s)));
|
|
252
266
|
}
|
|
253
|
-
o.
|
|
267
|
+
o.et(
|
|
254
268
|
e,
|
|
255
269
|
() => {
|
|
256
270
|
this.ar(t, i, !1);
|
|
257
271
|
},
|
|
258
|
-
h.H.
|
|
272
|
+
h.H.vi,
|
|
259
273
|
(t) => this.Ys(t),
|
|
260
274
|
() => this.Zs(),
|
|
261
|
-
|
|
275
|
+
f,
|
|
262
276
|
);
|
|
263
277
|
},
|
|
264
278
|
});
|
|
265
279
|
},
|
|
266
|
-
h.H.
|
|
280
|
+
h.H.vi,
|
|
267
281
|
i,
|
|
268
282
|
);
|
|
269
283
|
}
|
|
@@ -284,29 +298,29 @@ export default class W extends t {
|
|
|
284
298
|
let e = Math.max(this.Ss || 0, this.ys || 0);
|
|
285
299
|
return (
|
|
286
300
|
0 === e && (e = void 0),
|
|
287
|
-
this.
|
|
288
|
-
new ContentCards(i,
|
|
301
|
+
this.B && this.B.dt(s.ft.Hs) === this.Ss && void 0 === e && (e = this.Ss),
|
|
302
|
+
new ContentCards(i, V(e))
|
|
289
303
|
);
|
|
290
304
|
}
|
|
291
|
-
|
|
292
|
-
return this.ws.
|
|
305
|
+
It(t) {
|
|
306
|
+
return this.ws.Rt(t);
|
|
293
307
|
}
|
|
294
|
-
|
|
308
|
+
bi() {
|
|
295
309
|
(this.ys = 0),
|
|
296
310
|
(this.Ss = 0),
|
|
297
|
-
this.
|
|
311
|
+
this.B && (this.B.zt(s.ft.Gs), this.B.zt(s.ft.Hs));
|
|
298
312
|
}
|
|
299
313
|
changeUser(t) {
|
|
300
314
|
t ||
|
|
301
315
|
((this.cards = []),
|
|
302
316
|
this.ws.L(new ContentCards(this.cards.slice(), null)),
|
|
303
|
-
this.
|
|
304
|
-
(this.
|
|
305
|
-
this.
|
|
306
|
-
this.
|
|
307
|
-
this.
|
|
317
|
+
this.B &&
|
|
318
|
+
(this.B.zt(s.ft.Ps),
|
|
319
|
+
this.B.zt(s.ft.Jt),
|
|
320
|
+
this.B.zt(s.ft.Vt),
|
|
321
|
+
this.B.zt(s.ft.Pt))),
|
|
308
322
|
this.Zs(),
|
|
309
|
-
this.
|
|
323
|
+
this.bi();
|
|
310
324
|
}
|
|
311
325
|
clearData(t) {
|
|
312
326
|
(this.ys = 0),
|
|
@@ -314,19 +328,19 @@ export default class W extends t {
|
|
|
314
328
|
(this.cards = []),
|
|
315
329
|
this.ws.L(new ContentCards(this.cards.slice(), null)),
|
|
316
330
|
t &&
|
|
317
|
-
this.
|
|
318
|
-
(this.
|
|
319
|
-
this.
|
|
320
|
-
this.
|
|
321
|
-
this.
|
|
322
|
-
this.
|
|
323
|
-
this.
|
|
331
|
+
this.B &&
|
|
332
|
+
(this.B.zt(s.ft.Ps),
|
|
333
|
+
this.B.zt(s.ft.Jt),
|
|
334
|
+
this.B.zt(s.ft.Vt),
|
|
335
|
+
this.B.zt(s.ft.Pt),
|
|
336
|
+
this.B.zt(s.ft.Gs),
|
|
337
|
+
this.B.zt(s.ft.Hs)),
|
|
324
338
|
this.Zs();
|
|
325
339
|
}
|
|
326
340
|
Os() {
|
|
327
|
-
return !!this.h && (!!this.h.wi() || (0 !== this.h.
|
|
341
|
+
return !!this.h && (!!this.h.wi() || (0 !== this.h.xt() && this.gi(), !1));
|
|
328
342
|
}
|
|
329
343
|
gi() {
|
|
330
|
-
this.ws.L(new ContentCards([], new Date())), this.
|
|
344
|
+
this.ws.L(new ContentCards([], new Date())), this.B && this.B.zt(s.ft.Ps);
|
|
331
345
|
}
|
|
332
346
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import rr 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 rr.o().Ws(!1);
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import rr from "./content-cards-provider-factory.js";
|
|
3
3
|
export function requestContentCardsRefresh(e, t) {
|
|
4
|
-
if (r.rr()) return
|
|
4
|
+
if (r.rr()) return rr.o().ar(e, t, !0);
|
|
5
5
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import rr from "./content-cards-provider-factory.js";
|
|
3
3
|
export function subscribeToContentCardsUpdates(o) {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
|
-
const t =
|
|
6
|
-
n = t.
|
|
7
|
-
if (!t.
|
|
5
|
+
const t = rr.o(),
|
|
6
|
+
n = t.It(o);
|
|
7
|
+
if (!t.St()) {
|
|
8
8
|
const o = r.nn();
|
|
9
9
|
if (o) {
|
|
10
10
|
const r = o.rn(() => {
|
|
11
11
|
t.ar(void 0, void 0, !0);
|
|
12
12
|
});
|
|
13
|
-
r && t.
|
|
13
|
+
r && t.wt(r);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
return n;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import r, { OPTIONS as
|
|
1
|
+
import r, { OPTIONS as D } from "../../managers/braze-instance.js";
|
|
2
2
|
import { ContentCards, subscribeToContentCardsUpdates } from "../index.js";
|
|
3
|
-
import
|
|
3
|
+
import rr 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,11 +18,11 @@ 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.
|
|
22
|
-
s =
|
|
21
|
+
const o = r.re(D.tn) || !1,
|
|
22
|
+
s = rr.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 = rr.o(),
|
|
26
26
|
c = i.Bs();
|
|
27
27
|
(null == s.lastUpdated ||
|
|
28
28
|
new Date().valueOf() - s.lastUpdated.valueOf() > ContentCards.Cr) &&
|
|
@@ -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 R,
|
|
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 (!R(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 er } 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 ir } 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 (er(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 && !ir(i, "set signature for new user", "signature")) return;
|
|
15
15
|
const t = r.nn();
|
|
16
16
|
t && t.changeUser(e.toString(), r.gr(), i);
|
|
17
17
|
}
|
package/src/Core/disable-sdk.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { logger as E, IndexedDBAdapter as
|
|
2
|
+
import { logger as E, IndexedDBAdapter as et } 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();
|
|
6
6
|
e && e.requestImmediateDataFlush();
|
|
7
|
-
const n = new ee.
|
|
8
|
-
a = "This-cookie-will-expire-in-" + n.
|
|
9
|
-
n.store(s.
|
|
10
|
-
const i =
|
|
11
|
-
new
|
|
7
|
+
const n = new ee.le(null, !0),
|
|
8
|
+
a = "This-cookie-will-expire-in-" + n.me();
|
|
9
|
+
n.store(s.pe, a);
|
|
10
|
+
const i = et.Us.Rs;
|
|
11
|
+
new et(i, E).setItem(i.Fs.be, i.fe, !0),
|
|
12
12
|
E.info("disableSDK was called"),
|
|
13
13
|
r.destroy(!1),
|
|
14
|
-
r.
|
|
14
|
+
r.ge(!0);
|
|
15
15
|
}
|
package/src/Core/enable-sdk.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { logger as E, IndexedDBAdapter as
|
|
2
|
+
import { logger as E, IndexedDBAdapter as et } from "../../shared-lib/index.js";
|
|
3
3
|
import ee, { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
4
4
|
export function enableSDK() {
|
|
5
|
-
new ee.
|
|
6
|
-
const e =
|
|
7
|
-
new
|
|
5
|
+
new ee.le(null, !0).remove(s.pe);
|
|
6
|
+
const e = et.Us.Rs;
|
|
7
|
+
new et(e, E).je(e.Fs.be, e.fe),
|
|
8
8
|
E.info("enableSDK was called"),
|
|
9
9
|
r.destroy(!1),
|
|
10
|
-
r.
|
|
10
|
+
r.ge(!1);
|
|
11
11
|
}
|
|
@@ -2,9 +2,9 @@ import r from "../managers/braze-instance.js";
|
|
|
2
2
|
import { logger as E } from "../../shared-lib/index.js";
|
|
3
3
|
export function getDeviceId(e) {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
|
-
const t = r.
|
|
5
|
+
const t = r.ue();
|
|
6
6
|
if (!t) return;
|
|
7
|
-
const i = t.
|
|
7
|
+
const i = t.ve().id;
|
|
8
8
|
if ("function" != typeof e) return i;
|
|
9
9
|
E.warn(
|
|
10
10
|
"The callback for getDeviceId is deprecated. You can access its return value directly instead (e.g. `const id = braze.getDeviceId()`)",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger as E } from "../../shared-lib/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { CoreStrings as z } from "../common/constants.js";
|
|
3
3
|
import r from "../managers/braze-instance.js";
|
|
4
4
|
import {
|
|
5
5
|
BRAZE_ACTIONS as oo,
|
|
@@ -44,7 +44,7 @@ export function _handleBrazeAction(o, e, s) {
|
|
|
44
44
|
r.ao()
|
|
45
45
|
? ((t = Array.prototype.slice.call(e)),
|
|
46
46
|
logCustomEvent(...t))
|
|
47
|
-
: E.error(
|
|
47
|
+
: E.error(z.ee);
|
|
48
48
|
},
|
|
49
49
|
);
|
|
50
50
|
break;
|
|
@@ -55,7 +55,7 @@ export function _handleBrazeAction(o, e, s) {
|
|
|
55
55
|
? "Safari" === ro.browser && ro.OS === so.co
|
|
56
56
|
? window.navigator.standalone && requestPushPermission()
|
|
57
57
|
: requestPushPermission()
|
|
58
|
-
: E.error(
|
|
58
|
+
: E.error(z.ee);
|
|
59
59
|
},
|
|
60
60
|
);
|
|
61
61
|
break;
|
package/src/Core/is-disabled.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
3
|
-
import { logger as E, EventTypes as
|
|
4
|
-
import
|
|
5
|
-
import { TriggersProviderFactory as
|
|
2
|
+
import v from "../common/event-logger.js";
|
|
3
|
+
import { logger as E, EventTypes as f } from "../../shared-lib/index.js";
|
|
4
|
+
import ot from "../triggers/models/trigger-events.js";
|
|
5
|
+
import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-factory.js";
|
|
6
6
|
import {
|
|
7
|
-
validateCustomProperties as
|
|
8
|
-
validateCustomString as
|
|
7
|
+
validateCustomProperties as nt,
|
|
8
|
+
validateCustomString as mt,
|
|
9
9
|
} from "../util/validation-utils.js";
|
|
10
|
-
import {
|
|
10
|
+
import { CoreStrings as z } 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,22 +17,22 @@ export function logCustomEvent(t, e) {
|
|
|
17
17
|
),
|
|
18
18
|
!1
|
|
19
19
|
);
|
|
20
|
-
if (!
|
|
21
|
-
const [o, n] =
|
|
20
|
+
if (!mt(t, "log custom event", "the event name")) return !1;
|
|
21
|
+
const [o, n] = nt(
|
|
22
22
|
e,
|
|
23
|
-
|
|
23
|
+
z.$e,
|
|
24
24
|
"eventProperties",
|
|
25
25
|
`log custom event "${t}"`,
|
|
26
26
|
"event",
|
|
27
27
|
);
|
|
28
28
|
if (!o) return !1;
|
|
29
29
|
const i = r.l();
|
|
30
|
-
if (i && i.
|
|
30
|
+
if (i && i.Ce(t))
|
|
31
31
|
return E.info(`Custom Event "${t}" is blocklisted, ignoring.`), !1;
|
|
32
|
-
const s =
|
|
32
|
+
const s = v.lt(f.CustomEvent, { n: t, p: n });
|
|
33
33
|
if (s.W) {
|
|
34
34
|
E.info(`Logged custom event "${t}".`);
|
|
35
|
-
for (const o of s.
|
|
35
|
+
for (const o of s.Ee) rt.o().he(ot.xe, [t, e], o);
|
|
36
36
|
}
|
|
37
37
|
return s.W;
|
|
38
38
|
}
|