@braze/web-sdk 4.7.2 → 4.8.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 (164) hide show
  1. package/index.d.ts +32 -26
  2. package/package.json +1 -1
  3. package/shared-lib/braze-shared-lib.js +5 -5
  4. package/shared-lib/encoding-utils.js +1 -1
  5. package/shared-lib/event-types.js +25 -25
  6. package/shared-lib/guid.js +3 -3
  7. package/shared-lib/indexed-db-adapter.js +74 -74
  8. package/shared-lib/logger.js +18 -18
  9. package/shared-lib/supported-options.js +18 -18
  10. package/src/Card/card-manager-factory.js +2 -2
  11. package/src/Card/card-manager.js +48 -42
  12. package/src/Card/display/card-display.js +70 -67
  13. package/src/Card/log-card-click.js +1 -1
  14. package/src/Card/log-card-dismissal.js +1 -1
  15. package/src/Card/log-card-impressions.js +3 -3
  16. package/src/Card/models/banner.js +3 -2
  17. package/src/Card/models/captioned-image.js +6 -5
  18. package/src/Card/models/card.js +107 -87
  19. package/src/Card/models/classic-card.js +5 -5
  20. package/src/Card/models/control-card.js +5 -21
  21. package/src/Card/types.js +1 -0
  22. package/src/Card/util/card-factory.js +32 -32
  23. package/src/ContentCards/content-cards-provider-factory.js +3 -3
  24. package/src/ContentCards/content-cards-provider.js +283 -175
  25. package/src/ContentCards/content-cards.js +2 -2
  26. package/src/ContentCards/get-cached-content-cards.js +1 -1
  27. package/src/ContentCards/log-content-cards-displayed.js +2 -2
  28. package/src/ContentCards/request-content-cards-refresh.js +1 -1
  29. package/src/ContentCards/subscribe-to-content-cards-updates.js +9 -6
  30. package/src/ContentCards/types.js +1 -0
  31. package/src/ContentCards/ui/hide-content-cards.js +2 -2
  32. package/src/ContentCards/ui/show-content-cards.js +36 -34
  33. package/src/Core/add-sdk-metadata.js +17 -18
  34. package/src/Core/change-user.js +12 -14
  35. package/src/Core/destroy.js +1 -1
  36. package/src/Core/disable-sdk.js +8 -6
  37. package/src/Core/enable-sdk.js +4 -4
  38. package/src/Core/get-device-id.js +7 -6
  39. package/src/Core/get-user.js +1 -1
  40. package/src/Core/handle-braze-action.js +57 -40
  41. package/src/Core/is-disabled.js +2 -2
  42. package/src/Core/log-custom-event.js +22 -15
  43. package/src/Core/log-purchase.js +33 -33
  44. package/src/Core/open-session.js +17 -15
  45. package/src/Core/request-immediate-data-flush.js +4 -2
  46. package/src/Core/set-logger.js +1 -1
  47. package/src/Core/set-sdk-authentication-signature.js +5 -6
  48. package/src/Core/subscribe-to-sdk-authentication-failures.js +3 -1
  49. package/src/Core/toggle-logging.js +1 -1
  50. package/src/Core/types.js +1 -0
  51. package/src/Core/wipe-data.js +11 -10
  52. package/src/FeatureFlags/feature-flag-factory.js +6 -6
  53. package/src/FeatureFlags/feature-flag.js +17 -17
  54. package/src/FeatureFlags/feature-flags-provider-factory.js +2 -2
  55. package/src/FeatureFlags/feature-flags-provider.js +67 -65
  56. package/src/FeatureFlags/get-all-feature-flags.js +3 -3
  57. package/src/FeatureFlags/get-feature-flag.js +4 -4
  58. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -1
  59. package/src/Feed/feed-provider-factory.js +8 -8
  60. package/src/Feed/feed-provider.js +57 -46
  61. package/src/Feed/feed.js +1 -1
  62. package/src/Feed/get-cached-feed.js +2 -2
  63. package/src/Feed/log-feed-displayed.js +3 -1
  64. package/src/Feed/request-feed-refresh.js +2 -2
  65. package/src/Feed/subscribe-to-feed-updates.js +2 -2
  66. package/src/Feed/types.js +1 -0
  67. package/src/Feed/ui/hide-feed.js +2 -2
  68. package/src/Feed/ui/show-feed.js +41 -37
  69. package/src/InAppMessage/display/html-message-to-html.js +125 -119
  70. package/src/InAppMessage/display/in-app-message-to-html.js +72 -69
  71. package/src/InAppMessage/display/modal-utils.js +18 -13
  72. package/src/InAppMessage/in-app-message-factory.js +9 -8
  73. package/src/InAppMessage/in-app-message-manager-factory.js +7 -7
  74. package/src/InAppMessage/in-app-message-manager.js +130 -110
  75. package/src/InAppMessage/log-in-app-message-button-click.js +10 -10
  76. package/src/InAppMessage/log-in-app-message-click.js +9 -9
  77. package/src/InAppMessage/log-in-app-message-html-click.js +10 -10
  78. package/src/InAppMessage/log-in-app-message-impression.js +5 -5
  79. package/src/InAppMessage/models/control-message.js +4 -1
  80. package/src/InAppMessage/models/full-screen-message.js +35 -37
  81. package/src/InAppMessage/models/html-message.js +34 -33
  82. package/src/InAppMessage/models/in-app-message-button.js +23 -16
  83. package/src/InAppMessage/models/in-app-message.js +147 -105
  84. package/src/InAppMessage/models/modal-message.js +34 -36
  85. package/src/InAppMessage/models/slide-up-message.js +25 -27
  86. package/src/InAppMessage/models/templated-in-app-message.js +12 -7
  87. package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
  88. package/src/InAppMessage/types.js +1 -0
  89. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +4 -4
  90. package/src/InAppMessage/ui/show-in-app-message.js +95 -89
  91. package/src/InAppMessage/utils/in-app-message-utils.js +1 -0
  92. package/src/Push/is-push-blocked.js +2 -2
  93. package/src/Push/is-push-permission-granted.js +2 -2
  94. package/src/Push/is-push-supported.js +2 -2
  95. package/src/Push/push-manager-factory.js +20 -20
  96. package/src/Push/push-manager.js +193 -174
  97. package/src/Push/request-push-permission.js +4 -3
  98. package/src/Push/types.js +1 -0
  99. package/src/Push/unregister-push.js +2 -2
  100. package/src/Push/utils/push-utils.js +10 -10
  101. package/src/User/types.js +1 -0
  102. package/src/User/user-manager.js +24 -24
  103. package/src/User/user.js +117 -105
  104. package/src/common/base-feed.js +7 -7
  105. package/src/common/base-provider.js +2 -2
  106. package/src/common/constants.js +6 -0
  107. package/src/common/event-logger.js +6 -6
  108. package/src/common/feed-display.js +95 -85
  109. package/src/common/types.js +1 -0
  110. package/src/l10n/l10n-manager-factory.js +10 -10
  111. package/src/l10n/l10n-manager.js +1 -1
  112. package/src/managers/auth-manager.js +37 -34
  113. package/src/managers/braze-instance.js +209 -193
  114. package/src/managers/device-manager.js +43 -38
  115. package/src/managers/network-manager.js +119 -96
  116. package/src/managers/server-config-manager.js +68 -48
  117. package/src/managers/session-manager.js +52 -45
  118. package/src/managers/storage-manager-factory.js +29 -22
  119. package/src/managers/storage-manager.js +288 -273
  120. package/src/managers/subscription-manager.js +9 -6
  121. package/src/managers/types.js +1 -0
  122. package/src/models/backend-errors.js +5 -5
  123. package/src/models/braze-event.js +14 -8
  124. package/src/models/device.js +10 -18
  125. package/src/models/identifier.js +10 -11
  126. package/src/models/push-token.js +17 -12
  127. package/src/models/request-result.js +4 -4
  128. package/src/models/server-config.js +36 -20
  129. package/src/models/types.js +1 -0
  130. package/src/request-controller.js +176 -174
  131. package/src/triggers/models/custom-event-data.js +6 -6
  132. package/src/triggers/models/custom-event-property-data.js +9 -9
  133. package/src/triggers/models/filter-set.js +9 -9
  134. package/src/triggers/models/filter.js +64 -64
  135. package/src/triggers/models/in-app-message-click-data.js +12 -12
  136. package/src/triggers/models/purchase-data.js +3 -3
  137. package/src/triggers/models/purchase-property-data.js +9 -9
  138. package/src/triggers/models/push-click-data.js +7 -7
  139. package/src/triggers/models/trigger-condition.js +57 -57
  140. package/src/triggers/models/trigger-events.js +2 -2
  141. package/src/triggers/models/trigger.js +42 -42
  142. package/src/triggers/triggers-provider-factory.js +8 -8
  143. package/src/triggers/triggers-provider.js +173 -170
  144. package/src/types.js +1 -0
  145. package/src/ui/js/attach-css.js +3 -3
  146. package/src/ui/js/load-font-awesome.js +2 -2
  147. package/src/util/base-device-parser.js +2 -2
  148. package/src/util/braze-actions.js +20 -20
  149. package/src/util/browser-detector.js +22 -22
  150. package/src/util/client-hints-parser.js +7 -7
  151. package/src/util/code-utils.js +1 -1
  152. package/src/util/color-utils.js +2 -2
  153. package/src/util/component-utils.js +2 -2
  154. package/src/util/deprecation-utils.js +1 -1
  155. package/src/util/device-constants.js +3 -3
  156. package/src/util/dom-utils.js +7 -7
  157. package/src/util/error-utils.js +2 -0
  158. package/src/util/key-codes.js +1 -1
  159. package/src/util/net.js +11 -11
  160. package/src/util/request-header-utils.js +23 -0
  161. package/src/util/string-utils.js +1 -1
  162. package/src/util/user-agent-parser.js +21 -21
  163. package/src/util/validation-utils.js +44 -44
  164. package/src/util/window-utils.js +3 -3
@@ -1,4 +1,4 @@
1
1
  import r from "../../shared-lib/braze-shared-lib.js";
2
2
  export function toggleLogging() {
3
- r.D.toggleLogging();
3
+ r.j.toggleLogging();
4
4
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,15 +1,16 @@
1
1
  import e from "../managers/braze-instance.js";
2
- import { keys as or } from "../util/code-utils.js";
2
+ import { keys as oo } from "../util/code-utils.js";
3
3
  import r from "../../shared-lib/braze-shared-lib.js";
4
+ import { BRAZE_MUST_BE_INITIALIZED_ERROR as P } from "../common/constants.js";
4
5
  export function wipeData() {
5
- if (null == e.l())
6
- throw new Error("Braze must be initialized before calling methods.");
7
- e.l().clearData();
8
- const o = or(r.xt);
9
- for (let e = 0; e < o.length; e++) {
10
- const i = o[e],
11
- t = r.xt[i];
12
- new r.qt(t, r.D).clearData();
6
+ if (null == e.l()) throw new Error(P);
7
+ const o = e.l();
8
+ o && o.clearData();
9
+ const t = oo(r.zt);
10
+ for (let o = 0; o < t.length; o++) {
11
+ const n = t[o],
12
+ s = r.zt[n];
13
+ new r.xt(s, r.j).clearData();
13
14
  }
14
- if (e.rr()) for (const r of e.re()) r.clearData(!0);
15
+ if (e.rr()) for (const o of e.gr()) o.clearData(!0);
15
16
  }
@@ -1,13 +1,13 @@
1
1
  import r from "../../shared-lib/braze-shared-lib.js";
2
2
  import FeatureFlag from "./feature-flag.js";
3
3
  export function newFeatureFlagFromJson(e) {
4
- if (e[FeatureFlag.At.ns] && "boolean" == typeof e[FeatureFlag.At.Fe])
4
+ if (e[FeatureFlag.Tt.ns] && "boolean" == typeof e[FeatureFlag.Tt.Fe])
5
5
  return new FeatureFlag(
6
- e[FeatureFlag.At.ns],
7
- e[FeatureFlag.At.Fe],
8
- e[FeatureFlag.At.we]
6
+ e[FeatureFlag.Tt.ns],
7
+ e[FeatureFlag.Tt.Fe],
8
+ e[FeatureFlag.Tt.we]
9
9
  );
10
- r.D.info(`Unable to create feature flag from ${JSON.stringify(e, null, 2)}`);
10
+ r.j.info(`Unable to create feature flag from ${JSON.stringify(e, null, 2)}`);
11
11
  }
12
12
  export function newFeatureFlagFromSerializedValue(e) {
13
13
  if (e[FeatureFlag.hs.ns] && "boolean" == typeof e[FeatureFlag.hs.Fe])
@@ -16,7 +16,7 @@ export function newFeatureFlagFromSerializedValue(e) {
16
16
  e[FeatureFlag.hs.Fe],
17
17
  e[FeatureFlag.hs.we]
18
18
  );
19
- r.D.info(
19
+ r.j.info(
20
20
  `Unable to deserialize feature flag from ${JSON.stringify(e, null, 2)}`
21
21
  );
22
22
  }
@@ -11,26 +11,26 @@ export default class FeatureFlag {
11
11
  getStringProperty(t) {
12
12
  const r = this.properties[t];
13
13
  return null == r
14
- ? (this.yr(t), null)
15
- : this.Er(r)
14
+ ? (this.Er(t), null)
15
+ : this.Br(r)
16
16
  ? r.value
17
- : (this.Br("string"), null);
17
+ : (this.Ir("string"), null);
18
18
  }
19
19
  getNumberProperty(t) {
20
20
  const r = this.properties[t];
21
21
  return null == r
22
- ? (this.yr(t), null)
23
- : this.Ir(r)
22
+ ? (this.Er(t), null)
23
+ : this.Nr(r)
24
24
  ? r.value
25
- : (this.Br("number"), null);
25
+ : (this.Ir("number"), null);
26
26
  }
27
27
  getBooleanProperty(t) {
28
28
  const r = this.properties[t];
29
29
  return null == r
30
- ? (this.yr(t), null)
31
- : this.Nr(r)
30
+ ? (this.Er(t), null)
31
+ : this.Tr(r)
32
32
  ? r.value
33
- : (this.Br("boolean"), null);
33
+ : (this.Ir("boolean"), null);
34
34
  }
35
35
  ss() {
36
36
  const t = {};
@@ -41,21 +41,21 @@ export default class FeatureFlag {
41
41
  t
42
42
  );
43
43
  }
44
- Br(t) {
45
- r.D.info(`Property is not of type ${t}.`);
46
- }
47
- yr(t) {
48
- r.D.info(`${t} not found in feature flag properties.`);
44
+ Ir(t) {
45
+ r.j.info(`Property is not of type ${t}.`);
49
46
  }
50
47
  Er(t) {
48
+ r.j.info(`${t} not found in feature flag properties.`);
49
+ }
50
+ Br(t) {
51
51
  return "string" === t.type && "string" == typeof t.value;
52
52
  }
53
- Ir(t) {
53
+ Nr(t) {
54
54
  return "number" === t.type && "number" == typeof t.value;
55
55
  }
56
- Nr(t) {
56
+ Tr(t) {
57
57
  return "boolean" === t.type && "boolean" == typeof t.value;
58
58
  }
59
59
  }
60
60
  (FeatureFlag.hs = { ns: "id", Fe: "e", we: "pr" }),
61
- (FeatureFlag.At = { ns: "id", Fe: "enabled", we: "properties" });
61
+ (FeatureFlag.Tt = { ns: "id", Fe: "enabled", we: "properties" });
@@ -6,11 +6,11 @@ const ir = {
6
6
  er: () => (
7
7
  ir.o(),
8
8
  ir.provider ||
9
- ((ir.provider = new er(e.ir(), e.nr(), e.l())), e.ar(ir.provider)),
9
+ ((ir.provider = new er(e.tr(), e.ar(), e.l())), e.dr(ir.provider)),
10
10
  ir.provider
11
11
  ),
12
12
  o: () => {
13
- ir.t || (e.u(ir), (ir.t = !0));
13
+ ir.t || (e.g(ir), (ir.t = !0));
14
14
  },
15
15
  destroy: () => {
16
16
  (ir.provider = null), (ir.t = !1);
@@ -1,45 +1,46 @@
1
1
  import r from "../../shared-lib/braze-shared-lib.js";
2
2
  import y from "../common/base-provider.js";
3
3
  import e from "../managers/braze-instance.js";
4
- import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
5
- import u from "../managers/subscription-manager.js";
6
- import { randomInclusive as tt } from "../util/math.js";
7
- import b from "../util/net.js";
4
+ import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
5
+ import E from "../managers/subscription-manager.js";
6
+ import { randomInclusive as D } from "../util/math.js";
7
+ import C from "../util/net.js";
8
8
  import {
9
9
  newFeatureFlagFromJson as st,
10
10
  newFeatureFlagFromSerializedValue as it
11
11
  } from "./feature-flag-factory.js";
12
+ import T from "../util/request-header-utils.js";
12
13
  export default class er extends y {
13
14
  constructor(t, s, i) {
14
15
  super(),
15
- (this.si = t),
16
- (this.ei = s),
17
- (this.ri = i),
18
- (this.hi = []),
19
- (this.oi = 0),
20
- (this.si = t),
21
- (this.ei = s),
22
- (this.ri = i),
23
- (this.ni = null),
24
- (this.ai = new u()),
25
- (this.fi = 10),
26
- (this.ui = null),
27
- (this.li = null),
28
- e.jt(this.ai);
16
+ (this.wt = t),
17
+ (this.gt = s),
18
+ (this.u = i),
19
+ (this.mi = []),
20
+ (this.pi = 0),
21
+ (this.wt = t),
22
+ (this.gt = s),
23
+ (this.u = i),
24
+ (this.gi = null),
25
+ (this.wi = new E()),
26
+ (this.yi = 10),
27
+ (this.Fi = null),
28
+ (this.ji = null),
29
+ e.jt(this.wi);
29
30
  }
30
- Rs(t) {
31
- if ((!this.si || this.si.ci()) && null != t && t.feature_flags) {
32
- this.hi = [];
31
+ Ts(t) {
32
+ if ((!this.wt || this.wt.bi()) && null != t && t.feature_flags) {
33
+ this.mi = [];
33
34
  for (const s of t.feature_flags) {
34
35
  const t = st(s);
35
- t && this.hi.push(t);
36
+ t && this.mi.push(t);
36
37
  }
37
- (this.oi = new Date().getTime()), this.mi(), this.ai.St(this.hi);
38
+ (this.pi = new Date().getTime()), this.vi(), this.wi.Et(this.mi);
38
39
  }
39
40
  }
40
- pi() {
41
+ Ti() {
41
42
  let t = {};
42
- this.ri && (t = this.ri.I(o.q.di));
43
+ this.u && (t = this.u.v(i.k.Di));
43
44
  const s = {};
44
45
  for (const i in t) {
45
46
  const e = it(t[i]);
@@ -47,84 +48,85 @@ export default class er extends y {
47
48
  }
48
49
  return s;
49
50
  }
50
- Ws(t) {
51
- return this.ai.ut(t);
51
+ hi(t) {
52
+ return this.wi.lt(t);
52
53
  }
53
54
  refreshFeatureFlags(t, s, i = !1, e = !0) {
54
- if (!this.gi(i))
55
+ if (!this.Ri(i))
55
56
  return (
56
- !this.ni &&
57
- this.si &&
58
- (this.ni = this.si.Fi(() => {
57
+ !this.gi &&
58
+ this.wt &&
59
+ (this.gi = this.wt.Ni(() => {
59
60
  this.refreshFeatureFlags(t, s);
60
61
  })),
61
62
  void ("function" == typeof s && s())
62
63
  );
63
- if ((e && this.yi(), !this.ei)) return void ("function" == typeof s && s());
64
- const r = this.ei.Ps({}, !0),
65
- h = this.ei.Bs(r, !1, !0);
64
+ if ((e && this.qi(), !this.gt)) return void ("function" == typeof s && s());
65
+ const r = this.gt.Gs({}, !0),
66
+ h = this.gt.Ks(r, T.Qs.xi);
66
67
  let o = !1;
67
- this.ei.Gs(r, () => {
68
- this.ei
69
- ? b.Hs({
70
- url: `${this.ei.Ks()}/feature_flags/sync`,
68
+ this.gt.Vs(r, () => {
69
+ this.gt
70
+ ? (T.Xs(this.u, T.Qs.xi, new Date().valueOf()),
71
+ C.Ys({
72
+ url: `${this.gt.Zs()}/feature_flags/sync`,
71
73
  headers: h,
72
74
  data: r,
73
- S: i => {
74
- if (!this.ei.Os(r, i, h))
75
+ O: i => {
76
+ if (!this.gt.ti(r, i, h))
75
77
  return (o = !0), void ("function" == typeof s && s());
76
- this.ei.Qs(), this.Rs(i), "function" == typeof t && t();
78
+ this.gt.si(), this.Ts(i), (o = !1), "function" == typeof t && t();
77
79
  },
78
80
  error: t => {
79
- this.ei.Vs(t, "retrieving feature flags"),
81
+ this.gt.ii(t, "retrieving feature flags"),
80
82
  (o = !0),
81
83
  "function" == typeof s && s();
82
84
  },
83
- wi: () => {
84
- if (e && o && !this.li) {
85
- let e = this.ui;
86
- (null == e || e < 1e3 * this.fi) && (e = 1e3 * this.fi),
87
- this.bi(Math.min(3e5, tt(1e3 * this.fi, 3 * e)), t, s, i);
85
+ ei: () => {
86
+ if (e && o && !this.ji) {
87
+ let e = this.Fi;
88
+ (null == e || e < 1e3 * this.yi) && (e = 1e3 * this.yi),
89
+ this.zi(Math.min(3e5, D(1e3 * this.yi, 3 * e)), t, s, i);
88
90
  }
89
91
  }
90
- })
92
+ }))
91
93
  : "function" == typeof s && s();
92
94
  });
93
95
  }
94
- yi() {
95
- null != this.li && (clearTimeout(this.li), (this.li = null));
96
+ qi() {
97
+ null != this.ji && (clearTimeout(this.ji), (this.ji = null));
96
98
  }
97
- bi(t = 1e3 * this.fi, s, i, e) {
98
- this.yi(),
99
- (this.li = window.setTimeout(() => {
99
+ zi(t = 1e3 * this.yi, s, i, e) {
100
+ this.qi(),
101
+ (this.ji = window.setTimeout(() => {
100
102
  this.refreshFeatureFlags(s, i, e);
101
103
  }, t)),
102
- (this.ui = t);
104
+ (this.Fi = t);
103
105
  }
104
- gi(t) {
105
- if (!this.si) return !1;
106
+ Ri(t) {
107
+ if (!this.wt) return !1;
106
108
  if (!t) {
107
- const t = parseFloat(this.si.ji());
109
+ const t = this.wt.Si();
108
110
  let s = !1;
109
111
  if (!isNaN(t)) {
110
- if (-1 === t) return r.D.info("Feature flag refreshes not allowed"), !1;
111
- s = new Date().getTime() >= (this.oi || 0) + 1e3 * t;
112
+ if (-1 === t) return r.j.info("Feature flag refreshes not allowed"), !1;
113
+ s = new Date().getTime() >= (this.pi || 0) + 1e3 * t;
112
114
  }
113
115
  if (!s)
114
116
  return (
115
- r.D.info(`Feature flag refreshes were rate limited to ${t} seconds`),
117
+ r.j.info(`Feature flag refreshes were rate limited to ${t} seconds`),
116
118
  !1
117
119
  );
118
120
  }
119
- return this.si.ci();
121
+ return this.wt.bi();
120
122
  }
121
- mi() {
122
- if (!this.ri) return;
123
+ vi() {
124
+ if (!this.u) return;
123
125
  const t = {};
124
- for (const s of this.hi) {
126
+ for (const s of this.mi) {
125
127
  const i = s.ss();
126
128
  t[s.id] = i;
127
129
  }
128
- this.ri.B(o.q.di, t), this.ri.B(o.q.vi, this.oi);
130
+ this.u.D(i.k.Di, t), this.u.D(i.k.$i, this.pi);
129
131
  }
130
132
  }
@@ -4,9 +4,9 @@ import ir from "./feature-flags-provider-factory.js";
4
4
  export function getAllFeatureFlags() {
5
5
  if (!e.rr()) return;
6
6
  const t = [],
7
- a = e.ir();
8
- if (a && !a.ci()) return r.D.info("Feature flags are not enabled."), t;
9
- const o = ir.er().pi();
7
+ a = e.tr();
8
+ if (a && !a.bi()) return r.j.info("Feature flags are not enabled."), t;
9
+ const o = ir.er().Ti();
10
10
  for (const r in o) t.push(o[r]);
11
11
  return t;
12
12
  }
@@ -4,9 +4,9 @@ import FeatureFlag from "./feature-flag.js";
4
4
  import ir from "./feature-flags-provider-factory.js";
5
5
  export function getFeatureFlag(t) {
6
6
  if (!e.rr()) return;
7
- const a = e.ir();
8
- if (a && !a.ci())
9
- return r.D.info("Feature flags are not enabled."), new FeatureFlag(t);
10
- const o = ir.er().pi();
7
+ const a = e.tr();
8
+ if (a && !a.bi())
9
+ return r.j.info("Feature flags are not enabled."), new FeatureFlag(t);
10
+ const o = ir.er().Ti();
11
11
  return o[t] ? o[t] : new FeatureFlag(t);
12
12
  }
@@ -1,6 +1,9 @@
1
1
  import e from "../managers/braze-instance.js";
2
2
  import ir from "./feature-flags-provider-factory.js";
3
+ import { getAllFeatureFlags } from "./get-all-feature-flags.js";
3
4
  export function subscribeToFeatureFlagsUpdates(r) {
4
5
  if (!e.rr()) return;
5
- return ir.er().Ws(r);
6
+ const t = getAllFeatureFlags();
7
+ t && "function" == typeof r && r(t);
8
+ return ir.er().hi(r);
6
9
  }
@@ -1,18 +1,18 @@
1
1
  import e from "../managers/braze-instance.js";
2
- import ee from "./feed-provider.js";
3
- const re = {
2
+ import re from "./feed-provider.js";
3
+ const ie = {
4
4
  t: !1,
5
5
  provider: null,
6
6
  er: () => (
7
- re.o(),
8
- re.provider || ((re.provider = new ee(e.l(), e.mr())), e.ar(re.provider)),
9
- re.provider
7
+ ie.o(),
8
+ ie.provider || ((ie.provider = new re(e.l(), e.cr())), e.dr(ie.provider)),
9
+ ie.provider
10
10
  ),
11
11
  o: () => {
12
- re.t || (e.u(re), (re.t = !0));
12
+ ie.t || (e.g(ie), (ie.t = !0));
13
13
  },
14
14
  destroy: () => {
15
- (re.provider = null), (re.t = !1);
15
+ (ie.provider = null), (ie.t = !1);
16
16
  }
17
17
  };
18
- export default re;
18
+ export default ie;
@@ -2,78 +2,89 @@ import y from "../common/base-provider.js";
2
2
  import e from "../managers/braze-instance.js";
3
3
  import Feed from "./feed.js";
4
4
  import {
5
- newCardFromFeedJson as et,
6
- newCardFromSerializedValue as S
5
+ newCardFromFeedJson as ht,
6
+ newCardFromSerializedValue as R
7
7
  } from "../Card/util/card-factory.js";
8
8
  import { rehydrateDateAfterJsonization as w } from "../util/date-utils.js";
9
- import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
10
- import u from "../managers/subscription-manager.js";
11
- export default class ee extends y {
9
+ import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
10
+ import E from "../managers/subscription-manager.js";
11
+ export default class re extends y {
12
12
  constructor(t, s) {
13
13
  super(),
14
- (this.h = t),
14
+ (this.u = t),
15
15
  (this.Ci = s),
16
- (this.yt = new u()),
16
+ (this.cards = []),
17
+ (this.Ui = null),
18
+ (this.u = t),
19
+ (this.Ci = s),
20
+ (this.yt = new E()),
17
21
  e.jt(this.yt),
18
- this.zt();
22
+ this.Lt();
19
23
  }
20
- zt() {
21
- const t = this.h.I(o.q.Di) || [],
22
- s = [];
24
+ Lt() {
25
+ let t = [];
26
+ this.u && (t = this.u.v(i.k.ki) || []);
27
+ const s = [];
23
28
  for (let i = 0; i < t.length; i++) {
24
- const e = S(t[i]);
29
+ const e = R(t[i]);
25
30
  null != e && s.push(e);
26
31
  }
27
- (this.Zt = s), (this._i = w(this.h.I(o.q.xi)));
32
+ (this.cards = s), this.u && (this.Ui = w(this.u.v(i.k.Ai)));
28
33
  }
29
- Si(t) {
34
+ Bi(t) {
30
35
  const s = [];
31
- let i = null;
32
- const e = this.h.I(o.q.P) || {},
36
+ let e = null,
33
37
  r = {};
34
- for (let h = 0; h < t.length; h++) {
35
- i = t[h];
36
- const o = et(i);
37
- null != o && (e[o.id] && ((o.viewed = !0), (r[o.id] = !0)), s.push(o));
38
+ this.u && (r = this.u.v(i.k.L) || {});
39
+ const h = {};
40
+ for (let i = 0; i < t.length; i++) {
41
+ e = t[i];
42
+ const o = ht(e);
43
+ if (null != o) {
44
+ const t = o.id;
45
+ t && r[t] && ((o.viewed = !0), (h[t] = !0)), s.push(o);
46
+ }
38
47
  }
39
- this.h.B(o.q.P, r),
40
- (this.Zt = s),
41
- this.Ss(),
42
- (this._i = new Date()),
43
- this.h.B(o.q.xi, this._i);
48
+ (this.cards = s),
49
+ this.Rs(),
50
+ (this.Ui = new Date()),
51
+ this.u && (this.u.D(i.k.L, h), this.u.D(i.k.Ai, this.Ui));
44
52
  }
45
- Ss() {
53
+ Rs() {
54
+ if (!this.u) return;
46
55
  const t = [];
47
- for (let s = 0; s < this.Zt.length; s++) t.push(this.Zt[s].ss());
48
- this.h.B(o.q.Di, t);
56
+ for (let s = 0; s < this.cards.length; s++) t.push(this.cards[s].ss());
57
+ this.u.D(i.k.ki, t);
49
58
  }
50
- Rs(t) {
59
+ Ts(t) {
51
60
  null != t &&
52
61
  t.feed &&
53
- (this.zt(),
54
- this.Si(t.feed),
55
- this.yt.St(new Feed(this.Zt.slice(), this._i)));
62
+ (this.Lt(),
63
+ this.Bi(t.feed),
64
+ this.yt.Et(new Feed(this.cards.slice(), this.Ui)));
56
65
  }
57
- Ti() {
58
- this.zt();
66
+ Ei() {
67
+ this.Lt();
59
68
  const t = [],
60
69
  s = new Date();
61
- for (let i = 0; i < this.Zt.length; i++)
62
- (null == this.Zt[i].expiresAt || this.Zt[i].expiresAt >= s) &&
63
- t.push(this.Zt[i]);
64
- return new Feed(t, this._i);
70
+ for (let i = 0; i < this.cards.length; i++) {
71
+ const e = this.cards[i].expiresAt;
72
+ let r = !0;
73
+ null != e && (r = e >= s), r && t.push(this.cards[i]);
74
+ }
75
+ return new Feed(t, this.Ui);
65
76
  }
66
- Is() {
67
- this.Ci.requestFeedRefresh();
77
+ Es() {
78
+ this.Ci && this.Ci.requestFeedRefresh();
68
79
  }
69
- Ws(t) {
70
- return this.yt.ut(t);
80
+ hi(t) {
81
+ return this.yt.lt(t);
71
82
  }
72
83
  clearData(t) {
73
84
  null == t && (t = !1),
74
- (this.Zt = []),
75
- (this._i = null),
76
- t && (this.h.Xs(o.q.Di), this.h.Xs(o.q.xi)),
77
- this.yt.St(new Feed(this.Zt.slice(), this._i));
85
+ (this.cards = []),
86
+ (this.Ui = null),
87
+ t && this.u && (this.u.ri(i.k.ki), this.u.ri(i.k.Ai)),
88
+ this.yt.Et(new Feed(this.cards.slice(), this.Ui));
78
89
  }
79
90
  }
package/src/Feed/feed.js CHANGED
@@ -14,7 +14,7 @@ export default class Feed extends x {
14
14
  sr() {
15
15
  requestFeedRefresh();
16
16
  }
17
- dr() {
17
+ ur() {
18
18
  return !1;
19
19
  }
20
20
  }
@@ -1,5 +1,5 @@
1
1
  import e from "../managers/braze-instance.js";
2
- import re from "./feed-provider-factory.js";
2
+ import ie from "./feed-provider-factory.js";
3
3
  export function getCachedFeed() {
4
- if (e.rr()) return re.er().Ti();
4
+ if (e.rr()) return ie.er().Ei();
5
5
  }
@@ -1,5 +1,7 @@
1
1
  import e from "../managers/braze-instance.js";
2
2
  import r from "../../shared-lib/braze-shared-lib.js";
3
3
  export function logFeedDisplayed() {
4
- if (e.rr()) return e.nr().Fr(r.Ar.qr).S;
4
+ if (!e.rr()) return;
5
+ const i = e.ar();
6
+ return i ? i.qr(r.Cr.Ar).O : void 0;
5
7
  }
@@ -1,5 +1,5 @@
1
1
  import e from "../managers/braze-instance.js";
2
- import re from "./feed-provider-factory.js";
2
+ import ie from "./feed-provider-factory.js";
3
3
  export function requestFeedRefresh() {
4
- if (e.rr()) return re.er().Is();
4
+ if (e.rr()) return ie.er().Es();
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import e from "../managers/braze-instance.js";
2
- import re from "./feed-provider-factory.js";
2
+ import ie from "./feed-provider-factory.js";
3
3
  export function subscribeToFeedUpdates(r) {
4
- if (e.rr()) return re.er().Ws(r);
4
+ if (e.rr()) return ie.er().hi(r);
5
5
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,7 @@
1
1
  import e from "../../managers/braze-instance.js";
2
- import { destroyFeedHtml as z } from "../../common/feed-display.js";
2
+ import { destroyFeedHtml as k } from "../../common/feed-display.js";
3
3
  export function destroyFeed() {
4
4
  if (!e.rr()) return;
5
5
  const o = document.querySelectorAll(".ab-feed");
6
- for (let e = 0; e < o.length; e++) z(o[e]);
6
+ for (let e = 0; e < o.length; e++) k(o[e]);
7
7
  }