@braze/web-sdk 5.0.1 → 5.1.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 (158) hide show
  1. package/README.md +1 -1
  2. package/index.d.ts +10 -5
  3. package/package.json +1 -1
  4. package/shared-lib/encoding-utils.js +3 -3
  5. package/shared-lib/event-types.js +29 -29
  6. package/shared-lib/guid.js +3 -3
  7. package/shared-lib/index.js +6 -0
  8. package/shared-lib/indexed-db-adapter.js +70 -70
  9. package/shared-lib/logger.js +18 -18
  10. package/shared-lib/supported-options.js +21 -21
  11. package/src/Card/card-manager.js +43 -45
  12. package/src/Card/display/card-display.js +60 -60
  13. package/src/Card/log-card-click.js +4 -4
  14. package/src/Card/log-card-dismissal.js +2 -3
  15. package/src/Card/log-card-impressions.js +7 -7
  16. package/src/Card/models/captioned-image.js +21 -21
  17. package/src/Card/models/card.js +73 -73
  18. package/src/Card/models/classic-card.js +21 -21
  19. package/src/Card/models/control-card.js +11 -11
  20. package/src/Card/models/image-only.js +19 -19
  21. package/src/Card/util/card-factory.js +68 -68
  22. package/src/ContentCards/content-cards-provider-factory.js +3 -3
  23. package/src/ContentCards/content-cards-provider.js +255 -245
  24. package/src/ContentCards/content-cards.js +2 -2
  25. package/src/ContentCards/get-cached-content-cards.js +1 -1
  26. package/src/ContentCards/request-content-cards-refresh.js +1 -1
  27. package/src/ContentCards/subscribe-to-content-cards-updates.js +6 -6
  28. package/src/ContentCards/ui/hide-content-cards.js +1 -1
  29. package/src/ContentCards/ui/show-content-cards.js +24 -24
  30. package/src/ContentCards/ui/toggle-content-cards.js +1 -1
  31. package/src/Core/add-sdk-metadata.js +21 -19
  32. package/src/Core/change-user.js +10 -10
  33. package/src/Core/destroy.js +2 -2
  34. package/src/Core/disable-sdk.js +11 -11
  35. package/src/Core/enable-sdk.js +7 -7
  36. package/src/Core/get-device-id.js +6 -6
  37. package/src/Core/get-user.js +1 -1
  38. package/src/Core/handle-braze-action.js +41 -41
  39. package/src/Core/is-disabled.js +2 -2
  40. package/src/Core/log-custom-event.js +15 -15
  41. package/src/Core/log-purchase.js +31 -37
  42. package/src/Core/open-session.js +12 -12
  43. package/src/Core/remove-all-subscriptions.js +1 -1
  44. package/src/Core/remove-subscription.js +1 -1
  45. package/src/Core/request-immediate-data-flush.js +1 -1
  46. package/src/Core/set-logger.js +2 -2
  47. package/src/Core/set-sdk-authentication-signature.js +3 -3
  48. package/src/Core/subscribe-to-sdk-authentication-failures.js +6 -4
  49. package/src/Core/toggle-logging.js +2 -2
  50. package/src/Core/wipe-data.js +9 -9
  51. package/src/FeatureFlags/feature-flag-factory.js +12 -12
  52. package/src/FeatureFlags/feature-flag.js +10 -10
  53. package/src/FeatureFlags/feature-flags-provider-factory.js +3 -2
  54. package/src/FeatureFlags/feature-flags-provider.js +108 -80
  55. package/src/FeatureFlags/get-all-feature-flags.js +5 -5
  56. package/src/FeatureFlags/get-feature-flag.js +6 -6
  57. package/src/FeatureFlags/log-feature-flag-impression.js +15 -13
  58. package/src/FeatureFlags/refresh-feature-flags.js +1 -1
  59. package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +7 -4
  60. package/src/Feed/feed-provider-factory.js +2 -2
  61. package/src/Feed/feed-provider.js +44 -44
  62. package/src/Feed/feed.js +1 -1
  63. package/src/Feed/get-cached-feed.js +1 -1
  64. package/src/Feed/log-feed-displayed.js +4 -4
  65. package/src/Feed/request-feed-refresh.js +1 -1
  66. package/src/Feed/subscribe-to-feed-updates.js +1 -1
  67. package/src/Feed/ui/hide-feed.js +1 -1
  68. package/src/Feed/ui/show-feed.js +28 -28
  69. package/src/Feed/ui/toggle-feed.js +1 -1
  70. package/src/InAppMessage/defer-in-app-message.js +5 -5
  71. package/src/InAppMessage/display/html-message-to-html.js +54 -54
  72. package/src/InAppMessage/display/in-app-message-to-html.js +79 -79
  73. package/src/InAppMessage/display/modal-utils.js +8 -8
  74. package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
  75. package/src/InAppMessage/in-app-message-factory.js +49 -49
  76. package/src/InAppMessage/in-app-message-manager-factory.js +1 -1
  77. package/src/InAppMessage/in-app-message-manager.js +143 -138
  78. package/src/InAppMessage/log-in-app-message-button-click.js +12 -12
  79. package/src/InAppMessage/log-in-app-message-click.js +9 -9
  80. package/src/InAppMessage/log-in-app-message-html-click.js +12 -12
  81. package/src/InAppMessage/log-in-app-message-impression.js +6 -6
  82. package/src/InAppMessage/models/full-screen-message.js +33 -33
  83. package/src/InAppMessage/models/html-message.js +20 -20
  84. package/src/InAppMessage/models/in-app-message-button.js +6 -6
  85. package/src/InAppMessage/models/in-app-message.js +99 -99
  86. package/src/InAppMessage/models/modal-message.js +32 -32
  87. package/src/InAppMessage/models/slide-up-message.js +28 -28
  88. package/src/InAppMessage/models/templated-in-app-message.js +8 -8
  89. package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
  90. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +4 -4
  91. package/src/InAppMessage/ui/show-in-app-message.js +81 -81
  92. package/src/Push/is-push-blocked.js +1 -1
  93. package/src/Push/is-push-permission-granted.js +1 -1
  94. package/src/Push/is-push-supported.js +1 -1
  95. package/src/Push/push-manager-factory.js +5 -5
  96. package/src/Push/push-manager.js +176 -173
  97. package/src/Push/request-push-permission.js +1 -1
  98. package/src/Push/unregister-push.js +1 -1
  99. package/src/Push/utils/push-utils.js +4 -4
  100. package/src/User/user-manager.js +29 -29
  101. package/src/User/user.js +72 -74
  102. package/src/common/base-feed.js +7 -7
  103. package/src/common/base-provider.js +1 -1
  104. package/src/common/constants.js +2 -0
  105. package/src/common/event-logger.js +21 -18
  106. package/src/common/feed-display.js +44 -44
  107. package/src/l10n/l10n-manager-factory.js +3 -3
  108. package/src/l10n/l10n-manager.js +7 -7
  109. package/src/managers/auth-manager.js +32 -32
  110. package/src/managers/braze-instance.js +188 -190
  111. package/src/managers/device-manager.js +28 -28
  112. package/src/managers/network-manager.js +189 -138
  113. package/src/managers/server-config-manager.js +69 -53
  114. package/src/managers/session-manager.js +34 -30
  115. package/src/managers/storage-manager-factory.js +16 -16
  116. package/src/managers/storage-manager.js +178 -163
  117. package/src/managers/subscription-manager.js +12 -12
  118. package/src/models/backend-errors.js +5 -5
  119. package/src/models/braze-event.js +4 -4
  120. package/src/models/device.js +2 -2
  121. package/src/models/identifier.js +34 -14
  122. package/src/models/push-token.js +8 -8
  123. package/src/models/request-result.js +3 -3
  124. package/src/models/server-config.js +32 -23
  125. package/src/request-controller.js +186 -179
  126. package/src/triggers/models/custom-event-data.js +7 -7
  127. package/src/triggers/models/custom-event-property-data.js +10 -10
  128. package/src/triggers/models/filter-set.js +13 -13
  129. package/src/triggers/models/filter.js +45 -45
  130. package/src/triggers/models/in-app-message-click-data.js +12 -12
  131. package/src/triggers/models/purchase-data.js +2 -2
  132. package/src/triggers/models/purchase-property-data.js +10 -10
  133. package/src/triggers/models/push-click-data.js +7 -7
  134. package/src/triggers/models/trigger-condition.js +57 -59
  135. package/src/triggers/models/trigger-events.js +4 -4
  136. package/src/triggers/models/trigger.js +38 -38
  137. package/src/triggers/triggers-provider-factory.js +4 -4
  138. package/src/triggers/triggers-provider.js +127 -130
  139. package/src/ui/js/attach-css.js +2 -2
  140. package/src/ui/js/iam-css.js +1 -1
  141. package/src/ui/js/load-font-awesome.js +1 -1
  142. package/src/util/base-device-parser.js +3 -3
  143. package/src/util/braze-actions.js +35 -35
  144. package/src/util/browser-detector.js +21 -21
  145. package/src/util/client-hints-parser.js +8 -8
  146. package/src/util/code-utils.js +2 -2
  147. package/src/util/component-utils.js +1 -1
  148. package/src/util/deprecation-utils.js +4 -4
  149. package/src/util/device-constants.js +1 -1
  150. package/src/util/dom-utils.js +18 -18
  151. package/src/util/key-codes.js +1 -1
  152. package/src/util/net.js +18 -18
  153. package/src/util/request-header-utils.js +39 -37
  154. package/src/util/string-utils.js +10 -10
  155. package/src/util/user-agent-parser.js +18 -18
  156. package/src/util/validation-utils.js +37 -39
  157. package/src/util/window-utils.js +3 -3
  158. package/shared-lib/braze-shared-lib.js +0 -8
@@ -1,6 +1,6 @@
1
1
  import e from "../managers/braze-instance.js";
2
2
  export function requestImmediateDataFlush(t) {
3
- if (!e.rr()) return;
3
+ if (!e.X()) return;
4
4
  const r = e.cr();
5
5
  r && r.requestImmediateDataFlush(t);
6
6
  }
@@ -1,4 +1,4 @@
1
- import r from "../../shared-lib/braze-shared-lib.js";
1
+ import { logger as r } from "../../shared-lib/index.js";
2
2
  export function setLogger(e) {
3
- r.j.setLogger(e);
3
+ r.setLogger(e);
4
4
  }
@@ -1,8 +1,8 @@
1
1
  import e from "../managers/braze-instance.js";
2
- import { validateStandardString as H } from "../util/validation-utils.js";
2
+ import { validateStandardString as P } from "../util/validation-utils.js";
3
3
  export function setSdkAuthenticationSignature(t) {
4
- if (!e.rr()) return !1;
5
- if ("" === t || !H(t, "set signature", "signature", !1)) return !1;
4
+ if (!e.X()) return !1;
5
+ if ("" === t || !P(t, "set signature", "signature", !1)) return !1;
6
6
  const r = e.Sr();
7
7
  return !!r && (r.setSdkAuthenticationSignature(t), !0);
8
8
  }
@@ -1,6 +1,8 @@
1
1
  import e from "../managers/braze-instance.js";
2
- export function subscribeToSdkAuthenticationFailures(r) {
3
- if (!e.rr()) return;
4
- const n = e.Sr();
5
- return n ? n.subscribeToSdkAuthenticationFailures(r) : void 0;
2
+ export function subscribeToSdkAuthenticationFailures(i) {
3
+ var r;
4
+ if (e.X())
5
+ return null === (r = e.Sr()) || void 0 === r
6
+ ? void 0
7
+ : r.subscribeToSdkAuthenticationFailures(i);
6
8
  }
@@ -1,4 +1,4 @@
1
- import r from "../../shared-lib/braze-shared-lib.js";
1
+ import { logger as r } from "../../shared-lib/index.js";
2
2
  export function toggleLogging() {
3
- r.j.toggleLogging();
3
+ r.toggleLogging();
4
4
  }
@@ -1,16 +1,16 @@
1
1
  import e from "../managers/braze-instance.js";
2
- import { keys as oo } from "../util/code-utils.js";
3
- import r from "../../shared-lib/braze-shared-lib.js";
4
- import { BRAZE_MUST_BE_INITIALIZED_ERROR as P } from "../common/constants.js";
2
+ import { keys as to } from "../util/code-utils.js";
3
+ import { logger as r, IndexedDBAdapter as A } from "../../shared-lib/index.js";
4
+ import { BRAZE_MUST_BE_INITIALIZED_ERROR as _ } from "../common/constants.js";
5
5
  export function wipeData() {
6
- if (null == e.l()) return void r.j.warn(P);
7
6
  const o = e.l();
8
- o && o.clearData();
9
- const t = oo(r.ts);
7
+ if (null == o) return void r.warn(_);
8
+ o.clearData();
9
+ const t = to(A.Yt);
10
10
  for (let o = 0; o < t.length; o++) {
11
11
  const n = t[o],
12
- s = r.ts[n];
13
- new r.es(s, r.j).clearData();
12
+ i = A.Yt[n];
13
+ new A(i, r).clearData();
14
14
  }
15
- if (e.rr()) for (const o of e.gr()) o.clearData(!0);
15
+ if (e.X()) for (const o of e.gr()) o.clearData(!0);
16
16
  }
@@ -1,24 +1,24 @@
1
- import r from "../../shared-lib/braze-shared-lib.js";
1
+ import { logger as r } from "../../shared-lib/index.js";
2
2
  import FeatureFlag from "./feature-flag.js";
3
3
  export function newFeatureFlagFromJson(e) {
4
- if (e[FeatureFlag.Rt.rt] && "boolean" == typeof e[FeatureFlag.Rt.Fe])
4
+ if (e[FeatureFlag.Rt.ht] && "boolean" == typeof e[FeatureFlag.Rt.le])
5
5
  return new FeatureFlag(
6
- e[FeatureFlag.Rt.rt],
6
+ e[FeatureFlag.Rt.ht],
7
+ e[FeatureFlag.Rt.le],
8
+ e[FeatureFlag.Rt.pe],
7
9
  e[FeatureFlag.Rt.Fe],
8
- e[FeatureFlag.Rt.we],
9
- e[FeatureFlag.Rt.ze],
10
10
  );
11
- r.j.info(`Unable to create feature flag from ${JSON.stringify(e, null, 2)}`);
11
+ r.info(`Unable to create feature flag from ${JSON.stringify(e, null, 2)}`);
12
12
  }
13
13
  export function newFeatureFlagFromSerializedValue(e) {
14
- if (e[FeatureFlag.it.rt] && "boolean" == typeof e[FeatureFlag.it.Fe])
14
+ if (e[FeatureFlag.tt.ht] && "boolean" == typeof e[FeatureFlag.tt.le])
15
15
  return new FeatureFlag(
16
- e[FeatureFlag.it.rt],
17
- e[FeatureFlag.it.Fe],
18
- e[FeatureFlag.it.we],
19
- e[FeatureFlag.it.ze],
16
+ e[FeatureFlag.tt.ht],
17
+ e[FeatureFlag.tt.le],
18
+ e[FeatureFlag.tt.pe],
19
+ e[FeatureFlag.tt.Fe],
20
20
  );
21
- r.j.info(
21
+ r.info(
22
22
  `Unable to deserialize feature flag from ${JSON.stringify(e, null, 2)}`,
23
23
  );
24
24
  }
@@ -1,4 +1,4 @@
1
- import r from "../../shared-lib/braze-shared-lib.js";
1
+ import { logger as r } from "../../shared-lib/index.js";
2
2
  export default class FeatureFlag {
3
3
  constructor(t, r = !1, e = {}, s) {
4
4
  (this.id = t),
@@ -34,21 +34,21 @@ export default class FeatureFlag {
34
34
  ? r.value
35
35
  : (this.Nr("boolean"), null);
36
36
  }
37
- tt() {
37
+ Y() {
38
38
  const t = {};
39
39
  return (
40
- (t[FeatureFlag.it.rt] = this.id),
41
- (t[FeatureFlag.it.Fe] = this.enabled),
42
- (t[FeatureFlag.it.we] = this.properties),
43
- (t[FeatureFlag.it.ze] = this.trackingString),
40
+ (t[FeatureFlag.tt.ht] = this.id),
41
+ (t[FeatureFlag.tt.le] = this.enabled),
42
+ (t[FeatureFlag.tt.pe] = this.properties),
43
+ (t[FeatureFlag.tt.Fe] = this.trackingString),
44
44
  t
45
45
  );
46
46
  }
47
47
  Nr(t) {
48
- r.j.info(`Property is not of type ${t}.`);
48
+ r.info(`Property is not of type ${t}.`);
49
49
  }
50
50
  Er(t) {
51
- r.j.info(`${t} not found in feature flag properties.`);
51
+ r.info(`${t} not found in feature flag properties.`);
52
52
  }
53
53
  Ir(t) {
54
54
  return "string" === t.type && "string" == typeof t.value;
@@ -60,5 +60,5 @@ export default class FeatureFlag {
60
60
  return "boolean" === t.type && "boolean" == typeof t.value;
61
61
  }
62
62
  }
63
- (FeatureFlag.it = { rt: "id", Fe: "e", we: "pr", ze: "fts" }),
64
- (FeatureFlag.Rt = { rt: "id", Fe: "enabled", we: "properties", ze: "fts" });
63
+ (FeatureFlag.tt = { ht: "id", le: "e", pe: "pr", Fe: "fts" }),
64
+ (FeatureFlag.Rt = { ht: "id", le: "enabled", pe: "properties", Fe: "fts" });
@@ -3,10 +3,11 @@ import er from "./feature-flags-provider.js";
3
3
  const ir = {
4
4
  t: !1,
5
5
  provider: null,
6
- er: () => (
6
+ rr: () => (
7
7
  ir.o(),
8
8
  ir.provider ||
9
- ((ir.provider = new er(e.tr(), e.ar(), e.l())), e.dr(ir.provider)),
9
+ ((ir.provider = new er(e.ir(), e.nr(), e.l(), e.zr())),
10
+ e.ar(ir.provider)),
10
11
  ir.provider
11
12
  ),
12
13
  o: () => {
@@ -1,46 +1,53 @@
1
- import r from "../../shared-lib/braze-shared-lib.js";
1
+ import { logger as r } from "../../shared-lib/index.js";
2
2
  import y from "../common/base-provider.js";
3
3
  import e from "../managers/braze-instance.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";
4
+ import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
5
+ import T from "../managers/subscription-manager.js";
6
+ import { randomInclusive as k } from "../util/math.js";
7
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
+ import S from "../util/request-header-utils.js";
13
13
  export default class er extends y {
14
- constructor(t, s, i) {
14
+ constructor(t, s, i, r) {
15
15
  super(),
16
16
  (this.yt = t),
17
- (this.$t = s),
17
+ (this.qt = s),
18
18
  (this.u = i),
19
- (this.gi = []),
20
- (this.pi = 0),
19
+ (this.di = r),
20
+ (this.mi = []),
21
+ (this.gi = 0),
21
22
  (this.yt = t),
22
- (this.$t = s),
23
+ (this.qt = s),
23
24
  (this.u = i),
25
+ (this.di = r),
24
26
  (this.Fi = null),
25
- (this.wi = new E()),
26
- (this.ji = 10),
27
- (this.bi = null),
28
- (this.vi = null),
29
- e.Ht(this.wi);
27
+ (this.vi = new T()),
28
+ (this.pi = 10),
29
+ (this.wi = null),
30
+ (this.ji = null),
31
+ e.$t(this.vi);
30
32
  }
31
- Ss(t) {
32
- if ((!this.yt || this.yt.yi()) && null != t && t.feature_flags) {
33
- this.gi = [];
33
+ Rs(t) {
34
+ var s;
35
+ if (
36
+ (null === (s = this.yt) || void 0 === s ? void 0 : s.yi()) &&
37
+ null != t &&
38
+ t.feature_flags
39
+ ) {
40
+ this.mi = [];
34
41
  for (const s of t.feature_flags) {
35
42
  const t = st(s);
36
- t && this.gi.push(t);
43
+ t && this.mi.push(t);
37
44
  }
38
- (this.pi = new Date().getTime()), this.Ti(), this.wi.Dt(this.gi);
45
+ (this.gi = new Date().getTime()), this.bi(), this.vi.Dt(this.mi);
39
46
  }
40
47
  }
41
- Di() {
48
+ Ci() {
42
49
  let t = {};
43
- this.u && (t = this.u.v(i.k.Ri));
50
+ this.u && (t = this.u.j(o.C.Ti));
44
51
  const s = {};
45
52
  for (const i in t) {
46
53
  const e = it(t[i]);
@@ -48,98 +55,119 @@ export default class er extends y {
48
55
  }
49
56
  return s;
50
57
  }
51
- Ni() {
58
+ Di() {
52
59
  var t;
53
- return (null === (t = this.u) || void 0 === t ? void 0 : t.v(i.k.qi)) || {};
60
+ return (null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.Ii)) || {};
54
61
  }
55
- xi(t) {
56
- this.u && this.u.D(i.k.qi, t);
62
+ Ri(t) {
63
+ this.u && this.u.k(o.C.Ii, t);
57
64
  }
58
- ri(t) {
59
- return this.wi.It(t);
65
+ ei(t) {
66
+ return this.vi.It(t);
60
67
  }
61
68
  refreshFeatureFlags(t, s, i = !1, e = !0) {
62
69
  const r = () => {
63
- "function" == typeof s && s(), this.wi.Dt(this.gi);
70
+ "function" == typeof s && s(), this.vi.Dt(this.mi);
64
71
  };
65
- if (!this.zi(i))
72
+ if (!this.Si(i))
66
73
  return (
67
74
  !this.Fi &&
68
75
  this.yt &&
69
- (this.Fi = this.yt.Ci(() => {
76
+ (this.Fi = this.yt.xi(() => {
70
77
  this.refreshFeatureFlags(t, s);
71
78
  })),
72
79
  void r()
73
80
  );
74
- if ((e && this.Ii(), !this.$t)) return void r();
75
- const h = this.$t.Bs({}, !0),
76
- a = this.$t.Hs(h, T.Os.Si);
77
- let o = !1;
78
- this.$t.Qs(h, () => {
79
- this.$t
80
- ? (T.Ws(this.u, T.Os.Si, new Date().valueOf()),
81
- C.Xs({
82
- url: `${this.$t.Ys()}/feature_flags/sync`,
83
- headers: a,
84
- data: h,
85
- O: (s) => {
86
- if (!this.$t.Zs(h, s, a)) return (o = !0), void r();
87
- this.$t.ti(),
88
- this.Ss(s),
89
- (o = !1),
90
- T.si(this.u, T.Os.Si, 1),
91
- "function" == typeof t && t();
92
- },
93
- error: (t) => {
94
- this.$t.ii(t, "retrieving feature flags"), (o = !0), r();
95
- },
96
- ei: () => {
97
- if (e && o && !this.vi) {
98
- T.hi(this.u, T.Os.Si);
99
- let e = this.bi;
100
- (null == e || e < 1e3 * this.ji) && (e = 1e3 * this.ji),
101
- this.$i(Math.min(3e5, D(1e3 * this.ji, 3 * e)), t, s, i);
102
- }
103
- },
104
- }))
105
- : r();
106
- });
81
+ if ((e && this.Ni(), !this.qt)) return void r();
82
+ const h = this.qt.Ps({}, !0),
83
+ o = this.qt._s(h, S.Gs.qi);
84
+ let a = !1;
85
+ this.qt.Hs(
86
+ h,
87
+ () => {
88
+ this.qt
89
+ ? (S.Os(this.u, S.Gs.qi, new Date().valueOf()),
90
+ C.Qs({
91
+ url: `${this.qt.Vs()}/feature_flags/sync`,
92
+ headers: o,
93
+ data: h,
94
+ L: (s) => {
95
+ if (!this.qt.Ws(h, s, o)) return (a = !0), void r();
96
+ this.qt.Xs(),
97
+ this.Rs(s),
98
+ (a = !1),
99
+ S.Ys(this.u, S.Gs.qi, 1),
100
+ "function" == typeof t && t();
101
+ },
102
+ error: (t) => {
103
+ this.qt.Zs(t, "retrieving feature flags"), (a = !0), r();
104
+ },
105
+ ti: () => {
106
+ if (e && a && !this.ji) {
107
+ S.si(this.u, S.Gs.qi);
108
+ let e = this.wi;
109
+ (null == e || e < 1e3 * this.pi) && (e = 1e3 * this.pi),
110
+ this.$i(Math.min(3e5, k(1e3 * this.pi, 3 * e)), t, s, i);
111
+ }
112
+ },
113
+ }))
114
+ : r();
115
+ },
116
+ S.ii.qi,
117
+ );
107
118
  }
108
- Ii() {
109
- null != this.vi && (clearTimeout(this.vi), (this.vi = null));
119
+ Ni() {
120
+ null != this.ji && (clearTimeout(this.ji), (this.ji = null));
110
121
  }
111
- $i(t = 1e3 * this.ji, s, i, e = !1) {
112
- this.Ii(),
113
- (this.vi = window.setTimeout(() => {
122
+ $i(t = 1e3 * this.pi, s, i, e = !1) {
123
+ this.Ni(),
124
+ (this.ji = window.setTimeout(() => {
114
125
  this.refreshFeatureFlags(s, i, e);
115
126
  }, t)),
116
- (this.bi = t);
127
+ (this.wi = t);
117
128
  }
118
- zi(t) {
129
+ Si(t) {
119
130
  if (!this.yt) return !1;
120
131
  if (!t) {
121
- const t = this.yt.Mi();
132
+ const t = this.yt.zi();
122
133
  if (null == t) return !1;
123
134
  let s = !1;
124
135
  if (!isNaN(t)) {
125
- if (-1 === t) return r.j.info("Feature flag refreshes not allowed"), !1;
126
- s = new Date().getTime() >= (this.pi || 0) + 1e3 * t;
136
+ if (-1 === t) return r.info("Feature flag refreshes not allowed"), !1;
137
+ s = new Date().getTime() >= (this.gi || 0) + 1e3 * t;
127
138
  }
128
139
  if (!s)
129
140
  return (
130
- r.j.info(`Feature flag refreshes were rate limited to ${t} seconds`),
131
- !1
141
+ r.info(`Feature flag refreshes were rate limited to ${t} seconds`), !1
132
142
  );
133
143
  }
134
144
  return this.yt.yi();
135
145
  }
136
- Ti() {
146
+ Mi() {
147
+ var t;
148
+ return (
149
+ (null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.Ui)) || null
150
+ );
151
+ }
152
+ _i() {
153
+ var t, s;
154
+ null === (t = this.u) ||
155
+ void 0 === t ||
156
+ t.k(o.C.Ui, null === (s = this.di) || void 0 === s ? void 0 : s.ki());
157
+ }
158
+ Ai() {
159
+ var t;
160
+ const s = null === (t = this.di) || void 0 === t ? void 0 : t.ki(),
161
+ i = this.Mi();
162
+ return null == i || s === i;
163
+ }
164
+ bi() {
137
165
  if (!this.u) return;
138
166
  const t = {};
139
- for (const s of this.gi) {
140
- const i = s.tt();
167
+ for (const s of this.mi) {
168
+ const i = s.Y();
141
169
  t[s.id] = i;
142
170
  }
143
- this.u.D(i.k.Ri, t), this.u.D(i.k.Ui, this.pi);
171
+ this.u.k(o.C.Ti, t), this.u.k(o.C.Bi, this.gi), this._i();
144
172
  }
145
173
  }
@@ -1,12 +1,12 @@
1
- import r from "../../shared-lib/braze-shared-lib.js";
1
+ import { logger as r } from "../../shared-lib/index.js";
2
2
  import e from "../managers/braze-instance.js";
3
3
  import ir from "./feature-flags-provider-factory.js";
4
4
  export function getAllFeatureFlags() {
5
- if (!e.rr()) return;
5
+ if (!e.X()) return;
6
6
  const t = [],
7
- a = e.tr();
8
- if (a && !a.yi()) return r.j.info("Feature flags are not enabled."), t;
9
- const o = ir.er().Di();
7
+ n = e.ir();
8
+ if (n && !n.yi()) return r.info("Feature flags are not enabled."), t;
9
+ const o = ir.rr().Ci();
10
10
  for (const r in o) t.push(o[r]);
11
11
  return t;
12
12
  }
@@ -1,10 +1,10 @@
1
- import r from "../../shared-lib/braze-shared-lib.js";
1
+ import { logger as r } from "../../shared-lib/index.js";
2
2
  import e from "../managers/braze-instance.js";
3
3
  import ir from "./feature-flags-provider-factory.js";
4
4
  export function getFeatureFlag(t) {
5
- if (!e.rr()) return;
6
- const a = e.tr();
7
- if (a && !a.yi()) return r.j.info("Feature flags are not enabled."), null;
8
- const n = ir.er().Di();
9
- return n[t] ? n[t] : null;
5
+ if (!e.X()) return;
6
+ const n = e.ir();
7
+ if (n && !n.yi()) return r.info("Feature flags are not enabled."), null;
8
+ const a = ir.rr().Ci();
9
+ return a[t] ? a[t] : null;
10
10
  }
@@ -1,23 +1,25 @@
1
- import r from "../../shared-lib/braze-shared-lib.js";
1
+ import { logger as r, EventTypes as i } from "../../shared-lib/index.js";
2
2
  import s from "../common/event-logger.js";
3
3
  import e from "../managers/braze-instance.js";
4
4
  import ir from "./feature-flags-provider-factory.js";
5
5
  export function logFeatureFlagImpression(t) {
6
- if (!e.rr()) return;
6
+ if (!e.X()) return;
7
7
  if (!t) return !1;
8
- const o = ir.er().Di();
9
- if (!o[t]) return !1;
10
- const n = o[t].trackingString;
11
- if (!n)
8
+ const o =
9
+ "Not logging a feature flag impression. The feature flag was not part of any matching experiment.",
10
+ n = ir.rr().Ci();
11
+ if (!n[t]) return r.info(o), !1;
12
+ const a = n[t].trackingString;
13
+ if (!a) return r.info(o), !1;
14
+ const f = ir.rr().Di();
15
+ if (f[a])
12
16
  return (
13
- r.j.info(
14
- "Not logging a feature flag impression. The feature flag was not part of any matching campaign.",
17
+ r.info(
18
+ "Not logging another feature flag impression. This ID was already logged this session.",
15
19
  ),
16
20
  !1
17
21
  );
18
- const a = ir.er().Ni();
19
- if (a[n]) return !1;
20
- (a[n] = !0), ir.er().xi(a);
21
- const i = { fid: t, fts: n };
22
- return s.N(r.q.Fr, i).O;
22
+ (f[a] = !0), ir.rr().Ri(f);
23
+ const g = { fid: t, fts: a };
24
+ return s.q(i.Fr, g).L;
23
25
  }
@@ -1,7 +1,7 @@
1
1
  import e from "../managers/braze-instance.js";
2
2
  import ir from "./feature-flags-provider-factory.js";
3
3
  function tr(r, t, a = !1) {
4
- if (e.rr()) return ir.er().refreshFeatureFlags(r, t, a);
4
+ if (e.X()) return ir.rr().refreshFeatureFlags(r, t, a);
5
5
  }
6
6
  export function refreshFeatureFlags(r, e) {
7
7
  tr(r, e);
@@ -2,8 +2,11 @@ import e from "../managers/braze-instance.js";
2
2
  import ir from "./feature-flags-provider-factory.js";
3
3
  import { getAllFeatureFlags } from "./get-all-feature-flags.js";
4
4
  export function subscribeToFeatureFlagsUpdates(r) {
5
- if (!e.rr()) return;
6
- const t = getAllFeatureFlags();
7
- t && "function" == typeof r && r(t);
8
- return ir.er().ri(r);
5
+ if (!e.X()) return;
6
+ const t = ir.rr();
7
+ if (t.Ai()) {
8
+ const t = getAllFeatureFlags();
9
+ t && "function" == typeof r && r(t);
10
+ }
11
+ return t.ei(r);
9
12
  }
@@ -3,9 +3,9 @@ import ee from "./feed-provider.js";
3
3
  const re = {
4
4
  t: !1,
5
5
  provider: null,
6
- er: () => (
6
+ rr: () => (
7
7
  re.o(),
8
- re.provider || ((re.provider = new ee(e.l(), e.cr())), e.dr(re.provider)),
8
+ re.provider || ((re.provider = new ee(e.l(), e.cr())), e.ar(re.provider)),
9
9
  re.provider
10
10
  ),
11
11
  o: () => {