@ecomiq/core 0.1.7 → 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 +94 -89
- 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 +94 -89
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +96 -101
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -55
- package/dist/index.d.ts +65 -55
- package/dist/index.js +95 -100
- package/dist/index.js.map +1 -1
- package/dist/models/collections.cjs +7 -1
- package/dist/models/collections.cjs.map +1 -1
- package/dist/models/collections.d.cts +6 -6
- package/dist/models/collections.d.ts +6 -6
- package/dist/models/collections.js +7 -1
- 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 +44 -34
- package/dist/models/storefront-checkout.cjs.map +1 -1
- package/dist/models/storefront-checkout.d.cts +660 -2278
- package/dist/models/storefront-checkout.d.ts +660 -2278
- package/dist/models/storefront-checkout.js +44 -35
- 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,8 +110,14 @@ 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.string().min(1, "Expected resource id");
|
|
114
|
+
var CartTokenSchema = zod.z.string().min(1).max(32).regex(/^[A-Za-z0-9_-]+$/, "Expected cart token");
|
|
115
|
+
var NullableEntityIdSchema = EntityIdSchema.nullable();
|
|
116
|
+
var OptionalEntityIdSchema = EntityIdSchema.optional();
|
|
117
|
+
|
|
118
|
+
// src/models/collections.ts
|
|
113
119
|
var CollectionSchema = zod.z.object({
|
|
114
|
-
id:
|
|
120
|
+
id: EntityIdSchema,
|
|
115
121
|
slug: zod.z.string(),
|
|
116
122
|
name: zod.z.string(),
|
|
117
123
|
description: zod.z.string().nullable().optional(),
|
|
@@ -120,20 +126,8 @@ var CollectionSchema = zod.z.object({
|
|
|
120
126
|
productCount: zod.z.number().optional()
|
|
121
127
|
});
|
|
122
128
|
var CollectionsSchema = zod.z.array(CollectionSchema);
|
|
123
|
-
var EntityIdSchema = zod.z.union([
|
|
124
|
-
zod.z.string().uuid(),
|
|
125
|
-
zod.z.string().regex(/^\d+$/, "Expected numeric id")
|
|
126
|
-
]);
|
|
127
|
-
var NullableEntityIdSchema = EntityIdSchema.nullable();
|
|
128
|
-
var OptionalEntityIdSchema = EntityIdSchema.optional();
|
|
129
|
-
|
|
130
|
-
// src/models/products.ts
|
|
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
|
}
|
|
@@ -884,8 +869,18 @@ async function getCollectionBySlug(api, collectionSlug) {
|
|
|
884
869
|
async function getPageBySlug(api, pageSlug) {
|
|
885
870
|
return api.get(`pages/${encodeURIComponent(pageSlug)}`, CmsPageDetailsDtoSchema);
|
|
886
871
|
}
|
|
872
|
+
var CheckoutMetadataValueSchema = zod.z.lazy(
|
|
873
|
+
() => zod.z.union([
|
|
874
|
+
zod.z.string(),
|
|
875
|
+
zod.z.number(),
|
|
876
|
+
zod.z.boolean(),
|
|
877
|
+
zod.z.null(),
|
|
878
|
+
zod.z.array(CheckoutMetadataValueSchema),
|
|
879
|
+
zod.z.record(zod.z.string(), CheckoutMetadataValueSchema)
|
|
880
|
+
])
|
|
881
|
+
);
|
|
887
882
|
var CartBuyerParamsSchema = zod.z.object({
|
|
888
|
-
|
|
883
|
+
cartToken: CartTokenSchema,
|
|
889
884
|
email: zod.z.string().email(),
|
|
890
885
|
firstName: zod.z.string().min(1),
|
|
891
886
|
lastName: zod.z.string().min(1),
|
|
@@ -911,7 +906,7 @@ var CartAddressWriteSchema = zod.z.object({
|
|
|
911
906
|
}).nullable().optional()
|
|
912
907
|
});
|
|
913
908
|
var CartAddressesParamsSchema = zod.z.object({
|
|
914
|
-
|
|
909
|
+
cartToken: CartTokenSchema,
|
|
915
910
|
shippingAddress: CartAddressWriteSchema,
|
|
916
911
|
billingAddress: CartAddressWriteSchema
|
|
917
912
|
});
|
|
@@ -930,9 +925,9 @@ var CartPaymentMethodSchema = zod.z.object({
|
|
|
930
925
|
qrImageUrl: zod.z.string().nullable().optional()
|
|
931
926
|
});
|
|
932
927
|
var StorefrontOrderBumpSchema = zod.z.object({
|
|
933
|
-
id:
|
|
934
|
-
|
|
935
|
-
|
|
928
|
+
id: EntityIdSchema,
|
|
929
|
+
productId: EntityIdSchema,
|
|
930
|
+
variantId: EntityIdSchema,
|
|
936
931
|
productName: zod.z.string(),
|
|
937
932
|
variantName: zod.z.string().nullable().optional(),
|
|
938
933
|
imageUrl: zod.z.string().nullable().optional(),
|
|
@@ -944,7 +939,7 @@ var StorefrontOrderBumpSchema = zod.z.object({
|
|
|
944
939
|
description: zod.z.string().nullable().optional()
|
|
945
940
|
});
|
|
946
941
|
var CartCheckoutReadParamsSchema = zod.z.object({
|
|
947
|
-
|
|
942
|
+
cartToken: CartTokenSchema
|
|
948
943
|
});
|
|
949
944
|
var CartCheckoutReadResponseSchema = zod.z.object({
|
|
950
945
|
cart: StorefrontCartSchema,
|
|
@@ -960,13 +955,13 @@ var CartCheckoutPaymentActionSchema = zod.z.object({
|
|
|
960
955
|
phoneNumber: zod.z.string().nullable().optional(),
|
|
961
956
|
accountHolder: zod.z.string().nullable().optional(),
|
|
962
957
|
qrImageUrl: zod.z.string().nullable().optional()
|
|
963
|
-
}).
|
|
958
|
+
}).strip().nullable().optional(),
|
|
964
959
|
url: zod.z.string().nullable().optional(),
|
|
965
960
|
html: zod.z.string().nullable().optional(),
|
|
966
961
|
clientSecret: zod.z.string().nullable().optional(),
|
|
967
962
|
qrCode: zod.z.string().nullable().optional(),
|
|
968
963
|
expiresAt: zod.z.string().nullable().optional()
|
|
969
|
-
}).
|
|
964
|
+
}).strip();
|
|
970
965
|
var CartCheckoutPaymentSchema = zod.z.object({
|
|
971
966
|
transactionId: zod.z.string(),
|
|
972
967
|
paymentMethodCode: zod.z.string(),
|
|
@@ -977,21 +972,21 @@ var CartCheckoutPaymentSchema = zod.z.object({
|
|
|
977
972
|
actionType: zod.z.string(),
|
|
978
973
|
receiptUrl: zod.z.string().nullable().optional(),
|
|
979
974
|
action: CartCheckoutPaymentActionSchema.nullable().optional()
|
|
980
|
-
}).
|
|
975
|
+
}).strip();
|
|
981
976
|
var CartCheckoutResponseSchema = zod.z.object({
|
|
982
977
|
publicKey: zod.z.string().optional(),
|
|
983
978
|
publishableKey: zod.z.string().optional(),
|
|
984
979
|
stripePublicKey: zod.z.string().optional(),
|
|
985
980
|
clientSecret: zod.z.string().optional(),
|
|
986
981
|
intentClientSecret: zod.z.string().optional(),
|
|
987
|
-
orderId:
|
|
982
|
+
orderId: EntityIdSchema.optional(),
|
|
988
983
|
orderGroup: zod.z.string().optional(),
|
|
989
|
-
orderIds: zod.z.array(
|
|
984
|
+
orderIds: zod.z.array(EntityIdSchema).optional(),
|
|
990
985
|
payment: CartCheckoutPaymentSchema.optional(),
|
|
991
986
|
cart: StorefrontCartSchema.optional()
|
|
992
|
-
}).
|
|
987
|
+
}).strip();
|
|
993
988
|
var CartCheckoutParamsSchema = zod.z.object({
|
|
994
|
-
|
|
989
|
+
cartToken: CartTokenSchema,
|
|
995
990
|
paymentMethodCode: zod.z.string().min(1),
|
|
996
991
|
externalRef: zod.z.string().min(1),
|
|
997
992
|
receiptUrl: zod.z.string().min(1).optional()
|
|
@@ -1010,8 +1005,8 @@ var ShippingRateSchema = zod.z.object({
|
|
|
1010
1005
|
deliveryLocationName: zod.z.string().nullable().optional(),
|
|
1011
1006
|
estimatedDeliveryDays: zod.z.number().nullable().optional(),
|
|
1012
1007
|
serviceCode: zod.z.string().nullable().optional(),
|
|
1013
|
-
metadata: zod.z.record(zod.z.string(),
|
|
1014
|
-
}).
|
|
1008
|
+
metadata: zod.z.record(zod.z.string(), CheckoutMetadataValueSchema).optional()
|
|
1009
|
+
}).strip();
|
|
1015
1010
|
var ShippingOptionGroupSchema = zod.z.object({
|
|
1016
1011
|
sellerId: zod.z.string(),
|
|
1017
1012
|
shippingProfileId: zod.z.string().nullable().optional(),
|
|
@@ -1019,16 +1014,16 @@ var ShippingOptionGroupSchema = zod.z.object({
|
|
|
1019
1014
|
totalWeight: zod.z.number().optional(),
|
|
1020
1015
|
itemIds: zod.z.array(zod.z.string()).optional(),
|
|
1021
1016
|
rates: zod.z.array(ShippingRateSchema)
|
|
1022
|
-
}).
|
|
1017
|
+
}).strip();
|
|
1023
1018
|
var ShippingOptionsResponseSchema = zod.z.object({
|
|
1024
1019
|
groups: zod.z.array(ShippingOptionGroupSchema)
|
|
1025
1020
|
});
|
|
1026
1021
|
var GetShippingOptionsParamsSchema = zod.z.object({
|
|
1027
|
-
|
|
1022
|
+
cartToken: CartTokenSchema,
|
|
1028
1023
|
postalCode: zod.z.string().min(1)
|
|
1029
1024
|
});
|
|
1030
1025
|
var PutShippingMethodParamsSchema = zod.z.object({
|
|
1031
|
-
|
|
1026
|
+
cartToken: CartTokenSchema,
|
|
1032
1027
|
rateId: zod.z.string().min(1),
|
|
1033
1028
|
shippingMethodId: zod.z.string().min(1),
|
|
1034
1029
|
serviceCode: zod.z.string().nullable().optional(),
|
|
@@ -1044,7 +1039,7 @@ var CartPaymentReceiptResponseSchema = zod.z.object({
|
|
|
1044
1039
|
url: zod.z.string()
|
|
1045
1040
|
});
|
|
1046
1041
|
var CartPromotionCodeParamsSchema = zod.z.object({
|
|
1047
|
-
|
|
1042
|
+
cartToken: CartTokenSchema,
|
|
1048
1043
|
code: zod.z.string().min(1)
|
|
1049
1044
|
});
|
|
1050
1045
|
|
|
@@ -1052,59 +1047,59 @@ var CartPromotionCodeParamsSchema = zod.z.object({
|
|
|
1052
1047
|
async function getCartCheckout(api, params) {
|
|
1053
1048
|
const input = CartCheckoutReadParamsSchema.parse(params);
|
|
1054
1049
|
return api.get(
|
|
1055
|
-
`carts/${encodeURIComponent(input.
|
|
1050
|
+
`carts/${encodeURIComponent(input.cartToken)}/checkout`,
|
|
1056
1051
|
CartCheckoutReadResponseSchema
|
|
1057
1052
|
);
|
|
1058
1053
|
}
|
|
1059
1054
|
async function getShippingOptions(api, params) {
|
|
1060
1055
|
const input = GetShippingOptionsParamsSchema.parse(params);
|
|
1061
1056
|
return api.get(
|
|
1062
|
-
`carts/${encodeURIComponent(input.
|
|
1057
|
+
`carts/${encodeURIComponent(input.cartToken)}/shipping-options`,
|
|
1063
1058
|
ShippingOptionsResponseSchema,
|
|
1064
1059
|
{ query: { postalCode: input.postalCode } }
|
|
1065
1060
|
);
|
|
1066
1061
|
}
|
|
1067
1062
|
async function putCartShippingMethod(api, params) {
|
|
1068
1063
|
const input = PutShippingMethodParamsSchema.parse(params);
|
|
1069
|
-
const {
|
|
1064
|
+
const { cartToken, ...body } = input;
|
|
1070
1065
|
return api.request(
|
|
1071
1066
|
"PUT",
|
|
1072
|
-
`carts/${encodeURIComponent(
|
|
1067
|
+
`carts/${encodeURIComponent(cartToken)}/shipping-method`,
|
|
1073
1068
|
StorefrontCartSchema,
|
|
1074
1069
|
{ body }
|
|
1075
1070
|
);
|
|
1076
1071
|
}
|
|
1077
1072
|
async function patchCartBuyer(api, params) {
|
|
1078
1073
|
const input = CartBuyerParamsSchema.parse(params);
|
|
1079
|
-
const {
|
|
1074
|
+
const { cartToken, ...body } = input;
|
|
1080
1075
|
return api.request(
|
|
1081
1076
|
"PATCH",
|
|
1082
|
-
`carts/${encodeURIComponent(
|
|
1077
|
+
`carts/${encodeURIComponent(cartToken)}/buyer`,
|
|
1083
1078
|
StorefrontCartSchema,
|
|
1084
1079
|
{ body }
|
|
1085
1080
|
);
|
|
1086
1081
|
}
|
|
1087
1082
|
async function patchCartAddresses(api, params) {
|
|
1088
1083
|
const input = CartAddressesParamsSchema.parse(params);
|
|
1089
|
-
const {
|
|
1084
|
+
const { cartToken, shippingAddress, billingAddress } = input;
|
|
1090
1085
|
return api.request(
|
|
1091
1086
|
"PATCH",
|
|
1092
|
-
`carts/${encodeURIComponent(
|
|
1087
|
+
`carts/${encodeURIComponent(cartToken)}/addresses`,
|
|
1093
1088
|
StorefrontCartSchema,
|
|
1094
1089
|
{ body: { shippingAddress, billingAddress } }
|
|
1095
1090
|
);
|
|
1096
1091
|
}
|
|
1097
1092
|
async function checkoutCart(api, params) {
|
|
1098
1093
|
const input = CartCheckoutParamsSchema.parse(params);
|
|
1099
|
-
const {
|
|
1094
|
+
const { cartToken, ...body } = input;
|
|
1100
1095
|
return api.post(
|
|
1101
|
-
`carts/${encodeURIComponent(
|
|
1096
|
+
`carts/${encodeURIComponent(cartToken)}/checkout`,
|
|
1102
1097
|
body,
|
|
1103
1098
|
CartCheckoutResponseSchema
|
|
1104
1099
|
);
|
|
1105
1100
|
}
|
|
1106
1101
|
async function uploadPaymentReceipt(api, params) {
|
|
1107
|
-
const
|
|
1102
|
+
const cartToken = CartCheckoutReadParamsSchema.shape.cartToken.parse(params.cartToken);
|
|
1108
1103
|
if (!(params.file instanceof Blob)) {
|
|
1109
1104
|
throw new TypeError("uploadPaymentReceipt requiere un archivo (Blob/File)");
|
|
1110
1105
|
}
|
|
@@ -1112,7 +1107,7 @@ async function uploadPaymentReceipt(api, params) {
|
|
|
1112
1107
|
const name = params.fileName ?? (params.file instanceof File ? params.file.name : "receipt");
|
|
1113
1108
|
form.append("file", params.file, name);
|
|
1114
1109
|
return api.postForm(
|
|
1115
|
-
`carts/${encodeURIComponent(
|
|
1110
|
+
`carts/${encodeURIComponent(cartToken)}/payment-receipt`,
|
|
1116
1111
|
form,
|
|
1117
1112
|
CartPaymentReceiptResponseSchema
|
|
1118
1113
|
);
|
|
@@ -1120,7 +1115,7 @@ async function uploadPaymentReceipt(api, params) {
|
|
|
1120
1115
|
async function addCartPromotionCode(api, params) {
|
|
1121
1116
|
const input = CartPromotionCodeParamsSchema.parse(params);
|
|
1122
1117
|
return api.post(
|
|
1123
|
-
`carts/${encodeURIComponent(input.
|
|
1118
|
+
`carts/${encodeURIComponent(input.cartToken)}/promotion-codes`,
|
|
1124
1119
|
{ code: input.code },
|
|
1125
1120
|
StorefrontCartSchema
|
|
1126
1121
|
);
|
|
@@ -1129,7 +1124,7 @@ async function removeCartPromotionCode(api, params) {
|
|
|
1129
1124
|
const input = CartPromotionCodeParamsSchema.parse(params);
|
|
1130
1125
|
return api.request(
|
|
1131
1126
|
"DELETE",
|
|
1132
|
-
`carts/${encodeURIComponent(input.
|
|
1127
|
+
`carts/${encodeURIComponent(input.cartToken)}/promotion-codes/${encodeURIComponent(input.code)}`,
|
|
1133
1128
|
StorefrontCartSchema
|
|
1134
1129
|
);
|
|
1135
1130
|
}
|
|
@@ -1231,7 +1226,7 @@ var CustomerAddressUpsertInputSchema = zod.z.object({
|
|
|
1231
1226
|
isDefault: zod.z.boolean()
|
|
1232
1227
|
});
|
|
1233
1228
|
var CustomerAddressSchema = CustomerAddressUpsertInputSchema.extend({
|
|
1234
|
-
id:
|
|
1229
|
+
id: EntityIdSchema.optional()
|
|
1235
1230
|
});
|
|
1236
1231
|
var CustomerAddressesSchema = zod.z.array(CustomerAddressSchema);
|
|
1237
1232
|
function toCustomerSavedAddresses(addresses) {
|
|
@@ -1249,7 +1244,7 @@ var ADDRESSES_PATH = "customer/addresses";
|
|
|
1249
1244
|
var CustomerAddressMutationResponseSchema = zod.z.union([
|
|
1250
1245
|
CustomerAddressSchema,
|
|
1251
1246
|
zod.z.object({
|
|
1252
|
-
id:
|
|
1247
|
+
id: EntityIdSchema
|
|
1253
1248
|
}),
|
|
1254
1249
|
zod.z.null()
|
|
1255
1250
|
]);
|
|
@@ -1336,8 +1331,8 @@ var CustomerProfileSchema = zod.z.object({
|
|
|
1336
1331
|
});
|
|
1337
1332
|
var nullableString = zod.z.string().nullable().optional().transform((v) => v ?? null);
|
|
1338
1333
|
var CustomerMeSchema = zod.z.object({
|
|
1339
|
-
id:
|
|
1340
|
-
storeId:
|
|
1334
|
+
id: EntityIdSchema,
|
|
1335
|
+
storeId: EntityIdSchema.optional(),
|
|
1341
1336
|
email: zod.z.string().email(),
|
|
1342
1337
|
firstName: zod.z.string(),
|
|
1343
1338
|
lastName: zod.z.string(),
|
|
@@ -1446,10 +1441,10 @@ var CustomerOrderShippingAddressSchema = zod.z.object({
|
|
|
1446
1441
|
metadata: zod.z.record(zod.z.unknown()).nullable().optional()
|
|
1447
1442
|
}).passthrough();
|
|
1448
1443
|
var CustomerOrderLineItemSchema = zod.z.object({
|
|
1449
|
-
id:
|
|
1450
|
-
orderId:
|
|
1451
|
-
productId:
|
|
1452
|
-
variantId:
|
|
1444
|
+
id: EntityIdSchema,
|
|
1445
|
+
orderId: EntityIdSchema,
|
|
1446
|
+
productId: EntityIdSchema.nullable(),
|
|
1447
|
+
variantId: EntityIdSchema.nullable(),
|
|
1453
1448
|
title: zod.z.string(),
|
|
1454
1449
|
subtitle: zod.z.string().nullable().optional(),
|
|
1455
1450
|
thumbnail: zod.z.string().nullable().optional(),
|
|
@@ -1461,10 +1456,10 @@ var CustomerOrderLineItemSchema = zod.z.object({
|
|
|
1461
1456
|
status: zod.z.string()
|
|
1462
1457
|
});
|
|
1463
1458
|
var CustomerOrderListItemSchema = zod.z.object({
|
|
1464
|
-
orderId:
|
|
1459
|
+
orderId: EntityIdSchema,
|
|
1465
1460
|
orderNumber: zod.z.string(),
|
|
1466
1461
|
orderGroup: zod.z.string(),
|
|
1467
|
-
orderIds: zod.z.array(
|
|
1462
|
+
orderIds: zod.z.array(EntityIdSchema),
|
|
1468
1463
|
status: zod.z.string(),
|
|
1469
1464
|
total: zod.z.number(),
|
|
1470
1465
|
totalPaid: zod.z.number(),
|
|
@@ -1479,7 +1474,7 @@ var CustomerOrderListItemSchema = zod.z.object({
|
|
|
1479
1474
|
});
|
|
1480
1475
|
var CustomerOrderListSchema = zod.z.array(CustomerOrderListItemSchema);
|
|
1481
1476
|
var CustomerOrderPaymentSchema = zod.z.object({
|
|
1482
|
-
id:
|
|
1477
|
+
id: EntityIdSchema,
|
|
1483
1478
|
paymentMethod: zod.z.string(),
|
|
1484
1479
|
paymentCode: zod.z.string(),
|
|
1485
1480
|
amount: zod.z.number(),
|
|
@@ -1496,7 +1491,7 @@ var CustomerOrderStatusTimelineSchema = zod.z.object({
|
|
|
1496
1491
|
source: zod.z.string()
|
|
1497
1492
|
});
|
|
1498
1493
|
var CustomerOrderDetailSchema = zod.z.object({
|
|
1499
|
-
id:
|
|
1494
|
+
id: EntityIdSchema,
|
|
1500
1495
|
orderNumber: zod.z.string(),
|
|
1501
1496
|
orderGroup: zod.z.string(),
|
|
1502
1497
|
status: zod.z.string(),
|
|
@@ -1917,6 +1912,8 @@ exports.CartItemModifierSchema = CartItemModifierSchema;
|
|
|
1917
1912
|
exports.CartPaymentMethodSchema = CartPaymentMethodSchema;
|
|
1918
1913
|
exports.CartPaymentReceiptResponseSchema = CartPaymentReceiptResponseSchema;
|
|
1919
1914
|
exports.CartPromotionCodeParamsSchema = CartPromotionCodeParamsSchema;
|
|
1915
|
+
exports.CartTokenSchema = CartTokenSchema;
|
|
1916
|
+
exports.CheckoutMetadataValueSchema = CheckoutMetadataValueSchema;
|
|
1920
1917
|
exports.CmsBlockDtoSchema = CmsBlockDtoSchema;
|
|
1921
1918
|
exports.CmsBrandingSettingsDtoSchema = CmsBrandingSettingsDtoSchema;
|
|
1922
1919
|
exports.CmsContactSettingsDtoSchema = CmsContactSettingsDtoSchema;
|
|
@@ -1979,7 +1976,6 @@ exports.ProductDetailParamsSchema = ProductDetailParamsSchema;
|
|
|
1979
1976
|
exports.ProductDetailSchema = ProductDetailSchema;
|
|
1980
1977
|
exports.ProductImageSchema = ProductImageSchema;
|
|
1981
1978
|
exports.ProductPriceTierSchema = ProductPriceTierSchema;
|
|
1982
|
-
exports.ProductPublicIdSchema = ProductPublicIdSchema;
|
|
1983
1979
|
exports.ProductSchema = ProductSchema;
|
|
1984
1980
|
exports.ProductSortSchema = ProductSortSchema;
|
|
1985
1981
|
exports.ProductSuggestionSchema = ProductSuggestionSchema;
|
|
@@ -2046,7 +2042,6 @@ exports.VariantSchema = VariantSchema;
|
|
|
2046
2042
|
exports.addCartItem = addCartItem;
|
|
2047
2043
|
exports.addCartPromotionCode = addCartPromotionCode;
|
|
2048
2044
|
exports.autocompleteProducts = autocompleteProducts;
|
|
2049
|
-
exports.cartVariantIdFromProduct = cartVariantIdFromProduct;
|
|
2050
2045
|
exports.checkoutCart = checkoutCart;
|
|
2051
2046
|
exports.createApi = createApi;
|
|
2052
2047
|
exports.createCart = createCart;
|