@braze/web-sdk 5.7.0 → 5.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +4 -4
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +23 -23
- package/shared-lib/guid.js +1 -1
- package/shared-lib/indexed-db-adapter.js +21 -21
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +18 -18
- package/src/Banner/banner-provider.js +79 -79
- package/src/Banner/banner.js +9 -9
- package/src/Banner/display/banner-to-html.js +2 -2
- package/src/Banner/get-all-banners.js +3 -4
- package/src/Banner/get-banner.js +11 -11
- package/src/Banner/log-banner-click.js +2 -2
- package/src/Banner/log-banner-impressions.js +4 -4
- package/src/Banner/request-banners-refresh.js +21 -13
- package/src/Banner/subscribe-to-banners-updates.js +14 -13
- package/src/Banner/ui/insert-banner.js +11 -9
- package/src/Card/card-manager.js +35 -35
- package/src/Card/display/card-display.js +8 -8
- package/src/Card/log-card-click.js +1 -1
- package/src/Card/log-card-dismissal.js +1 -1
- package/src/Card/log-card-impressions.js +3 -3
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +92 -92
- package/src/Card/models/classic-card.js +21 -21
- package/src/Card/models/control-card.js +11 -11
- package/src/Card/models/image-only.js +19 -19
- package/src/Card/util/card-factory.js +39 -39
- package/src/ContentCards/content-cards-provider-factory.js +1 -1
- package/src/ContentCards/content-cards-provider.js +142 -142
- package/src/ContentCards/content-cards.js +3 -3
- 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 +8 -8
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +3 -3
- package/src/Core/disable-sdk.js +7 -7
- package/src/Core/enable-sdk.js +5 -5
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +2 -2
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/is-initialized.js +1 -1
- package/src/Core/log-custom-event.js +5 -5
- package/src/Core/log-purchase.js +4 -4
- package/src/Core/open-session.js +7 -7
- package/src/Core/wipe-data.js +3 -3
- package/src/FeatureFlags/feature-flag-factory.js +10 -10
- package/src/FeatureFlags/feature-flag.js +19 -19
- package/src/FeatureFlags/feature-flags-provider.js +61 -61
- 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 +4 -4
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/Feed/feed-provider.js +41 -41
- package/src/Feed/feed.js +2 -2
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/log-feed-displayed.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 +5 -5
- 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 +20 -20
- package/src/InAppMessage/display/modal-utils.js +4 -4
- package/src/InAppMessage/in-app-message-factory.js +7 -7
- package/src/InAppMessage/in-app-message-manager-factory.js +1 -1
- package/src/InAppMessage/in-app-message-manager.js +89 -89
- package/src/InAppMessage/log-in-app-message-button-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-html-click.js +7 -7
- package/src/InAppMessage/log-in-app-message-impression.js +2 -2
- package/src/InAppMessage/models/control-message.js +5 -5
- package/src/InAppMessage/models/full-screen-message.js +34 -34
- package/src/InAppMessage/models/html-message.js +20 -20
- package/src/InAppMessage/models/in-app-message-button.js +8 -8
- package/src/InAppMessage/models/in-app-message.js +83 -83
- package/src/InAppMessage/models/modal-message.js +33 -33
- package/src/InAppMessage/models/slide-up-message.js +30 -30
- 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 +19 -19
- package/src/Push/push-manager-factory.js +8 -8
- package/src/Push/push-manager.js +96 -96
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +19 -19
- package/src/User/user.js +41 -41
- package/src/common/base-feed.js +3 -3
- package/src/common/base-provider.js +1 -1
- package/src/common/event-logger.js +6 -6
- package/src/common/feed-display.js +10 -10
- package/src/l10n/l10n-manager-factory.js +2 -2
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +31 -31
- package/src/managers/braze-instance.js +139 -139
- package/src/managers/device-manager.js +24 -24
- package/src/managers/network-manager.js +151 -151
- package/src/managers/server-config-manager.js +86 -86
- package/src/managers/session-manager.js +38 -38
- package/src/managers/storage-manager-factory.js +12 -12
- package/src/managers/storage-manager.js +96 -96
- package/src/managers/subscription-manager.js +10 -10
- package/src/managers/utils.js +4 -4
- 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/identifier.js +12 -12
- package/src/models/push-token.js +8 -8
- package/src/models/request-result.js +3 -3
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +152 -152
- package/src/triggers/models/custom-event-data.js +1 -1
- package/src/triggers/models/custom-event-property-data.js +2 -2
- package/src/triggers/models/filter-set.js +6 -6
- package/src/triggers/models/filter.js +2 -2
- package/src/triggers/models/in-app-message-click-data.js +1 -1
- package/src/triggers/models/purchase-data.js +1 -1
- package/src/triggers/models/purchase-property-data.js +2 -2
- package/src/triggers/models/push-click-data.js +1 -1
- package/src/triggers/models/trigger-condition.js +33 -33
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +11 -11
- package/src/triggers/triggers-provider-factory.js +3 -3
- package/src/triggers/triggers-provider.js +74 -74
- 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 +7 -7
- package/src/util/html-display-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +6 -6
- package/src/util/request-header-utils.js +21 -21
- 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
package/src/Feed/feed.js
CHANGED
|
@@ -3,5 +3,5 @@ import { InternalEventTypes as dr } from "../../shared-lib/index.js";
|
|
|
3
3
|
export function logFeedDisplayed() {
|
|
4
4
|
var e;
|
|
5
5
|
if (r.rr())
|
|
6
|
-
return null === (e = r.g()) || void 0 === e ? void 0 : e.zr(dr.Fr).
|
|
6
|
+
return null === (e = r.g()) || void 0 === e ? void 0 : e.zr(dr.Fr).tt;
|
|
7
7
|
}
|
package/src/Feed/ui/show-feed.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import r, { OPTIONS as
|
|
1
|
+
import r, { OPTIONS as w } from "../../managers/braze-instance.js";
|
|
2
2
|
import {
|
|
3
3
|
destroyFeedHtml as ee,
|
|
4
4
|
detectFeedImpressions as nn,
|
|
@@ -30,22 +30,22 @@ export function showFeed(e, t, n) {
|
|
|
30
30
|
}
|
|
31
31
|
return o;
|
|
32
32
|
},
|
|
33
|
-
i = r.
|
|
33
|
+
i = r.ee(w.tn) || r.ee(w.en) || !1;
|
|
34
34
|
let s = !1;
|
|
35
35
|
null == e && ((e = document.body), (s = !0));
|
|
36
36
|
let l,
|
|
37
37
|
f = !1;
|
|
38
38
|
null == t
|
|
39
|
-
? ((l = ie.m().
|
|
39
|
+
? ((l = ie.m().Bi()),
|
|
40
40
|
an(l, o(l.cards, n), l.lastUpdated, null, i),
|
|
41
41
|
(f = !0))
|
|
42
42
|
: (l = new Feed(o(t, n), new Date()));
|
|
43
43
|
const a = tn(l, i, s);
|
|
44
44
|
if (f) {
|
|
45
45
|
(null == l.lastUpdated ||
|
|
46
|
-
new Date().valueOf() - l.lastUpdated.valueOf() > Feed.
|
|
46
|
+
new Date().valueOf() - l.lastUpdated.valueOf() > Feed.dr) &&
|
|
47
47
|
(N.info(
|
|
48
|
-
`Cached feed was older than max TTL of ${Feed.
|
|
48
|
+
`Cached feed was older than max TTL of ${Feed.dr} ms, requesting an update from the server.`,
|
|
49
49
|
),
|
|
50
50
|
on(l, a));
|
|
51
51
|
const e = new Date().valueOf(),
|
|
@@ -8,6 +8,6 @@ export function deferInAppMessage(e) {
|
|
|
8
8
|
return e instanceof ControlMessage
|
|
9
9
|
? (N.info("Not deferring since this is a ControlMessage."), !1)
|
|
10
10
|
: e instanceof InAppMessage
|
|
11
|
-
? se.ea().
|
|
11
|
+
? se.ea().sn(e)
|
|
12
12
|
: (N.info("Not an instance of InAppMessage, ignoring."), !1);
|
|
13
13
|
}
|
|
@@ -15,10 +15,10 @@ export default function ct(t, e, o, s, n, i) {
|
|
|
15
15
|
n.focus();
|
|
16
16
|
const a = n.document.getElementsByTagName("head")[0];
|
|
17
17
|
if (null != a) {
|
|
18
|
-
if (t.
|
|
18
|
+
if (t.lo()) {
|
|
19
19
|
const e = document.createElement("style");
|
|
20
20
|
(e.innerHTML = t.css || ""),
|
|
21
|
-
(e.id = t.
|
|
21
|
+
(e.id = t.do() || ""),
|
|
22
22
|
null != i && e.setAttribute("nonce", i),
|
|
23
23
|
a.appendChild(e);
|
|
24
24
|
}
|
|
@@ -42,7 +42,7 @@ export default function ct(t, e, o, s, n, i) {
|
|
|
42
42
|
},
|
|
43
43
|
);
|
|
44
44
|
if (
|
|
45
|
-
((n.appboyBridge = c), (n.brazeBridge = c), t.
|
|
45
|
+
((n.appboyBridge = c), (n.brazeBridge = c), t.uo !== InAppMessage.po.fo)
|
|
46
46
|
) {
|
|
47
47
|
const e = n.document.getElementsByTagName("a");
|
|
48
48
|
for (let o = 0; o < e.length; o++) e[o].onclick = lt(t, l, e[o], s);
|
|
@@ -51,7 +51,7 @@ export default function ct(t, e, o, s, n, i) {
|
|
|
51
51
|
}
|
|
52
52
|
const m = n.document.body;
|
|
53
53
|
if (null != m) {
|
|
54
|
-
t.
|
|
54
|
+
t.bo() && (m.id = t.htmlId || "");
|
|
55
55
|
const e = document.createElement("hidden");
|
|
56
56
|
(e.onclick = c.closeMessage),
|
|
57
57
|
(e.className = "ab-programmatic-close-button"),
|
|
@@ -67,8 +67,8 @@ export default function ct(t, e, o, s, n, i) {
|
|
|
67
67
|
) {
|
|
68
68
|
const e = document.createElement("div");
|
|
69
69
|
return (
|
|
70
|
-
(e.className = "ab-ios-scroll-wrapper"), e.appendChild(l), (t.
|
|
70
|
+
(e.className = "ab-ios-scroll-wrapper"), e.appendChild(l), (t.ho = e), e
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
|
-
return (t.
|
|
73
|
+
return (t.ho = l), l;
|
|
74
74
|
}
|
|
@@ -17,7 +17,7 @@ import ct from "./html-message-to-html.js";
|
|
|
17
17
|
import ce from "./modal-utils.js";
|
|
18
18
|
import { logger as N, Guid as G } from "../../../shared-lib/index.js";
|
|
19
19
|
export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
20
|
-
if (((e.
|
|
20
|
+
if (((e.jo = document.activeElement), e instanceof HtmlMessage))
|
|
21
21
|
return ct(e, o, a, n, s, i);
|
|
22
22
|
const c = (function (e, o, a, t, n, s, i = document.body, m = "ltr") {
|
|
23
23
|
let l = null;
|
|
@@ -25,10 +25,10 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
25
25
|
(c.dir = m),
|
|
26
26
|
(c.className = "ab-in-app-message ab-start-hidden ab-background"),
|
|
27
27
|
s && (c.style.zIndex = (s + 1).toString()),
|
|
28
|
-
e.
|
|
28
|
+
e.wo() &&
|
|
29
29
|
((c.className += " ab-modal-interactions"),
|
|
30
30
|
c.setAttribute("tabindex", "-1")),
|
|
31
|
-
e.
|
|
31
|
+
e.lo() ||
|
|
32
32
|
((c.style.color = le(e.textColor)),
|
|
33
33
|
(c.style.backgroundColor = le(e.backgroundColor)),
|
|
34
34
|
ae(e.backgroundColor) && (c.className += " ab-no-shadow"));
|
|
@@ -38,7 +38,7 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
38
38
|
document.querySelectorAll(".ab-iam-img-loading").length > 0
|
|
39
39
|
? t(
|
|
40
40
|
`Cannot show in-app message ${e.message} because another message is being shown.`,
|
|
41
|
-
InAppMessage.
|
|
41
|
+
InAppMessage.xo.vo,
|
|
42
42
|
)
|
|
43
43
|
: a(c));
|
|
44
44
|
},
|
|
@@ -79,7 +79,7 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
79
79
|
)));
|
|
80
80
|
const u = T(
|
|
81
81
|
"Close Message",
|
|
82
|
-
e.
|
|
82
|
+
e.lo() ? void 0 : le(e.closeButtonColor),
|
|
83
83
|
() => {
|
|
84
84
|
e.ll(c);
|
|
85
85
|
},
|
|
@@ -88,7 +88,7 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
88
88
|
c.appendChild(u), s && (u.style.zIndex = (s + 2).toString());
|
|
89
89
|
const b = document.createElement("div");
|
|
90
90
|
(b.className = "ab-message-text"), (b.dir = m);
|
|
91
|
-
const p = (e.messageAlignment || e.
|
|
91
|
+
const p = (e.messageAlignment || e.Co).toLowerCase();
|
|
92
92
|
b.className += " " + p + "-aligned";
|
|
93
93
|
let g = !1;
|
|
94
94
|
const f = document.createElement("div");
|
|
@@ -99,13 +99,13 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
99
99
|
(o.style.backgroundImage = "url(" + e.imageUrl + ")"),
|
|
100
100
|
o.setAttribute("role", "img"),
|
|
101
101
|
o.setAttribute("aria-label", "Modal Image"),
|
|
102
|
-
e
|
|
102
|
+
e.$o(o),
|
|
103
103
|
f.appendChild(o);
|
|
104
104
|
} else {
|
|
105
105
|
const o = document.createElement("img");
|
|
106
106
|
if (
|
|
107
107
|
(o.setAttribute("src", e.imageUrl),
|
|
108
|
-
e
|
|
108
|
+
e.$o(o),
|
|
109
109
|
0 === document.querySelectorAll(".ab-iam-img-loading").length)
|
|
110
110
|
) {
|
|
111
111
|
g = !0;
|
|
@@ -128,7 +128,7 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
128
128
|
f.className += " ab-icon-area";
|
|
129
129
|
const o = document.createElement("span");
|
|
130
130
|
(o.className = "ab-icon"),
|
|
131
|
-
e.
|
|
131
|
+
e.lo() ||
|
|
132
132
|
((o.style.backgroundColor = le(e.iconBackgroundColor)),
|
|
133
133
|
(o.style.color = le(e.iconColor)));
|
|
134
134
|
const a = document.createElement("i");
|
|
@@ -142,23 +142,23 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
142
142
|
}
|
|
143
143
|
if ((J(b, "touchstart"), e.header && e.header.length > 0)) {
|
|
144
144
|
const o = document.createElement("h1");
|
|
145
|
-
(o.className = "ab-message-header"), (e.
|
|
145
|
+
(o.className = "ab-message-header"), (e.ko = G.ce()), (o.id = e.ko);
|
|
146
146
|
const a = (
|
|
147
147
|
e.headerAlignment || InAppMessage.TextAlignment.CENTER
|
|
148
148
|
).toLowerCase();
|
|
149
149
|
(o.className += " " + a + "-aligned"),
|
|
150
|
-
e.
|
|
150
|
+
e.lo() || (o.style.color = le(e.headerTextColor)),
|
|
151
151
|
o.appendChild(document.createTextNode(e.header)),
|
|
152
152
|
b.appendChild(o);
|
|
153
153
|
}
|
|
154
|
-
return b.appendChild(e.
|
|
154
|
+
return b.appendChild(e.Mo()), c.appendChild(b), g || d(), (e.ho = c), c;
|
|
155
155
|
})(e, o, a, t, n, s, m, l);
|
|
156
156
|
if (e instanceof FullScreenMessage || e instanceof ModalMessage) {
|
|
157
157
|
const a = e instanceof FullScreenMessage ? "ab-fullscreen" : "ab-modal";
|
|
158
158
|
(c.className += ` ${a} ab-centered`),
|
|
159
|
-
ce.
|
|
160
|
-
ce.
|
|
161
|
-
ce.
|
|
159
|
+
ce.zo(e, o, c, n),
|
|
160
|
+
ce.Lo(c),
|
|
161
|
+
ce.Io(e.ko, c);
|
|
162
162
|
} else if (e instanceof SlideUpMessage) {
|
|
163
163
|
c.className += " ab-slideup";
|
|
164
164
|
const o = c.getElementsByClassName("ab-close-button")[0];
|
|
@@ -166,22 +166,22 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
166
166
|
const a = oe(
|
|
167
167
|
"0 0 11.38 19.44",
|
|
168
168
|
"M11.38 9.72l-9.33 9.72L0 17.3l7.27-7.58L0 2.14 2.05 0l9.33 9.72z",
|
|
169
|
-
e.
|
|
169
|
+
e.lo() ? void 0 : le(e.closeButtonColor),
|
|
170
170
|
);
|
|
171
171
|
a.setAttribute("class", `ab-chevron ${l}`), o.appendChild(a);
|
|
172
172
|
}
|
|
173
173
|
let a, t;
|
|
174
|
-
H(c, R.
|
|
174
|
+
H(c, R.ie, (e) => {
|
|
175
175
|
(c.className += " ab-swiped-left"),
|
|
176
176
|
null != o && null != o.onclick && o.onclick(e);
|
|
177
177
|
}),
|
|
178
|
-
H(c, R.
|
|
178
|
+
H(c, R.de, (e) => {
|
|
179
179
|
(c.className += " ab-swiped-right"),
|
|
180
180
|
null != o && null != o.onclick && o.onclick(e);
|
|
181
181
|
}),
|
|
182
182
|
e.slideFrom === InAppMessage.SlideFrom.TOP
|
|
183
|
-
? ((a = R.
|
|
184
|
-
: ((a = R
|
|
183
|
+
? ((a = R.To), (t = " ab-swiped-up"))
|
|
184
|
+
: ((a = R.qo), (t = " ab-swiped-down")),
|
|
185
185
|
H(c, a, (e) => {
|
|
186
186
|
(c.className += t), null != o && null != o.onclick && o.onclick(e);
|
|
187
187
|
});
|
|
@@ -5,7 +5,7 @@ import { toRgba as le } from "../../util/color-utils.js";
|
|
|
5
5
|
import { addPassiveEventListener as J } from "../../util/dom-utils.js";
|
|
6
6
|
import { KeyCodes as mt } from "../../util/key-codes.js";
|
|
7
7
|
const ce = {
|
|
8
|
-
|
|
8
|
+
Lo: (t) => {
|
|
9
9
|
const o = t.querySelectorAll(
|
|
10
10
|
".ab-close-button, .ab-message-text, .ab-message-button",
|
|
11
11
|
);
|
|
@@ -25,13 +25,13 @@ const ce = {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
Io: (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
|
+
zo: (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);
|
|
@@ -60,7 +60,7 @@ const ce = {
|
|
|
60
60
|
let l = e.text;
|
|
61
61
|
"" === e.text && (l = " "),
|
|
62
62
|
s.appendChild(document.createTextNode(l)),
|
|
63
|
-
t.
|
|
63
|
+
t.lo() ||
|
|
64
64
|
((s.style.backgroundColor = le(e.backgroundColor)),
|
|
65
65
|
(s.style.color = le(e.textColor)),
|
|
66
66
|
(s.style.borderColor = le(e.borderColor))),
|
|
@@ -47,7 +47,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
47
47
|
((S = void 0), (q = void 0));
|
|
48
48
|
const B = e.message_extras;
|
|
49
49
|
let C;
|
|
50
|
-
if (o === ModalMessage.
|
|
50
|
+
if (o === ModalMessage.ds || o === InAppMessage.po.Ao)
|
|
51
51
|
C = new ModalMessage(
|
|
52
52
|
s,
|
|
53
53
|
n,
|
|
@@ -78,7 +78,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
78
78
|
q,
|
|
79
79
|
B,
|
|
80
80
|
);
|
|
81
|
-
else if (o === FullScreenMessage.
|
|
81
|
+
else if (o === FullScreenMessage.ds)
|
|
82
82
|
C = new FullScreenMessage(
|
|
83
83
|
s,
|
|
84
84
|
n,
|
|
@@ -110,7 +110,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
110
110
|
q,
|
|
111
111
|
B,
|
|
112
112
|
);
|
|
113
|
-
else if (o === SlideUpMessage.
|
|
113
|
+
else if (o === SlideUpMessage.ds)
|
|
114
114
|
C = new SlideUpMessage(
|
|
115
115
|
s,
|
|
116
116
|
n,
|
|
@@ -137,9 +137,9 @@ export function newInAppMessageFromJson(e) {
|
|
|
137
137
|
);
|
|
138
138
|
else {
|
|
139
139
|
if (
|
|
140
|
-
o !== HtmlMessage.
|
|
141
|
-
o !== InAppMessage.
|
|
142
|
-
o !== InAppMessage.
|
|
140
|
+
o !== HtmlMessage.ds &&
|
|
141
|
+
o !== InAppMessage.po.fo &&
|
|
142
|
+
o !== InAppMessage.po.Fo
|
|
143
143
|
)
|
|
144
144
|
return void N.error("Ignoring message with unknown type " + o);
|
|
145
145
|
{
|
|
@@ -148,7 +148,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
148
148
|
(C.trusted = e.trusted || !1);
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
return (C.
|
|
151
|
+
return (C.uo = o), C;
|
|
152
152
|
}
|
|
153
153
|
export function buttonsFromSerializedInAppMessage(e) {
|
|
154
154
|
const o = [];
|
|
@@ -21,51 +21,51 @@ import {
|
|
|
21
21
|
} from "../util/braze-actions.js";
|
|
22
22
|
import vt from "../Push/utils/push-utils.js";
|
|
23
23
|
import h from "../util/request-header-utils.js";
|
|
24
|
-
import { STORAGE_KEYS as
|
|
24
|
+
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
25
25
|
import { FullScreenMessage, ModalMessage, SlideUpMessage } from "./index.js";
|
|
26
26
|
export default class ea {
|
|
27
27
|
constructor(t, e, s, i) {
|
|
28
28
|
(this.S = t),
|
|
29
29
|
(this.T = e),
|
|
30
30
|
(this.C = s),
|
|
31
|
-
(this.
|
|
31
|
+
(this.Cs = i),
|
|
32
32
|
(this.S = t),
|
|
33
33
|
(this.T = e),
|
|
34
34
|
(this.C = s),
|
|
35
|
-
(this.
|
|
36
|
-
(this.
|
|
37
|
-
r.N(this.
|
|
38
|
-
(this.
|
|
39
|
-
(this
|
|
40
|
-
(this.
|
|
41
|
-
(this
|
|
42
|
-
(this.
|
|
35
|
+
(this.Cs = i),
|
|
36
|
+
(this.Mi = new u()),
|
|
37
|
+
r.N(this.Mi),
|
|
38
|
+
(this._i = 1e3),
|
|
39
|
+
(this.Pi = 6e4),
|
|
40
|
+
(this.Gi = null),
|
|
41
|
+
(this.$i = null),
|
|
42
|
+
(this.Oi = null);
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
return this.
|
|
44
|
+
Xi() {
|
|
45
|
+
return this.Mi;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
return this.
|
|
47
|
+
Hi(t) {
|
|
48
|
+
return this.Mi.Ft(t);
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
return this.
|
|
50
|
+
Ji() {
|
|
51
|
+
return this.Gi;
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
this.
|
|
53
|
+
Ki(t) {
|
|
54
|
+
this.Gi = t;
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
ut(t, e, s, i) {
|
|
57
57
|
const r = new E();
|
|
58
58
|
let n;
|
|
59
|
-
if (e === d.
|
|
60
|
-
if (!t.
|
|
59
|
+
if (e === d.Li || t instanceof ControlMessage) {
|
|
60
|
+
if (!t.ts())
|
|
61
61
|
return (
|
|
62
62
|
N.info(
|
|
63
63
|
"This in-app message has already received an impression. Ignoring analytics event.",
|
|
64
64
|
),
|
|
65
65
|
r
|
|
66
66
|
);
|
|
67
|
-
} else if (e === d.
|
|
68
|
-
if (!t
|
|
67
|
+
} else if (e === d.Qi || (t instanceof HtmlMessage && e === d.Vi)) {
|
|
68
|
+
if (!t.$t(i))
|
|
69
69
|
return (
|
|
70
70
|
N.info(
|
|
71
71
|
"This in-app message has already received a click. Ignoring analytics event.",
|
|
@@ -77,49 +77,49 @@ export default class ea {
|
|
|
77
77
|
(n =
|
|
78
78
|
t instanceof ControlMessage
|
|
79
79
|
? { trigger_ids: [t.triggerId] }
|
|
80
|
-
: this.
|
|
80
|
+
: this.Wi(t)),
|
|
81
81
|
null == n
|
|
82
82
|
? r
|
|
83
83
|
: (t.messageExtras && (n.message_extras = t.messageExtras),
|
|
84
84
|
null != s && (n.bid = s),
|
|
85
|
-
c.
|
|
85
|
+
c.ut(e, n))
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
Yi(t, e) {
|
|
89
89
|
const s = new E();
|
|
90
|
-
if (!t
|
|
90
|
+
if (!t.$t())
|
|
91
91
|
return (
|
|
92
92
|
N.info(
|
|
93
93
|
"This in-app message button has already received a click. Ignoring analytics event.",
|
|
94
94
|
),
|
|
95
95
|
s
|
|
96
96
|
);
|
|
97
|
-
const i = this.
|
|
97
|
+
const i = this.Wi(e);
|
|
98
98
|
return null == i
|
|
99
99
|
? s
|
|
100
|
-
: t.id === InAppMessageButton.
|
|
100
|
+
: t.id === InAppMessageButton.Zi
|
|
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
|
-
: (null != t.id && (i.bid = t.id), c.
|
|
105
|
+
: (null != t.id && (i.bid = t.id), c.ut(d.Vi, i));
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
Ir(t) {
|
|
108
108
|
const e = t.messageFields;
|
|
109
109
|
return (null != e && e.is_push_primer) || !1;
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
Mr(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.Tr, "In-App Message")
|
|
118
|
+
: gt(e) && !vt.wr()
|
|
119
|
+
? dt(jt.Br, "In-App Message")
|
|
120
120
|
: void 0;
|
|
121
121
|
};
|
|
122
|
-
if (this.
|
|
122
|
+
if (this.Ir(t) && !vt.wr())
|
|
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.
|
|
140
|
+
_r(t, e) {
|
|
141
|
+
e !== this.Oi && this.qr(), (this.$i = t), (this.Oi = e);
|
|
142
142
|
}
|
|
143
|
-
|
|
144
|
-
null != this
|
|
145
|
-
(clearTimeout(this
|
|
143
|
+
qr() {
|
|
144
|
+
null != this.$i &&
|
|
145
|
+
(clearTimeout(this.$i), (this.$i = null), (this.Oi = null));
|
|
146
146
|
}
|
|
147
|
-
|
|
147
|
+
Er(t, e, s, i) {
|
|
148
148
|
const r = this.S;
|
|
149
149
|
if (!r) return;
|
|
150
|
-
this.
|
|
151
|
-
const n = r.
|
|
150
|
+
this.Oi && t.triggerId !== this.Oi && (this.qr(), h.wi(this.C, h.O.Gr));
|
|
151
|
+
const n = r.Nr(!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.$r());
|
|
155
|
+
const u = r.J(o, h.O.Gr);
|
|
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.Gr, p),
|
|
163
163
|
-1 !== r && u.push(["X-Braze-Req-Tokens-Remaining", r.toString()]);
|
|
164
164
|
let m,
|
|
165
165
|
c,
|
|
@@ -168,51 +168,51 @@ export default class ea {
|
|
|
168
168
|
url: `${n.Z()}/template/`,
|
|
169
169
|
data: o,
|
|
170
170
|
headers: u,
|
|
171
|
-
|
|
172
|
-
if (!n.
|
|
173
|
-
return void ("function" == typeof t.
|
|
174
|
-
if ((n.
|
|
171
|
+
tt: (e) => {
|
|
172
|
+
if (!n.st(o, e, u))
|
|
173
|
+
return void ("function" == typeof t.Cr && t.Cr());
|
|
174
|
+
if ((n.it(), null == e || null == e.templated_message)) return;
|
|
175
175
|
const s = e.templated_message;
|
|
176
|
-
if (s.type !== pt.
|
|
176
|
+
if (s.type !== pt.Xr.Or) return;
|
|
177
177
|
const i = ut(s.data);
|
|
178
178
|
if (null == i) return;
|
|
179
|
-
const r = this.
|
|
179
|
+
const r = this.Mr(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.Cr && t.Cr());
|
|
182
|
+
"function" == typeof t.Hr && t.Hr(i);
|
|
183
183
|
},
|
|
184
184
|
error: (e) => {
|
|
185
185
|
(g = !0),
|
|
186
186
|
(m = e),
|
|
187
187
|
(c = `getting user personalization for message ${t.triggerId}.`);
|
|
188
188
|
},
|
|
189
|
-
|
|
190
|
-
if (new Date().valueOf() - t.
|
|
189
|
+
nt: (r, o) => {
|
|
190
|
+
if (new Date().valueOf() - t.Jr < t.Kr) {
|
|
191
191
|
let r = 0;
|
|
192
192
|
if (g) {
|
|
193
|
-
const e = Math.min(t.
|
|
194
|
-
s = this.
|
|
193
|
+
const e = Math.min(t.Kr, this.Pi),
|
|
194
|
+
s = this._i;
|
|
195
195
|
null == i && (i = s), (r = Math.min(e, a(s, 3 * i)));
|
|
196
196
|
}
|
|
197
|
-
n.
|
|
197
|
+
n.rt(
|
|
198
198
|
o,
|
|
199
199
|
() => {
|
|
200
|
-
this.
|
|
200
|
+
this.Er(t, e, s, r);
|
|
201
201
|
},
|
|
202
|
-
h.O.
|
|
203
|
-
(e) => this.
|
|
204
|
-
() => this.
|
|
202
|
+
h.O.Gr,
|
|
203
|
+
(e) => this._r(e, t.triggerId),
|
|
204
|
+
() => this.qr(),
|
|
205
205
|
r,
|
|
206
206
|
);
|
|
207
207
|
}
|
|
208
|
-
g && n.
|
|
208
|
+
g && n.et(m, c);
|
|
209
209
|
},
|
|
210
210
|
});
|
|
211
211
|
},
|
|
212
|
-
h.O.
|
|
212
|
+
h.O.Gr,
|
|
213
213
|
);
|
|
214
214
|
}
|
|
215
|
-
|
|
215
|
+
Wi(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
|
+
sn(t) {
|
|
227
227
|
return (
|
|
228
228
|
!!this.C &&
|
|
229
229
|
!(
|
|
230
|
-
!(
|
|
231
|
-
|
|
230
|
+
!(t && t instanceof InAppMessage && t.constructor !== InAppMessage) ||
|
|
231
|
+
t instanceof ControlMessage
|
|
232
232
|
) &&
|
|
233
|
-
this.C.
|
|
233
|
+
this.C.Bt(s.gt.Lr, t.bt())
|
|
234
234
|
);
|
|
235
235
|
}
|
|
236
236
|
Ar() {
|
|
237
237
|
if (!this.C) return null;
|
|
238
|
-
const
|
|
239
|
-
if (!
|
|
240
|
-
let
|
|
241
|
-
switch (
|
|
242
|
-
case InAppMessage.
|
|
243
|
-
|
|
238
|
+
const t = this.C.ft(s.gt.Lr);
|
|
239
|
+
if (!t) return null;
|
|
240
|
+
let e;
|
|
241
|
+
switch (t.type) {
|
|
242
|
+
case InAppMessage.po.Qr:
|
|
243
|
+
e = FullScreenMessage.Ur(t);
|
|
244
244
|
break;
|
|
245
|
-
case InAppMessage.
|
|
246
|
-
case InAppMessage.
|
|
247
|
-
case InAppMessage.
|
|
248
|
-
|
|
245
|
+
case InAppMessage.po.Vr:
|
|
246
|
+
case InAppMessage.po.fo:
|
|
247
|
+
case InAppMessage.po.Fo:
|
|
248
|
+
e = HtmlMessage.Ur(t);
|
|
249
249
|
break;
|
|
250
|
-
case InAppMessage.
|
|
251
|
-
case InAppMessage.
|
|
252
|
-
|
|
250
|
+
case InAppMessage.po.Wr:
|
|
251
|
+
case InAppMessage.po.Ao:
|
|
252
|
+
e = ModalMessage.Ur(t);
|
|
253
253
|
break;
|
|
254
|
-
case InAppMessage.
|
|
255
|
-
|
|
254
|
+
case InAppMessage.po.Yr:
|
|
255
|
+
e = SlideUpMessage.Ur(t);
|
|
256
256
|
}
|
|
257
|
-
return
|
|
257
|
+
return e && this.Zr(), e;
|
|
258
258
|
}
|
|
259
|
-
|
|
260
|
-
this.C && this.C.
|
|
259
|
+
Zr() {
|
|
260
|
+
this.C && this.C.Ut(s.gt.Lr);
|
|
261
261
|
}
|
|
262
262
|
}
|