@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.
package/dist/index.mjs CHANGED
@@ -1312,11 +1312,13 @@ var checkoutSchema = z.object({
1312
1312
  billing_address: billingAddressSchemaNonMandatory,
1313
1313
  shipping_address: addressSchemaNonMandatory,
1314
1314
  payment_method: z.string(),
1315
+ // Null until an order is placed.
1316
+ // GET /checkout returns null here, so the schema must accept it.
1315
1317
  payment_result: z.object({
1316
1318
  payment_status: z.string(),
1317
1319
  payment_details: z.array(z.unknown()),
1318
1320
  redirect_url: z.string()
1319
- })
1321
+ }).nullable()
1320
1322
  });
1321
1323
  var checkoutInputSchema = z.object({
1322
1324
  payment_method: z.string(),
@@ -1519,6 +1521,14 @@ var productSchema = z.object({
1519
1521
  review_count: z.number(),
1520
1522
  extensions: z.record(z.string(), z.unknown())
1521
1523
  });
1524
+ var productTagSchema = z.object({
1525
+ /** Tag unique identifier */
1526
+ id: z.number(),
1527
+ /** Tag display name, e.g. "Vichy decembar 2025" */
1528
+ name: z.string(),
1529
+ /** URL-friendly tag identifier */
1530
+ slug: z.string()
1531
+ });
1522
1532
  z.object({
1523
1533
  /** Attribution source type (e.g., 'mobile_app', 'organic', 'referral') */
1524
1534
  source_type: z.string(),
@@ -1664,6 +1674,14 @@ var createProductsAPI = (client, endpoints, options) => ({
1664
1674
  categories: async () => {
1665
1675
  const response = await client.get(endpoints.categories);
1666
1676
  return handleApiResponse(response, z.array(productCategorySchema), options);
1677
+ },
1678
+ // Tags, e.g. GET /products/tags?include=996,683.
1679
+ // The Store API wants include as a comma list, so join the ids.
1680
+ tags: async (params) => {
1681
+ const response = await client.get(endpoints.tags, {
1682
+ params: { include: params?.include?.join(",") }
1683
+ });
1684
+ return handleApiResponse(response, z.array(productTagSchema), options);
1667
1685
  }
1668
1686
  });
1669
1687
 
@@ -1674,6 +1692,8 @@ var createEndpoints = (version = "legacy") => {
1674
1692
  // Products
1675
1693
  products: `${prefix}/products`,
1676
1694
  categories: `${prefix}/products/categories`,
1695
+ // Product tags, e.g. to turn a tag id into its name
1696
+ tags: `${prefix}/products/tags`,
1677
1697
  // Cart
1678
1698
  cart: `${prefix}/cart`,
1679
1699
  addItem: `${prefix}/cart/add-item`,