@braze/web-sdk 6.10.2 → 6.12.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 +61 -6
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +3 -3
- package/shared-lib/event-types.js +12 -12
- package/shared-lib/indexed-db-adapter.js +52 -52
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +10 -10
- package/src/Core/logout.js +2 -2
- package/src/DUST/dust-config-store.js +89 -0
- package/src/DUST/dust-connection-core.js +7 -21
- package/src/DUST/dust-message-dedup.js +33 -0
- package/src/DUST/dust-provider.js +367 -397
- package/src/DUST/dust-tab-identity.js +30 -0
- package/src/DUST/index.js +7 -9
- package/src/DUST/subscribe-to-dust.js +5 -5
- package/src/FeatureFlags/feature-flag-factory.js +4 -4
- package/src/FeatureFlags/feature-flag.js +5 -5
- package/src/FeatureFlags/feature-flags-provider-factory.js +8 -1
- package/src/FeatureFlags/feature-flags-provider.js +74 -74
- 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 +3 -3
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
- package/src/InAppMessage/constants.js +39 -47
- package/src/InAppMessage/defer-in-app-message.js +2 -2
- package/src/InAppMessage/display/get-animation-effect.js +1 -1
- package/src/InAppMessage/display/html-message-display-utils.js +4 -4
- package/src/InAppMessage/display/html-message-to-html.js +10 -10
- package/src/InAppMessage/display/in-app-message-to-html.js +68 -66
- package/src/InAppMessage/display/modal-utils.js +14 -14
- package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
- package/src/InAppMessage/in-app-message-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
- package/src/InAppMessage/in-app-message-manager.js +101 -80
- 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 +4 -4
- package/src/InAppMessage/log-in-app-message-impression.js +3 -3
- package/src/InAppMessage/models/full-screen-message.js +25 -25
- package/src/InAppMessage/models/html-message.js +14 -14
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +100 -98
- package/src/InAppMessage/models/modal-message.js +23 -23
- package/src/InAppMessage/models/slide-up-message.js +29 -29
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +2 -2
- package/src/InAppMessage/ui/show-in-app-message.js +42 -40
- package/src/Push/index.js +1 -0
- package/src/Push/is-push-blocked.js +2 -2
- package/src/Push/is-push-permission-granted.js +2 -2
- package/src/Push/is-push-supported.js +2 -2
- package/src/Push/push-manager-factory.js +6 -6
- package/src/Push/push-manager.js +228 -185
- package/src/Push/register-push.js +9 -0
- package/src/Push/unregister-push-token-on-server.js +4 -4
- package/src/Push/utils/push-utils.js +16 -16
- package/src/User/user-manager.js +19 -19
- package/src/User/user.js +36 -36
- package/src/common/constants.js +1 -1
- package/src/common/content-cards-display.js +21 -21
- package/src/common/event-logger.js +2 -2
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/l10n/l10n-manager.js +5 -5
- package/src/managers/auth-manager.js +1 -1
- package/src/managers/braze-instance.js +70 -66
- package/src/managers/device-manager.js +12 -12
- package/src/managers/network-manager.js +118 -118
- package/src/managers/server-config-manager.js +84 -84
- package/src/managers/session-manager.js +10 -10
- package/src/managers/storage-manager-factory.js +4 -4
- package/src/managers/storage-manager.js +138 -136
- package/src/managers/subscription-manager.js +1 -1
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +7 -7
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +6 -6
- package/src/models/push-token.js +6 -6
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +91 -91
- package/src/triggers/models/filter.js +58 -58
- package/src/triggers/models/in-app-message-click-data.js +4 -4
- package/src/triggers/models/push-click-data.js +2 -2
- package/src/triggers/models/trigger-condition.js +35 -35
- package/src/triggers/models/trigger.js +37 -37
- package/src/triggers/triggers-provider-factory.js +3 -3
- package/src/triggers/triggers-provider.js +61 -53
- package/src/types.js +1 -1
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/feed-css.js +2 -2
- package/src/ui/js/iam-css.js +2 -2
- package/src/util/base-device-parser.js +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +13 -13
- package/src/util/client-hints-parser.js +4 -4
- package/src/util/component-utils.js +4 -4
- package/src/util/dom-utils.js +5 -5
- package/src/util/ecommerce-event-validation.js +77 -48
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +4 -4
- package/src/util/request-header-utils.js +20 -20
- package/src/util/string-utils.js +5 -0
- package/src/util/user-agent-parser.js +15 -15
- package/src/util/validation-utils.js +9 -9
- package/src/util/window-utils.js +2 -2
- package/src/DUST/dust-shared-worker-code.js +0 -2
- package/src/DUST/dust-shared-worker-impl.js +0 -234
- package/src/DUST/dust-worker-bridge.js +0 -151
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Dt = {
|
|
2
2
|
cu: () =>
|
|
3
3
|
"serviceWorker" in navigator &&
|
|
4
4
|
"undefined" != typeof ServiceWorkerRegistration &&
|
|
5
5
|
"showNotification" in ServiceWorkerRegistration.prototype &&
|
|
6
6
|
"PushManager" in window,
|
|
7
|
-
|
|
7
|
+
du: () =>
|
|
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: () =>
|
|
12
|
+
isPushSupported: () => Dt.cu() || Dt.du(),
|
|
13
13
|
isPushBlocked: () => {
|
|
14
14
|
const o =
|
|
15
|
-
|
|
15
|
+
Dt.isPushSupported() &&
|
|
16
16
|
"Notification" in window &&
|
|
17
17
|
null != window.Notification &&
|
|
18
18
|
null != window.Notification.permission &&
|
|
19
19
|
"denied" === window.Notification.permission,
|
|
20
20
|
i =
|
|
21
|
-
|
|
21
|
+
Dt.isPushSupported() &&
|
|
22
22
|
(!("Notification" in window) || null == window.Notification);
|
|
23
23
|
return o || i;
|
|
24
24
|
},
|
|
25
25
|
isPushPermissionGranted: () =>
|
|
26
|
-
|
|
26
|
+
Dt.isPushSupported() &&
|
|
27
27
|
"Notification" in window &&
|
|
28
28
|
null != window.Notification &&
|
|
29
29
|
null != window.Notification.permission &&
|
|
30
30
|
"granted" === window.Notification.permission,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
? {
|
|
34
|
-
:
|
|
35
|
-
?
|
|
36
|
-
? {
|
|
37
|
-
: {
|
|
38
|
-
: {
|
|
39
|
-
|
|
31
|
+
Yn: () =>
|
|
32
|
+
Dt.isPushBlocked()
|
|
33
|
+
? { Zn: !1, reason: "blocked" }
|
|
34
|
+
: Dt.isPushSupported()
|
|
35
|
+
? Dt.isPushPermissionGranted()
|
|
36
|
+
? { Zn: !1, reason: "permissionGranted" }
|
|
37
|
+
: { Zn: !0 }
|
|
38
|
+
: { Zn: !1, reason: "unsupported" },
|
|
39
|
+
So: (o, i) =>
|
|
40
40
|
"blocked" === o
|
|
41
41
|
? `${i} containing a push prompt is not being shown because the user has already declined push permission prompt.`
|
|
42
42
|
: "unsupported" === o
|
|
43
43
|
? `${i} containing a push prompt is not being shown because the browser doesn't support push notifications.`
|
|
44
44
|
: `${i} containing a push prompt is not being shown because the user has already accepted the permission prompt.`,
|
|
45
45
|
};
|
|
46
|
-
export default
|
|
46
|
+
export default Dt;
|
package/src/User/user-manager.js
CHANGED
|
@@ -11,28 +11,28 @@ export default class Ut {
|
|
|
11
11
|
getUserId() {
|
|
12
12
|
const t = this.j.$u(s.Ou.Cu);
|
|
13
13
|
if (null == t) return null;
|
|
14
|
-
let i = t.
|
|
14
|
+
let i = t.Iu,
|
|
15
15
|
e = er(i);
|
|
16
16
|
if (e > User.br) {
|
|
17
17
|
for (; e > User.br; ) (i = i.slice(0, i.length - 1)), (e = er(i));
|
|
18
|
-
(t.
|
|
18
|
+
(t.Iu = i), this.j.Ju(s.Ou.Cu, t);
|
|
19
19
|
}
|
|
20
20
|
return i;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
Lu(t) {
|
|
23
23
|
const i = null == this.getUserId();
|
|
24
|
-
this.j.
|
|
24
|
+
this.j.Ju(s.Ou.Cu, new _t(t)), i && this.j.qu(t);
|
|
25
25
|
}
|
|
26
26
|
setCustomUserAttribute(t, s) {
|
|
27
|
-
if (this.h.
|
|
27
|
+
if (this.h.zu(t))
|
|
28
28
|
return (
|
|
29
29
|
b.info('Custom Attribute "' + t + '" is blocklisted, ignoring.'), !1
|
|
30
30
|
);
|
|
31
31
|
const i = {};
|
|
32
|
-
return (i[t] = s), this.
|
|
32
|
+
return (i[t] = s), this.Bu(User.Eu, i, !0);
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
const u = this.j.
|
|
34
|
+
Bu(t, s, i = !1, e = !1) {
|
|
35
|
+
const u = this.j.Fu(this.getUserId(), t, s);
|
|
36
36
|
let o = "",
|
|
37
37
|
r = t,
|
|
38
38
|
h = s;
|
|
@@ -47,27 +47,27 @@ export default class Ut {
|
|
|
47
47
|
u
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
53
|
-
this.
|
|
54
|
-
this.
|
|
50
|
+
yu(t, i, e, u, o) {
|
|
51
|
+
this.Bu("push_token", t, !1, !0),
|
|
52
|
+
this.Bu("custom_push_public_key", e, !1, !0),
|
|
53
|
+
this.Bu("custom_push_user_auth", u, !1, !0),
|
|
54
|
+
this.Bu("custom_push_vapid_public_key", o, !1, !0);
|
|
55
55
|
const r = et._s.Xs,
|
|
56
56
|
h = new et(r, b),
|
|
57
57
|
n = new ui(t, i, e, u, o);
|
|
58
|
-
this.j.Pt(s.It.
|
|
58
|
+
this.j.Pt(s.It.xu, n.qt()), h.setItem(r.Ws.Gu, r.be, !0);
|
|
59
59
|
}
|
|
60
60
|
wu(t) {
|
|
61
61
|
if (
|
|
62
|
-
(this.
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
62
|
+
(this.Bu("push_token", null, !1, !0),
|
|
63
|
+
this.Bu("custom_push_public_key", null, !1, !0),
|
|
64
|
+
this.Bu("custom_push_user_auth", null, !1, !0),
|
|
65
|
+
this.Bu("custom_push_vapid_public_key", null, !1, !0),
|
|
66
66
|
t)
|
|
67
67
|
) {
|
|
68
68
|
const t = et._s.Xs,
|
|
69
69
|
i = new et(t, b);
|
|
70
|
-
this.j.Pt(s.It.
|
|
70
|
+
this.j.Pt(s.It.xu, !1), i.setItem(t.Ws.Gu, t.be, !1);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
}
|
package/src/User/user.js
CHANGED
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
} from "../util/code-utils.js";
|
|
7
7
|
import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
|
|
8
8
|
import {
|
|
9
|
-
isValidEmail as
|
|
10
|
-
validateCustomAttributeArrayType as
|
|
11
|
-
validateCustomAttributeKey as
|
|
9
|
+
isValidEmail as Ft,
|
|
10
|
+
validateCustomAttributeArrayType as Lt,
|
|
11
|
+
validateCustomAttributeKey as $t,
|
|
12
12
|
validateCustomProperties as nt,
|
|
13
13
|
validateCustomString as mt,
|
|
14
|
-
validatePropertyType as
|
|
14
|
+
validatePropertyType as Bt,
|
|
15
15
|
validateStandardString as tr,
|
|
16
16
|
} from "../util/validation-utils.js";
|
|
17
17
|
import { CoreStrings as R } from "../common/constants.js";
|
|
18
|
-
import { toValidBackendTimeString as
|
|
18
|
+
import { toValidBackendTimeString as Rt } from "../util/date-utils.js";
|
|
19
19
|
export default class User {
|
|
20
20
|
constructor(t, e) {
|
|
21
21
|
(this.Ss = t), (this.Ru = e), (this.Ss = t), (this.Ru = e);
|
|
@@ -33,22 +33,22 @@ export default class User {
|
|
|
33
33
|
? (b.error("addAlias requires a non-empty alias"), !1)
|
|
34
34
|
: !tr(e, "add alias", "the label", !1) || e.length <= 0
|
|
35
35
|
? (b.error("addAlias requires a non-empty label"), !1)
|
|
36
|
-
: this.Ru.
|
|
36
|
+
: this.Ru.Hu(t, e).lt;
|
|
37
37
|
}
|
|
38
38
|
setFirstName(t) {
|
|
39
39
|
return (
|
|
40
40
|
!!tr(t, "set first name", "the firstName", !0) &&
|
|
41
|
-
this.Ss.
|
|
41
|
+
this.Ss.Bu("first_name", t)
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
setLastName(t) {
|
|
45
45
|
return (
|
|
46
|
-
!!tr(t, "set last name", "the lastName", !0) && this.Ss.
|
|
46
|
+
!!tr(t, "set last name", "the lastName", !0) && this.Ss.Bu("last_name", t)
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
setEmail(t) {
|
|
50
|
-
return null === t ||
|
|
51
|
-
? this.Ss.
|
|
50
|
+
return null === t || Ft(t)
|
|
51
|
+
? this.Ss.Bu("email", t)
|
|
52
52
|
: (b.error(
|
|
53
53
|
`Cannot set email address - "${t}" did not pass RFC-5322 validation.`,
|
|
54
54
|
),
|
|
@@ -65,12 +65,12 @@ export default class User {
|
|
|
65
65
|
`Gender "${t}" is not a valid gender.`,
|
|
66
66
|
"User.Genders",
|
|
67
67
|
)
|
|
68
|
-
) && this.Ss.
|
|
68
|
+
) && this.Ss.Bu("gender", t)
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
setDateOfBirth(t, e, r) {
|
|
72
72
|
return null === t && null === e && null === r
|
|
73
|
-
? this.Ss.
|
|
73
|
+
? this.Ss.Bu("dob", null)
|
|
74
74
|
: ((t = null != t ? parseInt(t.toString()) : null),
|
|
75
75
|
(e = null != e ? parseInt(e.toString()) : null),
|
|
76
76
|
(r = null != r ? parseInt(r.toString()) : null),
|
|
@@ -88,21 +88,21 @@ export default class User {
|
|
|
88
88
|
"Cannot set date of birth - parameters should comprise a valid date e.g. setDateOfBirth(1776, 7, 4);",
|
|
89
89
|
),
|
|
90
90
|
!1)
|
|
91
|
-
: this.Ss.
|
|
91
|
+
: this.Ss.Bu("dob", `${t}-${e}-${r}`));
|
|
92
92
|
}
|
|
93
93
|
setCountry(t) {
|
|
94
94
|
return (
|
|
95
|
-
!!tr(t, "set country", "the country", !0) && this.Ss.
|
|
95
|
+
!!tr(t, "set country", "the country", !0) && this.Ss.Bu("country", t)
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
setHomeCity(t) {
|
|
99
99
|
return (
|
|
100
|
-
!!tr(t, "set home city", "the homeCity", !0) && this.Ss.
|
|
100
|
+
!!tr(t, "set home city", "the homeCity", !0) && this.Ss.Bu("home_city", t)
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
103
|
setLanguage(t) {
|
|
104
104
|
return (
|
|
105
|
-
!!tr(t, "set language", "the language", !0) && this.Ss.
|
|
105
|
+
!!tr(t, "set language", "the language", !0) && this.Ss.Bu("language", t)
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
108
|
setEmailNotificationSubscriptionType(t) {
|
|
@@ -112,7 +112,7 @@ export default class User {
|
|
|
112
112
|
t,
|
|
113
113
|
`Email notification setting "${t}" is not a valid subscription type.`,
|
|
114
114
|
"User.NotificationSubscriptionTypes",
|
|
115
|
-
) && this.Ss.
|
|
115
|
+
) && this.Ss.Bu("email_subscribe", t)
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
setPushNotificationSubscriptionType(t) {
|
|
@@ -122,14 +122,14 @@ export default class User {
|
|
|
122
122
|
t,
|
|
123
123
|
`Push notification setting "${t}" is not a valid subscription type.`,
|
|
124
124
|
"User.NotificationSubscriptionTypes",
|
|
125
|
-
) && this.Ss.
|
|
125
|
+
) && this.Ss.Bu("push_subscribe", t)
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
128
|
setPhoneNumber(t) {
|
|
129
129
|
return (
|
|
130
130
|
!!tr(t, "set phone number", "the phoneNumber", !0) &&
|
|
131
|
-
(null === t || t.match(User.
|
|
132
|
-
? this.Ss.
|
|
131
|
+
(null === t || t.match(User.Ku)
|
|
132
|
+
? this.Ss.Bu("phone", t)
|
|
133
133
|
: (b.error(`Cannot set phone number - "${t}" did not pass validation.`),
|
|
134
134
|
!1))
|
|
135
135
|
);
|
|
@@ -168,11 +168,11 @@ export default class User {
|
|
|
168
168
|
.lt);
|
|
169
169
|
}
|
|
170
170
|
setCustomUserAttribute(t, e, r) {
|
|
171
|
-
if (
|
|
171
|
+
if (!$t(t)) return !1;
|
|
172
172
|
const s = (e) => {
|
|
173
173
|
const [r] = nt(
|
|
174
174
|
e,
|
|
175
|
-
R.
|
|
175
|
+
R.Mu,
|
|
176
176
|
"attribute value",
|
|
177
177
|
`set custom user attribute "${t}"`,
|
|
178
178
|
"custom user attribute",
|
|
@@ -180,17 +180,17 @@ export default class User {
|
|
|
180
180
|
return r;
|
|
181
181
|
};
|
|
182
182
|
if (g(e)) {
|
|
183
|
-
const [r, n] =
|
|
183
|
+
const [r, n] = Lt(t, e);
|
|
184
184
|
if (!r && !n && 0 !== e.length) return !1;
|
|
185
|
-
if (r || 0 === e.length) return this.Ru.
|
|
185
|
+
if (r || 0 === e.length) return this.Ru.Yu(p.Vu, t, e).lt;
|
|
186
186
|
for (const t of e) if (!s(t)) return !1;
|
|
187
187
|
} else if (Ct(e)) {
|
|
188
188
|
if (!s(e)) return !1;
|
|
189
|
-
if (r) return this.Ru.
|
|
189
|
+
if (r) return this.Ru.Yu(p.Qu, t, e).lt;
|
|
190
190
|
} else {
|
|
191
|
-
if (!(void 0 !== e &&
|
|
191
|
+
if (!(void 0 !== e && Bt(e))) return !1;
|
|
192
192
|
if (
|
|
193
|
-
(Nt(e) && (e =
|
|
193
|
+
(Nt(e) && (e = Rt(e)),
|
|
194
194
|
"string" == typeof e &&
|
|
195
195
|
!mt(
|
|
196
196
|
e,
|
|
@@ -209,7 +209,7 @@ export default class User {
|
|
|
209
209
|
null != e &&
|
|
210
210
|
!mt(e, "add to custom user attribute array", "the given value")
|
|
211
211
|
) &&
|
|
212
|
-
this.Ru.
|
|
212
|
+
this.Ru.Yu(p.Xu, t, e).lt
|
|
213
213
|
);
|
|
214
214
|
}
|
|
215
215
|
removeFromCustomAttributeArray(t, e) {
|
|
@@ -219,7 +219,7 @@ export default class User {
|
|
|
219
219
|
null != e &&
|
|
220
220
|
!mt(e, "remove from custom user attribute array", "the given value")
|
|
221
221
|
) &&
|
|
222
|
-
this.Ru.
|
|
222
|
+
this.Ru.Yu(p.Zu, t, e).lt
|
|
223
223
|
);
|
|
224
224
|
}
|
|
225
225
|
incrementCustomUserAttribute(t, e) {
|
|
@@ -231,7 +231,7 @@ export default class User {
|
|
|
231
231
|
`Cannot increment custom user attribute because the given incrementValue "${e}" is not an integer.`,
|
|
232
232
|
),
|
|
233
233
|
!1)
|
|
234
|
-
: this.Ru.
|
|
234
|
+
: this.Ru.Yu(p.Na, t, r).lt;
|
|
235
235
|
}
|
|
236
236
|
setCustomLocationAttribute(t, e, r) {
|
|
237
237
|
return (
|
|
@@ -247,7 +247,7 @@ export default class User {
|
|
|
247
247
|
"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.",
|
|
248
248
|
),
|
|
249
249
|
!1)
|
|
250
|
-
: this.Ru.
|
|
250
|
+
: this.Ru.ya(t, e, r).lt)
|
|
251
251
|
);
|
|
252
252
|
}
|
|
253
253
|
addToSubscriptionGroup(t) {
|
|
@@ -284,11 +284,11 @@ export default class User {
|
|
|
284
284
|
`Rejected LINE user ID ${t} because it is longer than ${User.Ca} characters.`,
|
|
285
285
|
),
|
|
286
286
|
!1)
|
|
287
|
-
: this.Ss.
|
|
287
|
+
: this.Ss.Bu("native_line_id", t)
|
|
288
288
|
: (b.error("setLineId requires a non-empty ID"), !1);
|
|
289
289
|
}
|
|
290
|
-
|
|
291
|
-
this.Ss.
|
|
290
|
+
yu(t, e, r, s, n) {
|
|
291
|
+
this.Ss.yu(t, e, r, s, n), this.Ru.Ea();
|
|
292
292
|
}
|
|
293
293
|
wu(t) {
|
|
294
294
|
this.Ss.wu(t);
|
|
@@ -307,9 +307,9 @@ export default class User {
|
|
|
307
307
|
SUBSCRIBED: "subscribed",
|
|
308
308
|
UNSUBSCRIBED: "unsubscribed",
|
|
309
309
|
}),
|
|
310
|
-
(User.
|
|
310
|
+
(User.Ku = /^[0-9 .\\(\\)\\+\\-]+$/),
|
|
311
311
|
(User.Ia = { SUBSCRIBED: "subscribed", UNSUBSCRIBED: "unsubscribed" }),
|
|
312
312
|
(User.Sa = "user_id"),
|
|
313
|
-
(User.
|
|
313
|
+
(User.Eu = "custom"),
|
|
314
314
|
(User.br = 997),
|
|
315
315
|
(User.Ca = 33);
|
package/src/common/constants.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
|
-
getCardId as
|
|
3
|
-
markCardAsRead as
|
|
2
|
+
getCardId as qt,
|
|
3
|
+
markCardAsRead as Ot,
|
|
4
4
|
} from "../Card/display/card-display.js";
|
|
5
5
|
import { bottomIsInView as q, topIsInView as k } from "../util/dom-utils.js";
|
|
6
6
|
import { Card, ControlCard } from "../Card/index.js";
|
|
7
|
-
import { cardToHtml as
|
|
7
|
+
import { cardToHtml as Gt } from "../Card/display/card-display.js";
|
|
8
8
|
import { isArray as g } from "../util/code-utils.js";
|
|
9
|
-
import { KeyCodes as
|
|
10
|
-
import
|
|
9
|
+
import { KeyCodes as le } from "../util/key-codes.js";
|
|
10
|
+
import he from "../l10n/l10n-manager-factory.js";
|
|
11
11
|
import { removeSubscription } from "../Core/remove-subscription.js";
|
|
12
12
|
import { logger as b, Guid as V } from "../../shared-lib/index.js";
|
|
13
13
|
import { BRAZE_ACTION_URI_REGEX as to } from "../util/validation-utils.js";
|
|
14
14
|
import {
|
|
15
|
-
INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as
|
|
16
|
-
ineligibleBrazeActionURLErrorMessage as
|
|
15
|
+
INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as Tt,
|
|
16
|
+
ineligibleBrazeActionURLErrorMessage as Mt,
|
|
17
17
|
getDecodedBrazeAction as eo,
|
|
18
|
-
containsUnknownBrazeAction as
|
|
18
|
+
containsUnknownBrazeAction as At,
|
|
19
19
|
} from "../util/braze-actions.js";
|
|
20
20
|
import {
|
|
21
|
-
bottomHadImpression as
|
|
21
|
+
bottomHadImpression as Qt,
|
|
22
22
|
impressOnBottom as $,
|
|
23
23
|
impressOnTop as B,
|
|
24
|
-
topHadImpression as
|
|
24
|
+
topHadImpression as Kt,
|
|
25
25
|
} from "./detect-impression.js";
|
|
26
26
|
import { BannerStrings as x } from "../Banner/constants.js";
|
|
27
27
|
import ContentCards from "../ContentCards/content-cards.js";
|
|
@@ -43,7 +43,7 @@ export function destroyContentCardsHtml(t) {
|
|
|
43
43
|
delete scrollListeners[n]);
|
|
44
44
|
}
|
|
45
45
|
export function generateContentCardsUI(t, e) {
|
|
46
|
-
const n =
|
|
46
|
+
const n = he.ra(),
|
|
47
47
|
o = document.createElement("div");
|
|
48
48
|
if (
|
|
49
49
|
((o.className = "ab-feed-body"),
|
|
@@ -63,7 +63,7 @@ export function generateContentCardsUI(t, e) {
|
|
|
63
63
|
for (const a of t.cards) {
|
|
64
64
|
const i = a instanceof ControlCard;
|
|
65
65
|
!i || t.hr()
|
|
66
|
-
? (o.appendChild(
|
|
66
|
+
? (o.appendChild(Gt(a, r, e, n.ga())), (s = s || !i))
|
|
67
67
|
: b.error(
|
|
68
68
|
"Received a control card for a legacy news feed. Control cards are only supported with content cards.",
|
|
69
69
|
);
|
|
@@ -84,15 +84,15 @@ export function detectContentCardsImpressions(t, e) {
|
|
|
84
84
|
o = e.querySelectorAll(".ab-card");
|
|
85
85
|
t.Ta || (t.Ta = {});
|
|
86
86
|
for (let e = 0; e < o.length; e++) {
|
|
87
|
-
const s =
|
|
87
|
+
const s = qt(o[e]),
|
|
88
88
|
r = k(o[e]),
|
|
89
89
|
a = q(o[e]);
|
|
90
90
|
if (t.Ta[s]) {
|
|
91
|
-
r || a ||
|
|
91
|
+
r || a || Ot(o[e]);
|
|
92
92
|
continue;
|
|
93
93
|
}
|
|
94
|
-
let i =
|
|
95
|
-
l =
|
|
94
|
+
let i = Kt(o[e]),
|
|
95
|
+
l = Qt(o[e]);
|
|
96
96
|
const d = i,
|
|
97
97
|
c = l;
|
|
98
98
|
if (
|
|
@@ -124,7 +124,7 @@ export function refreshContentCardsUI(t, e) {
|
|
|
124
124
|
const n = e.querySelectorAll(".ab-initial-spinner")[0];
|
|
125
125
|
if (null != n) {
|
|
126
126
|
const t = document.createElement("span");
|
|
127
|
-
(t.innerHTML =
|
|
127
|
+
(t.innerHTML = he.ra().get("FEED_TIMEOUT_MESSAGE") || ""),
|
|
128
128
|
null != n.parentNode &&
|
|
129
129
|
(n.parentNode.appendChild(t), n.parentNode.removeChild(n));
|
|
130
130
|
}
|
|
@@ -153,7 +153,7 @@ export function contentCardsToHtml(t, e, n) {
|
|
|
153
153
|
destroyContentCardsHtml(o), t.stopPropagation();
|
|
154
154
|
};
|
|
155
155
|
r.addEventListener("keydown", (t) => {
|
|
156
|
-
(t.keyCode !==
|
|
156
|
+
(t.keyCode !== le.To && t.keyCode !== le.Lo) || a(t);
|
|
157
157
|
}),
|
|
158
158
|
(r.onclick = a);
|
|
159
159
|
const i = document.createElement("i");
|
|
@@ -166,7 +166,7 @@ export function contentCardsToHtml(t, e, n) {
|
|
|
166
166
|
refreshContentCardsUI(t, o), e.stopPropagation();
|
|
167
167
|
};
|
|
168
168
|
i.addEventListener("keydown", (t) => {
|
|
169
|
-
(t.keyCode !==
|
|
169
|
+
(t.keyCode !== le.To && t.keyCode !== le.Lo) || l(t);
|
|
170
170
|
}),
|
|
171
171
|
(i.onclick = l),
|
|
172
172
|
s.appendChild(i),
|
|
@@ -187,8 +187,8 @@ export function updateContentCards(t, e, n, o, s) {
|
|
|
187
187
|
if (t instanceof Card) {
|
|
188
188
|
if (t.url && to.test(t.url)) {
|
|
189
189
|
const e = eo(t.url);
|
|
190
|
-
if (
|
|
191
|
-
b.error(
|
|
190
|
+
if (At(e)) {
|
|
191
|
+
b.error(Mt(Tt.Wn, "Content Card"));
|
|
192
192
|
continue;
|
|
193
193
|
}
|
|
194
194
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { logger as b } from "../../shared-lib/index.js";
|
|
2
2
|
import r from "../managers/braze-instance.js";
|
|
3
|
-
import
|
|
3
|
+
import ve from "../models/braze-event.js";
|
|
4
4
|
import L from "../models/request-result.js";
|
|
5
5
|
const v = {
|
|
6
6
|
Dt: (e, o, t) => {
|
|
@@ -17,7 +17,7 @@ const v = {
|
|
|
17
17
|
const d = l.el();
|
|
18
18
|
return (
|
|
19
19
|
i.Ce.push(
|
|
20
|
-
new
|
|
20
|
+
new ve(
|
|
21
21
|
t || (null === (n = r.ir()) || void 0 === n ? void 0 : n.getUserId()),
|
|
22
22
|
e,
|
|
23
23
|
new Date().valueOf(),
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import r, { OPTIONS as U } from "../managers/braze-instance.js";
|
|
2
2
|
import ro from "../util/browser-detector.js";
|
|
3
3
|
import jr from "./l10n-manager.js";
|
|
4
|
-
const
|
|
4
|
+
const he = {
|
|
5
5
|
i: !1,
|
|
6
6
|
na: null,
|
|
7
7
|
ra: () => {
|
|
8
|
-
if ((
|
|
8
|
+
if ((he.t(), !he.na)) {
|
|
9
9
|
let e = ro.language,
|
|
10
10
|
t = !1;
|
|
11
|
-
r.er(U.
|
|
11
|
+
r.er(U.Ma) && ((e = r.er(U.Ma)), (t = !0)), (he.na = new jr(e, t));
|
|
12
12
|
}
|
|
13
|
-
return
|
|
13
|
+
return he.na;
|
|
14
14
|
},
|
|
15
15
|
t: () => {
|
|
16
|
-
|
|
16
|
+
he.i || (r.g(he), (he.i = !0));
|
|
17
17
|
},
|
|
18
18
|
destroy: () => {
|
|
19
|
-
(
|
|
19
|
+
(he.na = null), (he.i = !1);
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
|
-
export default
|
|
22
|
+
export default he;
|
package/src/l10n/l10n-manager.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { logger as b } from "../../shared-lib/index.js";
|
|
2
|
-
import
|
|
2
|
+
import Pt from "../common/translations.js";
|
|
3
3
|
export default class jr {
|
|
4
4
|
constructor(t, e = !1) {
|
|
5
5
|
if (
|
|
6
6
|
((this.language = t),
|
|
7
7
|
null != t && (t = t.toLowerCase()),
|
|
8
|
-
null != t && null ==
|
|
8
|
+
null != t && null == Pt[t])
|
|
9
9
|
) {
|
|
10
10
|
const e = t.indexOf("-");
|
|
11
11
|
e > 0 && (t = t.substring(0, e));
|
|
12
12
|
}
|
|
13
|
-
if (null ==
|
|
13
|
+
if (null == Pt[t]) {
|
|
14
14
|
const a =
|
|
15
15
|
"Braze does not yet have a localization for language " +
|
|
16
16
|
t +
|
|
@@ -20,9 +20,9 @@ export default class jr {
|
|
|
20
20
|
this.language = t;
|
|
21
21
|
}
|
|
22
22
|
get(t) {
|
|
23
|
-
return
|
|
23
|
+
return Pt[this.language][t];
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
ga() {
|
|
26
26
|
switch (this.language) {
|
|
27
27
|
case "ar":
|
|
28
28
|
case "he":
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { STORAGE_KEYS as s } from "./storage-manager.js";
|
|
2
2
|
import f from "./subscription-manager.js";
|
|
3
3
|
import { logger as b, IndexedDBAdapter as et } from "../../shared-lib/index.js";
|
|
4
|
-
export default class
|
|
4
|
+
export default class Vt {
|
|
5
5
|
constructor(t, i, s) {
|
|
6
6
|
(this.j = t),
|
|
7
7
|
(this.gh = i),
|