@braze/web-sdk 6.5.0 → 6.6.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 (59) hide show
  1. package/index.d.ts +8 -3
  2. package/package.json +1 -1
  3. package/shared-lib/event-types.js +11 -11
  4. package/shared-lib/indexed-db-adapter.js +4 -4
  5. package/shared-lib/logger.js +2 -2
  6. package/shared-lib/supported-options.js +14 -13
  7. package/src/Core/disable-sdk.js +8 -7
  8. package/src/Core/enable-sdk.js +3 -3
  9. package/src/Core/is-disabled.js +1 -1
  10. package/src/DUST/dust-provider.js +100 -100
  11. package/src/DUST/dust-shared-worker-impl.js +12 -12
  12. package/src/DUST/dust-worker-bridge.js +11 -11
  13. package/src/DUST/subscribe-to-dust.js +5 -5
  14. package/src/InAppMessage/defer-in-app-message.js +1 -1
  15. package/src/InAppMessage/in-app-message-manager.js +68 -68
  16. package/src/InAppMessage/log-in-app-message-button-click.js +1 -1
  17. package/src/InAppMessage/log-in-app-message-click.js +1 -1
  18. package/src/InAppMessage/log-in-app-message-html-click.js +2 -2
  19. package/src/InAppMessage/log-in-app-message-impression.js +1 -1
  20. package/src/InAppMessage/models/full-screen-message.js +7 -7
  21. package/src/InAppMessage/models/html-message.js +8 -8
  22. package/src/InAppMessage/models/in-app-message-button.js +2 -2
  23. package/src/InAppMessage/models/in-app-message.js +42 -42
  24. package/src/InAppMessage/models/modal-message.js +8 -8
  25. package/src/InAppMessage/models/slide-up-message.js +6 -6
  26. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  27. package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
  28. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
  29. package/src/Push/push-manager-factory.js +2 -2
  30. package/src/Push/utils/push-utils.js +6 -6
  31. package/src/User/user-manager.js +2 -2
  32. package/src/User/user.js +9 -9
  33. package/src/common/content-cards-display.js +1 -1
  34. package/src/l10n/l10n-manager-factory.js +1 -1
  35. package/src/managers/braze-instance.js +99 -95
  36. package/src/managers/device-manager.js +2 -2
  37. package/src/managers/network-manager.js +116 -116
  38. package/src/managers/server-config-manager.js +33 -33
  39. package/src/managers/session-manager.js +1 -1
  40. package/src/managers/storage-manager-factory.js +8 -8
  41. package/src/managers/storage-manager.js +45 -48
  42. package/src/managers/subscription-manager.js +8 -8
  43. package/src/models/backend-errors.js +5 -5
  44. package/src/models/braze-event.js +1 -1
  45. package/src/models/device.js +1 -1
  46. package/src/models/push-token.js +6 -6
  47. package/src/models/server-config.js +29 -29
  48. package/src/request-controller.js +91 -91
  49. package/src/triggers/models/trigger-condition.js +25 -25
  50. package/src/triggers/models/trigger.js +7 -7
  51. package/src/triggers/triggers-provider-factory.js +1 -1
  52. package/src/triggers/triggers-provider.js +12 -12
  53. package/src/ui/js/attach-css.js +1 -1
  54. package/src/ui/js/load-font-awesome.js +1 -1
  55. package/src/util/braze-actions.js +2 -2
  56. package/src/util/browser-detector.js +1 -1
  57. package/src/util/net.js +2 -2
  58. package/src/util/request-header-utils.js +12 -12
  59. package/src/util/window-utils.js +1 -1
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Type definitions for @braze/web-sdk v6.5.0
2
+ * Type definitions for @braze/web-sdk v6.6.0
3
3
  * Project: https://github.com/braze-inc/braze-web-sdk
4
4
  * (c) Braze, Inc. 2026 - http://braze.com
5
5
  * License available at https://github.com/braze-inc/braze-web-sdk/blob/master/LICENSE
@@ -2171,7 +2171,7 @@ export function openSession(): void;
2171
2171
  * - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
2172
2172
  *
2173
2173
  * ```
2174
- * self.importScripts('https://js.appboycdn.com/web-sdk/6.5/service-worker.js');
2174
+ * self.importScripts('https://js.appboycdn.com/web-sdk/6.6/service-worker.js');
2175
2175
  * ```
2176
2176
  *
2177
2177
  * For more details, see [Our Product Documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
@@ -2594,7 +2594,7 @@ export type InitializationOptions = {
2594
2594
  * lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
2595
2595
  * option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
2596
2596
  * `requestPushPermission`, and ensure that it contains Braze's service worker code, either with
2597
- * `self.importScripts('https://js.appboycdn.com/web-sdk/6.5/service-worker.js');` or by including the content
2597
+ * `self.importScripts('https://js.appboycdn.com/web-sdk/6.6/service-worker.js');` or by including the content
2598
2598
  * of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
2599
2599
  */
2600
2600
  manageServiceWorkerExternally?: boolean;
@@ -2604,6 +2604,11 @@ export type InitializationOptions = {
2604
2604
  * value any smaller than 10 to avoid spamming the user with notifications.
2605
2605
  */
2606
2606
  minimumIntervalBetweenTriggerActionsInSeconds?: number;
2607
+ /**
2608
+ * By default, Braze cookies expire after 400 days. Provide a value for this configuration option to override that
2609
+ * default with a value of your own.
2610
+ */
2611
+ cookieExpiryInDays?: number;
2607
2612
  /**
2608
2613
  * By default, the Braze SDK will store small amounts of data (user ids, session ids), in cookies. This is done to allow Braze
2609
2614
  * to recognize users and sessions across different subdomains of your site. If this presents a problem for you, pass `true`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@braze/web-sdk",
3
- "version": "6.5.0",
3
+ "version": "6.6.0",
4
4
  "description": "Braze SDK for web sites and other JS platforms.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,31 +1,31 @@
1
1
  const f = {
2
2
  CustomEvent: "ce",
3
3
  Pr: "p",
4
- jd: "pc",
4
+ Sd: "pc",
5
5
  ev: "ca",
6
- Fl: "i",
7
- wl: "ie",
6
+ Kl: "i",
7
+ Cl: "ie",
8
8
  Xt: "cci",
9
9
  Zt: "ccic",
10
10
  Lt: "ccc",
11
11
  Qt: "ccd",
12
12
  Sm: "ss",
13
13
  hm: "se",
14
- wn: "si",
15
- zn: "sc",
16
- Sn: "sbc",
14
+ zn: "si",
15
+ Sn: "sc",
16
+ Bn: "sbc",
17
17
  tv: "sfe",
18
18
  om: "iec",
19
- yd: "lr",
20
- kd: "uae",
21
- Dd: "lcaa",
22
- Ad: "lcar",
19
+ jd: "lr",
20
+ yd: "uae",
21
+ $d: "lcaa",
22
+ Dd: "lcar",
23
23
  Zu: "inc",
24
24
  Qu: "add",
25
25
  Xu: "rem",
26
26
  Yu: "set",
27
27
  Vu: "ncam",
28
- $d: "sgu",
28
+ qd: "sgu",
29
29
  xo: "ffi",
30
30
  ro: "bi",
31
31
  ut: "bc",
@@ -307,7 +307,7 @@ export default class et {
307
307
  for (const e in this.database.Fs) {
308
308
  const n = e;
309
309
  this.database.Fs.hasOwnProperty(e) &&
310
- this.database.Fs[n] !== this.database.Fs.be &&
310
+ this.database.Fs[n] !== this.database.Fs.fe &&
311
311
  t.push(this.database.Fs[n]);
312
312
  }
313
313
  const e = this;
@@ -338,15 +338,15 @@ et.Us = {
338
338
  Ld: "AppboyServiceWorkerAsyncStorage",
339
339
  VERSION: 6,
340
340
  Fs: {
341
- Ze: "data",
341
+ _e: "data",
342
342
  vr: "pushClicks",
343
343
  Fu: "pushSubscribed",
344
344
  Gd: "fallbackDevice",
345
345
  As: "cardUpdates",
346
- be: "optOut",
346
+ fe: "optOut",
347
347
  zr: "pendingData",
348
348
  qh: "sdkAuthenticationSignature",
349
349
  },
350
- fe: 1,
350
+ ge: 1,
351
351
  },
352
352
  };
@@ -24,13 +24,13 @@ const E = {
24
24
  },
25
25
  warn: function (n) {
26
26
  if (E.zg) {
27
- const o = "Braze SDK Warning: " + n + " (v6.5.0)";
27
+ const o = "Braze SDK Warning: " + n + " (v6.6.0)";
28
28
  null != E.Rd ? E.Rd(o) : console.warn(o);
29
29
  }
30
30
  },
31
31
  error: function (n) {
32
32
  if (E.zg) {
33
- const o = "Braze SDK Error: " + n + " (v6.5.0)";
33
+ const o = "Braze SDK Error: " + n + " (v6.6.0)";
34
34
  null != E.Rd ? E.Rd(o) : console.error(o);
35
35
  }
36
36
  },
@@ -1,28 +1,29 @@
1
1
  export default {
2
2
  Ph: "allowCrawlerActivity",
3
3
  Wh: "baseUrl",
4
+ le: "cookieExpiryInDays",
4
5
  Vh: "noCookies",
5
6
  Kh: "devicePropertyAllowlist",
6
- La: "disablePushTokenMaintenance",
7
- $h: "enableLogging",
8
- Yh: "enableSdkAuthentication",
9
- Ka: "manageServiceWorkerExternally",
7
+ Na: "disablePushTokenMaintenance",
8
+ Yh: "enableLogging",
9
+ $h: "enableSdkAuthentication",
10
+ La: "manageServiceWorkerExternally",
10
11
  Xh: "minimumIntervalBetweenTriggerActionsInSeconds",
11
12
  Zh: "sessionTimeoutInSeconds",
12
13
  Qh: "appVersion",
13
- Xa: "appVersionNumber",
14
- Ga: "serviceWorkerLocation",
15
- Ia: "safariWebsitePushId",
16
- Wa: "localization",
14
+ Za: "appVersionNumber",
15
+ Ha: "serviceWorkerLocation",
16
+ Ka: "safariWebsitePushId",
17
+ Xa: "localization",
17
18
  er: "contentSecurityNonce",
18
19
  te: "allowUserSuppliedJavascript",
19
20
  $a: "inAppMessageZIndex",
20
21
  Ja: "openInAppMessagesInNewTab",
21
22
  Oh: "requireExplicitInAppMessageDismissal",
22
- Za: "doNotLoadFontAwesome",
23
- tl: "deviceId",
24
- Ha: "serviceWorkerScope",
25
- Ne: "dustHost",
26
- il: "sdkFlavor",
23
+ tl: "doNotLoadFontAwesome",
24
+ il: "deviceId",
25
+ Ia: "serviceWorkerScope",
26
+ Te: "dustHost",
27
+ sl: "sdkFlavor",
27
28
  tn: "openCardsInNewTab",
28
29
  };
@@ -1,15 +1,16 @@
1
- import r from "../managers/braze-instance.js";
1
+ import r, { OPTIONS as D } from "../managers/braze-instance.js";
2
2
  import { logger as E, IndexedDBAdapter as et } from "../../shared-lib/index.js";
3
3
  import ee, { STORAGE_KEYS as s } from "../managers/storage-manager.js";
4
4
  export function disableSDK() {
5
5
  const e = r.nn();
6
6
  e && e.requestImmediateDataFlush();
7
- const n = new ee.le(null, !0),
8
- a = "This-cookie-will-expire-in-" + n.me();
9
- n.store(s.pe, a);
10
- const i = et.Us.Rs;
11
- new et(i, E).setItem(i.Fs.be, i.fe, !0),
7
+ const n = r.re(D.le),
8
+ a = new ee.me(null, !0, n),
9
+ i = "This-cookie-will-expire-in-" + a.pe();
10
+ a.store(s.be, i);
11
+ const o = et.Us.Rs;
12
+ new et(o, E).setItem(o.Fs.fe, o.ge, !0),
12
13
  E.info("disableSDK was called"),
13
14
  r.destroy(!1),
14
- r.ge(!0);
15
+ r.we(!0);
15
16
  }
@@ -2,10 +2,10 @@ import r from "../managers/braze-instance.js";
2
2
  import { logger as E, IndexedDBAdapter as et } from "../../shared-lib/index.js";
3
3
  import ee, { STORAGE_KEYS as s } from "../managers/storage-manager.js";
4
4
  export function enableSDK() {
5
- new ee.le(null, !0).remove(s.pe);
5
+ new ee.me(null, !0).remove(s.be);
6
6
  const e = et.Us.Rs;
7
- new et(e, E).je(e.Fs.be, e.fe),
7
+ new et(e, E).je(e.Fs.fe, e.ge),
8
8
  E.info("enableSDK was called"),
9
9
  r.destroy(!1),
10
- r.ge(!1);
10
+ r.we(!1);
11
11
  }
@@ -1,4 +1,4 @@
1
1
  import ee, { STORAGE_KEYS as s } from "../managers/storage-manager.js";
2
2
  export function isDisabled() {
3
- return !!new ee.le(null, !0).jr(s.pe);
3
+ return !!new ee.me(null, !0).jr(s.be);
4
4
  }