@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.
Files changed (87) hide show
  1. package/dist/{client-4ZTG2RZ3.d.ts → client-Ba1r_uiO.d.ts} +4 -4
  2. package/dist/{client-BpX4yR6S.d.cts → client-Cqcnv2tC.d.cts} +4 -4
  3. package/dist/client.cjs +94 -89
  4. package/dist/client.cjs.map +1 -1
  5. package/dist/client.d.cts +2 -2
  6. package/dist/client.d.ts +2 -2
  7. package/dist/client.js +94 -89
  8. package/dist/client.js.map +1 -1
  9. package/dist/index.cjs +96 -101
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +65 -55
  12. package/dist/index.d.ts +65 -55
  13. package/dist/index.js +95 -100
  14. package/dist/index.js.map +1 -1
  15. package/dist/models/collections.cjs +7 -1
  16. package/dist/models/collections.cjs.map +1 -1
  17. package/dist/models/collections.d.cts +6 -6
  18. package/dist/models/collections.d.ts +6 -6
  19. package/dist/models/collections.js +7 -1
  20. package/dist/models/collections.js.map +1 -1
  21. package/dist/models/customer-address.cjs +7 -1
  22. package/dist/models/customer-address.cjs.map +1 -1
  23. package/dist/models/customer-address.d.cts +4 -4
  24. package/dist/models/customer-address.d.ts +4 -4
  25. package/dist/models/customer-address.js +7 -1
  26. package/dist/models/customer-address.js.map +1 -1
  27. package/dist/models/customer-order.cjs +14 -8
  28. package/dist/models/customer-order.cjs.map +1 -1
  29. package/dist/models/customer-order.d.cts +1 -5
  30. package/dist/models/customer-order.d.ts +1 -5
  31. package/dist/models/customer-order.js +14 -8
  32. package/dist/models/customer-order.js.map +1 -1
  33. package/dist/models/customer-profile.cjs +8 -2
  34. package/dist/models/customer-profile.cjs.map +1 -1
  35. package/dist/models/customer-profile.d.cts +3 -3
  36. package/dist/models/customer-profile.d.ts +3 -3
  37. package/dist/models/customer-profile.js +8 -2
  38. package/dist/models/customer-profile.js.map +1 -1
  39. package/dist/models/geo.cjs +2 -4
  40. package/dist/models/geo.cjs.map +1 -1
  41. package/dist/models/geo.d.cts +14 -14
  42. package/dist/models/geo.d.ts +14 -14
  43. package/dist/models/geo.js +2 -4
  44. package/dist/models/geo.js.map +1 -1
  45. package/dist/models/ids.cjs +3 -4
  46. package/dist/models/ids.cjs.map +1 -1
  47. package/dist/models/ids.d.cts +8 -8
  48. package/dist/models/ids.d.ts +8 -8
  49. package/dist/models/ids.js +3 -5
  50. package/dist/models/ids.js.map +1 -1
  51. package/dist/models/products.cjs +12 -19
  52. package/dist/models/products.cjs.map +1 -1
  53. package/dist/models/products.d.cts +32 -33
  54. package/dist/models/products.d.ts +32 -33
  55. package/dist/models/products.js +13 -19
  56. package/dist/models/products.js.map +1 -1
  57. package/dist/models/search.cjs +3 -180
  58. package/dist/models/search.cjs.map +1 -1
  59. package/dist/models/search.d.cts +5 -5
  60. package/dist/models/search.d.ts +5 -5
  61. package/dist/models/search.js +3 -180
  62. package/dist/models/search.js.map +1 -1
  63. package/dist/models/settings.cjs +2 -4
  64. package/dist/models/settings.cjs.map +1 -1
  65. package/dist/models/settings.d.cts +63 -63
  66. package/dist/models/settings.d.ts +63 -63
  67. package/dist/models/settings.js +2 -4
  68. package/dist/models/settings.js.map +1 -1
  69. package/dist/models/storefront-cart.cjs +14 -26
  70. package/dist/models/storefront-cart.cjs.map +1 -1
  71. package/dist/models/storefront-cart.d.cts +100 -98
  72. package/dist/models/storefront-cart.d.ts +100 -98
  73. package/dist/models/storefront-cart.js +15 -26
  74. package/dist/models/storefront-cart.js.map +1 -1
  75. package/dist/models/storefront-checkout.cjs +44 -34
  76. package/dist/models/storefront-checkout.cjs.map +1 -1
  77. package/dist/models/storefront-checkout.d.cts +660 -2278
  78. package/dist/models/storefront-checkout.d.ts +660 -2278
  79. package/dist/models/storefront-checkout.js +44 -35
  80. package/dist/models/storefront-checkout.js.map +1 -1
  81. package/dist/models/storefront-reviews.cjs +8 -187
  82. package/dist/models/storefront-reviews.cjs.map +1 -1
  83. package/dist/models/storefront-reviews.d.cts +17 -17
  84. package/dist/models/storefront-reviews.d.ts +17 -17
  85. package/dist/models/storefront-reviews.js +8 -187
  86. package/dist/models/storefront-reviews.js.map +1 -1
  87. package/package.json +1 -1
package/dist/client.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import './api.cjs';
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-BpX4yR6S.cjs';
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
- import './api.js';
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-4ZTG2RZ3.js';
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,8 +103,14 @@ function createApi(options = {}) {
103
103
  postForm: (path, body, schema, opts) => request("POST", path, schema, { ...opts, body })
104
104
  };
105
105
  }
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");
108
+ var NullableEntityIdSchema = EntityIdSchema.nullable();
109
+ var OptionalEntityIdSchema = EntityIdSchema.optional();
110
+
111
+ // src/models/collections.ts
106
112
  var CollectionSchema = z.object({
107
- id: z.number(),
113
+ id: EntityIdSchema,
108
114
  slug: z.string(),
109
115
  name: z.string(),
110
116
  description: z.string().nullable().optional(),
@@ -113,20 +119,8 @@ var CollectionSchema = z.object({
113
119
  productCount: z.number().optional()
114
120
  });
115
121
  var CollectionsSchema = z.array(CollectionSchema);
116
- var EntityIdSchema = z.union([
117
- z.string().uuid(),
118
- z.string().regex(/^\d+$/, "Expected numeric id")
119
- ]);
120
- var NullableEntityIdSchema = EntityIdSchema.nullable();
121
- var OptionalEntityIdSchema = EntityIdSchema.optional();
122
-
123
- // src/models/products.ts
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: ProductPublicIdSchema,
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: ProductPublicIdSchema.optional(),
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: ProductPublicIdSchema,
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: z.string().nullable(),
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: z.string(),
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: ProductPublicIdSchema,
237
- variantId: ProductPublicIdSchema,
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: z.string(),
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: ProductPublicIdSchema,
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: ProductPublicIdSchema.nullable(),
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: ProductPublicIdSchema,
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: ProductPublicIdSchema,
601
- productId: ProductPublicIdSchema,
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: ProductPublicIdSchema,
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: ProductPublicIdSchema,
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: z.number().int().safe().positive().optional()
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: z.number().int().safe().nonnegative(),
683
- variantId: z.number().int().safe().nonnegative(),
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: z.number().int().safe().nonnegative(),
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: z.number().int().safe().nonnegative(),
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
- cartId: EntityIdSchema
757
+ cartToken: CartTokenSchema
763
758
  });
764
759
  var CartItemModifierSchema = z.object({
765
- modifierGroupId: z.number().int().safe().positive(),
766
- optionIds: z.array(z.number().int().safe().positive()).min(1)
760
+ modifierGroupId: EntityIdSchema,
761
+ optionIds: z.array(EntityIdSchema).min(1)
767
762
  });
768
763
  var AddCartItemParamsSchema = z.object({
769
- cartId: EntityIdSchema,
770
- variantId: z.number().int().safe().positive(),
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
- cartId: EntityIdSchema,
770
+ cartToken: CartTokenSchema,
776
771
  cartItemId: EntityIdSchema,
777
772
  quantity: z.number().int().nonnegative()
778
773
  });
779
774
  var RemoveCartItemParamsSchema = z.object({
780
- cartId: EntityIdSchema,
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.cartId)}`,
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.cartId)}/items`,
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.cartId)}/items/${encodeURIComponent(input.cartItemId)}`,
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.cartId)}/items/${encodeURIComponent(input.cartItemId)}`,
824
+ `carts/${encodeURIComponent(input.cartToken)}/items/${encodeURIComponent(input.cartItemId)}`,
830
825
  StorefrontCartSchema
831
826
  );
832
827
  }
@@ -843,8 +838,18 @@ async function getCollectionBySlug(api, collectionSlug) {
843
838
  async function getPageBySlug(api, pageSlug) {
844
839
  return api.get(`pages/${encodeURIComponent(pageSlug)}`, CmsPageDetailsDtoSchema);
845
840
  }
841
+ var CheckoutMetadataValueSchema = z.lazy(
842
+ () => z.union([
843
+ z.string(),
844
+ z.number(),
845
+ z.boolean(),
846
+ z.null(),
847
+ z.array(CheckoutMetadataValueSchema),
848
+ z.record(z.string(), CheckoutMetadataValueSchema)
849
+ ])
850
+ );
846
851
  var CartBuyerParamsSchema = z.object({
847
- cartId: EntityIdSchema,
852
+ cartToken: CartTokenSchema,
848
853
  email: z.string().email(),
849
854
  firstName: z.string().min(1),
850
855
  lastName: z.string().min(1),
@@ -870,7 +875,7 @@ var CartAddressWriteSchema = z.object({
870
875
  }).nullable().optional()
871
876
  });
872
877
  var CartAddressesParamsSchema = z.object({
873
- cartId: EntityIdSchema,
878
+ cartToken: CartTokenSchema,
874
879
  shippingAddress: CartAddressWriteSchema,
875
880
  billingAddress: CartAddressWriteSchema
876
881
  });
@@ -889,9 +894,9 @@ var CartPaymentMethodSchema = z.object({
889
894
  qrImageUrl: z.string().nullable().optional()
890
895
  });
891
896
  var StorefrontOrderBumpSchema = z.object({
892
- id: z.string(),
893
- productPublicId: z.coerce.string(),
894
- variantPublicId: z.coerce.string(),
897
+ id: EntityIdSchema,
898
+ productId: EntityIdSchema,
899
+ variantId: EntityIdSchema,
895
900
  productName: z.string(),
896
901
  variantName: z.string().nullable().optional(),
897
902
  imageUrl: z.string().nullable().optional(),
@@ -903,7 +908,7 @@ var StorefrontOrderBumpSchema = z.object({
903
908
  description: z.string().nullable().optional()
904
909
  });
905
910
  var CartCheckoutReadParamsSchema = z.object({
906
- cartId: EntityIdSchema
911
+ cartToken: CartTokenSchema
907
912
  });
908
913
  var CartCheckoutReadResponseSchema = z.object({
909
914
  cart: StorefrontCartSchema,
@@ -919,13 +924,13 @@ var CartCheckoutPaymentActionSchema = z.object({
919
924
  phoneNumber: z.string().nullable().optional(),
920
925
  accountHolder: z.string().nullable().optional(),
921
926
  qrImageUrl: z.string().nullable().optional()
922
- }).passthrough().nullable().optional(),
927
+ }).strip().nullable().optional(),
923
928
  url: z.string().nullable().optional(),
924
929
  html: z.string().nullable().optional(),
925
930
  clientSecret: z.string().nullable().optional(),
926
931
  qrCode: z.string().nullable().optional(),
927
932
  expiresAt: z.string().nullable().optional()
928
- }).passthrough();
933
+ }).strip();
929
934
  var CartCheckoutPaymentSchema = z.object({
930
935
  transactionId: z.string(),
931
936
  paymentMethodCode: z.string(),
@@ -936,21 +941,21 @@ var CartCheckoutPaymentSchema = z.object({
936
941
  actionType: z.string(),
937
942
  receiptUrl: z.string().nullable().optional(),
938
943
  action: CartCheckoutPaymentActionSchema.nullable().optional()
939
- }).passthrough();
944
+ }).strip();
940
945
  var CartCheckoutResponseSchema = z.object({
941
946
  publicKey: z.string().optional(),
942
947
  publishableKey: z.string().optional(),
943
948
  stripePublicKey: z.string().optional(),
944
949
  clientSecret: z.string().optional(),
945
950
  intentClientSecret: z.string().optional(),
946
- orderId: z.coerce.string().optional(),
951
+ orderId: EntityIdSchema.optional(),
947
952
  orderGroup: z.string().optional(),
948
- orderIds: z.array(z.coerce.string()).optional(),
953
+ orderIds: z.array(EntityIdSchema).optional(),
949
954
  payment: CartCheckoutPaymentSchema.optional(),
950
955
  cart: StorefrontCartSchema.optional()
951
- }).passthrough();
956
+ }).strip();
952
957
  var CartCheckoutParamsSchema = z.object({
953
- cartId: EntityIdSchema,
958
+ cartToken: CartTokenSchema,
954
959
  paymentMethodCode: z.string().min(1),
955
960
  externalRef: z.string().min(1),
956
961
  receiptUrl: z.string().min(1).optional()
@@ -969,8 +974,8 @@ var ShippingRateSchema = z.object({
969
974
  deliveryLocationName: z.string().nullable().optional(),
970
975
  estimatedDeliveryDays: z.number().nullable().optional(),
971
976
  serviceCode: z.string().nullable().optional(),
972
- metadata: z.record(z.string(), z.unknown()).optional()
973
- }).passthrough();
977
+ metadata: z.record(z.string(), CheckoutMetadataValueSchema).optional()
978
+ }).strip();
974
979
  var ShippingOptionGroupSchema = z.object({
975
980
  sellerId: z.string(),
976
981
  shippingProfileId: z.string().nullable().optional(),
@@ -978,16 +983,16 @@ var ShippingOptionGroupSchema = z.object({
978
983
  totalWeight: z.number().optional(),
979
984
  itemIds: z.array(z.string()).optional(),
980
985
  rates: z.array(ShippingRateSchema)
981
- }).passthrough();
986
+ }).strip();
982
987
  var ShippingOptionsResponseSchema = z.object({
983
988
  groups: z.array(ShippingOptionGroupSchema)
984
989
  });
985
990
  var GetShippingOptionsParamsSchema = z.object({
986
- cartId: EntityIdSchema,
991
+ cartToken: CartTokenSchema,
987
992
  postalCode: z.string().min(1)
988
993
  });
989
994
  var PutShippingMethodParamsSchema = z.object({
990
- cartId: EntityIdSchema,
995
+ cartToken: CartTokenSchema,
991
996
  rateId: z.string().min(1),
992
997
  shippingMethodId: z.string().min(1),
993
998
  serviceCode: z.string().nullable().optional(),
@@ -1003,7 +1008,7 @@ var CartPaymentReceiptResponseSchema = z.object({
1003
1008
  url: z.string()
1004
1009
  });
1005
1010
  var CartPromotionCodeParamsSchema = z.object({
1006
- cartId: EntityIdSchema,
1011
+ cartToken: CartTokenSchema,
1007
1012
  code: z.string().min(1)
1008
1013
  });
1009
1014
 
@@ -1011,59 +1016,59 @@ var CartPromotionCodeParamsSchema = z.object({
1011
1016
  async function getCartCheckout(api, params) {
1012
1017
  const input = CartCheckoutReadParamsSchema.parse(params);
1013
1018
  return api.get(
1014
- `carts/${encodeURIComponent(input.cartId)}/checkout`,
1019
+ `carts/${encodeURIComponent(input.cartToken)}/checkout`,
1015
1020
  CartCheckoutReadResponseSchema
1016
1021
  );
1017
1022
  }
1018
1023
  async function getShippingOptions(api, params) {
1019
1024
  const input = GetShippingOptionsParamsSchema.parse(params);
1020
1025
  return api.get(
1021
- `carts/${encodeURIComponent(input.cartId)}/shipping-options`,
1026
+ `carts/${encodeURIComponent(input.cartToken)}/shipping-options`,
1022
1027
  ShippingOptionsResponseSchema,
1023
1028
  { query: { postalCode: input.postalCode } }
1024
1029
  );
1025
1030
  }
1026
1031
  async function putCartShippingMethod(api, params) {
1027
1032
  const input = PutShippingMethodParamsSchema.parse(params);
1028
- const { cartId, ...body } = input;
1033
+ const { cartToken, ...body } = input;
1029
1034
  return api.request(
1030
1035
  "PUT",
1031
- `carts/${encodeURIComponent(cartId)}/shipping-method`,
1036
+ `carts/${encodeURIComponent(cartToken)}/shipping-method`,
1032
1037
  StorefrontCartSchema,
1033
1038
  { body }
1034
1039
  );
1035
1040
  }
1036
1041
  async function patchCartBuyer(api, params) {
1037
1042
  const input = CartBuyerParamsSchema.parse(params);
1038
- const { cartId, ...body } = input;
1043
+ const { cartToken, ...body } = input;
1039
1044
  return api.request(
1040
1045
  "PATCH",
1041
- `carts/${encodeURIComponent(cartId)}/buyer`,
1046
+ `carts/${encodeURIComponent(cartToken)}/buyer`,
1042
1047
  StorefrontCartSchema,
1043
1048
  { body }
1044
1049
  );
1045
1050
  }
1046
1051
  async function patchCartAddresses(api, params) {
1047
1052
  const input = CartAddressesParamsSchema.parse(params);
1048
- const { cartId, shippingAddress, billingAddress } = input;
1053
+ const { cartToken, shippingAddress, billingAddress } = input;
1049
1054
  return api.request(
1050
1055
  "PATCH",
1051
- `carts/${encodeURIComponent(cartId)}/addresses`,
1056
+ `carts/${encodeURIComponent(cartToken)}/addresses`,
1052
1057
  StorefrontCartSchema,
1053
1058
  { body: { shippingAddress, billingAddress } }
1054
1059
  );
1055
1060
  }
1056
1061
  async function checkoutCart(api, params) {
1057
1062
  const input = CartCheckoutParamsSchema.parse(params);
1058
- const { cartId, ...body } = input;
1063
+ const { cartToken, ...body } = input;
1059
1064
  return api.post(
1060
- `carts/${encodeURIComponent(cartId)}/checkout`,
1065
+ `carts/${encodeURIComponent(cartToken)}/checkout`,
1061
1066
  body,
1062
1067
  CartCheckoutResponseSchema
1063
1068
  );
1064
1069
  }
1065
1070
  async function uploadPaymentReceipt(api, params) {
1066
- const cartId = CartCheckoutReadParamsSchema.shape.cartId.parse(params.cartId);
1071
+ const cartToken = CartCheckoutReadParamsSchema.shape.cartToken.parse(params.cartToken);
1067
1072
  if (!(params.file instanceof Blob)) {
1068
1073
  throw new TypeError("uploadPaymentReceipt requiere un archivo (Blob/File)");
1069
1074
  }
@@ -1071,7 +1076,7 @@ async function uploadPaymentReceipt(api, params) {
1071
1076
  const name = params.fileName ?? (params.file instanceof File ? params.file.name : "receipt");
1072
1077
  form.append("file", params.file, name);
1073
1078
  return api.postForm(
1074
- `carts/${encodeURIComponent(cartId)}/payment-receipt`,
1079
+ `carts/${encodeURIComponent(cartToken)}/payment-receipt`,
1075
1080
  form,
1076
1081
  CartPaymentReceiptResponseSchema
1077
1082
  );
@@ -1079,7 +1084,7 @@ async function uploadPaymentReceipt(api, params) {
1079
1084
  async function addCartPromotionCode(api, params) {
1080
1085
  const input = CartPromotionCodeParamsSchema.parse(params);
1081
1086
  return api.post(
1082
- `carts/${encodeURIComponent(input.cartId)}/promotion-codes`,
1087
+ `carts/${encodeURIComponent(input.cartToken)}/promotion-codes`,
1083
1088
  { code: input.code },
1084
1089
  StorefrontCartSchema
1085
1090
  );
@@ -1088,7 +1093,7 @@ async function removeCartPromotionCode(api, params) {
1088
1093
  const input = CartPromotionCodeParamsSchema.parse(params);
1089
1094
  return api.request(
1090
1095
  "DELETE",
1091
- `carts/${encodeURIComponent(input.cartId)}/promotion-codes/${encodeURIComponent(input.code)}`,
1096
+ `carts/${encodeURIComponent(input.cartToken)}/promotion-codes/${encodeURIComponent(input.code)}`,
1092
1097
  StorefrontCartSchema
1093
1098
  );
1094
1099
  }
@@ -1190,7 +1195,7 @@ var CustomerAddressUpsertInputSchema = z.object({
1190
1195
  isDefault: z.boolean()
1191
1196
  });
1192
1197
  var CustomerAddressSchema = CustomerAddressUpsertInputSchema.extend({
1193
- id: z.union([z.string(), z.number()]).transform(String).optional()
1198
+ id: EntityIdSchema.optional()
1194
1199
  });
1195
1200
  var CustomerAddressesSchema = z.array(CustomerAddressSchema);
1196
1201
 
@@ -1199,7 +1204,7 @@ var ADDRESSES_PATH = "customer/addresses";
1199
1204
  var CustomerAddressMutationResponseSchema = z.union([
1200
1205
  CustomerAddressSchema,
1201
1206
  z.object({
1202
- id: z.union([z.string(), z.number()]).transform(String)
1207
+ id: EntityIdSchema
1203
1208
  }),
1204
1209
  z.null()
1205
1210
  ]);
@@ -1286,8 +1291,8 @@ z.object({
1286
1291
  });
1287
1292
  var nullableString = z.string().nullable().optional().transform((v) => v ?? null);
1288
1293
  var CustomerMeSchema = z.object({
1289
- id: z.union([z.string(), z.number()]),
1290
- storeId: z.string().optional(),
1294
+ id: EntityIdSchema,
1295
+ storeId: EntityIdSchema.optional(),
1291
1296
  email: z.string().email(),
1292
1297
  firstName: z.string(),
1293
1298
  lastName: z.string(),
@@ -1336,10 +1341,10 @@ var CustomerOrderShippingAddressSchema = z.object({
1336
1341
  metadata: z.record(z.unknown()).nullable().optional()
1337
1342
  }).passthrough();
1338
1343
  var CustomerOrderLineItemSchema = z.object({
1339
- id: z.string(),
1340
- orderId: z.coerce.string(),
1341
- productId: z.coerce.string().nullable(),
1342
- variantId: z.coerce.string().nullable(),
1344
+ id: EntityIdSchema,
1345
+ orderId: EntityIdSchema,
1346
+ productId: EntityIdSchema.nullable(),
1347
+ variantId: EntityIdSchema.nullable(),
1343
1348
  title: z.string(),
1344
1349
  subtitle: z.string().nullable().optional(),
1345
1350
  thumbnail: z.string().nullable().optional(),
@@ -1351,10 +1356,10 @@ var CustomerOrderLineItemSchema = z.object({
1351
1356
  status: z.string()
1352
1357
  });
1353
1358
  var CustomerOrderListItemSchema = z.object({
1354
- orderId: z.coerce.string(),
1359
+ orderId: EntityIdSchema,
1355
1360
  orderNumber: z.string(),
1356
1361
  orderGroup: z.string(),
1357
- orderIds: z.array(z.coerce.string()),
1362
+ orderIds: z.array(EntityIdSchema),
1358
1363
  status: z.string(),
1359
1364
  total: z.number(),
1360
1365
  totalPaid: z.number(),
@@ -1369,7 +1374,7 @@ var CustomerOrderListItemSchema = z.object({
1369
1374
  });
1370
1375
  var CustomerOrderListSchema = z.array(CustomerOrderListItemSchema);
1371
1376
  var CustomerOrderPaymentSchema = z.object({
1372
- id: z.string(),
1377
+ id: EntityIdSchema,
1373
1378
  paymentMethod: z.string(),
1374
1379
  paymentCode: z.string(),
1375
1380
  amount: z.number(),
@@ -1386,7 +1391,7 @@ var CustomerOrderStatusTimelineSchema = z.object({
1386
1391
  source: z.string()
1387
1392
  });
1388
1393
  var CustomerOrderDetailSchema = z.object({
1389
- id: z.coerce.string(),
1394
+ id: EntityIdSchema,
1390
1395
  orderNumber: z.string(),
1391
1396
  orderGroup: z.string(),
1392
1397
  status: z.string(),