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