arky-sdk 0.7.116 → 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 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 booking systems.
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
- - 📅 **Booking System** - Manage services, providers, and reservations with availability calendars
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, booking platforms, content sites, newsletters, or multi-tenant marketplaces.
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. Book Services
95
+ ### 4. Sell Scheduled Services
96
96
 
97
97
  ```typescript
98
98
  // Browse services (like arky.io/services)
99
- const { items: services } = await arky.reservation.getServices({});
99
+ const { items: services } = await arky.eshop.service.find({});
100
100
 
101
101
  // Check available time slots
102
- const slots = await arky.reservation.getAvailableSlots({
103
- serviceId: 'service_haircut',
104
- from: Date.now(),
105
- to: Date.now() + 86400000 // Next 24 hours
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
- // Book a reservation
109
- const reservation = await arky.reservation.checkout({
110
- parts: [{
111
- serviceId: 'service_haircut',
112
- startTime: slots[0].startTime,
113
- providerId: 'provider_jane'
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
- paymentMethod: 'CREDIT_CARD',
116
- blocks: [ // Customer contact info
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
- ### Reservations
232
+ ### Services
231
233
  ```typescript
232
234
  // Services
233
- await arky.reservation.createService({ name, duration, price })
234
- await arky.reservation.getServices({})
235
- await arky.reservation.getAvailableSlots({ serviceId, start, end })
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.reservation.createProvider({ name, serviceIds })
239
- await arky.reservation.getProviders({})
240
+ await arky.eshop.provider.create({ name })
241
+ await arky.eshop.provider.find({})
240
242
 
241
- // Reservations
242
- await arky.reservation.createReservation({ parts, blocks })
243
- await arky.reservation.checkout({ parts, paymentMethod })
244
- await arky.reservation.searchReservations({ start, end })
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,23 +130,25 @@ var getImageUrl = (imageBlock, isBlock = true) => {
130
130
  function normalizeOrderQuoteItems(items) {
131
131
  return items.map((item) => {
132
132
  if ("type" in item) {
133
- return item;
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 };
137
138
  }
138
- return { type: "booking", ...item };
139
+ return { type: "service", ...item };
139
140
  });
140
141
  }
141
142
  function normalizeOrderCheckoutItems(items) {
142
143
  return items.map((item) => {
143
144
  if ("type" in item) {
144
- return item;
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 };
148
150
  }
149
- return { type: "booking", ...item };
151
+ return { type: "service", ...item };
150
152
  });
151
153
  }
152
154