@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.
@@ -1262,11 +1262,13 @@ var checkoutSchema = z.object({
1262
1262
  billing_address: billingAddressSchemaNonMandatory,
1263
1263
  shipping_address: addressSchemaNonMandatory,
1264
1264
  payment_method: z.string(),
1265
+ // Null until an order is placed.
1266
+ // GET /checkout returns null here, so the schema must accept it.
1265
1267
  payment_result: z.object({
1266
1268
  payment_status: z.string(),
1267
1269
  payment_details: z.array(z.unknown()),
1268
1270
  redirect_url: z.string()
1269
- })
1271
+ }).nullable()
1270
1272
  });
1271
1273
  z.object({
1272
1274
  payment_method: z.string(),
@@ -1368,6 +1370,14 @@ var productSchema = z.object({
1368
1370
  review_count: z.number(),
1369
1371
  extensions: z.record(z.string(), z.unknown())
1370
1372
  });
1373
+ var productTagSchema = z.object({
1374
+ /** Tag unique identifier */
1375
+ id: z.number(),
1376
+ /** Tag display name, e.g. "Vichy decembar 2025" */
1377
+ name: z.string(),
1378
+ /** URL-friendly tag identifier */
1379
+ slug: z.string()
1380
+ });
1371
1381
  z.object({
1372
1382
  /** Attribution source type (e.g., 'mobile_app', 'organic', 'referral') */
1373
1383
  source_type: z.string(),
@@ -1513,6 +1523,14 @@ var createProductsAPI = (client, endpoints, options) => ({
1513
1523
  categories: async () => {
1514
1524
  const response = await client.get(endpoints.categories);
1515
1525
  return handleApiResponse(response, z.array(productCategorySchema), options);
1526
+ },
1527
+ // Tags, e.g. GET /products/tags?include=996,683.
1528
+ // The Store API wants include as a comma list, so join the ids.
1529
+ tags: async (params) => {
1530
+ const response = await client.get(endpoints.tags, {
1531
+ params: { include: params?.include?.join(",") }
1532
+ });
1533
+ return handleApiResponse(response, z.array(productTagSchema), options);
1516
1534
  }
1517
1535
  });
1518
1536
 
@@ -1523,6 +1541,8 @@ var createEndpoints = (version = "legacy") => {
1523
1541
  // Products
1524
1542
  products: `${prefix}/products`,
1525
1543
  categories: `${prefix}/products/categories`,
1544
+ // Product tags, e.g. to turn a tag id into its name
1545
+ tags: `${prefix}/products/tags`,
1526
1546
  // Cart
1527
1547
  cart: `${prefix}/cart`,
1528
1548
  addItem: `${prefix}/cart/add-item`,