@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
|
@@ -29,7 +29,7 @@ declare const CustomerAddressMutationResponseSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
29
29
|
longitude: z.ZodNullable<z.ZodNumber>;
|
|
30
30
|
isDefault: z.ZodBoolean;
|
|
31
31
|
} & {
|
|
32
|
-
id: z.ZodOptional<z.
|
|
32
|
+
id: z.ZodOptional<z.ZodString>;
|
|
33
33
|
}, "strip", z.ZodTypeAny, {
|
|
34
34
|
province: string;
|
|
35
35
|
postalCode: string;
|
|
@@ -61,13 +61,13 @@ declare const CustomerAddressMutationResponseSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
61
61
|
addressNumber: string;
|
|
62
62
|
department: string;
|
|
63
63
|
cellPhone: string;
|
|
64
|
-
id?: string |
|
|
64
|
+
id?: string | undefined;
|
|
65
65
|
}>, z.ZodObject<{
|
|
66
|
-
id: z.
|
|
66
|
+
id: z.ZodString;
|
|
67
67
|
}, "strip", z.ZodTypeAny, {
|
|
68
68
|
id: string;
|
|
69
69
|
}, {
|
|
70
|
-
id: string
|
|
70
|
+
id: string;
|
|
71
71
|
}>, z.ZodNull]>;
|
|
72
72
|
type CustomerAddressMutationResponse = z.infer<typeof CustomerAddressMutationResponseSchema>;
|
|
73
73
|
type CustomerAddressRequestOptions = {
|
|
@@ -29,7 +29,7 @@ declare const CustomerAddressMutationResponseSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
29
29
|
longitude: z.ZodNullable<z.ZodNumber>;
|
|
30
30
|
isDefault: z.ZodBoolean;
|
|
31
31
|
} & {
|
|
32
|
-
id: z.ZodOptional<z.
|
|
32
|
+
id: z.ZodOptional<z.ZodString>;
|
|
33
33
|
}, "strip", z.ZodTypeAny, {
|
|
34
34
|
province: string;
|
|
35
35
|
postalCode: string;
|
|
@@ -61,13 +61,13 @@ declare const CustomerAddressMutationResponseSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
61
61
|
addressNumber: string;
|
|
62
62
|
department: string;
|
|
63
63
|
cellPhone: string;
|
|
64
|
-
id?: string |
|
|
64
|
+
id?: string | undefined;
|
|
65
65
|
}>, z.ZodObject<{
|
|
66
|
-
id: z.
|
|
66
|
+
id: z.ZodString;
|
|
67
67
|
}, "strip", z.ZodTypeAny, {
|
|
68
68
|
id: string;
|
|
69
69
|
}, {
|
|
70
|
-
id: string
|
|
70
|
+
id: string;
|
|
71
71
|
}>, z.ZodNull]>;
|
|
72
72
|
type CustomerAddressMutationResponse = z.infer<typeof CustomerAddressMutationResponseSchema>;
|
|
73
73
|
type CustomerAddressRequestOptions = {
|
package/dist/client.cjs
CHANGED
|
@@ -105,10 +105,8 @@ function createApi(options = {}) {
|
|
|
105
105
|
postForm: (path, body, schema, opts) => request("POST", path, schema, { ...opts, body })
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
var EntityIdSchema = zod.z.
|
|
109
|
-
|
|
110
|
-
zod.z.string().regex(/^\d+$/, "Expected numeric id")
|
|
111
|
-
]);
|
|
108
|
+
var EntityIdSchema = zod.z.string().min(1, "Expected resource id");
|
|
109
|
+
var CartTokenSchema = zod.z.string().min(1).max(32).regex(/^[A-Za-z0-9_-]+$/, "Expected cart token");
|
|
112
110
|
var NullableEntityIdSchema = EntityIdSchema.nullable();
|
|
113
111
|
var OptionalEntityIdSchema = EntityIdSchema.optional();
|
|
114
112
|
|
|
@@ -123,12 +121,8 @@ var CollectionSchema = zod.z.object({
|
|
|
123
121
|
productCount: zod.z.number().optional()
|
|
124
122
|
});
|
|
125
123
|
var CollectionsSchema = zod.z.array(CollectionSchema);
|
|
126
|
-
var ProductPublicIdSchema = zod.z.union([
|
|
127
|
-
zod.z.string().regex(/^[1-9]\d*$/),
|
|
128
|
-
zod.z.number().int().safe().positive()
|
|
129
|
-
]).transform(String);
|
|
130
124
|
var ProductSummarySchema = zod.z.object({
|
|
131
|
-
id:
|
|
125
|
+
id: EntityIdSchema,
|
|
132
126
|
name: zod.z.string(),
|
|
133
127
|
slug: zod.z.string(),
|
|
134
128
|
productType: zod.z.string(),
|
|
@@ -185,7 +179,7 @@ var ProductsParamsSchema = zod.z.object({
|
|
|
185
179
|
search: zod.z.string().optional(),
|
|
186
180
|
collection: zod.z.string().optional(),
|
|
187
181
|
collections: zod.z.array(zod.z.string()).optional(),
|
|
188
|
-
collectionId:
|
|
182
|
+
collectionId: EntityIdSchema.optional(),
|
|
189
183
|
category: zod.z.string().optional(),
|
|
190
184
|
categories: zod.z.array(zod.z.string()).optional(),
|
|
191
185
|
brand: zod.z.string().optional(),
|
|
@@ -204,7 +198,7 @@ var ProductDetailParamsSchema = zod.z.object({
|
|
|
204
198
|
sellerId: OptionalEntityIdSchema
|
|
205
199
|
});
|
|
206
200
|
var RelatedProductsParamsSchema = zod.z.object({
|
|
207
|
-
productId:
|
|
201
|
+
productId: EntityIdSchema,
|
|
208
202
|
limit: zod.z.number().int().positive().max(12).default(8),
|
|
209
203
|
sellerId: OptionalEntityIdSchema
|
|
210
204
|
});
|
|
@@ -219,7 +213,7 @@ var ProductImageSchema = zod.z.object({
|
|
|
219
213
|
order: zod.z.number().int().nonnegative()
|
|
220
214
|
});
|
|
221
215
|
var VariantItemSchema = zod.z.object({
|
|
222
|
-
id:
|
|
216
|
+
id: EntityIdSchema.nullable(),
|
|
223
217
|
sku: zod.z.string(),
|
|
224
218
|
status: zod.z.string(),
|
|
225
219
|
price: zod.z.number().nonnegative(),
|
|
@@ -229,14 +223,14 @@ var VariantItemSchema = zod.z.object({
|
|
|
229
223
|
images: zod.z.array(ProductImageSchema)
|
|
230
224
|
});
|
|
231
225
|
var ProductPriceTierSchema = zod.z.object({
|
|
232
|
-
variantId:
|
|
226
|
+
variantId: EntityIdSchema,
|
|
233
227
|
minQuantity: zod.z.number().int().positive(),
|
|
234
228
|
maxQuantity: zod.z.number().int().positive().nullable(),
|
|
235
229
|
unitPrice: zod.z.number().nonnegative()
|
|
236
230
|
});
|
|
237
231
|
var BundleItemSchema = zod.z.object({
|
|
238
|
-
productId:
|
|
239
|
-
variantId:
|
|
232
|
+
productId: EntityIdSchema,
|
|
233
|
+
variantId: EntityIdSchema,
|
|
240
234
|
productName: zod.z.string(),
|
|
241
235
|
variantName: zod.z.string().nullable(),
|
|
242
236
|
sku: zod.z.string().nullable(),
|
|
@@ -262,7 +256,7 @@ var SizeGuideRowSchema = zod.z.object({
|
|
|
262
256
|
measurements: zod.z.array(SizeGuideMeasurementSchema)
|
|
263
257
|
});
|
|
264
258
|
var SizeGuideSchema = zod.z.object({
|
|
265
|
-
id:
|
|
259
|
+
id: EntityIdSchema,
|
|
266
260
|
name: zod.z.string(),
|
|
267
261
|
slug: zod.z.string(),
|
|
268
262
|
description: zod.z.string().nullable(),
|
|
@@ -274,7 +268,7 @@ var SizeGuideSchema = zod.z.object({
|
|
|
274
268
|
rows: zod.z.array(SizeGuideRowSchema)
|
|
275
269
|
});
|
|
276
270
|
var ProductDetailSchema = zod.z.object({
|
|
277
|
-
id:
|
|
271
|
+
id: EntityIdSchema,
|
|
278
272
|
name: zod.z.string(),
|
|
279
273
|
slug: zod.z.string(),
|
|
280
274
|
description: zod.z.string(),
|
|
@@ -287,7 +281,7 @@ var ProductDetailSchema = zod.z.object({
|
|
|
287
281
|
totalInventory: zod.z.number().int().nonnegative(),
|
|
288
282
|
brand: zod.z.string(),
|
|
289
283
|
category: zod.z.string(),
|
|
290
|
-
categoryId:
|
|
284
|
+
categoryId: EntityIdSchema.nullable(),
|
|
291
285
|
tags: zod.z.array(zod.z.string()),
|
|
292
286
|
specifications: zod.z.array(SpecItemSchema),
|
|
293
287
|
variants: zod.z.array(VariantItemSchema),
|
|
@@ -580,7 +574,7 @@ var ProductAutocompleteParamsSchema = zod.z.object({
|
|
|
580
574
|
sellerId: OptionalEntityIdSchema
|
|
581
575
|
});
|
|
582
576
|
var ProductSuggestionSchema = zod.z.object({
|
|
583
|
-
id:
|
|
577
|
+
id: EntityIdSchema,
|
|
584
578
|
name: zod.z.string(),
|
|
585
579
|
slug: zod.z.string(),
|
|
586
580
|
imageUrl: zod.z.string()
|
|
@@ -599,8 +593,8 @@ async function autocompleteProducts(api, params) {
|
|
|
599
593
|
});
|
|
600
594
|
}
|
|
601
595
|
var StorefrontReviewSchema = zod.z.object({
|
|
602
|
-
id:
|
|
603
|
-
productId:
|
|
596
|
+
id: EntityIdSchema,
|
|
597
|
+
productId: EntityIdSchema,
|
|
604
598
|
isVerifiedPurchase: zod.z.boolean(),
|
|
605
599
|
rating: zod.z.number().int().min(1).max(5),
|
|
606
600
|
title: zod.z.string().nullable(),
|
|
@@ -615,7 +609,7 @@ var StorefrontReviewsSchema = zod.z.object({
|
|
|
615
609
|
totalCount: zod.z.number().int().nonnegative().nullable()
|
|
616
610
|
});
|
|
617
611
|
var ListProductReviewsParamsSchema = zod.z.object({
|
|
618
|
-
productId:
|
|
612
|
+
productId: EntityIdSchema,
|
|
619
613
|
limit: zod.z.number().int().min(1).max(200).optional(),
|
|
620
614
|
cursor: zod.z.string().optional(),
|
|
621
615
|
search: zod.z.string().optional(),
|
|
@@ -624,13 +618,13 @@ var ListProductReviewsParamsSchema = zod.z.object({
|
|
|
624
618
|
rating: zod.z.number().int().min(1).max(5).optional()
|
|
625
619
|
});
|
|
626
620
|
var CreateProductReviewParamsSchema = zod.z.object({
|
|
627
|
-
productId:
|
|
621
|
+
productId: EntityIdSchema,
|
|
628
622
|
rating: zod.z.number().int().min(1).max(5),
|
|
629
623
|
content: zod.z.string().min(1).max(4e3),
|
|
630
624
|
title: zod.z.string().max(200).optional(),
|
|
631
625
|
reviewerName: zod.z.string().min(1).max(200),
|
|
632
626
|
reviewerEmail: zod.z.string().email().max(320),
|
|
633
|
-
orderId:
|
|
627
|
+
orderId: EntityIdSchema.optional()
|
|
634
628
|
});
|
|
635
629
|
|
|
636
630
|
// src/services/review.service.ts
|
|
@@ -681,8 +675,8 @@ var StorefrontAddressSchema = zod.z.object({
|
|
|
681
675
|
longitude: zod.z.number().nullable()
|
|
682
676
|
});
|
|
683
677
|
var StorefrontCartBundleItemSchema = zod.z.object({
|
|
684
|
-
productId:
|
|
685
|
-
variantId:
|
|
678
|
+
productId: EntityIdSchema,
|
|
679
|
+
variantId: EntityIdSchema,
|
|
686
680
|
productName: zod.z.string(),
|
|
687
681
|
variantName: zod.z.string().nullable(),
|
|
688
682
|
sku: zod.z.string().nullable(),
|
|
@@ -692,13 +686,13 @@ var StorefrontCartBundleItemSchema = zod.z.object({
|
|
|
692
686
|
});
|
|
693
687
|
var StorefrontCartItemSchema = zod.z.object({
|
|
694
688
|
id: EntityIdSchema,
|
|
695
|
-
productId:
|
|
689
|
+
productId: NullableEntityIdSchema,
|
|
696
690
|
title: zod.z.string(),
|
|
697
691
|
variantLabel: zod.z.string().nullable(),
|
|
698
692
|
productHandle: zod.z.string().nullable(),
|
|
699
693
|
thumbnail: zod.z.string().nullable(),
|
|
700
694
|
quantity: zod.z.number().int().positive(),
|
|
701
|
-
variantId:
|
|
695
|
+
variantId: NullableEntityIdSchema,
|
|
702
696
|
variantSku: zod.z.string().nullable(),
|
|
703
697
|
unitPrice: zod.z.number(),
|
|
704
698
|
compareAtUnitPrice: zod.z.number().nullable(),
|
|
@@ -740,6 +734,7 @@ var StorefrontCartStatusSchema = zod.z.enum([
|
|
|
740
734
|
]);
|
|
741
735
|
var StorefrontCartSchema = zod.z.object({
|
|
742
736
|
id: EntityIdSchema,
|
|
737
|
+
token: CartTokenSchema,
|
|
743
738
|
cartNumber: zod.z.string(),
|
|
744
739
|
email: zod.z.string().nullable(),
|
|
745
740
|
phone: zod.z.string().nullable(),
|
|
@@ -761,25 +756,25 @@ var CreateCartParamsSchema = zod.z.object({
|
|
|
761
756
|
email: zod.z.string().email().optional()
|
|
762
757
|
});
|
|
763
758
|
var GetCartParamsSchema = zod.z.object({
|
|
764
|
-
|
|
759
|
+
cartToken: CartTokenSchema
|
|
765
760
|
});
|
|
766
761
|
var CartItemModifierSchema = zod.z.object({
|
|
767
|
-
modifierGroupId:
|
|
768
|
-
optionIds: zod.z.array(
|
|
762
|
+
modifierGroupId: EntityIdSchema,
|
|
763
|
+
optionIds: zod.z.array(EntityIdSchema).min(1)
|
|
769
764
|
});
|
|
770
765
|
var AddCartItemParamsSchema = zod.z.object({
|
|
771
|
-
|
|
772
|
-
variantId:
|
|
766
|
+
cartToken: CartTokenSchema,
|
|
767
|
+
variantId: EntityIdSchema,
|
|
773
768
|
quantity: zod.z.number().int().positive(),
|
|
774
769
|
modifiers: zod.z.array(CartItemModifierSchema).optional()
|
|
775
770
|
});
|
|
776
771
|
var UpdateCartItemQuantityParamsSchema = zod.z.object({
|
|
777
|
-
|
|
772
|
+
cartToken: CartTokenSchema,
|
|
778
773
|
cartItemId: EntityIdSchema,
|
|
779
774
|
quantity: zod.z.number().int().nonnegative()
|
|
780
775
|
});
|
|
781
776
|
var RemoveCartItemParamsSchema = zod.z.object({
|
|
782
|
-
|
|
777
|
+
cartToken: CartTokenSchema,
|
|
783
778
|
cartItemId: EntityIdSchema
|
|
784
779
|
});
|
|
785
780
|
|
|
@@ -799,14 +794,14 @@ async function createCart(api, params) {
|
|
|
799
794
|
async function getCart(api, params) {
|
|
800
795
|
const input = GetCartParamsSchema.parse(params);
|
|
801
796
|
return api.get(
|
|
802
|
-
`carts/${encodeURIComponent(input.
|
|
797
|
+
`carts/${encodeURIComponent(input.cartToken)}`,
|
|
803
798
|
StorefrontCartSchema
|
|
804
799
|
);
|
|
805
800
|
}
|
|
806
801
|
async function addCartItem(api, params) {
|
|
807
802
|
const input = AddCartItemParamsSchema.parse(params);
|
|
808
803
|
return api.post(
|
|
809
|
-
`carts/${encodeURIComponent(input.
|
|
804
|
+
`carts/${encodeURIComponent(input.cartToken)}/items`,
|
|
810
805
|
{
|
|
811
806
|
variantId: input.variantId,
|
|
812
807
|
quantity: input.quantity,
|
|
@@ -819,7 +814,7 @@ async function updateCartItemQuantity(api, params) {
|
|
|
819
814
|
const input = UpdateCartItemQuantityParamsSchema.parse(params);
|
|
820
815
|
return api.request(
|
|
821
816
|
"PATCH",
|
|
822
|
-
`carts/${encodeURIComponent(input.
|
|
817
|
+
`carts/${encodeURIComponent(input.cartToken)}/items/${encodeURIComponent(input.cartItemId)}`,
|
|
823
818
|
StorefrontCartSchema,
|
|
824
819
|
{ body: { quantity: input.quantity } }
|
|
825
820
|
);
|
|
@@ -828,7 +823,7 @@ async function removeCartItem(api, params) {
|
|
|
828
823
|
const input = RemoveCartItemParamsSchema.parse(params);
|
|
829
824
|
return api.request(
|
|
830
825
|
"DELETE",
|
|
831
|
-
`carts/${encodeURIComponent(input.
|
|
826
|
+
`carts/${encodeURIComponent(input.cartToken)}/items/${encodeURIComponent(input.cartItemId)}`,
|
|
832
827
|
StorefrontCartSchema
|
|
833
828
|
);
|
|
834
829
|
}
|
|
@@ -856,7 +851,7 @@ var CheckoutMetadataValueSchema = zod.z.lazy(
|
|
|
856
851
|
])
|
|
857
852
|
);
|
|
858
853
|
var CartBuyerParamsSchema = zod.z.object({
|
|
859
|
-
|
|
854
|
+
cartToken: CartTokenSchema,
|
|
860
855
|
email: zod.z.string().email(),
|
|
861
856
|
firstName: zod.z.string().min(1),
|
|
862
857
|
lastName: zod.z.string().min(1),
|
|
@@ -882,7 +877,7 @@ var CartAddressWriteSchema = zod.z.object({
|
|
|
882
877
|
}).nullable().optional()
|
|
883
878
|
});
|
|
884
879
|
var CartAddressesParamsSchema = zod.z.object({
|
|
885
|
-
|
|
880
|
+
cartToken: CartTokenSchema,
|
|
886
881
|
shippingAddress: CartAddressWriteSchema,
|
|
887
882
|
billingAddress: CartAddressWriteSchema
|
|
888
883
|
});
|
|
@@ -901,9 +896,9 @@ var CartPaymentMethodSchema = zod.z.object({
|
|
|
901
896
|
qrImageUrl: zod.z.string().nullable().optional()
|
|
902
897
|
});
|
|
903
898
|
var StorefrontOrderBumpSchema = zod.z.object({
|
|
904
|
-
id:
|
|
905
|
-
|
|
906
|
-
|
|
899
|
+
id: EntityIdSchema,
|
|
900
|
+
productId: EntityIdSchema,
|
|
901
|
+
variantId: EntityIdSchema,
|
|
907
902
|
productName: zod.z.string(),
|
|
908
903
|
variantName: zod.z.string().nullable().optional(),
|
|
909
904
|
imageUrl: zod.z.string().nullable().optional(),
|
|
@@ -915,7 +910,7 @@ var StorefrontOrderBumpSchema = zod.z.object({
|
|
|
915
910
|
description: zod.z.string().nullable().optional()
|
|
916
911
|
});
|
|
917
912
|
var CartCheckoutReadParamsSchema = zod.z.object({
|
|
918
|
-
|
|
913
|
+
cartToken: CartTokenSchema
|
|
919
914
|
});
|
|
920
915
|
var CartCheckoutReadResponseSchema = zod.z.object({
|
|
921
916
|
cart: StorefrontCartSchema,
|
|
@@ -955,14 +950,14 @@ var CartCheckoutResponseSchema = zod.z.object({
|
|
|
955
950
|
stripePublicKey: zod.z.string().optional(),
|
|
956
951
|
clientSecret: zod.z.string().optional(),
|
|
957
952
|
intentClientSecret: zod.z.string().optional(),
|
|
958
|
-
orderId:
|
|
953
|
+
orderId: EntityIdSchema.optional(),
|
|
959
954
|
orderGroup: zod.z.string().optional(),
|
|
960
|
-
orderIds: zod.z.array(
|
|
955
|
+
orderIds: zod.z.array(EntityIdSchema).optional(),
|
|
961
956
|
payment: CartCheckoutPaymentSchema.optional(),
|
|
962
957
|
cart: StorefrontCartSchema.optional()
|
|
963
958
|
}).strip();
|
|
964
959
|
var CartCheckoutParamsSchema = zod.z.object({
|
|
965
|
-
|
|
960
|
+
cartToken: CartTokenSchema,
|
|
966
961
|
paymentMethodCode: zod.z.string().min(1),
|
|
967
962
|
externalRef: zod.z.string().min(1),
|
|
968
963
|
receiptUrl: zod.z.string().min(1).optional()
|
|
@@ -995,11 +990,11 @@ var ShippingOptionsResponseSchema = zod.z.object({
|
|
|
995
990
|
groups: zod.z.array(ShippingOptionGroupSchema)
|
|
996
991
|
});
|
|
997
992
|
var GetShippingOptionsParamsSchema = zod.z.object({
|
|
998
|
-
|
|
993
|
+
cartToken: CartTokenSchema,
|
|
999
994
|
postalCode: zod.z.string().min(1)
|
|
1000
995
|
});
|
|
1001
996
|
var PutShippingMethodParamsSchema = zod.z.object({
|
|
1002
|
-
|
|
997
|
+
cartToken: CartTokenSchema,
|
|
1003
998
|
rateId: zod.z.string().min(1),
|
|
1004
999
|
shippingMethodId: zod.z.string().min(1),
|
|
1005
1000
|
serviceCode: zod.z.string().nullable().optional(),
|
|
@@ -1015,7 +1010,7 @@ var CartPaymentReceiptResponseSchema = zod.z.object({
|
|
|
1015
1010
|
url: zod.z.string()
|
|
1016
1011
|
});
|
|
1017
1012
|
var CartPromotionCodeParamsSchema = zod.z.object({
|
|
1018
|
-
|
|
1013
|
+
cartToken: CartTokenSchema,
|
|
1019
1014
|
code: zod.z.string().min(1)
|
|
1020
1015
|
});
|
|
1021
1016
|
|
|
@@ -1023,59 +1018,59 @@ var CartPromotionCodeParamsSchema = zod.z.object({
|
|
|
1023
1018
|
async function getCartCheckout(api, params) {
|
|
1024
1019
|
const input = CartCheckoutReadParamsSchema.parse(params);
|
|
1025
1020
|
return api.get(
|
|
1026
|
-
`carts/${encodeURIComponent(input.
|
|
1021
|
+
`carts/${encodeURIComponent(input.cartToken)}/checkout`,
|
|
1027
1022
|
CartCheckoutReadResponseSchema
|
|
1028
1023
|
);
|
|
1029
1024
|
}
|
|
1030
1025
|
async function getShippingOptions(api, params) {
|
|
1031
1026
|
const input = GetShippingOptionsParamsSchema.parse(params);
|
|
1032
1027
|
return api.get(
|
|
1033
|
-
`carts/${encodeURIComponent(input.
|
|
1028
|
+
`carts/${encodeURIComponent(input.cartToken)}/shipping-options`,
|
|
1034
1029
|
ShippingOptionsResponseSchema,
|
|
1035
1030
|
{ query: { postalCode: input.postalCode } }
|
|
1036
1031
|
);
|
|
1037
1032
|
}
|
|
1038
1033
|
async function putCartShippingMethod(api, params) {
|
|
1039
1034
|
const input = PutShippingMethodParamsSchema.parse(params);
|
|
1040
|
-
const {
|
|
1035
|
+
const { cartToken, ...body } = input;
|
|
1041
1036
|
return api.request(
|
|
1042
1037
|
"PUT",
|
|
1043
|
-
`carts/${encodeURIComponent(
|
|
1038
|
+
`carts/${encodeURIComponent(cartToken)}/shipping-method`,
|
|
1044
1039
|
StorefrontCartSchema,
|
|
1045
1040
|
{ body }
|
|
1046
1041
|
);
|
|
1047
1042
|
}
|
|
1048
1043
|
async function patchCartBuyer(api, params) {
|
|
1049
1044
|
const input = CartBuyerParamsSchema.parse(params);
|
|
1050
|
-
const {
|
|
1045
|
+
const { cartToken, ...body } = input;
|
|
1051
1046
|
return api.request(
|
|
1052
1047
|
"PATCH",
|
|
1053
|
-
`carts/${encodeURIComponent(
|
|
1048
|
+
`carts/${encodeURIComponent(cartToken)}/buyer`,
|
|
1054
1049
|
StorefrontCartSchema,
|
|
1055
1050
|
{ body }
|
|
1056
1051
|
);
|
|
1057
1052
|
}
|
|
1058
1053
|
async function patchCartAddresses(api, params) {
|
|
1059
1054
|
const input = CartAddressesParamsSchema.parse(params);
|
|
1060
|
-
const {
|
|
1055
|
+
const { cartToken, shippingAddress, billingAddress } = input;
|
|
1061
1056
|
return api.request(
|
|
1062
1057
|
"PATCH",
|
|
1063
|
-
`carts/${encodeURIComponent(
|
|
1058
|
+
`carts/${encodeURIComponent(cartToken)}/addresses`,
|
|
1064
1059
|
StorefrontCartSchema,
|
|
1065
1060
|
{ body: { shippingAddress, billingAddress } }
|
|
1066
1061
|
);
|
|
1067
1062
|
}
|
|
1068
1063
|
async function checkoutCart(api, params) {
|
|
1069
1064
|
const input = CartCheckoutParamsSchema.parse(params);
|
|
1070
|
-
const {
|
|
1065
|
+
const { cartToken, ...body } = input;
|
|
1071
1066
|
return api.post(
|
|
1072
|
-
`carts/${encodeURIComponent(
|
|
1067
|
+
`carts/${encodeURIComponent(cartToken)}/checkout`,
|
|
1073
1068
|
body,
|
|
1074
1069
|
CartCheckoutResponseSchema
|
|
1075
1070
|
);
|
|
1076
1071
|
}
|
|
1077
1072
|
async function uploadPaymentReceipt(api, params) {
|
|
1078
|
-
const
|
|
1073
|
+
const cartToken = CartCheckoutReadParamsSchema.shape.cartToken.parse(params.cartToken);
|
|
1079
1074
|
if (!(params.file instanceof Blob)) {
|
|
1080
1075
|
throw new TypeError("uploadPaymentReceipt requiere un archivo (Blob/File)");
|
|
1081
1076
|
}
|
|
@@ -1083,7 +1078,7 @@ async function uploadPaymentReceipt(api, params) {
|
|
|
1083
1078
|
const name = params.fileName ?? (params.file instanceof File ? params.file.name : "receipt");
|
|
1084
1079
|
form.append("file", params.file, name);
|
|
1085
1080
|
return api.postForm(
|
|
1086
|
-
`carts/${encodeURIComponent(
|
|
1081
|
+
`carts/${encodeURIComponent(cartToken)}/payment-receipt`,
|
|
1087
1082
|
form,
|
|
1088
1083
|
CartPaymentReceiptResponseSchema
|
|
1089
1084
|
);
|
|
@@ -1091,7 +1086,7 @@ async function uploadPaymentReceipt(api, params) {
|
|
|
1091
1086
|
async function addCartPromotionCode(api, params) {
|
|
1092
1087
|
const input = CartPromotionCodeParamsSchema.parse(params);
|
|
1093
1088
|
return api.post(
|
|
1094
|
-
`carts/${encodeURIComponent(input.
|
|
1089
|
+
`carts/${encodeURIComponent(input.cartToken)}/promotion-codes`,
|
|
1095
1090
|
{ code: input.code },
|
|
1096
1091
|
StorefrontCartSchema
|
|
1097
1092
|
);
|
|
@@ -1100,7 +1095,7 @@ async function removeCartPromotionCode(api, params) {
|
|
|
1100
1095
|
const input = CartPromotionCodeParamsSchema.parse(params);
|
|
1101
1096
|
return api.request(
|
|
1102
1097
|
"DELETE",
|
|
1103
|
-
`carts/${encodeURIComponent(input.
|
|
1098
|
+
`carts/${encodeURIComponent(input.cartToken)}/promotion-codes/${encodeURIComponent(input.code)}`,
|
|
1104
1099
|
StorefrontCartSchema
|
|
1105
1100
|
);
|
|
1106
1101
|
}
|
|
@@ -1202,7 +1197,7 @@ var CustomerAddressUpsertInputSchema = zod.z.object({
|
|
|
1202
1197
|
isDefault: zod.z.boolean()
|
|
1203
1198
|
});
|
|
1204
1199
|
var CustomerAddressSchema = CustomerAddressUpsertInputSchema.extend({
|
|
1205
|
-
id:
|
|
1200
|
+
id: EntityIdSchema.optional()
|
|
1206
1201
|
});
|
|
1207
1202
|
var CustomerAddressesSchema = zod.z.array(CustomerAddressSchema);
|
|
1208
1203
|
|
|
@@ -1211,7 +1206,7 @@ var ADDRESSES_PATH = "customer/addresses";
|
|
|
1211
1206
|
var CustomerAddressMutationResponseSchema = zod.z.union([
|
|
1212
1207
|
CustomerAddressSchema,
|
|
1213
1208
|
zod.z.object({
|
|
1214
|
-
id:
|
|
1209
|
+
id: EntityIdSchema
|
|
1215
1210
|
}),
|
|
1216
1211
|
zod.z.null()
|
|
1217
1212
|
]);
|
|
@@ -1298,8 +1293,8 @@ zod.z.object({
|
|
|
1298
1293
|
});
|
|
1299
1294
|
var nullableString = zod.z.string().nullable().optional().transform((v) => v ?? null);
|
|
1300
1295
|
var CustomerMeSchema = zod.z.object({
|
|
1301
|
-
id:
|
|
1302
|
-
storeId:
|
|
1296
|
+
id: EntityIdSchema,
|
|
1297
|
+
storeId: EntityIdSchema.optional(),
|
|
1303
1298
|
email: zod.z.string().email(),
|
|
1304
1299
|
firstName: zod.z.string(),
|
|
1305
1300
|
lastName: zod.z.string(),
|
|
@@ -1348,10 +1343,10 @@ var CustomerOrderShippingAddressSchema = zod.z.object({
|
|
|
1348
1343
|
metadata: zod.z.record(zod.z.unknown()).nullable().optional()
|
|
1349
1344
|
}).passthrough();
|
|
1350
1345
|
var CustomerOrderLineItemSchema = zod.z.object({
|
|
1351
|
-
id:
|
|
1352
|
-
orderId:
|
|
1353
|
-
productId:
|
|
1354
|
-
variantId:
|
|
1346
|
+
id: EntityIdSchema,
|
|
1347
|
+
orderId: EntityIdSchema,
|
|
1348
|
+
productId: EntityIdSchema.nullable(),
|
|
1349
|
+
variantId: EntityIdSchema.nullable(),
|
|
1355
1350
|
title: zod.z.string(),
|
|
1356
1351
|
subtitle: zod.z.string().nullable().optional(),
|
|
1357
1352
|
thumbnail: zod.z.string().nullable().optional(),
|
|
@@ -1363,10 +1358,10 @@ var CustomerOrderLineItemSchema = zod.z.object({
|
|
|
1363
1358
|
status: zod.z.string()
|
|
1364
1359
|
});
|
|
1365
1360
|
var CustomerOrderListItemSchema = zod.z.object({
|
|
1366
|
-
orderId:
|
|
1361
|
+
orderId: EntityIdSchema,
|
|
1367
1362
|
orderNumber: zod.z.string(),
|
|
1368
1363
|
orderGroup: zod.z.string(),
|
|
1369
|
-
orderIds: zod.z.array(
|
|
1364
|
+
orderIds: zod.z.array(EntityIdSchema),
|
|
1370
1365
|
status: zod.z.string(),
|
|
1371
1366
|
total: zod.z.number(),
|
|
1372
1367
|
totalPaid: zod.z.number(),
|
|
@@ -1381,7 +1376,7 @@ var CustomerOrderListItemSchema = zod.z.object({
|
|
|
1381
1376
|
});
|
|
1382
1377
|
var CustomerOrderListSchema = zod.z.array(CustomerOrderListItemSchema);
|
|
1383
1378
|
var CustomerOrderPaymentSchema = zod.z.object({
|
|
1384
|
-
id:
|
|
1379
|
+
id: EntityIdSchema,
|
|
1385
1380
|
paymentMethod: zod.z.string(),
|
|
1386
1381
|
paymentCode: zod.z.string(),
|
|
1387
1382
|
amount: zod.z.number(),
|
|
@@ -1398,7 +1393,7 @@ var CustomerOrderStatusTimelineSchema = zod.z.object({
|
|
|
1398
1393
|
source: zod.z.string()
|
|
1399
1394
|
});
|
|
1400
1395
|
var CustomerOrderDetailSchema = zod.z.object({
|
|
1401
|
-
id:
|
|
1396
|
+
id: EntityIdSchema,
|
|
1402
1397
|
orderNumber: zod.z.string(),
|
|
1403
1398
|
orderGroup: zod.z.string(),
|
|
1404
1399
|
status: zod.z.string(),
|