@braze/web-sdk 4.4.0 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +15 -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 +7 -7
- package/shared-lib/indexed-db-adapter.js +1 -1
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +13 -13
- package/src/Card/models/card.js +1 -0
- package/src/Card/models/control-card.js +3 -2
- package/src/InAppMessage/log-in-app-message-click.js +4 -1
- package/src/InAppMessage/models/control-message.js +1 -1
- package/src/InAppMessage/models/in-app-message.js +8 -4
- package/src/Push/push-manager.js +54 -54
- package/src/Push/utils/push-utils.js +3 -3
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +8 -8
- package/src/managers/auth-manager.js +4 -4
- package/src/managers/braze-instance.js +81 -81
- package/src/managers/device-manager.js +7 -7
- package/src/managers/network-manager.js +39 -39
- package/src/managers/server-config-manager.js +4 -4
- package/src/managers/session-manager.js +1 -1
- package/src/managers/storage-manager-factory.js +1 -1
- package/src/managers/storage-manager.js +40 -40
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +1 -1
- package/src/models/identifier.js +1 -1
- package/src/models/push-token.js +3 -3
- package/src/models/server-config.js +3 -3
- package/src/request-controller.js +64 -64
- package/src/triggers/models/custom-event-data.js +1 -1
- package/src/triggers/models/custom-event-property-data.js +5 -5
- package/src/triggers/models/filter-set.js +4 -4
- package/src/triggers/models/filter.js +57 -57
- 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 +5 -5
- package/src/triggers/models/push-click-data.js +1 -1
- package/src/triggers/models/trigger-condition.js +4 -4
- package/src/triggers/models/trigger.js +16 -16
- package/src/triggers/triggers-provider-factory.js +1 -1
- package/src/triggers/triggers-provider.js +14 -14
- 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/browser-detector.js +5 -5
- package/src/util/client-hints-parser.js +1 -1
- package/src/util/net.js +3 -3
- package/src/util/user-agent-parser.js +1 -1
- package/src/util/window-utils.js +1 -1
|
@@ -30,16 +30,16 @@ export default class St {
|
|
|
30
30
|
subscribeToSdkAuthenticationFailures(t) {
|
|
31
31
|
return this.zn.ut(t);
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
Vn(t) {
|
|
34
34
|
this.zn.St(t);
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
Wn() {
|
|
37
37
|
this.qn.removeAllSubscriptions();
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
Xn() {
|
|
40
40
|
this.Gn += 1;
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
Yn() {
|
|
43
43
|
return this.Gn;
|
|
44
44
|
}
|
|
45
45
|
Qs() {
|
|
@@ -24,66 +24,66 @@ import { User } from "../User/index.js";
|
|
|
24
24
|
import { parseQueryStringKeyValues as it } from "../util/url-utils.js";
|
|
25
25
|
import { WindowUtils as H } from "../util/window-utils.js";
|
|
26
26
|
const T = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
Zn: "allowCrawlerActivity",
|
|
28
|
+
ho: "baseUrl",
|
|
29
|
+
po: "noCookies",
|
|
30
|
+
Eo: "devicePropertyAllowlist",
|
|
31
31
|
ta: "disablePushTokenMaintenance",
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
_o: "enableLogging",
|
|
33
|
+
Io: "enableSdkAuthentication",
|
|
34
34
|
ia: "manageServiceWorkerExternally",
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
Ao: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
36
|
+
So: "sessionTimeoutInSeconds",
|
|
37
|
+
No: "appVersion",
|
|
38
38
|
na: "serviceWorkerLocation",
|
|
39
39
|
ra: "safariWebsitePushId",
|
|
40
40
|
jn: "localization",
|
|
41
41
|
ao: "contentSecurityNonce",
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
wo: "enableHtmlInAppMessages",
|
|
43
|
+
To: "allowUserSuppliedJavascript",
|
|
44
44
|
no: "inAppMessageZIndex",
|
|
45
45
|
lo: "openInAppMessagesInNewTab",
|
|
46
46
|
tn: "openCardsInNewTab",
|
|
47
47
|
en: "openNewsFeedCardsInNewTab",
|
|
48
48
|
qi: "requireExplicitInAppMessageDismissal",
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
Oo: "doNotLoadFontAwesome",
|
|
50
|
+
vo: "sdkFlavor"
|
|
51
51
|
};
|
|
52
52
|
class jt {
|
|
53
53
|
constructor() {
|
|
54
|
-
(this.
|
|
55
|
-
(this.
|
|
56
|
-
(this.Lo = new u()),
|
|
54
|
+
(this.Co = !1),
|
|
55
|
+
(this.Lo = !1),
|
|
57
56
|
(this.Po = new u()),
|
|
58
|
-
(this.Ro =
|
|
59
|
-
(this.Mo =
|
|
57
|
+
(this.Ro = new u()),
|
|
58
|
+
(this.Mo = {}),
|
|
60
59
|
(this.jo = []),
|
|
60
|
+
(this.yo = []),
|
|
61
61
|
(this.Pe = []),
|
|
62
|
-
(this.
|
|
62
|
+
(this.Do = "4.5.0");
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
this.
|
|
64
|
+
Uo(t) {
|
|
65
|
+
this.Po.ut(t);
|
|
66
66
|
}
|
|
67
67
|
Zi(t) {
|
|
68
|
-
this.
|
|
68
|
+
this.Ro.ut(t);
|
|
69
69
|
}
|
|
70
70
|
initialize(t, i) {
|
|
71
|
-
if (this.
|
|
71
|
+
if (this.zo())
|
|
72
72
|
return (
|
|
73
73
|
r.D.info("Braze has already been initialized with an API key."), !0
|
|
74
74
|
);
|
|
75
|
-
this.
|
|
76
|
-
let s = this.nn(T.
|
|
77
|
-
const e = it(H.
|
|
75
|
+
this.Mo = i || {};
|
|
76
|
+
let s = this.nn(T._o);
|
|
77
|
+
const e = it(H.gn());
|
|
78
78
|
if (
|
|
79
79
|
(e && "true" === e.brazeLogging && (s = !0),
|
|
80
80
|
r.D.init(s),
|
|
81
|
-
r.D.info(`Initialization Options: ${JSON.stringify(this.
|
|
81
|
+
r.D.info(`Initialization Options: ${JSON.stringify(this.Mo, null, 2)}`),
|
|
82
82
|
null == t || "" === t || "string" != typeof t)
|
|
83
83
|
)
|
|
84
84
|
return r.D.error("Braze requires a valid API key to be initialized."), !1;
|
|
85
85
|
this._r = t;
|
|
86
|
-
let n = this.nn(T.
|
|
86
|
+
let n = this.nn(T.ho);
|
|
87
87
|
if (null == n || "" === n || "string" != typeof n)
|
|
88
88
|
return r.D.error("Braze requires a valid baseUrl to be initialized."), !1;
|
|
89
89
|
!1 === /^https?:/.test(n) && (n = `https://${n}`);
|
|
@@ -92,32 +92,32 @@ class jt {
|
|
|
92
92
|
((n = document.createElement("a")),
|
|
93
93
|
(n.href = a),
|
|
94
94
|
"/" === n.pathname && (n = `${n}api/v3`),
|
|
95
|
-
(this.
|
|
96
|
-
ot.
|
|
95
|
+
(this.Bo = n.toString()),
|
|
96
|
+
ot.Wo && !this.nn(T.Zn))
|
|
97
97
|
)
|
|
98
98
|
return (
|
|
99
99
|
r.D.info("Ignoring activity from crawler bot " + navigator.userAgent),
|
|
100
|
-
(this.
|
|
100
|
+
(this.Lo = !0),
|
|
101
101
|
!1
|
|
102
102
|
);
|
|
103
|
-
const h = this.nn(jt.
|
|
104
|
-
if (((this.h = Mt.
|
|
103
|
+
const h = this.nn(jt.po) || !1;
|
|
104
|
+
if (((this.h = Mt.Fo(t, h)), new G.ne(null, !0).lr(o.ae)))
|
|
105
105
|
return (
|
|
106
106
|
r.D.info("Ignoring all activity due to previous opt out"),
|
|
107
|
-
(this.
|
|
107
|
+
(this.Lo = !0),
|
|
108
108
|
!1
|
|
109
109
|
);
|
|
110
|
-
for (const t of rr(this.
|
|
111
|
-
-1 === At(r.
|
|
110
|
+
for (const t of rr(this.Mo))
|
|
111
|
+
-1 === At(r.Vo).indexOf(t) &&
|
|
112
112
|
r.D.warn(`Ignoring unknown initialization option '${t}'.`);
|
|
113
113
|
const l = ["mparticle", "wordpress", "tealium"];
|
|
114
|
-
if (null != this.nn(T.
|
|
115
|
-
const t = this.nn(T.
|
|
114
|
+
if (null != this.nn(T.vo)) {
|
|
115
|
+
const t = this.nn(T.vo);
|
|
116
116
|
-1 !== l.indexOf(t)
|
|
117
|
-
? (this.
|
|
117
|
+
? (this.Go = t)
|
|
118
118
|
: r.D.error("Invalid sdk flavor passed: " + t);
|
|
119
119
|
}
|
|
120
|
-
let f = this.nn(r.
|
|
120
|
+
let f = this.nn(r.Vo.Eo);
|
|
121
121
|
if (null != f)
|
|
122
122
|
if (p(f)) {
|
|
123
123
|
const t = [];
|
|
@@ -137,45 +137,45 @@ class jt {
|
|
|
137
137
|
(this.Ur = new It(this.h, f)),
|
|
138
138
|
(this.gt = new Pt(this.h)),
|
|
139
139
|
(this.v = new bt(this.gt, this.h)),
|
|
140
|
-
(this.j = new Rt(this.h, this.v, this.gt, this.nn(T.
|
|
140
|
+
(this.j = new Rt(this.h, this.v, this.gt, this.nn(T.So)));
|
|
141
141
|
const m = new u();
|
|
142
142
|
return (
|
|
143
|
-
(this.
|
|
143
|
+
(this.Ko = new St(this.h, this.nn(T.Io), m)),
|
|
144
144
|
this.jt(m),
|
|
145
145
|
(this.vt = new Ot(
|
|
146
146
|
this.Ur,
|
|
147
147
|
this.h,
|
|
148
|
-
this.
|
|
148
|
+
this.Ko,
|
|
149
149
|
this.v,
|
|
150
150
|
this.j,
|
|
151
151
|
this.gt,
|
|
152
152
|
this._r,
|
|
153
|
-
this.
|
|
154
|
-
this.
|
|
155
|
-
this.
|
|
156
|
-
this.nn(T.
|
|
153
|
+
this.Bo,
|
|
154
|
+
this.Do,
|
|
155
|
+
this.Go,
|
|
156
|
+
this.nn(T.No)
|
|
157
157
|
)),
|
|
158
158
|
(this.si = new Lt(
|
|
159
159
|
this._r,
|
|
160
|
-
this.
|
|
160
|
+
this.Bo,
|
|
161
161
|
this.j,
|
|
162
162
|
this.Ur,
|
|
163
163
|
this.v,
|
|
164
164
|
this.gt,
|
|
165
165
|
this.h,
|
|
166
166
|
t => {
|
|
167
|
-
if (this.
|
|
167
|
+
if (this.zo()) for (const i of this.re()) i.Rs(t);
|
|
168
168
|
},
|
|
169
|
-
this.
|
|
169
|
+
this.Ko,
|
|
170
170
|
this.vt
|
|
171
171
|
)),
|
|
172
172
|
this.si.initialize(),
|
|
173
173
|
r.D.info(
|
|
174
174
|
`Initialized for the Braze backend at "${this.nn(
|
|
175
|
-
T.
|
|
175
|
+
T.ho
|
|
176
176
|
)}" with API key "${this._r}".`
|
|
177
177
|
),
|
|
178
|
-
null != this.nn(T.
|
|
178
|
+
null != this.nn(T.wo) &&
|
|
179
179
|
D(
|
|
180
180
|
"enableHtmlInAppMessages",
|
|
181
181
|
"initialization option",
|
|
@@ -194,38 +194,38 @@ class jt {
|
|
|
194
194
|
(0, t.default)(null, null, !0);
|
|
195
195
|
});
|
|
196
196
|
}),
|
|
197
|
-
this.
|
|
198
|
-
(this.
|
|
197
|
+
this.Po.St(this.Mo),
|
|
198
|
+
(this.Co = !0),
|
|
199
199
|
!0
|
|
200
200
|
);
|
|
201
201
|
}
|
|
202
202
|
destroy(t) {
|
|
203
|
-
if ((r.D.destroy(), this.
|
|
204
|
-
this.
|
|
205
|
-
for (const t of this.
|
|
206
|
-
this.
|
|
207
|
-
for (const t of this.
|
|
208
|
-
(this.
|
|
203
|
+
if ((r.D.destroy(), this.zo())) {
|
|
204
|
+
this.Ro.St(), this.Ro.removeAllSubscriptions();
|
|
205
|
+
for (const t of this.jo) t.destroy();
|
|
206
|
+
this.jo = [];
|
|
207
|
+
for (const t of this.yo) t.clearData(!1);
|
|
208
|
+
(this.yo = []),
|
|
209
209
|
this.removeAllSubscriptions(),
|
|
210
210
|
(this.Pe = []),
|
|
211
211
|
this.si.destroy(),
|
|
212
212
|
(this.si = null),
|
|
213
|
-
(this.
|
|
213
|
+
(this.Ko = null),
|
|
214
214
|
(this.Ur = null),
|
|
215
215
|
(this.vt = null),
|
|
216
216
|
(this.gt = null),
|
|
217
217
|
(this.j = null),
|
|
218
218
|
(this.v = null),
|
|
219
|
-
(this.
|
|
220
|
-
(this.
|
|
221
|
-
(this.vo = !1),
|
|
219
|
+
(this.Mo = {}),
|
|
220
|
+
(this.Go = void 0),
|
|
222
221
|
(this.Co = !1),
|
|
222
|
+
(this.Lo = !1),
|
|
223
223
|
t && (this.h = null);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
rr() {
|
|
227
|
-
if (this.
|
|
228
|
-
if (!this.
|
|
227
|
+
if (this.Ho()) return !1;
|
|
228
|
+
if (!this.zo())
|
|
229
229
|
throw new Error("Braze must be initialized before calling methods.");
|
|
230
230
|
return !0;
|
|
231
231
|
}
|
|
@@ -233,10 +233,10 @@ class jt {
|
|
|
233
233
|
return this._r;
|
|
234
234
|
}
|
|
235
235
|
ii() {
|
|
236
|
-
return this.
|
|
236
|
+
return this.Ko;
|
|
237
237
|
}
|
|
238
238
|
Ks() {
|
|
239
|
-
return this.
|
|
239
|
+
return this.Bo;
|
|
240
240
|
}
|
|
241
241
|
ce() {
|
|
242
242
|
return this.Ur;
|
|
@@ -245,10 +245,10 @@ class jt {
|
|
|
245
245
|
return this.vt;
|
|
246
246
|
}
|
|
247
247
|
nn(t) {
|
|
248
|
-
return this.
|
|
248
|
+
return this.Mo[t];
|
|
249
249
|
}
|
|
250
250
|
re() {
|
|
251
|
-
return this.
|
|
251
|
+
return this.yo;
|
|
252
252
|
}
|
|
253
253
|
mr() {
|
|
254
254
|
return this.si;
|
|
@@ -269,17 +269,17 @@ class jt {
|
|
|
269
269
|
return this.v;
|
|
270
270
|
}
|
|
271
271
|
tr() {
|
|
272
|
-
return !0 === this.nn(T.
|
|
272
|
+
return !0 === this.nn(T.To) || !0 === this.nn(T.wo);
|
|
273
273
|
}
|
|
274
274
|
u(t) {
|
|
275
275
|
let i = !1;
|
|
276
|
-
for (const s of this.
|
|
277
|
-
i || this.
|
|
276
|
+
for (const s of this.jo) s === t && (i = !0);
|
|
277
|
+
i || this.jo.push(t);
|
|
278
278
|
}
|
|
279
279
|
ar(t) {
|
|
280
280
|
let i = !1;
|
|
281
|
-
for (const s of this.
|
|
282
|
-
t instanceof y && !i && this.
|
|
281
|
+
for (const s of this.yo) s.constructor === t.constructor && (i = !0);
|
|
282
|
+
t instanceof y && !i && this.yo.push(t);
|
|
283
283
|
}
|
|
284
284
|
jt(t) {
|
|
285
285
|
t instanceof u && this.Pe.push(t);
|
|
@@ -291,16 +291,16 @@ class jt {
|
|
|
291
291
|
if (this.rr()) for (const i of this.Pe) i.removeSubscription(t);
|
|
292
292
|
}
|
|
293
293
|
le(t) {
|
|
294
|
-
this.
|
|
295
|
-
}
|
|
296
|
-
Uo() {
|
|
297
|
-
return this.vo;
|
|
294
|
+
this.Lo = t;
|
|
298
295
|
}
|
|
299
|
-
|
|
296
|
+
zo() {
|
|
300
297
|
return this.Co;
|
|
301
298
|
}
|
|
299
|
+
Ho() {
|
|
300
|
+
return this.Lo;
|
|
301
|
+
}
|
|
302
302
|
Ds() {
|
|
303
|
-
return this.
|
|
303
|
+
return this.Do;
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
306
|
const e = new jt();
|
|
@@ -32,7 +32,7 @@ export default class It {
|
|
|
32
32
|
t[r] = ot.language;
|
|
33
33
|
break;
|
|
34
34
|
case DeviceProperties.TIME_ZONE:
|
|
35
|
-
t[r] = this.
|
|
35
|
+
t[r] = this.Qo(new Date());
|
|
36
36
|
break;
|
|
37
37
|
case DeviceProperties.USER_AGENT:
|
|
38
38
|
t[r] = ot.userAgent;
|
|
@@ -41,11 +41,11 @@ export default class It {
|
|
|
41
41
|
return t;
|
|
42
42
|
}
|
|
43
43
|
qo() {
|
|
44
|
-
if (ot.
|
|
45
|
-
const e = this.h.I(o.q.
|
|
46
|
-
return e && e.os_version ? e.os_version : ot.
|
|
44
|
+
if (ot.Xo()) return ot.Xo();
|
|
45
|
+
const e = this.h.I(o.q.Yo);
|
|
46
|
+
return e && e.os_version ? e.os_version : ot.Zo();
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
Qo(e) {
|
|
49
49
|
if ("undefined" != typeof Intl && "function" == typeof Intl.DateTimeFormat)
|
|
50
50
|
try {
|
|
51
51
|
if ("function" == typeof Intl.DateTimeFormat().resolvedOptions) {
|
|
@@ -61,9 +61,9 @@ export default class It {
|
|
|
61
61
|
}
|
|
62
62
|
if (!e) return e;
|
|
63
63
|
const t = e.getTimezoneOffset();
|
|
64
|
-
return this
|
|
64
|
+
return this.$o(t);
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
$o(e) {
|
|
67
67
|
const t = parseInt(e / 60),
|
|
68
68
|
r = parseInt(e % 60);
|
|
69
69
|
let s = "GMT";
|
|
@@ -12,33 +12,33 @@ export default class Ot {
|
|
|
12
12
|
constructor(t, e, s, i, r, o, n, a, u, h, c) {
|
|
13
13
|
(this.Ur = t),
|
|
14
14
|
(this.h = e),
|
|
15
|
-
(this.
|
|
15
|
+
(this.Ko = s),
|
|
16
16
|
(this.v = i),
|
|
17
17
|
(this.j = r),
|
|
18
18
|
(this.gt = o),
|
|
19
19
|
(this._r = n),
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
22
|
-
(this.
|
|
23
|
-
(this
|
|
24
|
-
(this.
|
|
20
|
+
(this.Bo = a),
|
|
21
|
+
(this.Do = u),
|
|
22
|
+
(this.Go = h),
|
|
23
|
+
(this.sa = c),
|
|
24
|
+
(this.oa = ["npm"]);
|
|
25
25
|
}
|
|
26
26
|
Ps(t, e) {
|
|
27
27
|
const s = this.Ur.te(),
|
|
28
28
|
i = s.Mi(),
|
|
29
|
-
r = this.h.I(o.q.
|
|
29
|
+
r = this.h.I(o.q.Yo);
|
|
30
30
|
ii(r, i) || (t.device = i),
|
|
31
31
|
(t.api_key = this._r),
|
|
32
32
|
(t.time = l(new Date().valueOf(), !0));
|
|
33
|
-
const n = this.h.I(o.q.
|
|
34
|
-
a = this.h.I(o.q.
|
|
33
|
+
const n = this.h.I(o.q.ua) || [],
|
|
34
|
+
a = this.h.I(o.q.ha) || "";
|
|
35
35
|
if (
|
|
36
|
-
(this.
|
|
37
|
-
(!ii(n, this.
|
|
38
|
-
(t.sdk_metadata = this.
|
|
39
|
-
(t.sdk_version = this.
|
|
40
|
-
this.
|
|
41
|
-
(t.app_version = this
|
|
36
|
+
(this.oa.length > 0 &&
|
|
37
|
+
(!ii(n, this.oa) || a !== this.j.ca()) &&
|
|
38
|
+
(t.sdk_metadata = this.oa),
|
|
39
|
+
(t.sdk_version = this.Do),
|
|
40
|
+
this.Go && (t.sdk_flavor = this.Go),
|
|
41
|
+
(t.app_version = this.sa),
|
|
42
42
|
(t.device_id = s.id),
|
|
43
43
|
e)
|
|
44
44
|
) {
|
|
@@ -53,7 +53,7 @@ export default class Ot {
|
|
|
53
53
|
if (!o && !n) return !0;
|
|
54
54
|
if (o) {
|
|
55
55
|
let e;
|
|
56
|
-
this.
|
|
56
|
+
this.Ko.Xn();
|
|
57
57
|
const s = { errorCode: o.error_code };
|
|
58
58
|
for (const t of i)
|
|
59
59
|
p(t) && "X-Braze-Auth-Signature" === t[0] && (s.signature = t[1]);
|
|
@@ -65,42 +65,42 @@ export default class Ot {
|
|
|
65
65
|
n
|
|
66
66
|
? ((s.reason = n), (e = `due to ${n}`))
|
|
67
67
|
: (e = `with error code ${o.error_code}.`),
|
|
68
|
-
this.
|
|
68
|
+
this.Ko.Jn() ||
|
|
69
69
|
(e +=
|
|
70
70
|
' Please use the "enableSdkAuthentication" initialization option to enable authentication.'),
|
|
71
71
|
r.D.error(`SDK Authentication failed ${e}`),
|
|
72
|
-
this.
|
|
73
|
-
this.
|
|
72
|
+
this.la(t.events, t.attributes),
|
|
73
|
+
this.Ko.Vn(s),
|
|
74
74
|
!1
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
77
|
if (n) {
|
|
78
78
|
let i = n;
|
|
79
79
|
switch (i) {
|
|
80
|
-
case qt.
|
|
80
|
+
case qt.fa:
|
|
81
81
|
const o = "Received successful response with empty body.";
|
|
82
82
|
return s.G(r.A.qs, { e: o }), r.D.info(o), !1;
|
|
83
|
-
case qt.
|
|
83
|
+
case qt.ma:
|
|
84
84
|
const n = "Received successful response with invalid JSON";
|
|
85
85
|
return s.G(r.A.qs, { e: n + ": " + e.response }), r.D.info(n), !1;
|
|
86
|
-
case qt.ma:
|
|
87
|
-
i = `The API key "${t.api_key}" is invalid for the baseUrl ${this.zo}`;
|
|
88
|
-
break;
|
|
89
86
|
case qt.pa:
|
|
87
|
+
i = `The API key "${t.api_key}" is invalid for the baseUrl ${this.Bo}`;
|
|
88
|
+
break;
|
|
89
|
+
case qt.Ra:
|
|
90
90
|
i =
|
|
91
91
|
"Sorry, we are not currently accepting your requests. If you think this is in error, please contact us.";
|
|
92
92
|
break;
|
|
93
|
-
case qt.
|
|
93
|
+
case qt.ba:
|
|
94
94
|
i = "No device identifier. Please contact support@braze.com";
|
|
95
95
|
}
|
|
96
96
|
r.D.error("Backend error: " + i);
|
|
97
97
|
}
|
|
98
98
|
return !1;
|
|
99
99
|
}
|
|
100
|
-
|
|
100
|
+
ga(t, e, s, i) {
|
|
101
101
|
return !!((t && 0 !== t.length) || (e && 0 !== e.length) || s || i);
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
qa(t, e, s, i) {
|
|
104
104
|
const r = [],
|
|
105
105
|
o = t => t || "",
|
|
106
106
|
n = o(this.v.getUserId());
|
|
@@ -112,7 +112,7 @@ export default class Ot {
|
|
|
112
112
|
if (s.length > 0) {
|
|
113
113
|
const t = [];
|
|
114
114
|
for (const e of s) {
|
|
115
|
-
if (((a = e.Mi()), this.
|
|
115
|
+
if (((a = e.Mi()), this.Ko.Jn())) {
|
|
116
116
|
if (n && !a.user_id) {
|
|
117
117
|
c || ((c = {}), (c.events = [])), c.events.push(a);
|
|
118
118
|
continue;
|
|
@@ -129,21 +129,21 @@ export default class Ot {
|
|
|
129
129
|
if (i.length > 0) {
|
|
130
130
|
const t = [];
|
|
131
131
|
for (const e of i)
|
|
132
|
-
this.
|
|
132
|
+
this.Ko.Jn() && o(e.user_id) !== n
|
|
133
133
|
? (h || (h = []), h.push(e))
|
|
134
134
|
: t.push(e);
|
|
135
135
|
t.length > 0 && (l.attributes = t);
|
|
136
136
|
}
|
|
137
|
-
if ((this.
|
|
137
|
+
if ((this.la(u, h), (l = this.Ps(l, !0)), c)) {
|
|
138
138
|
c = this.Ps(c, !1);
|
|
139
139
|
const t = { requestData: c, headers: this.Bs(c) };
|
|
140
140
|
r.push(t);
|
|
141
141
|
}
|
|
142
|
-
if (l && !this.
|
|
142
|
+
if (l && !this.ga(l.events, l.attributes, t, e)) return c ? r : null;
|
|
143
143
|
const f = { requestData: l, headers: this.Bs(l) };
|
|
144
144
|
return r.push(f), r;
|
|
145
145
|
}
|
|
146
|
-
|
|
146
|
+
la(t, e) {
|
|
147
147
|
if (t) {
|
|
148
148
|
const e = [];
|
|
149
149
|
for (const s of t) {
|
|
@@ -152,14 +152,14 @@ export default class Ot {
|
|
|
152
152
|
}
|
|
153
153
|
this.h.bo(e);
|
|
154
154
|
}
|
|
155
|
-
if (e) for (const t of e) this.h.
|
|
155
|
+
if (e) for (const t of e) this.h.Aa(t);
|
|
156
156
|
}
|
|
157
157
|
Vs(t, e) {
|
|
158
158
|
let s = "HTTP error ";
|
|
159
159
|
null != t && (s += t + " "), (s += e), r.D.error(s);
|
|
160
160
|
}
|
|
161
161
|
yr(t) {
|
|
162
|
-
return s.G(r.A.
|
|
162
|
+
return s.G(r.A.za, { n: t });
|
|
163
163
|
}
|
|
164
164
|
Ai(t, e, s) {
|
|
165
165
|
const i = {};
|
|
@@ -192,9 +192,9 @@ export default class Ot {
|
|
|
192
192
|
if (
|
|
193
193
|
(s && (r.push(["X-Braze-FeatureFlagsRequest", "true"]), (n = !0)),
|
|
194
194
|
n && r.push(["X-Braze-DataRequest", "true"]),
|
|
195
|
-
this.
|
|
195
|
+
this.Ko.Jn())
|
|
196
196
|
) {
|
|
197
|
-
const t = this.
|
|
197
|
+
const t = this.Ko.Kn();
|
|
198
198
|
null != t && r.push(["X-Braze-Auth-Signature", t]);
|
|
199
199
|
}
|
|
200
200
|
return r;
|
|
@@ -208,12 +208,12 @@ export default class Ot {
|
|
|
208
208
|
: e();
|
|
209
209
|
}
|
|
210
210
|
Qs() {
|
|
211
|
-
this.
|
|
211
|
+
this.Ko.Qs();
|
|
212
212
|
}
|
|
213
213
|
Ks() {
|
|
214
|
-
return this.
|
|
214
|
+
return this.Bo;
|
|
215
215
|
}
|
|
216
216
|
addSdkMetadata(t) {
|
|
217
|
-
for (const e of t) -1 === this.
|
|
217
|
+
for (const e of t) -1 === this.oa.indexOf(e) && this.oa.push(e);
|
|
218
218
|
}
|
|
219
219
|
}
|
|
@@ -14,7 +14,7 @@ export default class Pt {
|
|
|
14
14
|
hl() {
|
|
15
15
|
if (null == this.rl) {
|
|
16
16
|
const t = this.h.I(o.q.ol);
|
|
17
|
-
this.rl = null != t ? Ft.
|
|
17
|
+
this.rl = null != t ? Ft.Sn(t) : new Ft();
|
|
18
18
|
}
|
|
19
19
|
return this.rl;
|
|
20
20
|
}
|
|
@@ -36,7 +36,7 @@ export default class Pt {
|
|
|
36
36
|
e.feature_flags
|
|
37
37
|
);
|
|
38
38
|
let s = !1;
|
|
39
|
-
null != t.gl && this.
|
|
39
|
+
null != t.gl && this.wn() !== t.gl && (s = !0);
|
|
40
40
|
let i = !1;
|
|
41
41
|
null != t.ml.enabled && this.Ys() !== t.ml.enabled && (i = !0);
|
|
42
42
|
let r = !1;
|
|
@@ -49,7 +49,7 @@ export default class Pt {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
yn(t) {
|
|
53
53
|
let e = this.tl.ut(t);
|
|
54
54
|
return this.fl && this.tl.removeSubscription(this.fl), (this.fl = e), e;
|
|
55
55
|
}
|
|
@@ -71,7 +71,7 @@ export default class Pt {
|
|
|
71
71
|
wl() {
|
|
72
72
|
return this.hl().Cl;
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
wn() {
|
|
75
75
|
return this.hl().gl;
|
|
76
76
|
}
|
|
77
77
|
Ys() {
|