@atomic-solutions/woocommerce-api-client 0.1.5 → 0.3.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.
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-B7CKE1bj.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 OrdersAPI, P as PaginatedResponse, r as Product, t as ProductCategory, u as ProductImage, v as ProductParams, w as ProductsAPI, x as RemoveCartItemInput, S as SelectShippingRateInput, y as StoreApiOrder, U as UpdateCartItemInput, z as UpdateCustomerInput, D as WooCommerceApiError, E as WooCommerceApiErrorOptions, a as WooCommerceClient, W as WooCommerceConfig, F as addToCartInputSchema, H as cartItemImageSchema, I as cartSchema, K as checkoutInputSchema, L as checkoutSchema, M as couponInputSchema, N as productCategorySchema, Q as productImageSchema, T as productSchema, X as removeCartItemInputSchema, Y as searchParamsSchema, Z as selectShippingRateInputSchema, _ as storeApiOrderSchema, $ as updateCartItemInputSchema, a0 as updateCustomerInputSchema } from './types-B7CKE1bj.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';
4
4
  import * as zod from 'zod';
5
5
  import { ZodError, z } from 'zod';
6
6
  import 'axios';
@@ -831,6 +831,44 @@ declare const createCustomerSchema: z.ZodObject<Pick<{
831
831
  }>;
832
832
  }, "first_name" | "last_name" | "email" | "shipping"> & {
833
833
  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
+ }>>;
834
872
  }, "strip", z.ZodTypeAny, {
835
873
  first_name: string;
836
874
  last_name: string;
@@ -848,6 +886,19 @@ declare const createCustomerSchema: z.ZodObject<Pick<{
848
886
  phone: string;
849
887
  email?: string | undefined;
850
888
  };
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;
851
902
  loyalty_card_number?: string | undefined;
852
903
  }, {
853
904
  first_name: string;
@@ -866,6 +917,19 @@ declare const createCustomerSchema: z.ZodObject<Pick<{
866
917
  phone?: string | undefined;
867
918
  email?: string | undefined;
868
919
  };
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;
869
933
  loyalty_card_number?: string | undefined;
870
934
  }>;
871
935
  declare const updateCustomerSchema: z.ZodObject<{
@@ -4293,6 +4357,44 @@ declare const schemas: {
4293
4357
  }>;
4294
4358
  }, "first_name" | "last_name" | "email" | "shipping"> & {
4295
4359
  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
+ }>>;
4296
4398
  }, "strip", zod.ZodTypeAny, {
4297
4399
  first_name: string;
4298
4400
  last_name: string;
@@ -4310,6 +4412,19 @@ declare const schemas: {
4310
4412
  phone: string;
4311
4413
  email?: string | undefined;
4312
4414
  };
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;
4313
4428
  loyalty_card_number?: string | undefined;
4314
4429
  }, {
4315
4430
  first_name: string;
@@ -4328,6 +4443,19 @@ declare const schemas: {
4328
4443
  phone?: string | undefined;
4329
4444
  email?: string | undefined;
4330
4445
  };
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;
4331
4459
  loyalty_card_number?: string | undefined;
4332
4460
  }>;
4333
4461
  readonly update: zod.ZodObject<{
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-B7CKE1bj.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 OrdersAPI, P as PaginatedResponse, r as Product, t as ProductCategory, u as ProductImage, v as ProductParams, w as ProductsAPI, x as RemoveCartItemInput, S as SelectShippingRateInput, y as StoreApiOrder, U as UpdateCartItemInput, z as UpdateCustomerInput, D as WooCommerceApiError, E as WooCommerceApiErrorOptions, a as WooCommerceClient, W as WooCommerceConfig, F as addToCartInputSchema, H as cartItemImageSchema, I as cartSchema, K as checkoutInputSchema, L as checkoutSchema, M as couponInputSchema, N as productCategorySchema, Q as productImageSchema, T as productSchema, X as removeCartItemInputSchema, Y as searchParamsSchema, Z as selectShippingRateInputSchema, _ as storeApiOrderSchema, $ as updateCartItemInputSchema, a0 as updateCustomerInputSchema } from './types-B7CKE1bj.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';
4
4
  import * as zod from 'zod';
5
5
  import { ZodError, z } from 'zod';
6
6
  import 'axios';
@@ -831,6 +831,44 @@ declare const createCustomerSchema: z.ZodObject<Pick<{
831
831
  }>;
832
832
  }, "first_name" | "last_name" | "email" | "shipping"> & {
833
833
  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
+ }>>;
834
872
  }, "strip", z.ZodTypeAny, {
835
873
  first_name: string;
836
874
  last_name: string;
@@ -848,6 +886,19 @@ declare const createCustomerSchema: z.ZodObject<Pick<{
848
886
  phone: string;
849
887
  email?: string | undefined;
850
888
  };
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;
851
902
  loyalty_card_number?: string | undefined;
852
903
  }, {
853
904
  first_name: string;
@@ -866,6 +917,19 @@ declare const createCustomerSchema: z.ZodObject<Pick<{
866
917
  phone?: string | undefined;
867
918
  email?: string | undefined;
868
919
  };
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;
869
933
  loyalty_card_number?: string | undefined;
870
934
  }>;
871
935
  declare const updateCustomerSchema: z.ZodObject<{
@@ -4293,6 +4357,44 @@ declare const schemas: {
4293
4357
  }>;
4294
4358
  }, "first_name" | "last_name" | "email" | "shipping"> & {
4295
4359
  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
+ }>>;
4296
4398
  }, "strip", zod.ZodTypeAny, {
4297
4399
  first_name: string;
4298
4400
  last_name: string;
@@ -4310,6 +4412,19 @@ declare const schemas: {
4310
4412
  phone: string;
4311
4413
  email?: string | undefined;
4312
4414
  };
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;
4313
4428
  loyalty_card_number?: string | undefined;
4314
4429
  }, {
4315
4430
  first_name: string;
@@ -4328,6 +4443,19 @@ declare const schemas: {
4328
4443
  phone?: string | undefined;
4329
4444
  email?: string | undefined;
4330
4445
  };
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;
4331
4459
  loyalty_card_number?: string | undefined;
4332
4460
  }>;
4333
4461
  readonly update: zod.ZodObject<{
package/dist/index.js CHANGED
@@ -438,7 +438,14 @@ var error = (...args) => {
438
438
  // src/http/interceptors/request.ts
439
439
  var requiresAuth = (url) => {
440
440
  if (!url) return false;
441
- const authEndpoints = ["/jwt-auth/", "/customers/me", "/wp/v2/users/me"];
441
+ const authEndpoints = [
442
+ "/jwt-auth/",
443
+ "/customers/me",
444
+ "/wp/v2/users/me",
445
+ // Store API non-cart endpoints: inject JWT when available so authenticated
446
+ // users can access their own resources (e.g. orders, personalised product data)
447
+ "/wc/store/v1/order"
448
+ ];
442
449
  return authEndpoints.some((endpoint) => url.includes(endpoint));
443
450
  };
444
451
  var requiresCartAuth = (url) => {
@@ -1938,7 +1945,8 @@ var createCustomerSchema = customerSchema.pick({
1938
1945
  last_name: true,
1939
1946
  shipping: true
1940
1947
  }).extend({
1941
- loyalty_card_number: zod.z.string().optional()
1948
+ loyalty_card_number: zod.z.string().optional(),
1949
+ billing: customerSchema.shape.billing.optional()
1942
1950
  });
1943
1951
  var updateCustomerSchema = createCustomerSchema.merge(
1944
1952
  customerSchema.pick({