@braze/web-sdk 6.7.1 → 6.9.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 (138) hide show
  1. package/index.d.ts +165 -38
  2. package/package.json +1 -1
  3. package/shared-lib/encoding-utils.js +2 -2
  4. package/shared-lib/event-types.js +16 -16
  5. package/shared-lib/indexed-db-adapter.js +65 -65
  6. package/shared-lib/logger.js +18 -18
  7. package/shared-lib/supported-options.js +1 -1
  8. package/src/Banner/banner-provider.js +67 -59
  9. package/src/Banner/banner.js +40 -19
  10. package/src/Banner/dismiss-banner.js +4 -0
  11. package/src/Banner/display/banner-to-html.js +10 -10
  12. package/src/Banner/display/destroy-banner-html.js +2 -2
  13. package/src/Banner/get-all-banners.js +6 -6
  14. package/src/Banner/get-banner.js +6 -6
  15. package/src/Banner/index.js +1 -0
  16. package/src/Banner/log-banner-click.js +7 -7
  17. package/src/Banner/log-banner-dismissal.js +7 -7
  18. package/src/Banner/log-banner-impressions.js +27 -18
  19. package/src/Banner/request-banners-refresh.js +8 -8
  20. package/src/Banner/subscribe-to-banners-updates.js +5 -5
  21. package/src/Banner/ui/insert-banner.js +8 -8
  22. package/src/Card/card-manager.js +31 -31
  23. package/src/Card/log-card-dismissal.js +2 -2
  24. package/src/Card/log-content-card-click.js +2 -2
  25. package/src/Card/log-content-card-impressions.js +4 -4
  26. package/src/Card/models/captioned-image.js +15 -15
  27. package/src/Card/models/card.js +89 -89
  28. package/src/Card/models/classic-card.js +16 -16
  29. package/src/Card/models/control-card.js +7 -7
  30. package/src/Card/models/image-only.js +13 -13
  31. package/src/Card/util/card-factory.js +32 -32
  32. package/src/ContentCards/content-cards-provider-factory.js +13 -11
  33. package/src/ContentCards/content-cards-provider.js +105 -105
  34. package/src/ContentCards/get-cached-content-cards.js +2 -2
  35. package/src/ContentCards/request-content-cards-refresh.js +2 -2
  36. package/src/ContentCards/subscribe-to-content-cards-updates.js +10 -10
  37. package/src/ContentCards/ui/show-content-cards.js +7 -7
  38. package/src/Core/add-sdk-metadata.js +2 -2
  39. package/src/Core/change-user.js +5 -5
  40. package/src/Core/destroy.js +2 -2
  41. package/src/Core/disable-sdk.js +4 -4
  42. package/src/Core/enable-sdk.js +4 -4
  43. package/src/Core/get-device-id.js +2 -2
  44. package/src/Core/handle-braze-action.js +5 -5
  45. package/src/Core/index.js +1 -0
  46. package/src/Core/log-custom-event.js +5 -5
  47. package/src/Core/log-ecommerce-event.js +29 -0
  48. package/src/Core/log-purchase.js +23 -198
  49. package/src/Core/open-session.js +10 -10
  50. package/src/Core/set-logger.js +2 -2
  51. package/src/Core/set-sdk-authentication-signature.js +1 -1
  52. package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -1
  53. package/src/Core/toggle-logging.js +2 -2
  54. package/src/Core/wipe-data.js +6 -6
  55. package/src/DUST/dust-connection-core.js +1 -0
  56. package/src/DUST/dust-provider-factory.js +10 -10
  57. package/src/DUST/dust-provider.js +258 -226
  58. package/src/DUST/dust-shared-worker-code.js +1 -1
  59. package/src/DUST/dust-shared-worker-impl.js +97 -103
  60. package/src/DUST/dust-worker-bridge.js +55 -40
  61. package/src/DUST/subscribe-to-dust.js +7 -7
  62. package/src/FeatureFlags/feature-flag-factory.js +8 -8
  63. package/src/FeatureFlags/feature-flag.js +3 -3
  64. package/src/FeatureFlags/feature-flags-provider.js +21 -21
  65. package/src/FeatureFlags/log-feature-flag-impression.js +5 -5
  66. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
  67. package/src/InAppMessage/constants.js +3 -3
  68. package/src/InAppMessage/defer-in-app-message.js +3 -3
  69. package/src/InAppMessage/display/html-message-to-html.js +4 -4
  70. package/src/InAppMessage/display/in-app-message-to-html.js +32 -32
  71. package/src/InAppMessage/display/modal-utils.js +2 -2
  72. package/src/InAppMessage/in-app-message-factory.js +36 -36
  73. package/src/InAppMessage/in-app-message-manager.js +35 -35
  74. package/src/InAppMessage/log-in-app-message-button-click.js +3 -3
  75. package/src/InAppMessage/log-in-app-message-click.js +3 -3
  76. package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
  77. package/src/InAppMessage/log-in-app-message-impression.js +3 -3
  78. package/src/InAppMessage/models/control-message.js +4 -4
  79. package/src/InAppMessage/models/full-screen-message.js +9 -9
  80. package/src/InAppMessage/models/html-message.js +2 -2
  81. package/src/InAppMessage/models/in-app-message-button.js +4 -4
  82. package/src/InAppMessage/models/in-app-message.js +34 -34
  83. package/src/InAppMessage/models/modal-message.js +7 -7
  84. package/src/InAppMessage/models/slide-up-message.js +8 -8
  85. package/src/InAppMessage/ui/show-in-app-message.js +20 -20
  86. package/src/Push/push-manager.js +44 -44
  87. package/src/User/user-manager.js +19 -19
  88. package/src/User/user.js +17 -17
  89. package/src/common/base-provider.js +1 -1
  90. package/src/common/constants.js +1 -0
  91. package/src/common/content-cards-display.js +6 -6
  92. package/src/common/event-logger.js +3 -3
  93. package/src/common/properties-base.js +3 -3
  94. package/src/l10n/l10n-manager.js +2 -2
  95. package/src/managers/auth-manager.js +11 -11
  96. package/src/managers/braze-instance.js +59 -59
  97. package/src/managers/device-manager.js +9 -9
  98. package/src/managers/network-manager.js +65 -63
  99. package/src/managers/server-config-manager.js +110 -93
  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 +137 -137
  103. package/src/managers/subscription-manager.js +2 -2
  104. package/src/managers/utils.js +1 -1
  105. package/src/models/braze-event.js +2 -2
  106. package/src/models/identifier.js +5 -5
  107. package/src/models/push-token.js +8 -8
  108. package/src/models/request-result.js +1 -1
  109. package/src/models/server-config.js +46 -28
  110. package/src/request-controller.js +124 -124
  111. package/src/triggers/models/custom-event-data.js +4 -4
  112. package/src/triggers/models/custom-event-property-data.js +5 -5
  113. package/src/triggers/models/filter-set.js +2 -2
  114. package/src/triggers/models/filter.js +1 -1
  115. package/src/triggers/models/in-app-message-click-data.js +5 -5
  116. package/src/triggers/models/purchase-data.js +1 -1
  117. package/src/triggers/models/purchase-property-data.js +2 -2
  118. package/src/triggers/models/push-click-data.js +5 -5
  119. package/src/triggers/models/trigger-condition.js +45 -45
  120. package/src/triggers/models/trigger-events.js +3 -3
  121. package/src/triggers/models/trigger.js +30 -30
  122. package/src/triggers/triggers-provider.js +63 -63
  123. package/src/types.js +5 -1
  124. package/src/ui/js/attach-css.js +1 -1
  125. package/src/util/braze-actions.js +6 -6
  126. package/src/util/browser-detector.js +13 -13
  127. package/src/util/client-hints-parser.js +5 -5
  128. package/src/util/code-utils.js +2 -2
  129. package/src/util/deprecation-utils.js +2 -2
  130. package/src/util/dom-utils.js +8 -8
  131. package/src/util/ecommerce-event-validation.js +343 -0
  132. package/src/util/html-display-utils.js +11 -11
  133. package/src/util/iso-4217-currency-codes.js +176 -0
  134. package/src/util/net.js +4 -4
  135. package/src/util/request-header-utils.js +10 -10
  136. package/src/util/string-utils.js +2 -2
  137. package/src/util/user-agent-parser.js +15 -15
  138. package/src/util/validation-utils.js +14 -14
@@ -1,21 +1,21 @@
1
1
  export default class et {
2
2
  constructor(t, e) {
3
3
  (this.database = t),
4
- (this.vd = e),
4
+ (this.Ud = e),
5
5
  (this.parent = "undefined" == typeof window ? self : window),
6
6
  (this.database = t),
7
- (this.vd = e);
7
+ (this.Ud = e);
8
8
  }
9
- Dd() {
9
+ Od() {
10
10
  if ("indexedDB" in this.parent) return this.parent.indexedDB;
11
11
  }
12
12
  isSupported() {
13
13
  var t;
14
14
  try {
15
- if (null == this.Dd()) return !1;
15
+ if (null == this.Od()) return !1;
16
16
  {
17
17
  const e =
18
- null === (t = this.Dd()) || void 0 === t
18
+ null === (t = this.Od()) || void 0 === t
19
19
  ? void 0
20
20
  : t.open("Braze IndexedDB Support Test");
21
21
  if (
@@ -25,10 +25,10 @@ export default class et {
25
25
  "undefined" != typeof window)
26
26
  ) {
27
27
  const t = window,
28
- e = t.chrome || t.browser || t.Bd;
28
+ e = t.chrome || t.browser || t.kd;
29
29
  if (e && e.runtime && e.runtime.id)
30
30
  return (
31
- this.vd.info(
31
+ this.Ud.info(
32
32
  "Not using IndexedDB for storage because we are running inside an extension",
33
33
  ),
34
34
  !1
@@ -38,37 +38,37 @@ export default class et {
38
38
  }
39
39
  } catch (t) {
40
40
  return (
41
- this.vd.info(
41
+ this.Ud.info(
42
42
  "Not using IndexedDB for storage due to following error: " + t,
43
43
  ),
44
44
  !1
45
45
  );
46
46
  }
47
47
  }
48
- Cd(t, e) {
48
+ Kd(t, e) {
49
49
  var n;
50
50
  const o =
51
- null === (n = this.Dd()) || void 0 === n
51
+ null === (n = this.Od()) || void 0 === n
52
52
  ? void 0
53
- : n.open(this.database.xd, this.database.VERSION);
53
+ : n.open(this.database.Gd, this.database.VERSION);
54
54
  if (null == o) return "function" == typeof e && e(), !1;
55
55
  const i = this;
56
56
  return (
57
57
  (o.onupgradeneeded = (t) => {
58
58
  var e;
59
- i.vd.info(
59
+ i.Ud.info(
60
60
  "Upgrading indexedDB " +
61
- i.database.xd +
61
+ i.database.Gd +
62
62
  " to v" +
63
63
  i.database.VERSION +
64
64
  "...",
65
65
  );
66
66
  const n = null === (e = t.target) || void 0 === e ? void 0 : e.result;
67
- for (const t in i.database.Os) {
67
+ for (const t in i.database.Ws) {
68
68
  const e = t;
69
- i.database.Os.hasOwnProperty(t) &&
70
- !n.objectStoreNames.contains(i.database.Os[e]) &&
71
- n.createObjectStore(i.database.Os[e]);
69
+ i.database.Ws.hasOwnProperty(t) &&
70
+ !n.objectStoreNames.contains(i.database.Ws[e]) &&
71
+ n.createObjectStore(i.database.Ws[e]);
72
72
  }
73
73
  }),
74
74
  (o.onsuccess = (n) => {
@@ -77,7 +77,7 @@ export default class et {
77
77
  (r.onversionchange = () => {
78
78
  r.close(),
79
79
  "function" == typeof e && e(),
80
- i.vd.error(
80
+ i.Ud.error(
81
81
  "Needed to close the database unexpectedly because of an upgrade in another tab",
82
82
  );
83
83
  }),
@@ -87,9 +87,9 @@ export default class et {
87
87
  var n;
88
88
  const o = t;
89
89
  return (
90
- i.vd.info(
90
+ i.Ud.info(
91
91
  "Could not open indexedDB " +
92
- i.database.xd +
92
+ i.database.Gd +
93
93
  " v" +
94
94
  i.database.VERSION +
95
95
  ": " +
@@ -105,16 +105,16 @@ export default class et {
105
105
  setItem(t, e, n, o, i) {
106
106
  if (!this.isSupported()) return "function" == typeof i && i(), !1;
107
107
  const r = this;
108
- return this.Cd((d) => {
108
+ return this.Kd((d) => {
109
109
  if (!d.objectStoreNames.contains(t))
110
110
  return (
111
- r.vd.error(
111
+ r.Ud.error(
112
112
  "Could not store object " +
113
113
  e +
114
114
  " in " +
115
115
  t +
116
116
  " on indexedDB " +
117
- r.database.xd +
117
+ r.database.Gd +
118
118
  " - " +
119
119
  t +
120
120
  " is not a valid objectStore",
@@ -126,13 +126,13 @@ export default class et {
126
126
  s.oncomplete = () => d.close();
127
127
  const u = s.objectStore(t).put(n, e);
128
128
  (u.onerror = () => {
129
- r.vd.error(
129
+ r.Ud.error(
130
130
  "Could not store object " +
131
131
  e +
132
132
  " in " +
133
133
  t +
134
134
  " on indexedDB " +
135
- r.database.xd,
135
+ r.database.Gd,
136
136
  ),
137
137
  "function" == typeof i && i();
138
138
  }),
@@ -144,16 +144,16 @@ export default class et {
144
144
  getItem(t, e, n) {
145
145
  if (!this.isSupported()) return !1;
146
146
  const o = this;
147
- return this.Cd((i) => {
147
+ return this.Kd((i) => {
148
148
  if (!i.objectStoreNames.contains(t))
149
149
  return (
150
- o.vd.error(
150
+ o.Ud.error(
151
151
  "Could not retrieve object " +
152
152
  e +
153
153
  " in " +
154
154
  t +
155
155
  " on indexedDB " +
156
- o.database.xd +
156
+ o.database.Gd +
157
157
  " - " +
158
158
  t +
159
159
  " is not a valid objectStore",
@@ -164,13 +164,13 @@ export default class et {
164
164
  r.oncomplete = () => i.close();
165
165
  const d = r.objectStore(t).get(e);
166
166
  (d.onerror = () => {
167
- o.vd.error(
167
+ o.Ud.error(
168
168
  "Could not retrieve object " +
169
169
  e +
170
170
  " in " +
171
171
  t +
172
172
  " on indexedDB " +
173
- o.database.xd,
173
+ o.database.Gd,
174
174
  );
175
175
  }),
176
176
  (d.onsuccess = (t) => {
@@ -183,14 +183,14 @@ export default class et {
183
183
  kr(t, e, n) {
184
184
  if (!this.isSupported()) return "function" == typeof n && n(), !1;
185
185
  const o = this;
186
- return this.Cd((i) => {
186
+ return this.Kd((i) => {
187
187
  if (!i.objectStoreNames.contains(t))
188
188
  return (
189
- o.vd.error(
189
+ o.Ud.error(
190
190
  "Could not retrieve last record from " +
191
191
  t +
192
192
  " on indexedDB " +
193
- o.database.xd +
193
+ o.database.Gd +
194
194
  " - " +
195
195
  t +
196
196
  " is not a valid objectStore",
@@ -202,8 +202,8 @@ export default class et {
202
202
  r.oncomplete = () => i.close();
203
203
  const d = r.objectStore(t).openCursor(null, "prev");
204
204
  (d.onerror = () => {
205
- o.vd.error(
206
- "Could not open cursor for " + t + " on indexedDB " + o.database.xd,
205
+ o.Ud.error(
206
+ "Could not open cursor for " + t + " on indexedDB " + o.database.Gd,
207
207
  ),
208
208
  "function" == typeof n && n();
209
209
  }),
@@ -219,16 +219,16 @@ export default class et {
219
219
  ge(t, e) {
220
220
  if (!this.isSupported()) return !1;
221
221
  const n = this;
222
- return this.Cd((o) => {
222
+ return this.Kd((o) => {
223
223
  if (!o.objectStoreNames.contains(t))
224
224
  return (
225
- n.vd.error(
225
+ n.Ud.error(
226
226
  "Could not delete record " +
227
227
  e +
228
228
  " from " +
229
229
  t +
230
230
  " on indexedDB " +
231
- n.database.xd +
231
+ n.database.Gd +
232
232
  " - " +
233
233
  t +
234
234
  " is not a valid objectStore",
@@ -238,28 +238,28 @@ export default class et {
238
238
  const i = o.transaction([t], "readwrite");
239
239
  i.oncomplete = () => o.close();
240
240
  i.objectStore(t).delete(e).onerror = () => {
241
- n.vd.error(
241
+ n.Ud.error(
242
242
  "Could not delete record " +
243
243
  e +
244
244
  " from " +
245
245
  t +
246
246
  " on indexedDB " +
247
- n.database.xd,
247
+ n.database.Gd,
248
248
  );
249
249
  };
250
250
  });
251
251
  }
252
- Xs(t, e) {
252
+ Qs(t, e) {
253
253
  if (!this.isSupported()) return !1;
254
254
  const n = this;
255
- return this.Cd((o) => {
255
+ return this.Kd((o) => {
256
256
  if (!o.objectStoreNames.contains(t))
257
257
  return (
258
- n.vd.error(
258
+ n.Ud.error(
259
259
  "Could not retrieve objects from " +
260
260
  t +
261
261
  " on indexedDB " +
262
- n.database.xd +
262
+ n.database.Gd +
263
263
  " - " +
264
264
  t +
265
265
  " is not a valid objectStore",
@@ -273,18 +273,18 @@ export default class et {
273
273
  s = [];
274
274
  (d.onerror = () => {
275
275
  s.length > 0
276
- ? (n.vd.info(
276
+ ? (n.Ud.info(
277
277
  "Cursor closed midway through for " +
278
278
  t +
279
279
  " on indexedDB " +
280
- n.database.xd,
280
+ n.database.Gd,
281
281
  ),
282
282
  e(s))
283
- : n.vd.error(
283
+ : n.Ud.error(
284
284
  "Could not open cursor for " +
285
285
  t +
286
286
  " on indexedDB " +
287
- n.database.xd,
287
+ n.database.Gd,
288
288
  );
289
289
  }),
290
290
  (d.onsuccess = (t) => {
@@ -304,47 +304,47 @@ export default class et {
304
304
  clearData() {
305
305
  if (!this.isSupported()) return !1;
306
306
  const t = [];
307
- for (const e in this.database.Os) {
307
+ for (const e in this.database.Ws) {
308
308
  const n = e;
309
- this.database.Os.hasOwnProperty(e) &&
310
- this.database.Os[n] !== this.database.Os.pe &&
311
- t.push(this.database.Os[n]);
309
+ this.database.Ws.hasOwnProperty(e) &&
310
+ this.database.Ws[n] !== this.database.Ws.pe &&
311
+ t.push(this.database.Ws[n]);
312
312
  }
313
313
  const e = this;
314
- return this.Cd(function (n) {
314
+ return this.Kd(function (n) {
315
315
  const o = n.transaction(t, "readwrite");
316
316
  o.oncomplete = () => n.close();
317
317
  for (let n = 0; n < t.length; n++) {
318
318
  const i = t[n];
319
319
  o.objectStore(i).clear().onerror = function () {
320
- e.vd.error(
320
+ e.Ud.error(
321
321
  "Could not clear " +
322
322
  this.source.name +
323
323
  " on indexedDB " +
324
- e.database.xd,
324
+ e.database.Gd,
325
325
  );
326
326
  };
327
327
  }
328
328
  o.onerror = function () {
329
- e.vd.error(
330
- "Could not clear object stores on indexedDB " + e.database.xd,
329
+ e.Ud.error(
330
+ "Could not clear object stores on indexedDB " + e.database.Gd,
331
331
  );
332
332
  };
333
333
  });
334
334
  }
335
335
  }
336
- et.Ps = {
337
- $s: {
338
- xd: "AppboyServiceWorkerAsyncStorage",
336
+ et._s = {
337
+ Xs: {
338
+ Gd: "AppboyServiceWorkerAsyncStorage",
339
339
  VERSION: 6,
340
- Os: {
340
+ Ws: {
341
341
  pn: "data",
342
- $r: "pushClicks",
342
+ yr: "pushClicks",
343
343
  Fu: "pushSubscribed",
344
- yd: "fallbackDevice",
345
- _s: "cardUpdates",
344
+ Hd: "fallbackDevice",
345
+ Vs: "cardUpdates",
346
346
  pe: "optOut",
347
- qr: "pendingData",
347
+ Br: "pendingData",
348
348
  wh: "sdkAuthenticationSignature",
349
349
  },
350
350
  be: 1,
@@ -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.7.1)";
28
- null != E.vd ? E.vd(o) : console.warn(o);
26
+ if (b.zg) {
27
+ const o = "Braze SDK Warning: " + n + " (v6.9.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.7.1)";
34
- null != E.vd ? E.vd(o) : console.error(o);
32
+ if (b.zg) {
33
+ const o = "Braze SDK Error: " + n + " (v6.9.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;
@@ -23,7 +23,7 @@ export default {
23
23
  Uh: "doNotLoadFontAwesome",
24
24
  Wh: "deviceId",
25
25
  ya: "serviceWorkerScope",
26
- Qe: "dustHost",
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
  }