arky-sdk 0.7.117 → 0.7.118
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 +32 -30
- package/dist/admin.cjs +4 -2
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.js +4 -2
- package/dist/admin.js.map +1 -1
- package/dist/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/storefront.cjs +4 -2
- package/dist/storefront.cjs.map +1 -1
- package/dist/storefront.js +4 -2
- package/dist/storefront.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +4 -4
- package/dist/types.d.ts +4 -4
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# arky-sdk
|
|
2
2
|
|
|
3
|
-
Official TypeScript SDK for [Arky](https://arky.io) — Build online stores with headless CMS, e-commerce, and
|
|
3
|
+
Official TypeScript SDK for [Arky](https://arky.io) — Build online stores with headless CMS, e-commerce, and service scheduling.
|
|
4
4
|
|
|
5
5
|
## What is Arky?
|
|
6
6
|
|
|
@@ -8,12 +8,12 @@ Arky is an **all-in-one platform** that gives you everything you need to run an
|
|
|
8
8
|
|
|
9
9
|
- 📝 **Headless CMS** - Manage content with flexible blocks, multilingual support, and AI-powered content generation
|
|
10
10
|
- 🛒 **E-commerce** - Sell products with multi-currency pricing, inventory, orders, and Stripe payments
|
|
11
|
-
- 📅 **
|
|
11
|
+
- 📅 **Service Scheduling** - Sell scheduled services with providers and availability calendars
|
|
12
12
|
- 📧 **Newsletters** - Send newsletters to subscribers with built-in email delivery
|
|
13
13
|
- 👥 **User Management** - Authentication, roles, permissions, and user profiles
|
|
14
14
|
- 💳 **Payments** - Integrated Stripe checkout and promo codes
|
|
15
15
|
|
|
16
|
-
**Build any online store:** SaaS products, e-commerce shops,
|
|
16
|
+
**Build any online store:** SaaS products, e-commerce shops, service businesses, content sites, newsletters, or multi-tenant marketplaces.
|
|
17
17
|
|
|
18
18
|
## Why Use This SDK?
|
|
19
19
|
|
|
@@ -92,31 +92,33 @@ const order = await arky.eshop.checkout({
|
|
|
92
92
|
});
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
### 4.
|
|
95
|
+
### 4. Sell Scheduled Services
|
|
96
96
|
|
|
97
97
|
```typescript
|
|
98
98
|
// Browse services (like arky.io/services)
|
|
99
|
-
const { items: services } = await arky.
|
|
99
|
+
const { items: services } = await arky.eshop.service.find({});
|
|
100
100
|
|
|
101
101
|
// Check available time slots
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
const availability = await arky.eshop.service.getAvailability({
|
|
103
|
+
service_id: 'service_haircut',
|
|
104
|
+
provider_id: 'provider_jane',
|
|
105
|
+
from: Math.floor(Date.now() / 1000),
|
|
106
|
+
to: Math.floor(Date.now() / 1000) + 86400,
|
|
106
107
|
});
|
|
107
108
|
|
|
108
|
-
//
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
// Create an order with a service line
|
|
110
|
+
const order = await arky.eshop.order.checkout({
|
|
111
|
+
items: [{
|
|
112
|
+
type: 'service',
|
|
113
|
+
service_id: 'service_haircut',
|
|
114
|
+
provider_id: 'provider_jane',
|
|
115
|
+
slots: [{
|
|
116
|
+
from: availability.available_slots[0].from,
|
|
117
|
+
to: availability.available_slots[0].to,
|
|
118
|
+
}],
|
|
114
119
|
}],
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
{ key: 'name', values: ['John Doe'] },
|
|
118
|
-
{ key: 'phone', values: ['+1234567890'] }
|
|
119
|
-
]
|
|
120
|
+
payment_method: 'cash',
|
|
121
|
+
forms: [],
|
|
120
122
|
});
|
|
121
123
|
```
|
|
122
124
|
|
|
@@ -227,21 +229,21 @@ await arky.eshop.getQuote({
|
|
|
227
229
|
})
|
|
228
230
|
```
|
|
229
231
|
|
|
230
|
-
###
|
|
232
|
+
### Services
|
|
231
233
|
```typescript
|
|
232
234
|
// Services
|
|
233
|
-
await arky.
|
|
234
|
-
await arky.
|
|
235
|
-
await arky.
|
|
235
|
+
await arky.eshop.service.create({ name, duration, price })
|
|
236
|
+
await arky.eshop.service.find({})
|
|
237
|
+
await arky.eshop.service.getAvailability({ service_id, provider_id, from, to })
|
|
236
238
|
|
|
237
239
|
// Providers
|
|
238
|
-
await arky.
|
|
239
|
-
await arky.
|
|
240
|
+
await arky.eshop.provider.create({ name })
|
|
241
|
+
await arky.eshop.provider.find({})
|
|
240
242
|
|
|
241
|
-
//
|
|
242
|
-
await arky.
|
|
243
|
-
await arky.
|
|
244
|
-
await arky.
|
|
243
|
+
// Service orders
|
|
244
|
+
await arky.eshop.order.getQuote({ items, payment_method })
|
|
245
|
+
await arky.eshop.order.checkout({ items, payment_method })
|
|
246
|
+
await arky.eshop.order.find({})
|
|
245
247
|
```
|
|
246
248
|
|
|
247
249
|
### Media
|
package/dist/admin.cjs
CHANGED
|
@@ -130,7 +130,8 @@ var getImageUrl = (imageBlock, isBlock = true) => {
|
|
|
130
130
|
function normalizeOrderQuoteItems(items) {
|
|
131
131
|
return items.map((item) => {
|
|
132
132
|
if ("type" in item) {
|
|
133
|
-
|
|
133
|
+
const type = item.type;
|
|
134
|
+
return type === "booking" ? { ...item, type: "service" } : item;
|
|
134
135
|
}
|
|
135
136
|
if ("product_id" in item) {
|
|
136
137
|
return { type: "product", ...item };
|
|
@@ -141,7 +142,8 @@ function normalizeOrderQuoteItems(items) {
|
|
|
141
142
|
function normalizeOrderCheckoutItems(items) {
|
|
142
143
|
return items.map((item) => {
|
|
143
144
|
if ("type" in item) {
|
|
144
|
-
|
|
145
|
+
const type = item.type;
|
|
146
|
+
return type === "booking" ? { ...item, type: "service" } : item;
|
|
145
147
|
}
|
|
146
148
|
if ("product_id" in item) {
|
|
147
149
|
return { type: "product", ...item };
|