@braze/web-sdk 5.3.2 → 5.5.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 +20 -4
- package/package.json +1 -1
- package/shared-lib/event-types.js +12 -12
- package/shared-lib/indexed-db-adapter.js +14 -14
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +10 -9
- package/src/Card/card-manager.js +46 -42
- package/src/Card/display/card-display.js +59 -58
- package/src/Card/models/card.js +61 -55
- package/src/Card/models/classic-card.js +1 -1
- package/src/Card/models/control-card.js +1 -1
- package/src/Card/models/image-only.js +1 -1
- package/src/Card/util/card-factory.js +20 -20
- package/src/ContentCards/content-cards-provider.js +140 -140
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +4 -4
- package/src/ContentCards/ui/show-content-cards.js +3 -3
- package/src/Core/disable-sdk.js +2 -2
- package/src/Core/enable-sdk.js +2 -2
- package/src/Core/index.js +1 -0
- package/src/Core/is-initialized.js +4 -0
- package/src/Core/log-custom-event.js +14 -14
- package/src/Core/log-purchase.js +8 -8
- package/src/Core/open-session.js +4 -4
- package/src/Core/wipe-data.js +2 -2
- package/src/FeatureFlags/feature-flag-factory.js +5 -5
- package/src/FeatureFlags/feature-flag.js +1 -1
- package/src/FeatureFlags/feature-flags-provider.js +74 -74
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/log-feature-flag-impression.js +12 -12
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/Feed/feed-provider.js +29 -29
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/display/in-app-message-to-html.js +64 -62
- package/src/InAppMessage/in-app-message-manager.js +63 -63
- 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 +2 -2
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/full-screen-message.js +10 -10
- package/src/InAppMessage/models/html-message.js +13 -13
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +59 -59
- package/src/InAppMessage/models/modal-message.js +9 -9
- package/src/InAppMessage/models/slide-up-message.js +11 -11
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/ui/show-in-app-message.js +42 -40
- package/src/Push/push-manager-factory.js +5 -4
- package/src/Push/push-manager.js +77 -89
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +8 -8
- package/src/User/user.js +29 -29
- package/src/common/base-provider.js +1 -1
- package/src/common/event-logger.js +11 -11
- package/src/common/feed-display.js +18 -17
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/l10n/l10n-manager.js +15 -5
- package/src/managers/auth-manager.js +9 -9
- package/src/managers/braze-instance.js +89 -87
- package/src/managers/device-manager.js +17 -17
- package/src/managers/network-manager.js +130 -130
- package/src/managers/server-config-manager.js +24 -24
- package/src/managers/session-manager.js +12 -12
- package/src/managers/storage-manager-factory.js +1 -1
- package/src/managers/storage-manager.js +31 -31
- package/src/managers/subscription-manager.js +2 -2
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +4 -4
- package/src/models/device.js +2 -2
- package/src/models/request-result.js +1 -1
- package/src/models/server-config.js +5 -5
- package/src/request-controller.js +130 -130
- package/src/triggers/models/filter.js +9 -9
- package/src/triggers/models/in-app-message-click-data.js +8 -8
- package/src/triggers/models/push-click-data.js +3 -3
- package/src/triggers/models/trigger-condition.js +27 -27
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +7 -7
- package/src/triggers/triggers-provider.js +29 -29
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/feed-css.js +1 -1
- package/src/ui/js/iam-css.js +1 -1
- package/src/util/base-device-parser.js +7 -7
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +21 -21
- package/src/util/client-hints-parser.js +3 -3
- package/src/util/component-utils.js +13 -12
- package/src/util/net.js +4 -4
- package/src/util/request-header-utils.js +17 -17
- package/src/util/user-agent-parser.js +3 -3
- package/src/util/window-utils.js +1 -1
|
@@ -16,54 +16,55 @@ import { _handleBrazeAction as u } from "../../Core/handle-braze-action.js";
|
|
|
16
16
|
import dt from "./html-message-to-html.js";
|
|
17
17
|
import le from "./modal-utils.js";
|
|
18
18
|
import { logger as r, Guid as p } from "../../../shared-lib/index.js";
|
|
19
|
-
export default function ce(e, o, a, t, n, s, i, l = document.body) {
|
|
19
|
+
export default function ce(e, o, a, t, n, s, i, l = document.body, b = "ltr") {
|
|
20
20
|
if (((e.ke = document.activeElement), e instanceof HtmlMessage))
|
|
21
21
|
return dt(e, o, a, n, s, i);
|
|
22
|
-
const
|
|
23
|
-
let
|
|
24
|
-
const
|
|
25
|
-
(
|
|
26
|
-
|
|
22
|
+
const g = (function (e, o, a, t, n, s, i = document.body, m = "ltr") {
|
|
23
|
+
let l = null;
|
|
24
|
+
const c = document.createElement("div");
|
|
25
|
+
(c.dir = m),
|
|
26
|
+
(c.className = "ab-in-app-message ab-start-hidden ab-background"),
|
|
27
|
+
s && (c.style.zIndex = (s + 1).toString()),
|
|
27
28
|
e.$e() &&
|
|
28
|
-
((
|
|
29
|
-
|
|
29
|
+
((c.className += " ab-modal-interactions"),
|
|
30
|
+
c.setAttribute("tabindex", "-1")),
|
|
30
31
|
e.ve() ||
|
|
31
|
-
((
|
|
32
|
-
(
|
|
33
|
-
ne(e.backgroundColor) && (
|
|
34
|
-
const
|
|
35
|
-
-1 !==
|
|
36
|
-
((
|
|
32
|
+
((c.style.color = ie(e.textColor)),
|
|
33
|
+
(c.style.backgroundColor = ie(e.backgroundColor)),
|
|
34
|
+
ne(e.backgroundColor) && (c.className += " ab-no-shadow"));
|
|
35
|
+
const b = () => {
|
|
36
|
+
-1 !== c.className.indexOf("ab-start-hidden") &&
|
|
37
|
+
((c.className = c.className.replace("ab-start-hidden", "")),
|
|
37
38
|
document.querySelectorAll(".ab-iam-img-loading").length > 0
|
|
38
39
|
? t(
|
|
39
40
|
`Cannot show in-app message ${e.message} because another message is being shown.`,
|
|
40
41
|
InAppMessage.Le.ze,
|
|
41
42
|
)
|
|
42
|
-
: a(
|
|
43
|
+
: a(c));
|
|
43
44
|
},
|
|
44
|
-
|
|
45
|
+
g = (o = !0) => {
|
|
45
46
|
let a = document.querySelectorAll(".ab-iam-root");
|
|
46
47
|
(a && 0 !== a.length) || (a = i.querySelectorAll(".ab-iam-root")),
|
|
47
48
|
a &&
|
|
48
49
|
a.length > 0 &&
|
|
49
50
|
(a[0].classList.remove("ab-iam-img-loading"),
|
|
50
|
-
|
|
51
|
+
l && (clearTimeout(l), (l = null)),
|
|
51
52
|
o
|
|
52
|
-
?
|
|
53
|
+
? b()
|
|
53
54
|
: r.error(
|
|
54
55
|
`Cannot show in-app message ${e.message} because the image failed to load.`,
|
|
55
56
|
));
|
|
56
57
|
};
|
|
57
58
|
e.imageStyle === InAppMessage.ImageStyle.GRAPHIC &&
|
|
58
|
-
(
|
|
59
|
+
(c.className += " graphic"),
|
|
59
60
|
e.orientation === InAppMessage.Orientation.LANDSCAPE &&
|
|
60
|
-
(
|
|
61
|
+
(c.className += " landscape"),
|
|
61
62
|
null != e.buttons &&
|
|
62
63
|
0 === e.buttons.length &&
|
|
63
64
|
(e.clickAction !== InAppMessage.ClickAction.NONE &&
|
|
64
|
-
(
|
|
65
|
-
(
|
|
66
|
-
e.Cr(
|
|
65
|
+
(c.className += " ab-clickable"),
|
|
66
|
+
(c.onclick = (a) => (
|
|
67
|
+
e.Cr(c, () => {
|
|
67
68
|
logInAppMessageClick(e),
|
|
68
69
|
e.clickAction === InAppMessage.ClickAction.URI
|
|
69
70
|
? u(
|
|
@@ -76,21 +77,22 @@ export default function ce(e, o, a, t, n, s, i, l = document.body) {
|
|
|
76
77
|
a.stopPropagation(),
|
|
77
78
|
!1
|
|
78
79
|
)));
|
|
79
|
-
const
|
|
80
|
+
const f = d(
|
|
80
81
|
"Close Message",
|
|
81
82
|
e.ve() ? void 0 : ie(e.closeButtonColor),
|
|
82
83
|
() => {
|
|
83
|
-
e.Cr(
|
|
84
|
+
e.Cr(c);
|
|
84
85
|
},
|
|
86
|
+
m,
|
|
85
87
|
);
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
let
|
|
92
|
-
const
|
|
93
|
-
if (((
|
|
88
|
+
c.appendChild(f), s && (f.style.zIndex = (s + 2).toString());
|
|
89
|
+
const h = document.createElement("div");
|
|
90
|
+
(h.className = "ab-message-text"), (h.dir = m);
|
|
91
|
+
const j = (e.messageAlignment || e.qe).toLowerCase();
|
|
92
|
+
h.className += " " + j + "-aligned";
|
|
93
|
+
let w = !1;
|
|
94
|
+
const v = document.createElement("div");
|
|
95
|
+
if (((v.className = "ab-image-area"), e.imageUrl)) {
|
|
94
96
|
if (e.cropType === InAppMessage.CropType.CENTER_CROP) {
|
|
95
97
|
const o = document.createElement("span");
|
|
96
98
|
(o.className = "ab-center-cropped-img"),
|
|
@@ -98,7 +100,7 @@ export default function ce(e, o, a, t, n, s, i, l = document.body) {
|
|
|
98
100
|
o.setAttribute("role", "img"),
|
|
99
101
|
o.setAttribute("aria-label", "Modal Image"),
|
|
100
102
|
e.Ae(o),
|
|
101
|
-
|
|
103
|
+
v.appendChild(o);
|
|
102
104
|
} else {
|
|
103
105
|
const o = document.createElement("img");
|
|
104
106
|
if (
|
|
@@ -106,24 +108,24 @@ export default function ce(e, o, a, t, n, s, i, l = document.body) {
|
|
|
106
108
|
e.Ae(o),
|
|
107
109
|
0 === document.querySelectorAll(".ab-iam-img-loading").length)
|
|
108
110
|
) {
|
|
109
|
-
|
|
111
|
+
w = !0;
|
|
110
112
|
const e = document.querySelectorAll(".ab-iam-root");
|
|
111
113
|
e && e.length > 0 && e[0].classList.add("ab-iam-img-loading"),
|
|
112
|
-
(
|
|
113
|
-
|
|
114
|
+
(l = window.setTimeout(() => {
|
|
115
|
+
g(!1);
|
|
114
116
|
}, 6e4)),
|
|
115
117
|
(o.onload = () => {
|
|
116
|
-
|
|
118
|
+
g();
|
|
117
119
|
}),
|
|
118
120
|
(o.onerror = () => {
|
|
119
|
-
|
|
121
|
+
g(!1);
|
|
120
122
|
});
|
|
121
123
|
}
|
|
122
|
-
|
|
124
|
+
v.appendChild(o);
|
|
123
125
|
}
|
|
124
|
-
|
|
126
|
+
c.appendChild(v), (h.className += " ab-with-image");
|
|
125
127
|
} else if (e.icon) {
|
|
126
|
-
|
|
128
|
+
v.className += " ab-icon-area";
|
|
127
129
|
const o = document.createElement("span");
|
|
128
130
|
(o.className = "ab-icon"),
|
|
129
131
|
e.ve() ||
|
|
@@ -134,11 +136,11 @@ export default function ce(e, o, a, t, n, s, i, l = document.body) {
|
|
|
134
136
|
a.appendChild(document.createTextNode(e.icon)),
|
|
135
137
|
a.setAttribute("aria-hidden", "true"),
|
|
136
138
|
o.appendChild(a),
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
(
|
|
139
|
+
v.appendChild(o),
|
|
140
|
+
c.appendChild(v),
|
|
141
|
+
(h.className += " ab-with-icon");
|
|
140
142
|
}
|
|
141
|
-
if ((oe(
|
|
143
|
+
if ((oe(h, "touchstart"), e.header && e.header.length > 0)) {
|
|
142
144
|
const o = document.createElement("h1");
|
|
143
145
|
(o.className = "ab-message-header"), (e.De = p.W()), (o.id = e.De);
|
|
144
146
|
const a = (
|
|
@@ -147,19 +149,19 @@ export default function ce(e, o, a, t, n, s, i, l = document.body) {
|
|
|
147
149
|
(o.className += " " + a + "-aligned"),
|
|
148
150
|
e.ve() || (o.style.color = ie(e.headerTextColor)),
|
|
149
151
|
o.appendChild(document.createTextNode(e.header)),
|
|
150
|
-
|
|
152
|
+
h.appendChild(o);
|
|
151
153
|
}
|
|
152
|
-
return
|
|
153
|
-
})(e, o, a, t, n, s, l);
|
|
154
|
+
return h.appendChild(e.Ge()), c.appendChild(h), w || b(), (e.Re = c), c;
|
|
155
|
+
})(e, o, a, t, n, s, l, b);
|
|
154
156
|
if (e instanceof FullScreenMessage || e instanceof ModalMessage) {
|
|
155
157
|
const a = e instanceof FullScreenMessage ? "ab-fullscreen" : "ab-modal";
|
|
156
|
-
(
|
|
157
|
-
le.He(e, o,
|
|
158
|
-
le.Je(
|
|
159
|
-
le.Ke(e.De,
|
|
158
|
+
(g.className += ` ${a} ab-centered`),
|
|
159
|
+
le.He(e, o, g, n),
|
|
160
|
+
le.Je(g),
|
|
161
|
+
le.Ke(e.De, g);
|
|
160
162
|
} else if (e instanceof SlideUpMessage) {
|
|
161
|
-
|
|
162
|
-
const o =
|
|
163
|
+
g.className += " ab-slideup";
|
|
164
|
+
const o = g.getElementsByClassName("ab-close-button")[0];
|
|
163
165
|
if (null != o) {
|
|
164
166
|
const a = ae(
|
|
165
167
|
"0 0 11.38 19.44",
|
|
@@ -169,20 +171,20 @@ export default function ce(e, o, a, t, n, s, i, l = document.body) {
|
|
|
169
171
|
a.setAttribute("class", "ab-chevron"), o.appendChild(a);
|
|
170
172
|
}
|
|
171
173
|
let a, t;
|
|
172
|
-
c(
|
|
173
|
-
(
|
|
174
|
+
c(g, m.U, (e) => {
|
|
175
|
+
(g.className += " ab-swiped-left"),
|
|
174
176
|
null != o && null != o.onclick && o.onclick(e);
|
|
175
177
|
}),
|
|
176
|
-
c(
|
|
177
|
-
(
|
|
178
|
+
c(g, m.V, (e) => {
|
|
179
|
+
(g.className += " ab-swiped-right"),
|
|
178
180
|
null != o && null != o.onclick && o.onclick(e);
|
|
179
181
|
}),
|
|
180
182
|
e.slideFrom === InAppMessage.SlideFrom.TOP
|
|
181
183
|
? ((a = m.Oe), (t = " ab-swiped-up"))
|
|
182
184
|
: ((a = m.Qe), (t = " ab-swiped-down")),
|
|
183
|
-
c(
|
|
184
|
-
(
|
|
185
|
+
c(g, a, (e) => {
|
|
186
|
+
(g.className += t), null != o && null != o.onclick && o.onclick(e);
|
|
185
187
|
});
|
|
186
188
|
}
|
|
187
|
-
return
|
|
189
|
+
return g;
|
|
188
190
|
}
|
|
@@ -4,10 +4,10 @@ import ControlMessage from "./models/control-message.js";
|
|
|
4
4
|
import HtmlMessage from "./models/html-message.js";
|
|
5
5
|
import InAppMessage from "./models/in-app-message.js";
|
|
6
6
|
import InAppMessageButton from "./models/in-app-message-button.js";
|
|
7
|
-
import
|
|
7
|
+
import t from "../common/event-logger.js";
|
|
8
8
|
import { newInAppMessageFromJson as pt } from "./in-app-message-factory.js";
|
|
9
9
|
import { randomInclusive as U } from "../util/math.js";
|
|
10
|
-
import
|
|
10
|
+
import s 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
13
|
import gt from "../triggers/models/trigger.js";
|
|
@@ -25,16 +25,16 @@ import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
|
|
|
25
25
|
import { FullScreenMessage, ModalMessage, SlideUpMessage } from "./index.js";
|
|
26
26
|
export default class aa {
|
|
27
27
|
constructor(t, s, i, r) {
|
|
28
|
-
(this
|
|
29
|
-
(this.
|
|
28
|
+
(this.$t = t),
|
|
29
|
+
(this.oi = s),
|
|
30
30
|
(this.u = i),
|
|
31
|
-
(this.
|
|
32
|
-
(this
|
|
33
|
-
(this.
|
|
31
|
+
(this.yt = r),
|
|
32
|
+
(this.$t = t),
|
|
33
|
+
(this.oi = s),
|
|
34
34
|
(this.u = i),
|
|
35
|
-
(this.
|
|
35
|
+
(this.yt = r),
|
|
36
36
|
(this._e = new T()),
|
|
37
|
-
e
|
|
37
|
+
e.Ht(this._e),
|
|
38
38
|
(this.Xe = 1e3),
|
|
39
39
|
(this.We = 6e4),
|
|
40
40
|
(this.Ye = null);
|
|
@@ -43,7 +43,7 @@ export default class aa {
|
|
|
43
43
|
return this._e;
|
|
44
44
|
}
|
|
45
45
|
Mi(t) {
|
|
46
|
-
return this._e.
|
|
46
|
+
return this._e.Nt(t);
|
|
47
47
|
}
|
|
48
48
|
_i() {
|
|
49
49
|
return this.Ye;
|
|
@@ -52,11 +52,11 @@ export default class aa {
|
|
|
52
52
|
this.Ye = t;
|
|
53
53
|
}
|
|
54
54
|
q(e, n, o, a) {
|
|
55
|
-
const l = new
|
|
55
|
+
const l = new s();
|
|
56
56
|
let u;
|
|
57
57
|
if (e instanceof ControlMessage) u = { trigger_ids: [e.triggerId] };
|
|
58
58
|
else {
|
|
59
|
-
if (n === i.$i || (e instanceof HtmlMessage && n === i.
|
|
59
|
+
if (n === i.$i || (e instanceof HtmlMessage && n === i.Oi)) {
|
|
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.Xi) {
|
|
68
68
|
if (!e.K())
|
|
69
69
|
return (
|
|
70
70
|
r.info(
|
|
@@ -73,16 +73,16 @@ export default class aa {
|
|
|
73
73
|
l
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
|
-
u = this.
|
|
76
|
+
u = this.Hi(e);
|
|
77
77
|
}
|
|
78
78
|
return null == u
|
|
79
79
|
? l
|
|
80
80
|
: (e.messageExtras && (u.message_extras = e.messageExtras),
|
|
81
81
|
null != o && (u.bid = o),
|
|
82
|
-
|
|
82
|
+
t.q(n, u));
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
const o = new
|
|
84
|
+
Ji(e, n) {
|
|
85
|
+
const o = new s();
|
|
86
86
|
if (!e.p())
|
|
87
87
|
return (
|
|
88
88
|
r.info(
|
|
@@ -90,32 +90,32 @@ export default class aa {
|
|
|
90
90
|
),
|
|
91
91
|
o
|
|
92
92
|
);
|
|
93
|
-
const a = this.
|
|
93
|
+
const a = this.Hi(n);
|
|
94
94
|
return null == a
|
|
95
95
|
? o
|
|
96
|
-
: e.id === InAppMessageButton.
|
|
96
|
+
: e.id === InAppMessageButton.Ki
|
|
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),
|
|
101
|
+
: (null != e.id && (a.bid = e.id), t.q(i.Oi, a));
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
Li(t) {
|
|
104
104
|
const e = t.messageFields;
|
|
105
105
|
return (null != e && e.is_push_primer) || !1;
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
Qi(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
112
|
return jt(e)
|
|
113
|
-
? vt(bt.Li, "In-App Message")
|
|
114
|
-
: ft(e) && !yt.Qi()
|
|
115
113
|
? vt(bt.Vi, "In-App Message")
|
|
114
|
+
: ft(e) && !yt.Wi()
|
|
115
|
+
? vt(bt.Yi, "In-App Message")
|
|
116
116
|
: void 0;
|
|
117
117
|
};
|
|
118
|
-
if (this.
|
|
118
|
+
if (this.Li(t) && !yt.Wi())
|
|
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
|
-
|
|
137
|
-
const n = this
|
|
136
|
+
Zi(t, e, s, i) {
|
|
137
|
+
const n = this.$t;
|
|
138
138
|
if (!n) return;
|
|
139
|
-
const o = n.
|
|
140
|
-
a = n
|
|
139
|
+
const o = n.Ir(!1, !1),
|
|
140
|
+
a = n.$s(o);
|
|
141
141
|
(a.template = { trigger_id: t.triggerId, trigger_event_type: e }),
|
|
142
|
-
null != s && (a.template.data = s.
|
|
143
|
-
const l = n
|
|
144
|
-
n.
|
|
142
|
+
null != s && (a.template.data = s.Mr());
|
|
143
|
+
const l = n.Ps(a, D._s.Tr);
|
|
144
|
+
n.Gs(
|
|
145
145
|
a,
|
|
146
146
|
(n = -1) => {
|
|
147
|
-
if (!this
|
|
147
|
+
if (!this.$t) return;
|
|
148
148
|
const o = new Date().valueOf();
|
|
149
|
-
D.
|
|
149
|
+
D.Hs(this.u, D._s.Tr, o),
|
|
150
150
|
-1 !== n && l.push(["X-Braze-Req-Tokens-Remaining", n.toString()]),
|
|
151
|
-
C.
|
|
152
|
-
url: `${this.
|
|
151
|
+
C.Ks({
|
|
152
|
+
url: `${this.$t.Os()}/template/`,
|
|
153
153
|
data: a,
|
|
154
154
|
headers: l,
|
|
155
155
|
L: (e) => {
|
|
156
|
-
if ((D.
|
|
157
|
-
return void ("function" == typeof t.
|
|
158
|
-
if ((this.
|
|
156
|
+
if ((D.Ws(this.u, D._s.Tr, 1), !this.$t.Qs(a, e, l)))
|
|
157
|
+
return void ("function" == typeof t.Br && t.Br());
|
|
158
|
+
if ((this.$t.Vs(), null == e || null == e.templated_message))
|
|
159
159
|
return;
|
|
160
160
|
const s = e.templated_message;
|
|
161
|
-
if (s.type !== gt.
|
|
161
|
+
if (s.type !== gt.Er._r) return;
|
|
162
162
|
const i = pt(s.data);
|
|
163
163
|
if (null == i) return;
|
|
164
|
-
const n = this.
|
|
164
|
+
const n = this.Qi(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.Br && t.Br());
|
|
167
|
+
"function" == typeof t.Gr && t.Gr(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.
|
|
173
|
-
const r = Math.min(t.
|
|
171
|
+
if (new Date().valueOf() - t.Nr < t.Or) {
|
|
172
|
+
D.ti(this.u, D._s.Tr);
|
|
173
|
+
const r = Math.min(t.Or, 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.Zi(t, e, s, a);
|
|
180
180
|
}, a);
|
|
181
181
|
}
|
|
182
|
-
this.
|
|
182
|
+
this.$t.Ys(r, n);
|
|
183
183
|
},
|
|
184
184
|
});
|
|
185
185
|
},
|
|
186
|
-
D.
|
|
186
|
+
D._s.Tr,
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
Hi(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.
|
|
207
|
+
this.u.I(o.C.Xr, 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.Xr);
|
|
213
213
|
if (!t) return null;
|
|
214
214
|
let e;
|
|
215
215
|
switch (t.type) {
|
|
216
|
-
case InAppMessage.Be.Or:
|
|
217
|
-
e = FullScreenMessage.Xr(t);
|
|
218
|
-
break;
|
|
219
216
|
case InAppMessage.Be.Hr:
|
|
217
|
+
e = FullScreenMessage.Jr(t);
|
|
218
|
+
break;
|
|
219
|
+
case InAppMessage.Be.Kr:
|
|
220
220
|
case InAppMessage.Be.Me:
|
|
221
221
|
case InAppMessage.Be.Ve:
|
|
222
|
-
e = HtmlMessage.
|
|
222
|
+
e = HtmlMessage.Jr(t);
|
|
223
223
|
break;
|
|
224
|
-
case InAppMessage.Be.
|
|
224
|
+
case InAppMessage.Be.Lr:
|
|
225
225
|
case InAppMessage.Be.Ue:
|
|
226
|
-
e = ModalMessage.
|
|
226
|
+
e = ModalMessage.Jr(t);
|
|
227
227
|
break;
|
|
228
|
-
case InAppMessage.Be.
|
|
229
|
-
e = SlideUpMessage.
|
|
228
|
+
case InAppMessage.Be.Qr:
|
|
229
|
+
e = SlideUpMessage.Jr(t);
|
|
230
230
|
}
|
|
231
|
-
return e && this.
|
|
231
|
+
return e && this.Ur(), e;
|
|
232
232
|
}
|
|
233
|
-
|
|
234
|
-
this.u && this.u.
|
|
233
|
+
Ur() {
|
|
234
|
+
this.u && this.u.ii(o.C.Xr);
|
|
235
235
|
}
|
|
236
236
|
}
|
|
@@ -12,11 +12,11 @@ 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().Ji(o, t);
|
|
16
16
|
if (n.L)
|
|
17
17
|
for (let r = 0; r < n.ge.length; r++)
|
|
18
18
|
et.rr().fe(
|
|
19
|
-
tt.
|
|
19
|
+
tt.Vr,
|
|
20
20
|
[
|
|
21
21
|
t.triggerId,
|
|
22
22
|
null === (s = o.id) || void 0 === s ? void 0 : s.toString(),
|
|
@@ -11,9 +11,9 @@ export function logInAppMessageClick(o) {
|
|
|
11
11
|
if (!(o instanceof InAppMessage)) return r.error(sr), !1;
|
|
12
12
|
const s = se.m().q(o, i.$i);
|
|
13
13
|
if (s) {
|
|
14
|
-
o.
|
|
14
|
+
o.Wr() || logInAppMessageImpression(o);
|
|
15
15
|
for (let r = 0; r < s.ge.length; r++)
|
|
16
|
-
et.rr().fe(tt.
|
|
16
|
+
et.rr().fe(tt.Vr, [o.triggerId], s.ge[r]);
|
|
17
17
|
}
|
|
18
18
|
return s.L;
|
|
19
19
|
}
|
|
@@ -14,10 +14,10 @@ export function logInAppMessageHtmlClick(t, s, o) {
|
|
|
14
14
|
!1
|
|
15
15
|
);
|
|
16
16
|
let m = i.$i;
|
|
17
|
-
null != s && (m = i.
|
|
17
|
+
null != s && (m = i.Oi);
|
|
18
18
|
const n = se.m().q(t, m, s, o);
|
|
19
19
|
if (n.L)
|
|
20
20
|
for (let e = 0; e < n.ge.length; e++)
|
|
21
|
-
et.rr().fe(tt.
|
|
21
|
+
et.rr().fe(tt.Vr, [t.triggerId, s], n.ge[e]);
|
|
22
22
|
return n.L;
|
|
23
23
|
}
|
|
@@ -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.Xi;
|
|
12
12
|
return se.m().q(o, s).L;
|
|
13
13
|
}
|
|
@@ -71,21 +71,19 @@ export default class FullScreenMessage extends InAppMessage {
|
|
|
71
71
|
Y() {
|
|
72
72
|
return super.Y(FullScreenMessage.it);
|
|
73
73
|
}
|
|
74
|
-
static
|
|
74
|
+
static Jr(e) {
|
|
75
75
|
return new FullScreenMessage(
|
|
76
|
-
e[InAppMessage.tt.Vr],
|
|
77
|
-
e[InAppMessage.tt.Wr],
|
|
78
|
-
e[InAppMessage.tt.bt],
|
|
79
76
|
e[InAppMessage.tt.Yr],
|
|
80
77
|
e[InAppMessage.tt.Zr],
|
|
81
|
-
e[InAppMessage.tt.
|
|
78
|
+
e[InAppMessage.tt.bt],
|
|
82
79
|
e[InAppMessage.tt.ea],
|
|
83
80
|
e[InAppMessage.tt.ra],
|
|
81
|
+
e[InAppMessage.tt.URI],
|
|
84
82
|
e[InAppMessage.tt.sa],
|
|
85
83
|
e[InAppMessage.tt.ta],
|
|
86
|
-
e[InAppMessage.tt.ot],
|
|
87
84
|
e[InAppMessage.tt.ia],
|
|
88
85
|
e[InAppMessage.tt.aa],
|
|
86
|
+
e[InAppMessage.tt.ot],
|
|
89
87
|
e[InAppMessage.tt.oa],
|
|
90
88
|
e[InAppMessage.tt.pa],
|
|
91
89
|
e[InAppMessage.tt.ma],
|
|
@@ -96,13 +94,15 @@ export default class FullScreenMessage extends InAppMessage {
|
|
|
96
94
|
e[InAppMessage.tt.da],
|
|
97
95
|
e[InAppMessage.tt.la],
|
|
98
96
|
e[InAppMessage.tt.ga],
|
|
99
|
-
|
|
97
|
+
e[InAppMessage.tt.ja],
|
|
100
98
|
e[InAppMessage.tt.xa],
|
|
101
|
-
e[InAppMessage.tt.za],
|
|
99
|
+
pe(e[InAppMessage.tt.za]),
|
|
102
100
|
e[InAppMessage.tt.ha],
|
|
103
|
-
e[InAppMessage.tt.CSS],
|
|
104
101
|
e[InAppMessage.tt.va],
|
|
102
|
+
e[InAppMessage.tt.wa],
|
|
103
|
+
e[InAppMessage.tt.CSS],
|
|
104
|
+
e[InAppMessage.tt.ya],
|
|
105
105
|
);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
FullScreenMessage.it = InAppMessage.Be.
|
|
108
|
+
FullScreenMessage.it = InAppMessage.Be.Hr;
|
|
@@ -40,31 +40,31 @@ export default class HtmlMessage extends InAppMessage {
|
|
|
40
40
|
return !1;
|
|
41
41
|
}
|
|
42
42
|
p(i) {
|
|
43
|
-
if (this.xe === InAppMessage.Be.
|
|
43
|
+
if (this.xe === InAppMessage.Be.Kr) {
|
|
44
44
|
if (this.vo) return !1;
|
|
45
45
|
this.vo = !0;
|
|
46
46
|
}
|
|
47
|
-
return this.Et.
|
|
47
|
+
return this.Et.Rt(i), !0;
|
|
48
48
|
}
|
|
49
49
|
Y() {
|
|
50
50
|
const i = super.Y(HtmlMessage.it);
|
|
51
51
|
return (i[InAppMessage.tt.uo] = this.messageFields), i;
|
|
52
52
|
}
|
|
53
|
-
static
|
|
53
|
+
static Jr(i) {
|
|
54
54
|
return new HtmlMessage(
|
|
55
|
-
i[InAppMessage.tt.Vr],
|
|
56
|
-
i[InAppMessage.tt.bt],
|
|
57
55
|
i[InAppMessage.tt.Yr],
|
|
58
|
-
i[InAppMessage.tt.
|
|
59
|
-
i[InAppMessage.tt.
|
|
60
|
-
i[InAppMessage.tt.
|
|
61
|
-
i[InAppMessage.tt.
|
|
62
|
-
i[InAppMessage.tt.
|
|
63
|
-
i[InAppMessage.tt.
|
|
56
|
+
i[InAppMessage.tt.bt],
|
|
57
|
+
i[InAppMessage.tt.ea],
|
|
58
|
+
i[InAppMessage.tt.ta],
|
|
59
|
+
i[InAppMessage.tt.ia],
|
|
60
|
+
i[InAppMessage.tt.fa],
|
|
61
|
+
i[InAppMessage.tt.da],
|
|
62
|
+
i[InAppMessage.tt.xa],
|
|
63
|
+
i[InAppMessage.tt.wa],
|
|
64
64
|
i[InAppMessage.tt.CSS],
|
|
65
65
|
i[InAppMessage.tt.uo],
|
|
66
|
-
i[InAppMessage.tt.
|
|
66
|
+
i[InAppMessage.tt.ya],
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
HtmlMessage.it = InAppMessage.Be.
|
|
70
|
+
HtmlMessage.it = InAppMessage.Be.Kr;
|
|
@@ -15,13 +15,13 @@ 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.Ki),
|
|
19
19
|
(this.id = n),
|
|
20
20
|
(this.vo = !1),
|
|
21
21
|
(this.Et = new T());
|
|
22
22
|
}
|
|
23
23
|
subscribeToClickedEvent(s) {
|
|
24
|
-
return this.Et.
|
|
24
|
+
return this.Et.Nt(s);
|
|
25
25
|
}
|
|
26
26
|
removeSubscription(s) {
|
|
27
27
|
this.Et.removeSubscription(s);
|
|
@@ -30,7 +30,7 @@ export default class InAppMessageButton {
|
|
|
30
30
|
this.Et.removeAllSubscriptions();
|
|
31
31
|
}
|
|
32
32
|
p() {
|
|
33
|
-
return !this.vo && ((this.vo = !0), this.Et.
|
|
33
|
+
return !this.vo && ((this.vo = !0), this.Et.Rt(), !0);
|
|
34
34
|
}
|
|
35
35
|
static fromJson(s) {
|
|
36
36
|
return new InAppMessageButton(
|
|
@@ -44,4 +44,4 @@ export default class InAppMessageButton {
|
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
InAppMessageButton.
|
|
47
|
+
InAppMessageButton.Ki = -1;
|