@braze/web-sdk 5.7.0 → 5.8.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 +4 -4
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +8 -8
- package/shared-lib/indexed-db-adapter.js +7 -7
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +17 -17
- package/src/Banner/get-all-banners.js +2 -3
- package/src/Banner/get-banner.js +11 -11
- package/src/Banner/request-banners-refresh.js +20 -12
- package/src/Banner/subscribe-to-banners-updates.js +14 -13
- package/src/Banner/ui/insert-banner.js +11 -9
- package/src/Card/log-card-impressions.js +2 -2
- package/src/ContentCards/content-cards-provider-factory.js +1 -1
- package/src/ContentCards/content-cards.js +3 -3
- 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 +3 -3
- package/src/Core/disable-sdk.js +5 -5
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/get-user.js +1 -1
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/open-session.js +6 -6
- package/src/Core/wipe-data.js +1 -1
- package/src/FeatureFlags/feature-flag-factory.js +4 -4
- package/src/FeatureFlags/feature-flag.js +17 -17
- package/src/FeatureFlags/feature-flags-provider.js +37 -37
- package/src/FeatureFlags/get-all-feature-flags.js +6 -7
- package/src/FeatureFlags/get-feature-flag.js +5 -6
- package/src/FeatureFlags/log-feature-flag-impression.js +3 -3
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
- package/src/Feed/feed.js +2 -2
- package/src/Feed/ui/show-feed.js +4 -4
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +6 -6
- package/src/InAppMessage/display/in-app-message-to-html.js +18 -18
- package/src/InAppMessage/display/modal-utils.js +4 -4
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager-factory.js +1 -1
- package/src/InAppMessage/in-app-message-manager.js +49 -49
- package/src/InAppMessage/log-in-app-message-button-click.js +1 -1
- package/src/InAppMessage/log-in-app-message-click.js +1 -1
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/control-message.js +1 -1
- package/src/InAppMessage/models/full-screen-message.js +3 -3
- package/src/InAppMessage/models/html-message.js +5 -5
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +32 -32
- package/src/InAppMessage/models/modal-message.js +3 -3
- package/src/InAppMessage/models/slide-up-message.js +6 -6
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/ui/show-in-app-message.js +18 -18
- package/src/Push/push-manager-factory.js +8 -8
- package/src/Push/push-manager.js +83 -83
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +6 -6
- package/src/User/user.js +18 -18
- package/src/common/base-feed.js +3 -3
- package/src/common/event-logger.js +1 -1
- package/src/common/feed-display.js +8 -8
- package/src/l10n/l10n-manager-factory.js +2 -2
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/braze-instance.js +107 -107
- package/src/managers/device-manager.js +18 -18
- package/src/managers/network-manager.js +117 -117
- package/src/managers/server-config-manager.js +61 -61
- package/src/managers/session-manager.js +25 -25
- package/src/managers/storage-manager-factory.js +8 -8
- package/src/managers/storage-manager.js +57 -57
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +2 -2
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +10 -10
- package/src/models/push-token.js +7 -7
- package/src/models/server-config.js +30 -30
- package/src/request-controller.js +93 -93
- package/src/triggers/models/filter-set.js +4 -4
- package/src/triggers/models/filter.js +1 -1
- package/src/triggers/models/trigger-condition.js +29 -29
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +9 -9
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +15 -15
- 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 +3 -3
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +5 -5
- package/src/util/client-hints-parser.js +1 -1
- package/src/util/component-utils.js +1 -1
- package/src/util/dom-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +1 -1
- package/src/util/request-header-utils.js +13 -13
- package/src/util/user-agent-parser.js +1 -1
- package/src/util/validation-utils.js +4 -4
- package/src/util/window-utils.js +1 -1
|
@@ -77,7 +77,7 @@ export default class ea {
|
|
|
77
77
|
(n =
|
|
78
78
|
t instanceof ControlMessage
|
|
79
79
|
? { trigger_ids: [t.triggerId] }
|
|
80
|
-
: this.
|
|
80
|
+
: this.wr(t)),
|
|
81
81
|
null == n
|
|
82
82
|
? r
|
|
83
83
|
: (t.messageExtras && (n.message_extras = t.messageExtras),
|
|
@@ -85,7 +85,7 @@ export default class ea {
|
|
|
85
85
|
c.cs(e, n))
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
Br(t, e) {
|
|
89
89
|
const s = new E();
|
|
90
90
|
if (!t.rt())
|
|
91
91
|
return (
|
|
@@ -94,32 +94,32 @@ export default class ea {
|
|
|
94
94
|
),
|
|
95
95
|
s
|
|
96
96
|
);
|
|
97
|
-
const i = this.
|
|
97
|
+
const i = this.wr(e);
|
|
98
98
|
return null == i
|
|
99
99
|
? s
|
|
100
|
-
: t.id === InAppMessageButton.
|
|
100
|
+
: t.id === InAppMessageButton._r
|
|
101
101
|
? (N.info(
|
|
102
102
|
"This in-app message button does not have a tracking id. Not logging event to Braze servers.",
|
|
103
103
|
),
|
|
104
104
|
s)
|
|
105
105
|
: (null != t.id && (i.bid = t.id), c.cs(d.Tr, i));
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
qr(t) {
|
|
108
108
|
const e = t.messageFields;
|
|
109
109
|
return (null != e && e.is_push_primer) || !1;
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
Er(t) {
|
|
112
112
|
if (!(t instanceof InAppMessage)) return;
|
|
113
113
|
const e = (t) => {
|
|
114
114
|
if (!t) return;
|
|
115
115
|
const e = eo(t);
|
|
116
116
|
return ft(e)
|
|
117
|
-
? dt(jt.
|
|
118
|
-
: gt(e) && !vt.
|
|
119
|
-
? dt(jt
|
|
117
|
+
? dt(jt.Gr, "In-App Message")
|
|
118
|
+
: gt(e) && !vt.Nr()
|
|
119
|
+
? dt(jt.$r, "In-App Message")
|
|
120
120
|
: void 0;
|
|
121
121
|
};
|
|
122
|
-
if (this.
|
|
122
|
+
if (this.qr(t) && !vt.Nr())
|
|
123
123
|
return "In-App Message contains a push prompt, but is not eligible for a push prompt. Ignoring.";
|
|
124
124
|
const s = t.buttons || [];
|
|
125
125
|
let i;
|
|
@@ -137,29 +137,29 @@ export default class ea {
|
|
|
137
137
|
? e(t.uri)
|
|
138
138
|
: void 0;
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
e !== this.Qi && this.
|
|
140
|
+
Cr(t, e) {
|
|
141
|
+
e !== this.Qi && this.Or(), (this.Xi = t), (this.Qi = e);
|
|
142
142
|
}
|
|
143
|
-
|
|
143
|
+
Or() {
|
|
144
144
|
null != this.Xi &&
|
|
145
145
|
(clearTimeout(this.Xi), (this.Xi = null), (this.Qi = null));
|
|
146
146
|
}
|
|
147
|
-
|
|
147
|
+
Xr(t, e, s, i) {
|
|
148
148
|
const r = this.S;
|
|
149
149
|
if (!r) return;
|
|
150
|
-
this.Qi && t.triggerId !== this.Qi && (this.
|
|
151
|
-
const n = r.
|
|
150
|
+
this.Qi && t.triggerId !== this.Qi && (this.Or(), h.zi(this.C, h.O.Hr));
|
|
151
|
+
const n = r.Jr(!1, !1),
|
|
152
152
|
o = r.H(n);
|
|
153
153
|
(o.template = { trigger_id: t.triggerId, trigger_event_type: e }),
|
|
154
|
-
null != s && (o.template.data = s.
|
|
155
|
-
const u = r.J(o, h.O.
|
|
154
|
+
null != s && (o.template.data = s.Kr());
|
|
155
|
+
const u = r.J(o, h.O.Hr);
|
|
156
156
|
r.V(
|
|
157
157
|
o,
|
|
158
158
|
(r = -1) => {
|
|
159
159
|
const n = this.S;
|
|
160
160
|
if (!n) return;
|
|
161
161
|
const p = new Date().valueOf();
|
|
162
|
-
h.W(this.C, h.O.
|
|
162
|
+
h.W(this.C, h.O.Hr, p),
|
|
163
163
|
-1 !== r && u.push(["X-Braze-Req-Tokens-Remaining", r.toString()]);
|
|
164
164
|
let m,
|
|
165
165
|
c,
|
|
@@ -170,16 +170,16 @@ export default class ea {
|
|
|
170
170
|
headers: u,
|
|
171
171
|
ss: (e) => {
|
|
172
172
|
if (!n.ts(o, e, u))
|
|
173
|
-
return void ("function" == typeof t.
|
|
173
|
+
return void ("function" == typeof t.Lr && t.Lr());
|
|
174
174
|
if ((n.es(), null == e || null == e.templated_message)) return;
|
|
175
175
|
const s = e.templated_message;
|
|
176
|
-
if (s.type !== pt.
|
|
176
|
+
if (s.type !== pt.Ur.Qr) return;
|
|
177
177
|
const i = ut(s.data);
|
|
178
178
|
if (null == i) return;
|
|
179
|
-
const r = this.
|
|
179
|
+
const r = this.Er(i);
|
|
180
180
|
if (r)
|
|
181
|
-
return N.error(r), void ("function" == typeof t.
|
|
182
|
-
"function" == typeof t.
|
|
181
|
+
return N.error(r), void ("function" == typeof t.Lr && t.Lr());
|
|
182
|
+
"function" == typeof t.Vr && t.Vr(i);
|
|
183
183
|
},
|
|
184
184
|
error: (e) => {
|
|
185
185
|
(g = !0),
|
|
@@ -187,21 +187,21 @@ export default class ea {
|
|
|
187
187
|
(c = `getting user personalization for message ${t.triggerId}.`);
|
|
188
188
|
},
|
|
189
189
|
rs: (r, o) => {
|
|
190
|
-
if (new Date().valueOf() - t.
|
|
190
|
+
if (new Date().valueOf() - t.Wr < t.Yr) {
|
|
191
191
|
let r = 0;
|
|
192
192
|
if (g) {
|
|
193
|
-
const e = Math.min(t.
|
|
193
|
+
const e = Math.min(t.Yr, this.$i),
|
|
194
194
|
s = this.Pi;
|
|
195
195
|
null == i && (i = s), (r = Math.min(e, a(s, 3 * i)));
|
|
196
196
|
}
|
|
197
197
|
n.os(
|
|
198
198
|
o,
|
|
199
199
|
() => {
|
|
200
|
-
this.
|
|
200
|
+
this.Xr(t, e, s, r);
|
|
201
201
|
},
|
|
202
|
-
h.O.
|
|
203
|
-
(e) => this.
|
|
204
|
-
() => this.
|
|
202
|
+
h.O.Hr,
|
|
203
|
+
(e) => this.Cr(e, t.triggerId),
|
|
204
|
+
() => this.Or(),
|
|
205
205
|
r,
|
|
206
206
|
);
|
|
207
207
|
}
|
|
@@ -209,10 +209,10 @@ export default class ea {
|
|
|
209
209
|
},
|
|
210
210
|
});
|
|
211
211
|
},
|
|
212
|
-
h.O.
|
|
212
|
+
h.O.Hr,
|
|
213
213
|
);
|
|
214
214
|
}
|
|
215
|
-
|
|
215
|
+
wr(t) {
|
|
216
216
|
if (null == t.triggerId)
|
|
217
217
|
return (
|
|
218
218
|
N.info(
|
|
@@ -223,40 +223,40 @@ export default class ea {
|
|
|
223
223
|
const e = {};
|
|
224
224
|
return null != t.triggerId && (e.trigger_ids = [t.triggerId]), e;
|
|
225
225
|
}
|
|
226
|
-
|
|
226
|
+
Oe(e) {
|
|
227
227
|
return (
|
|
228
228
|
!!this.C &&
|
|
229
229
|
!(
|
|
230
230
|
!(e && e instanceof InAppMessage && e.constructor !== InAppMessage) ||
|
|
231
231
|
e instanceof ControlMessage
|
|
232
232
|
) &&
|
|
233
|
-
this.C.Bs(t.gs.
|
|
233
|
+
this.C.Bs(t.gs.Zr, e.bs())
|
|
234
234
|
);
|
|
235
235
|
}
|
|
236
236
|
Ar() {
|
|
237
237
|
if (!this.C) return null;
|
|
238
|
-
const e = this.C.vs(t.gs.
|
|
238
|
+
const e = this.C.vs(t.gs.Zr);
|
|
239
239
|
if (!e) return null;
|
|
240
240
|
let s;
|
|
241
241
|
switch (e.type) {
|
|
242
|
-
case InAppMessage.
|
|
243
|
-
s = FullScreenMessage.
|
|
242
|
+
case InAppMessage.Ze.sn:
|
|
243
|
+
s = FullScreenMessage.on(e);
|
|
244
244
|
break;
|
|
245
|
-
case InAppMessage.
|
|
246
|
-
case InAppMessage.
|
|
247
|
-
case InAppMessage.
|
|
248
|
-
s = HtmlMessage.
|
|
245
|
+
case InAppMessage.Ze.an:
|
|
246
|
+
case InAppMessage.Ze.Ye:
|
|
247
|
+
case InAppMessage.Ze.Ao:
|
|
248
|
+
s = HtmlMessage.on(e);
|
|
249
249
|
break;
|
|
250
|
-
case InAppMessage.
|
|
251
|
-
case InAppMessage.
|
|
252
|
-
s = ModalMessage.
|
|
250
|
+
case InAppMessage.Ze.ln:
|
|
251
|
+
case InAppMessage.Ze.Io:
|
|
252
|
+
s = ModalMessage.on(e);
|
|
253
253
|
break;
|
|
254
|
-
case InAppMessage.
|
|
255
|
-
s = SlideUpMessage.
|
|
254
|
+
case InAppMessage.Ze.un:
|
|
255
|
+
s = SlideUpMessage.on(e);
|
|
256
256
|
}
|
|
257
|
-
return s && this.
|
|
257
|
+
return s && this.pn(), s;
|
|
258
258
|
}
|
|
259
|
-
|
|
260
|
-
this.C && this.C.Es(t.gs.
|
|
259
|
+
pn() {
|
|
260
|
+
this.C && this.C.Es(t.gs.Zr);
|
|
261
261
|
}
|
|
262
262
|
}
|
|
@@ -12,7 +12,7 @@ export function logInAppMessageButtonClick(o, t) {
|
|
|
12
12
|
if (!(o instanceof InAppMessageButton))
|
|
13
13
|
return N.error("button must be an InAppMessageButton object"), !1;
|
|
14
14
|
if (!(t instanceof InAppMessage)) return N.error(sr), !1;
|
|
15
|
-
const s = se.ea().
|
|
15
|
+
const s = se.ea().Br(o, t);
|
|
16
16
|
if (s.ss)
|
|
17
17
|
for (let r = 0; r < s.fe.length; r++)
|
|
18
18
|
ot.m().ue(
|
|
@@ -11,7 +11,7 @@ export function logInAppMessageClick(o) {
|
|
|
11
11
|
if (!(o instanceof InAppMessage)) return N.error(sr), !1;
|
|
12
12
|
const s = se.ea().cs(o, d.Mr);
|
|
13
13
|
if (s) {
|
|
14
|
-
o.
|
|
14
|
+
o.zo() || logInAppMessageImpression(o);
|
|
15
15
|
for (let r = 0; r < s.fe.length; r++)
|
|
16
16
|
ot.m().ue(et.Bo, [o.triggerId], s.fe[r]);
|
|
17
17
|
}
|
|
@@ -8,6 +8,6 @@ export function logInAppMessageImpression(o) {
|
|
|
8
8
|
if (!r.rr()) return !1;
|
|
9
9
|
if (!(o instanceof InAppMessage || o instanceof ControlMessage))
|
|
10
10
|
return N.error(sr), !1;
|
|
11
|
-
const s = o instanceof ControlMessage ? d.
|
|
11
|
+
const s = o instanceof ControlMessage ? d.qo : d.Ir;
|
|
12
12
|
return se.ea().cs(o, s).ss;
|
|
13
13
|
}
|
|
@@ -66,12 +66,12 @@ export default class FullScreenMessage extends InAppMessage {
|
|
|
66
66
|
A,
|
|
67
67
|
B,
|
|
68
68
|
),
|
|
69
|
-
(this.
|
|
69
|
+
(this.ho = InAppMessage.TextAlignment.CENTER);
|
|
70
70
|
}
|
|
71
71
|
bs() {
|
|
72
72
|
return super.bs(FullScreenMessage.Dt);
|
|
73
73
|
}
|
|
74
|
-
static
|
|
74
|
+
static on(e) {
|
|
75
75
|
return new FullScreenMessage(
|
|
76
76
|
e[InAppMessage.qt.ra],
|
|
77
77
|
e[InAppMessage.qt.sa],
|
|
@@ -105,4 +105,4 @@ export default class FullScreenMessage extends InAppMessage {
|
|
|
105
105
|
);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
FullScreenMessage.Dt = InAppMessage.
|
|
108
|
+
FullScreenMessage.Dt = InAppMessage.Ze.sn;
|
|
@@ -40,7 +40,7 @@ export default class HtmlMessage extends InAppMessage {
|
|
|
40
40
|
return !1;
|
|
41
41
|
}
|
|
42
42
|
rt(i) {
|
|
43
|
-
if (this.
|
|
43
|
+
if (this.We === InAppMessage.Ze.an) {
|
|
44
44
|
if (this.So) return !1;
|
|
45
45
|
this.So = !0;
|
|
46
46
|
}
|
|
@@ -48,9 +48,9 @@ export default class HtmlMessage extends InAppMessage {
|
|
|
48
48
|
}
|
|
49
49
|
bs() {
|
|
50
50
|
const i = super.bs(HtmlMessage.Dt);
|
|
51
|
-
return (i[InAppMessage.qt.
|
|
51
|
+
return (i[InAppMessage.qt.Do] = this.messageFields), i;
|
|
52
52
|
}
|
|
53
|
-
static
|
|
53
|
+
static on(i) {
|
|
54
54
|
return new HtmlMessage(
|
|
55
55
|
i[InAppMessage.qt.ra],
|
|
56
56
|
i[InAppMessage.qt.St],
|
|
@@ -62,9 +62,9 @@ export default class HtmlMessage extends InAppMessage {
|
|
|
62
62
|
i[InAppMessage.qt.wa],
|
|
63
63
|
i[InAppMessage.qt.ka],
|
|
64
64
|
i[InAppMessage.qt.CSS],
|
|
65
|
-
i[InAppMessage.qt.
|
|
65
|
+
i[InAppMessage.qt.Do],
|
|
66
66
|
i[InAppMessage.qt.qa],
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
HtmlMessage.Dt = InAppMessage.
|
|
70
|
+
HtmlMessage.Dt = InAppMessage.Ze.an;
|
|
@@ -15,7 +15,7 @@ export default class InAppMessageButton {
|
|
|
15
15
|
(this.borderColor = r || this.backgroundColor),
|
|
16
16
|
(this.clickAction = h || InAppMessage.ClickAction.NONE),
|
|
17
17
|
(this.uri = e),
|
|
18
|
-
null == n && (n = InAppMessageButton.
|
|
18
|
+
null == n && (n = InAppMessageButton._r),
|
|
19
19
|
(this.id = n),
|
|
20
20
|
(this.So = !1),
|
|
21
21
|
(this._t = new u());
|
|
@@ -44,4 +44,4 @@ export default class InAppMessageButton {
|
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
InAppMessageButton.
|
|
47
|
+
InAppMessageButton._r = -1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import r, { OPTIONS as
|
|
1
|
+
import r, { OPTIONS as w } from "../../managers/braze-instance.js";
|
|
2
2
|
import ro from "../../util/browser-detector.js";
|
|
3
3
|
import {
|
|
4
4
|
clickElement as Et,
|
|
@@ -107,11 +107,11 @@ export default class InAppMessage {
|
|
|
107
107
|
(this.st = !1),
|
|
108
108
|
(this.So = !1),
|
|
109
109
|
(this.Th = !1),
|
|
110
|
-
(this.
|
|
111
|
-
(this.
|
|
110
|
+
(this.do = null),
|
|
111
|
+
(this.uo = null),
|
|
112
112
|
(this._t = new u()),
|
|
113
113
|
(this.oh = new u()),
|
|
114
|
-
(this.
|
|
114
|
+
(this.ho = InAppMessage.TextAlignment.CENTER);
|
|
115
115
|
}
|
|
116
116
|
subscribeToClickedEvent(t) {
|
|
117
117
|
return this._t.Fs(t);
|
|
@@ -126,27 +126,27 @@ export default class InAppMessage {
|
|
|
126
126
|
this._t.removeAllSubscriptions(), this.oh.removeAllSubscriptions();
|
|
127
127
|
}
|
|
128
128
|
closeMessage() {
|
|
129
|
-
this.ll(this.
|
|
129
|
+
this.ll(this.do);
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
bo() {
|
|
132
132
|
return !0;
|
|
133
133
|
}
|
|
134
134
|
Po() {
|
|
135
|
-
return this.
|
|
135
|
+
return this.bo();
|
|
136
136
|
}
|
|
137
|
-
|
|
137
|
+
lo() {
|
|
138
138
|
return null != this.htmlId && this.htmlId.length > 4;
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
return this.
|
|
140
|
+
Qe() {
|
|
141
|
+
return this.lo() && null != this.css && this.css.length > 0;
|
|
142
142
|
}
|
|
143
|
-
|
|
144
|
-
if (this.
|
|
143
|
+
Ve() {
|
|
144
|
+
if (this.lo() && this.Qe()) return this.htmlId + "-css";
|
|
145
145
|
}
|
|
146
146
|
wt() {
|
|
147
147
|
return !this.st && ((this.st = !0), !0);
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
zo() {
|
|
150
150
|
return this.st;
|
|
151
151
|
}
|
|
152
152
|
rt(t) {
|
|
@@ -158,7 +158,7 @@ export default class InAppMessage {
|
|
|
158
158
|
hide(t) {
|
|
159
159
|
if (t && t.parentNode) {
|
|
160
160
|
let s = t.closest(".ab-iam-root");
|
|
161
|
-
if ((null == s && (s = t), this.
|
|
161
|
+
if ((null == s && (s = t), this.bo() && null != s.parentNode)) {
|
|
162
162
|
const t = s.parentNode.classList;
|
|
163
163
|
t && t.contains(InAppMessage.rh) && t.remove(InAppMessage.rh),
|
|
164
164
|
document.body.removeEventListener("touchmove", InAppMessage.lh);
|
|
@@ -170,7 +170,7 @@ export default class InAppMessage {
|
|
|
170
170
|
ll(t, s) {
|
|
171
171
|
if (null == t) return;
|
|
172
172
|
let i;
|
|
173
|
-
(this.
|
|
173
|
+
(this.do = null),
|
|
174
174
|
(i =
|
|
175
175
|
-1 === t.className.indexOf("ab-in-app-message")
|
|
176
176
|
? t.getElementsByClassName("ab-in-app-message")[0]
|
|
@@ -185,7 +185,7 @@ export default class InAppMessage {
|
|
|
185
185
|
let s = t.closest(".ab-iam-root");
|
|
186
186
|
null == s && (s = t), s.parentNode && s.parentNode.removeChild(s);
|
|
187
187
|
}
|
|
188
|
-
const i = this.
|
|
188
|
+
const i = this.Ve();
|
|
189
189
|
if (null != i) {
|
|
190
190
|
const t = document.getElementById(i);
|
|
191
191
|
t && t.parentNode && t.parentNode.removeChild(t);
|
|
@@ -193,14 +193,14 @@ export default class InAppMessage {
|
|
|
193
193
|
null != e && "Safari" === ro.browser && (e.scrollTop = E),
|
|
194
194
|
s ? s() : this.ft();
|
|
195
195
|
};
|
|
196
|
-
h ? setTimeout(n, InAppMessage.Ih) : n(), this.
|
|
196
|
+
h ? setTimeout(n, InAppMessage.Ih) : n(), this.uo && this.uo.focus();
|
|
197
197
|
}
|
|
198
|
-
|
|
198
|
+
vo() {
|
|
199
199
|
return document.createTextNode(this.message || "");
|
|
200
200
|
}
|
|
201
|
-
|
|
201
|
+
jo(t) {
|
|
202
202
|
let s = "";
|
|
203
|
-
this.message || this.header || !this.
|
|
203
|
+
this.message || this.header || !this.bo() || (s = "Modal Image"),
|
|
204
204
|
t.setAttribute("alt", s);
|
|
205
205
|
}
|
|
206
206
|
static lh(t) {
|
|
@@ -216,7 +216,7 @@ export default class InAppMessage {
|
|
|
216
216
|
}
|
|
217
217
|
Ah(t) {
|
|
218
218
|
const s = t.parentNode;
|
|
219
|
-
this.
|
|
219
|
+
this.bo() &&
|
|
220
220
|
null != s &&
|
|
221
221
|
this.orientation !== InAppMessage.Orientation.LANDSCAPE &&
|
|
222
222
|
(null != s.classList && s.classList.add(InAppMessage.rh),
|
|
@@ -230,7 +230,7 @@ export default class InAppMessage {
|
|
|
230
230
|
static Oh(t) {
|
|
231
231
|
if (
|
|
232
232
|
t.keyCode === mt._h &&
|
|
233
|
-
!r.
|
|
233
|
+
!r.ee(w.mh) &&
|
|
234
234
|
document.querySelectorAll(".ab-modal-interactions").length > 0
|
|
235
235
|
) {
|
|
236
236
|
const t = document.getElementsByClassName("ab-html-message");
|
|
@@ -254,7 +254,7 @@ export default class InAppMessage {
|
|
|
254
254
|
}
|
|
255
255
|
Lh() {
|
|
256
256
|
this.nh ||
|
|
257
|
-
r.
|
|
257
|
+
r.ee(w.mh) ||
|
|
258
258
|
(document.addEventListener("keydown", InAppMessage.Oh, !1),
|
|
259
259
|
r.Nh(() => {
|
|
260
260
|
document.removeEventListener("keydown", InAppMessage.Oh);
|
|
@@ -308,9 +308,9 @@ export default class InAppMessage {
|
|
|
308
308
|
Eh: 3224580915,
|
|
309
309
|
eh: 4288387995,
|
|
310
310
|
}),
|
|
311
|
-
(InAppMessage.
|
|
311
|
+
(InAppMessage.fo = {
|
|
312
312
|
Dh: "hd",
|
|
313
|
-
|
|
313
|
+
po: "ias",
|
|
314
314
|
Ch: "of",
|
|
315
315
|
dh: "do",
|
|
316
316
|
Uh: "umt",
|
|
@@ -339,13 +339,13 @@ export default class InAppMessage {
|
|
|
339
339
|
CENTER_CROP: "CENTER_CROP",
|
|
340
340
|
FIT_CENTER: "FIT_CENTER",
|
|
341
341
|
}),
|
|
342
|
-
(InAppMessage.
|
|
343
|
-
|
|
344
|
-
|
|
342
|
+
(InAppMessage.Ze = {
|
|
343
|
+
un: "SLIDEUP",
|
|
344
|
+
ln: "MODAL",
|
|
345
345
|
Io: "MODAL_STYLED",
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
346
|
+
sn: "FULL",
|
|
347
|
+
an: "WEB_HTML",
|
|
348
|
+
Ye: "HTML",
|
|
349
349
|
Ao: "HTML_FULL",
|
|
350
350
|
}),
|
|
351
351
|
(InAppMessage.Ih = 500),
|
|
@@ -384,6 +384,6 @@ export default class InAppMessage {
|
|
|
384
384
|
ka: "hi",
|
|
385
385
|
CSS: "css",
|
|
386
386
|
zt: "type",
|
|
387
|
-
|
|
387
|
+
Do: "messageFields",
|
|
388
388
|
qa: "me",
|
|
389
389
|
});
|
|
@@ -63,12 +63,12 @@ export default class ModalMessage extends InAppMessage {
|
|
|
63
63
|
q,
|
|
64
64
|
A,
|
|
65
65
|
),
|
|
66
|
-
(this.
|
|
66
|
+
(this.ho = InAppMessage.TextAlignment.CENTER);
|
|
67
67
|
}
|
|
68
68
|
bs() {
|
|
69
69
|
return super.bs(ModalMessage.Dt);
|
|
70
70
|
}
|
|
71
|
-
static
|
|
71
|
+
static on(e) {
|
|
72
72
|
return new ModalMessage(
|
|
73
73
|
e[InAppMessage.qt.ra],
|
|
74
74
|
e[InAppMessage.qt.sa],
|
|
@@ -101,4 +101,4 @@ export default class ModalMessage extends InAppMessage {
|
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
ModalMessage.Dt = InAppMessage.
|
|
104
|
+
ModalMessage.Dt = InAppMessage.Ze.ln;
|
|
@@ -59,18 +59,18 @@ export default class SlideUpMessage extends InAppMessage {
|
|
|
59
59
|
M,
|
|
60
60
|
b,
|
|
61
61
|
),
|
|
62
|
-
(this.
|
|
62
|
+
(this.ho = InAppMessage.TextAlignment.START);
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
bo() {
|
|
65
65
|
return !1;
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
vo() {
|
|
68
68
|
const e = document.createElement("span");
|
|
69
69
|
return e.appendChild(document.createTextNode(this.message || "")), e;
|
|
70
70
|
}
|
|
71
71
|
Ah(e) {
|
|
72
72
|
const t = e.getElementsByClassName("ab-in-app-message")[0];
|
|
73
|
-
ue.
|
|
73
|
+
ue.Ho(t, !0, !0) ||
|
|
74
74
|
(this.slideFrom === InAppMessage.SlideFrom.TOP
|
|
75
75
|
? (t.style.top = "0px")
|
|
76
76
|
: (t.style.bottom = "0px")),
|
|
@@ -79,7 +79,7 @@ export default class SlideUpMessage extends InAppMessage {
|
|
|
79
79
|
bs() {
|
|
80
80
|
return super.bs(SlideUpMessage.Dt);
|
|
81
81
|
}
|
|
82
|
-
static
|
|
82
|
+
static on(e) {
|
|
83
83
|
return new SlideUpMessage(
|
|
84
84
|
e[InAppMessage.qt.ra],
|
|
85
85
|
e[InAppMessage.qt.sa],
|
|
@@ -106,4 +106,4 @@ export default class SlideUpMessage extends InAppMessage {
|
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
SlideUpMessage.Dt = InAppMessage.
|
|
109
|
+
SlideUpMessage.Dt = InAppMessage.Ze.un;
|
|
@@ -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.Vr = s),
|
|
5
|
+
(this.Lr = i),
|
|
6
|
+
(this.Wr = h),
|
|
7
|
+
(this.Yr = l),
|
|
8
8
|
(this.triggerId = t),
|
|
9
|
-
(this.
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
12
|
-
(this.
|
|
9
|
+
(this.Vr = s),
|
|
10
|
+
(this.Lr = i),
|
|
11
|
+
(this.Wr = h),
|
|
12
|
+
(this.Yr = l);
|
|
13
13
|
}
|
|
14
14
|
static fromJson(t, s, i, h, l) {
|
|
15
15
|
return null == t || null == t.trigger_id
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import r, { OPTIONS as
|
|
1
|
+
import r, { OPTIONS as w } from "../../managers/braze-instance.js";
|
|
2
2
|
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";
|
|
@@ -33,14 +33,14 @@ export function showInAppMessage(e, t, o) {
|
|
|
33
33
|
if (e.constructor === InAppMessage) return !1;
|
|
34
34
|
e.Lh();
|
|
35
35
|
const s = e instanceof HtmlMessage;
|
|
36
|
-
if (s && !e.trusted && !r.
|
|
36
|
+
if (s && !e.trusted && !r.tr())
|
|
37
37
|
return (
|
|
38
38
|
N.error(
|
|
39
39
|
'HTML in-app messages are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable these messages.',
|
|
40
40
|
),
|
|
41
41
|
!1
|
|
42
42
|
);
|
|
43
|
-
if ((null == t && (t = document.body), e.
|
|
43
|
+
if ((null == t && (t = document.body), e.bo())) {
|
|
44
44
|
if (t.querySelectorAll(".ab-modal-interactions").length > 0)
|
|
45
45
|
return (
|
|
46
46
|
N.info(
|
|
@@ -70,7 +70,7 @@ export function showInAppMessage(e, t, o) {
|
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
if (!r.
|
|
73
|
+
if (!r.tr()) {
|
|
74
74
|
let t = !1;
|
|
75
75
|
if (e.buttons && e.buttons.length > 0) {
|
|
76
76
|
const o = e.buttons;
|
|
@@ -93,15 +93,15 @@ export function showInAppMessage(e, t, o) {
|
|
|
93
93
|
((i.className = "ab-iam-root v3"),
|
|
94
94
|
(i.className += me(e)),
|
|
95
95
|
i.setAttribute("role", "complementary"),
|
|
96
|
-
e.
|
|
97
|
-
r.
|
|
96
|
+
e.lo() && (i.id = e.htmlId),
|
|
97
|
+
r.ee(w.To) && (i.style.zIndex = (r.ee(w.To) + 1).toString()),
|
|
98
98
|
t.appendChild(i),
|
|
99
|
-
e.
|
|
99
|
+
e.Qe())
|
|
100
100
|
) {
|
|
101
101
|
const t = document.createElement("style");
|
|
102
102
|
(t.innerHTML = e.css),
|
|
103
|
-
(t.id = e.
|
|
104
|
-
null != r.
|
|
103
|
+
(t.id = e.Ve()),
|
|
104
|
+
null != r.ee(w.er) && t.setAttribute("nonce", r.ee(w.er)),
|
|
105
105
|
document.getElementsByTagName("head")[0].appendChild(t);
|
|
106
106
|
}
|
|
107
107
|
const n = e instanceof SlideUpMessage,
|
|
@@ -113,14 +113,14 @@ export function showInAppMessage(e, t, o) {
|
|
|
113
113
|
});
|
|
114
114
|
},
|
|
115
115
|
(t) => {
|
|
116
|
-
if (e.
|
|
116
|
+
if (e.bo() && e.Po()) {
|
|
117
117
|
const o = document.createElement("div");
|
|
118
118
|
if (
|
|
119
119
|
((o.className = "ab-page-blocker"),
|
|
120
|
-
e.
|
|
121
|
-
r.
|
|
120
|
+
e.Qe() || (o.style.backgroundColor = le(e.frameColor)),
|
|
121
|
+
r.ee(w.To) && (o.style.zIndex = r.ee(w.To).toString()),
|
|
122
122
|
i.appendChild(o),
|
|
123
|
-
!r.
|
|
123
|
+
!r.ee(w.mh))
|
|
124
124
|
) {
|
|
125
125
|
const s = new Date().valueOf();
|
|
126
126
|
o.onclick = (o) => {
|
|
@@ -149,7 +149,7 @@ export function showInAppMessage(e, t, o) {
|
|
|
149
149
|
s.offsetTop),
|
|
150
150
|
(t.style.bottom = Math.max(e, 0) + "px");
|
|
151
151
|
}
|
|
152
|
-
} else if (s && !r.
|
|
152
|
+
} else if (s && !r.ee(w.mh)) {
|
|
153
153
|
const o = e;
|
|
154
154
|
It(t) &&
|
|
155
155
|
t.contentWindow &&
|
|
@@ -167,11 +167,11 @@ export function showInAppMessage(e, t, o) {
|
|
|
167
167
|
(e) => {
|
|
168
168
|
N.info(e);
|
|
169
169
|
},
|
|
170
|
-
r.
|
|
171
|
-
r.
|
|
172
|
-
r.
|
|
170
|
+
r.ee(w.Fo),
|
|
171
|
+
r.ee(w.To),
|
|
172
|
+
r.ee(w.er),
|
|
173
173
|
t,
|
|
174
|
-
ge.ea().
|
|
174
|
+
ge.ea().Lo(),
|
|
175
175
|
);
|
|
176
176
|
return (s || n) && (i.appendChild(a), e.Ah(i)), !0;
|
|
177
177
|
}
|