@braze/web-sdk 6.12.1 → 6.13.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 +240 -3
- package/package.json +1 -1
- package/shared-lib/event-types.js +18 -18
- package/shared-lib/indexed-db-adapter.js +58 -58
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +25 -24
- package/src/ConversationalChat/automatically-manage-chat.js +5 -0
- package/src/ConversationalChat/chat-message-factory.js +25 -0
- package/src/ConversationalChat/chat-message.js +33 -0
- package/src/ConversationalChat/constants.js +1 -0
- package/src/ConversationalChat/conversational-chat-provider-factory.js +26 -0
- package/src/ConversationalChat/conversational-chat-provider.js +372 -0
- package/src/ConversationalChat/display/chat-widget-manager.js +113 -0
- package/src/ConversationalChat/display/chat-widget-to-html.js +58 -0
- package/src/ConversationalChat/get-chat-messages.js +7 -0
- package/src/ConversationalChat/index.js +12 -0
- package/src/ConversationalChat/is-chat-conversation-ended.js +7 -0
- package/src/ConversationalChat/is-chat-turn-errored.js +7 -0
- package/src/ConversationalChat/is-chat-turn-in-progress.js +7 -0
- package/src/ConversationalChat/register-chat-action-handler.js +10 -0
- package/src/ConversationalChat/reset-chat-conversation.js +5 -0
- package/src/ConversationalChat/retrieve-chat-config.js +7 -0
- package/src/ConversationalChat/send-chat-message.js +17 -0
- package/src/ConversationalChat/subscribe-to-chat-action.js +5 -0
- package/src/ConversationalChat/subscribe-to-chat-conversation-updated.js +5 -0
- package/src/ConversationalChat/subscribe-to-chat-message-received.js +5 -0
- package/src/ConversationalChat/trigger-chat-action.js +11 -0
- package/src/ConversationalChat/types.js +1 -0
- package/src/Core/add-sdk-metadata.js +5 -5
- package/src/Core/change-user.js +6 -6
- package/src/Core/disable-sdk.js +6 -6
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/handle-braze-action.js +20 -13
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/is-initialized.js +1 -1
- package/src/Core/log-custom-event.js +9 -9
- package/src/Core/log-ecommerce-event.js +4 -4
- package/src/Core/log-purchase.js +14 -14
- package/src/Core/open-session.js +8 -8
- package/src/Core/set-sdk-authentication-signature.js +3 -3
- package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -1
- package/src/Core/wipe-data.js +1 -1
- package/src/DUST/dust-config-store.js +35 -35
- package/src/DUST/dust-message-dedup.js +3 -3
- package/src/DUST/dust-provider-factory.js +10 -10
- package/src/DUST/dust-provider.js +234 -234
- package/src/DUST/subscribe-to-dust.js +7 -7
- package/src/FeatureFlags/feature-flag-factory.js +2 -2
- package/src/FeatureFlags/feature-flag.js +4 -4
- package/src/FeatureFlags/feature-flags-provider-factory.js +11 -11
- package/src/FeatureFlags/feature-flags-provider.js +38 -38
- package/src/FeatureFlags/get-all-feature-flags.js +3 -3
- package/src/FeatureFlags/get-feature-flag.js +3 -3
- package/src/FeatureFlags/log-feature-flag-impression.js +4 -4
- package/src/FeatureFlags/refresh-feature-flags.js +5 -5
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +3 -3
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-display-utils.js +4 -4
- package/src/InAppMessage/display/html-message-to-html.js +13 -13
- package/src/InAppMessage/display/in-app-message-to-html.js +20 -20
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/in-app-message-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager.js +92 -92
- package/src/InAppMessage/log-in-app-message-button-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-click.js +7 -7
- package/src/InAppMessage/log-in-app-message-html-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-impression.js +3 -3
- package/src/InAppMessage/models/full-screen-message.js +39 -39
- package/src/InAppMessage/models/html-message.js +20 -20
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +102 -102
- package/src/InAppMessage/models/modal-message.js +38 -38
- package/src/InAppMessage/models/slide-up-message.js +34 -34
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- 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/remove-all-visible-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +23 -23
- 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 +15 -15
- package/src/Push/push-manager.js +13 -13
- package/src/Push/register-push.js +2 -2
- package/src/Push/request-push-permission.js +2 -2
- package/src/Push/unregister-push-token-on-server.js +3 -3
- package/src/Push/unregister-push.js +3 -3
- package/src/Push/utils/push-utils.js +15 -15
- package/src/User/user-manager.js +9 -9
- package/src/User/user.js +50 -50
- package/src/common/constants.js +1 -1
- package/src/common/content-cards-display.js +22 -22
- package/src/common/event-logger.js +3 -3
- package/src/index.js +2 -9
- package/src/l10n/l10n-manager-factory.js +4 -4
- package/src/l10n/l10n-manager.js +6 -6
- package/src/managers/auth-manager.js +28 -28
- package/src/managers/braze-action-manager.js +14 -0
- package/src/managers/braze-instance.js +159 -151
- package/src/managers/device-manager.js +26 -26
- package/src/managers/network-manager.js +120 -120
- package/src/managers/server-config-manager.js +95 -86
- package/src/managers/session-manager.js +25 -25
- package/src/managers/storage-manager-factory.js +12 -12
- package/src/managers/storage-manager.js +129 -124
- package/src/managers/subscription-manager.js +8 -8
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +5 -5
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +8 -8
- package/src/models/push-token.js +6 -6
- package/src/models/request-result.js +2 -2
- package/src/models/server-config.js +27 -27
- package/src/request-controller.js +117 -117
- package/src/standard-index.js +9 -0
- package/src/triggers/models/custom-event-data.js +4 -4
- package/src/triggers/models/custom-event-property-data.js +5 -5
- package/src/triggers/models/filter-set.js +5 -5
- package/src/triggers/models/filter.js +31 -31
- package/src/triggers/models/in-app-message-click-data.js +9 -9
- 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 +4 -4
- package/src/triggers/models/trigger-condition.js +35 -35
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +36 -36
- package/src/triggers/triggers-provider-factory.js +5 -5
- package/src/triggers/triggers-provider.js +128 -128
- package/src/types.js +2 -2
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/chat-widget-css.js +11 -0
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +7 -7
- package/src/util/braze-actions.js +5 -5
- package/src/util/browser-detector.js +41 -41
- package/src/util/client-hints-parser.js +10 -10
- package/src/util/component-utils.js +1 -1
- package/src/util/date-utils.js +2 -2
- package/src/util/device-constants.js +5 -5
- package/src/util/dom-utils.js +8 -8
- package/src/util/ecommerce-event-validation.js +13 -13
- package/src/util/html-display-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +82 -44
- package/src/util/request-header-utils.js +26 -24
- package/src/util/user-agent-parser.js +21 -21
- package/src/util/validation-utils.js +29 -21
- package/src/util/window-utils.js +3 -3
package/src/User/user.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isArray as g,
|
|
3
|
-
isDate as
|
|
4
|
-
isObject as
|
|
5
|
-
validateValueIsFromEnum as
|
|
3
|
+
isDate as Kt,
|
|
4
|
+
isObject as Yt,
|
|
5
|
+
validateValueIsFromEnum as ra,
|
|
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
|
|
12
|
-
validateCustomProperties as
|
|
13
|
-
validateCustomString as
|
|
14
|
-
validatePropertyType as
|
|
15
|
-
validateStandardString as
|
|
9
|
+
isValidEmail as Vt,
|
|
10
|
+
validateCustomAttributeArrayType as Wt,
|
|
11
|
+
validateCustomAttributeKey as Qt,
|
|
12
|
+
validateCustomProperties as vt,
|
|
13
|
+
validateCustomString as jt,
|
|
14
|
+
validatePropertyType as Xt,
|
|
15
|
+
validateStandardString as or,
|
|
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 Zt } 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);
|
|
@@ -29,25 +29,25 @@ export default class User {
|
|
|
29
29
|
t(e);
|
|
30
30
|
}
|
|
31
31
|
addAlias(t, e) {
|
|
32
|
-
return !
|
|
32
|
+
return !or(t, "add alias", "the alias", !1) || t.length <= 0
|
|
33
33
|
? (b.error("addAlias requires a non-empty alias"), !1)
|
|
34
|
-
: !
|
|
34
|
+
: !or(e, "add alias", "the label", !1) || e.length <= 0
|
|
35
35
|
? (b.error("addAlias requires a non-empty label"), !1)
|
|
36
36
|
: this.Ru.Hu(t, e).lt;
|
|
37
37
|
}
|
|
38
38
|
setFirstName(t) {
|
|
39
39
|
return (
|
|
40
|
-
!!
|
|
40
|
+
!!or(t, "set first name", "the firstName", !0) &&
|
|
41
41
|
this.Ss.Bu("first_name", t)
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
setLastName(t) {
|
|
45
45
|
return (
|
|
46
|
-
!!
|
|
46
|
+
!!or(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 ||
|
|
50
|
+
return null === t || Vt(t)
|
|
51
51
|
? this.Ss.Bu("email", t)
|
|
52
52
|
: (b.error(
|
|
53
53
|
`Cannot set email address - "${t}" did not pass RFC-5322 validation.`,
|
|
@@ -59,7 +59,7 @@ export default class User {
|
|
|
59
59
|
"string" == typeof t && (t = t.toLowerCase()),
|
|
60
60
|
!(
|
|
61
61
|
null !== t &&
|
|
62
|
-
!
|
|
62
|
+
!ra(
|
|
63
63
|
User.Genders,
|
|
64
64
|
t,
|
|
65
65
|
`Gender "${t}" is not a valid gender.`,
|
|
@@ -92,22 +92,22 @@ export default class User {
|
|
|
92
92
|
}
|
|
93
93
|
setCountry(t) {
|
|
94
94
|
return (
|
|
95
|
-
!!
|
|
95
|
+
!!or(t, "set country", "the country", !0) && this.Ss.Bu("country", t)
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
setHomeCity(t) {
|
|
99
99
|
return (
|
|
100
|
-
!!
|
|
100
|
+
!!or(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
|
-
!!
|
|
105
|
+
!!or(t, "set language", "the language", !0) && this.Ss.Bu("language", t)
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
108
|
setEmailNotificationSubscriptionType(t) {
|
|
109
109
|
return (
|
|
110
|
-
!!
|
|
110
|
+
!!ra(
|
|
111
111
|
User.NotificationSubscriptionTypes,
|
|
112
112
|
t,
|
|
113
113
|
`Email notification setting "${t}" is not a valid subscription type.`,
|
|
@@ -117,7 +117,7 @@ export default class User {
|
|
|
117
117
|
}
|
|
118
118
|
setPushNotificationSubscriptionType(t) {
|
|
119
119
|
return (
|
|
120
|
-
!!
|
|
120
|
+
!!ra(
|
|
121
121
|
User.NotificationSubscriptionTypes,
|
|
122
122
|
t,
|
|
123
123
|
`Push notification setting "${t}" is not a valid subscription type.`,
|
|
@@ -127,7 +127,7 @@ export default class User {
|
|
|
127
127
|
}
|
|
128
128
|
setPhoneNumber(t) {
|
|
129
129
|
return (
|
|
130
|
-
!!
|
|
130
|
+
!!or(t, "set phone number", "the phoneNumber", !0) &&
|
|
131
131
|
(null === t || t.match(User.Ku)
|
|
132
132
|
? this.Ss.Bu("phone", t)
|
|
133
133
|
: (b.error(`Cannot set phone number - "${t}" did not pass validation.`),
|
|
@@ -168,9 +168,9 @@ export default class User {
|
|
|
168
168
|
.lt);
|
|
169
169
|
}
|
|
170
170
|
setCustomUserAttribute(t, e, r) {
|
|
171
|
-
if (
|
|
171
|
+
if (!Qt(t)) return !1;
|
|
172
172
|
const s = (e) => {
|
|
173
|
-
const [r] =
|
|
173
|
+
const [r] = vt(
|
|
174
174
|
e,
|
|
175
175
|
R.Mu,
|
|
176
176
|
"attribute value",
|
|
@@ -180,19 +180,19 @@ export default class User {
|
|
|
180
180
|
return r;
|
|
181
181
|
};
|
|
182
182
|
if (g(e)) {
|
|
183
|
-
const [r, n] =
|
|
183
|
+
const [r, n] = Wt(t, e);
|
|
184
184
|
if (!r && !n && 0 !== e.length) return !1;
|
|
185
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
|
-
} else if (
|
|
187
|
+
} else if (Yt(e)) {
|
|
188
188
|
if (!s(e)) return !1;
|
|
189
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 && Xt(e))) return !1;
|
|
192
192
|
if (
|
|
193
|
-
(
|
|
193
|
+
(Kt(e) && (e = Zt(e)),
|
|
194
194
|
"string" == typeof e &&
|
|
195
|
-
!
|
|
195
|
+
!jt(
|
|
196
196
|
e,
|
|
197
197
|
`set custom user attribute "${t}"`,
|
|
198
198
|
"the element in the given array",
|
|
@@ -204,26 +204,26 @@ export default class User {
|
|
|
204
204
|
}
|
|
205
205
|
addToCustomAttributeArray(t, e) {
|
|
206
206
|
return (
|
|
207
|
-
!!
|
|
207
|
+
!!jt(t, "add to custom user attribute array", "the given key") &&
|
|
208
208
|
!(
|
|
209
209
|
null != e &&
|
|
210
|
-
!
|
|
210
|
+
!jt(e, "add to custom user attribute array", "the given value")
|
|
211
211
|
) &&
|
|
212
212
|
this.Ru.Yu(p.Xu, t, e).lt
|
|
213
213
|
);
|
|
214
214
|
}
|
|
215
215
|
removeFromCustomAttributeArray(t, e) {
|
|
216
216
|
return (
|
|
217
|
-
!!
|
|
217
|
+
!!jt(t, "remove from custom user attribute array", "the given key") &&
|
|
218
218
|
!(
|
|
219
219
|
null != e &&
|
|
220
|
-
!
|
|
220
|
+
!jt(e, "remove from custom user attribute array", "the given value")
|
|
221
221
|
) &&
|
|
222
222
|
this.Ru.Yu(p.Zu, t, e).lt
|
|
223
223
|
);
|
|
224
224
|
}
|
|
225
225
|
incrementCustomUserAttribute(t, e) {
|
|
226
|
-
if (!
|
|
226
|
+
if (!jt(t, "increment custom user attribute", "the given key")) return !1;
|
|
227
227
|
null == e && (e = 1);
|
|
228
228
|
const r = parseInt(e.toString());
|
|
229
229
|
return isNaN(r) || r !== parseFloat(e.toString())
|
|
@@ -231,11 +231,11 @@ 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.Yu(p.
|
|
234
|
+
: this.Ru.Yu(p.Ya, t, r).lt;
|
|
235
235
|
}
|
|
236
236
|
setCustomLocationAttribute(t, e, r) {
|
|
237
237
|
return (
|
|
238
|
-
!!
|
|
238
|
+
!!jt(t, "set custom location attribute", "the given key") &&
|
|
239
239
|
((null !== e || null !== r) &&
|
|
240
240
|
((e = null != e ? parseFloat(e.toString()) : null),
|
|
241
241
|
(r = null != r ? parseFloat(r.toString()) : null),
|
|
@@ -247,11 +247,11 @@ 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.Va(t, e, r).lt)
|
|
251
251
|
);
|
|
252
252
|
}
|
|
253
253
|
addToSubscriptionGroup(t) {
|
|
254
|
-
return !
|
|
254
|
+
return !or(
|
|
255
255
|
t,
|
|
256
256
|
"add user to subscription group",
|
|
257
257
|
"subscription group ID",
|
|
@@ -261,10 +261,10 @@ export default class User {
|
|
|
261
261
|
"addToSubscriptionGroup requires a non-empty subscription group ID",
|
|
262
262
|
),
|
|
263
263
|
!1)
|
|
264
|
-
: this.Ru.
|
|
264
|
+
: this.Ru.Wa(t, User.Qa.SUBSCRIBED).lt;
|
|
265
265
|
}
|
|
266
266
|
removeFromSubscriptionGroup(t) {
|
|
267
|
-
return !
|
|
267
|
+
return !or(
|
|
268
268
|
t,
|
|
269
269
|
"remove user from subscription group",
|
|
270
270
|
"subscription group ID",
|
|
@@ -274,21 +274,21 @@ export default class User {
|
|
|
274
274
|
"removeFromSubscriptionGroup requires a non-empty subscription group ID",
|
|
275
275
|
),
|
|
276
276
|
!1)
|
|
277
|
-
: this.Ru.
|
|
277
|
+
: this.Ru.Wa(t, User.Qa.UNSUBSCRIBED).lt;
|
|
278
278
|
}
|
|
279
279
|
setLineId(t) {
|
|
280
|
-
return
|
|
280
|
+
return or(t, "set LINE user ID", "the ID", !0) &&
|
|
281
281
|
0 !== (null == t ? void 0 : t.length)
|
|
282
|
-
? t && t.length > User.
|
|
282
|
+
? t && t.length > User.Za
|
|
283
283
|
? (b.error(
|
|
284
|
-
`Rejected LINE user ID ${t} because it is longer than ${User.
|
|
284
|
+
`Rejected LINE user ID ${t} because it is longer than ${User.Za} characters.`,
|
|
285
285
|
),
|
|
286
286
|
!1)
|
|
287
287
|
: this.Ss.Bu("native_line_id", t)
|
|
288
288
|
: (b.error("setLineId requires a non-empty ID"), !1);
|
|
289
289
|
}
|
|
290
290
|
yu(t, e, r, s, n) {
|
|
291
|
-
this.Ss.yu(t, e, r, s, n), this.Ru.
|
|
291
|
+
this.Ss.yu(t, e, r, s, n), this.Ru.el();
|
|
292
292
|
}
|
|
293
293
|
wu(t) {
|
|
294
294
|
this.Ss.wu(t);
|
|
@@ -308,8 +308,8 @@ export default class User {
|
|
|
308
308
|
UNSUBSCRIBED: "unsubscribed",
|
|
309
309
|
}),
|
|
310
310
|
(User.Ku = /^[0-9 .\\(\\)\\+\\-]+$/),
|
|
311
|
-
(User.
|
|
312
|
-
(User.
|
|
311
|
+
(User.Qa = { SUBSCRIBED: "subscribed", UNSUBSCRIBED: "unsubscribed" }),
|
|
312
|
+
(User.rl = "user_id"),
|
|
313
313
|
(User.Eu = "custom"),
|
|
314
|
-
(User.
|
|
315
|
-
(User.
|
|
314
|
+
(User.Ur = 997),
|
|
315
|
+
(User.Za = 33);
|
package/src/common/constants.js
CHANGED
|
@@ -11,7 +11,7 @@ export const REQUEST_BACKOFF_SCALE_FACTOR_DEFAULT = 3;
|
|
|
11
11
|
export const REQUEST_BACKOFF_MAX_SLEEP_MS_DEFAULT = 3e5;
|
|
12
12
|
export const CoreStrings = {
|
|
13
13
|
ee: "Braze must be initialized before calling methods.",
|
|
14
|
-
|
|
14
|
+
$e: "logCustomEvent",
|
|
15
15
|
QE: "logEcommerceEvent",
|
|
16
16
|
Mu: "setCustomUserAttribute",
|
|
17
17
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
getCardId as
|
|
3
|
-
markCardAsRead as
|
|
2
|
+
getCardId as Ce,
|
|
3
|
+
markCardAsRead as ye,
|
|
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 xe } from "../Card/display/card-display.js";
|
|
8
8
|
import { isArray as g } from "../util/code-utils.js";
|
|
9
9
|
import { KeyCodes as le } from "../util/key-codes.js";
|
|
10
10
|
import he from "../l10n/l10n-manager-factory.js";
|
|
@@ -12,16 +12,16 @@ 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
|
|
17
|
-
getDecodedBrazeAction as
|
|
18
|
-
containsUnknownBrazeAction as
|
|
15
|
+
INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as Rt,
|
|
16
|
+
ineligibleBrazeActionURLErrorMessage as zt,
|
|
17
|
+
getDecodedBrazeAction as ro,
|
|
18
|
+
containsUnknownBrazeAction as St,
|
|
19
19
|
} from "../util/braze-actions.js";
|
|
20
20
|
import {
|
|
21
|
-
bottomHadImpression as
|
|
21
|
+
bottomHadImpression as Ee,
|
|
22
22
|
impressOnBottom as $,
|
|
23
23
|
impressOnTop as B,
|
|
24
|
-
topHadImpression as
|
|
24
|
+
topHadImpression as Ie,
|
|
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";
|
|
@@ -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(xe(a, r, e, n.Ca())), (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
|
);
|
|
@@ -82,17 +82,17 @@ export function detectContentCardsImpressions(t, e) {
|
|
|
82
82
|
if (null != t && null != e) {
|
|
83
83
|
const n = [],
|
|
84
84
|
o = e.querySelectorAll(".ab-card");
|
|
85
|
-
t.
|
|
85
|
+
t.nl || (t.nl = {});
|
|
86
86
|
for (let e = 0; e < o.length; e++) {
|
|
87
|
-
const s =
|
|
87
|
+
const s = Ce(o[e]),
|
|
88
88
|
r = k(o[e]),
|
|
89
89
|
a = q(o[e]);
|
|
90
|
-
if (t.
|
|
91
|
-
r || a ||
|
|
90
|
+
if (t.nl[s]) {
|
|
91
|
+
r || a || ye(o[e]);
|
|
92
92
|
continue;
|
|
93
93
|
}
|
|
94
|
-
let i =
|
|
95
|
-
l =
|
|
94
|
+
let i = Ie(o[e]),
|
|
95
|
+
l = Ee(o[e]);
|
|
96
96
|
const d = i,
|
|
97
97
|
c = l;
|
|
98
98
|
if (
|
|
@@ -101,7 +101,7 @@ export function detectContentCardsImpressions(t, e) {
|
|
|
101
101
|
if (d && c) continue;
|
|
102
102
|
for (const e of t.cards)
|
|
103
103
|
if (e.id === s) {
|
|
104
|
-
(t.
|
|
104
|
+
(t.nl[e.id] = !0), n.push(e);
|
|
105
105
|
break;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -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 !== le.
|
|
156
|
+
(t.keyCode !== le.qo && 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 !== le.
|
|
169
|
+
(t.keyCode !== le.qo && t.keyCode !== le.Lo) || l(t);
|
|
170
170
|
}),
|
|
171
171
|
(i.onclick = l),
|
|
172
172
|
s.appendChild(i),
|
|
@@ -186,9 +186,9 @@ export function updateContentCards(t, e, n, o, s) {
|
|
|
186
186
|
for (const t of e)
|
|
187
187
|
if (t instanceof Card) {
|
|
188
188
|
if (t.url && to.test(t.url)) {
|
|
189
|
-
const e =
|
|
190
|
-
if (
|
|
191
|
-
b.error(
|
|
189
|
+
const e = ro(t.url);
|
|
190
|
+
if (St(e)) {
|
|
191
|
+
b.error(zt(Rt.ya, "Content Card"));
|
|
192
192
|
continue;
|
|
193
193
|
}
|
|
194
194
|
}
|
|
@@ -14,9 +14,9 @@ const v = {
|
|
|
14
14
|
),
|
|
15
15
|
i
|
|
16
16
|
);
|
|
17
|
-
const d = l.
|
|
17
|
+
const d = l.ol();
|
|
18
18
|
return (
|
|
19
|
-
i.
|
|
19
|
+
i.Ne.push(
|
|
20
20
|
new ve(
|
|
21
21
|
t || (null === (n = r.ir()) || void 0 === n ? void 0 : n.getUserId()),
|
|
22
22
|
e,
|
|
@@ -26,7 +26,7 @@ const v = {
|
|
|
26
26
|
),
|
|
27
27
|
),
|
|
28
28
|
(i.lt =
|
|
29
|
-
(null === (s = r.p()) || void 0 === s ? void 0 : s.
|
|
29
|
+
(null === (s = r.p()) || void 0 === s ? void 0 : s.ll(i.Ne)) || !1),
|
|
30
30
|
i
|
|
31
31
|
);
|
|
32
32
|
},
|
package/src/index.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./Core/index.js";
|
|
4
|
-
export * from "./InAppMessage/index.js";
|
|
5
|
-
export * from "./Push/index.js";
|
|
6
|
-
export * from "./User/index.js";
|
|
7
|
-
export * from "./FeatureFlags/index.js";
|
|
8
|
-
export * from "./Banner/index.js";
|
|
9
|
-
export { WindowUtils } from "./util/window-utils.js";
|
|
1
|
+
export * from "./standard-index.js";
|
|
2
|
+
export * from "./ConversationalChat/index.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import r, { OPTIONS as U } from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import eo from "../util/browser-detector.js";
|
|
3
|
+
import br from "./l10n-manager.js";
|
|
4
4
|
const he = {
|
|
5
5
|
i: !1,
|
|
6
6
|
na: null,
|
|
7
7
|
ra: () => {
|
|
8
8
|
if ((he.t(), !he.na)) {
|
|
9
|
-
let e =
|
|
9
|
+
let e = eo.language,
|
|
10
10
|
t = !1;
|
|
11
|
-
r.er(U.
|
|
11
|
+
r.er(U.al) && ((e = r.er(U.al)), (t = !0)), (he.na = new br(e, t));
|
|
12
12
|
}
|
|
13
13
|
return he.na;
|
|
14
14
|
},
|
package/src/l10n/l10n-manager.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { logger as b } from "../../shared-lib/index.js";
|
|
2
|
-
import
|
|
3
|
-
export default class
|
|
2
|
+
import ze from "../common/translations.js";
|
|
3
|
+
export default class br {
|
|
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 == ze[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 == ze[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 ze[this.language][t];
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
Ca() {
|
|
26
26
|
switch (this.language) {
|
|
27
27
|
case "ar":
|
|
28
28
|
case "he":
|
|
@@ -1,51 +1,51 @@
|
|
|
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 mi {
|
|
5
5
|
constructor(t, i, s) {
|
|
6
6
|
(this.j = t),
|
|
7
|
-
(this.
|
|
8
|
-
(this.
|
|
7
|
+
(this.tc = i),
|
|
8
|
+
(this.sc = s),
|
|
9
9
|
(this.j = t),
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
12
|
-
(this.
|
|
13
|
-
(this.
|
|
14
|
-
(this.
|
|
10
|
+
(this.tc = i || !1),
|
|
11
|
+
(this.sc = s),
|
|
12
|
+
(this.ec = new f()),
|
|
13
|
+
(this.rc = 0),
|
|
14
|
+
(this.nc = 1);
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
return this.
|
|
16
|
+
hc() {
|
|
17
|
+
return this.tc;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
return this.j.St(s.It.
|
|
19
|
+
uc() {
|
|
20
|
+
return this.j.St(s.It.oc);
|
|
21
21
|
}
|
|
22
22
|
setSdkAuthenticationSignature(t) {
|
|
23
|
-
const i = this.
|
|
24
|
-
this.j.Pt(s.It.
|
|
23
|
+
const i = this.uc();
|
|
24
|
+
this.j.Pt(s.It.oc, t);
|
|
25
25
|
const e = et._s.Xs;
|
|
26
|
-
new et(e, b).setItem(e.Ws.
|
|
26
|
+
new et(e, b).setItem(e.Ws.ac, this.nc, t), i !== t && this.ct();
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
this.j.Vt(s.It.
|
|
28
|
+
cc() {
|
|
29
|
+
this.j.Vt(s.It.oc);
|
|
30
30
|
const t = et._s.Xs;
|
|
31
|
-
new et(t, b).
|
|
31
|
+
new et(t, b).Ae(t.Ws.ac, this.nc);
|
|
32
32
|
}
|
|
33
33
|
subscribeToSdkAuthenticationFailures(t) {
|
|
34
|
-
return this.
|
|
34
|
+
return this.sc.Ut(t);
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
this.
|
|
36
|
+
mc(t) {
|
|
37
|
+
this.sc.A(t);
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
this.
|
|
39
|
+
gc() {
|
|
40
|
+
this.ec.removeAllSubscriptions();
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
this.
|
|
42
|
+
lc() {
|
|
43
|
+
this.rc += 1;
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
return this.
|
|
45
|
+
bc() {
|
|
46
|
+
return this.rc;
|
|
47
47
|
}
|
|
48
48
|
ct() {
|
|
49
|
-
this.
|
|
49
|
+
this.rc = 0;
|
|
50
50
|
}
|
|
51
51
|
}
|