@nuskin/product-components 3.1.1 → 3.1.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 +21 -0
- package/components/NsProductCard.vue +9 -2
- package/components/NsProductCardBase.vue +2 -1
- package/index.js +3 -1
- package/mixins/NsProductMixin.js +70 -65
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [3.1.3](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.1.2...v3.1.3) (2022-06-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Fix
|
|
5
|
+
|
|
6
|
+
* several fixes/tweaks to get product cards to work for the exclusive offer app (#CX15-5006) ([ef742b2](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/ef742b25147e030740f2bedfe456b36af881c8bd)), closes [#CX15-5006](https://code.tls.nuskin.io/ns-am/ux/product-components/issues/CX15-5006)
|
|
7
|
+
|
|
8
|
+
## [3.1.2](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.1.1...v3.1.2) (2022-05-19)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Fix
|
|
12
|
+
|
|
13
|
+
* use shopping context for storefront/personal offer checks (#CX12-5158) ([642c9df](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/642c9dfca66a3e355cacbb81116c275cce846500)), closes [#CX12-5158](https://code.tls.nuskin.io/ns-am/ux/product-components/issues/CX12-5158)
|
|
14
|
+
|
|
15
|
+
## [3.1.2-shopping-context.1](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.1.1...v3.1.2-shopping-context.1) (2022-05-18)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Fix
|
|
19
|
+
|
|
20
|
+
* use shopping context for storefront/personal offer checks (#CX12-5158) ([1f82ec5](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/1f82ec5852f45aabe374201d54bf0424e0bad4f4)), closes [#CX12-5158](https://code.tls.nuskin.io/ns-am/ux/product-components/issues/CX12-5158)
|
|
21
|
+
|
|
1
22
|
## [3.1.1](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.1.0...v3.1.1) (2022-05-17)
|
|
2
23
|
|
|
3
24
|
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
:max-price="maxPrice"
|
|
30
30
|
:mobile-side-by-side="mobileSideBySide"
|
|
31
31
|
:no-action="noAction"
|
|
32
|
+
:show-action="showAction"
|
|
32
33
|
:original-price="originalPrice"
|
|
33
34
|
:original-price-label="originalPriceLabel"
|
|
34
35
|
:original-price-type="originalPriceType"
|
|
@@ -58,7 +59,9 @@
|
|
|
58
59
|
@add-to-adr="handleAddToAdr"
|
|
59
60
|
@card-click="handleCardClick"
|
|
60
61
|
@favorite-click="handleFavoriteClick"
|
|
61
|
-
|
|
62
|
+
>
|
|
63
|
+
<slot />
|
|
64
|
+
</NsProductCardBase>
|
|
62
65
|
</template>
|
|
63
66
|
|
|
64
67
|
<script>
|
|
@@ -114,7 +117,11 @@ export default {
|
|
|
114
117
|
/**
|
|
115
118
|
* Won't show the Action area on hover
|
|
116
119
|
*/
|
|
117
|
-
noAction: Boolean
|
|
120
|
+
noAction: Boolean,
|
|
121
|
+
/**
|
|
122
|
+
* Force the Action area to always show
|
|
123
|
+
*/
|
|
124
|
+
showAction: Boolean
|
|
118
125
|
},
|
|
119
126
|
data() {
|
|
120
127
|
return {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
@mouseleave="closeAction"
|
|
16
16
|
@click="handleCardClick"
|
|
17
17
|
>
|
|
18
|
+
<slot />
|
|
18
19
|
<!-- EXCLUSIVE OFFER ICON & LABEL -->
|
|
19
20
|
<div v-if="isExclusive && !hideExclusiveIcon" :class="$style.exclusive">
|
|
20
21
|
<NsIcon
|
|
@@ -403,7 +404,7 @@ export default {
|
|
|
403
404
|
);
|
|
404
405
|
},
|
|
405
406
|
showSkuPrices() {
|
|
406
|
-
return !this.isBaseSku && !this.noAction;
|
|
407
|
+
return !this.isBaseSku && (!this.noAction || this.forcesv);
|
|
407
408
|
},
|
|
408
409
|
showExclusiveOfferLabel() {
|
|
409
410
|
return !(this.hideExclusiveTextOnMobile || this.useMobileSideBySide);
|
package/index.js
CHANGED
|
@@ -33,6 +33,7 @@ import NsProductList from "./components/NsProductList.vue";
|
|
|
33
33
|
import NsProductListSortable from "./components/NsProductListSortable.vue";
|
|
34
34
|
import NsProductLine from "./components/NsProductLine.vue";
|
|
35
35
|
import NsProductOffer from "./components/NsProductOffer.vue";
|
|
36
|
+
import NsProductQuantitySelector from "./components/NsProductQuantitySelector";
|
|
36
37
|
|
|
37
38
|
export {
|
|
38
39
|
// Services
|
|
@@ -52,5 +53,6 @@ export {
|
|
|
52
53
|
NsProductList,
|
|
53
54
|
NsProductListSortable,
|
|
54
55
|
NsProductLine,
|
|
55
|
-
NsProductOffer
|
|
56
|
+
NsProductOffer,
|
|
57
|
+
NsProductQuantitySelector
|
|
56
58
|
};
|
package/mixins/NsProductMixin.js
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
StringService,
|
|
4
4
|
util,
|
|
5
5
|
SitesSessionStorageService,
|
|
6
|
+
ShoppingContext,
|
|
6
7
|
StoreFrontSponsorStorageService,
|
|
7
8
|
PersonalOfferStorageService,
|
|
8
9
|
dateFormatter,
|
|
@@ -17,7 +18,7 @@ import {
|
|
|
17
18
|
Product as ShopProduct
|
|
18
19
|
} from "@nuskin/ns-shop";
|
|
19
20
|
import webLoyalty from "@nuskin/ns-loyalty-web";
|
|
20
|
-
import { getProp, getFullUrl
|
|
21
|
+
import { getProp, getFullUrl } from "@nuskin/ns-common-lib";
|
|
21
22
|
import { PriceType } from "@nuskin/ns-product-lib";
|
|
22
23
|
|
|
23
24
|
//const PRODUCT_SMALL_VARIANT = "product-card.selected-variant";
|
|
@@ -141,6 +142,8 @@ const NsProductMixin = {
|
|
|
141
142
|
imageSet: [],
|
|
142
143
|
isBaseSku: false,
|
|
143
144
|
isExclusive: false,
|
|
145
|
+
isStorefront: false,
|
|
146
|
+
isPersonalOffer: false,
|
|
144
147
|
/**
|
|
145
148
|
* Determines if the current product is a pending or current favorite
|
|
146
149
|
*/
|
|
@@ -255,8 +258,10 @@ const NsProductMixin = {
|
|
|
255
258
|
return !this.hideVariantSelector && (this.isBaseSku || this.isVariantSku);
|
|
256
259
|
},
|
|
257
260
|
showExclusiveOfferMessage() {
|
|
258
|
-
return (
|
|
259
|
-
this.isExclusive &&
|
|
261
|
+
return !!(
|
|
262
|
+
this.isExclusive &&
|
|
263
|
+
!this.userIsQualified &&
|
|
264
|
+
this.exclusiveOfferMessage
|
|
260
265
|
);
|
|
261
266
|
},
|
|
262
267
|
showOriginalCrossedOut() {
|
|
@@ -336,6 +341,13 @@ const NsProductMixin = {
|
|
|
336
341
|
|
|
337
342
|
this.resetProductData(sku);
|
|
338
343
|
|
|
344
|
+
this.isStorefront =
|
|
345
|
+
ShoppingContext.isContext(ShoppingContext.STOREFRONT) &&
|
|
346
|
+
StoreFrontSponsorStorageService.isStorefront();
|
|
347
|
+
this.isPersonalOffer =
|
|
348
|
+
ShoppingContext.isContext(ShoppingContext.PERSONAL_OFFER) &&
|
|
349
|
+
!!(PersonalOfferStorageService.getPersonalOffer() || {}).active;
|
|
350
|
+
|
|
339
351
|
this.activeSku = sku;
|
|
340
352
|
|
|
341
353
|
this.setFromProductData(sku);
|
|
@@ -383,9 +395,7 @@ const NsProductMixin = {
|
|
|
383
395
|
},
|
|
384
396
|
|
|
385
397
|
async setLoyalty() {
|
|
386
|
-
this.hideLoyalty =
|
|
387
|
-
PersonalOfferStorageService.isPersonalOffer() ||
|
|
388
|
-
StoreFrontSponsorStorageService.isStorefront();
|
|
398
|
+
this.hideLoyalty = this.isStorefront || this.isPersonalOffer;
|
|
389
399
|
let localLoyaltyData =
|
|
390
400
|
JSON.parse(localStorage.getItem("loyaltyData")) || null;
|
|
391
401
|
|
|
@@ -576,6 +586,52 @@ const NsProductMixin = {
|
|
|
576
586
|
return;
|
|
577
587
|
}
|
|
578
588
|
|
|
589
|
+
if (this.product.status === ProductStatus.ReleasedForSale) {
|
|
590
|
+
if (this.maxQuantity > 0) {
|
|
591
|
+
this.enable();
|
|
592
|
+
this.statusMessageKey = "releasedForSale";
|
|
593
|
+
|
|
594
|
+
if (
|
|
595
|
+
this.product.backOrderDate &&
|
|
596
|
+
this.localTranslations.backOrderedWithDate
|
|
597
|
+
) {
|
|
598
|
+
this.statusMessage = this.localTranslations.backOrderedWithDate.replace(
|
|
599
|
+
"%date%",
|
|
600
|
+
dateFormatter.getCountryFormattedDate(
|
|
601
|
+
this.product.backOrderDate,
|
|
602
|
+
this.locale
|
|
603
|
+
)
|
|
604
|
+
);
|
|
605
|
+
this.statusMessageKey = "backOrderedWithDate";
|
|
606
|
+
}
|
|
607
|
+
} else {
|
|
608
|
+
this.disable();
|
|
609
|
+
|
|
610
|
+
if (!this.isExclusive) {
|
|
611
|
+
if (this.product.availableQuantity > 0) {
|
|
612
|
+
this.statusMessage = this.localTranslations.reachedPurchaseLimit;
|
|
613
|
+
this.statusMessageKey = "reachedPurchaseLimit";
|
|
614
|
+
} else {
|
|
615
|
+
this.statusMessage = this.localTranslations.outOfStock;
|
|
616
|
+
this.statusMessageKey = "outOfStock";
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
} else {
|
|
621
|
+
this.disable();
|
|
622
|
+
|
|
623
|
+
if (this.product.status === ProductStatus.Discontinued) {
|
|
624
|
+
this.statusMessage = this.localTranslations.discontinued;
|
|
625
|
+
this.statusMessageKey = "discontinued";
|
|
626
|
+
} else if (this.product.status === ProductStatus.NotReleasedForSale) {
|
|
627
|
+
this.statusMessage = this.localTranslations.notReleasedForSale;
|
|
628
|
+
this.statusMessageKey = "notReleasedForSale";
|
|
629
|
+
} else if (this.product.status === ProductStatus.StopStatus) {
|
|
630
|
+
this.statusMessage = this.localTranslations.stopStatus;
|
|
631
|
+
this.statusMessageKey = "stopStatus";
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
579
635
|
this.exclusiveOfferMessage = "";
|
|
580
636
|
if (this.isExclusive) {
|
|
581
637
|
if (this.isLoggedIn) {
|
|
@@ -624,52 +680,6 @@ const NsProductMixin = {
|
|
|
624
680
|
this.exclusiveOfferMessage = this.localTranslations.exclusiveOfferMessage;
|
|
625
681
|
}
|
|
626
682
|
}
|
|
627
|
-
|
|
628
|
-
if (this.product.status === ProductStatus.ReleasedForSale) {
|
|
629
|
-
if (this.maxQuantity > 0) {
|
|
630
|
-
this.enable();
|
|
631
|
-
this.statusMessageKey = "releasedForSale";
|
|
632
|
-
|
|
633
|
-
if (
|
|
634
|
-
this.product.backOrderDate &&
|
|
635
|
-
this.localTranslations.backOrderedWithDate
|
|
636
|
-
) {
|
|
637
|
-
this.statusMessage = this.localTranslations.backOrderedWithDate.replace(
|
|
638
|
-
"%date%",
|
|
639
|
-
dateFormatter.getCountryFormattedDate(
|
|
640
|
-
this.product.backOrderDate,
|
|
641
|
-
this.locale
|
|
642
|
-
)
|
|
643
|
-
);
|
|
644
|
-
this.statusMessageKey = "backOrderedWithDate";
|
|
645
|
-
}
|
|
646
|
-
} else {
|
|
647
|
-
this.disable();
|
|
648
|
-
|
|
649
|
-
if (!this.isExclusive) {
|
|
650
|
-
if (this.product.availableQuantity > 0) {
|
|
651
|
-
this.statusMessage = this.localTranslations.reachedPurchaseLimit;
|
|
652
|
-
this.statusMessageKey = "reachedPurchaseLimit";
|
|
653
|
-
} else {
|
|
654
|
-
this.statusMessage = this.localTranslations.outOfStock;
|
|
655
|
-
this.statusMessageKey = "outOfStock";
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
} else {
|
|
660
|
-
this.disable();
|
|
661
|
-
|
|
662
|
-
if (this.product.status === ProductStatus.Discontinued) {
|
|
663
|
-
this.statusMessage = this.localTranslations.discontinued;
|
|
664
|
-
this.statusMessageKey = "discontinued";
|
|
665
|
-
} else if (this.product.status === ProductStatus.NotReleasedForSale) {
|
|
666
|
-
this.statusMessage = this.localTranslations.notReleasedForSale;
|
|
667
|
-
this.statusMessageKey = "notReleasedForSale";
|
|
668
|
-
} else if (this.product.status === ProductStatus.StopStatus) {
|
|
669
|
-
this.statusMessage = this.localTranslations.stopStatus;
|
|
670
|
-
this.statusMessageKey = "stopStatus";
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
683
|
},
|
|
674
684
|
|
|
675
685
|
/**
|
|
@@ -756,8 +766,6 @@ const NsProductMixin = {
|
|
|
756
766
|
},
|
|
757
767
|
|
|
758
768
|
setHideAdr() {
|
|
759
|
-
const isPersonalOffer = PersonalOfferStorageService.isPersonalOffer();
|
|
760
|
-
const isStorefront = StoreFrontSponsorStorageService.isStorefront();
|
|
761
769
|
const isSkinConsult = util.isSkinConsult();
|
|
762
770
|
const mySiteHideAdr = !!(
|
|
763
771
|
this.marketConfig &&
|
|
@@ -767,8 +775,8 @@ const NsProductMixin = {
|
|
|
767
775
|
this.hideAdr =
|
|
768
776
|
!this.adrHasPriority &&
|
|
769
777
|
(this.hideAdrOverride ||
|
|
770
|
-
isPersonalOffer ||
|
|
771
|
-
((isStorefront || isSkinConsult) && mySiteHideAdr));
|
|
778
|
+
this.isPersonalOffer ||
|
|
779
|
+
((this.isStorefront || isSkinConsult) && mySiteHideAdr));
|
|
772
780
|
},
|
|
773
781
|
|
|
774
782
|
goToDetails() {
|
|
@@ -807,27 +815,22 @@ const NsProductMixin = {
|
|
|
807
815
|
|
|
808
816
|
redirectToDetailsPage() {
|
|
809
817
|
const sponsor = StoreFrontSponsorStorageService.getStoreFrontSponsor();
|
|
810
|
-
const
|
|
811
|
-
const sponsorSubdomain = isStorefront
|
|
818
|
+
const sponsorSubdomain = this.isStorefront
|
|
812
819
|
? Object.keys(sponsor.storefront || {})[0] || ""
|
|
813
820
|
: "";
|
|
814
|
-
const isPersonalOffer = !!(
|
|
815
|
-
PersonalOfferStorageService.getPersonalOffer() || {}
|
|
816
|
-
).active;
|
|
817
|
-
const useMysiteUrl = isStorefront && !isPersonalOffer;
|
|
818
821
|
const baseUrl =
|
|
819
822
|
window.location.hostname === "localhost"
|
|
820
|
-
?
|
|
823
|
+
? this.isStorefront
|
|
821
824
|
? `https://mysite${
|
|
822
825
|
this.runConfig.envCode === "test" ? ".test" : ""
|
|
823
826
|
}.mynuskin.com`
|
|
824
827
|
: this.marketConfig.siteUrl
|
|
825
828
|
: window.location.origin;
|
|
826
829
|
let pdpPath = `products/product.${this.product.sku}`;
|
|
827
|
-
if (isStorefront || isPersonalOffer) {
|
|
830
|
+
if (this.isStorefront || this.isPersonalOffer) {
|
|
828
831
|
pdpPath += ".mysite";
|
|
829
832
|
}
|
|
830
|
-
if (
|
|
833
|
+
if (this.isStorefront) {
|
|
831
834
|
pdpPath += `.${sponsorSubdomain}`;
|
|
832
835
|
}
|
|
833
836
|
pdpPath += ".html";
|
|
@@ -1250,6 +1253,8 @@ const NsProductMixin = {
|
|
|
1250
1253
|
this.imageSet = [];
|
|
1251
1254
|
this.isBaseSku = false;
|
|
1252
1255
|
this.isExclusive = false;
|
|
1256
|
+
this.isStorefront = false;
|
|
1257
|
+
this.isPersonalOffer = false;
|
|
1253
1258
|
this.isFavorite = false;
|
|
1254
1259
|
this.isSale = false;
|
|
1255
1260
|
this.isVariantSku = false;
|