@braze/web-sdk 6.12.0 → 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 +27 -24
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Oe from "./base-device-parser.js";
|
|
2
|
-
import { Browsers as
|
|
3
|
-
export default class
|
|
2
|
+
import { Browsers as Bi } from "./device-constants.js";
|
|
3
|
+
export default class yi extends Oe {
|
|
4
4
|
constructor() {
|
|
5
5
|
if (
|
|
6
6
|
(super(),
|
|
@@ -9,23 +9,23 @@ export default class Si extends Oe {
|
|
|
9
9
|
(this.version = null),
|
|
10
10
|
this.userAgentData)
|
|
11
11
|
) {
|
|
12
|
-
const t = this.
|
|
12
|
+
const t = this.hf();
|
|
13
13
|
(this.browser = t.browser || "Unknown Browser"),
|
|
14
14
|
(this.version = t.version || "Unknown Version");
|
|
15
15
|
}
|
|
16
16
|
this.OS = null;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
ff() {
|
|
19
19
|
return this.browser;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
cf() {
|
|
22
22
|
return this.version;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
jc(t) {
|
|
25
25
|
if (this.OS) return Promise.resolve(this.OS);
|
|
26
26
|
const s = (s) => {
|
|
27
27
|
for (let r = 0; r < t.length; r++) {
|
|
28
|
-
const i =
|
|
28
|
+
const i = yi.lf(s, t[r]);
|
|
29
29
|
if (i) return (this.OS = i), this.OS;
|
|
30
30
|
}
|
|
31
31
|
return s;
|
|
@@ -36,12 +36,12 @@ export default class Si extends Oe {
|
|
|
36
36
|
.then((t) => (t.platform ? s(t.platform) : navigator.platform))
|
|
37
37
|
.catch(() => navigator.platform);
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
hf() {
|
|
40
40
|
const t = {},
|
|
41
41
|
s = this.userAgentData.brands;
|
|
42
42
|
if (s && s.length)
|
|
43
43
|
for (const r of s) {
|
|
44
|
-
const s = this.
|
|
44
|
+
const s = this.af(Bi),
|
|
45
45
|
i = r.brand.match(s);
|
|
46
46
|
if (i && i.length > 0) {
|
|
47
47
|
(t.browser = i[0]), (t.version = r.version);
|
|
@@ -50,7 +50,7 @@ export default class Si extends Oe {
|
|
|
50
50
|
}
|
|
51
51
|
return t;
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
af(t) {
|
|
54
54
|
const s = [];
|
|
55
55
|
for (const r in t) {
|
|
56
56
|
const i = r;
|
|
@@ -16,7 +16,7 @@ export function createCloseButton(t, o, e, r = "ltr") {
|
|
|
16
16
|
n.appendChild(l),
|
|
17
17
|
l.setAttribute("aria-hidden", "true"),
|
|
18
18
|
n.addEventListener("keydown", (t) => {
|
|
19
|
-
(t.keyCode !== le.
|
|
19
|
+
(t.keyCode !== le.qo && t.keyCode !== le.Lo) ||
|
|
20
20
|
(e(), t.stopPropagation());
|
|
21
21
|
}),
|
|
22
22
|
(n.onclick = (t) => {
|
package/src/util/date-utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isDate as
|
|
1
|
+
import { isDate as Kt } from "./code-utils.js";
|
|
2
2
|
export function convertMsToSeconds(e, n = !1) {
|
|
3
3
|
let t = e / 1e3;
|
|
4
4
|
return n && (t = Math.floor(t)), t;
|
|
@@ -12,7 +12,7 @@ export function dateFromUnixTimestamp(e) {
|
|
|
12
12
|
return isNaN(n) ? null : new Date(1e3 * n);
|
|
13
13
|
}
|
|
14
14
|
export function toValidBackendTimeString(e) {
|
|
15
|
-
return null != e &&
|
|
15
|
+
return null != e && Kt(e) ? e.toISOString().replace(/\.[0-9]{3}Z$/, "") : e;
|
|
16
16
|
}
|
|
17
17
|
export function rehydrateDateAfterJsonization(e) {
|
|
18
18
|
return null == e || "" === e ? null : new Date(e);
|
|
@@ -2,13 +2,13 @@ export const Browsers = {
|
|
|
2
2
|
rO: "Chrome",
|
|
3
3
|
eO: "Edge",
|
|
4
4
|
oO: "Opera",
|
|
5
|
-
|
|
5
|
+
Og: "Safari",
|
|
6
6
|
OO: "Firefox",
|
|
7
7
|
Sg: "ChatGPTBrowser",
|
|
8
8
|
};
|
|
9
9
|
export const OperatingSystems = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
Fg: "Android",
|
|
11
|
+
ao: "iOS",
|
|
12
|
+
Cg: "Mac",
|
|
13
|
+
Wg: "Windows",
|
|
14
14
|
};
|
package/src/util/dom-utils.js
CHANGED
|
@@ -18,15 +18,15 @@ export function _isInView(t, n = !1, e = !1, s = !1) {
|
|
|
18
18
|
!s)
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
|
-
export const DOMUtils = {
|
|
22
|
-
export const DIRECTIONS = {
|
|
21
|
+
export const DOMUtils = { lp: null, td: _isInView };
|
|
22
|
+
export const DIRECTIONS = { No: "up", Po: "down", ie: "left", ne: "right" };
|
|
23
23
|
export function supportsPassive() {
|
|
24
|
-
if (null == DOMUtils.
|
|
25
|
-
DOMUtils.
|
|
24
|
+
if (null == DOMUtils.lp) {
|
|
25
|
+
DOMUtils.lp = !1;
|
|
26
26
|
try {
|
|
27
27
|
const t = Object.defineProperty({}, "passive", {
|
|
28
28
|
get: () => {
|
|
29
|
-
DOMUtils.
|
|
29
|
+
DOMUtils.lp = !0;
|
|
30
30
|
},
|
|
31
31
|
});
|
|
32
32
|
window.addEventListener("testPassive", () => {}, t),
|
|
@@ -35,7 +35,7 @@ export function supportsPassive() {
|
|
|
35
35
|
b.error(ci(t));
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
return DOMUtils.
|
|
38
|
+
return DOMUtils.lp;
|
|
39
39
|
}
|
|
40
40
|
export function addPassiveEventListener(t, n, e = () => {}) {
|
|
41
41
|
t.addEventListener(n, e, !!supportsPassive() && { passive: !0 });
|
|
@@ -69,9 +69,9 @@ export function detectSwipe(t, n, e) {
|
|
|
69
69
|
(i = null))
|
|
70
70
|
: Math.abs(u) >= 25 &&
|
|
71
71
|
(((u > 0 &&
|
|
72
|
-
n === DIRECTIONS.
|
|
72
|
+
n === DIRECTIONS.No &&
|
|
73
73
|
t.scrollTop === t.scrollHeight - t.offsetHeight) ||
|
|
74
|
-
(u < 0 && n === DIRECTIONS.
|
|
74
|
+
(u < 0 && n === DIRECTIONS.Po && 0 === t.scrollTop)) &&
|
|
75
75
|
e(o),
|
|
76
76
|
(s = null),
|
|
77
77
|
(i = null));
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { logger as b } from "../../shared-lib/index.js";
|
|
2
|
-
import { isValidIso4217CurrencyCode as
|
|
2
|
+
import { isValidIso4217CurrencyCode as ur } from "./iso-4217-currency-codes.js";
|
|
3
3
|
import { CoreStrings as R } from "../common/constants.js";
|
|
4
4
|
import { CartUpdatedActions as un } from "../types.js";
|
|
5
5
|
import {
|
|
6
6
|
isArray as g,
|
|
7
|
-
isObject as
|
|
8
|
-
validateValueIsFromEnum as
|
|
7
|
+
isObject as Yt,
|
|
8
|
+
validateValueIsFromEnum as ra,
|
|
9
9
|
} from "./code-utils.js";
|
|
10
10
|
import {
|
|
11
|
-
validateCustomProperties as
|
|
12
|
-
validateCustomString as
|
|
11
|
+
validateCustomProperties as vt,
|
|
12
|
+
validateCustomString as jt,
|
|
13
13
|
} from "./validation-utils.js";
|
|
14
14
|
const ln = "log eCommerce event";
|
|
15
15
|
function dn(n, t, e) {
|
|
@@ -26,7 +26,7 @@ function dn(n, t, e) {
|
|
|
26
26
|
!1)
|
|
27
27
|
: n.length > 255
|
|
28
28
|
? (b.error(`Cannot ${ln} because ${t} must be at most 255 characters.`), !1)
|
|
29
|
-
: !!
|
|
29
|
+
: !!jt(n, ln, t) && n;
|
|
30
30
|
}
|
|
31
31
|
function mn(n, t) {
|
|
32
32
|
return "number" != typeof n || isNaN(n) || !isFinite(n)
|
|
@@ -75,7 +75,7 @@ function yn(n, t, e) {
|
|
|
75
75
|
}
|
|
76
76
|
return !0;
|
|
77
77
|
}
|
|
78
|
-
if (!
|
|
78
|
+
if (!Yt(n)) return !0;
|
|
79
79
|
const r = n;
|
|
80
80
|
for (const n in r) {
|
|
81
81
|
if (!Object.prototype.hasOwnProperty.call(r, n)) continue;
|
|
@@ -103,7 +103,7 @@ function $n(n, t) {
|
|
|
103
103
|
}
|
|
104
104
|
function vn(n, t) {
|
|
105
105
|
if (null == n) return;
|
|
106
|
-
const [e, r] =
|
|
106
|
+
const [e, r] = vt(n, R.QE, "metadata", ln, t);
|
|
107
107
|
return !!e && !(null != r && !yn(r, t, 0)) && r;
|
|
108
108
|
}
|
|
109
109
|
function gn(n) {
|
|
@@ -169,7 +169,7 @@ function jn(n) {
|
|
|
169
169
|
!1
|
|
170
170
|
);
|
|
171
171
|
const t = n.toUpperCase();
|
|
172
|
-
return
|
|
172
|
+
return ur(t)
|
|
173
173
|
? t
|
|
174
174
|
: (b.error(
|
|
175
175
|
`${R.QE} requires a valid ISO 4217 currency code, got "${n}". Ignoring event.`,
|
|
@@ -215,7 +215,7 @@ function qn(n) {
|
|
|
215
215
|
const r = dn(e.code, "metadata.presentment_currency.code", !1);
|
|
216
216
|
if ("string" != typeof r) return !1;
|
|
217
217
|
const u = r.toUpperCase();
|
|
218
|
-
return
|
|
218
|
+
return ur(u)
|
|
219
219
|
? ((e.code = u), !0)
|
|
220
220
|
: (b.error(
|
|
221
221
|
`${R.QE} requires a valid ISO 4217 currency code, got "${r}". Ignoring event.`,
|
|
@@ -228,7 +228,7 @@ function En(n, t) {
|
|
|
228
228
|
null == n.action
|
|
229
229
|
? un.REPLACE
|
|
230
230
|
: ((u = n.action),
|
|
231
|
-
!!
|
|
231
|
+
!!ra(
|
|
232
232
|
un,
|
|
233
233
|
u,
|
|
234
234
|
`Cannot ${ln} because action is invalid.`,
|
|
@@ -237,7 +237,7 @@ function En(n, t) {
|
|
|
237
237
|
var u;
|
|
238
238
|
const o = Cn(n.products);
|
|
239
239
|
if (!1 === e || !1 === r || null == o) return null;
|
|
240
|
-
const c = r === un.
|
|
240
|
+
const c = r === un.ap || r === un.dp,
|
|
241
241
|
a = null == n.total_value && c ? void 0 : pn(n.total_value, "total_value");
|
|
242
242
|
if (!1 === a) return null;
|
|
243
243
|
const i = {
|
|
@@ -349,7 +349,7 @@ export function sanitizeEcommerceEvent(n) {
|
|
|
349
349
|
return (
|
|
350
350
|
b.error(`Cannot ${ln} because discounts must be an array.`), null
|
|
351
351
|
);
|
|
352
|
-
const [t, e] =
|
|
352
|
+
const [t, e] = vt(
|
|
353
353
|
{ discounts: n.discounts },
|
|
354
354
|
R.QE,
|
|
355
355
|
"discounts",
|
|
@@ -10,7 +10,7 @@ export const buildBrazeBridge = (t, e) => {
|
|
|
10
10
|
return function () {
|
|
11
11
|
const t = arguments;
|
|
12
12
|
import("../Push/request-push-permission.js").then((e) => {
|
|
13
|
-
r.
|
|
13
|
+
r.vr()
|
|
14
14
|
? e.requestPushPermission(...Array.prototype.slice.call(t))
|
|
15
15
|
: b.error(R.ee);
|
|
16
16
|
});
|
|
@@ -21,7 +21,7 @@ export const buildBrazeBridge = (t, e) => {
|
|
|
21
21
|
const t = arguments;
|
|
22
22
|
import("../Core/request-immediate-data-flush.js").then(
|
|
23
23
|
({ requestImmediateDataFlush: requestImmediateDataFlush }) => {
|
|
24
|
-
r.
|
|
24
|
+
r.vr()
|
|
25
25
|
? requestImmediateDataFlush(...Array.prototype.slice.call(t))
|
|
26
26
|
: b.error(R.ee);
|
|
27
27
|
},
|
|
@@ -31,7 +31,7 @@ export const buildBrazeBridge = (t, e) => {
|
|
|
31
31
|
const t = arguments;
|
|
32
32
|
import("../Core/log-custom-event.js").then(
|
|
33
33
|
({ logCustomEvent: logCustomEvent }) => {
|
|
34
|
-
if (!r.
|
|
34
|
+
if (!r.vr()) return void b.error(R.ee);
|
|
35
35
|
logCustomEvent(...Array.prototype.slice.call(t));
|
|
36
36
|
},
|
|
37
37
|
);
|
|
@@ -40,7 +40,7 @@ export const buildBrazeBridge = (t, e) => {
|
|
|
40
40
|
const t = arguments;
|
|
41
41
|
import("../Core/log-purchase.js").then(
|
|
42
42
|
({ logPurchase: logPurchase }) => {
|
|
43
|
-
if (!r.
|
|
43
|
+
if (!r.vr()) return void b.error(R.ee);
|
|
44
44
|
logPurchase(...Array.prototype.slice.call(t));
|
|
45
45
|
},
|
|
46
46
|
);
|
|
@@ -49,7 +49,7 @@ export const buildBrazeBridge = (t, e) => {
|
|
|
49
49
|
const t = arguments;
|
|
50
50
|
import("../Push/unregister-push.js").then(
|
|
51
51
|
({ unregisterPush: unregisterPush }) => {
|
|
52
|
-
r.
|
|
52
|
+
r.vr()
|
|
53
53
|
? unregisterPush(...Array.prototype.slice.call(t))
|
|
54
54
|
: b.error(R.ee);
|
|
55
55
|
},
|
|
@@ -59,7 +59,7 @@ export const buildBrazeBridge = (t, e) => {
|
|
|
59
59
|
changeUser: function () {
|
|
60
60
|
const t = arguments;
|
|
61
61
|
import("../Core/change-user.js").then(({ changeUser: changeUser }) => {
|
|
62
|
-
if (!r.
|
|
62
|
+
if (!r.vr()) return void b.error(R.ee);
|
|
63
63
|
changeUser(...Array.prototype.slice.call(t));
|
|
64
64
|
});
|
|
65
65
|
},
|
package/src/util/key-codes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const KeyCodes = {
|
|
1
|
+
export const KeyCodes = { qo: 32, Qo: 9, Lo: 13, Yh: 27 };
|
package/src/util/net.js
CHANGED
|
@@ -1,55 +1,93 @@
|
|
|
1
1
|
import { logger as b } from "../../shared-lib/index.js";
|
|
2
2
|
import Re from "../models/backend-errors.js";
|
|
3
3
|
import { getErrorMessage as ci } from "./error-utils.js";
|
|
4
|
+
function Xe(t, e, o, r, n) {
|
|
5
|
+
let s = !1;
|
|
6
|
+
if ((window.XMLHttpRequest && (s = !0), !s))
|
|
7
|
+
return (
|
|
8
|
+
b.error("This browser does not have any supported ajax options!"), null
|
|
9
|
+
);
|
|
10
|
+
const f = new XMLHttpRequest();
|
|
11
|
+
(f.onload = () => {
|
|
12
|
+
let t = !1;
|
|
13
|
+
if (4 !== f.readyState) return;
|
|
14
|
+
t = (f.status >= 200 && f.status < 300) || 304 === f.status;
|
|
15
|
+
const e = f.getAllResponseHeaders();
|
|
16
|
+
t ? r(f, e) : n(f, e);
|
|
17
|
+
}),
|
|
18
|
+
(f.onerror = () => {
|
|
19
|
+
n(f, f.getAllResponseHeaders());
|
|
20
|
+
}),
|
|
21
|
+
(f.ontimeout = () => {
|
|
22
|
+
n(f);
|
|
23
|
+
}),
|
|
24
|
+
f.open(t, e, !0),
|
|
25
|
+
"POST" === t &&
|
|
26
|
+
(f.setRequestHeader("Content-type", "application/json"),
|
|
27
|
+
f.setRequestHeader("X-Requested-With", "XMLHttpRequest"));
|
|
28
|
+
const i = o || [];
|
|
29
|
+
for (const t of i) f.setRequestHeader(t[0], t[1]);
|
|
30
|
+
return f;
|
|
31
|
+
}
|
|
4
32
|
const l = {
|
|
5
33
|
ot: (t) => {
|
|
6
34
|
let e, o;
|
|
7
35
|
try {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
o = JSON.parse(e.responseText);
|
|
28
|
-
} catch (o) {
|
|
29
|
-
const n = {
|
|
30
|
-
error: "" === e.responseText ? Re.Ha : Re.Wa,
|
|
31
|
-
response: e.responseText,
|
|
32
|
-
};
|
|
33
|
-
(0, t.lt)(n, r);
|
|
36
|
+
if (
|
|
37
|
+
((e = Xe(
|
|
38
|
+
"POST",
|
|
39
|
+
t.url,
|
|
40
|
+
t.headers,
|
|
41
|
+
(e, o) => {
|
|
42
|
+
if ("function" == typeof t.lt) {
|
|
43
|
+
let r;
|
|
44
|
+
try {
|
|
45
|
+
r = JSON.parse(e.responseText);
|
|
46
|
+
} catch (r) {
|
|
47
|
+
const n = {
|
|
48
|
+
error: "" === e.responseText ? Re.Ql : Re.vc,
|
|
49
|
+
response: e.responseText,
|
|
50
|
+
};
|
|
51
|
+
(0, t.lt)(n, o);
|
|
52
|
+
}
|
|
53
|
+
r && t.lt(r, o);
|
|
34
54
|
}
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
"function" == typeof t.ft && t.ft(!0, o);
|
|
56
|
+
},
|
|
57
|
+
(e, o) => {
|
|
58
|
+
"function" == typeof t.error && t.error(e.status),
|
|
59
|
+
"function" == typeof t.ft && t.ft(!1, o);
|
|
60
|
+
},
|
|
61
|
+
)),
|
|
62
|
+
!e)
|
|
63
|
+
)
|
|
64
|
+
return;
|
|
65
|
+
(o = JSON.stringify(t.data)), e.send(o);
|
|
66
|
+
} catch (t) {
|
|
67
|
+
b.error(`Network request error: ${ci(t)}`);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
get: (t) => {
|
|
71
|
+
let e;
|
|
72
|
+
try {
|
|
73
|
+
if (
|
|
74
|
+
((e = Xe(
|
|
75
|
+
"GET",
|
|
76
|
+
t.url,
|
|
77
|
+
t.headers,
|
|
78
|
+
(e) => {
|
|
79
|
+
"function" == typeof t.lt && t.lt(e.responseText),
|
|
80
|
+
"function" == typeof t.ft && t.ft(!0);
|
|
81
|
+
},
|
|
82
|
+
(e) => {
|
|
83
|
+
"function" == typeof t.error && t.error(e.status),
|
|
84
|
+
"function" == typeof t.ft && t.ft(!1);
|
|
85
|
+
},
|
|
86
|
+
)),
|
|
87
|
+
!e)
|
|
88
|
+
)
|
|
89
|
+
return;
|
|
90
|
+
e.send();
|
|
53
91
|
} catch (t) {
|
|
54
92
|
b.error(`Network request error: ${ci(t)}`);
|
|
55
93
|
}
|
|
@@ -1,52 +1,54 @@
|
|
|
1
|
-
import { REQUEST_ATTEMPT_DEFAULT as
|
|
1
|
+
import { REQUEST_ATTEMPT_DEFAULT as _e } from "../common/constants.js";
|
|
2
2
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
3
3
|
const h = {
|
|
4
4
|
it: {
|
|
5
|
-
|
|
5
|
+
Jh: "data",
|
|
6
6
|
Mi: "content_cards/sync",
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
jo: "feature_flags/sync",
|
|
8
|
+
Da: "template",
|
|
9
9
|
st: "banners/sync",
|
|
10
|
-
|
|
10
|
+
Xa: "push/unregister",
|
|
11
|
+
Bn: "conversational_chat/config",
|
|
12
|
+
$n: "conversational_chat/message",
|
|
11
13
|
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
sd: (e) => (null == e ? void 0 : e.St(s.It.lS)),
|
|
15
|
+
qm: (e) => (null == e ? void 0 : e.St(s.It._S)),
|
|
16
|
+
Om: (e, t) => {
|
|
15
17
|
null == e || e.Pt(s.It.lS, t);
|
|
16
18
|
},
|
|
17
|
-
|
|
19
|
+
Gm: (e, t) => {
|
|
18
20
|
null == e || e.Pt(s.It._S, t);
|
|
19
21
|
},
|
|
20
|
-
|
|
22
|
+
zc: (e, t) => {
|
|
21
23
|
if (!e || !t) return -1;
|
|
22
|
-
const s = h.
|
|
24
|
+
const s = h.sd(e);
|
|
23
25
|
if (null == s) return -1;
|
|
24
26
|
const n = s[t];
|
|
25
27
|
return null == n || isNaN(n) ? -1 : n;
|
|
26
28
|
},
|
|
27
|
-
|
|
28
|
-
let s =
|
|
29
|
+
Xc: (e, t) => {
|
|
30
|
+
let s = _e;
|
|
29
31
|
if (!e || !t) return s;
|
|
30
|
-
const n = h.
|
|
31
|
-
return null == n ? s : ((s = n[t]), null == s || isNaN(s) ?
|
|
32
|
+
const n = h.qm(e);
|
|
33
|
+
return null == n ? s : ((s = n[t]), null == s || isNaN(s) ? _e : s);
|
|
32
34
|
},
|
|
33
35
|
nt: (e, t, s) => {
|
|
34
36
|
if (!e || !t) return;
|
|
35
|
-
let n = h.
|
|
36
|
-
null == n && (n = {}), (n[t] = s), h.
|
|
37
|
+
let n = h.sd(e);
|
|
38
|
+
null == n && (n = {}), (n[t] = s), h.Om(e, n);
|
|
37
39
|
},
|
|
38
|
-
|
|
40
|
+
$c: (e, t, s) => {
|
|
39
41
|
if (!e || !t) return;
|
|
40
|
-
let n = h.
|
|
41
|
-
null == n && (n = {}), (n[t] = s), h.
|
|
42
|
+
let n = h.qm(e);
|
|
43
|
+
null == n && (n = {}), (n[t] = s), h.Gm(e, n);
|
|
42
44
|
},
|
|
43
45
|
Ji: (e, t) => {
|
|
44
|
-
e && t && h
|
|
46
|
+
e && t && h.$c(e, t, _e);
|
|
45
47
|
},
|
|
46
|
-
|
|
48
|
+
Oc: (e, t) => {
|
|
47
49
|
if (!e || !t) return;
|
|
48
|
-
const s = h.
|
|
49
|
-
h
|
|
50
|
+
const s = h.Xc(e, t);
|
|
51
|
+
h.$c(e, t, s + 1);
|
|
50
52
|
},
|
|
51
53
|
};
|
|
52
54
|
export default h;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import Oe from "./base-device-parser.js";
|
|
2
|
-
import { Browsers as
|
|
3
|
-
export default class
|
|
2
|
+
import { Browsers as Bi, OperatingSystems as so } from "./device-constants.js";
|
|
3
|
+
export default class xi extends Oe {
|
|
4
4
|
constructor() {
|
|
5
|
-
super(), (this.
|
|
6
|
-
}
|
|
7
|
-
ef() {
|
|
8
|
-
return this.Sd[0] || "Unknown Browser";
|
|
5
|
+
super(), (this.Vm = xi.hf(navigator.userAgent || ""));
|
|
9
6
|
}
|
|
10
7
|
ff() {
|
|
11
|
-
return this.
|
|
8
|
+
return this.Vm[0] || "Unknown Browser";
|
|
9
|
+
}
|
|
10
|
+
cf() {
|
|
11
|
+
return this.Vm[1] || "Unknown Version";
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
jc(r) {
|
|
14
14
|
for (let n = 0; n < r.length; n++) {
|
|
15
15
|
const e = r[n].string;
|
|
16
|
-
let i =
|
|
16
|
+
let i = xi.lf(e, r[n]);
|
|
17
17
|
if (i)
|
|
18
18
|
return (
|
|
19
|
-
i === so.
|
|
19
|
+
i === so.Cg && navigator.maxTouchPoints > 1 && (i = so.ao),
|
|
20
20
|
Promise.resolve(i)
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
23
|
return Promise.resolve(navigator.platform);
|
|
24
24
|
}
|
|
25
|
-
static
|
|
25
|
+
static hf(r) {
|
|
26
26
|
let n,
|
|
27
27
|
e =
|
|
28
28
|
r.match(
|
|
@@ -40,40 +40,40 @@ export default class yi extends Oe {
|
|
|
40
40
|
if (-1 !== r.indexOf("PhilipsTV")) return ["Philips Smart TV", null];
|
|
41
41
|
if (r.match(/\b(Roku)\b/)) return ["Roku", null];
|
|
42
42
|
if (r.match(/\bAFTM\b/)) return ["Amazon Fire Stick", null];
|
|
43
|
-
if (e[1] ===
|
|
44
|
-
if (r.includes(
|
|
43
|
+
if (e[1] === Bi.rO) {
|
|
44
|
+
if (r.includes(Bi.Sg)) return [Bi.Sg, e[2]];
|
|
45
45
|
if (
|
|
46
46
|
((n = r.match(/\b(OPR|Edge|EdgA|Edg|UCBrowser)\/(\.?\d+(\.\d+)*)/)),
|
|
47
47
|
null != n)
|
|
48
48
|
)
|
|
49
49
|
return (
|
|
50
50
|
(n = n.slice(1)),
|
|
51
|
-
(n[0] = n[0].replace("OPR",
|
|
52
|
-
(n[0] = n[0].replace("EdgA",
|
|
53
|
-
"Edg" === n[0] && (n[0] =
|
|
51
|
+
(n[0] = n[0].replace("OPR", Bi.oO)),
|
|
52
|
+
(n[0] = n[0].replace("EdgA", Bi.eO)),
|
|
53
|
+
"Edg" === n[0] && (n[0] = Bi.eO),
|
|
54
54
|
[n[0], n[1]]
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
57
|
if (
|
|
58
|
-
e[1] ===
|
|
58
|
+
e[1] === Bi.Og &&
|
|
59
59
|
((n = r.match(/\b(EdgiOS)\/(\.?\d+(\.\d+)*)/)), null != n)
|
|
60
60
|
)
|
|
61
61
|
return (
|
|
62
|
-
(n = n.slice(1)), (n[0] = n[0].replace("EdgiOS",
|
|
62
|
+
(n = n.slice(1)), (n[0] = n[0].replace("EdgiOS", Bi.eO)), [n[0], n[1]]
|
|
63
63
|
);
|
|
64
64
|
if (
|
|
65
65
|
((e = e[2] ? [e[1], e[2]] : [null, null]),
|
|
66
|
-
e[0] ===
|
|
66
|
+
e[0] === Bi.Og &&
|
|
67
67
|
null != (n = r.match(/version\/(\.?\d+(\.\d+)*)/i)) &&
|
|
68
68
|
e.splice(1, 1, n[1]),
|
|
69
69
|
null != (n = r.match(/\b(UCBrowser)\/(\.?\d+(\.\d+)*)/)) &&
|
|
70
70
|
e.splice(1, 1, n[2]),
|
|
71
|
-
e[0] ===
|
|
71
|
+
e[0] === Bi.oO && null != (n = r.match(/mini\/(\.?\d+(\.\d+)*)/i)))
|
|
72
72
|
)
|
|
73
73
|
return ["Opera Mini", n[1] || ""];
|
|
74
74
|
if (e[0]) {
|
|
75
75
|
const r = e[0].toLowerCase();
|
|
76
|
-
"crios" === r && (e[0] =
|
|
76
|
+
"crios" === r && (e[0] = Bi.rO),
|
|
77
77
|
"tizen" === r && ((e[0] = "Samsung Smart TV"), (e[1] = null)),
|
|
78
78
|
"samsungbrowser" === r && (e[0] = "Samsung Browser");
|
|
79
79
|
}
|