@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/client.d.cts CHANGED
@@ -12,3 +12,4 @@ import './models/customer-profile.cjs';
12
12
  import './models/customer-order.cjs';
13
13
  import './models/settings.cjs';
14
14
  import 'zod';
15
+ import './models/ids.cjs';
package/dist/client.d.ts CHANGED
@@ -12,3 +12,4 @@ import './models/customer-profile.js';
12
12
  import './models/customer-order.js';
13
13
  import './models/settings.js';
14
14
  import 'zod';
15
+ import './models/ids.js';
package/dist/client.js CHANGED
@@ -103,8 +103,16 @@ function createApi(options = {}) {
103
103
  postForm: (path, body, schema, opts) => request("POST", path, schema, { ...opts, body })
104
104
  };
105
105
  }
106
+ var EntityIdSchema = z.union([
107
+ z.string().uuid(),
108
+ z.string().regex(/^\d+$/, "Expected numeric id")
109
+ ]);
110
+ var NullableEntityIdSchema = EntityIdSchema.nullable();
111
+ var OptionalEntityIdSchema = EntityIdSchema.optional();
112
+
113
+ // src/models/collections.ts
106
114
  var CollectionSchema = z.object({
107
- id: z.number(),
115
+ id: EntityIdSchema,
108
116
  slug: z.string(),
109
117
  name: z.string(),
110
118
  description: z.string().nullable().optional(),
@@ -171,7 +179,7 @@ var ProductsParamsSchema = z.object({
171
179
  page: z.number().int().positive().default(1),
172
180
  pageSize: z.number().int().positive().max(100).default(24),
173
181
  sort: ProductSortSchema.optional(),
174
- sellerId: z.string().uuid().optional(),
182
+ sellerId: OptionalEntityIdSchema,
175
183
  search: z.string().optional(),
176
184
  collection: z.string().optional(),
177
185
  collections: z.array(z.string()).optional(),
@@ -185,18 +193,18 @@ var ProductsParamsSchema = z.object({
185
193
  tag: z.string().optional(),
186
194
  tags: z.array(z.string()).optional(),
187
195
  filters: z.array(z.string()).optional(),
188
- locationId: z.string().uuid().optional(),
196
+ locationId: OptionalEntityIdSchema,
189
197
  inStock: z.boolean().optional(),
190
198
  minPrice: z.number().nonnegative().optional(),
191
199
  maxPrice: z.number().nonnegative().optional()
192
200
  });
193
201
  var ProductDetailParamsSchema = z.object({
194
- sellerId: z.string().uuid().optional()
202
+ sellerId: OptionalEntityIdSchema
195
203
  });
196
204
  var RelatedProductsParamsSchema = z.object({
197
205
  productId: ProductPublicIdSchema,
198
206
  limit: z.number().int().positive().max(12).default(8),
199
- sellerId: z.string().uuid().optional()
207
+ sellerId: OptionalEntityIdSchema
200
208
  });
201
209
  var SpecItemSchema = z.object({
202
210
  key: z.string(),
@@ -300,12 +308,6 @@ var JsonElementSchema = z.lazy(
300
308
  );
301
309
  var DateTimeOffsetSchema = z.string().datetime({ offset: true });
302
310
  var NullableDateTimeOffsetSchema = DateTimeOffsetSchema.nullable();
303
- var NullableUuidSchema = z.string().uuid().nullable();
304
- var EntityIdSchema = z.union([
305
- z.string().uuid(),
306
- z.string().regex(/^\d+$/, "Expected numeric id")
307
- ]);
308
- var NullableEntityIdSchema = EntityIdSchema.nullable();
309
311
  var StoreTypeSchema = z.enum([
310
312
  "b2C",
311
313
  "marketplace",
@@ -477,11 +479,11 @@ var CmsPageDetailsDtoSchema = z.object({
477
479
  status: CmsPageStatusSchema,
478
480
  hasPublishedVersion: z.boolean(),
479
481
  publishedOn: NullableDateTimeOffsetSchema,
480
- publishedBy: NullableUuidSchema,
482
+ publishedBy: NullableEntityIdSchema,
481
483
  createdOn: DateTimeOffsetSchema,
482
484
  updatedOn: NullableDateTimeOffsetSchema,
483
- createdBy: NullableUuidSchema,
484
- updatedBy: NullableUuidSchema,
485
+ createdBy: NullableEntityIdSchema,
486
+ updatedBy: NullableEntityIdSchema,
485
487
  lastModifiedBy: z.string().nullable()
486
488
  }).strict();
487
489
  var CmsSnapshotDtoSchema = z.object({
@@ -573,7 +575,7 @@ async function getRelatedProducts(api, params) {
573
575
  var ProductAutocompleteParamsSchema = z.object({
574
576
  search: z.string().min(2).max(80),
575
577
  limit: z.number().int().positive().max(20).default(8),
576
- sellerId: z.string().uuid().optional()
578
+ sellerId: OptionalEntityIdSchema
577
579
  });
578
580
  var ProductSuggestionSchema = z.object({
579
581
  id: ProductPublicIdSchema,
@@ -687,7 +689,7 @@ var StorefrontCartBundleItemSchema = z.object({
687
689
  quantity: z.number().int().positive()
688
690
  });
689
691
  var StorefrontCartItemSchema = z.object({
690
- id: z.string().uuid(),
692
+ id: EntityIdSchema,
691
693
  productId: z.number().int().safe().nonnegative(),
692
694
  title: z.string(),
693
695
  variantLabel: z.string().nullable(),
@@ -701,20 +703,20 @@ var StorefrontCartItemSchema = z.object({
701
703
  bundleItems: z.array(StorefrontCartBundleItemSchema)
702
704
  });
703
705
  var StorefrontCartShippingMethodSchema = z.object({
704
- id: z.string().uuid(),
705
- shippingMethodId: z.string().uuid().nullable(),
706
- rateId: z.string().uuid().nullable(),
706
+ id: EntityIdSchema,
707
+ shippingMethodId: NullableEntityIdSchema,
708
+ rateId: NullableEntityIdSchema,
707
709
  name: z.string(),
708
710
  description: z.string().nullable(),
709
711
  total: z.number(),
710
- locationId: z.string().uuid().nullable(),
712
+ locationId: NullableEntityIdSchema,
711
713
  estimatedDays: z.number().int().nullable(),
712
- pickupPointId: z.string().uuid().nullable(),
714
+ pickupPointId: NullableEntityIdSchema,
713
715
  scheduledDate: z.string().nullable(),
714
716
  scheduledTime: z.string().nullable(),
715
717
  serviceCode: z.string().nullable(),
716
- sellerId: z.string().uuid().nullable(),
717
- shippingProfileId: z.string().uuid().nullable()
718
+ sellerId: NullableEntityIdSchema,
719
+ shippingProfileId: NullableEntityIdSchema
718
720
  });
719
721
  var StorefrontCartTotalsSchema = z.object({
720
722
  subtotal: z.number(),
@@ -735,7 +737,7 @@ var StorefrontCartStatusSchema = z.enum([
735
737
  "failed"
736
738
  ]);
737
739
  var StorefrontCartSchema = z.object({
738
- id: z.string().uuid(),
740
+ id: EntityIdSchema,
739
741
  cartNumber: z.string(),
740
742
  email: z.string().nullable(),
741
743
  phone: z.string().nullable(),
@@ -757,26 +759,26 @@ var CreateCartParamsSchema = z.object({
757
759
  email: z.string().email().optional()
758
760
  });
759
761
  var GetCartParamsSchema = z.object({
760
- cartId: z.string().uuid()
762
+ cartId: EntityIdSchema
761
763
  });
762
764
  var CartItemModifierSchema = z.object({
763
765
  modifierGroupId: z.number().int().safe().positive(),
764
766
  optionIds: z.array(z.number().int().safe().positive()).min(1)
765
767
  });
766
768
  var AddCartItemParamsSchema = z.object({
767
- cartId: z.string().uuid(),
769
+ cartId: EntityIdSchema,
768
770
  variantId: z.number().int().safe().positive(),
769
771
  quantity: z.number().int().positive(),
770
772
  modifiers: z.array(CartItemModifierSchema).optional()
771
773
  });
772
774
  var UpdateCartItemQuantityParamsSchema = z.object({
773
- cartId: z.string().uuid(),
774
- cartItemId: z.string().uuid(),
775
+ cartId: EntityIdSchema,
776
+ cartItemId: EntityIdSchema,
775
777
  quantity: z.number().int().nonnegative()
776
778
  });
777
779
  var RemoveCartItemParamsSchema = z.object({
778
- cartId: z.string().uuid(),
779
- cartItemId: z.string().uuid()
780
+ cartId: EntityIdSchema,
781
+ cartItemId: EntityIdSchema
780
782
  });
781
783
 
782
784
  // src/services/cart.service.ts
@@ -841,8 +843,18 @@ async function getCollectionBySlug(api, collectionSlug) {
841
843
  async function getPageBySlug(api, pageSlug) {
842
844
  return api.get(`pages/${encodeURIComponent(pageSlug)}`, CmsPageDetailsDtoSchema);
843
845
  }
846
+ var CheckoutMetadataValueSchema = z.lazy(
847
+ () => z.union([
848
+ z.string(),
849
+ z.number(),
850
+ z.boolean(),
851
+ z.null(),
852
+ z.array(CheckoutMetadataValueSchema),
853
+ z.record(z.string(), CheckoutMetadataValueSchema)
854
+ ])
855
+ );
844
856
  var CartBuyerParamsSchema = z.object({
845
- cartId: z.string().uuid(),
857
+ cartId: EntityIdSchema,
846
858
  email: z.string().email(),
847
859
  firstName: z.string().min(1),
848
860
  lastName: z.string().min(1),
@@ -868,7 +880,7 @@ var CartAddressWriteSchema = z.object({
868
880
  }).nullable().optional()
869
881
  });
870
882
  var CartAddressesParamsSchema = z.object({
871
- cartId: z.string().uuid(),
883
+ cartId: EntityIdSchema,
872
884
  shippingAddress: CartAddressWriteSchema,
873
885
  billingAddress: CartAddressWriteSchema
874
886
  });
@@ -901,7 +913,7 @@ var StorefrontOrderBumpSchema = z.object({
901
913
  description: z.string().nullable().optional()
902
914
  });
903
915
  var CartCheckoutReadParamsSchema = z.object({
904
- cartId: z.string().uuid()
916
+ cartId: EntityIdSchema
905
917
  });
906
918
  var CartCheckoutReadResponseSchema = z.object({
907
919
  cart: StorefrontCartSchema,
@@ -917,13 +929,13 @@ var CartCheckoutPaymentActionSchema = z.object({
917
929
  phoneNumber: z.string().nullable().optional(),
918
930
  accountHolder: z.string().nullable().optional(),
919
931
  qrImageUrl: z.string().nullable().optional()
920
- }).passthrough().nullable().optional(),
932
+ }).strip().nullable().optional(),
921
933
  url: z.string().nullable().optional(),
922
934
  html: z.string().nullable().optional(),
923
935
  clientSecret: z.string().nullable().optional(),
924
936
  qrCode: z.string().nullable().optional(),
925
937
  expiresAt: z.string().nullable().optional()
926
- }).passthrough();
938
+ }).strip();
927
939
  var CartCheckoutPaymentSchema = z.object({
928
940
  transactionId: z.string(),
929
941
  paymentMethodCode: z.string(),
@@ -934,7 +946,7 @@ var CartCheckoutPaymentSchema = z.object({
934
946
  actionType: z.string(),
935
947
  receiptUrl: z.string().nullable().optional(),
936
948
  action: CartCheckoutPaymentActionSchema.nullable().optional()
937
- }).passthrough();
949
+ }).strip();
938
950
  var CartCheckoutResponseSchema = z.object({
939
951
  publicKey: z.string().optional(),
940
952
  publishableKey: z.string().optional(),
@@ -946,9 +958,9 @@ var CartCheckoutResponseSchema = z.object({
946
958
  orderIds: z.array(z.coerce.string()).optional(),
947
959
  payment: CartCheckoutPaymentSchema.optional(),
948
960
  cart: StorefrontCartSchema.optional()
949
- }).passthrough();
961
+ }).strip();
950
962
  var CartCheckoutParamsSchema = z.object({
951
- cartId: z.string().uuid(),
963
+ cartId: EntityIdSchema,
952
964
  paymentMethodCode: z.string().min(1),
953
965
  externalRef: z.string().min(1),
954
966
  receiptUrl: z.string().min(1).optional()
@@ -967,8 +979,8 @@ var ShippingRateSchema = z.object({
967
979
  deliveryLocationName: z.string().nullable().optional(),
968
980
  estimatedDeliveryDays: z.number().nullable().optional(),
969
981
  serviceCode: z.string().nullable().optional(),
970
- metadata: z.record(z.string(), z.unknown()).optional()
971
- }).passthrough();
982
+ metadata: z.record(z.string(), CheckoutMetadataValueSchema).optional()
983
+ }).strip();
972
984
  var ShippingOptionGroupSchema = z.object({
973
985
  sellerId: z.string(),
974
986
  shippingProfileId: z.string().nullable().optional(),
@@ -976,16 +988,16 @@ var ShippingOptionGroupSchema = z.object({
976
988
  totalWeight: z.number().optional(),
977
989
  itemIds: z.array(z.string()).optional(),
978
990
  rates: z.array(ShippingRateSchema)
979
- }).passthrough();
991
+ }).strip();
980
992
  var ShippingOptionsResponseSchema = z.object({
981
993
  groups: z.array(ShippingOptionGroupSchema)
982
994
  });
983
995
  var GetShippingOptionsParamsSchema = z.object({
984
- cartId: z.string().uuid(),
996
+ cartId: EntityIdSchema,
985
997
  postalCode: z.string().min(1)
986
998
  });
987
999
  var PutShippingMethodParamsSchema = z.object({
988
- cartId: z.string().uuid(),
1000
+ cartId: EntityIdSchema,
989
1001
  rateId: z.string().min(1),
990
1002
  shippingMethodId: z.string().min(1),
991
1003
  serviceCode: z.string().nullable().optional(),
@@ -1001,7 +1013,7 @@ var CartPaymentReceiptResponseSchema = z.object({
1001
1013
  url: z.string()
1002
1014
  });
1003
1015
  var CartPromotionCodeParamsSchema = z.object({
1004
- cartId: z.string().uuid(),
1016
+ cartId: EntityIdSchema,
1005
1017
  code: z.string().min(1)
1006
1018
  });
1007
1019
 
@@ -1097,12 +1109,12 @@ var CountrySchema = z.object({
1097
1109
  var CountriesSchema = z.array(CountrySchema);
1098
1110
  var GeoDivisionTypeSchema = z.enum(["level1", "level2", "level3"]);
1099
1111
  var GeoDivisionSchema = z.object({
1100
- id: z.string().uuid(),
1112
+ id: EntityIdSchema,
1101
1113
  countryCode: z.string().length(2),
1102
1114
  type: GeoDivisionTypeSchema,
1103
1115
  code: z.string().min(1),
1104
1116
  name: z.string().min(1),
1105
- parentId: z.string().uuid().nullable(),
1117
+ parentId: NullableEntityIdSchema,
1106
1118
  source: z.string().min(1)
1107
1119
  }).strict();
1108
1120
  var DepartmentSchema = GeoDivisionSchema;