@atomic-solutions/woocommerce-api-client 0.3.0 → 0.4.0

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.
@@ -1,5 +1,5 @@
1
- import { W as WooCommerceConfig, a as WooCommerceClient } from '../types-CgTmmyIP.mjs';
2
- export { P as PaginatedResponse, R as ResponseOptions, V as ValidationMode, h as handleApiResponse, b as handlePaginatedApiResponse, i as isZodError, s as setupErrorInterceptor } from '../types-CgTmmyIP.mjs';
1
+ import { W as WooCommerceConfig, a as WooCommerceClient } from '../types-BF4_UUqp.mjs';
2
+ export { P as PaginatedResponse, R as ResponseOptions, V as ValidationMode, h as handleApiResponse, b as handlePaginatedApiResponse, i as isZodError, s as setupErrorInterceptor } from '../types-BF4_UUqp.mjs';
3
3
  import { AxiosInstance } from 'axios';
4
4
  import 'zod';
5
5
 
@@ -1,5 +1,5 @@
1
- import { W as WooCommerceConfig, a as WooCommerceClient } from '../types-CgTmmyIP.js';
2
- export { P as PaginatedResponse, R as ResponseOptions, V as ValidationMode, h as handleApiResponse, b as handlePaginatedApiResponse, i as isZodError, s as setupErrorInterceptor } from '../types-CgTmmyIP.js';
1
+ import { W as WooCommerceConfig, a as WooCommerceClient } from '../types-BF4_UUqp.js';
2
+ export { P as PaginatedResponse, R as ResponseOptions, V as ValidationMode, h as handleApiResponse, b as handlePaginatedApiResponse, i as isZodError, s as setupErrorInterceptor } from '../types-BF4_UUqp.js';
3
3
  import { AxiosInstance } from 'axios';
4
4
  import 'zod';
5
5
 
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { createClient } from './client/index.mjs';
2
- import { B as BaseError, e as BaseErrorOptions, f as ValidationReportableData, g as WooCommerceDataValidationErrorOptions } from './types-CgTmmyIP.mjs';
3
- export { A as AddToCartInput, j as Cart, k as CartAPI, C as CartHeadersAdapter, l as CartItem, m as CartItemImage, n as Checkout, o as CheckoutAPI, p as CheckoutInput, q as CouponInput, G as GetOrderInput, J as JwtTokenAdapter, O as OrderStatus, r as OrdersAPI, P as PaginatedResponse, t as Product, u as ProductCategory, v as ProductImage, w as ProductParams, x as ProductsAPI, y as RemoveCartItemInput, S as SelectShippingRateInput, z as StoreApiOrder, U as UpdateCartItemInput, D as UpdateCustomerInput, E as WooCommerceApiError, F as WooCommerceApiErrorOptions, a as WooCommerceClient, W as WooCommerceConfig, H as addToCartInputSchema, I as cartItemImageSchema, K as cartSchema, L as checkoutInputSchema, M as checkoutSchema, N as couponInputSchema, Q as productCategorySchema, T as productImageSchema, X as productSchema, Y as removeCartItemInputSchema, Z as searchParamsSchema, _ as selectShippingRateInputSchema, $ as storeApiOrderSchema, a0 as updateCartItemInputSchema, a1 as updateCustomerInputSchema } from './types-CgTmmyIP.mjs';
2
+ import { B as BaseError, e as BaseErrorOptions, f as ValidationReportableData, g as WooCommerceDataValidationErrorOptions } from './types-BF4_UUqp.mjs';
3
+ export { A as AddToCartInput, j as Cart, k as CartAPI, C as CartHeadersAdapter, l as CartItem, m as CartItemImage, n as Checkout, o as CheckoutAPI, p as CheckoutInput, q as CouponInput, G as GetOrderInput, J as JwtTokenAdapter, O as OrderStatus, r as OrdersAPI, P as PaginatedResponse, t as Product, u as ProductCategory, v as ProductImage, w as ProductParams, x as ProductsAPI, y as RemoveCartItemInput, z as SelectShippingRateInput, D as StoreApiOrder, U as UpdateCartItemInput, E as UpdateCustomerInput, F as WooCommerceApiError, H as WooCommerceApiErrorOptions, a as WooCommerceClient, W as WooCommerceConfig, I as addToCartInputSchema, K as cartItemImageSchema, L as cartSchema, M as checkoutInputSchema, N as checkoutSchema, Q as couponInputSchema, T as productCategorySchema, X as productImageSchema, Y as productSchema, Z as removeCartItemInputSchema, _ as searchParamsSchema, $ as selectShippingRateInputSchema, a0 as storeApiOrderSchema, a1 as updateCartItemInputSchema, a2 as updateCustomerInputSchema } from './types-BF4_UUqp.mjs';
4
4
  import * as zod from 'zod';
5
5
  import { ZodError, z } from 'zod';
6
6
  import 'axios';
@@ -96,8 +96,75 @@ declare const billingAddressSchemaMandatory: z.ZodObject<{
96
96
  phone: string;
97
97
  email: string;
98
98
  }>;
99
+ interface AddressFormMessages {
100
+ required?: string;
101
+ email?: string;
102
+ postcode?: string;
103
+ phone?: string;
104
+ }
105
+ declare const makeAddressFormSchema: (messages?: AddressFormMessages, postcodePattern?: RegExp) => z.ZodObject<{
106
+ first_name: z.ZodString;
107
+ last_name: z.ZodString;
108
+ company: z.ZodString;
109
+ address_1: z.ZodString;
110
+ address_2: z.ZodString;
111
+ city: z.ZodString;
112
+ postcode: z.ZodString;
113
+ phone: z.ZodString;
114
+ }, "strip", z.ZodTypeAny, {
115
+ first_name: string;
116
+ last_name: string;
117
+ company: string;
118
+ address_1: string;
119
+ address_2: string;
120
+ city: string;
121
+ postcode: string;
122
+ phone: string;
123
+ }, {
124
+ first_name: string;
125
+ last_name: string;
126
+ company: string;
127
+ address_1: string;
128
+ address_2: string;
129
+ city: string;
130
+ postcode: string;
131
+ phone: string;
132
+ }>;
133
+ declare const makeBillingAddressFormSchema: (messages?: AddressFormMessages, postcodePattern?: RegExp) => z.ZodObject<{
134
+ email: z.ZodString;
135
+ first_name: z.ZodString;
136
+ last_name: z.ZodString;
137
+ company: z.ZodString;
138
+ address_1: z.ZodString;
139
+ address_2: z.ZodString;
140
+ city: z.ZodString;
141
+ postcode: z.ZodString;
142
+ phone: z.ZodString;
143
+ }, "strip", z.ZodTypeAny, {
144
+ first_name: string;
145
+ last_name: string;
146
+ company: string;
147
+ address_1: string;
148
+ address_2: string;
149
+ city: string;
150
+ postcode: string;
151
+ phone: string;
152
+ email: string;
153
+ }, {
154
+ first_name: string;
155
+ last_name: string;
156
+ company: string;
157
+ address_1: string;
158
+ address_2: string;
159
+ city: string;
160
+ postcode: string;
161
+ phone: string;
162
+ email: string;
163
+ }>;
99
164
  type Address = z.infer<typeof addressSchema>;
100
165
  type BillingAddress = z.infer<typeof billingAddressSchemaMandatory>;
166
+ type AddressFormValues = z.infer<ReturnType<typeof makeAddressFormSchema>>;
167
+ type BillingAddressFormValues = z.infer<ReturnType<typeof makeBillingAddressFormSchema>>;
101
168
 
102
169
  declare const paginationParamsSchema: z.ZodObject<{
103
170
  page: z.ZodOptional<z.ZodNumber>;
@@ -831,44 +898,6 @@ declare const createCustomerSchema: z.ZodObject<Pick<{
831
898
  }>;
832
899
  }, "first_name" | "last_name" | "email" | "shipping"> & {
833
900
  loyalty_card_number: z.ZodOptional<z.ZodString>;
834
- billing: z.ZodOptional<z.ZodObject<{
835
- first_name: z.ZodDefault<z.ZodString>;
836
- last_name: z.ZodDefault<z.ZodString>;
837
- company: z.ZodDefault<z.ZodString>;
838
- address_1: z.ZodDefault<z.ZodString>;
839
- address_2: z.ZodDefault<z.ZodString>;
840
- city: z.ZodDefault<z.ZodString>;
841
- state: z.ZodDefault<z.ZodString>;
842
- postcode: z.ZodDefault<z.ZodString>;
843
- country: z.ZodDefault<z.ZodString>;
844
- phone: z.ZodDefault<z.ZodString>;
845
- } & {
846
- email: z.ZodString;
847
- }, "strip", z.ZodTypeAny, {
848
- first_name: string;
849
- last_name: string;
850
- company: string;
851
- address_1: string;
852
- address_2: string;
853
- city: string;
854
- state: string;
855
- postcode: string;
856
- country: string;
857
- phone: string;
858
- email: string;
859
- }, {
860
- email: string;
861
- first_name?: string | undefined;
862
- last_name?: string | undefined;
863
- company?: string | undefined;
864
- address_1?: string | undefined;
865
- address_2?: string | undefined;
866
- city?: string | undefined;
867
- state?: string | undefined;
868
- postcode?: string | undefined;
869
- country?: string | undefined;
870
- phone?: string | undefined;
871
- }>>;
872
901
  }, "strip", z.ZodTypeAny, {
873
902
  first_name: string;
874
903
  last_name: string;
@@ -886,19 +915,6 @@ declare const createCustomerSchema: z.ZodObject<Pick<{
886
915
  phone: string;
887
916
  email?: string | undefined;
888
917
  };
889
- billing?: {
890
- first_name: string;
891
- last_name: string;
892
- company: string;
893
- address_1: string;
894
- address_2: string;
895
- city: string;
896
- state: string;
897
- postcode: string;
898
- country: string;
899
- phone: string;
900
- email: string;
901
- } | undefined;
902
918
  loyalty_card_number?: string | undefined;
903
919
  }, {
904
920
  first_name: string;
@@ -917,19 +933,6 @@ declare const createCustomerSchema: z.ZodObject<Pick<{
917
933
  phone?: string | undefined;
918
934
  email?: string | undefined;
919
935
  };
920
- billing?: {
921
- email: string;
922
- first_name?: string | undefined;
923
- last_name?: string | undefined;
924
- company?: string | undefined;
925
- address_1?: string | undefined;
926
- address_2?: string | undefined;
927
- city?: string | undefined;
928
- state?: string | undefined;
929
- postcode?: string | undefined;
930
- country?: string | undefined;
931
- phone?: string | undefined;
932
- } | undefined;
933
936
  loyalty_card_number?: string | undefined;
934
937
  }>;
935
938
  declare const updateCustomerSchema: z.ZodObject<{
@@ -4357,44 +4360,6 @@ declare const schemas: {
4357
4360
  }>;
4358
4361
  }, "first_name" | "last_name" | "email" | "shipping"> & {
4359
4362
  loyalty_card_number: zod.ZodOptional<zod.ZodString>;
4360
- billing: zod.ZodOptional<zod.ZodObject<{
4361
- first_name: zod.ZodDefault<zod.ZodString>;
4362
- last_name: zod.ZodDefault<zod.ZodString>;
4363
- company: zod.ZodDefault<zod.ZodString>;
4364
- address_1: zod.ZodDefault<zod.ZodString>;
4365
- address_2: zod.ZodDefault<zod.ZodString>;
4366
- city: zod.ZodDefault<zod.ZodString>;
4367
- state: zod.ZodDefault<zod.ZodString>;
4368
- postcode: zod.ZodDefault<zod.ZodString>;
4369
- country: zod.ZodDefault<zod.ZodString>;
4370
- phone: zod.ZodDefault<zod.ZodString>;
4371
- } & {
4372
- email: zod.ZodString;
4373
- }, "strip", zod.ZodTypeAny, {
4374
- first_name: string;
4375
- last_name: string;
4376
- company: string;
4377
- address_1: string;
4378
- address_2: string;
4379
- city: string;
4380
- state: string;
4381
- postcode: string;
4382
- country: string;
4383
- phone: string;
4384
- email: string;
4385
- }, {
4386
- email: string;
4387
- first_name?: string | undefined;
4388
- last_name?: string | undefined;
4389
- company?: string | undefined;
4390
- address_1?: string | undefined;
4391
- address_2?: string | undefined;
4392
- city?: string | undefined;
4393
- state?: string | undefined;
4394
- postcode?: string | undefined;
4395
- country?: string | undefined;
4396
- phone?: string | undefined;
4397
- }>>;
4398
4363
  }, "strip", zod.ZodTypeAny, {
4399
4364
  first_name: string;
4400
4365
  last_name: string;
@@ -4412,19 +4377,6 @@ declare const schemas: {
4412
4377
  phone: string;
4413
4378
  email?: string | undefined;
4414
4379
  };
4415
- billing?: {
4416
- first_name: string;
4417
- last_name: string;
4418
- company: string;
4419
- address_1: string;
4420
- address_2: string;
4421
- city: string;
4422
- state: string;
4423
- postcode: string;
4424
- country: string;
4425
- phone: string;
4426
- email: string;
4427
- } | undefined;
4428
4380
  loyalty_card_number?: string | undefined;
4429
4381
  }, {
4430
4382
  first_name: string;
@@ -4443,19 +4395,6 @@ declare const schemas: {
4443
4395
  phone?: string | undefined;
4444
4396
  email?: string | undefined;
4445
4397
  };
4446
- billing?: {
4447
- email: string;
4448
- first_name?: string | undefined;
4449
- last_name?: string | undefined;
4450
- company?: string | undefined;
4451
- address_1?: string | undefined;
4452
- address_2?: string | undefined;
4453
- city?: string | undefined;
4454
- state?: string | undefined;
4455
- postcode?: string | undefined;
4456
- country?: string | undefined;
4457
- phone?: string | undefined;
4458
- } | undefined;
4459
4398
  loyalty_card_number?: string | undefined;
4460
4399
  }>;
4461
4400
  readonly update: zod.ZodObject<{
@@ -5168,4 +5107,4 @@ declare const schemas: {
5168
5107
  };
5169
5108
  };
5170
5109
 
5171
- export { type Address, type CategoryFilterParams as AdminCategoryFilterParams, type Product as AdminProduct, type ProductCategory as AdminProductCategory, type ProductFilterParams as AdminProductFilterParams, type BillingAddress, type Coupon, type CouponFilterParams, type Customer, type CustomerFilterParams, type Order, type OrderFilterParams, type PaginationMeta, type PaginationParams, type PaymentMethod, type PaymentMethodFilterParams, type TAppEnumsKeys, type WCBaseParams, type WCErrorResponse, type WCPaginationMeta, WooCommerceDataValidationError, WooCommerceDataValidationErrorOptions, addressSchema, categoryFilterSchema as adminCategoryFilterSchema, couponFilterSchema as adminCouponFilterSchema, couponSchema as adminCouponSchema, orderFilterSchema as adminOrderFilterSchema, orderSchema as adminOrderSchema, productCategorySchema as adminProductCategorySchema, productFilterSchema as adminProductFilterSchema, productSchema as adminProductSchema, billingAddressSchemaMandatory as billingAddressSchema, createCategorySchema, createCouponSchema, createCustomerSchema, createPaginatedSchema, customerFilterSchema, customerSchema, getAppEnumRaw, getAppEnumZod, paginationMetaSchema, paginationParamsSchema, paymentMethodFilterSchema, paymentMethodSchema, schemas, updateCustomerSchema, wcBaseParamsSchema, wcErrorResponseSchema, wcPaginationMetaSchema };
5110
+ export { type Address, type AddressFormMessages, type AddressFormValues, type CategoryFilterParams as AdminCategoryFilterParams, type Product as AdminProduct, type ProductCategory as AdminProductCategory, type ProductFilterParams as AdminProductFilterParams, type BillingAddress, type BillingAddressFormValues, type Coupon, type CouponFilterParams, type Customer, type CustomerFilterParams, type Order, type OrderFilterParams, type PaginationMeta, type PaginationParams, type PaymentMethod, type PaymentMethodFilterParams, type TAppEnumsKeys, type WCBaseParams, type WCErrorResponse, type WCPaginationMeta, WooCommerceDataValidationError, WooCommerceDataValidationErrorOptions, addressSchema, categoryFilterSchema as adminCategoryFilterSchema, couponFilterSchema as adminCouponFilterSchema, couponSchema as adminCouponSchema, orderFilterSchema as adminOrderFilterSchema, orderSchema as adminOrderSchema, productCategorySchema as adminProductCategorySchema, productFilterSchema as adminProductFilterSchema, productSchema as adminProductSchema, billingAddressSchemaMandatory as billingAddressSchema, createCategorySchema, createCouponSchema, createCustomerSchema, createPaginatedSchema, customerFilterSchema, customerSchema, getAppEnumRaw, getAppEnumZod, makeAddressFormSchema, makeBillingAddressFormSchema, paginationMetaSchema, paginationParamsSchema, paymentMethodFilterSchema, paymentMethodSchema, schemas, updateCustomerSchema, wcBaseParamsSchema, wcErrorResponseSchema, wcPaginationMetaSchema };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { createClient } from './client/index.js';
2
- import { B as BaseError, e as BaseErrorOptions, f as ValidationReportableData, g as WooCommerceDataValidationErrorOptions } from './types-CgTmmyIP.js';
3
- export { A as AddToCartInput, j as Cart, k as CartAPI, C as CartHeadersAdapter, l as CartItem, m as CartItemImage, n as Checkout, o as CheckoutAPI, p as CheckoutInput, q as CouponInput, G as GetOrderInput, J as JwtTokenAdapter, O as OrderStatus, r as OrdersAPI, P as PaginatedResponse, t as Product, u as ProductCategory, v as ProductImage, w as ProductParams, x as ProductsAPI, y as RemoveCartItemInput, S as SelectShippingRateInput, z as StoreApiOrder, U as UpdateCartItemInput, D as UpdateCustomerInput, E as WooCommerceApiError, F as WooCommerceApiErrorOptions, a as WooCommerceClient, W as WooCommerceConfig, H as addToCartInputSchema, I as cartItemImageSchema, K as cartSchema, L as checkoutInputSchema, M as checkoutSchema, N as couponInputSchema, Q as productCategorySchema, T as productImageSchema, X as productSchema, Y as removeCartItemInputSchema, Z as searchParamsSchema, _ as selectShippingRateInputSchema, $ as storeApiOrderSchema, a0 as updateCartItemInputSchema, a1 as updateCustomerInputSchema } from './types-CgTmmyIP.js';
2
+ import { B as BaseError, e as BaseErrorOptions, f as ValidationReportableData, g as WooCommerceDataValidationErrorOptions } from './types-BF4_UUqp.js';
3
+ export { A as AddToCartInput, j as Cart, k as CartAPI, C as CartHeadersAdapter, l as CartItem, m as CartItemImage, n as Checkout, o as CheckoutAPI, p as CheckoutInput, q as CouponInput, G as GetOrderInput, J as JwtTokenAdapter, O as OrderStatus, r as OrdersAPI, P as PaginatedResponse, t as Product, u as ProductCategory, v as ProductImage, w as ProductParams, x as ProductsAPI, y as RemoveCartItemInput, z as SelectShippingRateInput, D as StoreApiOrder, U as UpdateCartItemInput, E as UpdateCustomerInput, F as WooCommerceApiError, H as WooCommerceApiErrorOptions, a as WooCommerceClient, W as WooCommerceConfig, I as addToCartInputSchema, K as cartItemImageSchema, L as cartSchema, M as checkoutInputSchema, N as checkoutSchema, Q as couponInputSchema, T as productCategorySchema, X as productImageSchema, Y as productSchema, Z as removeCartItemInputSchema, _ as searchParamsSchema, $ as selectShippingRateInputSchema, a0 as storeApiOrderSchema, a1 as updateCartItemInputSchema, a2 as updateCustomerInputSchema } from './types-BF4_UUqp.js';
4
4
  import * as zod from 'zod';
5
5
  import { ZodError, z } from 'zod';
6
6
  import 'axios';
@@ -96,8 +96,75 @@ declare const billingAddressSchemaMandatory: z.ZodObject<{
96
96
  phone: string;
97
97
  email: string;
98
98
  }>;
99
+ interface AddressFormMessages {
100
+ required?: string;
101
+ email?: string;
102
+ postcode?: string;
103
+ phone?: string;
104
+ }
105
+ declare const makeAddressFormSchema: (messages?: AddressFormMessages, postcodePattern?: RegExp) => z.ZodObject<{
106
+ first_name: z.ZodString;
107
+ last_name: z.ZodString;
108
+ company: z.ZodString;
109
+ address_1: z.ZodString;
110
+ address_2: z.ZodString;
111
+ city: z.ZodString;
112
+ postcode: z.ZodString;
113
+ phone: z.ZodString;
114
+ }, "strip", z.ZodTypeAny, {
115
+ first_name: string;
116
+ last_name: string;
117
+ company: string;
118
+ address_1: string;
119
+ address_2: string;
120
+ city: string;
121
+ postcode: string;
122
+ phone: string;
123
+ }, {
124
+ first_name: string;
125
+ last_name: string;
126
+ company: string;
127
+ address_1: string;
128
+ address_2: string;
129
+ city: string;
130
+ postcode: string;
131
+ phone: string;
132
+ }>;
133
+ declare const makeBillingAddressFormSchema: (messages?: AddressFormMessages, postcodePattern?: RegExp) => z.ZodObject<{
134
+ email: z.ZodString;
135
+ first_name: z.ZodString;
136
+ last_name: z.ZodString;
137
+ company: z.ZodString;
138
+ address_1: z.ZodString;
139
+ address_2: z.ZodString;
140
+ city: z.ZodString;
141
+ postcode: z.ZodString;
142
+ phone: z.ZodString;
143
+ }, "strip", z.ZodTypeAny, {
144
+ first_name: string;
145
+ last_name: string;
146
+ company: string;
147
+ address_1: string;
148
+ address_2: string;
149
+ city: string;
150
+ postcode: string;
151
+ phone: string;
152
+ email: string;
153
+ }, {
154
+ first_name: string;
155
+ last_name: string;
156
+ company: string;
157
+ address_1: string;
158
+ address_2: string;
159
+ city: string;
160
+ postcode: string;
161
+ phone: string;
162
+ email: string;
163
+ }>;
99
164
  type Address = z.infer<typeof addressSchema>;
100
165
  type BillingAddress = z.infer<typeof billingAddressSchemaMandatory>;
166
+ type AddressFormValues = z.infer<ReturnType<typeof makeAddressFormSchema>>;
167
+ type BillingAddressFormValues = z.infer<ReturnType<typeof makeBillingAddressFormSchema>>;
101
168
 
102
169
  declare const paginationParamsSchema: z.ZodObject<{
103
170
  page: z.ZodOptional<z.ZodNumber>;
@@ -831,44 +898,6 @@ declare const createCustomerSchema: z.ZodObject<Pick<{
831
898
  }>;
832
899
  }, "first_name" | "last_name" | "email" | "shipping"> & {
833
900
  loyalty_card_number: z.ZodOptional<z.ZodString>;
834
- billing: z.ZodOptional<z.ZodObject<{
835
- first_name: z.ZodDefault<z.ZodString>;
836
- last_name: z.ZodDefault<z.ZodString>;
837
- company: z.ZodDefault<z.ZodString>;
838
- address_1: z.ZodDefault<z.ZodString>;
839
- address_2: z.ZodDefault<z.ZodString>;
840
- city: z.ZodDefault<z.ZodString>;
841
- state: z.ZodDefault<z.ZodString>;
842
- postcode: z.ZodDefault<z.ZodString>;
843
- country: z.ZodDefault<z.ZodString>;
844
- phone: z.ZodDefault<z.ZodString>;
845
- } & {
846
- email: z.ZodString;
847
- }, "strip", z.ZodTypeAny, {
848
- first_name: string;
849
- last_name: string;
850
- company: string;
851
- address_1: string;
852
- address_2: string;
853
- city: string;
854
- state: string;
855
- postcode: string;
856
- country: string;
857
- phone: string;
858
- email: string;
859
- }, {
860
- email: string;
861
- first_name?: string | undefined;
862
- last_name?: string | undefined;
863
- company?: string | undefined;
864
- address_1?: string | undefined;
865
- address_2?: string | undefined;
866
- city?: string | undefined;
867
- state?: string | undefined;
868
- postcode?: string | undefined;
869
- country?: string | undefined;
870
- phone?: string | undefined;
871
- }>>;
872
901
  }, "strip", z.ZodTypeAny, {
873
902
  first_name: string;
874
903
  last_name: string;
@@ -886,19 +915,6 @@ declare const createCustomerSchema: z.ZodObject<Pick<{
886
915
  phone: string;
887
916
  email?: string | undefined;
888
917
  };
889
- billing?: {
890
- first_name: string;
891
- last_name: string;
892
- company: string;
893
- address_1: string;
894
- address_2: string;
895
- city: string;
896
- state: string;
897
- postcode: string;
898
- country: string;
899
- phone: string;
900
- email: string;
901
- } | undefined;
902
918
  loyalty_card_number?: string | undefined;
903
919
  }, {
904
920
  first_name: string;
@@ -917,19 +933,6 @@ declare const createCustomerSchema: z.ZodObject<Pick<{
917
933
  phone?: string | undefined;
918
934
  email?: string | undefined;
919
935
  };
920
- billing?: {
921
- email: string;
922
- first_name?: string | undefined;
923
- last_name?: string | undefined;
924
- company?: string | undefined;
925
- address_1?: string | undefined;
926
- address_2?: string | undefined;
927
- city?: string | undefined;
928
- state?: string | undefined;
929
- postcode?: string | undefined;
930
- country?: string | undefined;
931
- phone?: string | undefined;
932
- } | undefined;
933
936
  loyalty_card_number?: string | undefined;
934
937
  }>;
935
938
  declare const updateCustomerSchema: z.ZodObject<{
@@ -4357,44 +4360,6 @@ declare const schemas: {
4357
4360
  }>;
4358
4361
  }, "first_name" | "last_name" | "email" | "shipping"> & {
4359
4362
  loyalty_card_number: zod.ZodOptional<zod.ZodString>;
4360
- billing: zod.ZodOptional<zod.ZodObject<{
4361
- first_name: zod.ZodDefault<zod.ZodString>;
4362
- last_name: zod.ZodDefault<zod.ZodString>;
4363
- company: zod.ZodDefault<zod.ZodString>;
4364
- address_1: zod.ZodDefault<zod.ZodString>;
4365
- address_2: zod.ZodDefault<zod.ZodString>;
4366
- city: zod.ZodDefault<zod.ZodString>;
4367
- state: zod.ZodDefault<zod.ZodString>;
4368
- postcode: zod.ZodDefault<zod.ZodString>;
4369
- country: zod.ZodDefault<zod.ZodString>;
4370
- phone: zod.ZodDefault<zod.ZodString>;
4371
- } & {
4372
- email: zod.ZodString;
4373
- }, "strip", zod.ZodTypeAny, {
4374
- first_name: string;
4375
- last_name: string;
4376
- company: string;
4377
- address_1: string;
4378
- address_2: string;
4379
- city: string;
4380
- state: string;
4381
- postcode: string;
4382
- country: string;
4383
- phone: string;
4384
- email: string;
4385
- }, {
4386
- email: string;
4387
- first_name?: string | undefined;
4388
- last_name?: string | undefined;
4389
- company?: string | undefined;
4390
- address_1?: string | undefined;
4391
- address_2?: string | undefined;
4392
- city?: string | undefined;
4393
- state?: string | undefined;
4394
- postcode?: string | undefined;
4395
- country?: string | undefined;
4396
- phone?: string | undefined;
4397
- }>>;
4398
4363
  }, "strip", zod.ZodTypeAny, {
4399
4364
  first_name: string;
4400
4365
  last_name: string;
@@ -4412,19 +4377,6 @@ declare const schemas: {
4412
4377
  phone: string;
4413
4378
  email?: string | undefined;
4414
4379
  };
4415
- billing?: {
4416
- first_name: string;
4417
- last_name: string;
4418
- company: string;
4419
- address_1: string;
4420
- address_2: string;
4421
- city: string;
4422
- state: string;
4423
- postcode: string;
4424
- country: string;
4425
- phone: string;
4426
- email: string;
4427
- } | undefined;
4428
4380
  loyalty_card_number?: string | undefined;
4429
4381
  }, {
4430
4382
  first_name: string;
@@ -4443,19 +4395,6 @@ declare const schemas: {
4443
4395
  phone?: string | undefined;
4444
4396
  email?: string | undefined;
4445
4397
  };
4446
- billing?: {
4447
- email: string;
4448
- first_name?: string | undefined;
4449
- last_name?: string | undefined;
4450
- company?: string | undefined;
4451
- address_1?: string | undefined;
4452
- address_2?: string | undefined;
4453
- city?: string | undefined;
4454
- state?: string | undefined;
4455
- postcode?: string | undefined;
4456
- country?: string | undefined;
4457
- phone?: string | undefined;
4458
- } | undefined;
4459
4398
  loyalty_card_number?: string | undefined;
4460
4399
  }>;
4461
4400
  readonly update: zod.ZodObject<{
@@ -5168,4 +5107,4 @@ declare const schemas: {
5168
5107
  };
5169
5108
  };
5170
5109
 
5171
- export { type Address, type CategoryFilterParams as AdminCategoryFilterParams, type Product as AdminProduct, type ProductCategory as AdminProductCategory, type ProductFilterParams as AdminProductFilterParams, type BillingAddress, type Coupon, type CouponFilterParams, type Customer, type CustomerFilterParams, type Order, type OrderFilterParams, type PaginationMeta, type PaginationParams, type PaymentMethod, type PaymentMethodFilterParams, type TAppEnumsKeys, type WCBaseParams, type WCErrorResponse, type WCPaginationMeta, WooCommerceDataValidationError, WooCommerceDataValidationErrorOptions, addressSchema, categoryFilterSchema as adminCategoryFilterSchema, couponFilterSchema as adminCouponFilterSchema, couponSchema as adminCouponSchema, orderFilterSchema as adminOrderFilterSchema, orderSchema as adminOrderSchema, productCategorySchema as adminProductCategorySchema, productFilterSchema as adminProductFilterSchema, productSchema as adminProductSchema, billingAddressSchemaMandatory as billingAddressSchema, createCategorySchema, createCouponSchema, createCustomerSchema, createPaginatedSchema, customerFilterSchema, customerSchema, getAppEnumRaw, getAppEnumZod, paginationMetaSchema, paginationParamsSchema, paymentMethodFilterSchema, paymentMethodSchema, schemas, updateCustomerSchema, wcBaseParamsSchema, wcErrorResponseSchema, wcPaginationMetaSchema };
5110
+ export { type Address, type AddressFormMessages, type AddressFormValues, type CategoryFilterParams as AdminCategoryFilterParams, type Product as AdminProduct, type ProductCategory as AdminProductCategory, type ProductFilterParams as AdminProductFilterParams, type BillingAddress, type BillingAddressFormValues, type Coupon, type CouponFilterParams, type Customer, type CustomerFilterParams, type Order, type OrderFilterParams, type PaginationMeta, type PaginationParams, type PaymentMethod, type PaymentMethodFilterParams, type TAppEnumsKeys, type WCBaseParams, type WCErrorResponse, type WCPaginationMeta, WooCommerceDataValidationError, WooCommerceDataValidationErrorOptions, addressSchema, categoryFilterSchema as adminCategoryFilterSchema, couponFilterSchema as adminCouponFilterSchema, couponSchema as adminCouponSchema, orderFilterSchema as adminOrderFilterSchema, orderSchema as adminOrderSchema, productCategorySchema as adminProductCategorySchema, productFilterSchema as adminProductFilterSchema, productSchema as adminProductSchema, billingAddressSchemaMandatory as billingAddressSchema, createCategorySchema, createCouponSchema, createCustomerSchema, createPaginatedSchema, customerFilterSchema, customerSchema, getAppEnumRaw, getAppEnumZod, makeAddressFormSchema, makeBillingAddressFormSchema, paginationMetaSchema, paginationParamsSchema, paymentMethodFilterSchema, paymentMethodSchema, schemas, updateCustomerSchema, wcBaseParamsSchema, wcErrorResponseSchema, wcPaginationMetaSchema };
package/dist/index.js CHANGED
@@ -691,6 +691,33 @@ var billingAddressSchemaNonMandatory = addressSchemaNonMandatory.extend({
691
691
  /** Email address (can be null for guest carts) */
692
692
  email: zod.z.string().nullable()
693
693
  });
694
+ var phoneFormatRegex = /^[+\d][\d\s\-/()]{5,}$/;
695
+ var defaultAddressFormMessages = {
696
+ required: "This field is required",
697
+ email: "Valid email is required",
698
+ postcode: "Postal code is not valid",
699
+ phone: "Invalid phone number"
700
+ };
701
+ var defaultPostcodePattern = /^\d+$/;
702
+ var resolveAddressFormMessages = (messages) => ({ ...defaultAddressFormMessages, ...messages });
703
+ var buildAddressFormShape = (m, postcodePattern) => ({
704
+ first_name: zod.z.string().trim().min(1, m.required),
705
+ last_name: zod.z.string().trim().min(1, m.required),
706
+ company: zod.z.string().trim(),
707
+ address_1: zod.z.string().trim().min(1, m.required),
708
+ address_2: zod.z.string().trim(),
709
+ city: zod.z.string().trim().min(1, m.required),
710
+ postcode: zod.z.string().trim().min(1, m.required).regex(postcodePattern, m.postcode),
711
+ phone: zod.z.string().trim().min(1, m.required).regex(phoneFormatRegex, m.phone)
712
+ });
713
+ var makeAddressFormSchema = (messages = {}, postcodePattern = defaultPostcodePattern) => zod.z.object(buildAddressFormShape(resolveAddressFormMessages(messages), postcodePattern));
714
+ var makeBillingAddressFormSchema = (messages = {}, postcodePattern = defaultPostcodePattern) => {
715
+ const m = resolveAddressFormMessages(messages);
716
+ return zod.z.object({
717
+ ...buildAddressFormShape(m, postcodePattern),
718
+ email: zod.z.string().trim().min(1, m.required).email(m.email)
719
+ });
720
+ };
694
721
  var moneySchema = zod.z.object({
695
722
  /** Currency code (e.g., 'USD', 'EUR', 'BAM') */
696
723
  currency_code: zod.z.string(),
@@ -1945,8 +1972,7 @@ var createCustomerSchema = customerSchema.pick({
1945
1972
  last_name: true,
1946
1973
  shipping: true
1947
1974
  }).extend({
1948
- loyalty_card_number: zod.z.string().optional(),
1949
- billing: customerSchema.shape.billing.optional()
1975
+ loyalty_card_number: zod.z.string().optional()
1950
1976
  });
1951
1977
  var updateCustomerSchema = createCustomerSchema.merge(
1952
1978
  customerSchema.pick({
@@ -2167,6 +2193,8 @@ exports.customerFilterSchema = customerFilterSchema;
2167
2193
  exports.customerSchema = customerSchema;
2168
2194
  exports.getAppEnumRaw = getAppEnumRaw;
2169
2195
  exports.getAppEnumZod = getAppEnumZod;
2196
+ exports.makeAddressFormSchema = makeAddressFormSchema;
2197
+ exports.makeBillingAddressFormSchema = makeBillingAddressFormSchema;
2170
2198
  exports.paginationMetaSchema = paginationMetaSchema;
2171
2199
  exports.paginationParamsSchema = paginationParamsSchema;
2172
2200
  exports.paymentMethodFilterSchema = paymentMethodFilterSchema;