@braze/web-sdk 4.5.1 → 4.6.1
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 +65 -9
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +7 -7
- package/shared-lib/encoding-utils.js +3 -3
- package/shared-lib/event-types.js +14 -14
- package/shared-lib/guid.js +2 -2
- package/shared-lib/indexed-db-adapter.js +3 -3
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +15 -15
- package/src/Card/index.js +1 -0
- package/src/Card/log-content-card-click.js +4 -0
- package/src/FeatureFlags/feature-flag-factory.js +13 -5
- package/src/FeatureFlags/feature-flag.js +36 -8
- package/src/FeatureFlags/feature-flags-provider.js +58 -33
- package/src/FeatureFlags/get-all-feature-flags.js +3 -3
- package/src/FeatureFlags/get-feature-flag.js +5 -5
- package/src/FeatureFlags/index.js +1 -0
- package/src/Feed/feed-provider-factory.js +8 -8
- package/src/Feed/feed-provider.js +3 -3
- package/src/Feed/get-cached-feed.js +2 -2
- package/src/Feed/log-feed-displayed.js +1 -1
- package/src/Feed/request-feed-refresh.js +2 -2
- package/src/Feed/subscribe-to-feed-updates.js +2 -2
- package/src/Feed/ui/show-feed.js +2 -2
- package/src/InAppMessage/display/html-message-to-html.js +3 -3
- package/src/InAppMessage/display/in-app-message-to-html.js +101 -86
- package/src/InAppMessage/display/modal-utils.js +9 -9
- package/src/InAppMessage/in-app-message-factory.js +1 -1
- package/src/InAppMessage/in-app-message-manager-factory.js +3 -3
- package/src/InAppMessage/in-app-message-manager.js +52 -52
- package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-click.js +2 -2
- 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/full-screen-message.js +1 -1
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +68 -68
- package/src/InAppMessage/models/modal-message.js +2 -2
- package/src/InAppMessage/models/slide-up-message.js +8 -8
- package/src/InAppMessage/models/templated-in-app-message.js +4 -4
- 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 +24 -21
- package/src/Push/push-manager.js +54 -54
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +13 -13
- package/src/common/base-feed.js +1 -1
- package/src/common/feed-display.js +22 -22
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/managers/auth-manager.js +23 -23
- package/src/managers/braze-instance.js +93 -93
- package/src/managers/device-manager.js +2 -2
- package/src/managers/network-manager.js +42 -42
- package/src/managers/server-config-manager.js +9 -9
- package/src/managers/session-manager.js +27 -27
- package/src/managers/storage-manager-factory.js +1 -1
- package/src/managers/storage-manager.js +61 -61
- package/src/managers/subscription-manager.js +6 -6
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +2 -2
- package/src/models/device.js +1 -1
- package/src/models/identifier.js +6 -6
- package/src/models/push-token.js +3 -3
- package/src/models/server-config.js +3 -3
- package/src/request-controller.js +52 -52
- package/src/triggers/models/filter-set.js +2 -2
- package/src/triggers/models/filter.js +34 -34
- package/src/triggers/models/in-app-message-click-data.js +6 -6
- package/src/triggers/models/push-click-data.js +1 -1
- package/src/triggers/models/trigger-condition.js +8 -8
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +30 -30
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +37 -37
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +2 -2
- package/src/util/dom-utils.js +8 -8
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +3 -3
- package/src/util/window-utils.js +1 -1
|
@@ -9,11 +9,11 @@ import { TriggersProviderFactory as W } from "../triggers/triggers-provider-fact
|
|
|
9
9
|
export function logInAppMessageClick(o) {
|
|
10
10
|
if (!e.rr()) return !1;
|
|
11
11
|
if (!(o instanceof InAppMessage)) return r.D.error(or), !1;
|
|
12
|
-
const s = pe.m().G(o, r.A.
|
|
12
|
+
const s = pe.m().G(o, r.A.yi);
|
|
13
13
|
if (s) {
|
|
14
14
|
o.Cr() || logInAppMessageImpression(o);
|
|
15
15
|
for (let r = 0; r < s.ve.length; r++)
|
|
16
|
-
W.er().je(V.
|
|
16
|
+
W.er().je(V.Br, [o.triggerId], s.ve[r]);
|
|
17
17
|
}
|
|
18
18
|
return s.S;
|
|
19
19
|
}
|
|
@@ -13,11 +13,11 @@ export function logInAppMessageHtmlClick(s, t, o) {
|
|
|
13
13
|
),
|
|
14
14
|
!1
|
|
15
15
|
);
|
|
16
|
-
let m = r.A.
|
|
17
|
-
null != t && (m = r.A.
|
|
16
|
+
let m = r.A.yi;
|
|
17
|
+
null != t && (m = r.A.ji);
|
|
18
18
|
const i = pe.m().G(s, m, t, o);
|
|
19
19
|
if (i.S)
|
|
20
20
|
for (let r = 0; r < i.ve.length; r++)
|
|
21
|
-
W.er().je(V.
|
|
21
|
+
W.er().je(V.Br, [s.triggerId, t], i.ve[r]);
|
|
22
22
|
return i.S;
|
|
23
23
|
}
|
|
@@ -8,6 +8,6 @@ export function logInAppMessageImpression(o) {
|
|
|
8
8
|
if (!e.rr()) return !1;
|
|
9
9
|
if (!(o instanceof InAppMessage || o instanceof ControlMessage))
|
|
10
10
|
return r.D.error(or), !1;
|
|
11
|
-
const s = o instanceof ControlMessage ? r.A.ro : r.A.
|
|
11
|
+
const s = o instanceof ControlMessage ? r.A.ro : r.A.bi;
|
|
12
12
|
return pe.m().G(o, s).S;
|
|
13
13
|
}
|
|
@@ -3,12 +3,12 @@ import u from "../../managers/subscription-manager.js";
|
|
|
3
3
|
export default class InAppMessageButton {
|
|
4
4
|
constructor(s, t, i, r, e, h, n) {
|
|
5
5
|
(this.text = s || ""),
|
|
6
|
-
(this.backgroundColor = t || InAppMessage.
|
|
7
|
-
(this.textColor = i || InAppMessage.
|
|
6
|
+
(this.backgroundColor = t || InAppMessage.Ji.Ci),
|
|
7
|
+
(this.textColor = i || InAppMessage.Ji.Hi),
|
|
8
8
|
(this.borderColor = r || this.backgroundColor),
|
|
9
9
|
(this.clickAction = e || InAppMessage.ClickAction.NONE),
|
|
10
10
|
(this.uri = h),
|
|
11
|
-
null == n && (n = InAppMessageButton.
|
|
11
|
+
null == n && (n = InAppMessageButton.Mi),
|
|
12
12
|
(this.id = n),
|
|
13
13
|
(this.nl = !1),
|
|
14
14
|
(this.lt = new u());
|
|
@@ -37,4 +37,4 @@ export default class InAppMessageButton {
|
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
InAppMessageButton.
|
|
40
|
+
InAppMessageButton.Mi = -1;
|
|
@@ -51,51 +51,51 @@ export default class InAppMessage {
|
|
|
51
51
|
(this.icon = T),
|
|
52
52
|
(this.imageUrl = a),
|
|
53
53
|
(this.imageStyle = m || InAppMessage.ImageStyle.TOP),
|
|
54
|
-
(this.iconColor = c || InAppMessage.
|
|
55
|
-
(this.iconBackgroundColor = I || InAppMessage.
|
|
56
|
-
(this.backgroundColor = A || InAppMessage.
|
|
57
|
-
(this.textColor = N || InAppMessage.
|
|
58
|
-
(this.closeButtonColor = _ || InAppMessage.
|
|
54
|
+
(this.iconColor = c || InAppMessage.Ji.Hi),
|
|
55
|
+
(this.iconBackgroundColor = I || InAppMessage.Ji.Ci),
|
|
56
|
+
(this.backgroundColor = A || InAppMessage.Ji.Hi),
|
|
57
|
+
(this.textColor = N || InAppMessage.Ji.Li),
|
|
58
|
+
(this.closeButtonColor = _ || InAppMessage.Ji.Oi),
|
|
59
59
|
(this.animateIn = L),
|
|
60
60
|
null == this.animateIn && (this.animateIn = !0),
|
|
61
61
|
(this.animateOut = d),
|
|
62
62
|
null == this.animateOut && (this.animateOut = !0),
|
|
63
63
|
(this.header = O),
|
|
64
64
|
(this.headerAlignment = S || InAppMessage.TextAlignment.CENTER),
|
|
65
|
-
(this.headerTextColor = D || InAppMessage.
|
|
66
|
-
(this.frameColor = M || InAppMessage.
|
|
65
|
+
(this.headerTextColor = D || InAppMessage.Ji.Li),
|
|
66
|
+
(this.frameColor = M || InAppMessage.Ji.Ri),
|
|
67
67
|
(this.buttons = R || []),
|
|
68
68
|
(this.cropType = b || InAppMessage.CropType.FIT_CENTER),
|
|
69
69
|
(this.orientation = P),
|
|
70
70
|
(this.htmlId = p),
|
|
71
71
|
(this.css = C),
|
|
72
72
|
(this.isControl = !1),
|
|
73
|
-
(this.Ri = !1),
|
|
74
|
-
(this.nl = !1),
|
|
75
73
|
(this.Pi = !1),
|
|
74
|
+
(this.nl = !1),
|
|
75
|
+
(this.Ui = !1),
|
|
76
76
|
(this.lt = new u()),
|
|
77
|
-
(this.
|
|
77
|
+
(this.Wi = new u());
|
|
78
78
|
}
|
|
79
79
|
subscribeToClickedEvent(t) {
|
|
80
80
|
return this.lt.ut(t);
|
|
81
81
|
}
|
|
82
82
|
subscribeToDismissedEvent(t) {
|
|
83
|
-
return this.
|
|
83
|
+
return this.Wi.ut(t);
|
|
84
84
|
}
|
|
85
85
|
removeSubscription(t) {
|
|
86
|
-
this.lt.removeSubscription(t), this.
|
|
86
|
+
this.lt.removeSubscription(t), this.Wi.removeSubscription(t);
|
|
87
87
|
}
|
|
88
88
|
removeAllSubscriptions() {
|
|
89
|
-
this.lt.removeAllSubscriptions(), this.
|
|
89
|
+
this.lt.removeAllSubscriptions(), this.Wi.removeAllSubscriptions();
|
|
90
90
|
}
|
|
91
91
|
closeMessage() {
|
|
92
92
|
this.on(this.mn);
|
|
93
93
|
}
|
|
94
|
-
|
|
94
|
+
Ie() {
|
|
95
95
|
return !0;
|
|
96
96
|
}
|
|
97
97
|
ll() {
|
|
98
|
-
return this.
|
|
98
|
+
return this.Ie();
|
|
99
99
|
}
|
|
100
100
|
an() {
|
|
101
101
|
return null != this.htmlId && this.htmlId.length > 4;
|
|
@@ -107,26 +107,26 @@ export default class InAppMessage {
|
|
|
107
107
|
if (this.an() && this.sn()) return this.htmlId + "-css";
|
|
108
108
|
}
|
|
109
109
|
R() {
|
|
110
|
-
return !this.
|
|
110
|
+
return !this.Pi && ((this.Pi = !0), !0);
|
|
111
111
|
}
|
|
112
112
|
Cr() {
|
|
113
|
-
return this.
|
|
113
|
+
return this.Pi;
|
|
114
114
|
}
|
|
115
115
|
k() {
|
|
116
116
|
return !this.nl && ((this.nl = !0), this.lt.St(), !0);
|
|
117
117
|
}
|
|
118
118
|
J() {
|
|
119
|
-
return !this.
|
|
119
|
+
return !this.Ui && ((this.Ui = !0), this.Wi.St(), !0);
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
Ki(t) {
|
|
122
122
|
if (t && t.parentNode) {
|
|
123
123
|
let s = t.closest(".ab-iam-root");
|
|
124
|
-
if ((null == s && (s = t), this.
|
|
124
|
+
if ((null == s && (s = t), this.Ie() && null != s.parentNode)) {
|
|
125
125
|
const t = s.parentNode.classList;
|
|
126
|
-
t && t.contains(InAppMessage.
|
|
127
|
-
document.body.removeEventListener("touchmove", InAppMessage.
|
|
126
|
+
t && t.contains(InAppMessage.Yi) && t.remove(InAppMessage.Yi),
|
|
127
|
+
document.body.removeEventListener("touchmove", InAppMessage.Xi);
|
|
128
128
|
}
|
|
129
|
-
s.className = s.className.replace(InAppMessage.
|
|
129
|
+
s.className = s.className.replace(InAppMessage.Vi, InAppMessage.Qi);
|
|
130
130
|
}
|
|
131
131
|
return this.animateOut;
|
|
132
132
|
}
|
|
@@ -139,7 +139,7 @@ export default class InAppMessage {
|
|
|
139
139
|
? t.getElementsByClassName("ab-in-app-message")[0]
|
|
140
140
|
: t);
|
|
141
141
|
let e = !1;
|
|
142
|
-
i && (e = this.
|
|
142
|
+
i && (e = this.Ki(i));
|
|
143
143
|
const h = document.body;
|
|
144
144
|
if (null != h) var n = h.scrollTop;
|
|
145
145
|
const r = () => {
|
|
@@ -154,40 +154,40 @@ export default class InAppMessage {
|
|
|
154
154
|
null != h && "Safari" === ot.browser && (h.scrollTop = n),
|
|
155
155
|
s ? s() : this.J();
|
|
156
156
|
};
|
|
157
|
-
e ? setTimeout(r, InAppMessage.
|
|
157
|
+
e ? setTimeout(r, InAppMessage.Zi) : r(), this.Le && this.Le.focus();
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
Oe() {
|
|
160
160
|
return document.createTextNode(this.message);
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
Je(t) {
|
|
163
163
|
let s = "";
|
|
164
|
-
this.message || this.header || !this.
|
|
164
|
+
this.message || this.header || !this.Ie() || (s = "Modal Image"),
|
|
165
165
|
t.setAttribute("alt", s);
|
|
166
166
|
}
|
|
167
|
-
static
|
|
167
|
+
static Xi(t) {
|
|
168
168
|
(t.targetTouches && t.targetTouches.length > 1) ||
|
|
169
169
|
(t.target.classList &&
|
|
170
170
|
t.target.classList.contains("ab-message-text") &&
|
|
171
171
|
t.target.scrollHeight > t.target.clientHeight) ||
|
|
172
|
-
(document.querySelector(`.${InAppMessage.
|
|
172
|
+
(document.querySelector(`.${InAppMessage.Yi}`) && t.preventDefault());
|
|
173
173
|
}
|
|
174
|
-
|
|
175
|
-
this.
|
|
174
|
+
th(t) {
|
|
175
|
+
this.Ie() &&
|
|
176
176
|
null != t.parentNode &&
|
|
177
177
|
this.orientation !== InAppMessage.Orientation.LANDSCAPE &&
|
|
178
178
|
(null != t.parentNode.classList &&
|
|
179
|
-
t.parentNode.classList.add(InAppMessage.
|
|
179
|
+
t.parentNode.classList.add(InAppMessage.Yi),
|
|
180
180
|
document.body.addEventListener(
|
|
181
181
|
"touchmove",
|
|
182
|
-
InAppMessage.
|
|
182
|
+
InAppMessage.Xi,
|
|
183
183
|
!!Tt() && { passive: !1 }
|
|
184
184
|
)),
|
|
185
|
-
(t.className += " " + InAppMessage.
|
|
185
|
+
(t.className += " " + InAppMessage.Vi);
|
|
186
186
|
}
|
|
187
|
-
static
|
|
187
|
+
static sh(t) {
|
|
188
188
|
if (
|
|
189
|
-
t.keyCode === at.
|
|
190
|
-
!e.nn(T.
|
|
189
|
+
t.keyCode === at.ih &&
|
|
190
|
+
!e.nn(T.eh) &&
|
|
191
191
|
document.querySelectorAll(".ab-modal-interactions").length > 0
|
|
192
192
|
) {
|
|
193
193
|
const t = document.getElementsByClassName("ab-html-message");
|
|
@@ -206,33 +206,33 @@ export default class InAppMessage {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
|
-
|
|
210
|
-
this.
|
|
211
|
-
e.nn(T.
|
|
212
|
-
(document.addEventListener("keydown", InAppMessage.
|
|
213
|
-
e.
|
|
214
|
-
document.removeEventListener("keydown", InAppMessage.
|
|
209
|
+
hh() {
|
|
210
|
+
this.nh ||
|
|
211
|
+
e.nn(T.eh) ||
|
|
212
|
+
(document.addEventListener("keydown", InAppMessage.sh, !1),
|
|
213
|
+
e.rh(() => {
|
|
214
|
+
document.removeEventListener("keydown", InAppMessage.sh);
|
|
215
215
|
}),
|
|
216
|
-
(this.
|
|
216
|
+
(this.nh = !0));
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
(InAppMessage.
|
|
220
|
-
|
|
221
|
-
|
|
219
|
+
(InAppMessage.Ji = {
|
|
220
|
+
Li: 4281545523,
|
|
221
|
+
Hi: 4294967295,
|
|
222
222
|
Ci: 4278219733,
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
223
|
+
oh: 4293914607,
|
|
224
|
+
lh: 4283782485,
|
|
225
|
+
Ri: 3224580915,
|
|
226
|
+
Oi: 4288387995
|
|
227
227
|
}),
|
|
228
|
-
(InAppMessage.
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
228
|
+
(InAppMessage.Ge = {
|
|
229
|
+
Eh: "hd",
|
|
230
|
+
Ee: "ias",
|
|
231
|
+
uh: "of",
|
|
232
|
+
Th: "do",
|
|
233
|
+
Gi: "umt",
|
|
234
|
+
$i: "tf",
|
|
235
|
+
ah: "te"
|
|
236
236
|
}),
|
|
237
237
|
(InAppMessage.SlideFrom = { TOP: "TOP", BOTTOM: "BOTTOM" }),
|
|
238
238
|
(InAppMessage.ClickAction = {
|
|
@@ -257,15 +257,15 @@ export default class InAppMessage {
|
|
|
257
257
|
FIT_CENTER: "FIT_CENTER"
|
|
258
258
|
}),
|
|
259
259
|
(InAppMessage.es = {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
mh: "SLIDEUP",
|
|
261
|
+
Ih: "MODAL",
|
|
262
|
+
Ye: "MODAL_STYLED",
|
|
263
263
|
Tr: "FULL",
|
|
264
264
|
el: "WEB_HTML",
|
|
265
265
|
cn: "HTML"
|
|
266
266
|
}),
|
|
267
|
-
(InAppMessage.
|
|
268
|
-
(InAppMessage.
|
|
269
|
-
(InAppMessage.
|
|
270
|
-
(InAppMessage.
|
|
271
|
-
(InAppMessage.
|
|
267
|
+
(InAppMessage.Zi = 500),
|
|
268
|
+
(InAppMessage.Ah = 200),
|
|
269
|
+
(InAppMessage.Vi = "ab-show"),
|
|
270
|
+
(InAppMessage.Qi = "ab-hide"),
|
|
271
|
+
(InAppMessage.Yi = "ab-pause-scrolling");
|
|
@@ -2,8 +2,8 @@ import InAppMessage from "./in-app-message.js";
|
|
|
2
2
|
import { DOMUtils as vt } from "../../util/dom-utils.js";
|
|
3
3
|
export default class SlideUpMessage extends InAppMessage {
|
|
4
4
|
constructor(t, e, o, s, n, i, r, d, u, a, p, l, m, c, v, x, g, f, h, I, M) {
|
|
5
|
-
(x = x || InAppMessage.
|
|
6
|
-
(v = v || InAppMessage.
|
|
5
|
+
(x = x || InAppMessage.Ji.lh),
|
|
6
|
+
(v = v || InAppMessage.Ji.oh),
|
|
7
7
|
super(
|
|
8
8
|
t,
|
|
9
9
|
(e = e || InAppMessage.TextAlignment.START),
|
|
@@ -36,23 +36,23 @@ export default class SlideUpMessage extends InAppMessage {
|
|
|
36
36
|
M
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
Ie() {
|
|
40
40
|
return !1;
|
|
41
41
|
}
|
|
42
|
-
get
|
|
42
|
+
get He() {
|
|
43
43
|
return InAppMessage.TextAlignment.START;
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
Oe() {
|
|
46
46
|
const t = document.createElement("span");
|
|
47
47
|
return t.appendChild(document.createTextNode(this.message)), t;
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
th(t) {
|
|
50
50
|
const e = t.getElementsByClassName("ab-in-app-message")[0];
|
|
51
51
|
vt.eo(e, !0, !0) ||
|
|
52
52
|
(this.slideFrom === InAppMessage.SlideFrom.TOP
|
|
53
53
|
? (e.style.top = "0px")
|
|
54
54
|
: (e.style.bottom = "0px")),
|
|
55
|
-
super.
|
|
55
|
+
super.th(t);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
SlideUpMessage.es = InAppMessage.es.
|
|
58
|
+
SlideUpMessage.es = InAppMessage.es.mh;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export default class wt {
|
|
2
2
|
constructor(t, s, l, n, i) {
|
|
3
3
|
(this.triggerId = t),
|
|
4
|
-
(this.
|
|
5
|
-
(this.
|
|
6
|
-
(this.
|
|
7
|
-
(this
|
|
4
|
+
(this.Ni = s),
|
|
5
|
+
(this.Bi = l),
|
|
6
|
+
(this.qi = n),
|
|
7
|
+
(this.xi = i);
|
|
8
8
|
}
|
|
9
9
|
static fromJson(t, s, l, n, i) {
|
|
10
10
|
return null == t || null == t.trigger_id
|
|
@@ -7,9 +7,9 @@ export function automaticallyShowInAppMessages() {
|
|
|
7
7
|
if (!e.rr()) return;
|
|
8
8
|
ss();
|
|
9
9
|
const s = pe.m();
|
|
10
|
-
if (null == s.
|
|
10
|
+
if (null == s.gi()) {
|
|
11
11
|
const r = subscribeToInAppMessage(s => showInAppMessage(s));
|
|
12
|
-
s.
|
|
12
|
+
s.fi(r);
|
|
13
13
|
}
|
|
14
|
-
return s.
|
|
14
|
+
return s.gi();
|
|
15
15
|
}
|
|
@@ -5,17 +5,17 @@ import InAppMessage from "../models/in-app-message.js";
|
|
|
5
5
|
import SlideUpMessage from "../models/slide-up-message.js";
|
|
6
6
|
import pe from "../in-app-message-manager-factory.js";
|
|
7
7
|
import se from "../display/get-animation-effect.js";
|
|
8
|
-
import
|
|
8
|
+
import ce from "../display/in-app-message-to-html.js";
|
|
9
9
|
import { logInAppMessageImpression } from "../log-in-app-message-impression.js";
|
|
10
10
|
import {
|
|
11
|
-
ORIENTATION as
|
|
11
|
+
ORIENTATION as le,
|
|
12
12
|
WindowUtils as H
|
|
13
13
|
} from "../../util/window-utils.js";
|
|
14
14
|
import { isURIJavascriptOrData as j } from "../../util/url-utils.js";
|
|
15
15
|
import { KeyCodes as at } from "../../util/key-codes.js";
|
|
16
16
|
import { setupInAppMessageUI as ss } from "../../ui/js/index.js";
|
|
17
17
|
import r from "../../../shared-lib/braze-shared-lib.js";
|
|
18
|
-
import { toRgba as
|
|
18
|
+
import { toRgba as ne } from "../../util/color-utils.js";
|
|
19
19
|
export function showInAppMessage(t, s, o) {
|
|
20
20
|
if (!e.rr()) return;
|
|
21
21
|
if ((ss(), null == t)) return !1;
|
|
@@ -29,35 +29,35 @@ export function showInAppMessage(t, s, o) {
|
|
|
29
29
|
);
|
|
30
30
|
if (!(t instanceof InAppMessage)) return !1;
|
|
31
31
|
const i = pe.m();
|
|
32
|
-
t.
|
|
32
|
+
t.hh();
|
|
33
33
|
const n = t instanceof HtmlMessage;
|
|
34
34
|
if (n && !t.trusted && !e.tr())
|
|
35
35
|
return (
|
|
36
36
|
r.D.error(
|
|
37
37
|
'HTML in-app messages are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable these messages.'
|
|
38
38
|
),
|
|
39
|
-
i.
|
|
39
|
+
i.di(t.triggerId, InAppMessage.Ge.Eh),
|
|
40
40
|
!1
|
|
41
41
|
);
|
|
42
|
-
if ((null == s && (s = document.body), t.
|
|
42
|
+
if ((null == s && (s = document.body), t.Ie())) {
|
|
43
43
|
if (s.querySelectorAll(".ab-modal-interactions").length > 0)
|
|
44
44
|
return (
|
|
45
45
|
r.D.info(
|
|
46
46
|
`Cannot show in-app message ${t.message} because another message is being shown.`
|
|
47
47
|
),
|
|
48
|
-
i.
|
|
48
|
+
i.di(t.triggerId, InAppMessage.Ge.Ee),
|
|
49
49
|
!1
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
if (H.so()) {
|
|
53
53
|
const e = H.io();
|
|
54
54
|
if (
|
|
55
|
-
(e ===
|
|
55
|
+
(e === le.PORTRAIT &&
|
|
56
56
|
t.orientation === InAppMessage.Orientation.LANDSCAPE) ||
|
|
57
|
-
(e ===
|
|
57
|
+
(e === le.LANDSCAPE &&
|
|
58
58
|
t.orientation === InAppMessage.Orientation.PORTRAIT)
|
|
59
59
|
) {
|
|
60
|
-
const s = e ===
|
|
60
|
+
const s = e === le.PORTRAIT ? "portrait" : "landscape",
|
|
61
61
|
o =
|
|
62
62
|
t.orientation === InAppMessage.Orientation.PORTRAIT
|
|
63
63
|
? "portrait"
|
|
@@ -66,7 +66,7 @@ export function showInAppMessage(t, s, o) {
|
|
|
66
66
|
r.D.info(
|
|
67
67
|
`Not showing ${o} in-app message ${t.message} because the screen is currently ${s}`
|
|
68
68
|
),
|
|
69
|
-
i.
|
|
69
|
+
i.di(t.triggerId, InAppMessage.Ge.uh),
|
|
70
70
|
!1
|
|
71
71
|
);
|
|
72
72
|
}
|
|
@@ -86,7 +86,7 @@ export function showInAppMessage(t, s, o) {
|
|
|
86
86
|
r.D.error(
|
|
87
87
|
'Javascript click actions are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable these actions.'
|
|
88
88
|
),
|
|
89
|
-
i.
|
|
89
|
+
i.di(t.triggerId, InAppMessage.Ge.Eh),
|
|
90
90
|
!1
|
|
91
91
|
);
|
|
92
92
|
}
|
|
@@ -107,28 +107,28 @@ export function showInAppMessage(t, s, o) {
|
|
|
107
107
|
document.getElementsByTagName("head")[0].appendChild(s);
|
|
108
108
|
}
|
|
109
109
|
const l = t instanceof SlideUpMessage,
|
|
110
|
-
m =
|
|
110
|
+
m = ce(
|
|
111
111
|
t,
|
|
112
112
|
() => {
|
|
113
113
|
import("../../Feed/ui/show-feed.js").then(e => e.showFeed());
|
|
114
114
|
},
|
|
115
115
|
s => {
|
|
116
|
-
if (t.
|
|
116
|
+
if (t.Ie() && t.ll()) {
|
|
117
117
|
const o = document.createElement("div");
|
|
118
118
|
if (
|
|
119
119
|
((o.className = "ab-page-blocker"),
|
|
120
|
-
t.sn() || (o.style.backgroundColor =
|
|
120
|
+
t.sn() || (o.style.backgroundColor = ne(t.frameColor)),
|
|
121
121
|
e.nn(T.no) && (o.style.zIndex = e.nn(T.no)),
|
|
122
122
|
a.appendChild(o),
|
|
123
|
-
!e.nn(T.
|
|
123
|
+
!e.nn(T.eh))
|
|
124
124
|
) {
|
|
125
125
|
const e = new Date().valueOf();
|
|
126
126
|
o.onclick = o => {
|
|
127
|
-
new Date().valueOf() - e > InAppMessage.
|
|
127
|
+
new Date().valueOf() - e > InAppMessage.Ah &&
|
|
128
128
|
(t.on(s), o.stopPropagation());
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
|
-
a.appendChild(s), s.focus(), t.
|
|
131
|
+
a.appendChild(s), s.focus(), t.th(a);
|
|
132
132
|
} else if (l) {
|
|
133
133
|
const e = document.querySelectorAll(".ab-slideup");
|
|
134
134
|
let o = null;
|
|
@@ -149,10 +149,10 @@ export function showInAppMessage(t, s, o) {
|
|
|
149
149
|
o.offsetTop),
|
|
150
150
|
(s.style.bottom = Math.max(e, 0) + "px");
|
|
151
151
|
}
|
|
152
|
-
} else if (n && !e.nn(T.
|
|
152
|
+
} else if (n && !e.nn(T.eh)) {
|
|
153
153
|
const e = t;
|
|
154
154
|
s.contentWindow.addEventListener("keydown", function(t) {
|
|
155
|
-
t.keyCode === at.
|
|
155
|
+
t.keyCode === at.ih && e.closeMessage();
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
logInAppMessageImpression(t),
|
|
@@ -162,9 +162,12 @@ export function showInAppMessage(t, s, o) {
|
|
|
162
162
|
}, t.duration),
|
|
163
163
|
"function" == typeof o && o();
|
|
164
164
|
},
|
|
165
|
+
(e, s) => {
|
|
166
|
+
r.D.info(e), i.di(t.triggerId, s);
|
|
167
|
+
},
|
|
165
168
|
e.nn(T.lo),
|
|
166
169
|
e.nn(T.no),
|
|
167
170
|
e.nn(T.ao)
|
|
168
171
|
);
|
|
169
|
-
return (n || l) && (a.appendChild(m), t.
|
|
172
|
+
return (n || l) && (a.appendChild(m), t.th(a)), !0;
|
|
170
173
|
}
|