arky-sdk 0.7.117 → 0.7.119

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
@@ -340,7 +342,7 @@ await arky.utils.injectSvgIntoElement(mediaBlock, element, 'custom-class')
340
342
 
341
343
  - 🏪 **E-commerce shops** - Product catalogs, shopping carts, checkout
342
344
  - 📰 **Content websites** - Blogs, documentation, marketing sites
343
- - 📅 **Booking platforms** - Appointment scheduling, service bookings
345
+ - 📅 **Service businesses** - Appointment scheduling, service orders
344
346
  - 📬 **Newsletter platforms** - Subscriber management, email campaigns
345
347
  - 🏢 **SaaS products** - Multi-tenant apps with user auth and billing
346
348
  - 🛍️ **Marketplaces** - Multi-vendor platforms with payments
@@ -391,7 +393,7 @@ When adding a new SDK method, follow this checklist so the API surface stays typ
391
393
  2. **Define the request params** in `src/types/api.ts`. Mirror the Rust DTO in `server/core/src/{module}/types/commands.rs` field-for-field. Two exceptions: `store_id?: string` and `market?: string` are optional in TS (the SDK auto-fills both from `apiConfig.storeId` and `apiConfig.market`). Do **not** use `[key: string]: any` index signatures.
392
394
  3. **Annotate the SDK method's return type** using the matching entity from `src/types/index.ts`.
393
395
  4. **Pass the response generic to the HTTP call**: `apiConfig.httpClient.post<EntityType>(...)`, `apiConfig.httpClient.get<PaginatedResponse<EntityType>>(...)`, etc. Never rely on inference.
394
- 5. **Inject `market` from `apiConfig`**: when a body needs a `market` field, write `{ market: apiConfig.market, ...payload }`. Never hardcode `"booking"`, `"eshop"`, or any other market string in `src/api/*.ts`.
396
+ 5. **Inject `market` from `apiConfig`**: when a body needs a `market` field, write `{ market: apiConfig.market, ...payload }`. Never hardcode `"default"`, `"eshop"`, or any other market string in `src/api/*.ts`.
395
397
  6. **Re-export the entity** from `src/index.ts` if consumers (admin, storefront) will import it.
396
398
  7. **Bump `SDK_VERSION`** in `src/index.ts` and the `version` in `package.json`. Patch only.
397
399
 
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
- return item.type === "booking" ? { ...item, type: "service" } : 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 };
@@ -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
- return item.type === "booking" ? { ...item, type: "service" } : 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 };