@atomic-solutions/woocommerce-api-client 0.1.3 → 0.1.4

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
@@ -772,6 +772,8 @@ var pricesSchema = z.object({
772
772
  sale_price: z.string()
773
773
  }).optional()
774
774
  }).merge(moneySchema);
775
+
776
+ // ../schemas/src/woocommerce/store-api/cart-item.schema.ts
775
777
  var itemTotalsSchema = z.object({
776
778
  /** Subtotal before taxes */
777
779
  line_subtotal: z.string(),
@@ -948,6 +950,8 @@ var shippingPackageSchema = z.object({
948
950
  /** Available shipping rates for this package */
949
951
  shipping_rates: z.array(shippingRateSchema)
950
952
  });
953
+
954
+ // ../schemas/src/woocommerce/store-api/cart.ts
951
955
  var cartSchema = z.object({
952
956
  items: z.array(cartItemSchema),
953
957
  items_count: z.number(),
@@ -1167,6 +1171,8 @@ var orderTotalsSchema = z.object({
1167
1171
  /** Currency suffix (e.g., 'USD') */
1168
1172
  currency_suffix: z.string()
1169
1173
  });
1174
+
1175
+ // ../schemas/src/woocommerce/store-api/order.schema.ts
1170
1176
  var orderStatusEnum = z.enum([
1171
1177
  "pending",
1172
1178
  // Order received, awaiting payment
@@ -1213,21 +1219,6 @@ var storeApiOrderSchema = z.object({
1213
1219
  /** Payment method title (optional - returned from checkout) */
1214
1220
  payment_method_title: z.string().optional()
1215
1221
  });
1216
- z.object({
1217
- id: z.number(),
1218
- status: z.string(),
1219
- order_key: z.string(),
1220
- number: z.string(),
1221
- currency: z.string(),
1222
- total: z.string(),
1223
- date_created: z.string(),
1224
- customer_note: z.string(),
1225
- billing: z.record(z.string(), z.unknown()),
1226
- shipping: z.record(z.string(), z.unknown()),
1227
- payment_method: z.string(),
1228
- payment_method_title: z.string(),
1229
- line_items: z.array(z.unknown())
1230
- });
1231
1222
  var checkoutSchema = z.object({
1232
1223
  order_id: z.number(),
1233
1224
  status: z.string(),
@@ -1408,6 +1399,8 @@ var storeProductsSearchParamsSchema = z.object({
1408
1399
  /** Filter by product rating (1-5 stars) */
1409
1400
  rating: z.array(z.number().min(1).max(5)).optional()
1410
1401
  });
1402
+
1403
+ // ../schemas/src/woocommerce/store-api/products.ts
1411
1404
  var productSchema = z.object({
1412
1405
  id: z.number(),
1413
1406
  name: z.string(),
@@ -1438,23 +1431,6 @@ var productSchema = z.object({
1438
1431
  review_count: z.number(),
1439
1432
  extensions: z.record(z.string(), z.unknown())
1440
1433
  });
1441
- var paymentDataItemSchema = z.object({
1442
- /** Key identifier for the payment data field */
1443
- key: z.string(),
1444
- /** Value can be string or boolean depending on the field */
1445
- value: z.union([z.string(), z.boolean()])
1446
- });
1447
- z.object({
1448
- /** Payment method ID (e.g., "cod", "stripe", "bacs") */
1449
- payment_method: z.string().min(1, "Payment method is required"),
1450
- /**
1451
- * Optional payment gateway-specific data
1452
- *
1453
- * Array of key-value pairs that will be passed to the payment gateway
1454
- * Example: [{ key: "stripe_token", value: "tok_xyz" }]
1455
- */
1456
- payment_data: z.array(paymentDataItemSchema).optional()
1457
- });
1458
1434
 
1459
1435
  // src/api/cart.ts
1460
1436
  var createCartAPI = (client, endpoints, options) => ({
@@ -1593,6 +1569,8 @@ var createClient = (config) => {
1593
1569
  setupErrorInterceptor(axiosInstance, fullConfig, client);
1594
1570
  return client;
1595
1571
  };
1572
+
1573
+ // ../schemas/src/woocommerce/admin-api/enums/enums-raw.ts
1596
1574
  var ORDER_STATUS = [
1597
1575
  "cancelled",
1598
1576
  "completed",
@@ -1706,6 +1684,8 @@ var ENUM_RAW = {
1706
1684
  ORDER_BY: COUPONS_ORDER_BY
1707
1685
  }
1708
1686
  };
1687
+
1688
+ // ../schemas/src/woocommerce/admin-api/enums/enums.ts
1709
1689
  var APP_ENUMS = {
1710
1690
  PRODUCT_TYPES: {
1711
1691
  RAW: ENUM_RAW.PRODUCT.TYPES,
@@ -1811,6 +1791,8 @@ var wpLinksSchema = z.object({
1811
1791
  })
1812
1792
  ).optional()
1813
1793
  });
1794
+
1795
+ // ../schemas/src/woocommerce/admin-api/base/base-wc.schema.ts
1814
1796
  var wcSortingSchema = z.object({
1815
1797
  order: getAppEnumZod("COMMON_SORT_ORDER").default("desc"),
1816
1798
  orderby: z.string().optional()
@@ -1849,7 +1831,7 @@ var wcBaseResponseSchema = z.object({
1849
1831
  _links: wpLinksSchema,
1850
1832
  meta_data: z.array(wcMetaDataSchema).optional()
1851
1833
  });
1852
- z.object({
1834
+ var wcPaginationMetaSchema = z.object({
1853
1835
  total: z.number(),
1854
1836
  totalPages: z.number(),
1855
1837
  currentPage: z.number(),
@@ -1862,6 +1844,12 @@ var wcErrorResponseSchema = z.object({
1862
1844
  status: z.number()
1863
1845
  }).optional()
1864
1846
  }).passthrough();
1847
+ var createPaginatedSchema = (schema) => z.object({
1848
+ data: z.array(schema),
1849
+ meta: wcPaginationMetaSchema
1850
+ });
1851
+
1852
+ // ../schemas/src/woocommerce/admin-api/coupons/coupon-filter.schema.ts
1865
1853
  var couponFilterSchema = wcBaseParamsSchema.extend({
1866
1854
  orderby: getAppEnumZod("COUPONS_ORDER_BY").default("date"),
1867
1855
  code: z.string().optional()
@@ -1952,7 +1940,7 @@ var orderLineItemSchema = z.object({
1952
1940
  sku: z.string(),
1953
1941
  price: z.number()
1954
1942
  });
1955
- var orderSchema2 = wcBaseResponseSchema.extend({
1943
+ var orderSchema = wcBaseResponseSchema.extend({
1956
1944
  id: z.number(),
1957
1945
  parent_id: z.number(),
1958
1946
  status: getAppEnumZod("ORDER_STATUS"),
@@ -1984,7 +1972,7 @@ var orderSchema2 = wcBaseResponseSchema.extend({
1984
1972
  var paymentMethodFilterSchema = wcBaseParamsSchema.extend({
1985
1973
  enabled: z.boolean().optional()
1986
1974
  });
1987
- var paymentMethodSchema2 = wcBaseResponseSchema.extend({
1975
+ var paymentMethodSchema = wcBaseResponseSchema.extend({
1988
1976
  id: getAppEnumZod("PAYMENT_METHODS"),
1989
1977
  title: z.string(),
1990
1978
  description: z.string(),
@@ -2047,6 +2035,8 @@ var productSchema2 = wcBaseResponseSchema.extend({
2047
2035
  on_sale: z.boolean(),
2048
2036
  manufacturer: z.string().optional()
2049
2037
  });
2038
+
2039
+ // ../schemas/src/woocommerce/admin-api/products/category.schema.ts
2050
2040
  var productCategorySchema2 = wcBaseResponseSchema.extend({
2051
2041
  id: z.number(),
2052
2042
  name: z.string(),
@@ -2080,6 +2070,8 @@ var createCategorySchema = productCategorySchema2.omit({
2080
2070
  }).extend({
2081
2071
  name: z.string().min(1, "Name is required")
2082
2072
  });
2073
+
2074
+ // ../schemas/src/woocommerce/admin-api/index.ts
2083
2075
  var schemas = {
2084
2076
  resources: {
2085
2077
  product: {
@@ -2092,7 +2084,7 @@ var schemas = {
2092
2084
  },
2093
2085
  order: {
2094
2086
  filter: orderFilterSchema,
2095
- entity: orderSchema2,
2087
+ entity: orderSchema,
2096
2088
  lineItem: orderLineItemSchema
2097
2089
  },
2098
2090
  customer: {
@@ -2108,11 +2100,11 @@ var schemas = {
2108
2100
  },
2109
2101
  paymentMethod: {
2110
2102
  filter: paymentMethodFilterSchema,
2111
- entity: paymentMethodSchema2
2103
+ entity: paymentMethodSchema
2112
2104
  }
2113
2105
  }
2114
2106
  };
2115
2107
 
2116
- export { WooCommerceApiError, WooCommerceDataValidationError, addToCartInputSchema, addressSchema, categoryFilterSchema as adminCategoryFilterSchema, couponFilterSchema as adminCouponFilterSchema, couponSchema as adminCouponSchema, orderFilterSchema as adminOrderFilterSchema, orderSchema2 as adminOrderSchema, productCategorySchema2 as adminProductCategorySchema, productFilterSchema as adminProductFilterSchema, productSchema2 as adminProductSchema, billingAddressSchemaMandatory as billingAddressSchema, cartItemImageSchema, cartSchema, checkoutInputSchema, checkoutSchema, couponInputSchema, createCategorySchema, createClient, createCouponSchema, createCustomerSchema, customerFilterSchema, customerSchema, getAppEnumRaw, getAppEnumZod, paginationMetaSchema, paginationParamsSchema, paymentMethodFilterSchema, paymentMethodSchema2 as paymentMethodSchema, productCategorySchema, productImageSchema, productSchema, removeCartItemInputSchema, schemas, storeProductsSearchParamsSchema as searchParamsSchema, selectShippingRateInputSchema, storeApiOrderSchema, updateCartItemInputSchema, updateCustomerInputSchema, updateCustomerSchema, wcErrorResponseSchema };
2108
+ export { WooCommerceApiError, WooCommerceDataValidationError, 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, billingAddressSchemaMandatory as billingAddressSchema, cartItemImageSchema, cartSchema, checkoutInputSchema, checkoutSchema, couponInputSchema, createCategorySchema, createClient, createCouponSchema, createCustomerSchema, createPaginatedSchema, customerFilterSchema, customerSchema, getAppEnumRaw, getAppEnumZod, paginationMetaSchema, paginationParamsSchema, paymentMethodFilterSchema, paymentMethodSchema, productCategorySchema, productImageSchema, productSchema, removeCartItemInputSchema, schemas, storeProductsSearchParamsSchema as searchParamsSchema, selectShippingRateInputSchema, storeApiOrderSchema, updateCartItemInputSchema, updateCustomerInputSchema, updateCustomerSchema, wcBaseParamsSchema, wcErrorResponseSchema, wcPaginationMetaSchema };
2117
2109
  //# sourceMappingURL=index.mjs.map
2118
2110
  //# sourceMappingURL=index.mjs.map