@atomic-solutions/woocommerce-api-client 0.5.1 → 0.7.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 +32 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +32 -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 +33 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -2
- 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 +32 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/index.mjs +32 -1
- package/dist/testing/index.mjs.map +1 -1
- package/dist/{types-9I6oS_83.d.mts → types-Tf-Yd0qB.d.mts} +36 -5
- package/dist/{types-9I6oS_83.d.ts → types-Tf-Yd0qB.d.ts} +36 -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.mjs
CHANGED
|
@@ -1030,6 +1030,10 @@ z.object({
|
|
|
1030
1030
|
z.object({
|
|
1031
1031
|
code: z.string().min(1)
|
|
1032
1032
|
});
|
|
1033
|
+
z.object({
|
|
1034
|
+
namespace: z.string().min(1),
|
|
1035
|
+
data: z.record(z.string(), z.unknown())
|
|
1036
|
+
});
|
|
1033
1037
|
z.object({
|
|
1034
1038
|
billing_address: billingAddressSchemaMandatory.partial(),
|
|
1035
1039
|
shipping_address: addressSchema.partial()
|
|
@@ -1262,11 +1266,13 @@ var checkoutSchema = z.object({
|
|
|
1262
1266
|
billing_address: billingAddressSchemaNonMandatory,
|
|
1263
1267
|
shipping_address: addressSchemaNonMandatory,
|
|
1264
1268
|
payment_method: z.string(),
|
|
1269
|
+
// Null until an order is placed.
|
|
1270
|
+
// GET /checkout returns null here, so the schema must accept it.
|
|
1265
1271
|
payment_result: z.object({
|
|
1266
1272
|
payment_status: z.string(),
|
|
1267
1273
|
payment_details: z.array(z.unknown()),
|
|
1268
1274
|
redirect_url: z.string()
|
|
1269
|
-
})
|
|
1275
|
+
}).nullable()
|
|
1270
1276
|
});
|
|
1271
1277
|
z.object({
|
|
1272
1278
|
payment_method: z.string(),
|
|
@@ -1368,6 +1374,14 @@ var productSchema = z.object({
|
|
|
1368
1374
|
review_count: z.number(),
|
|
1369
1375
|
extensions: z.record(z.string(), z.unknown())
|
|
1370
1376
|
});
|
|
1377
|
+
var productTagSchema = z.object({
|
|
1378
|
+
/** Tag unique identifier */
|
|
1379
|
+
id: z.number(),
|
|
1380
|
+
/** Tag display name, e.g. "Vichy decembar 2025" */
|
|
1381
|
+
name: z.string(),
|
|
1382
|
+
/** URL-friendly tag identifier */
|
|
1383
|
+
slug: z.string()
|
|
1384
|
+
});
|
|
1371
1385
|
z.object({
|
|
1372
1386
|
/** Attribution source type (e.g., 'mobile_app', 'organic', 'referral') */
|
|
1373
1387
|
source_type: z.string(),
|
|
@@ -1459,6 +1473,11 @@ var createCartAPI = (client, endpoints, options) => ({
|
|
|
1459
1473
|
const response = await client.post(endpoints.removeCoupon, input);
|
|
1460
1474
|
return handleApiResponse(response, cartSchema, options);
|
|
1461
1475
|
},
|
|
1476
|
+
// Same request headers (Nonce / Cart-Token / Bearer) as every cart POST.
|
|
1477
|
+
updateExtensions: async (input) => {
|
|
1478
|
+
const response = await client.post(endpoints.updateExtensions, input);
|
|
1479
|
+
return handleApiResponse(response, cartSchema, options);
|
|
1480
|
+
},
|
|
1462
1481
|
updateCustomer: async (input) => {
|
|
1463
1482
|
const response = await client.post(endpoints.updateCustomer, input);
|
|
1464
1483
|
return handleApiResponse(response, cartSchema, options);
|
|
@@ -1513,6 +1532,14 @@ var createProductsAPI = (client, endpoints, options) => ({
|
|
|
1513
1532
|
categories: async () => {
|
|
1514
1533
|
const response = await client.get(endpoints.categories);
|
|
1515
1534
|
return handleApiResponse(response, z.array(productCategorySchema), options);
|
|
1535
|
+
},
|
|
1536
|
+
// Tags, e.g. GET /products/tags?include=996,683.
|
|
1537
|
+
// The Store API wants include as a comma list, so join the ids.
|
|
1538
|
+
tags: async (params) => {
|
|
1539
|
+
const response = await client.get(endpoints.tags, {
|
|
1540
|
+
params: { include: params?.include?.join(",") }
|
|
1541
|
+
});
|
|
1542
|
+
return handleApiResponse(response, z.array(productTagSchema), options);
|
|
1516
1543
|
}
|
|
1517
1544
|
});
|
|
1518
1545
|
|
|
@@ -1523,6 +1550,8 @@ var createEndpoints = (version = "legacy") => {
|
|
|
1523
1550
|
// Products
|
|
1524
1551
|
products: `${prefix}/products`,
|
|
1525
1552
|
categories: `${prefix}/products/categories`,
|
|
1553
|
+
// Product tags, e.g. to turn a tag id into its name
|
|
1554
|
+
tags: `${prefix}/products/tags`,
|
|
1526
1555
|
// Cart
|
|
1527
1556
|
cart: `${prefix}/cart`,
|
|
1528
1557
|
addItem: `${prefix}/cart/add-item`,
|
|
@@ -1530,6 +1559,8 @@ var createEndpoints = (version = "legacy") => {
|
|
|
1530
1559
|
removeItem: `${prefix}/cart/remove-item`,
|
|
1531
1560
|
applyCoupon: `${prefix}/cart/apply-coupon`,
|
|
1532
1561
|
removeCoupon: `${prefix}/cart/remove-coupon`,
|
|
1562
|
+
// Plugins change the cart through this one route (e.g. points discounts).
|
|
1563
|
+
updateExtensions: `${prefix}/cart/extensions`,
|
|
1533
1564
|
updateCustomer: `${prefix}/cart/update-customer`,
|
|
1534
1565
|
selectShippingRate: `${prefix}/cart/select-shipping-rate`,
|
|
1535
1566
|
// Batch
|