@braze/web-sdk 6.8.0 → 6.10.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 (141) hide show
  1. package/index.d.ts +113 -21
  2. package/package.json +1 -1
  3. package/shared-lib/event-types.js +20 -20
  4. package/shared-lib/indexed-db-adapter.js +64 -64
  5. package/shared-lib/logger.js +18 -18
  6. package/shared-lib/supported-options.js +8 -8
  7. package/src/Banner/banner-provider.js +67 -59
  8. package/src/Banner/banner.js +40 -19
  9. package/src/Banner/dismiss-banner.js +4 -0
  10. package/src/Banner/display/banner-to-html.js +10 -10
  11. package/src/Banner/display/destroy-banner-html.js +2 -2
  12. package/src/Banner/get-all-banners.js +6 -6
  13. package/src/Banner/get-banner.js +6 -6
  14. package/src/Banner/index.js +1 -0
  15. package/src/Banner/log-banner-click.js +7 -7
  16. package/src/Banner/log-banner-dismissal.js +7 -7
  17. package/src/Banner/log-banner-impressions.js +10 -10
  18. package/src/Banner/request-banners-refresh.js +8 -8
  19. package/src/Banner/subscribe-to-banners-updates.js +5 -5
  20. package/src/Banner/ui/insert-banner.js +8 -8
  21. package/src/Card/card-manager.js +31 -31
  22. package/src/Card/log-card-dismissal.js +2 -2
  23. package/src/Card/log-content-card-click.js +2 -2
  24. package/src/Card/log-content-card-impressions.js +4 -4
  25. package/src/Card/models/captioned-image.js +15 -15
  26. package/src/Card/models/card.js +89 -89
  27. package/src/Card/models/classic-card.js +16 -16
  28. package/src/Card/models/control-card.js +7 -7
  29. package/src/Card/models/image-only.js +13 -13
  30. package/src/Card/util/card-factory.js +32 -32
  31. package/src/ContentCards/content-cards-provider.js +102 -102
  32. package/src/ContentCards/get-cached-content-cards.js +1 -1
  33. package/src/ContentCards/subscribe-to-content-cards-updates.js +3 -3
  34. package/src/ContentCards/ui/show-content-cards.js +5 -5
  35. package/src/Core/add-sdk-metadata.js +2 -2
  36. package/src/Core/change-user.js +3 -3
  37. package/src/Core/destroy.js +2 -2
  38. package/src/Core/disable-sdk.js +4 -4
  39. package/src/Core/enable-sdk.js +4 -4
  40. package/src/Core/get-device-id.js +2 -2
  41. package/src/Core/handle-braze-action.js +5 -5
  42. package/src/Core/index.js +1 -0
  43. package/src/Core/log-custom-event.js +5 -5
  44. package/src/Core/log-ecommerce-event.js +5 -5
  45. package/src/Core/log-purchase.js +9 -9
  46. package/src/Core/logout.js +22 -0
  47. package/src/Core/open-session.js +7 -7
  48. package/src/Core/set-logger.js +2 -2
  49. package/src/Core/toggle-logging.js +2 -2
  50. package/src/Core/wipe-data.js +6 -6
  51. package/src/DUST/dust-provider.js +249 -240
  52. package/src/DUST/dust-shared-worker-code.js +1 -1
  53. package/src/DUST/dust-shared-worker-impl.js +15 -14
  54. package/src/DUST/dust-worker-bridge.js +50 -35
  55. package/src/DUST/subscribe-to-dust.js +7 -7
  56. package/src/FeatureFlags/feature-flag-factory.js +8 -8
  57. package/src/FeatureFlags/feature-flag.js +3 -3
  58. package/src/FeatureFlags/feature-flags-provider.js +21 -21
  59. package/src/FeatureFlags/log-feature-flag-impression.js +5 -5
  60. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
  61. package/src/InAppMessage/constants.js +3 -3
  62. package/src/InAppMessage/defer-in-app-message.js +4 -4
  63. package/src/InAppMessage/display/html-message-to-html.js +4 -4
  64. package/src/InAppMessage/display/in-app-message-to-html.js +16 -16
  65. package/src/InAppMessage/in-app-message-factory.js +36 -36
  66. package/src/InAppMessage/in-app-message-manager.js +78 -78
  67. package/src/InAppMessage/log-in-app-message-button-click.js +4 -4
  68. package/src/InAppMessage/log-in-app-message-click.js +3 -3
  69. package/src/InAppMessage/log-in-app-message-html-click.js +5 -5
  70. package/src/InAppMessage/log-in-app-message-impression.js +4 -4
  71. package/src/InAppMessage/models/control-message.js +4 -4
  72. package/src/InAppMessage/models/full-screen-message.js +4 -4
  73. package/src/InAppMessage/models/html-message.js +3 -3
  74. package/src/InAppMessage/models/in-app-message-button.js +4 -4
  75. package/src/InAppMessage/models/in-app-message.js +12 -12
  76. package/src/InAppMessage/models/modal-message.js +4 -4
  77. package/src/InAppMessage/models/slide-up-message.js +4 -4
  78. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  79. package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
  80. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
  81. package/src/InAppMessage/ui/show-in-app-message.js +14 -14
  82. package/src/Push/push-manager-factory.js +2 -2
  83. package/src/Push/push-manager.js +38 -38
  84. package/src/Push/unregister-push-token-on-server.js +35 -0
  85. package/src/Push/unregister-push.js +2 -1
  86. package/src/Push/utils/push-utils.js +6 -6
  87. package/src/User/user-manager.js +14 -14
  88. package/src/User/user.js +25 -25
  89. package/src/common/base-provider.js +1 -1
  90. package/src/common/content-cards-display.js +7 -7
  91. package/src/common/event-logger.js +3 -3
  92. package/src/common/properties-base.js +3 -3
  93. package/src/l10n/l10n-manager-factory.js +2 -2
  94. package/src/l10n/l10n-manager.js +4 -4
  95. package/src/managers/auth-manager.js +11 -11
  96. package/src/managers/braze-instance.js +56 -56
  97. package/src/managers/device-manager.js +10 -10
  98. package/src/managers/network-manager.js +103 -102
  99. package/src/managers/server-config-manager.js +112 -95
  100. package/src/managers/session-manager.js +20 -20
  101. package/src/managers/storage-manager-factory.js +9 -9
  102. package/src/managers/storage-manager.js +73 -73
  103. package/src/managers/subscription-manager.js +2 -2
  104. package/src/managers/utils.js +1 -1
  105. package/src/models/backend-errors.js +5 -5
  106. package/src/models/braze-event.js +1 -1
  107. package/src/models/device.js +1 -1
  108. package/src/models/identifier.js +2 -2
  109. package/src/models/push-token.js +6 -6
  110. package/src/models/request-result.js +1 -1
  111. package/src/models/server-config.js +42 -24
  112. package/src/request-controller.js +126 -126
  113. package/src/triggers/models/custom-event-data.js +4 -4
  114. package/src/triggers/models/custom-event-property-data.js +5 -5
  115. package/src/triggers/models/filter-set.js +2 -2
  116. package/src/triggers/models/filter.js +1 -1
  117. package/src/triggers/models/in-app-message-click-data.js +1 -1
  118. package/src/triggers/models/purchase-data.js +1 -1
  119. package/src/triggers/models/purchase-property-data.js +2 -2
  120. package/src/triggers/models/push-click-data.js +3 -3
  121. package/src/triggers/models/trigger-condition.js +36 -36
  122. package/src/triggers/models/trigger-events.js +1 -1
  123. package/src/triggers/models/trigger.js +33 -33
  124. package/src/triggers/triggers-provider-factory.js +1 -1
  125. package/src/triggers/triggers-provider.js +68 -68
  126. package/src/types.js +2 -2
  127. package/src/ui/js/attach-css.js +1 -1
  128. package/src/util/braze-actions.js +7 -7
  129. package/src/util/browser-detector.js +2 -2
  130. package/src/util/client-hints-parser.js +4 -4
  131. package/src/util/code-utils.js +2 -2
  132. package/src/util/deprecation-utils.js +2 -2
  133. package/src/util/dom-utils.js +7 -7
  134. package/src/util/ecommerce-event-validation.js +52 -35
  135. package/src/util/html-display-utils.js +11 -11
  136. package/src/util/net.js +4 -4
  137. package/src/util/request-header-utils.js +36 -35
  138. package/src/util/string-utils.js +2 -2
  139. package/src/util/user-agent-parser.js +2 -2
  140. package/src/util/validation-utils.js +12 -12
  141. package/src/util/window-utils.js +2 -2
@@ -1,38 +1,38 @@
1
- const E = {
1
+ const b = {
2
2
  init: function (n) {
3
- (void 0 === n && void 0 !== E.zg) || (E.zg = !!n), E.i || (E.i = !0);
3
+ (void 0 === n && void 0 !== b.zg) || (b.zg = !!n), b.i || (b.i = !0);
4
4
  },
5
5
  destroy: function () {
6
- (E.i = !1), (E.zg = void 0), (E.vd = void 0);
6
+ (b.i = !1), (b.zg = void 0), (b.Ud = void 0);
7
7
  },
8
8
  setLogger: function (n) {
9
9
  "function" == typeof n
10
- ? (E.init(), (E.vd = n))
11
- : E.info("Ignoring setLogger call since logger is not a function");
10
+ ? (b.init(), (b.Ud = n))
11
+ : b.info("Ignoring setLogger call since logger is not a function");
12
12
  },
13
13
  toggleLogging: function () {
14
- E.init(),
15
- E.zg
16
- ? (console.log("Disabling Braze logging"), (E.zg = !1))
17
- : (console.log("Enabled Braze logging"), (E.zg = !0));
14
+ b.init(),
15
+ b.zg
16
+ ? (console.log("Disabling Braze logging"), (b.zg = !1))
17
+ : (console.log("Enabled Braze logging"), (b.zg = !0));
18
18
  },
19
19
  info: function (n) {
20
- if (E.zg) {
20
+ if (b.zg) {
21
21
  const o = "Braze: " + n;
22
- null != E.vd ? E.vd(o) : console.log(o);
22
+ null != b.Ud ? b.Ud(o) : console.log(o);
23
23
  }
24
24
  },
25
25
  warn: function (n) {
26
- if (E.zg) {
27
- const o = "Braze SDK Warning: " + n + " (v6.8.0)";
28
- null != E.vd ? E.vd(o) : console.warn(o);
26
+ if (b.zg) {
27
+ const o = "Braze SDK Warning: " + n + " (v6.10.0)";
28
+ null != b.Ud ? b.Ud(o) : console.warn(o);
29
29
  }
30
30
  },
31
31
  error: function (n) {
32
- if (E.zg) {
33
- const o = "Braze SDK Error: " + n + " (v6.8.0)";
34
- null != E.vd ? E.vd(o) : console.error(o);
32
+ if (b.zg) {
33
+ const o = "Braze SDK Error: " + n + " (v6.10.0)";
34
+ null != b.Ud ? b.Ud(o) : console.error(o);
35
35
  }
36
36
  },
37
37
  };
38
- export default E;
38
+ export default b;
@@ -4,26 +4,26 @@ export default {
4
4
  se: "cookieExpiryInDays",
5
5
  Oh: "noCookies",
6
6
  Th: "devicePropertyAllowlist",
7
- qa: "disablePushTokenMaintenance",
7
+ ka: "disablePushTokenMaintenance",
8
8
  Rh: "enableLogging",
9
9
  Ph: "enableSdkAuthentication",
10
- ka: "manageServiceWorkerExternally",
10
+ _a: "manageServiceWorkerExternally",
11
11
  Dh: "minimumIntervalBetweenTriggerActionsInSeconds",
12
12
  Lh: "sessionTimeoutInSeconds",
13
13
  yh: "appVersion",
14
14
  Mh: "appVersionNumber",
15
15
  xa: "serviceWorkerLocation",
16
- _a: "safariWebsitePushId",
17
- Ba: "localization",
16
+ Ma: "safariWebsitePushId",
17
+ Aa: "localization",
18
18
  sr: "contentSecurityNonce",
19
19
  nr: "allowUserSuppliedJavascript",
20
- wa: "inAppMessageZIndex",
21
- va: "openInAppMessagesInNewTab",
20
+ ja: "inAppMessageZIndex",
21
+ ba: "openInAppMessagesInNewTab",
22
22
  oh: "requireExplicitInAppMessageDismissal",
23
23
  Uh: "doNotLoadFontAwesome",
24
24
  Wh: "deviceId",
25
- Ma: "serviceWorkerScope",
26
- Xe: "dustHost",
25
+ ya: "serviceWorkerScope",
26
+ Ye: "dustHost",
27
27
  Bh: "sdkFlavor",
28
28
  tn: "openCardsInNewTab",
29
29
  };
@@ -18,33 +18,34 @@ import r from "../managers/braze-instance.js";
18
18
  import v from "../common/event-logger.js";
19
19
  import { EventTypes as p } from "../../shared-lib/event-types.js";
20
20
  import { isArray as g } from "../util/code-utils.js";
21
+ import { logger as b } from "../../shared-lib/index.js";
21
22
  export default class e extends t {
22
23
  constructor(t, s, i, e) {
23
24
  super(),
24
25
  (this.h = t),
25
26
  (this.B = s),
26
- (this.C = i),
27
- (this.j = e),
27
+ (this.j = i),
28
+ (this.C = e),
28
29
  (this.banners = {}),
29
30
  (this.h = t),
30
31
  (this.B = s),
31
- (this.C = i),
32
- (this.j = e),
32
+ (this.j = i),
33
+ (this.C = e),
33
34
  (this.D = 10),
34
35
  (this.N = null),
35
36
  (this.F = null),
36
37
  (this.R = new f()),
37
38
  r.S(this.R),
38
39
  (this.T = null),
39
- (this.q = null);
40
+ (this.I = null);
40
41
  }
41
- I(t) {
42
+ q(t) {
42
43
  if (this.P() && (this._(t), null != t && t.banners)) {
43
44
  const s = t.request_time,
44
45
  i = "number" != typeof s || isNaN(s) ? null : s,
45
46
  e = this.k(),
46
- r = this.L(),
47
- o = this.$();
47
+ r = this.$(),
48
+ o = this.L();
48
49
  this.banners = {};
49
50
  const h = t.banners;
50
51
  for (const t in h) {
@@ -101,7 +102,7 @@ export default class e extends t {
101
102
  ? void 0
102
103
  : s.acknowledged;
103
104
  if (!i || !g(i) || 0 === i.length) return;
104
- const e = this.L();
105
+ const e = this.$();
105
106
  if (0 === e.length) return;
106
107
  const n = {};
107
108
  for (const t of i)
@@ -135,7 +136,7 @@ export default class e extends t {
135
136
  const f = [];
136
137
  for (const s of t) f.push({ id: s });
137
138
  u.placements = f;
138
- const v = this.L().map((t) => ({
139
+ const v = this.$().map((t) => ({
139
140
  banner_id: t.banner_id,
140
141
  dismissal_time: t.dismissal_time,
141
142
  }));
@@ -148,7 +149,7 @@ export default class e extends t {
148
149
  const n = this.B;
149
150
  if (!n) return void r();
150
151
  const o = new Date().valueOf();
151
- h.nt(this.C, h.it.st, o),
152
+ h.nt(this.j, h.it.st, o),
152
153
  -1 !== e && p.push(["X-Braze-Req-Tokens-Remaining", e.toString()]);
153
154
  const f = u.time_ms;
154
155
  null == f || "number" != typeof f || isNaN(f) || this.rt(t, f),
@@ -158,7 +159,7 @@ export default class e extends t {
158
159
  data: u,
159
160
  lt: (t) => {
160
161
  if (!n.ut(u, t, p)) return (g = !0), void r();
161
- n.ct(), this.I(t), (g = !1), "function" == typeof s && s();
162
+ n.ct(), this.q(t), (g = !1), "function" == typeof s && s();
162
163
  },
163
164
  error: (t) => {
164
165
  n.dt(t, "retrieving banners"), (g = !0), r();
@@ -166,7 +167,7 @@ export default class e extends t {
166
167
  ft: (e, r) => {
167
168
  var o, l, u;
168
169
  let f;
169
- if (((this.q = t), g)) {
170
+ if (((this.I = t), g)) {
170
171
  const t =
171
172
  (null === (o = this.h) || void 0 === o ? void 0 : o.vt()) ||
172
173
  d,
@@ -196,18 +197,24 @@ export default class e extends t {
196
197
  i,
197
198
  );
198
199
  }
199
- Ct() {
200
- return this.q;
200
+ jt() {
201
+ return this.I;
201
202
  }
202
- jt(t, s) {
203
+ Ct(t, s) {
203
204
  const i = { id: t.id };
204
205
  s && (i.bid = s);
205
- return v.wt(p.Dt, i).lt;
206
+ return v.Dt(p.Nt, i).lt;
206
207
  }
207
- Nt(t) {
208
+ wt(t) {
208
209
  if (!t.G) return !1;
209
- const s = this.L();
210
- if (s.some((s) => s.banner_id === t.id && s.stable_key === t.G)) return !1;
210
+ const s = this.$();
211
+ if (s.some((s) => s.banner_id === t.id && s.stable_key === t.G))
212
+ return (
213
+ b.info(
214
+ `Not dismissing banner ID ${t.id}. The banner has already been dismissed.`,
215
+ ),
216
+ !1
217
+ );
211
218
  const i = { id: t.id },
212
219
  e = this.k(),
213
220
  n = e[t.placementId];
@@ -222,8 +229,9 @@ export default class e extends t {
222
229
  dismissal_time: new Date().valueOf(),
223
230
  stable_key: t.G,
224
231
  }),
225
- this.J(s);
226
- return v.wt(p.Ft, i).lt;
232
+ this.J(s),
233
+ t.Ft();
234
+ return v.Dt(p.Rt, i).lt;
227
235
  }
228
236
  Y() {
229
237
  null != this.F && (clearTimeout(this.F), (this.F = null));
@@ -233,7 +241,7 @@ export default class e extends t {
233
241
  }
234
242
  k() {
235
243
  let t = {};
236
- this.C && (t = this.C.Rt(s.Tt.St));
244
+ this.j && (t = this.j.St(s.It.Tt));
237
245
  const i = {};
238
246
  for (const s in t) {
239
247
  let e = null;
@@ -243,7 +251,7 @@ export default class e extends t {
243
251
  }
244
252
  W() {
245
253
  var t;
246
- if (!this.C) return;
254
+ if (!this.j) return;
247
255
  const i = {};
248
256
  for (const s in this.banners) {
249
257
  const e =
@@ -251,86 +259,86 @@ export default class e extends t {
251
259
  null;
252
260
  i[s] = e;
253
261
  }
254
- this.C.It(s.Tt.St, i), this.Pt();
262
+ this.j.Pt(s.It.Tt, i), this._t();
255
263
  }
256
- Pt() {
264
+ _t() {
257
265
  var t, i;
258
- null === (t = this.C) ||
266
+ null === (t = this.j) ||
259
267
  void 0 === t ||
260
- t.It(s.Tt._t, null === (i = this.j) || void 0 === i ? void 0 : i.kt());
268
+ t.Pt(s.It.kt, null === (i = this.C) || void 0 === i ? void 0 : i.$t());
261
269
  }
262
- Et() {
270
+ xt() {
263
271
  var t;
264
272
  return (
265
- (null === (t = this.C) || void 0 === t ? void 0 : t.Rt(s.Tt._t)) || null
273
+ (null === (t = this.j) || void 0 === t ? void 0 : t.St(s.It.kt)) || null
266
274
  );
267
275
  }
268
- Lt() {
276
+ Et() {
269
277
  return this.T;
270
278
  }
271
- $t(t) {
279
+ Lt(t) {
272
280
  this.T = t;
273
281
  }
274
- xt() {
282
+ zt() {
275
283
  var t;
276
- const s = null === (t = this.j) || void 0 === t ? void 0 : t.kt(),
277
- i = this.Et();
284
+ const s = null === (t = this.C) || void 0 === t ? void 0 : t.$t(),
285
+ i = this.xt();
278
286
  return null == i || s === i;
279
287
  }
280
- zt(t) {
281
- return this.R.Kt(t);
288
+ Kt(t) {
289
+ return this.R.Ut(t);
282
290
  }
283
- Ut() {
291
+ Wt() {
284
292
  var t;
285
293
  return (
286
- (null === (t = this.C) || void 0 === t ? void 0 : t.Rt(s.Tt.Wt)) || {}
294
+ (null === (t = this.j) || void 0 === t ? void 0 : t.St(s.It.At)) || {}
287
295
  );
288
296
  }
289
- At(t) {
290
- this.C && this.C.It(s.Tt.Wt, t);
297
+ Mt(t) {
298
+ this.j && this.j.Pt(s.It.At, t);
291
299
  }
292
- L() {
300
+ $() {
293
301
  var t;
294
302
  return (
295
- (null === (t = this.C) || void 0 === t ? void 0 : t.Rt(s.Tt.Mt)) || []
303
+ (null === (t = this.j) || void 0 === t ? void 0 : t.St(s.It.Xt)) || []
296
304
  );
297
305
  }
298
306
  J(t) {
299
307
  var i;
300
- if (!this.C) return;
301
- const e = null === (i = this.h) || void 0 === i ? void 0 : i.Xt(),
308
+ if (!this.j) return;
309
+ const e = null === (i = this.h) || void 0 === i ? void 0 : i.Gt(),
302
310
  n = null != e ? e : u,
303
311
  r = t.length <= n ? t : t.slice(-n);
304
- this.C.It(s.Tt.Mt, r);
312
+ this.j.Pt(s.It.Xt, r);
305
313
  }
306
- $() {
314
+ L() {
307
315
  var t;
308
316
  return (
309
- (null === (t = this.C) || void 0 === t ? void 0 : t.Rt(s.Tt.Gt)) || {}
317
+ (null === (t = this.j) || void 0 === t ? void 0 : t.St(s.It.Ht)) || {}
310
318
  );
311
319
  }
312
320
  rt(t, i) {
313
- if (!this.C) return;
314
- const e = this.$();
321
+ if (!this.j) return;
322
+ const e = this.L();
315
323
  for (const s of t) e[s] = i;
316
- this.C.It(s.Tt.Gt, e);
324
+ this.j.Pt(s.It.Ht, e);
317
325
  }
318
326
  changeUser() {
319
- this.Ht(), this.Y();
327
+ this.Jt(), this.Y();
320
328
  }
321
329
  clearData() {
322
330
  this.Y();
323
331
  }
324
332
  P() {
325
- return !!this.h && (!!this.h.Jt() || (0 !== this.h.Ot() && this.Ht(), !1));
333
+ return !!this.h && (!!this.h.Ot() || (0 !== this.h.Qt() && this.Jt(), !1));
326
334
  }
327
- Ht() {
335
+ Jt() {
328
336
  (this.banners = {}),
329
- this.C &&
330
- (this.C.Qt(s.Tt.St),
331
- this.C.Qt(s.Tt.Wt),
332
- this.C.Qt(s.Tt.Mt),
333
- this.C.Qt(s.Tt.Gt)),
337
+ this.j &&
338
+ (this.j.Vt(s.It.Tt),
339
+ this.j.Vt(s.It.At),
340
+ this.j.Vt(s.It.Xt),
341
+ this.j.Vt(s.It.Ht)),
334
342
  this.R.A({});
335
343
  }
336
344
  }
@@ -1,33 +1,54 @@
1
- import { PropertiesBase as x } from "../common/properties-base.js";
2
- export default class Banner extends x {
3
- constructor(t, s, i, h = !1, r = !1, e = -1, o = {}, n = null) {
4
- super(o),
5
- (this.id = t),
6
- (this.placementId = s),
7
- (this.html = i),
8
- (this.Vt = h),
1
+ import { PropertiesBase as D } from "../common/properties-base.js";
2
+ import f from "../managers/subscription-manager.js";
3
+ export default class Banner extends D {
4
+ constructor(s, i, t, h = !1, r = !1, e = -1, n = {}, o = null) {
5
+ super(n),
6
+ (this.id = s),
7
+ (this.placementId = i),
8
+ (this.html = t),
9
+ (this.ss = h),
9
10
  (this.isControl = r),
10
- (this.Yt = e),
11
- (this.G = n),
12
- (this.id = t),
13
- (this.placementId = s),
14
- (this.html = i),
15
- (this.Vt = h),
11
+ (this.ts = e),
12
+ (this.G = o),
13
+ (this.id = s),
14
+ (this.placementId = i),
15
+ (this.html = t),
16
+ (this.ss = h),
16
17
  (this.isControl = r),
17
- (this.Yt = e),
18
- (this.Zt = !1);
18
+ (this.ts = e),
19
+ (this.hs = !1),
20
+ (this.rs = !1),
21
+ (this.es = null);
19
22
  }
20
- ts() {
23
+ subscribeToDismissedEvent(s) {
24
+ return this.ns().Ut(s);
25
+ }
26
+ removeSubscription(s) {
27
+ null != this.es && this.es.removeSubscription(s);
28
+ }
29
+ removeAllSubscriptions() {
30
+ null != this.es && this.es.removeAllSubscriptions();
31
+ }
32
+ os() {
21
33
  return this.isControl;
22
34
  }
35
+ ns() {
36
+ return null == this.es && (this.es = new f()), this.es;
37
+ }
38
+ Ft() {
39
+ return (
40
+ !this.rs &&
41
+ ((this.rs = !0), this.ns().A(), this.removeAllSubscriptions(), !0)
42
+ );
43
+ }
23
44
  qt() {
24
45
  return {
25
46
  id: this.id,
26
47
  pid: this.placementId,
27
48
  html: this.html,
28
- its: this.Vt,
49
+ its: this.ss,
29
50
  ic: this.isControl,
30
- eat: this.Yt,
51
+ eat: this.ts,
31
52
  pr: this.properties,
32
53
  sk: this.G,
33
54
  };
@@ -0,0 +1,4 @@
1
+ import { logBannerDismissal as j } from "./log-banner-dismissal.js";
2
+ export function dismissBanner(n) {
3
+ return j(n);
4
+ }
@@ -1,11 +1,11 @@
1
1
  import {
2
- attachHtmlToIframeWithNonce as b,
3
- buildBrazeBridge as N,
2
+ attachHtmlToIframeWithNonce as N,
3
+ buildBrazeBridge as E,
4
4
  } from "../../util/html-display-utils.js";
5
- import E from "../../../shared-lib/logger.js";
5
+ import b from "../../../shared-lib/logger.js";
6
6
  import { logBannerClick } from "../log-banner-click.js";
7
- import { logBannerDismissal as _ } from "../log-banner-dismissal.js";
8
- import { destroyBannerHtml as A } from "./destroy-banner-html.js";
7
+ import { logBannerDismissal as j } from "../log-banner-dismissal.js";
8
+ import { destroyBannerHtml as _ } from "./destroy-banner-html.js";
9
9
  export const BANNER_PLACEMENT_ID = "data-ab-banner-placement-id";
10
10
  export const BANNER_HTML_CLASS = "ab-html-banner";
11
11
  export const CONTROL_BANNER_HTML_CLASS = "ab-html-control-banner";
@@ -19,7 +19,7 @@ export function controlBannerToHtml(n) {
19
19
  );
20
20
  }
21
21
  export function bannerToHtml(n, t) {
22
- if (n.ts()) return controlBannerToHtml(n);
22
+ if (n.os()) return controlBannerToHtml(n);
23
23
  const o = document.createElement("iframe");
24
24
  return (
25
25
  (o.id = n.id),
@@ -27,24 +27,24 @@ export function bannerToHtml(n, t) {
27
27
  (o.className = "ab-html-banner"),
28
28
  o.setAttribute(BANNER_PLACEMENT_ID, n.placementId),
29
29
  o.setAttribute("title", "Banner"),
30
- b(o, n.html, t),
30
+ N(o, n.html, t),
31
31
  (o.onload = () => {
32
32
  const t = o.contentWindow,
33
33
  e = t.document.getElementsByTagName("title");
34
34
  e && e.length > 0 && o.setAttribute("title", e[0].textContent || "");
35
- const r = Object.assign(Object.assign({}, N(o)), {
35
+ const r = Object.assign(Object.assign({}, E(o)), {
36
36
  logClick: function () {
37
37
  logBannerClick(n, ...arguments);
38
38
  },
39
39
  closeMessage: function () {
40
40
  !(function (n) {
41
41
  const t = document.getElementById(n.id);
42
- t && A(t), _(n);
42
+ t && _(t), j(n);
43
43
  })(n);
44
44
  },
45
45
  setBannerHeight: (n) => {
46
46
  isNaN(n) || !isFinite(n) || n < 0
47
- ? E.warn(`Invalid banner height: ${n}`)
47
+ ? b.warn(`Invalid banner height: ${n}`)
48
48
  : (o.style.height = `${n}px`);
49
49
  },
50
50
  });
@@ -1,7 +1,7 @@
1
1
  import { removeSubscription } from "../../Core/remove-subscription.js";
2
- import { BannerStrings as j } from "../constants.js";
2
+ import { BannerStrings as x } from "../constants.js";
3
3
  export function destroyBannerHtml(o) {
4
- const r = o.getAttribute(j.ea);
4
+ const r = o.getAttribute(x.ea);
5
5
  null != r && removeSubscription(r),
6
6
  o && o.parentNode && o.parentNode.removeChild(o);
7
7
  }
@@ -1,18 +1,18 @@
1
- import { logger as E } from "../../shared-lib/index.js";
2
- import { BannerStrings as j } from "./constants.js";
1
+ import { logger as b } from "../../shared-lib/index.js";
2
+ import { BannerStrings as x } from "./constants.js";
3
3
  import r from "../managers/braze-instance.js";
4
4
  import i from "./banner-provider-factory.js";
5
- import { getBannerIfNotExpired as C } from "./get-banner.js";
5
+ import { getBannerIfNotExpired as A } from "./get-banner.js";
6
6
  export function getAllBanners() {
7
7
  if (!r.rr()) return;
8
8
  const n = {},
9
9
  o = r.l();
10
10
  if (
11
- (!1 === (null == o ? void 0 : o.Jt()) && E.error(j.aa),
12
- !(null == o ? void 0 : o.Jt()))
11
+ (!1 === (null == o ? void 0 : o.Ot()) && b.error(x.aa),
12
+ !(null == o ? void 0 : o.Ot()))
13
13
  )
14
14
  return n;
15
15
  const t = i.o().k();
16
- for (const r in t) n[r] = C(t, r);
16
+ for (const r in t) n[r] = A(t, r);
17
17
  return n;
18
18
  }
@@ -1,22 +1,22 @@
1
- import { logger as E } from "../../shared-lib/index.js";
2
- import { BannerStrings as j } from "./constants.js";
1
+ import { logger as b } from "../../shared-lib/index.js";
2
+ import { BannerStrings as x } from "./constants.js";
3
3
  import r from "../managers/braze-instance.js";
4
4
  import i from "./banner-provider-factory.js";
5
5
  export function getBannerIfNotExpired(n, r) {
6
6
  const e = n[r];
7
7
  if (!e) return null;
8
- const t = e.Yt,
8
+ const t = e.ts,
9
9
  o = new Date().valueOf();
10
10
  return -1 !== t && 1e3 * t < o
11
- ? (E.info(`Banner with ID: ${e.id} and placement ID: ${r} has expired.`),
11
+ ? (b.info(`Banner with ID: ${e.id} and placement ID: ${r} has expired.`),
12
12
  null)
13
13
  : e;
14
14
  }
15
15
  export function getBanner(n) {
16
16
  var e;
17
17
  if (!r.rr()) return;
18
- !1 === (null === (e = r.l()) || void 0 === e ? void 0 : e.Jt()) &&
19
- E.error(j.aa);
18
+ !1 === (null === (e = r.l()) || void 0 === e ? void 0 : e.Ot()) &&
19
+ b.error(x.aa);
20
20
  const t = i.o();
21
21
  if (!t.P()) return null;
22
22
  return getBannerIfNotExpired(t.k(), n);
@@ -6,3 +6,4 @@ export { getAllBanners } from "./get-all-banners.js";
6
6
  export { subscribeToBannersUpdates } from "./subscribe-to-banners-updates.js";
7
7
  export { logBannerImpressions } from "./log-banner-impressions.js";
8
8
  export { logBannerClick } from "./log-banner-click.js";
9
+ export { dismissBanner } from "./dismiss-banner.js";
@@ -1,21 +1,21 @@
1
1
  import r from "../managers/braze-instance.js";
2
2
  import Banner from "./banner.js";
3
- import { logger as E } from "../../shared-lib/index.js";
3
+ import { logger as b } from "../../shared-lib/index.js";
4
4
  import i from "./banner-provider-factory.js";
5
- import { keys as D } from "../util/code-utils.js";
5
+ import { keys as C } from "../util/code-utils.js";
6
6
  export function logBannerClick(n, o) {
7
7
  if (!r.rr()) return;
8
8
  if (!(n instanceof Banner))
9
9
  return (
10
- E.error("Banner argument to logBannerClick must be an Banner object."), !1
10
+ b.error("Banner argument to logBannerClick must be an Banner object."), !1
11
11
  );
12
12
  const e = i.o(),
13
13
  t = e.k();
14
- return 0 === D(t).length
15
- ? (E.info("Not logging banner click. No banners exist."), !1)
14
+ return 0 === C(t).length
15
+ ? (b.info("Not logging banner click. No banners exist."), !1)
16
16
  : t[n.placementId]
17
- ? e.jt(n, o)
18
- : (E.info(
17
+ ? e.Ct(n, o)
18
+ : (b.info(
19
19
  `Not logging banner click for ID ${n.placementId}. The placement ID did not correspond to any banner.`,
20
20
  ),
21
21
  !1);
@@ -1,22 +1,22 @@
1
1
  import r from "../managers/braze-instance.js";
2
2
  import Banner from "./banner.js";
3
- import { logger as E } from "../../shared-lib/index.js";
3
+ import { logger as b } from "../../shared-lib/index.js";
4
4
  import i from "./banner-provider-factory.js";
5
- import { keys as D } from "../util/code-utils.js";
5
+ import { keys as C } from "../util/code-utils.js";
6
6
  export function logBannerDismissal(n) {
7
7
  if (!r.rr()) return;
8
8
  if (!(n instanceof Banner))
9
9
  return (
10
- E.error("Banner argument to logBannerDismissal must be a Banner object."),
10
+ b.error("Banner argument to logBannerDismissal must be a Banner object."),
11
11
  !1
12
12
  );
13
13
  const o = i.o(),
14
14
  e = o.k();
15
- return 0 === D(e).length
16
- ? (E.info("Not logging banner dismissal. No banners exist."), !1)
15
+ return 0 === C(e).length
16
+ ? (b.info("Not logging banner dismissal. No banners exist."), !1)
17
17
  : e[n.placementId]
18
- ? o.Nt(n)
19
- : (E.info(
18
+ ? o.wt(n)
19
+ : (b.info(
20
20
  `Not logging banner dismissal for ID ${n.placementId}. The placement ID did not correspond to any banner.`,
21
21
  ),
22
22
  !1);