@braze/web-sdk 5.1.0 → 5.2.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 -8
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +18 -18
- package/shared-lib/indexed-db-adapter.js +32 -32
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +22 -21
- package/src/InAppMessage/display/html-message-to-html.js +38 -35
- package/src/InAppMessage/display/in-app-message-to-html.js +2 -2
- package/src/InAppMessage/display/modal-utils.js +2 -2
- package/src/InAppMessage/in-app-message-factory.js +21 -19
- package/src/InAppMessage/in-app-message-manager.js +58 -78
- 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 +5 -2
- package/src/InAppMessage/models/html-message.js +6 -4
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +51 -46
- package/src/InAppMessage/models/modal-message.js +5 -2
- package/src/InAppMessage/models/slide-up-message.js +33 -8
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/ui/show-in-app-message.js +28 -34
- package/src/InAppMessage/utils/in-app-message-utils.js +18 -1
- package/src/Push/push-manager-factory.js +3 -3
- 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 +17 -17
- package/src/common/base-feed.js +1 -1
- 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 +26 -26
- package/src/managers/braze-instance.js +59 -52
- package/src/managers/device-manager.js +15 -15
- package/src/managers/network-manager.js +98 -93
- package/src/managers/server-config-manager.js +9 -9
- package/src/managers/storage-manager.js +99 -96
- package/src/managers/utils.js +6 -0
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +20 -12
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +33 -19
- package/src/models/push-token.js +4 -4
- package/src/models/server-config.js +6 -6
- package/src/request-controller.js +77 -73
- package/src/triggers/models/custom-event-data.js +2 -2
- package/src/triggers/models/custom-event-property-data.js +4 -4
- package/src/triggers/models/filter-set.js +5 -5
- 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 +2 -2
- package/src/triggers/models/purchase-property-data.js +4 -4
- package/src/triggers/models/push-click-data.js +1 -1
- package/src/triggers/models/trigger-condition.js +41 -41
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +36 -36
- package/src/triggers/triggers-provider-factory.js +1 -1
- package/src/triggers/triggers-provider.js +71 -82
- 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 +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +9 -8
- package/src/util/client-hints-parser.js +1 -1
- package/src/util/component-utils.js +2 -2
- package/src/util/device-constants.js +2 -2
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +1 -1
- package/src/util/request-header-utils.js +6 -6
- package/src/util/user-agent-parser.js +5 -5
- package/src/util/validation-utils.js +2 -0
- package/src/util/window-utils.js +3 -3
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
clickElement as Et,
|
|
5
5
|
supportsPassive as Tt,
|
|
6
6
|
} from "../../util/dom-utils.js";
|
|
7
|
-
import { KeyCodes as
|
|
7
|
+
import { KeyCodes as lt } from "../../util/key-codes.js";
|
|
8
8
|
import T from "../../managers/subscription-manager.js";
|
|
9
9
|
import { isIFrame as It } from "../utils/in-app-message-utils.js";
|
|
10
10
|
export default class InAppMessage {
|
|
@@ -23,21 +23,22 @@ export default class InAppMessage {
|
|
|
23
23
|
a,
|
|
24
24
|
I,
|
|
25
25
|
c,
|
|
26
|
-
O,
|
|
27
26
|
A,
|
|
28
|
-
|
|
27
|
+
O,
|
|
29
28
|
_,
|
|
30
29
|
m,
|
|
30
|
+
L,
|
|
31
31
|
N,
|
|
32
|
-
R,
|
|
33
32
|
S,
|
|
34
|
-
|
|
33
|
+
R,
|
|
35
34
|
M,
|
|
35
|
+
D,
|
|
36
36
|
C,
|
|
37
37
|
d,
|
|
38
38
|
U,
|
|
39
39
|
b,
|
|
40
40
|
P,
|
|
41
|
+
p,
|
|
41
42
|
) {
|
|
42
43
|
(this.message = t),
|
|
43
44
|
(this.messageAlignment = s),
|
|
@@ -53,21 +54,22 @@ export default class InAppMessage {
|
|
|
53
54
|
(this.imageUrl = a),
|
|
54
55
|
(this.imageStyle = I),
|
|
55
56
|
(this.iconColor = c),
|
|
56
|
-
(this.iconBackgroundColor =
|
|
57
|
-
(this.backgroundColor =
|
|
58
|
-
(this.textColor =
|
|
59
|
-
(this.closeButtonColor =
|
|
60
|
-
(this.animateIn =
|
|
57
|
+
(this.iconBackgroundColor = A),
|
|
58
|
+
(this.backgroundColor = O),
|
|
59
|
+
(this.textColor = _),
|
|
60
|
+
(this.closeButtonColor = m),
|
|
61
|
+
(this.animateIn = L),
|
|
61
62
|
(this.animateOut = N),
|
|
62
|
-
(this.header =
|
|
63
|
-
(this.headerAlignment =
|
|
64
|
-
(this.headerTextColor =
|
|
65
|
-
(this.frameColor =
|
|
63
|
+
(this.header = S),
|
|
64
|
+
(this.headerAlignment = R),
|
|
65
|
+
(this.headerTextColor = M),
|
|
66
|
+
(this.frameColor = D),
|
|
66
67
|
(this.buttons = C),
|
|
67
68
|
(this.cropType = d),
|
|
68
69
|
(this.orientation = U),
|
|
69
70
|
(this.htmlId = b),
|
|
70
71
|
(this.css = P),
|
|
72
|
+
(this.messageExtras = p),
|
|
71
73
|
(this.message = t),
|
|
72
74
|
(this.messageAlignment = s || InAppMessage.TextAlignment.CENTER),
|
|
73
75
|
(this.duration = l || 5e3),
|
|
@@ -82,24 +84,25 @@ export default class InAppMessage {
|
|
|
82
84
|
(this.imageUrl = a),
|
|
83
85
|
(this.imageStyle = I || InAppMessage.ImageStyle.TOP),
|
|
84
86
|
(this.iconColor = c || InAppMessage.th.ih),
|
|
85
|
-
(this.iconBackgroundColor =
|
|
86
|
-
(this.backgroundColor =
|
|
87
|
-
(this.textColor =
|
|
88
|
-
(this.closeButtonColor =
|
|
89
|
-
(this.animateIn =
|
|
87
|
+
(this.iconBackgroundColor = A || InAppMessage.th.sh),
|
|
88
|
+
(this.backgroundColor = O || InAppMessage.th.ih),
|
|
89
|
+
(this.textColor = _ || InAppMessage.th.hh),
|
|
90
|
+
(this.closeButtonColor = m || InAppMessage.th.eh),
|
|
91
|
+
(this.animateIn = L),
|
|
90
92
|
null == this.animateIn && (this.animateIn = !0),
|
|
91
93
|
(this.animateOut = N),
|
|
92
94
|
null == this.animateOut && (this.animateOut = !0),
|
|
93
|
-
(this.header =
|
|
94
|
-
(this.headerAlignment =
|
|
95
|
-
(this.headerTextColor =
|
|
96
|
-
(this.frameColor =
|
|
95
|
+
(this.header = S),
|
|
96
|
+
(this.headerAlignment = R || InAppMessage.TextAlignment.CENTER),
|
|
97
|
+
(this.headerTextColor = M || InAppMessage.th.hh),
|
|
98
|
+
(this.frameColor = D || InAppMessage.th.Eh),
|
|
97
99
|
(this.buttons = C || []),
|
|
98
100
|
(this.cropType = d || InAppMessage.CropType.FIT_CENTER),
|
|
99
101
|
(this.orientation = U),
|
|
100
102
|
(this.htmlId = b),
|
|
101
103
|
(this.css = P),
|
|
102
104
|
(this.isControl = !1),
|
|
105
|
+
(this.messageExtras = p),
|
|
103
106
|
(this.nh = !1),
|
|
104
107
|
(this.Th = !1),
|
|
105
108
|
(this.vo = !1),
|
|
@@ -143,7 +146,7 @@ export default class InAppMessage {
|
|
|
143
146
|
K() {
|
|
144
147
|
return !this.Th && ((this.Th = !0), !0);
|
|
145
148
|
}
|
|
146
|
-
|
|
149
|
+
mo() {
|
|
147
150
|
return this.Th;
|
|
148
151
|
}
|
|
149
152
|
p(t) {
|
|
@@ -190,7 +193,7 @@ export default class InAppMessage {
|
|
|
190
193
|
null != e && "Safari" === X.browser && (e.scrollTop = E),
|
|
191
194
|
s ? s() : this.N();
|
|
192
195
|
};
|
|
193
|
-
h ? setTimeout(n, InAppMessage.
|
|
196
|
+
h ? setTimeout(n, InAppMessage.Ah) : n(), this.we && this.we.focus();
|
|
194
197
|
}
|
|
195
198
|
Ie() {
|
|
196
199
|
return document.createTextNode(this.message || "");
|
|
@@ -209,7 +212,7 @@ export default class InAppMessage {
|
|
|
209
212
|
s.scrollHeight > s.clientHeight) ||
|
|
210
213
|
(document.querySelector(`.${InAppMessage.lh}`) && t.preventDefault());
|
|
211
214
|
}
|
|
212
|
-
|
|
215
|
+
Oh(t) {
|
|
213
216
|
const s = t.parentNode;
|
|
214
217
|
this.xe() &&
|
|
215
218
|
null != s &&
|
|
@@ -222,10 +225,10 @@ export default class InAppMessage {
|
|
|
222
225
|
)),
|
|
223
226
|
(t.className += " " + InAppMessage.ah);
|
|
224
227
|
}
|
|
225
|
-
static
|
|
228
|
+
static _h(t) {
|
|
226
229
|
if (
|
|
227
|
-
t.keyCode ===
|
|
228
|
-
!e.nn(L.
|
|
230
|
+
t.keyCode === lt.mh &&
|
|
231
|
+
!e.nn(L.Lh) &&
|
|
229
232
|
document.querySelectorAll(".ab-modal-interactions").length > 0
|
|
230
233
|
) {
|
|
231
234
|
const t = document.getElementsByClassName("ab-html-message");
|
|
@@ -249,10 +252,10 @@ export default class InAppMessage {
|
|
|
249
252
|
}
|
|
250
253
|
Nh() {
|
|
251
254
|
this.nh ||
|
|
252
|
-
e.nn(L.
|
|
253
|
-
(document.addEventListener("keydown", InAppMessage.
|
|
254
|
-
e.
|
|
255
|
-
document.removeEventListener("keydown", InAppMessage.
|
|
255
|
+
e.nn(L.Lh) ||
|
|
256
|
+
(document.addEventListener("keydown", InAppMessage._h, !1),
|
|
257
|
+
e.Sh(() => {
|
|
258
|
+
document.removeEventListener("keydown", InAppMessage._h);
|
|
256
259
|
}),
|
|
257
260
|
(this.nh = !0));
|
|
258
261
|
}
|
|
@@ -261,7 +264,7 @@ export default class InAppMessage {
|
|
|
261
264
|
return t
|
|
262
265
|
? ((s[InAppMessage.tt.ea] = this.message),
|
|
263
266
|
(s[InAppMessage.tt.ra] = this.messageAlignment),
|
|
264
|
-
(s[InAppMessage.tt.
|
|
267
|
+
(s[InAppMessage.tt.Rh] = this.slideFrom),
|
|
265
268
|
(s[InAppMessage.tt.bt] = this.extras),
|
|
266
269
|
(s[InAppMessage.tt.sa] = this.triggerId),
|
|
267
270
|
(s[InAppMessage.tt.ta] = this.clickAction),
|
|
@@ -289,6 +292,7 @@ export default class InAppMessage {
|
|
|
289
292
|
(s[InAppMessage.tt.Sa] = this.htmlId),
|
|
290
293
|
(s[InAppMessage.tt.CSS] = this.css),
|
|
291
294
|
(s[InAppMessage.tt.Z] = t),
|
|
295
|
+
(s[InAppMessage.tt.ba] = this.messageExtras),
|
|
292
296
|
s)
|
|
293
297
|
: s;
|
|
294
298
|
}
|
|
@@ -297,8 +301,8 @@ export default class InAppMessage {
|
|
|
297
301
|
hh: 4281545523,
|
|
298
302
|
ih: 4294967295,
|
|
299
303
|
sh: 4278219733,
|
|
300
|
-
|
|
301
|
-
|
|
304
|
+
Mh: 4293914607,
|
|
305
|
+
Dh: 4283782485,
|
|
302
306
|
Eh: 3224580915,
|
|
303
307
|
eh: 4288387995,
|
|
304
308
|
}),
|
|
@@ -307,9 +311,9 @@ export default class InAppMessage {
|
|
|
307
311
|
ke: "ias",
|
|
308
312
|
dh: "of",
|
|
309
313
|
Uh: "do",
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
314
|
+
bh: "umt",
|
|
315
|
+
Ph: "tf",
|
|
316
|
+
ph: "te",
|
|
313
317
|
}),
|
|
314
318
|
(InAppMessage.SlideFrom = { TOP: "TOP", BOTTOM: "BOTTOM" }),
|
|
315
319
|
(InAppMessage.ClickAction = {
|
|
@@ -334,23 +338,23 @@ export default class InAppMessage {
|
|
|
334
338
|
FIT_CENTER: "FIT_CENTER",
|
|
335
339
|
}),
|
|
336
340
|
(InAppMessage.Ce = {
|
|
337
|
-
|
|
338
|
-
|
|
341
|
+
Xr: "SLIDEUP",
|
|
342
|
+
Wr: "MODAL",
|
|
339
343
|
Je: "MODAL_STYLED",
|
|
340
|
-
|
|
341
|
-
|
|
344
|
+
Qr: "FULL",
|
|
345
|
+
Vr: "WEB_HTML",
|
|
342
346
|
je: "HTML",
|
|
343
347
|
Se: "HTML_FULL",
|
|
344
348
|
}),
|
|
345
|
-
(InAppMessage.
|
|
346
|
-
(InAppMessage.
|
|
349
|
+
(InAppMessage.Ah = 500),
|
|
350
|
+
(InAppMessage.fh = 200),
|
|
347
351
|
(InAppMessage.ah = "ab-show"),
|
|
348
352
|
(InAppMessage.Ih = "ab-hide"),
|
|
349
353
|
(InAppMessage.lh = "ab-pause-scrolling"),
|
|
350
354
|
(InAppMessage.tt = {
|
|
351
355
|
ea: "m",
|
|
352
356
|
ra: "ma",
|
|
353
|
-
|
|
357
|
+
Rh: "sf",
|
|
354
358
|
bt: "e",
|
|
355
359
|
sa: "ti",
|
|
356
360
|
ta: "ca",
|
|
@@ -379,4 +383,5 @@ export default class InAppMessage {
|
|
|
379
383
|
CSS: "css",
|
|
380
384
|
Z: "type",
|
|
381
385
|
uo: "messageFields",
|
|
386
|
+
ba: "me",
|
|
382
387
|
});
|
|
@@ -29,6 +29,7 @@ export default class ModalMessage extends InAppMessage {
|
|
|
29
29
|
b,
|
|
30
30
|
k,
|
|
31
31
|
q,
|
|
32
|
+
A,
|
|
32
33
|
) {
|
|
33
34
|
super(
|
|
34
35
|
e,
|
|
@@ -60,13 +61,14 @@ export default class ModalMessage extends InAppMessage {
|
|
|
60
61
|
void 0,
|
|
61
62
|
k,
|
|
62
63
|
q,
|
|
64
|
+
A,
|
|
63
65
|
),
|
|
64
66
|
(this.$e = InAppMessage.TextAlignment.CENTER);
|
|
65
67
|
}
|
|
66
68
|
Y() {
|
|
67
69
|
return super.Y(ModalMessage.it);
|
|
68
70
|
}
|
|
69
|
-
static
|
|
71
|
+
static Ur(e) {
|
|
70
72
|
return new ModalMessage(
|
|
71
73
|
e[InAppMessage.tt.ea],
|
|
72
74
|
e[InAppMessage.tt.ra],
|
|
@@ -95,7 +97,8 @@ export default class ModalMessage extends InAppMessage {
|
|
|
95
97
|
e[InAppMessage.tt.wa],
|
|
96
98
|
e[InAppMessage.tt.Sa],
|
|
97
99
|
e[InAppMessage.tt.CSS],
|
|
100
|
+
e[InAppMessage.tt.ba],
|
|
98
101
|
);
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
|
-
ModalMessage.it = InAppMessage.Ce.
|
|
104
|
+
ModalMessage.it = InAppMessage.Ce.Wr;
|
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
import InAppMessage from "./in-app-message.js";
|
|
2
2
|
import { DOMUtils as de } from "../../util/dom-utils.js";
|
|
3
3
|
export default class SlideUpMessage extends InAppMessage {
|
|
4
|
-
constructor(
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
constructor(
|
|
5
|
+
e,
|
|
6
|
+
t,
|
|
7
|
+
s,
|
|
8
|
+
o,
|
|
9
|
+
i,
|
|
10
|
+
r,
|
|
11
|
+
n,
|
|
12
|
+
d,
|
|
13
|
+
a,
|
|
14
|
+
u,
|
|
15
|
+
p,
|
|
16
|
+
m,
|
|
17
|
+
c,
|
|
18
|
+
l,
|
|
19
|
+
v,
|
|
20
|
+
x,
|
|
21
|
+
f,
|
|
22
|
+
h,
|
|
23
|
+
g,
|
|
24
|
+
I,
|
|
25
|
+
M,
|
|
26
|
+
b,
|
|
27
|
+
) {
|
|
28
|
+
(x = x || InAppMessage.th.Dh),
|
|
29
|
+
(v = v || InAppMessage.th.Mh),
|
|
7
30
|
super(
|
|
8
31
|
e,
|
|
9
32
|
(t = t || InAppMessage.TextAlignment.START),
|
|
@@ -34,6 +57,7 @@ export default class SlideUpMessage extends InAppMessage {
|
|
|
34
57
|
void 0,
|
|
35
58
|
I,
|
|
36
59
|
M,
|
|
60
|
+
b,
|
|
37
61
|
),
|
|
38
62
|
(this.$e = InAppMessage.TextAlignment.START);
|
|
39
63
|
}
|
|
@@ -44,22 +68,22 @@ export default class SlideUpMessage extends InAppMessage {
|
|
|
44
68
|
const e = document.createElement("span");
|
|
45
69
|
return e.appendChild(document.createTextNode(this.message || "")), e;
|
|
46
70
|
}
|
|
47
|
-
|
|
71
|
+
Oh(e) {
|
|
48
72
|
const t = e.getElementsByClassName("ab-in-app-message")[0];
|
|
49
73
|
de.co(t, !0, !0) ||
|
|
50
74
|
(this.slideFrom === InAppMessage.SlideFrom.TOP
|
|
51
75
|
? (t.style.top = "0px")
|
|
52
76
|
: (t.style.bottom = "0px")),
|
|
53
|
-
super.
|
|
77
|
+
super.Oh(e);
|
|
54
78
|
}
|
|
55
79
|
Y() {
|
|
56
80
|
return super.Y(SlideUpMessage.it);
|
|
57
81
|
}
|
|
58
|
-
static
|
|
82
|
+
static Ur(e) {
|
|
59
83
|
return new SlideUpMessage(
|
|
60
84
|
e[InAppMessage.tt.ea],
|
|
61
85
|
e[InAppMessage.tt.ra],
|
|
62
|
-
e[InAppMessage.tt.
|
|
86
|
+
e[InAppMessage.tt.Rh],
|
|
63
87
|
e[InAppMessage.tt.bt],
|
|
64
88
|
e[InAppMessage.tt.sa],
|
|
65
89
|
e[InAppMessage.tt.ta],
|
|
@@ -78,7 +102,8 @@ export default class SlideUpMessage extends InAppMessage {
|
|
|
78
102
|
e[InAppMessage.tt.ga],
|
|
79
103
|
e[InAppMessage.tt.Sa],
|
|
80
104
|
e[InAppMessage.tt.CSS],
|
|
105
|
+
e[InAppMessage.tt.ba],
|
|
81
106
|
);
|
|
82
107
|
}
|
|
83
108
|
}
|
|
84
|
-
SlideUpMessage.it = InAppMessage.Ce.
|
|
109
|
+
SlideUpMessage.it = InAppMessage.Ce.Xr;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export default class wt {
|
|
2
2
|
constructor(t, s, i, h, l) {
|
|
3
3
|
(this.triggerId = t),
|
|
4
|
-
(this.
|
|
5
|
-
(this.
|
|
6
|
-
(this.
|
|
7
|
-
(this.
|
|
4
|
+
(this.Hr = s),
|
|
5
|
+
(this.Gr = i),
|
|
6
|
+
(this.Jr = h),
|
|
7
|
+
(this.Kr = l),
|
|
8
8
|
(this.triggerId = t),
|
|
9
|
-
(this.
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
12
|
-
(this.
|
|
9
|
+
(this.Hr = s),
|
|
10
|
+
(this.Gr = i),
|
|
11
|
+
(this.Jr = h),
|
|
12
|
+
(this.Kr = l);
|
|
13
13
|
}
|
|
14
14
|
static fromJson(t, s, i, h, l) {
|
|
15
15
|
return null == t || null == t.trigger_id
|
|
@@ -3,7 +3,6 @@ import ControlMessage from "../models/control-message.js";
|
|
|
3
3
|
import HtmlMessage from "../models/html-message.js";
|
|
4
4
|
import InAppMessage from "../models/in-app-message.js";
|
|
5
5
|
import SlideUpMessage from "../models/slide-up-message.js";
|
|
6
|
-
import se from "../in-app-message-manager-factory.js";
|
|
7
6
|
import me from "../display/get-animation-effect.js";
|
|
8
7
|
import ce from "../display/in-app-message-to-html.js";
|
|
9
8
|
import { logInAppMessageImpression } from "../log-in-app-message-impression.js";
|
|
@@ -12,7 +11,7 @@ import {
|
|
|
12
11
|
WindowUtils as eo,
|
|
13
12
|
} from "../../util/window-utils.js";
|
|
14
13
|
import { isURIJavascriptOrData as N } from "../../util/url-utils.js";
|
|
15
|
-
import { KeyCodes as
|
|
14
|
+
import { KeyCodes as lt } from "../../util/key-codes.js";
|
|
16
15
|
import { setupInAppMessageUI as ss } from "../../ui/js/index.js";
|
|
17
16
|
import { logger as r } from "../../../shared-lib/index.js";
|
|
18
17
|
import { toRgba as ie } from "../../util/color-utils.js";
|
|
@@ -31,15 +30,13 @@ export function showInAppMessage(t, s, o) {
|
|
|
31
30
|
);
|
|
32
31
|
if (!(t instanceof InAppMessage)) return !1;
|
|
33
32
|
if (t.constructor === InAppMessage) return !1;
|
|
34
|
-
const i = se.m();
|
|
35
33
|
t.Nh();
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
34
|
+
const i = t instanceof HtmlMessage;
|
|
35
|
+
if (i && !t.trusted && !e.tr())
|
|
38
36
|
return (
|
|
39
37
|
r.error(
|
|
40
38
|
'HTML in-app messages are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable these messages.',
|
|
41
39
|
),
|
|
42
|
-
i.Ve(t.triggerId, InAppMessage.Me.Ch),
|
|
43
40
|
!1
|
|
44
41
|
);
|
|
45
42
|
if ((null == s && (s = document.body), t.xe())) {
|
|
@@ -48,12 +45,11 @@ export function showInAppMessage(t, s, o) {
|
|
|
48
45
|
r.info(
|
|
49
46
|
`Cannot show in-app message ${t.message} because another message is being shown.`,
|
|
50
47
|
),
|
|
51
|
-
i.Ve(t.triggerId, InAppMessage.Me.ke),
|
|
52
48
|
!1
|
|
53
49
|
);
|
|
54
50
|
}
|
|
55
|
-
if (eo.
|
|
56
|
-
const e = eo.
|
|
51
|
+
if (eo.fo()) {
|
|
52
|
+
const e = eo.jo();
|
|
57
53
|
if (
|
|
58
54
|
(e === fe.PORTRAIT &&
|
|
59
55
|
t.orientation === InAppMessage.Orientation.LANDSCAPE) ||
|
|
@@ -69,7 +65,6 @@ export function showInAppMessage(t, s, o) {
|
|
|
69
65
|
r.info(
|
|
70
66
|
`Not showing ${o} in-app message ${t.message} because the screen is currently ${s}`,
|
|
71
67
|
),
|
|
72
|
-
i.Ve(t.triggerId, InAppMessage.Me.dh),
|
|
73
68
|
!1
|
|
74
69
|
);
|
|
75
70
|
}
|
|
@@ -89,27 +84,26 @@ export function showInAppMessage(t, s, o) {
|
|
|
89
84
|
r.error(
|
|
90
85
|
'Javascript click actions are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable these actions.',
|
|
91
86
|
),
|
|
92
|
-
i.Ve(t.triggerId, InAppMessage.Me.Ch),
|
|
93
87
|
!1
|
|
94
88
|
);
|
|
95
89
|
}
|
|
96
|
-
const
|
|
90
|
+
const n = document.createElement("div");
|
|
97
91
|
if (
|
|
98
|
-
((
|
|
99
|
-
(
|
|
100
|
-
|
|
101
|
-
t.ve() && (
|
|
102
|
-
e.nn(L.
|
|
103
|
-
s.appendChild(
|
|
92
|
+
((n.className = "ab-iam-root v3"),
|
|
93
|
+
(n.className += me(t)),
|
|
94
|
+
n.setAttribute("role", "complementary"),
|
|
95
|
+
t.ve() && (n.id = t.htmlId),
|
|
96
|
+
e.nn(L.bo) && (n.style.zIndex = (e.nn(L.bo) + 1).toString()),
|
|
97
|
+
s.appendChild(n),
|
|
104
98
|
t.be())
|
|
105
99
|
) {
|
|
106
100
|
const s = document.createElement("style");
|
|
107
101
|
(s.innerHTML = t.css),
|
|
108
102
|
(s.id = t.ye()),
|
|
109
|
-
null != e.nn(L.
|
|
103
|
+
null != e.nn(L.ho) && s.setAttribute("nonce", e.nn(L.ho)),
|
|
110
104
|
document.getElementsByTagName("head")[0].appendChild(s);
|
|
111
105
|
}
|
|
112
|
-
const
|
|
106
|
+
const a = t instanceof SlideUpMessage,
|
|
113
107
|
l = ce(
|
|
114
108
|
t,
|
|
115
109
|
() => {
|
|
@@ -123,18 +117,18 @@ export function showInAppMessage(t, s, o) {
|
|
|
123
117
|
if (
|
|
124
118
|
((o.className = "ab-page-blocker"),
|
|
125
119
|
t.be() || (o.style.backgroundColor = ie(t.frameColor)),
|
|
126
|
-
e.nn(L.
|
|
127
|
-
|
|
128
|
-
!e.nn(L.
|
|
120
|
+
e.nn(L.bo) && (o.style.zIndex = e.nn(L.bo).toString()),
|
|
121
|
+
n.appendChild(o),
|
|
122
|
+
!e.nn(L.Lh))
|
|
129
123
|
) {
|
|
130
124
|
const e = new Date().valueOf();
|
|
131
125
|
o.onclick = (o) => {
|
|
132
|
-
new Date().valueOf() - e > InAppMessage.
|
|
126
|
+
new Date().valueOf() - e > InAppMessage.fh &&
|
|
133
127
|
(t.he(s), o.stopPropagation());
|
|
134
128
|
};
|
|
135
129
|
}
|
|
136
|
-
|
|
137
|
-
} else if (
|
|
130
|
+
n.appendChild(s), s.focus(), t.Oh(n);
|
|
131
|
+
} else if (a) {
|
|
138
132
|
const e = document.querySelectorAll(".ab-slideup");
|
|
139
133
|
let o = null;
|
|
140
134
|
for (let t = e.length - 1; t >= 0; t--)
|
|
@@ -154,28 +148,28 @@ export function showInAppMessage(t, s, o) {
|
|
|
154
148
|
o.offsetTop),
|
|
155
149
|
(s.style.bottom = Math.max(e, 0) + "px");
|
|
156
150
|
}
|
|
157
|
-
} else if (
|
|
151
|
+
} else if (i && !e.nn(L.Lh)) {
|
|
158
152
|
const e = t;
|
|
159
153
|
It(s) &&
|
|
160
154
|
s.contentWindow &&
|
|
161
155
|
s.contentWindow.addEventListener("keydown", function (t) {
|
|
162
|
-
t.keyCode ===
|
|
156
|
+
t.keyCode === lt.mh && e.closeMessage();
|
|
163
157
|
});
|
|
164
158
|
}
|
|
165
159
|
logInAppMessageImpression(t),
|
|
166
160
|
t.dismissType === InAppMessage.DismissType.AUTO_DISMISS &&
|
|
167
161
|
setTimeout(() => {
|
|
168
|
-
|
|
162
|
+
n.contains(s) && t.he(s);
|
|
169
163
|
}, t.duration),
|
|
170
164
|
"function" == typeof o && o();
|
|
171
165
|
},
|
|
172
|
-
(e
|
|
173
|
-
r.info(e)
|
|
166
|
+
(e) => {
|
|
167
|
+
r.info(e);
|
|
174
168
|
},
|
|
175
|
-
e.nn(L.yo),
|
|
176
|
-
e.nn(L.ho),
|
|
177
169
|
e.nn(L.wo),
|
|
170
|
+
e.nn(L.bo),
|
|
171
|
+
e.nn(L.ho),
|
|
178
172
|
s,
|
|
179
173
|
);
|
|
180
|
-
return (
|
|
174
|
+
return (i || a) && (n.appendChild(l), t.Oh(n)), !0;
|
|
181
175
|
}
|
|
@@ -1 +1,18 @@
|
|
|
1
|
-
export const isIFrame = (
|
|
1
|
+
export const isIFrame = (o) => null !== o && "IFRAME" === o.tagName;
|
|
2
|
+
export function nodeScriptReplace(o) {
|
|
3
|
+
var n;
|
|
4
|
+
if ("SCRIPT" === o.tagName)
|
|
5
|
+
null === (n = o.parentNode) ||
|
|
6
|
+
void 0 === n ||
|
|
7
|
+
n.replaceChild(
|
|
8
|
+
(function (o) {
|
|
9
|
+
const n = document.createElement("script");
|
|
10
|
+
n.text = o.innerHTML;
|
|
11
|
+
for (const e of o.attributes) n.setAttribute(e.name, e.value);
|
|
12
|
+
return n;
|
|
13
|
+
})(o),
|
|
14
|
+
o,
|
|
15
|
+
);
|
|
16
|
+
else for (const n of o.childNodes) nodeScriptReplace(n);
|
|
17
|
+
return o;
|
|
18
|
+
}
|