arky-sdk 0.3.0 → 0.3.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.
package/dist/index.d.cts CHANGED
@@ -1,278 +1,410 @@
1
- import { ApiResponse, Quote, PaginatedResponse, Newsletter, Payment } from './types.cjs';
2
- export { Block, Business, BusinessConfig, BusinessPaymentMethod, EshopCartItem, EshopStoreState, Location, Market, MarketConfigClient, PaymentMethod, PaymentProviderConfig, Price, PromoCodeValidation, QuoteLineItem, ReservationCartPart, ReservationStoreState, ShippingMethod, Zone } from './types.cjs';
3
- 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-C9UAYKke.cjs';
1
+ import { CreateCollectionParams, RequestOptions, UpdateCollectionParams, DeleteCollectionParams, GetCollectionParams, GetCollectionsParams, GetEntriesParams, CreateEntryParams, UpdateEntryParams, DeleteCollectionEntryParams, GetCollectionEntryParams, SendEntryParams, GetVariableMetadataParams, CreateProductParams, UpdateProductParams, GetProductParams, GetProductsParams, GetProductBySlugParams, CreateOrderParams, UpdateOrderParams, GetOrderParams, GetOrdersParams, UpdateOrderStatusParams, UpdateOrderPaymentStatusParams, GetQuoteParams, CheckoutParams, CreateReservationParams, UpdateReservationParams, ReservationCheckoutParams, GetReservationParams, GetReservationPartsParams, SearchReservationsParams, SearchMyReservationsParams, GetReservationQuoteParams, CreateServiceParams, UpdateServiceParams, DeleteServiceParams, GetServiceParams, GetServicesParams, GetAvailableSlotsParams, CreateProviderParams, UpdateProviderParams, DeleteProviderParams, GetProviderParams, GetProvidersParams, GetBusinessServiceWorkingTimeParams, NewsletterFindParams, NewsletterGetParams, CreateNewsletterParams, UpdateNewsletterParams, DeleteNewsletterParams, GetSubscribersParams, NewsletterSubscribeParams, UnsubscribeParams, UpdateUserProfileParams, UpdateProfilePhoneParams, VerifyPhoneCodeParams, GetUsersParams, SetRoleParams, LoginUserParams, RegisterUserParams, ConfirmUserParams, GetLoginUrlParams, ForgotPasswordParams, ResetForgotPasswordParams, ResetPasswordParams, CreateBusinessParams, UpdateBusinessParams, DeleteBusinessParams, GetBusinessParams, GetBusinessParentsParams, TriggerBuildsParams, GetSubscriptionParams, CreateSubscriptionParams, UpdateSubscriptionParams, CancelSubscriptionParams, ReactivateSubscriptionParams, CreatePortalSessionParams, InviteUserParams, HandleInvitationParams, TestWebhookParams, UploadBusinessMediaParams, DeleteBusinessMediaParams, GetBusinessMediaParams, CreateRoleParams, UpdateRoleParams, DeleteRoleParams, GetRoleParams, GetRolesParams, GetNotificationsParams, TrackEmailOpenParams, GetDeliveryStatsParams, CreatePromoCodeParams, UpdatePromoCodeParams, DeletePromoCodeParams, GetPromoCodeParams, GetPromoCodesParams, GetAnalyticsParams, GetAnalyticsHealthParams, SetupAnalyticsParams, HandleStripeWebhookParams, GetBusinessMarketsParams, GetBusinessMarketParams } from './types.cjs';
2
+ export { ApiResponse, ApplyPromoCodeParams, Block, Business, BusinessConfig, BusinessPaymentMethod, CreateCollectionEntryParams, DeleteEntryParams, DeleteProductParams, EshopCartItem, EshopItem, EshopStoreState, GenerateBlocksParams, GetAllProductsParams, GetAllServicesParams, GetCollectionEntriesParams, GetEntryParams, GetInvoiceParams, GetPermissionsParams, GetPromoCodeByCodeParams, GetProvidersByServiceParams, GetRoleParentsParams, GetUserLocationParams, Location, LogoutParams, Market, MarketConfigClient, Newsletter, OAuthLoginParams, PaginatedResponse, Payment, PaymentMethod, PaymentProviderConfig, Price, PromoCodeValidation, Quote, QuoteLineItem, ReservationCartPart, ReservationConfirmParams, ReservationStoreState, ScheduleSetParams, SearchAvailableSlotsParams, ShippingMethod, UpdatePromoCodeStatusParams, UpdateUserParams, ValidatePromoCodeParams, Zone } from './types.cjs';
3
+ import { g as getGalleryThumbnail, a as getMarketPrice, b as getPriceAmount, f as formatPayment, c as formatMinor, d as createPaymentForCheckout, e as getCurrencySymbol, v as validatePhoneNumber, h as findTimeZone } from './index-DOEos-hV.cjs';
4
+ export { C as Collection, i as CollectionEntry, E as ERROR_CODES, x as ERROR_CONSTANTS, R as RequestError, S as SYMBOL_AFTER_CURRENCIES, y as ServerError, V as ValidationError, U as ValidationResult, P as categorify, D as convertServerErrorToRequestError, G as convertToMajor, H as convertToMinor, F as errors, l as extractBlockValues, K as fetchSvgContent, k as formatBlockValue, J as formatCurrencyAmount, Q as formatDate, r as getBlockFromArray, j as getBlockLabel, q as getBlockObjectValues, m as getBlockTextValue, n as getBlockValue, o as getBlockValues, I as getCurrencyFromMarket, z as getErrorMessage, s as getImageUrl, L as getSvgContentForAstro, O as humanize, M as injectSvgIntoElement, A as isErrorCode, w as isSymbolAfterCurrency, p as prepareBlocksForSubmission, N as slugify, t as thumbnailUrl, B as transformErrors, u as translateMap, T as tzGroups, W as validateEmail, Y as validateRequired, X as validateVerificationCode } from './index-DOEos-hV.cjs';
4
5
 
5
- interface ArkyConfig {
6
- apiUrl: string;
7
- businessId: string;
8
- storageUrl?: string;
9
- auth?: {
10
- type: 'guest' | 'api-token';
11
- apiToken?: string;
12
- };
13
- }
14
- declare function setGlobalConfig(config: ArkyConfig): void;
15
- declare function getGlobalConfig(): ArkyConfig;
6
+ declare const createCmsApi: (apiConfig: ApiConfig) => {
7
+ createCollection(params: CreateCollectionParams, options?: RequestOptions): Promise<any>;
8
+ updateCollection(params: UpdateCollectionParams, options?: RequestOptions): Promise<any>;
9
+ deleteCollection(params: DeleteCollectionParams, options?: RequestOptions): Promise<any>;
10
+ getCollection(params: GetCollectionParams, options?: RequestOptions): Promise<any>;
11
+ getCollections(params?: GetCollectionsParams, options?: RequestOptions): Promise<any>;
12
+ generateBlocks(params: any, options?: RequestOptions): Promise<any>;
13
+ getCollectionEntries(params?: GetEntriesParams, options?: RequestOptions): Promise<any>;
14
+ createCollectionEntry(params: CreateEntryParams, options?: RequestOptions): Promise<any>;
15
+ updateCollectionEntry(params: UpdateEntryParams, options?: RequestOptions): Promise<any>;
16
+ deleteCollectionEntry(params: DeleteCollectionEntryParams, options?: RequestOptions): Promise<any>;
17
+ getCollectionEntry(params: GetCollectionEntryParams, options?: RequestOptions): Promise<any>;
18
+ sendEntry(params: SendEntryParams, options?: RequestOptions): Promise<any>;
19
+ getVariableMetadata(params: GetVariableMetadataParams, options?: RequestOptions): Promise<any>;
20
+ };
16
21
 
17
- /**
18
- * Query parameter builder utility that maintains exact backward compatibility
19
- * with existing API parameter encoding patterns
20
- */
21
- interface QueryParams {
22
- [key: string]: string | number | boolean | string[] | number[] | null | undefined;
23
- }
22
+ declare const createEshopApi: (apiConfig: ApiConfig) => {
23
+ createProduct(params: CreateProductParams, options?: RequestOptions): Promise<any>;
24
+ updateProduct(params: UpdateProductParams, options?: RequestOptions): Promise<any>;
25
+ deleteProduct(id: string, options?: RequestOptions): Promise<any>;
26
+ getProduct(params: GetProductParams, options?: RequestOptions): Promise<any>;
27
+ getProducts(params?: GetProductsParams, options?: RequestOptions): Promise<any>;
28
+ getProductBySlug(params: GetProductBySlugParams, options?: RequestOptions): Promise<any>;
29
+ createOrder(params: CreateOrderParams, options?: RequestOptions): Promise<any>;
30
+ updateOrder(params: UpdateOrderParams, options?: RequestOptions): Promise<any>;
31
+ getOrder(params: GetOrderParams, options?: RequestOptions): Promise<any>;
32
+ getOrders(params?: GetOrdersParams, options?: RequestOptions): Promise<any>;
33
+ updateOrderStatus(params: UpdateOrderStatusParams, options?: RequestOptions): Promise<any>;
34
+ updateOrderPaymentStatus(params: UpdateOrderPaymentStatusParams, options?: RequestOptions): Promise<any>;
35
+ getQuote(params: GetQuoteParams, options?: RequestOptions): Promise<any>;
36
+ checkout(params: CheckoutParams, options?: RequestOptions): Promise<any>;
37
+ };
24
38
 
25
- interface HttpOptions {
26
- successMessage?: string;
27
- errorMessage?: string;
28
- schema?: any;
29
- params?: QueryParams;
30
- }
31
- interface HttpResponse<T = any> {
32
- value: T;
33
- success: boolean;
34
- error?: string;
35
- }
36
- declare function get<T = any>(url: string, options?: HttpOptions): Promise<HttpResponse<T>>;
37
- declare function post<T = any>(url: string, data: any, options?: HttpOptions): Promise<HttpResponse<T>>;
38
- declare const httpClient: {
39
- get: typeof get;
40
- post: typeof post;
39
+ declare const createReservationApi: (apiConfig: ApiConfig) => {
40
+ createReservation(params: CreateReservationParams, options?: RequestOptions): Promise<any>;
41
+ updateReservation(params: UpdateReservationParams, options?: RequestOptions): Promise<any>;
42
+ checkout(params: ReservationCheckoutParams, options?: RequestOptions): Promise<any>;
43
+ getReservation(params: GetReservationParams, options?: RequestOptions): Promise<any>;
44
+ getReservationParts(params?: GetReservationPartsParams, options?: RequestOptions): Promise<any>;
45
+ searchReservations(params: SearchReservationsParams, options?: RequestOptions): Promise<any>;
46
+ searchMyReservations(params?: SearchMyReservationsParams, options?: RequestOptions): Promise<any>;
47
+ getQuote(params: GetReservationQuoteParams, options?: RequestOptions): Promise<any>;
48
+ createService(params: CreateServiceParams, options?: RequestOptions): Promise<any>;
49
+ updateService(params: UpdateServiceParams, options?: RequestOptions): Promise<any>;
50
+ deleteService(params: DeleteServiceParams, options?: RequestOptions): Promise<any>;
51
+ getService(params: GetServiceParams, options?: RequestOptions): Promise<any>;
52
+ getServices(params?: GetServicesParams, options?: RequestOptions): Promise<any>;
53
+ getAvailableSlots(params: GetAvailableSlotsParams, options?: RequestOptions): Promise<any>;
54
+ createProvider(params: CreateProviderParams, options?: RequestOptions): Promise<any>;
55
+ updateProvider(params: UpdateProviderParams, options?: RequestOptions): Promise<any>;
56
+ deleteProvider(params: DeleteProviderParams, options?: RequestOptions): Promise<any>;
57
+ getProvider(params: GetProviderParams, options?: RequestOptions): Promise<any>;
58
+ getProviders(params: GetProvidersParams, options?: RequestOptions): Promise<any>;
59
+ getProviderWorkingTime(params: GetBusinessServiceWorkingTimeParams, options?: RequestOptions): Promise<any>;
60
+ };
61
+
62
+ declare const createNewsletterApi: (apiConfig: ApiConfig) => {
63
+ find(params: NewsletterFindParams, options?: RequestOptions): Promise<any>;
64
+ get(params: NewsletterGetParams, options?: RequestOptions): Promise<any>;
65
+ create(params: CreateNewsletterParams, options?: RequestOptions): Promise<any>;
66
+ update(params: UpdateNewsletterParams, options?: RequestOptions): Promise<any>;
67
+ delete(params: DeleteNewsletterParams, options?: RequestOptions): Promise<any>;
68
+ getSubscribers(params: GetSubscribersParams, options?: RequestOptions): Promise<any>;
69
+ subscribe(params: NewsletterSubscribeParams, options?: RequestOptions): Promise<any>;
70
+ unsubscribe(params: UnsubscribeParams, options?: RequestOptions): Promise<any>;
71
+ unsubscribeWithToken(params: UnsubscribeParams, options?: RequestOptions): Promise<any>;
41
72
  };
42
73
 
43
- declare const cmsApi: {
44
- getCollection: (id: string) => Promise<any>;
45
- getCollections: ({ name, ids }: {
46
- name?: string | null;
47
- ids?: string[] | null;
48
- }) => Promise<any>;
49
- getCollectionEntries: ({ collectionId, limit, cursor, ids }: {
50
- collectionId: string;
74
+ declare const createUserApi: (apiConfig: ApiConfig) => {
75
+ updateUser(params: UpdateUserProfileParams, options?: RequestOptions): Promise<any>;
76
+ updateProfilePhone(params: UpdateProfilePhoneParams, options?: RequestOptions): Promise<any>;
77
+ verifyPhoneCode(params: VerifyPhoneCodeParams, options?: RequestOptions): Promise<any>;
78
+ getUserLocation(options?: RequestOptions): Promise<any>;
79
+ getMe(options?: RequestOptions): Promise<any>;
80
+ searchUsers(params: GetUsersParams, options?: RequestOptions): Promise<any>;
81
+ setUserRole(params: SetRoleParams, options?: RequestOptions): Promise<any>;
82
+ loginUser(params: LoginUserParams, options?: RequestOptions): Promise<any>;
83
+ registerUser(params: RegisterUserParams, options?: RequestOptions): Promise<any>;
84
+ logout(options?: RequestOptions): Promise<any>;
85
+ confirmUser(params: ConfirmUserParams, options?: RequestOptions): Promise<any>;
86
+ getLoginUrl(params: GetLoginUrlParams, options?: RequestOptions): Promise<any>;
87
+ getGuestToken(params: {
88
+ existingToken?: string;
89
+ }, options?: RequestOptions): Promise<string>;
90
+ forgotPassword(params: ForgotPasswordParams, options?: RequestOptions): Promise<any>;
91
+ resetForgotPassword(params: ResetForgotPasswordParams, options?: RequestOptions): Promise<any>;
92
+ resetPassword(params: ResetPasswordParams, options?: RequestOptions): Promise<any>;
93
+ };
94
+
95
+ declare const createBusinessApi: (apiConfig: ApiConfig) => {
96
+ createBusiness(params: CreateBusinessParams, options?: RequestOptions): Promise<any>;
97
+ updateBusiness(params: UpdateBusinessParams, options?: RequestOptions): Promise<any>;
98
+ deleteBusiness(params: DeleteBusinessParams, options?: RequestOptions): Promise<any>;
99
+ getBusiness(params: GetBusinessParams, options?: RequestOptions): Promise<any>;
100
+ getBusinesses(options?: RequestOptions): Promise<any>;
101
+ getBusinessParents(params: GetBusinessParentsParams, options?: RequestOptions): Promise<any>;
102
+ triggerBuilds(params: TriggerBuildsParams, options?: RequestOptions): Promise<any>;
103
+ getSubscriptionPlans(options?: RequestOptions): Promise<any>;
104
+ getSubscription(params: GetSubscriptionParams, options?: RequestOptions): Promise<any>;
105
+ createSubscription(params: CreateSubscriptionParams, options?: RequestOptions): Promise<any>;
106
+ updateSubscription(params: UpdateSubscriptionParams, options?: RequestOptions): Promise<any>;
107
+ cancelSubscription(params: CancelSubscriptionParams, options?: RequestOptions): Promise<any>;
108
+ reactivateSubscription(params: ReactivateSubscriptionParams, options?: RequestOptions): Promise<any>;
109
+ createPortalSession(params: CreatePortalSessionParams, options?: RequestOptions): Promise<any>;
110
+ inviteUser(params: InviteUserParams, options?: RequestOptions): Promise<any>;
111
+ handleInvitation(params: HandleInvitationParams, options?: RequestOptions): Promise<any>;
112
+ testWebhook(params: TestWebhookParams, options?: RequestOptions): Promise<any>;
113
+ getBusinessMedia(params: {
114
+ id: string;
115
+ cursor?: string | null;
51
116
  limit?: number;
52
- cursor?: string;
53
- ids?: string[] | null;
54
- }) => Promise<any>;
55
- getCollectionEntry: ({ collectionId, id }: {
56
- collectionId: string;
117
+ }, options?: RequestOptions): Promise<any>;
118
+ setProviderSchedule(params: {
57
119
  id: string;
58
- }) => Promise<HttpResponse<any>>;
59
- createCollectionEntry: (collectionEntryData: any) => Promise<HttpResponse<any>>;
120
+ workingTime: any;
121
+ serviceIds: string[];
122
+ providerIds: string[];
123
+ }, options?: RequestOptions): Promise<any>;
60
124
  };
61
125
 
62
- declare const eshopApi: {
63
- getProducts({ businessId, categoryIds, status, limit, cursor }: {
64
- businessId: string;
65
- categoryIds?: string[] | null;
66
- status?: string;
67
- limit?: number;
68
- cursor?: string | null;
69
- }): Promise<{
70
- success: boolean;
71
- data: any;
72
- cursor: any;
73
- total: any;
74
- error?: undefined;
75
- } | {
76
- success: boolean;
77
- error: string;
78
- data: any[];
79
- cursor?: undefined;
80
- total?: undefined;
81
- }>;
82
- getProductBySlug({ businessId, slug }: {
83
- businessId: string;
84
- slug: string;
85
- }): Promise<{
86
- success: boolean;
87
- data: any;
88
- error?: undefined;
89
- } | {
90
- success: boolean;
91
- error: any;
92
- data: any;
93
- }>;
94
- getQuote({ token, businessId, items, market, currency, userId, paymentMethod, shippingMethodId, promoCode }: {
95
- token: string;
96
- businessId: string;
97
- items: {
98
- productId: string;
99
- variantId: string;
100
- quantity: number;
101
- }[];
102
- market: string;
103
- currency: string;
104
- userId: string;
105
- paymentMethod: string;
106
- shippingMethodId?: string;
107
- promoCode?: string;
108
- }): Promise<ApiResponse<Quote>>;
109
- checkout({ token, businessId, items, paymentMethod, blocks, market, shippingMethodId, promoCode, paymentIntentId }: {
110
- token: string;
111
- businessId: string;
112
- items: any[];
113
- paymentMethod: string;
114
- blocks: any[];
115
- market?: string;
116
- shippingMethodId?: string;
117
- promoCode?: string;
118
- paymentIntentId?: string | null;
119
- }): Promise<{
120
- success: boolean;
121
- error: any;
122
- code: any;
123
- data?: undefined;
124
- } | {
125
- success: boolean;
126
- data: any;
127
- error?: undefined;
128
- code?: undefined;
129
- } | {
130
- success: boolean;
131
- error: any;
132
- code?: undefined;
133
- data?: undefined;
134
- }>;
135
- createPaymentIntent({ amount, currency, businessId }: {
136
- amount: number;
137
- currency: string;
138
- businessId: string;
139
- }): Promise<{
140
- success: boolean;
141
- data: any;
142
- error?: undefined;
143
- } | {
144
- success: boolean;
145
- error: any;
146
- data?: undefined;
147
- }>;
126
+ declare const createMediaApi: (apiConfig: ApiConfig) => {
127
+ uploadBusinessMedia(params: UploadBusinessMediaParams): Promise<any>;
128
+ deleteBusinessMedia(params: DeleteBusinessMediaParams, options?: RequestOptions): Promise<any>;
129
+ getBusinessMedia(params: GetBusinessMediaParams): Promise<any>;
148
130
  };
149
131
 
150
- declare const reservationApi: {
151
- getQuote({ token, businessId, market, currency, userId, parts, paymentMethod, promoCode, }: {
152
- token: string;
153
- businessId: string;
154
- market: string;
155
- currency: string;
156
- userId: string;
157
- parts: any[];
158
- paymentMethod?: string;
159
- promoCode?: string;
160
- }): Promise<ApiResponse<Quote>>;
161
- getAvailableSlots({ businessId, serviceId, from, to, limit, providerId, }: {
162
- businessId: string;
163
- serviceId: string;
164
- from: number;
165
- to: number;
166
- limit?: number;
167
- providerId?: string | null;
168
- }): Promise<{
169
- success: boolean;
170
- data: any;
171
- error?: undefined;
172
- } | {
173
- success: boolean;
174
- error: string;
175
- data: any[];
176
- }>;
177
- getProviders({ businessId, serviceId, limit }: {
178
- businessId: string;
179
- serviceId: string;
180
- limit?: number;
181
- }): Promise<{
182
- success: boolean;
183
- data: any;
184
- error?: undefined;
185
- } | {
186
- success: boolean;
187
- error: string;
188
- data: any[];
189
- }>;
190
- getGuestToken(): Promise<ApiResponse<{
191
- token: string;
192
- }>>;
193
- updateProfilePhone({ token, phoneNumber }: {
194
- token: string;
195
- phoneNumber: string;
196
- }): Promise<{
197
- success: boolean;
198
- error?: undefined;
199
- } | {
200
- success: boolean;
201
- error: any;
202
- }>;
203
- verifyPhoneCode({ token, phoneNumber, code }: {
204
- token: string;
205
- phoneNumber: string;
206
- code: string;
207
- }): Promise<{
208
- success: boolean;
209
- error?: undefined;
210
- } | {
211
- success: boolean;
212
- error: any;
213
- }>;
214
- checkout({ token, businessId, parts, paymentMethod, blocks, market, promoCode }: {
215
- token: string;
216
- businessId: string;
217
- parts: any[];
218
- paymentMethod?: string;
219
- blocks?: any[];
220
- market?: string;
221
- promoCode?: string;
222
- }): Promise<{
223
- success: boolean;
224
- data: any;
225
- error?: undefined;
226
- } | {
227
- success: boolean;
228
- error: any;
229
- data?: undefined;
230
- }>;
132
+ declare const createRoleApi: (apiConfig: ApiConfig) => {
133
+ createRole(params: CreateRoleParams, options?: RequestOptions): Promise<void>;
134
+ updateRole(params: UpdateRoleParams, options?: RequestOptions): Promise<any>;
135
+ deleteRole(params: DeleteRoleParams, options?: RequestOptions): Promise<any>;
136
+ getRole(params: GetRoleParams, options?: RequestOptions): Promise<any>;
137
+ getRoles(params?: GetRolesParams, options?: RequestOptions): Promise<any>;
231
138
  };
232
139
 
233
- interface NewsletterFindPayload {
234
- business_id: string;
235
- }
236
- interface NewsletterSubscribePayload {
237
- newsletterId: string;
238
- email: string;
239
- customerId?: string;
240
- payment?: Payment;
241
- }
242
- declare const newsletterApi: {
243
- find(payload: NewsletterFindPayload): Promise<PaginatedResponse<Newsletter>>;
244
- get(id: string): Promise<Newsletter>;
245
- subscribe(payload: NewsletterSubscribePayload): Promise<{
246
- success: boolean;
247
- data: any;
248
- error?: undefined;
249
- } | {
250
- success: boolean;
251
- error: string;
252
- data?: undefined;
253
- }>;
140
+ declare const createNotificationApi: (apiConfig: ApiConfig) => {
141
+ getNotifications(params: GetNotificationsParams, options?: RequestOptions): Promise<any>;
142
+ updateNotifications(options?: RequestOptions): Promise<any>;
143
+ trackEmailOpen(params: TrackEmailOpenParams, options?: RequestOptions): Promise<any>;
144
+ getDeliveryStats(params: GetDeliveryStatsParams, options?: RequestOptions): Promise<any>;
145
+ };
146
+
147
+ declare const createPromoCodeApi: (apiConfig: ApiConfig) => {
148
+ createPromoCode(params: CreatePromoCodeParams, options?: RequestOptions): Promise<any>;
149
+ updatePromoCode(params: UpdatePromoCodeParams, options?: RequestOptions): Promise<any>;
150
+ deletePromoCode(params: DeletePromoCodeParams, options?: RequestOptions): Promise<any>;
151
+ getPromoCode(params: GetPromoCodeParams, options?: RequestOptions): Promise<any>;
152
+ getPromoCodes(params: GetPromoCodesParams, options?: RequestOptions): Promise<any>;
153
+ };
154
+
155
+ declare const createAnalyticsApi: (apiConfig: ApiConfig) => {
156
+ getAnalytics(params: GetAnalyticsParams, options?: RequestOptions): Promise<any>;
157
+ getAnalyticsHealth(params: GetAnalyticsHealthParams, options?: RequestOptions): Promise<any>;
158
+ setupAnalytics(params: SetupAnalyticsParams, options?: RequestOptions): Promise<any>;
159
+ };
160
+
161
+ declare const createPaymentApi: (apiConfig: ApiConfig) => {
162
+ handleStripeWebhook(params: HandleStripeWebhookParams, options?: RequestOptions): Promise<any>;
163
+ getBusinessMarkets(params: GetBusinessMarketsParams, options?: RequestOptions): Promise<any>;
164
+ getBusinessMarket(params: GetBusinessMarketParams, options?: RequestOptions): Promise<any>;
254
165
  };
255
166
 
256
- declare function getGuestToken(currentToken?: string | null): Promise<string>;
257
- declare function updateProfilePhone(token: string, phoneNumber: string): Promise<{
258
- success: boolean;
259
- }>;
260
- declare function verifyPhoneCode(token: string, phoneNumber: string, code: string): Promise<{
261
- success: boolean;
262
- }>;
263
- declare function getBusinessConfig(businessId: string): Promise<{
264
- success: boolean;
265
- data: any;
266
- error?: undefined;
267
- } | {
268
- success: boolean;
269
- error: any;
270
- data?: undefined;
271
- }>;
167
+ declare function setDefaultLocale(locale: string): void;
168
+ declare function getLocale(): string;
169
+ declare function getLocaleFromUrl(url: URL): string;
170
+ declare function getLocalizedString(value: any, locale?: string): string;
272
171
 
273
- declare const SDK_VERSION = "0.3.0";
172
+ /**
173
+ * Query parameter builder utility that maintains exact backward compatibility
174
+ * with existing API parameter encoding patterns
175
+ */
176
+ interface QueryParams {
177
+ [key: string]: string | number | boolean | string[] | number[] | null | undefined;
178
+ }
179
+ /**
180
+ * Builds a query string from parameters following the exact encoding patterns
181
+ * used by the existing API implementation:
182
+ * - Arrays: JSON.stringify then encodeURIComponent
183
+ * - Strings: encodeURIComponent
184
+ * - Numbers: No encoding
185
+ * - Null/undefined: Skip
186
+ */
187
+ declare function buildQueryString(params: QueryParams): string;
188
+ /**
189
+ * Appends query string to a URL
190
+ */
191
+ declare function appendQueryString(url: string, params: QueryParams): string;
192
+
193
+ interface AuthTokens {
194
+ accessToken: string;
195
+ refreshToken?: string;
196
+ provider?: string;
197
+ expiresAt?: number;
198
+ userId?: string;
199
+ }
200
+ interface HttpClientConfig {
201
+ baseUrl: string;
202
+ storageUrl?: string;
203
+ businessId: string;
204
+ getTokens: () => Promise<AuthTokens> | AuthTokens;
205
+ setTokens: (tokens: AuthTokens) => void;
206
+ autoGuest?: boolean;
207
+ onAuthFailure: () => void;
208
+ navigate?: (path: string) => void;
209
+ loginFallbackPath?: string;
210
+ notify?: (opts: {
211
+ message: string;
212
+ type: 'error' | 'success';
213
+ }) => void;
214
+ isAuthenticated?: () => boolean;
215
+ logout?: () => void;
216
+ setUserToken?: (userToken: any) => void;
217
+ }
218
+
219
+ declare const SDK_VERSION = "0.3.2";
274
220
  declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
221
+ interface ApiConfig {
222
+ httpClient: any;
223
+ businessId: string;
224
+ storageUrl: string;
225
+ baseUrl: string;
226
+ market: string;
227
+ setTokens: (tokens: any) => void;
228
+ getTokens: () => Promise<any> | any;
229
+ }
275
230
 
276
- declare function initArky(config: ArkyConfig): ArkyConfig;
231
+ declare function createArkySDK(config: HttpClientConfig & {
232
+ market?: string;
233
+ }): {
234
+ user: {
235
+ updateUser(params: UpdateUserProfileParams, options?: RequestOptions): Promise<any>;
236
+ updateProfilePhone(params: UpdateProfilePhoneParams, options?: RequestOptions): Promise<any>;
237
+ verifyPhoneCode(params: VerifyPhoneCodeParams, options?: RequestOptions): Promise<any>;
238
+ getUserLocation(options?: RequestOptions): Promise<any>;
239
+ getMe(options?: RequestOptions): Promise<any>;
240
+ searchUsers(params: GetUsersParams, options?: RequestOptions): Promise<any>;
241
+ setUserRole(params: SetRoleParams, options?: RequestOptions): Promise<any>;
242
+ loginUser(params: LoginUserParams, options?: RequestOptions): Promise<any>;
243
+ registerUser(params: RegisterUserParams, options?: RequestOptions): Promise<any>;
244
+ logout(options?: RequestOptions): Promise<any>;
245
+ confirmUser(params: ConfirmUserParams, options?: RequestOptions): Promise<any>;
246
+ getLoginUrl(params: GetLoginUrlParams, options?: RequestOptions): Promise<any>;
247
+ getGuestToken(params: {
248
+ existingToken?: string;
249
+ }, options?: RequestOptions): Promise<string>;
250
+ forgotPassword(params: ForgotPasswordParams, options?: RequestOptions): Promise<any>;
251
+ resetForgotPassword(params: ResetForgotPasswordParams, options?: RequestOptions): Promise<any>;
252
+ resetPassword(params: ResetPasswordParams, options?: RequestOptions): Promise<any>;
253
+ };
254
+ business: {
255
+ createBusiness(params: CreateBusinessParams, options?: RequestOptions): Promise<any>;
256
+ updateBusiness(params: UpdateBusinessParams, options?: RequestOptions): Promise<any>;
257
+ deleteBusiness(params: DeleteBusinessParams, options?: RequestOptions): Promise<any>;
258
+ getBusiness(params: GetBusinessParams, options?: RequestOptions): Promise<any>;
259
+ getBusinesses(options?: RequestOptions): Promise<any>;
260
+ getBusinessParents(params: GetBusinessParentsParams, options?: RequestOptions): Promise<any>;
261
+ triggerBuilds(params: TriggerBuildsParams, options?: RequestOptions): Promise<any>;
262
+ getSubscriptionPlans(options?: RequestOptions): Promise<any>;
263
+ getSubscription(params: GetSubscriptionParams, options?: RequestOptions): Promise<any>;
264
+ createSubscription(params: CreateSubscriptionParams, options?: RequestOptions): Promise<any>;
265
+ updateSubscription(params: UpdateSubscriptionParams, options?: RequestOptions): Promise<any>;
266
+ cancelSubscription(params: CancelSubscriptionParams, options?: RequestOptions): Promise<any>;
267
+ reactivateSubscription(params: ReactivateSubscriptionParams, options?: RequestOptions): Promise<any>;
268
+ createPortalSession(params: CreatePortalSessionParams, options?: RequestOptions): Promise<any>;
269
+ inviteUser(params: InviteUserParams, options?: RequestOptions): Promise<any>;
270
+ handleInvitation(params: HandleInvitationParams, options?: RequestOptions): Promise<any>;
271
+ testWebhook(params: TestWebhookParams, options?: RequestOptions): Promise<any>;
272
+ getBusinessMedia(params: {
273
+ id: string;
274
+ cursor?: string | null;
275
+ limit?: number;
276
+ }, options?: RequestOptions): Promise<any>;
277
+ setProviderSchedule(params: {
278
+ id: string;
279
+ workingTime: any;
280
+ serviceIds: string[];
281
+ providerIds: string[];
282
+ }, options?: RequestOptions): Promise<any>;
283
+ };
284
+ media: {
285
+ uploadBusinessMedia(params: UploadBusinessMediaParams): Promise<any>;
286
+ deleteBusinessMedia(params: DeleteBusinessMediaParams, options?: RequestOptions): Promise<any>;
287
+ getBusinessMedia(params: GetBusinessMediaParams): Promise<any>;
288
+ };
289
+ role: {
290
+ createRole(params: CreateRoleParams, options?: RequestOptions): Promise<void>;
291
+ updateRole(params: UpdateRoleParams, options?: RequestOptions): Promise<any>;
292
+ deleteRole(params: DeleteRoleParams, options?: RequestOptions): Promise<any>;
293
+ getRole(params: GetRoleParams, options?: RequestOptions): Promise<any>;
294
+ getRoles(params?: GetRolesParams, options?: RequestOptions): Promise<any>;
295
+ };
296
+ notification: {
297
+ getNotifications(params: GetNotificationsParams, options?: RequestOptions): Promise<any>;
298
+ updateNotifications(options?: RequestOptions): Promise<any>;
299
+ trackEmailOpen(params: TrackEmailOpenParams, options?: RequestOptions): Promise<any>;
300
+ getDeliveryStats(params: GetDeliveryStatsParams, options?: RequestOptions): Promise<any>;
301
+ };
302
+ promoCode: {
303
+ createPromoCode(params: CreatePromoCodeParams, options?: RequestOptions): Promise<any>;
304
+ updatePromoCode(params: UpdatePromoCodeParams, options?: RequestOptions): Promise<any>;
305
+ deletePromoCode(params: DeletePromoCodeParams, options?: RequestOptions): Promise<any>;
306
+ getPromoCode(params: GetPromoCodeParams, options?: RequestOptions): Promise<any>;
307
+ getPromoCodes(params: GetPromoCodesParams, options?: RequestOptions): Promise<any>;
308
+ };
309
+ analytics: {
310
+ getAnalytics(params: GetAnalyticsParams, options?: RequestOptions): Promise<any>;
311
+ getAnalyticsHealth(params: GetAnalyticsHealthParams, options?: RequestOptions): Promise<any>;
312
+ setupAnalytics(params: SetupAnalyticsParams, options?: RequestOptions): Promise<any>;
313
+ };
314
+ cms: {
315
+ createCollection(params: CreateCollectionParams, options?: RequestOptions): Promise<any>;
316
+ updateCollection(params: UpdateCollectionParams, options?: RequestOptions): Promise<any>;
317
+ deleteCollection(params: DeleteCollectionParams, options?: RequestOptions): Promise<any>;
318
+ getCollection(params: GetCollectionParams, options?: RequestOptions): Promise<any>;
319
+ getCollections(params?: GetCollectionsParams, options?: RequestOptions): Promise<any>;
320
+ generateBlocks(params: any, options?: RequestOptions): Promise<any>;
321
+ getCollectionEntries(params?: GetEntriesParams, options?: RequestOptions): Promise<any>;
322
+ createCollectionEntry(params: CreateEntryParams, options?: RequestOptions): Promise<any>;
323
+ updateCollectionEntry(params: UpdateEntryParams, options?: RequestOptions): Promise<any>;
324
+ deleteCollectionEntry(params: DeleteCollectionEntryParams, options?: RequestOptions): Promise<any>;
325
+ getCollectionEntry(params: GetCollectionEntryParams, options?: RequestOptions): Promise<any>;
326
+ sendEntry(params: SendEntryParams, options?: RequestOptions): Promise<any>;
327
+ getVariableMetadata(params: GetVariableMetadataParams, options?: RequestOptions): Promise<any>;
328
+ };
329
+ eshop: {
330
+ createProduct(params: CreateProductParams, options?: RequestOptions): Promise<any>;
331
+ updateProduct(params: UpdateProductParams, options?: RequestOptions): Promise<any>;
332
+ deleteProduct(id: string, options?: RequestOptions): Promise<any>;
333
+ getProduct(params: GetProductParams, options?: RequestOptions): Promise<any>;
334
+ getProducts(params?: GetProductsParams, options?: RequestOptions): Promise<any>;
335
+ getProductBySlug(params: GetProductBySlugParams, options?: RequestOptions): Promise<any>;
336
+ createOrder(params: CreateOrderParams, options?: RequestOptions): Promise<any>;
337
+ updateOrder(params: UpdateOrderParams, options?: RequestOptions): Promise<any>;
338
+ getOrder(params: GetOrderParams, options?: RequestOptions): Promise<any>;
339
+ getOrders(params?: GetOrdersParams, options?: RequestOptions): Promise<any>;
340
+ updateOrderStatus(params: UpdateOrderStatusParams, options?: RequestOptions): Promise<any>;
341
+ updateOrderPaymentStatus(params: UpdateOrderPaymentStatusParams, options?: RequestOptions): Promise<any>;
342
+ getQuote(params: GetQuoteParams, options?: RequestOptions): Promise<any>;
343
+ checkout(params: CheckoutParams, options?: RequestOptions): Promise<any>;
344
+ };
345
+ reservation: {
346
+ createReservation(params: CreateReservationParams, options?: RequestOptions): Promise<any>;
347
+ updateReservation(params: UpdateReservationParams, options?: RequestOptions): Promise<any>;
348
+ checkout(params: ReservationCheckoutParams, options?: RequestOptions): Promise<any>;
349
+ getReservation(params: GetReservationParams, options?: RequestOptions): Promise<any>;
350
+ getReservationParts(params?: GetReservationPartsParams, options?: RequestOptions): Promise<any>;
351
+ searchReservations(params: SearchReservationsParams, options?: RequestOptions): Promise<any>;
352
+ searchMyReservations(params?: SearchMyReservationsParams, options?: RequestOptions): Promise<any>;
353
+ getQuote(params: GetReservationQuoteParams, options?: RequestOptions): Promise<any>;
354
+ createService(params: CreateServiceParams, options?: RequestOptions): Promise<any>;
355
+ updateService(params: UpdateServiceParams, options?: RequestOptions): Promise<any>;
356
+ deleteService(params: DeleteServiceParams, options?: RequestOptions): Promise<any>;
357
+ getService(params: GetServiceParams, options?: RequestOptions): Promise<any>;
358
+ getServices(params?: GetServicesParams, options?: RequestOptions): Promise<any>;
359
+ getAvailableSlots(params: GetAvailableSlotsParams, options?: RequestOptions): Promise<any>;
360
+ createProvider(params: CreateProviderParams, options?: RequestOptions): Promise<any>;
361
+ updateProvider(params: UpdateProviderParams, options?: RequestOptions): Promise<any>;
362
+ deleteProvider(params: DeleteProviderParams, options?: RequestOptions): Promise<any>;
363
+ getProvider(params: GetProviderParams, options?: RequestOptions): Promise<any>;
364
+ getProviders(params: GetProvidersParams, options?: RequestOptions): Promise<any>;
365
+ getProviderWorkingTime(params: GetBusinessServiceWorkingTimeParams, options?: RequestOptions): Promise<any>;
366
+ };
367
+ newsletter: {
368
+ find(params: NewsletterFindParams, options?: RequestOptions): Promise<any>;
369
+ get(params: NewsletterGetParams, options?: RequestOptions): Promise<any>;
370
+ create(params: CreateNewsletterParams, options?: RequestOptions): Promise<any>;
371
+ update(params: UpdateNewsletterParams, options?: RequestOptions): Promise<any>;
372
+ delete(params: DeleteNewsletterParams, options?: RequestOptions): Promise<any>;
373
+ getSubscribers(params: GetSubscribersParams, options?: RequestOptions): Promise<any>;
374
+ subscribe(params: NewsletterSubscribeParams, options?: RequestOptions): Promise<any>;
375
+ unsubscribe(params: UnsubscribeParams, options?: RequestOptions): Promise<any>;
376
+ unsubscribeWithToken(params: UnsubscribeParams, options?: RequestOptions): Promise<any>;
377
+ };
378
+ payment: {
379
+ handleStripeWebhook(params: HandleStripeWebhookParams, options?: RequestOptions): Promise<any>;
380
+ getBusinessMarkets(params: GetBusinessMarketsParams, options?: RequestOptions): Promise<any>;
381
+ getBusinessMarket(params: GetBusinessMarketParams, options?: RequestOptions): Promise<any>;
382
+ };
383
+ setBusinessId: (businessId: string) => void;
384
+ getBusinessId: () => string;
385
+ isAuthenticated: () => boolean;
386
+ logout: () => void;
387
+ setUserToken: (userToken: any) => void;
388
+ utils: {
389
+ getImageUrl: (imageBlock: any, isBlock?: boolean) => any;
390
+ thumbnailUrl: (service: any) => string;
391
+ getGalleryThumbnail: typeof getGalleryThumbnail;
392
+ getMarketPrice: typeof getMarketPrice;
393
+ getPriceAmount: typeof getPriceAmount;
394
+ formatPayment: typeof formatPayment;
395
+ formatMinor: typeof formatMinor;
396
+ createPaymentForCheckout: typeof createPaymentForCheckout;
397
+ getCurrencySymbol: typeof getCurrencySymbol;
398
+ validatePhoneNumber: typeof validatePhoneNumber;
399
+ tzGroups: {
400
+ label: string;
401
+ zones: {
402
+ label: string;
403
+ value: string;
404
+ }[];
405
+ }[];
406
+ findTimeZone: typeof findTimeZone;
407
+ };
408
+ };
277
409
 
278
- export { ApiResponse, type ArkyConfig, Newsletter, PaginatedResponse, Payment, Quote, SDK_VERSION, SUPPORTED_FRAMEWORKS, cmsApi, eshopApi, getBusinessConfig, getGlobalConfig, getGuestToken, httpClient, initArky, newsletterApi, reservationApi, setGlobalConfig, updateProfilePhone, verifyPhoneCode };
410
+ export { type ApiConfig, CancelSubscriptionParams, CheckoutParams, ConfirmUserParams, CreateBusinessParams, CreateCollectionParams, CreateEntryParams, CreateNewsletterParams, CreateOrderParams, CreatePortalSessionParams, CreateProductParams, CreatePromoCodeParams, CreateProviderParams, CreateReservationParams, CreateRoleParams, CreateServiceParams, CreateSubscriptionParams, DeleteBusinessMediaParams, DeleteBusinessParams, DeleteCollectionEntryParams, DeleteCollectionParams, DeleteNewsletterParams, DeletePromoCodeParams, DeleteProviderParams, DeleteRoleParams, DeleteServiceParams, ForgotPasswordParams, GetAnalyticsHealthParams, GetAnalyticsParams, GetAvailableSlotsParams, GetBusinessMarketParams, GetBusinessMarketsParams, GetBusinessMediaParams, GetBusinessParams, GetBusinessParentsParams, GetBusinessServiceWorkingTimeParams, GetCollectionEntryParams, GetCollectionParams, GetCollectionsParams, GetDeliveryStatsParams, GetEntriesParams, GetLoginUrlParams, GetNotificationsParams, GetOrderParams, GetOrdersParams, GetProductBySlugParams, GetProductParams, GetProductsParams, GetPromoCodeParams, GetPromoCodesParams, GetProviderParams, GetProvidersParams, GetQuoteParams, GetReservationParams, GetReservationPartsParams, GetReservationQuoteParams, GetRoleParams, GetRolesParams, GetServiceParams, GetServicesParams, GetSubscribersParams, GetSubscriptionParams, GetUsersParams, GetVariableMetadataParams, HandleInvitationParams, HandleStripeWebhookParams, type HttpClientConfig, InviteUserParams, LoginUserParams, NewsletterFindParams, NewsletterGetParams, NewsletterSubscribeParams, type QueryParams, ReactivateSubscriptionParams, RegisterUserParams, RequestOptions, ReservationCheckoutParams, ResetForgotPasswordParams, ResetPasswordParams, SDK_VERSION, SUPPORTED_FRAMEWORKS, SearchMyReservationsParams, SearchReservationsParams, SendEntryParams, SetRoleParams, SetupAnalyticsParams, TestWebhookParams, TrackEmailOpenParams, TriggerBuildsParams, UnsubscribeParams, UpdateBusinessParams, UpdateCollectionParams, UpdateEntryParams, UpdateNewsletterParams, UpdateOrderParams, UpdateOrderPaymentStatusParams, UpdateOrderStatusParams, UpdateProductParams, UpdateProfilePhoneParams, UpdatePromoCodeParams, UpdateProviderParams, UpdateReservationParams, UpdateRoleParams, UpdateServiceParams, UpdateSubscriptionParams, UpdateUserProfileParams, UploadBusinessMediaParams, VerifyPhoneCodeParams, appendQueryString, buildQueryString, createAnalyticsApi, createArkySDK, createBusinessApi, createCmsApi, createEshopApi, createMediaApi, createNewsletterApi, createNotificationApi, createPaymentApi, createPaymentForCheckout, createPromoCodeApi, createReservationApi, createRoleApi, createUserApi, findTimeZone, formatMinor, formatPayment, getCurrencySymbol, getGalleryThumbnail, getLocale, getLocaleFromUrl, getLocalizedString, getMarketPrice, getPriceAmount, setDefaultLocale, validatePhoneNumber };