@braze/web-sdk 5.0.1 → 5.1.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 +10 -5
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +3 -3
- package/shared-lib/event-types.js +29 -29
- package/shared-lib/guid.js +3 -3
- package/shared-lib/index.js +6 -0
- package/shared-lib/indexed-db-adapter.js +70 -70
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +21 -21
- package/src/Card/card-manager.js +43 -45
- package/src/Card/display/card-display.js +60 -60
- package/src/Card/log-card-click.js +4 -4
- package/src/Card/log-card-dismissal.js +2 -3
- package/src/Card/log-card-impressions.js +7 -7
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +73 -73
- package/src/Card/models/classic-card.js +21 -21
- package/src/Card/models/control-card.js +11 -11
- package/src/Card/models/image-only.js +19 -19
- package/src/Card/util/card-factory.js +68 -68
- package/src/ContentCards/content-cards-provider-factory.js +3 -3
- package/src/ContentCards/content-cards-provider.js +255 -245
- package/src/ContentCards/content-cards.js +2 -2
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +6 -6
- package/src/ContentCards/ui/hide-content-cards.js +1 -1
- package/src/ContentCards/ui/show-content-cards.js +24 -24
- package/src/ContentCards/ui/toggle-content-cards.js +1 -1
- package/src/Core/add-sdk-metadata.js +21 -19
- package/src/Core/change-user.js +10 -10
- package/src/Core/destroy.js +2 -2
- package/src/Core/disable-sdk.js +11 -11
- package/src/Core/enable-sdk.js +7 -7
- package/src/Core/get-device-id.js +6 -6
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +41 -41
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/log-custom-event.js +15 -15
- package/src/Core/log-purchase.js +31 -37
- package/src/Core/open-session.js +12 -12
- package/src/Core/remove-all-subscriptions.js +1 -1
- package/src/Core/remove-subscription.js +1 -1
- package/src/Core/request-immediate-data-flush.js +1 -1
- package/src/Core/set-logger.js +2 -2
- package/src/Core/set-sdk-authentication-signature.js +3 -3
- package/src/Core/subscribe-to-sdk-authentication-failures.js +6 -4
- package/src/Core/toggle-logging.js +2 -2
- package/src/Core/wipe-data.js +9 -9
- package/src/FeatureFlags/feature-flag-factory.js +12 -12
- package/src/FeatureFlags/feature-flag.js +10 -10
- package/src/FeatureFlags/feature-flags-provider-factory.js +3 -2
- package/src/FeatureFlags/feature-flags-provider.js +108 -80
- package/src/FeatureFlags/get-all-feature-flags.js +5 -5
- package/src/FeatureFlags/get-feature-flag.js +6 -6
- package/src/FeatureFlags/log-feature-flag-impression.js +15 -13
- package/src/FeatureFlags/refresh-feature-flags.js +1 -1
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +7 -4
- package/src/Feed/feed-provider-factory.js +2 -2
- package/src/Feed/feed-provider.js +44 -44
- package/src/Feed/feed.js +1 -1
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/log-feed-displayed.js +4 -4
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/hide-feed.js +1 -1
- package/src/Feed/ui/show-feed.js +28 -28
- package/src/Feed/ui/toggle-feed.js +1 -1
- package/src/InAppMessage/defer-in-app-message.js +5 -5
- package/src/InAppMessage/display/html-message-to-html.js +54 -54
- package/src/InAppMessage/display/in-app-message-to-html.js +79 -79
- package/src/InAppMessage/display/modal-utils.js +8 -8
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-factory.js +49 -49
- package/src/InAppMessage/in-app-message-manager-factory.js +1 -1
- package/src/InAppMessage/in-app-message-manager.js +143 -138
- package/src/InAppMessage/log-in-app-message-button-click.js +12 -12
- package/src/InAppMessage/log-in-app-message-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-html-click.js +12 -12
- package/src/InAppMessage/log-in-app-message-impression.js +6 -6
- package/src/InAppMessage/models/full-screen-message.js +33 -33
- package/src/InAppMessage/models/html-message.js +20 -20
- package/src/InAppMessage/models/in-app-message-button.js +6 -6
- package/src/InAppMessage/models/in-app-message.js +99 -99
- package/src/InAppMessage/models/modal-message.js +32 -32
- package/src/InAppMessage/models/slide-up-message.js +28 -28
- 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 +4 -4
- package/src/InAppMessage/ui/show-in-app-message.js +81 -81
- package/src/Push/is-push-blocked.js +1 -1
- package/src/Push/is-push-permission-granted.js +1 -1
- package/src/Push/is-push-supported.js +1 -1
- package/src/Push/push-manager-factory.js +5 -5
- package/src/Push/push-manager.js +176 -173
- package/src/Push/request-push-permission.js +1 -1
- package/src/Push/unregister-push.js +1 -1
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +29 -29
- package/src/User/user.js +72 -74
- package/src/common/base-feed.js +7 -7
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +2 -0
- package/src/common/event-logger.js +21 -18
- package/src/common/feed-display.js +44 -44
- package/src/l10n/l10n-manager-factory.js +3 -3
- package/src/l10n/l10n-manager.js +7 -7
- package/src/managers/auth-manager.js +32 -32
- package/src/managers/braze-instance.js +188 -190
- package/src/managers/device-manager.js +28 -28
- package/src/managers/network-manager.js +189 -138
- package/src/managers/server-config-manager.js +69 -53
- package/src/managers/session-manager.js +34 -30
- package/src/managers/storage-manager-factory.js +16 -16
- package/src/managers/storage-manager.js +178 -163
- package/src/managers/subscription-manager.js +12 -12
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +4 -4
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +34 -14
- package/src/models/push-token.js +8 -8
- package/src/models/request-result.js +3 -3
- package/src/models/server-config.js +32 -23
- package/src/request-controller.js +186 -179
- package/src/triggers/models/custom-event-data.js +7 -7
- package/src/triggers/models/custom-event-property-data.js +10 -10
- package/src/triggers/models/filter-set.js +13 -13
- package/src/triggers/models/filter.js +45 -45
- package/src/triggers/models/in-app-message-click-data.js +12 -12
- package/src/triggers/models/purchase-data.js +2 -2
- package/src/triggers/models/purchase-property-data.js +10 -10
- package/src/triggers/models/push-click-data.js +7 -7
- package/src/triggers/models/trigger-condition.js +57 -59
- package/src/triggers/models/trigger-events.js +4 -4
- package/src/triggers/models/trigger.js +38 -38
- package/src/triggers/triggers-provider-factory.js +4 -4
- package/src/triggers/triggers-provider.js +127 -130
- package/src/ui/js/attach-css.js +2 -2
- package/src/ui/js/iam-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +3 -3
- package/src/util/braze-actions.js +35 -35
- package/src/util/browser-detector.js +21 -21
- package/src/util/client-hints-parser.js +8 -8
- package/src/util/code-utils.js +2 -2
- package/src/util/component-utils.js +1 -1
- package/src/util/deprecation-utils.js +4 -4
- package/src/util/device-constants.js +1 -1
- package/src/util/dom-utils.js +18 -18
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +18 -18
- package/src/util/request-header-utils.js +39 -37
- package/src/util/string-utils.js +10 -10
- package/src/util/user-agent-parser.js +18 -18
- package/src/util/validation-utils.js +37 -39
- package/src/util/window-utils.js +3 -3
- package/shared-lib/braze-shared-lib.js +0 -8
package/README.md
CHANGED
|
@@ -8,5 +8,5 @@ Note: The Braze Web SDK is meant to be used client-side in a web application and
|
|
|
8
8
|
|
|
9
9
|
See the [Public Github Repo](https://github.com/braze-inc/braze-web-sdk#readme) for getting started instructions or [our documentation pages](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/initial_sdk_setup/) for use-case based documentation.
|
|
10
10
|
|
|
11
|
-
(c) Braze, Inc.
|
|
11
|
+
(c) Braze, Inc. 2024 - http://braze.com
|
|
12
12
|
License available at https://github.com/braze-inc/braze-web-sdk/blob/master/LICENSE
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Type definitions for @braze/web-sdk v5.0
|
|
2
|
+
* Type definitions for @braze/web-sdk v5.1.0
|
|
3
3
|
* Project: https://github.com/braze-inc/braze-web-sdk
|
|
4
|
-
* (c) Braze, Inc.
|
|
4
|
+
* (c) Braze, Inc. 2024 - http://braze.com
|
|
5
5
|
* License available at https://github.com/braze-inc/braze-web-sdk/blob/master/LICENSE
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -1549,7 +1549,12 @@ export class FeatureFlag {
|
|
|
1549
1549
|
/** Indicates whether or not this feature flag is enabled. */
|
|
1550
1550
|
enabled: boolean;
|
|
1551
1551
|
|
|
1552
|
-
/**
|
|
1552
|
+
/**
|
|
1553
|
+
* Properties of this feature flag.
|
|
1554
|
+
*
|
|
1555
|
+
* Avoid accessing these properties directly. Instead, prefer using the `getStringProperty`, `getBooleanProperty`, `getNumberProperty` methods which ensure type safety,
|
|
1556
|
+
* and to avoid breaking changes in the future.
|
|
1557
|
+
*/
|
|
1553
1558
|
properties: Partial<
|
|
1554
1559
|
Record<
|
|
1555
1560
|
string,
|
|
@@ -2083,7 +2088,7 @@ export function openSession(): void;
|
|
|
2083
2088
|
* - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
|
|
2084
2089
|
*
|
|
2085
2090
|
* ```
|
|
2086
|
-
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.
|
|
2091
|
+
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.1/service-worker.js');
|
|
2087
2092
|
* ```
|
|
2088
2093
|
*
|
|
2089
2094
|
* For more details, see [Our Product Documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
|
|
@@ -2458,7 +2463,7 @@ export type InitializationOptions = {
|
|
|
2458
2463
|
* lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
|
|
2459
2464
|
* option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
|
|
2460
2465
|
* `requestPushPermission`, and ensure that it contains Braze's service worker code, either with
|
|
2461
|
-
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.
|
|
2466
|
+
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.1/service-worker.js');` or by including the content
|
|
2462
2467
|
* of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
|
|
2463
2468
|
*/
|
|
2464
2469
|
manageServiceWorkerExternally?: boolean;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
1
|
+
const ei = {
|
|
2
|
+
qn: function (t) {
|
|
3
3
|
const r = (t + "=".repeat((4 - (t.length % 4)) % 4))
|
|
4
4
|
.replace(/\-/g, "+")
|
|
5
5
|
.replace(/_/g, "/"),
|
|
@@ -9,4 +9,4 @@ const ve = {
|
|
|
9
9
|
return o;
|
|
10
10
|
},
|
|
11
11
|
};
|
|
12
|
-
export default
|
|
12
|
+
export default ei;
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
const
|
|
1
|
+
const i = {
|
|
2
2
|
CustomEvent: "ce",
|
|
3
3
|
Pr: "p",
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
Iu: "pc",
|
|
5
|
+
vc: "ca",
|
|
6
|
+
Za: "i",
|
|
7
|
+
Ms: "ie",
|
|
8
|
+
M: "cci",
|
|
9
|
+
R: "ccic",
|
|
10
|
+
I: "ccc",
|
|
11
|
+
F: "ccd",
|
|
12
|
+
kl: "ss",
|
|
13
13
|
xl: "se",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
14
|
+
Ze: "si",
|
|
15
|
+
Xe: "sc",
|
|
16
|
+
Ye: "sbc",
|
|
17
|
+
We: "sfe",
|
|
18
|
+
fo: "iec",
|
|
19
|
+
xu: "lr",
|
|
20
|
+
Pu: "uae",
|
|
21
|
+
O: "ci",
|
|
22
|
+
$: "cc",
|
|
23
|
+
Uu: "lcaa",
|
|
24
|
+
Ou: "lcar",
|
|
25
|
+
Hn: "inc",
|
|
26
|
+
On: "add",
|
|
27
|
+
Gn: "rem",
|
|
28
|
+
Ln: "set",
|
|
29
|
+
Rn: "ncam",
|
|
30
|
+
_u: "sgu",
|
|
31
31
|
Fr: "ffi",
|
|
32
32
|
},
|
|
33
|
-
|
|
34
|
-
export {
|
|
33
|
+
or = { Br: "feed_displayed", Cc: "content_cards_displayed" };
|
|
34
|
+
export { i as EventTypes, or as InternalEventTypes };
|
package/shared-lib/guid.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
1
|
+
const p = {
|
|
2
|
+
W: function () {
|
|
3
3
|
const t = (t = !1) => {
|
|
4
4
|
const n = (Math.random().toString(16) + "000000000").substr(2, 8);
|
|
5
5
|
return t ? "-" + n.substr(0, 4) + "-" + n.substr(4, 4) : n;
|
|
@@ -7,4 +7,4 @@ const Ge = {
|
|
|
7
7
|
return t() + t(!0) + t(!0) + t();
|
|
8
8
|
},
|
|
9
9
|
};
|
|
10
|
-
export default
|
|
10
|
+
export default p;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as logger } from "./logger.js";
|
|
2
|
+
export { default as EncodingUtils } from "./encoding-utils.js";
|
|
3
|
+
export { EventTypes, InternalEventTypes } from "./event-types.js";
|
|
4
|
+
export { default as Guid } from "./guid.js";
|
|
5
|
+
export { default as IndexedDBAdapter } from "./indexed-db-adapter.js";
|
|
6
|
+
export { default as SupportedOptions } from "./supported-options.js";
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export default class
|
|
1
|
+
export default class A {
|
|
2
2
|
constructor(t, e) {
|
|
3
3
|
(this.database = t),
|
|
4
|
-
(this.
|
|
4
|
+
(this.dd = e),
|
|
5
5
|
(this.parent = "undefined" == typeof window ? self : window),
|
|
6
6
|
(this.database = t),
|
|
7
|
-
(this.
|
|
7
|
+
(this.dd = e);
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
fd() {
|
|
10
10
|
if ("indexedDB" in this.parent) return this.parent.indexedDB;
|
|
11
11
|
}
|
|
12
12
|
isSupported() {
|
|
13
13
|
var t;
|
|
14
14
|
try {
|
|
15
|
-
if (null == this.
|
|
15
|
+
if (null == this.fd()) return !1;
|
|
16
16
|
{
|
|
17
17
|
const e =
|
|
18
|
-
null === (t = this.
|
|
18
|
+
null === (t = this.fd()) || void 0 === t
|
|
19
19
|
? void 0
|
|
20
20
|
: t.open("Braze IndexedDB Support Test");
|
|
21
21
|
if (
|
|
@@ -25,10 +25,10 @@ export default class Oe {
|
|
|
25
25
|
"undefined" != typeof window)
|
|
26
26
|
) {
|
|
27
27
|
const t = window,
|
|
28
|
-
e = t.chrome || t.browser || t.
|
|
28
|
+
e = t.chrome || t.browser || t.ad;
|
|
29
29
|
if (e && e.runtime && e.runtime.id)
|
|
30
30
|
return (
|
|
31
|
-
this.
|
|
31
|
+
this.dd.info(
|
|
32
32
|
"Not using IndexedDB for storage because we are running inside an extension",
|
|
33
33
|
),
|
|
34
34
|
!1
|
|
@@ -38,37 +38,37 @@ export default class Oe {
|
|
|
38
38
|
}
|
|
39
39
|
} catch (t) {
|
|
40
40
|
return (
|
|
41
|
-
this.
|
|
41
|
+
this.dd.info(
|
|
42
42
|
"Not using IndexedDB for storage due to following error: " + t,
|
|
43
43
|
),
|
|
44
44
|
!1
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
vd(t, e) {
|
|
49
49
|
var n;
|
|
50
50
|
const o =
|
|
51
|
-
null === (n = this.
|
|
51
|
+
null === (n = this.fd()) || void 0 === n
|
|
52
52
|
? void 0
|
|
53
|
-
: n.open(this.database.
|
|
53
|
+
: n.open(this.database.Dd, this.database.VERSION);
|
|
54
54
|
if (null == o) return "function" == typeof e && e(), !1;
|
|
55
55
|
const i = this;
|
|
56
56
|
return (
|
|
57
57
|
(o.onupgradeneeded = (t) => {
|
|
58
58
|
var e;
|
|
59
|
-
i.
|
|
59
|
+
i.dd.info(
|
|
60
60
|
"Upgrading indexedDB " +
|
|
61
|
-
i.database.
|
|
61
|
+
i.database.Dd +
|
|
62
62
|
" to v" +
|
|
63
63
|
i.database.VERSION +
|
|
64
64
|
"...",
|
|
65
65
|
);
|
|
66
66
|
const n = null === (e = t.target) || void 0 === e ? void 0 : e.result;
|
|
67
|
-
for (const t in i.database.
|
|
67
|
+
for (const t in i.database.ss) {
|
|
68
68
|
const e = t;
|
|
69
|
-
i.database.
|
|
70
|
-
!n.objectStoreNames.contains(i.database.
|
|
71
|
-
n.createObjectStore(i.database.
|
|
69
|
+
i.database.ss.hasOwnProperty(t) &&
|
|
70
|
+
!n.objectStoreNames.contains(i.database.ss[e]) &&
|
|
71
|
+
n.createObjectStore(i.database.ss[e]);
|
|
72
72
|
}
|
|
73
73
|
}),
|
|
74
74
|
(o.onsuccess = (n) => {
|
|
@@ -77,7 +77,7 @@ export default class Oe {
|
|
|
77
77
|
(r.onversionchange = () => {
|
|
78
78
|
r.close(),
|
|
79
79
|
"function" == typeof e && e(),
|
|
80
|
-
i.
|
|
80
|
+
i.dd.error(
|
|
81
81
|
"Needed to close the database unexpectedly because of an upgrade in another tab",
|
|
82
82
|
);
|
|
83
83
|
}),
|
|
@@ -87,9 +87,9 @@ export default class Oe {
|
|
|
87
87
|
var n;
|
|
88
88
|
const o = t;
|
|
89
89
|
return (
|
|
90
|
-
i.
|
|
90
|
+
i.dd.info(
|
|
91
91
|
"Could not open indexedDB " +
|
|
92
|
-
i.database.
|
|
92
|
+
i.database.Dd +
|
|
93
93
|
" v" +
|
|
94
94
|
i.database.VERSION +
|
|
95
95
|
": " +
|
|
@@ -105,16 +105,16 @@ export default class Oe {
|
|
|
105
105
|
setItem(t, e, n, o, i) {
|
|
106
106
|
if (!this.isSupported()) return "function" == typeof i && i(), !1;
|
|
107
107
|
const r = this;
|
|
108
|
-
return this.
|
|
108
|
+
return this.vd((d) => {
|
|
109
109
|
if (!d.objectStoreNames.contains(t))
|
|
110
110
|
return (
|
|
111
|
-
r.
|
|
111
|
+
r.dd.error(
|
|
112
112
|
"Could not store object " +
|
|
113
113
|
e +
|
|
114
114
|
" in " +
|
|
115
115
|
t +
|
|
116
116
|
" on indexedDB " +
|
|
117
|
-
r.database.
|
|
117
|
+
r.database.Dd +
|
|
118
118
|
" - " +
|
|
119
119
|
t +
|
|
120
120
|
" is not a valid objectStore",
|
|
@@ -126,13 +126,13 @@ export default class Oe {
|
|
|
126
126
|
s.oncomplete = () => d.close();
|
|
127
127
|
const u = s.objectStore(t).put(n, e);
|
|
128
128
|
(u.onerror = () => {
|
|
129
|
-
r.
|
|
129
|
+
r.dd.error(
|
|
130
130
|
"Could not store object " +
|
|
131
131
|
e +
|
|
132
132
|
" in " +
|
|
133
133
|
t +
|
|
134
134
|
" on indexedDB " +
|
|
135
|
-
r.database.
|
|
135
|
+
r.database.Dd,
|
|
136
136
|
),
|
|
137
137
|
"function" == typeof i && i();
|
|
138
138
|
}),
|
|
@@ -144,16 +144,16 @@ export default class Oe {
|
|
|
144
144
|
getItem(t, e, n) {
|
|
145
145
|
if (!this.isSupported()) return !1;
|
|
146
146
|
const o = this;
|
|
147
|
-
return this.
|
|
147
|
+
return this.vd((i) => {
|
|
148
148
|
if (!i.objectStoreNames.contains(t))
|
|
149
149
|
return (
|
|
150
|
-
o.
|
|
150
|
+
o.dd.error(
|
|
151
151
|
"Could not retrieve object " +
|
|
152
152
|
e +
|
|
153
153
|
" in " +
|
|
154
154
|
t +
|
|
155
155
|
" on indexedDB " +
|
|
156
|
-
o.database.
|
|
156
|
+
o.database.Dd +
|
|
157
157
|
" - " +
|
|
158
158
|
t +
|
|
159
159
|
" is not a valid objectStore",
|
|
@@ -164,13 +164,13 @@ export default class Oe {
|
|
|
164
164
|
r.oncomplete = () => i.close();
|
|
165
165
|
const d = r.objectStore(t).get(e);
|
|
166
166
|
(d.onerror = () => {
|
|
167
|
-
o.
|
|
167
|
+
o.dd.error(
|
|
168
168
|
"Could not retrieve object " +
|
|
169
169
|
e +
|
|
170
170
|
" in " +
|
|
171
171
|
t +
|
|
172
172
|
" on indexedDB " +
|
|
173
|
-
o.database.
|
|
173
|
+
o.database.Dd,
|
|
174
174
|
);
|
|
175
175
|
}),
|
|
176
176
|
(d.onsuccess = (t) => {
|
|
@@ -180,17 +180,17 @@ export default class Oe {
|
|
|
180
180
|
});
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
|
-
|
|
183
|
+
jr(t, e, n) {
|
|
184
184
|
if (!this.isSupported()) return "function" == typeof n && n(), !1;
|
|
185
185
|
const o = this;
|
|
186
|
-
return this.
|
|
186
|
+
return this.vd((i) => {
|
|
187
187
|
if (!i.objectStoreNames.contains(t))
|
|
188
188
|
return (
|
|
189
|
-
o.
|
|
189
|
+
o.dd.error(
|
|
190
190
|
"Could not retrieve last record from " +
|
|
191
191
|
t +
|
|
192
192
|
" on indexedDB " +
|
|
193
|
-
o.database.
|
|
193
|
+
o.database.Dd +
|
|
194
194
|
" - " +
|
|
195
195
|
t +
|
|
196
196
|
" is not a valid objectStore",
|
|
@@ -202,8 +202,8 @@ export default class Oe {
|
|
|
202
202
|
r.oncomplete = () => i.close();
|
|
203
203
|
const d = r.objectStore(t).openCursor(null, "prev");
|
|
204
204
|
(d.onerror = () => {
|
|
205
|
-
o.
|
|
206
|
-
"Could not open cursor for " + t + " on indexedDB " + o.database.
|
|
205
|
+
o.dd.error(
|
|
206
|
+
"Could not open cursor for " + t + " on indexedDB " + o.database.Dd,
|
|
207
207
|
),
|
|
208
208
|
"function" == typeof n && n();
|
|
209
209
|
}),
|
|
@@ -216,19 +216,19 @@ export default class Oe {
|
|
|
216
216
|
});
|
|
217
217
|
}, n);
|
|
218
218
|
}
|
|
219
|
-
|
|
219
|
+
re(t, e) {
|
|
220
220
|
if (!this.isSupported()) return !1;
|
|
221
221
|
const n = this;
|
|
222
|
-
return this.
|
|
222
|
+
return this.vd((o) => {
|
|
223
223
|
if (!o.objectStoreNames.contains(t))
|
|
224
224
|
return (
|
|
225
|
-
n.
|
|
225
|
+
n.dd.error(
|
|
226
226
|
"Could not delete record " +
|
|
227
227
|
e +
|
|
228
228
|
" from " +
|
|
229
229
|
t +
|
|
230
230
|
" on indexedDB " +
|
|
231
|
-
n.database.
|
|
231
|
+
n.database.Dd +
|
|
232
232
|
" - " +
|
|
233
233
|
t +
|
|
234
234
|
" is not a valid objectStore",
|
|
@@ -238,28 +238,28 @@ export default class Oe {
|
|
|
238
238
|
const i = o.transaction([t], "readwrite");
|
|
239
239
|
i.oncomplete = () => o.close();
|
|
240
240
|
i.objectStore(t).delete(e).onerror = () => {
|
|
241
|
-
n.
|
|
241
|
+
n.dd.error(
|
|
242
242
|
"Could not delete record " +
|
|
243
243
|
e +
|
|
244
244
|
" from " +
|
|
245
245
|
t +
|
|
246
246
|
" on indexedDB " +
|
|
247
|
-
n.database.
|
|
247
|
+
n.database.Dd,
|
|
248
248
|
);
|
|
249
249
|
};
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
|
-
|
|
252
|
+
Zt(t, e) {
|
|
253
253
|
if (!this.isSupported()) return !1;
|
|
254
254
|
const n = this;
|
|
255
|
-
return this.
|
|
255
|
+
return this.vd((o) => {
|
|
256
256
|
if (!o.objectStoreNames.contains(t))
|
|
257
257
|
return (
|
|
258
|
-
n.
|
|
258
|
+
n.dd.error(
|
|
259
259
|
"Could not retrieve objects from " +
|
|
260
260
|
t +
|
|
261
261
|
" on indexedDB " +
|
|
262
|
-
n.database.
|
|
262
|
+
n.database.Dd +
|
|
263
263
|
" - " +
|
|
264
264
|
t +
|
|
265
265
|
" is not a valid objectStore",
|
|
@@ -273,18 +273,18 @@ export default class Oe {
|
|
|
273
273
|
s = [];
|
|
274
274
|
(d.onerror = () => {
|
|
275
275
|
s.length > 0
|
|
276
|
-
? (n.
|
|
276
|
+
? (n.dd.info(
|
|
277
277
|
"Cursor closed midway through for " +
|
|
278
278
|
t +
|
|
279
279
|
" on indexedDB " +
|
|
280
|
-
n.database.
|
|
280
|
+
n.database.Dd,
|
|
281
281
|
),
|
|
282
282
|
e(s))
|
|
283
|
-
: n.
|
|
283
|
+
: n.dd.error(
|
|
284
284
|
"Could not open cursor for " +
|
|
285
285
|
t +
|
|
286
286
|
" on indexedDB " +
|
|
287
|
-
n.database.
|
|
287
|
+
n.database.Dd,
|
|
288
288
|
);
|
|
289
289
|
}),
|
|
290
290
|
(d.onsuccess = (t) => {
|
|
@@ -304,48 +304,48 @@ export default class Oe {
|
|
|
304
304
|
clearData() {
|
|
305
305
|
if (!this.isSupported()) return !1;
|
|
306
306
|
const t = [];
|
|
307
|
-
for (const e in this.database.
|
|
307
|
+
for (const e in this.database.ss) {
|
|
308
308
|
const n = e;
|
|
309
|
-
this.database.
|
|
310
|
-
this.database.
|
|
311
|
-
t.push(this.database.
|
|
309
|
+
this.database.ss.hasOwnProperty(e) &&
|
|
310
|
+
this.database.ss[n] !== this.database.ss.ae &&
|
|
311
|
+
t.push(this.database.ss[n]);
|
|
312
312
|
}
|
|
313
313
|
const e = this;
|
|
314
|
-
return this.
|
|
314
|
+
return this.vd(function (n) {
|
|
315
315
|
const o = n.transaction(t, "readwrite");
|
|
316
316
|
o.oncomplete = () => n.close();
|
|
317
317
|
for (let n = 0; n < t.length; n++) {
|
|
318
318
|
const i = t[n];
|
|
319
319
|
o.objectStore(i).clear().onerror = function () {
|
|
320
|
-
e.
|
|
320
|
+
e.dd.error(
|
|
321
321
|
"Could not clear " +
|
|
322
322
|
this.source.name +
|
|
323
323
|
" on indexedDB " +
|
|
324
|
-
e.database.
|
|
324
|
+
e.database.Dd,
|
|
325
325
|
);
|
|
326
326
|
};
|
|
327
327
|
}
|
|
328
328
|
o.onerror = function () {
|
|
329
|
-
e.
|
|
330
|
-
"Could not clear object stores on indexedDB " + e.database.
|
|
329
|
+
e.dd.error(
|
|
330
|
+
"Could not clear object stores on indexedDB " + e.database.Dd,
|
|
331
331
|
);
|
|
332
332
|
};
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
336
|
+
A.Yt = {
|
|
337
|
+
Qt: {
|
|
338
|
+
Dd: "AppboyServiceWorkerAsyncStorage",
|
|
339
339
|
VERSION: 6,
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
340
|
+
ss: {
|
|
341
|
+
Qa: "data",
|
|
342
|
+
hr: "pushClicks",
|
|
343
343
|
cu: "pushSubscribed",
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
344
|
+
pd: "fallbackDevice",
|
|
345
|
+
ts: "cardUpdates",
|
|
346
|
+
ae: "optOut",
|
|
347
347
|
wr: "pendingData",
|
|
348
|
-
|
|
348
|
+
xh: "sdkAuthenticationSignature",
|
|
349
349
|
},
|
|
350
350
|
ie: 1,
|
|
351
351
|
},
|
package/shared-lib/logger.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
const
|
|
1
|
+
const r = {
|
|
2
2
|
init: function (n) {
|
|
3
|
-
(void 0 === n && void 0 !==
|
|
3
|
+
(void 0 === n && void 0 !== r.zg) || (r.zg = !!n), r.t || (r.t = !0);
|
|
4
4
|
},
|
|
5
5
|
destroy: function () {
|
|
6
|
-
(
|
|
6
|
+
(r.t = !1), (r.zg = void 0), (r.dd = void 0);
|
|
7
7
|
},
|
|
8
8
|
setLogger: function (n) {
|
|
9
9
|
"function" == typeof n
|
|
10
|
-
? (
|
|
11
|
-
:
|
|
10
|
+
? (r.init(), (r.dd = n))
|
|
11
|
+
: r.info("Ignoring setLogger call since logger is not a function");
|
|
12
12
|
},
|
|
13
13
|
toggleLogging: function () {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
? (console.log("Disabling Braze logging"), (
|
|
17
|
-
: (console.log("Enabled Braze logging"), (
|
|
14
|
+
r.init(),
|
|
15
|
+
r.zg
|
|
16
|
+
? (console.log("Disabling Braze logging"), (r.zg = !1))
|
|
17
|
+
: (console.log("Enabled Braze logging"), (r.zg = !0));
|
|
18
18
|
},
|
|
19
19
|
info: function (n) {
|
|
20
|
-
if (
|
|
20
|
+
if (r.zg) {
|
|
21
21
|
const o = "Braze: " + n;
|
|
22
|
-
null !=
|
|
22
|
+
null != r.dd ? r.dd(o) : console.log(o);
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
warn: function (n) {
|
|
26
|
-
if (
|
|
27
|
-
const o = "Braze SDK Warning: " + n + " (v5.0
|
|
28
|
-
null !=
|
|
26
|
+
if (r.zg) {
|
|
27
|
+
const o = "Braze SDK Warning: " + n + " (v5.1.0)";
|
|
28
|
+
null != r.dd ? r.dd(o) : console.warn(o);
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
error: function (n) {
|
|
32
|
-
if (
|
|
33
|
-
const o = "Braze SDK Error: " + n + " (v5.0
|
|
34
|
-
null !=
|
|
32
|
+
if (r.zg) {
|
|
33
|
+
const o = "Braze SDK Error: " + n + " (v5.1.0)";
|
|
34
|
+
null != r.dd ? r.dd(o) : console.error(o);
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
};
|
|
38
|
-
export default
|
|
38
|
+
export default r;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
_o: "allowCrawlerActivity",
|
|
3
|
+
Io: "baseUrl",
|
|
4
|
+
Ao: "noCookies",
|
|
5
|
+
So: "devicePropertyAllowlist",
|
|
6
|
+
qa: "disablePushTokenMaintenance",
|
|
7
|
+
No: "enableLogging",
|
|
8
|
+
Oo: "enableSdkAuthentication",
|
|
9
|
+
ka: "manageServiceWorkerExternally",
|
|
10
|
+
Po: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
11
|
+
Ro: "sessionTimeoutInSeconds",
|
|
12
|
+
Lo: "appVersion",
|
|
13
|
+
Do: "appVersionNumber",
|
|
14
|
+
Ma: "serviceWorkerLocation",
|
|
15
|
+
_a: "safariWebsitePushId",
|
|
16
|
+
Xn: "localization",
|
|
17
|
+
wo: "contentSecurityNonce",
|
|
18
|
+
Mo: "allowUserSuppliedJavascript",
|
|
19
|
+
ho: "inAppMessageZIndex",
|
|
20
|
+
yo: "openInAppMessagesInNewTab",
|
|
21
21
|
en: "openNewsFeedCardsInNewTab",
|
|
22
22
|
mh: "requireExplicitInAppMessageDismissal",
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
Uo: "doNotLoadFontAwesome",
|
|
24
|
+
Bo: "sdkFlavor",
|
|
25
25
|
tn: "openCardsInNewTab",
|
|
26
26
|
};
|