@ecomiq/core 0.1.6 → 0.1.8

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 (65) hide show
  1. package/dist/client.cjs +58 -46
  2. package/dist/client.cjs.map +1 -1
  3. package/dist/client.d.cts +1 -0
  4. package/dist/client.d.ts +1 -0
  5. package/dist/client.js +58 -46
  6. package/dist/client.js.map +1 -1
  7. package/dist/index.cjs +60 -46
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +3 -2
  10. package/dist/index.d.ts +3 -2
  11. package/dist/index.js +59 -47
  12. package/dist/index.js.map +1 -1
  13. package/dist/models/collections.cjs +9 -1
  14. package/dist/models/collections.cjs.map +1 -1
  15. package/dist/models/collections.d.cts +6 -6
  16. package/dist/models/collections.d.ts +6 -6
  17. package/dist/models/collections.js +9 -1
  18. package/dist/models/collections.js.map +1 -1
  19. package/dist/models/geo.cjs +10 -2
  20. package/dist/models/geo.cjs.map +1 -1
  21. package/dist/models/geo.d.cts +14 -14
  22. package/dist/models/geo.d.ts +14 -14
  23. package/dist/models/geo.js +10 -2
  24. package/dist/models/geo.js.map +1 -1
  25. package/dist/models/ids.cjs +17 -0
  26. package/dist/models/ids.cjs.map +1 -0
  27. package/dist/models/ids.d.cts +12 -0
  28. package/dist/models/ids.d.ts +12 -0
  29. package/dist/models/ids.js +13 -0
  30. package/dist/models/ids.js.map +1 -0
  31. package/dist/models/products.cjs +12 -4
  32. package/dist/models/products.cjs.map +1 -1
  33. package/dist/models/products.d.cts +4 -4
  34. package/dist/models/products.d.ts +4 -4
  35. package/dist/models/products.js +12 -4
  36. package/dist/models/products.js.map +1 -1
  37. package/dist/models/search.cjs +11 -5
  38. package/dist/models/search.cjs.map +1 -1
  39. package/dist/models/search.d.cts +1 -1
  40. package/dist/models/search.d.ts +1 -1
  41. package/dist/models/search.js +11 -5
  42. package/dist/models/search.js.map +1 -1
  43. package/dist/models/settings.cjs +12 -9
  44. package/dist/models/settings.cjs.map +1 -1
  45. package/dist/models/settings.d.cts +23 -25
  46. package/dist/models/settings.d.ts +23 -25
  47. package/dist/models/settings.js +12 -10
  48. package/dist/models/settings.js.map +1 -1
  49. package/dist/models/storefront-cart.cjs +23 -15
  50. package/dist/models/storefront-cart.cjs.map +1 -1
  51. package/dist/models/storefront-cart.d.cts +23 -23
  52. package/dist/models/storefront-cart.d.ts +23 -23
  53. package/dist/models/storefront-cart.js +23 -15
  54. package/dist/models/storefront-cart.js.map +1 -1
  55. package/dist/models/storefront-checkout.cjs +46 -29
  56. package/dist/models/storefront-checkout.cjs.map +1 -1
  57. package/dist/models/storefront-checkout.d.cts +555 -2183
  58. package/dist/models/storefront-checkout.d.ts +555 -2183
  59. package/dist/models/storefront-checkout.js +46 -30
  60. package/dist/models/storefront-checkout.js.map +1 -1
  61. package/dist/models/storefront-reviews.cjs +12 -4
  62. package/dist/models/storefront-reviews.cjs.map +1 -1
  63. package/dist/models/storefront-reviews.js +12 -4
  64. package/dist/models/storefront-reviews.js.map +1 -1
  65. package/package.json +6 -1
package/dist/index.cjs CHANGED
@@ -110,8 +110,16 @@ function createApi(options = {}) {
110
110
  postForm: (path, body, schema, opts) => request("POST", path, schema, { ...opts, body })
111
111
  };
112
112
  }
113
+ var EntityIdSchema = zod.z.union([
114
+ zod.z.string().uuid(),
115
+ zod.z.string().regex(/^\d+$/, "Expected numeric id")
116
+ ]);
117
+ var NullableEntityIdSchema = EntityIdSchema.nullable();
118
+ var OptionalEntityIdSchema = EntityIdSchema.optional();
119
+
120
+ // src/models/collections.ts
113
121
  var CollectionSchema = zod.z.object({
114
- id: zod.z.number(),
122
+ id: EntityIdSchema,
115
123
  slug: zod.z.string(),
116
124
  name: zod.z.string(),
117
125
  description: zod.z.string().nullable().optional(),
@@ -180,7 +188,7 @@ var ProductsParamsSchema = zod.z.object({
180
188
  page: zod.z.number().int().positive().default(1),
181
189
  pageSize: zod.z.number().int().positive().max(100).default(24),
182
190
  sort: ProductSortSchema.optional(),
183
- sellerId: zod.z.string().uuid().optional(),
191
+ sellerId: OptionalEntityIdSchema,
184
192
  search: zod.z.string().optional(),
185
193
  collection: zod.z.string().optional(),
186
194
  collections: zod.z.array(zod.z.string()).optional(),
@@ -194,18 +202,18 @@ var ProductsParamsSchema = zod.z.object({
194
202
  tag: zod.z.string().optional(),
195
203
  tags: zod.z.array(zod.z.string()).optional(),
196
204
  filters: zod.z.array(zod.z.string()).optional(),
197
- locationId: zod.z.string().uuid().optional(),
205
+ locationId: OptionalEntityIdSchema,
198
206
  inStock: zod.z.boolean().optional(),
199
207
  minPrice: zod.z.number().nonnegative().optional(),
200
208
  maxPrice: zod.z.number().nonnegative().optional()
201
209
  });
202
210
  var ProductDetailParamsSchema = zod.z.object({
203
- sellerId: zod.z.string().uuid().optional()
211
+ sellerId: OptionalEntityIdSchema
204
212
  });
205
213
  var RelatedProductsParamsSchema = zod.z.object({
206
214
  productId: ProductPublicIdSchema,
207
215
  limit: zod.z.number().int().positive().max(12).default(8),
208
- sellerId: zod.z.string().uuid().optional()
216
+ sellerId: OptionalEntityIdSchema
209
217
  });
210
218
  var SpecItemSchema = zod.z.object({
211
219
  key: zod.z.string(),
@@ -312,12 +320,6 @@ var JsonElementSchema = zod.z.lazy(
312
320
  );
313
321
  var DateTimeOffsetSchema = zod.z.string().datetime({ offset: true });
314
322
  var NullableDateTimeOffsetSchema = DateTimeOffsetSchema.nullable();
315
- var NullableUuidSchema = zod.z.string().uuid().nullable();
316
- var EntityIdSchema = zod.z.union([
317
- zod.z.string().uuid(),
318
- zod.z.string().regex(/^\d+$/, "Expected numeric id")
319
- ]);
320
- var NullableEntityIdSchema = EntityIdSchema.nullable();
321
323
  var StoreTypeSchema = zod.z.enum([
322
324
  "b2C",
323
325
  "marketplace",
@@ -489,11 +491,11 @@ var CmsPageDetailsDtoSchema = zod.z.object({
489
491
  status: CmsPageStatusSchema,
490
492
  hasPublishedVersion: zod.z.boolean(),
491
493
  publishedOn: NullableDateTimeOffsetSchema,
492
- publishedBy: NullableUuidSchema,
494
+ publishedBy: NullableEntityIdSchema,
493
495
  createdOn: DateTimeOffsetSchema,
494
496
  updatedOn: NullableDateTimeOffsetSchema,
495
- createdBy: NullableUuidSchema,
496
- updatedBy: NullableUuidSchema,
497
+ createdBy: NullableEntityIdSchema,
498
+ updatedBy: NullableEntityIdSchema,
497
499
  lastModifiedBy: zod.z.string().nullable()
498
500
  }).strict();
499
501
  var CmsSnapshotDtoSchema = zod.z.object({
@@ -604,7 +606,7 @@ async function getRelatedProducts(api, params) {
604
606
  var ProductAutocompleteParamsSchema = zod.z.object({
605
607
  search: zod.z.string().min(2).max(80),
606
608
  limit: zod.z.number().int().positive().max(20).default(8),
607
- sellerId: zod.z.string().uuid().optional()
609
+ sellerId: OptionalEntityIdSchema
608
610
  });
609
611
  var ProductSuggestionSchema = zod.z.object({
610
612
  id: ProductPublicIdSchema,
@@ -728,7 +730,7 @@ var StorefrontCartBundleItemSchema = zod.z.object({
728
730
  quantity: zod.z.number().int().positive()
729
731
  });
730
732
  var StorefrontCartItemSchema = zod.z.object({
731
- id: zod.z.string().uuid(),
733
+ id: EntityIdSchema,
732
734
  productId: zod.z.number().int().safe().nonnegative(),
733
735
  title: zod.z.string(),
734
736
  variantLabel: zod.z.string().nullable(),
@@ -742,20 +744,20 @@ var StorefrontCartItemSchema = zod.z.object({
742
744
  bundleItems: zod.z.array(StorefrontCartBundleItemSchema)
743
745
  });
744
746
  var StorefrontCartShippingMethodSchema = zod.z.object({
745
- id: zod.z.string().uuid(),
746
- shippingMethodId: zod.z.string().uuid().nullable(),
747
- rateId: zod.z.string().uuid().nullable(),
747
+ id: EntityIdSchema,
748
+ shippingMethodId: NullableEntityIdSchema,
749
+ rateId: NullableEntityIdSchema,
748
750
  name: zod.z.string(),
749
751
  description: zod.z.string().nullable(),
750
752
  total: zod.z.number(),
751
- locationId: zod.z.string().uuid().nullable(),
753
+ locationId: NullableEntityIdSchema,
752
754
  estimatedDays: zod.z.number().int().nullable(),
753
- pickupPointId: zod.z.string().uuid().nullable(),
755
+ pickupPointId: NullableEntityIdSchema,
754
756
  scheduledDate: zod.z.string().nullable(),
755
757
  scheduledTime: zod.z.string().nullable(),
756
758
  serviceCode: zod.z.string().nullable(),
757
- sellerId: zod.z.string().uuid().nullable(),
758
- shippingProfileId: zod.z.string().uuid().nullable()
759
+ sellerId: NullableEntityIdSchema,
760
+ shippingProfileId: NullableEntityIdSchema
759
761
  });
760
762
  var StorefrontCartTotalsSchema = zod.z.object({
761
763
  subtotal: zod.z.number(),
@@ -776,7 +778,7 @@ var StorefrontCartStatusSchema = zod.z.enum([
776
778
  "failed"
777
779
  ]);
778
780
  var StorefrontCartSchema = zod.z.object({
779
- id: zod.z.string().uuid(),
781
+ id: EntityIdSchema,
780
782
  cartNumber: zod.z.string(),
781
783
  email: zod.z.string().nullable(),
782
784
  phone: zod.z.string().nullable(),
@@ -798,26 +800,26 @@ var CreateCartParamsSchema = zod.z.object({
798
800
  email: zod.z.string().email().optional()
799
801
  });
800
802
  var GetCartParamsSchema = zod.z.object({
801
- cartId: zod.z.string().uuid()
803
+ cartId: EntityIdSchema
802
804
  });
803
805
  var CartItemModifierSchema = zod.z.object({
804
806
  modifierGroupId: zod.z.number().int().safe().positive(),
805
807
  optionIds: zod.z.array(zod.z.number().int().safe().positive()).min(1)
806
808
  });
807
809
  var AddCartItemParamsSchema = zod.z.object({
808
- cartId: zod.z.string().uuid(),
810
+ cartId: EntityIdSchema,
809
811
  variantId: zod.z.number().int().safe().positive(),
810
812
  quantity: zod.z.number().int().positive(),
811
813
  modifiers: zod.z.array(CartItemModifierSchema).optional()
812
814
  });
813
815
  var UpdateCartItemQuantityParamsSchema = zod.z.object({
814
- cartId: zod.z.string().uuid(),
815
- cartItemId: zod.z.string().uuid(),
816
+ cartId: EntityIdSchema,
817
+ cartItemId: EntityIdSchema,
816
818
  quantity: zod.z.number().int().nonnegative()
817
819
  });
818
820
  var RemoveCartItemParamsSchema = zod.z.object({
819
- cartId: zod.z.string().uuid(),
820
- cartItemId: zod.z.string().uuid()
821
+ cartId: EntityIdSchema,
822
+ cartItemId: EntityIdSchema
821
823
  });
822
824
 
823
825
  // src/services/cart.service.ts
@@ -882,8 +884,18 @@ async function getCollectionBySlug(api, collectionSlug) {
882
884
  async function getPageBySlug(api, pageSlug) {
883
885
  return api.get(`pages/${encodeURIComponent(pageSlug)}`, CmsPageDetailsDtoSchema);
884
886
  }
887
+ var CheckoutMetadataValueSchema = zod.z.lazy(
888
+ () => zod.z.union([
889
+ zod.z.string(),
890
+ zod.z.number(),
891
+ zod.z.boolean(),
892
+ zod.z.null(),
893
+ zod.z.array(CheckoutMetadataValueSchema),
894
+ zod.z.record(zod.z.string(), CheckoutMetadataValueSchema)
895
+ ])
896
+ );
885
897
  var CartBuyerParamsSchema = zod.z.object({
886
- cartId: zod.z.string().uuid(),
898
+ cartId: EntityIdSchema,
887
899
  email: zod.z.string().email(),
888
900
  firstName: zod.z.string().min(1),
889
901
  lastName: zod.z.string().min(1),
@@ -909,7 +921,7 @@ var CartAddressWriteSchema = zod.z.object({
909
921
  }).nullable().optional()
910
922
  });
911
923
  var CartAddressesParamsSchema = zod.z.object({
912
- cartId: zod.z.string().uuid(),
924
+ cartId: EntityIdSchema,
913
925
  shippingAddress: CartAddressWriteSchema,
914
926
  billingAddress: CartAddressWriteSchema
915
927
  });
@@ -942,7 +954,7 @@ var StorefrontOrderBumpSchema = zod.z.object({
942
954
  description: zod.z.string().nullable().optional()
943
955
  });
944
956
  var CartCheckoutReadParamsSchema = zod.z.object({
945
- cartId: zod.z.string().uuid()
957
+ cartId: EntityIdSchema
946
958
  });
947
959
  var CartCheckoutReadResponseSchema = zod.z.object({
948
960
  cart: StorefrontCartSchema,
@@ -958,13 +970,13 @@ var CartCheckoutPaymentActionSchema = zod.z.object({
958
970
  phoneNumber: zod.z.string().nullable().optional(),
959
971
  accountHolder: zod.z.string().nullable().optional(),
960
972
  qrImageUrl: zod.z.string().nullable().optional()
961
- }).passthrough().nullable().optional(),
973
+ }).strip().nullable().optional(),
962
974
  url: zod.z.string().nullable().optional(),
963
975
  html: zod.z.string().nullable().optional(),
964
976
  clientSecret: zod.z.string().nullable().optional(),
965
977
  qrCode: zod.z.string().nullable().optional(),
966
978
  expiresAt: zod.z.string().nullable().optional()
967
- }).passthrough();
979
+ }).strip();
968
980
  var CartCheckoutPaymentSchema = zod.z.object({
969
981
  transactionId: zod.z.string(),
970
982
  paymentMethodCode: zod.z.string(),
@@ -975,7 +987,7 @@ var CartCheckoutPaymentSchema = zod.z.object({
975
987
  actionType: zod.z.string(),
976
988
  receiptUrl: zod.z.string().nullable().optional(),
977
989
  action: CartCheckoutPaymentActionSchema.nullable().optional()
978
- }).passthrough();
990
+ }).strip();
979
991
  var CartCheckoutResponseSchema = zod.z.object({
980
992
  publicKey: zod.z.string().optional(),
981
993
  publishableKey: zod.z.string().optional(),
@@ -987,9 +999,9 @@ var CartCheckoutResponseSchema = zod.z.object({
987
999
  orderIds: zod.z.array(zod.z.coerce.string()).optional(),
988
1000
  payment: CartCheckoutPaymentSchema.optional(),
989
1001
  cart: StorefrontCartSchema.optional()
990
- }).passthrough();
1002
+ }).strip();
991
1003
  var CartCheckoutParamsSchema = zod.z.object({
992
- cartId: zod.z.string().uuid(),
1004
+ cartId: EntityIdSchema,
993
1005
  paymentMethodCode: zod.z.string().min(1),
994
1006
  externalRef: zod.z.string().min(1),
995
1007
  receiptUrl: zod.z.string().min(1).optional()
@@ -1008,8 +1020,8 @@ var ShippingRateSchema = zod.z.object({
1008
1020
  deliveryLocationName: zod.z.string().nullable().optional(),
1009
1021
  estimatedDeliveryDays: zod.z.number().nullable().optional(),
1010
1022
  serviceCode: zod.z.string().nullable().optional(),
1011
- metadata: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
1012
- }).passthrough();
1023
+ metadata: zod.z.record(zod.z.string(), CheckoutMetadataValueSchema).optional()
1024
+ }).strip();
1013
1025
  var ShippingOptionGroupSchema = zod.z.object({
1014
1026
  sellerId: zod.z.string(),
1015
1027
  shippingProfileId: zod.z.string().nullable().optional(),
@@ -1017,16 +1029,16 @@ var ShippingOptionGroupSchema = zod.z.object({
1017
1029
  totalWeight: zod.z.number().optional(),
1018
1030
  itemIds: zod.z.array(zod.z.string()).optional(),
1019
1031
  rates: zod.z.array(ShippingRateSchema)
1020
- }).passthrough();
1032
+ }).strip();
1021
1033
  var ShippingOptionsResponseSchema = zod.z.object({
1022
1034
  groups: zod.z.array(ShippingOptionGroupSchema)
1023
1035
  });
1024
1036
  var GetShippingOptionsParamsSchema = zod.z.object({
1025
- cartId: zod.z.string().uuid(),
1037
+ cartId: EntityIdSchema,
1026
1038
  postalCode: zod.z.string().min(1)
1027
1039
  });
1028
1040
  var PutShippingMethodParamsSchema = zod.z.object({
1029
- cartId: zod.z.string().uuid(),
1041
+ cartId: EntityIdSchema,
1030
1042
  rateId: zod.z.string().min(1),
1031
1043
  shippingMethodId: zod.z.string().min(1),
1032
1044
  serviceCode: zod.z.string().nullable().optional(),
@@ -1042,7 +1054,7 @@ var CartPaymentReceiptResponseSchema = zod.z.object({
1042
1054
  url: zod.z.string()
1043
1055
  });
1044
1056
  var CartPromotionCodeParamsSchema = zod.z.object({
1045
- cartId: zod.z.string().uuid(),
1057
+ cartId: EntityIdSchema,
1046
1058
  code: zod.z.string().min(1)
1047
1059
  });
1048
1060
 
@@ -1138,12 +1150,12 @@ var CountrySchema = zod.z.object({
1138
1150
  var CountriesSchema = zod.z.array(CountrySchema);
1139
1151
  var GeoDivisionTypeSchema = zod.z.enum(["level1", "level2", "level3"]);
1140
1152
  var GeoDivisionSchema = zod.z.object({
1141
- id: zod.z.string().uuid(),
1153
+ id: EntityIdSchema,
1142
1154
  countryCode: zod.z.string().length(2),
1143
1155
  type: GeoDivisionTypeSchema,
1144
1156
  code: zod.z.string().min(1),
1145
1157
  name: zod.z.string().min(1),
1146
- parentId: zod.z.string().uuid().nullable(),
1158
+ parentId: NullableEntityIdSchema,
1147
1159
  source: zod.z.string().min(1)
1148
1160
  }).strict();
1149
1161
  var DepartmentSchema = GeoDivisionSchema;
@@ -1915,6 +1927,7 @@ exports.CartItemModifierSchema = CartItemModifierSchema;
1915
1927
  exports.CartPaymentMethodSchema = CartPaymentMethodSchema;
1916
1928
  exports.CartPaymentReceiptResponseSchema = CartPaymentReceiptResponseSchema;
1917
1929
  exports.CartPromotionCodeParamsSchema = CartPromotionCodeParamsSchema;
1930
+ exports.CheckoutMetadataValueSchema = CheckoutMetadataValueSchema;
1918
1931
  exports.CmsBlockDtoSchema = CmsBlockDtoSchema;
1919
1932
  exports.CmsBrandingSettingsDtoSchema = CmsBrandingSettingsDtoSchema;
1920
1933
  exports.CmsContactSettingsDtoSchema = CmsContactSettingsDtoSchema;
@@ -1970,6 +1983,7 @@ exports.GetShippingOptionsParamsSchema = GetShippingOptionsParamsSchema;
1970
1983
  exports.JsonElementSchema = JsonElementSchema;
1971
1984
  exports.ListProductReviewsParamsSchema = ListProductReviewsParamsSchema;
1972
1985
  exports.NullableEntityIdSchema = NullableEntityIdSchema;
1986
+ exports.OptionalEntityIdSchema = OptionalEntityIdSchema;
1973
1987
  exports.PriceTierSchema = PriceTierSchema;
1974
1988
  exports.ProductAutocompleteParamsSchema = ProductAutocompleteParamsSchema;
1975
1989
  exports.ProductDetailParamsSchema = ProductDetailParamsSchema;