@atomic-solutions/woocommerce-api-client 0.5.1 → 0.6.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-9I6oS_83.mjs';
2
- export { P as PaginatedResponse, R as ResponseOptions, V as ValidationMode, h as handleApiData, b as handleApiResponse, c as handlePaginatedApiResponse, i as isZodError, s as setupErrorInterceptor } from '../types-9I6oS_83.mjs';
1
+ import { W as WooCommerceConfig, a as WooCommerceClient } from '../types-Cbf1-EhK.mjs';
2
+ export { P as PaginatedResponse, R as ResponseOptions, V as ValidationMode, h as handleApiData, b as handleApiResponse, c as handlePaginatedApiResponse, i as isZodError, s as setupErrorInterceptor } from '../types-Cbf1-EhK.mjs';
3
3
  import { AxiosInstance } from 'axios';
4
4
  import '@atomic-solutions/errors';
5
5
  import 'zod';
@@ -1,5 +1,5 @@
1
- import { W as WooCommerceConfig, a as WooCommerceClient } from '../types-9I6oS_83.js';
2
- export { P as PaginatedResponse, R as ResponseOptions, V as ValidationMode, h as handleApiData, b as handleApiResponse, c as handlePaginatedApiResponse, i as isZodError, s as setupErrorInterceptor } from '../types-9I6oS_83.js';
1
+ import { W as WooCommerceConfig, a as WooCommerceClient } from '../types-Cbf1-EhK.js';
2
+ export { P as PaginatedResponse, R as ResponseOptions, V as ValidationMode, h as handleApiData, b as handleApiResponse, c as handlePaginatedApiResponse, i as isZodError, s as setupErrorInterceptor } from '../types-Cbf1-EhK.js';
3
3
  import { AxiosInstance } from 'axios';
4
4
  import '@atomic-solutions/errors';
5
5
  import 'zod';
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { createClient } from './client/index.mjs';
2
- import { f as WooCommerceApiErrorCode, B as BaseErrorOptions, g as BaseReportableData, j as ValidationReportableData, k as WooCommerceDataValidationErrorOptions } from './types-9I6oS_83.mjs';
3
- export { A as AddItemsInput, l as AddItemsResult, m as AddToCartInput, n as BatchResponse, o as Cart, p as CartAPI, C as CartHeadersAdapter, q as CartItem, r as CartItemImage, t as Checkout, u as CheckoutAPI, v as CheckoutInput, w as CouponInput, G as GetOrderInput, J as JwtTokenAdapter, O as OrderStatus, x as OrdersAPI, P as PaginatedResponse, y as Product, z as ProductCategory, D as ProductImage, E as ProductParams, F as ProductsAPI, H as RemoveCartItemInput, I as SelectShippingRateInput, K as StoreApiOrder, U as UpdateCartItemInput, L as UpdateCustomerInput, M as WooCommerceApiError, N as WooCommerceApiErrorOptions, a as WooCommerceClient, W as WooCommerceConfig, Q as addItemsInputSchema, T as addToCartInputSchema, X as batchResponseSchema, Y as cartItemImageSchema, Z as cartSchema, _ as checkoutInputSchema, $ as checkoutSchema, a0 as couponInputSchema, a1 as productCategorySchema, a2 as productImageSchema, a3 as productSchema, a4 as removeCartItemInputSchema, a5 as searchParamsSchema, a6 as selectShippingRateInputSchema, a7 as storeApiOrderSchema, a8 as updateCartItemInputSchema, a9 as updateCustomerInputSchema } from './types-9I6oS_83.mjs';
2
+ import { f as WooCommerceApiErrorCode, B as BaseErrorOptions, g as BaseReportableData, j as ValidationReportableData, k as WooCommerceDataValidationErrorOptions } from './types-Cbf1-EhK.mjs';
3
+ export { A as AddItemsInput, l as AddItemsResult, m as AddToCartInput, n as BatchResponse, o as Cart, p as CartAPI, C as CartHeadersAdapter, q as CartItem, r as CartItemImage, t as Checkout, u as CheckoutAPI, v as CheckoutInput, w as CouponInput, G as GetOrderInput, J as JwtTokenAdapter, O as OrderStatus, x as OrdersAPI, P as PaginatedResponse, y as Product, z as ProductCategory, D as ProductImage, E as ProductParams, F as ProductTag, H as ProductTagsParams, I as ProductsAPI, K as RemoveCartItemInput, L as SelectShippingRateInput, M as StoreApiOrder, U as UpdateCartItemInput, N as UpdateCustomerInput, Q as WooCommerceApiError, T as WooCommerceApiErrorOptions, a as WooCommerceClient, W as WooCommerceConfig, X as addItemsInputSchema, Y as addToCartInputSchema, Z as batchResponseSchema, _ as cartItemImageSchema, $ as cartSchema, a0 as checkoutInputSchema, a1 as checkoutSchema, a2 as couponInputSchema, a3 as productCategorySchema, a4 as productImageSchema, a5 as productSchema, a6 as removeCartItemInputSchema, a7 as searchParamsSchema, a8 as selectShippingRateInputSchema, a9 as storeApiOrderSchema, aa as updateCartItemInputSchema, ab as updateCustomerInputSchema } from './types-Cbf1-EhK.mjs';
4
4
  import * as zod from 'zod';
5
5
  import { ZodError, z } from 'zod';
6
6
  import 'axios';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { createClient } from './client/index.js';
2
- import { f as WooCommerceApiErrorCode, B as BaseErrorOptions, g as BaseReportableData, j as ValidationReportableData, k as WooCommerceDataValidationErrorOptions } from './types-9I6oS_83.js';
3
- export { A as AddItemsInput, l as AddItemsResult, m as AddToCartInput, n as BatchResponse, o as Cart, p as CartAPI, C as CartHeadersAdapter, q as CartItem, r as CartItemImage, t as Checkout, u as CheckoutAPI, v as CheckoutInput, w as CouponInput, G as GetOrderInput, J as JwtTokenAdapter, O as OrderStatus, x as OrdersAPI, P as PaginatedResponse, y as Product, z as ProductCategory, D as ProductImage, E as ProductParams, F as ProductsAPI, H as RemoveCartItemInput, I as SelectShippingRateInput, K as StoreApiOrder, U as UpdateCartItemInput, L as UpdateCustomerInput, M as WooCommerceApiError, N as WooCommerceApiErrorOptions, a as WooCommerceClient, W as WooCommerceConfig, Q as addItemsInputSchema, T as addToCartInputSchema, X as batchResponseSchema, Y as cartItemImageSchema, Z as cartSchema, _ as checkoutInputSchema, $ as checkoutSchema, a0 as couponInputSchema, a1 as productCategorySchema, a2 as productImageSchema, a3 as productSchema, a4 as removeCartItemInputSchema, a5 as searchParamsSchema, a6 as selectShippingRateInputSchema, a7 as storeApiOrderSchema, a8 as updateCartItemInputSchema, a9 as updateCustomerInputSchema } from './types-9I6oS_83.js';
2
+ import { f as WooCommerceApiErrorCode, B as BaseErrorOptions, g as BaseReportableData, j as ValidationReportableData, k as WooCommerceDataValidationErrorOptions } from './types-Cbf1-EhK.js';
3
+ export { A as AddItemsInput, l as AddItemsResult, m as AddToCartInput, n as BatchResponse, o as Cart, p as CartAPI, C as CartHeadersAdapter, q as CartItem, r as CartItemImage, t as Checkout, u as CheckoutAPI, v as CheckoutInput, w as CouponInput, G as GetOrderInput, J as JwtTokenAdapter, O as OrderStatus, x as OrdersAPI, P as PaginatedResponse, y as Product, z as ProductCategory, D as ProductImage, E as ProductParams, F as ProductTag, H as ProductTagsParams, I as ProductsAPI, K as RemoveCartItemInput, L as SelectShippingRateInput, M as StoreApiOrder, U as UpdateCartItemInput, N as UpdateCustomerInput, Q as WooCommerceApiError, T as WooCommerceApiErrorOptions, a as WooCommerceClient, W as WooCommerceConfig, X as addItemsInputSchema, Y as addToCartInputSchema, Z as batchResponseSchema, _ as cartItemImageSchema, $ as cartSchema, a0 as checkoutInputSchema, a1 as checkoutSchema, a2 as couponInputSchema, a3 as productCategorySchema, a4 as productImageSchema, a5 as productSchema, a6 as removeCartItemInputSchema, a7 as searchParamsSchema, a8 as selectShippingRateInputSchema, a9 as storeApiOrderSchema, aa as updateCartItemInputSchema, ab as updateCustomerInputSchema } from './types-Cbf1-EhK.js';
4
4
  import * as zod from 'zod';
5
5
  import { ZodError, z } from 'zod';
6
6
  import 'axios';
package/dist/index.js CHANGED
@@ -1318,11 +1318,13 @@ var checkoutSchema = zod.z.object({
1318
1318
  billing_address: billingAddressSchemaNonMandatory,
1319
1319
  shipping_address: addressSchemaNonMandatory,
1320
1320
  payment_method: zod.z.string(),
1321
+ // Null until an order is placed.
1322
+ // GET /checkout returns null here, so the schema must accept it.
1321
1323
  payment_result: zod.z.object({
1322
1324
  payment_status: zod.z.string(),
1323
1325
  payment_details: zod.z.array(zod.z.unknown()),
1324
1326
  redirect_url: zod.z.string()
1325
- })
1327
+ }).nullable()
1326
1328
  });
1327
1329
  var checkoutInputSchema = zod.z.object({
1328
1330
  payment_method: zod.z.string(),
@@ -1525,6 +1527,14 @@ var productSchema = zod.z.object({
1525
1527
  review_count: zod.z.number(),
1526
1528
  extensions: zod.z.record(zod.z.string(), zod.z.unknown())
1527
1529
  });
1530
+ var productTagSchema = zod.z.object({
1531
+ /** Tag unique identifier */
1532
+ id: zod.z.number(),
1533
+ /** Tag display name, e.g. "Vichy decembar 2025" */
1534
+ name: zod.z.string(),
1535
+ /** URL-friendly tag identifier */
1536
+ slug: zod.z.string()
1537
+ });
1528
1538
  zod.z.object({
1529
1539
  /** Attribution source type (e.g., 'mobile_app', 'organic', 'referral') */
1530
1540
  source_type: zod.z.string(),
@@ -1670,6 +1680,14 @@ var createProductsAPI = (client, endpoints, options) => ({
1670
1680
  categories: async () => {
1671
1681
  const response = await client.get(endpoints.categories);
1672
1682
  return handleApiResponse(response, zod.z.array(productCategorySchema), options);
1683
+ },
1684
+ // Tags, e.g. GET /products/tags?include=996,683.
1685
+ // The Store API wants include as a comma list, so join the ids.
1686
+ tags: async (params) => {
1687
+ const response = await client.get(endpoints.tags, {
1688
+ params: { include: params?.include?.join(",") }
1689
+ });
1690
+ return handleApiResponse(response, zod.z.array(productTagSchema), options);
1673
1691
  }
1674
1692
  });
1675
1693
 
@@ -1680,6 +1698,8 @@ var createEndpoints = (version = "legacy") => {
1680
1698
  // Products
1681
1699
  products: `${prefix}/products`,
1682
1700
  categories: `${prefix}/products/categories`,
1701
+ // Product tags, e.g. to turn a tag id into its name
1702
+ tags: `${prefix}/products/tags`,
1683
1703
  // Cart
1684
1704
  cart: `${prefix}/cart`,
1685
1705
  addItem: `${prefix}/cart/add-item`,