@nuskin/product-components 3.4.0 → 3.5.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [3.5.0](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.4.0...v3.5.0) (2023-05-02)
2
+
3
+
4
+ ### New
5
+
6
+ * added a feature flag to allow us to turn on the new exclusive offer api for testing (#CX15-7412) ([73da3e8](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/73da3e857e99f0a8d1a1671e922de6efc9b14f38)), closes [#CX15-7412](https://code.tls.nuskin.io/ns-am/ux/product-components/issues/CX15-7412)
7
+
1
8
  # [3.4.0](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.3.11...v3.4.0) (2023-05-02)
2
9
 
3
10
 
@@ -25,6 +25,7 @@ import {
25
25
  EquinoxCartService
26
26
  } from "@nuskin/ns-shop";
27
27
  import { default as NewQualificationService } from "@nuskin/exclusive-offer-sdk";
28
+ import { retrieveTogglesBasedOnEnvironment } from "@nuskin/ns-feature-flags";
28
29
  import webLoyalty from "@nuskin/ns-loyalty-web";
29
30
  import { getProp, getFullUrl } from "@nuskin/ns-common-lib";
30
31
  import { PriceType } from "@nuskin/ns-product-lib";
@@ -34,29 +35,29 @@ import { waitForConfig } from "../services/configHelper";
34
35
  const PENDING_FAVORITE = "pendingFavorite";
35
36
  const KEY_BREADCRUMB_BACK = "breadcrumbBack";
36
37
 
37
- let equinoxMarket = {
38
- promise: getConfiguration(["Equinox_Markets"]).then(config => {
39
- equinoxMarket = {
40
- value:
41
- config && config.Equinox_Markets
42
- ? !!config.Equinox_Markets.active
43
- : false,
44
- promise: null,
45
- loaded: true
46
- };
47
- }),
48
- loaded: false,
49
- value: undefined
38
+ let flagsPromise = null;
39
+ let featureFlags = false;
40
+ const checkFlag = async flag => {
41
+ if (!featureFlags && !flagsPromise) {
42
+ flagsPromise = retrieveTogglesBasedOnEnvironment().then(
43
+ flagsFromServer => (featureFlags = flagsFromServer)
44
+ );
45
+ }
46
+
47
+ if (!featureFlags) {
48
+ await flagsPromise;
49
+ }
50
+
51
+ return featureFlags.has(flag);
50
52
  };
51
53
 
52
54
  const getQualificationService = async () => {
53
- if (!equinoxMarket.loaded) {
54
- await equinoxMarket.promise;
55
- }
56
- if (equinoxMarket.value) {
57
- return NewQualificationService;
58
- }
59
- return OldQualificationService;
55
+ const equinoxMarket = (await getConfiguration(["Equinox_Markets"]))
56
+ .Equinox_Markets;
57
+ return equinoxMarket.active ||
58
+ (await checkFlag("cx15_use_new_exclusive_offer_api"))
59
+ ? NewQualificationService
60
+ : OldQualificationService;
60
61
  };
61
62
 
62
63
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/product-components",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "Nu Skin Product Components",
5
5
  "main": "index.js",
6
6
  "scripts": {