@braze/web-sdk 4.3.0 → 4.5.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.
Files changed (178) hide show
  1. package/index.d.ts +68 -6
  2. package/package.json +1 -1
  3. package/shared-lib/braze-shared-lib.js +8 -1
  4. package/shared-lib/encoding-utils.js +12 -1
  5. package/shared-lib/event-types.js +32 -1
  6. package/shared-lib/guid.js +10 -1
  7. package/shared-lib/indexed-db-adapter.js +315 -1
  8. package/shared-lib/logger.js +38 -1
  9. package/shared-lib/supported-options.js +26 -1
  10. package/src/Card/card-manager-factory.js +14 -1
  11. package/src/Card/card-manager.js +72 -1
  12. package/src/Card/display/card-display.js +134 -1
  13. package/src/Card/index.js +5 -1
  14. package/src/Card/log-card-click.js +11 -1
  15. package/src/Card/log-card-dismissal.js +11 -1
  16. package/src/Card/log-card-impressions.js +13 -1
  17. package/src/Card/log-content-card-impressions.js +4 -1
  18. package/src/Card/models/banner.js +30 -1
  19. package/src/Card/models/captioned-image.js +32 -1
  20. package/src/Card/models/card.js +175 -1
  21. package/src/Card/models/classic-card.js +32 -1
  22. package/src/Card/models/control-card.js +39 -1
  23. package/src/Card/models/index.js +5 -1
  24. package/src/Card/util/card-factory.js +104 -1
  25. package/src/ContentCards/content-cards-provider-factory.js +20 -1
  26. package/src/ContentCards/content-cards-provider.js +283 -1
  27. package/src/ContentCards/content-cards.js +24 -1
  28. package/src/ContentCards/get-cached-content-cards.js +5 -1
  29. package/src/ContentCards/index.js +8 -1
  30. package/src/ContentCards/log-content-cards-displayed.js +5 -1
  31. package/src/ContentCards/request-content-cards-refresh.js +5 -1
  32. package/src/ContentCards/subscribe-to-content-cards-updates.js +14 -1
  33. package/src/ContentCards/ui/hide-content-cards.js +8 -1
  34. package/src/ContentCards/ui/show-content-cards.js +72 -1
  35. package/src/ContentCards/ui/toggle-content-cards.js +8 -1
  36. package/src/Core/add-sdk-metadata.js +27 -1
  37. package/src/Core/braze-sdk-metadata.js +10 -1
  38. package/src/Core/change-user.js +19 -1
  39. package/src/Core/destroy.js +5 -1
  40. package/src/Core/device-properties.js +9 -1
  41. package/src/Core/disable-sdk.js +10 -1
  42. package/src/Core/enable-sdk.js +8 -1
  43. package/src/Core/get-device-id.js +10 -1
  44. package/src/Core/get-user.js +4 -1
  45. package/src/Core/handle-braze-action.js +64 -1
  46. package/src/Core/index.js +23 -1
  47. package/src/Core/initialize.js +4 -1
  48. package/src/Core/is-disabled.js +4 -1
  49. package/src/Core/log-custom-event.js +36 -1
  50. package/src/Core/log-purchase.js +245 -1
  51. package/src/Core/open-session.js +23 -1
  52. package/src/Core/remove-all-subscriptions.js +4 -1
  53. package/src/Core/remove-subscription.js +4 -1
  54. package/src/Core/request-immediate-data-flush.js +4 -1
  55. package/src/Core/set-logger.js +4 -1
  56. package/src/Core/set-sdk-authentication-signature.js +9 -1
  57. package/src/Core/subscribe-to-sdk-authentication-failures.js +4 -1
  58. package/src/Core/toggle-logging.js +4 -1
  59. package/src/Core/wipe-data.js +15 -1
  60. package/src/FeatureFlags/feature-flag-factory.js +14 -0
  61. package/src/FeatureFlags/feature-flag.js +16 -0
  62. package/src/FeatureFlags/feature-flags-provider-factory.js +19 -0
  63. package/src/FeatureFlags/feature-flags-provider.js +94 -0
  64. package/src/FeatureFlags/get-all-feature-flags.js +12 -0
  65. package/src/FeatureFlags/get-feature-flag.js +12 -0
  66. package/src/FeatureFlags/index.js +4 -0
  67. package/src/FeatureFlags/refresh-feature-flags.js +9 -0
  68. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +6 -0
  69. package/src/Feed/feed-provider-factory.js +18 -1
  70. package/src/Feed/feed-provider.js +79 -1
  71. package/src/Feed/feed.js +20 -1
  72. package/src/Feed/get-cached-feed.js +5 -1
  73. package/src/Feed/index.js +8 -1
  74. package/src/Feed/log-feed-displayed.js +5 -1
  75. package/src/Feed/request-feed-refresh.js +5 -1
  76. package/src/Feed/subscribe-to-feed-updates.js +5 -1
  77. package/src/Feed/ui/hide-feed.js +7 -1
  78. package/src/Feed/ui/show-feed.js +89 -1
  79. package/src/Feed/ui/toggle-feed.js +8 -1
  80. package/src/InAppMessage/display/get-animation-effect.js +19 -1
  81. package/src/InAppMessage/display/html-message-to-html.js +223 -1
  82. package/src/InAppMessage/display/in-app-message-to-html.js +152 -1
  83. package/src/InAppMessage/display/modal-utils.js +68 -1
  84. package/src/InAppMessage/in-app-message-factory.js +145 -1
  85. package/src/InAppMessage/in-app-message-manager-factory.js +16 -1
  86. package/src/InAppMessage/in-app-message-manager.js +189 -1
  87. package/src/InAppMessage/index.js +14 -1
  88. package/src/InAppMessage/log-in-app-message-button-click.js +19 -1
  89. package/src/InAppMessage/log-in-app-message-click.js +19 -1
  90. package/src/InAppMessage/log-in-app-message-html-click.js +23 -1
  91. package/src/InAppMessage/log-in-app-message-impression.js +13 -1
  92. package/src/InAppMessage/models/control-message.js +8 -1
  93. package/src/InAppMessage/models/full-screen-message.js +71 -1
  94. package/src/InAppMessage/models/html-message.js +54 -1
  95. package/src/InAppMessage/models/in-app-message-button.js +40 -1
  96. package/src/InAppMessage/models/in-app-message.js +271 -1
  97. package/src/InAppMessage/models/modal-message.js +68 -1
  98. package/src/InAppMessage/models/slide-up-message.js +58 -1
  99. package/src/InAppMessage/models/templated-in-app-message.js +14 -1
  100. package/src/InAppMessage/subscribe-to-in-app-message.js +10 -1
  101. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +15 -1
  102. package/src/InAppMessage/ui/show-in-app-message.js +170 -1
  103. package/src/Push/index.js +5 -1
  104. package/src/Push/is-push-blocked.js +5 -1
  105. package/src/Push/is-push-permission-granted.js +5 -1
  106. package/src/Push/is-push-supported.js +5 -1
  107. package/src/Push/push-manager-factory.js +30 -1
  108. package/src/Push/push-manager.js +360 -1
  109. package/src/Push/request-push-permission.js +8 -1
  110. package/src/Push/unregister-push.js +5 -1
  111. package/src/Push/utils/push-utils.js +34 -1
  112. package/src/User/index.js +1 -1
  113. package/src/User/user-manager.js +70 -1
  114. package/src/User/user.js +278 -1
  115. package/src/common/base-feed.js +25 -1
  116. package/src/common/base-provider.js +6 -1
  117. package/src/common/constants.js +5 -1
  118. package/src/common/event-logger.js +24 -1
  119. package/src/common/feed-display.js +200 -1
  120. package/src/common/translations.js +148 -1
  121. package/src/index.js +9 -1
  122. package/src/l10n/l10n-manager-factory.js +22 -1
  123. package/src/l10n/l10n-manager.js +21 -1
  124. package/src/managers/auth-manager.js +48 -1
  125. package/src/managers/braze-instance.js +307 -1
  126. package/src/managers/device-manager.js +80 -1
  127. package/src/managers/network-manager.js +219 -1
  128. package/src/managers/server-config-manager.js +88 -1
  129. package/src/managers/session-manager.js +68 -1
  130. package/src/managers/storage-manager-factory.js +35 -1
  131. package/src/managers/storage-manager.js +394 -1
  132. package/src/managers/subscription-manager.js +25 -1
  133. package/src/models/backend-errors.js +8 -1
  134. package/src/models/braze-event.js +41 -1
  135. package/src/models/braze-sdk-metadata.js +10 -1
  136. package/src/models/device.js +26 -1
  137. package/src/models/identifier.js +20 -1
  138. package/src/models/push-token.js +22 -1
  139. package/src/models/request-result.js +8 -1
  140. package/src/models/server-config.js +32 -1
  141. package/src/request-controller.js +288 -1
  142. package/src/triggers/models/custom-event-data.js +14 -1
  143. package/src/triggers/models/custom-event-property-data.js +21 -1
  144. package/src/triggers/models/filter-set.js +55 -1
  145. package/src/triggers/models/filter.js +98 -1
  146. package/src/triggers/models/in-app-message-click-data.js +25 -1
  147. package/src/triggers/models/purchase-data.js +14 -1
  148. package/src/triggers/models/purchase-property-data.js +21 -1
  149. package/src/triggers/models/push-click-data.js +15 -1
  150. package/src/triggers/models/trigger-condition.js +109 -1
  151. package/src/triggers/models/trigger-events.js +8 -1
  152. package/src/triggers/models/trigger.js +110 -1
  153. package/src/triggers/triggers-provider-factory.js +30 -1
  154. package/src/triggers/triggers-provider.js +307 -1
  155. package/src/ui/js/attach-css.js +12 -1
  156. package/src/ui/js/feed-css.js +12 -1
  157. package/src/ui/js/iam-css.js +12 -1
  158. package/src/ui/js/index.js +3 -1
  159. package/src/ui/js/load-font-awesome.js +13 -1
  160. package/src/util/base-device-parser.js +14 -1
  161. package/src/util/braze-actions.js +79 -1
  162. package/src/util/browser-detector.js +85 -1
  163. package/src/util/client-hints-parser.js +60 -1
  164. package/src/util/code-utils.js +92 -1
  165. package/src/util/color-utils.js +23 -1
  166. package/src/util/component-utils.js +26 -1
  167. package/src/util/date-utils.js +27 -1
  168. package/src/util/deprecation-utils.js +5 -1
  169. package/src/util/device-constants.js +14 -1
  170. package/src/util/dom-utils.js +87 -1
  171. package/src/util/key-codes.js +1 -1
  172. package/src/util/math.js +5 -1
  173. package/src/util/net.js +75 -1
  174. package/src/util/string-utils.js +22 -1
  175. package/src/util/url-utils.js +23 -1
  176. package/src/util/user-agent-parser.js +85 -1
  177. package/src/util/validation-utils.js +136 -1
  178. 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.3.0
2
+ * Type definitions for @braze/web-sdk v4.5.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
@@ -122,6 +122,9 @@
122
122
  /** Whether to pin this card to the top of the view. */
123
123
  pinned: boolean;
124
124
 
125
+ /** Whether this card is a ControlCard. */
126
+ isControl: boolean;
127
+
125
128
 
126
129
  }
127
130
 
@@ -468,6 +471,12 @@
468
471
  * Braze with in-app message analytics events.
469
472
  */
470
473
  triggerId?: string;
474
+
475
+ /** Object of string/string key/value pairs. */
476
+ extras: Record<string, any>;
477
+
478
+ /** Whether this message is a ControlMessage. */
479
+ isControl: boolean;
471
480
  }
472
481
 
473
482
 
@@ -588,6 +597,9 @@
588
597
  */
589
598
  css?: string;
590
599
 
600
+ /** Whether this message is a ControlMessage. */
601
+ isControl: boolean;
602
+
591
603
  /**
592
604
  * Call this method if you wish to programmatically remove the message from the DOM. This method will only
593
605
  * work with the Braze UI.
@@ -1484,6 +1496,17 @@
1484
1496
  subscribeToClickedEvent(subscriber: () => void): string;
1485
1497
  }
1486
1498
 
1499
+ export interface FeatureFlag {
1500
+ /** Indicates whether or not this feature flag is enabled. */
1501
+ enabled: boolean;
1502
+
1503
+ /** Properties of this feature flag, listed as key-value pairs. */
1504
+ properties: object;
1505
+
1506
+ /** The ID for this feature flag. */
1507
+ id: string;
1508
+ }
1509
+
1487
1510
  /**
1488
1511
  * Automatically display in-app messages when they are triggered. This method should be called before
1489
1512
  * calling `openSession`.
@@ -1902,9 +1925,9 @@
1902
1925
  ): boolean;
1903
1926
 
1904
1927
  /**
1905
- * Opens a new session, or resumes the previous session if this browser had activity within the `sessionTimeoutInSeconds` value.
1906
- * When a new session is opened, this refreshes In-App Messages. Content Cards are refreshed automatically if
1907
- * the `subscribeToContentCardsUpdates` has been registered prior to `openSession`. If the user has previously
1928
+ * Opens a new session, or resumes the previous session if this browser had activity within the `sessionTimeoutInSeconds` value.
1929
+ * When a new session is opened, this refreshes In-App Messages. Content Cards are refreshed automatically if
1930
+ * the `subscribeToContentCardsUpdates` has been registered prior to `openSession`. If the user has previously
1908
1931
  * granted the site permission to send push, automatically sends the push registration to the Braze backend.
1909
1932
  */
1910
1933
  export function openSession(): void;
@@ -1921,7 +1944,7 @@
1921
1944
  * - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
1922
1945
  *
1923
1946
  * ```
1924
- * self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.3/service-worker.js');
1947
+ * self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.5/service-worker.js');
1925
1948
  * ```
1926
1949
  *
1927
1950
  * For more details, see [Our Product Documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
@@ -1975,6 +1998,16 @@
1975
1998
  */
1976
1999
  export function requestFeedRefresh(): void;
1977
2000
 
2001
+ /**
2002
+ * Requests an immediate refresh of feature flags from Braze servers. By default, feature flags are refreshed when
2003
+ * a new session starts. If you want to refresh feature flags from the server at another time you must call this function.
2004
+ *
2005
+ * @param successCallback - Callback that is invoked when the feature flags refresh request has been successfully completed.
2006
+ * This callback is useful for determining when a request has completed regardless of whether new feature flags were returned.
2007
+ * @param errorCallback - Callback that is invoked when an error occurs during the refresh.
2008
+ */
2009
+ export function refreshFeatureFlags(successCallback?: () => void, errorCallback?: () => void): void;
2010
+
1978
2011
  /**
1979
2012
  * By default, data logged to Braze through the SDK is queued locally (in HTML 5 localStorage when available, and
1980
2013
  * in memory otherwise) and sent to Braze's servers asynchronously on a regular interval (10 seconds when localStorage is available
@@ -2139,6 +2172,35 @@
2139
2172
  */
2140
2173
  export function handleBrazeAction(url: string, openLinkInNewTab?: boolean): void;
2141
2174
 
2175
+ /**
2176
+ * Gets a feature flag by its ID.
2177
+ *
2178
+ * @param id - The ID of the feature flag.
2179
+ * @returns - An object of type `FeatureFlag`.
2180
+ */
2181
+ export function getFeatureFlag(id: string): FeatureFlag;
2182
+
2183
+ /**
2184
+ * Subscribe to feature flag updates. The subscriber callback will be called whenever feature flags are updated. This method
2185
+ * should be called before calling `openSession`.
2186
+ *
2187
+ * @param subscriber - The callback function to handle new feature flags. This function will be called with a list of `FeatureFlag`
2188
+ * objects, including all feature flags currently available. If you want to be notified when a refresh has completed
2189
+ * regardless of whether new feature flags are available, you should use the `successCallback` of `refreshFeatureFlags`.
2190
+ *
2191
+ * @returns The identifier of the subscription created. This can be passed to `removeSubscription` to cancel the subscription.
2192
+ */
2193
+ export function subscribeToFeatureFlagsUpdates(
2194
+ subscriber: (featureFlags: FeatureFlag[]) => void
2195
+ ): string;
2196
+
2197
+ /**
2198
+ * Gets all available feature flags.
2199
+ *
2200
+ * @returns - A list of `FeatureFlag` objects.
2201
+ */
2202
+ export function getAllFeatureFlags(): FeatureFlag[];
2203
+
2142
2204
  /**
2143
2205
  * Supported initialization options
2144
2206
  *
@@ -2235,7 +2297,7 @@
2235
2297
  * lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
2236
2298
  * option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
2237
2299
  * `requestPushPermission`, and ensure that it contains Braze's service worker code, either with
2238
- * `self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.3/service-worker.js');` or by including the content
2300
+ * `self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.5/service-worker.js');` or by including the content
2239
2301
  * of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
2240
2302
  */
2241
2303
  manageServiceWorkerExternally?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@braze/web-sdk",
3
- "version": "4.3.0",
3
+ "version": "4.5.0",
4
4
  "description": "Braze SDK for web sites and other JS platforms.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1 +1,8 @@
1
- import je from"./encoding-utils.js";import{EventTypes as ve,InternalEventTypes as De}from"./event-types.js";import Be from"./guid.js";import Ae from"./indexed-db-adapter.js";import Ge from"./logger.js";import Oe from"./supported-options.js";const r={bn:je,A:ve,qr:De,it:Be,qt:Ae,xt:Ae.ep,D:Ge,Uo:Oe};export default r;
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 = { kn: ve, A: De, qr: Be, it: Ae, qt: Ge, xt: Ge.ep, D: Oe, Vo: Ue };
8
+ export default r;
@@ -1 +1,12 @@
1
- const je={pn:function(t){const r=(t+"=".repeat((4-t.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(r),o=new Uint8Array(n.length);for(let t=0;t<n.length;++t)o[t]=n.charCodeAt(t);return o}};export default je;
1
+ const ve = {
2
+ vn: 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 ve={CustomEvent:"ce",Pr:"p",Kl:"pc",oc:"ca",Ra:"i",qs:"ie",T:"cci",W:"ccic",_:"ccc",L:"ccd",ph:"ss",nh:"se",Je:"si",Re:"sc",He:"sbc",Pe:"sfe",ro:"iec",xl:"lr",Ul:"uae",U:"ci",F:"cc",Gl:"lcaa",Bl:"lcar",En:"inc",An:"add",Un:"rem",Sn:"set",Jl:"sgu"},De={Fr:"feed_displayed",ac:"content_cards_displayed"};export{ve as EventTypes,De as InternalEventTypes};
1
+ const De = {
2
+ CustomEvent: "ce",
3
+ Pr: "p",
4
+ xl: "pc",
5
+ cc: "ca",
6
+ za: "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
+ Ul: "lr",
20
+ Ol: "uae",
21
+ U: "ci",
22
+ F: "cc",
23
+ Bl: "lcaa",
24
+ Wl: "lcar",
25
+ Fn: "inc",
26
+ Un: "add",
27
+ En: "rem",
28
+ An: "set",
29
+ Gl: "sgu"
30
+ },
31
+ Be = { Fr: "feed_displayed", dc: "content_cards_displayed" };
32
+ export { De as EventTypes, Be as InternalEventTypes };
@@ -1 +1,10 @@
1
- const Be={nt:()=>{const t=t=>{const e=(Math.random().toString(16)+"000000000").substr(2,8);return t?"-"+e.substr(0,4)+"-"+e.substr(4,4):e};return t()+t(!0)+t(!0)+t()}};export default Be;
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 Ae{constructor(t,e){this.td="undefined"==typeof window?self:window,this.ed=t,this.nd=e}od(){if("indexedDB"in this.td)return this.td.indexedDB}rd(){try{if(null==this.od())return!1;if(this.od().open("Braze IndexedDB Support Test"),"undefined"!=typeof window){const t=window.chrome||window.browser||window.msBrowser;if(t&&t.runtime&&t.runtime.id)return this.nd.info("Not using IndexedDB for storage because we are running inside an extension"),!1}return!0}catch(t){return this.nd.info("Not using IndexedDB for storage due to following error: "+t),!1}}dd(t,e){const n=this.od().open(this.ed.sd,this.ed.VERSION);if(null==n)return"function"==typeof e&&e(),!1;const o=this;return n.onupgradeneeded=t=>{o.nd.info("Upgrading indexedDB "+o.ed.sd+" to v"+o.ed.VERSION+"...");const e=t.target.result;for(const t in o.ed.$t)o.ed.$t.hasOwnProperty(t)&&!e.objectStoreNames.contains(o.ed.$t[t])&&e.createObjectStore(o.ed.$t[t])},n.onsuccess=n=>{const i=n.target.result;i.onversionchange=()=>{i.close(),"function"==typeof e&&e(),o.nd.error("Needed to close the database unexpectedly because of an upgrade in another tab")},t(i)},n.onerror=t=>(o.nd.info("Could not open indexedDB "+o.ed.sd+" v"+o.ed.VERSION+": "+t.target.errorCode),"function"==typeof e&&e(),!0),!0}setItem(t,e,n,o,i){if(!this.rd())return"function"==typeof i&&i(),!1;const r=this;return this.dd((d=>{if(!d.objectStoreNames.contains(t))return r.nd.error("Could not store object "+e+" in "+t+" on indexedDB "+r.ed.sd+" - "+t+" is not a valid objectStore"),void("function"==typeof i&&i());const s=d.transaction([t],"readwrite").objectStore(t).put(n,e);s.onerror=()=>{r.nd.error("Could not store object "+e+" in "+t+" on indexedDB "+r.ed.sd),"function"==typeof i&&i()},s.onsuccess=()=>{"function"==typeof o&&o()}}),i)}getItem(t,e,n){if(!this.rd())return!1;const o=this;return this.dd((i=>{if(!i.objectStoreNames.contains(t))return void o.nd.error("Could not retrieve object "+e+" in "+t+" on indexedDB "+o.ed.sd+" - "+t+" is not a valid objectStore");const r=i.transaction([t],"readonly").objectStore(t).get(e);r.onerror=()=>{o.nd.error("Could not retrieve object "+e+" in "+t+" on indexedDB "+o.ed.sd)},r.onsuccess=t=>{const e=t.target.result;null!=e&&n(e)}}))}hr(t,e,n){if(!this.rd())return"function"==typeof n&&n(),!1;const o=this;return this.dd((i=>{if(!i.objectStoreNames.contains(t))return o.nd.error("Could not retrieve last record from "+t+" on indexedDB "+o.ed.sd+" - "+t+" is not a valid objectStore"),void("function"==typeof n&&n());const r=i.transaction([t],"readonly").objectStore(t).openCursor(null,"prev");r.onerror=()=>{o.nd.error("Could not open cursor for "+t+" on indexedDB "+o.ed.sd),"function"==typeof n&&n()},r.onsuccess=t=>{const o=t.target.result;null!=o&&null!=o.value&&null!=o.key?e(o.key,o.value):"function"==typeof n&&n()}}),n)}br(t,e){if(!this.rd())return!1;const n=this;return this.dd((o=>{if(!o.objectStoreNames.contains(t))return void n.nd.error("Could not delete record "+e+" from "+t+" on indexedDB "+n.ed.sd+" - "+t+" is not a valid objectStore");o.transaction([t],"readwrite").objectStore(t).delete(e).onerror=()=>{n.nd.error("Could not delete record "+e+" from "+t+" on indexedDB "+n.ed.sd)}}))}Jt(t,e){if(!this.rd())return!1;const n=this;return this.dd((o=>{if(!o.objectStoreNames.contains(t))return void n.nd.error("Could not retrieve objects from "+t+" on indexedDB "+n.ed.sd+" - "+t+" is not a valid objectStore");const i=o.transaction([t],"readwrite").objectStore(t),r=i.openCursor(),d=[];r.onerror=()=>{d.length>0?(n.nd.info("Cursor closed midway through for "+t+" on indexedDB "+n.ed.sd),e(d)):n.nd.error("Could not open cursor for "+t+" on indexedDB "+n.ed.sd)},r.onsuccess=t=>{const n=t.target.result;if(null!=n){if(null!=n.value&&null!=n.key){i.delete(n.key).onsuccess=()=>{d.push(n.value)}}n.continue()}else d.length>0&&e(d)}}))}clearData(){if(!this.rd())return!1;const t=[];for(const e in this.ed.$t)this.ed.$t.hasOwnProperty(e)&&this.ed.$t[e]!==this.ed.$t.oe&&t.push(this.ed.$t[e]);const e=this;return this.dd((function(n){const o=n.transaction(t,"readwrite");for(let n=0;n<t.length;n++){const i=t[n];o.objectStore(i).clear().onerror=function(){e.nd.error("Could not clear "+this.source.name+" on indexedDB "+e.ed.sd)}}o.onerror=function(){e.nd.error("Could not clear object stores on indexedDB "+e.ed.sd)}}))}}Ae.ep={Ft:{sd:"AppboyServiceWorkerAsyncStorage",VERSION:6,$t:{Wl:"data",jr:"pushClicks",pu:"pushSubscribed",ud:"fallbackDevice",Mt:"cardUpdates",oe:"optOut",$r:"pendingData",Kn:"sdkAuthenticationSignature"},se:1}};
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
+ Kl: "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
+ };
@@ -1 +1,38 @@
1
- const Ge={init:function(n){void 0===n&&void 0!==Ge.zg||(Ge.zg=!!n),Ge.Dg||(Ge.Dg=!0)},destroy:function(){Ge.Dg=!1,Ge.zg=void 0,Ge.nd=void 0},setLogger:function(n){"function"==typeof n?(Ge.init(),Ge.nd=n):Ge.info("Ignoring setLogger call since logger is not a function")},toggleLogging:function(){Ge.init(),Ge.zg?(console.log("Disabling Braze logging"),Ge.zg=!1):(console.log("Enabled Braze logging"),Ge.zg=!0)},info:function(n){if(Ge.zg){const o="Braze: "+n;null!=Ge.nd?Ge.nd(o):console.log(o)}},warn:function(n){if(Ge.zg){const o="Braze SDK Warning: "+n+" (v4.3.0)";null!=Ge.nd?Ge.nd(o):console.warn(o)}},error:function(n){if(Ge.zg){const o="Braze SDK Error: "+n+" (v4.3.0)";null!=Ge.nd?Ge.nd(o):console.error(o)}}};export default Ge;
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.5.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.5.0)";
34
+ null != Oe.nd ? Oe.nd(o) : console.error(o);
35
+ }
36
+ }
37
+ };
38
+ export default Oe;
@@ -1 +1,26 @@
1
- export default{Rn:"allowCrawlerActivity",Wn:"baseUrl",Vn:"noCookies",Yn:"devicePropertyAllowlist",ta:"disablePushTokenMaintenance",Xn:"enableLogging",Zn:"enableSdkAuthentication",ia:"manageServiceWorkerExternally",ho:"minimumIntervalBetweenTriggerActionsInSeconds",po:"sessionTimeoutInSeconds",Eo:"appVersion",na:"serviceWorkerLocation",ra:"safariWebsitePushId",jn:"localization",ao:"contentSecurityNonce",_o:"enableHtmlInAppMessages",Io:"allowUserSuppliedJavascript",no:"inAppMessageZIndex",lo:"openInAppMessagesInNewTab",en:"openNewsFeedCardsInNewTab",Ui:"requireExplicitInAppMessageDismissal",Ao:"doNotLoadFontAwesome",So:"sdkFlavor",tn:"openCardsInNewTab"};
1
+ export default {
2
+ Zn: "allowCrawlerActivity",
3
+ ho: "baseUrl",
4
+ po: "noCookies",
5
+ Eo: "devicePropertyAllowlist",
6
+ ta: "disablePushTokenMaintenance",
7
+ _o: "enableLogging",
8
+ Io: "enableSdkAuthentication",
9
+ ia: "manageServiceWorkerExternally",
10
+ Ao: "minimumIntervalBetweenTriggerActionsInSeconds",
11
+ So: "sessionTimeoutInSeconds",
12
+ No: "appVersion",
13
+ na: "serviceWorkerLocation",
14
+ ra: "safariWebsitePushId",
15
+ jn: "localization",
16
+ ao: "contentSecurityNonce",
17
+ wo: "enableHtmlInAppMessages",
18
+ To: "allowUserSuppliedJavascript",
19
+ no: "inAppMessageZIndex",
20
+ lo: "openInAppMessagesInNewTab",
21
+ en: "openNewsFeedCardsInNewTab",
22
+ qi: "requireExplicitInAppMessageDismissal",
23
+ Oo: "doNotLoadFontAwesome",
24
+ vo: "sdkFlavor",
25
+ tn: "openCardsInNewTab"
26
+ };
@@ -1 +1,14 @@
1
- import a from"./card-manager.js";import e from"../managers/braze-instance.js";const n={t:!1,i:null,m:()=>(n.o(),n.i||(n.i=new a(e.l(),e.g(),e.p())),n.i),o:()=>{n.t||(e.u(n),n.t=!0)},destroy:()=>{n.i=null,n.t=!1}};export default n;
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;