@braze/web-sdk 6.4.0 → 6.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/README.md +1 -1
  2. package/index.d.ts +11 -5
  3. package/package.json +1 -1
  4. package/shared-lib/encoding-utils.js +3 -3
  5. package/shared-lib/event-types.js +30 -30
  6. package/shared-lib/guid.js +3 -3
  7. package/shared-lib/indexed-db-adapter.js +58 -58
  8. package/shared-lib/logger.js +7 -7
  9. package/shared-lib/supported-options.js +17 -16
  10. package/src/Banner/banner-provider.js +95 -81
  11. package/src/Banner/banner.js +9 -9
  12. package/src/Banner/constants.js +4 -0
  13. package/src/Banner/display/banner-to-html.js +1 -1
  14. package/src/Banner/display/destroy-banner-html.js +3 -3
  15. package/src/Banner/display/detect-banner-impressions.js +14 -14
  16. package/src/Banner/get-all-banners.js +4 -4
  17. package/src/Banner/get-banner.js +5 -4
  18. package/src/Banner/log-banner-click.js +2 -2
  19. package/src/Banner/log-banner-impressions.js +6 -6
  20. package/src/Banner/request-banners-refresh.js +18 -20
  21. package/src/Banner/subscribe-to-banners-updates.js +5 -5
  22. package/src/Banner/ui/insert-banner.js +17 -14
  23. package/src/Card/card-manager-factory.js +3 -3
  24. package/src/Card/card-manager.js +32 -32
  25. package/src/Card/constants.js +1 -0
  26. package/src/Card/display/card-display.js +11 -11
  27. package/src/Card/log-card-dismissal.js +2 -2
  28. package/src/Card/log-content-card-click.js +2 -2
  29. package/src/Card/log-content-card-impressions.js +5 -5
  30. package/src/Card/models/captioned-image.js +3 -3
  31. package/src/Card/models/card.js +16 -16
  32. package/src/Card/models/classic-card.js +3 -3
  33. package/src/Card/models/control-card.js +3 -3
  34. package/src/Card/models/image-only.js +3 -3
  35. package/src/Card/util/card-factory.js +6 -6
  36. package/src/ContentCards/content-cards-provider-factory.js +11 -11
  37. package/src/ContentCards/content-cards-provider.js +110 -96
  38. package/src/ContentCards/get-cached-content-cards.js +2 -2
  39. package/src/ContentCards/request-content-cards-refresh.js +2 -2
  40. package/src/ContentCards/subscribe-to-content-cards-updates.js +5 -5
  41. package/src/ContentCards/ui/show-content-cards.js +5 -5
  42. package/src/Core/add-sdk-metadata.js +2 -2
  43. package/src/Core/change-user.js +4 -4
  44. package/src/Core/disable-sdk.js +9 -8
  45. package/src/Core/enable-sdk.js +5 -5
  46. package/src/Core/get-device-id.js +2 -2
  47. package/src/Core/handle-braze-action.js +3 -3
  48. package/src/Core/is-disabled.js +1 -1
  49. package/src/Core/log-custom-event.js +13 -13
  50. package/src/Core/log-purchase.js +10 -10
  51. package/src/Core/open-session.js +7 -7
  52. package/src/Core/set-sdk-authentication-signature.js +2 -2
  53. package/src/Core/wipe-data.js +6 -6
  54. package/src/DUST/dust-connection-core.js +23 -0
  55. package/src/DUST/dust-provider-factory.js +10 -8
  56. package/src/DUST/dust-provider.js +408 -176
  57. package/src/DUST/dust-shared-worker-code.js +2 -0
  58. package/src/DUST/dust-shared-worker-impl.js +240 -0
  59. package/src/DUST/dust-worker-bridge.js +136 -0
  60. package/src/DUST/index.js +10 -0
  61. package/src/DUST/subscribe-to-dust.js +13 -13
  62. package/src/FeatureFlags/feature-flag-factory.js +8 -8
  63. package/src/FeatureFlags/feature-flag.js +6 -6
  64. package/src/FeatureFlags/feature-flags-provider-factory.js +9 -9
  65. package/src/FeatureFlags/feature-flags-provider.js +98 -84
  66. package/src/FeatureFlags/get-all-feature-flags.js +3 -3
  67. package/src/FeatureFlags/get-feature-flag.js +3 -3
  68. package/src/FeatureFlags/log-feature-flag-impression.js +7 -7
  69. package/src/FeatureFlags/refresh-feature-flags.js +2 -2
  70. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -4
  71. package/src/InAppMessage/constants.js +4 -0
  72. package/src/InAppMessage/defer-in-app-message.js +2 -2
  73. package/src/InAppMessage/display/get-animation-effect.js +1 -1
  74. package/src/InAppMessage/display/html-message-to-html.js +6 -6
  75. package/src/InAppMessage/display/in-app-message-to-html.js +40 -40
  76. package/src/InAppMessage/display/modal-utils.js +16 -16
  77. package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
  78. package/src/InAppMessage/in-app-message-factory.js +4 -4
  79. package/src/InAppMessage/in-app-message-manager-factory.js +7 -7
  80. package/src/InAppMessage/in-app-message-manager.js +97 -97
  81. package/src/InAppMessage/log-in-app-message-button-click.js +14 -14
  82. package/src/InAppMessage/log-in-app-message-click.js +13 -13
  83. package/src/InAppMessage/log-in-app-message-html-click.js +11 -11
  84. package/src/InAppMessage/log-in-app-message-impression.js +8 -8
  85. package/src/InAppMessage/models/control-message.js +5 -5
  86. package/src/InAppMessage/models/full-screen-message.js +18 -18
  87. package/src/InAppMessage/models/html-message.js +19 -19
  88. package/src/InAppMessage/models/in-app-message-button.js +7 -7
  89. package/src/InAppMessage/models/in-app-message.js +121 -119
  90. package/src/InAppMessage/models/modal-message.js +18 -18
  91. package/src/InAppMessage/models/slide-up-message.js +23 -23
  92. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  93. package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
  94. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +5 -5
  95. package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +8 -8
  96. package/src/InAppMessage/ui/show-in-app-message.js +34 -34
  97. package/src/Push/push-manager-factory.js +14 -14
  98. package/src/Push/push-manager.js +90 -90
  99. package/src/Push/request-push-permission.js +1 -1
  100. package/src/Push/unregister-push.js +1 -1
  101. package/src/Push/utils/push-utils.js +9 -9
  102. package/src/User/user-manager.js +32 -32
  103. package/src/User/user.js +71 -71
  104. package/src/common/constants.js +8 -11
  105. package/src/common/content-cards-display.js +32 -32
  106. package/src/common/event-logger.js +10 -10
  107. package/src/common/properties-base.js +16 -16
  108. package/src/l10n/l10n-manager-factory.js +11 -11
  109. package/src/l10n/l10n-manager.js +2 -2
  110. package/src/managers/auth-manager.js +14 -14
  111. package/src/managers/braze-instance.js +163 -159
  112. package/src/managers/device-manager.js +11 -11
  113. package/src/managers/network-manager.js +154 -154
  114. package/src/managers/server-config-manager.js +116 -88
  115. package/src/managers/session-manager.js +41 -41
  116. package/src/managers/storage-manager-factory.js +13 -13
  117. package/src/managers/storage-manager.js +130 -131
  118. package/src/managers/subscription-manager.js +12 -12
  119. package/src/managers/utils.js +1 -1
  120. package/src/models/backend-errors.js +5 -5
  121. package/src/models/braze-event.js +10 -10
  122. package/src/models/device.js +2 -2
  123. package/src/models/identifier.js +17 -17
  124. package/src/models/push-token.js +14 -14
  125. package/src/models/request-result.js +4 -4
  126. package/src/models/server-config.js +41 -37
  127. package/src/request-controller.js +163 -160
  128. package/src/triggers/models/custom-event-data.js +5 -5
  129. package/src/triggers/models/custom-event-property-data.js +6 -6
  130. package/src/triggers/models/filter-set.js +8 -8
  131. package/src/triggers/models/filter.js +7 -7
  132. package/src/triggers/models/in-app-message-click-data.js +13 -13
  133. package/src/triggers/models/purchase-data.js +2 -2
  134. package/src/triggers/models/purchase-property-data.js +6 -6
  135. package/src/triggers/models/push-click-data.js +6 -6
  136. package/src/triggers/models/trigger-condition.js +47 -47
  137. package/src/triggers/models/trigger-events.js +2 -2
  138. package/src/triggers/models/trigger.js +42 -42
  139. package/src/triggers/triggers-provider-factory.js +5 -5
  140. package/src/triggers/triggers-provider.js +66 -66
  141. package/src/ui/js/attach-css.js +3 -3
  142. package/src/ui/js/load-font-awesome.js +2 -2
  143. package/src/util/base-device-parser.js +8 -8
  144. package/src/util/braze-actions.js +5 -5
  145. package/src/util/browser-detector.js +33 -33
  146. package/src/util/client-hints-parser.js +10 -10
  147. package/src/util/component-utils.js +5 -5
  148. package/src/util/dom-utils.js +13 -13
  149. package/src/util/html-display-utils.js +7 -7
  150. package/src/util/key-codes.js +1 -1
  151. package/src/util/net.js +6 -6
  152. package/src/util/request-header-utils.js +26 -26
  153. package/src/util/user-agent-parser.js +20 -20
  154. package/src/util/validation-utils.js +16 -16
  155. package/src/util/window-utils.js +3 -3
@@ -5,28 +5,33 @@ import {
5
5
  newBannerFromSerializedValue as o,
6
6
  } from "./banner-factory.js";
7
7
  import h from "../util/request-header-utils.js";
8
- import a from "../util/net.js";
9
- import { randomInclusive as l } from "../util/math.js";
10
- import u from "../managers/subscription-manager.js";
8
+ import l from "../util/net.js";
9
+ import { randomInclusive as a } from "../util/math.js";
10
+ import {
11
+ REQUEST_BACKOFF_MAX_SLEEP_MS_DEFAULT as u,
12
+ REQUEST_BACKOFF_MIN_SLEEP_MS_DEFAULT as c,
13
+ REQUEST_BACKOFF_SCALE_FACTOR_DEFAULT as d,
14
+ } from "../common/constants.js";
15
+ import m from "../managers/subscription-manager.js";
11
16
  import r from "../managers/braze-instance.js";
12
- import c from "../common/event-logger.js";
13
- import { EventTypes as m } from "../../shared-lib/event-types.js";
17
+ import v from "../common/event-logger.js";
18
+ import { EventTypes as f } from "../../shared-lib/event-types.js";
14
19
  export default class e extends t {
15
- constructor(t, s, i, e) {
20
+ constructor(t, s, i, n) {
16
21
  super(),
17
22
  (this.h = t),
18
- (this.B = s),
19
- (this.j = i),
20
- (this.C = e),
23
+ (this.j = s),
24
+ (this.B = i),
25
+ (this.C = n),
21
26
  (this.banners = {}),
22
27
  (this.h = t),
23
- (this.B = s),
24
- (this.j = i),
25
- (this.C = e),
28
+ (this.j = s),
29
+ (this.B = i),
30
+ (this.C = n),
26
31
  (this.S = 10),
27
32
  (this.T = null),
28
33
  (this.I = null),
29
- (this.R = new u()),
34
+ (this.R = new m()),
30
35
  r.q(this.R),
31
36
  (this.D = null),
32
37
  (this.F = null);
@@ -44,63 +49,72 @@ export default class e extends t {
44
49
  this.U(), this.R.L(this.banners);
45
50
  }
46
51
  }
47
- M(t, s, i, e = !0) {
48
- var n;
52
+ M(t, s, i, n = !0) {
53
+ var e;
49
54
  const r = () => {
50
55
  "function" == typeof i && i();
51
56
  };
52
57
  if (!this.k())
53
58
  return void (
54
- null === (n = this.h) ||
55
- void 0 === n ||
56
- n.P(() => {
59
+ null === (e = this.h) ||
60
+ void 0 === e ||
61
+ e.P(() => {
57
62
  this.M(t, s, i);
58
63
  })
59
64
  );
60
- const o = this.B;
65
+ const o = this.j;
61
66
  if (!o) return void r();
62
- e && this.X();
63
- const u = o.$({}, !0),
64
- c = [];
65
- for (const s of t) c.push({ id: s });
66
- u.placements = c;
67
- const m = o.A(u, h.H.G);
68
- let d = !1;
67
+ n && this.X();
68
+ const m = o.$({}, !0),
69
+ v = [];
70
+ for (const s of t) v.push({ id: s });
71
+ m.placements = v;
72
+ const f = o.A(m, h.H.G);
73
+ let p = !1;
69
74
  o.J(
70
- u,
71
- (e = -1) => {
72
- const n = this.B;
73
- if (!n) return void r();
75
+ m,
76
+ (n = -1) => {
77
+ const e = this.j;
78
+ if (!e) return void r();
74
79
  const o = new Date().valueOf();
75
- h.K(this.j, h.H.G, o),
76
- -1 !== e && m.push(["X-Braze-Req-Tokens-Remaining", e.toString()]),
77
- a.O({
78
- url: `${n.V()}/banners/sync`,
79
- headers: m,
80
- data: u,
80
+ h.K(this.B, h.H.G, o),
81
+ -1 !== n && f.push(["X-Braze-Req-Tokens-Remaining", n.toString()]),
82
+ l.O({
83
+ url: `${e.V()}/banners/sync`,
84
+ headers: f,
85
+ data: m,
81
86
  W: (t) => {
82
- if (!n.Y(u, t, m)) return (d = !0), void r();
83
- n.Z(), this.N(t), (d = !1), "function" == typeof s && s();
87
+ if (!e.Y(m, t, f)) return (p = !0), void r();
88
+ e.Z(), this.N(t), (p = !1), "function" == typeof s && s();
84
89
  },
85
90
  error: (t) => {
86
- n._(t, "retrieving banners"), (d = !0), r();
91
+ e._(t, "retrieving banners"), (p = !0), r();
87
92
  },
88
- tt: (e, r) => {
89
- let o;
90
- if (((this.F = t), d)) {
91
- let t = this.T;
92
- (null == t || t < 1e3 * this.S) && (t = 1e3 * this.S),
93
- (o = Math.min(3e5, l(1e3 * this.S, 3 * t)));
93
+ tt: (n, r) => {
94
+ var o, l, m;
95
+ let v;
96
+ if (((this.F = t), p)) {
97
+ const t =
98
+ (null === (o = this.h) || void 0 === o ? void 0 : o.st()) ||
99
+ c,
100
+ s =
101
+ (null === (l = this.h) || void 0 === l ? void 0 : l.it()) ||
102
+ d,
103
+ i =
104
+ (null === (m = this.h) || void 0 === m ? void 0 : m.nt()) ||
105
+ u;
106
+ let n = this.T;
107
+ (null == n || n < t) && (n = t), (v = Math.min(i, a(t, n * s)));
94
108
  }
95
- n.st(
109
+ e.et(
96
110
  r,
97
111
  () => {
98
112
  this.M(t, s, i, !1);
99
113
  },
100
114
  h.H.G,
101
- (t) => this.it(t),
115
+ (t) => this.rt(t),
102
116
  () => this.X(),
103
- o,
117
+ v,
104
118
  );
105
119
  },
106
120
  });
@@ -109,90 +123,90 @@ export default class e extends t {
109
123
  i,
110
124
  );
111
125
  }
112
- et() {
126
+ ot() {
113
127
  return this.F;
114
128
  }
115
- nt(t, s) {
129
+ ht(t, s) {
116
130
  const i = { id: t.id };
117
131
  s && (i.bid = s);
118
- return c.rt(m.ot, i).W;
132
+ return v.lt(f.ut, i).W;
119
133
  }
120
134
  X() {
121
135
  null != this.I && (clearTimeout(this.I), (this.I = null));
122
136
  }
123
- it(t) {
137
+ rt(t) {
124
138
  this.X(), (this.I = t);
125
139
  }
126
- ht() {
140
+ ct() {
127
141
  let t = {};
128
- this.j && (t = this.j.lt(s.ct.ut));
142
+ this.B && (t = this.B.dt(s.ft.vt));
129
143
  const i = {};
130
144
  for (const s in t) {
131
- let e = null;
132
- null != t[s] && (e = o(t[s])), e && (i[e.placementId] = e);
145
+ let n = null;
146
+ null != t[s] && (n = o(t[s])), n && (i[n.placementId] = n);
133
147
  }
134
148
  return i;
135
149
  }
136
150
  U() {
137
151
  var t;
138
- if (!this.j) return;
152
+ if (!this.B) return;
139
153
  const i = {};
140
154
  for (const s in this.banners) {
141
- const e =
142
- (null === (t = this.banners[s]) || void 0 === t ? void 0 : t.dt()) ||
155
+ const n =
156
+ (null === (t = this.banners[s]) || void 0 === t ? void 0 : t.gt()) ||
143
157
  null;
144
- i[s] = e;
158
+ i[s] = n;
145
159
  }
146
- this.j.ft(s.ct.ut, i), this.vt();
160
+ this.B.bt(s.ft.vt, i), this.jt();
147
161
  }
148
- vt() {
162
+ jt() {
149
163
  var t, i;
150
- null === (t = this.j) ||
164
+ null === (t = this.B) ||
151
165
  void 0 === t ||
152
- t.ft(s.ct.gt, null === (i = this.C) || void 0 === i ? void 0 : i.bt());
166
+ t.bt(s.ft.Bt, null === (i = this.C) || void 0 === i ? void 0 : i.yt());
153
167
  }
154
- Bt() {
168
+ Ct() {
155
169
  var t;
156
170
  return (
157
- (null === (t = this.j) || void 0 === t ? void 0 : t.lt(s.ct.gt)) || null
171
+ (null === (t = this.B) || void 0 === t ? void 0 : t.dt(s.ft.Bt)) || null
158
172
  );
159
173
  }
160
- jt() {
174
+ St() {
161
175
  return this.D;
162
176
  }
163
- yt(t) {
177
+ wt(t) {
164
178
  this.D = t;
165
179
  }
166
- Ct() {
180
+ Tt() {
167
181
  var t;
168
- const s = null === (t = this.C) || void 0 === t ? void 0 : t.bt(),
169
- i = this.Bt();
182
+ const s = null === (t = this.C) || void 0 === t ? void 0 : t.yt(),
183
+ i = this.Ct();
170
184
  return null == i || s === i;
171
185
  }
172
- St(t) {
173
- return this.R.wt(t);
186
+ It(t) {
187
+ return this.R.Rt(t);
174
188
  }
175
- Tt() {
189
+ qt() {
176
190
  var t;
177
191
  return (
178
- (null === (t = this.j) || void 0 === t ? void 0 : t.lt(s.ct.It)) || {}
192
+ (null === (t = this.B) || void 0 === t ? void 0 : t.dt(s.ft.Dt)) || {}
179
193
  );
180
194
  }
181
- Rt(t) {
182
- this.j && this.j.ft(s.ct.It, t);
195
+ Ft(t) {
196
+ this.B && this.B.bt(s.ft.Dt, t);
183
197
  }
184
198
  changeUser() {
185
- this.qt(), this.X();
199
+ this.Nt(), this.X();
186
200
  }
187
201
  clearData() {
188
202
  this.X();
189
203
  }
190
204
  k() {
191
- return !!this.h && (!!this.h.Dt() || (0 !== this.h.Ft() && this.qt(), !1));
205
+ return !!this.h && (!!this.h.kt() || (0 !== this.h.xt() && this.Nt(), !1));
192
206
  }
193
- qt() {
207
+ Nt() {
194
208
  (this.banners = {}),
195
- this.j && (this.j.Nt(s.ct.ut), this.j.Nt(s.ct.It)),
209
+ this.B && (this.B.zt(s.ft.vt), this.B.zt(s.ft.Dt)),
196
210
  this.R.L({});
197
211
  }
198
212
  }
@@ -5,28 +5,28 @@ export default class Banner extends p {
5
5
  (this.id = t),
6
6
  (this.placementId = s),
7
7
  (this.html = i),
8
- (this.xt = h),
8
+ (this.At = h),
9
9
  (this.isControl = r),
10
- (this.zt = e),
10
+ (this.Et = e),
11
11
  (this.id = t),
12
12
  (this.placementId = s),
13
13
  (this.html = i),
14
- (this.xt = h),
14
+ (this.At = h),
15
15
  (this.isControl = r),
16
- (this.zt = e),
17
- (this.kt = !1);
16
+ (this.Et = e),
17
+ (this.Gt = !1);
18
18
  }
19
- At() {
19
+ Ht() {
20
20
  return this.isControl;
21
21
  }
22
- dt() {
22
+ gt() {
23
23
  return {
24
24
  id: this.id,
25
25
  pid: this.placementId,
26
26
  html: this.html,
27
- its: this.xt,
27
+ its: this.At,
28
28
  ic: this.isControl,
29
- eat: this.zt,
29
+ eat: this.Et,
30
30
  pr: this.properties,
31
31
  };
32
32
  }
@@ -0,0 +1,4 @@
1
+ export const BannerStrings = {
2
+ aa: "Banners are disabled. Make sure you have at least one campaign and relaunch the app.",
3
+ ea: "data-update-subscription-id",
4
+ };
@@ -17,7 +17,7 @@ export function controlBannerToHtml(n) {
17
17
  );
18
18
  }
19
19
  export function bannerToHtml(n, t) {
20
- if (n.At()) return controlBannerToHtml(n);
20
+ if (n.Ht()) return controlBannerToHtml(n);
21
21
  const e = document.createElement("iframe");
22
22
  return (
23
23
  (e.id = n.id),
@@ -1,7 +1,7 @@
1
1
  import { removeSubscription } from "../../Core/remove-subscription.js";
2
- import { SUBSCRIPTION_ID_DATA_ATTRIBUTE as f } from "../../common/constants.js";
2
+ import { BannerStrings as j } from "../constants.js";
3
3
  export function destroyBannerHtml(o) {
4
- const n = o.getAttribute(f);
5
- null != n && removeSubscription(n),
4
+ const r = o.getAttribute(j.ea);
5
+ null != r && removeSubscription(r),
6
6
  o && o.parentNode && o.parentNode.removeChild(o);
7
7
  }
@@ -1,28 +1,28 @@
1
1
  import {
2
- impressOnBottom as d,
3
- impressOnTop as j,
4
- detectImpression as $,
2
+ impressOnBottom as $,
3
+ impressOnTop as g,
4
+ detectImpression as x,
5
5
  } from "../../common/detect-impression.js";
6
- import { topIsInView as g, bottomIsInView as x } from "../../util/dom-utils.js";
6
+ import { topIsInView as B, bottomIsInView as I } from "../../util/dom-utils.js";
7
7
  import { logBannerImpressions } from "../log-banner-impressions.js";
8
8
  import {
9
- BANNER_HTML_CLASS as B,
10
- BANNER_PLACEMENT_ID as I,
11
- CONTROL_BANNER_HTML_CLASS as k,
9
+ BANNER_HTML_CLASS as k,
10
+ BANNER_PLACEMENT_ID as q,
11
+ CONTROL_BANNER_HTML_CLASS as w,
12
12
  } from "./banner-to-html.js";
13
13
  export function detectBannerImpressions() {
14
- const o = document.querySelectorAll(`.${B}, .${k}`),
14
+ const o = document.querySelectorAll(`.${k}, .${w}`),
15
15
  t = [];
16
16
  for (let n = 0; n < o.length; n++) {
17
17
  const s = o[n],
18
- i = s.getAttribute(I);
18
+ i = s.getAttribute(q);
19
19
  if (!i) continue;
20
- const m = $.oo(s),
21
- r = $.no(s);
20
+ const m = x.oo(s),
21
+ r = x.no(s);
22
22
  if (m && r) continue;
23
- const e = g(s),
24
- c = x(s);
25
- e && !m && j(s), c && !r && d(s), $.oo(s) && $.no(s) && t.push(i);
23
+ const e = B(s),
24
+ c = I(s);
25
+ e && !m && g(s), c && !r && $(s), x.oo(s) && x.no(s) && t.push(i);
26
26
  }
27
27
  t.length > 0 && logBannerImpressions(t);
28
28
  }
@@ -1,5 +1,5 @@
1
1
  import { logger as E } from "../../shared-lib/index.js";
2
- import { BANNERS_DISABLED_MESSAGE as v } from "../common/constants.js";
2
+ import { BannerStrings as j } from "./constants.js";
3
3
  import r from "../managers/braze-instance.js";
4
4
  import i from "./banner-provider-factory.js";
5
5
  import { getBannerIfNotExpired as y } from "./get-banner.js";
@@ -8,11 +8,11 @@ export function getAllBanners() {
8
8
  const n = {},
9
9
  o = r.l();
10
10
  if (
11
- (!1 === (null == o ? void 0 : o.Dt()) && E.error(v),
12
- !(null == o ? void 0 : o.Dt()))
11
+ (!1 === (null == o ? void 0 : o.kt()) && E.error(j.aa),
12
+ !(null == o ? void 0 : o.kt()))
13
13
  )
14
14
  return n;
15
- const t = i.o().ht();
15
+ const t = i.o().ct();
16
16
  for (const r in t) n[r] = y(t, r);
17
17
  return n;
18
18
  }
@@ -1,11 +1,11 @@
1
1
  import { logger as E } from "../../shared-lib/index.js";
2
- import { BANNERS_DISABLED_MESSAGE as v } from "../common/constants.js";
2
+ import { BannerStrings as j } 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.zt,
8
+ const t = e.Et,
9
9
  o = new Date().valueOf();
10
10
  return -1 !== t && 1e3 * t < o
11
11
  ? (E.info(`Banner with ID: ${e.id} and placement ID: ${r} has expired.`),
@@ -15,8 +15,9 @@ export function getBannerIfNotExpired(n, r) {
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.Dt()) && E.error(v);
18
+ !1 === (null === (e = r.l()) || void 0 === e ? void 0 : e.kt()) &&
19
+ E.error(j.aa);
19
20
  const t = i.o();
20
21
  if (!t.k()) return null;
21
- return getBannerIfNotExpired(t.ht(), n);
22
+ return getBannerIfNotExpired(t.ct(), n);
22
23
  }
@@ -10,11 +10,11 @@ export function logBannerClick(n, o) {
10
10
  E.error("Banner argument to logBannerClick must be an Banner object."), !1
11
11
  );
12
12
  const e = i.o(),
13
- t = e.ht();
13
+ t = e.ct();
14
14
  return 0 === C(t).length
15
15
  ? (E.info("Not logging banner click. No banners exist."), !1)
16
16
  : t[n.placementId]
17
- ? e.nt(n, o)
17
+ ? e.ht(n, o)
18
18
  : (E.info(
19
19
  `Not logging banner click for ID ${n.placementId}. The placement ID did not correspond to any banner.`,
20
20
  ),
@@ -1,5 +1,5 @@
1
- import { logger as E, EventTypes as m } from "../../shared-lib/index.js";
2
- import c from "../common/event-logger.js";
1
+ import { logger as E, EventTypes as f } from "../../shared-lib/index.js";
2
+ import v from "../common/event-logger.js";
3
3
  import r from "../managers/braze-instance.js";
4
4
  import { keys as C } from "../util/code-utils.js";
5
5
  import i from "./banner-provider-factory.js";
@@ -7,10 +7,10 @@ export function logBannerImpressions(o) {
7
7
  if (!r.rr()) return;
8
8
  if (!o || o.length <= 0) return !1;
9
9
  const n = i.o(),
10
- s = n.ht();
10
+ s = n.ct();
11
11
  if (0 === C(s).length)
12
12
  return E.info("Not logging banners impression. No banners exist."), !1;
13
- const e = n.Tt(),
13
+ const e = n.qt(),
14
14
  t = [];
15
15
  for (const r of o) {
16
16
  const o = s[r];
@@ -25,7 +25,7 @@ export function logBannerImpressions(o) {
25
25
  );
26
26
  }
27
27
  if (0 === t.length) return !1;
28
- n.Rt(e);
28
+ n.Ft(e);
29
29
  const a = { ids: t };
30
- return c.rt(m.ro, a).W;
30
+ return v.lt(f.ro, a).W;
31
31
  }
@@ -1,28 +1,26 @@
1
1
  import { logger as E } from "../../shared-lib/index.js";
2
- import {
3
- BANNERS_DISABLED_MESSAGE as v,
4
- BRAZE_MUST_BE_INITIALIZED_ERROR as w,
5
- } from "../common/constants.js";
6
- import r, { OPTIONS as q } from "../managers/braze-instance.js";
7
- import { isArray as z } from "../util/code-utils.js";
8
- import { isValidBannerPlacementId as D } from "../util/validation-utils.js";
2
+ import { CoreStrings as z } from "../common/constants.js";
3
+ import { BannerStrings as j } from "./constants.js";
4
+ import r, { OPTIONS as D } from "../managers/braze-instance.js";
5
+ import { isArray as R } from "../util/code-utils.js";
6
+ import { isValidBannerPlacementId as J } from "../util/validation-utils.js";
9
7
  import i from "./banner-provider-factory.js";
10
- export function requestBannersRefresh(e, t, n) {
11
- if (!r.rr()) return void E.warn(w);
12
- const o = r.l();
13
- if (!o) return;
14
- if (!z(e) || 0 === e.length)
8
+ export function requestBannersRefresh(e, t, o) {
9
+ if (!r.rr()) return void E.warn(z.ee);
10
+ const s = r.l();
11
+ if (!s) return;
12
+ if (!R(e) || 0 === e.length)
15
13
  return void E.warn("placementIds should be a non-empty array.");
16
- if (!r.ee(q.re))
14
+ if (!r.re(D.te))
17
15
  return void E.error(
18
16
  "Banners are disabled. Use the 'allowUserSuppliedJavascript' option for braze.initialize to enable these messages.",
19
17
  );
20
- const s = i.o();
21
- if ((!1 === o.Dt() && E.error(v), !s.k()))
22
- return void o.P(() => {
23
- requestBannersRefresh(e, t, n);
18
+ const n = i.o();
19
+ if ((!1 === s.kt() && E.error(j.aa), !n.k()))
20
+ return void s.P(() => {
21
+ requestBannersRefresh(e, t, o);
24
22
  });
25
- const a = o.te();
23
+ const a = s.oe();
26
24
  e.length > a &&
27
25
  (E.warn(
28
26
  `Number of placement IDs requested exceeds the max allowed. Trimming placementIds array from length ${e.length} to ${a} (max allowed).`,
@@ -31,12 +29,12 @@ export function requestBannersRefresh(e, t, n) {
31
29
  0 !==
32
30
  (e = e.filter(
33
31
  (e) =>
34
- !!D(e) ||
32
+ !!J(e) ||
35
33
  (E.warn(
36
34
  `Placement ID should be a valid utf8 string with no whitespaces, filtering out: ${e}`,
37
35
  ),
38
36
  !1),
39
37
  )).length &&
40
38
  (E.info(`Requesting banners for placement IDs: ${JSON.stringify(e)}`),
41
- s.M(e, t, n));
39
+ n.M(e, t, o));
42
40
  }
@@ -5,20 +5,20 @@ export function subscribeToBannersUpdates(n) {
5
5
  var o;
6
6
  if (!r.rr()) return;
7
7
  const t = i.o();
8
- if (t.Ct()) {
8
+ if (t.Tt()) {
9
9
  const r = getAllBanners();
10
10
  r && "function" == typeof n && n(r);
11
11
  }
12
- const s = t.St(n);
13
- if (!t.jt()) {
12
+ const s = t.It(n);
13
+ if (!t.St()) {
14
14
  const n =
15
15
  null === (o = r.nn()) || void 0 === o
16
16
  ? void 0
17
17
  : o.rn(() => {
18
- const n = t.et();
18
+ const n = t.ot();
19
19
  n && n.length > 0 && t.M(n);
20
20
  });
21
- n && t.yt(n);
21
+ n && t.wt(n);
22
22
  }
23
23
  return s;
24
24
  }
@@ -1,26 +1,29 @@
1
1
  import E from "../../../shared-lib/logger.js";
2
- import { SUBSCRIPTION_ID_DATA_ATTRIBUTE as f } from "../../common/constants.js";
3
- import r, { OPTIONS as q } from "../../managers/braze-instance.js";
2
+ import { BannerStrings as j } from "../constants.js";
3
+ import r, { OPTIONS as D } from "../../managers/braze-instance.js";
4
4
  import { setupBannerUI as U } from "../../ui/js/banner-css.js";
5
- import { addPassiveEventListener as J } from "../../util/dom-utils.js";
6
- import { bannerToHtml as S } from "../display/banner-to-html.js";
7
- import { destroyBannerHtml as A } from "../display/destroy-banner-html.js";
8
- import { detectBannerImpressions as F } from "../display/detect-banner-impressions.js";
5
+ import { addPassiveEventListener as S } from "../../util/dom-utils.js";
6
+ import { bannerToHtml as A } from "../display/banner-to-html.js";
7
+ import { destroyBannerHtml as F } from "../display/destroy-banner-html.js";
8
+ import { detectBannerImpressions as G } from "../display/detect-banner-impressions.js";
9
9
  import { subscribeToBannersUpdates } from "../subscribe-to-banners-updates.js";
10
- export function insertBanner(o, e) {
10
+ export function insertBanner(e, n) {
11
11
  if (!r.rr()) return;
12
- if (!o) return void E.error("Not inserting banner: banner was not provided.");
13
- if (!e)
12
+ if (!e) return void E.error("Not inserting banner: banner was not provided.");
13
+ if (!n)
14
14
  return void E.error("Not inserting banner: parentNode was not provided.");
15
- if (!r.ee(q.re))
15
+ if (!r.re(D.te))
16
16
  return void E.error(
17
17
  "Banners are disabled. Use the 'allowUserSuppliedJavascript' option for braze.initialize to enable these messages.",
18
18
  );
19
19
  U();
20
- const n = S(o, r.ee(q.er)),
20
+ const o = A(e, r.re(D.er)),
21
21
  s = subscribeToBannersUpdates((s) => {
22
- const i = s[o.placementId];
23
- i ? e.replaceChildren(S(i, r.ee(q.er))) : A(n);
22
+ const i = s[e.placementId];
23
+ i ? n.replaceChildren(A(i, r.re(D.er))) : F(o);
24
24
  });
25
- s && n.setAttribute(f, s), e.replaceChildren(n), J(window, "scroll", F), F();
25
+ s && o.setAttribute(j.ea, s),
26
+ n.replaceChildren(o),
27
+ S(window, "scroll", G),
28
+ G();
26
29
  }
@@ -2,13 +2,13 @@ import M from "./card-manager.js";
2
2
  import r from "../managers/braze-instance.js";
3
3
  const _ = {
4
4
  i: !1,
5
- aa: null,
6
- ea: () => (_.t(), _.aa || (_.aa = new M(r.p())), _.aa),
5
+ na: null,
6
+ ra: () => (_.t(), _.na || (_.na = new M(r.p())), _.na),
7
7
  t: () => {
8
8
  _.i || (r.g(_), (_.i = !0));
9
9
  },
10
10
  destroy: () => {
11
- (_.aa = null), (_.i = !1);
11
+ (_.na = null), (_.i = !1);
12
12
  },
13
13
  };
14
14
  export default _;