@atomic-solutions/woocommerce-api-client 0.1.4 → 0.1.5
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 +24 -3
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +24 -3
- 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 +24 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -3
- package/dist/index.mjs.map +1 -1
- package/dist/{types-B09FKPkT.d.mts → types-B7CKE1bj.d.mts} +16 -0
- package/dist/{types-B09FKPkT.d.ts → types-B7CKE1bj.d.ts} +16 -0
- package/dist/utils/index.d.mts +2 -2
- package/dist/utils/index.d.ts +2 -2
- package/package.json +2 -2
package/dist/http/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as WooCommerceConfig, a as WooCommerceClient } from '../types-
|
|
2
|
-
export { P as PaginatedResponse, R as ResponseOptions, V as ValidationMode, h as handleApiResponse, b as handlePaginatedApiResponse, i as isZodError, s as setupErrorInterceptor } from '../types-
|
|
1
|
+
import { W as WooCommerceConfig, a as WooCommerceClient } from '../types-B7CKE1bj.mjs';
|
|
2
|
+
export { P as PaginatedResponse, R as ResponseOptions, V as ValidationMode, h as handleApiResponse, b as handlePaginatedApiResponse, i as isZodError, s as setupErrorInterceptor } from '../types-B7CKE1bj.mjs';
|
|
3
3
|
import { AxiosInstance } from 'axios';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
package/dist/http/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as WooCommerceConfig, a as WooCommerceClient } from '../types-
|
|
2
|
-
export { P as PaginatedResponse, R as ResponseOptions, V as ValidationMode, h as handleApiResponse, b as handlePaginatedApiResponse, i as isZodError, s as setupErrorInterceptor } from '../types-
|
|
1
|
+
import { W as WooCommerceConfig, a as WooCommerceClient } from '../types-B7CKE1bj.js';
|
|
2
|
+
export { P as PaginatedResponse, R as ResponseOptions, V as ValidationMode, h as handleApiResponse, b as handlePaginatedApiResponse, i as isZodError, s as setupErrorInterceptor } from '../types-B7CKE1bj.js';
|
|
3
3
|
import { AxiosInstance } from 'axios';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createClient } from './client/index.mjs';
|
|
2
|
-
import { B as BaseError, e as BaseErrorOptions, f as ValidationReportableData, g as WooCommerceDataValidationErrorOptions } from './types-
|
|
3
|
-
export { A as AddToCartInput, j as Cart, k as CartAPI, C as CartHeadersAdapter, l as CartItem, m as CartItemImage, n as Checkout, o as CheckoutAPI, p as CheckoutInput, q as CouponInput, G as GetOrderInput, J as JwtTokenAdapter, O as OrdersAPI, P as PaginatedResponse, r as Product, t as ProductCategory, u as ProductImage, v as ProductParams, w as ProductsAPI, x as RemoveCartItemInput, S as SelectShippingRateInput, y as StoreApiOrder, U as UpdateCartItemInput, z as UpdateCustomerInput, D as WooCommerceApiError, E as WooCommerceApiErrorOptions, a as WooCommerceClient, W as WooCommerceConfig, F as addToCartInputSchema, H as cartItemImageSchema, I as cartSchema, K as checkoutInputSchema, L as checkoutSchema, M as couponInputSchema, N as productCategorySchema, Q as productImageSchema, T as productSchema, X as removeCartItemInputSchema, Y as searchParamsSchema, Z as selectShippingRateInputSchema, _ as storeApiOrderSchema, $ as updateCartItemInputSchema, a0 as updateCustomerInputSchema } from './types-
|
|
2
|
+
import { B as BaseError, e as BaseErrorOptions, f as ValidationReportableData, g as WooCommerceDataValidationErrorOptions } from './types-B7CKE1bj.mjs';
|
|
3
|
+
export { A as AddToCartInput, j as Cart, k as CartAPI, C as CartHeadersAdapter, l as CartItem, m as CartItemImage, n as Checkout, o as CheckoutAPI, p as CheckoutInput, q as CouponInput, G as GetOrderInput, J as JwtTokenAdapter, O as OrdersAPI, P as PaginatedResponse, r as Product, t as ProductCategory, u as ProductImage, v as ProductParams, w as ProductsAPI, x as RemoveCartItemInput, S as SelectShippingRateInput, y as StoreApiOrder, U as UpdateCartItemInput, z as UpdateCustomerInput, D as WooCommerceApiError, E as WooCommerceApiErrorOptions, a as WooCommerceClient, W as WooCommerceConfig, F as addToCartInputSchema, H as cartItemImageSchema, I as cartSchema, K as checkoutInputSchema, L as checkoutSchema, M as couponInputSchema, N as productCategorySchema, Q as productImageSchema, T as productSchema, X as removeCartItemInputSchema, Y as searchParamsSchema, Z as selectShippingRateInputSchema, _ as storeApiOrderSchema, $ as updateCartItemInputSchema, a0 as updateCustomerInputSchema } from './types-B7CKE1bj.mjs';
|
|
4
4
|
import * as zod from 'zod';
|
|
5
5
|
import { ZodError, z } from 'zod';
|
|
6
6
|
import 'axios';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createClient } from './client/index.js';
|
|
2
|
-
import { B as BaseError, e as BaseErrorOptions, f as ValidationReportableData, g as WooCommerceDataValidationErrorOptions } from './types-
|
|
3
|
-
export { A as AddToCartInput, j as Cart, k as CartAPI, C as CartHeadersAdapter, l as CartItem, m as CartItemImage, n as Checkout, o as CheckoutAPI, p as CheckoutInput, q as CouponInput, G as GetOrderInput, J as JwtTokenAdapter, O as OrdersAPI, P as PaginatedResponse, r as Product, t as ProductCategory, u as ProductImage, v as ProductParams, w as ProductsAPI, x as RemoveCartItemInput, S as SelectShippingRateInput, y as StoreApiOrder, U as UpdateCartItemInput, z as UpdateCustomerInput, D as WooCommerceApiError, E as WooCommerceApiErrorOptions, a as WooCommerceClient, W as WooCommerceConfig, F as addToCartInputSchema, H as cartItemImageSchema, I as cartSchema, K as checkoutInputSchema, L as checkoutSchema, M as couponInputSchema, N as productCategorySchema, Q as productImageSchema, T as productSchema, X as removeCartItemInputSchema, Y as searchParamsSchema, Z as selectShippingRateInputSchema, _ as storeApiOrderSchema, $ as updateCartItemInputSchema, a0 as updateCustomerInputSchema } from './types-
|
|
2
|
+
import { B as BaseError, e as BaseErrorOptions, f as ValidationReportableData, g as WooCommerceDataValidationErrorOptions } from './types-B7CKE1bj.js';
|
|
3
|
+
export { A as AddToCartInput, j as Cart, k as CartAPI, C as CartHeadersAdapter, l as CartItem, m as CartItemImage, n as Checkout, o as CheckoutAPI, p as CheckoutInput, q as CouponInput, G as GetOrderInput, J as JwtTokenAdapter, O as OrdersAPI, P as PaginatedResponse, r as Product, t as ProductCategory, u as ProductImage, v as ProductParams, w as ProductsAPI, x as RemoveCartItemInput, S as SelectShippingRateInput, y as StoreApiOrder, U as UpdateCartItemInput, z as UpdateCustomerInput, D as WooCommerceApiError, E as WooCommerceApiErrorOptions, a as WooCommerceClient, W as WooCommerceConfig, F as addToCartInputSchema, H as cartItemImageSchema, I as cartSchema, K as checkoutInputSchema, L as checkoutSchema, M as couponInputSchema, N as productCategorySchema, Q as productImageSchema, T as productSchema, X as removeCartItemInputSchema, Y as searchParamsSchema, Z as selectShippingRateInputSchema, _ as storeApiOrderSchema, $ as updateCartItemInputSchema, a0 as updateCustomerInputSchema } from './types-B7CKE1bj.js';
|
|
4
4
|
import * as zod from 'zod';
|
|
5
5
|
import { ZodError, z } from 'zod';
|
|
6
6
|
import 'axios';
|
package/dist/index.js
CHANGED
|
@@ -1437,6 +1437,15 @@ var productSchema = zod.z.object({
|
|
|
1437
1437
|
review_count: zod.z.number(),
|
|
1438
1438
|
extensions: zod.z.record(zod.z.string(), zod.z.unknown())
|
|
1439
1439
|
});
|
|
1440
|
+
zod.z.object({
|
|
1441
|
+
/** Attribution source type (e.g., 'mobile_app', 'organic', 'referral') */
|
|
1442
|
+
source_type: zod.z.string(),
|
|
1443
|
+
/** UTM source identifier (e.g., 'moja-apoteka-app', 'google') */
|
|
1444
|
+
utm_source: zod.z.string(),
|
|
1445
|
+
/** Device type (e.g., 'mobile', 'desktop', 'tablet') */
|
|
1446
|
+
device_type: zod.z.string()
|
|
1447
|
+
});
|
|
1448
|
+
var ORDER_ATTRIBUTION_NAMESPACE = "woocommerce/order-attribution";
|
|
1440
1449
|
|
|
1441
1450
|
// src/api/cart.ts
|
|
1442
1451
|
var createCartAPI = (client, endpoints, options) => ({
|
|
@@ -1475,13 +1484,20 @@ var createCartAPI = (client, endpoints, options) => ({
|
|
|
1475
1484
|
});
|
|
1476
1485
|
|
|
1477
1486
|
// src/api/checkout.ts
|
|
1478
|
-
var createCheckoutAPI = (client, endpoints, options) => ({
|
|
1487
|
+
var createCheckoutAPI = (client, endpoints, options, orderAttribution) => ({
|
|
1479
1488
|
get: async () => {
|
|
1480
1489
|
const response = await client.get(endpoints.checkout);
|
|
1481
1490
|
return handleApiResponse(response, checkoutSchema, options);
|
|
1482
1491
|
},
|
|
1483
1492
|
process: async (input) => {
|
|
1484
|
-
const
|
|
1493
|
+
const body = orderAttribution ? {
|
|
1494
|
+
...input,
|
|
1495
|
+
extensions: {
|
|
1496
|
+
[ORDER_ATTRIBUTION_NAMESPACE]: orderAttribution,
|
|
1497
|
+
...input.extensions
|
|
1498
|
+
}
|
|
1499
|
+
} : input;
|
|
1500
|
+
const response = await client.post(endpoints.checkout, body);
|
|
1485
1501
|
return handleApiResponse(response, checkoutSchema, options);
|
|
1486
1502
|
}
|
|
1487
1503
|
});
|
|
@@ -1567,7 +1583,12 @@ var createClient = (config) => {
|
|
|
1567
1583
|
axios: axiosInstance,
|
|
1568
1584
|
products: createProductsAPI(axiosInstance, endpoints, responseOptions),
|
|
1569
1585
|
cart: createCartAPI(axiosInstance, endpoints, responseOptions),
|
|
1570
|
-
checkout: createCheckoutAPI(
|
|
1586
|
+
checkout: createCheckoutAPI(
|
|
1587
|
+
axiosInstance,
|
|
1588
|
+
endpoints,
|
|
1589
|
+
responseOptions,
|
|
1590
|
+
fullConfig.orderAttribution
|
|
1591
|
+
),
|
|
1571
1592
|
orders: createOrdersAPI(axiosInstance, endpoints, responseOptions)
|
|
1572
1593
|
};
|
|
1573
1594
|
setupRequestInterceptor(axiosInstance, fullConfig, client);
|