@braze/web-sdk 6.11.0 → 6.12.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 (102) hide show
  1. package/index.d.ts +36 -5
  2. package/package.json +1 -1
  3. package/shared-lib/event-types.js +4 -4
  4. package/shared-lib/indexed-db-adapter.js +51 -51
  5. package/shared-lib/logger.js +7 -7
  6. package/shared-lib/supported-options.js +9 -9
  7. package/src/DUST/dust-config-store.js +89 -0
  8. package/src/DUST/dust-connection-core.js +7 -21
  9. package/src/DUST/dust-message-dedup.js +33 -0
  10. package/src/DUST/dust-provider.js +367 -397
  11. package/src/DUST/dust-tab-identity.js +30 -0
  12. package/src/DUST/index.js +7 -9
  13. package/src/DUST/subscribe-to-dust.js +5 -5
  14. package/src/FeatureFlags/feature-flag-factory.js +4 -4
  15. package/src/FeatureFlags/feature-flag.js +5 -5
  16. package/src/FeatureFlags/feature-flags-provider-factory.js +8 -1
  17. package/src/FeatureFlags/feature-flags-provider.js +74 -74
  18. package/src/FeatureFlags/get-all-feature-flags.js +2 -2
  19. package/src/FeatureFlags/get-feature-flag.js +2 -2
  20. package/src/FeatureFlags/log-feature-flag-impression.js +3 -3
  21. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
  22. package/src/InAppMessage/defer-in-app-message.js +2 -2
  23. package/src/InAppMessage/display/get-animation-effect.js +1 -1
  24. package/src/InAppMessage/display/html-message-display-utils.js +4 -4
  25. package/src/InAppMessage/display/html-message-to-html.js +10 -10
  26. package/src/InAppMessage/display/in-app-message-to-html.js +42 -42
  27. package/src/InAppMessage/display/modal-utils.js +14 -14
  28. package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
  29. package/src/InAppMessage/in-app-message-factory.js +6 -6
  30. package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
  31. package/src/InAppMessage/in-app-message-manager.js +73 -73
  32. package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
  33. package/src/InAppMessage/log-in-app-message-click.js +2 -2
  34. package/src/InAppMessage/log-in-app-message-html-click.js +2 -2
  35. package/src/InAppMessage/log-in-app-message-impression.js +2 -2
  36. package/src/InAppMessage/models/full-screen-message.js +9 -9
  37. package/src/InAppMessage/models/html-message.js +4 -4
  38. package/src/InAppMessage/models/in-app-message-button.js +2 -2
  39. package/src/InAppMessage/models/in-app-message.js +52 -52
  40. package/src/InAppMessage/models/modal-message.js +7 -7
  41. package/src/InAppMessage/models/slide-up-message.js +11 -11
  42. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  43. package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
  44. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +5 -5
  45. package/src/InAppMessage/ui/show-in-app-message.js +36 -36
  46. package/src/Push/is-push-blocked.js +2 -2
  47. package/src/Push/is-push-permission-granted.js +2 -2
  48. package/src/Push/is-push-supported.js +2 -2
  49. package/src/Push/push-manager-factory.js +6 -6
  50. package/src/Push/push-manager.js +14 -14
  51. package/src/Push/unregister-push-token-on-server.js +3 -3
  52. package/src/Push/utils/push-utils.js +10 -10
  53. package/src/User/user.js +19 -19
  54. package/src/common/content-cards-display.js +21 -21
  55. package/src/common/event-logger.js +2 -2
  56. package/src/l10n/l10n-manager-factory.js +7 -7
  57. package/src/l10n/l10n-manager.js +5 -5
  58. package/src/managers/auth-manager.js +1 -1
  59. package/src/managers/braze-instance.js +41 -41
  60. package/src/managers/device-manager.js +22 -22
  61. package/src/managers/network-manager.js +108 -108
  62. package/src/managers/server-config-manager.js +83 -83
  63. package/src/managers/session-manager.js +6 -6
  64. package/src/managers/storage-manager-factory.js +4 -4
  65. package/src/managers/storage-manager.js +127 -125
  66. package/src/managers/subscription-manager.js +1 -1
  67. package/src/managers/utils.js +1 -1
  68. package/src/models/backend-errors.js +5 -5
  69. package/src/models/braze-event.js +7 -7
  70. package/src/models/device.js +3 -3
  71. package/src/models/identifier.js +3 -3
  72. package/src/models/push-token.js +3 -3
  73. package/src/models/server-config.js +31 -31
  74. package/src/request-controller.js +39 -39
  75. package/src/triggers/models/filter.js +58 -58
  76. package/src/triggers/models/in-app-message-click-data.js +4 -4
  77. package/src/triggers/models/push-click-data.js +2 -2
  78. package/src/triggers/models/trigger-condition.js +35 -35
  79. package/src/triggers/models/trigger.js +37 -37
  80. package/src/triggers/triggers-provider-factory.js +3 -3
  81. package/src/triggers/triggers-provider.js +50 -50
  82. package/src/types.js +2 -2
  83. package/src/ui/js/attach-css.js +1 -1
  84. package/src/ui/js/feed-css.js +2 -2
  85. package/src/ui/js/iam-css.js +2 -2
  86. package/src/util/base-device-parser.js +2 -2
  87. package/src/util/braze-actions.js +2 -2
  88. package/src/util/browser-detector.js +15 -15
  89. package/src/util/client-hints-parser.js +5 -5
  90. package/src/util/component-utils.js +4 -4
  91. package/src/util/dom-utils.js +5 -5
  92. package/src/util/ecommerce-event-validation.js +77 -48
  93. package/src/util/key-codes.js +1 -1
  94. package/src/util/net.js +4 -4
  95. package/src/util/request-header-utils.js +20 -20
  96. package/src/util/string-utils.js +5 -0
  97. package/src/util/user-agent-parser.js +18 -18
  98. package/src/util/validation-utils.js +4 -4
  99. package/src/util/window-utils.js +2 -2
  100. package/src/DUST/dust-shared-worker-code.js +0 -2
  101. package/src/DUST/dust-shared-worker-impl.js +0 -234
  102. package/src/DUST/dust-worker-bridge.js +0 -151
@@ -1,16 +1,16 @@
1
1
  import { logger as b } from "../../shared-lib/index.js";
2
- import zt from "../common/translations.js";
2
+ import Pt from "../common/translations.js";
3
3
  export default class jr {
4
4
  constructor(t, e = !1) {
5
5
  if (
6
6
  ((this.language = t),
7
7
  null != t && (t = t.toLowerCase()),
8
- null != t && null == zt[t])
8
+ null != t && null == Pt[t])
9
9
  ) {
10
10
  const e = t.indexOf("-");
11
11
  e > 0 && (t = t.substring(0, e));
12
12
  }
13
- if (null == zt[t]) {
13
+ if (null == Pt[t]) {
14
14
  const a =
15
15
  "Braze does not yet have a localization for language " +
16
16
  t +
@@ -20,9 +20,9 @@ export default class jr {
20
20
  this.language = t;
21
21
  }
22
22
  get(t) {
23
- return zt[this.language][t];
23
+ return Pt[this.language][t];
24
24
  }
25
- za() {
25
+ ga() {
26
26
  switch (this.language) {
27
27
  case "ar":
28
28
  case "he":
@@ -1,7 +1,7 @@
1
1
  import { STORAGE_KEYS as s } from "./storage-manager.js";
2
2
  import f from "./subscription-manager.js";
3
3
  import { logger as b, IndexedDBAdapter as et } from "../../shared-lib/index.js";
4
- export default class Gt {
4
+ export default class Vt {
5
5
  constructor(t, i, s) {
6
6
  (this.j = t),
7
7
  (this.gh = i),
@@ -1,30 +1,30 @@
1
- import Gt from "./auth-manager.js";
1
+ import Vt from "./auth-manager.js";
2
2
  import t from "../common/base-provider.js";
3
3
  import ro from "../util/browser-detector.js";
4
- import Pt from "./device-manager.js";
4
+ import Wt from "./device-manager.js";
5
5
  import DeviceProperties from "../Core/device-properties.js";
6
6
  import {
7
7
  isArray as g,
8
8
  keys as C,
9
9
  validateValueIsFromEnum as ta,
10
- values as Wt,
10
+ values as Yt,
11
11
  } from "../util/code-utils.js";
12
- import Vt from "./network-manager.js";
13
- import Kt from "../request-controller.js";
14
- import Yt from "./server-config-manager.js";
15
- import Xt from "./session-manager.js";
12
+ import Xt from "./network-manager.js";
13
+ import Zt from "../request-controller.js";
14
+ import li from "./server-config-manager.js";
15
+ import fi from "./session-manager.js";
16
16
  import ne, { STORAGE_KEYS as s } from "./storage-manager.js";
17
- import Zt from "./storage-manager-factory.js";
17
+ import di from "./storage-manager-factory.js";
18
18
  import f from "./subscription-manager.js";
19
19
  import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-factory.js";
20
20
  import dr from "../DUST/dust-provider-factory.js";
21
- import { subscribeToDust as Qt } from "../DUST/subscribe-to-dust.js";
21
+ import { subscribeToDust as mi } from "../DUST/subscribe-to-dust.js";
22
22
  import Ut from "../User/user-manager.js";
23
23
  import { User } from "../User/index.js";
24
- import { parseQueryStringKeyValues as lt } from "../util/url-utils.js";
24
+ import { parseQueryStringKeyValues as pt } from "../util/url-utils.js";
25
25
  import { WindowUtils as no } from "../util/window-utils.js";
26
26
  import { CoreStrings as R } from "../common/constants.js";
27
- import { SupportedOptions as li, logger as b } from "../../shared-lib/index.js";
27
+ import { SupportedOptions as pi, logger as b } from "../../shared-lib/index.js";
28
28
  import _t from "../models/identifier.js";
29
29
  const U = {
30
30
  _h: "allowCrawlerActivity",
@@ -32,30 +32,30 @@ const U = {
32
32
  se: "cookieExpiryInDays",
33
33
  Oh: "noCookies",
34
34
  Th: "devicePropertyAllowlist",
35
- Aa: "disablePushTokenMaintenance",
35
+ xa: "disablePushTokenMaintenance",
36
36
  Rh: "enableLogging",
37
37
  Ph: "enableSdkAuthentication",
38
- qa: "manageServiceWorkerExternally",
38
+ wa: "manageServiceWorkerExternally",
39
39
  Dh: "minimumIntervalBetweenTriggerActionsInSeconds",
40
40
  Lh: "sessionTimeoutInSeconds",
41
41
  yh: "appVersion",
42
42
  Mh: "appVersionNumber",
43
- Ma: "serviceWorkerLocation",
44
- ka: "safariWebsitePushId",
45
- Ba: "localization",
43
+ za: "serviceWorkerLocation",
44
+ ha: "safariWebsitePushId",
45
+ Ma: "localization",
46
46
  sr: "contentSecurityNonce",
47
47
  nr: "allowUserSuppliedJavascript",
48
- va: "inAppMessageZIndex",
49
- ya: "openInAppMessagesInNewTab",
48
+ ca: "inAppMessageZIndex",
49
+ da: "openInAppMessagesInNewTab",
50
50
  tn: "openCardsInNewTab",
51
51
  lh: "requireExplicitInAppMessageDismissal",
52
52
  Uh: "doNotLoadFontAwesome",
53
53
  Wh: "deviceId",
54
- _a: "serviceWorkerScope",
55
- Ye: "dustHost",
54
+ ba: "serviceWorkerScope",
55
+ Oi: "dustHost",
56
56
  Bh: "sdkFlavor",
57
57
  };
58
- class ci {
58
+ class Ei {
59
59
  constructor() {
60
60
  (this.eu = ""),
61
61
  (this.Vh = ""),
@@ -77,7 +77,7 @@ class ci {
77
77
  (this.Jh = []),
78
78
  (this.Xh = []),
79
79
  (this.In = []),
80
- (this.Vh = "6.11.0");
80
+ (this.Vh = "6.12.0");
81
81
  }
82
82
  Zh(t) {
83
83
  this.qh.Ut(t);
@@ -91,7 +91,7 @@ class ci {
91
91
  return b.info("Braze has already been initialized with an API key."), !0;
92
92
  this.options = i || {};
93
93
  let n = this.er(U.Rh);
94
- const h = lt(no.Qh());
94
+ const h = pt(no.Qh());
95
95
  if (
96
96
  (h && "true" === h.brazeLogging && (n = !0),
97
97
  b.init(n),
@@ -121,9 +121,9 @@ class ci {
121
121
  );
122
122
  const u = this.er(U.Oh) || !1,
123
123
  c = this.er(U.se),
124
- d = Zt.sl();
124
+ d = di.sl();
125
125
  if (
126
- ((this.j = Zt.rl(t, u, c)),
126
+ ((this.j = di.rl(t, u, c)),
127
127
  u && this.j.hl(t),
128
128
  new ne.le(null, !0).wr(s.ce))
129
129
  )
@@ -133,7 +133,7 @@ class ci {
133
133
  !1
134
134
  );
135
135
  for (const t of C(this.options))
136
- -1 === Wt(li).indexOf(t) &&
136
+ -1 === Yt(pi).indexOf(t) &&
137
137
  b.warn(`Ignoring unknown initialization option '${t}'.`);
138
138
  const m = ["mparticle", "wordpress", "tealium"];
139
139
  if (null != this.er(U.Bh)) {
@@ -142,7 +142,7 @@ class ci {
142
142
  ? (this.Kh = t)
143
143
  : b.error("Invalid sdk flavor passed: " + t);
144
144
  }
145
- let p = this.er(li.Th);
145
+ let p = this.er(pi.Th);
146
146
  if (null != p)
147
147
  if (g(p)) {
148
148
  const t = [];
@@ -164,14 +164,14 @@ class ci {
164
164
  const t = new _t(E);
165
165
  this.j.Ju(s.Ou.Wh, t);
166
166
  }
167
- (this.tu = new Pt(this.j, p)),
168
- (this.h = new Yt(this.j)),
167
+ (this.tu = new Wt(this.j, p)),
168
+ (this.h = new li(this.j)),
169
169
  (this.Ss = new Ut(this.h, this.j)),
170
- (this.C = new Xt(this.j, this.Ss, this.h, this.er(U.Lh)));
170
+ (this.C = new fi(this.j, this.Ss, this.h, this.er(U.Lh)));
171
171
  const I = new f();
172
- (this.Gh = new Gt(this.j, this.er(U.Ph), I)),
172
+ (this.Gh = new Vt(this.j, this.er(U.Ph), I)),
173
173
  this.S(I),
174
- (this.B = new Vt(
174
+ (this.B = new Xt(
175
175
  this.tu,
176
176
  this.j,
177
177
  this.Gh,
@@ -185,7 +185,7 @@ class ci {
185
185
  this.er(U.yh),
186
186
  this.er(U.Mh),
187
187
  )),
188
- (this.Ru = new Kt(
188
+ (this.Ru = new Zt(
189
189
  this.eu,
190
190
  this.Yh,
191
191
  this.C,
@@ -207,11 +207,11 @@ class ci {
207
207
  )}" with API key "${this.eu}".`,
208
208
  ),
209
209
  rt.t(),
210
- Qt(),
211
- this.h.bo(() => {
210
+ mi(),
211
+ this.h.do(() => {
212
212
  var t;
213
213
  this.isInitialized &&
214
- (null === (t = this.h) || void 0 === t ? void 0 : t.lo()) &&
214
+ (null === (t = this.h) || void 0 === t ? void 0 : t.Kr()) &&
215
215
  import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
216
216
  if (!this.isInitialized) return;
217
217
  (0, t.default)();
@@ -220,7 +220,7 @@ class ci {
220
220
  this.Ru.rn(() => {
221
221
  var t;
222
222
  this.isInitialized &&
223
- (null === (t = this.h) || void 0 === t ? void 0 : t.lo()) &&
223
+ (null === (t = this.h) || void 0 === t ? void 0 : t.Kr()) &&
224
224
  import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
225
225
  if (!this.isInitialized) return;
226
226
  (0, t.default)(void 0, void 0, !0);
@@ -274,7 +274,7 @@ class ci {
274
274
  rr() {
275
275
  return !this.cl() && (!!this.ao() || (console.warn(R.ee), !1));
276
276
  }
277
- xa() {
277
+ ja() {
278
278
  return this.eu;
279
279
  }
280
280
  Er() {
@@ -346,11 +346,11 @@ class ci {
346
346
  }
347
347
  ar(t, i) {
348
348
  if (!this.rr()) return null;
349
- return dr.o().on(t, i);
349
+ return dr.o().mn(t, i);
350
350
  }
351
351
  qi() {
352
352
  return this.Vh;
353
353
  }
354
354
  }
355
- const r = new ci();
356
- export { r as default, ci as BrazeSdkInstance, U as OPTIONS };
355
+ const r = new Ei();
356
+ export { r as default, Ei as BrazeSdkInstance, U as OPTIONS };
@@ -1,42 +1,42 @@
1
1
  import ro from "../util/browser-detector.js";
2
- import Oe from "../models/device.js";
2
+ import ke from "../models/device.js";
3
3
  import DeviceProperties from "../Core/device-properties.js";
4
4
  import _t from "../models/identifier.js";
5
5
  import { logger as b, Guid as V } from "../../shared-lib/index.js";
6
6
  import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
7
- import { values as Wt } from "../util/code-utils.js";
8
- import { getErrorMessage as ai } from "../util/error-utils.js";
9
- export default class Pt {
7
+ import { values as Yt } from "../util/code-utils.js";
8
+ import { getErrorMessage as ci } from "../util/error-utils.js";
9
+ export default class Wt {
10
10
  constructor(t, e) {
11
11
  (this.j = t),
12
- (this.Oa = e),
12
+ (this.Da = e),
13
13
  (this.j = t),
14
- null == e && (e = Wt(DeviceProperties)),
15
- (this.Oa = e);
14
+ null == e && (e = Yt(DeviceProperties)),
15
+ (this.Da = e);
16
16
  }
17
17
  ve(t = !0) {
18
18
  let e = this.j.$u(s.Ou.Wh);
19
19
  null == e && ((e = new _t(V.de())), t && this.j.Ju(s.Ou.Wh, e));
20
- const r = new Oe(e.Iu);
21
- for (let t = 0; t < this.Oa.length; t++) {
22
- switch (this.Oa[t]) {
20
+ const r = new ke(e.Iu);
21
+ for (let t = 0; t < this.Da.length; t++) {
22
+ switch (this.Da[t]) {
23
23
  case DeviceProperties.BROWSER:
24
24
  r.browser = ro.browser;
25
25
  break;
26
26
  case DeviceProperties.BROWSER_VERSION:
27
- r.Fa = ro.version;
27
+ r.Oa = ro.version;
28
28
  break;
29
29
  case DeviceProperties.OS:
30
- r.os = this.Ga();
30
+ r.os = this.Fa();
31
31
  break;
32
32
  case DeviceProperties.RESOLUTION:
33
- r.Ja = screen.width + "x" + screen.height;
33
+ r.Ga = screen.width + "x" + screen.height;
34
34
  break;
35
35
  case DeviceProperties.LANGUAGE:
36
36
  r.language = ro.language;
37
37
  break;
38
38
  case DeviceProperties.TIME_ZONE:
39
- r.timeZone = this.Ha(new Date());
39
+ r.timeZone = this.Ja(new Date());
40
40
  break;
41
41
  case DeviceProperties.USER_AGENT:
42
42
  r.userAgent = ro.userAgent;
@@ -44,12 +44,12 @@ export default class Pt {
44
44
  }
45
45
  return r;
46
46
  }
47
- Ga() {
48
- if (ro.Ka()) return ro.Ka();
49
- const t = this.j.St(s.It.La);
50
- return t && t.os_version ? t.os_version : ro.Ga();
47
+ Fa() {
48
+ if (ro.qa()) return ro.qa();
49
+ const t = this.j.St(s.It.Aa);
50
+ return t && t.os_version ? t.os_version : ro.Fa();
51
51
  }
52
- Ha(t) {
52
+ Ja(t) {
53
53
  let e = !1;
54
54
  if ("undefined" != typeof Intl && "function" == typeof Intl.DateTimeFormat)
55
55
  try {
@@ -60,15 +60,15 @@ export default class Pt {
60
60
  } catch (t) {
61
61
  b.info(
62
62
  "Intl.DateTimeFormat threw an error, cannot detect user's time zone:" +
63
- ai(t),
63
+ ci(t),
64
64
  ),
65
65
  (e = !0);
66
66
  }
67
67
  if (e) return "";
68
68
  const r = t.getTimezoneOffset();
69
- return this.Pa(r);
69
+ return this.Ba(r);
70
70
  }
71
- Pa(t) {
71
+ Ba(t) {
72
72
  const e = Math.trunc(t / 60),
73
73
  r = Math.trunc(t % 60);
74
74
  let s = "GMT";