@braze/web-sdk 5.1.1 → 5.3.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 +65 -10
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +20 -20
- package/shared-lib/indexed-db-adapter.js +52 -52
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +22 -21
- package/src/ContentCards/content-cards-provider.js +107 -135
- 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 +2 -2
- package/src/ContentCards/ui/show-content-cards.js +1 -1
- package/src/FeatureFlags/feature-flag.js +41 -30
- package/src/FeatureFlags/feature-flags-provider.js +88 -84
- 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 +2 -2
- package/src/Feed/feed-provider.js +24 -24
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/log-feed-displayed.js +1 -1
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +45 -42
- package/src/InAppMessage/display/in-app-message-to-html.js +22 -22
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-factory.js +23 -21
- package/src/InAppMessage/in-app-message-manager.js +95 -112
- package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/control-message.js +4 -2
- package/src/InAppMessage/models/full-screen-message.js +14 -11
- package/src/InAppMessage/models/html-message.js +11 -9
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +127 -120
- package/src/InAppMessage/models/modal-message.js +14 -11
- package/src/InAppMessage/models/slide-up-message.js +46 -21
- 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/show-in-app-message.js +37 -43
- package/src/InAppMessage/utils/in-app-message-utils.js +18 -1
- package/src/Push/push-manager-factory.js +4 -4
- package/src/Push/push-manager.js +118 -110
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +19 -19
- package/src/common/base-feed.js +1 -1
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +0 -2
- package/src/common/event-logger.js +2 -2
- package/src/common/feed-display.js +12 -12
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/l10n/l10n-manager.js +4 -4
- package/src/managers/auth-manager.js +27 -27
- package/src/managers/braze-instance.js +119 -112
- package/src/managers/device-manager.js +19 -19
- package/src/managers/network-manager.js +215 -165
- package/src/managers/server-config-manager.js +46 -50
- package/src/managers/session-manager.js +21 -21
- package/src/managers/storage-manager-factory.js +1 -1
- package/src/managers/storage-manager.js +128 -125
- package/src/managers/utils.js +6 -0
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +19 -11
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +34 -20
- package/src/models/push-token.js +4 -4
- package/src/models/server-config.js +24 -24
- package/src/request-controller.js +134 -124
- package/src/triggers/models/filter-set.js +2 -2
- package/src/triggers/models/filter.js +56 -56
- package/src/triggers/models/in-app-message-click-data.js +8 -8
- package/src/triggers/models/push-click-data.js +3 -3
- package/src/triggers/models/trigger-condition.js +30 -30
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +36 -36
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +84 -95
- package/src/ui/js/attach-css.js +2 -2
- 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 +4 -4
- package/src/util/browser-detector.js +25 -24
- package/src/util/client-hints-parser.js +4 -4
- package/src/util/component-utils.js +2 -2
- package/src/util/device-constants.js +2 -2
- package/src/util/dom-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +4 -4
- package/src/util/request-header-utils.js +36 -37
- package/src/util/user-agent-parser.js +8 -8
- package/src/util/validation-utils.js +2 -0
- package/src/util/window-utils.js +3 -3
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Type definitions for @braze/web-sdk v5.
|
|
2
|
+
* Type definitions for @braze/web-sdk v5.3.0
|
|
3
3
|
* Project: https://github.com/braze-inc/braze-web-sdk
|
|
4
4
|
* (c) Braze, Inc. 2024 - http://braze.com
|
|
5
5
|
* License available at https://github.com/braze-inc/braze-web-sdk/blob/master/LICENSE
|
|
@@ -1289,7 +1289,8 @@ export class User {
|
|
|
1289
1289
|
* @param key - The identifier of the custom attribute. Limited to 255 characters in length, cannot begin with
|
|
1290
1290
|
* a $, and can only contain alphanumeric characters and punctuation.
|
|
1291
1291
|
* @param value - Can be numeric, boolean, a Date object, a string, or an array of strings. Strings are limited to
|
|
1292
|
-
* 255 characters in length, cannot begin with a
|
|
1292
|
+
* 255 characters in length, cannot begin with a $ and cannot contain new lines, tabs or double quotes.
|
|
1293
|
+
* It can only include alphanumeric characters and other punctuation.
|
|
1293
1294
|
* Passing a null value will remove this custom attribute from the user.
|
|
1294
1295
|
* @param merge - Whether the value should be merged with the existing value on the backend. If `false` (default), any existing
|
|
1295
1296
|
* attribute will be overwritten. If `true`, existing objects and arrays of objects will be merged. To update an array of objects,
|
|
@@ -1545,6 +1546,22 @@ export interface FeatureFlagBooleanProperty {
|
|
|
1545
1546
|
value: boolean;
|
|
1546
1547
|
}
|
|
1547
1548
|
|
|
1549
|
+
export interface FeatureFlagImageProperty {
|
|
1550
|
+
type: "image";
|
|
1551
|
+
value: string;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
export interface FeatureFlagTimestampProperty {
|
|
1555
|
+
type: "datetime";
|
|
1556
|
+
value: number;
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
export type FeatureFlagJsonPropertyValue = Partial<Record<string, any>>;
|
|
1560
|
+
export interface FeatureFlagJsonProperty {
|
|
1561
|
+
type: "jsonobject";
|
|
1562
|
+
value: FeatureFlagJsonPropertyValue;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1548
1565
|
export class FeatureFlag {
|
|
1549
1566
|
/** Indicates whether or not this feature flag is enabled. */
|
|
1550
1567
|
enabled: boolean;
|
|
@@ -1552,8 +1569,8 @@ export class FeatureFlag {
|
|
|
1552
1569
|
/**
|
|
1553
1570
|
* Properties of this feature flag.
|
|
1554
1571
|
*
|
|
1555
|
-
* Avoid accessing these properties directly. Instead, prefer using the `getStringProperty`, `getBooleanProperty`, `getNumberProperty
|
|
1556
|
-
* and to avoid breaking changes in the future.
|
|
1572
|
+
* Avoid accessing these properties directly. Instead, prefer using the `getStringProperty`, `getBooleanProperty`, `getNumberProperty`,
|
|
1573
|
+
* `getImageProperty` and `getJsonProperty` methods which ensure type safety and to avoid breaking changes in the future.
|
|
1557
1574
|
*/
|
|
1558
1575
|
properties: Partial<
|
|
1559
1576
|
Record<
|
|
@@ -1561,6 +1578,9 @@ export class FeatureFlag {
|
|
|
1561
1578
|
| FeatureFlagStringProperty
|
|
1562
1579
|
| FeatureFlagNumberProperty
|
|
1563
1580
|
| FeatureFlagBooleanProperty
|
|
1581
|
+
| FeatureFlagImageProperty
|
|
1582
|
+
| FeatureFlagJsonProperty
|
|
1583
|
+
| FeatureFlagTimestampProperty
|
|
1564
1584
|
>
|
|
1565
1585
|
>;
|
|
1566
1586
|
|
|
@@ -1596,6 +1616,36 @@ export class FeatureFlag {
|
|
|
1596
1616
|
* If the key is not found or if there is a type mismatch, this method will return a null.
|
|
1597
1617
|
*/
|
|
1598
1618
|
getBooleanProperty(key: string): boolean | null;
|
|
1619
|
+
|
|
1620
|
+
/**
|
|
1621
|
+
* Get value of a feature flag property of type image.
|
|
1622
|
+
*
|
|
1623
|
+
* @param key - The key of the property.
|
|
1624
|
+
*
|
|
1625
|
+
* @returns The string value of the image url if the key is found and is of type image.
|
|
1626
|
+
* If the key is not found or if there is a type mismatch, this method will return a null.
|
|
1627
|
+
*/
|
|
1628
|
+
getImageProperty(key: string): string | null;
|
|
1629
|
+
|
|
1630
|
+
/**
|
|
1631
|
+
* Get value of a feature flag property of type JSON.
|
|
1632
|
+
*
|
|
1633
|
+
* @param key - The key of the property.
|
|
1634
|
+
*
|
|
1635
|
+
* @returns The value of the property if the key is found and is of type JSON.
|
|
1636
|
+
* If the key is not found or if there is a type mismatch, this method will return a null.
|
|
1637
|
+
*/
|
|
1638
|
+
getJsonProperty(key: string): FeatureFlagJsonPropertyValue | null;
|
|
1639
|
+
|
|
1640
|
+
/**
|
|
1641
|
+
* Get value of a feature flag property of type datetime as a Unix timestamp (milliseconds).
|
|
1642
|
+
*
|
|
1643
|
+
* @param key - The key of the property.
|
|
1644
|
+
*
|
|
1645
|
+
* @returns The Unix timestamp (milliseconds) value of the property if the key is found and is of type datetime.
|
|
1646
|
+
* If the key is not found or if there is a type mismatch, this method will return a null.
|
|
1647
|
+
*/
|
|
1648
|
+
getTimestampProperty(key: string): number | null;
|
|
1599
1649
|
}
|
|
1600
1650
|
|
|
1601
1651
|
/**
|
|
@@ -1767,9 +1817,9 @@ export function toggleFeed(
|
|
|
1767
1817
|
* Additionally, if you identify a user which has never been identified on another device, the entire history of
|
|
1768
1818
|
* that user as an "anonymous" user on this device will be preserved and associated with the newly identified
|
|
1769
1819
|
* user. However, if you identify a user which *has* been identified in another app, any history which was
|
|
1770
|
-
* already flushed to the server for the anonymous user on this device will
|
|
1771
|
-
*
|
|
1772
|
-
*
|
|
1820
|
+
* already flushed to the server for the anonymous user on this device will be merged into the identified user.
|
|
1821
|
+
* Any fields that already exist on the identified user will not be overwritten, and the merge is limited
|
|
1822
|
+
* to the fields listed [here](https://www.braze.com/docs/api/endpoints/user_data/post_users_merge/).
|
|
1773
1823
|
*
|
|
1774
1824
|
* Note: Once you identify a user, you cannot revert to the "anonymous" user. The transition from anonymous to
|
|
1775
1825
|
* identified tracking is only allowed once because the initial anonymous user receives special treatment to
|
|
@@ -2088,7 +2138,7 @@ export function openSession(): void;
|
|
|
2088
2138
|
* - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
|
|
2089
2139
|
*
|
|
2090
2140
|
* ```
|
|
2091
|
-
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.
|
|
2141
|
+
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.3/service-worker.js');
|
|
2092
2142
|
* ```
|
|
2093
2143
|
*
|
|
2094
2144
|
* For more details, see [Our Product Documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
|
|
@@ -2394,7 +2444,7 @@ export type InitializationOptions = {
|
|
|
2394
2444
|
/**
|
|
2395
2445
|
* A numerical app version value which can be used for user segmentation. This value must be sent with four fields, such as
|
|
2396
2446
|
* "1.2.3.4", otherwise it will be ignored.
|
|
2397
|
-
*
|
|
2447
|
+
*
|
|
2398
2448
|
* Note: `appVersion` must also be set, either with the same value or a unique name for this version.
|
|
2399
2449
|
*/
|
|
2400
2450
|
appVersionNumber?: string;
|
|
@@ -2463,7 +2513,7 @@ export type InitializationOptions = {
|
|
|
2463
2513
|
* lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
|
|
2464
2514
|
* option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
|
|
2465
2515
|
* `requestPushPermission`, and ensure that it contains Braze's service worker code, either with
|
|
2466
|
-
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.
|
|
2516
|
+
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.3/service-worker.js');` or by including the content
|
|
2467
2517
|
* of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
|
|
2468
2518
|
*/
|
|
2469
2519
|
manageServiceWorkerExternally?: boolean;
|
|
@@ -2515,6 +2565,11 @@ export type InitializationOptions = {
|
|
|
2515
2565
|
* default with a value of your own.
|
|
2516
2566
|
*/
|
|
2517
2567
|
sessionTimeoutInSeconds?: number;
|
|
2568
|
+
/**
|
|
2569
|
+
* By default, Braze will assign a random guid as the device ID. Provide a value for this configuration option to override that
|
|
2570
|
+
* default with a value of your own.
|
|
2571
|
+
*/
|
|
2572
|
+
deviceId?: string;
|
|
2518
2573
|
};
|
|
2519
2574
|
|
|
2520
2575
|
|
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
const i = {
|
|
2
2
|
CustomEvent: "ce",
|
|
3
3
|
Pr: "p",
|
|
4
|
-
|
|
4
|
+
_u: "pc",
|
|
5
5
|
vc: "ca",
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
Ea: "i",
|
|
7
|
+
qs: "ie",
|
|
8
8
|
M: "cci",
|
|
9
9
|
R: "ccic",
|
|
10
10
|
I: "ccc",
|
|
11
11
|
F: "ccd",
|
|
12
|
-
|
|
12
|
+
ql: "ss",
|
|
13
13
|
xl: "se",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
Oi: "si",
|
|
15
|
+
Ei: "sc",
|
|
16
|
+
Gi: "sbc",
|
|
17
|
+
Cc: "sfe",
|
|
18
|
+
mo: "iec",
|
|
19
|
+
Uu: "lr",
|
|
20
|
+
zu: "uae",
|
|
21
21
|
O: "ci",
|
|
22
22
|
$: "cc",
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
Ju: "lcaa",
|
|
24
|
+
Eu: "lcar",
|
|
25
|
+
On: "inc",
|
|
26
|
+
Ln: "add",
|
|
27
|
+
Rn: "rem",
|
|
28
|
+
$n: "set",
|
|
29
|
+
Bn: "ncam",
|
|
30
|
+
Ku: "sgu",
|
|
31
31
|
Fr: "ffi",
|
|
32
32
|
},
|
|
33
|
-
or = {
|
|
33
|
+
or = { Ar: "feed_displayed", Ec: "content_cards_displayed" };
|
|
34
34
|
export { i as EventTypes, or as InternalEventTypes };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
export default class A {
|
|
2
2
|
constructor(t, e) {
|
|
3
3
|
(this.database = t),
|
|
4
|
-
(this.
|
|
4
|
+
(this.vd = e),
|
|
5
5
|
(this.parent = "undefined" == typeof window ? self : window),
|
|
6
6
|
(this.database = t),
|
|
7
|
-
(this.
|
|
7
|
+
(this.vd = e);
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
Dd() {
|
|
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.Dd()) return !1;
|
|
16
16
|
{
|
|
17
17
|
const e =
|
|
18
|
-
null === (t = this.
|
|
18
|
+
null === (t = this.Dd()) || 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 A {
|
|
|
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.pd;
|
|
29
29
|
if (e && e.runtime && e.runtime.id)
|
|
30
30
|
return (
|
|
31
|
-
this.
|
|
31
|
+
this.vd.info(
|
|
32
32
|
"Not using IndexedDB for storage because we are running inside an extension",
|
|
33
33
|
),
|
|
34
34
|
!1
|
|
@@ -38,27 +38,27 @@ export default class A {
|
|
|
38
38
|
}
|
|
39
39
|
} catch (t) {
|
|
40
40
|
return (
|
|
41
|
-
this.
|
|
41
|
+
this.vd.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
|
+
Bd(t, e) {
|
|
49
49
|
var n;
|
|
50
50
|
const o =
|
|
51
|
-
null === (n = this.
|
|
51
|
+
null === (n = this.Dd()) || void 0 === n
|
|
52
52
|
? void 0
|
|
53
|
-
: n.open(this.database.
|
|
53
|
+
: n.open(this.database.Sd, 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.vd.info(
|
|
60
60
|
"Upgrading indexedDB " +
|
|
61
|
-
i.database.
|
|
61
|
+
i.database.Sd +
|
|
62
62
|
" to v" +
|
|
63
63
|
i.database.VERSION +
|
|
64
64
|
"...",
|
|
@@ -77,7 +77,7 @@ export default class A {
|
|
|
77
77
|
(r.onversionchange = () => {
|
|
78
78
|
r.close(),
|
|
79
79
|
"function" == typeof e && e(),
|
|
80
|
-
i.
|
|
80
|
+
i.vd.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 A {
|
|
|
87
87
|
var n;
|
|
88
88
|
const o = t;
|
|
89
89
|
return (
|
|
90
|
-
i.
|
|
90
|
+
i.vd.info(
|
|
91
91
|
"Could not open indexedDB " +
|
|
92
|
-
i.database.
|
|
92
|
+
i.database.Sd +
|
|
93
93
|
" v" +
|
|
94
94
|
i.database.VERSION +
|
|
95
95
|
": " +
|
|
@@ -105,16 +105,16 @@ export default class A {
|
|
|
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.Bd((d) => {
|
|
109
109
|
if (!d.objectStoreNames.contains(t))
|
|
110
110
|
return (
|
|
111
|
-
r.
|
|
111
|
+
r.vd.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.Sd +
|
|
118
118
|
" - " +
|
|
119
119
|
t +
|
|
120
120
|
" is not a valid objectStore",
|
|
@@ -126,13 +126,13 @@ export default class A {
|
|
|
126
126
|
s.oncomplete = () => d.close();
|
|
127
127
|
const u = s.objectStore(t).put(n, e);
|
|
128
128
|
(u.onerror = () => {
|
|
129
|
-
r.
|
|
129
|
+
r.vd.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.Sd,
|
|
136
136
|
),
|
|
137
137
|
"function" == typeof i && i();
|
|
138
138
|
}),
|
|
@@ -144,16 +144,16 @@ export default class A {
|
|
|
144
144
|
getItem(t, e, n) {
|
|
145
145
|
if (!this.isSupported()) return !1;
|
|
146
146
|
const o = this;
|
|
147
|
-
return this.
|
|
147
|
+
return this.Bd((i) => {
|
|
148
148
|
if (!i.objectStoreNames.contains(t))
|
|
149
149
|
return (
|
|
150
|
-
o.
|
|
150
|
+
o.vd.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.Sd +
|
|
157
157
|
" - " +
|
|
158
158
|
t +
|
|
159
159
|
" is not a valid objectStore",
|
|
@@ -164,13 +164,13 @@ export default class A {
|
|
|
164
164
|
r.oncomplete = () => i.close();
|
|
165
165
|
const d = r.objectStore(t).get(e);
|
|
166
166
|
(d.onerror = () => {
|
|
167
|
-
o.
|
|
167
|
+
o.vd.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.Sd,
|
|
174
174
|
);
|
|
175
175
|
}),
|
|
176
176
|
(d.onsuccess = (t) => {
|
|
@@ -183,14 +183,14 @@ export default class A {
|
|
|
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.Bd((i) => {
|
|
187
187
|
if (!i.objectStoreNames.contains(t))
|
|
188
188
|
return (
|
|
189
|
-
o.
|
|
189
|
+
o.vd.error(
|
|
190
190
|
"Could not retrieve last record from " +
|
|
191
191
|
t +
|
|
192
192
|
" on indexedDB " +
|
|
193
|
-
o.database.
|
|
193
|
+
o.database.Sd +
|
|
194
194
|
" - " +
|
|
195
195
|
t +
|
|
196
196
|
" is not a valid objectStore",
|
|
@@ -202,8 +202,8 @@ export default class A {
|
|
|
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.vd.error(
|
|
206
|
+
"Could not open cursor for " + t + " on indexedDB " + o.database.Sd,
|
|
207
207
|
),
|
|
208
208
|
"function" == typeof n && n();
|
|
209
209
|
}),
|
|
@@ -219,16 +219,16 @@ export default class A {
|
|
|
219
219
|
re(t, e) {
|
|
220
220
|
if (!this.isSupported()) return !1;
|
|
221
221
|
const n = this;
|
|
222
|
-
return this.
|
|
222
|
+
return this.Bd((o) => {
|
|
223
223
|
if (!o.objectStoreNames.contains(t))
|
|
224
224
|
return (
|
|
225
|
-
n.
|
|
225
|
+
n.vd.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.Sd +
|
|
232
232
|
" - " +
|
|
233
233
|
t +
|
|
234
234
|
" is not a valid objectStore",
|
|
@@ -238,13 +238,13 @@ export default class A {
|
|
|
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.vd.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.Sd,
|
|
248
248
|
);
|
|
249
249
|
};
|
|
250
250
|
});
|
|
@@ -252,14 +252,14 @@ export default class A {
|
|
|
252
252
|
Zt(t, e) {
|
|
253
253
|
if (!this.isSupported()) return !1;
|
|
254
254
|
const n = this;
|
|
255
|
-
return this.
|
|
255
|
+
return this.Bd((o) => {
|
|
256
256
|
if (!o.objectStoreNames.contains(t))
|
|
257
257
|
return (
|
|
258
|
-
n.
|
|
258
|
+
n.vd.error(
|
|
259
259
|
"Could not retrieve objects from " +
|
|
260
260
|
t +
|
|
261
261
|
" on indexedDB " +
|
|
262
|
-
n.database.
|
|
262
|
+
n.database.Sd +
|
|
263
263
|
" - " +
|
|
264
264
|
t +
|
|
265
265
|
" is not a valid objectStore",
|
|
@@ -273,18 +273,18 @@ export default class A {
|
|
|
273
273
|
s = [];
|
|
274
274
|
(d.onerror = () => {
|
|
275
275
|
s.length > 0
|
|
276
|
-
? (n.
|
|
276
|
+
? (n.vd.info(
|
|
277
277
|
"Cursor closed midway through for " +
|
|
278
278
|
t +
|
|
279
279
|
" on indexedDB " +
|
|
280
|
-
n.database.
|
|
280
|
+
n.database.Sd,
|
|
281
281
|
),
|
|
282
282
|
e(s))
|
|
283
|
-
: n.
|
|
283
|
+
: n.vd.error(
|
|
284
284
|
"Could not open cursor for " +
|
|
285
285
|
t +
|
|
286
286
|
" on indexedDB " +
|
|
287
|
-
n.database.
|
|
287
|
+
n.database.Sd,
|
|
288
288
|
);
|
|
289
289
|
}),
|
|
290
290
|
(d.onsuccess = (t) => {
|
|
@@ -311,23 +311,23 @@ export default class A {
|
|
|
311
311
|
t.push(this.database.ss[n]);
|
|
312
312
|
}
|
|
313
313
|
const e = this;
|
|
314
|
-
return this.
|
|
314
|
+
return this.Bd(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.vd.error(
|
|
321
321
|
"Could not clear " +
|
|
322
322
|
this.source.name +
|
|
323
323
|
" on indexedDB " +
|
|
324
|
-
e.database.
|
|
324
|
+
e.database.Sd,
|
|
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.vd.error(
|
|
330
|
+
"Could not clear object stores on indexedDB " + e.database.Sd,
|
|
331
331
|
);
|
|
332
332
|
};
|
|
333
333
|
});
|
|
@@ -335,17 +335,17 @@ export default class A {
|
|
|
335
335
|
}
|
|
336
336
|
A.Yt = {
|
|
337
337
|
Qt: {
|
|
338
|
-
|
|
338
|
+
Sd: "AppboyServiceWorkerAsyncStorage",
|
|
339
339
|
VERSION: 6,
|
|
340
340
|
ss: {
|
|
341
|
-
|
|
341
|
+
$a: "data",
|
|
342
342
|
hr: "pushClicks",
|
|
343
343
|
cu: "pushSubscribed",
|
|
344
|
-
|
|
344
|
+
Cd: "fallbackDevice",
|
|
345
345
|
ts: "cardUpdates",
|
|
346
346
|
ae: "optOut",
|
|
347
347
|
wr: "pendingData",
|
|
348
|
-
|
|
348
|
+
jh: "sdkAuthenticationSignature",
|
|
349
349
|
},
|
|
350
350
|
ie: 1,
|
|
351
351
|
},
|
package/shared-lib/logger.js
CHANGED
|
@@ -3,11 +3,11 @@ const r = {
|
|
|
3
3
|
(void 0 === n && void 0 !== r.zg) || (r.zg = !!n), r.t || (r.t = !0);
|
|
4
4
|
},
|
|
5
5
|
destroy: function () {
|
|
6
|
-
(r.t = !1), (r.zg = void 0), (r.
|
|
6
|
+
(r.t = !1), (r.zg = void 0), (r.vd = void 0);
|
|
7
7
|
},
|
|
8
8
|
setLogger: function (n) {
|
|
9
9
|
"function" == typeof n
|
|
10
|
-
? (r.init(), (r.
|
|
10
|
+
? (r.init(), (r.vd = n))
|
|
11
11
|
: r.info("Ignoring setLogger call since logger is not a function");
|
|
12
12
|
},
|
|
13
13
|
toggleLogging: function () {
|
|
@@ -19,19 +19,19 @@ const r = {
|
|
|
19
19
|
info: function (n) {
|
|
20
20
|
if (r.zg) {
|
|
21
21
|
const o = "Braze: " + n;
|
|
22
|
-
null != r.
|
|
22
|
+
null != r.vd ? r.vd(o) : console.log(o);
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
warn: function (n) {
|
|
26
26
|
if (r.zg) {
|
|
27
|
-
const o = "Braze SDK Warning: " + n + " (v5.
|
|
28
|
-
null != r.
|
|
27
|
+
const o = "Braze SDK Warning: " + n + " (v5.3.0)";
|
|
28
|
+
null != r.vd ? r.vd(o) : console.warn(o);
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
error: function (n) {
|
|
32
32
|
if (r.zg) {
|
|
33
|
-
const o = "Braze SDK Error: " + n + " (v5.
|
|
34
|
-
null != r.
|
|
33
|
+
const o = "Braze SDK Error: " + n + " (v5.3.0)";
|
|
34
|
+
null != r.vd ? r.vd(o) : console.error(o);
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
};
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
Eo: "allowCrawlerActivity",
|
|
3
|
+
_o: "baseUrl",
|
|
4
|
+
Io: "noCookies",
|
|
5
|
+
Ao: "devicePropertyAllowlist",
|
|
6
|
+
_a: "disablePushTokenMaintenance",
|
|
7
|
+
So: "enableLogging",
|
|
8
|
+
No: "enableSdkAuthentication",
|
|
9
|
+
Ma: "manageServiceWorkerExternally",
|
|
10
|
+
Oo: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
11
|
+
Po: "sessionTimeoutInSeconds",
|
|
12
|
+
Ro: "appVersion",
|
|
13
|
+
Lo: "appVersionNumber",
|
|
14
|
+
wa: "serviceWorkerLocation",
|
|
15
|
+
ya: "safariWebsitePushId",
|
|
16
|
+
zn: "localization",
|
|
17
|
+
bo: "contentSecurityNonce",
|
|
18
|
+
Do: "allowUserSuppliedJavascript",
|
|
19
|
+
jo: "inAppMessageZIndex",
|
|
20
|
+
ho: "openInAppMessagesInNewTab",
|
|
21
21
|
en: "openNewsFeedCardsInNewTab",
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
Lh: "requireExplicitInAppMessageDismissal",
|
|
23
|
+
Mo: "doNotLoadFontAwesome",
|
|
24
|
+
Uo: "deviceId",
|
|
24
25
|
Bo: "sdkFlavor",
|
|
25
26
|
tn: "openCardsInNewTab",
|
|
26
27
|
};
|