@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/index.mjs
CHANGED
|
@@ -1431,6 +1431,15 @@ var productSchema = z.object({
|
|
|
1431
1431
|
review_count: z.number(),
|
|
1432
1432
|
extensions: z.record(z.string(), z.unknown())
|
|
1433
1433
|
});
|
|
1434
|
+
z.object({
|
|
1435
|
+
/** Attribution source type (e.g., 'mobile_app', 'organic', 'referral') */
|
|
1436
|
+
source_type: z.string(),
|
|
1437
|
+
/** UTM source identifier (e.g., 'moja-apoteka-app', 'google') */
|
|
1438
|
+
utm_source: z.string(),
|
|
1439
|
+
/** Device type (e.g., 'mobile', 'desktop', 'tablet') */
|
|
1440
|
+
device_type: z.string()
|
|
1441
|
+
});
|
|
1442
|
+
var ORDER_ATTRIBUTION_NAMESPACE = "woocommerce/order-attribution";
|
|
1434
1443
|
|
|
1435
1444
|
// src/api/cart.ts
|
|
1436
1445
|
var createCartAPI = (client, endpoints, options) => ({
|
|
@@ -1469,13 +1478,20 @@ var createCartAPI = (client, endpoints, options) => ({
|
|
|
1469
1478
|
});
|
|
1470
1479
|
|
|
1471
1480
|
// src/api/checkout.ts
|
|
1472
|
-
var createCheckoutAPI = (client, endpoints, options) => ({
|
|
1481
|
+
var createCheckoutAPI = (client, endpoints, options, orderAttribution) => ({
|
|
1473
1482
|
get: async () => {
|
|
1474
1483
|
const response = await client.get(endpoints.checkout);
|
|
1475
1484
|
return handleApiResponse(response, checkoutSchema, options);
|
|
1476
1485
|
},
|
|
1477
1486
|
process: async (input) => {
|
|
1478
|
-
const
|
|
1487
|
+
const body = orderAttribution ? {
|
|
1488
|
+
...input,
|
|
1489
|
+
extensions: {
|
|
1490
|
+
[ORDER_ATTRIBUTION_NAMESPACE]: orderAttribution,
|
|
1491
|
+
...input.extensions
|
|
1492
|
+
}
|
|
1493
|
+
} : input;
|
|
1494
|
+
const response = await client.post(endpoints.checkout, body);
|
|
1479
1495
|
return handleApiResponse(response, checkoutSchema, options);
|
|
1480
1496
|
}
|
|
1481
1497
|
});
|
|
@@ -1561,7 +1577,12 @@ var createClient = (config) => {
|
|
|
1561
1577
|
axios: axiosInstance,
|
|
1562
1578
|
products: createProductsAPI(axiosInstance, endpoints, responseOptions),
|
|
1563
1579
|
cart: createCartAPI(axiosInstance, endpoints, responseOptions),
|
|
1564
|
-
checkout: createCheckoutAPI(
|
|
1580
|
+
checkout: createCheckoutAPI(
|
|
1581
|
+
axiosInstance,
|
|
1582
|
+
endpoints,
|
|
1583
|
+
responseOptions,
|
|
1584
|
+
fullConfig.orderAttribution
|
|
1585
|
+
),
|
|
1565
1586
|
orders: createOrdersAPI(axiosInstance, endpoints, responseOptions)
|
|
1566
1587
|
};
|
|
1567
1588
|
setupRequestInterceptor(axiosInstance, fullConfig, client);
|