arky-sdk 0.1.0 → 0.1.2

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.
Files changed (104) hide show
  1. package/dist/config-CPkOgumU.d.cts +16 -0
  2. package/dist/config-CPkOgumU.d.ts +16 -0
  3. package/dist/index.cjs +1615 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +268 -0
  6. package/dist/index.d.ts +268 -26
  7. package/dist/index.js +1555 -56
  8. package/dist/index.js.map +1 -0
  9. package/dist/stores.cjs +2148 -0
  10. package/dist/stores.cjs.map +1 -0
  11. package/dist/stores.d.cts +218 -0
  12. package/dist/stores.d.ts +218 -0
  13. package/dist/stores.js +2111 -0
  14. package/dist/stores.js.map +1 -0
  15. package/dist/types.cjs +13 -0
  16. package/dist/types.cjs.map +1 -0
  17. package/dist/{types/index.d.ts → types.d.cts} +25 -24
  18. package/dist/types.d.ts +245 -0
  19. package/dist/types.js +11 -0
  20. package/dist/types.js.map +1 -0
  21. package/dist/utils.cjs +725 -0
  22. package/dist/utils.cjs.map +1 -0
  23. package/dist/utils.d.cts +9 -0
  24. package/dist/utils.d.ts +9 -0
  25. package/dist/utils.js +680 -0
  26. package/dist/utils.js.map +1 -0
  27. package/dist/validation-C9UAYKke.d.cts +245 -0
  28. package/dist/validation-DIvAzYjG.d.ts +245 -0
  29. package/package.json +17 -11
  30. package/dist/api/cms.d.ts +0 -19
  31. package/dist/api/cms.d.ts.map +0 -1
  32. package/dist/api/cms.js +0 -41
  33. package/dist/api/eshop.d.ts +0 -89
  34. package/dist/api/eshop.d.ts.map +0 -1
  35. package/dist/api/eshop.js +0 -183
  36. package/dist/api/index.d.ts +0 -6
  37. package/dist/api/index.d.ts.map +0 -1
  38. package/dist/api/index.js +0 -5
  39. package/dist/api/newsletter.d.ts +0 -32
  40. package/dist/api/newsletter.d.ts.map +0 -1
  41. package/dist/api/newsletter.js +0 -70
  42. package/dist/api/reservation.d.ts +0 -84
  43. package/dist/api/reservation.d.ts.map +0 -1
  44. package/dist/api/reservation.js +0 -239
  45. package/dist/config.d.ts +0 -15
  46. package/dist/config.d.ts.map +0 -1
  47. package/dist/config.js +0 -20
  48. package/dist/index.d.ts.map +0 -1
  49. package/dist/services/auth.d.ts +0 -17
  50. package/dist/services/auth.d.ts.map +0 -1
  51. package/dist/services/auth.js +0 -62
  52. package/dist/services/http.d.ts +0 -20
  53. package/dist/services/http.d.ts.map +0 -1
  54. package/dist/services/http.js +0 -73
  55. package/dist/stores/business.d.ts +0 -28
  56. package/dist/stores/business.d.ts.map +0 -1
  57. package/dist/stores/business.js +0 -122
  58. package/dist/stores/cart.d.ts +0 -8
  59. package/dist/stores/cart.d.ts.map +0 -1
  60. package/dist/stores/cart.js +0 -20
  61. package/dist/stores/eshop.d.ts +0 -121
  62. package/dist/stores/eshop.d.ts.map +0 -1
  63. package/dist/stores/eshop.js +0 -377
  64. package/dist/stores/index.d.ts +0 -7
  65. package/dist/stores/index.d.ts.map +0 -1
  66. package/dist/stores/index.js +0 -19
  67. package/dist/stores/reservation.d.ts +0 -237
  68. package/dist/stores/reservation.d.ts.map +0 -1
  69. package/dist/stores/reservation.js +0 -853
  70. package/dist/types/index.d.ts.map +0 -1
  71. package/dist/types/index.js +0 -8
  72. package/dist/utils/blocks.d.ts +0 -30
  73. package/dist/utils/blocks.d.ts.map +0 -1
  74. package/dist/utils/blocks.js +0 -237
  75. package/dist/utils/currency.d.ts +0 -9
  76. package/dist/utils/currency.d.ts.map +0 -1
  77. package/dist/utils/currency.js +0 -99
  78. package/dist/utils/errors.d.ts +0 -121
  79. package/dist/utils/errors.d.ts.map +0 -1
  80. package/dist/utils/errors.js +0 -114
  81. package/dist/utils/i18n.d.ts +0 -5
  82. package/dist/utils/i18n.d.ts.map +0 -1
  83. package/dist/utils/i18n.js +0 -37
  84. package/dist/utils/index.d.ts +0 -9
  85. package/dist/utils/index.d.ts.map +0 -1
  86. package/dist/utils/index.js +0 -10
  87. package/dist/utils/price.d.ts +0 -33
  88. package/dist/utils/price.d.ts.map +0 -1
  89. package/dist/utils/price.js +0 -141
  90. package/dist/utils/queryParams.d.ts +0 -21
  91. package/dist/utils/queryParams.d.ts.map +0 -1
  92. package/dist/utils/queryParams.js +0 -47
  93. package/dist/utils/svg.d.ts +0 -17
  94. package/dist/utils/svg.d.ts.map +0 -1
  95. package/dist/utils/svg.js +0 -62
  96. package/dist/utils/text.d.ts +0 -26
  97. package/dist/utils/text.d.ts.map +0 -1
  98. package/dist/utils/text.js +0 -64
  99. package/dist/utils/timezone.d.ts +0 -9
  100. package/dist/utils/timezone.d.ts.map +0 -1
  101. package/dist/utils/timezone.js +0 -49
  102. package/dist/utils/validation.d.ts +0 -9
  103. package/dist/utils/validation.d.ts.map +0 -1
  104. package/dist/utils/validation.js +0 -44
package/dist/index.d.ts CHANGED
@@ -1,26 +1,268 @@
1
- export * from './config';
2
- export type { ArkyConfig } from './config';
3
- export * from './types';
4
- export type { ApiResponse, EshopCartItem, EshopStoreState, ReservationStoreState, ReservationCartPart, Business, Block, Price } from './types';
5
- export * from './api';
6
- export * from './services/auth';
7
- export { default as httpClient } from './services/http';
8
- export * from './utils/blocks';
9
- export * from './utils/errors';
10
- export * from './utils/price';
11
- export * from './utils/svg';
12
- export * from './utils/text';
13
- export * from './utils/timezone';
14
- export * from './utils/validation';
15
- export { validatePhoneNumber, validateEmail, validateVerificationCode, validateRequired } from './utils/validation';
16
- export { getBlockLabel, getBlockTextValue, getBlockValue, getBlockValues, getImageUrl, thumbnailUrl } from './utils/blocks';
17
- export { getGuestToken, updateProfilePhone, verifyPhoneCode, getBusinessConfig } from './services/auth';
18
- export { fetchSvgContent, getSvgContentForAstro, injectSvgIntoElement } from './utils/svg';
19
- export { slugify, humanize, categorify, formatDate } from './utils/text';
20
- export { findTimeZone, tzGroups } from './utils/timezone';
21
- export { getErrorMessage, isErrorCode, ERROR_CODES, ERROR_CONSTANTS } from './utils/errors';
22
- export declare const SDK_VERSION = "0.1.0";
23
- export declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
24
- import { type ArkyConfig } from './config';
25
- export declare function initArky(config: ArkyConfig): ArkyConfig;
26
- //# sourceMappingURL=index.d.ts.map
1
+ import { A as ArkyConfig } from './config-CPkOgumU.js';
2
+ export { a as API_URL, B as BUSINESS_ID, S as STORAGE_URL, g as getGlobalConfig, s as setGlobalConfig } from './config-CPkOgumU.js';
3
+ import { ApiResponse, Quote, PaginatedResponse, Newsletter, Payment } from './types.js';
4
+ export { Block, Business, BusinessConfig, BusinessPaymentMethod, EshopCartItem, EshopStoreState, Location, Market, MarketConfigClient, PaymentMethod, PaymentProviderConfig, Price, PromoCodeValidation, QuoteLineItem, ReservationCartPart, ReservationStoreState, ShippingMethod, Zone } from './types.js';
5
+ export { C as Collection, w as CollectionEntry, E as ERROR_CODES, u as ERROR_CONSTANTS, R as RequestError, S as ServerError, V as ValidationError, W as ValidationResult, m as categorify, H as convertServerErrorToRequestError, J as convertToMajor, K as convertToMinor, U as createPaymentForCheckout, I as errors, z as extractBlockValues, i as fetchSvgContent, o as findTimeZone, x as formatBlockValue, N as formatCurrencyAmount, n as formatDate, O as formatMinor, P as formatPayment, B as getBlockFromArray, g as getBlockLabel, A as getBlockObjectValues, d as getBlockTextValue, e as getBlockValue, f as getBlockValues, M as getCurrencyFromMarket, q as getErrorMessage, D as getGalleryThumbnail, h as getImageUrl, Q as getMarketPrice, T as getPriceAmount, j as getSvgContentForAstro, L as getSymbol, l as humanize, k as injectSvgIntoElement, r as isErrorCode, y as prepareBlocksForSubmission, s as slugify, t as thumbnailUrl, G as transformErrors, F as translateMap, p as tzGroups, a as validateEmail, v as validatePhoneNumber, c as validateRequired, b as validateVerificationCode } from './validation-DIvAzYjG.js';
6
+
7
+ /**
8
+ * Query parameter builder utility that maintains exact backward compatibility
9
+ * with existing API parameter encoding patterns
10
+ */
11
+ interface QueryParams {
12
+ [key: string]: string | number | boolean | string[] | number[] | null | undefined;
13
+ }
14
+
15
+ interface HttpOptions {
16
+ successMessage?: string;
17
+ errorMessage?: string;
18
+ schema?: any;
19
+ params?: QueryParams;
20
+ }
21
+ interface HttpResponse<T = any> {
22
+ value: T;
23
+ success: boolean;
24
+ error?: string;
25
+ }
26
+ declare function get<T = any>(url: string, options?: HttpOptions): Promise<HttpResponse<T>>;
27
+ declare function post<T = any>(url: string, data: any, options?: HttpOptions): Promise<HttpResponse<T>>;
28
+ declare const httpClient: {
29
+ get: typeof get;
30
+ post: typeof post;
31
+ };
32
+
33
+ declare const cmsApi: {
34
+ getCollection: (id: string) => Promise<any>;
35
+ getCollections: ({ name, ids }: {
36
+ name?: string | null;
37
+ ids?: string[] | null;
38
+ }) => Promise<any>;
39
+ getCollectionEntries: ({ collectionId, limit, cursor, ids }: {
40
+ collectionId: string;
41
+ limit?: number;
42
+ cursor?: string;
43
+ ids?: string[] | null;
44
+ }) => Promise<any>;
45
+ getCollectionEntry: ({ collectionId, id }: {
46
+ collectionId: string;
47
+ id: string;
48
+ }) => Promise<HttpResponse<any>>;
49
+ createCollectionEntry: (collectionEntryData: any) => Promise<HttpResponse<any>>;
50
+ };
51
+
52
+ declare const eshopApi: {
53
+ getProducts({ businessId, categoryIds, status, limit, cursor }: {
54
+ businessId: string;
55
+ categoryIds?: string[] | null;
56
+ status?: string;
57
+ limit?: number;
58
+ cursor?: string | null;
59
+ }): Promise<{
60
+ success: boolean;
61
+ data: any;
62
+ cursor: any;
63
+ total: any;
64
+ error?: undefined;
65
+ } | {
66
+ success: boolean;
67
+ error: string;
68
+ data: any[];
69
+ cursor?: undefined;
70
+ total?: undefined;
71
+ }>;
72
+ getProductBySlug({ businessId, slug }: {
73
+ businessId: string;
74
+ slug: string;
75
+ }): Promise<{
76
+ success: boolean;
77
+ data: any;
78
+ error?: undefined;
79
+ } | {
80
+ success: boolean;
81
+ error: any;
82
+ data: any;
83
+ }>;
84
+ getQuote({ token, businessId, items, market, currency, userId, paymentMethod, shippingMethodId, promoCode }: {
85
+ token: string;
86
+ businessId: string;
87
+ items: {
88
+ productId: string;
89
+ variantId: string;
90
+ quantity: number;
91
+ }[];
92
+ market: string;
93
+ currency: string;
94
+ userId: string;
95
+ paymentMethod: string;
96
+ shippingMethodId?: string;
97
+ promoCode?: string;
98
+ }): Promise<ApiResponse<Quote>>;
99
+ checkout({ token, businessId, items, paymentMethod, blocks, market, shippingMethodId, promoCode, paymentIntentId }: {
100
+ token: string;
101
+ businessId: string;
102
+ items: any[];
103
+ paymentMethod: string;
104
+ blocks: any[];
105
+ market?: string;
106
+ shippingMethodId?: string;
107
+ promoCode?: string;
108
+ paymentIntentId?: string | null;
109
+ }): Promise<{
110
+ success: boolean;
111
+ error: any;
112
+ code: any;
113
+ data?: undefined;
114
+ } | {
115
+ success: boolean;
116
+ data: any;
117
+ error?: undefined;
118
+ code?: undefined;
119
+ } | {
120
+ success: boolean;
121
+ error: any;
122
+ code?: undefined;
123
+ data?: undefined;
124
+ }>;
125
+ createPaymentIntent({ amount, currency, businessId }: {
126
+ amount: number;
127
+ currency: string;
128
+ businessId: string;
129
+ }): Promise<{
130
+ success: boolean;
131
+ data: any;
132
+ error?: undefined;
133
+ } | {
134
+ success: boolean;
135
+ error: any;
136
+ data?: undefined;
137
+ }>;
138
+ };
139
+
140
+ declare const reservationApi: {
141
+ getQuote({ token, businessId, market, currency, userId, parts, paymentMethod, promoCode, }: {
142
+ token: string;
143
+ businessId: string;
144
+ market: string;
145
+ currency: string;
146
+ userId: string;
147
+ parts: any[];
148
+ paymentMethod?: string;
149
+ promoCode?: string;
150
+ }): Promise<ApiResponse<Quote>>;
151
+ getAvailableSlots({ businessId, serviceId, from, to, limit, providerId, }: {
152
+ businessId: string;
153
+ serviceId: string;
154
+ from: number;
155
+ to: number;
156
+ limit?: number;
157
+ providerId?: string | null;
158
+ }): Promise<{
159
+ success: boolean;
160
+ data: any;
161
+ error?: undefined;
162
+ } | {
163
+ success: boolean;
164
+ error: string;
165
+ data: any[];
166
+ }>;
167
+ getProviders({ businessId, serviceId, limit }: {
168
+ businessId: string;
169
+ serviceId: string;
170
+ limit?: number;
171
+ }): Promise<{
172
+ success: boolean;
173
+ data: any;
174
+ error?: undefined;
175
+ } | {
176
+ success: boolean;
177
+ error: string;
178
+ data: any[];
179
+ }>;
180
+ getGuestToken(): Promise<ApiResponse<{
181
+ token: string;
182
+ }>>;
183
+ updateProfilePhone({ token, phoneNumber }: {
184
+ token: string;
185
+ phoneNumber: string;
186
+ }): Promise<{
187
+ success: boolean;
188
+ error?: undefined;
189
+ } | {
190
+ success: boolean;
191
+ error: any;
192
+ }>;
193
+ verifyPhoneCode({ token, phoneNumber, code }: {
194
+ token: string;
195
+ phoneNumber: string;
196
+ code: string;
197
+ }): Promise<{
198
+ success: boolean;
199
+ error?: undefined;
200
+ } | {
201
+ success: boolean;
202
+ error: any;
203
+ }>;
204
+ checkout({ token, businessId, parts, paymentMethod, blocks, market, promoCode }: {
205
+ token: string;
206
+ businessId: string;
207
+ parts: any[];
208
+ paymentMethod?: string;
209
+ blocks?: any[];
210
+ market?: string;
211
+ promoCode?: string;
212
+ }): Promise<{
213
+ success: boolean;
214
+ data: any;
215
+ error?: undefined;
216
+ } | {
217
+ success: boolean;
218
+ error: any;
219
+ data?: undefined;
220
+ }>;
221
+ };
222
+
223
+ interface NewsletterFindPayload {
224
+ business_id: string;
225
+ }
226
+ interface NewsletterSubscribePayload {
227
+ newsletterId: string;
228
+ email: string;
229
+ customerId?: string;
230
+ payment?: Payment;
231
+ }
232
+ declare const newsletterApi: {
233
+ find(payload: NewsletterFindPayload): Promise<PaginatedResponse<Newsletter>>;
234
+ get(id: string): Promise<Newsletter>;
235
+ subscribe(payload: NewsletterSubscribePayload): Promise<{
236
+ success: boolean;
237
+ data: any;
238
+ error?: undefined;
239
+ } | {
240
+ success: boolean;
241
+ error: string;
242
+ data?: undefined;
243
+ }>;
244
+ };
245
+
246
+ declare function getGuestToken(currentToken?: string | null): Promise<string>;
247
+ declare function updateProfilePhone(token: string, phoneNumber: string): Promise<{
248
+ success: boolean;
249
+ }>;
250
+ declare function verifyPhoneCode(token: string, phoneNumber: string, code: string): Promise<{
251
+ success: boolean;
252
+ }>;
253
+ declare function getBusinessConfig(businessId: string): Promise<{
254
+ success: boolean;
255
+ data: any;
256
+ error?: undefined;
257
+ } | {
258
+ success: boolean;
259
+ error: any;
260
+ data?: undefined;
261
+ }>;
262
+
263
+ declare const SDK_VERSION = "0.1.2";
264
+ declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
265
+
266
+ declare function initArky(config: ArkyConfig): ArkyConfig;
267
+
268
+ export { ApiResponse, ArkyConfig, Newsletter, PaginatedResponse, Payment, Quote, SDK_VERSION, SUPPORTED_FRAMEWORKS, cmsApi, eshopApi, getBusinessConfig, getGuestToken, httpClient, initArky, newsletterApi, reservationApi, updateProfilePhone, verifyPhoneCode };