@braze/web-sdk 4.8.0 → 4.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 +6 -3
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +11 -11
- package/shared-lib/indexed-db-adapter.js +67 -67
- package/shared-lib/logger.js +7 -7
- package/src/Card/card-manager.js +1 -1
- package/src/ContentCards/ui/show-content-cards.js +1 -1
- package/src/Core/disable-sdk.js +5 -4
- package/src/Core/enable-sdk.js +1 -1
- package/src/Core/is-disabled.js +1 -1
- package/src/FeatureFlags/feature-flags-provider.js +12 -12
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/in-app-message-manager.js +40 -34
- 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 +1 -1
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +13 -13
- package/src/InAppMessage/models/slide-up-message.js +2 -2
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/ui/show-in-app-message.js +2 -2
- package/src/Push/push-manager.js +82 -81
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +5 -5
- package/src/common/feed-display.js +82 -72
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/managers/auth-manager.js +18 -15
- package/src/managers/braze-instance.js +125 -109
- package/src/managers/device-manager.js +40 -35
- package/src/managers/network-manager.js +90 -81
- package/src/managers/server-config-manager.js +36 -34
- package/src/managers/session-manager.js +44 -37
- package/src/managers/storage-manager-factory.js +23 -16
- package/src/managers/storage-manager.js +251 -239
- package/src/managers/subscription-manager.js +10 -7
- package/src/managers/types.js +1 -0
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +10 -4
- package/src/models/device.js +10 -18
- package/src/models/identifier.js +10 -11
- package/src/models/push-token.js +14 -9
- package/src/models/request-result.js +2 -2
- package/src/models/server-config.js +32 -16
- package/src/models/types.js +1 -0
- package/src/request-controller.js +109 -109
- package/src/triggers/models/custom-event-data.js +6 -6
- package/src/triggers/models/custom-event-property-data.js +9 -9
- package/src/triggers/models/filter-set.js +9 -9
- package/src/triggers/models/filter.js +60 -60
- package/src/triggers/models/in-app-message-click-data.js +9 -9
- package/src/triggers/models/purchase-data.js +3 -3
- package/src/triggers/models/purchase-property-data.js +7 -7
- package/src/triggers/models/push-click-data.js +6 -6
- package/src/triggers/models/trigger-condition.js +46 -46
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +27 -27
- package/src/triggers/triggers-provider.js +126 -126
- package/src/ui/js/attach-css.js +1 -1
- package/src/util/base-device-parser.js +2 -2
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +18 -18
- package/src/util/client-hints-parser.js +6 -6
- package/src/util/device-constants.js +6 -6
- package/src/util/dom-utils.js +5 -5
- package/src/util/error-utils.js +2 -0
- package/src/util/net.js +1 -1
- package/src/util/request-header-utils.js +9 -9
- package/src/util/user-agent-parser.js +21 -21
- package/src/util/window-utils.js +1 -1
|
@@ -86,11 +86,11 @@ export default class aa {
|
|
|
86
86
|
a
|
|
87
87
|
);
|
|
88
88
|
}
|
|
89
|
-
l = this.
|
|
89
|
+
l = this.Pi(e);
|
|
90
90
|
}
|
|
91
91
|
return null == l ? a : (null != n && (l.bid = n), s.N(i, l));
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
Gi(e, i) {
|
|
94
94
|
const n = new t();
|
|
95
95
|
if (!e.p())
|
|
96
96
|
return (
|
|
@@ -99,10 +99,10 @@ export default class aa {
|
|
|
99
99
|
),
|
|
100
100
|
n
|
|
101
101
|
);
|
|
102
|
-
const o = this.
|
|
102
|
+
const o = this.Pi(i);
|
|
103
103
|
return null == o
|
|
104
104
|
? n
|
|
105
|
-
: e.id === InAppMessageButton.
|
|
105
|
+
: e.id === InAppMessageButton.Oi
|
|
106
106
|
? (r.j.info(
|
|
107
107
|
"This in-app message button does not have a tracking id. Not logging event to Braze servers."
|
|
108
108
|
),
|
|
@@ -110,17 +110,23 @@ export default class aa {
|
|
|
110
110
|
: (null != e.id && (o.bid = e.id), s.N(r.q.Mi, o));
|
|
111
111
|
}
|
|
112
112
|
Hi(t) {
|
|
113
|
+
const s = t.messageFields;
|
|
114
|
+
return (null != s && s.is_push_primer) || !1;
|
|
115
|
+
}
|
|
116
|
+
Ji(t) {
|
|
113
117
|
if (!(t instanceof InAppMessage)) return;
|
|
114
118
|
const s = t => {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
if (!t) return;
|
|
120
|
+
const s = Q(t);
|
|
121
|
+
return ft(s)
|
|
122
|
+
? dt(vt.Ki, "In-App Message")
|
|
123
|
+
: gt(s) && !yt.Li()
|
|
124
|
+
? dt(vt.Qi, "In-App Message")
|
|
125
|
+
: void 0;
|
|
126
|
+
};
|
|
127
|
+
if (this.Hi(t) && !yt.Li())
|
|
128
|
+
return "In-App Message contains a push prompt, but is not eligible for a push prompt. Ignoring.";
|
|
129
|
+
const e = t.buttons || [];
|
|
124
130
|
let i;
|
|
125
131
|
for (const t of e)
|
|
126
132
|
if (
|
|
@@ -136,16 +142,16 @@ export default class aa {
|
|
|
136
142
|
? s(t.uri)
|
|
137
143
|
: void 0;
|
|
138
144
|
}
|
|
139
|
-
|
|
145
|
+
Vi(t, s, e, i) {
|
|
140
146
|
if (!this.gt) return;
|
|
141
|
-
const n = this.gt.
|
|
147
|
+
const n = this.gt.Wi(!1, !1),
|
|
142
148
|
o = this.gt.Gs(n);
|
|
143
149
|
(o.template = { trigger_id: t.triggerId, trigger_event_type: s }),
|
|
144
|
-
null != e && (o.template.data = e.
|
|
145
|
-
const a = this.gt.Ks(o, T.Qs.
|
|
150
|
+
null != e && (o.template.data = e.Xi());
|
|
151
|
+
const a = this.gt.Ks(o, T.Qs.Yi);
|
|
146
152
|
this.gt.Vs(o, () => {
|
|
147
153
|
this.gt &&
|
|
148
|
-
(T.Xs(this.u, T.Qs.
|
|
154
|
+
(T.Xs(this.u, T.Qs.Yi, new Date().valueOf()),
|
|
149
155
|
C.Ys({
|
|
150
156
|
url: `${this.gt.Zs()}/template/`,
|
|
151
157
|
data: o,
|
|
@@ -153,35 +159,35 @@ export default class aa {
|
|
|
153
159
|
O: s => {
|
|
154
160
|
if (!this.gt.ti(o, s, a))
|
|
155
161
|
return (
|
|
156
|
-
this.Ye(t.triggerId, InAppMessage.Me.
|
|
157
|
-
void ("function" == typeof t.
|
|
162
|
+
this.Ye(t.triggerId, InAppMessage.Me.Zi),
|
|
163
|
+
void ("function" == typeof t.Mr && t.Mr())
|
|
158
164
|
);
|
|
159
165
|
if ((this.gt.si(), null == s || null == s.templated_message))
|
|
160
|
-
return void this.Ye(t.triggerId, InAppMessage.Me.
|
|
166
|
+
return void this.Ye(t.triggerId, InAppMessage.Me.Zi);
|
|
161
167
|
const e = s.templated_message;
|
|
162
|
-
if (e.type !== mt._r
|
|
163
|
-
return void this.Ye(t.triggerId, InAppMessage.Me.
|
|
168
|
+
if (e.type !== mt.Gr._r)
|
|
169
|
+
return void this.Ye(t.triggerId, InAppMessage.Me.Or);
|
|
164
170
|
const i = pt(e.data);
|
|
165
|
-
if (null == i) return void this.Ye(t.triggerId, InAppMessage.Me.
|
|
166
|
-
const n = this.
|
|
171
|
+
if (null == i) return void this.Ye(t.triggerId, InAppMessage.Me.Or);
|
|
172
|
+
const n = this.Ji(i);
|
|
167
173
|
if (n)
|
|
168
|
-
return r.j.error(n), void ("function" == typeof t.
|
|
169
|
-
"function" == typeof t.
|
|
170
|
-
? t.
|
|
171
|
-
: this.Ye(t.triggerId, InAppMessage.Me.
|
|
174
|
+
return r.j.error(n), void ("function" == typeof t.Mr && t.Mr());
|
|
175
|
+
"function" == typeof t.Hr
|
|
176
|
+
? t.Hr(i)
|
|
177
|
+
: this.Ye(t.triggerId, InAppMessage.Me.Zi);
|
|
172
178
|
},
|
|
173
179
|
error: r => {
|
|
174
180
|
let n = `getting user personalization for message ${t.triggerId}`;
|
|
175
|
-
if (new Date().valueOf() - t.
|
|
176
|
-
this.Ye(t.triggerId, InAppMessage.Me.
|
|
181
|
+
if (new Date().valueOf() - t.Jr > t.Kr)
|
|
182
|
+
this.Ye(t.triggerId, InAppMessage.Me.Zi);
|
|
177
183
|
else {
|
|
178
|
-
const r = Math.min(t.
|
|
184
|
+
const r = Math.min(t.Kr, this.Re),
|
|
179
185
|
o = this.Oe;
|
|
180
186
|
null == i && (i = o);
|
|
181
187
|
const a = Math.min(r, D(o, 3 * i));
|
|
182
188
|
(n += `. Retrying in ${a} ms`),
|
|
183
189
|
setTimeout(() => {
|
|
184
|
-
this.
|
|
190
|
+
this.Vi(t, s, e, a);
|
|
185
191
|
}, a);
|
|
186
192
|
}
|
|
187
193
|
this.gt.ii(r, n);
|
|
@@ -189,7 +195,7 @@ export default class aa {
|
|
|
189
195
|
}));
|
|
190
196
|
});
|
|
191
197
|
}
|
|
192
|
-
|
|
198
|
+
Pi(t) {
|
|
193
199
|
if (null == t.triggerId)
|
|
194
200
|
return (
|
|
195
201
|
r.j.info(
|
|
@@ -11,9 +11,9 @@ export function logInAppMessageButtonClick(t, o) {
|
|
|
11
11
|
if (!(t instanceof InAppMessageButton))
|
|
12
12
|
return r.j.error("button must be an InAppMessageButton object"), !1;
|
|
13
13
|
if (!(o instanceof InAppMessage)) return r.j.error(or), !1;
|
|
14
|
-
const s = ea.m().
|
|
14
|
+
const s = ea.m().Gi(t, o);
|
|
15
15
|
if (s.O)
|
|
16
16
|
for (let r = 0; r < s.ve.length; r++)
|
|
17
|
-
et.er().je(tt.
|
|
17
|
+
et.er().je(tt.Lr, [o.triggerId, t.id], s.ve[r]);
|
|
18
18
|
return s.O;
|
|
19
19
|
}
|
|
@@ -11,9 +11,9 @@ export function logInAppMessageClick(o) {
|
|
|
11
11
|
if (!(o instanceof InAppMessage)) return r.j.error(or), !1;
|
|
12
12
|
const s = ea.m().N(o, r.q.Ii);
|
|
13
13
|
if (s) {
|
|
14
|
-
o.
|
|
14
|
+
o.Qr() || logInAppMessageImpression(o);
|
|
15
15
|
for (let r = 0; r < s.ve.length; r++)
|
|
16
|
-
et.er().je(tt.
|
|
16
|
+
et.er().je(tt.Lr, [o.triggerId], s.ve[r]);
|
|
17
17
|
}
|
|
18
18
|
return s.O;
|
|
19
19
|
}
|
|
@@ -10,12 +10,12 @@ export default class InAppMessageButton {
|
|
|
10
10
|
(this.uri = e),
|
|
11
11
|
(this.id = n),
|
|
12
12
|
(this.text = s || ""),
|
|
13
|
-
(this.backgroundColor = t || InAppMessage.Ur
|
|
14
|
-
(this.textColor = i || InAppMessage.
|
|
13
|
+
(this.backgroundColor = t || InAppMessage.Vr.Ur),
|
|
14
|
+
(this.textColor = i || InAppMessage.Vr.Wr),
|
|
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.Oi),
|
|
19
19
|
(this.id = n),
|
|
20
20
|
(this.vo = !1),
|
|
21
21
|
(this.ht = new E());
|
|
@@ -44,4 +44,4 @@ export default class InAppMessageButton {
|
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
InAppMessageButton.
|
|
47
|
+
InAppMessageButton.Oi = -1;
|
|
@@ -81,19 +81,19 @@ export default class InAppMessage {
|
|
|
81
81
|
(this.icon = T),
|
|
82
82
|
(this.imageUrl = a),
|
|
83
83
|
(this.imageStyle = m || InAppMessage.ImageStyle.TOP),
|
|
84
|
-
(this.iconColor = c || InAppMessage.
|
|
85
|
-
(this.iconBackgroundColor = I || InAppMessage.Ur
|
|
86
|
-
(this.backgroundColor = L || InAppMessage.
|
|
87
|
-
(this.textColor = A || InAppMessage.
|
|
88
|
-
(this.closeButtonColor = N || InAppMessage.
|
|
84
|
+
(this.iconColor = c || InAppMessage.Vr.Wr),
|
|
85
|
+
(this.iconBackgroundColor = I || InAppMessage.Vr.Ur),
|
|
86
|
+
(this.backgroundColor = L || InAppMessage.Vr.Wr),
|
|
87
|
+
(this.textColor = A || InAppMessage.Vr.th),
|
|
88
|
+
(this.closeButtonColor = N || InAppMessage.Vr.sh),
|
|
89
89
|
(this.animateIn = d),
|
|
90
90
|
null == this.animateIn && (this.animateIn = !0),
|
|
91
91
|
(this.animateOut = _),
|
|
92
92
|
null == this.animateOut && (this.animateOut = !0),
|
|
93
93
|
(this.header = O),
|
|
94
94
|
(this.headerAlignment = S || InAppMessage.TextAlignment.CENTER),
|
|
95
|
-
(this.headerTextColor = D || InAppMessage.
|
|
96
|
-
(this.frameColor = M || InAppMessage.
|
|
95
|
+
(this.headerTextColor = D || InAppMessage.Vr.th),
|
|
96
|
+
(this.frameColor = M || InAppMessage.Vr.ih),
|
|
97
97
|
(this.buttons = R || []),
|
|
98
98
|
(this.cropType = b || InAppMessage.CropType.FIT_CENTER),
|
|
99
99
|
(this.orientation = p),
|
|
@@ -143,7 +143,7 @@ export default class InAppMessage {
|
|
|
143
143
|
M() {
|
|
144
144
|
return !this.eh && ((this.eh = !0), !0);
|
|
145
145
|
}
|
|
146
|
-
|
|
146
|
+
Qr() {
|
|
147
147
|
return this.eh;
|
|
148
148
|
}
|
|
149
149
|
p(t) {
|
|
@@ -257,10 +257,10 @@ export default class InAppMessage {
|
|
|
257
257
|
(this.hh = !0));
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
(InAppMessage.
|
|
260
|
+
(InAppMessage.Vr = {
|
|
261
261
|
th: 4281545523,
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
Wr: 4294967295,
|
|
263
|
+
Ur: 4278219733,
|
|
264
264
|
dh: 4293914607,
|
|
265
265
|
_h: 4283782485,
|
|
266
266
|
ih: 3224580915,
|
|
@@ -271,8 +271,8 @@ export default class InAppMessage {
|
|
|
271
271
|
ze: "ias",
|
|
272
272
|
Sh: "of",
|
|
273
273
|
Dh: "do",
|
|
274
|
-
|
|
275
|
-
|
|
274
|
+
Or: "umt",
|
|
275
|
+
Zi: "tf",
|
|
276
276
|
Mh: "te"
|
|
277
277
|
}),
|
|
278
278
|
(InAppMessage.SlideFrom = { TOP: "TOP", BOTTOM: "BOTTOM" }),
|
|
@@ -2,8 +2,8 @@ import InAppMessage from "./in-app-message.js";
|
|
|
2
2
|
import { DOMUtils as so } from "../../util/dom-utils.js";
|
|
3
3
|
export default class SlideUpMessage extends InAppMessage {
|
|
4
4
|
constructor(o, s, t, e, i, d, n, r, a, p, u, m, c, v, l, x, h, f, g, I, M) {
|
|
5
|
-
(x = x || InAppMessage.
|
|
6
|
-
(l = l || InAppMessage.
|
|
5
|
+
(x = x || InAppMessage.Vr._h),
|
|
6
|
+
(l = l || InAppMessage.Vr.dh),
|
|
7
7
|
super(
|
|
8
8
|
o,
|
|
9
9
|
(s = s || InAppMessage.TextAlignment.START),
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export default class wt {
|
|
2
2
|
constructor(t, s, i, h, l) {
|
|
3
3
|
(this.triggerId = t),
|
|
4
|
-
(this.
|
|
5
|
-
(this.
|
|
6
|
-
(this.
|
|
7
|
-
(this.
|
|
4
|
+
(this.Hr = s),
|
|
5
|
+
(this.Mr = i),
|
|
6
|
+
(this.Jr = h),
|
|
7
|
+
(this.Kr = l),
|
|
8
8
|
(this.triggerId = t),
|
|
9
|
-
(this.
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
12
|
-
(this.
|
|
9
|
+
(this.Hr = s),
|
|
10
|
+
(this.Mr = i),
|
|
11
|
+
(this.Jr = h),
|
|
12
|
+
(this.Kr = l);
|
|
13
13
|
}
|
|
14
14
|
static fromJson(t, s, i, h, l) {
|
|
15
15
|
return null == t || null == t.trigger_id
|
|
@@ -98,7 +98,7 @@ export function showInAppMessage(s, t, o) {
|
|
|
98
98
|
(a.className += se(s)),
|
|
99
99
|
a.setAttribute("role", "complementary"),
|
|
100
100
|
s.$e() && (a.id = s.htmlId),
|
|
101
|
-
e.nn(L.mo) && (a.style.zIndex = e.nn(L.mo) + 1),
|
|
101
|
+
e.nn(L.mo) && (a.style.zIndex = (e.nn(L.mo) + 1).toString()),
|
|
102
102
|
t.appendChild(a),
|
|
103
103
|
s.ye())
|
|
104
104
|
) {
|
|
@@ -122,7 +122,7 @@ export function showInAppMessage(s, t, o) {
|
|
|
122
122
|
if (
|
|
123
123
|
((o.className = "ab-page-blocker"),
|
|
124
124
|
s.ye() || (o.style.backgroundColor = me(s.frameColor)),
|
|
125
|
-
e.nn(L.mo) && (o.style.zIndex = e.nn(L.mo)),
|
|
125
|
+
e.nn(L.mo) && (o.style.zIndex = e.nn(L.mo).toString()),
|
|
126
126
|
a.appendChild(o),
|
|
127
127
|
!e.nn(L.Lh))
|
|
128
128
|
) {
|