@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 { l as AddItemsResult, p as CartAPI, C as CartHeadersAdapter, u as CheckoutAPI, J as JwtTokenAdapter, x as OrdersAPI, F as ProductsAPI } from '../types-9I6oS_83.mjs';
1
+ import { W as WooCommerceConfig, a as WooCommerceClient } from '../types-Cbf1-EhK.mjs';
2
+ export { l as AddItemsResult, p as CartAPI, C as CartHeadersAdapter, u as CheckoutAPI, J as JwtTokenAdapter, x as OrdersAPI, I as ProductsAPI } from '../types-Cbf1-EhK.mjs';
3
3
  import '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 { l as AddItemsResult, p as CartAPI, C as CartHeadersAdapter, u as CheckoutAPI, J as JwtTokenAdapter, x as OrdersAPI, F as ProductsAPI } from '../types-9I6oS_83.js';
1
+ import { W as WooCommerceConfig, a as WooCommerceClient } from '../types-Cbf1-EhK.js';
2
+ export { l as AddItemsResult, p as CartAPI, C as CartHeadersAdapter, u as CheckoutAPI, J as JwtTokenAdapter, x as OrdersAPI, I as ProductsAPI } from '../types-Cbf1-EhK.js';
3
3
  import 'axios';
4
4
  import '@atomic-solutions/errors';
5
5
  import 'zod';
@@ -1268,11 +1268,13 @@ var checkoutSchema = zod.z.object({
1268
1268
  billing_address: billingAddressSchemaNonMandatory,
1269
1269
  shipping_address: addressSchemaNonMandatory,
1270
1270
  payment_method: zod.z.string(),
1271
+ // Null until an order is placed.
1272
+ // GET /checkout returns null here, so the schema must accept it.
1271
1273
  payment_result: zod.z.object({
1272
1274
  payment_status: zod.z.string(),
1273
1275
  payment_details: zod.z.array(zod.z.unknown()),
1274
1276
  redirect_url: zod.z.string()
1275
- })
1277
+ }).nullable()
1276
1278
  });
1277
1279
  zod.z.object({
1278
1280
  payment_method: zod.z.string(),
@@ -1374,6 +1376,14 @@ var productSchema = zod.z.object({
1374
1376
  review_count: zod.z.number(),
1375
1377
  extensions: zod.z.record(zod.z.string(), zod.z.unknown())
1376
1378
  });
1379
+ var productTagSchema = zod.z.object({
1380
+ /** Tag unique identifier */
1381
+ id: zod.z.number(),
1382
+ /** Tag display name, e.g. "Vichy decembar 2025" */
1383
+ name: zod.z.string(),
1384
+ /** URL-friendly tag identifier */
1385
+ slug: zod.z.string()
1386
+ });
1377
1387
  zod.z.object({
1378
1388
  /** Attribution source type (e.g., 'mobile_app', 'organic', 'referral') */
1379
1389
  source_type: zod.z.string(),
@@ -1519,6 +1529,14 @@ var createProductsAPI = (client, endpoints, options) => ({
1519
1529
  categories: async () => {
1520
1530
  const response = await client.get(endpoints.categories);
1521
1531
  return handleApiResponse(response, zod.z.array(productCategorySchema), options);
1532
+ },
1533
+ // Tags, e.g. GET /products/tags?include=996,683.
1534
+ // The Store API wants include as a comma list, so join the ids.
1535
+ tags: async (params) => {
1536
+ const response = await client.get(endpoints.tags, {
1537
+ params: { include: params?.include?.join(",") }
1538
+ });
1539
+ return handleApiResponse(response, zod.z.array(productTagSchema), options);
1522
1540
  }
1523
1541
  });
1524
1542
 
@@ -1529,6 +1547,8 @@ var createEndpoints = (version = "legacy") => {
1529
1547
  // Products
1530
1548
  products: `${prefix}/products`,
1531
1549
  categories: `${prefix}/products/categories`,
1550
+ // Product tags, e.g. to turn a tag id into its name
1551
+ tags: `${prefix}/products/tags`,
1532
1552
  // Cart
1533
1553
  cart: `${prefix}/cart`,
1534
1554
  addItem: `${prefix}/cart/add-item`,