@braze/web-sdk 6.10.1 → 6.11.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 +28 -4
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +3 -3
- package/shared-lib/event-types.js +10 -10
- package/shared-lib/indexed-db-adapter.js +51 -51
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +9 -9
- package/src/Core/logout.js +2 -2
- package/src/InAppMessage/constants.js +39 -47
- package/src/InAppMessage/display/html-message-to-html.js +1 -1
- package/src/InAppMessage/display/in-app-message-to-html.js +38 -36
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager.js +89 -68
- 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 +22 -22
- package/src/InAppMessage/models/html-message.js +13 -13
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +68 -66
- package/src/InAppMessage/models/modal-message.js +20 -20
- package/src/InAppMessage/models/slide-up-message.js +25 -25
- package/src/InAppMessage/models/templated-in-app-message.js +6 -6
- 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 +27 -25
- package/src/Push/index.js +1 -0
- package/src/Push/push-manager-factory.js +4 -4
- package/src/Push/push-manager.js +222 -179
- package/src/Push/register-push.js +9 -0
- package/src/Push/unregister-push-token-on-server.js +4 -4
- package/src/Push/utils/push-utils.js +8 -8
- package/src/User/user-manager.js +19 -19
- package/src/User/user.js +35 -35
- package/src/common/constants.js +1 -1
- package/src/common/content-cards-display.js +5 -5
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/braze-instance.js +42 -38
- package/src/managers/device-manager.js +20 -20
- package/src/managers/network-manager.js +122 -122
- package/src/managers/server-config-manager.js +76 -76
- package/src/managers/session-manager.js +8 -8
- package/src/managers/storage-manager.js +127 -127
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +2 -2
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +6 -6
- package/src/models/push-token.js +6 -6
- package/src/models/server-config.js +24 -24
- package/src/request-controller.js +85 -85
- package/src/triggers/models/trigger-condition.js +27 -27
- package/src/triggers/models/trigger.js +2 -2
- package/src/triggers/triggers-provider-factory.js +1 -1
- package/src/triggers/triggers-provider.js +37 -29
- package/src/types.js +2 -2
- package/src/ui/js/attach-css.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 +5 -5
- package/src/util/client-hints-parser.js +1 -1
- package/src/util/dom-utils.js +2 -2
- package/src/util/ecommerce-event-validation.js +1 -1
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +3 -3
- package/src/util/request-header-utils.js +15 -15
- package/src/util/user-agent-parser.js +4 -4
- package/src/util/validation-utils.js +5 -5
- package/src/util/window-utils.js +2 -2
|
@@ -14,19 +14,18 @@ import { logInAppMessageClick } from "../log-in-app-message-click.js";
|
|
|
14
14
|
import { _handleBrazeAction as Q } from "../../Core/handle-braze-action.js";
|
|
15
15
|
import ft from "./html-message-to-html.js";
|
|
16
16
|
import xe from "./modal-utils.js";
|
|
17
|
-
import {
|
|
17
|
+
import { Guid as V } from "../../../shared-lib/index.js";
|
|
18
18
|
import { KeyCodes as Ce } from "../../util/key-codes.js";
|
|
19
19
|
import {
|
|
20
20
|
IamClickAction as Le,
|
|
21
21
|
IamCropType as Me,
|
|
22
|
-
|
|
23
|
-
IamImageStyle as Ae,
|
|
22
|
+
IamImageStyle as qe,
|
|
24
23
|
IamOpenTarget as ut,
|
|
25
|
-
IamOrientation as
|
|
26
|
-
IamSlideFrom as
|
|
27
|
-
IamTextAlignment as
|
|
24
|
+
IamOrientation as Ae,
|
|
25
|
+
IamSlideFrom as De,
|
|
26
|
+
IamTextAlignment as Ee,
|
|
28
27
|
} from "../constants.js";
|
|
29
|
-
export default function
|
|
28
|
+
export default function Fe(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
30
29
|
if (((e.$o = document.activeElement), e instanceof HtmlMessage))
|
|
31
30
|
return ft(e, o, a, n, i);
|
|
32
31
|
const l = (function (e, o, t, a, n, i = document.body, s = "ltr") {
|
|
@@ -48,26 +47,29 @@ export default function Ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
48
47
|
document.querySelectorAll(".ab-iam-img-loading").length > 0
|
|
49
48
|
? t(
|
|
50
49
|
`Cannot show in-app message ${e.message} because another message is being shown.`,
|
|
51
|
-
qe.tE,
|
|
52
50
|
)
|
|
53
51
|
: o(l));
|
|
54
52
|
},
|
|
55
53
|
r = (o = !0) => {
|
|
56
|
-
let
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
let a = document.querySelectorAll(".ab-iam-root");
|
|
55
|
+
if (
|
|
56
|
+
((a && 0 !== a.length) || (a = i.querySelectorAll(".ab-iam-root")),
|
|
57
|
+
a && a.length > 0)
|
|
58
|
+
)
|
|
59
|
+
if (
|
|
60
|
+
(a[0].classList.remove("ab-iam-img-loading"),
|
|
61
61
|
m && (clearTimeout(m), (m = null)),
|
|
62
|
-
o
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
o)
|
|
63
|
+
)
|
|
64
|
+
c();
|
|
65
|
+
else {
|
|
66
|
+
const o = `Cannot show in-app message ${e.message} because the image failed to load.`;
|
|
67
|
+
t(o);
|
|
68
|
+
}
|
|
67
69
|
};
|
|
68
70
|
if (
|
|
69
|
-
(e.imageStyle ===
|
|
70
|
-
e.orientation ===
|
|
71
|
+
(e.imageStyle === qe.GRAPHIC && (l.className += " graphic"),
|
|
72
|
+
e.orientation === Ae.LANDSCAPE && (l.className += " landscape"),
|
|
71
73
|
null != e.buttons && 0 === e.buttons.length)
|
|
72
74
|
) {
|
|
73
75
|
e.clickAction !== Le.NONE && (l.className += " ab-clickable");
|
|
@@ -98,18 +100,18 @@ export default function Ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
98
100
|
(u.className = "ab-message-text"),
|
|
99
101
|
(u.dir = s),
|
|
100
102
|
u.setAttribute("role", "article");
|
|
101
|
-
const
|
|
102
|
-
u.className += " " +
|
|
103
|
-
let
|
|
104
|
-
const
|
|
105
|
-
if (((
|
|
103
|
+
const b = (e.messageAlignment || e.Go).toLowerCase();
|
|
104
|
+
u.className += " " + b + "-aligned";
|
|
105
|
+
let f = !1;
|
|
106
|
+
const p = document.createElement("div");
|
|
107
|
+
if (((p.className = "ab-image-area"), e.imageUrl)) {
|
|
106
108
|
const o = document.createElement("img");
|
|
107
109
|
if (
|
|
108
110
|
(o.setAttribute("src", e.imageUrl),
|
|
109
111
|
e.Ho(o),
|
|
110
112
|
0 === document.querySelectorAll(".ab-iam-img-loading").length)
|
|
111
113
|
) {
|
|
112
|
-
|
|
114
|
+
f = !0;
|
|
113
115
|
const e = document.querySelectorAll(".ab-iam-root");
|
|
114
116
|
e && e.length > 0 && e[0].classList.add("ab-iam-img-loading"),
|
|
115
117
|
(m = window.setTimeout(() => {
|
|
@@ -126,11 +128,11 @@ export default function Ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
126
128
|
const e = document.createElement("div");
|
|
127
129
|
(e.className = "ab-center-cropped-img"),
|
|
128
130
|
e.appendChild(o),
|
|
129
|
-
|
|
130
|
-
} else
|
|
131
|
-
l.appendChild(
|
|
131
|
+
p.appendChild(e);
|
|
132
|
+
} else p.appendChild(o);
|
|
133
|
+
l.appendChild(p), (u.className += " ab-with-image");
|
|
132
134
|
} else if (e.icon) {
|
|
133
|
-
|
|
135
|
+
p.className += " ab-icon-area";
|
|
134
136
|
const o = document.createElement("span");
|
|
135
137
|
(o.className = "ab-icon"),
|
|
136
138
|
e.Mo() ||
|
|
@@ -141,21 +143,21 @@ export default function Ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
141
143
|
t.appendChild(document.createTextNode(e.icon)),
|
|
142
144
|
t.setAttribute("aria-hidden", "true"),
|
|
143
145
|
o.appendChild(t),
|
|
144
|
-
|
|
145
|
-
l.appendChild(
|
|
146
|
+
p.appendChild(o),
|
|
147
|
+
l.appendChild(p),
|
|
146
148
|
(u.className += " ab-with-icon");
|
|
147
149
|
}
|
|
148
150
|
if ((F(u, "touchstart"), e.header && e.header.length > 0)) {
|
|
149
151
|
const o = document.createElement("h1");
|
|
150
152
|
(o.className = "ab-message-header"), (e.Jo = V.de()), (o.id = e.Jo);
|
|
151
|
-
const t = (e.headerAlignment ||
|
|
153
|
+
const t = (e.headerAlignment || Ee.CENTER).toLowerCase();
|
|
152
154
|
(o.className += " " + t + "-aligned"),
|
|
153
155
|
e.Mo() || (o.style.color = ke(e.headerTextColor)),
|
|
154
156
|
o.appendChild(document.createTextNode(e.header)),
|
|
155
157
|
u.appendChild(o);
|
|
156
158
|
}
|
|
157
|
-
const
|
|
158
|
-
return u.appendChild(
|
|
159
|
+
const g = e.Ko();
|
|
160
|
+
return u.appendChild(g), l.appendChild(u), f || c(), (e.Eo = l), l;
|
|
159
161
|
})(e, o, t, a, n, s, m);
|
|
160
162
|
if (e instanceof FullScreenMessage || e instanceof ModalMessage) {
|
|
161
163
|
const o = e instanceof FullScreenMessage ? "ab-fullscreen" : "ab-modal";
|
|
@@ -185,7 +187,7 @@ export default function Ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
185
187
|
(l.className += " ab-swiped-right"),
|
|
186
188
|
null != o && null != o.onclick && o.onclick(e);
|
|
187
189
|
}),
|
|
188
|
-
e.slideFrom ===
|
|
190
|
+
e.slideFrom === De.TOP
|
|
189
191
|
? ((t = P.Uo), (a = " ab-swiped-up"))
|
|
190
192
|
: ((t = P.Vo), (a = " ab-swiped-down")),
|
|
191
193
|
O(l, t, (e) => {
|
|
@@ -49,7 +49,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
49
49
|
D = e.language,
|
|
50
50
|
E = e.image_alt;
|
|
51
51
|
let G;
|
|
52
|
-
if (o === dt.
|
|
52
|
+
if (o === dt.tE || o === dt.eE)
|
|
53
53
|
G = new ModalMessage(
|
|
54
54
|
s,
|
|
55
55
|
n,
|
|
@@ -82,7 +82,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
82
82
|
D,
|
|
83
83
|
E,
|
|
84
84
|
);
|
|
85
|
-
else if (o === dt.
|
|
85
|
+
else if (o === dt.oE)
|
|
86
86
|
G = new FullScreenMessage(
|
|
87
87
|
s,
|
|
88
88
|
n,
|
|
@@ -116,7 +116,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
116
116
|
D,
|
|
117
117
|
E,
|
|
118
118
|
);
|
|
119
|
-
else if (o === dt.
|
|
119
|
+
else if (o === dt.RE)
|
|
120
120
|
G = new SlideUpMessage(
|
|
121
121
|
s,
|
|
122
122
|
n,
|
|
@@ -144,7 +144,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
144
144
|
E,
|
|
145
145
|
);
|
|
146
146
|
else {
|
|
147
|
-
if (o !== dt.
|
|
147
|
+
if (o !== dt.ME && o !== dt.CE && o !== dt.DE)
|
|
148
148
|
return void b.error("Ignoring message with unknown type " + o);
|
|
149
149
|
{
|
|
150
150
|
const o = e.message_fields;
|
|
@@ -14,16 +14,20 @@ import gt from "../triggers/models/trigger.js";
|
|
|
14
14
|
import { BRAZE_ACTION_URI_REGEX as to } from "../util/validation-utils.js";
|
|
15
15
|
import {
|
|
16
16
|
containsPushPrimerBrazeAction as jt,
|
|
17
|
-
containsUnknownBrazeAction as
|
|
17
|
+
containsUnknownBrazeAction as yt,
|
|
18
18
|
getDecodedBrazeAction as eo,
|
|
19
|
-
ineligibleBrazeActionURLErrorMessage as
|
|
19
|
+
ineligibleBrazeActionURLErrorMessage as vt,
|
|
20
20
|
INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as bt,
|
|
21
21
|
} from "../util/braze-actions.js";
|
|
22
22
|
import It from "../Push/utils/push-utils.js";
|
|
23
23
|
import h from "../util/request-header-utils.js";
|
|
24
24
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
25
25
|
import { FullScreenMessage, ModalMessage, SlideUpMessage } from "./index.js";
|
|
26
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
IamClickAction as Le,
|
|
28
|
+
IamServerTypes as dt,
|
|
29
|
+
IamTiming as At,
|
|
30
|
+
} from "./constants.js";
|
|
27
31
|
export default class ea {
|
|
28
32
|
constructor(t, e, s, i) {
|
|
29
33
|
(this.B = t),
|
|
@@ -40,24 +44,25 @@ export default class ea {
|
|
|
40
44
|
(this.Dn = 6e4),
|
|
41
45
|
(this._n = null),
|
|
42
46
|
(this.qn = null),
|
|
43
|
-
(this.xn = null)
|
|
47
|
+
(this.xn = null),
|
|
48
|
+
(this.Pn = {});
|
|
44
49
|
}
|
|
45
|
-
|
|
50
|
+
En() {
|
|
46
51
|
return this.In;
|
|
47
52
|
}
|
|
48
|
-
|
|
53
|
+
Gn(t) {
|
|
49
54
|
return this.In.Ut(t);
|
|
50
55
|
}
|
|
51
|
-
|
|
56
|
+
Nn() {
|
|
52
57
|
return this._n;
|
|
53
58
|
}
|
|
54
|
-
|
|
59
|
+
Fn(t) {
|
|
55
60
|
this._n = t;
|
|
56
61
|
}
|
|
57
62
|
Dt(t, e, s, i) {
|
|
58
63
|
const r = new L();
|
|
59
64
|
let n;
|
|
60
|
-
if (e === p.
|
|
65
|
+
if (e === p.On || t instanceof ControlMessage) {
|
|
61
66
|
if (!t.js())
|
|
62
67
|
return (
|
|
63
68
|
b.info(
|
|
@@ -65,7 +70,14 @@ export default class ea {
|
|
|
65
70
|
),
|
|
66
71
|
r
|
|
67
72
|
);
|
|
68
|
-
|
|
73
|
+
if (this.Xn(t.triggerId))
|
|
74
|
+
return (
|
|
75
|
+
b.info(
|
|
76
|
+
"An impression for this in-app message trigger has already been logged. Ignoring analytics event.",
|
|
77
|
+
),
|
|
78
|
+
r
|
|
79
|
+
);
|
|
80
|
+
} else if (e === p.Hn || (t instanceof HtmlMessage && e === p.Jn)) {
|
|
69
81
|
if (!t.Yt(i))
|
|
70
82
|
return (
|
|
71
83
|
b.info(
|
|
@@ -78,7 +90,7 @@ export default class ea {
|
|
|
78
90
|
(n =
|
|
79
91
|
t instanceof ControlMessage
|
|
80
92
|
? { trigger_ids: [t.triggerId] }
|
|
81
|
-
: this.
|
|
93
|
+
: this.Kn(t)),
|
|
82
94
|
null == n
|
|
83
95
|
? r
|
|
84
96
|
: (t.messageExtras && (n.message_extras = t.messageExtras),
|
|
@@ -86,7 +98,7 @@ export default class ea {
|
|
|
86
98
|
v.Dt(e, n))
|
|
87
99
|
);
|
|
88
100
|
}
|
|
89
|
-
|
|
101
|
+
Ln(t, e) {
|
|
90
102
|
const s = new L();
|
|
91
103
|
if (!t.Yt())
|
|
92
104
|
return (
|
|
@@ -95,34 +107,34 @@ export default class ea {
|
|
|
95
107
|
),
|
|
96
108
|
s
|
|
97
109
|
);
|
|
98
|
-
const i = this.
|
|
110
|
+
const i = this.Kn(e);
|
|
99
111
|
return null == i
|
|
100
112
|
? s
|
|
101
|
-
: t.id === InAppMessageButton.
|
|
113
|
+
: t.id === InAppMessageButton.Qn
|
|
102
114
|
? (b.info(
|
|
103
115
|
"This in-app message button does not have a tracking id. Not logging event to Braze servers.",
|
|
104
116
|
),
|
|
105
117
|
s)
|
|
106
|
-
: (null != t.id && (i.bid = t.id), v.Dt(p.
|
|
118
|
+
: (null != t.id && (i.bid = t.id), v.Dt(p.Jn, i));
|
|
107
119
|
}
|
|
108
|
-
|
|
120
|
+
Un(t) {
|
|
109
121
|
const e = t.messageFields;
|
|
110
122
|
return (null != e && e.is_push_primer) || !1;
|
|
111
123
|
}
|
|
112
|
-
|
|
124
|
+
Vn(t) {
|
|
113
125
|
if (!(t instanceof InAppMessage)) return;
|
|
114
126
|
const e = (t) => {
|
|
115
127
|
if (!t) return;
|
|
116
128
|
const e = eo(t);
|
|
117
|
-
if (
|
|
129
|
+
if (yt(e)) return vt(bt.Wn, "In-App Message");
|
|
118
130
|
if (jt(e)) {
|
|
119
|
-
const t = It.
|
|
120
|
-
if (!t.
|
|
131
|
+
const t = It.Yn();
|
|
132
|
+
if (!t.Zn) return It._o(t.reason, "In-App Message");
|
|
121
133
|
}
|
|
122
134
|
};
|
|
123
|
-
if (this.
|
|
124
|
-
const t = It.
|
|
125
|
-
if (!t.
|
|
135
|
+
if (this.Un(t)) {
|
|
136
|
+
const t = It.Yn();
|
|
137
|
+
if (!t.Zn) return It._o(t.reason, "In-App Message");
|
|
126
138
|
}
|
|
127
139
|
const s = t.buttons || [];
|
|
128
140
|
let i;
|
|
@@ -138,59 +150,59 @@ export default class ea {
|
|
|
138
150
|
? e(t.uri)
|
|
139
151
|
: void 0;
|
|
140
152
|
}
|
|
141
|
-
|
|
142
|
-
e !== this.xn && this.
|
|
153
|
+
Xo(t, e) {
|
|
154
|
+
e !== this.xn && this.Yo(), (this.qn = t), (this.xn = e);
|
|
143
155
|
}
|
|
144
|
-
|
|
156
|
+
Yo() {
|
|
145
157
|
null != this.qn &&
|
|
146
158
|
(clearTimeout(this.qn), (this.qn = null), (this.xn = null));
|
|
147
159
|
}
|
|
148
|
-
|
|
160
|
+
Zo(t, e, s, i) {
|
|
149
161
|
const r = this.B;
|
|
150
162
|
if (!r) return;
|
|
151
|
-
this.xn && t.triggerId !== this.xn && (this.
|
|
152
|
-
const n = r.
|
|
163
|
+
this.xn && t.triggerId !== this.xn && (this.Yo(), h.Ji(this.j, h.it.ta));
|
|
164
|
+
const n = r.ia(!1),
|
|
153
165
|
o = r.Z(n);
|
|
154
166
|
(o.template = { trigger_id: t.triggerId, trigger_event_type: e }),
|
|
155
|
-
null != s && (o.template.data = s.
|
|
156
|
-
const u = r.tt(o, h.it.
|
|
167
|
+
null != s && (o.template.data = s.oa());
|
|
168
|
+
const u = r.tt(o, h.it.ta);
|
|
157
169
|
r.et(
|
|
158
170
|
o,
|
|
159
171
|
(r = -1) => {
|
|
160
172
|
const n = this.B;
|
|
161
173
|
if (!n) return;
|
|
162
174
|
const m = new Date().valueOf();
|
|
163
|
-
h.nt(this.j, h.it.
|
|
175
|
+
h.nt(this.j, h.it.ta, m),
|
|
164
176
|
-1 !== r && u.push(["X-Braze-Req-Tokens-Remaining", r.toString()]);
|
|
165
|
-
let
|
|
166
|
-
|
|
167
|
-
|
|
177
|
+
let p,
|
|
178
|
+
c,
|
|
179
|
+
g = !1;
|
|
168
180
|
l.ot({
|
|
169
181
|
url: `${n.ht()}/template/`,
|
|
170
182
|
data: o,
|
|
171
183
|
headers: u,
|
|
172
184
|
lt: (e) => {
|
|
173
185
|
if (!n.ut(o, e, u))
|
|
174
|
-
return void ("function" == typeof t.
|
|
186
|
+
return void ("function" == typeof t.la && t.la());
|
|
175
187
|
if ((n.ct(), null == e || null == e.templated_message)) return;
|
|
176
188
|
const s = e.templated_message;
|
|
177
|
-
if (s.type !== gt.
|
|
189
|
+
if (s.type !== gt.ma.ua) return;
|
|
178
190
|
const i = pt(s.data);
|
|
179
191
|
if (null == i) return;
|
|
180
|
-
const r = this.
|
|
192
|
+
const r = this.Vn(i);
|
|
181
193
|
if (r)
|
|
182
|
-
return b.error(r), void ("function" == typeof t.
|
|
183
|
-
"function" == typeof t.
|
|
194
|
+
return b.error(r), void ("function" == typeof t.la && t.la());
|
|
195
|
+
"function" == typeof t.pa && t.pa(i);
|
|
184
196
|
},
|
|
185
197
|
error: (e) => {
|
|
186
|
-
(
|
|
187
|
-
(
|
|
188
|
-
(
|
|
198
|
+
(g = !0),
|
|
199
|
+
(p = e),
|
|
200
|
+
(c = `getting user personalization for message ${t.triggerId}.`);
|
|
189
201
|
},
|
|
190
202
|
ft: (r, o) => {
|
|
191
|
-
if (new Date().valueOf() - t.
|
|
203
|
+
if (new Date().valueOf() - t.ha < t.ca) {
|
|
192
204
|
let r = 0;
|
|
193
|
-
if (
|
|
205
|
+
if (g) {
|
|
194
206
|
const e = Math.min(t.ca, this.Dn),
|
|
195
207
|
s = this.An;
|
|
196
208
|
null == i && (i = s), (r = Math.min(e, a(s, 3 * i)));
|
|
@@ -198,22 +210,31 @@ export default class ea {
|
|
|
198
210
|
n.yt(
|
|
199
211
|
o,
|
|
200
212
|
() => {
|
|
201
|
-
this.
|
|
213
|
+
this.Zo(t, e, s, r);
|
|
202
214
|
},
|
|
203
|
-
h.it.
|
|
204
|
-
(e) => this.
|
|
205
|
-
() => this.
|
|
215
|
+
h.it.ta,
|
|
216
|
+
(e) => this.Xo(e, t.triggerId),
|
|
217
|
+
() => this.Yo(),
|
|
206
218
|
r,
|
|
207
219
|
);
|
|
208
220
|
}
|
|
209
|
-
|
|
221
|
+
g && n.dt(p, c);
|
|
210
222
|
},
|
|
211
223
|
});
|
|
212
224
|
},
|
|
213
|
-
h.it.
|
|
225
|
+
h.it.ta,
|
|
214
226
|
);
|
|
215
227
|
}
|
|
216
|
-
|
|
228
|
+
Xn(t) {
|
|
229
|
+
if (null == t || "" === t) return !1;
|
|
230
|
+
const e = new Date().valueOf(),
|
|
231
|
+
s = this.Pn[t];
|
|
232
|
+
return (null != s && e - s < At.aE) || ((this.Pn[t] = e), !1);
|
|
233
|
+
}
|
|
234
|
+
ga() {
|
|
235
|
+
this.Pn = {};
|
|
236
|
+
}
|
|
237
|
+
Kn(t) {
|
|
217
238
|
if (null == t.triggerId)
|
|
218
239
|
return (
|
|
219
240
|
b.info(
|
|
@@ -231,33 +252,33 @@ export default class ea {
|
|
|
231
252
|
!(t && t instanceof InAppMessage && t.constructor !== InAppMessage) ||
|
|
232
253
|
t instanceof ControlMessage
|
|
233
254
|
) &&
|
|
234
|
-
this.j.Pt(s.It.
|
|
255
|
+
this.j.Pt(s.It.fa, t.qt())
|
|
235
256
|
);
|
|
236
257
|
}
|
|
237
258
|
sa() {
|
|
238
259
|
if (!this.j) return null;
|
|
239
|
-
const t = this.j.St(s.It.
|
|
260
|
+
const t = this.j.St(s.It.fa);
|
|
240
261
|
if (!t) return null;
|
|
241
262
|
let e;
|
|
242
263
|
switch (t.type) {
|
|
243
|
-
case dt.
|
|
244
|
-
e = FullScreenMessage.
|
|
264
|
+
case dt.oE:
|
|
265
|
+
e = FullScreenMessage.da(t);
|
|
245
266
|
break;
|
|
246
|
-
case dt.
|
|
247
|
-
case dt.
|
|
248
|
-
case dt.
|
|
249
|
-
e = HtmlMessage.
|
|
267
|
+
case dt.ME:
|
|
268
|
+
case dt.CE:
|
|
269
|
+
case dt.DE:
|
|
270
|
+
e = HtmlMessage.da(t);
|
|
250
271
|
break;
|
|
251
|
-
case dt.
|
|
252
|
-
case dt.
|
|
253
|
-
e = ModalMessage.
|
|
272
|
+
case dt.tE:
|
|
273
|
+
case dt.eE:
|
|
274
|
+
e = ModalMessage.da(t);
|
|
254
275
|
break;
|
|
255
|
-
case dt.
|
|
256
|
-
e = SlideUpMessage.
|
|
276
|
+
case dt.RE:
|
|
277
|
+
e = SlideUpMessage.da(t);
|
|
257
278
|
}
|
|
258
|
-
return e && this.
|
|
279
|
+
return e && this.ja(), e;
|
|
259
280
|
}
|
|
260
|
-
|
|
261
|
-
this.j && this.j.Vt(s.It.
|
|
281
|
+
ja() {
|
|
282
|
+
this.j && this.j.Vt(s.It.fa);
|
|
262
283
|
}
|
|
263
284
|
}
|
|
@@ -12,7 +12,7 @@ export function logInAppMessageButtonClick(t, o) {
|
|
|
12
12
|
if (!(t instanceof InAppMessageButton))
|
|
13
13
|
return b.error("button must be an InAppMessageButton object"), !1;
|
|
14
14
|
if (!(o instanceof InAppMessage)) return b.error(mr.EE), !1;
|
|
15
|
-
const s = je.ra().
|
|
15
|
+
const s = je.ra().Ln(t, o);
|
|
16
16
|
if (s.lt)
|
|
17
17
|
for (let r = 0; r < s.Ce.length; r++)
|
|
18
18
|
rt.o().Ee(
|
|
@@ -9,7 +9,7 @@ import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-fac
|
|
|
9
9
|
export function logInAppMessageClick(s) {
|
|
10
10
|
if (!r.rr()) return !1;
|
|
11
11
|
if (!(s instanceof InAppMessage)) return b.error(mr.EE), !1;
|
|
12
|
-
const e = je.ra().Dt(s, p.
|
|
12
|
+
const e = je.ra().Dt(s, p.Hn);
|
|
13
13
|
if (e) {
|
|
14
14
|
s.sm() || logInAppMessageImpression(s);
|
|
15
15
|
for (let r = 0; r < e.Ce.length; r++)
|
|
@@ -8,6 +8,6 @@ export function logInAppMessageImpression(s) {
|
|
|
8
8
|
if (!r.rr()) return !1;
|
|
9
9
|
if (!(s instanceof InAppMessage || s instanceof ControlMessage))
|
|
10
10
|
return b.error(mr.EE), !1;
|
|
11
|
-
const o = s instanceof ControlMessage ? p.om : p.
|
|
11
|
+
const o = s instanceof ControlMessage ? p.om : p.On;
|
|
12
12
|
return je.ra().Dt(s, o).lt;
|
|
13
13
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IamCropType as Me,
|
|
3
3
|
IamDismissType as pr,
|
|
4
|
-
IamOrientation as
|
|
4
|
+
IamOrientation as Ae,
|
|
5
5
|
IamSerializationKeys as cr,
|
|
6
6
|
IamServerTypes as dt,
|
|
7
|
-
IamTextAlignment as
|
|
7
|
+
IamTextAlignment as Ee,
|
|
8
8
|
} from "../constants.js";
|
|
9
9
|
import { buttonsFromSerializedInAppMessage as ur } from "../in-app-message-factory.js";
|
|
10
10
|
import InAppMessage from "./in-app-message.js";
|
|
@@ -43,7 +43,7 @@ export default class FullScreenMessage extends InAppMessage {
|
|
|
43
43
|
D,
|
|
44
44
|
) {
|
|
45
45
|
(p = p || pr.MANUAL),
|
|
46
|
-
(k = k ||
|
|
46
|
+
(k = k || Ae.PORTRAIT),
|
|
47
47
|
super(
|
|
48
48
|
r,
|
|
49
49
|
s,
|
|
@@ -78,42 +78,42 @@ export default class FullScreenMessage extends InAppMessage {
|
|
|
78
78
|
C,
|
|
79
79
|
D,
|
|
80
80
|
),
|
|
81
|
-
(this.Go =
|
|
81
|
+
(this.Go = Ee.CENTER);
|
|
82
82
|
}
|
|
83
83
|
qt() {
|
|
84
|
-
return super.qt(dt.
|
|
84
|
+
return super.qt(dt.oE);
|
|
85
85
|
}
|
|
86
|
-
static
|
|
86
|
+
static da(r) {
|
|
87
87
|
return new FullScreenMessage(
|
|
88
|
-
r[cr.
|
|
89
|
-
r[cr.
|
|
88
|
+
r[cr.UE],
|
|
89
|
+
r[cr.cE],
|
|
90
90
|
r[cr.Is],
|
|
91
|
-
r[cr.
|
|
92
|
-
r[cr.
|
|
91
|
+
r[cr.PE],
|
|
92
|
+
r[cr.iE],
|
|
93
93
|
r[cr.URI],
|
|
94
|
+
r[cr.pE],
|
|
95
|
+
r[cr.rE],
|
|
96
|
+
r[cr.mE],
|
|
97
|
+
r[cr.GE],
|
|
98
|
+
r[cr.Bs],
|
|
94
99
|
r[cr.xE],
|
|
100
|
+
r[cr.HE],
|
|
101
|
+
r[cr.FE],
|
|
95
102
|
r[cr.BE],
|
|
96
|
-
r[cr.lE],
|
|
97
103
|
r[cr.bE],
|
|
98
|
-
r[cr.Bs],
|
|
99
104
|
r[cr.gE],
|
|
105
|
+
r[cr.lE],
|
|
100
106
|
r[cr.YE],
|
|
107
|
+
r[cr.hE],
|
|
101
108
|
r[cr.KE],
|
|
109
|
+
r[cr.WE],
|
|
102
110
|
r[cr.XE],
|
|
111
|
+
ur(r[cr.yE]),
|
|
103
112
|
r[cr.dE],
|
|
104
|
-
r[cr.hE],
|
|
105
|
-
r[cr.yE],
|
|
106
113
|
r[cr.uE],
|
|
107
|
-
r[cr.WE],
|
|
108
114
|
r[cr.fE],
|
|
109
|
-
r[cr.jE],
|
|
110
|
-
r[cr.kE],
|
|
111
|
-
ur(r[cr.vE]),
|
|
112
|
-
r[cr.wE],
|
|
113
|
-
r[cr.zE],
|
|
114
|
-
r[cr.VE],
|
|
115
115
|
r[cr.CSS],
|
|
116
|
-
r[cr.
|
|
116
|
+
r[cr.jE],
|
|
117
117
|
r[cr.LANGUAGE],
|
|
118
118
|
r[cr.Ns],
|
|
119
119
|
);
|
|
@@ -47,30 +47,30 @@ export default class HtmlMessage extends InAppMessage {
|
|
|
47
47
|
return !1;
|
|
48
48
|
}
|
|
49
49
|
Yt(i) {
|
|
50
|
-
if (this.ko === dt.
|
|
50
|
+
if (this.ko === dt.ME) {
|
|
51
51
|
if (this.rd) return !1;
|
|
52
52
|
this.rd = !0;
|
|
53
53
|
}
|
|
54
54
|
return this.ti.A(i), !0;
|
|
55
55
|
}
|
|
56
56
|
qt() {
|
|
57
|
-
const i = super.qt(dt.
|
|
58
|
-
return (i[cr.
|
|
57
|
+
const i = super.qt(dt.ME);
|
|
58
|
+
return (i[cr.wE] = this.messageFields), i;
|
|
59
59
|
}
|
|
60
|
-
static
|
|
60
|
+
static da(i) {
|
|
61
61
|
return new HtmlMessage(
|
|
62
|
-
i[cr.
|
|
62
|
+
i[cr.UE],
|
|
63
63
|
i[cr.Is],
|
|
64
|
-
i[cr.
|
|
65
|
-
i[cr.
|
|
64
|
+
i[cr.PE],
|
|
65
|
+
i[cr.rE],
|
|
66
|
+
i[cr.mE],
|
|
66
67
|
i[cr.lE],
|
|
67
|
-
i[cr.
|
|
68
|
-
i[cr.
|
|
69
|
-
i[cr.
|
|
70
|
-
i[cr.VE],
|
|
68
|
+
i[cr.YE],
|
|
69
|
+
i[cr.XE],
|
|
70
|
+
i[cr.fE],
|
|
71
71
|
i[cr.CSS],
|
|
72
|
-
i[cr.
|
|
73
|
-
i[cr.
|
|
72
|
+
i[cr.wE],
|
|
73
|
+
i[cr.jE],
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -15,7 +15,7 @@ export default class InAppMessageButton {
|
|
|
15
15
|
(this.borderColor = r || this.backgroundColor),
|
|
16
16
|
(this.clickAction = h || Le.NONE),
|
|
17
17
|
(this.uri = e),
|
|
18
|
-
null == n && (n = InAppMessageButton.
|
|
18
|
+
null == n && (n = InAppMessageButton.Qn),
|
|
19
19
|
(this.id = n),
|
|
20
20
|
(this.rd = !1),
|
|
21
21
|
(this.ti = new f());
|
|
@@ -44,4 +44,4 @@ export default class InAppMessageButton {
|
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
InAppMessageButton.
|
|
47
|
+
InAppMessageButton.Qn = -1;
|