@nuskin/ns-product-lib 2.5.0-cx24-2179.2.19 → 2.5.0-cx24-3282.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,17 @@
1
+ # [2.5.0-cx24-3282.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-3282.1...v2.5.0-cx24-3282.2) (2023-02-02)
2
+
3
+
4
+ ### Fix
5
+
6
+ * Get test environment if not PROD ([dc25437](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/dc25437433126ad7f817660b83d62000d7256475))
7
+
8
+ # [2.5.0-cx24-3282.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.19...v2.5.0-cx24-3282.1) (2023-02-02)
9
+
10
+
11
+ ### Fix
12
+
13
+ * Get test environment if not PROD ([b572755](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/b5727553edfcec2d983e90560cf2ed5bad8792f1))
14
+
1
15
  # [2.5.0-cx24-2179.2.19](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.18...v2.5.0-cx24-2179.2.19) (2023-01-27)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.5.0-cx24-2179.2.19",
3
+ "version": "2.5.0-cx24-3282.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": {
@@ -25,7 +25,7 @@ const ProductData = {
25
25
  clientId: '735b1eb810304bba966af0891ab54053'
26
26
  }));
27
27
 
28
- if (config.Equinox_Markets.country_code != '') {
28
+ if (config.Equinox_Markets.country_code != '' || config.Equinox_Markets.country_code == market) {
29
29
  return await this.getProductFromEquinox(skus, localeMarket, config);
30
30
  }
31
31
  }
@@ -88,7 +88,7 @@ const ProductData = {
88
88
  /**
89
89
  * @param {contentstack.MarketConfig} marketConfig
90
90
  */
91
- getLegacyRequestHeaders: function(marketConfig) {
91
+ getLegacyRequestHeaders: function (marketConfig) {
92
92
  return {
93
93
  'Content-Type': 'application/json',
94
94
  client_id: marketConfig.checkout_client_id,
@@ -102,7 +102,7 @@ const ProductData = {
102
102
  * @param {*} eqVariant
103
103
  * @returns Array<Product>
104
104
  */
105
- eqProductVariantMapper : function (eqVariant) {
105
+ eqProductVariantMapper: function (eqVariant) {
106
106
 
107
107
  let imageURL = eqVariant.properties.imageURL;
108
108
  const regex = /\d+.\d+/
@@ -111,10 +111,10 @@ const ProductData = {
111
111
  if (imageURL.includes('contentstack')) {
112
112
  thumbnailImage = imageURL + '?width=40'
113
113
  } else {
114
- thumbnailImage = imageURL.replace(regex,'40.40')
114
+ thumbnailImage = imageURL.replace(regex, '40.40')
115
115
  }
116
116
 
117
- const { eventName, eventLabels, computedPrice, defaultProductPrice} = this.getEqProductPromotions(eqVariant);
117
+ const { eventName, eventLabels, computedPrice, defaultProductPrice } = this.getEqProductPromotions(eqVariant);
118
118
  const productPrice = eventName ? defaultProductPrice : eqVariant.priceFacets["Regular Price"];
119
119
  const discountedPrice = eventName ? computedPrice : eqVariant.priceFacets["Regular Price"];
120
120
 
@@ -223,8 +223,8 @@ const ProductData = {
223
223
  "availableQuantity": eqVariant.inventoryProperties.atpQty,
224
224
  "maxQuantity": 999,
225
225
  "points": "",
226
- "cv": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
227
- "pv":eqVariant.priceFacets.PV,
226
+ "cv": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
227
+ "pv": eqVariant.priceFacets.PV,
228
228
  "priceType": "WRTL",
229
229
  "price": discountedPrice,
230
230
  "priceMap": {
@@ -258,9 +258,9 @@ const ProductData = {
258
258
  "shade": "",
259
259
  "status": this.switchStatusFromEquinox(eqVariant.properties.status),
260
260
  "variantType": "Other",
261
- "variantDropdownLabel": eqVariant.properties.variantSelectLabel || "",
261
+ "variantDropdownLabel": eqVariant.properties.variantSelectLabel || "",
262
262
  "variantDropdownPlaceholder": "Select Type",
263
- "variantsLabel": eqVariant.properties.variantSelectLabel || "",
263
+ "variantsLabel": eqVariant.properties.variantSelectLabel || "",
264
264
  "groupOffer": false,
265
265
  "personalOffer": false,
266
266
  "savedEventName": eventName,
@@ -291,14 +291,14 @@ const ProductData = {
291
291
  if (!Array.isArray(product.promotion)) {
292
292
  return {
293
293
  eventLabels: "",
294
- computedPrice : 0,
294
+ computedPrice: 0,
295
295
  defaultProductPrice: product.priceFacets ? product.priceFacets["Regular Price"] : 0,
296
296
  eventName: null
297
297
  }
298
298
  }
299
299
 
300
- const defaultProductPrice = product.totalValue ? product.totalValue.originalPrice : 0;
301
- const computedPrice = product.totalValue && product.totalValue.priceAfterDiscount
300
+ const defaultProductPrice = product.totalValue ? product.totalValue.originalPrice : 0;
301
+ const computedPrice = product.totalValue && product.totalValue.priceAfterDiscount
302
302
  ? product.totalValue.priceAfterDiscount
303
303
  : 0;
304
304
  let eventName = "";
@@ -331,7 +331,7 @@ const ProductData = {
331
331
  if (imageURL.includes('contentstack')) {
332
332
  thumbnailImage = imageURL + '?width=40'
333
333
  } else {
334
- thumbnailImage = imageURL.replace(regex,'40.40')
334
+ thumbnailImage = imageURL.replace(regex, '40.40')
335
335
  }
336
336
 
337
337
  if (data.sku && data.sku.length > 1) {
@@ -386,7 +386,7 @@ const ProductData = {
386
386
  "availableQuantity": data.sku[count].inventoryProperties.atpQty,
387
387
  "maxQuantity": 999,
388
388
  "points": "",
389
- "cv": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : '',
389
+ "cv": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : '',
390
390
  "pv": data.sku[count].priceFacets.PV,
391
391
  "priceType": "WRTL",
392
392
  "price": discountedPrice,
@@ -422,9 +422,9 @@ const ProductData = {
422
422
  "shade": "",
423
423
  "status": this.switchStatusFromEquinox(data.sku[count].properties.productStatus),
424
424
  "variantType": "Other",
425
- "variantDropdownLabel": data.sku[count].properties.variantLabel || "",
425
+ "variantDropdownLabel": data.sku[count].properties.variantLabel || "",
426
426
  "variantDropdownPlaceholder": "Select Type",
427
- "variantsLabel": data.sku[count].properties.variantLabel || "",
427
+ "variantsLabel": data.sku[count].properties.variantLabel || "",
428
428
  "groupOffer": false,
429
429
  "personalOffer": false,
430
430
  "savedEventName": eventName,
@@ -483,7 +483,7 @@ const ProductData = {
483
483
  newStatus = ProductStatus.Discontinued;
484
484
  break;
485
485
  case equinoxStatus.STOPPED:
486
- newStatus = ProductStatus.Discontinued;
486
+ newStatus = ProductStatus.Discontinued;
487
487
  break;
488
488
  case equinoxStatus.REPLACEMENT:
489
489
  newStatus = ProductStatus.NotReleasedForSale;
@@ -532,7 +532,7 @@ const ProductData = {
532
532
 
533
533
  _sortProductsBySku: function (skus, products) {
534
534
 
535
- if(!skus || !products || products.length === 1) {
535
+ if (!skus || !products || products.length === 1) {
536
536
  return products
537
537
  }
538
538
 
@@ -606,8 +606,8 @@ function contentstackEnv() {
606
606
  if (typeof window === 'undefined') {
607
607
  return 'test';
608
608
  }
609
-
610
- return getEnvironmentFromUrl(window.location.host);
609
+ let env = (getEnvironmentFromUrl(window.location.host) != 'prod') ? 'test' : 'prod';
610
+ return env;
611
611
  }
612
612
 
613
613
  module.exports = ProductData;