@braze/web-sdk 4.6.3 → 4.7.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 (97) hide show
  1. package/index.d.ts +13 -8
  2. package/package.json +1 -1
  3. package/shared-lib/braze-shared-lib.js +2 -2
  4. package/shared-lib/encoding-utils.js +1 -1
  5. package/shared-lib/event-types.js +18 -17
  6. package/shared-lib/indexed-db-adapter.js +2 -2
  7. package/shared-lib/logger.js +2 -2
  8. package/shared-lib/supported-options.js +15 -15
  9. package/src/Core/handle-braze-action.js +40 -34
  10. package/src/Core/log-custom-event.js +2 -7
  11. package/src/Core/log-purchase.js +3 -3
  12. package/src/Core/wipe-data.js +2 -2
  13. package/src/FeatureFlags/feature-flag.js +33 -16
  14. package/src/FeatureFlags/feature-flags-provider.js +86 -75
  15. package/src/FeatureFlags/get-all-feature-flags.js +5 -5
  16. package/src/FeatureFlags/get-feature-flag.js +6 -6
  17. package/src/FeatureFlags/refresh-feature-flags.js +1 -1
  18. package/src/FeatureFlags/types.js +1 -0
  19. package/src/Feed/feed-provider.js +17 -17
  20. package/src/Feed/get-cached-feed.js +1 -1
  21. package/src/Feed/ui/show-feed.js +1 -1
  22. package/src/InAppMessage/display/html-message-to-html.js +135 -120
  23. package/src/InAppMessage/display/in-app-message-to-html.js +21 -21
  24. package/src/InAppMessage/display/modal-utils.js +6 -6
  25. package/src/InAppMessage/in-app-message-factory.js +3 -3
  26. package/src/InAppMessage/in-app-message-manager-factory.js +3 -3
  27. package/src/InAppMessage/in-app-message-manager.js +65 -65
  28. package/src/InAppMessage/log-in-app-message-button-click.js +4 -4
  29. package/src/InAppMessage/log-in-app-message-click.js +4 -4
  30. package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
  31. package/src/InAppMessage/log-in-app-message-impression.js +3 -3
  32. package/src/InAppMessage/models/full-screen-message.js +1 -1
  33. package/src/InAppMessage/models/html-message.js +1 -1
  34. package/src/InAppMessage/models/in-app-message-button.js +4 -4
  35. package/src/InAppMessage/models/in-app-message.js +80 -80
  36. package/src/InAppMessage/models/modal-message.js +2 -2
  37. package/src/InAppMessage/models/slide-up-message.js +8 -8
  38. package/src/InAppMessage/models/templated-in-app-message.js +4 -4
  39. package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
  40. package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
  41. package/src/InAppMessage/ui/show-in-app-message.js +20 -20
  42. package/src/Push/push-manager.js +216 -209
  43. package/src/Push/utils/push-utils.js +4 -4
  44. package/src/User/user-manager.js +11 -8
  45. package/src/User/user.js +52 -41
  46. package/src/common/base-feed.js +1 -1
  47. package/src/common/base-provider.js +1 -1
  48. package/src/common/constants.js +2 -0
  49. package/src/common/feed-display.js +6 -6
  50. package/src/l10n/l10n-manager-factory.js +1 -1
  51. package/src/managers/auth-manager.js +24 -24
  52. package/src/managers/braze-instance.js +120 -120
  53. package/src/managers/device-manager.js +11 -11
  54. package/src/managers/network-manager.js +63 -54
  55. package/src/managers/server-config-manager.js +20 -20
  56. package/src/managers/session-manager.js +29 -29
  57. package/src/managers/storage-manager-factory.js +4 -4
  58. package/src/managers/storage-manager.js +104 -104
  59. package/src/managers/subscription-manager.js +6 -6
  60. package/src/models/backend-errors.js +5 -5
  61. package/src/models/braze-event.js +7 -7
  62. package/src/models/device.js +1 -1
  63. package/src/models/identifier.js +6 -6
  64. package/src/models/push-token.js +3 -3
  65. package/src/models/server-config.js +15 -15
  66. package/src/request-controller.js +92 -88
  67. package/src/triggers/models/custom-event-data.js +4 -4
  68. package/src/triggers/models/custom-event-property-data.js +9 -9
  69. package/src/triggers/models/filter-set.js +9 -9
  70. package/src/triggers/models/filter.js +63 -63
  71. package/src/triggers/models/in-app-message-click-data.js +5 -5
  72. package/src/triggers/models/purchase-data.js +3 -3
  73. package/src/triggers/models/purchase-property-data.js +9 -9
  74. package/src/triggers/models/push-click-data.js +5 -5
  75. package/src/triggers/models/trigger-condition.js +48 -48
  76. package/src/triggers/models/trigger-events.js +1 -1
  77. package/src/triggers/models/trigger.js +29 -29
  78. package/src/triggers/triggers-provider-factory.js +2 -2
  79. package/src/triggers/triggers-provider.js +87 -89
  80. package/src/ui/js/attach-css.js +1 -1
  81. package/src/ui/js/feed-css.js +4 -4
  82. package/src/ui/js/iam-css.js +4 -4
  83. package/src/ui/js/load-font-awesome.js +1 -1
  84. package/src/util/base-device-parser.js +2 -2
  85. package/src/util/braze-actions.js +8 -8
  86. package/src/util/browser-detector.js +8 -8
  87. package/src/util/client-hints-parser.js +3 -3
  88. package/src/util/code-utils.js +10 -3
  89. package/src/util/component-utils.js +1 -1
  90. package/src/util/date-utils.js +2 -2
  91. package/src/util/device-constants.js +1 -1
  92. package/src/util/dom-utils.js +9 -9
  93. package/src/util/key-codes.js +1 -1
  94. package/src/util/net.js +3 -3
  95. package/src/util/user-agent-parser.js +4 -4
  96. package/src/util/validation-utils.js +155 -74
  97. package/src/util/window-utils.js +1 -1
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Type definitions for @braze/web-sdk v4.6.3
2
+ * Type definitions for @braze/web-sdk v4.7.0
3
3
  * Project: https://github.com/braze-inc/braze-web-sdk
4
4
  * (c) Braze, Inc. 2023 - http://braze.com
5
5
  * License available at https://github.com/braze-inc/braze-web-sdk/blob/master/LICENSE
@@ -1270,12 +1270,17 @@
1270
1270
  * @param value - Can be numeric, boolean, a Date object, a string, or an array of strings. Strings are limited to
1271
1271
  * 255 characters in length, cannot begin with a $, and can only contain alphanumeric characters and punctuation.
1272
1272
  * Passing a null value will remove this custom attribute from the user.
1273
+ * @param merge - Whether the value should be merged with the existing value on the backend. If `false` (default), any existing
1274
+ * attribute will be overwritten. If `true`, existing objects and arrays of objects will be merged. To update an array of objects,
1275
+ * follow the guidelines in our
1276
+ * [public docs](https://www.braze.com/docs/user_guide/data_and_analytics/custom_data/custom_attributes/array_of_objects/#usage-examples).
1273
1277
  *
1274
1278
  * @returns {boolean} Whether the update was successfully enqueued.
1275
1279
  */
1276
1280
  setCustomUserAttribute(
1277
1281
  key: string,
1278
- value: number | boolean | Date | string | string[] | null
1282
+ value: number | boolean | Date | string | string[] | object | object[] | null,
1283
+ merge?: boolean
1279
1284
  ): boolean;
1280
1285
 
1281
1286
  /**
@@ -2000,16 +2005,16 @@
2000
2005
  * - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
2001
2006
  *
2002
2007
  * ```
2003
- * self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.6/service-worker.js');
2008
+ * self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.7/service-worker.js');
2004
2009
  * ```
2005
2010
  *
2006
2011
  * For more details, see [Our Product Documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
2007
2012
  *
2008
2013
  * @param successCallback - When the user subscribes to push successfully this callback will be
2009
2014
  * invoked with the user's endpoint, public key, and user auth key (endpoint, publicKey, userAuth).
2010
- * @param deniedCallback - If push permission is denied, this callback will be invoked. If the denial
2011
- * is temporary, it will be invoked with a parameter of `true` - otherwise it will be invoked with a parameter
2012
- * of `false`.
2015
+ * @param deniedCallback - If push permission is denied or an error is encountered while registering, this callback will
2016
+ * be invoked. If the denial is temporary, it will be invoked with a parameter of `true` - otherwise it will be invoked
2017
+ * with a parameter of `false`.
2013
2018
  */
2014
2019
  export function requestPushPermission(
2015
2020
  successCallback?: (
@@ -2189,7 +2194,7 @@
2189
2194
  */
2190
2195
  export function subscribeToSdkAuthenticationFailures(subscriber: (
2191
2196
  error: {
2192
- errorCode: string,
2197
+ errorCode: number,
2193
2198
  reason?: string,
2194
2199
  userId?: string,
2195
2200
  signature?: string
@@ -2353,7 +2358,7 @@
2353
2358
  * lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
2354
2359
  * option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
2355
2360
  * `requestPushPermission`, and ensure that it contains Braze's service worker code, either with
2356
- * `self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.6/service-worker.js');` or by including the content
2361
+ * `self.importScripts('https://js.appboycdn.com/web-sdk-develop/4.7/service-worker.js');` or by including the content
2357
2362
  * of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
2358
2363
  */
2359
2364
  manageServiceWorkerExternally?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@braze/web-sdk",
3
- "version": "4.6.3",
3
+ "version": "4.7.0",
4
4
  "description": "Braze SDK for web sites and other JS platforms.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -3,6 +3,6 @@ import { EventTypes as ve, InternalEventTypes as De } from "./event-types.js";
3
3
  import Be from "./guid.js";
4
4
  import Ae from "./indexed-db-adapter.js";
5
5
  import Ge from "./logger.js";
6
- import Oe from "./supported-options.js";
7
- const r = { Dn: je, A: ve, Ar: De, it: Be, qt: Ae, xt: Ae.ep, D: Ge, Go: Oe };
6
+ import Ue from "./supported-options.js";
7
+ const r = { yn: je, A: ve, Ar: De, it: Be, qt: Ae, xt: Ae.ep, D: Ge, Wo: Ue };
8
8
  export default r;
@@ -1,5 +1,5 @@
1
1
  const je = {
2
- Pn: function(t) {
2
+ wn: function(t) {
3
3
  const r = (t + "=".repeat((4 - (t.length % 4)) % 4))
4
4
  .replace(/\-/g, "+")
5
5
  .replace(/_/g, "/"),
@@ -1,32 +1,33 @@
1
1
  const ve = {
2
2
  CustomEvent: "ce",
3
3
  Pr: "p",
4
- xl: "pc",
4
+ Nl: "pc",
5
5
  cc: "ca",
6
- Ba: "i",
6
+ qa: "i",
7
7
  qs: "ie",
8
8
  T: "cci",
9
9
  W: "ccic",
10
10
  _: "ccc",
11
11
  L: "ccd",
12
- _h: "ss",
13
- gh: "se",
14
- bi: "si",
15
- yi: "sc",
16
- ji: "sbc",
17
- vi: "sfe",
12
+ yh: "ss",
13
+ wh: "se",
14
+ Mi: "si",
15
+ Ii: "sc",
16
+ Ai: "sbc",
17
+ Ze: "sfe",
18
18
  ro: "iec",
19
- Ul: "lr",
20
- Ol: "uae",
19
+ Ml: "lr",
20
+ Rl: "uae",
21
21
  U: "ci",
22
22
  F: "cc",
23
- Bl: "lcaa",
24
- Wl: "lcar",
25
- Tn: "inc",
26
- En: "add",
27
- Fn: "rem",
28
- Un: "set",
29
- Gl: "sgu"
23
+ Ul: "lcaa",
24
+ Il: "lcar",
25
+ Fn: "inc",
26
+ Un: "add",
27
+ En: "rem",
28
+ Sn: "set",
29
+ An: "ncam",
30
+ xl: "sgu"
30
31
  },
31
32
  De = { qr: "feed_displayed", dc: "content_cards_displayed" };
32
33
  export { ve as EventTypes, De as InternalEventTypes };
@@ -301,14 +301,14 @@ Ae.ep = {
301
301
  dd: "AppboyServiceWorkerAsyncStorage",
302
302
  VERSION: 6,
303
303
  $t: {
304
- Kl: "data",
304
+ Ol: "data",
305
305
  jr: "pushClicks",
306
306
  cu: "pushSubscribed",
307
307
  ud: "fallbackDevice",
308
308
  Mt: "cardUpdates",
309
309
  oe: "optOut",
310
310
  $r: "pendingData",
311
- Vn: "sdkAuthenticationSignature"
311
+ Mn: "sdkAuthenticationSignature"
312
312
  },
313
313
  se: 1
314
314
  }
@@ -24,13 +24,13 @@ const Ge = {
24
24
  },
25
25
  warn: function(n) {
26
26
  if (Ge.zg) {
27
- const o = "Braze SDK Warning: " + n + " (v4.6.3)";
27
+ const o = "Braze SDK Warning: " + n + " (v4.7.0)";
28
28
  null != Ge.nd ? Ge.nd(o) : console.warn(o);
29
29
  }
30
30
  },
31
31
  error: function(n) {
32
32
  if (Ge.zg) {
33
- const o = "Braze SDK Error: " + n + " (v4.6.3)";
33
+ const o = "Braze SDK Error: " + n + " (v4.7.0)";
34
34
  null != Ge.nd ? Ge.nd(o) : console.error(o);
35
35
  }
36
36
  }
@@ -1,26 +1,26 @@
1
1
  export default {
2
- ho: "allowCrawlerActivity",
3
- po: "baseUrl",
4
- Eo: "noCookies",
5
- _o: "devicePropertyAllowlist",
2
+ Yn: "allowCrawlerActivity",
3
+ Xn: "baseUrl",
4
+ Zn: "noCookies",
5
+ ho: "devicePropertyAllowlist",
6
6
  ta: "disablePushTokenMaintenance",
7
- Io: "enableLogging",
8
- Ao: "enableSdkAuthentication",
7
+ po: "enableLogging",
8
+ Eo: "enableSdkAuthentication",
9
9
  ia: "manageServiceWorkerExternally",
10
- So: "minimumIntervalBetweenTriggerActionsInSeconds",
11
- No: "sessionTimeoutInSeconds",
12
- wo: "appVersion",
10
+ _o: "minimumIntervalBetweenTriggerActionsInSeconds",
11
+ Io: "sessionTimeoutInSeconds",
12
+ Ao: "appVersion",
13
13
  na: "serviceWorkerLocation",
14
14
  ra: "safariWebsitePushId",
15
- zn: "localization",
15
+ jn: "localization",
16
16
  ao: "contentSecurityNonce",
17
- To: "enableHtmlInAppMessages",
18
- Oo: "allowUserSuppliedJavascript",
17
+ So: "enableHtmlInAppMessages",
18
+ No: "allowUserSuppliedJavascript",
19
19
  no: "inAppMessageZIndex",
20
20
  lo: "openInAppMessagesInNewTab",
21
21
  en: "openNewsFeedCardsInNewTab",
22
- eh: "requireExplicitInAppMessageDismissal",
23
- vo: "doNotLoadFontAwesome",
24
- Co: "sdkFlavor",
22
+ Ih: "requireExplicitInAppMessageDismissal",
23
+ wo: "doNotLoadFontAwesome",
24
+ To: "sdkFlavor",
25
25
  tn: "openCardsInNewTab"
26
26
  };
@@ -1,22 +1,22 @@
1
1
  import r from "../../shared-lib/braze-shared-lib.js";
2
2
  import e from "../managers/braze-instance.js";
3
3
  import {
4
- BRAZE_ACTIONS as _,
5
- getDecodedBrazeAction as J
4
+ BRAZE_ACTIONS as P,
5
+ getDecodedBrazeAction as _
6
6
  } from "../util/braze-actions.js";
7
7
  import {
8
- BRAZE_ACTION_URI_REGEX as O,
9
- isValidBrazeActionJson as P
8
+ BRAZE_ACTION_URI_REGEX as J,
9
+ isValidBrazeActionJson as O
10
10
  } from "../util/validation-utils.js";
11
11
  import { WindowUtils as H } from "../util/window-utils.js";
12
12
  import { getUser as Q } from "./get-user.js";
13
- export function _handleBrazeAction(a, s, i) {
13
+ export function _handleBrazeAction(s, o, i) {
14
14
  if (e.rr())
15
- if (O.test(a)) {
16
- const e = J(a);
15
+ if (J.test(s)) {
16
+ const e = _(s);
17
17
  if (!e) return;
18
- const s = async e => {
19
- if (!P(e))
18
+ const o = e => {
19
+ if (!O(e))
20
20
  return void r.D.error(
21
21
  `Decoded Braze Action json is invalid: ${JSON.stringify(
22
22
  e,
@@ -24,40 +24,46 @@ export function _handleBrazeAction(a, s, i) {
24
24
  2
25
25
  )}`
26
26
  );
27
- const a = e[_.properties.type];
28
- if (a === _.types.ue) for (const r of e[_.properties.me]) s(r);
27
+ const s = e[P.properties.type];
28
+ if (s === P.types.ue) for (const r of e[P.properties.me]) o(r);
29
29
  else {
30
- const s = e[_.properties.fe];
31
- let i, o;
32
- switch (a) {
33
- case _.types.logCustomEvent:
34
- (i = await import("./log-custom-event.js")),
35
- i.logCustomEvent.apply(null, Array.prototype.slice.call(s));
30
+ const o = e[P.properties.fe];
31
+ let i;
32
+ switch (s) {
33
+ case P.types.logCustomEvent:
34
+ import("./log-custom-event.js").then(
35
+ ({ logCustomEvent: logCustomEvent }) => {
36
+ logCustomEvent.apply(null, Array.prototype.slice.call(o));
37
+ }
38
+ );
36
39
  break;
37
- case _.types.requestPushPermission:
38
- (i = await import("../Push/request-push-permission.js")),
39
- i.requestPushPermission();
40
+ case P.types.requestPushPermission:
41
+ import("../Push/request-push-permission.js").then(
42
+ ({ requestPushPermission: requestPushPermission }) => {
43
+ requestPushPermission();
44
+ }
45
+ );
40
46
  break;
41
- case _.types.setEmailNotificationSubscriptionType:
42
- case _.types.setPushNotificationSubscriptionType:
43
- case _.types.setCustomUserAttribute:
44
- case _.types.addToSubscriptionGroup:
45
- case _.types.removeFromSubscriptionGroup:
46
- case _.types.addToCustomAttributeArray:
47
- case _.types.removeFromCustomAttributeArray:
48
- (o = Q()), o[a].apply(o, Array.prototype.slice.call(s));
47
+ case P.types.setEmailNotificationSubscriptionType:
48
+ case P.types.setPushNotificationSubscriptionType:
49
+ case P.types.setCustomUserAttribute:
50
+ case P.types.addToSubscriptionGroup:
51
+ case P.types.removeFromSubscriptionGroup:
52
+ case P.types.addToCustomAttributeArray:
53
+ case P.types.removeFromCustomAttributeArray:
54
+ (i = Q()), i[s].apply(i, Array.prototype.slice.call(o));
49
55
  break;
50
- case _.types.de:
51
- case _.types.pe:
52
- H.openUri.apply(null, Array.prototype.slice.call(s));
56
+ case P.types.de:
57
+ case P.types.pe:
58
+ H.openUri.apply(null, Array.prototype.slice.call(o));
53
59
  break;
54
60
  default:
55
- r.D.info(`Ignoring unknown Braze Action: ${a}`);
61
+ r.D.info(`Ignoring unknown Braze Action: ${s}`);
56
62
  }
57
63
  }
58
64
  };
59
- s(e);
60
- } else H.openUri(a, i, s);
65
+ o(e);
66
+ } else H.openUri(s, i, o);
61
67
  }
62
68
  export function handleBrazeAction(e, r) {
63
69
  _handleBrazeAction(e, r);
@@ -7,6 +7,7 @@ import {
7
7
  validateCustomProperties as X,
8
8
  validateCustomString as Y
9
9
  } from "../util/validation-utils.js";
10
+ import { LOG_CUSTOM_EVENT_STRING as Z } from "../common/constants.js";
10
11
  export function logCustomEvent(t, o) {
11
12
  if (!e.rr()) return !1;
12
13
  if (null == t || t.length <= 0)
@@ -17,13 +18,7 @@ export function logCustomEvent(t, o) {
17
18
  !1
18
19
  );
19
20
  if (!Y(t, "log custom event", "the event name")) return !1;
20
- const [n, i] = X(
21
- o,
22
- "logCustomEvent",
23
- "eventProperties",
24
- `log custom event "${t}"`,
25
- "event"
26
- );
21
+ const [n, i] = X(o, Z, "eventProperties", `log custom event "${t}"`, "event");
27
22
  if (!n) return !1;
28
23
  if (e.ir().ge(t))
29
24
  return r.D.info(`Custom Event "${t}" is blocklisted, ignoring.`), !1;
@@ -1,5 +1,5 @@
1
1
  import e from "../managers/braze-instance.js";
2
- import { MAX_PURCHASE_QUANTITY as Z } from "../common/constants.js";
2
+ import { MAX_PURCHASE_QUANTITY as rr } from "../common/constants.js";
3
3
  import r from "../../shared-lib/braze-shared-lib.js";
4
4
  import V from "../triggers/models/trigger-events.js";
5
5
  import { TriggersProviderFactory as W } from "../triggers/triggers-provider-factory.js";
@@ -34,10 +34,10 @@ export function logPurchase(o, i, t, n, D) {
34
34
  ),
35
35
  !1
36
36
  );
37
- if (g < 1 || g > Z)
37
+ if (g < 1 || g > rr)
38
38
  return (
39
39
  r.D.error(
40
- `logPurchase requires a quantity >1 and <${Z}, got ${g}, ignoring.`
40
+ `logPurchase requires a quantity >1 and <${rr}, got ${g}, ignoring.`
41
41
  ),
42
42
  !1
43
43
  );
@@ -1,11 +1,11 @@
1
1
  import e from "../managers/braze-instance.js";
2
- import { keys as rr } from "../util/code-utils.js";
2
+ import { keys as or } from "../util/code-utils.js";
3
3
  import r from "../../shared-lib/braze-shared-lib.js";
4
4
  export function wipeData() {
5
5
  if (null == e.l())
6
6
  throw new Error("Braze must be initialized before calling methods.");
7
7
  e.l().clearData();
8
- const o = rr(r.xt);
8
+ const o = or(r.xt);
9
9
  for (let e = 0; e < o.length; e++) {
10
10
  const i = o[e],
11
11
  t = r.xt[i];
@@ -1,22 +1,36 @@
1
1
  import r from "../../shared-lib/braze-shared-lib.js";
2
2
  export default class FeatureFlag {
3
3
  constructor(t, r = !1, e = {}) {
4
- (this.id = t), (this.enabled = r), (this.properties = e);
4
+ (this.id = t),
5
+ (this.enabled = r),
6
+ (this.properties = e),
7
+ (this.id = t),
8
+ (this.enabled = r),
9
+ (this.properties = e);
5
10
  }
6
11
  getStringProperty(t) {
7
- if (!this.yr(t)) return null;
8
12
  const r = this.properties[t];
9
- return this.Er(r, "string") ? r.value : null;
13
+ return null == r
14
+ ? (this.yr(t), null)
15
+ : this.Er(r)
16
+ ? r.value
17
+ : (this.Br("string"), null);
10
18
  }
11
19
  getNumberProperty(t) {
12
- if (!this.yr(t)) return null;
13
20
  const r = this.properties[t];
14
- return this.Er(r, "number") ? r.value : null;
21
+ return null == r
22
+ ? (this.yr(t), null)
23
+ : this.Ir(r)
24
+ ? r.value
25
+ : (this.Br("number"), null);
15
26
  }
16
27
  getBooleanProperty(t) {
17
- if (!this.yr(t)) return null;
18
28
  const r = this.properties[t];
19
- return this.Er(r, "boolean") ? r.value : null;
29
+ return null == r
30
+ ? (this.yr(t), null)
31
+ : this.Nr(r)
32
+ ? r.value
33
+ : (this.Br("boolean"), null);
20
34
  }
21
35
  ss() {
22
36
  const t = {};
@@ -27,17 +41,20 @@ export default class FeatureFlag {
27
41
  t
28
42
  );
29
43
  }
44
+ Br(t) {
45
+ r.D.info(`Property is not of type ${t}.`);
46
+ }
30
47
  yr(t) {
31
- return (
32
- !(!this.properties || !this.properties[t]) ||
33
- (r.D.info(`${t} not found in feature flag properties.`), !1)
34
- );
48
+ r.D.info(`${t} not found in feature flag properties.`);
35
49
  }
36
- Er(t, e) {
37
- return (
38
- (t.type === e && typeof t.value === e) ||
39
- (r.D.info(`Property is not of type ${e}.`), !1)
40
- );
50
+ Er(t) {
51
+ return "string" === t.type && "string" == typeof t.value;
52
+ }
53
+ Ir(t) {
54
+ return "number" === t.type && "number" == typeof t.value;
55
+ }
56
+ Nr(t) {
57
+ return "boolean" === t.type && "boolean" == typeof t.value;
41
58
  }
42
59
  }
43
60
  (FeatureFlag.hs = { ns: "id", Fe: "e", we: "pr" }),