@infrab4a/connect-angular 3.10.0-beta.0 → 3.10.0-beta.1
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/bundles/infrab4a-connect-angular.umd.js +18 -7
- package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
- package/esm2015/services/cart.service.js +11 -4
- package/esm2015/services/coupon.service.js +10 -6
- package/fesm2015/infrab4a-connect-angular.js +19 -8
- package/fesm2015/infrab4a-connect-angular.js.map +1 -1
- package/package.json +2 -2
- package/services/cart.service.d.ts +1 -0
|
@@ -576,12 +576,16 @@
|
|
|
576
576
|
userTypes.push(i3.Exclusivities.COLLABORATORS);
|
|
577
577
|
if (coupon.exclusivityType.includes(i3.Exclusivities.SPECIFIC_USER) && coupon.userExclusiveEmail.includes(user.email))
|
|
578
578
|
userTypes.push(i3.Exclusivities.SPECIFIC_USER);
|
|
579
|
-
if (coupon.exclusivityType.includes(i3.Exclusivities.ACTIVE_SUBSCRIBER) &&
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
coupon.exclusivityType.includes(i3.Exclusivities.INACTIVE_SUBSCRIBER)) &&
|
|
583
|
-
!user.isSubscriber)
|
|
579
|
+
if (coupon.exclusivityType.includes(i3.Exclusivities.ACTIVE_SUBSCRIBER) &&
|
|
580
|
+
user.isSubscriber &&
|
|
581
|
+
user.subscriptionPlan != '')
|
|
584
582
|
userTypes.push(i3.Exclusivities.ACTIVE_SUBSCRIBER);
|
|
583
|
+
if (user.isSubscriber &&
|
|
584
|
+
user.subscriptionPlan == '' &&
|
|
585
|
+
coupon.exclusivityType.includes(i3.Exclusivities.INACTIVE_SUBSCRIBER))
|
|
586
|
+
userTypes.push(i3.Exclusivities.INACTIVE_SUBSCRIBER);
|
|
587
|
+
if (coupon.exclusivityType.includes(i3.Exclusivities.NON_SUBSCRIBER) && !user.isSubscriber)
|
|
588
|
+
userTypes.push(i3.Exclusivities.NON_SUBSCRIBER);
|
|
585
589
|
return coupon.exclusivityType.some(function (r) { return userTypes.includes(r); });
|
|
586
590
|
};
|
|
587
591
|
CouponService.prototype.getCouponCategoriesId = function (productsCategories) {
|
|
@@ -819,6 +823,7 @@
|
|
|
819
823
|
shop: checkout.shop || this.defaultShop,
|
|
820
824
|
isSubscriber: (_e = checkout.user) === null || _e === void 0 ? void 0 : _e.isSubscriber,
|
|
821
825
|
});
|
|
826
|
+
i3.RoundProductPricesHelper.roundProductPrices(item);
|
|
822
827
|
return [2 /*return*/, {
|
|
823
828
|
checkout: checkout,
|
|
824
829
|
lineItem: i3.LineItem.toInstance({
|
|
@@ -829,7 +834,7 @@
|
|
|
829
834
|
slug: slug !== null && slug !== void 0 ? slug : product.slug,
|
|
830
835
|
sku: sku !== null && sku !== void 0 ? sku : product.sku,
|
|
831
836
|
stock: stock,
|
|
832
|
-
price: price,
|
|
837
|
+
price: this.roundPrice(price),
|
|
833
838
|
image: image,
|
|
834
839
|
weight: weight !== null && weight !== void 0 ? weight : product.weight,
|
|
835
840
|
quantity: (item.quantity || 0) + (quantity || 0),
|
|
@@ -849,7 +854,9 @@
|
|
|
849
854
|
var info = product.price;
|
|
850
855
|
if (product.isGift)
|
|
851
856
|
return 0;
|
|
852
|
-
return isSubscriber && info.subscriberPrice > 0
|
|
857
|
+
return isSubscriber && info.subscriberPrice > 0
|
|
858
|
+
? Number(info.subscriberPrice.toFixed(2))
|
|
859
|
+
: Number(info.price.toFixed(2));
|
|
853
860
|
};
|
|
854
861
|
this.checkMaxStock = function (item, quantity) {
|
|
855
862
|
var _a;
|
|
@@ -945,6 +952,10 @@
|
|
|
945
952
|
var _this = this;
|
|
946
953
|
return this.checkoutService.getCheckout(checkoutData).pipe(operators.map(function (checkout) { return checkout.lineItems; }), operators.concatMap(function (lineItems) { return rxjs.of(_this.generateCartObject(lineItems)); }));
|
|
947
954
|
};
|
|
955
|
+
CartService.prototype.roundPrice = function (productPrice) {
|
|
956
|
+
var price = productPrice.price, fullPrice = productPrice.fullPrice, subscriberPrice = productPrice.subscriberPrice;
|
|
957
|
+
return Object.assign(Object.assign(Object.assign({}, productPrice), { price: Number(price.toFixed(2)), fullPrice: Number(fullPrice.toFixed(2)) }), (subscriberPrice && { subscriberPrice: Number(subscriberPrice.toFixed(2)) }));
|
|
958
|
+
};
|
|
948
959
|
CartService.prototype.getProductData = function (productId) {
|
|
949
960
|
return __awaiter(this, void 0, void 0, function () {
|
|
950
961
|
var product, variant, error_1;
|