@moonbase.sh/vue 0.2.131 → 0.2.133
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/dist/index.cjs +5 -3
- package/dist/index.d.cts +70 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +5 -3
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -586,18 +586,20 @@ function useCart(context) {
|
|
|
586
586
|
total: (0, import_vue6.computed)(() => {
|
|
587
587
|
const currency = storefront.currentOrder.value.currency || storefront.storefront.value.suggestedCurrency;
|
|
588
588
|
const total = storefront.currentOrder.value.items.reduce((agg, item) => {
|
|
589
|
-
var _a, _b, _c, _d, _e, _f;
|
|
589
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
590
590
|
let price;
|
|
591
591
|
if (item.type === "Product") {
|
|
592
592
|
const product = storefront.storefront.value.products.find((p) => p.id === item.productId);
|
|
593
593
|
const variations = (product == null ? void 0 : product.variations) || [];
|
|
594
594
|
const pickedVariation = variations.find((v) => v.id === item.variationId);
|
|
595
|
-
|
|
595
|
+
const eligiblePricingTiers = (_b = (_a = pickedVariation == null ? void 0 : pickedVariation.pricingTiers) == null ? void 0 : _a.filter((tier) => item.quantity >= tier.minQuantity)) != null ? _b : [];
|
|
596
|
+
const matchingPricingTier = eligiblePricingTiers.length > 0 ? eligiblePricingTiers[eligiblePricingTiers.length - 1] : null;
|
|
597
|
+
price = (_f = (_e = (_c = matchingPricingTier == null ? void 0 : matchingPricingTier.price[currency]) != null ? _c : pickedVariation == null ? void 0 : pickedVariation.price[currency]) != null ? _e : (_d = product == null ? void 0 : product.defaultVariation) == null ? void 0 : _d.price[currency]) != null ? _f : 0;
|
|
596
598
|
} else {
|
|
597
599
|
const bundle = storefront.storefront.value.bundles.find((b) => b.id === item.bundleId);
|
|
598
600
|
const variations = (bundle == null ? void 0 : bundle.variations) || [];
|
|
599
601
|
const pickedVariation = variations.find((v) => v.id === item.variationId);
|
|
600
|
-
price = (
|
|
602
|
+
price = (_i = (_h = pickedVariation == null ? void 0 : pickedVariation.price[currency]) != null ? _h : (_g = bundle == null ? void 0 : bundle.defaultVariation) == null ? void 0 : _g.price[currency]) != null ? _i : 0;
|
|
601
603
|
}
|
|
602
604
|
return agg + price * item.quantity;
|
|
603
605
|
}, 0);
|
package/dist/index.d.cts
CHANGED
|
@@ -197,6 +197,11 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
197
197
|
description?: string | undefined;
|
|
198
198
|
total?: Record<string, number> | undefined;
|
|
199
199
|
} | undefined;
|
|
200
|
+
pricingTiers?: {
|
|
201
|
+
minQuantity: number;
|
|
202
|
+
originalPrice: Record<string, number>;
|
|
203
|
+
price: Record<string, number>;
|
|
204
|
+
}[] | null | undefined;
|
|
200
205
|
} | undefined;
|
|
201
206
|
appliedDiscount?: {
|
|
202
207
|
type: "PercentageOffDiscount";
|
|
@@ -254,6 +259,11 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
254
259
|
description?: string | undefined;
|
|
255
260
|
total?: Record<string, number> | undefined;
|
|
256
261
|
} | undefined;
|
|
262
|
+
pricingTiers?: {
|
|
263
|
+
minQuantity: number;
|
|
264
|
+
originalPrice: Record<string, number>;
|
|
265
|
+
price: Record<string, number>;
|
|
266
|
+
}[] | null | undefined;
|
|
257
267
|
} | undefined;
|
|
258
268
|
appliedDiscount?: {
|
|
259
269
|
type: "PercentageOffDiscount";
|
|
@@ -573,6 +583,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
573
583
|
description?: string | undefined;
|
|
574
584
|
total?: Record<string, number> | undefined;
|
|
575
585
|
} | undefined;
|
|
586
|
+
pricingTiers?: {
|
|
587
|
+
minQuantity: number;
|
|
588
|
+
originalPrice: Record<string, number>;
|
|
589
|
+
price: Record<string, number>;
|
|
590
|
+
}[] | null | undefined;
|
|
576
591
|
} | undefined;
|
|
577
592
|
variations?: {
|
|
578
593
|
id: string;
|
|
@@ -594,6 +609,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
594
609
|
description?: string | undefined;
|
|
595
610
|
total?: Record<string, number> | undefined;
|
|
596
611
|
} | undefined;
|
|
612
|
+
pricingTiers?: {
|
|
613
|
+
minQuantity: number;
|
|
614
|
+
originalPrice: Record<string, number>;
|
|
615
|
+
price: Record<string, number>;
|
|
616
|
+
}[] | null | undefined;
|
|
597
617
|
}[] | undefined;
|
|
598
618
|
};
|
|
599
619
|
quantity: number;
|
|
@@ -652,6 +672,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
652
672
|
description?: string | undefined;
|
|
653
673
|
total?: Record<string, number> | undefined;
|
|
654
674
|
} | undefined;
|
|
675
|
+
pricingTiers?: {
|
|
676
|
+
minQuantity: number;
|
|
677
|
+
originalPrice: Record<string, number>;
|
|
678
|
+
price: Record<string, number>;
|
|
679
|
+
}[] | null | undefined;
|
|
655
680
|
} | undefined;
|
|
656
681
|
variations?: {
|
|
657
682
|
id: string;
|
|
@@ -673,6 +698,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
673
698
|
description?: string | undefined;
|
|
674
699
|
total?: Record<string, number> | undefined;
|
|
675
700
|
} | undefined;
|
|
701
|
+
pricingTiers?: {
|
|
702
|
+
minQuantity: number;
|
|
703
|
+
originalPrice: Record<string, number>;
|
|
704
|
+
price: Record<string, number>;
|
|
705
|
+
}[] | null | undefined;
|
|
676
706
|
}[] | undefined;
|
|
677
707
|
} & {
|
|
678
708
|
included?: boolean | undefined;
|
|
@@ -697,6 +727,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
697
727
|
description?: string | undefined;
|
|
698
728
|
total?: Record<string, number> | undefined;
|
|
699
729
|
} | undefined;
|
|
730
|
+
pricingTiers?: {
|
|
731
|
+
minQuantity: number;
|
|
732
|
+
originalPrice: Record<string, number>;
|
|
733
|
+
price: Record<string, number>;
|
|
734
|
+
}[] | null | undefined;
|
|
700
735
|
} | undefined;
|
|
701
736
|
variations?: {
|
|
702
737
|
id: string;
|
|
@@ -718,6 +753,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
718
753
|
description?: string | undefined;
|
|
719
754
|
total?: Record<string, number> | undefined;
|
|
720
755
|
} | undefined;
|
|
756
|
+
pricingTiers?: {
|
|
757
|
+
minQuantity: number;
|
|
758
|
+
originalPrice: Record<string, number>;
|
|
759
|
+
price: Record<string, number>;
|
|
760
|
+
}[] | null | undefined;
|
|
721
761
|
}[] | undefined;
|
|
722
762
|
};
|
|
723
763
|
quantity: number;
|
|
@@ -774,6 +814,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
774
814
|
description?: string | undefined;
|
|
775
815
|
total?: Record<string, number> | undefined;
|
|
776
816
|
} | undefined;
|
|
817
|
+
pricingTiers?: {
|
|
818
|
+
minQuantity: number;
|
|
819
|
+
originalPrice: Record<string, number>;
|
|
820
|
+
price: Record<string, number>;
|
|
821
|
+
}[] | null | undefined;
|
|
777
822
|
} | undefined;
|
|
778
823
|
variations?: {
|
|
779
824
|
id: string;
|
|
@@ -795,6 +840,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
795
840
|
description?: string | undefined;
|
|
796
841
|
total?: Record<string, number> | undefined;
|
|
797
842
|
} | undefined;
|
|
843
|
+
pricingTiers?: {
|
|
844
|
+
minQuantity: number;
|
|
845
|
+
originalPrice: Record<string, number>;
|
|
846
|
+
price: Record<string, number>;
|
|
847
|
+
}[] | null | undefined;
|
|
798
848
|
}[] | undefined;
|
|
799
849
|
};
|
|
800
850
|
quantity: number;
|
|
@@ -853,6 +903,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
853
903
|
description?: string | undefined;
|
|
854
904
|
total?: Record<string, number> | undefined;
|
|
855
905
|
} | undefined;
|
|
906
|
+
pricingTiers?: {
|
|
907
|
+
minQuantity: number;
|
|
908
|
+
originalPrice: Record<string, number>;
|
|
909
|
+
price: Record<string, number>;
|
|
910
|
+
}[] | null | undefined;
|
|
856
911
|
} | undefined;
|
|
857
912
|
variations?: {
|
|
858
913
|
id: string;
|
|
@@ -874,6 +929,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
874
929
|
description?: string | undefined;
|
|
875
930
|
total?: Record<string, number> | undefined;
|
|
876
931
|
} | undefined;
|
|
932
|
+
pricingTiers?: {
|
|
933
|
+
minQuantity: number;
|
|
934
|
+
originalPrice: Record<string, number>;
|
|
935
|
+
price: Record<string, number>;
|
|
936
|
+
}[] | null | undefined;
|
|
877
937
|
}[] | undefined;
|
|
878
938
|
} & {
|
|
879
939
|
included?: boolean | undefined;
|
|
@@ -898,6 +958,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
898
958
|
description?: string | undefined;
|
|
899
959
|
total?: Record<string, number> | undefined;
|
|
900
960
|
} | undefined;
|
|
961
|
+
pricingTiers?: {
|
|
962
|
+
minQuantity: number;
|
|
963
|
+
originalPrice: Record<string, number>;
|
|
964
|
+
price: Record<string, number>;
|
|
965
|
+
}[] | null | undefined;
|
|
901
966
|
} | undefined;
|
|
902
967
|
variations?: {
|
|
903
968
|
id: string;
|
|
@@ -919,6 +984,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
919
984
|
description?: string | undefined;
|
|
920
985
|
total?: Record<string, number> | undefined;
|
|
921
986
|
} | undefined;
|
|
987
|
+
pricingTiers?: {
|
|
988
|
+
minQuantity: number;
|
|
989
|
+
originalPrice: Record<string, number>;
|
|
990
|
+
price: Record<string, number>;
|
|
991
|
+
}[] | null | undefined;
|
|
922
992
|
}[] | undefined;
|
|
923
993
|
};
|
|
924
994
|
quantity: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -197,6 +197,11 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
197
197
|
description?: string | undefined;
|
|
198
198
|
total?: Record<string, number> | undefined;
|
|
199
199
|
} | undefined;
|
|
200
|
+
pricingTiers?: {
|
|
201
|
+
minQuantity: number;
|
|
202
|
+
originalPrice: Record<string, number>;
|
|
203
|
+
price: Record<string, number>;
|
|
204
|
+
}[] | null | undefined;
|
|
200
205
|
} | undefined;
|
|
201
206
|
appliedDiscount?: {
|
|
202
207
|
type: "PercentageOffDiscount";
|
|
@@ -254,6 +259,11 @@ declare function useCart(context?: StorefrontContext): {
|
|
|
254
259
|
description?: string | undefined;
|
|
255
260
|
total?: Record<string, number> | undefined;
|
|
256
261
|
} | undefined;
|
|
262
|
+
pricingTiers?: {
|
|
263
|
+
minQuantity: number;
|
|
264
|
+
originalPrice: Record<string, number>;
|
|
265
|
+
price: Record<string, number>;
|
|
266
|
+
}[] | null | undefined;
|
|
257
267
|
} | undefined;
|
|
258
268
|
appliedDiscount?: {
|
|
259
269
|
type: "PercentageOffDiscount";
|
|
@@ -573,6 +583,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
573
583
|
description?: string | undefined;
|
|
574
584
|
total?: Record<string, number> | undefined;
|
|
575
585
|
} | undefined;
|
|
586
|
+
pricingTiers?: {
|
|
587
|
+
minQuantity: number;
|
|
588
|
+
originalPrice: Record<string, number>;
|
|
589
|
+
price: Record<string, number>;
|
|
590
|
+
}[] | null | undefined;
|
|
576
591
|
} | undefined;
|
|
577
592
|
variations?: {
|
|
578
593
|
id: string;
|
|
@@ -594,6 +609,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
594
609
|
description?: string | undefined;
|
|
595
610
|
total?: Record<string, number> | undefined;
|
|
596
611
|
} | undefined;
|
|
612
|
+
pricingTiers?: {
|
|
613
|
+
minQuantity: number;
|
|
614
|
+
originalPrice: Record<string, number>;
|
|
615
|
+
price: Record<string, number>;
|
|
616
|
+
}[] | null | undefined;
|
|
597
617
|
}[] | undefined;
|
|
598
618
|
};
|
|
599
619
|
quantity: number;
|
|
@@ -652,6 +672,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
652
672
|
description?: string | undefined;
|
|
653
673
|
total?: Record<string, number> | undefined;
|
|
654
674
|
} | undefined;
|
|
675
|
+
pricingTiers?: {
|
|
676
|
+
minQuantity: number;
|
|
677
|
+
originalPrice: Record<string, number>;
|
|
678
|
+
price: Record<string, number>;
|
|
679
|
+
}[] | null | undefined;
|
|
655
680
|
} | undefined;
|
|
656
681
|
variations?: {
|
|
657
682
|
id: string;
|
|
@@ -673,6 +698,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
673
698
|
description?: string | undefined;
|
|
674
699
|
total?: Record<string, number> | undefined;
|
|
675
700
|
} | undefined;
|
|
701
|
+
pricingTiers?: {
|
|
702
|
+
minQuantity: number;
|
|
703
|
+
originalPrice: Record<string, number>;
|
|
704
|
+
price: Record<string, number>;
|
|
705
|
+
}[] | null | undefined;
|
|
676
706
|
}[] | undefined;
|
|
677
707
|
} & {
|
|
678
708
|
included?: boolean | undefined;
|
|
@@ -697,6 +727,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
697
727
|
description?: string | undefined;
|
|
698
728
|
total?: Record<string, number> | undefined;
|
|
699
729
|
} | undefined;
|
|
730
|
+
pricingTiers?: {
|
|
731
|
+
minQuantity: number;
|
|
732
|
+
originalPrice: Record<string, number>;
|
|
733
|
+
price: Record<string, number>;
|
|
734
|
+
}[] | null | undefined;
|
|
700
735
|
} | undefined;
|
|
701
736
|
variations?: {
|
|
702
737
|
id: string;
|
|
@@ -718,6 +753,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
718
753
|
description?: string | undefined;
|
|
719
754
|
total?: Record<string, number> | undefined;
|
|
720
755
|
} | undefined;
|
|
756
|
+
pricingTiers?: {
|
|
757
|
+
minQuantity: number;
|
|
758
|
+
originalPrice: Record<string, number>;
|
|
759
|
+
price: Record<string, number>;
|
|
760
|
+
}[] | null | undefined;
|
|
721
761
|
}[] | undefined;
|
|
722
762
|
};
|
|
723
763
|
quantity: number;
|
|
@@ -774,6 +814,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
774
814
|
description?: string | undefined;
|
|
775
815
|
total?: Record<string, number> | undefined;
|
|
776
816
|
} | undefined;
|
|
817
|
+
pricingTiers?: {
|
|
818
|
+
minQuantity: number;
|
|
819
|
+
originalPrice: Record<string, number>;
|
|
820
|
+
price: Record<string, number>;
|
|
821
|
+
}[] | null | undefined;
|
|
777
822
|
} | undefined;
|
|
778
823
|
variations?: {
|
|
779
824
|
id: string;
|
|
@@ -795,6 +840,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
795
840
|
description?: string | undefined;
|
|
796
841
|
total?: Record<string, number> | undefined;
|
|
797
842
|
} | undefined;
|
|
843
|
+
pricingTiers?: {
|
|
844
|
+
minQuantity: number;
|
|
845
|
+
originalPrice: Record<string, number>;
|
|
846
|
+
price: Record<string, number>;
|
|
847
|
+
}[] | null | undefined;
|
|
798
848
|
}[] | undefined;
|
|
799
849
|
};
|
|
800
850
|
quantity: number;
|
|
@@ -853,6 +903,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
853
903
|
description?: string | undefined;
|
|
854
904
|
total?: Record<string, number> | undefined;
|
|
855
905
|
} | undefined;
|
|
906
|
+
pricingTiers?: {
|
|
907
|
+
minQuantity: number;
|
|
908
|
+
originalPrice: Record<string, number>;
|
|
909
|
+
price: Record<string, number>;
|
|
910
|
+
}[] | null | undefined;
|
|
856
911
|
} | undefined;
|
|
857
912
|
variations?: {
|
|
858
913
|
id: string;
|
|
@@ -874,6 +929,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
874
929
|
description?: string | undefined;
|
|
875
930
|
total?: Record<string, number> | undefined;
|
|
876
931
|
} | undefined;
|
|
932
|
+
pricingTiers?: {
|
|
933
|
+
minQuantity: number;
|
|
934
|
+
originalPrice: Record<string, number>;
|
|
935
|
+
price: Record<string, number>;
|
|
936
|
+
}[] | null | undefined;
|
|
877
937
|
}[] | undefined;
|
|
878
938
|
} & {
|
|
879
939
|
included?: boolean | undefined;
|
|
@@ -898,6 +958,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
898
958
|
description?: string | undefined;
|
|
899
959
|
total?: Record<string, number> | undefined;
|
|
900
960
|
} | undefined;
|
|
961
|
+
pricingTiers?: {
|
|
962
|
+
minQuantity: number;
|
|
963
|
+
originalPrice: Record<string, number>;
|
|
964
|
+
price: Record<string, number>;
|
|
965
|
+
}[] | null | undefined;
|
|
901
966
|
} | undefined;
|
|
902
967
|
variations?: {
|
|
903
968
|
id: string;
|
|
@@ -919,6 +984,11 @@ declare function useVoucher(context?: StorefrontContext): {
|
|
|
919
984
|
description?: string | undefined;
|
|
920
985
|
total?: Record<string, number> | undefined;
|
|
921
986
|
} | undefined;
|
|
987
|
+
pricingTiers?: {
|
|
988
|
+
minQuantity: number;
|
|
989
|
+
originalPrice: Record<string, number>;
|
|
990
|
+
price: Record<string, number>;
|
|
991
|
+
}[] | null | undefined;
|
|
922
992
|
}[] | undefined;
|
|
923
993
|
};
|
|
924
994
|
quantity: number;
|
package/dist/index.js
CHANGED
|
@@ -554,18 +554,20 @@ function useCart(context) {
|
|
|
554
554
|
total: computed4(() => {
|
|
555
555
|
const currency = storefront.currentOrder.value.currency || storefront.storefront.value.suggestedCurrency;
|
|
556
556
|
const total = storefront.currentOrder.value.items.reduce((agg, item) => {
|
|
557
|
-
var _a, _b, _c, _d, _e, _f;
|
|
557
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
558
558
|
let price;
|
|
559
559
|
if (item.type === "Product") {
|
|
560
560
|
const product = storefront.storefront.value.products.find((p) => p.id === item.productId);
|
|
561
561
|
const variations = (product == null ? void 0 : product.variations) || [];
|
|
562
562
|
const pickedVariation = variations.find((v) => v.id === item.variationId);
|
|
563
|
-
|
|
563
|
+
const eligiblePricingTiers = (_b = (_a = pickedVariation == null ? void 0 : pickedVariation.pricingTiers) == null ? void 0 : _a.filter((tier) => item.quantity >= tier.minQuantity)) != null ? _b : [];
|
|
564
|
+
const matchingPricingTier = eligiblePricingTiers.length > 0 ? eligiblePricingTiers[eligiblePricingTiers.length - 1] : null;
|
|
565
|
+
price = (_f = (_e = (_c = matchingPricingTier == null ? void 0 : matchingPricingTier.price[currency]) != null ? _c : pickedVariation == null ? void 0 : pickedVariation.price[currency]) != null ? _e : (_d = product == null ? void 0 : product.defaultVariation) == null ? void 0 : _d.price[currency]) != null ? _f : 0;
|
|
564
566
|
} else {
|
|
565
567
|
const bundle = storefront.storefront.value.bundles.find((b) => b.id === item.bundleId);
|
|
566
568
|
const variations = (bundle == null ? void 0 : bundle.variations) || [];
|
|
567
569
|
const pickedVariation = variations.find((v) => v.id === item.variationId);
|
|
568
|
-
price = (
|
|
570
|
+
price = (_i = (_h = pickedVariation == null ? void 0 : pickedVariation.price[currency]) != null ? _h : (_g = bundle == null ? void 0 : bundle.defaultVariation) == null ? void 0 : _g.price[currency]) != null ? _i : 0;
|
|
569
571
|
}
|
|
570
572
|
return agg + price * item.quantity;
|
|
571
573
|
}, 0);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbase.sh/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.133",
|
|
5
5
|
"description": "Package to let you build vue.js storefronts with Moonbase.sh as payment and delivery provider",
|
|
6
6
|
"author": "Tobias Lønnerød Madsen <m@dsen.tv>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@vue/devtools-api": "^6.6.3",
|
|
20
20
|
"uuid": "^9.0.1",
|
|
21
21
|
"zod": "^3.23.8",
|
|
22
|
-
"@moonbase.sh/storefront-api": "0.2.
|
|
22
|
+
"@moonbase.sh/storefront-api": "0.2.133"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/uuid": "^9.0.8",
|