@braze/web-sdk 4.5.0 → 4.6.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/README.md +1 -1
- package/index.d.ts +49 -8
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +7 -7
- package/shared-lib/encoding-utils.js +3 -3
- package/shared-lib/event-types.js +14 -14
- package/shared-lib/guid.js +2 -2
- package/shared-lib/indexed-db-adapter.js +3 -3
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +15 -15
- package/src/Card/index.js +1 -0
- package/src/Card/log-content-card-click.js +4 -0
- package/src/FeatureFlags/feature-flag-factory.js +13 -5
- package/src/FeatureFlags/feature-flag.js +36 -8
- package/src/FeatureFlags/feature-flags-provider.js +58 -33
- package/src/FeatureFlags/get-all-feature-flags.js +3 -3
- package/src/FeatureFlags/get-feature-flag.js +5 -5
- package/src/FeatureFlags/index.js +1 -0
- package/src/Feed/feed-provider-factory.js +8 -8
- package/src/Feed/feed-provider.js +3 -3
- package/src/Feed/get-cached-feed.js +2 -2
- package/src/Feed/log-feed-displayed.js +1 -1
- package/src/Feed/request-feed-refresh.js +2 -2
- package/src/Feed/subscribe-to-feed-updates.js +2 -2
- package/src/Feed/ui/show-feed.js +2 -2
- package/src/InAppMessage/display/html-message-to-html.js +3 -3
- package/src/InAppMessage/display/in-app-message-to-html.js +101 -86
- package/src/InAppMessage/display/modal-utils.js +9 -9
- package/src/InAppMessage/in-app-message-factory.js +1 -1
- package/src/InAppMessage/in-app-message-manager-factory.js +3 -3
- package/src/InAppMessage/in-app-message-manager.js +52 -52
- 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 +3 -3
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/full-screen-message.js +1 -1
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +68 -68
- package/src/InAppMessage/models/modal-message.js +2 -2
- package/src/InAppMessage/models/slide-up-message.js +8 -8
- package/src/InAppMessage/models/templated-in-app-message.js +4 -4
- 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 +24 -21
- package/src/Push/push-manager.js +54 -54
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +13 -13
- package/src/common/base-feed.js +1 -1
- package/src/common/feed-display.js +22 -22
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/managers/auth-manager.js +23 -23
- package/src/managers/braze-instance.js +93 -93
- package/src/managers/device-manager.js +2 -2
- package/src/managers/network-manager.js +42 -42
- package/src/managers/server-config-manager.js +9 -9
- package/src/managers/session-manager.js +27 -27
- package/src/managers/storage-manager-factory.js +1 -1
- package/src/managers/storage-manager.js +61 -61
- package/src/managers/subscription-manager.js +6 -6
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +2 -2
- package/src/models/device.js +1 -1
- package/src/models/identifier.js +6 -6
- package/src/models/push-token.js +3 -3
- package/src/models/server-config.js +3 -3
- package/src/request-controller.js +52 -52
- package/src/triggers/models/filter-set.js +2 -2
- package/src/triggers/models/filter.js +34 -34
- package/src/triggers/models/in-app-message-click-data.js +6 -6
- package/src/triggers/models/push-click-data.js +1 -1
- package/src/triggers/models/trigger-condition.js +8 -8
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +30 -30
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +37 -37
- 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/ui/js/load-font-awesome.js +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +2 -2
- package/src/util/dom-utils.js +8 -8
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +3 -3
- package/src/util/window-utils.js +1 -1
|
@@ -2,13 +2,13 @@ import y from "../common/base-provider.js";
|
|
|
2
2
|
import e from "../managers/braze-instance.js";
|
|
3
3
|
import Feed from "./feed.js";
|
|
4
4
|
import {
|
|
5
|
-
newCardFromFeedJson as
|
|
5
|
+
newCardFromFeedJson as it,
|
|
6
6
|
newCardFromSerializedValue as S
|
|
7
7
|
} from "../Card/util/card-factory.js";
|
|
8
8
|
import { rehydrateDateAfterJsonization as w } from "../util/date-utils.js";
|
|
9
9
|
import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
|
|
10
10
|
import u from "../managers/subscription-manager.js";
|
|
11
|
-
export default class
|
|
11
|
+
export default class ee extends y {
|
|
12
12
|
constructor(t, s) {
|
|
13
13
|
super(),
|
|
14
14
|
(this.h = t),
|
|
@@ -33,7 +33,7 @@ export default class re extends y {
|
|
|
33
33
|
r = {};
|
|
34
34
|
for (let h = 0; h < t.length; h++) {
|
|
35
35
|
i = t[h];
|
|
36
|
-
const o =
|
|
36
|
+
const o = it(i);
|
|
37
37
|
null != o && (e[o.id] && ((o.viewed = !0), (r[o.id] = !0)), s.push(o));
|
|
38
38
|
}
|
|
39
39
|
this.h.B(o.q.P, r),
|
package/src/Feed/ui/show-feed.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
updateFeedCards as k
|
|
10
10
|
} from "../../common/feed-display.js";
|
|
11
11
|
import { Feed, logFeedDisplayed, subscribeToFeedUpdates } from "../index.js";
|
|
12
|
-
import
|
|
12
|
+
import re from "../feed-provider-factory.js";
|
|
13
13
|
import { intersection as te } from "../../util/code-utils.js";
|
|
14
14
|
import { setCardHeight as A } from "../../Card/display/card-display.js";
|
|
15
15
|
import { setupFeedUI as B } from "../../ui/js/index.js";
|
|
@@ -36,7 +36,7 @@ export function showFeed(t, n, o) {
|
|
|
36
36
|
let a = !1,
|
|
37
37
|
f = null;
|
|
38
38
|
null == n
|
|
39
|
-
? ((f =
|
|
39
|
+
? ((f = re.er().ai()),
|
|
40
40
|
k(f, s(f.cards, o), f.lastUpdated, null, i),
|
|
41
41
|
(a = !0))
|
|
42
42
|
: (f = new Feed(s(n, o), new Date()));
|
|
@@ -5,9 +5,9 @@ import { getUser as Q } from "../../Core/get-user.js";
|
|
|
5
5
|
import { InAppMessage } from "../index.js";
|
|
6
6
|
import { keys as rr } from "../../util/code-utils.js";
|
|
7
7
|
import { OperatingSystems as rt } from "../../util/device-constants.js";
|
|
8
|
-
import { parseQueryStringKeyValues as
|
|
8
|
+
import { parseQueryStringKeyValues as ut } from "../../util/url-utils.js";
|
|
9
9
|
import { WindowUtils as H } from "../../util/window-utils.js";
|
|
10
|
-
export default function
|
|
10
|
+
export default function ct(t, n, e, o, s, r) {
|
|
11
11
|
const i = document.createElement("iframe");
|
|
12
12
|
i.setAttribute("title", "Modal Message"), s && (i.style.zIndex = s + 1);
|
|
13
13
|
const u = n => {
|
|
@@ -15,7 +15,7 @@ export default function ut(t, n, e, o, s, r) {
|
|
|
15
15
|
s = n.onclick;
|
|
16
16
|
return r => {
|
|
17
17
|
if (null != s && "function" == typeof s && !1 === s()) return;
|
|
18
|
-
let u =
|
|
18
|
+
let u = ut(e).abButtonId;
|
|
19
19
|
if (
|
|
20
20
|
((null != u && "" !== u) || (u = n.getAttribute("id")),
|
|
21
21
|
null != e && "" !== e && 0 !== e.indexOf("#"))
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
DIRECTIONS as c
|
|
6
6
|
} from "../../util/dom-utils.js";
|
|
7
7
|
import { createCloseButton as i } from "../../util/component-utils.js";
|
|
8
|
-
import { isTransparent as
|
|
8
|
+
import { isTransparent as ie, toRgba as ne } from "../../util/color-utils.js";
|
|
9
9
|
import FullScreenMessage from "../models/full-screen-message.js";
|
|
10
10
|
import HtmlMessage from "../models/html-message.js";
|
|
11
11
|
import InAppMessage from "../models/in-app-message.js";
|
|
@@ -13,140 +13,155 @@ 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
15
|
import { _handleBrazeAction as m } from "../../Core/handle-braze-action.js";
|
|
16
|
-
import
|
|
17
|
-
import
|
|
16
|
+
import ct from "./html-message-to-html.js";
|
|
17
|
+
import me from "./modal-utils.js";
|
|
18
18
|
import r from "../../../shared-lib/braze-shared-lib.js";
|
|
19
|
-
export default function
|
|
20
|
-
if (((e.
|
|
21
|
-
return
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
(
|
|
25
|
-
|
|
26
|
-
e.
|
|
27
|
-
((
|
|
28
|
-
|
|
19
|
+
export default function ce(e, o, a, s, t, n, l) {
|
|
20
|
+
if (((e.Le = document.activeElement), e instanceof HtmlMessage))
|
|
21
|
+
return ct(e, o, a, t, n, l);
|
|
22
|
+
const b = (function(e, o, a, s, t, n) {
|
|
23
|
+
const c = document.createElement("div");
|
|
24
|
+
(c.className = "ab-in-app-message ab-start-hidden ab-background"),
|
|
25
|
+
n && (c.style.zIndex = n + 1),
|
|
26
|
+
e.Ie() &&
|
|
27
|
+
((c.className += " ab-modal-interactions"),
|
|
28
|
+
c.setAttribute("tabindex", "-1")),
|
|
29
29
|
e.sn() ||
|
|
30
|
-
((
|
|
31
|
-
(
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
((c.style.color = ne(e.textColor)),
|
|
31
|
+
(c.style.backgroundColor = ne(e.backgroundColor)),
|
|
32
|
+
ie(e.backgroundColor) && (c.className += " ab-no-shadow"));
|
|
33
|
+
const d = () => {
|
|
34
|
+
-1 !== c.className.indexOf("ab-start-hidden") &&
|
|
35
|
+
((c.className = c.className.replace("ab-start-hidden", "")),
|
|
36
|
+
document.querySelectorAll(".ab-iam-img-loading").length > 0
|
|
37
|
+
? s(
|
|
38
|
+
`Cannot show in-app message ${e.message} because another message is being shown.`,
|
|
39
|
+
InAppMessage.Ge.Ee
|
|
40
|
+
)
|
|
41
|
+
: a(c));
|
|
42
|
+
},
|
|
43
|
+
l = () => {
|
|
44
|
+
const e = document.querySelectorAll(".ab-iam-root");
|
|
45
|
+
e && e.length > 0 && (e[0].classList.remove("ab-iam-img-loading"), d());
|
|
46
|
+
};
|
|
37
47
|
e.imageStyle === InAppMessage.ImageStyle.GRAPHIC &&
|
|
38
|
-
(
|
|
48
|
+
(c.className += " graphic"),
|
|
39
49
|
e.orientation === InAppMessage.Orientation.LANDSCAPE &&
|
|
40
|
-
(
|
|
50
|
+
(c.className += " landscape"),
|
|
41
51
|
0 === e.buttons.length &&
|
|
42
52
|
(e.clickAction !== InAppMessage.ClickAction.NONE &&
|
|
43
|
-
(
|
|
44
|
-
(
|
|
45
|
-
e.on(
|
|
53
|
+
(c.className += " ab-clickable"),
|
|
54
|
+
(c.onclick = a => (
|
|
55
|
+
e.on(c, () => {
|
|
46
56
|
logInAppMessageClick(e),
|
|
47
57
|
e.clickAction === InAppMessage.ClickAction.URI
|
|
48
58
|
? m(
|
|
49
59
|
e.uri,
|
|
50
|
-
|
|
60
|
+
a,
|
|
51
61
|
t || e.openTarget === InAppMessage.OpenTarget.BLANK
|
|
52
62
|
)
|
|
53
63
|
: e.clickAction === InAppMessage.ClickAction.NEWS_FEED && o();
|
|
54
64
|
}),
|
|
55
|
-
|
|
65
|
+
a.stopPropagation(),
|
|
56
66
|
!1
|
|
57
67
|
)));
|
|
58
|
-
const
|
|
68
|
+
const b = i(
|
|
59
69
|
"Close Message",
|
|
60
|
-
e.sn() ? void 0 :
|
|
70
|
+
e.sn() ? void 0 : ne(e.closeButtonColor),
|
|
61
71
|
() => {
|
|
62
|
-
e.on(
|
|
72
|
+
e.on(c);
|
|
63
73
|
}
|
|
64
74
|
);
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
let
|
|
71
|
-
const
|
|
72
|
-
if (((
|
|
75
|
+
c.appendChild(b), n && (b.style.zIndex = n + 2);
|
|
76
|
+
const u = document.createElement("div");
|
|
77
|
+
u.className = "ab-message-text";
|
|
78
|
+
const p = (e.messageAlignment || e.He).toLowerCase();
|
|
79
|
+
u.className += " " + p + "-aligned";
|
|
80
|
+
let f = !1;
|
|
81
|
+
const g = document.createElement("div");
|
|
82
|
+
if (((g.className = "ab-image-area"), e.imageUrl)) {
|
|
73
83
|
if (e.cropType === InAppMessage.CropType.CENTER_CROP) {
|
|
74
84
|
const o = document.createElement("span");
|
|
75
85
|
(o.className = "ab-center-cropped-img"),
|
|
76
86
|
(o.style.backgroundImage = "url(" + e.imageUrl + ")"),
|
|
77
87
|
o.setAttribute("role", "img"),
|
|
78
88
|
o.setAttribute("aria-label", "Modal Image"),
|
|
79
|
-
e.
|
|
80
|
-
|
|
89
|
+
e.Je(o),
|
|
90
|
+
g.appendChild(o);
|
|
81
91
|
} else {
|
|
82
92
|
const o = document.createElement("img");
|
|
83
|
-
|
|
84
|
-
e.
|
|
85
|
-
(
|
|
86
|
-
(
|
|
87
|
-
|
|
88
|
-
f
|
|
93
|
+
if (
|
|
94
|
+
(o.setAttribute("src", e.imageUrl),
|
|
95
|
+
e.Je(o),
|
|
96
|
+
0 === document.querySelectorAll(".ab-iam-img-loading").length)
|
|
97
|
+
) {
|
|
98
|
+
f = !0;
|
|
99
|
+
const e = document.querySelectorAll(".ab-iam-root");
|
|
100
|
+
e && e.length > 0 && e[0].classList.add("ab-iam-img-loading"),
|
|
101
|
+
(o.onload = l);
|
|
102
|
+
}
|
|
103
|
+
setTimeout(d, 1e3), g.appendChild(o);
|
|
89
104
|
}
|
|
90
|
-
|
|
105
|
+
c.appendChild(g), (u.className += " ab-with-image");
|
|
91
106
|
} else if (e.icon) {
|
|
92
|
-
|
|
107
|
+
g.className += " ab-icon-area";
|
|
93
108
|
const o = document.createElement("span");
|
|
94
109
|
(o.className = "ab-icon"),
|
|
95
110
|
e.sn() ||
|
|
96
|
-
((o.style.backgroundColor =
|
|
97
|
-
(o.style.color =
|
|
98
|
-
const
|
|
99
|
-
(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
o.appendChild(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
(
|
|
111
|
+
((o.style.backgroundColor = ne(e.iconBackgroundColor)),
|
|
112
|
+
(o.style.color = ne(e.iconColor)));
|
|
113
|
+
const a = document.createElement("i");
|
|
114
|
+
(a.className = "fa"),
|
|
115
|
+
a.appendChild(document.createTextNode(e.icon)),
|
|
116
|
+
a.setAttribute("aria-hidden", !0),
|
|
117
|
+
o.appendChild(a),
|
|
118
|
+
g.appendChild(o),
|
|
119
|
+
c.appendChild(g),
|
|
120
|
+
(u.className += " ab-with-icon");
|
|
106
121
|
}
|
|
107
|
-
if ((oe(
|
|
122
|
+
if ((oe(u, "touchstart", function() {}), e.header && e.header.length > 0)) {
|
|
108
123
|
const o = document.createElement("h1");
|
|
109
|
-
(o.className = "ab-message-header"), (e.
|
|
110
|
-
const
|
|
124
|
+
(o.className = "ab-message-header"), (e.Ke = r.it.nt()), (o.id = e.Ke);
|
|
125
|
+
const a = (
|
|
111
126
|
e.headerAlignment || InAppMessage.TextAlignment.CENTER
|
|
112
127
|
).toLowerCase();
|
|
113
|
-
(o.className += " " +
|
|
114
|
-
e.sn() || (o.style.color =
|
|
128
|
+
(o.className += " " + a + "-aligned"),
|
|
129
|
+
e.sn() || (o.style.color = ne(e.headerTextColor)),
|
|
115
130
|
o.appendChild(document.createTextNode(e.header)),
|
|
116
|
-
|
|
131
|
+
u.appendChild(o);
|
|
117
132
|
}
|
|
118
|
-
return
|
|
119
|
-
})(e, o, s, t,
|
|
133
|
+
return u.appendChild(e.Oe()), c.appendChild(u), f || d(), (e.mn = c), c;
|
|
134
|
+
})(e, o, a, s, t, n);
|
|
120
135
|
if (e instanceof FullScreenMessage || e instanceof ModalMessage) {
|
|
121
|
-
const
|
|
122
|
-
(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
136
|
+
const a = e instanceof FullScreenMessage ? "ab-fullscreen" : "ab-modal";
|
|
137
|
+
(b.className += ` ${a} ab-centered`),
|
|
138
|
+
me.Pe(e, o, b, t),
|
|
139
|
+
me.Qe(b),
|
|
140
|
+
me.Ve(e.Ke, b);
|
|
126
141
|
} else if (e instanceof SlideUpMessage) {
|
|
127
|
-
|
|
128
|
-
const o =
|
|
142
|
+
b.className += " ab-slideup";
|
|
143
|
+
const o = b.getElementsByClassName("ab-close-button")[0];
|
|
129
144
|
if (null != o) {
|
|
130
|
-
const
|
|
145
|
+
const a = ae(
|
|
131
146
|
"0 0 11.38 19.44",
|
|
132
147
|
"M11.38 9.72l-9.33 9.72L0 17.3l7.27-7.58L0 2.14 2.05 0l9.33 9.72z",
|
|
133
|
-
e.sn() ? void 0 :
|
|
148
|
+
e.sn() ? void 0 : ne(e.closeButtonColor)
|
|
134
149
|
);
|
|
135
|
-
|
|
150
|
+
a.setAttribute("class", "ab-chevron"), o.appendChild(a);
|
|
136
151
|
}
|
|
137
|
-
let
|
|
138
|
-
d(
|
|
139
|
-
(
|
|
152
|
+
let a, s;
|
|
153
|
+
d(b, c.ot, e => {
|
|
154
|
+
(b.className += " ab-swiped-left"), o.onclick(e);
|
|
140
155
|
}),
|
|
141
|
-
d(
|
|
142
|
-
(
|
|
156
|
+
d(b, c.et, e => {
|
|
157
|
+
(b.className += " ab-swiped-right"), o.onclick(e);
|
|
143
158
|
}),
|
|
144
159
|
e.slideFrom === InAppMessage.SlideFrom.TOP
|
|
145
|
-
? ((
|
|
146
|
-
: ((
|
|
147
|
-
d(
|
|
148
|
-
(
|
|
160
|
+
? ((a = c.We), (s = " ab-swiped-up"))
|
|
161
|
+
: ((a = c.Xe), (s = " ab-swiped-down")),
|
|
162
|
+
d(b, a, e => {
|
|
163
|
+
(b.className += s), o.onclick(e);
|
|
149
164
|
});
|
|
150
165
|
}
|
|
151
|
-
return
|
|
166
|
+
return b;
|
|
152
167
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import InAppMessage from "../models/in-app-message.js";
|
|
2
2
|
import { _handleBrazeAction as m } from "../../Core/handle-braze-action.js";
|
|
3
3
|
import { logInAppMessageButtonClick } from "../log-in-app-message-button-click.js";
|
|
4
|
-
import { toRgba as
|
|
4
|
+
import { toRgba as ne } from "../../util/color-utils.js";
|
|
5
5
|
import { addPassiveEventListener as oe } from "../../util/dom-utils.js";
|
|
6
6
|
import { KeyCodes as at } from "../../util/key-codes.js";
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const me = {
|
|
8
|
+
Qe: t => {
|
|
9
9
|
const o = t.querySelectorAll(
|
|
10
10
|
".ab-close-button, .ab-message-text, .ab-message-button"
|
|
11
11
|
);
|
|
@@ -24,13 +24,13 @@ const ce = {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
-
|
|
27
|
+
Ve: (t, o) => {
|
|
28
28
|
o.setAttribute("role", "dialog"),
|
|
29
29
|
o.setAttribute("aria-modal", !0),
|
|
30
30
|
o.setAttribute("aria-label", "Modal Message"),
|
|
31
31
|
t && o.setAttribute("aria-labelledby", t);
|
|
32
32
|
},
|
|
33
|
-
|
|
33
|
+
Pe: (t, o, e, s) => {
|
|
34
34
|
if (t.buttons.length > 0) {
|
|
35
35
|
const a = document.createElement("div");
|
|
36
36
|
(a.className = "ab-message-buttons"), e.appendChild(a);
|
|
@@ -56,13 +56,13 @@ const ce = {
|
|
|
56
56
|
"" === e.text && (l = " "),
|
|
57
57
|
s.appendChild(document.createTextNode(l)),
|
|
58
58
|
t.sn() ||
|
|
59
|
-
((s.style.backgroundColor =
|
|
60
|
-
(s.style.color =
|
|
61
|
-
(s.style.borderColor =
|
|
59
|
+
((s.style.backgroundColor = ne(e.backgroundColor)),
|
|
60
|
+
(s.style.color = ne(e.textColor)),
|
|
61
|
+
(s.style.borderColor = ne(e.borderColor))),
|
|
62
62
|
(s.onclick = n(e)),
|
|
63
63
|
a.appendChild(s);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
|
-
export default
|
|
68
|
+
export default me;
|
|
@@ -46,7 +46,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
46
46
|
if (
|
|
47
47
|
((null != C && "" !== C && null != D && "" !== D) ||
|
|
48
48
|
((C = void 0), (D = void 0)),
|
|
49
|
-
s === ModalMessage.es || s === InAppMessage.es.
|
|
49
|
+
s === ModalMessage.es || s === InAppMessage.es.Ye)
|
|
50
50
|
)
|
|
51
51
|
B = new ModalMessage(
|
|
52
52
|
o,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import ge from "./in-app-message-manager.js";
|
|
2
2
|
import e from "../managers/braze-instance.js";
|
|
3
3
|
const pe = {
|
|
4
|
-
|
|
4
|
+
Ze: null,
|
|
5
5
|
t: !1,
|
|
6
6
|
m: () => (
|
|
7
|
-
pe.o(), pe.
|
|
7
|
+
pe.o(), pe.Ze || (pe.Ze = new ge(e.nr(), e.g(), e.l(), e.p())), pe.Ze
|
|
8
8
|
),
|
|
9
9
|
o: () => {
|
|
10
10
|
pe.t || (e.u(pe), (pe.t = !0));
|
|
11
11
|
},
|
|
12
12
|
destroy: () => {
|
|
13
|
-
(pe.
|
|
13
|
+
(pe.Ze = null), (pe.t = !1);
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
export default pe;
|
|
@@ -6,16 +6,16 @@ import InAppMessage from "./models/in-app-message.js";
|
|
|
6
6
|
import InAppMessageButton from "./models/in-app-message-button.js";
|
|
7
7
|
import s from "../common/event-logger.js";
|
|
8
8
|
import { newInAppMessageFromJson as lt } from "./in-app-message-factory.js";
|
|
9
|
-
import { randomInclusive as
|
|
9
|
+
import { randomInclusive as tt } from "../util/math.js";
|
|
10
10
|
import t from "../models/request-result.js";
|
|
11
11
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
12
12
|
import u from "../managers/subscription-manager.js";
|
|
13
|
-
import
|
|
13
|
+
import pt from "../triggers/models/trigger.js";
|
|
14
14
|
import { validateValueIsFromEnum as F } from "../util/code-utils.js";
|
|
15
15
|
import { BRAZE_ACTION_URI_REGEX as O } from "../util/validation-utils.js";
|
|
16
16
|
import {
|
|
17
|
-
containsPushPrimerBrazeAction as
|
|
18
|
-
containsUnknownBrazeAction as
|
|
17
|
+
containsPushPrimerBrazeAction as mt,
|
|
18
|
+
containsUnknownBrazeAction as gt,
|
|
19
19
|
getDecodedBrazeAction as J,
|
|
20
20
|
ineligibleBrazeActionURLErrorMessage as ht,
|
|
21
21
|
INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as ft
|
|
@@ -27,27 +27,27 @@ export default class ge {
|
|
|
27
27
|
(this.j = s),
|
|
28
28
|
(this.h = i),
|
|
29
29
|
(this.v = r),
|
|
30
|
-
(this.
|
|
31
|
-
e.jt(this.
|
|
32
|
-
(this.
|
|
33
|
-
(this.
|
|
30
|
+
(this.ni = new u()),
|
|
31
|
+
e.jt(this.ni),
|
|
32
|
+
(this.li = 1e3),
|
|
33
|
+
(this.ui = 6e4);
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
return this.
|
|
35
|
+
pi() {
|
|
36
|
+
return this.ni;
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
return this.
|
|
38
|
+
mi(t) {
|
|
39
|
+
return this.ni.ut(t);
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
return this.
|
|
41
|
+
gi() {
|
|
42
|
+
return this.ci;
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
this.
|
|
44
|
+
fi(t) {
|
|
45
|
+
this.ci = t;
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
di(e, i) {
|
|
48
48
|
if (
|
|
49
49
|
!F(
|
|
50
|
-
InAppMessage.
|
|
50
|
+
InAppMessage.Ge,
|
|
51
51
|
i,
|
|
52
52
|
`${i} is not a valid in-app message display failure`,
|
|
53
53
|
"InAppMessage.DisplayFailures"
|
|
@@ -55,14 +55,14 @@ export default class ge {
|
|
|
55
55
|
)
|
|
56
56
|
return new t();
|
|
57
57
|
const n = { trigger_ids: [e], error_code: i };
|
|
58
|
-
return s.G(r.A.
|
|
58
|
+
return s.G(r.A.vi, n);
|
|
59
59
|
}
|
|
60
60
|
G(e, i, n, o) {
|
|
61
61
|
const a = new t();
|
|
62
62
|
let l;
|
|
63
63
|
if (e instanceof ControlMessage) l = { trigger_ids: [e.triggerId] };
|
|
64
64
|
else {
|
|
65
|
-
if (i === r.A.
|
|
65
|
+
if (i === r.A.yi || (e instanceof HtmlMessage && i === r.A.ji)) {
|
|
66
66
|
if (!e.k(o))
|
|
67
67
|
return (
|
|
68
68
|
r.D.info(
|
|
@@ -70,7 +70,7 @@ export default class ge {
|
|
|
70
70
|
),
|
|
71
71
|
a
|
|
72
72
|
);
|
|
73
|
-
} else if (i === r.A.
|
|
73
|
+
} else if (i === r.A.bi) {
|
|
74
74
|
if (!e.R())
|
|
75
75
|
return (
|
|
76
76
|
r.D.info(
|
|
@@ -79,11 +79,11 @@ export default class ge {
|
|
|
79
79
|
a
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
|
-
l = this.
|
|
82
|
+
l = this.Ii(e);
|
|
83
83
|
}
|
|
84
84
|
return null == l ? a : (null != n && (l.bid = n), s.G(i, l));
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
Ai(e, i) {
|
|
87
87
|
const n = new t();
|
|
88
88
|
if (!e.k())
|
|
89
89
|
return (
|
|
@@ -92,24 +92,24 @@ export default class ge {
|
|
|
92
92
|
),
|
|
93
93
|
n
|
|
94
94
|
);
|
|
95
|
-
const o = this.
|
|
95
|
+
const o = this.Ii(i);
|
|
96
96
|
return null == o
|
|
97
97
|
? n
|
|
98
|
-
: e.id === InAppMessageButton.
|
|
98
|
+
: e.id === InAppMessageButton.Mi
|
|
99
99
|
? (r.D.info(
|
|
100
100
|
"This in-app message button does not have a tracking id. Not logging event to Braze servers."
|
|
101
101
|
),
|
|
102
102
|
n)
|
|
103
|
-
: (null != e.id && (o.bid = e.id), s.G(r.A.
|
|
103
|
+
: (null != e.id && (o.bid = e.id), s.G(r.A.ji, o));
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
zi(t) {
|
|
106
106
|
if (!(t instanceof InAppMessage)) return;
|
|
107
107
|
const s = t => {
|
|
108
108
|
const s = J(t);
|
|
109
|
-
return
|
|
110
|
-
? ht(ft.
|
|
111
|
-
:
|
|
112
|
-
? ht(ft.
|
|
109
|
+
return gt(s)
|
|
110
|
+
? ht(ft.Di, "In-App Message")
|
|
111
|
+
: mt(s) && !dt.Ti()
|
|
112
|
+
? ht(ft._i, "In-App Message")
|
|
113
113
|
: void 0;
|
|
114
114
|
},
|
|
115
115
|
e = t.buttons;
|
|
@@ -125,11 +125,11 @@ export default class ge {
|
|
|
125
125
|
? s(t.uri)
|
|
126
126
|
: void 0;
|
|
127
127
|
}
|
|
128
|
-
|
|
129
|
-
let n = this.vt.
|
|
128
|
+
ki(t, s, e, i) {
|
|
129
|
+
let n = this.vt.wi(!1, !1);
|
|
130
130
|
(n = this.vt.Ps(n)),
|
|
131
131
|
(n.template = { trigger_id: t.triggerId, trigger_event_type: s }),
|
|
132
|
-
null != e && (n.template.data = e.
|
|
132
|
+
null != e && (n.template.data = e.Si());
|
|
133
133
|
const o = this.vt.Bs(n);
|
|
134
134
|
this.vt.Gs(n, () => {
|
|
135
135
|
b.Hs({
|
|
@@ -139,35 +139,35 @@ export default class ge {
|
|
|
139
139
|
S: async s => {
|
|
140
140
|
if (!this.vt.Os(n, s, o))
|
|
141
141
|
return (
|
|
142
|
-
this.
|
|
143
|
-
void ("function" == typeof t.
|
|
142
|
+
this.di(t.triggerId, InAppMessage.Ge.$i),
|
|
143
|
+
void ("function" == typeof t.Bi && t.Bi())
|
|
144
144
|
);
|
|
145
145
|
if ((this.vt.Qs(), null == s || null == s.templated_message))
|
|
146
|
-
return void this.
|
|
146
|
+
return void this.di(t.triggerId, InAppMessage.Ge.$i);
|
|
147
147
|
const e = s.templated_message;
|
|
148
|
-
if (e.type !==
|
|
149
|
-
return void this.
|
|
148
|
+
if (e.type !== pt.Fi.Ei)
|
|
149
|
+
return void this.di(t.triggerId, InAppMessage.Ge.Gi);
|
|
150
150
|
const i = lt(e.data);
|
|
151
|
-
if (null == i) return void this.
|
|
152
|
-
let a = this.
|
|
151
|
+
if (null == i) return void this.di(t.triggerId, InAppMessage.Ge.Gi);
|
|
152
|
+
let a = this.zi(i);
|
|
153
153
|
if (a)
|
|
154
|
-
return r.D.error(a), void ("function" == typeof t.
|
|
155
|
-
"function" == typeof t.
|
|
156
|
-
? t.
|
|
157
|
-
: this.
|
|
154
|
+
return r.D.error(a), void ("function" == typeof t.Bi && t.Bi());
|
|
155
|
+
"function" == typeof t.Ni
|
|
156
|
+
? t.Ni(i)
|
|
157
|
+
: this.di(t.triggerId, InAppMessage.Ge.$i);
|
|
158
158
|
},
|
|
159
159
|
error: r => {
|
|
160
160
|
let n = `getting user personalization for message ${t.triggerId}`;
|
|
161
|
-
if (new Date().valueOf() - t.
|
|
162
|
-
this.
|
|
161
|
+
if (new Date().valueOf() - t.qi > t.xi)
|
|
162
|
+
this.di(t.triggerId, InAppMessage.Ge.$i);
|
|
163
163
|
else {
|
|
164
|
-
const r = Math.min(t
|
|
165
|
-
o = this.
|
|
164
|
+
const r = Math.min(t.xi, this.ui),
|
|
165
|
+
o = this.li;
|
|
166
166
|
null == i && (i = o);
|
|
167
|
-
const a = Math.min(r,
|
|
167
|
+
const a = Math.min(r, tt(o, 3 * i));
|
|
168
168
|
(n += `. Retrying in ${a} ms`),
|
|
169
169
|
setTimeout(() => {
|
|
170
|
-
this.
|
|
170
|
+
this.ki(t, s, e, a);
|
|
171
171
|
}, a);
|
|
172
172
|
}
|
|
173
173
|
this.vt.Vs(r, n);
|
|
@@ -175,7 +175,7 @@ export default class ge {
|
|
|
175
175
|
});
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
|
-
|
|
178
|
+
Ii(t) {
|
|
179
179
|
if (null == t.triggerId)
|
|
180
180
|
return (
|
|
181
181
|
r.D.info(
|
|
@@ -11,9 +11,9 @@ export function logInAppMessageButtonClick(t, o) {
|
|
|
11
11
|
if (!(t instanceof InAppMessageButton))
|
|
12
12
|
return r.D.error("button must be an InAppMessageButton object"), !1;
|
|
13
13
|
if (!(o instanceof InAppMessage)) return r.D.error(or), !1;
|
|
14
|
-
const s = pe.m().
|
|
14
|
+
const s = pe.m().Ai(t, o);
|
|
15
15
|
if (s.S)
|
|
16
16
|
for (let r = 0; r < s.ve.length; r++)
|
|
17
|
-
W.er().je(V.
|
|
17
|
+
W.er().je(V.Br, [o.triggerId, t.id], s.ve[r]);
|
|
18
18
|
return s.S;
|
|
19
19
|
}
|