@braze/web-sdk 5.5.0 → 5.6.1

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 (183) hide show
  1. package/index.d.ts +109 -7
  2. package/package.json +1 -1
  3. package/shared-lib/encoding-utils.js +1 -1
  4. package/shared-lib/event-types.js +33 -31
  5. package/shared-lib/guid.js +3 -3
  6. package/shared-lib/indexed-db-adapter.js +20 -20
  7. package/shared-lib/logger.js +18 -18
  8. package/shared-lib/supported-options.js +24 -24
  9. package/src/Banner/banner-factory.js +14 -0
  10. package/src/Banner/banner-provider-factory.js +19 -0
  11. package/src/Banner/banner-provider.js +198 -0
  12. package/src/Banner/banner.js +30 -0
  13. package/src/Banner/display/banner-to-html.js +57 -0
  14. package/src/Banner/display/destroy-banner-html.js +7 -0
  15. package/src/Banner/display/detect-banner-impressions.js +28 -0
  16. package/src/Banner/get-all-banners.js +13 -0
  17. package/src/Banner/get-banner.js +19 -0
  18. package/src/Banner/index.js +7 -0
  19. package/src/Banner/log-banner-click.js +22 -0
  20. package/src/Banner/log-banner-impressions.js +31 -0
  21. package/src/Banner/request-banners-refresh.js +35 -0
  22. package/src/Banner/subscribe-to-banners-updates.js +23 -0
  23. package/src/Banner/types.js +1 -0
  24. package/src/Banner/ui/insert-banner.js +24 -0
  25. package/src/Card/card-manager-factory.js +10 -10
  26. package/src/Card/card-manager.js +54 -52
  27. package/src/Card/display/card-display.js +77 -91
  28. package/src/Card/log-card-click.js +6 -6
  29. package/src/Card/log-card-dismissal.js +6 -5
  30. package/src/Card/log-card-impressions.js +11 -11
  31. package/src/Card/models/captioned-image.js +21 -21
  32. package/src/Card/models/card.js +99 -99
  33. package/src/Card/models/classic-card.js +21 -21
  34. package/src/Card/models/control-card.js +11 -11
  35. package/src/Card/models/image-only.js +19 -19
  36. package/src/Card/util/card-factory.js +58 -58
  37. package/src/ContentCards/content-cards-provider-factory.js +14 -14
  38. package/src/ContentCards/content-cards-provider.js +261 -263
  39. package/src/ContentCards/content-cards.js +5 -5
  40. package/src/ContentCards/get-cached-content-cards.js +3 -3
  41. package/src/ContentCards/request-content-cards-refresh.js +4 -4
  42. package/src/ContentCards/subscribe-to-content-cards-updates.js +13 -13
  43. package/src/ContentCards/ui/hide-content-cards.js +7 -7
  44. package/src/ContentCards/ui/show-content-cards.js +52 -52
  45. package/src/ContentCards/ui/toggle-content-cards.js +4 -4
  46. package/src/Core/add-sdk-metadata.js +9 -9
  47. package/src/Core/change-user.js +14 -14
  48. package/src/Core/destroy.js +3 -3
  49. package/src/Core/disable-sdk.js +13 -13
  50. package/src/Core/enable-sdk.js +9 -9
  51. package/src/Core/get-device-id.js +10 -10
  52. package/src/Core/get-user.js +2 -2
  53. package/src/Core/handle-braze-action.js +53 -53
  54. package/src/Core/initialize.js +2 -2
  55. package/src/Core/is-disabled.js +2 -2
  56. package/src/Core/is-initialized.js +2 -2
  57. package/src/Core/log-custom-event.js +27 -27
  58. package/src/Core/log-purchase.js +38 -38
  59. package/src/Core/open-session.js +18 -18
  60. package/src/Core/remove-all-subscriptions.js +2 -2
  61. package/src/Core/remove-subscription.js +3 -3
  62. package/src/Core/request-immediate-data-flush.js +5 -5
  63. package/src/Core/set-logger.js +2 -2
  64. package/src/Core/set-sdk-authentication-signature.js +6 -6
  65. package/src/Core/subscribe-to-sdk-authentication-failures.js +5 -5
  66. package/src/Core/toggle-logging.js +2 -2
  67. package/src/Core/wipe-data.js +10 -10
  68. package/src/FeatureFlags/feature-flag-factory.js +13 -13
  69. package/src/FeatureFlags/feature-flag.js +10 -10
  70. package/src/FeatureFlags/feature-flags-provider-factory.js +13 -14
  71. package/src/FeatureFlags/feature-flags-provider.js +118 -116
  72. package/src/FeatureFlags/get-all-feature-flags.js +10 -10
  73. package/src/FeatureFlags/get-feature-flag.js +9 -9
  74. package/src/FeatureFlags/log-feature-flag-impression.js +18 -18
  75. package/src/FeatureFlags/refresh-feature-flags.js +6 -6
  76. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +9 -9
  77. package/src/Feed/feed-provider-factory.js +12 -12
  78. package/src/Feed/feed-provider.js +59 -59
  79. package/src/Feed/feed.js +4 -4
  80. package/src/Feed/get-cached-feed.js +3 -3
  81. package/src/Feed/log-feed-displayed.js +5 -5
  82. package/src/Feed/request-feed-refresh.js +3 -3
  83. package/src/Feed/subscribe-to-feed-updates.js +4 -4
  84. package/src/Feed/ui/hide-feed.js +5 -5
  85. package/src/Feed/ui/show-feed.js +53 -53
  86. package/src/Feed/ui/toggle-feed.js +4 -4
  87. package/src/InAppMessage/defer-in-app-message.js +9 -9
  88. package/src/InAppMessage/display/html-message-display-utils.js +18 -164
  89. package/src/InAppMessage/display/html-message-to-html.js +55 -62
  90. package/src/InAppMessage/display/in-app-message-to-html.js +74 -74
  91. package/src/InAppMessage/display/modal-utils.js +17 -17
  92. package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
  93. package/src/InAppMessage/in-app-message-factory.js +61 -61
  94. package/src/InAppMessage/in-app-message-manager-factory.js +9 -9
  95. package/src/InAppMessage/in-app-message-manager.js +158 -156
  96. package/src/InAppMessage/log-in-app-message-button-click.js +16 -16
  97. package/src/InAppMessage/log-in-app-message-click.js +11 -11
  98. package/src/InAppMessage/log-in-app-message-html-click.js +15 -15
  99. package/src/InAppMessage/log-in-app-message-impression.js +6 -6
  100. package/src/InAppMessage/models/control-message.js +15 -8
  101. package/src/InAppMessage/models/full-screen-message.js +34 -34
  102. package/src/InAppMessage/models/html-message.js +23 -23
  103. package/src/InAppMessage/models/in-app-message-button.js +10 -10
  104. package/src/InAppMessage/models/in-app-message.js +155 -155
  105. package/src/InAppMessage/models/modal-message.js +33 -33
  106. package/src/InAppMessage/models/slide-up-message.js +35 -35
  107. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  108. package/src/InAppMessage/subscribe-to-in-app-message.js +3 -3
  109. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +6 -6
  110. package/src/InAppMessage/ui/show-in-app-message.js +103 -103
  111. package/src/Push/is-push-blocked.js +2 -2
  112. package/src/Push/is-push-permission-granted.js +2 -2
  113. package/src/Push/is-push-supported.js +2 -2
  114. package/src/Push/push-manager-factory.js +25 -25
  115. package/src/Push/push-manager.js +176 -176
  116. package/src/Push/request-push-permission.js +8 -8
  117. package/src/Push/unregister-push.js +4 -4
  118. package/src/Push/utils/push-utils.js +4 -4
  119. package/src/User/user-manager.js +38 -38
  120. package/src/User/user.js +95 -92
  121. package/src/common/base-feed.js +9 -9
  122. package/src/common/base-provider.js +2 -2
  123. package/src/common/constants.js +1 -0
  124. package/src/common/detect-impression.js +18 -0
  125. package/src/common/event-logger.js +22 -22
  126. package/src/common/feed-display.js +53 -53
  127. package/src/index.js +1 -0
  128. package/src/l10n/l10n-manager-factory.js +15 -15
  129. package/src/l10n/l10n-manager.js +4 -4
  130. package/src/managers/auth-manager.js +38 -38
  131. package/src/managers/braze-instance.js +212 -212
  132. package/src/managers/device-manager.js +30 -30
  133. package/src/managers/network-manager.js +234 -235
  134. package/src/managers/server-config-manager.js +99 -83
  135. package/src/managers/session-manager.js +46 -50
  136. package/src/managers/storage-manager-factory.js +13 -13
  137. package/src/managers/storage-manager.js +182 -180
  138. package/src/managers/subscription-manager.js +12 -12
  139. package/src/managers/utils.js +4 -4
  140. package/src/models/backend-errors.js +5 -5
  141. package/src/models/braze-event.js +9 -9
  142. package/src/models/device.js +2 -2
  143. package/src/models/identifier.js +15 -15
  144. package/src/models/push-token.js +10 -10
  145. package/src/models/request-result.js +4 -4
  146. package/src/models/server-config.js +38 -34
  147. package/src/request-controller.js +228 -228
  148. package/src/triggers/models/custom-event-data.js +5 -5
  149. package/src/triggers/models/custom-event-property-data.js +6 -6
  150. package/src/triggers/models/filter-set.js +10 -10
  151. package/src/triggers/models/filter.js +66 -66
  152. package/src/triggers/models/in-app-message-click-data.js +10 -10
  153. package/src/triggers/models/purchase-data.js +2 -2
  154. package/src/triggers/models/purchase-property-data.js +6 -6
  155. package/src/triggers/models/push-click-data.js +5 -5
  156. package/src/triggers/models/trigger-condition.js +46 -46
  157. package/src/triggers/models/trigger-events.js +4 -4
  158. package/src/triggers/models/trigger.js +33 -33
  159. package/src/triggers/triggers-provider-factory.js +16 -16
  160. package/src/triggers/triggers-provider.js +156 -154
  161. package/src/ui/js/attach-css.js +7 -7
  162. package/src/ui/js/banner-css.js +11 -0
  163. package/src/ui/js/feed-css.js +4 -4
  164. package/src/ui/js/iam-css.js +4 -4
  165. package/src/ui/js/index.js +1 -0
  166. package/src/ui/js/load-font-awesome.js +8 -8
  167. package/src/util/base-device-parser.js +9 -9
  168. package/src/util/braze-actions.js +32 -32
  169. package/src/util/browser-detector.js +31 -30
  170. package/src/util/client-hints-parser.js +10 -10
  171. package/src/util/code-utils.js +5 -5
  172. package/src/util/component-utils.js +5 -5
  173. package/src/util/deprecation-utils.js +3 -3
  174. package/src/util/device-constants.js +1 -1
  175. package/src/util/dom-utils.js +13 -13
  176. package/src/util/html-display-utils.js +158 -0
  177. package/src/util/key-codes.js +1 -1
  178. package/src/util/net.js +21 -21
  179. package/src/util/request-header-utils.js +31 -30
  180. package/src/util/string-utils.js +2 -2
  181. package/src/util/user-agent-parser.js +18 -18
  182. package/src/util/validation-utils.js +89 -85
  183. package/src/util/window-utils.js +3 -3
@@ -1,177 +1,179 @@
1
- import { logger as r } from "../../shared-lib/index.js";
2
- import y from "../common/base-provider.js";
3
- import e from "../managers/braze-instance.js";
4
- import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
5
- import T from "../managers/subscription-manager.js";
6
- import { randomInclusive as U } from "../util/math.js";
7
- import C from "../util/net.js";
1
+ import { logger as N } from "../../shared-lib/index.js";
2
+ import s from "../common/base-provider.js";
3
+ import r from "../managers/braze-instance.js";
4
+ import { STORAGE_KEYS as t } from "../managers/storage-manager.js";
5
+ import u from "../managers/subscription-manager.js";
6
+ import { randomInclusive as a } from "../util/math.js";
7
+ import l from "../util/net.js";
8
8
  import {
9
- newFeatureFlagFromJson as st,
10
- newFeatureFlagFromSerializedValue as it,
9
+ newFeatureFlagFromJson as ht,
10
+ newFeatureFlagFromSerializedValue as at,
11
11
  } from "./feature-flag-factory.js";
12
- import D from "../util/request-header-utils.js";
13
- export default class er extends y {
14
- constructor(t, s, i, r) {
12
+ import h from "../util/request-header-utils.js";
13
+ export default class tr extends s {
14
+ constructor(t, s, i, e) {
15
15
  super(),
16
- (this.qt = t),
17
- (this.$t = s),
18
- (this.u = i),
19
- (this.oi = r),
20
- (this.ai = []),
21
- (this.ni = 0),
22
- (this.qt = t),
23
- (this.$t = s),
24
- (this.u = i),
25
- (this.oi = r),
26
- (this.li = null),
27
- (this.ui = new T()),
28
- (this.fi = 10),
29
- (this.ci = null),
30
- (this.di = null),
31
- e.Ht(this.ui);
16
+ (this.B = t),
17
+ (this.S = s),
18
+ (this.C = i),
19
+ (this.T = e),
20
+ (this.Gi = []),
21
+ (this.Hi = 0),
22
+ (this.B = t),
23
+ (this.S = s),
24
+ (this.C = i),
25
+ (this.T = e),
26
+ (this.Ki = null),
27
+ (this.Oi = new u()),
28
+ (this.R = 10),
29
+ (this.I = null),
30
+ (this.q = null),
31
+ r.N(this.Oi);
32
32
  }
33
- Ss(t) {
33
+ U(t) {
34
34
  var s;
35
35
  if (
36
- (null === (s = this.qt) || void 0 === s ? void 0 : s.mi()) &&
36
+ (null === (s = this.B) || void 0 === s ? void 0 : s.Qi()) &&
37
37
  null != t &&
38
38
  t.feature_flags
39
39
  ) {
40
- this.ai = [];
40
+ this.Gi = [];
41
41
  for (const s of t.feature_flags) {
42
- const t = st(s);
43
- t && this.ai.push(t);
42
+ const t = ht(s);
43
+ t && this.Gi.push(t);
44
44
  }
45
- (this.ni = new Date().getTime()), this.gi(), this.ui.Rt(this.ai);
45
+ (this.Hi = new Date().getTime()), this.Vi(), this.Oi.X(this.Gi);
46
46
  }
47
47
  }
48
- Fi() {
49
- let t = {};
50
- this.u && (t = this.u.j(o.C.vi));
51
- const s = {};
52
- for (const i in t) {
53
- const e = it(t[i]);
54
- e && (s[e.id] = e);
48
+ Wi() {
49
+ let s = {};
50
+ this.C && (s = this.C.ps(t.bs.Yi));
51
+ const i = {};
52
+ for (const t in s) {
53
+ const e = at(s[t]);
54
+ e && (i[e.id] = e);
55
55
  }
56
- return s;
56
+ return i;
57
57
  }
58
- pi() {
59
- var t;
60
- return (null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.wi)) || {};
58
+ Zi() {
59
+ var s;
60
+ return (
61
+ (null === (s = this.C) || void 0 === s ? void 0 : s.ps(t.bs.we)) || {}
62
+ );
61
63
  }
62
- ji(t) {
63
- this.u && this.u.I(o.C.wi, t);
64
+ je(s) {
65
+ this.C && this.C.js(t.bs.we, s);
64
66
  }
65
- si(t) {
66
- return this.ui.Nt(t);
67
+ Fs(t) {
68
+ return this.Oi.Ns(t);
67
69
  }
68
70
  refreshFeatureFlags(t, s, i = !1, e = !0) {
69
71
  const r = () => {
70
- "function" == typeof s && s(), this.ui.Rt(this.ai);
72
+ "function" == typeof s && s(), this.Oi.X(this.Gi);
71
73
  };
72
- if (!this.yi(i))
74
+ if (!this.Ce(i))
73
75
  return (
74
- !this.li &&
75
- this.qt &&
76
- (this.li = this.qt.bi(() => {
76
+ !this.Ki &&
77
+ this.B &&
78
+ (this.Ki = this.B.Re(() => {
77
79
  this.refreshFeatureFlags(t, s);
78
80
  })),
79
81
  void r()
80
82
  );
81
- const h = this.$t;
82
- if (!h) return void r();
83
- e && this.Ci();
84
- const o = h.$s({}, !0),
85
- a = h.Ps(o, D._s.Ri);
86
- let n = !1;
87
- h.Gs(
88
- o,
89
- (h = -1) => {
90
- if (!this.$t) return void r();
91
- const l = new Date().valueOf();
92
- D.Hs(this.u, D._s.Ri, l),
93
- -1 !== h && a.push(["X-Braze-Req-Tokens-Remaining", h.toString()]),
94
- C.Ks({
95
- url: `${this.$t.Os()}/feature_flags/sync`,
96
- headers: a,
97
- data: o,
98
- L: (s) => {
99
- if (!this.$t.Qs(o, s, a)) return (n = !0), void r();
100
- this.$t.Vs(),
101
- this.Ss(s),
102
- (n = !1),
103
- D.Ws(this.u, D._s.Ri, 1),
83
+ const o = this.S;
84
+ if (!o) return void r();
85
+ e && this.G();
86
+ const n = o.H({}, !0),
87
+ u = o.J(n, h.O.De);
88
+ let f = !1;
89
+ o.V(
90
+ n,
91
+ (o = -1) => {
92
+ if (!this.S) return void r();
93
+ const c = new Date().valueOf();
94
+ h.W(this.C, h.O.De, c),
95
+ -1 !== o && u.push(["X-Braze-Req-Tokens-Remaining", o.toString()]),
96
+ l.Y({
97
+ url: `${this.S.Z()}/feature_flags/sync`,
98
+ headers: u,
99
+ data: n,
100
+ ss: (s) => {
101
+ if (!this.S.ts(n, s, u)) return (f = !0), void r();
102
+ this.S.es(),
103
+ this.U(s),
104
+ (f = !1),
105
+ h.ns(this.C, h.O.De, 1),
104
106
  "function" == typeof t && t();
105
107
  },
106
108
  error: (t) => {
107
- this.$t.Ys(t, "retrieving feature flags"), (n = !0), r();
109
+ this.S.rs(t, "retrieving feature flags"), (f = !0), r();
108
110
  },
109
- Zs: () => {
110
- if (e && n && !this.di) {
111
- D.ti(this.u, D._s.Ri);
112
- let e = this.ci;
113
- (null == e || e < 1e3 * this.fi) && (e = 1e3 * this.fi),
114
- this.Ti(Math.min(3e5, U(1e3 * this.fi, 3 * e)), t, s, i);
111
+ os: () => {
112
+ if (e && f && !this.q) {
113
+ h.hs(this.C, h.O.De);
114
+ let e = this.I;
115
+ (null == e || e < 1e3 * this.R) && (e = 1e3 * this.R),
116
+ this.ls(Math.min(3e5, a(1e3 * this.R, 3 * e)), t, s, i);
115
117
  }
116
118
  },
117
119
  });
118
120
  },
119
- D._s.Ri,
121
+ h.O.De,
120
122
  s,
121
123
  );
122
124
  }
123
- Ci() {
124
- null != this.di && (clearTimeout(this.di), (this.di = null));
125
+ G() {
126
+ null != this.q && (clearTimeout(this.q), (this.q = null));
125
127
  }
126
- Ti(t = 1e3 * this.fi, s, i, e = !1) {
127
- this.Ci(),
128
- (this.di = window.setTimeout(() => {
128
+ ls(t = 1e3 * this.R, s, i, e = !1) {
129
+ this.G(),
130
+ (this.q = window.setTimeout(() => {
129
131
  this.refreshFeatureFlags(s, i, e);
130
132
  }, t)),
131
- (this.ci = t);
133
+ (this.I = t);
132
134
  }
133
- yi(t) {
134
- if (!this.qt) return !1;
135
+ Ce(t) {
136
+ if (!this.B) return !1;
135
137
  if (!t) {
136
- const t = this.qt.Di();
138
+ const t = this.B.Se();
137
139
  if (null == t) return !1;
138
140
  let s = !1;
139
141
  if (!isNaN(t)) {
140
- if (-1 === t) return r.info("Feature flag refreshes not allowed"), !1;
141
- s = new Date().getTime() >= (this.ni || 0) + 1e3 * t;
142
+ if (-1 === t) return N.info("Feature flag refreshes not allowed"), !1;
143
+ s = new Date().getTime() >= (this.Hi || 0) + 1e3 * t;
142
144
  }
143
145
  if (!s)
144
146
  return (
145
- r.info(`Feature flag refreshes were rate limited to ${t} seconds`), !1
147
+ N.info(`Feature flag refreshes were rate limited to ${t} seconds`), !1
146
148
  );
147
149
  }
148
- return this.qt.mi();
150
+ return this.B.Qi();
149
151
  }
150
- Ii() {
151
- var t;
152
+ qe() {
153
+ var s;
152
154
  return (
153
- (null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.Si)) || null
155
+ (null === (s = this.C) || void 0 === s ? void 0 : s.ps(t.bs.xe)) || null
154
156
  );
155
157
  }
156
- qi() {
157
- var t, s;
158
- null === (t = this.u) ||
159
- void 0 === t ||
160
- t.I(o.C.Si, null === (s = this.oi) || void 0 === s ? void 0 : s.xi());
158
+ ze() {
159
+ var s, i;
160
+ null === (s = this.C) ||
161
+ void 0 === s ||
162
+ s.js(t.bs.xe, null === (i = this.T) || void 0 === i ? void 0 : i.Ss());
161
163
  }
162
- Ni() {
164
+ $e() {
163
165
  var t;
164
- const s = null === (t = this.oi) || void 0 === t ? void 0 : t.xi(),
165
- i = this.Ii();
166
+ const s = null === (t = this.T) || void 0 === t ? void 0 : t.Ss(),
167
+ i = this.qe();
166
168
  return null == i || s === i;
167
169
  }
168
- gi() {
169
- if (!this.u) return;
170
- const t = {};
171
- for (const s of this.ai) {
172
- const i = s.Y();
173
- t[s.id] = i;
170
+ Vi() {
171
+ if (!this.C) return;
172
+ const s = {};
173
+ for (const t of this.Gi) {
174
+ const i = t.Bs();
175
+ s[t.id] = i;
174
176
  }
175
- this.u.I(o.C.vi, t), this.u.I(o.C.zi, this.ni), this.qi();
177
+ this.C.js(t.bs.Yi, s), this.C.js(t.bs.ke, this.Hi), this.ze();
176
178
  }
177
179
  }
@@ -1,12 +1,12 @@
1
- import { logger as r } from "../../shared-lib/index.js";
2
- import e from "../managers/braze-instance.js";
3
- import ir from "./feature-flags-provider-factory.js";
1
+ import { logger as N } from "../../shared-lib/index.js";
2
+ import r from "../managers/braze-instance.js";
3
+ import nr from "./feature-flags-provider-factory.js";
4
4
  export function getAllFeatureFlags() {
5
- if (!e.X()) return;
6
- const t = [],
7
- n = e.ir();
8
- if (n && !n.mi()) return r.info("Feature flags are not enabled."), t;
9
- const o = ir.rr().Fi();
10
- for (const r in o) t.push(o[r]);
11
- return t;
5
+ if (!r.rr()) return;
6
+ const e = [],
7
+ t = r.v();
8
+ if (t && !t.Qi()) return N.info("Feature flags are not enabled."), e;
9
+ const n = nr.m().Wi();
10
+ for (const r in n) e.push(n[r]);
11
+ return e;
12
12
  }
@@ -1,10 +1,10 @@
1
- import { logger as r } from "../../shared-lib/index.js";
2
- import e from "../managers/braze-instance.js";
3
- import ir from "./feature-flags-provider-factory.js";
4
- export function getFeatureFlag(t) {
5
- if (!e.X()) return;
6
- const n = e.ir();
7
- if (n && !n.mi()) return r.info("Feature flags are not enabled."), null;
8
- const a = ir.rr().Fi();
9
- return a[t] ? a[t] : null;
1
+ import { logger as N } from "../../shared-lib/index.js";
2
+ import r from "../managers/braze-instance.js";
3
+ import nr from "./feature-flags-provider-factory.js";
4
+ export function getFeatureFlag(e) {
5
+ if (!r.rr()) return;
6
+ const t = r.v();
7
+ if (t && !t.Qi()) return N.info("Feature flags are not enabled."), null;
8
+ const n = nr.m().Wi();
9
+ return n[e] ? n[e] : null;
10
10
  }
@@ -1,25 +1,25 @@
1
- import { logger as r, EventTypes as i } from "../../shared-lib/index.js";
2
- import t from "../common/event-logger.js";
3
- import e from "../managers/braze-instance.js";
4
- import ir from "./feature-flags-provider-factory.js";
5
- export function logFeatureFlagImpression(o) {
6
- if (!e.X()) return;
7
- if (!o) return !1;
8
- const n =
1
+ import { logger as N, EventTypes as d } from "../../shared-lib/index.js";
2
+ import c from "../common/event-logger.js";
3
+ import r from "../managers/braze-instance.js";
4
+ import nr from "./feature-flags-provider-factory.js";
5
+ export function logFeatureFlagImpression(e) {
6
+ if (!r.rr()) return;
7
+ if (!e) return !1;
8
+ const t =
9
9
  "Not logging a feature flag impression. The feature flag was not part of any matching experiment.",
10
- s = ir.rr().Fi();
11
- if (!s[o]) return r.info(n), !1;
12
- const a = s[o].trackingString;
13
- if (!a) return r.info(n), !1;
14
- const f = ir.rr().pi();
15
- if (f[a])
10
+ o = nr.m().Wi();
11
+ if (!o[e]) return N.info(t), !1;
12
+ const n = o[e].trackingString;
13
+ if (!n) return N.info(t), !1;
14
+ const i = nr.m().Zi();
15
+ if (i[n])
16
16
  return (
17
- r.info(
17
+ N.info(
18
18
  "Not logging another feature flag impression. This ID was already logged this session.",
19
19
  ),
20
20
  !1
21
21
  );
22
- (f[a] = !0), ir.rr().ji(f);
23
- const g = { fid: o, fts: a };
24
- return t.q(i.Fr, g).L;
22
+ (i[n] = !0), nr.m().je(i);
23
+ const s = { fid: e, fts: n };
24
+ return c.ds(d.yr, s).ss;
25
25
  }
@@ -1,9 +1,9 @@
1
- import e from "../managers/braze-instance.js";
2
- import ir from "./feature-flags-provider-factory.js";
3
- function tr(r, t, a = !1) {
4
- if (e.X()) return ir.rr().refreshFeatureFlags(r, t, a);
1
+ import r from "../managers/braze-instance.js";
2
+ import nr from "./feature-flags-provider-factory.js";
3
+ function ar(e, t, a = !1) {
4
+ if (r.rr()) return nr.m().refreshFeatureFlags(e, t, a);
5
5
  }
6
6
  export function refreshFeatureFlags(r, e) {
7
- tr(r, e);
7
+ ar(r, e);
8
8
  }
9
- export default tr;
9
+ export default ar;
@@ -1,12 +1,12 @@
1
- import e from "../managers/braze-instance.js";
2
- import ir from "./feature-flags-provider-factory.js";
1
+ import r from "../managers/braze-instance.js";
2
+ import nr from "./feature-flags-provider-factory.js";
3
3
  import { getAllFeatureFlags } from "./get-all-feature-flags.js";
4
- export function subscribeToFeatureFlagsUpdates(r) {
5
- if (!e.X()) return;
6
- const t = ir.rr();
7
- if (t.Ni()) {
8
- const t = getAllFeatureFlags();
9
- t && "function" == typeof r && r(t);
4
+ export function subscribeToFeatureFlagsUpdates(t) {
5
+ if (!r.rr()) return;
6
+ const e = nr.m();
7
+ if (e.$e()) {
8
+ const r = getAllFeatureFlags();
9
+ r && "function" == typeof t && t(r);
10
10
  }
11
- return t.si(r);
11
+ return e.Fs(t);
12
12
  }
@@ -1,18 +1,18 @@
1
- import e from "../managers/braze-instance.js";
2
- import ee from "./feed-provider.js";
3
- const re = {
4
- t: !1,
1
+ import r from "../managers/braze-instance.js";
2
+ import re from "./feed-provider.js";
3
+ const ie = {
4
+ l: !1,
5
5
  provider: null,
6
- rr: () => (
7
- re.o(),
8
- re.provider || ((re.provider = new ee(e.l(), e.cr())), e.ar(re.provider)),
9
- re.provider
6
+ m: () => (
7
+ ie.p(),
8
+ ie.provider || ((ie.provider = new re(r.j(), r.nn())), r._(ie.provider)),
9
+ ie.provider
10
10
  ),
11
- o: () => {
12
- re.t || (e.g(re), (re.t = !0));
11
+ p: () => {
12
+ ie.l || (r.h(ie), (ie.l = !0));
13
13
  },
14
14
  destroy: () => {
15
- (re.provider = null), (re.t = !1);
15
+ (ie.provider = null), (ie.l = !1);
16
16
  },
17
17
  };
18
- export default re;
18
+ export default ie;
@@ -1,70 +1,70 @@
1
- import y from "../common/base-provider.js";
2
- import e from "../managers/braze-instance.js";
1
+ import s from "../common/base-provider.js";
2
+ import r from "../managers/braze-instance.js";
3
3
  import Feed from "./feed.js";
4
4
  import {
5
- newCardFromFeedJson as ht,
6
- newCardFromSerializedValue as S,
5
+ newCardFromFeedJson as lt,
6
+ newCardFromSerializedValue as tt,
7
7
  } from "../Card/util/card-factory.js";
8
- import { rehydrateDateAfterJsonization as w } from "../util/date-utils.js";
9
- import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
10
- import T from "../managers/subscription-manager.js";
11
- export default class ee extends y {
8
+ import { rehydrateDateAfterJsonization as V } from "../util/date-utils.js";
9
+ import { STORAGE_KEYS as t } from "../managers/storage-manager.js";
10
+ import u from "../managers/subscription-manager.js";
11
+ export default class re extends s {
12
12
  constructor(t, s) {
13
13
  super(),
14
- (this.u = t),
15
- (this.Ui = s),
14
+ (this.C = t),
15
+ (this.Ue = s),
16
16
  (this.cards = []),
17
- (this.ki = null),
18
- (this.u = t),
19
- (this.Ui = s),
20
- (this.Bt = new T()),
21
- e.Ht(this.Bt),
22
- this.Yt();
17
+ (this.Ae = null),
18
+ (this.C = t),
19
+ (this.Ue = s),
20
+ (this.Ms = new u()),
21
+ r.N(this.Ms),
22
+ this.Xs();
23
23
  }
24
- Yt() {
25
- let t = [];
26
- this.u && (t = this.u.j(o.C.Ai) || []);
27
- const s = [];
28
- for (let i = 0; i < t.length; i++) {
29
- const e = S(t[i]);
30
- null != e && s.push(e);
24
+ Xs() {
25
+ let s = [];
26
+ this.C && (s = this.C.ps(t.bs.Be) || []);
27
+ const i = [];
28
+ for (let t = 0; t < s.length; t++) {
29
+ const e = tt(s[t]);
30
+ null != e && i.push(e);
31
31
  }
32
- (this.cards = s), this.u && (this.ki = w(this.u.j(o.C.Bi)));
32
+ (this.cards = i), this.C && (this.Ae = V(this.C.ps(t.bs.Ge)));
33
33
  }
34
- Ei(t) {
35
- const s = [];
36
- let i = null,
37
- e = {};
38
- this.u && (e = this.u.j(o.C.J) || {});
39
- const r = {};
40
- for (let h = 0; h < t.length; h++) {
41
- i = t[h];
42
- const o = ht(i);
34
+ He(s) {
35
+ const i = [];
36
+ let e = null,
37
+ r = {};
38
+ this.C && (r = this.C.ps(t.bs.Ct) || {});
39
+ const h = {};
40
+ for (let t = 0; t < s.length; t++) {
41
+ e = s[t];
42
+ const o = lt(e);
43
43
  if (null != o) {
44
44
  const t = o.id;
45
- t && e[t] && ((o.viewed = !0), (r[t] = !0)), s.push(o);
45
+ t && r[t] && ((o.viewed = !0), (h[t] = !0)), i.push(o);
46
46
  }
47
47
  }
48
- (this.cards = s),
49
- this.Ts(),
50
- (this.ki = new Date()),
51
- this.u && (this.u.I(o.C.J, r), this.u.I(o.C.Bi, this.ki));
48
+ (this.cards = i),
49
+ this.Ri(),
50
+ (this.Ae = new Date()),
51
+ this.C && (this.C.js(t.bs.Ct, h), this.C.js(t.bs.Ge, this.Ae));
52
52
  }
53
- Ts() {
54
- var t;
55
- const s = [];
56
- for (let t = 0; t < this.cards.length; t++) s.push(this.cards[t].Y());
57
- null === (t = this.u) || void 0 === t || t.I(o.C.Ai, s);
53
+ Ri() {
54
+ var s;
55
+ const i = [];
56
+ for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].Bs());
57
+ null === (s = this.C) || void 0 === s || s.js(t.bs.Be, i);
58
58
  }
59
- Ss(t) {
59
+ U(t) {
60
60
  null != t &&
61
61
  t.feed &&
62
- (this.Yt(),
63
- this.Ei(t.feed),
64
- this.Bt.Rt(new Feed(this.cards.slice(), this.ki)));
62
+ (this.Xs(),
63
+ this.He(t.feed),
64
+ this.Ms.X(new Feed(this.cards.slice(), this.Ae)));
65
65
  }
66
- Gi() {
67
- this.Yt();
66
+ Je() {
67
+ this.Xs();
68
68
  const t = [],
69
69
  s = new Date();
70
70
  for (let i = 0; i < this.cards.length; i++) {
@@ -72,19 +72,19 @@ export default class ee extends y {
72
72
  let r = !0;
73
73
  null != e && (r = e >= s), r && t.push(this.cards[i]);
74
74
  }
75
- return new Feed(t, this.ki);
75
+ return new Feed(t, this.Ae);
76
76
  }
77
- qs() {
78
- this.Ui && this.Ui.requestFeedRefresh();
77
+ zi() {
78
+ this.Ue && this.Ue.requestFeedRefresh();
79
79
  }
80
- si(t) {
81
- return this.Bt.Nt(t);
80
+ Fs(t) {
81
+ return this.Ms.Ns(t);
82
82
  }
83
- clearData(t) {
84
- null == t && (t = !1),
83
+ clearData(s) {
84
+ null == s && (s = !1),
85
85
  (this.cards = []),
86
- (this.ki = null),
87
- t && this.u && (this.u.ii(o.C.Ai), this.u.ii(o.C.Bi)),
88
- this.Bt.Rt(new Feed(this.cards.slice(), this.ki));
86
+ (this.Ae = null),
87
+ s && this.C && (this.C.Ls(t.bs.Be), this.C.Ls(t.bs.Ge)),
88
+ this.Ms.X(new Feed(this.cards.slice(), this.Ae));
89
89
  }
90
90
  }
package/src/Feed/feed.js CHANGED
@@ -1,7 +1,7 @@
1
- import x from "../common/base-feed.js";
1
+ import rr from "../common/base-feed.js";
2
2
  import { logCardClick, logCardImpressions } from "../Card/index.js";
3
3
  import { requestFeedRefresh } from "./request-feed-refresh.js";
4
- export default class Feed extends x {
4
+ export default class Feed extends rr {
5
5
  constructor(r, e) {
6
6
  super(r, e);
7
7
  }
@@ -11,10 +11,10 @@ export default class Feed extends x {
11
11
  logCardClick(r) {
12
12
  return logCardClick(r, !1);
13
13
  }
14
- sr() {
14
+ dr() {
15
15
  requestFeedRefresh();
16
16
  }
17
- dr() {
17
+ ur() {
18
18
  return !1;
19
19
  }
20
20
  }
@@ -1,5 +1,5 @@
1
- import e from "../managers/braze-instance.js";
2
- import re from "./feed-provider-factory.js";
1
+ import r from "../managers/braze-instance.js";
2
+ import ie from "./feed-provider-factory.js";
3
3
  export function getCachedFeed() {
4
- if (e.X()) return re.rr().Gi();
4
+ if (r.rr()) return ie.m().Je();
5
5
  }