@nuskin/ns-product-lib 2.7.0-cx24-3682.1 → 2.7.0-cx24-3682.2

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # [2.7.0-cx24-3682.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.0-cx24-3682.1...v2.7.0-cx24-3682.2) (2023-03-24)
2
+
3
+
4
+ ### New
5
+
6
+ * MySite product cards show blank data when users have setup AEM Base SKU's(55) in Admin #CX24-3682 ([219fbd5](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/219fbd59b96ed9cbbc3ea94a24d886f0e8ca563f)), closes [#CX24-3682](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3682)
7
+ * MySite product cards show blank data when users have setup AEM Base SKU's(55) in Admin #CX24-3682 ([b86a1d2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/b86a1d2610892564c643bd851d873e507efedd49)), closes [#CX24-3682](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3682)
8
+ * MySite product cards show blank data when users have setup AEM Base SKU's(55) in Admin #CX24-3682 ([60d61cc](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/60d61ccd38e9b971b7ac53cf4224a9897a63fef4)), closes [#CX24-3682](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3682)
9
+
1
10
  # [2.7.0-cx24-3682.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.1...v2.7.0-cx24-3682.1) (2023-03-24)
2
11
 
3
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.7.0-cx24-3682.1",
3
+ "version": "2.7.0-cx24-3682.2",
4
4
  "description": "This project contains shared Product models and code between the backend and frontend.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -0,0 +1,19 @@
1
+ /**
2
+ * productFoundInterceptor is executed when an equinox product is found
3
+ * @param {import('axios').AxiosResponse} response
4
+ */
5
+ function productFoundInterceptor(response) {
6
+ console.log('productFoundInterceptor', response);
7
+ return response;
8
+ }
9
+
10
+ /**
11
+ * productNotFoundInterceptor is called when an equinox product is not found
12
+ * @param {import('axios').AxiosError} error
13
+ */
14
+ function productNotFoundInterceptor(error) {
15
+ console.log('productNotFoundInterceptor', error);
16
+ return Promise.reject(error);
17
+ }
18
+
19
+ module.exports = { productFoundInterceptor, productNotFoundInterceptor };
@@ -6,6 +6,10 @@ const Product = require("./product");
6
6
  const CustomerTypes = require('./models/customerTypes');
7
7
  const ProductStatus = require("./models/productStatus");
8
8
  const { mapAvailableQuantity, mapChildSKU } = require('./equinox-helpers');
9
+ const {
10
+ productFoundInterceptor,
11
+ productNotFoundInterceptor
12
+ } = require('./equinox-helpers/interceptors/product');
9
13
 
10
14
  const productTypes = {
11
15
  kit: 'kit'
@@ -71,6 +75,7 @@ const ProductData = {
71
75
 
72
76
  const url = `${config.API_Base_URLs}/orchestrationservices/storefront/catalogs/search/`;
73
77
  const href = `${url}?filter='\\\\''${encodeURI(filter)}'\\''`;
78
+ axios.interceptors.response.use(productFoundInterceptor, productNotFoundInterceptor);
74
79
  const response = await axios.request({
75
80
  method: 'get',
76
81
  url: href,
@@ -83,6 +88,8 @@ const ProductData = {
83
88
  withCredentials: true
84
89
  });
85
90
 
91
+ axios.interceptors.response.eject(productFoundInterceptor);
92
+ axios.interceptors.response.eject(productNotFoundInterceptor);
86
93
  return response;
87
94
  },
88
95