@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
|
@@ -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,8 +105,14 @@ 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.string().min(1, "Expected resource id");
|
|
109
|
+
var CartTokenSchema = zod.z.string().min(1).max(32).regex(/^[A-Za-z0-9_-]+$/, "Expected cart token");
|
|
110
|
+
var NullableEntityIdSchema = EntityIdSchema.nullable();
|
|
111
|
+
var OptionalEntityIdSchema = EntityIdSchema.optional();
|
|
112
|
+
|
|
113
|
+
// src/models/collections.ts
|
|
108
114
|
var CollectionSchema = zod.z.object({
|
|
109
|
-
id:
|
|
115
|
+
id: EntityIdSchema,
|
|
110
116
|
slug: zod.z.string(),
|
|
111
117
|
name: zod.z.string(),
|
|
112
118
|
description: zod.z.string().nullable().optional(),
|
|
@@ -115,20 +121,8 @@ var CollectionSchema = zod.z.object({
|
|
|
115
121
|
productCount: zod.z.number().optional()
|
|
116
122
|
});
|
|
117
123
|
var CollectionsSchema = zod.z.array(CollectionSchema);
|
|
118
|
-
var EntityIdSchema = zod.z.union([
|
|
119
|
-
zod.z.string().uuid(),
|
|
120
|
-
zod.z.string().regex(/^\d+$/, "Expected numeric id")
|
|
121
|
-
]);
|
|
122
|
-
var NullableEntityIdSchema = EntityIdSchema.nullable();
|
|
123
|
-
var OptionalEntityIdSchema = EntityIdSchema.optional();
|
|
124
|
-
|
|
125
|
-
// src/models/products.ts
|
|
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
|
}
|
|
@@ -845,8 +840,18 @@ async function getCollectionBySlug(api, collectionSlug) {
|
|
|
845
840
|
async function getPageBySlug(api, pageSlug) {
|
|
846
841
|
return api.get(`pages/${encodeURIComponent(pageSlug)}`, CmsPageDetailsDtoSchema);
|
|
847
842
|
}
|
|
843
|
+
var CheckoutMetadataValueSchema = zod.z.lazy(
|
|
844
|
+
() => zod.z.union([
|
|
845
|
+
zod.z.string(),
|
|
846
|
+
zod.z.number(),
|
|
847
|
+
zod.z.boolean(),
|
|
848
|
+
zod.z.null(),
|
|
849
|
+
zod.z.array(CheckoutMetadataValueSchema),
|
|
850
|
+
zod.z.record(zod.z.string(), CheckoutMetadataValueSchema)
|
|
851
|
+
])
|
|
852
|
+
);
|
|
848
853
|
var CartBuyerParamsSchema = zod.z.object({
|
|
849
|
-
|
|
854
|
+
cartToken: CartTokenSchema,
|
|
850
855
|
email: zod.z.string().email(),
|
|
851
856
|
firstName: zod.z.string().min(1),
|
|
852
857
|
lastName: zod.z.string().min(1),
|
|
@@ -872,7 +877,7 @@ var CartAddressWriteSchema = zod.z.object({
|
|
|
872
877
|
}).nullable().optional()
|
|
873
878
|
});
|
|
874
879
|
var CartAddressesParamsSchema = zod.z.object({
|
|
875
|
-
|
|
880
|
+
cartToken: CartTokenSchema,
|
|
876
881
|
shippingAddress: CartAddressWriteSchema,
|
|
877
882
|
billingAddress: CartAddressWriteSchema
|
|
878
883
|
});
|
|
@@ -891,9 +896,9 @@ var CartPaymentMethodSchema = zod.z.object({
|
|
|
891
896
|
qrImageUrl: zod.z.string().nullable().optional()
|
|
892
897
|
});
|
|
893
898
|
var StorefrontOrderBumpSchema = zod.z.object({
|
|
894
|
-
id:
|
|
895
|
-
|
|
896
|
-
|
|
899
|
+
id: EntityIdSchema,
|
|
900
|
+
productId: EntityIdSchema,
|
|
901
|
+
variantId: EntityIdSchema,
|
|
897
902
|
productName: zod.z.string(),
|
|
898
903
|
variantName: zod.z.string().nullable().optional(),
|
|
899
904
|
imageUrl: zod.z.string().nullable().optional(),
|
|
@@ -905,7 +910,7 @@ var StorefrontOrderBumpSchema = zod.z.object({
|
|
|
905
910
|
description: zod.z.string().nullable().optional()
|
|
906
911
|
});
|
|
907
912
|
var CartCheckoutReadParamsSchema = zod.z.object({
|
|
908
|
-
|
|
913
|
+
cartToken: CartTokenSchema
|
|
909
914
|
});
|
|
910
915
|
var CartCheckoutReadResponseSchema = zod.z.object({
|
|
911
916
|
cart: StorefrontCartSchema,
|
|
@@ -921,13 +926,13 @@ var CartCheckoutPaymentActionSchema = zod.z.object({
|
|
|
921
926
|
phoneNumber: zod.z.string().nullable().optional(),
|
|
922
927
|
accountHolder: zod.z.string().nullable().optional(),
|
|
923
928
|
qrImageUrl: zod.z.string().nullable().optional()
|
|
924
|
-
}).
|
|
929
|
+
}).strip().nullable().optional(),
|
|
925
930
|
url: zod.z.string().nullable().optional(),
|
|
926
931
|
html: zod.z.string().nullable().optional(),
|
|
927
932
|
clientSecret: zod.z.string().nullable().optional(),
|
|
928
933
|
qrCode: zod.z.string().nullable().optional(),
|
|
929
934
|
expiresAt: zod.z.string().nullable().optional()
|
|
930
|
-
}).
|
|
935
|
+
}).strip();
|
|
931
936
|
var CartCheckoutPaymentSchema = zod.z.object({
|
|
932
937
|
transactionId: zod.z.string(),
|
|
933
938
|
paymentMethodCode: zod.z.string(),
|
|
@@ -938,21 +943,21 @@ var CartCheckoutPaymentSchema = zod.z.object({
|
|
|
938
943
|
actionType: zod.z.string(),
|
|
939
944
|
receiptUrl: zod.z.string().nullable().optional(),
|
|
940
945
|
action: CartCheckoutPaymentActionSchema.nullable().optional()
|
|
941
|
-
}).
|
|
946
|
+
}).strip();
|
|
942
947
|
var CartCheckoutResponseSchema = zod.z.object({
|
|
943
948
|
publicKey: zod.z.string().optional(),
|
|
944
949
|
publishableKey: zod.z.string().optional(),
|
|
945
950
|
stripePublicKey: zod.z.string().optional(),
|
|
946
951
|
clientSecret: zod.z.string().optional(),
|
|
947
952
|
intentClientSecret: zod.z.string().optional(),
|
|
948
|
-
orderId:
|
|
953
|
+
orderId: EntityIdSchema.optional(),
|
|
949
954
|
orderGroup: zod.z.string().optional(),
|
|
950
|
-
orderIds: zod.z.array(
|
|
955
|
+
orderIds: zod.z.array(EntityIdSchema).optional(),
|
|
951
956
|
payment: CartCheckoutPaymentSchema.optional(),
|
|
952
957
|
cart: StorefrontCartSchema.optional()
|
|
953
|
-
}).
|
|
958
|
+
}).strip();
|
|
954
959
|
var CartCheckoutParamsSchema = zod.z.object({
|
|
955
|
-
|
|
960
|
+
cartToken: CartTokenSchema,
|
|
956
961
|
paymentMethodCode: zod.z.string().min(1),
|
|
957
962
|
externalRef: zod.z.string().min(1),
|
|
958
963
|
receiptUrl: zod.z.string().min(1).optional()
|
|
@@ -971,8 +976,8 @@ var ShippingRateSchema = zod.z.object({
|
|
|
971
976
|
deliveryLocationName: zod.z.string().nullable().optional(),
|
|
972
977
|
estimatedDeliveryDays: zod.z.number().nullable().optional(),
|
|
973
978
|
serviceCode: zod.z.string().nullable().optional(),
|
|
974
|
-
metadata: zod.z.record(zod.z.string(),
|
|
975
|
-
}).
|
|
979
|
+
metadata: zod.z.record(zod.z.string(), CheckoutMetadataValueSchema).optional()
|
|
980
|
+
}).strip();
|
|
976
981
|
var ShippingOptionGroupSchema = zod.z.object({
|
|
977
982
|
sellerId: zod.z.string(),
|
|
978
983
|
shippingProfileId: zod.z.string().nullable().optional(),
|
|
@@ -980,16 +985,16 @@ var ShippingOptionGroupSchema = zod.z.object({
|
|
|
980
985
|
totalWeight: zod.z.number().optional(),
|
|
981
986
|
itemIds: zod.z.array(zod.z.string()).optional(),
|
|
982
987
|
rates: zod.z.array(ShippingRateSchema)
|
|
983
|
-
}).
|
|
988
|
+
}).strip();
|
|
984
989
|
var ShippingOptionsResponseSchema = zod.z.object({
|
|
985
990
|
groups: zod.z.array(ShippingOptionGroupSchema)
|
|
986
991
|
});
|
|
987
992
|
var GetShippingOptionsParamsSchema = zod.z.object({
|
|
988
|
-
|
|
993
|
+
cartToken: CartTokenSchema,
|
|
989
994
|
postalCode: zod.z.string().min(1)
|
|
990
995
|
});
|
|
991
996
|
var PutShippingMethodParamsSchema = zod.z.object({
|
|
992
|
-
|
|
997
|
+
cartToken: CartTokenSchema,
|
|
993
998
|
rateId: zod.z.string().min(1),
|
|
994
999
|
shippingMethodId: zod.z.string().min(1),
|
|
995
1000
|
serviceCode: zod.z.string().nullable().optional(),
|
|
@@ -1005,7 +1010,7 @@ var CartPaymentReceiptResponseSchema = zod.z.object({
|
|
|
1005
1010
|
url: zod.z.string()
|
|
1006
1011
|
});
|
|
1007
1012
|
var CartPromotionCodeParamsSchema = zod.z.object({
|
|
1008
|
-
|
|
1013
|
+
cartToken: CartTokenSchema,
|
|
1009
1014
|
code: zod.z.string().min(1)
|
|
1010
1015
|
});
|
|
1011
1016
|
|
|
@@ -1013,59 +1018,59 @@ var CartPromotionCodeParamsSchema = zod.z.object({
|
|
|
1013
1018
|
async function getCartCheckout(api, params) {
|
|
1014
1019
|
const input = CartCheckoutReadParamsSchema.parse(params);
|
|
1015
1020
|
return api.get(
|
|
1016
|
-
`carts/${encodeURIComponent(input.
|
|
1021
|
+
`carts/${encodeURIComponent(input.cartToken)}/checkout`,
|
|
1017
1022
|
CartCheckoutReadResponseSchema
|
|
1018
1023
|
);
|
|
1019
1024
|
}
|
|
1020
1025
|
async function getShippingOptions(api, params) {
|
|
1021
1026
|
const input = GetShippingOptionsParamsSchema.parse(params);
|
|
1022
1027
|
return api.get(
|
|
1023
|
-
`carts/${encodeURIComponent(input.
|
|
1028
|
+
`carts/${encodeURIComponent(input.cartToken)}/shipping-options`,
|
|
1024
1029
|
ShippingOptionsResponseSchema,
|
|
1025
1030
|
{ query: { postalCode: input.postalCode } }
|
|
1026
1031
|
);
|
|
1027
1032
|
}
|
|
1028
1033
|
async function putCartShippingMethod(api, params) {
|
|
1029
1034
|
const input = PutShippingMethodParamsSchema.parse(params);
|
|
1030
|
-
const {
|
|
1035
|
+
const { cartToken, ...body } = input;
|
|
1031
1036
|
return api.request(
|
|
1032
1037
|
"PUT",
|
|
1033
|
-
`carts/${encodeURIComponent(
|
|
1038
|
+
`carts/${encodeURIComponent(cartToken)}/shipping-method`,
|
|
1034
1039
|
StorefrontCartSchema,
|
|
1035
1040
|
{ body }
|
|
1036
1041
|
);
|
|
1037
1042
|
}
|
|
1038
1043
|
async function patchCartBuyer(api, params) {
|
|
1039
1044
|
const input = CartBuyerParamsSchema.parse(params);
|
|
1040
|
-
const {
|
|
1045
|
+
const { cartToken, ...body } = input;
|
|
1041
1046
|
return api.request(
|
|
1042
1047
|
"PATCH",
|
|
1043
|
-
`carts/${encodeURIComponent(
|
|
1048
|
+
`carts/${encodeURIComponent(cartToken)}/buyer`,
|
|
1044
1049
|
StorefrontCartSchema,
|
|
1045
1050
|
{ body }
|
|
1046
1051
|
);
|
|
1047
1052
|
}
|
|
1048
1053
|
async function patchCartAddresses(api, params) {
|
|
1049
1054
|
const input = CartAddressesParamsSchema.parse(params);
|
|
1050
|
-
const {
|
|
1055
|
+
const { cartToken, shippingAddress, billingAddress } = input;
|
|
1051
1056
|
return api.request(
|
|
1052
1057
|
"PATCH",
|
|
1053
|
-
`carts/${encodeURIComponent(
|
|
1058
|
+
`carts/${encodeURIComponent(cartToken)}/addresses`,
|
|
1054
1059
|
StorefrontCartSchema,
|
|
1055
1060
|
{ body: { shippingAddress, billingAddress } }
|
|
1056
1061
|
);
|
|
1057
1062
|
}
|
|
1058
1063
|
async function checkoutCart(api, params) {
|
|
1059
1064
|
const input = CartCheckoutParamsSchema.parse(params);
|
|
1060
|
-
const {
|
|
1065
|
+
const { cartToken, ...body } = input;
|
|
1061
1066
|
return api.post(
|
|
1062
|
-
`carts/${encodeURIComponent(
|
|
1067
|
+
`carts/${encodeURIComponent(cartToken)}/checkout`,
|
|
1063
1068
|
body,
|
|
1064
1069
|
CartCheckoutResponseSchema
|
|
1065
1070
|
);
|
|
1066
1071
|
}
|
|
1067
1072
|
async function uploadPaymentReceipt(api, params) {
|
|
1068
|
-
const
|
|
1073
|
+
const cartToken = CartCheckoutReadParamsSchema.shape.cartToken.parse(params.cartToken);
|
|
1069
1074
|
if (!(params.file instanceof Blob)) {
|
|
1070
1075
|
throw new TypeError("uploadPaymentReceipt requiere un archivo (Blob/File)");
|
|
1071
1076
|
}
|
|
@@ -1073,7 +1078,7 @@ async function uploadPaymentReceipt(api, params) {
|
|
|
1073
1078
|
const name = params.fileName ?? (params.file instanceof File ? params.file.name : "receipt");
|
|
1074
1079
|
form.append("file", params.file, name);
|
|
1075
1080
|
return api.postForm(
|
|
1076
|
-
`carts/${encodeURIComponent(
|
|
1081
|
+
`carts/${encodeURIComponent(cartToken)}/payment-receipt`,
|
|
1077
1082
|
form,
|
|
1078
1083
|
CartPaymentReceiptResponseSchema
|
|
1079
1084
|
);
|
|
@@ -1081,7 +1086,7 @@ async function uploadPaymentReceipt(api, params) {
|
|
|
1081
1086
|
async function addCartPromotionCode(api, params) {
|
|
1082
1087
|
const input = CartPromotionCodeParamsSchema.parse(params);
|
|
1083
1088
|
return api.post(
|
|
1084
|
-
`carts/${encodeURIComponent(input.
|
|
1089
|
+
`carts/${encodeURIComponent(input.cartToken)}/promotion-codes`,
|
|
1085
1090
|
{ code: input.code },
|
|
1086
1091
|
StorefrontCartSchema
|
|
1087
1092
|
);
|
|
@@ -1090,7 +1095,7 @@ async function removeCartPromotionCode(api, params) {
|
|
|
1090
1095
|
const input = CartPromotionCodeParamsSchema.parse(params);
|
|
1091
1096
|
return api.request(
|
|
1092
1097
|
"DELETE",
|
|
1093
|
-
`carts/${encodeURIComponent(input.
|
|
1098
|
+
`carts/${encodeURIComponent(input.cartToken)}/promotion-codes/${encodeURIComponent(input.code)}`,
|
|
1094
1099
|
StorefrontCartSchema
|
|
1095
1100
|
);
|
|
1096
1101
|
}
|
|
@@ -1192,7 +1197,7 @@ var CustomerAddressUpsertInputSchema = zod.z.object({
|
|
|
1192
1197
|
isDefault: zod.z.boolean()
|
|
1193
1198
|
});
|
|
1194
1199
|
var CustomerAddressSchema = CustomerAddressUpsertInputSchema.extend({
|
|
1195
|
-
id:
|
|
1200
|
+
id: EntityIdSchema.optional()
|
|
1196
1201
|
});
|
|
1197
1202
|
var CustomerAddressesSchema = zod.z.array(CustomerAddressSchema);
|
|
1198
1203
|
|
|
@@ -1201,7 +1206,7 @@ var ADDRESSES_PATH = "customer/addresses";
|
|
|
1201
1206
|
var CustomerAddressMutationResponseSchema = zod.z.union([
|
|
1202
1207
|
CustomerAddressSchema,
|
|
1203
1208
|
zod.z.object({
|
|
1204
|
-
id:
|
|
1209
|
+
id: EntityIdSchema
|
|
1205
1210
|
}),
|
|
1206
1211
|
zod.z.null()
|
|
1207
1212
|
]);
|
|
@@ -1288,8 +1293,8 @@ zod.z.object({
|
|
|
1288
1293
|
});
|
|
1289
1294
|
var nullableString = zod.z.string().nullable().optional().transform((v) => v ?? null);
|
|
1290
1295
|
var CustomerMeSchema = zod.z.object({
|
|
1291
|
-
id:
|
|
1292
|
-
storeId:
|
|
1296
|
+
id: EntityIdSchema,
|
|
1297
|
+
storeId: EntityIdSchema.optional(),
|
|
1293
1298
|
email: zod.z.string().email(),
|
|
1294
1299
|
firstName: zod.z.string(),
|
|
1295
1300
|
lastName: zod.z.string(),
|
|
@@ -1338,10 +1343,10 @@ var CustomerOrderShippingAddressSchema = zod.z.object({
|
|
|
1338
1343
|
metadata: zod.z.record(zod.z.unknown()).nullable().optional()
|
|
1339
1344
|
}).passthrough();
|
|
1340
1345
|
var CustomerOrderLineItemSchema = zod.z.object({
|
|
1341
|
-
id:
|
|
1342
|
-
orderId:
|
|
1343
|
-
productId:
|
|
1344
|
-
variantId:
|
|
1346
|
+
id: EntityIdSchema,
|
|
1347
|
+
orderId: EntityIdSchema,
|
|
1348
|
+
productId: EntityIdSchema.nullable(),
|
|
1349
|
+
variantId: EntityIdSchema.nullable(),
|
|
1345
1350
|
title: zod.z.string(),
|
|
1346
1351
|
subtitle: zod.z.string().nullable().optional(),
|
|
1347
1352
|
thumbnail: zod.z.string().nullable().optional(),
|
|
@@ -1353,10 +1358,10 @@ var CustomerOrderLineItemSchema = zod.z.object({
|
|
|
1353
1358
|
status: zod.z.string()
|
|
1354
1359
|
});
|
|
1355
1360
|
var CustomerOrderListItemSchema = zod.z.object({
|
|
1356
|
-
orderId:
|
|
1361
|
+
orderId: EntityIdSchema,
|
|
1357
1362
|
orderNumber: zod.z.string(),
|
|
1358
1363
|
orderGroup: zod.z.string(),
|
|
1359
|
-
orderIds: zod.z.array(
|
|
1364
|
+
orderIds: zod.z.array(EntityIdSchema),
|
|
1360
1365
|
status: zod.z.string(),
|
|
1361
1366
|
total: zod.z.number(),
|
|
1362
1367
|
totalPaid: zod.z.number(),
|
|
@@ -1371,7 +1376,7 @@ var CustomerOrderListItemSchema = zod.z.object({
|
|
|
1371
1376
|
});
|
|
1372
1377
|
var CustomerOrderListSchema = zod.z.array(CustomerOrderListItemSchema);
|
|
1373
1378
|
var CustomerOrderPaymentSchema = zod.z.object({
|
|
1374
|
-
id:
|
|
1379
|
+
id: EntityIdSchema,
|
|
1375
1380
|
paymentMethod: zod.z.string(),
|
|
1376
1381
|
paymentCode: zod.z.string(),
|
|
1377
1382
|
amount: zod.z.number(),
|
|
@@ -1388,7 +1393,7 @@ var CustomerOrderStatusTimelineSchema = zod.z.object({
|
|
|
1388
1393
|
source: zod.z.string()
|
|
1389
1394
|
});
|
|
1390
1395
|
var CustomerOrderDetailSchema = zod.z.object({
|
|
1391
|
-
id:
|
|
1396
|
+
id: EntityIdSchema,
|
|
1392
1397
|
orderNumber: zod.z.string(),
|
|
1393
1398
|
orderGroup: zod.z.string(),
|
|
1394
1399
|
status: zod.z.string(),
|