@braze/web-sdk 5.1.1 → 5.3.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 +65 -10
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +20 -20
- package/shared-lib/indexed-db-adapter.js +52 -52
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +22 -21
- package/src/ContentCards/content-cards-provider.js +107 -135
- 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 +2 -2
- package/src/ContentCards/ui/show-content-cards.js +1 -1
- package/src/FeatureFlags/feature-flag.js +41 -30
- package/src/FeatureFlags/feature-flags-provider.js +88 -84
- 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 +3 -3
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/Feed/feed-provider.js +24 -24
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/log-feed-displayed.js +1 -1
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +45 -42
- package/src/InAppMessage/display/in-app-message-to-html.js +22 -22
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-factory.js +23 -21
- package/src/InAppMessage/in-app-message-manager.js +95 -112
- 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 +4 -2
- package/src/InAppMessage/models/full-screen-message.js +14 -11
- package/src/InAppMessage/models/html-message.js +11 -9
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +127 -120
- package/src/InAppMessage/models/modal-message.js +14 -11
- package/src/InAppMessage/models/slide-up-message.js +46 -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/show-in-app-message.js +37 -43
- package/src/InAppMessage/utils/in-app-message-utils.js +18 -1
- package/src/Push/push-manager-factory.js +4 -4
- package/src/Push/push-manager.js +118 -110
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +19 -19
- package/src/common/base-feed.js +1 -1
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +0 -2
- package/src/common/event-logger.js +2 -2
- package/src/common/feed-display.js +12 -12
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/l10n/l10n-manager.js +4 -4
- package/src/managers/auth-manager.js +27 -27
- package/src/managers/braze-instance.js +119 -112
- package/src/managers/device-manager.js +19 -19
- package/src/managers/network-manager.js +215 -165
- package/src/managers/server-config-manager.js +46 -50
- package/src/managers/session-manager.js +21 -21
- package/src/managers/storage-manager-factory.js +1 -1
- package/src/managers/storage-manager.js +128 -125
- package/src/managers/utils.js +6 -0
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +19 -11
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +34 -20
- package/src/models/push-token.js +4 -4
- package/src/models/server-config.js +24 -24
- package/src/request-controller.js +134 -124
- package/src/triggers/models/filter-set.js +2 -2
- package/src/triggers/models/filter.js +56 -56
- package/src/triggers/models/in-app-message-click-data.js +8 -8
- package/src/triggers/models/push-click-data.js +3 -3
- package/src/triggers/models/trigger-condition.js +30 -30
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +36 -36
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +84 -95
- package/src/ui/js/attach-css.js +2 -2
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +7 -7
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +25 -24
- package/src/util/client-hints-parser.js +4 -4
- package/src/util/component-utils.js +2 -2
- package/src/util/device-constants.js +2 -2
- package/src/util/dom-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +4 -4
- package/src/util/request-header-utils.js +36 -37
- package/src/util/user-agent-parser.js +8 -8
- package/src/util/validation-utils.js +2 -0
- package/src/util/window-utils.js +3 -3
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import y from "../common/base-provider.js";
|
|
2
|
-
import { newInAppMessageFromJson as
|
|
2
|
+
import { newInAppMessageFromJson as pt } from "../InAppMessage/in-app-message-factory.js";
|
|
3
3
|
import ue from "../models/braze-event.js";
|
|
4
|
-
import { InAppMessage } from "../InAppMessage/index.js";
|
|
5
4
|
import {
|
|
6
5
|
isArray as j,
|
|
7
6
|
isEqual as ii,
|
|
@@ -9,7 +8,7 @@ import {
|
|
|
9
8
|
} from "../util/code-utils.js";
|
|
10
9
|
import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
|
|
11
10
|
import wt from "../InAppMessage/models/templated-in-app-message.js";
|
|
12
|
-
import
|
|
11
|
+
import mt from "./models/trigger.js";
|
|
13
12
|
import tt from "./models/trigger-events.js";
|
|
14
13
|
import { logger as r } from "../../shared-lib/index.js";
|
|
15
14
|
export default class gr extends y {
|
|
@@ -18,12 +17,12 @@ export default class gr extends y {
|
|
|
18
17
|
(this.tg = t),
|
|
19
18
|
(this.Jt = i),
|
|
20
19
|
(this.u = s),
|
|
21
|
-
(this.
|
|
20
|
+
(this.zi = e),
|
|
22
21
|
(this.ig = r),
|
|
23
22
|
(this.tg = t),
|
|
24
23
|
(this.Jt = i),
|
|
25
24
|
(this.u = s),
|
|
26
|
-
(this.
|
|
25
|
+
(this.zi = e),
|
|
27
26
|
(this.ig = r),
|
|
28
27
|
(this.sg = []),
|
|
29
28
|
(this.eg = []),
|
|
@@ -31,27 +30,27 @@ export default class gr extends y {
|
|
|
31
30
|
(this.ng = {}),
|
|
32
31
|
(this.og = {}),
|
|
33
32
|
(this.triggers = []),
|
|
34
|
-
(this.
|
|
35
|
-
this.
|
|
33
|
+
(this.lg = 0),
|
|
34
|
+
this.ag(),
|
|
36
35
|
this.gg();
|
|
37
36
|
}
|
|
38
37
|
fg() {
|
|
39
38
|
if (this.u) {
|
|
40
|
-
(this.hg = this.u.j(o.C.
|
|
41
|
-
(this.ng = this.u.j(o.C.
|
|
42
|
-
(this.og = this.u.j(o.C.
|
|
39
|
+
(this.hg = this.u.j(o.C.iE) || this.hg),
|
|
40
|
+
(this.ng = this.u.j(o.C.EE) || this.ng),
|
|
41
|
+
(this.og = this.u.j(o.C.aE) || this.og);
|
|
43
42
|
for (let t = 0; t < this.triggers.length; t++) {
|
|
44
43
|
const i = this.triggers[t];
|
|
45
|
-
i.id && null != this.og[i.id] && i.
|
|
44
|
+
i.id && null != this.og[i.id] && i.ad(this.og[i.id]);
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
|
-
|
|
48
|
+
ag() {
|
|
50
49
|
if (!this.u) return;
|
|
51
|
-
this.
|
|
50
|
+
this.lg = this.u.j(o.C.oE) || 0;
|
|
52
51
|
const t = this.u.j(o.C.rE) || [],
|
|
53
52
|
i = [];
|
|
54
|
-
for (let s = 0; s < t.length; s++) i.push(
|
|
53
|
+
for (let s = 0; s < t.length; s++) i.push(mt.qn(t[s]));
|
|
55
54
|
(this.triggers = i), this.fg();
|
|
56
55
|
}
|
|
57
56
|
gg() {
|
|
@@ -71,19 +70,19 @@ export default class gr extends y {
|
|
|
71
70
|
h = [];
|
|
72
71
|
for (let e = 0; e < t.length; e++) {
|
|
73
72
|
const n = t[e],
|
|
74
|
-
o = r.
|
|
73
|
+
o = r.ud(n.Gr || 0);
|
|
75
74
|
if (o > 0) {
|
|
76
75
|
let t, e;
|
|
77
76
|
h.push(n),
|
|
78
77
|
null != n.ug && (t = n.ug),
|
|
79
|
-
null != n.dg && ue.
|
|
80
|
-
const
|
|
78
|
+
null != n.dg && ue.RE(n.dg) && (e = ue.qn(n.dg));
|
|
79
|
+
const l = [];
|
|
81
80
|
if (n.pg && j(n.pg))
|
|
82
81
|
for (let t = 0; t < n.pg.length; t++) {
|
|
83
82
|
const i = s[n.pg[t]];
|
|
84
|
-
null != i &&
|
|
83
|
+
null != i && l.push(i);
|
|
85
84
|
}
|
|
86
|
-
this.eg.push(window.setTimeout(i(r, n.
|
|
85
|
+
this.eg.push(window.setTimeout(i(r, n.Gr || 0, t, e, l), o));
|
|
87
86
|
}
|
|
88
87
|
}
|
|
89
88
|
this.ng[r.id].length > h.length &&
|
|
@@ -92,44 +91,44 @@ export default class gr extends y {
|
|
|
92
91
|
0 === this.ng[r.id].length && delete this.ng[r.id]);
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
|
-
e && this.u && this.u.k(o.C.
|
|
94
|
+
e && this.u && this.u.k(o.C.EE, this.ng);
|
|
96
95
|
}
|
|
97
96
|
mg() {
|
|
98
97
|
if (!this.u) return;
|
|
99
98
|
const t = [];
|
|
100
99
|
for (let i = 0; i < this.triggers.length; i++) t.push(this.triggers[i].Y());
|
|
101
|
-
(this.
|
|
100
|
+
(this.lg = new Date().valueOf()),
|
|
102
101
|
this.u.k(o.C.rE, t),
|
|
103
|
-
this.u.k(o.C.oE, this.
|
|
102
|
+
this.u.k(o.C.oE, this.lg);
|
|
104
103
|
}
|
|
105
104
|
bg() {
|
|
106
105
|
if (!this.u) return;
|
|
107
|
-
(this.u.j(o.C.oE) || 0) > this.
|
|
106
|
+
(this.u.j(o.C.oE) || 0) > this.lg ? this.ag() : this.fg();
|
|
108
107
|
}
|
|
109
|
-
|
|
108
|
+
Ns(t) {
|
|
110
109
|
let i = !1;
|
|
111
110
|
if (null != t && t.triggers) {
|
|
112
|
-
this.ig.
|
|
111
|
+
this.ig.Lr(), this.fg();
|
|
113
112
|
const s = {},
|
|
114
113
|
e = {};
|
|
115
114
|
this.triggers = [];
|
|
116
115
|
for (let r = 0; r < t.triggers.length; r++) {
|
|
117
|
-
const h =
|
|
116
|
+
const h = mt.fromJson(t.triggers[r]);
|
|
118
117
|
if (h) {
|
|
119
118
|
h.id &&
|
|
120
119
|
null != this.og[h.id] &&
|
|
121
|
-
(h.
|
|
120
|
+
(h.ad(this.og[h.id]), (s[h.id] = this.og[h.id])),
|
|
122
121
|
h.id && null != this.ng[h.id] && (e[h.id] = this.ng[h.id]);
|
|
123
|
-
for (let t = 0; t < h.
|
|
124
|
-
if (h.
|
|
122
|
+
for (let t = 0; t < h.sd.length; t++)
|
|
123
|
+
if (h.sd[t].sc(tt.kt, null)) {
|
|
125
124
|
i = !0;
|
|
126
125
|
break;
|
|
127
126
|
}
|
|
128
127
|
this.triggers.push(h);
|
|
129
128
|
}
|
|
130
129
|
}
|
|
131
|
-
ii(this.og, s) || ((this.og = s), this.u && this.u.k(o.C.
|
|
132
|
-
ii(this.ng, e) || ((this.ng = e), this.u && this.u.k(o.C.
|
|
130
|
+
ii(this.og, s) || ((this.og = s), this.u && this.u.k(o.C.aE, this.og)),
|
|
131
|
+
ii(this.ng, e) || ((this.ng = e), this.u && this.u.k(o.C.EE, this.ng)),
|
|
133
132
|
this.mg(),
|
|
134
133
|
i &&
|
|
135
134
|
(r.info("Trigger with test condition found, firing test."),
|
|
@@ -146,40 +145,33 @@ export default class gr extends y {
|
|
|
146
145
|
const n = (e) => {
|
|
147
146
|
this.fg();
|
|
148
147
|
const h = new Date().valueOf();
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
?
|
|
148
|
+
t.dd(i) ||
|
|
149
|
+
(!1 === navigator.onLine && t.type === mt._r.Br && e.imageUrl
|
|
150
|
+
? r.info(
|
|
152
151
|
`Not showing ${t.type} trigger action ${t.id} due to offline state.`,
|
|
153
|
-
)
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
));
|
|
164
|
-
t.type === pt.Kr.nd
|
|
165
|
-
? this.ig.Ve(t.id, InAppMessage.Me.Or)
|
|
166
|
-
: this.ig.Ve(t.id, InAppMessage.Me.bh);
|
|
152
|
+
)
|
|
153
|
+
: t.nd(h) && this.wg(t, h, s)
|
|
154
|
+
? 0 === this.Jt.ic()
|
|
155
|
+
? r.info(
|
|
156
|
+
`Not displaying trigger ${t.id} because neither automaticallyShowInAppMessages() nor subscribeToInAppMessage() were called.`,
|
|
157
|
+
)
|
|
158
|
+
: (this.Jt.Dt([e]), this.yg(t, h))
|
|
159
|
+
: r.info(
|
|
160
|
+
`Not displaying trigger ${t.id} because display time fell outside of the acceptable time window.`,
|
|
161
|
+
));
|
|
167
162
|
},
|
|
168
163
|
o = () => {
|
|
169
164
|
this.fg();
|
|
170
165
|
const n = h.pop();
|
|
171
166
|
if (null != n)
|
|
172
|
-
if ((this.Tg(n, i, s, e, h), n.
|
|
167
|
+
if ((this.Tg(n, i, s, e, h), n.dd(i))) {
|
|
173
168
|
let t = `Server aborted in-app message display, but the timeout on fallback trigger ${n.id} has already elapsed.`;
|
|
174
|
-
h.length > 0 && (t += " Continuing to fall back."),
|
|
175
|
-
r.info(t),
|
|
176
|
-
this.ig.Ve(n.id, InAppMessage.Me.bh),
|
|
177
|
-
o();
|
|
169
|
+
h.length > 0 && (t += " Continuing to fall back."), r.info(t), o();
|
|
178
170
|
} else {
|
|
179
171
|
r.info(
|
|
180
172
|
`Server aborted in-app message display. Falling back to lower priority ${n.type} trigger action ${t.id}.`,
|
|
181
173
|
);
|
|
182
|
-
const o = 1e3 * n.
|
|
174
|
+
const o = 1e3 * n.ed - (new Date().valueOf() - i);
|
|
183
175
|
o > 0
|
|
184
176
|
? this.eg.push(
|
|
185
177
|
window.setTimeout(() => {
|
|
@@ -189,40 +181,37 @@ export default class gr extends y {
|
|
|
189
181
|
: this.cg(n, i, s, e, h);
|
|
190
182
|
}
|
|
191
183
|
};
|
|
192
|
-
let
|
|
184
|
+
let l, a, g;
|
|
193
185
|
switch (t.type) {
|
|
194
|
-
case
|
|
195
|
-
if (((
|
|
186
|
+
case mt._r.Br:
|
|
187
|
+
if (((l = pt(t.data)), null == l)) {
|
|
196
188
|
r.error(
|
|
197
189
|
`Could not parse trigger data for trigger ${t.id}, ignoring.`,
|
|
198
|
-
)
|
|
199
|
-
this.ig.Ve(t.id, InAppMessage.Me.Lr);
|
|
190
|
+
);
|
|
200
191
|
break;
|
|
201
192
|
}
|
|
202
|
-
if (((
|
|
203
|
-
r.error(
|
|
193
|
+
if (((a = this.ig.Li(l)), a)) {
|
|
194
|
+
r.error(a), o();
|
|
204
195
|
break;
|
|
205
196
|
}
|
|
206
|
-
n(
|
|
197
|
+
n(l);
|
|
207
198
|
break;
|
|
208
|
-
case
|
|
209
|
-
if (((g = wt.fromJson(t.data, n, o, i, t.
|
|
199
|
+
case mt._r.md:
|
|
200
|
+
if (((g = wt.fromJson(t.data, n, o, i, t.Nr || 0)), null == g)) {
|
|
210
201
|
r.error(
|
|
211
202
|
`Could not parse trigger data for trigger ${t.id}, ignoring.`,
|
|
212
|
-
)
|
|
213
|
-
this.ig.Ve(t.id, InAppMessage.Me.Lr);
|
|
203
|
+
);
|
|
214
204
|
break;
|
|
215
205
|
}
|
|
216
|
-
this.ig.
|
|
206
|
+
this.ig.Yi(g, s, e);
|
|
217
207
|
break;
|
|
218
208
|
default:
|
|
219
|
-
r.error(`Trigger ${t.id} was of unexpected type ${t.type}, ignoring.`)
|
|
220
|
-
this.ig.Ve(t.id, InAppMessage.Me.Lr);
|
|
209
|
+
r.error(`Trigger ${t.id} was of unexpected type ${t.type}, ignoring.`);
|
|
221
210
|
}
|
|
222
211
|
}
|
|
223
212
|
fe(t, i = null, s) {
|
|
224
213
|
if (!J(tt, t, "Cannot fire trigger action.", "TriggerEvents")) return;
|
|
225
|
-
if (this.
|
|
214
|
+
if (this.zi && this.zi.Nu())
|
|
226
215
|
return (
|
|
227
216
|
r.info(
|
|
228
217
|
"Trigger sync is currently in progress, awaiting sync completion before firing trigger event.",
|
|
@@ -234,22 +223,22 @@ export default class gr extends y {
|
|
|
234
223
|
h = e - (this.hg || 0);
|
|
235
224
|
let n = !0,
|
|
236
225
|
o = !0;
|
|
237
|
-
const
|
|
226
|
+
const l = [];
|
|
238
227
|
for (let s = 0; s < this.triggers.length; s++) {
|
|
239
228
|
const r = this.triggers[s],
|
|
240
|
-
h = e + 1e3 * r.
|
|
229
|
+
h = e + 1e3 * r.ed;
|
|
241
230
|
if (
|
|
242
|
-
r.
|
|
231
|
+
r.nd(h) &&
|
|
243
232
|
(null == r.startTime || r.startTime.valueOf() <= e) &&
|
|
244
233
|
(null == r.endTime || r.endTime.valueOf() >= e)
|
|
245
234
|
) {
|
|
246
235
|
let s = !1;
|
|
247
|
-
for (let e = 0; e < r.
|
|
248
|
-
if (r.
|
|
236
|
+
for (let e = 0; e < r.sd.length; e++)
|
|
237
|
+
if (r.sd[e].sc(t, i)) {
|
|
249
238
|
s = !0;
|
|
250
239
|
break;
|
|
251
240
|
}
|
|
252
|
-
s && ((n = !1), this.wg(r, h, t) && ((o = !1),
|
|
241
|
+
s && ((n = !1), this.wg(r, h, t) && ((o = !1), l.push(r)));
|
|
253
242
|
}
|
|
254
243
|
}
|
|
255
244
|
if (n)
|
|
@@ -262,27 +251,27 @@ export default class gr extends y {
|
|
|
262
251
|
h / 1e3
|
|
263
252
|
}s ago.`,
|
|
264
253
|
);
|
|
265
|
-
|
|
266
|
-
const
|
|
267
|
-
null !=
|
|
254
|
+
l.sort((t, i) => t.priority - i.priority);
|
|
255
|
+
const a = l.pop();
|
|
256
|
+
null != a &&
|
|
268
257
|
(r.info(
|
|
269
|
-
`Firing ${
|
|
258
|
+
`Firing ${a.type} trigger action ${a.id} from trigger event ${t}.`,
|
|
270
259
|
),
|
|
271
|
-
this.Tg(
|
|
272
|
-
0 ===
|
|
273
|
-
? this.cg(
|
|
260
|
+
this.Tg(a, e, t, s, l),
|
|
261
|
+
0 === a.ed
|
|
262
|
+
? this.cg(a, e, t, s, l)
|
|
274
263
|
: this.eg.push(
|
|
275
264
|
window.setTimeout(() => {
|
|
276
|
-
this.cg(
|
|
277
|
-
}, 1e3 *
|
|
265
|
+
this.cg(a, e, t, s, l);
|
|
266
|
+
}, 1e3 * a.ed),
|
|
278
267
|
));
|
|
279
268
|
}
|
|
280
269
|
changeUser(t = !1) {
|
|
281
|
-
if (((this.triggers = []), this.u && this.u.
|
|
270
|
+
if (((this.triggers = []), this.u && this.u.ti(o.C.rE), !t)) {
|
|
282
271
|
(this.sg = []), (this.hg = null), (this.og = {}), (this.ng = {});
|
|
283
272
|
for (let t = 0; t < this.eg.length; t++) clearTimeout(this.eg[t]);
|
|
284
273
|
(this.eg = []),
|
|
285
|
-
this.u && (this.u.
|
|
274
|
+
this.u && (this.u.ti(o.C.iE), this.u.ti(o.C.aE), this.u.ti(o.C.EE));
|
|
286
275
|
}
|
|
287
276
|
}
|
|
288
277
|
clearData() {
|
|
@@ -299,25 +288,25 @@ export default class gr extends y {
|
|
|
299
288
|
),
|
|
300
289
|
!0
|
|
301
290
|
);
|
|
302
|
-
let e = t.
|
|
291
|
+
let e = t.hd;
|
|
303
292
|
return null == e && (e = this.tg), i - this.hg >= 1e3 * e;
|
|
304
293
|
}
|
|
305
294
|
Tg(t, i, s, e, r) {
|
|
306
295
|
this.fg(), t.id && (this.ng[t.id] = this.ng[t.id] || []);
|
|
307
296
|
const h = {};
|
|
308
297
|
let n;
|
|
309
|
-
(h.
|
|
310
|
-
const
|
|
311
|
-
for (const t of r) t.id &&
|
|
312
|
-
(h.pg =
|
|
298
|
+
(h.Gr = i), (h.ug = s), null != e && (n = e.Y()), (h.dg = n);
|
|
299
|
+
const l = [];
|
|
300
|
+
for (const t of r) t.id && l.push(t.id);
|
|
301
|
+
(h.pg = l),
|
|
313
302
|
t.id && this.ng[t.id].push(h),
|
|
314
|
-
this.u && this.u.k(o.C.
|
|
303
|
+
this.u && this.u.k(o.C.EE, this.ng);
|
|
315
304
|
}
|
|
316
305
|
yg(t, i) {
|
|
317
306
|
this.fg(),
|
|
318
|
-
t.
|
|
307
|
+
t.ad(i),
|
|
319
308
|
(this.hg = i),
|
|
320
309
|
t.id && (this.og[t.id] = i),
|
|
321
|
-
this.u && (this.u.k(o.C.
|
|
310
|
+
this.u && (this.u.k(o.C.iE, i), this.u.k(o.C.aE, this.og));
|
|
322
311
|
}
|
|
323
312
|
}
|
package/src/ui/js/attach-css.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import e, { OPTIONS as L } from "../../managers/braze-instance.js";
|
|
2
2
|
export function attachCSS(n, t, o) {
|
|
3
3
|
const c = n || document.querySelector("head"),
|
|
4
|
-
s = `ab-${t}-css-definitions-${"5.
|
|
4
|
+
s = `ab-${t}-css-definitions-${"5.3.0".replace(/\./g, "-")}`;
|
|
5
5
|
if (!c) return;
|
|
6
6
|
const a = c.ownerDocument || document;
|
|
7
7
|
if (null == a.getElementById(s)) {
|
|
8
8
|
const n = a.createElement("style");
|
|
9
9
|
(n.innerHTML = o || ""), (n.id = s);
|
|
10
|
-
const t = e.nn(L.
|
|
10
|
+
const t = e.nn(L.bo);
|
|
11
11
|
null != t && n.setAttribute("nonce", t), c.appendChild(n);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import e, { OPTIONS as L } from "../../managers/braze-instance.js";
|
|
2
2
|
export function loadFontAwesome() {
|
|
3
|
-
if (e.nn(L.
|
|
3
|
+
if (e.nn(L.Mo)) return;
|
|
4
4
|
const t = "https://use.fontawesome.com/7f85a56ba4.css";
|
|
5
5
|
if (
|
|
6
6
|
!(null !== document.querySelector('link[rel=stylesheet][href="' + t + '"]'))
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { isArray as j } from "./code-utils.js";
|
|
2
2
|
export default class ge {
|
|
3
3
|
constructor() {}
|
|
4
|
-
tf() {}
|
|
5
4
|
ef() {}
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
rf() {}
|
|
6
|
+
Ta(t) {}
|
|
7
|
+
static sf(t, e) {
|
|
8
8
|
if (t && e)
|
|
9
|
-
if (((t = t.toLowerCase()), j(e.
|
|
10
|
-
for (let r = 0; r < e.
|
|
11
|
-
if (-1 !== t.indexOf(e.
|
|
12
|
-
} else if (-1 !== t.indexOf(e.
|
|
9
|
+
if (((t = t.toLowerCase()), j(e.ff))) {
|
|
10
|
+
for (let r = 0; r < e.ff.length; r++)
|
|
11
|
+
if (-1 !== t.indexOf(e.ff[r].toLowerCase())) return e.identity;
|
|
12
|
+
} else if (-1 !== t.indexOf(e.ff.toLowerCase())) return e.identity;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -25,14 +25,14 @@ export const BRAZE_ACTIONS = {
|
|
|
25
25
|
properties: { type: "type", oo: "steps", eo: "args" },
|
|
26
26
|
};
|
|
27
27
|
export const INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES = {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
Qi: "unknownBrazeAction",
|
|
29
|
+
Wi: "noPushPrompt",
|
|
30
30
|
};
|
|
31
31
|
export const ineligibleBrazeActionURLErrorMessage = (t, o) => {
|
|
32
32
|
switch (t) {
|
|
33
|
-
case INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.
|
|
33
|
+
case INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.Qi:
|
|
34
34
|
return `${o} contains an unknown braze action type and will not be displayed.`;
|
|
35
|
-
case INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.
|
|
35
|
+
case INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.Wi:
|
|
36
36
|
return `${o} contains a push prompt braze action, but is not eligible for a push prompt. Ignoring.`;
|
|
37
37
|
default:
|
|
38
38
|
return "";
|
|
@@ -6,10 +6,10 @@ class ui {
|
|
|
6
6
|
const t = navigator.userAgentData ? ai : oi;
|
|
7
7
|
(this.Sg = new t()),
|
|
8
8
|
(this.userAgent = navigator.userAgent),
|
|
9
|
-
(this.browser = this.Sg.
|
|
10
|
-
(this.version = this.Sg.
|
|
9
|
+
(this.browser = this.Sg.ef()),
|
|
10
|
+
(this.version = this.Sg.rf()),
|
|
11
11
|
(this.OS = null),
|
|
12
|
-
this.
|
|
12
|
+
this.Ta().then((t) => (this.OS = t));
|
|
13
13
|
const i = navigator;
|
|
14
14
|
(this.language = (
|
|
15
15
|
i.userLanguage ||
|
|
@@ -18,18 +18,18 @@ class ui {
|
|
|
18
18
|
i.systemLanguage ||
|
|
19
19
|
""
|
|
20
20
|
).toLowerCase()),
|
|
21
|
-
(this.
|
|
21
|
+
(this.Zo = ui.vg(this.userAgent));
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
IE() {
|
|
24
24
|
return this.browser === gi.Bg;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
Oa() {
|
|
27
27
|
return this.OS || null;
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
Ta() {
|
|
30
30
|
return this.OS
|
|
31
31
|
? Promise.resolve(this.OS)
|
|
32
|
-
: this.Sg.
|
|
32
|
+
: this.Sg.Ta(ui.kg).then((t) => ((this.OS = t), t));
|
|
33
33
|
}
|
|
34
34
|
static vg(t) {
|
|
35
35
|
t = t.toLowerCase();
|
|
@@ -50,35 +50,36 @@ class ui {
|
|
|
50
50
|
"adsbot",
|
|
51
51
|
"mediapartners-google",
|
|
52
52
|
"teoma",
|
|
53
|
+
"taiko",
|
|
53
54
|
];
|
|
54
55
|
for (let n = 0; n < i.length; n++) if (-1 !== t.indexOf(i[n])) return !0;
|
|
55
56
|
return !1;
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
|
-
ui.
|
|
59
|
-
{ string: navigator.platform,
|
|
60
|
-
{ string: navigator.platform,
|
|
61
|
-
{ string: navigator.platform,
|
|
62
|
-
{ string: navigator.platform,
|
|
63
|
-
{ string: navigator.platform,
|
|
64
|
-
{ string: navigator.platform,
|
|
65
|
-
{ string: navigator.platform,
|
|
66
|
-
{ string: navigator.platform,
|
|
67
|
-
{ string: navigator.platform,
|
|
59
|
+
ui.kg = [
|
|
60
|
+
{ string: navigator.platform, ff: "Win", identity: Y.Og },
|
|
61
|
+
{ string: navigator.platform, ff: "Mac", identity: Y.Pg },
|
|
62
|
+
{ string: navigator.platform, ff: "BlackBerry", identity: "BlackBerry" },
|
|
63
|
+
{ string: navigator.platform, ff: "FreeBSD", identity: "FreeBSD" },
|
|
64
|
+
{ string: navigator.platform, ff: "OpenBSD", identity: "OpenBSD" },
|
|
65
|
+
{ string: navigator.platform, ff: "Nintendo", identity: "Nintendo" },
|
|
66
|
+
{ string: navigator.platform, ff: "SunOS", identity: "SunOS" },
|
|
67
|
+
{ string: navigator.platform, ff: "PlayStation", identity: "PlayStation" },
|
|
68
|
+
{ string: navigator.platform, ff: "X11", identity: "X11" },
|
|
68
69
|
{
|
|
69
70
|
string: navigator.userAgent,
|
|
70
|
-
|
|
71
|
+
ff: ["iPhone", "iPad", "iPod"],
|
|
71
72
|
identity: Y.io,
|
|
72
73
|
},
|
|
73
|
-
{ string: navigator.platform,
|
|
74
|
-
{ string: navigator.userAgent,
|
|
74
|
+
{ string: navigator.platform, ff: "Pike v", identity: Y.io },
|
|
75
|
+
{ string: navigator.userAgent, ff: ["Web0S"], identity: "WebOS" },
|
|
75
76
|
{
|
|
76
77
|
string: navigator.platform,
|
|
77
|
-
|
|
78
|
+
ff: ["Linux armv7l", "Android"],
|
|
78
79
|
identity: Y.xg,
|
|
79
80
|
},
|
|
80
|
-
{ string: navigator.userAgent,
|
|
81
|
-
{ string: navigator.platform,
|
|
81
|
+
{ string: navigator.userAgent, ff: ["Android"], identity: Y.xg },
|
|
82
|
+
{ string: navigator.platform, ff: "Linux", identity: "Linux" },
|
|
82
83
|
];
|
|
83
84
|
const X = new ui();
|
|
84
85
|
export { X as default, ui as BrowserDetector };
|
|
@@ -15,17 +15,17 @@ export default class ai extends ge {
|
|
|
15
15
|
}
|
|
16
16
|
this.OS = null;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
ef() {
|
|
19
19
|
return this.browser;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
rf() {
|
|
22
22
|
return this.version;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
Ta(t) {
|
|
25
25
|
if (this.OS) return Promise.resolve(this.OS);
|
|
26
26
|
const s = (s) => {
|
|
27
27
|
for (let r = 0; r < t.length; r++) {
|
|
28
|
-
const i = ai.
|
|
28
|
+
const i = ai.sf(s, t[r]);
|
|
29
29
|
if (i) return (this.OS = i), this.OS;
|
|
30
30
|
}
|
|
31
31
|
return s;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { addPassiveEventListener as oe, buildSvg as ae } from "./dom-utils.js";
|
|
2
|
-
import { KeyCodes as
|
|
2
|
+
import { KeyCodes as lt } from "./key-codes.js";
|
|
3
3
|
export function createCloseButton(t, o, e) {
|
|
4
4
|
const n = document.createElement("button");
|
|
5
5
|
n.setAttribute("aria-label", t),
|
|
@@ -15,7 +15,7 @@ export function createCloseButton(t, o, e) {
|
|
|
15
15
|
return (
|
|
16
16
|
n.appendChild(r),
|
|
17
17
|
n.addEventListener("keydown", (t) => {
|
|
18
|
-
(t.keyCode !==
|
|
18
|
+
(t.keyCode !== lt.Fo && t.keyCode !== lt.To) ||
|
|
19
19
|
(e(), t.stopPropagation());
|
|
20
20
|
}),
|
|
21
21
|
(n.onclick = (t) => {
|
package/src/util/dom-utils.js
CHANGED
|
@@ -18,8 +18,8 @@ export function _isInView(t, n = !1, e = !1, s = !1) {
|
|
|
18
18
|
!s)
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
|
-
export const DOMUtils = { dc: null,
|
|
22
|
-
export const DIRECTIONS = {
|
|
21
|
+
export const DOMUtils = { dc: null, po: _isInView };
|
|
22
|
+
export const DIRECTIONS = { Re: "up", Se: "down", U: "left", V: "right" };
|
|
23
23
|
export function supportsPassive() {
|
|
24
24
|
if (null == DOMUtils.dc) {
|
|
25
25
|
DOMUtils.dc = !1;
|
|
@@ -41,10 +41,10 @@ export function addPassiveEventListener(t, n, e = () => {}) {
|
|
|
41
41
|
t.addEventListener(n, e, !!supportsPassive() && { passive: !0 });
|
|
42
42
|
}
|
|
43
43
|
export function topIsInView(t) {
|
|
44
|
-
return DOMUtils.
|
|
44
|
+
return DOMUtils.po(t, !0, !1, !1);
|
|
45
45
|
}
|
|
46
46
|
export function bottomIsInView(t) {
|
|
47
|
-
return DOMUtils.
|
|
47
|
+
return DOMUtils.po(t, !1, !0, !1);
|
|
48
48
|
}
|
|
49
49
|
export function clickElement(t) {
|
|
50
50
|
if (t.onclick) {
|
|
@@ -69,9 +69,9 @@ export function detectSwipe(t, n, e) {
|
|
|
69
69
|
(i = null))
|
|
70
70
|
: Math.abs(u) >= 25 &&
|
|
71
71
|
(((u > 0 &&
|
|
72
|
-
n === DIRECTIONS.
|
|
72
|
+
n === DIRECTIONS.Re &&
|
|
73
73
|
t.scrollTop === t.scrollHeight - t.offsetHeight) ||
|
|
74
|
-
(u < 0 && n === DIRECTIONS.
|
|
74
|
+
(u < 0 && n === DIRECTIONS.Se && 0 === t.scrollTop)) &&
|
|
75
75
|
e(o),
|
|
76
76
|
(s = null),
|
|
77
77
|
(i = null));
|
package/src/util/key-codes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const KeyCodes = {
|
|
1
|
+
export const KeyCodes = { Fo: 32, lo: 9, To: 13, mh: 27 };
|
package/src/util/net.js
CHANGED
|
@@ -2,7 +2,7 @@ import { logger as r } from "../../shared-lib/index.js";
|
|
|
2
2
|
import qt from "../models/backend-errors.js";
|
|
3
3
|
import { getErrorMessage as si } from "./error-utils.js";
|
|
4
4
|
const C = {
|
|
5
|
-
|
|
5
|
+
Gs: (t) => {
|
|
6
6
|
let e, o;
|
|
7
7
|
try {
|
|
8
8
|
const n = () => {
|
|
@@ -13,7 +13,7 @@ const C = {
|
|
|
13
13
|
e = new XMLHttpRequest();
|
|
14
14
|
const i = () => {
|
|
15
15
|
"function" == typeof t.error && t.error(e.status),
|
|
16
|
-
"function" == typeof t.
|
|
16
|
+
"function" == typeof t.Ws && t.Ws(!1);
|
|
17
17
|
};
|
|
18
18
|
(e.onload = () => {
|
|
19
19
|
let o = !1;
|
|
@@ -28,14 +28,14 @@ const C = {
|
|
|
28
28
|
(r = e.getAllResponseHeaders());
|
|
29
29
|
} catch (o) {
|
|
30
30
|
const n = {
|
|
31
|
-
error: "" === e.responseText ? qt.
|
|
31
|
+
error: "" === e.responseText ? qt.Zh : qt.Ra,
|
|
32
32
|
response: e.responseText,
|
|
33
33
|
};
|
|
34
34
|
(0, t.L)(n, r);
|
|
35
35
|
}
|
|
36
36
|
o && t.L(o, r);
|
|
37
37
|
}
|
|
38
|
-
"function" == typeof t.
|
|
38
|
+
"function" == typeof t.Ws && t.Ws(!0);
|
|
39
39
|
} else i();
|
|
40
40
|
}),
|
|
41
41
|
(e.onerror = () => {
|