@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.
Files changed (178) hide show
  1. package/index.d.ts +57 -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 +174 -1
  21. package/src/Card/models/classic-card.js +32 -1
  22. package/src/Card/models/control-card.js +38 -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 +16 -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 +267 -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.2.1
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 last 30 minutes.
1906
- * When a new session is opened, syncs triggered In-App Messages and Content Cards. If the user has previously
1907
- * granted the site permission to send push, automatically sends the push registration to the Braze backend.
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.2/service-worker.js');
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.2/service-worker.js');` or by including the content
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@braze/web-sdk",
3
- "version": "4.2.1",
3
+ "version": "4.4.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,zo: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 = { 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 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
+ 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 ve={CustomEvent:"ce",Pr:"p",Sl:"pc",oc:"ca",Ra:"i",qs:"ie",T:"cci",W:"ccic",_:"ccc",L:"ccd",Wh:"ss",bh:"se",Je:"si",Re:"sc",He:"sbc",Pe:"sfe",ro:"iec",vl:"lr",yl:"uae",U:"ci",F:"cc",Al:"lcaa",$l:"lcar",En:"inc",An:"add",Un:"rem",Sn:"set",Cl:"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
+ 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 };
@@ -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:{jl:"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
+ 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
+ };
@@ -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.2.1)";null!=Ge.nd?Ge.nd(o):console.warn(o)}},error:function(n){if(Ge.zg){const o="Braze SDK Error: "+n+" (v4.2.1)";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.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{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
+ 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";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;
@@ -1 +1,72 @@
1
- import{ControlCard}from"./models/index.js";import s from"../common/event-logger.js";import t from"../models/request-result.js";import r from"../../shared-lib/braze-shared-lib.js";import{STORAGE_KEYS as o}from"../managers/storage-manager.js";export default class a{constructor(s,t,r){this.h=s,this.j=t,this.v=r}C(n,i){const e=new t;if(n.k(),null==n.url||""===n.url)return r.D.info(`Card ${n.id} has no url. Not logging click to Braze servers.`),e;if(i){const s=this.h.I(o.q.$)||{};s[n.id]=!0,this.h.B(o.q.$,s)}const l=this.N([n]);if(null==l)return e;const u=i?r.A._:r.A.F;return s.G(u,l)}H(n){const i=new t;if(!n.J())return r.D.info(`Card ${n.id} refused this dismissal. Ignoring analytics event.`),i;const e=this.h.I(o.q.K)||{};e[n.id]=!0,this.h.B(o.q.K,e);const l=this.N([n]);return null==l?i:s.G(r.A.L,l)}M(n,i){const e=new t(!0),l=[],u=[];let a;a=i?this.h.I(o.q.O)||{}:this.h.I(o.q.P)||{};for(const s of n)s.R(),s instanceof ControlCard?u.push(s):l.push(s),a[s.id]=!0;const c=this.N(l),h=this.N(u);if(null==c&&null==h)return e.S=!1,e;if(i?this.h.B(o.q.O,a):this.h.B(o.q.P,a),null!=c){const t=i?r.A.T:r.A.U,n=s.G(t,c);e.V(n)}if(null!=h&&i){const t=s.G(r.A.W,h);e.V(t)}return e}N(s){let t=null;for(let r=0;r<s.length;r++)null!=s[r].id&&""!==s[r].id&&(t=t||{},t.ids=t.ids||[],t.ids.push(s[r].id));return t}}
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
+ }