@ecomiq/core 0.1.8 → 0.1.9
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/{client-4ZTG2RZ3.d.ts → client-Ba1r_uiO.d.ts} +4 -4
- package/dist/{client-BpX4yR6S.d.cts → client-Cqcnv2tC.d.cts} +4 -4
- package/dist/client.cjs +72 -77
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +72 -77
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +73 -89
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +64 -54
- package/dist/index.d.ts +64 -54
- package/dist/index.js +73 -88
- package/dist/index.js.map +1 -1
- package/dist/models/collections.cjs +2 -4
- package/dist/models/collections.cjs.map +1 -1
- package/dist/models/collections.d.cts +2 -2
- package/dist/models/collections.d.ts +2 -2
- package/dist/models/collections.js +2 -4
- package/dist/models/collections.js.map +1 -1
- package/dist/models/customer-address.cjs +7 -1
- package/dist/models/customer-address.cjs.map +1 -1
- package/dist/models/customer-address.d.cts +4 -4
- package/dist/models/customer-address.d.ts +4 -4
- package/dist/models/customer-address.js +7 -1
- package/dist/models/customer-address.js.map +1 -1
- package/dist/models/customer-order.cjs +14 -8
- package/dist/models/customer-order.cjs.map +1 -1
- package/dist/models/customer-order.d.cts +1 -5
- package/dist/models/customer-order.d.ts +1 -5
- package/dist/models/customer-order.js +14 -8
- package/dist/models/customer-order.js.map +1 -1
- package/dist/models/customer-profile.cjs +8 -2
- package/dist/models/customer-profile.cjs.map +1 -1
- package/dist/models/customer-profile.d.cts +3 -3
- package/dist/models/customer-profile.d.ts +3 -3
- package/dist/models/customer-profile.js +8 -2
- package/dist/models/customer-profile.js.map +1 -1
- package/dist/models/geo.cjs +2 -4
- package/dist/models/geo.cjs.map +1 -1
- package/dist/models/geo.d.cts +14 -14
- package/dist/models/geo.d.ts +14 -14
- package/dist/models/geo.js +2 -4
- package/dist/models/geo.js.map +1 -1
- package/dist/models/ids.cjs +3 -4
- package/dist/models/ids.cjs.map +1 -1
- package/dist/models/ids.d.cts +8 -8
- package/dist/models/ids.d.ts +8 -8
- package/dist/models/ids.js +3 -5
- package/dist/models/ids.js.map +1 -1
- package/dist/models/products.cjs +12 -19
- package/dist/models/products.cjs.map +1 -1
- package/dist/models/products.d.cts +32 -33
- package/dist/models/products.d.ts +32 -33
- package/dist/models/products.js +13 -19
- package/dist/models/products.js.map +1 -1
- package/dist/models/search.cjs +3 -180
- package/dist/models/search.cjs.map +1 -1
- package/dist/models/search.d.cts +5 -5
- package/dist/models/search.d.ts +5 -5
- package/dist/models/search.js +3 -180
- package/dist/models/search.js.map +1 -1
- package/dist/models/settings.cjs +2 -4
- package/dist/models/settings.cjs.map +1 -1
- package/dist/models/settings.d.cts +63 -63
- package/dist/models/settings.d.ts +63 -63
- package/dist/models/settings.js +2 -4
- package/dist/models/settings.js.map +1 -1
- package/dist/models/storefront-cart.cjs +14 -26
- package/dist/models/storefront-cart.cjs.map +1 -1
- package/dist/models/storefront-cart.d.cts +100 -98
- package/dist/models/storefront-cart.d.ts +100 -98
- package/dist/models/storefront-cart.js +15 -26
- package/dist/models/storefront-cart.js.map +1 -1
- package/dist/models/storefront-checkout.cjs +26 -27
- package/dist/models/storefront-checkout.cjs.map +1 -1
- package/dist/models/storefront-checkout.d.cts +130 -120
- package/dist/models/storefront-checkout.d.ts +130 -120
- package/dist/models/storefront-checkout.js +26 -27
- package/dist/models/storefront-checkout.js.map +1 -1
- package/dist/models/storefront-reviews.cjs +8 -187
- package/dist/models/storefront-reviews.cjs.map +1 -1
- package/dist/models/storefront-reviews.d.cts +17 -17
- package/dist/models/storefront-reviews.d.ts +17 -17
- package/dist/models/storefront-reviews.js +8 -187
- package/dist/models/storefront-reviews.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -110,10 +110,8 @@ function createApi(options = {}) {
|
|
|
110
110
|
postForm: (path, body, schema, opts) => request("POST", path, schema, { ...opts, body })
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
var EntityIdSchema = zod.z.
|
|
114
|
-
|
|
115
|
-
zod.z.string().regex(/^\d+$/, "Expected numeric id")
|
|
116
|
-
]);
|
|
113
|
+
var EntityIdSchema = zod.z.string().min(1, "Expected resource id");
|
|
114
|
+
var CartTokenSchema = zod.z.string().min(1).max(32).regex(/^[A-Za-z0-9_-]+$/, "Expected cart token");
|
|
117
115
|
var NullableEntityIdSchema = EntityIdSchema.nullable();
|
|
118
116
|
var OptionalEntityIdSchema = EntityIdSchema.optional();
|
|
119
117
|
|
|
@@ -128,12 +126,8 @@ var CollectionSchema = zod.z.object({
|
|
|
128
126
|
productCount: zod.z.number().optional()
|
|
129
127
|
});
|
|
130
128
|
var CollectionsSchema = zod.z.array(CollectionSchema);
|
|
131
|
-
var ProductPublicIdSchema = zod.z.union([
|
|
132
|
-
zod.z.string().regex(/^[1-9]\d*$/),
|
|
133
|
-
zod.z.number().int().safe().positive()
|
|
134
|
-
]).transform(String);
|
|
135
129
|
var ProductSummarySchema = zod.z.object({
|
|
136
|
-
id:
|
|
130
|
+
id: EntityIdSchema,
|
|
137
131
|
name: zod.z.string(),
|
|
138
132
|
slug: zod.z.string(),
|
|
139
133
|
productType: zod.z.string(),
|
|
@@ -192,7 +186,7 @@ var ProductsParamsSchema = zod.z.object({
|
|
|
192
186
|
search: zod.z.string().optional(),
|
|
193
187
|
collection: zod.z.string().optional(),
|
|
194
188
|
collections: zod.z.array(zod.z.string()).optional(),
|
|
195
|
-
collectionId:
|
|
189
|
+
collectionId: EntityIdSchema.optional(),
|
|
196
190
|
category: zod.z.string().optional(),
|
|
197
191
|
categories: zod.z.array(zod.z.string()).optional(),
|
|
198
192
|
brand: zod.z.string().optional(),
|
|
@@ -211,7 +205,7 @@ var ProductDetailParamsSchema = zod.z.object({
|
|
|
211
205
|
sellerId: OptionalEntityIdSchema
|
|
212
206
|
});
|
|
213
207
|
var RelatedProductsParamsSchema = zod.z.object({
|
|
214
|
-
productId:
|
|
208
|
+
productId: EntityIdSchema,
|
|
215
209
|
limit: zod.z.number().int().positive().max(12).default(8),
|
|
216
210
|
sellerId: OptionalEntityIdSchema
|
|
217
211
|
});
|
|
@@ -227,7 +221,7 @@ var ProductImageSchema = zod.z.object({
|
|
|
227
221
|
order: zod.z.number().int().nonnegative()
|
|
228
222
|
});
|
|
229
223
|
var VariantItemSchema = zod.z.object({
|
|
230
|
-
id:
|
|
224
|
+
id: EntityIdSchema.nullable(),
|
|
231
225
|
sku: zod.z.string(),
|
|
232
226
|
status: zod.z.string(),
|
|
233
227
|
price: zod.z.number().nonnegative(),
|
|
@@ -238,15 +232,15 @@ var VariantItemSchema = zod.z.object({
|
|
|
238
232
|
});
|
|
239
233
|
var VariantSchema = VariantItemSchema;
|
|
240
234
|
var ProductPriceTierSchema = zod.z.object({
|
|
241
|
-
variantId:
|
|
235
|
+
variantId: EntityIdSchema,
|
|
242
236
|
minQuantity: zod.z.number().int().positive(),
|
|
243
237
|
maxQuantity: zod.z.number().int().positive().nullable(),
|
|
244
238
|
unitPrice: zod.z.number().nonnegative()
|
|
245
239
|
});
|
|
246
240
|
var PriceTierSchema = ProductPriceTierSchema;
|
|
247
241
|
var BundleItemSchema = zod.z.object({
|
|
248
|
-
productId:
|
|
249
|
-
variantId:
|
|
242
|
+
productId: EntityIdSchema,
|
|
243
|
+
variantId: EntityIdSchema,
|
|
250
244
|
productName: zod.z.string(),
|
|
251
245
|
variantName: zod.z.string().nullable(),
|
|
252
246
|
sku: zod.z.string().nullable(),
|
|
@@ -272,7 +266,7 @@ var SizeGuideRowSchema = zod.z.object({
|
|
|
272
266
|
measurements: zod.z.array(SizeGuideMeasurementSchema)
|
|
273
267
|
});
|
|
274
268
|
var SizeGuideSchema = zod.z.object({
|
|
275
|
-
id:
|
|
269
|
+
id: EntityIdSchema,
|
|
276
270
|
name: zod.z.string(),
|
|
277
271
|
slug: zod.z.string(),
|
|
278
272
|
description: zod.z.string().nullable(),
|
|
@@ -284,7 +278,7 @@ var SizeGuideSchema = zod.z.object({
|
|
|
284
278
|
rows: zod.z.array(SizeGuideRowSchema)
|
|
285
279
|
});
|
|
286
280
|
var ProductDetailSchema = zod.z.object({
|
|
287
|
-
id:
|
|
281
|
+
id: EntityIdSchema,
|
|
288
282
|
name: zod.z.string(),
|
|
289
283
|
slug: zod.z.string(),
|
|
290
284
|
description: zod.z.string(),
|
|
@@ -297,7 +291,7 @@ var ProductDetailSchema = zod.z.object({
|
|
|
297
291
|
totalInventory: zod.z.number().int().nonnegative(),
|
|
298
292
|
brand: zod.z.string(),
|
|
299
293
|
category: zod.z.string(),
|
|
300
|
-
categoryId:
|
|
294
|
+
categoryId: EntityIdSchema.nullable(),
|
|
301
295
|
tags: zod.z.array(zod.z.string()),
|
|
302
296
|
specifications: zod.z.array(SpecItemSchema),
|
|
303
297
|
variants: zod.z.array(VariantItemSchema),
|
|
@@ -609,7 +603,7 @@ var ProductAutocompleteParamsSchema = zod.z.object({
|
|
|
609
603
|
sellerId: OptionalEntityIdSchema
|
|
610
604
|
});
|
|
611
605
|
var ProductSuggestionSchema = zod.z.object({
|
|
612
|
-
id:
|
|
606
|
+
id: EntityIdSchema,
|
|
613
607
|
name: zod.z.string(),
|
|
614
608
|
slug: zod.z.string(),
|
|
615
609
|
imageUrl: zod.z.string()
|
|
@@ -628,8 +622,8 @@ async function autocompleteProducts(api, params) {
|
|
|
628
622
|
});
|
|
629
623
|
}
|
|
630
624
|
var StorefrontReviewSchema = zod.z.object({
|
|
631
|
-
id:
|
|
632
|
-
productId:
|
|
625
|
+
id: EntityIdSchema,
|
|
626
|
+
productId: EntityIdSchema,
|
|
633
627
|
isVerifiedPurchase: zod.z.boolean(),
|
|
634
628
|
rating: zod.z.number().int().min(1).max(5),
|
|
635
629
|
title: zod.z.string().nullable(),
|
|
@@ -644,7 +638,7 @@ var StorefrontReviewsSchema = zod.z.object({
|
|
|
644
638
|
totalCount: zod.z.number().int().nonnegative().nullable()
|
|
645
639
|
});
|
|
646
640
|
var ListProductReviewsParamsSchema = zod.z.object({
|
|
647
|
-
productId:
|
|
641
|
+
productId: EntityIdSchema,
|
|
648
642
|
limit: zod.z.number().int().min(1).max(200).optional(),
|
|
649
643
|
cursor: zod.z.string().optional(),
|
|
650
644
|
search: zod.z.string().optional(),
|
|
@@ -653,13 +647,13 @@ var ListProductReviewsParamsSchema = zod.z.object({
|
|
|
653
647
|
rating: zod.z.number().int().min(1).max(5).optional()
|
|
654
648
|
});
|
|
655
649
|
var CreateProductReviewParamsSchema = zod.z.object({
|
|
656
|
-
productId:
|
|
650
|
+
productId: EntityIdSchema,
|
|
657
651
|
rating: zod.z.number().int().min(1).max(5),
|
|
658
652
|
content: zod.z.string().min(1).max(4e3),
|
|
659
653
|
title: zod.z.string().max(200).optional(),
|
|
660
654
|
reviewerName: zod.z.string().min(1).max(200),
|
|
661
655
|
reviewerEmail: zod.z.string().email().max(320),
|
|
662
|
-
orderId:
|
|
656
|
+
orderId: EntityIdSchema.optional()
|
|
663
657
|
});
|
|
664
658
|
|
|
665
659
|
// src/services/review.service.ts
|
|
@@ -695,16 +689,6 @@ async function createProductReview(api, params) {
|
|
|
695
689
|
StorefrontReviewSchema
|
|
696
690
|
);
|
|
697
691
|
}
|
|
698
|
-
function cartVariantIdFromProduct(variantId) {
|
|
699
|
-
if (!/^\d+$/.test(variantId)) {
|
|
700
|
-
throw new RangeError("El variant ID debe ser un integer decimal positivo.");
|
|
701
|
-
}
|
|
702
|
-
const value = BigInt(variantId);
|
|
703
|
-
if (value <= 0n || value > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
704
|
-
throw new RangeError("El variant ID no cabe en un integer seguro de JavaScript.");
|
|
705
|
-
}
|
|
706
|
-
return Number(value);
|
|
707
|
-
}
|
|
708
692
|
var StorefrontAddressSchema = zod.z.object({
|
|
709
693
|
name: zod.z.string().nullable(),
|
|
710
694
|
address1: zod.z.string(),
|
|
@@ -720,8 +704,8 @@ var StorefrontAddressSchema = zod.z.object({
|
|
|
720
704
|
longitude: zod.z.number().nullable()
|
|
721
705
|
});
|
|
722
706
|
var StorefrontCartBundleItemSchema = zod.z.object({
|
|
723
|
-
productId:
|
|
724
|
-
variantId:
|
|
707
|
+
productId: EntityIdSchema,
|
|
708
|
+
variantId: EntityIdSchema,
|
|
725
709
|
productName: zod.z.string(),
|
|
726
710
|
variantName: zod.z.string().nullable(),
|
|
727
711
|
sku: zod.z.string().nullable(),
|
|
@@ -731,13 +715,13 @@ var StorefrontCartBundleItemSchema = zod.z.object({
|
|
|
731
715
|
});
|
|
732
716
|
var StorefrontCartItemSchema = zod.z.object({
|
|
733
717
|
id: EntityIdSchema,
|
|
734
|
-
productId:
|
|
718
|
+
productId: NullableEntityIdSchema,
|
|
735
719
|
title: zod.z.string(),
|
|
736
720
|
variantLabel: zod.z.string().nullable(),
|
|
737
721
|
productHandle: zod.z.string().nullable(),
|
|
738
722
|
thumbnail: zod.z.string().nullable(),
|
|
739
723
|
quantity: zod.z.number().int().positive(),
|
|
740
|
-
variantId:
|
|
724
|
+
variantId: NullableEntityIdSchema,
|
|
741
725
|
variantSku: zod.z.string().nullable(),
|
|
742
726
|
unitPrice: zod.z.number(),
|
|
743
727
|
compareAtUnitPrice: zod.z.number().nullable(),
|
|
@@ -779,6 +763,7 @@ var StorefrontCartStatusSchema = zod.z.enum([
|
|
|
779
763
|
]);
|
|
780
764
|
var StorefrontCartSchema = zod.z.object({
|
|
781
765
|
id: EntityIdSchema,
|
|
766
|
+
token: CartTokenSchema,
|
|
782
767
|
cartNumber: zod.z.string(),
|
|
783
768
|
email: zod.z.string().nullable(),
|
|
784
769
|
phone: zod.z.string().nullable(),
|
|
@@ -800,25 +785,25 @@ var CreateCartParamsSchema = zod.z.object({
|
|
|
800
785
|
email: zod.z.string().email().optional()
|
|
801
786
|
});
|
|
802
787
|
var GetCartParamsSchema = zod.z.object({
|
|
803
|
-
|
|
788
|
+
cartToken: CartTokenSchema
|
|
804
789
|
});
|
|
805
790
|
var CartItemModifierSchema = zod.z.object({
|
|
806
|
-
modifierGroupId:
|
|
807
|
-
optionIds: zod.z.array(
|
|
791
|
+
modifierGroupId: EntityIdSchema,
|
|
792
|
+
optionIds: zod.z.array(EntityIdSchema).min(1)
|
|
808
793
|
});
|
|
809
794
|
var AddCartItemParamsSchema = zod.z.object({
|
|
810
|
-
|
|
811
|
-
variantId:
|
|
795
|
+
cartToken: CartTokenSchema,
|
|
796
|
+
variantId: EntityIdSchema,
|
|
812
797
|
quantity: zod.z.number().int().positive(),
|
|
813
798
|
modifiers: zod.z.array(CartItemModifierSchema).optional()
|
|
814
799
|
});
|
|
815
800
|
var UpdateCartItemQuantityParamsSchema = zod.z.object({
|
|
816
|
-
|
|
801
|
+
cartToken: CartTokenSchema,
|
|
817
802
|
cartItemId: EntityIdSchema,
|
|
818
803
|
quantity: zod.z.number().int().nonnegative()
|
|
819
804
|
});
|
|
820
805
|
var RemoveCartItemParamsSchema = zod.z.object({
|
|
821
|
-
|
|
806
|
+
cartToken: CartTokenSchema,
|
|
822
807
|
cartItemId: EntityIdSchema
|
|
823
808
|
});
|
|
824
809
|
|
|
@@ -838,14 +823,14 @@ async function createCart(api, params) {
|
|
|
838
823
|
async function getCart(api, params) {
|
|
839
824
|
const input = GetCartParamsSchema.parse(params);
|
|
840
825
|
return api.get(
|
|
841
|
-
`carts/${encodeURIComponent(input.
|
|
826
|
+
`carts/${encodeURIComponent(input.cartToken)}`,
|
|
842
827
|
StorefrontCartSchema
|
|
843
828
|
);
|
|
844
829
|
}
|
|
845
830
|
async function addCartItem(api, params) {
|
|
846
831
|
const input = AddCartItemParamsSchema.parse(params);
|
|
847
832
|
return api.post(
|
|
848
|
-
`carts/${encodeURIComponent(input.
|
|
833
|
+
`carts/${encodeURIComponent(input.cartToken)}/items`,
|
|
849
834
|
{
|
|
850
835
|
variantId: input.variantId,
|
|
851
836
|
quantity: input.quantity,
|
|
@@ -858,7 +843,7 @@ async function updateCartItemQuantity(api, params) {
|
|
|
858
843
|
const input = UpdateCartItemQuantityParamsSchema.parse(params);
|
|
859
844
|
return api.request(
|
|
860
845
|
"PATCH",
|
|
861
|
-
`carts/${encodeURIComponent(input.
|
|
846
|
+
`carts/${encodeURIComponent(input.cartToken)}/items/${encodeURIComponent(input.cartItemId)}`,
|
|
862
847
|
StorefrontCartSchema,
|
|
863
848
|
{ body: { quantity: input.quantity } }
|
|
864
849
|
);
|
|
@@ -867,7 +852,7 @@ async function removeCartItem(api, params) {
|
|
|
867
852
|
const input = RemoveCartItemParamsSchema.parse(params);
|
|
868
853
|
return api.request(
|
|
869
854
|
"DELETE",
|
|
870
|
-
`carts/${encodeURIComponent(input.
|
|
855
|
+
`carts/${encodeURIComponent(input.cartToken)}/items/${encodeURIComponent(input.cartItemId)}`,
|
|
871
856
|
StorefrontCartSchema
|
|
872
857
|
);
|
|
873
858
|
}
|
|
@@ -895,7 +880,7 @@ var CheckoutMetadataValueSchema = zod.z.lazy(
|
|
|
895
880
|
])
|
|
896
881
|
);
|
|
897
882
|
var CartBuyerParamsSchema = zod.z.object({
|
|
898
|
-
|
|
883
|
+
cartToken: CartTokenSchema,
|
|
899
884
|
email: zod.z.string().email(),
|
|
900
885
|
firstName: zod.z.string().min(1),
|
|
901
886
|
lastName: zod.z.string().min(1),
|
|
@@ -921,7 +906,7 @@ var CartAddressWriteSchema = zod.z.object({
|
|
|
921
906
|
}).nullable().optional()
|
|
922
907
|
});
|
|
923
908
|
var CartAddressesParamsSchema = zod.z.object({
|
|
924
|
-
|
|
909
|
+
cartToken: CartTokenSchema,
|
|
925
910
|
shippingAddress: CartAddressWriteSchema,
|
|
926
911
|
billingAddress: CartAddressWriteSchema
|
|
927
912
|
});
|
|
@@ -940,9 +925,9 @@ var CartPaymentMethodSchema = zod.z.object({
|
|
|
940
925
|
qrImageUrl: zod.z.string().nullable().optional()
|
|
941
926
|
});
|
|
942
927
|
var StorefrontOrderBumpSchema = zod.z.object({
|
|
943
|
-
id:
|
|
944
|
-
|
|
945
|
-
|
|
928
|
+
id: EntityIdSchema,
|
|
929
|
+
productId: EntityIdSchema,
|
|
930
|
+
variantId: EntityIdSchema,
|
|
946
931
|
productName: zod.z.string(),
|
|
947
932
|
variantName: zod.z.string().nullable().optional(),
|
|
948
933
|
imageUrl: zod.z.string().nullable().optional(),
|
|
@@ -954,7 +939,7 @@ var StorefrontOrderBumpSchema = zod.z.object({
|
|
|
954
939
|
description: zod.z.string().nullable().optional()
|
|
955
940
|
});
|
|
956
941
|
var CartCheckoutReadParamsSchema = zod.z.object({
|
|
957
|
-
|
|
942
|
+
cartToken: CartTokenSchema
|
|
958
943
|
});
|
|
959
944
|
var CartCheckoutReadResponseSchema = zod.z.object({
|
|
960
945
|
cart: StorefrontCartSchema,
|
|
@@ -994,14 +979,14 @@ var CartCheckoutResponseSchema = zod.z.object({
|
|
|
994
979
|
stripePublicKey: zod.z.string().optional(),
|
|
995
980
|
clientSecret: zod.z.string().optional(),
|
|
996
981
|
intentClientSecret: zod.z.string().optional(),
|
|
997
|
-
orderId:
|
|
982
|
+
orderId: EntityIdSchema.optional(),
|
|
998
983
|
orderGroup: zod.z.string().optional(),
|
|
999
|
-
orderIds: zod.z.array(
|
|
984
|
+
orderIds: zod.z.array(EntityIdSchema).optional(),
|
|
1000
985
|
payment: CartCheckoutPaymentSchema.optional(),
|
|
1001
986
|
cart: StorefrontCartSchema.optional()
|
|
1002
987
|
}).strip();
|
|
1003
988
|
var CartCheckoutParamsSchema = zod.z.object({
|
|
1004
|
-
|
|
989
|
+
cartToken: CartTokenSchema,
|
|
1005
990
|
paymentMethodCode: zod.z.string().min(1),
|
|
1006
991
|
externalRef: zod.z.string().min(1),
|
|
1007
992
|
receiptUrl: zod.z.string().min(1).optional()
|
|
@@ -1034,11 +1019,11 @@ var ShippingOptionsResponseSchema = zod.z.object({
|
|
|
1034
1019
|
groups: zod.z.array(ShippingOptionGroupSchema)
|
|
1035
1020
|
});
|
|
1036
1021
|
var GetShippingOptionsParamsSchema = zod.z.object({
|
|
1037
|
-
|
|
1022
|
+
cartToken: CartTokenSchema,
|
|
1038
1023
|
postalCode: zod.z.string().min(1)
|
|
1039
1024
|
});
|
|
1040
1025
|
var PutShippingMethodParamsSchema = zod.z.object({
|
|
1041
|
-
|
|
1026
|
+
cartToken: CartTokenSchema,
|
|
1042
1027
|
rateId: zod.z.string().min(1),
|
|
1043
1028
|
shippingMethodId: zod.z.string().min(1),
|
|
1044
1029
|
serviceCode: zod.z.string().nullable().optional(),
|
|
@@ -1054,7 +1039,7 @@ var CartPaymentReceiptResponseSchema = zod.z.object({
|
|
|
1054
1039
|
url: zod.z.string()
|
|
1055
1040
|
});
|
|
1056
1041
|
var CartPromotionCodeParamsSchema = zod.z.object({
|
|
1057
|
-
|
|
1042
|
+
cartToken: CartTokenSchema,
|
|
1058
1043
|
code: zod.z.string().min(1)
|
|
1059
1044
|
});
|
|
1060
1045
|
|
|
@@ -1062,59 +1047,59 @@ var CartPromotionCodeParamsSchema = zod.z.object({
|
|
|
1062
1047
|
async function getCartCheckout(api, params) {
|
|
1063
1048
|
const input = CartCheckoutReadParamsSchema.parse(params);
|
|
1064
1049
|
return api.get(
|
|
1065
|
-
`carts/${encodeURIComponent(input.
|
|
1050
|
+
`carts/${encodeURIComponent(input.cartToken)}/checkout`,
|
|
1066
1051
|
CartCheckoutReadResponseSchema
|
|
1067
1052
|
);
|
|
1068
1053
|
}
|
|
1069
1054
|
async function getShippingOptions(api, params) {
|
|
1070
1055
|
const input = GetShippingOptionsParamsSchema.parse(params);
|
|
1071
1056
|
return api.get(
|
|
1072
|
-
`carts/${encodeURIComponent(input.
|
|
1057
|
+
`carts/${encodeURIComponent(input.cartToken)}/shipping-options`,
|
|
1073
1058
|
ShippingOptionsResponseSchema,
|
|
1074
1059
|
{ query: { postalCode: input.postalCode } }
|
|
1075
1060
|
);
|
|
1076
1061
|
}
|
|
1077
1062
|
async function putCartShippingMethod(api, params) {
|
|
1078
1063
|
const input = PutShippingMethodParamsSchema.parse(params);
|
|
1079
|
-
const {
|
|
1064
|
+
const { cartToken, ...body } = input;
|
|
1080
1065
|
return api.request(
|
|
1081
1066
|
"PUT",
|
|
1082
|
-
`carts/${encodeURIComponent(
|
|
1067
|
+
`carts/${encodeURIComponent(cartToken)}/shipping-method`,
|
|
1083
1068
|
StorefrontCartSchema,
|
|
1084
1069
|
{ body }
|
|
1085
1070
|
);
|
|
1086
1071
|
}
|
|
1087
1072
|
async function patchCartBuyer(api, params) {
|
|
1088
1073
|
const input = CartBuyerParamsSchema.parse(params);
|
|
1089
|
-
const {
|
|
1074
|
+
const { cartToken, ...body } = input;
|
|
1090
1075
|
return api.request(
|
|
1091
1076
|
"PATCH",
|
|
1092
|
-
`carts/${encodeURIComponent(
|
|
1077
|
+
`carts/${encodeURIComponent(cartToken)}/buyer`,
|
|
1093
1078
|
StorefrontCartSchema,
|
|
1094
1079
|
{ body }
|
|
1095
1080
|
);
|
|
1096
1081
|
}
|
|
1097
1082
|
async function patchCartAddresses(api, params) {
|
|
1098
1083
|
const input = CartAddressesParamsSchema.parse(params);
|
|
1099
|
-
const {
|
|
1084
|
+
const { cartToken, shippingAddress, billingAddress } = input;
|
|
1100
1085
|
return api.request(
|
|
1101
1086
|
"PATCH",
|
|
1102
|
-
`carts/${encodeURIComponent(
|
|
1087
|
+
`carts/${encodeURIComponent(cartToken)}/addresses`,
|
|
1103
1088
|
StorefrontCartSchema,
|
|
1104
1089
|
{ body: { shippingAddress, billingAddress } }
|
|
1105
1090
|
);
|
|
1106
1091
|
}
|
|
1107
1092
|
async function checkoutCart(api, params) {
|
|
1108
1093
|
const input = CartCheckoutParamsSchema.parse(params);
|
|
1109
|
-
const {
|
|
1094
|
+
const { cartToken, ...body } = input;
|
|
1110
1095
|
return api.post(
|
|
1111
|
-
`carts/${encodeURIComponent(
|
|
1096
|
+
`carts/${encodeURIComponent(cartToken)}/checkout`,
|
|
1112
1097
|
body,
|
|
1113
1098
|
CartCheckoutResponseSchema
|
|
1114
1099
|
);
|
|
1115
1100
|
}
|
|
1116
1101
|
async function uploadPaymentReceipt(api, params) {
|
|
1117
|
-
const
|
|
1102
|
+
const cartToken = CartCheckoutReadParamsSchema.shape.cartToken.parse(params.cartToken);
|
|
1118
1103
|
if (!(params.file instanceof Blob)) {
|
|
1119
1104
|
throw new TypeError("uploadPaymentReceipt requiere un archivo (Blob/File)");
|
|
1120
1105
|
}
|
|
@@ -1122,7 +1107,7 @@ async function uploadPaymentReceipt(api, params) {
|
|
|
1122
1107
|
const name = params.fileName ?? (params.file instanceof File ? params.file.name : "receipt");
|
|
1123
1108
|
form.append("file", params.file, name);
|
|
1124
1109
|
return api.postForm(
|
|
1125
|
-
`carts/${encodeURIComponent(
|
|
1110
|
+
`carts/${encodeURIComponent(cartToken)}/payment-receipt`,
|
|
1126
1111
|
form,
|
|
1127
1112
|
CartPaymentReceiptResponseSchema
|
|
1128
1113
|
);
|
|
@@ -1130,7 +1115,7 @@ async function uploadPaymentReceipt(api, params) {
|
|
|
1130
1115
|
async function addCartPromotionCode(api, params) {
|
|
1131
1116
|
const input = CartPromotionCodeParamsSchema.parse(params);
|
|
1132
1117
|
return api.post(
|
|
1133
|
-
`carts/${encodeURIComponent(input.
|
|
1118
|
+
`carts/${encodeURIComponent(input.cartToken)}/promotion-codes`,
|
|
1134
1119
|
{ code: input.code },
|
|
1135
1120
|
StorefrontCartSchema
|
|
1136
1121
|
);
|
|
@@ -1139,7 +1124,7 @@ async function removeCartPromotionCode(api, params) {
|
|
|
1139
1124
|
const input = CartPromotionCodeParamsSchema.parse(params);
|
|
1140
1125
|
return api.request(
|
|
1141
1126
|
"DELETE",
|
|
1142
|
-
`carts/${encodeURIComponent(input.
|
|
1127
|
+
`carts/${encodeURIComponent(input.cartToken)}/promotion-codes/${encodeURIComponent(input.code)}`,
|
|
1143
1128
|
StorefrontCartSchema
|
|
1144
1129
|
);
|
|
1145
1130
|
}
|
|
@@ -1241,7 +1226,7 @@ var CustomerAddressUpsertInputSchema = zod.z.object({
|
|
|
1241
1226
|
isDefault: zod.z.boolean()
|
|
1242
1227
|
});
|
|
1243
1228
|
var CustomerAddressSchema = CustomerAddressUpsertInputSchema.extend({
|
|
1244
|
-
id:
|
|
1229
|
+
id: EntityIdSchema.optional()
|
|
1245
1230
|
});
|
|
1246
1231
|
var CustomerAddressesSchema = zod.z.array(CustomerAddressSchema);
|
|
1247
1232
|
function toCustomerSavedAddresses(addresses) {
|
|
@@ -1259,7 +1244,7 @@ var ADDRESSES_PATH = "customer/addresses";
|
|
|
1259
1244
|
var CustomerAddressMutationResponseSchema = zod.z.union([
|
|
1260
1245
|
CustomerAddressSchema,
|
|
1261
1246
|
zod.z.object({
|
|
1262
|
-
id:
|
|
1247
|
+
id: EntityIdSchema
|
|
1263
1248
|
}),
|
|
1264
1249
|
zod.z.null()
|
|
1265
1250
|
]);
|
|
@@ -1346,8 +1331,8 @@ var CustomerProfileSchema = zod.z.object({
|
|
|
1346
1331
|
});
|
|
1347
1332
|
var nullableString = zod.z.string().nullable().optional().transform((v) => v ?? null);
|
|
1348
1333
|
var CustomerMeSchema = zod.z.object({
|
|
1349
|
-
id:
|
|
1350
|
-
storeId:
|
|
1334
|
+
id: EntityIdSchema,
|
|
1335
|
+
storeId: EntityIdSchema.optional(),
|
|
1351
1336
|
email: zod.z.string().email(),
|
|
1352
1337
|
firstName: zod.z.string(),
|
|
1353
1338
|
lastName: zod.z.string(),
|
|
@@ -1456,10 +1441,10 @@ var CustomerOrderShippingAddressSchema = zod.z.object({
|
|
|
1456
1441
|
metadata: zod.z.record(zod.z.unknown()).nullable().optional()
|
|
1457
1442
|
}).passthrough();
|
|
1458
1443
|
var CustomerOrderLineItemSchema = zod.z.object({
|
|
1459
|
-
id:
|
|
1460
|
-
orderId:
|
|
1461
|
-
productId:
|
|
1462
|
-
variantId:
|
|
1444
|
+
id: EntityIdSchema,
|
|
1445
|
+
orderId: EntityIdSchema,
|
|
1446
|
+
productId: EntityIdSchema.nullable(),
|
|
1447
|
+
variantId: EntityIdSchema.nullable(),
|
|
1463
1448
|
title: zod.z.string(),
|
|
1464
1449
|
subtitle: zod.z.string().nullable().optional(),
|
|
1465
1450
|
thumbnail: zod.z.string().nullable().optional(),
|
|
@@ -1471,10 +1456,10 @@ var CustomerOrderLineItemSchema = zod.z.object({
|
|
|
1471
1456
|
status: zod.z.string()
|
|
1472
1457
|
});
|
|
1473
1458
|
var CustomerOrderListItemSchema = zod.z.object({
|
|
1474
|
-
orderId:
|
|
1459
|
+
orderId: EntityIdSchema,
|
|
1475
1460
|
orderNumber: zod.z.string(),
|
|
1476
1461
|
orderGroup: zod.z.string(),
|
|
1477
|
-
orderIds: zod.z.array(
|
|
1462
|
+
orderIds: zod.z.array(EntityIdSchema),
|
|
1478
1463
|
status: zod.z.string(),
|
|
1479
1464
|
total: zod.z.number(),
|
|
1480
1465
|
totalPaid: zod.z.number(),
|
|
@@ -1489,7 +1474,7 @@ var CustomerOrderListItemSchema = zod.z.object({
|
|
|
1489
1474
|
});
|
|
1490
1475
|
var CustomerOrderListSchema = zod.z.array(CustomerOrderListItemSchema);
|
|
1491
1476
|
var CustomerOrderPaymentSchema = zod.z.object({
|
|
1492
|
-
id:
|
|
1477
|
+
id: EntityIdSchema,
|
|
1493
1478
|
paymentMethod: zod.z.string(),
|
|
1494
1479
|
paymentCode: zod.z.string(),
|
|
1495
1480
|
amount: zod.z.number(),
|
|
@@ -1506,7 +1491,7 @@ var CustomerOrderStatusTimelineSchema = zod.z.object({
|
|
|
1506
1491
|
source: zod.z.string()
|
|
1507
1492
|
});
|
|
1508
1493
|
var CustomerOrderDetailSchema = zod.z.object({
|
|
1509
|
-
id:
|
|
1494
|
+
id: EntityIdSchema,
|
|
1510
1495
|
orderNumber: zod.z.string(),
|
|
1511
1496
|
orderGroup: zod.z.string(),
|
|
1512
1497
|
status: zod.z.string(),
|
|
@@ -1927,6 +1912,7 @@ exports.CartItemModifierSchema = CartItemModifierSchema;
|
|
|
1927
1912
|
exports.CartPaymentMethodSchema = CartPaymentMethodSchema;
|
|
1928
1913
|
exports.CartPaymentReceiptResponseSchema = CartPaymentReceiptResponseSchema;
|
|
1929
1914
|
exports.CartPromotionCodeParamsSchema = CartPromotionCodeParamsSchema;
|
|
1915
|
+
exports.CartTokenSchema = CartTokenSchema;
|
|
1930
1916
|
exports.CheckoutMetadataValueSchema = CheckoutMetadataValueSchema;
|
|
1931
1917
|
exports.CmsBlockDtoSchema = CmsBlockDtoSchema;
|
|
1932
1918
|
exports.CmsBrandingSettingsDtoSchema = CmsBrandingSettingsDtoSchema;
|
|
@@ -1990,7 +1976,6 @@ exports.ProductDetailParamsSchema = ProductDetailParamsSchema;
|
|
|
1990
1976
|
exports.ProductDetailSchema = ProductDetailSchema;
|
|
1991
1977
|
exports.ProductImageSchema = ProductImageSchema;
|
|
1992
1978
|
exports.ProductPriceTierSchema = ProductPriceTierSchema;
|
|
1993
|
-
exports.ProductPublicIdSchema = ProductPublicIdSchema;
|
|
1994
1979
|
exports.ProductSchema = ProductSchema;
|
|
1995
1980
|
exports.ProductSortSchema = ProductSortSchema;
|
|
1996
1981
|
exports.ProductSuggestionSchema = ProductSuggestionSchema;
|
|
@@ -2057,7 +2042,6 @@ exports.VariantSchema = VariantSchema;
|
|
|
2057
2042
|
exports.addCartItem = addCartItem;
|
|
2058
2043
|
exports.addCartPromotionCode = addCartPromotionCode;
|
|
2059
2044
|
exports.autocompleteProducts = autocompleteProducts;
|
|
2060
|
-
exports.cartVariantIdFromProduct = cartVariantIdFromProduct;
|
|
2061
2045
|
exports.checkoutCart = checkoutCart;
|
|
2062
2046
|
exports.createApi = createApi;
|
|
2063
2047
|
exports.createCart = createCart;
|