@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
package/src/Push/push-manager.js
CHANGED
|
@@ -15,19 +15,19 @@ export default class aa {
|
|
|
15
15
|
(this.Ir = n),
|
|
16
16
|
(this.gt = o),
|
|
17
17
|
(this.Vr = u || !1),
|
|
18
|
-
(this.
|
|
18
|
+
(this.Or = a || !1),
|
|
19
19
|
(this.h = h),
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
20
|
+
(this.Mr = dt.Yr()),
|
|
21
|
+
(this.Gr = dt.Hr());
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
return this.
|
|
23
|
+
Jr() {
|
|
24
|
+
return this.Or;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
Kr(i, e, t, s, n) {
|
|
27
27
|
i.unsubscribe()
|
|
28
28
|
.then(i => {
|
|
29
29
|
i
|
|
30
|
-
? this.
|
|
30
|
+
? this.Lr(e, t, s, n)
|
|
31
31
|
: (r.D.error("Failed to unsubscribe device from push."),
|
|
32
32
|
"function" == typeof n && n(!1));
|
|
33
33
|
})
|
|
@@ -36,16 +36,16 @@ export default class aa {
|
|
|
36
36
|
"function" == typeof n && n(!1);
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
Qr(i, e, t) {
|
|
40
40
|
const s = (i => {
|
|
41
41
|
if ("string" == typeof i) return i;
|
|
42
42
|
if (0 !== i.endpoint.indexOf("https://android.googleapis.com/gcm/send"))
|
|
43
43
|
return i.endpoint;
|
|
44
44
|
let e = i.endpoint;
|
|
45
45
|
return (
|
|
46
|
-
i.
|
|
47
|
-
-1 === i.endpoint.indexOf(i.
|
|
48
|
-
(e = i.endpoint + "/" + i.
|
|
46
|
+
i.Xr &&
|
|
47
|
+
-1 === i.endpoint.indexOf(i.Xr) &&
|
|
48
|
+
(e = i.endpoint + "/" + i.Xr),
|
|
49
49
|
e
|
|
50
50
|
);
|
|
51
51
|
})(i);
|
|
@@ -73,15 +73,15 @@ export default class aa {
|
|
|
73
73
|
.replace(/\//g, "_")
|
|
74
74
|
: null;
|
|
75
75
|
})(i);
|
|
76
|
-
this.Sr.
|
|
76
|
+
this.Sr.Zr(s, t, r, n, o), s && "function" == typeof e && e(s, r, n);
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
this.Sr.
|
|
78
|
+
hn() {
|
|
79
|
+
this.Sr.fn(!0);
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
this.Sr.
|
|
81
|
+
dn(i, e) {
|
|
82
|
+
this.Sr.fn(!1), r.D.info(i), "function" == typeof e && e(!1);
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
pn(i, e, t, s) {
|
|
85
85
|
if ("default" === e.permission)
|
|
86
86
|
try {
|
|
87
87
|
window.safari.pushNotification.requestPermission(
|
|
@@ -93,23 +93,23 @@ export default class aa {
|
|
|
93
93
|
this.Sr.setPushNotificationSubscriptionType(
|
|
94
94
|
User.NotificationSubscriptionTypes.OPTED_IN
|
|
95
95
|
),
|
|
96
|
-
this.
|
|
96
|
+
this.pn(i, e, t, s);
|
|
97
97
|
}
|
|
98
98
|
);
|
|
99
99
|
} catch (i) {
|
|
100
|
-
this.
|
|
100
|
+
this.dn("Could not request permission for push: " + i, s);
|
|
101
101
|
}
|
|
102
102
|
else
|
|
103
103
|
"denied" === e.permission
|
|
104
|
-
? this.
|
|
104
|
+
? this.dn(
|
|
105
105
|
"The user has blocked notifications from this site, or Safari push is not configured in the Braze dashboard.",
|
|
106
106
|
s
|
|
107
107
|
)
|
|
108
108
|
: "granted" === e.permission &&
|
|
109
109
|
(r.D.info("Device successfully subscribed to push."),
|
|
110
|
-
this.
|
|
110
|
+
this.Qr(e.deviceToken, t, new Date()));
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
bn(i, e, t) {
|
|
113
113
|
const s = s => {
|
|
114
114
|
switch (s) {
|
|
115
115
|
case "granted":
|
|
@@ -132,14 +132,14 @@ export default class aa {
|
|
|
132
132
|
})
|
|
133
133
|
: (n = !0);
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
Lr(i, e, t, s) {
|
|
136
136
|
const n = { userVisibleOnly: !0 };
|
|
137
137
|
null != e && (n.applicationServerKey = e),
|
|
138
138
|
i.pushManager
|
|
139
139
|
.subscribe(n)
|
|
140
140
|
.then(i => {
|
|
141
141
|
r.D.info("Device successfully subscribed to push."),
|
|
142
|
-
this.
|
|
142
|
+
this.Qr(i, t, new Date());
|
|
143
143
|
})
|
|
144
144
|
.catch(i => {
|
|
145
145
|
dt.isPushBlocked()
|
|
@@ -148,7 +148,7 @@ export default class aa {
|
|
|
148
148
|
: r.D.error("Push subscription failed: " + i);
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
gn() {
|
|
152
152
|
return this.Vr
|
|
153
153
|
? navigator.serviceWorker.getRegistration()
|
|
154
154
|
: navigator.serviceWorker.register(this.Nr).then(() =>
|
|
@@ -164,13 +164,13 @@ export default class aa {
|
|
|
164
164
|
)
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
wn(i) {
|
|
168
168
|
this.Vr ||
|
|
169
169
|
(i.unregister(), r.D.info("Service worker successfully unregistered."));
|
|
170
170
|
}
|
|
171
171
|
subscribe(i, e) {
|
|
172
172
|
if (dt.isPushSupported()) {
|
|
173
|
-
if (this.
|
|
173
|
+
if (this.Mr) {
|
|
174
174
|
if (!this.Vr && null != window.location) {
|
|
175
175
|
let i = this.Nr;
|
|
176
176
|
-1 === i.indexOf(window.location.host) &&
|
|
@@ -178,7 +178,7 @@ export default class aa {
|
|
|
178
178
|
-1 === i.indexOf(window.location.protocol) &&
|
|
179
179
|
(i = window.location.protocol + "//" + i);
|
|
180
180
|
const e = i.substr(0, i.lastIndexOf("/") + 1);
|
|
181
|
-
if (0 !== H.
|
|
181
|
+
if (0 !== H.yn().indexOf(e))
|
|
182
182
|
return void r.D.error(
|
|
183
183
|
"Cannot subscribe to push from a path higher than the service worker location (tried to subscribe from " +
|
|
184
184
|
window.location.pathname +
|
|
@@ -188,16 +188,16 @@ export default class aa {
|
|
|
188
188
|
);
|
|
189
189
|
}
|
|
190
190
|
if (dt.isPushBlocked())
|
|
191
|
-
return void this.
|
|
191
|
+
return void this.dn(
|
|
192
192
|
"Notifications from this site are blocked. This may be a temporary embargo or a permanent denial.",
|
|
193
193
|
e
|
|
194
194
|
);
|
|
195
|
-
if (this.gt && !this.gt.
|
|
195
|
+
if (this.gt && !this.gt.vn() && 0 === this.gt.Zs())
|
|
196
196
|
return (
|
|
197
197
|
r.D.info(
|
|
198
198
|
"Waiting for VAPID key from server config before subscribing to push."
|
|
199
199
|
),
|
|
200
|
-
void this.gt.
|
|
200
|
+
void this.gt.kn(() => {
|
|
201
201
|
this.subscribe(i, e);
|
|
202
202
|
})
|
|
203
203
|
);
|
|
@@ -219,7 +219,7 @@ export default class aa {
|
|
|
219
219
|
this.Sr.setPushNotificationSubscriptionType(
|
|
220
220
|
User.NotificationSubscriptionTypes.OPTED_IN
|
|
221
221
|
),
|
|
222
|
-
this.
|
|
222
|
+
this.gn()
|
|
223
223
|
.then(t => {
|
|
224
224
|
if (null == t)
|
|
225
225
|
return (
|
|
@@ -234,17 +234,17 @@ export default class aa {
|
|
|
234
234
|
let n = null;
|
|
235
235
|
if (
|
|
236
236
|
(this.gt &&
|
|
237
|
-
null != this.gt.
|
|
238
|
-
(n = r.
|
|
237
|
+
null != this.gt.vn() &&
|
|
238
|
+
(n = r.Dn.Pn(this.gt.vn())),
|
|
239
239
|
s)
|
|
240
240
|
) {
|
|
241
241
|
let u = null,
|
|
242
242
|
a = null;
|
|
243
|
-
const h = this.h.I(o.q.
|
|
243
|
+
const h = this.h.I(o.q.Sn);
|
|
244
244
|
if (h && !p(h)) {
|
|
245
245
|
let i;
|
|
246
246
|
try {
|
|
247
|
-
i = ei.
|
|
247
|
+
i = ei.jn(h)._n;
|
|
248
248
|
} catch (e) {
|
|
249
249
|
i = null;
|
|
250
250
|
}
|
|
@@ -268,30 +268,30 @@ export default class aa {
|
|
|
268
268
|
: r.D.info(
|
|
269
269
|
"Attempting to upgrade a gcm_sender_id-based push registration to VAPID - depending on the browser this may or may not result in the same gcm_sender_id-based subscription."
|
|
270
270
|
),
|
|
271
|
-
this.
|
|
271
|
+
this.Kr(s, t, n, i, e))
|
|
272
272
|
: s.expirationTime &&
|
|
273
273
|
new Date(s.expirationTime) <= new Date().valueOf()
|
|
274
274
|
? (r.D.info(
|
|
275
275
|
"Push subscription is expired, creating new subscription."
|
|
276
276
|
),
|
|
277
|
-
this.
|
|
277
|
+
this.Kr(s, t, n, i, e))
|
|
278
278
|
: h && p(h)
|
|
279
|
-
? this.
|
|
279
|
+
? this.Kr(s, t, n, i, e)
|
|
280
280
|
: null == a
|
|
281
281
|
? (r.D.info(
|
|
282
282
|
"No push subscription creation date found, creating new subscription."
|
|
283
283
|
),
|
|
284
|
-
this.
|
|
284
|
+
this.Kr(s, t, n, i, e))
|
|
285
285
|
: a <= new Date().valueOf()
|
|
286
286
|
? (r.D.info(
|
|
287
287
|
"Push subscription older than 6 months, creating new subscription."
|
|
288
288
|
),
|
|
289
|
-
this.
|
|
289
|
+
this.Kr(s, t, n, i, e))
|
|
290
290
|
: (r.D.info(
|
|
291
291
|
"Device already subscribed to push, sending existing subscription to backend."
|
|
292
292
|
),
|
|
293
|
-
this.
|
|
294
|
-
} else this.
|
|
293
|
+
this.Qr(s, i, u));
|
|
294
|
+
} else this.Lr(t, n, i, e);
|
|
295
295
|
})
|
|
296
296
|
.catch(i => {
|
|
297
297
|
r.D.error(
|
|
@@ -303,27 +303,27 @@ export default class aa {
|
|
|
303
303
|
r.D.error("ServiceWorker registration failed: " + i);
|
|
304
304
|
});
|
|
305
305
|
};
|
|
306
|
-
this.
|
|
307
|
-
} else if (this.
|
|
306
|
+
this.bn(u, s, t);
|
|
307
|
+
} else if (this.Gr) {
|
|
308
308
|
if (null == this.Ir || "" === this.Ir)
|
|
309
309
|
return void r.D.error(
|
|
310
310
|
"You must supply the safariWebsitePushId initialization option in order to use registerPush on Safari"
|
|
311
311
|
);
|
|
312
312
|
const t = window.safari.pushNotification.permission(this.Ir);
|
|
313
|
-
this.
|
|
313
|
+
this.pn(this.Ir, t, i, e);
|
|
314
314
|
}
|
|
315
|
-
} else r.D.info(this.
|
|
315
|
+
} else r.D.info(this.An);
|
|
316
316
|
}
|
|
317
317
|
unsubscribe(i, e) {
|
|
318
318
|
dt.isPushSupported()
|
|
319
|
-
? this.
|
|
319
|
+
? this.Mr
|
|
320
320
|
? navigator.serviceWorker.getRegistration().then(t => {
|
|
321
321
|
t
|
|
322
322
|
? t.pushManager
|
|
323
323
|
.getSubscription()
|
|
324
324
|
.then(s => {
|
|
325
325
|
s &&
|
|
326
|
-
(this.
|
|
326
|
+
(this.hn(),
|
|
327
327
|
s
|
|
328
328
|
.unsubscribe()
|
|
329
329
|
.then(s => {
|
|
@@ -336,7 +336,7 @@ export default class aa {
|
|
|
336
336
|
"Failed to unsubscribe device from push."
|
|
337
337
|
),
|
|
338
338
|
"function" == typeof e && e()),
|
|
339
|
-
this.
|
|
339
|
+
this.wn(t);
|
|
340
340
|
})
|
|
341
341
|
.catch(i => {
|
|
342
342
|
r.D.error("Push unsubscription error: " + i),
|
|
@@ -350,11 +350,11 @@ export default class aa {
|
|
|
350
350
|
: (r.D.info("Device already unsubscribed from push."),
|
|
351
351
|
"function" == typeof i && i());
|
|
352
352
|
})
|
|
353
|
-
: this.
|
|
354
|
-
(this.
|
|
353
|
+
: this.Gr &&
|
|
354
|
+
(this.hn(),
|
|
355
355
|
r.D.info("Device unsubscribed from push."),
|
|
356
356
|
"function" == typeof i && i())
|
|
357
|
-
: r.D.info(this.
|
|
357
|
+
: r.D.info(this.An);
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
aa.
|
|
360
|
+
aa.An = "Push notifications are not supported in this browser.";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
const dt = {
|
|
2
|
-
|
|
2
|
+
Yr: () =>
|
|
3
3
|
"serviceWorker" in navigator &&
|
|
4
4
|
"undefined" != typeof ServiceWorkerRegistration &&
|
|
5
5
|
"showNotification" in ServiceWorkerRegistration.prototype &&
|
|
6
6
|
"PushManager" in window,
|
|
7
|
-
|
|
7
|
+
Hr: () =>
|
|
8
8
|
"safari" in window &&
|
|
9
9
|
"pushNotification" in window.safari &&
|
|
10
10
|
"function" == typeof window.safari.pushNotification.permission &&
|
|
11
11
|
"function" == typeof window.safari.pushNotification.requestPermission,
|
|
12
|
-
isPushSupported: () => dt.
|
|
12
|
+
isPushSupported: () => dt.Yr() || dt.Hr(),
|
|
13
13
|
isPushBlocked: () => {
|
|
14
14
|
const i =
|
|
15
15
|
dt.isPushSupported() &&
|
|
@@ -28,7 +28,7 @@ const dt = {
|
|
|
28
28
|
null != window.Notification &&
|
|
29
29
|
null != window.Notification.permission &&
|
|
30
30
|
"granted" === window.Notification.permission,
|
|
31
|
-
|
|
31
|
+
Ti: () =>
|
|
32
32
|
!dt.isPushBlocked() && dt.isPushSupported() && !dt.isPushPermissionGranted()
|
|
33
33
|
};
|
|
34
34
|
export default dt;
|
package/src/User/user-manager.js
CHANGED
|
@@ -44,7 +44,7 @@ export default class bt {
|
|
|
44
44
|
u
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
Zr(t, s, e, i, u) {
|
|
48
48
|
this.nu("push_token", t, !1, !0),
|
|
49
49
|
this.nu("custom_push_public_key", e, !1, !0),
|
|
50
50
|
this.nu("custom_push_user_auth", i, !1, !0),
|
|
@@ -52,9 +52,9 @@ export default class bt {
|
|
|
52
52
|
const h = r.xt.Ft,
|
|
53
53
|
n = new r.qt(h, r.D),
|
|
54
54
|
l = new ei(t, s, e, i, u);
|
|
55
|
-
this.h.B(o.q.
|
|
55
|
+
this.h.B(o.q.Sn, l.ss()), n.setItem(h.$t.cu, h.se, !0);
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
fn(t) {
|
|
58
58
|
if (
|
|
59
59
|
(this.nu("push_token", null, !1, !0),
|
|
60
60
|
this.nu("custom_push_public_key", null, !1, !0),
|
|
@@ -64,7 +64,7 @@ export default class bt {
|
|
|
64
64
|
) {
|
|
65
65
|
const t = r.xt.Ft,
|
|
66
66
|
s = new r.qt(t, r.D);
|
|
67
|
-
this.h.B(o.q.
|
|
67
|
+
this.h.B(o.q.Sn, !1), s.setItem(t.$t.cu, t.se, !1);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}
|
package/src/User/user.js
CHANGED
|
@@ -176,7 +176,7 @@ export default class User {
|
|
|
176
176
|
)
|
|
177
177
|
return !1;
|
|
178
178
|
}
|
|
179
|
-
return this.si.In(r.A.
|
|
179
|
+
return this.si.In(r.A.Un, t, e).S;
|
|
180
180
|
}
|
|
181
181
|
return this.v.setCustomUserAttribute(t, e);
|
|
182
182
|
}
|
|
@@ -187,7 +187,7 @@ export default class User {
|
|
|
187
187
|
null != e &&
|
|
188
188
|
!Y(e, "add to custom user attribute array", "the given value")
|
|
189
189
|
) &&
|
|
190
|
-
this.si.In(r.A.
|
|
190
|
+
this.si.In(r.A.En, t, e).S
|
|
191
191
|
);
|
|
192
192
|
}
|
|
193
193
|
removeFromCustomAttributeArray(t, e) {
|
|
@@ -197,7 +197,7 @@ export default class User {
|
|
|
197
197
|
null != e &&
|
|
198
198
|
!Y(e, "remove from custom user attribute array", "the given value")
|
|
199
199
|
) &&
|
|
200
|
-
this.si.In(r.A.
|
|
200
|
+
this.si.In(r.A.Fn, t, e).S
|
|
201
201
|
);
|
|
202
202
|
}
|
|
203
203
|
incrementCustomUserAttribute(t, e) {
|
|
@@ -209,7 +209,7 @@ export default class User {
|
|
|
209
209
|
`Cannot increment custom user attribute because the given incrementValue "${e}" is not an integer.`
|
|
210
210
|
),
|
|
211
211
|
!1)
|
|
212
|
-
: this.si.In(r.A.
|
|
212
|
+
: this.si.In(r.A.Tn, t, s).S;
|
|
213
213
|
}
|
|
214
214
|
setCustomLocationAttribute(t, e, s) {
|
|
215
215
|
return (
|
|
@@ -222,7 +222,7 @@ export default class User {
|
|
|
222
222
|
"Received invalid values for latitude and/or longitude. Latitude and longitude are bounded by ±90 and ±180 respectively, or must both be null for removal."
|
|
223
223
|
),
|
|
224
224
|
!1)
|
|
225
|
-
: this.si
|
|
225
|
+
: this.si.$n(t, e, s).S)
|
|
226
226
|
);
|
|
227
227
|
}
|
|
228
228
|
addToSubscriptionGroup(t) {
|
|
@@ -236,7 +236,7 @@ export default class User {
|
|
|
236
236
|
"addToSubscriptionGroup requires a non-empty subscription group ID"
|
|
237
237
|
),
|
|
238
238
|
!1)
|
|
239
|
-
: this.si
|
|
239
|
+
: this.si.Bn(t, User.Ln.SUBSCRIBED).S;
|
|
240
240
|
}
|
|
241
241
|
removeFromSubscriptionGroup(t) {
|
|
242
242
|
return !R(
|
|
@@ -249,13 +249,13 @@ export default class User {
|
|
|
249
249
|
"removeFromSubscriptionGroup requires a non-empty subscription group ID"
|
|
250
250
|
),
|
|
251
251
|
!1)
|
|
252
|
-
: this.si
|
|
252
|
+
: this.si.Bn(t, User.Ln.UNSUBSCRIBED).S;
|
|
253
253
|
}
|
|
254
|
-
|
|
255
|
-
this.v.
|
|
254
|
+
Zr(t, e, s, r, i) {
|
|
255
|
+
this.v.Zr(t, e, s, r, i), this.si.Rn();
|
|
256
256
|
}
|
|
257
|
-
|
|
258
|
-
this.v.
|
|
257
|
+
fn(t) {
|
|
258
|
+
this.v.fn(t);
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
(User.Cn = /^[0-9 .\\(\\)\\+\\-]+$/),
|
|
@@ -272,7 +272,7 @@ export default class User {
|
|
|
272
272
|
SUBSCRIBED: "subscribed",
|
|
273
273
|
UNSUBSCRIBED: "unsubscribed"
|
|
274
274
|
}),
|
|
275
|
-
(User.
|
|
276
|
-
(User.
|
|
275
|
+
(User.Ln = { SUBSCRIBED: "subscribed", UNSUBSCRIBED: "unsubscribed" }),
|
|
276
|
+
(User.On = "user_id"),
|
|
277
277
|
(User.lu = "custom"),
|
|
278
278
|
(User.ee = 997);
|
package/src/common/base-feed.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import x from "./base-feed.js";
|
|
2
2
|
import {
|
|
3
3
|
bottomHadImpression as de,
|
|
4
|
-
getCardId as
|
|
5
|
-
impressOnBottom as
|
|
6
|
-
impressOnTop as
|
|
7
|
-
markCardAsRead as
|
|
8
|
-
topHadImpression as
|
|
4
|
+
getCardId as fe,
|
|
5
|
+
impressOnBottom as be,
|
|
6
|
+
impressOnTop as ye,
|
|
7
|
+
markCardAsRead as Fe,
|
|
8
|
+
topHadImpression as Te
|
|
9
9
|
} from "../Card/display/card-display.js";
|
|
10
|
-
import { bottomIsInView as
|
|
10
|
+
import { bottomIsInView as he, topIsInView as _e } from "../util/dom-utils.js";
|
|
11
11
|
import { Card, ControlCard } from "../Card/index.js";
|
|
12
|
-
import { cardToHtml as
|
|
12
|
+
import { cardToHtml as xe } from "../Card/display/card-display.js";
|
|
13
13
|
import { isArray as p } from "../util/code-utils.js";
|
|
14
14
|
import { KeyCodes as at } from "../util/key-codes.js";
|
|
15
|
-
import
|
|
15
|
+
import Ee from "../l10n/l10n-manager-factory.js";
|
|
16
16
|
import { removeSubscription } from "../Core/remove-subscription.js";
|
|
17
17
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
18
18
|
import { BRAZE_ACTION_URI_REGEX as O } from "../util/validation-utils.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as ft,
|
|
21
21
|
ineligibleBrazeActionURLErrorMessage as ht,
|
|
22
22
|
getDecodedBrazeAction as J,
|
|
23
|
-
containsUnknownBrazeAction as
|
|
23
|
+
containsUnknownBrazeAction as gt
|
|
24
24
|
} from "../util/braze-actions.js";
|
|
25
25
|
export const LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE =
|
|
26
26
|
"data-last-requested-refresh";
|
|
@@ -30,7 +30,7 @@ export function destroyFeedHtml(e) {
|
|
|
30
30
|
((e.className = e.className.replace("ab-show", "ab-hide")),
|
|
31
31
|
setTimeout(() => {
|
|
32
32
|
e && e.parentNode && e.parentNode.removeChild(e);
|
|
33
|
-
}, x.
|
|
33
|
+
}, x.Zi));
|
|
34
34
|
const t = e.getAttribute("data-update-subscription-id");
|
|
35
35
|
null != t && removeSubscription(t);
|
|
36
36
|
}
|
|
@@ -56,7 +56,7 @@ export function _generateFeedBody(e, t) {
|
|
|
56
56
|
for (const n of e.cards) {
|
|
57
57
|
const a = n instanceof ControlCard;
|
|
58
58
|
!a || e.dr()
|
|
59
|
-
? (o.appendChild(
|
|
59
|
+
? (o.appendChild(xe(n, logCardClick, t)), (s = s || !a))
|
|
60
60
|
: r.D.error(
|
|
61
61
|
"Received a control card for a legacy news feed. Control cards are only supported with content cards."
|
|
62
62
|
);
|
|
@@ -64,7 +64,7 @@ export function _generateFeedBody(e, t) {
|
|
|
64
64
|
if (!s) {
|
|
65
65
|
const e = document.createElement("div");
|
|
66
66
|
(e.className = "ab-no-cards-message"),
|
|
67
|
-
(e.innerHTML =
|
|
67
|
+
(e.innerHTML = Ee.m().get("NO_CARDS_MESSAGE")),
|
|
68
68
|
e.setAttribute("role", "article"),
|
|
69
69
|
o.appendChild(e);
|
|
70
70
|
}
|
|
@@ -77,20 +77,20 @@ export function detectFeedImpressions(e, t) {
|
|
|
77
77
|
r = t.querySelectorAll(".ab-card");
|
|
78
78
|
e.do || (e.do = {});
|
|
79
79
|
for (let t = 0; t < r.length; t++) {
|
|
80
|
-
const s =
|
|
80
|
+
const s = fe(r[t]);
|
|
81
81
|
if (e.do[s]) continue;
|
|
82
|
-
let n =
|
|
82
|
+
let n = Te(r[t]),
|
|
83
83
|
a = de(r[t]);
|
|
84
84
|
const i = n,
|
|
85
85
|
d = a,
|
|
86
|
-
f =
|
|
87
|
-
c =
|
|
86
|
+
f = _e(r[t]),
|
|
87
|
+
c = he(r[t]);
|
|
88
88
|
if (
|
|
89
|
-
(!n && f && ((n = !0),
|
|
90
|
-
!a && c && ((a = !0),
|
|
89
|
+
(!n && f && ((n = !0), ye(r[t])),
|
|
90
|
+
!a && c && ((a = !0), be(r[t])),
|
|
91
91
|
n && a)
|
|
92
92
|
) {
|
|
93
|
-
if ((f || c ||
|
|
93
|
+
if ((f || c || Fe(r[t]), i && d)) continue;
|
|
94
94
|
for (const t of e.cards)
|
|
95
95
|
if (t.id === s) {
|
|
96
96
|
(e.do[t.id] = !0), o.push(t);
|
|
@@ -115,7 +115,7 @@ export function refreshFeed(e, t) {
|
|
|
115
115
|
const o = t.querySelectorAll(".ab-initial-spinner")[0];
|
|
116
116
|
if (null != o) {
|
|
117
117
|
const e = document.createElement("span");
|
|
118
|
-
(e.innerHTML =
|
|
118
|
+
(e.innerHTML = Ee.m().get("FEED_TIMEOUT_MESSAGE")),
|
|
119
119
|
o.parentNode.appendChild(e),
|
|
120
120
|
o.parentNode.removeChild(o);
|
|
121
121
|
}
|
|
@@ -177,8 +177,8 @@ export function updateFeedCards(e, t, o, s, n) {
|
|
|
177
177
|
if (e instanceof Card) {
|
|
178
178
|
if (e.url && O.test(e.url)) {
|
|
179
179
|
let t = J(e.url);
|
|
180
|
-
if (
|
|
181
|
-
r.D.error(ht(ft.
|
|
180
|
+
if (gt(t)) {
|
|
181
|
+
r.D.error(ht(ft.Di, "Content Card"));
|
|
182
182
|
continue;
|
|
183
183
|
}
|
|
184
184
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import e, { OPTIONS as T } from "../managers/braze-instance.js";
|
|
2
2
|
import ot from "../util/browser-detector.js";
|
|
3
3
|
import nr from "./l10n-manager.js";
|
|
4
|
-
const
|
|
4
|
+
const Ee = {
|
|
5
5
|
t: !1,
|
|
6
6
|
i: null,
|
|
7
7
|
m: () => {
|
|
8
|
-
if ((
|
|
8
|
+
if ((Ee.o(), !Ee.i)) {
|
|
9
9
|
let r = ot.language,
|
|
10
10
|
t = !1;
|
|
11
|
-
e.nn(T.
|
|
11
|
+
e.nn(T.zn) && ((r = e.nn(T.zn)), (t = !0)), (Ee.i = new nr(r, t));
|
|
12
12
|
}
|
|
13
|
-
return
|
|
13
|
+
return Ee.i;
|
|
14
14
|
},
|
|
15
15
|
o: () => {
|
|
16
|
-
|
|
16
|
+
Ee.t || (e.u(Ee), (Ee.t = !0));
|
|
17
17
|
},
|
|
18
18
|
destroy: () => {
|
|
19
|
-
(
|
|
19
|
+
(Ee.i = null), (Ee.t = !1);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
export default
|
|
22
|
+
export default Ee;
|
|
@@ -5,44 +5,44 @@ export default class St {
|
|
|
5
5
|
constructor(t, i, s) {
|
|
6
6
|
(this.h = t),
|
|
7
7
|
(this.xn = i || !1),
|
|
8
|
-
(this.
|
|
9
|
-
(this.
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
8
|
+
(this.qn = s),
|
|
9
|
+
(this.Gn = new u()),
|
|
10
|
+
(this.Hn = 0),
|
|
11
|
+
(this.Jn = 1);
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
Kn() {
|
|
14
14
|
return this.xn;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
return this.h.I(o.q.
|
|
16
|
+
Mn() {
|
|
17
|
+
return this.h.I(o.q.Qn);
|
|
18
18
|
}
|
|
19
19
|
setSdkAuthenticationSignature(t) {
|
|
20
|
-
const i = this.
|
|
21
|
-
this.h.B(o.q.
|
|
20
|
+
const i = this.Mn();
|
|
21
|
+
this.h.B(o.q.Qn, t);
|
|
22
22
|
const s = r.xt.Ft;
|
|
23
|
-
new r.qt(s, r.D).setItem(s.$t.
|
|
23
|
+
new r.qt(s, r.D).setItem(s.$t.Vn, this.Jn, t), i !== t && this.Qs();
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
this.h.Xs(o.q.
|
|
25
|
+
Wn() {
|
|
26
|
+
this.h.Xs(o.q.Qn);
|
|
27
27
|
const t = r.xt.Ft;
|
|
28
|
-
new r.qt(t, r.D).br(t.$t.
|
|
28
|
+
new r.qt(t, r.D).br(t.$t.Vn, this.Jn);
|
|
29
29
|
}
|
|
30
30
|
subscribeToSdkAuthenticationFailures(t) {
|
|
31
|
-
return this.
|
|
31
|
+
return this.qn.ut(t);
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
this.
|
|
33
|
+
Xn(t) {
|
|
34
|
+
this.qn.St(t);
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
this.
|
|
36
|
+
Yn() {
|
|
37
|
+
this.Gn.removeAllSubscriptions();
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
this.
|
|
39
|
+
Zn() {
|
|
40
|
+
this.Hn += 1;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
return this.
|
|
42
|
+
au() {
|
|
43
|
+
return this.Hn;
|
|
44
44
|
}
|
|
45
45
|
Qs() {
|
|
46
|
-
this.
|
|
46
|
+
this.Hn = 0;
|
|
47
47
|
}
|
|
48
48
|
}
|