@ecomiq/core 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{client-4ZTG2RZ3.d.ts → client-Ba1r_uiO.d.ts} +4 -4
- package/dist/{client-BpX4yR6S.d.cts → client-Cqcnv2tC.d.cts} +4 -4
- package/dist/client.cjs +72 -77
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +72 -77
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +73 -89
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +64 -54
- package/dist/index.d.ts +64 -54
- package/dist/index.js +73 -88
- package/dist/index.js.map +1 -1
- package/dist/models/collections.cjs +2 -4
- package/dist/models/collections.cjs.map +1 -1
- package/dist/models/collections.d.cts +2 -2
- package/dist/models/collections.d.ts +2 -2
- package/dist/models/collections.js +2 -4
- package/dist/models/collections.js.map +1 -1
- package/dist/models/customer-address.cjs +7 -1
- package/dist/models/customer-address.cjs.map +1 -1
- package/dist/models/customer-address.d.cts +4 -4
- package/dist/models/customer-address.d.ts +4 -4
- package/dist/models/customer-address.js +7 -1
- package/dist/models/customer-address.js.map +1 -1
- package/dist/models/customer-order.cjs +14 -8
- package/dist/models/customer-order.cjs.map +1 -1
- package/dist/models/customer-order.d.cts +1 -5
- package/dist/models/customer-order.d.ts +1 -5
- package/dist/models/customer-order.js +14 -8
- package/dist/models/customer-order.js.map +1 -1
- package/dist/models/customer-profile.cjs +8 -2
- package/dist/models/customer-profile.cjs.map +1 -1
- package/dist/models/customer-profile.d.cts +3 -3
- package/dist/models/customer-profile.d.ts +3 -3
- package/dist/models/customer-profile.js +8 -2
- package/dist/models/customer-profile.js.map +1 -1
- package/dist/models/geo.cjs +2 -4
- package/dist/models/geo.cjs.map +1 -1
- package/dist/models/geo.d.cts +14 -14
- package/dist/models/geo.d.ts +14 -14
- package/dist/models/geo.js +2 -4
- package/dist/models/geo.js.map +1 -1
- package/dist/models/ids.cjs +3 -4
- package/dist/models/ids.cjs.map +1 -1
- package/dist/models/ids.d.cts +8 -8
- package/dist/models/ids.d.ts +8 -8
- package/dist/models/ids.js +3 -5
- package/dist/models/ids.js.map +1 -1
- package/dist/models/products.cjs +12 -19
- package/dist/models/products.cjs.map +1 -1
- package/dist/models/products.d.cts +32 -33
- package/dist/models/products.d.ts +32 -33
- package/dist/models/products.js +13 -19
- package/dist/models/products.js.map +1 -1
- package/dist/models/search.cjs +3 -180
- package/dist/models/search.cjs.map +1 -1
- package/dist/models/search.d.cts +5 -5
- package/dist/models/search.d.ts +5 -5
- package/dist/models/search.js +3 -180
- package/dist/models/search.js.map +1 -1
- package/dist/models/settings.cjs +2 -4
- package/dist/models/settings.cjs.map +1 -1
- package/dist/models/settings.d.cts +63 -63
- package/dist/models/settings.d.ts +63 -63
- package/dist/models/settings.js +2 -4
- package/dist/models/settings.js.map +1 -1
- package/dist/models/storefront-cart.cjs +14 -26
- package/dist/models/storefront-cart.cjs.map +1 -1
- package/dist/models/storefront-cart.d.cts +100 -98
- package/dist/models/storefront-cart.d.ts +100 -98
- package/dist/models/storefront-cart.js +15 -26
- package/dist/models/storefront-cart.js.map +1 -1
- package/dist/models/storefront-checkout.cjs +26 -27
- package/dist/models/storefront-checkout.cjs.map +1 -1
- package/dist/models/storefront-checkout.d.cts +130 -120
- package/dist/models/storefront-checkout.d.ts +130 -120
- package/dist/models/storefront-checkout.js +26 -27
- package/dist/models/storefront-checkout.js.map +1 -1
- package/dist/models/storefront-reviews.cjs +8 -187
- package/dist/models/storefront-reviews.cjs.map +1 -1
- package/dist/models/storefront-reviews.d.cts +17 -17
- package/dist/models/storefront-reviews.d.ts +17 -17
- package/dist/models/storefront-reviews.js +8 -187
- package/dist/models/storefront-reviews.js.map +1 -1
- package/package.json +1 -1
package/dist/client.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export { CreateApiOptions } from './api.cjs';
|
|
2
2
|
import './models/collections.cjs';
|
|
3
3
|
import './models/products.cjs';
|
|
4
4
|
import './models/search.cjs';
|
|
@@ -7,7 +7,7 @@ import './models/storefront-cart.cjs';
|
|
|
7
7
|
import './models/storefront-checkout.cjs';
|
|
8
8
|
import './models/geo.cjs';
|
|
9
9
|
import './models/customer-address.cjs';
|
|
10
|
-
export { C as CreateClientOptions, S as StorefrontClient, f as createClient, h as createStorefrontClient } from './client-
|
|
10
|
+
export { C as CreateClientOptions, S as StorefrontClient, f as createClient, h as createStorefrontClient } from './client-Cqcnv2tC.cjs';
|
|
11
11
|
import './models/customer-profile.cjs';
|
|
12
12
|
import './models/customer-order.cjs';
|
|
13
13
|
import './models/settings.cjs';
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export { CreateApiOptions } from './api.js';
|
|
2
2
|
import './models/collections.js';
|
|
3
3
|
import './models/products.js';
|
|
4
4
|
import './models/search.js';
|
|
@@ -7,7 +7,7 @@ import './models/storefront-cart.js';
|
|
|
7
7
|
import './models/storefront-checkout.js';
|
|
8
8
|
import './models/geo.js';
|
|
9
9
|
import './models/customer-address.js';
|
|
10
|
-
export { C as CreateClientOptions, S as StorefrontClient, f as createClient, h as createStorefrontClient } from './client-
|
|
10
|
+
export { C as CreateClientOptions, S as StorefrontClient, f as createClient, h as createStorefrontClient } from './client-Ba1r_uiO.js';
|
|
11
11
|
import './models/customer-profile.js';
|
|
12
12
|
import './models/customer-order.js';
|
|
13
13
|
import './models/settings.js';
|
package/dist/client.js
CHANGED
|
@@ -103,10 +103,8 @@ function createApi(options = {}) {
|
|
|
103
103
|
postForm: (path, body, schema, opts) => request("POST", path, schema, { ...opts, body })
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
var EntityIdSchema = z.
|
|
107
|
-
|
|
108
|
-
z.string().regex(/^\d+$/, "Expected numeric id")
|
|
109
|
-
]);
|
|
106
|
+
var EntityIdSchema = z.string().min(1, "Expected resource id");
|
|
107
|
+
var CartTokenSchema = z.string().min(1).max(32).regex(/^[A-Za-z0-9_-]+$/, "Expected cart token");
|
|
110
108
|
var NullableEntityIdSchema = EntityIdSchema.nullable();
|
|
111
109
|
var OptionalEntityIdSchema = EntityIdSchema.optional();
|
|
112
110
|
|
|
@@ -121,12 +119,8 @@ var CollectionSchema = z.object({
|
|
|
121
119
|
productCount: z.number().optional()
|
|
122
120
|
});
|
|
123
121
|
var CollectionsSchema = z.array(CollectionSchema);
|
|
124
|
-
var ProductPublicIdSchema = z.union([
|
|
125
|
-
z.string().regex(/^[1-9]\d*$/),
|
|
126
|
-
z.number().int().safe().positive()
|
|
127
|
-
]).transform(String);
|
|
128
122
|
var ProductSummarySchema = z.object({
|
|
129
|
-
id:
|
|
123
|
+
id: EntityIdSchema,
|
|
130
124
|
name: z.string(),
|
|
131
125
|
slug: z.string(),
|
|
132
126
|
productType: z.string(),
|
|
@@ -183,7 +177,7 @@ var ProductsParamsSchema = z.object({
|
|
|
183
177
|
search: z.string().optional(),
|
|
184
178
|
collection: z.string().optional(),
|
|
185
179
|
collections: z.array(z.string()).optional(),
|
|
186
|
-
collectionId:
|
|
180
|
+
collectionId: EntityIdSchema.optional(),
|
|
187
181
|
category: z.string().optional(),
|
|
188
182
|
categories: z.array(z.string()).optional(),
|
|
189
183
|
brand: z.string().optional(),
|
|
@@ -202,7 +196,7 @@ var ProductDetailParamsSchema = z.object({
|
|
|
202
196
|
sellerId: OptionalEntityIdSchema
|
|
203
197
|
});
|
|
204
198
|
var RelatedProductsParamsSchema = z.object({
|
|
205
|
-
productId:
|
|
199
|
+
productId: EntityIdSchema,
|
|
206
200
|
limit: z.number().int().positive().max(12).default(8),
|
|
207
201
|
sellerId: OptionalEntityIdSchema
|
|
208
202
|
});
|
|
@@ -217,7 +211,7 @@ var ProductImageSchema = z.object({
|
|
|
217
211
|
order: z.number().int().nonnegative()
|
|
218
212
|
});
|
|
219
213
|
var VariantItemSchema = z.object({
|
|
220
|
-
id:
|
|
214
|
+
id: EntityIdSchema.nullable(),
|
|
221
215
|
sku: z.string(),
|
|
222
216
|
status: z.string(),
|
|
223
217
|
price: z.number().nonnegative(),
|
|
@@ -227,14 +221,14 @@ var VariantItemSchema = z.object({
|
|
|
227
221
|
images: z.array(ProductImageSchema)
|
|
228
222
|
});
|
|
229
223
|
var ProductPriceTierSchema = z.object({
|
|
230
|
-
variantId:
|
|
224
|
+
variantId: EntityIdSchema,
|
|
231
225
|
minQuantity: z.number().int().positive(),
|
|
232
226
|
maxQuantity: z.number().int().positive().nullable(),
|
|
233
227
|
unitPrice: z.number().nonnegative()
|
|
234
228
|
});
|
|
235
229
|
var BundleItemSchema = z.object({
|
|
236
|
-
productId:
|
|
237
|
-
variantId:
|
|
230
|
+
productId: EntityIdSchema,
|
|
231
|
+
variantId: EntityIdSchema,
|
|
238
232
|
productName: z.string(),
|
|
239
233
|
variantName: z.string().nullable(),
|
|
240
234
|
sku: z.string().nullable(),
|
|
@@ -260,7 +254,7 @@ var SizeGuideRowSchema = z.object({
|
|
|
260
254
|
measurements: z.array(SizeGuideMeasurementSchema)
|
|
261
255
|
});
|
|
262
256
|
var SizeGuideSchema = z.object({
|
|
263
|
-
id:
|
|
257
|
+
id: EntityIdSchema,
|
|
264
258
|
name: z.string(),
|
|
265
259
|
slug: z.string(),
|
|
266
260
|
description: z.string().nullable(),
|
|
@@ -272,7 +266,7 @@ var SizeGuideSchema = z.object({
|
|
|
272
266
|
rows: z.array(SizeGuideRowSchema)
|
|
273
267
|
});
|
|
274
268
|
var ProductDetailSchema = z.object({
|
|
275
|
-
id:
|
|
269
|
+
id: EntityIdSchema,
|
|
276
270
|
name: z.string(),
|
|
277
271
|
slug: z.string(),
|
|
278
272
|
description: z.string(),
|
|
@@ -285,7 +279,7 @@ var ProductDetailSchema = z.object({
|
|
|
285
279
|
totalInventory: z.number().int().nonnegative(),
|
|
286
280
|
brand: z.string(),
|
|
287
281
|
category: z.string(),
|
|
288
|
-
categoryId:
|
|
282
|
+
categoryId: EntityIdSchema.nullable(),
|
|
289
283
|
tags: z.array(z.string()),
|
|
290
284
|
specifications: z.array(SpecItemSchema),
|
|
291
285
|
variants: z.array(VariantItemSchema),
|
|
@@ -578,7 +572,7 @@ var ProductAutocompleteParamsSchema = z.object({
|
|
|
578
572
|
sellerId: OptionalEntityIdSchema
|
|
579
573
|
});
|
|
580
574
|
var ProductSuggestionSchema = z.object({
|
|
581
|
-
id:
|
|
575
|
+
id: EntityIdSchema,
|
|
582
576
|
name: z.string(),
|
|
583
577
|
slug: z.string(),
|
|
584
578
|
imageUrl: z.string()
|
|
@@ -597,8 +591,8 @@ async function autocompleteProducts(api, params) {
|
|
|
597
591
|
});
|
|
598
592
|
}
|
|
599
593
|
var StorefrontReviewSchema = z.object({
|
|
600
|
-
id:
|
|
601
|
-
productId:
|
|
594
|
+
id: EntityIdSchema,
|
|
595
|
+
productId: EntityIdSchema,
|
|
602
596
|
isVerifiedPurchase: z.boolean(),
|
|
603
597
|
rating: z.number().int().min(1).max(5),
|
|
604
598
|
title: z.string().nullable(),
|
|
@@ -613,7 +607,7 @@ var StorefrontReviewsSchema = z.object({
|
|
|
613
607
|
totalCount: z.number().int().nonnegative().nullable()
|
|
614
608
|
});
|
|
615
609
|
var ListProductReviewsParamsSchema = z.object({
|
|
616
|
-
productId:
|
|
610
|
+
productId: EntityIdSchema,
|
|
617
611
|
limit: z.number().int().min(1).max(200).optional(),
|
|
618
612
|
cursor: z.string().optional(),
|
|
619
613
|
search: z.string().optional(),
|
|
@@ -622,13 +616,13 @@ var ListProductReviewsParamsSchema = z.object({
|
|
|
622
616
|
rating: z.number().int().min(1).max(5).optional()
|
|
623
617
|
});
|
|
624
618
|
var CreateProductReviewParamsSchema = z.object({
|
|
625
|
-
productId:
|
|
619
|
+
productId: EntityIdSchema,
|
|
626
620
|
rating: z.number().int().min(1).max(5),
|
|
627
621
|
content: z.string().min(1).max(4e3),
|
|
628
622
|
title: z.string().max(200).optional(),
|
|
629
623
|
reviewerName: z.string().min(1).max(200),
|
|
630
624
|
reviewerEmail: z.string().email().max(320),
|
|
631
|
-
orderId:
|
|
625
|
+
orderId: EntityIdSchema.optional()
|
|
632
626
|
});
|
|
633
627
|
|
|
634
628
|
// src/services/review.service.ts
|
|
@@ -679,8 +673,8 @@ var StorefrontAddressSchema = z.object({
|
|
|
679
673
|
longitude: z.number().nullable()
|
|
680
674
|
});
|
|
681
675
|
var StorefrontCartBundleItemSchema = z.object({
|
|
682
|
-
productId:
|
|
683
|
-
variantId:
|
|
676
|
+
productId: EntityIdSchema,
|
|
677
|
+
variantId: EntityIdSchema,
|
|
684
678
|
productName: z.string(),
|
|
685
679
|
variantName: z.string().nullable(),
|
|
686
680
|
sku: z.string().nullable(),
|
|
@@ -690,13 +684,13 @@ var StorefrontCartBundleItemSchema = z.object({
|
|
|
690
684
|
});
|
|
691
685
|
var StorefrontCartItemSchema = z.object({
|
|
692
686
|
id: EntityIdSchema,
|
|
693
|
-
productId:
|
|
687
|
+
productId: NullableEntityIdSchema,
|
|
694
688
|
title: z.string(),
|
|
695
689
|
variantLabel: z.string().nullable(),
|
|
696
690
|
productHandle: z.string().nullable(),
|
|
697
691
|
thumbnail: z.string().nullable(),
|
|
698
692
|
quantity: z.number().int().positive(),
|
|
699
|
-
variantId:
|
|
693
|
+
variantId: NullableEntityIdSchema,
|
|
700
694
|
variantSku: z.string().nullable(),
|
|
701
695
|
unitPrice: z.number(),
|
|
702
696
|
compareAtUnitPrice: z.number().nullable(),
|
|
@@ -738,6 +732,7 @@ var StorefrontCartStatusSchema = z.enum([
|
|
|
738
732
|
]);
|
|
739
733
|
var StorefrontCartSchema = z.object({
|
|
740
734
|
id: EntityIdSchema,
|
|
735
|
+
token: CartTokenSchema,
|
|
741
736
|
cartNumber: z.string(),
|
|
742
737
|
email: z.string().nullable(),
|
|
743
738
|
phone: z.string().nullable(),
|
|
@@ -759,25 +754,25 @@ var CreateCartParamsSchema = z.object({
|
|
|
759
754
|
email: z.string().email().optional()
|
|
760
755
|
});
|
|
761
756
|
var GetCartParamsSchema = z.object({
|
|
762
|
-
|
|
757
|
+
cartToken: CartTokenSchema
|
|
763
758
|
});
|
|
764
759
|
var CartItemModifierSchema = z.object({
|
|
765
|
-
modifierGroupId:
|
|
766
|
-
optionIds: z.array(
|
|
760
|
+
modifierGroupId: EntityIdSchema,
|
|
761
|
+
optionIds: z.array(EntityIdSchema).min(1)
|
|
767
762
|
});
|
|
768
763
|
var AddCartItemParamsSchema = z.object({
|
|
769
|
-
|
|
770
|
-
variantId:
|
|
764
|
+
cartToken: CartTokenSchema,
|
|
765
|
+
variantId: EntityIdSchema,
|
|
771
766
|
quantity: z.number().int().positive(),
|
|
772
767
|
modifiers: z.array(CartItemModifierSchema).optional()
|
|
773
768
|
});
|
|
774
769
|
var UpdateCartItemQuantityParamsSchema = z.object({
|
|
775
|
-
|
|
770
|
+
cartToken: CartTokenSchema,
|
|
776
771
|
cartItemId: EntityIdSchema,
|
|
777
772
|
quantity: z.number().int().nonnegative()
|
|
778
773
|
});
|
|
779
774
|
var RemoveCartItemParamsSchema = z.object({
|
|
780
|
-
|
|
775
|
+
cartToken: CartTokenSchema,
|
|
781
776
|
cartItemId: EntityIdSchema
|
|
782
777
|
});
|
|
783
778
|
|
|
@@ -797,14 +792,14 @@ async function createCart(api, params) {
|
|
|
797
792
|
async function getCart(api, params) {
|
|
798
793
|
const input = GetCartParamsSchema.parse(params);
|
|
799
794
|
return api.get(
|
|
800
|
-
`carts/${encodeURIComponent(input.
|
|
795
|
+
`carts/${encodeURIComponent(input.cartToken)}`,
|
|
801
796
|
StorefrontCartSchema
|
|
802
797
|
);
|
|
803
798
|
}
|
|
804
799
|
async function addCartItem(api, params) {
|
|
805
800
|
const input = AddCartItemParamsSchema.parse(params);
|
|
806
801
|
return api.post(
|
|
807
|
-
`carts/${encodeURIComponent(input.
|
|
802
|
+
`carts/${encodeURIComponent(input.cartToken)}/items`,
|
|
808
803
|
{
|
|
809
804
|
variantId: input.variantId,
|
|
810
805
|
quantity: input.quantity,
|
|
@@ -817,7 +812,7 @@ async function updateCartItemQuantity(api, params) {
|
|
|
817
812
|
const input = UpdateCartItemQuantityParamsSchema.parse(params);
|
|
818
813
|
return api.request(
|
|
819
814
|
"PATCH",
|
|
820
|
-
`carts/${encodeURIComponent(input.
|
|
815
|
+
`carts/${encodeURIComponent(input.cartToken)}/items/${encodeURIComponent(input.cartItemId)}`,
|
|
821
816
|
StorefrontCartSchema,
|
|
822
817
|
{ body: { quantity: input.quantity } }
|
|
823
818
|
);
|
|
@@ -826,7 +821,7 @@ async function removeCartItem(api, params) {
|
|
|
826
821
|
const input = RemoveCartItemParamsSchema.parse(params);
|
|
827
822
|
return api.request(
|
|
828
823
|
"DELETE",
|
|
829
|
-
`carts/${encodeURIComponent(input.
|
|
824
|
+
`carts/${encodeURIComponent(input.cartToken)}/items/${encodeURIComponent(input.cartItemId)}`,
|
|
830
825
|
StorefrontCartSchema
|
|
831
826
|
);
|
|
832
827
|
}
|
|
@@ -854,7 +849,7 @@ var CheckoutMetadataValueSchema = z.lazy(
|
|
|
854
849
|
])
|
|
855
850
|
);
|
|
856
851
|
var CartBuyerParamsSchema = z.object({
|
|
857
|
-
|
|
852
|
+
cartToken: CartTokenSchema,
|
|
858
853
|
email: z.string().email(),
|
|
859
854
|
firstName: z.string().min(1),
|
|
860
855
|
lastName: z.string().min(1),
|
|
@@ -880,7 +875,7 @@ var CartAddressWriteSchema = z.object({
|
|
|
880
875
|
}).nullable().optional()
|
|
881
876
|
});
|
|
882
877
|
var CartAddressesParamsSchema = z.object({
|
|
883
|
-
|
|
878
|
+
cartToken: CartTokenSchema,
|
|
884
879
|
shippingAddress: CartAddressWriteSchema,
|
|
885
880
|
billingAddress: CartAddressWriteSchema
|
|
886
881
|
});
|
|
@@ -899,9 +894,9 @@ var CartPaymentMethodSchema = z.object({
|
|
|
899
894
|
qrImageUrl: z.string().nullable().optional()
|
|
900
895
|
});
|
|
901
896
|
var StorefrontOrderBumpSchema = z.object({
|
|
902
|
-
id:
|
|
903
|
-
|
|
904
|
-
|
|
897
|
+
id: EntityIdSchema,
|
|
898
|
+
productId: EntityIdSchema,
|
|
899
|
+
variantId: EntityIdSchema,
|
|
905
900
|
productName: z.string(),
|
|
906
901
|
variantName: z.string().nullable().optional(),
|
|
907
902
|
imageUrl: z.string().nullable().optional(),
|
|
@@ -913,7 +908,7 @@ var StorefrontOrderBumpSchema = z.object({
|
|
|
913
908
|
description: z.string().nullable().optional()
|
|
914
909
|
});
|
|
915
910
|
var CartCheckoutReadParamsSchema = z.object({
|
|
916
|
-
|
|
911
|
+
cartToken: CartTokenSchema
|
|
917
912
|
});
|
|
918
913
|
var CartCheckoutReadResponseSchema = z.object({
|
|
919
914
|
cart: StorefrontCartSchema,
|
|
@@ -953,14 +948,14 @@ var CartCheckoutResponseSchema = z.object({
|
|
|
953
948
|
stripePublicKey: z.string().optional(),
|
|
954
949
|
clientSecret: z.string().optional(),
|
|
955
950
|
intentClientSecret: z.string().optional(),
|
|
956
|
-
orderId:
|
|
951
|
+
orderId: EntityIdSchema.optional(),
|
|
957
952
|
orderGroup: z.string().optional(),
|
|
958
|
-
orderIds: z.array(
|
|
953
|
+
orderIds: z.array(EntityIdSchema).optional(),
|
|
959
954
|
payment: CartCheckoutPaymentSchema.optional(),
|
|
960
955
|
cart: StorefrontCartSchema.optional()
|
|
961
956
|
}).strip();
|
|
962
957
|
var CartCheckoutParamsSchema = z.object({
|
|
963
|
-
|
|
958
|
+
cartToken: CartTokenSchema,
|
|
964
959
|
paymentMethodCode: z.string().min(1),
|
|
965
960
|
externalRef: z.string().min(1),
|
|
966
961
|
receiptUrl: z.string().min(1).optional()
|
|
@@ -993,11 +988,11 @@ var ShippingOptionsResponseSchema = z.object({
|
|
|
993
988
|
groups: z.array(ShippingOptionGroupSchema)
|
|
994
989
|
});
|
|
995
990
|
var GetShippingOptionsParamsSchema = z.object({
|
|
996
|
-
|
|
991
|
+
cartToken: CartTokenSchema,
|
|
997
992
|
postalCode: z.string().min(1)
|
|
998
993
|
});
|
|
999
994
|
var PutShippingMethodParamsSchema = z.object({
|
|
1000
|
-
|
|
995
|
+
cartToken: CartTokenSchema,
|
|
1001
996
|
rateId: z.string().min(1),
|
|
1002
997
|
shippingMethodId: z.string().min(1),
|
|
1003
998
|
serviceCode: z.string().nullable().optional(),
|
|
@@ -1013,7 +1008,7 @@ var CartPaymentReceiptResponseSchema = z.object({
|
|
|
1013
1008
|
url: z.string()
|
|
1014
1009
|
});
|
|
1015
1010
|
var CartPromotionCodeParamsSchema = z.object({
|
|
1016
|
-
|
|
1011
|
+
cartToken: CartTokenSchema,
|
|
1017
1012
|
code: z.string().min(1)
|
|
1018
1013
|
});
|
|
1019
1014
|
|
|
@@ -1021,59 +1016,59 @@ var CartPromotionCodeParamsSchema = z.object({
|
|
|
1021
1016
|
async function getCartCheckout(api, params) {
|
|
1022
1017
|
const input = CartCheckoutReadParamsSchema.parse(params);
|
|
1023
1018
|
return api.get(
|
|
1024
|
-
`carts/${encodeURIComponent(input.
|
|
1019
|
+
`carts/${encodeURIComponent(input.cartToken)}/checkout`,
|
|
1025
1020
|
CartCheckoutReadResponseSchema
|
|
1026
1021
|
);
|
|
1027
1022
|
}
|
|
1028
1023
|
async function getShippingOptions(api, params) {
|
|
1029
1024
|
const input = GetShippingOptionsParamsSchema.parse(params);
|
|
1030
1025
|
return api.get(
|
|
1031
|
-
`carts/${encodeURIComponent(input.
|
|
1026
|
+
`carts/${encodeURIComponent(input.cartToken)}/shipping-options`,
|
|
1032
1027
|
ShippingOptionsResponseSchema,
|
|
1033
1028
|
{ query: { postalCode: input.postalCode } }
|
|
1034
1029
|
);
|
|
1035
1030
|
}
|
|
1036
1031
|
async function putCartShippingMethod(api, params) {
|
|
1037
1032
|
const input = PutShippingMethodParamsSchema.parse(params);
|
|
1038
|
-
const {
|
|
1033
|
+
const { cartToken, ...body } = input;
|
|
1039
1034
|
return api.request(
|
|
1040
1035
|
"PUT",
|
|
1041
|
-
`carts/${encodeURIComponent(
|
|
1036
|
+
`carts/${encodeURIComponent(cartToken)}/shipping-method`,
|
|
1042
1037
|
StorefrontCartSchema,
|
|
1043
1038
|
{ body }
|
|
1044
1039
|
);
|
|
1045
1040
|
}
|
|
1046
1041
|
async function patchCartBuyer(api, params) {
|
|
1047
1042
|
const input = CartBuyerParamsSchema.parse(params);
|
|
1048
|
-
const {
|
|
1043
|
+
const { cartToken, ...body } = input;
|
|
1049
1044
|
return api.request(
|
|
1050
1045
|
"PATCH",
|
|
1051
|
-
`carts/${encodeURIComponent(
|
|
1046
|
+
`carts/${encodeURIComponent(cartToken)}/buyer`,
|
|
1052
1047
|
StorefrontCartSchema,
|
|
1053
1048
|
{ body }
|
|
1054
1049
|
);
|
|
1055
1050
|
}
|
|
1056
1051
|
async function patchCartAddresses(api, params) {
|
|
1057
1052
|
const input = CartAddressesParamsSchema.parse(params);
|
|
1058
|
-
const {
|
|
1053
|
+
const { cartToken, shippingAddress, billingAddress } = input;
|
|
1059
1054
|
return api.request(
|
|
1060
1055
|
"PATCH",
|
|
1061
|
-
`carts/${encodeURIComponent(
|
|
1056
|
+
`carts/${encodeURIComponent(cartToken)}/addresses`,
|
|
1062
1057
|
StorefrontCartSchema,
|
|
1063
1058
|
{ body: { shippingAddress, billingAddress } }
|
|
1064
1059
|
);
|
|
1065
1060
|
}
|
|
1066
1061
|
async function checkoutCart(api, params) {
|
|
1067
1062
|
const input = CartCheckoutParamsSchema.parse(params);
|
|
1068
|
-
const {
|
|
1063
|
+
const { cartToken, ...body } = input;
|
|
1069
1064
|
return api.post(
|
|
1070
|
-
`carts/${encodeURIComponent(
|
|
1065
|
+
`carts/${encodeURIComponent(cartToken)}/checkout`,
|
|
1071
1066
|
body,
|
|
1072
1067
|
CartCheckoutResponseSchema
|
|
1073
1068
|
);
|
|
1074
1069
|
}
|
|
1075
1070
|
async function uploadPaymentReceipt(api, params) {
|
|
1076
|
-
const
|
|
1071
|
+
const cartToken = CartCheckoutReadParamsSchema.shape.cartToken.parse(params.cartToken);
|
|
1077
1072
|
if (!(params.file instanceof Blob)) {
|
|
1078
1073
|
throw new TypeError("uploadPaymentReceipt requiere un archivo (Blob/File)");
|
|
1079
1074
|
}
|
|
@@ -1081,7 +1076,7 @@ async function uploadPaymentReceipt(api, params) {
|
|
|
1081
1076
|
const name = params.fileName ?? (params.file instanceof File ? params.file.name : "receipt");
|
|
1082
1077
|
form.append("file", params.file, name);
|
|
1083
1078
|
return api.postForm(
|
|
1084
|
-
`carts/${encodeURIComponent(
|
|
1079
|
+
`carts/${encodeURIComponent(cartToken)}/payment-receipt`,
|
|
1085
1080
|
form,
|
|
1086
1081
|
CartPaymentReceiptResponseSchema
|
|
1087
1082
|
);
|
|
@@ -1089,7 +1084,7 @@ async function uploadPaymentReceipt(api, params) {
|
|
|
1089
1084
|
async function addCartPromotionCode(api, params) {
|
|
1090
1085
|
const input = CartPromotionCodeParamsSchema.parse(params);
|
|
1091
1086
|
return api.post(
|
|
1092
|
-
`carts/${encodeURIComponent(input.
|
|
1087
|
+
`carts/${encodeURIComponent(input.cartToken)}/promotion-codes`,
|
|
1093
1088
|
{ code: input.code },
|
|
1094
1089
|
StorefrontCartSchema
|
|
1095
1090
|
);
|
|
@@ -1098,7 +1093,7 @@ async function removeCartPromotionCode(api, params) {
|
|
|
1098
1093
|
const input = CartPromotionCodeParamsSchema.parse(params);
|
|
1099
1094
|
return api.request(
|
|
1100
1095
|
"DELETE",
|
|
1101
|
-
`carts/${encodeURIComponent(input.
|
|
1096
|
+
`carts/${encodeURIComponent(input.cartToken)}/promotion-codes/${encodeURIComponent(input.code)}`,
|
|
1102
1097
|
StorefrontCartSchema
|
|
1103
1098
|
);
|
|
1104
1099
|
}
|
|
@@ -1200,7 +1195,7 @@ var CustomerAddressUpsertInputSchema = z.object({
|
|
|
1200
1195
|
isDefault: z.boolean()
|
|
1201
1196
|
});
|
|
1202
1197
|
var CustomerAddressSchema = CustomerAddressUpsertInputSchema.extend({
|
|
1203
|
-
id:
|
|
1198
|
+
id: EntityIdSchema.optional()
|
|
1204
1199
|
});
|
|
1205
1200
|
var CustomerAddressesSchema = z.array(CustomerAddressSchema);
|
|
1206
1201
|
|
|
@@ -1209,7 +1204,7 @@ var ADDRESSES_PATH = "customer/addresses";
|
|
|
1209
1204
|
var CustomerAddressMutationResponseSchema = z.union([
|
|
1210
1205
|
CustomerAddressSchema,
|
|
1211
1206
|
z.object({
|
|
1212
|
-
id:
|
|
1207
|
+
id: EntityIdSchema
|
|
1213
1208
|
}),
|
|
1214
1209
|
z.null()
|
|
1215
1210
|
]);
|
|
@@ -1296,8 +1291,8 @@ z.object({
|
|
|
1296
1291
|
});
|
|
1297
1292
|
var nullableString = z.string().nullable().optional().transform((v) => v ?? null);
|
|
1298
1293
|
var CustomerMeSchema = z.object({
|
|
1299
|
-
id:
|
|
1300
|
-
storeId:
|
|
1294
|
+
id: EntityIdSchema,
|
|
1295
|
+
storeId: EntityIdSchema.optional(),
|
|
1301
1296
|
email: z.string().email(),
|
|
1302
1297
|
firstName: z.string(),
|
|
1303
1298
|
lastName: z.string(),
|
|
@@ -1346,10 +1341,10 @@ var CustomerOrderShippingAddressSchema = z.object({
|
|
|
1346
1341
|
metadata: z.record(z.unknown()).nullable().optional()
|
|
1347
1342
|
}).passthrough();
|
|
1348
1343
|
var CustomerOrderLineItemSchema = z.object({
|
|
1349
|
-
id:
|
|
1350
|
-
orderId:
|
|
1351
|
-
productId:
|
|
1352
|
-
variantId:
|
|
1344
|
+
id: EntityIdSchema,
|
|
1345
|
+
orderId: EntityIdSchema,
|
|
1346
|
+
productId: EntityIdSchema.nullable(),
|
|
1347
|
+
variantId: EntityIdSchema.nullable(),
|
|
1353
1348
|
title: z.string(),
|
|
1354
1349
|
subtitle: z.string().nullable().optional(),
|
|
1355
1350
|
thumbnail: z.string().nullable().optional(),
|
|
@@ -1361,10 +1356,10 @@ var CustomerOrderLineItemSchema = z.object({
|
|
|
1361
1356
|
status: z.string()
|
|
1362
1357
|
});
|
|
1363
1358
|
var CustomerOrderListItemSchema = z.object({
|
|
1364
|
-
orderId:
|
|
1359
|
+
orderId: EntityIdSchema,
|
|
1365
1360
|
orderNumber: z.string(),
|
|
1366
1361
|
orderGroup: z.string(),
|
|
1367
|
-
orderIds: z.array(
|
|
1362
|
+
orderIds: z.array(EntityIdSchema),
|
|
1368
1363
|
status: z.string(),
|
|
1369
1364
|
total: z.number(),
|
|
1370
1365
|
totalPaid: z.number(),
|
|
@@ -1379,7 +1374,7 @@ var CustomerOrderListItemSchema = z.object({
|
|
|
1379
1374
|
});
|
|
1380
1375
|
var CustomerOrderListSchema = z.array(CustomerOrderListItemSchema);
|
|
1381
1376
|
var CustomerOrderPaymentSchema = z.object({
|
|
1382
|
-
id:
|
|
1377
|
+
id: EntityIdSchema,
|
|
1383
1378
|
paymentMethod: z.string(),
|
|
1384
1379
|
paymentCode: z.string(),
|
|
1385
1380
|
amount: z.number(),
|
|
@@ -1396,7 +1391,7 @@ var CustomerOrderStatusTimelineSchema = z.object({
|
|
|
1396
1391
|
source: z.string()
|
|
1397
1392
|
});
|
|
1398
1393
|
var CustomerOrderDetailSchema = z.object({
|
|
1399
|
-
id:
|
|
1394
|
+
id: EntityIdSchema,
|
|
1400
1395
|
orderNumber: z.string(),
|
|
1401
1396
|
orderGroup: z.string(),
|
|
1402
1397
|
status: z.string(),
|