@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.
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 +72 -77
  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 +72 -77
  8. package/dist/client.js.map +1 -1
  9. package/dist/index.cjs +73 -89
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +64 -54
  12. package/dist/index.d.ts +64 -54
  13. package/dist/index.js +73 -88
  14. package/dist/index.js.map +1 -1
  15. package/dist/models/collections.cjs +2 -4
  16. package/dist/models/collections.cjs.map +1 -1
  17. package/dist/models/collections.d.cts +2 -2
  18. package/dist/models/collections.d.ts +2 -2
  19. package/dist/models/collections.js +2 -4
  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 +26 -27
  76. package/dist/models/storefront-checkout.cjs.map +1 -1
  77. package/dist/models/storefront-checkout.d.cts +130 -120
  78. package/dist/models/storefront-checkout.d.ts +130 -120
  79. package/dist/models/storefront-checkout.js +26 -27
  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/index.js CHANGED
@@ -104,10 +104,8 @@ function createApi(options = {}) {
104
104
  postForm: (path, body, schema, opts) => request("POST", path, schema, { ...opts, body })
105
105
  };
106
106
  }
107
- var EntityIdSchema = z.union([
108
- z.string().uuid(),
109
- z.string().regex(/^\d+$/, "Expected numeric id")
110
- ]);
107
+ var EntityIdSchema = z.string().min(1, "Expected resource id");
108
+ var CartTokenSchema = z.string().min(1).max(32).regex(/^[A-Za-z0-9_-]+$/, "Expected cart token");
111
109
  var NullableEntityIdSchema = EntityIdSchema.nullable();
112
110
  var OptionalEntityIdSchema = EntityIdSchema.optional();
113
111
 
@@ -122,12 +120,8 @@ var CollectionSchema = z.object({
122
120
  productCount: z.number().optional()
123
121
  });
124
122
  var CollectionsSchema = z.array(CollectionSchema);
125
- var ProductPublicIdSchema = z.union([
126
- z.string().regex(/^[1-9]\d*$/),
127
- z.number().int().safe().positive()
128
- ]).transform(String);
129
123
  var ProductSummarySchema = z.object({
130
- id: ProductPublicIdSchema,
124
+ id: EntityIdSchema,
131
125
  name: z.string(),
132
126
  slug: z.string(),
133
127
  productType: z.string(),
@@ -186,7 +180,7 @@ var ProductsParamsSchema = z.object({
186
180
  search: z.string().optional(),
187
181
  collection: z.string().optional(),
188
182
  collections: z.array(z.string()).optional(),
189
- collectionId: ProductPublicIdSchema.optional(),
183
+ collectionId: EntityIdSchema.optional(),
190
184
  category: z.string().optional(),
191
185
  categories: z.array(z.string()).optional(),
192
186
  brand: z.string().optional(),
@@ -205,7 +199,7 @@ var ProductDetailParamsSchema = z.object({
205
199
  sellerId: OptionalEntityIdSchema
206
200
  });
207
201
  var RelatedProductsParamsSchema = z.object({
208
- productId: ProductPublicIdSchema,
202
+ productId: EntityIdSchema,
209
203
  limit: z.number().int().positive().max(12).default(8),
210
204
  sellerId: OptionalEntityIdSchema
211
205
  });
@@ -221,7 +215,7 @@ var ProductImageSchema = z.object({
221
215
  order: z.number().int().nonnegative()
222
216
  });
223
217
  var VariantItemSchema = z.object({
224
- id: z.string().nullable(),
218
+ id: EntityIdSchema.nullable(),
225
219
  sku: z.string(),
226
220
  status: z.string(),
227
221
  price: z.number().nonnegative(),
@@ -232,15 +226,15 @@ var VariantItemSchema = z.object({
232
226
  });
233
227
  var VariantSchema = VariantItemSchema;
234
228
  var ProductPriceTierSchema = z.object({
235
- variantId: z.string(),
229
+ variantId: EntityIdSchema,
236
230
  minQuantity: z.number().int().positive(),
237
231
  maxQuantity: z.number().int().positive().nullable(),
238
232
  unitPrice: z.number().nonnegative()
239
233
  });
240
234
  var PriceTierSchema = ProductPriceTierSchema;
241
235
  var BundleItemSchema = z.object({
242
- productId: ProductPublicIdSchema,
243
- variantId: ProductPublicIdSchema,
236
+ productId: EntityIdSchema,
237
+ variantId: EntityIdSchema,
244
238
  productName: z.string(),
245
239
  variantName: z.string().nullable(),
246
240
  sku: z.string().nullable(),
@@ -266,7 +260,7 @@ var SizeGuideRowSchema = z.object({
266
260
  measurements: z.array(SizeGuideMeasurementSchema)
267
261
  });
268
262
  var SizeGuideSchema = z.object({
269
- id: z.string(),
263
+ id: EntityIdSchema,
270
264
  name: z.string(),
271
265
  slug: z.string(),
272
266
  description: z.string().nullable(),
@@ -278,7 +272,7 @@ var SizeGuideSchema = z.object({
278
272
  rows: z.array(SizeGuideRowSchema)
279
273
  });
280
274
  var ProductDetailSchema = z.object({
281
- id: ProductPublicIdSchema,
275
+ id: EntityIdSchema,
282
276
  name: z.string(),
283
277
  slug: z.string(),
284
278
  description: z.string(),
@@ -291,7 +285,7 @@ var ProductDetailSchema = z.object({
291
285
  totalInventory: z.number().int().nonnegative(),
292
286
  brand: z.string(),
293
287
  category: z.string(),
294
- categoryId: ProductPublicIdSchema.nullable(),
288
+ categoryId: EntityIdSchema.nullable(),
295
289
  tags: z.array(z.string()),
296
290
  specifications: z.array(SpecItemSchema),
297
291
  variants: z.array(VariantItemSchema),
@@ -603,7 +597,7 @@ var ProductAutocompleteParamsSchema = z.object({
603
597
  sellerId: OptionalEntityIdSchema
604
598
  });
605
599
  var ProductSuggestionSchema = z.object({
606
- id: ProductPublicIdSchema,
600
+ id: EntityIdSchema,
607
601
  name: z.string(),
608
602
  slug: z.string(),
609
603
  imageUrl: z.string()
@@ -622,8 +616,8 @@ async function autocompleteProducts(api, params) {
622
616
  });
623
617
  }
624
618
  var StorefrontReviewSchema = z.object({
625
- id: ProductPublicIdSchema,
626
- productId: ProductPublicIdSchema,
619
+ id: EntityIdSchema,
620
+ productId: EntityIdSchema,
627
621
  isVerifiedPurchase: z.boolean(),
628
622
  rating: z.number().int().min(1).max(5),
629
623
  title: z.string().nullable(),
@@ -638,7 +632,7 @@ var StorefrontReviewsSchema = z.object({
638
632
  totalCount: z.number().int().nonnegative().nullable()
639
633
  });
640
634
  var ListProductReviewsParamsSchema = z.object({
641
- productId: ProductPublicIdSchema,
635
+ productId: EntityIdSchema,
642
636
  limit: z.number().int().min(1).max(200).optional(),
643
637
  cursor: z.string().optional(),
644
638
  search: z.string().optional(),
@@ -647,13 +641,13 @@ var ListProductReviewsParamsSchema = z.object({
647
641
  rating: z.number().int().min(1).max(5).optional()
648
642
  });
649
643
  var CreateProductReviewParamsSchema = z.object({
650
- productId: ProductPublicIdSchema,
644
+ productId: EntityIdSchema,
651
645
  rating: z.number().int().min(1).max(5),
652
646
  content: z.string().min(1).max(4e3),
653
647
  title: z.string().max(200).optional(),
654
648
  reviewerName: z.string().min(1).max(200),
655
649
  reviewerEmail: z.string().email().max(320),
656
- orderId: z.number().int().safe().positive().optional()
650
+ orderId: EntityIdSchema.optional()
657
651
  });
658
652
 
659
653
  // src/services/review.service.ts
@@ -689,16 +683,6 @@ async function createProductReview(api, params) {
689
683
  StorefrontReviewSchema
690
684
  );
691
685
  }
692
- function cartVariantIdFromProduct(variantId) {
693
- if (!/^\d+$/.test(variantId)) {
694
- throw new RangeError("El variant ID debe ser un integer decimal positivo.");
695
- }
696
- const value = BigInt(variantId);
697
- if (value <= 0n || value > BigInt(Number.MAX_SAFE_INTEGER)) {
698
- throw new RangeError("El variant ID no cabe en un integer seguro de JavaScript.");
699
- }
700
- return Number(value);
701
- }
702
686
  var StorefrontAddressSchema = z.object({
703
687
  name: z.string().nullable(),
704
688
  address1: z.string(),
@@ -714,8 +698,8 @@ var StorefrontAddressSchema = z.object({
714
698
  longitude: z.number().nullable()
715
699
  });
716
700
  var StorefrontCartBundleItemSchema = z.object({
717
- productId: z.number().int().safe().nonnegative(),
718
- variantId: z.number().int().safe().nonnegative(),
701
+ productId: EntityIdSchema,
702
+ variantId: EntityIdSchema,
719
703
  productName: z.string(),
720
704
  variantName: z.string().nullable(),
721
705
  sku: z.string().nullable(),
@@ -725,13 +709,13 @@ var StorefrontCartBundleItemSchema = z.object({
725
709
  });
726
710
  var StorefrontCartItemSchema = z.object({
727
711
  id: EntityIdSchema,
728
- productId: z.number().int().safe().nonnegative(),
712
+ productId: NullableEntityIdSchema,
729
713
  title: z.string(),
730
714
  variantLabel: z.string().nullable(),
731
715
  productHandle: z.string().nullable(),
732
716
  thumbnail: z.string().nullable(),
733
717
  quantity: z.number().int().positive(),
734
- variantId: z.number().int().safe().nonnegative(),
718
+ variantId: NullableEntityIdSchema,
735
719
  variantSku: z.string().nullable(),
736
720
  unitPrice: z.number(),
737
721
  compareAtUnitPrice: z.number().nullable(),
@@ -773,6 +757,7 @@ var StorefrontCartStatusSchema = z.enum([
773
757
  ]);
774
758
  var StorefrontCartSchema = z.object({
775
759
  id: EntityIdSchema,
760
+ token: CartTokenSchema,
776
761
  cartNumber: z.string(),
777
762
  email: z.string().nullable(),
778
763
  phone: z.string().nullable(),
@@ -794,25 +779,25 @@ var CreateCartParamsSchema = z.object({
794
779
  email: z.string().email().optional()
795
780
  });
796
781
  var GetCartParamsSchema = z.object({
797
- cartId: EntityIdSchema
782
+ cartToken: CartTokenSchema
798
783
  });
799
784
  var CartItemModifierSchema = z.object({
800
- modifierGroupId: z.number().int().safe().positive(),
801
- optionIds: z.array(z.number().int().safe().positive()).min(1)
785
+ modifierGroupId: EntityIdSchema,
786
+ optionIds: z.array(EntityIdSchema).min(1)
802
787
  });
803
788
  var AddCartItemParamsSchema = z.object({
804
- cartId: EntityIdSchema,
805
- variantId: z.number().int().safe().positive(),
789
+ cartToken: CartTokenSchema,
790
+ variantId: EntityIdSchema,
806
791
  quantity: z.number().int().positive(),
807
792
  modifiers: z.array(CartItemModifierSchema).optional()
808
793
  });
809
794
  var UpdateCartItemQuantityParamsSchema = z.object({
810
- cartId: EntityIdSchema,
795
+ cartToken: CartTokenSchema,
811
796
  cartItemId: EntityIdSchema,
812
797
  quantity: z.number().int().nonnegative()
813
798
  });
814
799
  var RemoveCartItemParamsSchema = z.object({
815
- cartId: EntityIdSchema,
800
+ cartToken: CartTokenSchema,
816
801
  cartItemId: EntityIdSchema
817
802
  });
818
803
 
@@ -832,14 +817,14 @@ async function createCart(api, params) {
832
817
  async function getCart(api, params) {
833
818
  const input = GetCartParamsSchema.parse(params);
834
819
  return api.get(
835
- `carts/${encodeURIComponent(input.cartId)}`,
820
+ `carts/${encodeURIComponent(input.cartToken)}`,
836
821
  StorefrontCartSchema
837
822
  );
838
823
  }
839
824
  async function addCartItem(api, params) {
840
825
  const input = AddCartItemParamsSchema.parse(params);
841
826
  return api.post(
842
- `carts/${encodeURIComponent(input.cartId)}/items`,
827
+ `carts/${encodeURIComponent(input.cartToken)}/items`,
843
828
  {
844
829
  variantId: input.variantId,
845
830
  quantity: input.quantity,
@@ -852,7 +837,7 @@ async function updateCartItemQuantity(api, params) {
852
837
  const input = UpdateCartItemQuantityParamsSchema.parse(params);
853
838
  return api.request(
854
839
  "PATCH",
855
- `carts/${encodeURIComponent(input.cartId)}/items/${encodeURIComponent(input.cartItemId)}`,
840
+ `carts/${encodeURIComponent(input.cartToken)}/items/${encodeURIComponent(input.cartItemId)}`,
856
841
  StorefrontCartSchema,
857
842
  { body: { quantity: input.quantity } }
858
843
  );
@@ -861,7 +846,7 @@ async function removeCartItem(api, params) {
861
846
  const input = RemoveCartItemParamsSchema.parse(params);
862
847
  return api.request(
863
848
  "DELETE",
864
- `carts/${encodeURIComponent(input.cartId)}/items/${encodeURIComponent(input.cartItemId)}`,
849
+ `carts/${encodeURIComponent(input.cartToken)}/items/${encodeURIComponent(input.cartItemId)}`,
865
850
  StorefrontCartSchema
866
851
  );
867
852
  }
@@ -889,7 +874,7 @@ var CheckoutMetadataValueSchema = z.lazy(
889
874
  ])
890
875
  );
891
876
  var CartBuyerParamsSchema = z.object({
892
- cartId: EntityIdSchema,
877
+ cartToken: CartTokenSchema,
893
878
  email: z.string().email(),
894
879
  firstName: z.string().min(1),
895
880
  lastName: z.string().min(1),
@@ -915,7 +900,7 @@ var CartAddressWriteSchema = z.object({
915
900
  }).nullable().optional()
916
901
  });
917
902
  var CartAddressesParamsSchema = z.object({
918
- cartId: EntityIdSchema,
903
+ cartToken: CartTokenSchema,
919
904
  shippingAddress: CartAddressWriteSchema,
920
905
  billingAddress: CartAddressWriteSchema
921
906
  });
@@ -934,9 +919,9 @@ var CartPaymentMethodSchema = z.object({
934
919
  qrImageUrl: z.string().nullable().optional()
935
920
  });
936
921
  var StorefrontOrderBumpSchema = z.object({
937
- id: z.string(),
938
- productPublicId: z.coerce.string(),
939
- variantPublicId: z.coerce.string(),
922
+ id: EntityIdSchema,
923
+ productId: EntityIdSchema,
924
+ variantId: EntityIdSchema,
940
925
  productName: z.string(),
941
926
  variantName: z.string().nullable().optional(),
942
927
  imageUrl: z.string().nullable().optional(),
@@ -948,7 +933,7 @@ var StorefrontOrderBumpSchema = z.object({
948
933
  description: z.string().nullable().optional()
949
934
  });
950
935
  var CartCheckoutReadParamsSchema = z.object({
951
- cartId: EntityIdSchema
936
+ cartToken: CartTokenSchema
952
937
  });
953
938
  var CartCheckoutReadResponseSchema = z.object({
954
939
  cart: StorefrontCartSchema,
@@ -988,14 +973,14 @@ var CartCheckoutResponseSchema = z.object({
988
973
  stripePublicKey: z.string().optional(),
989
974
  clientSecret: z.string().optional(),
990
975
  intentClientSecret: z.string().optional(),
991
- orderId: z.coerce.string().optional(),
976
+ orderId: EntityIdSchema.optional(),
992
977
  orderGroup: z.string().optional(),
993
- orderIds: z.array(z.coerce.string()).optional(),
978
+ orderIds: z.array(EntityIdSchema).optional(),
994
979
  payment: CartCheckoutPaymentSchema.optional(),
995
980
  cart: StorefrontCartSchema.optional()
996
981
  }).strip();
997
982
  var CartCheckoutParamsSchema = z.object({
998
- cartId: EntityIdSchema,
983
+ cartToken: CartTokenSchema,
999
984
  paymentMethodCode: z.string().min(1),
1000
985
  externalRef: z.string().min(1),
1001
986
  receiptUrl: z.string().min(1).optional()
@@ -1028,11 +1013,11 @@ var ShippingOptionsResponseSchema = z.object({
1028
1013
  groups: z.array(ShippingOptionGroupSchema)
1029
1014
  });
1030
1015
  var GetShippingOptionsParamsSchema = z.object({
1031
- cartId: EntityIdSchema,
1016
+ cartToken: CartTokenSchema,
1032
1017
  postalCode: z.string().min(1)
1033
1018
  });
1034
1019
  var PutShippingMethodParamsSchema = z.object({
1035
- cartId: EntityIdSchema,
1020
+ cartToken: CartTokenSchema,
1036
1021
  rateId: z.string().min(1),
1037
1022
  shippingMethodId: z.string().min(1),
1038
1023
  serviceCode: z.string().nullable().optional(),
@@ -1048,7 +1033,7 @@ var CartPaymentReceiptResponseSchema = z.object({
1048
1033
  url: z.string()
1049
1034
  });
1050
1035
  var CartPromotionCodeParamsSchema = z.object({
1051
- cartId: EntityIdSchema,
1036
+ cartToken: CartTokenSchema,
1052
1037
  code: z.string().min(1)
1053
1038
  });
1054
1039
 
@@ -1056,59 +1041,59 @@ var CartPromotionCodeParamsSchema = z.object({
1056
1041
  async function getCartCheckout(api, params) {
1057
1042
  const input = CartCheckoutReadParamsSchema.parse(params);
1058
1043
  return api.get(
1059
- `carts/${encodeURIComponent(input.cartId)}/checkout`,
1044
+ `carts/${encodeURIComponent(input.cartToken)}/checkout`,
1060
1045
  CartCheckoutReadResponseSchema
1061
1046
  );
1062
1047
  }
1063
1048
  async function getShippingOptions(api, params) {
1064
1049
  const input = GetShippingOptionsParamsSchema.parse(params);
1065
1050
  return api.get(
1066
- `carts/${encodeURIComponent(input.cartId)}/shipping-options`,
1051
+ `carts/${encodeURIComponent(input.cartToken)}/shipping-options`,
1067
1052
  ShippingOptionsResponseSchema,
1068
1053
  { query: { postalCode: input.postalCode } }
1069
1054
  );
1070
1055
  }
1071
1056
  async function putCartShippingMethod(api, params) {
1072
1057
  const input = PutShippingMethodParamsSchema.parse(params);
1073
- const { cartId, ...body } = input;
1058
+ const { cartToken, ...body } = input;
1074
1059
  return api.request(
1075
1060
  "PUT",
1076
- `carts/${encodeURIComponent(cartId)}/shipping-method`,
1061
+ `carts/${encodeURIComponent(cartToken)}/shipping-method`,
1077
1062
  StorefrontCartSchema,
1078
1063
  { body }
1079
1064
  );
1080
1065
  }
1081
1066
  async function patchCartBuyer(api, params) {
1082
1067
  const input = CartBuyerParamsSchema.parse(params);
1083
- const { cartId, ...body } = input;
1068
+ const { cartToken, ...body } = input;
1084
1069
  return api.request(
1085
1070
  "PATCH",
1086
- `carts/${encodeURIComponent(cartId)}/buyer`,
1071
+ `carts/${encodeURIComponent(cartToken)}/buyer`,
1087
1072
  StorefrontCartSchema,
1088
1073
  { body }
1089
1074
  );
1090
1075
  }
1091
1076
  async function patchCartAddresses(api, params) {
1092
1077
  const input = CartAddressesParamsSchema.parse(params);
1093
- const { cartId, shippingAddress, billingAddress } = input;
1078
+ const { cartToken, shippingAddress, billingAddress } = input;
1094
1079
  return api.request(
1095
1080
  "PATCH",
1096
- `carts/${encodeURIComponent(cartId)}/addresses`,
1081
+ `carts/${encodeURIComponent(cartToken)}/addresses`,
1097
1082
  StorefrontCartSchema,
1098
1083
  { body: { shippingAddress, billingAddress } }
1099
1084
  );
1100
1085
  }
1101
1086
  async function checkoutCart(api, params) {
1102
1087
  const input = CartCheckoutParamsSchema.parse(params);
1103
- const { cartId, ...body } = input;
1088
+ const { cartToken, ...body } = input;
1104
1089
  return api.post(
1105
- `carts/${encodeURIComponent(cartId)}/checkout`,
1090
+ `carts/${encodeURIComponent(cartToken)}/checkout`,
1106
1091
  body,
1107
1092
  CartCheckoutResponseSchema
1108
1093
  );
1109
1094
  }
1110
1095
  async function uploadPaymentReceipt(api, params) {
1111
- const cartId = CartCheckoutReadParamsSchema.shape.cartId.parse(params.cartId);
1096
+ const cartToken = CartCheckoutReadParamsSchema.shape.cartToken.parse(params.cartToken);
1112
1097
  if (!(params.file instanceof Blob)) {
1113
1098
  throw new TypeError("uploadPaymentReceipt requiere un archivo (Blob/File)");
1114
1099
  }
@@ -1116,7 +1101,7 @@ async function uploadPaymentReceipt(api, params) {
1116
1101
  const name = params.fileName ?? (params.file instanceof File ? params.file.name : "receipt");
1117
1102
  form.append("file", params.file, name);
1118
1103
  return api.postForm(
1119
- `carts/${encodeURIComponent(cartId)}/payment-receipt`,
1104
+ `carts/${encodeURIComponent(cartToken)}/payment-receipt`,
1120
1105
  form,
1121
1106
  CartPaymentReceiptResponseSchema
1122
1107
  );
@@ -1124,7 +1109,7 @@ async function uploadPaymentReceipt(api, params) {
1124
1109
  async function addCartPromotionCode(api, params) {
1125
1110
  const input = CartPromotionCodeParamsSchema.parse(params);
1126
1111
  return api.post(
1127
- `carts/${encodeURIComponent(input.cartId)}/promotion-codes`,
1112
+ `carts/${encodeURIComponent(input.cartToken)}/promotion-codes`,
1128
1113
  { code: input.code },
1129
1114
  StorefrontCartSchema
1130
1115
  );
@@ -1133,7 +1118,7 @@ async function removeCartPromotionCode(api, params) {
1133
1118
  const input = CartPromotionCodeParamsSchema.parse(params);
1134
1119
  return api.request(
1135
1120
  "DELETE",
1136
- `carts/${encodeURIComponent(input.cartId)}/promotion-codes/${encodeURIComponent(input.code)}`,
1121
+ `carts/${encodeURIComponent(input.cartToken)}/promotion-codes/${encodeURIComponent(input.code)}`,
1137
1122
  StorefrontCartSchema
1138
1123
  );
1139
1124
  }
@@ -1235,7 +1220,7 @@ var CustomerAddressUpsertInputSchema = z.object({
1235
1220
  isDefault: z.boolean()
1236
1221
  });
1237
1222
  var CustomerAddressSchema = CustomerAddressUpsertInputSchema.extend({
1238
- id: z.union([z.string(), z.number()]).transform(String).optional()
1223
+ id: EntityIdSchema.optional()
1239
1224
  });
1240
1225
  var CustomerAddressesSchema = z.array(CustomerAddressSchema);
1241
1226
  function toCustomerSavedAddresses(addresses) {
@@ -1253,7 +1238,7 @@ var ADDRESSES_PATH = "customer/addresses";
1253
1238
  var CustomerAddressMutationResponseSchema = z.union([
1254
1239
  CustomerAddressSchema,
1255
1240
  z.object({
1256
- id: z.union([z.string(), z.number()]).transform(String)
1241
+ id: EntityIdSchema
1257
1242
  }),
1258
1243
  z.null()
1259
1244
  ]);
@@ -1340,8 +1325,8 @@ var CustomerProfileSchema = z.object({
1340
1325
  });
1341
1326
  var nullableString = z.string().nullable().optional().transform((v) => v ?? null);
1342
1327
  var CustomerMeSchema = z.object({
1343
- id: z.union([z.string(), z.number()]),
1344
- storeId: z.string().optional(),
1328
+ id: EntityIdSchema,
1329
+ storeId: EntityIdSchema.optional(),
1345
1330
  email: z.string().email(),
1346
1331
  firstName: z.string(),
1347
1332
  lastName: z.string(),
@@ -1450,10 +1435,10 @@ var CustomerOrderShippingAddressSchema = z.object({
1450
1435
  metadata: z.record(z.unknown()).nullable().optional()
1451
1436
  }).passthrough();
1452
1437
  var CustomerOrderLineItemSchema = z.object({
1453
- id: z.string(),
1454
- orderId: z.coerce.string(),
1455
- productId: z.coerce.string().nullable(),
1456
- variantId: z.coerce.string().nullable(),
1438
+ id: EntityIdSchema,
1439
+ orderId: EntityIdSchema,
1440
+ productId: EntityIdSchema.nullable(),
1441
+ variantId: EntityIdSchema.nullable(),
1457
1442
  title: z.string(),
1458
1443
  subtitle: z.string().nullable().optional(),
1459
1444
  thumbnail: z.string().nullable().optional(),
@@ -1465,10 +1450,10 @@ var CustomerOrderLineItemSchema = z.object({
1465
1450
  status: z.string()
1466
1451
  });
1467
1452
  var CustomerOrderListItemSchema = z.object({
1468
- orderId: z.coerce.string(),
1453
+ orderId: EntityIdSchema,
1469
1454
  orderNumber: z.string(),
1470
1455
  orderGroup: z.string(),
1471
- orderIds: z.array(z.coerce.string()),
1456
+ orderIds: z.array(EntityIdSchema),
1472
1457
  status: z.string(),
1473
1458
  total: z.number(),
1474
1459
  totalPaid: z.number(),
@@ -1483,7 +1468,7 @@ var CustomerOrderListItemSchema = z.object({
1483
1468
  });
1484
1469
  var CustomerOrderListSchema = z.array(CustomerOrderListItemSchema);
1485
1470
  var CustomerOrderPaymentSchema = z.object({
1486
- id: z.string(),
1471
+ id: EntityIdSchema,
1487
1472
  paymentMethod: z.string(),
1488
1473
  paymentCode: z.string(),
1489
1474
  amount: z.number(),
@@ -1500,7 +1485,7 @@ var CustomerOrderStatusTimelineSchema = z.object({
1500
1485
  source: z.string()
1501
1486
  });
1502
1487
  var CustomerOrderDetailSchema = z.object({
1503
- id: z.coerce.string(),
1488
+ id: EntityIdSchema,
1504
1489
  orderNumber: z.string(),
1505
1490
  orderGroup: z.string(),
1506
1491
  status: z.string(),
@@ -1905,6 +1890,6 @@ function stripHtml(html) {
1905
1890
  return html.replace(/<br\s*\/?>/gi, " ").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
1906
1891
  }
1907
1892
 
1908
- export { AddCartItemParamsSchema, ApiError, BundleItemSchema, CartAddressWriteSchema, CartAddressesParamsSchema, CartBuyerParamsSchema, CartCheckoutParamsSchema, CartCheckoutPaymentActionSchema, CartCheckoutPaymentSchema, CartCheckoutReadParamsSchema, CartCheckoutReadResponseSchema, CartCheckoutResponseSchema, CartItemModifierSchema, CartPaymentMethodSchema, CartPaymentReceiptResponseSchema, CartPromotionCodeParamsSchema, CheckoutMetadataValueSchema, CmsBlockDtoSchema, CmsBrandingSettingsDtoSchema, CmsContactSettingsDtoSchema, CmsContentChannelSchema, CmsCustomScriptsDtoSchema, CmsMenuDtoSchema, CmsMenuItemSchema, CmsPageDetailsDtoSchema, CmsPageStatusSchema, CmsSectionDtoSchema, CmsSeoSettingsDtoSchema, CmsSiteSettingsDtoSchema, CmsSnapshotDtoSchema, CmsSocialLinksDtoSchema, CmsTrackingSettingsDtoSchema, CollectionSchema, CollectionsSchema, CountriesSchema, CountrySchema, CreateCartParamsSchema, CreateProductReviewParamsSchema, CustomerAddressMutationResponseSchema, CustomerAddressSchema, CustomerAddressUpsertInputSchema, CustomerAddressesSchema, CustomerMeSchema, CustomerOrderDetailSchema, CustomerOrderLineItemSchema, CustomerOrderListItemSchema, CustomerOrderListSchema, CustomerOrderPaymentSchema, CustomerOrderShippingAddressSchema, CustomerOrderStatusTimelineSchema, CustomerProfilePatchSchema, CustomerProfileSchema, CustomerRegisterRequestSchema, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DepartmentSchema, DepartmentsSchema, DistrictSchema, DistrictsSchema, EntityIdSchema, FacetItemSchema, FacetSchema, GeoDivisionSchema, GeoDivisionTypeSchema, GetCartParamsSchema, GetDepartmentsParamsSchema, GetDistrictsParamsSchema, GetProvincesParamsSchema, GetShippingOptionsParamsSchema, JsonElementSchema, ListProductReviewsParamsSchema, NullableEntityIdSchema, OptionalEntityIdSchema, PriceTierSchema, ProductAutocompleteParamsSchema, ProductDetailParamsSchema, ProductDetailSchema, ProductImageSchema, ProductPriceTierSchema, ProductPublicIdSchema, ProductSchema, ProductSortSchema, ProductSuggestionSchema, ProductSuggestionsSchema, ProductSummariesSchema, ProductSummarySchema, ProductsParamsSchema, ProductsResponseSchema, ProvinceSchema, ProvincesSchema, PutShippingMethodParamsSchema, RelatedProductsParamsSchema, RemoveCartItemParamsSchema, SearchFilterSchema, ShippingOptionGroupSchema, ShippingOptionsResponseSchema, ShippingRateSchema, SizeGuideMeasurementSchema, SizeGuideRowSchema, SizeGuideSchema, SpecItemSchema, StoreCheckoutCartPageSettingsSchema, StoreCheckoutGeneralSettingsSchema, StoreCheckoutOrderBumpSettingsSchema, StoreCheckoutOrdersAndPaymentsSettingsSchema, StoreCheckoutSettingsSchema, StoreCheckoutShippingSettingsSchema, StoreFeatureFlagsSchema, StoreModelSchema, StoreSettingsSnapshotDtoSchema, StoreThemeSettingsSchema, StoreTypeSchema, StoreVisibilitySchema, StorefrontAddressSchema, StorefrontCartBundleItemSchema, StorefrontCartItemSchema, StorefrontCartSchema, StorefrontCartShippingMethodSchema, StorefrontCartStatusSchema, StorefrontCartTotalsSchema, StorefrontCheckoutSettingsSchema, StorefrontCmsBrandingSchema, StorefrontCmsContactSchema, StorefrontCmsCustomScriptsSchema, StorefrontCmsPageSchema, StorefrontCmsSeoSchema, StorefrontCmsSettingsSchema, StorefrontCmsSocialLinksSchema, StorefrontCmsTrackingSchema, StorefrontFeaturesEnabledSchema, StorefrontMenuItemSchema, StorefrontMenuSchema, StorefrontOrderBumpSchema, StorefrontReviewSchema, StorefrontReviewsSchema, StorefrontSettingsSchema, StorefrontStoreSchema, StorefrontStoreTypeSchema, StorefrontThemeConfigSchema, UpdateCartItemQuantityParamsSchema, VariantItemSchema, VariantOptionSchema, VariantSchema, addCartItem, addCartPromotionCode, autocompleteProducts, cartVariantIdFromProduct, checkoutCart, createApi, createCart, createClient, createCustomerAddress, createProductReview, createStorefrontClient, customerMeToProfile, customerMeToProfilePatch, customerOrderStatusTone, customerProfileToPatch, deleteCustomerAddress, formatCustomerOrderStatus, formatOrderDate, formatOrderDateTime, getCart, getCartCheckout, getCountries, getCustomerAddresses, getCustomerMe, getCustomerOrder, getCustomerOrders, getDepartments, getDistricts, getMenuItems, getPageBySlug, getProductBySlug, getProducts, getProvinces, getRelatedProducts, getShippingOptions, listProductReviews, patchCartAddresses, patchCartBuyer, patchCustomer, putCartShippingMethod, registerCustomer, removeCartItem, removeCartPromotionCode, resolveApiBaseUrl, sanitizeHtml, stripHtml, toCustomerSavedAddresses, updateCartItemQuantity, updateCustomerAddress, uploadPaymentReceipt };
1893
+ export { AddCartItemParamsSchema, ApiError, BundleItemSchema, CartAddressWriteSchema, CartAddressesParamsSchema, CartBuyerParamsSchema, CartCheckoutParamsSchema, CartCheckoutPaymentActionSchema, CartCheckoutPaymentSchema, CartCheckoutReadParamsSchema, CartCheckoutReadResponseSchema, CartCheckoutResponseSchema, CartItemModifierSchema, CartPaymentMethodSchema, CartPaymentReceiptResponseSchema, CartPromotionCodeParamsSchema, CartTokenSchema, CheckoutMetadataValueSchema, CmsBlockDtoSchema, CmsBrandingSettingsDtoSchema, CmsContactSettingsDtoSchema, CmsContentChannelSchema, CmsCustomScriptsDtoSchema, CmsMenuDtoSchema, CmsMenuItemSchema, CmsPageDetailsDtoSchema, CmsPageStatusSchema, CmsSectionDtoSchema, CmsSeoSettingsDtoSchema, CmsSiteSettingsDtoSchema, CmsSnapshotDtoSchema, CmsSocialLinksDtoSchema, CmsTrackingSettingsDtoSchema, CollectionSchema, CollectionsSchema, CountriesSchema, CountrySchema, CreateCartParamsSchema, CreateProductReviewParamsSchema, CustomerAddressMutationResponseSchema, CustomerAddressSchema, CustomerAddressUpsertInputSchema, CustomerAddressesSchema, CustomerMeSchema, CustomerOrderDetailSchema, CustomerOrderLineItemSchema, CustomerOrderListItemSchema, CustomerOrderListSchema, CustomerOrderPaymentSchema, CustomerOrderShippingAddressSchema, CustomerOrderStatusTimelineSchema, CustomerProfilePatchSchema, CustomerProfileSchema, CustomerRegisterRequestSchema, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DepartmentSchema, DepartmentsSchema, DistrictSchema, DistrictsSchema, EntityIdSchema, FacetItemSchema, FacetSchema, GeoDivisionSchema, GeoDivisionTypeSchema, GetCartParamsSchema, GetDepartmentsParamsSchema, GetDistrictsParamsSchema, GetProvincesParamsSchema, GetShippingOptionsParamsSchema, JsonElementSchema, ListProductReviewsParamsSchema, NullableEntityIdSchema, OptionalEntityIdSchema, PriceTierSchema, ProductAutocompleteParamsSchema, ProductDetailParamsSchema, ProductDetailSchema, ProductImageSchema, ProductPriceTierSchema, ProductSchema, ProductSortSchema, ProductSuggestionSchema, ProductSuggestionsSchema, ProductSummariesSchema, ProductSummarySchema, ProductsParamsSchema, ProductsResponseSchema, ProvinceSchema, ProvincesSchema, PutShippingMethodParamsSchema, RelatedProductsParamsSchema, RemoveCartItemParamsSchema, SearchFilterSchema, ShippingOptionGroupSchema, ShippingOptionsResponseSchema, ShippingRateSchema, SizeGuideMeasurementSchema, SizeGuideRowSchema, SizeGuideSchema, SpecItemSchema, StoreCheckoutCartPageSettingsSchema, StoreCheckoutGeneralSettingsSchema, StoreCheckoutOrderBumpSettingsSchema, StoreCheckoutOrdersAndPaymentsSettingsSchema, StoreCheckoutSettingsSchema, StoreCheckoutShippingSettingsSchema, StoreFeatureFlagsSchema, StoreModelSchema, StoreSettingsSnapshotDtoSchema, StoreThemeSettingsSchema, StoreTypeSchema, StoreVisibilitySchema, StorefrontAddressSchema, StorefrontCartBundleItemSchema, StorefrontCartItemSchema, StorefrontCartSchema, StorefrontCartShippingMethodSchema, StorefrontCartStatusSchema, StorefrontCartTotalsSchema, StorefrontCheckoutSettingsSchema, StorefrontCmsBrandingSchema, StorefrontCmsContactSchema, StorefrontCmsCustomScriptsSchema, StorefrontCmsPageSchema, StorefrontCmsSeoSchema, StorefrontCmsSettingsSchema, StorefrontCmsSocialLinksSchema, StorefrontCmsTrackingSchema, StorefrontFeaturesEnabledSchema, StorefrontMenuItemSchema, StorefrontMenuSchema, StorefrontOrderBumpSchema, StorefrontReviewSchema, StorefrontReviewsSchema, StorefrontSettingsSchema, StorefrontStoreSchema, StorefrontStoreTypeSchema, StorefrontThemeConfigSchema, UpdateCartItemQuantityParamsSchema, VariantItemSchema, VariantOptionSchema, VariantSchema, addCartItem, addCartPromotionCode, autocompleteProducts, checkoutCart, createApi, createCart, createClient, createCustomerAddress, createProductReview, createStorefrontClient, customerMeToProfile, customerMeToProfilePatch, customerOrderStatusTone, customerProfileToPatch, deleteCustomerAddress, formatCustomerOrderStatus, formatOrderDate, formatOrderDateTime, getCart, getCartCheckout, getCountries, getCustomerAddresses, getCustomerMe, getCustomerOrder, getCustomerOrders, getDepartments, getDistricts, getMenuItems, getPageBySlug, getProductBySlug, getProducts, getProvinces, getRelatedProducts, getShippingOptions, listProductReviews, patchCartAddresses, patchCartBuyer, patchCustomer, putCartShippingMethod, registerCustomer, removeCartItem, removeCartPromotionCode, resolveApiBaseUrl, sanitizeHtml, stripHtml, toCustomerSavedAddresses, updateCartItemQuantity, updateCustomerAddress, uploadPaymentReceipt };
1909
1894
  //# sourceMappingURL=index.js.map
1910
1895
  //# sourceMappingURL=index.js.map