@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/index.mjs CHANGED
@@ -1080,6 +1080,10 @@ var removeCartItemInputSchema = z.object({
1080
1080
  var couponInputSchema = z.object({
1081
1081
  code: z.string().min(1)
1082
1082
  });
1083
+ var cartExtensionsInputSchema = z.object({
1084
+ namespace: z.string().min(1),
1085
+ data: z.record(z.string(), z.unknown())
1086
+ });
1083
1087
  var updateCustomerInputSchema = z.object({
1084
1088
  billing_address: billingAddressSchemaMandatory.partial(),
1085
1089
  shipping_address: addressSchema.partial()
@@ -1312,11 +1316,13 @@ var checkoutSchema = z.object({
1312
1316
  billing_address: billingAddressSchemaNonMandatory,
1313
1317
  shipping_address: addressSchemaNonMandatory,
1314
1318
  payment_method: z.string(),
1319
+ // Null until an order is placed.
1320
+ // GET /checkout returns null here, so the schema must accept it.
1315
1321
  payment_result: z.object({
1316
1322
  payment_status: z.string(),
1317
1323
  payment_details: z.array(z.unknown()),
1318
1324
  redirect_url: z.string()
1319
- })
1325
+ }).nullable()
1320
1326
  });
1321
1327
  var checkoutInputSchema = z.object({
1322
1328
  payment_method: z.string(),
@@ -1519,6 +1525,14 @@ var productSchema = z.object({
1519
1525
  review_count: z.number(),
1520
1526
  extensions: z.record(z.string(), z.unknown())
1521
1527
  });
1528
+ var productTagSchema = z.object({
1529
+ /** Tag unique identifier */
1530
+ id: z.number(),
1531
+ /** Tag display name, e.g. "Vichy decembar 2025" */
1532
+ name: z.string(),
1533
+ /** URL-friendly tag identifier */
1534
+ slug: z.string()
1535
+ });
1522
1536
  z.object({
1523
1537
  /** Attribution source type (e.g., 'mobile_app', 'organic', 'referral') */
1524
1538
  source_type: z.string(),
@@ -1610,6 +1624,11 @@ var createCartAPI = (client, endpoints, options) => ({
1610
1624
  const response = await client.post(endpoints.removeCoupon, input);
1611
1625
  return handleApiResponse(response, cartSchema, options);
1612
1626
  },
1627
+ // Same request headers (Nonce / Cart-Token / Bearer) as every cart POST.
1628
+ updateExtensions: async (input) => {
1629
+ const response = await client.post(endpoints.updateExtensions, input);
1630
+ return handleApiResponse(response, cartSchema, options);
1631
+ },
1613
1632
  updateCustomer: async (input) => {
1614
1633
  const response = await client.post(endpoints.updateCustomer, input);
1615
1634
  return handleApiResponse(response, cartSchema, options);
@@ -1664,6 +1683,14 @@ var createProductsAPI = (client, endpoints, options) => ({
1664
1683
  categories: async () => {
1665
1684
  const response = await client.get(endpoints.categories);
1666
1685
  return handleApiResponse(response, z.array(productCategorySchema), options);
1686
+ },
1687
+ // Tags, e.g. GET /products/tags?include=996,683.
1688
+ // The Store API wants include as a comma list, so join the ids.
1689
+ tags: async (params) => {
1690
+ const response = await client.get(endpoints.tags, {
1691
+ params: { include: params?.include?.join(",") }
1692
+ });
1693
+ return handleApiResponse(response, z.array(productTagSchema), options);
1667
1694
  }
1668
1695
  });
1669
1696
 
@@ -1674,6 +1701,8 @@ var createEndpoints = (version = "legacy") => {
1674
1701
  // Products
1675
1702
  products: `${prefix}/products`,
1676
1703
  categories: `${prefix}/products/categories`,
1704
+ // Product tags, e.g. to turn a tag id into its name
1705
+ tags: `${prefix}/products/tags`,
1677
1706
  // Cart
1678
1707
  cart: `${prefix}/cart`,
1679
1708
  addItem: `${prefix}/cart/add-item`,
@@ -1681,6 +1710,8 @@ var createEndpoints = (version = "legacy") => {
1681
1710
  removeItem: `${prefix}/cart/remove-item`,
1682
1711
  applyCoupon: `${prefix}/cart/apply-coupon`,
1683
1712
  removeCoupon: `${prefix}/cart/remove-coupon`,
1713
+ // Plugins change the cart through this one route (e.g. points discounts).
1714
+ updateExtensions: `${prefix}/cart/extensions`,
1684
1715
  updateCustomer: `${prefix}/cart/update-customer`,
1685
1716
  selectShippingRate: `${prefix}/cart/select-shipping-rate`,
1686
1717
  // Batch
@@ -2271,6 +2302,6 @@ var schemas = {
2271
2302
  }
2272
2303
  };
2273
2304
 
2274
- export { WooCommerceApiError, WooCommerceDataValidationError, addItemsInputSchema, addToCartInputSchema, addressSchema, categoryFilterSchema as adminCategoryFilterSchema, couponFilterSchema as adminCouponFilterSchema, couponSchema as adminCouponSchema, orderFilterSchema as adminOrderFilterSchema, orderSchema as adminOrderSchema, productCategorySchema2 as adminProductCategorySchema, productFilterSchema as adminProductFilterSchema, productSchema2 as adminProductSchema, batchResponseSchema, billingAddressSchemaMandatory as billingAddressSchema, cartItemImageSchema, cartSchema, checkoutInputSchema, checkoutSchema, couponInputSchema, createCategorySchema, createClient, createCouponSchema, createCustomerSchema, createPaginatedSchema, customerFilterSchema, customerSchema, getAppEnumRaw, getAppEnumZod, makeAddressFormSchema, makeBillingAddressFormSchema, mapWooCommerceCode, paginationMetaSchema, paginationParamsSchema, paymentMethodFilterSchema, paymentMethodSchema, productCategorySchema, productImageSchema, productSchema, removeCartItemInputSchema, schemas, storeProductsSearchParamsSchema as searchParamsSchema, selectShippingRateInputSchema, storeApiOrderSchema, updateCartItemInputSchema, updateCustomerInputSchema, updateCustomerSchema, wcBaseParamsSchema, wcErrorResponseSchema, wcPaginationMetaSchema };
2305
+ export { WooCommerceApiError, WooCommerceDataValidationError, addItemsInputSchema, addToCartInputSchema, addressSchema, categoryFilterSchema as adminCategoryFilterSchema, couponFilterSchema as adminCouponFilterSchema, couponSchema as adminCouponSchema, orderFilterSchema as adminOrderFilterSchema, orderSchema as adminOrderSchema, productCategorySchema2 as adminProductCategorySchema, productFilterSchema as adminProductFilterSchema, productSchema2 as adminProductSchema, batchResponseSchema, billingAddressSchemaMandatory as billingAddressSchema, cartExtensionsInputSchema, cartItemImageSchema, cartSchema, checkoutInputSchema, checkoutSchema, couponInputSchema, createCategorySchema, createClient, createCouponSchema, createCustomerSchema, createPaginatedSchema, customerFilterSchema, customerSchema, getAppEnumRaw, getAppEnumZod, makeAddressFormSchema, makeBillingAddressFormSchema, mapWooCommerceCode, paginationMetaSchema, paginationParamsSchema, paymentMethodFilterSchema, paymentMethodSchema, productCategorySchema, productImageSchema, productSchema, removeCartItemInputSchema, schemas, storeProductsSearchParamsSchema as searchParamsSchema, selectShippingRateInputSchema, storeApiOrderSchema, updateCartItemInputSchema, updateCustomerInputSchema, updateCustomerSchema, wcBaseParamsSchema, wcErrorResponseSchema, wcPaginationMetaSchema };
2275
2306
  //# sourceMappingURL=index.mjs.map
2276
2307
  //# sourceMappingURL=index.mjs.map