@braze/web-sdk 6.3.1 → 6.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 (132) hide show
  1. package/index.d.ts +35 -3
  2. package/package.json +1 -1
  3. package/shared-lib/encoding-utils.js +1 -1
  4. package/shared-lib/event-types.js +23 -23
  5. package/shared-lib/guid.js +2 -2
  6. package/shared-lib/indexed-db-adapter.js +7 -7
  7. package/shared-lib/logger.js +2 -2
  8. package/shared-lib/supported-options.js +22 -21
  9. package/src/Banner/display/banner-to-html.js +2 -2
  10. package/src/Banner/display/detect-banner-impressions.js +7 -7
  11. package/src/Banner/index.js +2 -0
  12. package/src/Banner/request-banners-refresh.js +6 -6
  13. package/src/Banner/ui/insert-banner.js +4 -4
  14. package/src/Card/card-manager-factory.js +5 -5
  15. package/src/Card/card-manager.js +4 -4
  16. package/src/Card/display/card-display.js +7 -7
  17. package/src/Card/log-card-dismissal.js +3 -3
  18. package/src/Card/log-content-card-click.js +3 -3
  19. package/src/Card/log-content-card-impressions.js +6 -6
  20. package/src/Card/models/card.js +7 -7
  21. package/src/Card/util/card-factory.js +6 -6
  22. package/src/ContentCards/content-cards-provider-factory.js +14 -10
  23. package/src/ContentCards/content-cards-provider.js +28 -28
  24. package/src/ContentCards/content-cards.js +4 -4
  25. package/src/ContentCards/get-cached-content-cards.js +2 -2
  26. package/src/ContentCards/request-content-cards-refresh.js +2 -2
  27. package/src/ContentCards/subscribe-to-content-cards-updates.js +3 -3
  28. package/src/ContentCards/ui/show-content-cards.js +8 -8
  29. package/src/Core/add-sdk-metadata.js +2 -2
  30. package/src/Core/change-user.js +5 -5
  31. package/src/Core/disable-sdk.js +3 -3
  32. package/src/Core/enable-sdk.js +3 -3
  33. package/src/Core/get-user.js +1 -1
  34. package/src/Core/is-disabled.js +1 -1
  35. package/src/Core/log-custom-event.js +9 -9
  36. package/src/Core/log-purchase.js +7 -7
  37. package/src/Core/open-session.js +11 -11
  38. package/src/Core/set-sdk-authentication-signature.js +2 -2
  39. package/src/Core/wipe-data.js +5 -5
  40. package/src/DUST/dust-provider-factory.js +20 -0
  41. package/src/DUST/dust-provider.js +288 -0
  42. package/src/DUST/index.js +3 -0
  43. package/src/DUST/subscribe-to-dust.js +24 -0
  44. package/src/DUST/types.js +1 -0
  45. package/src/FeatureFlags/feature-flags-provider-factory.js +9 -9
  46. package/src/FeatureFlags/feature-flags-provider.js +38 -38
  47. package/src/FeatureFlags/get-all-feature-flags.js +3 -3
  48. package/src/FeatureFlags/get-feature-flag.js +3 -3
  49. package/src/FeatureFlags/log-feature-flag-impression.js +5 -5
  50. package/src/FeatureFlags/refresh-feature-flags.js +5 -5
  51. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +3 -3
  52. package/src/InAppMessage/defer-in-app-message.js +1 -1
  53. package/src/InAppMessage/display/html-message-to-html.js +5 -5
  54. package/src/InAppMessage/display/in-app-message-to-html.js +22 -22
  55. package/src/InAppMessage/display/modal-utils.js +5 -5
  56. package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
  57. package/src/InAppMessage/in-app-message-factory.js +4 -4
  58. package/src/InAppMessage/in-app-message-manager.js +80 -80
  59. package/src/InAppMessage/log-in-app-message-button-click.js +5 -5
  60. package/src/InAppMessage/log-in-app-message-click.js +5 -5
  61. package/src/InAppMessage/log-in-app-message-html-click.js +5 -5
  62. package/src/InAppMessage/log-in-app-message-impression.js +1 -1
  63. package/src/InAppMessage/models/control-message.js +1 -1
  64. package/src/InAppMessage/models/full-screen-message.js +12 -12
  65. package/src/InAppMessage/models/html-message.js +14 -14
  66. package/src/InAppMessage/models/in-app-message-button.js +4 -4
  67. package/src/InAppMessage/models/in-app-message.js +119 -121
  68. package/src/InAppMessage/models/modal-message.js +12 -12
  69. package/src/InAppMessage/models/slide-up-message.js +21 -21
  70. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  71. package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
  72. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
  73. package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +18 -0
  74. package/src/InAppMessage/ui/show-in-app-message.js +24 -24
  75. package/src/Push/is-push-blocked.js +2 -2
  76. package/src/Push/is-push-permission-granted.js +2 -2
  77. package/src/Push/is-push-supported.js +2 -2
  78. package/src/Push/push-manager-factory.js +8 -8
  79. package/src/Push/push-manager.js +90 -90
  80. package/src/Push/utils/push-utils.js +17 -17
  81. package/src/User/user-manager.js +12 -12
  82. package/src/User/user.js +48 -48
  83. package/src/common/constants.js +1 -0
  84. package/src/common/content-cards-display.js +20 -20
  85. package/src/common/event-logger.js +4 -4
  86. package/src/common/properties-base.js +16 -16
  87. package/src/l10n/l10n-manager-factory.js +2 -2
  88. package/src/l10n/l10n-manager.js +1 -1
  89. package/src/managers/auth-manager.js +29 -29
  90. package/src/managers/braze-instance.js +141 -133
  91. package/src/managers/device-manager.js +18 -18
  92. package/src/managers/network-manager.js +139 -139
  93. package/src/managers/server-config-manager.js +99 -82
  94. package/src/managers/session-manager.js +32 -32
  95. package/src/managers/storage-manager-factory.js +8 -8
  96. package/src/managers/storage-manager.js +76 -74
  97. package/src/managers/subscription-manager.js +10 -10
  98. package/src/models/backend-errors.js +5 -5
  99. package/src/models/braze-event.js +9 -9
  100. package/src/models/device.js +2 -2
  101. package/src/models/identifier.js +12 -12
  102. package/src/models/push-token.js +12 -12
  103. package/src/models/request-result.js +1 -1
  104. package/src/models/server-config.js +38 -34
  105. package/src/request-controller.js +136 -134
  106. package/src/triggers/models/custom-event-data.js +4 -4
  107. package/src/triggers/models/custom-event-property-data.js +5 -5
  108. package/src/triggers/models/filter-set.js +8 -8
  109. package/src/triggers/models/filter.js +30 -30
  110. package/src/triggers/models/in-app-message-click-data.js +1 -1
  111. package/src/triggers/models/purchase-data.js +1 -1
  112. package/src/triggers/models/purchase-property-data.js +2 -2
  113. package/src/triggers/models/push-click-data.js +1 -1
  114. package/src/triggers/models/trigger-condition.js +36 -36
  115. package/src/triggers/models/trigger-events.js +2 -2
  116. package/src/triggers/models/trigger.js +15 -15
  117. package/src/triggers/triggers-provider-factory.js +3 -3
  118. package/src/triggers/triggers-provider.js +25 -25
  119. package/src/ui/js/attach-css.js +3 -3
  120. package/src/ui/js/load-font-awesome.js +2 -2
  121. package/src/util/base-device-parser.js +3 -3
  122. package/src/util/braze-actions.js +3 -3
  123. package/src/util/browser-detector.js +13 -13
  124. package/src/util/client-hints-parser.js +6 -6
  125. package/src/util/component-utils.js +1 -1
  126. package/src/util/dom-utils.js +10 -10
  127. package/src/util/key-codes.js +1 -1
  128. package/src/util/net.js +1 -1
  129. package/src/util/request-header-utils.js +22 -22
  130. package/src/util/user-agent-parser.js +14 -14
  131. package/src/util/validation-utils.js +9 -9
  132. package/src/util/window-utils.js +1 -1
@@ -2,18 +2,18 @@ import a from "../util/net.js";
2
2
  import t from "../common/base-provider.js";
3
3
  import r from "../managers/braze-instance.js";
4
4
  import ContentCards from "./content-cards.js";
5
- import { dateFromUnixTimestamp as V } from "../util/date-utils.js";
6
- import { isURIJavascriptOrData as tt } from "../util/url-utils.js";
5
+ import { dateFromUnixTimestamp as X } from "../util/date-utils.js";
6
+ import { isURIJavascriptOrData as Z } from "../util/url-utils.js";
7
7
  import {
8
- newCardFromContentCardsJson as st,
9
- newCardFromSerializedValue as it,
8
+ newCardFromContentCardsJson as tt,
9
+ newCardFromSerializedValue as st,
10
10
  } from "../Card/util/card-factory.js";
11
11
  import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
12
12
  import u from "../managers/subscription-manager.js";
13
13
  import h from "../util/request-header-utils.js";
14
14
  import { randomInclusive as l } from "../util/math.js";
15
- import { logger as E, IndexedDBAdapter as et } from "../../shared-lib/index.js";
16
- export default class Z extends t {
15
+ import { logger as E, IndexedDBAdapter as it } from "../../shared-lib/index.js";
16
+ export default class W extends t {
17
17
  constructor(t, s, i, e, h) {
18
18
  super(),
19
19
  (this.Cs = t),
@@ -32,8 +32,8 @@ export default class Z extends t {
32
32
  (this.Ss = 0),
33
33
  (this.cards = []),
34
34
  this.Ts();
35
- const n = et.Us.Rs;
36
- new et(n, E).Ds(n.Fs.As, (t) => {
35
+ const n = it.Us.Rs;
36
+ new it(n, E).Ds(n.Fs.As, (t) => {
37
37
  this.Ls(t);
38
38
  }),
39
39
  (this.Ns = null),
@@ -59,7 +59,7 @@ export default class Z extends t {
59
59
  const t = this.j.lt(s.ct.Ps) || [],
60
60
  i = [];
61
61
  for (let s = 0; s < t.length; s++) {
62
- const e = it(t[s]);
62
+ const e = st(t[s]);
63
63
  null != e && i.push(e);
64
64
  }
65
65
  (this.cards = this.Xs(this._s(i, !1))),
@@ -81,10 +81,10 @@ export default class Z extends t {
81
81
  break;
82
82
  }
83
83
  if (i) {
84
- const t = st(e);
84
+ const t = tt(e);
85
85
  null != h && h.viewed && t && (t.viewed = !0), null != t && r.push(t);
86
86
  } else if (null == h) {
87
- const t = st(e);
87
+ const t = tt(e);
88
88
  null != t && r.push(t);
89
89
  } else {
90
90
  if (!h.ri(e))
@@ -130,7 +130,7 @@ export default class Z extends t {
130
130
  break;
131
131
  }
132
132
  if (null == h) {
133
- const t = st(e);
133
+ const t = tt(e);
134
134
  null != t && i.push(t);
135
135
  } else {
136
136
  if (!h.ri(e))
@@ -176,7 +176,7 @@ export default class Z extends t {
176
176
  let r = !1;
177
177
  for (let s = 0; s < t.length; s++) {
178
178
  const n = t[s].url;
179
- if (!this.vs && n && tt(n)) {
179
+ if (!this.vs && n && Z(n)) {
180
180
  E.error(
181
181
  `Card with url ${n} will not be displayed because Javascript URLs are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable this card.`,
182
182
  );
@@ -202,31 +202,31 @@ export default class Z extends t {
202
202
  Zs() {
203
203
  this.Js && (clearTimeout(this.Js), (this.Js = null));
204
204
  }
205
- fi(t, i, e = !1) {
205
+ ar(t, i, e = !1) {
206
206
  var n;
207
207
  const o = this.B,
208
208
  u = this.j;
209
209
  if (!o || !u) return void ("function" == typeof i && i());
210
- if ((e && (h.Ci(u, h.H.bi), this.Zs()), !this.Os()))
210
+ if ((e && (h.fi(u, h.H.Ci), this.Zs()), !this.Os()))
211
211
  return void (
212
212
  null === (n = this.h) ||
213
213
  void 0 === n ||
214
- n.vi(() => {
215
- this.fi(t, i, !0);
214
+ n.bi(() => {
215
+ this.ar(t, i, !0);
216
216
  })
217
217
  );
218
218
  const c = o.$({}, !0);
219
- u.lt(s.ct.Qs) !== r.Vs() && this.wi(),
219
+ u.lt(s.ct.Qs) !== r.Vs() && this.vi(),
220
220
  (c.last_full_sync_at = this.ys),
221
221
  (c.last_card_updated_at = this.Ss);
222
- const f = o.A(c, h.H.bi, e);
222
+ const f = o.A(c, h.H.Ci, e);
223
223
  let d = !1;
224
224
  o.J(
225
225
  c,
226
226
  (s = -1) => {
227
227
  if (this.j) {
228
228
  const t = new Date().valueOf();
229
- h.K(this.j, h.H.bi, t);
229
+ h.K(this.j, h.H.Ci, t);
230
230
  }
231
231
  -1 !== s && f.push(["X-Braze-Req-Tokens-Remaining", s.toString()]),
232
232
  a.O({
@@ -253,9 +253,9 @@ export default class Z extends t {
253
253
  o.st(
254
254
  e,
255
255
  () => {
256
- this.fi(t, i, !1);
256
+ this.ar(t, i, !1);
257
257
  },
258
- h.H.bi,
258
+ h.H.Ci,
259
259
  (t) => this.Ys(t),
260
260
  () => this.Zs(),
261
261
  r,
@@ -263,7 +263,7 @@ export default class Z extends t {
263
263
  },
264
264
  });
265
265
  },
266
- h.H.bi,
266
+ h.H.Ci,
267
267
  i,
268
268
  );
269
269
  }
@@ -285,13 +285,13 @@ export default class Z extends t {
285
285
  return (
286
286
  0 === e && (e = void 0),
287
287
  this.j && this.j.lt(s.ct.Hs) === this.Ss && void 0 === e && (e = this.Ss),
288
- new ContentCards(i, V(e))
288
+ new ContentCards(i, X(e))
289
289
  );
290
290
  }
291
291
  St(t) {
292
292
  return this.ws.wt(t);
293
293
  }
294
- wi() {
294
+ vi() {
295
295
  (this.ys = 0),
296
296
  (this.Ss = 0),
297
297
  this.j && (this.j.Nt(s.ct.Gs), this.j.Nt(s.ct.Hs));
@@ -306,7 +306,7 @@ export default class Z extends t {
306
306
  this.j.Nt(s.ct.Pt),
307
307
  this.j.Nt(s.ct.Lt))),
308
308
  this.Zs(),
309
- this.wi();
309
+ this.vi();
310
310
  }
311
311
  clearData(t) {
312
312
  (this.ys = 0),
@@ -324,9 +324,9 @@ export default class Z extends t {
324
324
  this.Zs();
325
325
  }
326
326
  Os() {
327
- return !!this.h && (!!this.h.gi() || (0 !== this.h.Ft() && this.ji(), !1));
327
+ return !!this.h && (!!this.h.wi() || (0 !== this.h.Ft() && this.gi(), !1));
328
328
  }
329
- ji() {
329
+ gi() {
330
330
  this.ws.L(new ContentCards([], new Date())), this.j && this.j.Nt(s.ct.Ps);
331
331
  }
332
332
  }
@@ -19,14 +19,14 @@ export default class ContentCards {
19
19
  sr(r) {
20
20
  logContentCardImpressions(r);
21
21
  }
22
- nr(r) {
22
+ dr(r) {
23
23
  return logContentCardClick(r);
24
24
  }
25
- dr() {
25
+ ur() {
26
26
  requestContentCardsRefresh();
27
27
  }
28
- ar() {
28
+ cr() {
29
29
  return !0;
30
30
  }
31
31
  }
32
- (ContentCards.ur = 6e4), (ContentCards.cr = 500), (ContentCards.Cr = 1e4);
32
+ (ContentCards.Cr = 6e4), (ContentCards.hr = 500), (ContentCards.lr = 1e4);
@@ -1,5 +1,5 @@
1
- import rr from "./content-cards-provider-factory.js";
1
+ import Y from "./content-cards-provider-factory.js";
2
2
  import r from "../managers/braze-instance.js";
3
3
  export function getCachedContentCards() {
4
- if (r.rr()) return rr.o().Ws(!1);
4
+ if (r.rr()) return Y.o().Ws(!1);
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import r from "../managers/braze-instance.js";
2
- import rr from "./content-cards-provider-factory.js";
2
+ import Y from "./content-cards-provider-factory.js";
3
3
  export function requestContentCardsRefresh(e, t) {
4
- if (r.rr()) return rr.o().fi(e, t, !0);
4
+ if (r.rr()) return Y.o().ar(e, t, !0);
5
5
  }
@@ -1,14 +1,14 @@
1
1
  import r from "../managers/braze-instance.js";
2
- import rr from "./content-cards-provider-factory.js";
2
+ import Y from "./content-cards-provider-factory.js";
3
3
  export function subscribeToContentCardsUpdates(o) {
4
4
  if (!r.rr()) return;
5
- const t = rr.o(),
5
+ const t = Y.o(),
6
6
  n = t.St(o);
7
7
  if (!t.jt()) {
8
8
  const o = r.nn();
9
9
  if (o) {
10
10
  const r = o.rn(() => {
11
- t.fi(void 0, void 0, !0);
11
+ t.ar(void 0, void 0, !0);
12
12
  });
13
13
  r && t.yt(r);
14
14
  }
@@ -1,6 +1,6 @@
1
- import r, { OPTIONS as z } from "../../managers/braze-instance.js";
1
+ import r, { OPTIONS as q } from "../../managers/braze-instance.js";
2
2
  import { ContentCards, subscribeToContentCardsUpdates } from "../index.js";
3
- import rr from "../content-cards-provider-factory.js";
3
+ import Y from "../content-cards-provider-factory.js";
4
4
  import { setCardHeight as tn } from "../../Card/display/card-display.js";
5
5
  import { logger as E } from "../../../shared-lib/index.js";
6
6
  import {
@@ -18,17 +18,17 @@ export function showContentCards(n, t) {
18
18
  fn();
19
19
  let e = !1;
20
20
  null == n && ((n = document.body), (e = !0));
21
- const o = r.ee(z.tn) || !1,
22
- s = rr.o().Ws(!1);
21
+ const o = r.ee(q.tn) || !1,
22
+ s = Y.o().Ws(!1);
23
23
  "function" == typeof t && cn(s, t(s.cards.slice()), s.lastUpdated, null, o);
24
24
  const a = on(s, o, e),
25
- i = rr.o(),
25
+ i = Y.o(),
26
26
  c = i.Bs();
27
27
  (null == s.lastUpdated ||
28
- new Date().valueOf() - s.lastUpdated.valueOf() > ContentCards.ur) &&
29
- (null == c || new Date().valueOf() - c > ContentCards.ur) &&
28
+ new Date().valueOf() - s.lastUpdated.valueOf() > ContentCards.Cr) &&
29
+ (null == c || new Date().valueOf() - c > ContentCards.Cr) &&
30
30
  (E.info(
31
- `Cached content cards were older than max TTL of ${ContentCards.ur} ms, requesting an update from the server.`,
31
+ `Cached content cards were older than max TTL of ${ContentCards.Cr} ms, requesting an update from the server.`,
32
32
  ),
33
33
  sn(s, a),
34
34
  i.Es(new Date().valueOf()));
@@ -1,7 +1,7 @@
1
1
  import aa from "../managers/braze-instance.js";
2
2
  import BrazeSdkMetadata from "./braze-sdk-metadata.js";
3
3
  import {
4
- isArray as D,
4
+ isArray as z,
5
5
  validateValueIsFromEnum as ta,
6
6
  } from "../util/code-utils.js";
7
7
  import { logger as E } from "../../shared-lib/index.js";
@@ -9,7 +9,7 @@ export function addSdkMetadata(a) {
9
9
  if (!aa.rr()) return;
10
10
  const t = aa.m();
11
11
  if (t) {
12
- if (!D(a))
12
+ if (!z(a))
13
13
  return (
14
14
  E.error("Cannot set SDK metadata because metadata is not an array."), !1
15
15
  );
@@ -1,17 +1,17 @@
1
1
  import r from "../managers/braze-instance.js";
2
- import { getByteLength as er } from "../util/string-utils.js";
2
+ import { getByteLength as rr } from "../util/string-utils.js";
3
3
  import { logger as E } from "../../shared-lib/index.js";
4
4
  import { User } from "../User/index.js";
5
- import { validateStandardString as ir } from "../util/validation-utils.js";
5
+ import { validateStandardString as er } from "../util/validation-utils.js";
6
6
  export function changeUser(e, i) {
7
7
  if (!r.rr()) return;
8
8
  if (null == e || 0 === e.length || e != e)
9
9
  return void E.error("changeUser requires a non-empty userId.");
10
- if (er(e) > User.mr)
10
+ if (rr(e) > User.mr)
11
11
  return void E.error(
12
12
  `Rejected user id "${e}" because it is longer than ${User.mr} bytes.`,
13
13
  );
14
- if (null != i && !ir(i, "set signature for new user", "signature")) return;
14
+ if (null != i && !er(i, "set signature for new user", "signature")) return;
15
15
  const t = r.nn();
16
- t && t.changeUser(e.toString(), r.lr(), i);
16
+ t && t.changeUser(e.toString(), r.gr(), i);
17
17
  }
@@ -1,5 +1,5 @@
1
1
  import r from "../managers/braze-instance.js";
2
- import { logger as E, IndexedDBAdapter as et } from "../../shared-lib/index.js";
2
+ import { logger as E, IndexedDBAdapter as it } 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();
@@ -7,8 +7,8 @@ export function disableSDK() {
7
7
  const n = new ee.ne(null, !0),
8
8
  a = "This-cookie-will-expire-in-" + n.se();
9
9
  n.store(s.ie, a);
10
- const i = et.Us.Rs;
11
- new et(i, E).setItem(i.Fs.le, i.me, !0),
10
+ const i = it.Us.Rs;
11
+ new it(i, E).setItem(i.Fs.le, i.me, !0),
12
12
  E.info("disableSDK was called"),
13
13
  r.destroy(!1),
14
14
  r.ce(!0);
@@ -1,10 +1,10 @@
1
1
  import r from "../managers/braze-instance.js";
2
- import { logger as E, IndexedDBAdapter as et } from "../../shared-lib/index.js";
2
+ import { logger as E, IndexedDBAdapter as it } from "../../shared-lib/index.js";
3
3
  import ee, { STORAGE_KEYS as s } from "../managers/storage-manager.js";
4
4
  export function enableSDK() {
5
5
  new ee.ne(null, !0).remove(s.ie);
6
- const e = et.Us.Rs;
7
- new et(e, E).be(e.Fs.le, e.me),
6
+ const e = it.Us.Rs;
7
+ new it(e, E).be(e.Fs.le, e.me),
8
8
  E.info("enableSDK was called"),
9
9
  r.destroy(!1),
10
10
  r.ce(!1);
@@ -1,4 +1,4 @@
1
1
  import r from "../managers/braze-instance.js";
2
2
  export function getUser() {
3
- if (r.rr()) return r.gr();
3
+ if (r.rr()) return r.br();
4
4
  }
@@ -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.ne(null, !0).br(s.ie);
3
+ return !!new ee.ne(null, !0).jr(s.ie);
4
4
  }
@@ -1,13 +1,13 @@
1
1
  import r from "../managers/braze-instance.js";
2
2
  import c from "../common/event-logger.js";
3
3
  import { logger as E, EventTypes as m } from "../../shared-lib/index.js";
4
- import ot from "../triggers/models/trigger-events.js";
5
- import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-factory.js";
4
+ import et from "../triggers/models/trigger-events.js";
5
+ import { TriggersProviderFactory as ot } from "../triggers/triggers-provider-factory.js";
6
6
  import {
7
- validateCustomProperties as nt,
8
- validateCustomString as mt,
7
+ validateCustomProperties as rt,
8
+ validateCustomString as nt,
9
9
  } from "../util/validation-utils.js";
10
- import { LOG_CUSTOM_EVENT_STRING as gt } from "../common/constants.js";
10
+ import { LOG_CUSTOM_EVENT_STRING as mt } from "../common/constants.js";
11
11
  export function logCustomEvent(t, e) {
12
12
  if (!r.rr()) return !1;
13
13
  if (null == t || t.length <= 0)
@@ -17,10 +17,10 @@ export function logCustomEvent(t, e) {
17
17
  ),
18
18
  !1
19
19
  );
20
- if (!mt(t, "log custom event", "the event name")) return !1;
21
- const [o, n] = nt(
20
+ if (!nt(t, "log custom event", "the event name")) return !1;
21
+ const [o, n] = rt(
22
22
  e,
23
- gt,
23
+ mt,
24
24
  "eventProperties",
25
25
  `log custom event "${t}"`,
26
26
  "event",
@@ -32,7 +32,7 @@ export function logCustomEvent(t, e) {
32
32
  const s = c.rt(m.CustomEvent, { n: t, p: n });
33
33
  if (s.W) {
34
34
  E.info(`Logged custom event "${t}".`);
35
- for (const o of s.ue) rt.o().ve(ot.pe, [t, e], o);
35
+ for (const o of s.ue) ot.o().ve(et.pe, [t, e], o);
36
36
  }
37
37
  return s.W;
38
38
  }
@@ -1,11 +1,11 @@
1
1
  import r from "../managers/braze-instance.js";
2
2
  import { MAX_PURCHASE_QUANTITY as or } from "../common/constants.js";
3
3
  import { logger as E, EventTypes as m } from "../../shared-lib/index.js";
4
- import ot from "../triggers/models/trigger-events.js";
5
- import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-factory.js";
4
+ import et from "../triggers/models/trigger-events.js";
5
+ import { TriggersProviderFactory as ot } from "../triggers/triggers-provider-factory.js";
6
6
  import {
7
- validateCustomProperties as nt,
8
- validateCustomString as mt,
7
+ validateCustomProperties as rt,
8
+ validateCustomString as nt,
9
9
  } from "../util/validation-utils.js";
10
10
  import c from "../common/event-logger.js";
11
11
  export function logPurchase(e, o, i, n, t) {
@@ -19,7 +19,7 @@ export function logPurchase(e, o, i, n, t) {
19
19
  ),
20
20
  !1
21
21
  );
22
- if (!mt(e, "log purchase", "the purchase name")) return !1;
22
+ if (!nt(e, "log purchase", "the purchase name")) return !1;
23
23
  if (null == o || isNaN(parseFloat(o.toString())))
24
24
  return (
25
25
  E.error(`logPurchase requires a numeric price, got ${o}, ignoring.`), !1
@@ -219,7 +219,7 @@ export function logPurchase(e, o, i, n, t) {
219
219
  E.error(`logPurchase requires a valid currencyCode, got ${i}, ignoring.`),
220
220
  !1
221
221
  );
222
- const [u, a] = nt(
222
+ const [u, a] = rt(
223
223
  t,
224
224
  "logPurchase",
225
225
  "purchaseProperties",
@@ -233,7 +233,7 @@ export function logPurchase(e, o, i, n, t) {
233
233
  const P = c.rt(m.Pr, { pid: e, c: i, p: s, q: D, pr: a });
234
234
  if (P.W) {
235
235
  E.info(`Logged ${D} purchase${D > 1 ? "s" : ""} of "${e}" for ${i} ${s}.`);
236
- for (const r of P.ue) rt.o().ve(ot.Rr, [e, t], r);
236
+ for (const r of P.ue) ot.o().ve(et.Rr, [e, t], r);
237
237
  }
238
238
  return P.W;
239
239
  }
@@ -1,25 +1,25 @@
1
1
  import r from "../managers/braze-instance.js";
2
- import { logger as E, IndexedDBAdapter as et } from "../../shared-lib/index.js";
3
- import ot from "../triggers/models/trigger-events.js";
4
- import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-factory.js";
2
+ import { logger as E, IndexedDBAdapter as it } from "../../shared-lib/index.js";
3
+ import et from "../triggers/models/trigger-events.js";
4
+ import { TriggersProviderFactory as ot } from "../triggers/triggers-provider-factory.js";
5
5
  export function openSession() {
6
6
  if (!r.rr()) return;
7
7
  const i = r.nn();
8
8
  if (!i) return;
9
9
  i.openSession();
10
- const t = et.Us.Rs,
11
- o = new et(t, E);
12
- o.jr(t.Fs.hr, (r, n) => {
10
+ const t = it.Us.Rs,
11
+ o = new it(t, E);
12
+ o.kr(t.Fs.vr, (r, n) => {
13
13
  const e = n.lastClick,
14
14
  s = n.trackingString;
15
15
  E.info(`Firing push click trigger from ${s} push click at ${e}`);
16
- const c = i.kr(e, s),
16
+ const c = i.$r(e, s),
17
17
  g = function () {
18
- rt.o().ve(ot.vr, [s], c);
18
+ ot.o().ve(et.wr, [s], c);
19
19
  };
20
- i.$r(g, g), o.be(t.Fs.hr, r);
20
+ i.yr(g, g), o.be(t.Fs.vr, r);
21
21
  }),
22
- o.Ds(t.Fs.wr, function (r) {
23
- i.yr(r);
22
+ o.Ds(t.Fs.zr, function (r) {
23
+ i.Fr(r);
24
24
  });
25
25
  }
@@ -1,8 +1,8 @@
1
1
  import r from "../managers/braze-instance.js";
2
- import { validateStandardString as ir } from "../util/validation-utils.js";
2
+ import { validateStandardString as er } from "../util/validation-utils.js";
3
3
  export function setSdkAuthenticationSignature(t) {
4
4
  if (!r.rr()) return !1;
5
- if ("" === t || !ir(t, "set signature", "signature", !1)) return !1;
5
+ if ("" === t || !er(t, "set signature", "signature", !1)) return !1;
6
6
  const i = r.Sr();
7
7
  return !!i && (i.setSdkAuthenticationSignature(t), !0);
8
8
  }
@@ -1,18 +1,18 @@
1
1
  import r from "../managers/braze-instance.js";
2
2
  import { keys as C } from "../util/code-utils.js";
3
- import { logger as E, IndexedDBAdapter as et } from "../../shared-lib/index.js";
3
+ import { logger as E, IndexedDBAdapter as it } from "../../shared-lib/index.js";
4
4
  import { BRAZE_MUST_BE_INITIALIZED_ERROR as w } from "../common/constants.js";
5
5
  export function wipeData() {
6
6
  const o = r.p();
7
7
  if (null == o) return void E.warn(w);
8
8
  o.clearData();
9
- const t = C(et.Us);
9
+ const t = C(it.Us);
10
10
  for (let o = 0; o < t.length; o++) {
11
11
  const n = t[o],
12
- r = et.Us[n];
13
- new et(r, E).clearData();
12
+ r = it.Us[n];
13
+ new it(r, E).clearData();
14
14
  }
15
- if (r.rr()) for (const o of r.lr()) o.clearData(!0);
15
+ if (r.rr()) for (const o of r.gr()) o.clearData(!0);
16
16
  const n = r.m();
17
17
  n && n.fo();
18
18
  }
@@ -0,0 +1,20 @@
1
+ import r from "../managers/braze-instance.js";
2
+ import tr from "./dust-provider.js";
3
+ const ir = {
4
+ i: !1,
5
+ provider: null,
6
+ o: () => {
7
+ if ((ir.t(), !ir.provider)) {
8
+ const t = r.ee("dustHost");
9
+ (ir.provider = new tr(r.m(), r.p(), t)), r.v(ir.provider);
10
+ }
11
+ return ir.provider;
12
+ },
13
+ t: () => {
14
+ ir.i || (r.g(ir), (ir.i = !0));
15
+ },
16
+ destroy: () => {
17
+ ir.provider && ir.provider.destroy(), (ir.provider = null), (ir.i = !1);
18
+ },
19
+ };
20
+ export default ir;