@braze/web-sdk 5.8.1 → 5.9.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 +14 -9
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +20 -20
- package/shared-lib/guid.js +2 -2
- package/shared-lib/indexed-db-adapter.js +3 -3
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +11 -11
- package/src/Banner/banner-provider.js +22 -19
- package/src/Banner/display/banner-to-html.js +32 -27
- package/src/Banner/get-all-banners.js +11 -5
- package/src/Banner/get-banner.js +6 -3
- 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 +5 -2
- package/src/Banner/subscribe-to-banners-updates.js +2 -2
- package/src/Banner/ui/insert-banner.js +2 -2
- package/src/Card/card-manager.js +9 -9
- package/src/Card/display/card-display.js +5 -5
- package/src/Card/log-card-click.js +2 -2
- package/src/Card/log-card-dismissal.js +2 -2
- package/src/Card/log-card-impressions.js +2 -2
- package/src/Card/models/captioned-image.js +17 -17
- package/src/Card/models/card.js +58 -58
- package/src/Card/models/classic-card.js +17 -17
- package/src/Card/models/control-card.js +8 -8
- package/src/Card/models/image-only.js +15 -15
- package/src/Card/util/card-factory.js +24 -24
- package/src/ContentCards/content-cards-provider.js +77 -75
- 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 +3 -3
- package/src/ContentCards/ui/show-content-cards.js +3 -3
- package/src/Core/change-user.js +1 -1
- package/src/Core/disable-sdk.js +4 -4
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/handle-braze-action.js +2 -2
- package/src/Core/is-initialized.js +1 -1
- package/src/Core/open-session.js +4 -4
- package/src/Core/request-immediate-data-flush.js +1 -1
- package/src/Core/wipe-data.js +7 -5
- package/src/FeatureFlags/feature-flag-factory.js +4 -4
- package/src/FeatureFlags/feature-flag.js +3 -3
- package/src/FeatureFlags/feature-flags-provider.js +17 -11
- 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 +1 -1
- package/src/Feed/feed-provider-factory.js +1 -1
- package/src/Feed/feed-provider.js +12 -12
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +8 -8
- package/src/InAppMessage/display/in-app-message-to-html.js +18 -18
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/in-app-message-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager.js +70 -70
- package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/control-message.js +2 -2
- package/src/InAppMessage/models/full-screen-message.js +6 -6
- package/src/InAppMessage/models/html-message.js +7 -7
- package/src/InAppMessage/models/in-app-message-button.js +3 -3
- package/src/InAppMessage/models/in-app-message.js +36 -36
- package/src/InAppMessage/models/modal-message.js +6 -6
- package/src/InAppMessage/models/slide-up-message.js +8 -8
- 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 +13 -13
- package/src/Push/push-manager.js +81 -81
- package/src/Push/request-push-permission.js +1 -1
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +10 -10
- package/src/User/user.js +15 -15
- package/src/common/constants.js +2 -0
- package/src/common/event-logger.js +2 -2
- package/src/common/feed-display.js +6 -6
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/managers/auth-manager.js +30 -30
- package/src/managers/braze-instance.js +94 -93
- package/src/managers/device-manager.js +14 -14
- package/src/managers/network-manager.js +123 -117
- package/src/managers/server-config-manager.js +91 -79
- package/src/managers/session-manager.js +8 -8
- package/src/managers/storage-manager-factory.js +5 -5
- package/src/managers/storage-manager.js +48 -48
- package/src/managers/subscription-manager.js +4 -4
- package/src/models/backend-errors.js +4 -4
- package/src/models/braze-event.js +9 -9
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +3 -3
- package/src/models/push-token.js +4 -4
- package/src/models/request-result.js +2 -2
- package/src/models/server-config.js +18 -18
- package/src/request-controller.js +100 -88
- 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 +4 -4
- package/src/triggers/models/filter.js +6 -6
- 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 +2 -2
- package/src/triggers/models/trigger.js +12 -12
- package/src/triggers/triggers-provider-factory.js +3 -3
- package/src/triggers/triggers-provider.js +17 -17
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/load-font-awesome.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/component-utils.js +2 -2
- package/src/util/dom-utils.js +3 -3
- package/src/util/html-display-utils.js +14 -14
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +2 -2
- package/src/util/request-header-utils.js +13 -13
- package/src/util/user-agent-parser.js +1 -1
- package/src/util/validation-utils.js +2 -2
- package/src/util/window-utils.js +2 -2
|
@@ -2,8 +2,8 @@ import t from "../common/base-provider.js";
|
|
|
2
2
|
import r from "../managers/braze-instance.js";
|
|
3
3
|
import Feed from "./feed.js";
|
|
4
4
|
import {
|
|
5
|
-
newCardFromFeedJson as
|
|
6
|
-
newCardFromSerializedValue as
|
|
5
|
+
newCardFromFeedJson as lt,
|
|
6
|
+
newCardFromSerializedValue as tt,
|
|
7
7
|
} from "../Card/util/card-factory.js";
|
|
8
8
|
import { rehydrateDateAfterJsonization as V } from "../util/date-utils.js";
|
|
9
9
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
@@ -18,7 +18,7 @@ export default class re extends t {
|
|
|
18
18
|
(this.C = t),
|
|
19
19
|
(this.Fi = s),
|
|
20
20
|
(this.Ts = new u()),
|
|
21
|
-
r.
|
|
21
|
+
r.F(this.Ts),
|
|
22
22
|
this.Ds();
|
|
23
23
|
}
|
|
24
24
|
Ds() {
|
|
@@ -26,12 +26,12 @@ export default class re extends t {
|
|
|
26
26
|
this.C && (t = this.C.ft(s.gt.qi) || []);
|
|
27
27
|
const i = [];
|
|
28
28
|
for (let s = 0; s < t.length; s++) {
|
|
29
|
-
const e =
|
|
29
|
+
const e = tt(t[s]);
|
|
30
30
|
null != e && i.push(e);
|
|
31
31
|
}
|
|
32
32
|
(this.cards = i), this.C && (this.xi = V(this.C.ft(s.gt.zi)));
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
Ui(t) {
|
|
35
35
|
const i = [];
|
|
36
36
|
let e = null,
|
|
37
37
|
r = {};
|
|
@@ -39,18 +39,18 @@ export default class re extends t {
|
|
|
39
39
|
const h = {};
|
|
40
40
|
for (let s = 0; s < t.length; s++) {
|
|
41
41
|
e = t[s];
|
|
42
|
-
const o =
|
|
42
|
+
const o = lt(e);
|
|
43
43
|
if (null != o) {
|
|
44
44
|
const t = o.id;
|
|
45
45
|
t && r[t] && ((o.viewed = !0), (h[t] = !0)), i.push(o);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
(this.cards = i),
|
|
49
|
-
this.
|
|
49
|
+
this.Ws(),
|
|
50
50
|
(this.xi = new Date()),
|
|
51
51
|
this.C && (this.C.Bt(s.gt.Zt, h), this.C.Bt(s.gt.zi, this.xi));
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
Ws() {
|
|
54
54
|
var t;
|
|
55
55
|
const i = [];
|
|
56
56
|
for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].bt());
|
|
@@ -60,10 +60,10 @@ export default class re extends t {
|
|
|
60
60
|
null != t &&
|
|
61
61
|
t.feed &&
|
|
62
62
|
(this.Ds(),
|
|
63
|
-
this.
|
|
63
|
+
this.Ui(t.feed),
|
|
64
64
|
this.Ts.X(new Feed(this.cards.slice(), this.xi)));
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
ki() {
|
|
67
67
|
this.Ds();
|
|
68
68
|
const t = [],
|
|
69
69
|
s = new Date();
|
|
@@ -74,11 +74,11 @@ export default class re extends t {
|
|
|
74
74
|
}
|
|
75
75
|
return new Feed(t, this.xi);
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
bi() {
|
|
78
78
|
this.Fi && this.Fi.requestFeedRefresh();
|
|
79
79
|
}
|
|
80
80
|
qt(t) {
|
|
81
|
-
return this.Ts.
|
|
81
|
+
return this.Ts.Dt(t);
|
|
82
82
|
}
|
|
83
83
|
clearData(t) {
|
|
84
84
|
null == t && (t = !1),
|
package/src/Feed/ui/show-feed.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import ro from "../../util/browser-detector.js";
|
|
2
2
|
import { InAppMessage, logInAppMessageHtmlClick } from "../index.js";
|
|
3
3
|
import { OperatingSystems as so } from "../../util/device-constants.js";
|
|
4
|
-
import { buildHtmlClickHandler as
|
|
4
|
+
import { buildHtmlClickHandler as ct } from "./html-message-display-utils.js";
|
|
5
5
|
import { attachHtmlToIframeWithNonce as m } from "../../util/html-display-utils.js";
|
|
6
6
|
import { buildBrazeBridge as b } from "../../util/html-display-utils.js";
|
|
7
|
-
export default function
|
|
7
|
+
export default function mt(t, e, o, s, n, i) {
|
|
8
8
|
const l = document.createElement("iframe");
|
|
9
9
|
l.setAttribute("title", "Modal Message"),
|
|
10
10
|
n && (l.style.zIndex = (n + 1).toString());
|
|
@@ -42,16 +42,16 @@ 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.uo !== InAppMessage.po
|
|
45
|
+
((n.appboyBridge = c), (n.brazeBridge = c), t.uo !== InAppMessage.bo.po)
|
|
46
46
|
) {
|
|
47
47
|
const e = n.document.getElementsByTagName("a");
|
|
48
|
-
for (let o = 0; o < e.length; o++) e[o].onclick =
|
|
48
|
+
for (let o = 0; o < e.length; o++) e[o].onclick = ct(t, l, e[o], s);
|
|
49
49
|
const o = n.document.getElementsByTagName("button");
|
|
50
|
-
for (let e = 0; e < o.length; e++) o[e].onclick =
|
|
50
|
+
for (let e = 0; e < o.length; e++) o[e].onclick = ct(t, l, o[e], s);
|
|
51
51
|
}
|
|
52
52
|
const m = n.document.body;
|
|
53
53
|
if (null != m) {
|
|
54
|
-
t.
|
|
54
|
+
t.ho() && (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.jo = e), e
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
|
-
return (t.
|
|
73
|
+
return (t.jo = l), l;
|
|
74
74
|
}
|
|
@@ -12,20 +12,20 @@ import InAppMessage from "../models/in-app-message.js";
|
|
|
12
12
|
import ModalMessage from "../models/modal-message.js";
|
|
13
13
|
import SlideUpMessage from "../models/slide-up-message.js";
|
|
14
14
|
import { logInAppMessageClick } from "../log-in-app-message-click.js";
|
|
15
|
-
import { _handleBrazeAction as
|
|
16
|
-
import
|
|
15
|
+
import { _handleBrazeAction as G } from "../../Core/handle-braze-action.js";
|
|
16
|
+
import mt from "./html-message-to-html.js";
|
|
17
17
|
import ce from "./modal-utils.js";
|
|
18
|
-
import { logger as N, Guid as
|
|
18
|
+
import { logger as N, Guid as K } 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.
|
|
21
|
-
return
|
|
20
|
+
if (((e.wo = document.activeElement), e instanceof HtmlMessage))
|
|
21
|
+
return mt(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;
|
|
24
24
|
const c = document.createElement("div");
|
|
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.vo() &&
|
|
29
29
|
((c.className += " ab-modal-interactions"),
|
|
30
30
|
c.setAttribute("tabindex", "-1")),
|
|
31
31
|
e.lo() ||
|
|
@@ -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.xo
|
|
41
|
+
InAppMessage.Co.xo,
|
|
42
42
|
)
|
|
43
43
|
: a(c));
|
|
44
44
|
},
|
|
@@ -67,7 +67,7 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
67
67
|
e.ll(c, () => {
|
|
68
68
|
logInAppMessageClick(e),
|
|
69
69
|
e.clickAction === InAppMessage.ClickAction.URI
|
|
70
|
-
?
|
|
70
|
+
? G(
|
|
71
71
|
e.uri || "",
|
|
72
72
|
n || e.openTarget === InAppMessage.OpenTarget.BLANK,
|
|
73
73
|
a,
|
|
@@ -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.$o).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.ko(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.ko(o),
|
|
109
109
|
0 === document.querySelectorAll(".ab-iam-img-loading").length)
|
|
110
110
|
) {
|
|
111
111
|
g = !0;
|
|
@@ -142,7 +142,7 @@ 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.Mo = K.ce()), (o.id = e.Mo);
|
|
146
146
|
const a = (
|
|
147
147
|
e.headerAlignment || InAppMessage.TextAlignment.CENTER
|
|
148
148
|
).toLowerCase();
|
|
@@ -151,14 +151,14 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
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.zo()), c.appendChild(b), g || d(), (e.jo = 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.Lo(e, o, c, n),
|
|
160
|
+
ce.Io(c),
|
|
161
|
+
ce.To(e.Mo, c);
|
|
162
162
|
} else if (e instanceof SlideUpMessage) {
|
|
163
163
|
c.className += " ab-slideup";
|
|
164
164
|
const o = c.getElementsByClassName("ab-close-button")[0];
|
|
@@ -180,8 +180,8 @@ export default function de(e, o, a, t, n, s, i, m = document.body, l = "ltr") {
|
|
|
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.qo), (t = " ab-swiped-up"))
|
|
184
|
+
: ((a = R.yo), (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
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import InAppMessage from "../models/in-app-message.js";
|
|
2
|
-
import { _handleBrazeAction as
|
|
2
|
+
import { _handleBrazeAction as G } from "../../Core/handle-braze-action.js";
|
|
3
3
|
import { logInAppMessageButtonClick } from "../log-in-app-message-button-click.js";
|
|
4
4
|
import { toRgba as le } from "../../util/color-utils.js";
|
|
5
5
|
import { addPassiveEventListener as J } from "../../util/dom-utils.js";
|
|
6
|
-
import { KeyCodes as
|
|
6
|
+
import { KeyCodes as bt } from "../../util/key-codes.js";
|
|
7
7
|
const ce = {
|
|
8
|
-
|
|
8
|
+
Io: (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 ce = {
|
|
|
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 === bt.Ao &&
|
|
20
20
|
(o.shiftKey || (a !== s && a !== t)
|
|
21
21
|
? !o.shiftKey ||
|
|
22
22
|
(a !== e && a !== t) ||
|
|
@@ -25,13 +25,13 @@ const ce = {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
To: (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
|
+
Lo: (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);
|
|
@@ -41,7 +41,7 @@ const ce = {
|
|
|
41
41
|
t.ll(e, () => {
|
|
42
42
|
logInAppMessageButtonClick(a, t),
|
|
43
43
|
a.clickAction === InAppMessage.ClickAction.URI
|
|
44
|
-
?
|
|
44
|
+
? G(
|
|
45
45
|
a.uri || "",
|
|
46
46
|
s || t.openTarget === InAppMessage.OpenTarget.BLANK,
|
|
47
47
|
l,
|
|
@@ -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.cs || o === InAppMessage.bo.Fo)
|
|
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.cs)
|
|
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.cs)
|
|
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.po
|
|
142
|
-
o !== InAppMessage.
|
|
140
|
+
o !== HtmlMessage.cs &&
|
|
141
|
+
o !== InAppMessage.bo.po &&
|
|
142
|
+
o !== InAppMessage.bo.Jo
|
|
143
143
|
)
|
|
144
144
|
return void N.error("Ignoring message with unknown type " + o);
|
|
145
145
|
{
|
|
@@ -7,7 +7,7 @@ import InAppMessageButton from "./models/in-app-message-button.js";
|
|
|
7
7
|
import c from "../common/event-logger.js";
|
|
8
8
|
import { newInAppMessageFromJson as ut } from "./in-app-message-factory.js";
|
|
9
9
|
import { randomInclusive as a } from "../util/math.js";
|
|
10
|
-
import
|
|
10
|
+
import F from "../models/request-result.js";
|
|
11
11
|
import { logger as N, EventTypes as d } from "../../shared-lib/index.js";
|
|
12
12
|
import u from "../managers/subscription-manager.js";
|
|
13
13
|
import pt from "../triggers/models/trigger.js";
|
|
@@ -34,37 +34,37 @@ export default class ea {
|
|
|
34
34
|
(this.C = s),
|
|
35
35
|
(this.Cs = i),
|
|
36
36
|
(this.Mi = new u()),
|
|
37
|
-
r.
|
|
38
|
-
(this.
|
|
39
|
-
(this.
|
|
37
|
+
r.F(this.Mi),
|
|
38
|
+
(this.Bi = 1e3),
|
|
39
|
+
(this._i = 6e4),
|
|
40
|
+
(this.Pi = null),
|
|
40
41
|
(this.Gi = null),
|
|
41
|
-
(this.$i = null)
|
|
42
|
-
(this.Oi = null);
|
|
42
|
+
(this.$i = null);
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
Oi() {
|
|
45
45
|
return this.Mi;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
return this.Mi.
|
|
47
|
+
Xi(t) {
|
|
48
|
+
return this.Mi.Dt(t);
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
return this.
|
|
50
|
+
Hi() {
|
|
51
|
+
return this.Pi;
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
this.
|
|
53
|
+
Ji(t) {
|
|
54
|
+
this.Pi = t;
|
|
55
55
|
}
|
|
56
56
|
ut(t, e, s, i) {
|
|
57
|
-
const r = new
|
|
57
|
+
const r = new F();
|
|
58
58
|
let n;
|
|
59
|
-
if (e === d.
|
|
60
|
-
if (!t.
|
|
59
|
+
if (e === d.Ki || t instanceof ControlMessage) {
|
|
60
|
+
if (!t._t())
|
|
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.
|
|
67
|
+
} else if (e === d.Li || (t instanceof HtmlMessage && e === d.Qi)) {
|
|
68
68
|
if (!t.$t(i))
|
|
69
69
|
return (
|
|
70
70
|
N.info(
|
|
@@ -77,7 +77,7 @@ export default class ea {
|
|
|
77
77
|
(n =
|
|
78
78
|
t instanceof ControlMessage
|
|
79
79
|
? { trigger_ids: [t.triggerId] }
|
|
80
|
-
: this.
|
|
80
|
+
: this.Vi(t)),
|
|
81
81
|
null == n
|
|
82
82
|
? r
|
|
83
83
|
: (t.messageExtras && (n.message_extras = t.messageExtras),
|
|
@@ -85,8 +85,8 @@ export default class ea {
|
|
|
85
85
|
c.ut(e, n))
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
const s = new
|
|
88
|
+
Wi(t, e) {
|
|
89
|
+
const s = new F();
|
|
90
90
|
if (!t.$t())
|
|
91
91
|
return (
|
|
92
92
|
N.info(
|
|
@@ -94,32 +94,32 @@ export default class ea {
|
|
|
94
94
|
),
|
|
95
95
|
s
|
|
96
96
|
);
|
|
97
|
-
const i = this.
|
|
97
|
+
const i = this.Vi(e);
|
|
98
98
|
return null == i
|
|
99
99
|
? s
|
|
100
|
-
: t.id === InAppMessageButton.
|
|
100
|
+
: t.id === InAppMessageButton.Yi
|
|
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.ut(d.
|
|
105
|
+
: (null != t.id && (i.bid = t.id), c.ut(d.Qi, i));
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
Zi(t) {
|
|
108
108
|
const e = t.messageFields;
|
|
109
109
|
return (null != e && e.is_push_primer) || !1;
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
Ir(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.Mr, "In-App Message")
|
|
118
|
+
: gt(e) && !vt.Tr()
|
|
119
|
+
? dt(jt.wr, "In-App Message")
|
|
120
120
|
: void 0;
|
|
121
121
|
};
|
|
122
|
-
if (this.
|
|
122
|
+
if (this.Zi(t) && !vt.Tr())
|
|
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
|
+
Br(t, e) {
|
|
141
|
+
e !== this.$i && this._r(), (this.Gi = t), (this.$i = e);
|
|
142
142
|
}
|
|
143
|
-
|
|
144
|
-
null != this
|
|
145
|
-
(clearTimeout(this
|
|
143
|
+
_r() {
|
|
144
|
+
null != this.Gi &&
|
|
145
|
+
(clearTimeout(this.Gi), (this.Gi = null), (this.$i = null));
|
|
146
146
|
}
|
|
147
|
-
|
|
147
|
+
qr(t, e, s, i) {
|
|
148
148
|
const r = this.S;
|
|
149
149
|
if (!r) return;
|
|
150
|
-
this
|
|
151
|
-
const n = r.
|
|
150
|
+
this.$i && t.triggerId !== this.$i && (this._r(), h.vi(this.C, h.O.Er));
|
|
151
|
+
const n = r.Gr(!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.Nr());
|
|
155
|
+
const u = r.J(o, h.O.Er);
|
|
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.Er, p),
|
|
163
163
|
-1 !== r && u.push(["X-Braze-Req-Tokens-Remaining", r.toString()]);
|
|
164
164
|
let m,
|
|
165
165
|
c,
|
|
@@ -170,16 +170,16 @@ export default class ea {
|
|
|
170
170
|
headers: u,
|
|
171
171
|
tt: (e) => {
|
|
172
172
|
if (!n.st(o, e, u))
|
|
173
|
-
return void ("function" == typeof t
|
|
173
|
+
return void ("function" == typeof t.$r && t.$r());
|
|
174
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.Or.Cr) return;
|
|
177
177
|
const i = ut(s.data);
|
|
178
178
|
if (null == i) return;
|
|
179
|
-
const r = this.
|
|
179
|
+
const r = this.Ir(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.$r && t.$r());
|
|
182
|
+
"function" == typeof t.Xr && t.Xr(i);
|
|
183
183
|
},
|
|
184
184
|
error: (e) => {
|
|
185
185
|
(g = !0),
|
|
@@ -187,21 +187,21 @@ export default class ea {
|
|
|
187
187
|
(c = `getting user personalization for message ${t.triggerId}.`);
|
|
188
188
|
},
|
|
189
189
|
nt: (r, o) => {
|
|
190
|
-
if (new Date().valueOf() - t.
|
|
190
|
+
if (new Date().valueOf() - t.Hr < t.Jr) {
|
|
191
191
|
let r = 0;
|
|
192
192
|
if (g) {
|
|
193
|
-
const e = Math.min(t.
|
|
194
|
-
s = this.
|
|
193
|
+
const e = Math.min(t.Jr, this._i),
|
|
194
|
+
s = this.Bi;
|
|
195
195
|
null == i && (i = s), (r = Math.min(e, a(s, 3 * i)));
|
|
196
196
|
}
|
|
197
197
|
n.rt(
|
|
198
198
|
o,
|
|
199
199
|
() => {
|
|
200
|
-
this.
|
|
200
|
+
this.qr(t, e, s, r);
|
|
201
201
|
},
|
|
202
|
-
h.O.
|
|
203
|
-
(e) => this.
|
|
204
|
-
() => this.
|
|
202
|
+
h.O.Er,
|
|
203
|
+
(e) => this.Br(e, t.triggerId),
|
|
204
|
+
() => this._r(),
|
|
205
205
|
r,
|
|
206
206
|
);
|
|
207
207
|
}
|
|
@@ -209,10 +209,10 @@ export default class ea {
|
|
|
209
209
|
},
|
|
210
210
|
});
|
|
211
211
|
},
|
|
212
|
-
h.O.
|
|
212
|
+
h.O.Er,
|
|
213
213
|
);
|
|
214
214
|
}
|
|
215
|
-
|
|
215
|
+
Vi(t) {
|
|
216
216
|
if (null == t.triggerId)
|
|
217
217
|
return (
|
|
218
218
|
N.info(
|
|
@@ -230,33 +230,33 @@ export default class ea {
|
|
|
230
230
|
!(t && t instanceof InAppMessage && t.constructor !== InAppMessage) ||
|
|
231
231
|
t instanceof ControlMessage
|
|
232
232
|
) &&
|
|
233
|
-
this.C.Bt(s.gt.
|
|
233
|
+
this.C.Bt(s.gt.Kr, t.bt())
|
|
234
234
|
);
|
|
235
235
|
}
|
|
236
236
|
Ar() {
|
|
237
237
|
if (!this.C) return null;
|
|
238
|
-
const t = this.C.ft(s.gt.
|
|
238
|
+
const t = this.C.ft(s.gt.Kr);
|
|
239
239
|
if (!t) return null;
|
|
240
240
|
let e;
|
|
241
241
|
switch (t.type) {
|
|
242
|
-
case InAppMessage.
|
|
243
|
-
e = FullScreenMessage.
|
|
242
|
+
case InAppMessage.bo.Lr:
|
|
243
|
+
e = FullScreenMessage.Qr(t);
|
|
244
244
|
break;
|
|
245
|
-
case InAppMessage.
|
|
246
|
-
case InAppMessage.po
|
|
247
|
-
case InAppMessage.
|
|
248
|
-
e = HtmlMessage.
|
|
245
|
+
case InAppMessage.bo.Ur:
|
|
246
|
+
case InAppMessage.bo.po:
|
|
247
|
+
case InAppMessage.bo.Jo:
|
|
248
|
+
e = HtmlMessage.Qr(t);
|
|
249
249
|
break;
|
|
250
|
-
case InAppMessage.
|
|
251
|
-
case InAppMessage.
|
|
252
|
-
e = ModalMessage.
|
|
250
|
+
case InAppMessage.bo.Vr:
|
|
251
|
+
case InAppMessage.bo.Fo:
|
|
252
|
+
e = ModalMessage.Qr(t);
|
|
253
253
|
break;
|
|
254
|
-
case InAppMessage.
|
|
255
|
-
e = SlideUpMessage.
|
|
254
|
+
case InAppMessage.bo.Wr:
|
|
255
|
+
e = SlideUpMessage.Qr(t);
|
|
256
256
|
}
|
|
257
|
-
return e && this.
|
|
257
|
+
return e && this.Yr(), e;
|
|
258
258
|
}
|
|
259
|
-
|
|
260
|
-
this.C && this.C.Ut(s.gt.
|
|
259
|
+
Yr() {
|
|
260
|
+
this.C && this.C.Ut(s.gt.Kr);
|
|
261
261
|
}
|
|
262
262
|
}
|
|
@@ -12,11 +12,11 @@ export function logInAppMessageButtonClick(o, t) {
|
|
|
12
12
|
if (!(o instanceof InAppMessageButton))
|
|
13
13
|
return N.error("button must be an InAppMessageButton object"), !1;
|
|
14
14
|
if (!(t instanceof InAppMessage)) return N.error(sr), !1;
|
|
15
|
-
const s = se.ea().
|
|
15
|
+
const s = se.ea().Wi(o, t);
|
|
16
16
|
if (s.tt)
|
|
17
17
|
for (let r = 0; r < s.$e.length; r++)
|
|
18
18
|
ot.m().Ce(
|
|
19
|
-
et.
|
|
19
|
+
et.Zr,
|
|
20
20
|
[
|
|
21
21
|
t.triggerId,
|
|
22
22
|
null === (e = o.id) || void 0 === e ? void 0 : e.toString(),
|
|
@@ -9,11 +9,11 @@ import { TriggersProviderFactory as ot } from "../triggers/triggers-provider-fac
|
|
|
9
9
|
export function logInAppMessageClick(o) {
|
|
10
10
|
if (!r.rr()) return !1;
|
|
11
11
|
if (!(o instanceof InAppMessage)) return N.error(sr), !1;
|
|
12
|
-
const s = se.ea().ut(o, d.
|
|
12
|
+
const s = se.ea().ut(o, d.Li);
|
|
13
13
|
if (s) {
|
|
14
|
-
o.
|
|
14
|
+
o.Bo() || logInAppMessageImpression(o);
|
|
15
15
|
for (let r = 0; r < s.$e.length; r++)
|
|
16
|
-
ot.m().Ce(et.
|
|
16
|
+
ot.m().Ce(et.Zr, [o.triggerId], s.$e[r]);
|
|
17
17
|
}
|
|
18
18
|
return s.tt;
|
|
19
19
|
}
|