@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/client/index.d.mts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +21 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +21 -1
- package/dist/client/index.mjs.map +1 -1
- package/dist/http/index.d.mts +2 -2
- package/dist/http/index.d.ts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -1
- package/dist/index.mjs.map +1 -1
- package/dist/testing/index.d.mts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +21 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/index.mjs +21 -1
- package/dist/testing/index.mjs.map +1 -1
- package/dist/{types-9I6oS_83.d.mts → types-Cbf1-EhK.d.mts} +24 -5
- package/dist/{types-9I6oS_83.d.ts → types-Cbf1-EhK.d.ts} +24 -5
- package/dist/utils/index.d.mts +2 -2
- package/dist/utils/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as StoreApiVersion, C as CartHeadersAdapter, J as JwtTokenAdapter } from '../types-
|
|
1
|
+
import { S as StoreApiVersion, C as CartHeadersAdapter, J as JwtTokenAdapter } from '../types-Cbf1-EhK.mjs';
|
|
2
2
|
import 'axios';
|
|
3
3
|
import '@atomic-solutions/errors';
|
|
4
4
|
import 'zod';
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as StoreApiVersion, C as CartHeadersAdapter, J as JwtTokenAdapter } from '../types-
|
|
1
|
+
import { S as StoreApiVersion, C as CartHeadersAdapter, J as JwtTokenAdapter } from '../types-Cbf1-EhK.js';
|
|
2
2
|
import 'axios';
|
|
3
3
|
import '@atomic-solutions/errors';
|
|
4
4
|
import 'zod';
|
package/dist/testing/index.js
CHANGED
|
@@ -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`,
|