@braze/web-sdk 5.3.1 → 5.3.2
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 +1 -1
- package/package.json +1 -1
- package/shared-lib/event-types.js +3 -3
- package/shared-lib/logger.js +2 -2
- package/src/InAppMessage/display/html-message-display-utils.js +172 -0
- package/src/InAppMessage/display/html-message-to-html.js +54 -219
- package/src/InAppMessage/display/in-app-message-to-html.js +21 -21
- 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 +4 -4
- package/src/InAppMessage/in-app-message-manager.js +56 -56
- 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-html-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/full-screen-message.js +2 -2
- package/src/InAppMessage/models/html-message.js +2 -2
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +26 -26
- package/src/InAppMessage/models/modal-message.js +2 -2
- package/src/InAppMessage/models/slide-up-message.js +4 -4
- 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 +10 -10
- package/src/InAppMessage/utils/in-app-message-utils.js +1 -18
- package/src/Push/is-push-blocked.js +2 -2
- package/src/Push/is-push-permission-granted.js +2 -2
- package/src/Push/is-push-supported.js +2 -2
- package/src/Push/push-manager.js +9 -9
- package/src/Push/utils/push-utils.js +10 -10
- package/src/User/user-manager.js +1 -1
- package/src/User/user.js +15 -15
- package/src/common/feed-display.js +8 -8
- package/src/managers/auth-manager.js +1 -1
- package/src/managers/braze-instance.js +13 -13
- package/src/managers/device-manager.js +2 -2
- package/src/managers/network-manager.js +17 -17
- package/src/managers/server-config-manager.js +3 -3
- package/src/managers/storage-manager-factory.js +3 -3
- package/src/managers/storage-manager.js +1 -1
- package/src/models/braze-event.js +7 -7
- package/src/models/device.js +2 -2
- package/src/models/server-config.js +7 -7
- package/src/request-controller.js +3 -3
- 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 +3 -3
- package/src/triggers/models/filter.js +6 -6
- package/src/triggers/models/purchase-data.js +2 -2
- package/src/triggers/models/purchase-property-data.js +4 -4
- package/src/triggers/models/trigger-condition.js +38 -38
- package/src/triggers/models/trigger.js +12 -12
- package/src/triggers/triggers-provider-factory.js +1 -1
- package/src/triggers/triggers-provider.js +12 -12
- package/src/ui/js/attach-css.js +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/component-utils.js +2 -2
- package/src/util/date-utils.js +2 -2
- package/src/util/dom-utils.js +3 -3
- package/src/util/net.js +2 -2
- package/src/util/request-header-utils.js +1 -1
- package/src/util/validation-utils.js +17 -17
|
@@ -3,9 +3,9 @@ import { _handleBrazeAction as u } from "../../Core/handle-braze-action.js";
|
|
|
3
3
|
import { logInAppMessageButtonClick } from "../log-in-app-message-button-click.js";
|
|
4
4
|
import { toRgba as ie } from "../../util/color-utils.js";
|
|
5
5
|
import { addPassiveEventListener as oe } from "../../util/dom-utils.js";
|
|
6
|
-
import { KeyCodes as
|
|
6
|
+
import { KeyCodes as mt } from "../../util/key-codes.js";
|
|
7
7
|
const le = {
|
|
8
|
-
|
|
8
|
+
Je: (t) => {
|
|
9
9
|
const o = t.querySelectorAll(
|
|
10
10
|
".ab-close-button, .ab-message-text, .ab-message-button",
|
|
11
11
|
);
|
|
@@ -16,7 +16,7 @@ const le = {
|
|
|
16
16
|
s = o[o.length - 1];
|
|
17
17
|
t.addEventListener("keydown", (o) => {
|
|
18
18
|
const a = document.activeElement;
|
|
19
|
-
o.keyCode ===
|
|
19
|
+
o.keyCode === mt.lo &&
|
|
20
20
|
(o.shiftKey || (a !== s && a !== t)
|
|
21
21
|
? !o.shiftKey ||
|
|
22
22
|
(a !== e && a !== t) ||
|
|
@@ -25,20 +25,20 @@ const le = {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
Ke: (t, o) => {
|
|
29
29
|
o.setAttribute("role", "dialog"),
|
|
30
30
|
o.setAttribute("aria-modal", "true"),
|
|
31
31
|
o.setAttribute("aria-label", "Modal Message"),
|
|
32
32
|
t && o.setAttribute("aria-labelledby", t);
|
|
33
33
|
},
|
|
34
|
-
|
|
34
|
+
He: (t, o, e, s) => {
|
|
35
35
|
if (t.buttons && t.buttons.length > 0) {
|
|
36
36
|
const a = document.createElement("div");
|
|
37
37
|
(a.className = "ab-message-buttons"), e.appendChild(a);
|
|
38
38
|
const l = e.getElementsByClassName("ab-message-text")[0];
|
|
39
39
|
null != l && (l.className += " ab-with-buttons");
|
|
40
40
|
const n = (a) => (l) => (
|
|
41
|
-
t.
|
|
41
|
+
t.Cr(e, () => {
|
|
42
42
|
logInAppMessageButtonClick(a, t),
|
|
43
43
|
a.clickAction === InAppMessage.ClickAction.URI
|
|
44
44
|
? u(
|
|
@@ -60,7 +60,7 @@ const le = {
|
|
|
60
60
|
let l = e.text;
|
|
61
61
|
"" === e.text && (l = " "),
|
|
62
62
|
s.appendChild(document.createTextNode(l)),
|
|
63
|
-
t.
|
|
63
|
+
t.ve() ||
|
|
64
64
|
((s.style.backgroundColor = ie(e.backgroundColor)),
|
|
65
65
|
(s.style.color = ie(e.textColor)),
|
|
66
66
|
(s.style.borderColor = ie(e.borderColor))),
|
|
@@ -47,7 +47,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
47
47
|
((q = void 0), (B = void 0));
|
|
48
48
|
const C = e.message_extras;
|
|
49
49
|
let D;
|
|
50
|
-
if (o === ModalMessage.it || o === InAppMessage.
|
|
50
|
+
if (o === ModalMessage.it || o === InAppMessage.Be.Ue)
|
|
51
51
|
D = new ModalMessage(
|
|
52
52
|
s,
|
|
53
53
|
n,
|
|
@@ -138,8 +138,8 @@ export function newInAppMessageFromJson(e) {
|
|
|
138
138
|
else {
|
|
139
139
|
if (
|
|
140
140
|
o !== HtmlMessage.it &&
|
|
141
|
-
o !== InAppMessage.
|
|
142
|
-
o !== InAppMessage.
|
|
141
|
+
o !== InAppMessage.Be.Me &&
|
|
142
|
+
o !== InAppMessage.Be.Ve
|
|
143
143
|
)
|
|
144
144
|
return void r.error("Ignoring message with unknown type " + o);
|
|
145
145
|
{
|
|
@@ -148,7 +148,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
148
148
|
(D.trusted = e.trusted || !1);
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
return (D.
|
|
151
|
+
return (D.xe = o), D;
|
|
152
152
|
}
|
|
153
153
|
export function buttonsFromSerializedInAppMessage(e) {
|
|
154
154
|
const o = [];
|
|
@@ -10,16 +10,16 @@ import { randomInclusive as U } from "../util/math.js";
|
|
|
10
10
|
import t from "../models/request-result.js";
|
|
11
11
|
import { logger as r, EventTypes as i } from "../../shared-lib/index.js";
|
|
12
12
|
import T from "../managers/subscription-manager.js";
|
|
13
|
-
import
|
|
13
|
+
import gt from "../triggers/models/trigger.js";
|
|
14
14
|
import { BRAZE_ACTION_URI_REGEX as Z } from "../util/validation-utils.js";
|
|
15
15
|
import {
|
|
16
|
-
containsPushPrimerBrazeAction as
|
|
17
|
-
containsUnknownBrazeAction as
|
|
16
|
+
containsPushPrimerBrazeAction as ft,
|
|
17
|
+
containsUnknownBrazeAction as jt,
|
|
18
18
|
getDecodedBrazeAction as W,
|
|
19
|
-
ineligibleBrazeActionURLErrorMessage as
|
|
20
|
-
INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as
|
|
19
|
+
ineligibleBrazeActionURLErrorMessage as vt,
|
|
20
|
+
INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as bt,
|
|
21
21
|
} from "../util/braze-actions.js";
|
|
22
|
-
import
|
|
22
|
+
import yt from "../Push/utils/push-utils.js";
|
|
23
23
|
import D from "../util/request-header-utils.js";
|
|
24
24
|
import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
|
|
25
25
|
import { FullScreenMessage, ModalMessage, SlideUpMessage } from "./index.js";
|
|
@@ -36,27 +36,27 @@ export default class aa {
|
|
|
36
36
|
(this._e = new T()),
|
|
37
37
|
e.$t(this._e),
|
|
38
38
|
(this.Xe = 1e3),
|
|
39
|
-
(this.
|
|
40
|
-
(this.
|
|
39
|
+
(this.We = 6e4),
|
|
40
|
+
(this.Ye = null);
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
Ze() {
|
|
43
43
|
return this._e;
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
Mi(t) {
|
|
46
46
|
return this._e.It(t);
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
return this.
|
|
48
|
+
_i() {
|
|
49
|
+
return this.Ye;
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
this.
|
|
51
|
+
Pi(t) {
|
|
52
|
+
this.Ye = t;
|
|
53
53
|
}
|
|
54
54
|
q(e, n, o, a) {
|
|
55
55
|
const l = new t();
|
|
56
56
|
let u;
|
|
57
57
|
if (e instanceof ControlMessage) u = { trigger_ids: [e.triggerId] };
|
|
58
58
|
else {
|
|
59
|
-
if (n === i
|
|
59
|
+
if (n === i.$i || (e instanceof HtmlMessage && n === i.Ei)) {
|
|
60
60
|
if (!e.p(a))
|
|
61
61
|
return (
|
|
62
62
|
r.info(
|
|
@@ -64,7 +64,7 @@ export default class aa {
|
|
|
64
64
|
),
|
|
65
65
|
l
|
|
66
66
|
);
|
|
67
|
-
} else if (n === i.
|
|
67
|
+
} else if (n === i.Gi) {
|
|
68
68
|
if (!e.K())
|
|
69
69
|
return (
|
|
70
70
|
r.info(
|
|
@@ -73,7 +73,7 @@ export default class aa {
|
|
|
73
73
|
l
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
|
-
u = this.
|
|
76
|
+
u = this.Oi(e);
|
|
77
77
|
}
|
|
78
78
|
return null == u
|
|
79
79
|
? l
|
|
@@ -81,7 +81,7 @@ export default class aa {
|
|
|
81
81
|
null != o && (u.bid = o),
|
|
82
82
|
s.q(n, u));
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
Xi(e, n) {
|
|
85
85
|
const o = new t();
|
|
86
86
|
if (!e.p())
|
|
87
87
|
return (
|
|
@@ -90,32 +90,32 @@ export default class aa {
|
|
|
90
90
|
),
|
|
91
91
|
o
|
|
92
92
|
);
|
|
93
|
-
const a = this.
|
|
93
|
+
const a = this.Oi(n);
|
|
94
94
|
return null == a
|
|
95
95
|
? o
|
|
96
|
-
: e.id === InAppMessageButton.
|
|
96
|
+
: e.id === InAppMessageButton.Hi
|
|
97
97
|
? (r.info(
|
|
98
98
|
"This in-app message button does not have a tracking id. Not logging event to Braze servers.",
|
|
99
99
|
),
|
|
100
100
|
o)
|
|
101
|
-
: (null != e.id && (a.bid = e.id), s.q(i.
|
|
101
|
+
: (null != e.id && (a.bid = e.id), s.q(i.Ei, a));
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
Ji(t) {
|
|
104
104
|
const e = t.messageFields;
|
|
105
105
|
return (null != e && e.is_push_primer) || !1;
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
Ki(t) {
|
|
108
108
|
if (!(t instanceof InAppMessage)) return;
|
|
109
109
|
const e = (t) => {
|
|
110
110
|
if (!t) return;
|
|
111
111
|
const e = W(t);
|
|
112
|
-
return
|
|
113
|
-
?
|
|
114
|
-
:
|
|
115
|
-
?
|
|
112
|
+
return jt(e)
|
|
113
|
+
? vt(bt.Li, "In-App Message")
|
|
114
|
+
: ft(e) && !yt.Qi()
|
|
115
|
+
? vt(bt.Vi, "In-App Message")
|
|
116
116
|
: void 0;
|
|
117
117
|
};
|
|
118
|
-
if (this.
|
|
118
|
+
if (this.Ji(t) && !yt.Qi())
|
|
119
119
|
return "In-App Message contains a push prompt, but is not eligible for a push prompt. Ignoring.";
|
|
120
120
|
const s = t.buttons || [];
|
|
121
121
|
let i;
|
|
@@ -133,60 +133,60 @@ export default class aa {
|
|
|
133
133
|
? e(t.uri)
|
|
134
134
|
: void 0;
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
Wi(t, e, s, i) {
|
|
137
137
|
const n = this.qt;
|
|
138
138
|
if (!n) return;
|
|
139
|
-
const o = n.
|
|
139
|
+
const o = n.Yi(!1, !1),
|
|
140
140
|
a = n.Js(o);
|
|
141
141
|
(a.template = { trigger_id: t.triggerId, trigger_event_type: e }),
|
|
142
|
-
null != s && (a.template.data = s.
|
|
143
|
-
const l = n.$s(a, D.Ps.
|
|
142
|
+
null != s && (a.template.data = s.Zi());
|
|
143
|
+
const l = n.$s(a, D.Ps.Ir);
|
|
144
144
|
n.Xs(
|
|
145
145
|
a,
|
|
146
146
|
(n = -1) => {
|
|
147
147
|
if (!this.qt) return;
|
|
148
148
|
const o = new Date().valueOf();
|
|
149
|
-
D._s(this.u, D.Ps.
|
|
149
|
+
D._s(this.u, D.Ps.Ir, o),
|
|
150
150
|
-1 !== n && l.push(["X-Braze-Req-Tokens-Remaining", n.toString()]),
|
|
151
151
|
C.Gs({
|
|
152
152
|
url: `${this.qt.Hs()}/template/`,
|
|
153
153
|
data: a,
|
|
154
154
|
headers: l,
|
|
155
155
|
L: (e) => {
|
|
156
|
-
if ((D.Qs(this.u, D.Ps.
|
|
157
|
-
return void ("function" == typeof t.
|
|
156
|
+
if ((D.Qs(this.u, D.Ps.Ir, 1), !this.qt.Ks(a, e, l)))
|
|
157
|
+
return void ("function" == typeof t.Mr && t.Mr());
|
|
158
158
|
if ((this.qt.Os(), null == e || null == e.templated_message))
|
|
159
159
|
return;
|
|
160
160
|
const s = e.templated_message;
|
|
161
|
-
if (s.type !==
|
|
161
|
+
if (s.type !== gt.Br.Tr) return;
|
|
162
162
|
const i = pt(s.data);
|
|
163
163
|
if (null == i) return;
|
|
164
|
-
const n = this.
|
|
164
|
+
const n = this.Ki(i);
|
|
165
165
|
if (n)
|
|
166
|
-
return r.error(n), void ("function" == typeof t.
|
|
167
|
-
"function" == typeof t.
|
|
166
|
+
return r.error(n), void ("function" == typeof t.Mr && t.Mr());
|
|
167
|
+
"function" == typeof t._r && t._r(i);
|
|
168
168
|
},
|
|
169
169
|
error: (r) => {
|
|
170
170
|
let n = `getting user personalization for message ${t.triggerId}`;
|
|
171
|
-
if (new Date().valueOf() - t.
|
|
172
|
-
D.Ys(this.u, D.Ps.
|
|
173
|
-
const r = Math.min(t.
|
|
171
|
+
if (new Date().valueOf() - t.Er < t.Gr) {
|
|
172
|
+
D.Ys(this.u, D.Ps.Ir);
|
|
173
|
+
const r = Math.min(t.Gr, this.We),
|
|
174
174
|
o = this.Xe;
|
|
175
175
|
null == i && (i = o);
|
|
176
176
|
const a = Math.min(r, U(o, 3 * i));
|
|
177
177
|
(n += `. Retrying in ${a} ms`),
|
|
178
178
|
setTimeout(() => {
|
|
179
|
-
this.
|
|
179
|
+
this.Wi(t, e, s, a);
|
|
180
180
|
}, a);
|
|
181
181
|
}
|
|
182
182
|
this.qt.Vs(r, n);
|
|
183
183
|
},
|
|
184
184
|
});
|
|
185
185
|
},
|
|
186
|
-
D.Ps.
|
|
186
|
+
D.Ps.Ir,
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
Oi(t) {
|
|
190
190
|
if (null == t.triggerId)
|
|
191
191
|
return (
|
|
192
192
|
r.info(
|
|
@@ -204,33 +204,33 @@ export default class aa {
|
|
|
204
204
|
!(t && t instanceof InAppMessage && t.constructor !== InAppMessage) ||
|
|
205
205
|
t instanceof ControlMessage
|
|
206
206
|
) &&
|
|
207
|
-
this.u.k(o.C.
|
|
207
|
+
this.u.k(o.C.Nr, t.Y())
|
|
208
208
|
);
|
|
209
209
|
}
|
|
210
|
-
|
|
210
|
+
Se() {
|
|
211
211
|
if (!this.u) return null;
|
|
212
|
-
const t = this.u.j(o.C.
|
|
212
|
+
const t = this.u.j(o.C.Nr);
|
|
213
213
|
if (!t) return null;
|
|
214
214
|
let e;
|
|
215
215
|
switch (t.type) {
|
|
216
|
-
case InAppMessage.
|
|
216
|
+
case InAppMessage.Be.Or:
|
|
217
217
|
e = FullScreenMessage.Xr(t);
|
|
218
218
|
break;
|
|
219
|
-
case InAppMessage.
|
|
220
|
-
case InAppMessage.
|
|
221
|
-
case InAppMessage.
|
|
219
|
+
case InAppMessage.Be.Hr:
|
|
220
|
+
case InAppMessage.Be.Me:
|
|
221
|
+
case InAppMessage.Be.Ve:
|
|
222
222
|
e = HtmlMessage.Xr(t);
|
|
223
223
|
break;
|
|
224
|
-
case InAppMessage.
|
|
225
|
-
case InAppMessage.
|
|
224
|
+
case InAppMessage.Be.Jr:
|
|
225
|
+
case InAppMessage.Be.Ue:
|
|
226
226
|
e = ModalMessage.Xr(t);
|
|
227
227
|
break;
|
|
228
|
-
case InAppMessage.
|
|
228
|
+
case InAppMessage.Be.Kr:
|
|
229
229
|
e = SlideUpMessage.Xr(t);
|
|
230
230
|
}
|
|
231
231
|
return e && this.Lr(), e;
|
|
232
232
|
}
|
|
233
233
|
Lr() {
|
|
234
|
-
this.u && this.u.ti(o.C.
|
|
234
|
+
this.u && this.u.ti(o.C.Nr);
|
|
235
235
|
}
|
|
236
236
|
}
|
|
@@ -12,7 +12,7 @@ export function logInAppMessageButtonClick(o, t) {
|
|
|
12
12
|
if (!(o instanceof InAppMessageButton))
|
|
13
13
|
return r.error("button must be an InAppMessageButton object"), !1;
|
|
14
14
|
if (!(t instanceof InAppMessage)) return r.error(sr), !1;
|
|
15
|
-
const n = se.m().
|
|
15
|
+
const n = se.m().Xi(o, t);
|
|
16
16
|
if (n.L)
|
|
17
17
|
for (let r = 0; r < n.ge.length; r++)
|
|
18
18
|
et.rr().fe(
|
|
@@ -9,7 +9,7 @@ import { TriggersProviderFactory as et } from "../triggers/triggers-provider-fac
|
|
|
9
9
|
export function logInAppMessageClick(o) {
|
|
10
10
|
if (!e.X()) return !1;
|
|
11
11
|
if (!(o instanceof InAppMessage)) return r.error(sr), !1;
|
|
12
|
-
const s = se.m().q(o, i
|
|
12
|
+
const s = se.m().q(o, i.$i);
|
|
13
13
|
if (s) {
|
|
14
14
|
o.Ur() || logInAppMessageImpression(o);
|
|
15
15
|
for (let r = 0; r < s.ge.length; r++)
|
|
@@ -8,6 +8,6 @@ export function logInAppMessageImpression(o) {
|
|
|
8
8
|
if (!e.X()) return !1;
|
|
9
9
|
if (!(o instanceof InAppMessage || o instanceof ControlMessage))
|
|
10
10
|
return r.error(sr), !1;
|
|
11
|
-
const s = o instanceof ControlMessage ? i.mo : i.
|
|
11
|
+
const s = o instanceof ControlMessage ? i.mo : i.Gi;
|
|
12
12
|
return se.m().q(o, s).L;
|
|
13
13
|
}
|
|
@@ -66,7 +66,7 @@ export default class FullScreenMessage extends InAppMessage {
|
|
|
66
66
|
A,
|
|
67
67
|
B,
|
|
68
68
|
),
|
|
69
|
-
(this.
|
|
69
|
+
(this.qe = InAppMessage.TextAlignment.CENTER);
|
|
70
70
|
}
|
|
71
71
|
Y() {
|
|
72
72
|
return super.Y(FullScreenMessage.it);
|
|
@@ -105,4 +105,4 @@ export default class FullScreenMessage extends InAppMessage {
|
|
|
105
105
|
);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
FullScreenMessage.it = InAppMessage.
|
|
108
|
+
FullScreenMessage.it = InAppMessage.Be.Or;
|
|
@@ -40,7 +40,7 @@ export default class HtmlMessage extends InAppMessage {
|
|
|
40
40
|
return !1;
|
|
41
41
|
}
|
|
42
42
|
p(i) {
|
|
43
|
-
if (this.
|
|
43
|
+
if (this.xe === InAppMessage.Be.Hr) {
|
|
44
44
|
if (this.vo) return !1;
|
|
45
45
|
this.vo = !0;
|
|
46
46
|
}
|
|
@@ -67,4 +67,4 @@ export default class HtmlMessage extends InAppMessage {
|
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
HtmlMessage.it = InAppMessage.
|
|
70
|
+
HtmlMessage.it = InAppMessage.Be.Hr;
|
|
@@ -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.Hi),
|
|
19
19
|
(this.id = n),
|
|
20
20
|
(this.vo = !1),
|
|
21
21
|
(this.Et = new T());
|
|
@@ -44,4 +44,4 @@ export default class InAppMessageButton {
|
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
InAppMessageButton.
|
|
47
|
+
InAppMessageButton.Hi = -1;
|
|
@@ -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 mt } 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 {
|
|
@@ -107,11 +107,11 @@ export default class InAppMessage {
|
|
|
107
107
|
(this.Th = !1),
|
|
108
108
|
(this.vo = !1),
|
|
109
109
|
(this.oh = !1),
|
|
110
|
-
(this.
|
|
110
|
+
(this.Re = null),
|
|
111
111
|
(this.ke = null),
|
|
112
112
|
(this.Et = new T()),
|
|
113
113
|
(this.rh = new T()),
|
|
114
|
-
(this.
|
|
114
|
+
(this.qe = InAppMessage.TextAlignment.CENTER);
|
|
115
115
|
}
|
|
116
116
|
subscribeToClickedEvent(t) {
|
|
117
117
|
return this.Et.It(t);
|
|
@@ -126,22 +126,22 @@ export default class InAppMessage {
|
|
|
126
126
|
this.Et.removeAllSubscriptions(), this.rh.removeAllSubscriptions();
|
|
127
127
|
}
|
|
128
128
|
closeMessage() {
|
|
129
|
-
this.
|
|
129
|
+
this.Cr(this.Re);
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
$e() {
|
|
132
132
|
return !0;
|
|
133
133
|
}
|
|
134
134
|
do() {
|
|
135
|
-
return this
|
|
136
|
-
}
|
|
137
|
-
xe() {
|
|
138
|
-
return null != this.htmlId && this.htmlId.length > 4;
|
|
135
|
+
return this.$e();
|
|
139
136
|
}
|
|
140
137
|
Ce() {
|
|
141
|
-
return
|
|
138
|
+
return null != this.htmlId && this.htmlId.length > 4;
|
|
142
139
|
}
|
|
143
140
|
ve() {
|
|
144
|
-
|
|
141
|
+
return this.Ce() && null != this.css && this.css.length > 0;
|
|
142
|
+
}
|
|
143
|
+
we() {
|
|
144
|
+
if (this.Ce() && this.ve()) return this.htmlId + "-css";
|
|
145
145
|
}
|
|
146
146
|
K() {
|
|
147
147
|
return !this.Th && ((this.Th = !0), !0);
|
|
@@ -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.$e() && null != s.parentNode)) {
|
|
162
162
|
const t = s.parentNode.classList;
|
|
163
163
|
t && t.contains(InAppMessage.lh) && t.remove(InAppMessage.lh),
|
|
164
164
|
document.body.removeEventListener("touchmove", InAppMessage.uh);
|
|
@@ -167,10 +167,10 @@ export default class InAppMessage {
|
|
|
167
167
|
}
|
|
168
168
|
return this.animateOut || !1;
|
|
169
169
|
}
|
|
170
|
-
|
|
170
|
+
Cr(t, s) {
|
|
171
171
|
if (null == t) return;
|
|
172
172
|
let i;
|
|
173
|
-
(this.
|
|
173
|
+
(this.Re = 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.we();
|
|
189
189
|
if (null != i) {
|
|
190
190
|
const t = document.getElementById(i);
|
|
191
191
|
t && t.parentNode && t.parentNode.removeChild(t);
|
|
@@ -195,12 +195,12 @@ export default class InAppMessage {
|
|
|
195
195
|
};
|
|
196
196
|
h ? setTimeout(n, InAppMessage.Ah) : n(), this.ke && this.ke.focus();
|
|
197
197
|
}
|
|
198
|
-
|
|
198
|
+
Ge() {
|
|
199
199
|
return document.createTextNode(this.message || "");
|
|
200
200
|
}
|
|
201
|
-
|
|
201
|
+
Ae(t) {
|
|
202
202
|
let s = "";
|
|
203
|
-
this.message || this.header || !this
|
|
203
|
+
this.message || this.header || !this.$e() || (s = "Modal Image"),
|
|
204
204
|
t.setAttribute("alt", s);
|
|
205
205
|
}
|
|
206
206
|
static uh(t) {
|
|
@@ -216,7 +216,7 @@ export default class InAppMessage {
|
|
|
216
216
|
}
|
|
217
217
|
Oh(t) {
|
|
218
218
|
const s = t.parentNode;
|
|
219
|
-
this
|
|
219
|
+
this.$e() &&
|
|
220
220
|
null != s &&
|
|
221
221
|
this.orientation !== InAppMessage.Orientation.LANDSCAPE &&
|
|
222
222
|
(null != s.classList && s.classList.add(InAppMessage.lh),
|
|
@@ -229,7 +229,7 @@ export default class InAppMessage {
|
|
|
229
229
|
}
|
|
230
230
|
static _h(t) {
|
|
231
231
|
if (
|
|
232
|
-
t.keyCode ===
|
|
232
|
+
t.keyCode === mt.mh &&
|
|
233
233
|
!e.nn(L.Lh) &&
|
|
234
234
|
document.querySelectorAll(".ab-modal-interactions").length > 0
|
|
235
235
|
) {
|
|
@@ -308,9 +308,9 @@ export default class InAppMessage {
|
|
|
308
308
|
Eh: 3224580915,
|
|
309
309
|
eh: 4288387995,
|
|
310
310
|
}),
|
|
311
|
-
(InAppMessage.
|
|
311
|
+
(InAppMessage.Le = {
|
|
312
312
|
Ch: "hd",
|
|
313
|
-
|
|
313
|
+
ze: "ias",
|
|
314
314
|
dh: "of",
|
|
315
315
|
Uh: "do",
|
|
316
316
|
bh: "umt",
|
|
@@ -339,14 +339,14 @@ export default class InAppMessage {
|
|
|
339
339
|
CENTER_CROP: "CENTER_CROP",
|
|
340
340
|
FIT_CENTER: "FIT_CENTER",
|
|
341
341
|
}),
|
|
342
|
-
(InAppMessage.
|
|
342
|
+
(InAppMessage.Be = {
|
|
343
343
|
Kr: "SLIDEUP",
|
|
344
344
|
Jr: "MODAL",
|
|
345
|
-
|
|
345
|
+
Ue: "MODAL_STYLED",
|
|
346
346
|
Or: "FULL",
|
|
347
347
|
Hr: "WEB_HTML",
|
|
348
|
-
|
|
349
|
-
|
|
348
|
+
Me: "HTML",
|
|
349
|
+
Ve: "HTML_FULL",
|
|
350
350
|
}),
|
|
351
351
|
(InAppMessage.Ah = 500),
|
|
352
352
|
(InAppMessage.fh = 200),
|
|
@@ -63,7 +63,7 @@ export default class ModalMessage extends InAppMessage {
|
|
|
63
63
|
q,
|
|
64
64
|
A,
|
|
65
65
|
),
|
|
66
|
-
(this.
|
|
66
|
+
(this.qe = InAppMessage.TextAlignment.CENTER);
|
|
67
67
|
}
|
|
68
68
|
Y() {
|
|
69
69
|
return super.Y(ModalMessage.it);
|
|
@@ -101,4 +101,4 @@ export default class ModalMessage extends InAppMessage {
|
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
ModalMessage.it = InAppMessage.
|
|
104
|
+
ModalMessage.it = InAppMessage.Be.Jr;
|
|
@@ -59,12 +59,12 @@ export default class SlideUpMessage extends InAppMessage {
|
|
|
59
59
|
M,
|
|
60
60
|
b,
|
|
61
61
|
),
|
|
62
|
-
(this.
|
|
62
|
+
(this.qe = InAppMessage.TextAlignment.START);
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
$e() {
|
|
65
65
|
return !1;
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
Ge() {
|
|
68
68
|
const e = document.createElement("span");
|
|
69
69
|
return e.appendChild(document.createTextNode(this.message || "")), e;
|
|
70
70
|
}
|
|
@@ -106,4 +106,4 @@ export default class SlideUpMessage extends InAppMessage {
|
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
SlideUpMessage.it = InAppMessage.
|
|
109
|
+
SlideUpMessage.it = InAppMessage.Be.Kr;
|
|
@@ -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._r = s),
|
|
5
|
+
(this.Mr = i),
|
|
6
|
+
(this.Er = h),
|
|
7
|
+
(this.Gr = l),
|
|
8
8
|
(this.triggerId = t),
|
|
9
|
-
(this.
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
12
|
-
(this.
|
|
9
|
+
(this._r = s),
|
|
10
|
+
(this.Mr = i),
|
|
11
|
+
(this.Er = h),
|
|
12
|
+
(this.Gr = l);
|
|
13
13
|
}
|
|
14
14
|
static fromJson(t, s, i, h, l) {
|
|
15
15
|
return null == t || null == t.trigger_id
|
|
@@ -7,9 +7,9 @@ export function automaticallyShowInAppMessages() {
|
|
|
7
7
|
if (!e.X()) return;
|
|
8
8
|
ss();
|
|
9
9
|
const s = se.m();
|
|
10
|
-
if (null == s.
|
|
10
|
+
if (null == s._i()) {
|
|
11
11
|
const r = subscribeToInAppMessage((s) => showInAppMessage(s));
|
|
12
|
-
s
|
|
12
|
+
s.Pi(r);
|
|
13
13
|
}
|
|
14
|
-
return s.
|
|
14
|
+
return s._i();
|
|
15
15
|
}
|