@ecomiq/core 0.1.7 → 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.
package/dist/index.d.cts CHANGED
@@ -12,7 +12,7 @@ export { ProductAutocompleteParamsSchema, ProductSuggestion, ProductSuggestionSc
12
12
  import { AddCartItemParams, CreateCartParams, GetCartParams, RemoveCartItemParams, UpdateCartItemQuantityParams } from './models/storefront-cart.cjs';
13
13
  export { AddCartItemParamsSchema, CartItemModifierSchema, CreateCartParamsSchema, GetCartParamsSchema, RemoveCartItemParamsSchema, StorefrontAddress, StorefrontAddressSchema, StorefrontCart, StorefrontCartBundleItem, StorefrontCartBundleItemSchema, StorefrontCartItem, StorefrontCartItemSchema, StorefrontCartSchema, StorefrontCartShippingMethod, StorefrontCartShippingMethodSchema, StorefrontCartStatusSchema, StorefrontCartTotals, StorefrontCartTotalsSchema, UpdateCartItemQuantityParamsSchema, cartVariantIdFromProduct } from './models/storefront-cart.cjs';
14
14
  import { CartPromotionCodeParams, CartCheckoutParams, CartCheckoutResponse, CartCheckoutReadParams, CartCheckoutReadResponse, GetShippingOptionsParams, ShippingOptionsResponse, CartAddressesParams, CartBuyerParams, PutShippingMethodParams, UploadPaymentReceiptParams, CartPaymentReceiptResponse } from './models/storefront-checkout.cjs';
15
- export { CartAddressWrite, CartAddressWriteSchema, CartAddressesParamsSchema, CartBuyerParamsSchema, CartCheckoutParamsSchema, CartCheckoutPayment, CartCheckoutPaymentActionSchema, CartCheckoutPaymentSchema, CartCheckoutReadParamsSchema, CartCheckoutReadResponseSchema, CartCheckoutResponseSchema, CartPaymentMethod, CartPaymentMethodSchema, CartPaymentReceiptResponseSchema, CartPromotionCodeParamsSchema, GetShippingOptionsParamsSchema, PutShippingMethodParamsSchema, ShippingOptionGroup, ShippingOptionGroupSchema, ShippingOptionsResponseSchema, ShippingRate, ShippingRateSchema, StorefrontOrderBump, StorefrontOrderBumpSchema } from './models/storefront-checkout.cjs';
15
+ export { CartAddressWrite, CartAddressWriteSchema, CartAddressesParamsSchema, CartBuyerParamsSchema, CartCheckoutParamsSchema, CartCheckoutPayment, CartCheckoutPaymentActionSchema, CartCheckoutPaymentSchema, CartCheckoutReadParamsSchema, CartCheckoutReadResponseSchema, CartCheckoutResponseSchema, CartPaymentMethod, CartPaymentMethodSchema, CartPaymentReceiptResponseSchema, CartPromotionCodeParamsSchema, CheckoutMetadataValue, CheckoutMetadataValueSchema, GetShippingOptionsParamsSchema, PutShippingMethodParamsSchema, ShippingOptionGroup, ShippingOptionGroupSchema, ShippingOptionsResponseSchema, ShippingRate, ShippingRateSchema, StorefrontOrderBump, StorefrontOrderBumpSchema } from './models/storefront-checkout.cjs';
16
16
  import { CreateProductReviewParams, ListProductReviewsParams } from './models/storefront-reviews.cjs';
17
17
  export { CreateProductReviewParamsSchema, ListProductReviewsParamsSchema, StorefrontReview, StorefrontReviewSchema, StorefrontReviews, StorefrontReviewsSchema } from './models/storefront-reviews.cjs';
18
18
  import { Countries, GetDepartmentsParams, Departments, GetDistrictsParams, Districts, GetProvincesParams, Provinces } from './models/geo.cjs';
package/dist/index.d.ts CHANGED
@@ -12,7 +12,7 @@ export { ProductAutocompleteParamsSchema, ProductSuggestion, ProductSuggestionSc
12
12
  import { AddCartItemParams, CreateCartParams, GetCartParams, RemoveCartItemParams, UpdateCartItemQuantityParams } from './models/storefront-cart.js';
13
13
  export { AddCartItemParamsSchema, CartItemModifierSchema, CreateCartParamsSchema, GetCartParamsSchema, RemoveCartItemParamsSchema, StorefrontAddress, StorefrontAddressSchema, StorefrontCart, StorefrontCartBundleItem, StorefrontCartBundleItemSchema, StorefrontCartItem, StorefrontCartItemSchema, StorefrontCartSchema, StorefrontCartShippingMethod, StorefrontCartShippingMethodSchema, StorefrontCartStatusSchema, StorefrontCartTotals, StorefrontCartTotalsSchema, UpdateCartItemQuantityParamsSchema, cartVariantIdFromProduct } from './models/storefront-cart.js';
14
14
  import { CartPromotionCodeParams, CartCheckoutParams, CartCheckoutResponse, CartCheckoutReadParams, CartCheckoutReadResponse, GetShippingOptionsParams, ShippingOptionsResponse, CartAddressesParams, CartBuyerParams, PutShippingMethodParams, UploadPaymentReceiptParams, CartPaymentReceiptResponse } from './models/storefront-checkout.js';
15
- export { CartAddressWrite, CartAddressWriteSchema, CartAddressesParamsSchema, CartBuyerParamsSchema, CartCheckoutParamsSchema, CartCheckoutPayment, CartCheckoutPaymentActionSchema, CartCheckoutPaymentSchema, CartCheckoutReadParamsSchema, CartCheckoutReadResponseSchema, CartCheckoutResponseSchema, CartPaymentMethod, CartPaymentMethodSchema, CartPaymentReceiptResponseSchema, CartPromotionCodeParamsSchema, GetShippingOptionsParamsSchema, PutShippingMethodParamsSchema, ShippingOptionGroup, ShippingOptionGroupSchema, ShippingOptionsResponseSchema, ShippingRate, ShippingRateSchema, StorefrontOrderBump, StorefrontOrderBumpSchema } from './models/storefront-checkout.js';
15
+ export { CartAddressWrite, CartAddressWriteSchema, CartAddressesParamsSchema, CartBuyerParamsSchema, CartCheckoutParamsSchema, CartCheckoutPayment, CartCheckoutPaymentActionSchema, CartCheckoutPaymentSchema, CartCheckoutReadParamsSchema, CartCheckoutReadResponseSchema, CartCheckoutResponseSchema, CartPaymentMethod, CartPaymentMethodSchema, CartPaymentReceiptResponseSchema, CartPromotionCodeParamsSchema, CheckoutMetadataValue, CheckoutMetadataValueSchema, GetShippingOptionsParamsSchema, PutShippingMethodParamsSchema, ShippingOptionGroup, ShippingOptionGroupSchema, ShippingOptionsResponseSchema, ShippingRate, ShippingRateSchema, StorefrontOrderBump, StorefrontOrderBumpSchema } from './models/storefront-checkout.js';
16
16
  import { CreateProductReviewParams, ListProductReviewsParams } from './models/storefront-reviews.js';
17
17
  export { CreateProductReviewParamsSchema, ListProductReviewsParamsSchema, StorefrontReview, StorefrontReviewSchema, StorefrontReviews, StorefrontReviewsSchema } from './models/storefront-reviews.js';
18
18
  import { Countries, GetDepartmentsParams, Departments, GetDistrictsParams, Districts, GetProvincesParams, Provinces } from './models/geo.js';
package/dist/index.js CHANGED
@@ -104,8 +104,16 @@ 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
+ ]);
111
+ var NullableEntityIdSchema = EntityIdSchema.nullable();
112
+ var OptionalEntityIdSchema = EntityIdSchema.optional();
113
+
114
+ // src/models/collections.ts
107
115
  var CollectionSchema = z.object({
108
- id: z.number(),
116
+ id: EntityIdSchema,
109
117
  slug: z.string(),
110
118
  name: z.string(),
111
119
  description: z.string().nullable().optional(),
@@ -114,14 +122,6 @@ var CollectionSchema = z.object({
114
122
  productCount: z.number().optional()
115
123
  });
116
124
  var CollectionsSchema = z.array(CollectionSchema);
117
- var EntityIdSchema = z.union([
118
- z.string().uuid(),
119
- z.string().regex(/^\d+$/, "Expected numeric id")
120
- ]);
121
- var NullableEntityIdSchema = EntityIdSchema.nullable();
122
- var OptionalEntityIdSchema = EntityIdSchema.optional();
123
-
124
- // src/models/products.ts
125
125
  var ProductPublicIdSchema = z.union([
126
126
  z.string().regex(/^[1-9]\d*$/),
127
127
  z.number().int().safe().positive()
@@ -878,6 +878,16 @@ async function getCollectionBySlug(api, collectionSlug) {
878
878
  async function getPageBySlug(api, pageSlug) {
879
879
  return api.get(`pages/${encodeURIComponent(pageSlug)}`, CmsPageDetailsDtoSchema);
880
880
  }
881
+ var CheckoutMetadataValueSchema = z.lazy(
882
+ () => z.union([
883
+ z.string(),
884
+ z.number(),
885
+ z.boolean(),
886
+ z.null(),
887
+ z.array(CheckoutMetadataValueSchema),
888
+ z.record(z.string(), CheckoutMetadataValueSchema)
889
+ ])
890
+ );
881
891
  var CartBuyerParamsSchema = z.object({
882
892
  cartId: EntityIdSchema,
883
893
  email: z.string().email(),
@@ -954,13 +964,13 @@ var CartCheckoutPaymentActionSchema = z.object({
954
964
  phoneNumber: z.string().nullable().optional(),
955
965
  accountHolder: z.string().nullable().optional(),
956
966
  qrImageUrl: z.string().nullable().optional()
957
- }).passthrough().nullable().optional(),
967
+ }).strip().nullable().optional(),
958
968
  url: z.string().nullable().optional(),
959
969
  html: z.string().nullable().optional(),
960
970
  clientSecret: z.string().nullable().optional(),
961
971
  qrCode: z.string().nullable().optional(),
962
972
  expiresAt: z.string().nullable().optional()
963
- }).passthrough();
973
+ }).strip();
964
974
  var CartCheckoutPaymentSchema = z.object({
965
975
  transactionId: z.string(),
966
976
  paymentMethodCode: z.string(),
@@ -971,7 +981,7 @@ var CartCheckoutPaymentSchema = z.object({
971
981
  actionType: z.string(),
972
982
  receiptUrl: z.string().nullable().optional(),
973
983
  action: CartCheckoutPaymentActionSchema.nullable().optional()
974
- }).passthrough();
984
+ }).strip();
975
985
  var CartCheckoutResponseSchema = z.object({
976
986
  publicKey: z.string().optional(),
977
987
  publishableKey: z.string().optional(),
@@ -983,7 +993,7 @@ var CartCheckoutResponseSchema = z.object({
983
993
  orderIds: z.array(z.coerce.string()).optional(),
984
994
  payment: CartCheckoutPaymentSchema.optional(),
985
995
  cart: StorefrontCartSchema.optional()
986
- }).passthrough();
996
+ }).strip();
987
997
  var CartCheckoutParamsSchema = z.object({
988
998
  cartId: EntityIdSchema,
989
999
  paymentMethodCode: z.string().min(1),
@@ -1004,8 +1014,8 @@ var ShippingRateSchema = z.object({
1004
1014
  deliveryLocationName: z.string().nullable().optional(),
1005
1015
  estimatedDeliveryDays: z.number().nullable().optional(),
1006
1016
  serviceCode: z.string().nullable().optional(),
1007
- metadata: z.record(z.string(), z.unknown()).optional()
1008
- }).passthrough();
1017
+ metadata: z.record(z.string(), CheckoutMetadataValueSchema).optional()
1018
+ }).strip();
1009
1019
  var ShippingOptionGroupSchema = z.object({
1010
1020
  sellerId: z.string(),
1011
1021
  shippingProfileId: z.string().nullable().optional(),
@@ -1013,7 +1023,7 @@ var ShippingOptionGroupSchema = z.object({
1013
1023
  totalWeight: z.number().optional(),
1014
1024
  itemIds: z.array(z.string()).optional(),
1015
1025
  rates: z.array(ShippingRateSchema)
1016
- }).passthrough();
1026
+ }).strip();
1017
1027
  var ShippingOptionsResponseSchema = z.object({
1018
1028
  groups: z.array(ShippingOptionGroupSchema)
1019
1029
  });
@@ -1895,6 +1905,6 @@ function stripHtml(html) {
1895
1905
  return html.replace(/<br\s*\/?>/gi, " ").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
1896
1906
  }
1897
1907
 
1898
- export { AddCartItemParamsSchema, ApiError, BundleItemSchema, CartAddressWriteSchema, CartAddressesParamsSchema, CartBuyerParamsSchema, CartCheckoutParamsSchema, CartCheckoutPaymentActionSchema, CartCheckoutPaymentSchema, CartCheckoutReadParamsSchema, CartCheckoutReadResponseSchema, CartCheckoutResponseSchema, CartItemModifierSchema, CartPaymentMethodSchema, CartPaymentReceiptResponseSchema, CartPromotionCodeParamsSchema, 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 };
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 };
1899
1909
  //# sourceMappingURL=index.js.map
1900
1910
  //# sourceMappingURL=index.js.map