@nuskin/product-components 3.2.2 → 3.2.3

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.2.3](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.2.2...v3.2.3) (2023-03-14)
2
+
3
+
4
+ ### Fix
5
+
6
+ * Add to subscription for equinox market ([fd225e1](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/fd225e19d2540043f767c6ec214e19c8fed80393))
7
+
1
8
  ## [3.2.2](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.2.1...v3.2.2) (2023-03-11)
2
9
 
3
10
 
@@ -940,6 +940,7 @@ const NsProductMixin = {
940
940
  console.log(`ProductDataService.getProductData: `, error);
941
941
  });
942
942
  } else {
943
+ options.product = this.product;
943
944
  CartService.addProductToCart(options)
944
945
  .then(() => {
945
946
  this.maxQuantity -= options.qty;
@@ -962,24 +963,49 @@ const NsProductMixin = {
962
963
  */
963
964
  handleAddToAdr() {
964
965
  if (!this.disableAddToAdr) {
965
- let options = {
966
- sku: this.activeSku,
967
- qty: this.selectedQuantity,
968
- adr: !AdrService.isAdrOverride(),
969
- product: this.product,
970
- referrer: this.referrer
971
- };
972
- CartService.addProductToCart(options)
973
- .then(() => {
974
- this.maxQuantity -= options.qty;
975
- this.setStatus();
976
- events.publish(events.shop.ADD_TO_CART, options);
977
- events.publish(events.shop.SHOW_ADD_TO_BAG, options);
978
- this.$emit("added-to-adr", options);
979
- })
980
- .catch(error => {
981
- console.error("Failed to add to ADR.", error);
982
- });
966
+ getConfiguration(["Equinox_Markets"]).then(config => {
967
+ let options = {
968
+ sku: this.activeSku,
969
+ qty: this.selectedQuantity,
970
+ adr: !AdrService.isAdrOverride(),
971
+ referrer: this.referrer
972
+ };
973
+ if (
974
+ config.Equinox_Markets.active &&
975
+ equinoxLocalStorage.isEquinoxEnabled()
976
+ ) {
977
+ ProductDataService.getProductData(this.activeSku).then(
978
+ productData => {
979
+ options.product = new ShopProduct(productData.products[0]);
980
+
981
+ EquinoxCartService.addProductToEquinoxCart(options)
982
+ .then(() => {
983
+ this.maxQuantity -= options.qty;
984
+ this.setStatus();
985
+ events.publish(events.shop.ADD_TO_CART, options);
986
+ events.publish(events.shop.SHOW_ADD_TO_BAG, options);
987
+ this.$emit("added-to-adr", options);
988
+ })
989
+ .catch(error => {
990
+ console.error("Failed to add to ADR.", error);
991
+ });
992
+ }
993
+ );
994
+ } else {
995
+ options.product = this.product;
996
+ CartService.addProductToCart(options)
997
+ .then(() => {
998
+ this.maxQuantity -= options.qty;
999
+ this.setStatus();
1000
+ events.publish(events.shop.ADD_TO_CART, options);
1001
+ events.publish(events.shop.SHOW_ADD_TO_BAG, options);
1002
+ this.$emit("added-to-adr", options);
1003
+ })
1004
+ .catch(error => {
1005
+ console.error("Failed to add to ADR.", error);
1006
+ });
1007
+ }
1008
+ });
983
1009
  }
984
1010
  },
985
1011
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/product-components",
3
- "version": "3.2.2",
3
+ "version": "3.2.3",
4
4
  "description": "Nu Skin Product Components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -27,7 +27,7 @@
27
27
  "@nuskin/ns-common-lib": "1.4.5",
28
28
  "@nuskin/ns-core-styles": "2.11.2",
29
29
  "@nuskin/ns-loyalty-web": "1.5.6",
30
- "@nuskin/ns-product-lib": "2.5.1",
30
+ "@nuskin/ns-product-lib": "2.6.0",
31
31
  "@nuskin/product-recommendation": "2.0.1",
32
32
  "axios": "^0.19.2",
33
33
  "lodash": "^4.17.15",