arky-sdk 0.7.119 → 0.7.120
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/README.md +31 -21
- package/dist/admin.cjs +24 -31
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.js +24 -31
- package/dist/admin.js.map +1 -1
- package/dist/index.cjs +106 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -9
- package/dist/index.d.ts +18 -9
- package/dist/index.js +106 -46
- package/dist/index.js.map +1 -1
- package/dist/storefront.cjs +81 -14
- package/dist/storefront.cjs.map +1 -1
- package/dist/storefront.js +81 -14
- package/dist/storefront.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +93 -10
- package/dist/types.d.ts +93 -10
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,19 +76,21 @@ const formatted = arky.utils.formatPrice(product.variants[0].prices); // "$29.99
|
|
|
76
76
|
### 3. Shop & Checkout
|
|
77
77
|
|
|
78
78
|
```typescript
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
79
|
+
const cart = await arky.eshop.cart.current();
|
|
80
|
+
|
|
81
|
+
await arky.eshop.cart.addItem({
|
|
82
|
+
id: cart.id,
|
|
83
|
+
item: {
|
|
84
|
+
type: 'product',
|
|
85
|
+
product_id: 'prod_123',
|
|
86
|
+
variant_id: 'var_456',
|
|
87
|
+
quantity: 2,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const order = await arky.eshop.cart.checkout({
|
|
92
|
+
id: cart.id,
|
|
93
|
+
payment_method_id: 'credit_card',
|
|
92
94
|
});
|
|
93
95
|
```
|
|
94
96
|
|
|
@@ -106,10 +108,12 @@ const availability = await arky.eshop.service.getAvailability({
|
|
|
106
108
|
to: Math.floor(Date.now() / 1000) + 86400,
|
|
107
109
|
});
|
|
108
110
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
const cart = await arky.eshop.cart.current();
|
|
112
|
+
|
|
113
|
+
await arky.eshop.cart.update({
|
|
114
|
+
id: cart.id,
|
|
111
115
|
items: [{
|
|
112
|
-
type: '
|
|
116
|
+
type: 'booking',
|
|
113
117
|
service_id: 'service_haircut',
|
|
114
118
|
provider_id: 'provider_jane',
|
|
115
119
|
slots: [{
|
|
@@ -117,9 +121,13 @@ const order = await arky.eshop.order.checkout({
|
|
|
117
121
|
to: availability.available_slots[0].to,
|
|
118
122
|
}],
|
|
119
123
|
}],
|
|
120
|
-
payment_method: 'cash',
|
|
121
124
|
forms: [],
|
|
122
125
|
});
|
|
126
|
+
|
|
127
|
+
const order = await arky.eshop.cart.checkout({
|
|
128
|
+
id: cart.id,
|
|
129
|
+
payment_method_id: 'cash',
|
|
130
|
+
});
|
|
123
131
|
```
|
|
124
132
|
|
|
125
133
|
### 5. Subscribe to Newsletter
|
|
@@ -215,8 +223,10 @@ await arky.eshop.getProducts({ limit: 20, cursor: null })
|
|
|
215
223
|
await arky.eshop.getProduct({ id })
|
|
216
224
|
await arky.eshop.updateProduct({ id, name })
|
|
217
225
|
|
|
218
|
-
//
|
|
219
|
-
await arky.eshop.
|
|
226
|
+
// Carts and orders
|
|
227
|
+
const cart = await arky.eshop.cart.current()
|
|
228
|
+
await arky.eshop.cart.update({ id: cart.id, items, shipping_method_id })
|
|
229
|
+
await arky.eshop.cart.checkout({ id: cart.id, payment_method_id })
|
|
220
230
|
await arky.eshop.getOrders({})
|
|
221
231
|
await arky.eshop.getOrder({ id })
|
|
222
232
|
await arky.eshop.updateOrderStatus({ id, status: 'SHIPPED' })
|
|
@@ -240,9 +250,9 @@ await arky.eshop.service.getAvailability({ service_id, provider_id, from, to })
|
|
|
240
250
|
await arky.eshop.provider.create({ name })
|
|
241
251
|
await arky.eshop.provider.find({})
|
|
242
252
|
|
|
243
|
-
// Service
|
|
253
|
+
// Service cart checkout
|
|
244
254
|
await arky.eshop.order.getQuote({ items, payment_method })
|
|
245
|
-
await arky.eshop.
|
|
255
|
+
await arky.eshop.cart.checkout({ id: cart.id, payment_method_id })
|
|
246
256
|
await arky.eshop.order.find({})
|
|
247
257
|
```
|
|
248
258
|
|
package/dist/admin.cjs
CHANGED
|
@@ -1042,35 +1042,6 @@ var createEshopApi = (apiConfig) => {
|
|
|
1042
1042
|
options
|
|
1043
1043
|
);
|
|
1044
1044
|
},
|
|
1045
|
-
async createOrder(params, options) {
|
|
1046
|
-
const { store_id, items, ...rest } = params;
|
|
1047
|
-
const target_store_id = store_id || apiConfig.storeId;
|
|
1048
|
-
const payload = {
|
|
1049
|
-
...rest,
|
|
1050
|
-
market: rest.market || apiConfig.market,
|
|
1051
|
-
items: normalizeOrderCheckoutItems(items)
|
|
1052
|
-
};
|
|
1053
|
-
return apiConfig.httpClient.post(
|
|
1054
|
-
`/v1/stores/${target_store_id}/orders`,
|
|
1055
|
-
payload,
|
|
1056
|
-
options
|
|
1057
|
-
);
|
|
1058
|
-
},
|
|
1059
|
-
async checkoutOrder(params, options) {
|
|
1060
|
-
const { store_id, items, ...rest } = params;
|
|
1061
|
-
const target_store_id = store_id || apiConfig.storeId;
|
|
1062
|
-
const payload = {
|
|
1063
|
-
...rest,
|
|
1064
|
-
store_id: target_store_id,
|
|
1065
|
-
market: rest.market || apiConfig.market,
|
|
1066
|
-
items: normalizeOrderCheckoutItems(items)
|
|
1067
|
-
};
|
|
1068
|
-
return apiConfig.httpClient.post(
|
|
1069
|
-
`/v1/stores/${target_store_id}/orders/checkout`,
|
|
1070
|
-
payload,
|
|
1071
|
-
options
|
|
1072
|
-
);
|
|
1073
|
-
},
|
|
1074
1045
|
async updateOrder(params, options) {
|
|
1075
1046
|
const { store_id, items, ...rest } = params;
|
|
1076
1047
|
const target_store_id = store_id || apiConfig.storeId;
|
|
@@ -1102,6 +1073,24 @@ var createEshopApi = (apiConfig) => {
|
|
|
1102
1073
|
}
|
|
1103
1074
|
);
|
|
1104
1075
|
},
|
|
1076
|
+
async getCarts(params = {}, options) {
|
|
1077
|
+
const { store_id, ...queryParams } = params;
|
|
1078
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1079
|
+
return apiConfig.httpClient.get(
|
|
1080
|
+
`/v1/stores/${target_store_id}/carts`,
|
|
1081
|
+
{
|
|
1082
|
+
...options,
|
|
1083
|
+
params: queryParams
|
|
1084
|
+
}
|
|
1085
|
+
);
|
|
1086
|
+
},
|
|
1087
|
+
async getCart(params, options) {
|
|
1088
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1089
|
+
return apiConfig.httpClient.get(
|
|
1090
|
+
`/v1/stores/${target_store_id}/carts/${params.id}`,
|
|
1091
|
+
options
|
|
1092
|
+
);
|
|
1093
|
+
},
|
|
1105
1094
|
async getQuote(params, options) {
|
|
1106
1095
|
const { location, store_id, items, ...rest } = params;
|
|
1107
1096
|
const target_store_id = store_id || apiConfig.storeId;
|
|
@@ -1271,6 +1260,8 @@ var createCustomerApi = (apiConfig) => {
|
|
|
1271
1260
|
if (params?.query) queryParams.query = params.query;
|
|
1272
1261
|
if (params?.taxonomy_query) queryParams.taxonomy_query = params.taxonomy_query;
|
|
1273
1262
|
if (params?.status) queryParams.status = params.status;
|
|
1263
|
+
if (params?.has_activity !== void 0) queryParams.has_activity = params.has_activity;
|
|
1264
|
+
if (params?.has_cart !== void 0) queryParams.has_cart = params.has_cart;
|
|
1274
1265
|
if (params?.sort_field) queryParams.sort_field = params.sort_field;
|
|
1275
1266
|
if (params?.sort_direction) queryParams.sort_direction = params.sort_direction;
|
|
1276
1267
|
return apiConfig.httpClient.get(
|
|
@@ -2286,14 +2277,16 @@ function createAdmin(config) {
|
|
|
2286
2277
|
find: eshopApi.getProducts
|
|
2287
2278
|
},
|
|
2288
2279
|
order: {
|
|
2289
|
-
create: eshopApi.createOrder,
|
|
2290
2280
|
update: eshopApi.updateOrder,
|
|
2291
2281
|
get: eshopApi.getOrder,
|
|
2292
2282
|
find: eshopApi.getOrders,
|
|
2293
2283
|
getQuote: eshopApi.getQuote,
|
|
2294
|
-
checkout: eshopApi.checkoutOrder,
|
|
2295
2284
|
processRefund: eshopApi.processRefund
|
|
2296
2285
|
},
|
|
2286
|
+
cart: {
|
|
2287
|
+
get: eshopApi.getCart,
|
|
2288
|
+
find: eshopApi.getCarts
|
|
2289
|
+
},
|
|
2297
2290
|
service: {
|
|
2298
2291
|
create: eshopApi.createService,
|
|
2299
2292
|
update: eshopApi.updateService,
|