@moonbase.sh/storefront-api 0.4.0 → 0.4.2
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 +25 -8
- package/dist/index.d.cts +3663 -182
- package/dist/index.d.ts +3663 -182
- package/dist/index.js +25 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -700,6 +700,12 @@ var lineItemProductSchema = import_zod11.z.object({
|
|
|
700
700
|
tagline: import_zod11.z.string(),
|
|
701
701
|
iconUrl: import_zod11.z.string().nullable()
|
|
702
702
|
});
|
|
703
|
+
var lineItemTotalSchema = import_zod11.z.object({
|
|
704
|
+
original: moneySchema,
|
|
705
|
+
discount: moneySchema,
|
|
706
|
+
subtotal: moneySchema,
|
|
707
|
+
due: moneySchema
|
|
708
|
+
});
|
|
703
709
|
var openProductLineItem = import_zod11.z.object({
|
|
704
710
|
id: import_zod11.z.string(),
|
|
705
711
|
type: import_zod11.z.literal("Product"),
|
|
@@ -710,6 +716,7 @@ var openProductLineItem = import_zod11.z.object({
|
|
|
710
716
|
isSubcriptionPayment: import_zod11.z.boolean().nullish(),
|
|
711
717
|
price: priceCollectionSchema.optional(),
|
|
712
718
|
variation: pricingVariationSchema.optional(),
|
|
719
|
+
total: lineItemTotalSchema.nullish(),
|
|
713
720
|
product: lineItemProductSchema.optional(),
|
|
714
721
|
appliedDiscount: discountSchema.optional()
|
|
715
722
|
});
|
|
@@ -733,6 +740,7 @@ var openBundleLineItem = import_zod11.z.object({
|
|
|
733
740
|
isSubcriptionPayment: import_zod11.z.boolean().nullish(),
|
|
734
741
|
price: priceCollectionSchema.optional(),
|
|
735
742
|
variation: pricingVariationSchema.optional(),
|
|
743
|
+
total: lineItemTotalSchema.nullish(),
|
|
736
744
|
bundle: lineItemBundleSchema.optional(),
|
|
737
745
|
appliedDiscount: discountSchema.optional()
|
|
738
746
|
});
|
|
@@ -740,21 +748,22 @@ var openOrderLineItem = import_zod11.z.discriminatedUnion("type", [
|
|
|
740
748
|
openProductLineItem,
|
|
741
749
|
openBundleLineItem
|
|
742
750
|
]);
|
|
751
|
+
var orderTotalSchema = import_zod11.z.object({
|
|
752
|
+
original: moneySchema,
|
|
753
|
+
discount: moneySchema,
|
|
754
|
+
subtotal: moneySchema,
|
|
755
|
+
taxes: moneySchema,
|
|
756
|
+
due: moneySchema
|
|
757
|
+
});
|
|
743
758
|
var openOrderSchema = import_zod11.z.object({
|
|
744
759
|
id: import_zod11.z.string(),
|
|
745
760
|
currency: import_zod11.z.string(),
|
|
761
|
+
total: orderTotalSchema.nullish(),
|
|
746
762
|
items: openOrderLineItem.array(),
|
|
747
763
|
couponsApplied: couponSchema.array(),
|
|
748
764
|
checkoutUrl: import_zod11.z.string().optional(),
|
|
749
765
|
embeddedCheckoutUrl: import_zod11.z.string().optional()
|
|
750
766
|
});
|
|
751
|
-
var orderTotalSchema = import_zod11.z.object({
|
|
752
|
-
original: moneySchema,
|
|
753
|
-
discount: moneySchema,
|
|
754
|
-
subtotal: moneySchema,
|
|
755
|
-
taxes: moneySchema,
|
|
756
|
-
due: moneySchema
|
|
757
|
-
});
|
|
758
767
|
var customerSnapshotSchema = import_zod11.z.object({
|
|
759
768
|
name: import_zod11.z.string().nullable(),
|
|
760
769
|
businessName: import_zod11.z.string().nullable(),
|
|
@@ -853,7 +862,15 @@ var OrderEndpoints = class {
|
|
|
853
862
|
this.api = api;
|
|
854
863
|
}
|
|
855
864
|
async get(orderId, options) {
|
|
856
|
-
const
|
|
865
|
+
const query = new URLSearchParams();
|
|
866
|
+
if (options == null ? void 0 : options.finalize) {
|
|
867
|
+
query.append("finalize", "true");
|
|
868
|
+
}
|
|
869
|
+
if (options == null ? void 0 : options.checkout) {
|
|
870
|
+
query.append("checkout", "true");
|
|
871
|
+
query.append("returnUrl", options.checkout.returnUrl);
|
|
872
|
+
}
|
|
873
|
+
const response = await this.api.fetch(`/api/customer/orders/${orderId}?${query.toString()}`, orderSchema, {
|
|
857
874
|
abort: options == null ? void 0 : options.abort
|
|
858
875
|
});
|
|
859
876
|
return response.data;
|