arky-sdk 0.3.21 → 0.3.24
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 +277 -61
- package/dist/index.cjs +33 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -14
- package/dist/index.d.ts +6 -14
- package/dist/index.js +33 -55
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +13 -55
- package/dist/types.d.ts +13 -55
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,114 +1,330 @@
|
|
|
1
|
-
#
|
|
1
|
+
# arky-sdk
|
|
2
2
|
|
|
3
3
|
Official TypeScript SDK for Arky - All-in-one business platform
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install
|
|
8
|
+
npm install arky-sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
13
|
-
### API Client (No State)
|
|
14
|
-
|
|
15
13
|
```typescript
|
|
16
|
-
import {
|
|
14
|
+
import { createArkySDK } from 'arky-sdk'
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const arky = createArkySDK({
|
|
17
|
+
baseUrl: 'https://api.arky.io',
|
|
20
18
|
businessId: 'your-business-id',
|
|
21
|
-
storageUrl: 'https://storage.arky.io'
|
|
19
|
+
storageUrl: 'https://storage.arky.io',
|
|
20
|
+
market: 'us',
|
|
21
|
+
getToken: () => ({
|
|
22
|
+
accessToken: localStorage.getItem('accessToken') || '',
|
|
23
|
+
refreshToken: localStorage.getItem('refreshToken') || '',
|
|
24
|
+
provider: 'EMAIL',
|
|
25
|
+
expiresAt: 0,
|
|
26
|
+
}),
|
|
27
|
+
setToken: (tokens) => {
|
|
28
|
+
localStorage.setItem('accessToken', tokens.accessToken);
|
|
29
|
+
localStorage.setItem('refreshToken', tokens.refreshToken);
|
|
30
|
+
},
|
|
31
|
+
logout: () => {
|
|
32
|
+
localStorage.removeItem('accessToken');
|
|
33
|
+
localStorage.removeItem('refreshToken');
|
|
34
|
+
},
|
|
35
|
+
isAuthenticated: () => !!localStorage.getItem('accessToken'),
|
|
22
36
|
})
|
|
23
37
|
|
|
24
|
-
// Now use the
|
|
25
|
-
|
|
38
|
+
// Now use the SDK
|
|
39
|
+
const collections = await arky.cms.getCollections({});
|
|
40
|
+
const products = await arky.eshop.getProducts({});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## API Methods
|
|
44
|
+
|
|
45
|
+
The SDK provides the following API modules:
|
|
46
|
+
|
|
47
|
+
### User Management
|
|
48
|
+
```typescript
|
|
49
|
+
// Authentication
|
|
50
|
+
await arky.user.loginUser({ email, password })
|
|
51
|
+
await arky.user.registerUser({ email, password, name })
|
|
52
|
+
await arky.user.getMe()
|
|
53
|
+
await arky.user.logout()
|
|
54
|
+
|
|
55
|
+
// Profile
|
|
56
|
+
await arky.user.updateUser({ name, phoneNumber, addresses })
|
|
57
|
+
await arky.user.resetPassword({ oldPassword, newPassword })
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Business
|
|
61
|
+
```typescript
|
|
62
|
+
// Business CRUD
|
|
63
|
+
await arky.business.createBusiness({ name, slug })
|
|
64
|
+
await arky.business.getBusiness()
|
|
65
|
+
await arky.business.updateBusiness({ id, name })
|
|
66
|
+
await arky.business.deleteBusiness({ id })
|
|
67
|
+
|
|
68
|
+
// Subscriptions
|
|
69
|
+
await arky.business.createSubscription({ planId })
|
|
70
|
+
await arky.business.getSubscription()
|
|
71
|
+
await arky.business.cancelSubscription({ immediately: true })
|
|
72
|
+
```
|
|
26
73
|
|
|
27
|
-
|
|
28
|
-
|
|
74
|
+
### CMS & Newsletters
|
|
75
|
+
```typescript
|
|
76
|
+
// Collections
|
|
77
|
+
await arky.cms.createCollection({ name, slug, type: 'NEWSLETTER' })
|
|
78
|
+
await arky.cms.getCollections({ type: 'NEWSLETTER' })
|
|
79
|
+
await arky.cms.getCollection({ id })
|
|
80
|
+
await arky.cms.updateCollection({ id, name })
|
|
81
|
+
await arky.cms.deleteCollection({ id })
|
|
82
|
+
|
|
83
|
+
// Entries (Content)
|
|
84
|
+
await arky.cms.createCollectionEntry({ collectionId, blocks })
|
|
85
|
+
await arky.cms.getCollectionEntries({ collectionId })
|
|
86
|
+
await arky.cms.updateCollectionEntry({ id, blocks })
|
|
87
|
+
await arky.cms.sendEntry({ entryId, scheduledAt })
|
|
88
|
+
|
|
89
|
+
// Newsletter Subscriptions
|
|
90
|
+
await arky.cms.subscribeToCollection({
|
|
91
|
+
collectionId: 'newsletter_id',
|
|
92
|
+
email: 'user@example.com',
|
|
93
|
+
planId: 'plan_free', // Required
|
|
94
|
+
})
|
|
95
|
+
await arky.cms.getCollectionSubscribers({ id: 'newsletter_id' })
|
|
96
|
+
await arky.cms.unsubscribeFromCollection({ token: 'unsubscribe_token' })
|
|
29
97
|
```
|
|
30
98
|
|
|
31
|
-
###
|
|
99
|
+
### E-shop
|
|
100
|
+
```typescript
|
|
101
|
+
// Products
|
|
102
|
+
await arky.eshop.createProduct({ name, description, variants })
|
|
103
|
+
await arky.eshop.getProducts({ limit: 20, cursor: null })
|
|
104
|
+
await arky.eshop.getProduct({ id })
|
|
105
|
+
await arky.eshop.updateProduct({ id, name })
|
|
106
|
+
|
|
107
|
+
// Orders
|
|
108
|
+
await arky.eshop.checkout({ items, paymentMethod, shippingMethodId })
|
|
109
|
+
await arky.eshop.getOrders({})
|
|
110
|
+
await arky.eshop.getOrder({ id })
|
|
111
|
+
await arky.eshop.updateOrderStatus({ id, status: 'SHIPPED' })
|
|
112
|
+
|
|
113
|
+
// Quote
|
|
114
|
+
await arky.eshop.getQuote({
|
|
115
|
+
items: [{ productId, variantId, quantity }],
|
|
116
|
+
currency: 'usd',
|
|
117
|
+
paymentMethod: 'CREDIT_CARD',
|
|
118
|
+
})
|
|
119
|
+
```
|
|
32
120
|
|
|
121
|
+
### Reservations
|
|
33
122
|
```typescript
|
|
34
|
-
|
|
35
|
-
|
|
123
|
+
// Services
|
|
124
|
+
await arky.reservation.createService({ name, duration, price })
|
|
125
|
+
await arky.reservation.getServices({})
|
|
126
|
+
await arky.reservation.getAvailableSlots({ serviceId, start, end })
|
|
127
|
+
|
|
128
|
+
// Providers
|
|
129
|
+
await arky.reservation.createProvider({ name, serviceIds })
|
|
130
|
+
await arky.reservation.getProviders({})
|
|
131
|
+
|
|
132
|
+
// Reservations
|
|
133
|
+
await arky.reservation.createReservation({ parts, blocks })
|
|
134
|
+
await arky.reservation.checkout({ parts, paymentMethod })
|
|
135
|
+
await arky.reservation.searchReservations({ start, end })
|
|
136
|
+
```
|
|
36
137
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
138
|
+
### Media
|
|
139
|
+
```typescript
|
|
140
|
+
// Upload files
|
|
141
|
+
const media = await arky.media.uploadBusinessMedia({
|
|
142
|
+
files: [file1, file2],
|
|
143
|
+
urls: ['https://example.com/image.jpg'],
|
|
40
144
|
})
|
|
41
145
|
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
146
|
+
// List media
|
|
147
|
+
const { items } = await arky.media.getBusinessMedia({ limit: 20 })
|
|
148
|
+
|
|
149
|
+
// Delete media
|
|
150
|
+
await arky.media.deleteBusinessMedia({ id: businessId, mediaId })
|
|
45
151
|
```
|
|
46
152
|
|
|
47
|
-
|
|
153
|
+
### Notifications
|
|
154
|
+
```typescript
|
|
155
|
+
// Get notifications
|
|
156
|
+
const notifications = await arky.notification.getNotifications({
|
|
157
|
+
limit: 20,
|
|
158
|
+
previous_id: null,
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
// Mark as seen
|
|
162
|
+
await arky.notification.updateNotifications({})
|
|
48
163
|
|
|
49
|
-
|
|
164
|
+
// Delivery stats
|
|
165
|
+
const stats = await arky.notification.getDeliveryStats({})
|
|
166
|
+
```
|
|
50
167
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
168
|
+
### Analytics
|
|
169
|
+
```typescript
|
|
170
|
+
// Query metrics
|
|
171
|
+
const data = await arky.analytics.getAnalytics({
|
|
172
|
+
start: '2024-01-01',
|
|
173
|
+
end: '2024-12-31',
|
|
174
|
+
metrics: ['revenue', 'orders', 'users'],
|
|
175
|
+
})
|
|
55
176
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
</button>
|
|
177
|
+
// Health check
|
|
178
|
+
const health = await arky.analytics.getAnalyticsHealth({})
|
|
59
179
|
```
|
|
60
180
|
|
|
61
|
-
###
|
|
181
|
+
### Roles & Permissions
|
|
182
|
+
```typescript
|
|
183
|
+
await arky.role.createRole({ name, permissions })
|
|
184
|
+
await arky.role.getRoles({ action: 'READ' })
|
|
185
|
+
await arky.role.updateRole({ id, permissions })
|
|
186
|
+
await arky.user.setRole({ userId, roleId })
|
|
187
|
+
```
|
|
62
188
|
|
|
63
|
-
|
|
64
|
-
|
|
189
|
+
## Utility Functions
|
|
190
|
+
|
|
191
|
+
The SDK includes helpful utilities accessible via `arky.utils`:
|
|
192
|
+
|
|
193
|
+
### Block Utilities
|
|
194
|
+
```typescript
|
|
195
|
+
// Get image URL from block
|
|
196
|
+
const url = arky.utils.getImageUrl(imageBlock)
|
|
197
|
+
|
|
198
|
+
// Get block values
|
|
199
|
+
const value = arky.utils.getBlockValue(entry, 'title')
|
|
200
|
+
const values = arky.utils.getBlockValues(entry, 'gallery')
|
|
201
|
+
const text = arky.utils.getBlockTextValue(block, 'en')
|
|
202
|
+
|
|
203
|
+
// Format blocks
|
|
204
|
+
const formatted = arky.utils.formatBlockValue(block)
|
|
205
|
+
const forSubmit = arky.utils.prepareBlocksForSubmission(blocks)
|
|
65
206
|
```
|
|
66
207
|
|
|
208
|
+
### Price Utilities
|
|
67
209
|
```typescript
|
|
68
|
-
|
|
69
|
-
|
|
210
|
+
// Format prices
|
|
211
|
+
const formatted = arky.utils.formatMinor(999, 'usd') // "$9.99"
|
|
212
|
+
const payment = arky.utils.formatPayment(paymentObject)
|
|
70
213
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
214
|
+
// Get market prices
|
|
215
|
+
const price = arky.utils.getMarketPrice(prices, 'US', markets)
|
|
216
|
+
const amount = arky.utils.getPriceAmount(prices, 'US')
|
|
217
|
+
|
|
218
|
+
// Currency
|
|
219
|
+
const symbol = arky.utils.getCurrencySymbol('USD') // "$"
|
|
75
220
|
```
|
|
76
221
|
|
|
77
|
-
###
|
|
222
|
+
### Text Utilities
|
|
223
|
+
```typescript
|
|
224
|
+
const slug = arky.utils.slugify('Hello World') // "hello-world"
|
|
225
|
+
const title = arky.utils.humanize('hello-world') // "Hello World"
|
|
226
|
+
const category = arky.utils.categorify('hello-world') // "HELLO WORLD"
|
|
227
|
+
const date = arky.utils.formatDate(timestamp, 'en')
|
|
228
|
+
```
|
|
78
229
|
|
|
79
|
-
|
|
80
|
-
|
|
230
|
+
### Validation
|
|
231
|
+
```typescript
|
|
232
|
+
const result = arky.utils.validatePhoneNumber('+1234567890')
|
|
233
|
+
// { isValid: true } or { isValid: false, error: "..." }
|
|
81
234
|
```
|
|
82
235
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
236
|
+
### SVG Utilities
|
|
237
|
+
```typescript
|
|
238
|
+
// Fetch SVG content
|
|
239
|
+
const svgString = await arky.utils.fetchSvgContent(mediaBlock)
|
|
87
240
|
|
|
88
|
-
|
|
89
|
-
|
|
241
|
+
// For Astro
|
|
242
|
+
const svg = await arky.utils.getSvgContentForAstro(mediaBlock)
|
|
90
243
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
</template>
|
|
244
|
+
// Inject into element
|
|
245
|
+
await arky.utils.injectSvgIntoElement(mediaBlock, element, 'custom-class')
|
|
94
246
|
```
|
|
95
247
|
|
|
96
248
|
## Features
|
|
97
249
|
|
|
98
|
-
- 🚀 TypeScript-first
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
- 🔄
|
|
102
|
-
-
|
|
250
|
+
- 🚀 **TypeScript-first** - Full type safety and IntelliSense
|
|
251
|
+
- 📦 **Tree-shakeable** - Import only what you need
|
|
252
|
+
- ⚡ **Lightweight** - Minimal bundle size (~120KB)
|
|
253
|
+
- 🔄 **Auto-refresh** - Automatic token refresh
|
|
254
|
+
- 🎯 **Framework-agnostic** - Works with any JavaScript framework
|
|
103
255
|
|
|
104
256
|
## Modules
|
|
105
257
|
|
|
106
|
-
- **CMS** - Headless content management
|
|
107
|
-
- **E-shop** - E-commerce
|
|
108
|
-
- **Reservations** - Booking system
|
|
109
|
-
- **
|
|
110
|
-
- **
|
|
258
|
+
- **CMS** - Headless content management, newsletters, AI blocks
|
|
259
|
+
- **E-shop** - E-commerce, products, orders, checkout
|
|
260
|
+
- **Reservations** - Booking system, services, providers
|
|
261
|
+
- **Business** - Multi-tenant business management
|
|
262
|
+
- **User** - Authentication, profiles, roles
|
|
263
|
+
- **Media** - File upload, image management
|
|
264
|
+
- **Notifications** - Push, email, SMS
|
|
265
|
+
- **Analytics** - Business metrics and insights
|
|
266
|
+
- **Payment** - Stripe integration, quotes
|
|
267
|
+
|
|
268
|
+
## Configuration Options
|
|
269
|
+
|
|
270
|
+
```typescript
|
|
271
|
+
createArkySDK({
|
|
272
|
+
// Required
|
|
273
|
+
baseUrl: string, // API URL
|
|
274
|
+
businessId: string, // Your business ID
|
|
275
|
+
market: string, // Market code (e.g., 'us', 'eu')
|
|
276
|
+
|
|
277
|
+
// Token management
|
|
278
|
+
getToken: () => TokenData,
|
|
279
|
+
setToken: (tokens: TokenData) => void,
|
|
280
|
+
|
|
281
|
+
// Optional
|
|
282
|
+
storageUrl?: string, // Storage URL (default: https://storage.arky.io/dev)
|
|
283
|
+
autoGuest?: boolean, // Auto-create guest token (default: true)
|
|
284
|
+
logout?: () => void, // Logout callback
|
|
285
|
+
isAuthenticated?: () => boolean,
|
|
286
|
+
navigate?: (path: string) => void,
|
|
287
|
+
notify?: (notification: { message: string; type: string }) => void,
|
|
288
|
+
})
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## TypeScript Support
|
|
292
|
+
|
|
293
|
+
The SDK is written in TypeScript and provides full type definitions:
|
|
294
|
+
|
|
295
|
+
```typescript
|
|
296
|
+
import type {
|
|
297
|
+
HttpClientConfig,
|
|
298
|
+
ApiResponse,
|
|
299
|
+
Block,
|
|
300
|
+
Business,
|
|
301
|
+
Price,
|
|
302
|
+
// ... and many more
|
|
303
|
+
} from 'arky-sdk'
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Migration from Newsletter Module
|
|
307
|
+
|
|
308
|
+
Newsletters are now CMS Collections with `type: 'NEWSLETTER'`:
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
// Old (deprecated)
|
|
312
|
+
await sdk.newsletter.subscribe({ newsletterId, email })
|
|
313
|
+
|
|
314
|
+
// New
|
|
315
|
+
await sdk.cms.subscribeToCollection({
|
|
316
|
+
collectionId: newsletterId,
|
|
317
|
+
email,
|
|
318
|
+
planId: 'plan_free', // Required
|
|
319
|
+
})
|
|
320
|
+
```
|
|
111
321
|
|
|
112
322
|
## License
|
|
113
323
|
|
|
114
324
|
MIT
|
|
325
|
+
|
|
326
|
+
## Links
|
|
327
|
+
|
|
328
|
+
- [Documentation](https://docs.arky.io)
|
|
329
|
+
- [GitHub](https://github.com/0xDjole/arky-sdk)
|
|
330
|
+
- [npm](https://www.npmjs.com/package/arky-sdk)
|
package/dist/index.cjs
CHANGED
|
@@ -206,7 +206,7 @@ var createUserApi = (apiConfig) => {
|
|
|
206
206
|
}
|
|
207
207
|
});
|
|
208
208
|
},
|
|
209
|
-
async
|
|
209
|
+
async setRole(params, options) {
|
|
210
210
|
return apiConfig.httpClient.put("/v1/users/set-role", params, options);
|
|
211
211
|
},
|
|
212
212
|
// ===== AUTHENTICATION =====
|
|
@@ -404,7 +404,11 @@ var createRoleApi = (apiConfig) => {
|
|
|
404
404
|
return apiConfig.httpClient.post(`/v1/roles`, params, options);
|
|
405
405
|
},
|
|
406
406
|
async updateRole(params, options) {
|
|
407
|
-
return apiConfig.httpClient.put(
|
|
407
|
+
return apiConfig.httpClient.put(
|
|
408
|
+
`/v1/roles/${params.id}`,
|
|
409
|
+
params,
|
|
410
|
+
options
|
|
411
|
+
);
|
|
408
412
|
},
|
|
409
413
|
async deleteRole(params, options) {
|
|
410
414
|
return apiConfig.httpClient.delete(`/v1/roles/${params.id}`, options);
|
|
@@ -416,7 +420,7 @@ var createRoleApi = (apiConfig) => {
|
|
|
416
420
|
return apiConfig.httpClient.get(`/v1/roles`, {
|
|
417
421
|
...options,
|
|
418
422
|
params: {
|
|
419
|
-
|
|
423
|
+
action: params.action,
|
|
420
424
|
businessId: apiConfig.businessId
|
|
421
425
|
}
|
|
422
426
|
});
|
|
@@ -612,7 +616,7 @@ var createCmsApi = (apiConfig) => {
|
|
|
612
616
|
{
|
|
613
617
|
businessId: apiConfig.businessId,
|
|
614
618
|
entryId,
|
|
615
|
-
scheduledAt: scheduledAt
|
|
619
|
+
scheduledAt: scheduledAt ?? Math.floor(Date.now() / 1e3)
|
|
616
620
|
},
|
|
617
621
|
options
|
|
618
622
|
);
|
|
@@ -623,6 +627,30 @@ var createCmsApi = (apiConfig) => {
|
|
|
623
627
|
`/v1/collections/entry-types/${params.entryType}/variables`,
|
|
624
628
|
options
|
|
625
629
|
);
|
|
630
|
+
},
|
|
631
|
+
// ===== COLLECTION SUBSCRIPTIONS =====
|
|
632
|
+
async getCollectionSubscribers(params, options) {
|
|
633
|
+
return apiConfig.httpClient.get(
|
|
634
|
+
`/v1/businesses/${apiConfig.businessId}/collections/${params.id}/subscribers`,
|
|
635
|
+
options
|
|
636
|
+
);
|
|
637
|
+
},
|
|
638
|
+
async subscribeToCollection(params, options) {
|
|
639
|
+
return apiConfig.httpClient.post(
|
|
640
|
+
`/v1/businesses/${apiConfig.businessId}/collections/${params.collectionId}/subscribe`,
|
|
641
|
+
{
|
|
642
|
+
email: params.email,
|
|
643
|
+
market: apiConfig.market,
|
|
644
|
+
planId: params.planId
|
|
645
|
+
},
|
|
646
|
+
options
|
|
647
|
+
);
|
|
648
|
+
},
|
|
649
|
+
async unsubscribeFromCollection(params, options) {
|
|
650
|
+
return apiConfig.httpClient.get(`/v1/businesses/${apiConfig.businessId}/collections/unsubscribe`, {
|
|
651
|
+
...options,
|
|
652
|
+
params
|
|
653
|
+
});
|
|
626
654
|
}
|
|
627
655
|
};
|
|
628
656
|
};
|
|
@@ -917,55 +945,6 @@ var createReservationApi = (apiConfig) => {
|
|
|
917
945
|
};
|
|
918
946
|
};
|
|
919
947
|
|
|
920
|
-
// src/api/newsletter.ts
|
|
921
|
-
var createNewsletterApi = (apiConfig) => {
|
|
922
|
-
return {
|
|
923
|
-
// ===== NEWSLETTERS =====
|
|
924
|
-
async find(params, options) {
|
|
925
|
-
return apiConfig.httpClient.get(`/v1/newsletters`, {
|
|
926
|
-
...options,
|
|
927
|
-
params: { businessId: apiConfig.businessId }
|
|
928
|
-
});
|
|
929
|
-
},
|
|
930
|
-
async get(params, options) {
|
|
931
|
-
return apiConfig.httpClient.get(`/v1/newsletters/${params.id}`, options);
|
|
932
|
-
},
|
|
933
|
-
async create(params, options) {
|
|
934
|
-
return apiConfig.httpClient.post(`/v1/newsletters`, params, options);
|
|
935
|
-
},
|
|
936
|
-
async update(params, options) {
|
|
937
|
-
return apiConfig.httpClient.put(`/v1/newsletters/${params.id}`, params, options);
|
|
938
|
-
},
|
|
939
|
-
async delete(params, options) {
|
|
940
|
-
return apiConfig.httpClient.delete(`/v1/newsletters/${params.id}`, options);
|
|
941
|
-
},
|
|
942
|
-
// ===== SUBSCRIBERS =====
|
|
943
|
-
async getSubscribers(params, options) {
|
|
944
|
-
return apiConfig.httpClient.get(`/v1/newsletters/${params.id}/subscribers`, options);
|
|
945
|
-
},
|
|
946
|
-
async subscribe(params, options) {
|
|
947
|
-
const payload = {
|
|
948
|
-
...params,
|
|
949
|
-
market: apiConfig.market
|
|
950
|
-
};
|
|
951
|
-
return apiConfig.httpClient.post(
|
|
952
|
-
`/v1/newsletters/${params.newsletterId}/subscribe`,
|
|
953
|
-
payload,
|
|
954
|
-
options
|
|
955
|
-
);
|
|
956
|
-
},
|
|
957
|
-
async unsubscribe(params, options) {
|
|
958
|
-
return apiConfig.httpClient.post(`/v1/newsletters/unsubscribe`, params, options);
|
|
959
|
-
},
|
|
960
|
-
async unsubscribeWithToken(params, options) {
|
|
961
|
-
return apiConfig.httpClient.get(`/v1/newsletters/unsubscribe`, {
|
|
962
|
-
...options,
|
|
963
|
-
params
|
|
964
|
-
});
|
|
965
|
-
}
|
|
966
|
-
};
|
|
967
|
-
};
|
|
968
|
-
|
|
969
948
|
// src/api/payment.ts
|
|
970
949
|
var createPaymentApi = (apiConfig) => {
|
|
971
950
|
return {
|
|
@@ -1517,7 +1496,7 @@ async function injectSvgIntoElement(mediaObject, targetElement, className) {
|
|
|
1517
1496
|
}
|
|
1518
1497
|
|
|
1519
1498
|
// src/index.ts
|
|
1520
|
-
var SDK_VERSION = "0.3.
|
|
1499
|
+
var SDK_VERSION = "0.3.24";
|
|
1521
1500
|
var SUPPORTED_FRAMEWORKS = [
|
|
1522
1501
|
"astro",
|
|
1523
1502
|
"react",
|
|
@@ -1553,7 +1532,6 @@ function createArkySDK(config) {
|
|
|
1553
1532
|
cms: createCmsApi(apiConfig),
|
|
1554
1533
|
eshop: createEshopApi(apiConfig),
|
|
1555
1534
|
reservation: createReservationApi(apiConfig),
|
|
1556
|
-
newsletter: createNewsletterApi(apiConfig),
|
|
1557
1535
|
payment: createPaymentApi(apiConfig),
|
|
1558
1536
|
setBusinessId: (businessId) => {
|
|
1559
1537
|
apiConfig.businessId = businessId;
|