@braze/web-sdk 4.2.1 → 4.4.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 +57 -6
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +8 -1
- package/shared-lib/encoding-utils.js +12 -1
- package/shared-lib/event-types.js +32 -1
- package/shared-lib/guid.js +10 -1
- package/shared-lib/indexed-db-adapter.js +315 -1
- package/shared-lib/logger.js +38 -1
- package/shared-lib/supported-options.js +26 -1
- package/src/Card/card-manager-factory.js +14 -1
- package/src/Card/card-manager.js +72 -1
- package/src/Card/display/card-display.js +134 -1
- package/src/Card/index.js +5 -1
- package/src/Card/log-card-click.js +11 -1
- package/src/Card/log-card-dismissal.js +11 -1
- package/src/Card/log-card-impressions.js +13 -1
- package/src/Card/log-content-card-impressions.js +4 -1
- package/src/Card/models/banner.js +30 -1
- package/src/Card/models/captioned-image.js +32 -1
- package/src/Card/models/card.js +174 -1
- package/src/Card/models/classic-card.js +32 -1
- package/src/Card/models/control-card.js +38 -1
- package/src/Card/models/index.js +5 -1
- package/src/Card/util/card-factory.js +104 -1
- package/src/ContentCards/content-cards-provider-factory.js +20 -1
- package/src/ContentCards/content-cards-provider.js +283 -1
- package/src/ContentCards/content-cards.js +24 -1
- package/src/ContentCards/get-cached-content-cards.js +5 -1
- package/src/ContentCards/index.js +8 -1
- package/src/ContentCards/log-content-cards-displayed.js +5 -1
- package/src/ContentCards/request-content-cards-refresh.js +5 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +14 -1
- package/src/ContentCards/ui/hide-content-cards.js +8 -1
- package/src/ContentCards/ui/show-content-cards.js +72 -1
- package/src/ContentCards/ui/toggle-content-cards.js +8 -1
- package/src/Core/add-sdk-metadata.js +27 -1
- package/src/Core/braze-sdk-metadata.js +10 -1
- package/src/Core/change-user.js +19 -1
- package/src/Core/destroy.js +5 -1
- package/src/Core/device-properties.js +9 -1
- package/src/Core/disable-sdk.js +10 -1
- package/src/Core/enable-sdk.js +8 -1
- package/src/Core/get-device-id.js +10 -1
- package/src/Core/get-user.js +4 -1
- package/src/Core/handle-braze-action.js +64 -1
- package/src/Core/index.js +23 -1
- package/src/Core/initialize.js +4 -1
- package/src/Core/is-disabled.js +4 -1
- package/src/Core/log-custom-event.js +36 -1
- package/src/Core/log-purchase.js +245 -1
- package/src/Core/open-session.js +23 -1
- package/src/Core/remove-all-subscriptions.js +4 -1
- package/src/Core/remove-subscription.js +4 -1
- package/src/Core/request-immediate-data-flush.js +4 -1
- package/src/Core/set-logger.js +4 -1
- package/src/Core/set-sdk-authentication-signature.js +9 -1
- package/src/Core/subscribe-to-sdk-authentication-failures.js +4 -1
- package/src/Core/toggle-logging.js +4 -1
- package/src/Core/wipe-data.js +15 -1
- package/src/FeatureFlags/feature-flag-factory.js +14 -0
- package/src/FeatureFlags/feature-flag.js +16 -0
- package/src/FeatureFlags/feature-flags-provider-factory.js +19 -0
- package/src/FeatureFlags/feature-flags-provider.js +94 -0
- package/src/FeatureFlags/get-all-feature-flags.js +12 -0
- package/src/FeatureFlags/get-feature-flag.js +12 -0
- package/src/FeatureFlags/index.js +4 -0
- package/src/FeatureFlags/refresh-feature-flags.js +9 -0
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +6 -0
- package/src/Feed/feed-provider-factory.js +18 -1
- package/src/Feed/feed-provider.js +79 -1
- package/src/Feed/feed.js +20 -1
- package/src/Feed/get-cached-feed.js +5 -1
- package/src/Feed/index.js +8 -1
- package/src/Feed/log-feed-displayed.js +5 -1
- package/src/Feed/request-feed-refresh.js +5 -1
- package/src/Feed/subscribe-to-feed-updates.js +5 -1
- package/src/Feed/ui/hide-feed.js +7 -1
- package/src/Feed/ui/show-feed.js +89 -1
- package/src/Feed/ui/toggle-feed.js +8 -1
- package/src/InAppMessage/display/get-animation-effect.js +19 -1
- package/src/InAppMessage/display/html-message-to-html.js +223 -1
- package/src/InAppMessage/display/in-app-message-to-html.js +152 -1
- package/src/InAppMessage/display/modal-utils.js +68 -1
- package/src/InAppMessage/in-app-message-factory.js +145 -1
- package/src/InAppMessage/in-app-message-manager-factory.js +16 -1
- package/src/InAppMessage/in-app-message-manager.js +189 -1
- package/src/InAppMessage/index.js +14 -1
- package/src/InAppMessage/log-in-app-message-button-click.js +19 -1
- package/src/InAppMessage/log-in-app-message-click.js +16 -1
- package/src/InAppMessage/log-in-app-message-html-click.js +23 -1
- package/src/InAppMessage/log-in-app-message-impression.js +13 -1
- package/src/InAppMessage/models/control-message.js +8 -1
- package/src/InAppMessage/models/full-screen-message.js +71 -1
- package/src/InAppMessage/models/html-message.js +54 -1
- package/src/InAppMessage/models/in-app-message-button.js +40 -1
- package/src/InAppMessage/models/in-app-message.js +267 -1
- package/src/InAppMessage/models/modal-message.js +68 -1
- package/src/InAppMessage/models/slide-up-message.js +58 -1
- package/src/InAppMessage/models/templated-in-app-message.js +14 -1
- package/src/InAppMessage/subscribe-to-in-app-message.js +10 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +15 -1
- package/src/InAppMessage/ui/show-in-app-message.js +170 -1
- package/src/Push/index.js +5 -1
- package/src/Push/is-push-blocked.js +5 -1
- package/src/Push/is-push-permission-granted.js +5 -1
- package/src/Push/is-push-supported.js +5 -1
- package/src/Push/push-manager-factory.js +30 -1
- package/src/Push/push-manager.js +360 -1
- package/src/Push/request-push-permission.js +8 -1
- package/src/Push/unregister-push.js +5 -1
- package/src/Push/utils/push-utils.js +34 -1
- package/src/User/index.js +1 -1
- package/src/User/user-manager.js +70 -1
- package/src/User/user.js +278 -1
- package/src/common/base-feed.js +25 -1
- package/src/common/base-provider.js +6 -1
- package/src/common/constants.js +5 -1
- package/src/common/event-logger.js +24 -1
- package/src/common/feed-display.js +200 -1
- package/src/common/translations.js +148 -1
- package/src/index.js +9 -1
- package/src/l10n/l10n-manager-factory.js +22 -1
- package/src/l10n/l10n-manager.js +21 -1
- package/src/managers/auth-manager.js +48 -1
- package/src/managers/braze-instance.js +307 -1
- package/src/managers/device-manager.js +80 -1
- package/src/managers/network-manager.js +219 -1
- package/src/managers/server-config-manager.js +88 -1
- package/src/managers/session-manager.js +68 -1
- package/src/managers/storage-manager-factory.js +35 -1
- package/src/managers/storage-manager.js +394 -1
- package/src/managers/subscription-manager.js +25 -1
- package/src/models/backend-errors.js +8 -1
- package/src/models/braze-event.js +41 -1
- package/src/models/braze-sdk-metadata.js +10 -1
- package/src/models/device.js +26 -1
- package/src/models/identifier.js +20 -1
- package/src/models/push-token.js +22 -1
- package/src/models/request-result.js +8 -1
- package/src/models/server-config.js +32 -1
- package/src/request-controller.js +288 -1
- package/src/triggers/models/custom-event-data.js +14 -1
- package/src/triggers/models/custom-event-property-data.js +21 -1
- package/src/triggers/models/filter-set.js +55 -1
- package/src/triggers/models/filter.js +98 -1
- package/src/triggers/models/in-app-message-click-data.js +25 -1
- package/src/triggers/models/purchase-data.js +14 -1
- package/src/triggers/models/purchase-property-data.js +21 -1
- package/src/triggers/models/push-click-data.js +15 -1
- package/src/triggers/models/trigger-condition.js +109 -1
- package/src/triggers/models/trigger-events.js +8 -1
- package/src/triggers/models/trigger.js +110 -1
- package/src/triggers/triggers-provider-factory.js +30 -1
- package/src/triggers/triggers-provider.js +307 -1
- package/src/ui/js/attach-css.js +12 -1
- package/src/ui/js/feed-css.js +12 -1
- package/src/ui/js/iam-css.js +12 -1
- package/src/ui/js/index.js +3 -1
- package/src/ui/js/load-font-awesome.js +13 -1
- package/src/util/base-device-parser.js +14 -1
- package/src/util/braze-actions.js +79 -1
- package/src/util/browser-detector.js +85 -1
- package/src/util/client-hints-parser.js +60 -1
- package/src/util/code-utils.js +92 -1
- package/src/util/color-utils.js +23 -1
- package/src/util/component-utils.js +26 -1
- package/src/util/date-utils.js +27 -1
- package/src/util/deprecation-utils.js +5 -1
- package/src/util/device-constants.js +14 -1
- package/src/util/dom-utils.js +87 -1
- package/src/util/key-codes.js +1 -1
- package/src/util/math.js +5 -1
- package/src/util/net.js +75 -1
- package/src/util/string-utils.js +22 -1
- package/src/util/url-utils.js +23 -1
- package/src/util/user-agent-parser.js +85 -1
- package/src/util/validation-utils.js +136 -1
- package/src/util/window-utils.js +35 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Type definitions for @braze/web-sdk v4.
|
|
2
|
+
* Type definitions for @braze/web-sdk v4.4.0
|
|
3
3
|
* Project: https://github.com/braze-inc/braze-web-sdk
|
|
4
4
|
* (c) Braze, Inc. 2022 - http://braze.com
|
|
5
5
|
* License available at https://github.com/braze-inc/braze-web-sdk/blob/master/LICENSE
|
|
@@ -1484,6 +1484,17 @@
|
|
|
1484
1484
|
subscribeToClickedEvent(subscriber: () => void): string;
|
|
1485
1485
|
}
|
|
1486
1486
|
|
|
1487
|
+
export interface FeatureFlag {
|
|
1488
|
+
/** Indicates whether or not this feature flag is enabled. */
|
|
1489
|
+
enabled: boolean;
|
|
1490
|
+
|
|
1491
|
+
/** Properties of this feature flag, listed as key-value pairs. */
|
|
1492
|
+
properties: object;
|
|
1493
|
+
|
|
1494
|
+
/** The ID for this feature flag. */
|
|
1495
|
+
id: string;
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1487
1498
|
/**
|
|
1488
1499
|
* Automatically display in-app messages when they are triggered. This method should be called before
|
|
1489
1500
|
* calling `openSession`.
|
|
@@ -1902,9 +1913,10 @@
|
|
|
1902
1913
|
): boolean;
|
|
1903
1914
|
|
|
1904
1915
|
/**
|
|
1905
|
-
* Opens a new session, or resumes the previous session if this browser had activity within the
|
|
1906
|
-
*
|
|
1907
|
-
*
|
|
1916
|
+
* Opens a new session, or resumes the previous session if this browser had activity within the `sessionTimeoutInSeconds` value.
|
|
1917
|
+
* When a new session is opened, this refreshes In-App Messages. Content Cards are refreshed automatically if
|
|
1918
|
+
* the `subscribeToContentCardsUpdates` has been registered prior to `openSession`. If the user has previously
|
|
1919
|
+
* granted the site permission to send push, automatically sends the push registration to the Braze backend.
|
|
1908
1920
|
*/
|
|
1909
1921
|
export function openSession(): void;
|
|
1910
1922
|
|
|
@@ -1920,7 +1932,7 @@
|
|
|
1920
1932
|
* - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
|
|
1921
1933
|
*
|
|
1922
1934
|
* ```
|
|
1923
|
-
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.
|
|
1935
|
+
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.4/service-worker.js');
|
|
1924
1936
|
* ```
|
|
1925
1937
|
*
|
|
1926
1938
|
* For more details, see [Our Product Documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
|
|
@@ -1974,6 +1986,16 @@
|
|
|
1974
1986
|
*/
|
|
1975
1987
|
export function requestFeedRefresh(): void;
|
|
1976
1988
|
|
|
1989
|
+
/**
|
|
1990
|
+
* Requests an immediate refresh of feature flags from Braze servers. By default, feature flags are refreshed when
|
|
1991
|
+
* a new session starts. If you want to refresh feature flags from the server at another time you must call this function.
|
|
1992
|
+
*
|
|
1993
|
+
* @param successCallback - Callback that is invoked when the feature flags refresh request has been successfully completed.
|
|
1994
|
+
* This callback is useful for determining when a request has completed regardless of whether new feature flags were returned.
|
|
1995
|
+
* @param errorCallback - Callback that is invoked when an error occurs during the refresh.
|
|
1996
|
+
*/
|
|
1997
|
+
export function refreshFeatureFlags(successCallback?: () => void, errorCallback?: () => void): void;
|
|
1998
|
+
|
|
1977
1999
|
/**
|
|
1978
2000
|
* By default, data logged to Braze through the SDK is queued locally (in HTML 5 localStorage when available, and
|
|
1979
2001
|
* in memory otherwise) and sent to Braze's servers asynchronously on a regular interval (10 seconds when localStorage is available
|
|
@@ -2138,6 +2160,35 @@
|
|
|
2138
2160
|
*/
|
|
2139
2161
|
export function handleBrazeAction(url: string, openLinkInNewTab?: boolean): void;
|
|
2140
2162
|
|
|
2163
|
+
/**
|
|
2164
|
+
* Gets a feature flag by its ID.
|
|
2165
|
+
*
|
|
2166
|
+
* @param id - The ID of the feature flag.
|
|
2167
|
+
* @returns - An object of type `FeatureFlag`.
|
|
2168
|
+
*/
|
|
2169
|
+
export function getFeatureFlag(id: string): FeatureFlag;
|
|
2170
|
+
|
|
2171
|
+
/**
|
|
2172
|
+
* Subscribe to feature flag updates. The subscriber callback will be called whenever feature flags are updated. This method
|
|
2173
|
+
* should be called before calling `openSession`.
|
|
2174
|
+
*
|
|
2175
|
+
* @param subscriber - The callback function to handle new feature flags. This function will be called with a list of `FeatureFlag`
|
|
2176
|
+
* objects, including all feature flags currently available. If you want to be notified when a refresh has completed
|
|
2177
|
+
* regardless of whether new feature flags are available, you should use the `successCallback` of `refreshFeatureFlags`.
|
|
2178
|
+
*
|
|
2179
|
+
* @returns The identifier of the subscription created. This can be passed to `removeSubscription` to cancel the subscription.
|
|
2180
|
+
*/
|
|
2181
|
+
export function subscribeToFeatureFlagsUpdates(
|
|
2182
|
+
subscriber: (featureFlags: FeatureFlag[]) => void
|
|
2183
|
+
): string;
|
|
2184
|
+
|
|
2185
|
+
/**
|
|
2186
|
+
* Gets all available feature flags.
|
|
2187
|
+
*
|
|
2188
|
+
* @returns - A list of `FeatureFlag` objects.
|
|
2189
|
+
*/
|
|
2190
|
+
export function getAllFeatureFlags(): FeatureFlag[];
|
|
2191
|
+
|
|
2141
2192
|
/**
|
|
2142
2193
|
* Supported initialization options
|
|
2143
2194
|
*
|
|
@@ -2234,7 +2285,7 @@
|
|
|
2234
2285
|
* lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
|
|
2235
2286
|
* option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
|
|
2236
2287
|
* `requestPushPermission`, and ensure that it contains Braze's service worker code, either with
|
|
2237
|
-
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.
|
|
2288
|
+
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.4/service-worker.js');` or by including the content
|
|
2238
2289
|
* of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
|
|
2239
2290
|
*/
|
|
2240
2291
|
manageServiceWorkerExternally?: boolean;
|
package/package.json
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ve from "./encoding-utils.js";
|
|
2
|
+
import { EventTypes as De, InternalEventTypes as Be } from "./event-types.js";
|
|
3
|
+
import Ae from "./guid.js";
|
|
4
|
+
import Ge from "./indexed-db-adapter.js";
|
|
5
|
+
import Oe from "./logger.js";
|
|
6
|
+
import Ue from "./supported-options.js";
|
|
7
|
+
const r = { vn: ve, A: De, qr: Be, it: Ae, qt: Ge, xt: Ge.ep, D: Oe, Fo: Ue };
|
|
8
|
+
export default r;
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
const
|
|
1
|
+
const ve = {
|
|
2
|
+
yn: function(t) {
|
|
3
|
+
const r = (t + "=".repeat((4 - (t.length % 4)) % 4))
|
|
4
|
+
.replace(/\-/g, "+")
|
|
5
|
+
.replace(/_/g, "/"),
|
|
6
|
+
n = atob(r),
|
|
7
|
+
o = new Uint8Array(n.length);
|
|
8
|
+
for (let t = 0; t < n.length; ++t) o[t] = n.charCodeAt(t);
|
|
9
|
+
return o;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export default ve;
|
|
@@ -1 +1,32 @@
|
|
|
1
|
-
const
|
|
1
|
+
const De = {
|
|
2
|
+
CustomEvent: "ce",
|
|
3
|
+
Pr: "p",
|
|
4
|
+
Ul: "pc",
|
|
5
|
+
cc: "ca",
|
|
6
|
+
Aa: "i",
|
|
7
|
+
qs: "ie",
|
|
8
|
+
T: "cci",
|
|
9
|
+
W: "ccic",
|
|
10
|
+
_: "ccc",
|
|
11
|
+
L: "ccd",
|
|
12
|
+
Ch: "ss",
|
|
13
|
+
dh: "se",
|
|
14
|
+
gi: "si",
|
|
15
|
+
pi: "sc",
|
|
16
|
+
mi: "sbc",
|
|
17
|
+
ui: "sfe",
|
|
18
|
+
ro: "iec",
|
|
19
|
+
Ol: "lr",
|
|
20
|
+
Nl: "uae",
|
|
21
|
+
U: "ci",
|
|
22
|
+
F: "cc",
|
|
23
|
+
Wl: "lcaa",
|
|
24
|
+
Kl: "lcar",
|
|
25
|
+
Fn: "inc",
|
|
26
|
+
Un: "add",
|
|
27
|
+
En: "rem",
|
|
28
|
+
An: "set",
|
|
29
|
+
Bl: "sgu"
|
|
30
|
+
},
|
|
31
|
+
Be = { Fr: "feed_displayed", dc: "content_cards_displayed" };
|
|
32
|
+
export { De as EventTypes, Be as InternalEventTypes };
|
package/shared-lib/guid.js
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Ae = {
|
|
2
|
+
nt: () => {
|
|
3
|
+
const t = t => {
|
|
4
|
+
const e = (Math.random().toString(16) + "000000000").substr(2, 8);
|
|
5
|
+
return t ? "-" + e.substr(0, 4) + "-" + e.substr(4, 4) : e;
|
|
6
|
+
};
|
|
7
|
+
return t() + t(!0) + t(!0) + t();
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
export default Ae;
|
|
@@ -1 +1,315 @@
|
|
|
1
|
-
export default class
|
|
1
|
+
export default class Ge {
|
|
2
|
+
constructor(t, e) {
|
|
3
|
+
(this.td = "undefined" == typeof window ? self : window),
|
|
4
|
+
(this.ed = t),
|
|
5
|
+
(this.nd = e);
|
|
6
|
+
}
|
|
7
|
+
od() {
|
|
8
|
+
if ("indexedDB" in this.td) return this.td.indexedDB;
|
|
9
|
+
}
|
|
10
|
+
rd() {
|
|
11
|
+
try {
|
|
12
|
+
if (null == this.od()) return !1;
|
|
13
|
+
{
|
|
14
|
+
const t = this.od().open("Braze IndexedDB Support Test");
|
|
15
|
+
if (
|
|
16
|
+
((t.onupgradeneeded = () => t.result.close()),
|
|
17
|
+
(t.onsuccess = () => t.result.close()),
|
|
18
|
+
"undefined" != typeof window)
|
|
19
|
+
) {
|
|
20
|
+
const t = window.chrome || window.browser || window.msBrowser;
|
|
21
|
+
if (t && t.runtime && t.runtime.id)
|
|
22
|
+
return (
|
|
23
|
+
this.nd.info(
|
|
24
|
+
"Not using IndexedDB for storage because we are running inside an extension"
|
|
25
|
+
),
|
|
26
|
+
!1
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return !0;
|
|
30
|
+
}
|
|
31
|
+
} catch (t) {
|
|
32
|
+
return (
|
|
33
|
+
this.nd.info(
|
|
34
|
+
"Not using IndexedDB for storage due to following error: " + t
|
|
35
|
+
),
|
|
36
|
+
!1
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
sd(t, e) {
|
|
41
|
+
const n = this.od().open(this.ed.dd, this.ed.VERSION);
|
|
42
|
+
if (null == n) return "function" == typeof e && e(), !1;
|
|
43
|
+
const o = this;
|
|
44
|
+
return (
|
|
45
|
+
(n.onupgradeneeded = t => {
|
|
46
|
+
o.nd.info(
|
|
47
|
+
"Upgrading indexedDB " + o.ed.dd + " to v" + o.ed.VERSION + "..."
|
|
48
|
+
);
|
|
49
|
+
const e = t.target.result;
|
|
50
|
+
for (const t in o.ed.$t)
|
|
51
|
+
o.ed.$t.hasOwnProperty(t) &&
|
|
52
|
+
!e.objectStoreNames.contains(o.ed.$t[t]) &&
|
|
53
|
+
e.createObjectStore(o.ed.$t[t]);
|
|
54
|
+
}),
|
|
55
|
+
(n.onsuccess = n => {
|
|
56
|
+
const i = n.target.result;
|
|
57
|
+
(i.onversionchange = () => {
|
|
58
|
+
i.close(),
|
|
59
|
+
"function" == typeof e && e(),
|
|
60
|
+
o.nd.error(
|
|
61
|
+
"Needed to close the database unexpectedly because of an upgrade in another tab"
|
|
62
|
+
);
|
|
63
|
+
}),
|
|
64
|
+
t(i);
|
|
65
|
+
}),
|
|
66
|
+
(n.onerror = t => (
|
|
67
|
+
o.nd.info(
|
|
68
|
+
"Could not open indexedDB " +
|
|
69
|
+
o.ed.dd +
|
|
70
|
+
" v" +
|
|
71
|
+
o.ed.VERSION +
|
|
72
|
+
": " +
|
|
73
|
+
t.target.errorCode
|
|
74
|
+
),
|
|
75
|
+
"function" == typeof e && e(),
|
|
76
|
+
!0
|
|
77
|
+
)),
|
|
78
|
+
!0
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
setItem(t, e, n, o, i) {
|
|
82
|
+
if (!this.rd()) return "function" == typeof i && i(), !1;
|
|
83
|
+
const r = this;
|
|
84
|
+
return this.sd(s => {
|
|
85
|
+
if (!s.objectStoreNames.contains(t))
|
|
86
|
+
return (
|
|
87
|
+
r.nd.error(
|
|
88
|
+
"Could not store object " +
|
|
89
|
+
e +
|
|
90
|
+
" in " +
|
|
91
|
+
t +
|
|
92
|
+
" on indexedDB " +
|
|
93
|
+
r.ed.dd +
|
|
94
|
+
" - " +
|
|
95
|
+
t +
|
|
96
|
+
" is not a valid objectStore"
|
|
97
|
+
),
|
|
98
|
+
"function" == typeof i && i(),
|
|
99
|
+
void s.close()
|
|
100
|
+
);
|
|
101
|
+
const d = s.transaction([t], "readwrite");
|
|
102
|
+
d.oncomplete = () => s.close();
|
|
103
|
+
const u = d.objectStore(t).put(n, e);
|
|
104
|
+
(u.onerror = () => {
|
|
105
|
+
r.nd.error(
|
|
106
|
+
"Could not store object " +
|
|
107
|
+
e +
|
|
108
|
+
" in " +
|
|
109
|
+
t +
|
|
110
|
+
" on indexedDB " +
|
|
111
|
+
r.ed.dd
|
|
112
|
+
),
|
|
113
|
+
"function" == typeof i && i();
|
|
114
|
+
}),
|
|
115
|
+
(u.onsuccess = () => {
|
|
116
|
+
"function" == typeof o && o();
|
|
117
|
+
});
|
|
118
|
+
}, i);
|
|
119
|
+
}
|
|
120
|
+
getItem(t, e, n) {
|
|
121
|
+
if (!this.rd()) return !1;
|
|
122
|
+
const o = this;
|
|
123
|
+
return this.sd(i => {
|
|
124
|
+
if (!i.objectStoreNames.contains(t))
|
|
125
|
+
return (
|
|
126
|
+
o.nd.error(
|
|
127
|
+
"Could not retrieve object " +
|
|
128
|
+
e +
|
|
129
|
+
" in " +
|
|
130
|
+
t +
|
|
131
|
+
" on indexedDB " +
|
|
132
|
+
o.ed.dd +
|
|
133
|
+
" - " +
|
|
134
|
+
t +
|
|
135
|
+
" is not a valid objectStore"
|
|
136
|
+
),
|
|
137
|
+
void i.close()
|
|
138
|
+
);
|
|
139
|
+
const r = i.transaction([t], "readonly");
|
|
140
|
+
r.oncomplete = () => i.close();
|
|
141
|
+
const s = r.objectStore(t).get(e);
|
|
142
|
+
(s.onerror = () => {
|
|
143
|
+
o.nd.error(
|
|
144
|
+
"Could not retrieve object " +
|
|
145
|
+
e +
|
|
146
|
+
" in " +
|
|
147
|
+
t +
|
|
148
|
+
" on indexedDB " +
|
|
149
|
+
o.ed.dd
|
|
150
|
+
);
|
|
151
|
+
}),
|
|
152
|
+
(s.onsuccess = t => {
|
|
153
|
+
const e = t.target.result;
|
|
154
|
+
null != e && n(e);
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
hr(t, e, n) {
|
|
159
|
+
if (!this.rd()) return "function" == typeof n && n(), !1;
|
|
160
|
+
const o = this;
|
|
161
|
+
return this.sd(i => {
|
|
162
|
+
if (!i.objectStoreNames.contains(t))
|
|
163
|
+
return (
|
|
164
|
+
o.nd.error(
|
|
165
|
+
"Could not retrieve last record from " +
|
|
166
|
+
t +
|
|
167
|
+
" on indexedDB " +
|
|
168
|
+
o.ed.dd +
|
|
169
|
+
" - " +
|
|
170
|
+
t +
|
|
171
|
+
" is not a valid objectStore"
|
|
172
|
+
),
|
|
173
|
+
"function" == typeof n && n(),
|
|
174
|
+
void i.close()
|
|
175
|
+
);
|
|
176
|
+
const r = i.transaction([t], "readonly");
|
|
177
|
+
r.oncomplete = () => i.close();
|
|
178
|
+
const s = r.objectStore(t).openCursor(null, "prev");
|
|
179
|
+
(s.onerror = () => {
|
|
180
|
+
o.nd.error(
|
|
181
|
+
"Could not open cursor for " + t + " on indexedDB " + o.ed.dd
|
|
182
|
+
),
|
|
183
|
+
"function" == typeof n && n();
|
|
184
|
+
}),
|
|
185
|
+
(s.onsuccess = t => {
|
|
186
|
+
const o = t.target.result;
|
|
187
|
+
null != o && null != o.value && null != o.key
|
|
188
|
+
? e(o.key, o.value)
|
|
189
|
+
: "function" == typeof n && n();
|
|
190
|
+
});
|
|
191
|
+
}, n);
|
|
192
|
+
}
|
|
193
|
+
br(t, e) {
|
|
194
|
+
if (!this.rd()) return !1;
|
|
195
|
+
const n = this;
|
|
196
|
+
return this.sd(o => {
|
|
197
|
+
if (!o.objectStoreNames.contains(t))
|
|
198
|
+
return (
|
|
199
|
+
n.nd.error(
|
|
200
|
+
"Could not delete record " +
|
|
201
|
+
e +
|
|
202
|
+
" from " +
|
|
203
|
+
t +
|
|
204
|
+
" on indexedDB " +
|
|
205
|
+
n.ed.dd +
|
|
206
|
+
" - " +
|
|
207
|
+
t +
|
|
208
|
+
" is not a valid objectStore"
|
|
209
|
+
),
|
|
210
|
+
void o.close()
|
|
211
|
+
);
|
|
212
|
+
const i = o.transaction([t], "readwrite");
|
|
213
|
+
i.oncomplete = () => o.close();
|
|
214
|
+
i.objectStore(t).delete(e).onerror = () => {
|
|
215
|
+
n.nd.error(
|
|
216
|
+
"Could not delete record " +
|
|
217
|
+
e +
|
|
218
|
+
" from " +
|
|
219
|
+
t +
|
|
220
|
+
" on indexedDB " +
|
|
221
|
+
n.ed.dd
|
|
222
|
+
);
|
|
223
|
+
};
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
Jt(t, e) {
|
|
227
|
+
if (!this.rd()) return !1;
|
|
228
|
+
const n = this;
|
|
229
|
+
return this.sd(o => {
|
|
230
|
+
if (!o.objectStoreNames.contains(t))
|
|
231
|
+
return (
|
|
232
|
+
n.nd.error(
|
|
233
|
+
"Could not retrieve objects from " +
|
|
234
|
+
t +
|
|
235
|
+
" on indexedDB " +
|
|
236
|
+
n.ed.dd +
|
|
237
|
+
" - " +
|
|
238
|
+
t +
|
|
239
|
+
" is not a valid objectStore"
|
|
240
|
+
),
|
|
241
|
+
void o.close()
|
|
242
|
+
);
|
|
243
|
+
const i = o.transaction([t], "readwrite");
|
|
244
|
+
i.oncomplete = () => o.close();
|
|
245
|
+
const r = i.objectStore(t),
|
|
246
|
+
s = r.openCursor(),
|
|
247
|
+
d = [];
|
|
248
|
+
(s.onerror = () => {
|
|
249
|
+
d.length > 0
|
|
250
|
+
? (n.nd.info(
|
|
251
|
+
"Cursor closed midway through for " +
|
|
252
|
+
t +
|
|
253
|
+
" on indexedDB " +
|
|
254
|
+
n.ed.dd
|
|
255
|
+
),
|
|
256
|
+
e(d))
|
|
257
|
+
: n.nd.error(
|
|
258
|
+
"Could not open cursor for " + t + " on indexedDB " + n.ed.dd
|
|
259
|
+
);
|
|
260
|
+
}),
|
|
261
|
+
(s.onsuccess = t => {
|
|
262
|
+
const n = t.target.result;
|
|
263
|
+
if (null != n) {
|
|
264
|
+
if (null != n.value && null != n.key) {
|
|
265
|
+
r.delete(n.key).onsuccess = () => {
|
|
266
|
+
d.push(n.value);
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
n.continue();
|
|
270
|
+
} else d.length > 0 && e(d);
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
clearData() {
|
|
275
|
+
if (!this.rd()) return !1;
|
|
276
|
+
const t = [];
|
|
277
|
+
for (const e in this.ed.$t)
|
|
278
|
+
this.ed.$t.hasOwnProperty(e) &&
|
|
279
|
+
this.ed.$t[e] !== this.ed.$t.oe &&
|
|
280
|
+
t.push(this.ed.$t[e]);
|
|
281
|
+
const e = this;
|
|
282
|
+
return this.sd(function(n) {
|
|
283
|
+
const o = n.transaction(t, "readwrite");
|
|
284
|
+
o.oncomplete = () => n.close();
|
|
285
|
+
for (let n = 0; n < t.length; n++) {
|
|
286
|
+
const i = t[n];
|
|
287
|
+
o.objectStore(i).clear().onerror = function() {
|
|
288
|
+
e.nd.error(
|
|
289
|
+
"Could not clear " + this.source.name + " on indexedDB " + e.ed.dd
|
|
290
|
+
);
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
o.onerror = function() {
|
|
294
|
+
e.nd.error("Could not clear object stores on indexedDB " + e.ed.dd);
|
|
295
|
+
};
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
Ge.ep = {
|
|
300
|
+
Ft: {
|
|
301
|
+
dd: "AppboyServiceWorkerAsyncStorage",
|
|
302
|
+
VERSION: 6,
|
|
303
|
+
$t: {
|
|
304
|
+
xl: "data",
|
|
305
|
+
jr: "pushClicks",
|
|
306
|
+
cu: "pushSubscribed",
|
|
307
|
+
ud: "fallbackDevice",
|
|
308
|
+
Mt: "cardUpdates",
|
|
309
|
+
oe: "optOut",
|
|
310
|
+
$r: "pendingData",
|
|
311
|
+
On: "sdkAuthenticationSignature"
|
|
312
|
+
},
|
|
313
|
+
se: 1
|
|
314
|
+
}
|
|
315
|
+
};
|
package/shared-lib/logger.js
CHANGED
|
@@ -1 +1,38 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Oe = {
|
|
2
|
+
init: function(n) {
|
|
3
|
+
(void 0 === n && void 0 !== Oe.zg) || (Oe.zg = !!n), Oe.Eg || (Oe.Eg = !0);
|
|
4
|
+
},
|
|
5
|
+
destroy: function() {
|
|
6
|
+
(Oe.Eg = !1), (Oe.zg = void 0), (Oe.nd = void 0);
|
|
7
|
+
},
|
|
8
|
+
setLogger: function(n) {
|
|
9
|
+
"function" == typeof n
|
|
10
|
+
? (Oe.init(), (Oe.nd = n))
|
|
11
|
+
: Oe.info("Ignoring setLogger call since logger is not a function");
|
|
12
|
+
},
|
|
13
|
+
toggleLogging: function() {
|
|
14
|
+
Oe.init(),
|
|
15
|
+
Oe.zg
|
|
16
|
+
? (console.log("Disabling Braze logging"), (Oe.zg = !1))
|
|
17
|
+
: (console.log("Enabled Braze logging"), (Oe.zg = !0));
|
|
18
|
+
},
|
|
19
|
+
info: function(n) {
|
|
20
|
+
if (Oe.zg) {
|
|
21
|
+
const o = "Braze: " + n;
|
|
22
|
+
null != Oe.nd ? Oe.nd(o) : console.log(o);
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
warn: function(n) {
|
|
26
|
+
if (Oe.zg) {
|
|
27
|
+
const o = "Braze SDK Warning: " + n + " (v4.4.0)";
|
|
28
|
+
null != Oe.nd ? Oe.nd(o) : console.warn(o);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
error: function(n) {
|
|
32
|
+
if (Oe.zg) {
|
|
33
|
+
const o = "Braze SDK Error: " + n + " (v4.4.0)";
|
|
34
|
+
null != Oe.nd ? Oe.nd(o) : console.error(o);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
export default Oe;
|
|
@@ -1 +1,26 @@
|
|
|
1
|
-
export default{
|
|
1
|
+
export default {
|
|
2
|
+
Yn: "allowCrawlerActivity",
|
|
3
|
+
Zn: "baseUrl",
|
|
4
|
+
ho: "noCookies",
|
|
5
|
+
po: "devicePropertyAllowlist",
|
|
6
|
+
ta: "disablePushTokenMaintenance",
|
|
7
|
+
Eo: "enableLogging",
|
|
8
|
+
_o: "enableSdkAuthentication",
|
|
9
|
+
ia: "manageServiceWorkerExternally",
|
|
10
|
+
Io: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
11
|
+
Ao: "sessionTimeoutInSeconds",
|
|
12
|
+
So: "appVersion",
|
|
13
|
+
na: "serviceWorkerLocation",
|
|
14
|
+
ra: "safariWebsitePushId",
|
|
15
|
+
jn: "localization",
|
|
16
|
+
ao: "contentSecurityNonce",
|
|
17
|
+
No: "enableHtmlInAppMessages",
|
|
18
|
+
wo: "allowUserSuppliedJavascript",
|
|
19
|
+
no: "inAppMessageZIndex",
|
|
20
|
+
lo: "openInAppMessagesInNewTab",
|
|
21
|
+
en: "openNewsFeedCardsInNewTab",
|
|
22
|
+
qi: "requireExplicitInAppMessageDismissal",
|
|
23
|
+
To: "doNotLoadFontAwesome",
|
|
24
|
+
Oo: "sdkFlavor",
|
|
25
|
+
tn: "openCardsInNewTab"
|
|
26
|
+
};
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
import a from"./card-manager.js";
|
|
1
|
+
import a from "./card-manager.js";
|
|
2
|
+
import e from "../managers/braze-instance.js";
|
|
3
|
+
const n = {
|
|
4
|
+
t: !1,
|
|
5
|
+
i: null,
|
|
6
|
+
m: () => (n.o(), n.i || (n.i = new a(e.l(), e.g(), e.p())), n.i),
|
|
7
|
+
o: () => {
|
|
8
|
+
n.t || (e.u(n), (n.t = !0));
|
|
9
|
+
},
|
|
10
|
+
destroy: () => {
|
|
11
|
+
(n.i = null), (n.t = !1);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
export default n;
|
package/src/Card/card-manager.js
CHANGED
|
@@ -1 +1,72 @@
|
|
|
1
|
-
import{ControlCard}from"./models/index.js";
|
|
1
|
+
import { ControlCard } from "./models/index.js";
|
|
2
|
+
import s from "../common/event-logger.js";
|
|
3
|
+
import t from "../models/request-result.js";
|
|
4
|
+
import r from "../../shared-lib/braze-shared-lib.js";
|
|
5
|
+
import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
|
|
6
|
+
export default class a {
|
|
7
|
+
constructor(s, t, r) {
|
|
8
|
+
(this.h = s), (this.j = t), (this.v = r);
|
|
9
|
+
}
|
|
10
|
+
C(n, i) {
|
|
11
|
+
const e = new t();
|
|
12
|
+
if ((n.k(), null == n.url || "" === n.url))
|
|
13
|
+
return (
|
|
14
|
+
r.D.info(
|
|
15
|
+
`Card ${n.id} has no url. Not logging click to Braze servers.`
|
|
16
|
+
),
|
|
17
|
+
e
|
|
18
|
+
);
|
|
19
|
+
if (i) {
|
|
20
|
+
const s = this.h.I(o.q.$) || {};
|
|
21
|
+
(s[n.id] = !0), this.h.B(o.q.$, s);
|
|
22
|
+
}
|
|
23
|
+
const l = this.N([n]);
|
|
24
|
+
if (null == l) return e;
|
|
25
|
+
const u = i ? r.A._ : r.A.F;
|
|
26
|
+
return s.G(u, l);
|
|
27
|
+
}
|
|
28
|
+
H(n) {
|
|
29
|
+
const i = new t();
|
|
30
|
+
if (!n.J())
|
|
31
|
+
return (
|
|
32
|
+
r.D.info(
|
|
33
|
+
`Card ${n.id} refused this dismissal. Ignoring analytics event.`
|
|
34
|
+
),
|
|
35
|
+
i
|
|
36
|
+
);
|
|
37
|
+
const e = this.h.I(o.q.K) || {};
|
|
38
|
+
(e[n.id] = !0), this.h.B(o.q.K, e);
|
|
39
|
+
const l = this.N([n]);
|
|
40
|
+
return null == l ? i : s.G(r.A.L, l);
|
|
41
|
+
}
|
|
42
|
+
M(n, i) {
|
|
43
|
+
const e = new t(!0),
|
|
44
|
+
l = [],
|
|
45
|
+
u = [];
|
|
46
|
+
let a;
|
|
47
|
+
a = i ? this.h.I(o.q.O) || {} : this.h.I(o.q.P) || {};
|
|
48
|
+
for (const s of n)
|
|
49
|
+
s.R(), s instanceof ControlCard ? u.push(s) : l.push(s), (a[s.id] = !0);
|
|
50
|
+
const c = this.N(l),
|
|
51
|
+
h = this.N(u);
|
|
52
|
+
if (null == c && null == h) return (e.S = !1), e;
|
|
53
|
+
if ((i ? this.h.B(o.q.O, a) : this.h.B(o.q.P, a), null != c)) {
|
|
54
|
+
const t = i ? r.A.T : r.A.U,
|
|
55
|
+
n = s.G(t, c);
|
|
56
|
+
e.V(n);
|
|
57
|
+
}
|
|
58
|
+
if (null != h && i) {
|
|
59
|
+
const t = s.G(r.A.W, h);
|
|
60
|
+
e.V(t);
|
|
61
|
+
}
|
|
62
|
+
return e;
|
|
63
|
+
}
|
|
64
|
+
N(s) {
|
|
65
|
+
let t = null;
|
|
66
|
+
for (let r = 0; r < s.length; r++)
|
|
67
|
+
null != s[r].id &&
|
|
68
|
+
"" !== s[r].id &&
|
|
69
|
+
((t = t || {}), (t.ids = t.ids || []), t.ids.push(s[r].id));
|
|
70
|
+
return t;
|
|
71
|
+
}
|
|
72
|
+
}
|