arky-sdk 0.4.13 → 0.4.15

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,4 +1,4 @@
1
- import { Price, Payment, RequestOptions, MagicLinkVerifyParams, MagicLinkRequestParams, UpdateAccountProfileParams, DeleteAccountParams, AddPhoneNumberParams, PhoneNumberConfirmParams, GetMeParams, SearchAccountsParams, AccountSubscribeParams, CreateBusinessParams, UpdateBusinessParams, DeleteBusinessParams, GetBusinessParams, GetBusinessesParams, GetBusinessParentsParams, TriggerBuildsParams, GetSubscriptionPlansParams, GetSubscriptionParams, SubscribeParams, CreatePortalSessionParams, InviteUserParams, HandleInvitationParams, TestWebhookParams, GetBusinessMediaParams2, ProcessRefundParams, GetBusinessEventsParams, UpdateBusinessEventParams, UploadBusinessMediaParams, DeleteBusinessMediaParams, GetBusinessMediaParams, UpdateMediaParams, TrackEmailOpenParams, GetDeliveryStatsParams, CreatePromoCodeParams, UpdatePromoCodeParams, DeletePromoCodeParams, GetPromoCodeParams, GetPromoCodesParams, CreateNodeParams, UpdateNodeParams, DeleteNodeParams, GetNodeParams, GetNodesParams, GetNodeChildrenParams, GenerateBlocksParams, GetVariableMetadataParams, CreateProductParams, UpdateProductParams, DeleteProductParams, GetProductParams, GetProductsParams, CreateOrderParams, UpdateOrderParams, GetOrderParams, GetOrdersParams, GetQuoteParams, OrderCheckoutParams, Slot, CreateReservationParams, UpdateReservationParams, ReservationCheckoutParams, GetReservationParams, SearchReservationsParams, GetReservationQuoteParams, CreateServiceParams, UpdateServiceParams, DeleteServiceParams, BulkScheduleParams, GetServiceParams, GetServicesParams, CreateProviderParams, UpdateProviderParams, DeleteProviderParams, GetProviderParams, GetProvidersParams, GetBusinessServiceWorkingTimeParams, CreateWorkflowParams, UpdateWorkflowParams, DeleteWorkflowParams, GetWorkflowParams, GetWorkflowsParams, TriggerWorkflowParams, CreateAudienceParams, UpdateAudienceParams, GetAudienceParams, GetAudiencesParams, SubscribeAudienceParams, GetAudienceSubscribersParams, RevokeAudienceSubscriptionParams } from './types.cjs';
1
+ import { Price, Payment, RequestOptions, MagicLinkVerifyParams, MagicLinkRequestParams, UpdateAccountProfileParams, DeleteAccountParams, AddPhoneNumberParams, PhoneNumberConfirmParams, GetMeParams, SearchAccountsParams, AccountSubscribeParams, CreateBusinessParams, UpdateBusinessParams, DeleteBusinessParams, GetBusinessParams, GetBusinessesParams, GetBusinessParentsParams, TriggerBuildsParams, GetSubscriptionPlansParams, GetSubscriptionParams, SubscribeParams, CreatePortalSessionParams, InviteUserParams, HandleInvitationParams, TestWebhookParams, GetBusinessMediaParams2, ProcessRefundParams, GetBusinessEventsParams, UpdateBusinessEventParams, ConnectStripeParams, DisconnectStripeParams, UploadBusinessMediaParams, DeleteBusinessMediaParams, GetBusinessMediaParams, UpdateMediaParams, TrackEmailOpenParams, GetDeliveryStatsParams, CreatePromoCodeParams, UpdatePromoCodeParams, DeletePromoCodeParams, GetPromoCodeParams, GetPromoCodesParams, CreateNodeParams, UpdateNodeParams, DeleteNodeParams, GetNodeParams, GetNodesParams, GetNodeChildrenParams, GenerateBlocksParams, GetVariableMetadataParams, CreateProductParams, UpdateProductParams, DeleteProductParams, GetProductParams, GetProductsParams, CreateOrderParams, UpdateOrderParams, GetOrderParams, GetOrdersParams, GetQuoteParams, OrderCheckoutParams, Slot, CreateReservationParams, UpdateReservationParams, ReservationCheckoutParams, GetReservationParams, SearchReservationsParams, GetReservationQuoteParams, CreateServiceParams, UpdateServiceParams, DeleteServiceParams, BulkScheduleParams, GetServiceParams, GetServicesParams, CreateProviderParams, UpdateProviderParams, DeleteProviderParams, GetProviderParams, GetProvidersParams, GetBusinessServiceWorkingTimeParams, CreateWorkflowParams, UpdateWorkflowParams, DeleteWorkflowParams, GetWorkflowParams, GetWorkflowsParams, TriggerWorkflowParams, CreateAudienceParams, UpdateAudienceParams, GetAudienceParams, GetAudiencesParams, SubscribeAudienceParams, GetAudienceSubscribersParams, RevokeAudienceSubscriptionParams } from './types.cjs';
2
2
  export { Access, AnalyticsConfig, ApiResponse, Audience, AudienceAccessResponse, AudienceSubscribeResponse, AudienceSubscriber, Block, Business, BusinessConfig, BusinessEvent, BusinessEventAction, DayAvailability, EshopCartItem, EshopStoreState, GetAvailabilityParams, GetSlotsForDateParams, Language, Location, Market, Media, MediaResolution, Node, PaginatedResponse, PaymentMethod, PaymentMethodType, PaymentProviderConfig, PaymentRefund, PromoCodeValidation, ProviderWithTimeline, Quote, ReservationCartItem, ReservationStoreState, ShippingMethod, ShippingWeightTier, SystemTemplateKey, Workflow, WorkflowEdge, WorkflowHttpMethod, WorkflowHttpNode, WorkflowIfNode, WorkflowLoopNode, WorkflowNode, WorkflowTriggerNode, WorkflowWaitNode, Zone } from './types.cjs';
3
3
  import { isValidKey, validateKey, toKey, nameToKey } from './utils.cjs';
4
4
 
@@ -73,6 +73,11 @@ interface RunScriptResponse {
73
73
  message: string;
74
74
  }
75
75
 
76
+ interface PlatformConfig {
77
+ stripePublicKey: string;
78
+ stripeConnectClientId: string;
79
+ }
80
+
76
81
  declare function getBlockLabel(block: any, locale?: string): string;
77
82
  declare function formatBlockValue(block: any): string;
78
83
  declare function prepareBlocksForSubmission(formData: any): any[];
@@ -108,9 +113,6 @@ declare function createPaymentForCheckout(subtotalMinor: number, marketId: strin
108
113
  };
109
114
  }): Payment;
110
115
 
111
- /**
112
- * Maps currency codes to their display symbols
113
- */
114
116
  declare function getCurrencySymbol(currency: string): string;
115
117
 
116
118
  interface ValidationResult {
@@ -129,76 +131,24 @@ declare const tzGroups: {
129
131
  declare function findTimeZone(groups: typeof tzGroups): string;
130
132
 
131
133
  declare const locales: readonly ["en", "sr-latn"];
132
- /**
133
- * * returns "slugified" text.
134
- * @param text: string - text to slugify
135
- */
136
134
  declare function slugify(text: string): string;
137
- /**
138
- * * returns "humanized" text. runs slugify() and then replaces - with space and upper case first letter of every word, and lower case the rest
139
- * @param text: string - text to humanize
140
- */
141
135
  declare function humanize(text: string): string;
142
- /**
143
- * * returns "categorified" text. runs slugify() and then replaces - with space and upper cases everything
144
- * @param text: string - text to categorify
145
- * @returns string - categorified text
146
- */
147
136
  declare function categorify(text: string): string;
148
- /**
149
- * * returns a nicely formatted string of the date passed
150
- * @param date: string | number | Date - date to format
151
- * @param locale: string - locale to format the date in
152
- * @returns string - formatted date
153
- */
154
137
  declare function formatDate(date: string | number | Date, locale: (typeof locales)[number]): string;
155
138
 
156
139
  declare function fetchSvgContent(mediaObject: any): Promise<string | null>;
157
- /**
158
- * Server-side helper for Astro components to fetch SVG content during SSR
159
- *
160
- * @param mediaObject The media object from the CMS
161
- * @returns The SVG content as a string, or empty string on failure
162
- */
163
140
  declare function getSvgContentForAstro(mediaObject: any): Promise<string>;
164
- /**
165
- * Client-side helper to fetch and inject SVG content into DOM elements
166
- *
167
- * @param mediaObject The media object from the CMS
168
- * @param targetElement The DOM element to inject the SVG into
169
- * @param className Optional CSS class to add to the SVG
170
- */
171
141
  declare function injectSvgIntoElement(mediaObject: any, targetElement: HTMLElement, className?: string): Promise<void>;
172
142
 
173
- /**
174
- * Analytics Utilities
175
- *
176
- * Provider-agnostic analytics tracking.
177
- * Currently supports: GA4
178
- * Designed for easy addition of other providers.
179
- */
180
143
  declare global {
181
144
  interface Window {
182
145
  dataLayer: any[];
183
146
  gtag: (...args: any[]) => void;
184
147
  }
185
148
  }
186
- /**
187
- * Injects the GA4 script tag into the document head.
188
- * Should be called once on page load when analytics is configured.
189
- */
190
- declare function injectGA4Script(measurementId: string): void;
191
- /**
192
- * Generic event tracking - works with any configured analytics provider.
193
- * Currently routes to GA4, can be extended for other providers.
194
- */
195
- declare function trackEvent(eventName: string, params?: Record<string, any>): void;
196
- /**
197
- * Check if analytics is ready.
198
- */
199
- declare function isAnalyticsReady(): boolean;
149
+ declare function track(eventName: string, params?: Record<string, any>): void;
200
150
 
201
- declare const SDK_VERSION = "0.3.168";
151
+ declare const SDK_VERSION = "0.4.15";
202
152
  declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
203
153
  interface ApiConfig {
204
154
  httpClient: any;
@@ -259,6 +209,8 @@ declare function createArkySDK(config: HttpClientConfig & {
259
209
  processRefund(params: ProcessRefundParams, options?: RequestOptions): Promise<any>;
260
210
  getBusinessEvents(params: GetBusinessEventsParams, options?: RequestOptions): Promise<any>;
261
211
  updateBusinessEventPayload(params: UpdateBusinessEventParams, options?: RequestOptions): Promise<any>;
212
+ connectStripe(params: ConnectStripeParams, options?: RequestOptions): Promise<any>;
213
+ disconnectStripe(params: DisconnectStripeParams, options?: RequestOptions): Promise<any>;
262
214
  };
263
215
  media: {
264
216
  uploadBusinessMedia(params: UploadBusinessMediaParams, options?: RequestOptions): Promise<any>;
@@ -277,6 +229,9 @@ declare function createArkySDK(config: HttpClientConfig & {
277
229
  getPromoCode(params: GetPromoCodeParams, options?: RequestOptions): Promise<any>;
278
230
  getPromoCodes(params: GetPromoCodesParams, options?: RequestOptions): Promise<any>;
279
231
  };
232
+ platform: {
233
+ getConfig(options?: RequestOptions): Promise<PlatformConfig>;
234
+ };
280
235
  cms: {
281
236
  createNode(params: CreateNodeParams, options?: RequestOptions): Promise<any>;
282
237
  updateNode(params: UpdateNodeParams, options?: RequestOptions): Promise<any>;
@@ -362,6 +317,9 @@ declare function createArkySDK(config: HttpClientConfig & {
362
317
  getSubscribers(params: GetAudienceSubscribersParams, options?: RequestOptions): Promise<any>;
363
318
  revokeSubscription(params: RevokeAudienceSubscriptionParams, options?: RequestOptions): Promise<any>;
364
319
  };
320
+ analytics: {
321
+ track: typeof track;
322
+ };
365
323
  setBusinessId: (businessId: string) => void;
366
324
  getBusinessId: () => string;
367
325
  setMarket: (market: string) => void;
@@ -409,9 +367,7 @@ declare function createArkySDK(config: HttpClientConfig & {
409
367
  validateKey: typeof validateKey;
410
368
  toKey: typeof toKey;
411
369
  nameToKey: typeof nameToKey;
412
- injectGA4Script: typeof injectGA4Script;
413
- trackEvent: typeof trackEvent;
414
- isAnalyticsReady: typeof isAnalyticsReady;
370
+ track: typeof track;
415
371
  };
416
372
  }>;
417
373
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Price, Payment, RequestOptions, MagicLinkVerifyParams, MagicLinkRequestParams, UpdateAccountProfileParams, DeleteAccountParams, AddPhoneNumberParams, PhoneNumberConfirmParams, GetMeParams, SearchAccountsParams, AccountSubscribeParams, CreateBusinessParams, UpdateBusinessParams, DeleteBusinessParams, GetBusinessParams, GetBusinessesParams, GetBusinessParentsParams, TriggerBuildsParams, GetSubscriptionPlansParams, GetSubscriptionParams, SubscribeParams, CreatePortalSessionParams, InviteUserParams, HandleInvitationParams, TestWebhookParams, GetBusinessMediaParams2, ProcessRefundParams, GetBusinessEventsParams, UpdateBusinessEventParams, UploadBusinessMediaParams, DeleteBusinessMediaParams, GetBusinessMediaParams, UpdateMediaParams, TrackEmailOpenParams, GetDeliveryStatsParams, CreatePromoCodeParams, UpdatePromoCodeParams, DeletePromoCodeParams, GetPromoCodeParams, GetPromoCodesParams, CreateNodeParams, UpdateNodeParams, DeleteNodeParams, GetNodeParams, GetNodesParams, GetNodeChildrenParams, GenerateBlocksParams, GetVariableMetadataParams, CreateProductParams, UpdateProductParams, DeleteProductParams, GetProductParams, GetProductsParams, CreateOrderParams, UpdateOrderParams, GetOrderParams, GetOrdersParams, GetQuoteParams, OrderCheckoutParams, Slot, CreateReservationParams, UpdateReservationParams, ReservationCheckoutParams, GetReservationParams, SearchReservationsParams, GetReservationQuoteParams, CreateServiceParams, UpdateServiceParams, DeleteServiceParams, BulkScheduleParams, GetServiceParams, GetServicesParams, CreateProviderParams, UpdateProviderParams, DeleteProviderParams, GetProviderParams, GetProvidersParams, GetBusinessServiceWorkingTimeParams, CreateWorkflowParams, UpdateWorkflowParams, DeleteWorkflowParams, GetWorkflowParams, GetWorkflowsParams, TriggerWorkflowParams, CreateAudienceParams, UpdateAudienceParams, GetAudienceParams, GetAudiencesParams, SubscribeAudienceParams, GetAudienceSubscribersParams, RevokeAudienceSubscriptionParams } from './types.js';
1
+ import { Price, Payment, RequestOptions, MagicLinkVerifyParams, MagicLinkRequestParams, UpdateAccountProfileParams, DeleteAccountParams, AddPhoneNumberParams, PhoneNumberConfirmParams, GetMeParams, SearchAccountsParams, AccountSubscribeParams, CreateBusinessParams, UpdateBusinessParams, DeleteBusinessParams, GetBusinessParams, GetBusinessesParams, GetBusinessParentsParams, TriggerBuildsParams, GetSubscriptionPlansParams, GetSubscriptionParams, SubscribeParams, CreatePortalSessionParams, InviteUserParams, HandleInvitationParams, TestWebhookParams, GetBusinessMediaParams2, ProcessRefundParams, GetBusinessEventsParams, UpdateBusinessEventParams, ConnectStripeParams, DisconnectStripeParams, UploadBusinessMediaParams, DeleteBusinessMediaParams, GetBusinessMediaParams, UpdateMediaParams, TrackEmailOpenParams, GetDeliveryStatsParams, CreatePromoCodeParams, UpdatePromoCodeParams, DeletePromoCodeParams, GetPromoCodeParams, GetPromoCodesParams, CreateNodeParams, UpdateNodeParams, DeleteNodeParams, GetNodeParams, GetNodesParams, GetNodeChildrenParams, GenerateBlocksParams, GetVariableMetadataParams, CreateProductParams, UpdateProductParams, DeleteProductParams, GetProductParams, GetProductsParams, CreateOrderParams, UpdateOrderParams, GetOrderParams, GetOrdersParams, GetQuoteParams, OrderCheckoutParams, Slot, CreateReservationParams, UpdateReservationParams, ReservationCheckoutParams, GetReservationParams, SearchReservationsParams, GetReservationQuoteParams, CreateServiceParams, UpdateServiceParams, DeleteServiceParams, BulkScheduleParams, GetServiceParams, GetServicesParams, CreateProviderParams, UpdateProviderParams, DeleteProviderParams, GetProviderParams, GetProvidersParams, GetBusinessServiceWorkingTimeParams, CreateWorkflowParams, UpdateWorkflowParams, DeleteWorkflowParams, GetWorkflowParams, GetWorkflowsParams, TriggerWorkflowParams, CreateAudienceParams, UpdateAudienceParams, GetAudienceParams, GetAudiencesParams, SubscribeAudienceParams, GetAudienceSubscribersParams, RevokeAudienceSubscriptionParams } from './types.js';
2
2
  export { Access, AnalyticsConfig, ApiResponse, Audience, AudienceAccessResponse, AudienceSubscribeResponse, AudienceSubscriber, Block, Business, BusinessConfig, BusinessEvent, BusinessEventAction, DayAvailability, EshopCartItem, EshopStoreState, GetAvailabilityParams, GetSlotsForDateParams, Language, Location, Market, Media, MediaResolution, Node, PaginatedResponse, PaymentMethod, PaymentMethodType, PaymentProviderConfig, PaymentRefund, PromoCodeValidation, ProviderWithTimeline, Quote, ReservationCartItem, ReservationStoreState, ShippingMethod, ShippingWeightTier, SystemTemplateKey, Workflow, WorkflowEdge, WorkflowHttpMethod, WorkflowHttpNode, WorkflowIfNode, WorkflowLoopNode, WorkflowNode, WorkflowTriggerNode, WorkflowWaitNode, Zone } from './types.js';
3
3
  import { isValidKey, validateKey, toKey, nameToKey } from './utils.js';
4
4
 
@@ -73,6 +73,11 @@ interface RunScriptResponse {
73
73
  message: string;
74
74
  }
75
75
 
76
+ interface PlatformConfig {
77
+ stripePublicKey: string;
78
+ stripeConnectClientId: string;
79
+ }
80
+
76
81
  declare function getBlockLabel(block: any, locale?: string): string;
77
82
  declare function formatBlockValue(block: any): string;
78
83
  declare function prepareBlocksForSubmission(formData: any): any[];
@@ -108,9 +113,6 @@ declare function createPaymentForCheckout(subtotalMinor: number, marketId: strin
108
113
  };
109
114
  }): Payment;
110
115
 
111
- /**
112
- * Maps currency codes to their display symbols
113
- */
114
116
  declare function getCurrencySymbol(currency: string): string;
115
117
 
116
118
  interface ValidationResult {
@@ -129,76 +131,24 @@ declare const tzGroups: {
129
131
  declare function findTimeZone(groups: typeof tzGroups): string;
130
132
 
131
133
  declare const locales: readonly ["en", "sr-latn"];
132
- /**
133
- * * returns "slugified" text.
134
- * @param text: string - text to slugify
135
- */
136
134
  declare function slugify(text: string): string;
137
- /**
138
- * * returns "humanized" text. runs slugify() and then replaces - with space and upper case first letter of every word, and lower case the rest
139
- * @param text: string - text to humanize
140
- */
141
135
  declare function humanize(text: string): string;
142
- /**
143
- * * returns "categorified" text. runs slugify() and then replaces - with space and upper cases everything
144
- * @param text: string - text to categorify
145
- * @returns string - categorified text
146
- */
147
136
  declare function categorify(text: string): string;
148
- /**
149
- * * returns a nicely formatted string of the date passed
150
- * @param date: string | number | Date - date to format
151
- * @param locale: string - locale to format the date in
152
- * @returns string - formatted date
153
- */
154
137
  declare function formatDate(date: string | number | Date, locale: (typeof locales)[number]): string;
155
138
 
156
139
  declare function fetchSvgContent(mediaObject: any): Promise<string | null>;
157
- /**
158
- * Server-side helper for Astro components to fetch SVG content during SSR
159
- *
160
- * @param mediaObject The media object from the CMS
161
- * @returns The SVG content as a string, or empty string on failure
162
- */
163
140
  declare function getSvgContentForAstro(mediaObject: any): Promise<string>;
164
- /**
165
- * Client-side helper to fetch and inject SVG content into DOM elements
166
- *
167
- * @param mediaObject The media object from the CMS
168
- * @param targetElement The DOM element to inject the SVG into
169
- * @param className Optional CSS class to add to the SVG
170
- */
171
141
  declare function injectSvgIntoElement(mediaObject: any, targetElement: HTMLElement, className?: string): Promise<void>;
172
142
 
173
- /**
174
- * Analytics Utilities
175
- *
176
- * Provider-agnostic analytics tracking.
177
- * Currently supports: GA4
178
- * Designed for easy addition of other providers.
179
- */
180
143
  declare global {
181
144
  interface Window {
182
145
  dataLayer: any[];
183
146
  gtag: (...args: any[]) => void;
184
147
  }
185
148
  }
186
- /**
187
- * Injects the GA4 script tag into the document head.
188
- * Should be called once on page load when analytics is configured.
189
- */
190
- declare function injectGA4Script(measurementId: string): void;
191
- /**
192
- * Generic event tracking - works with any configured analytics provider.
193
- * Currently routes to GA4, can be extended for other providers.
194
- */
195
- declare function trackEvent(eventName: string, params?: Record<string, any>): void;
196
- /**
197
- * Check if analytics is ready.
198
- */
199
- declare function isAnalyticsReady(): boolean;
149
+ declare function track(eventName: string, params?: Record<string, any>): void;
200
150
 
201
- declare const SDK_VERSION = "0.3.168";
151
+ declare const SDK_VERSION = "0.4.15";
202
152
  declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
203
153
  interface ApiConfig {
204
154
  httpClient: any;
@@ -259,6 +209,8 @@ declare function createArkySDK(config: HttpClientConfig & {
259
209
  processRefund(params: ProcessRefundParams, options?: RequestOptions): Promise<any>;
260
210
  getBusinessEvents(params: GetBusinessEventsParams, options?: RequestOptions): Promise<any>;
261
211
  updateBusinessEventPayload(params: UpdateBusinessEventParams, options?: RequestOptions): Promise<any>;
212
+ connectStripe(params: ConnectStripeParams, options?: RequestOptions): Promise<any>;
213
+ disconnectStripe(params: DisconnectStripeParams, options?: RequestOptions): Promise<any>;
262
214
  };
263
215
  media: {
264
216
  uploadBusinessMedia(params: UploadBusinessMediaParams, options?: RequestOptions): Promise<any>;
@@ -277,6 +229,9 @@ declare function createArkySDK(config: HttpClientConfig & {
277
229
  getPromoCode(params: GetPromoCodeParams, options?: RequestOptions): Promise<any>;
278
230
  getPromoCodes(params: GetPromoCodesParams, options?: RequestOptions): Promise<any>;
279
231
  };
232
+ platform: {
233
+ getConfig(options?: RequestOptions): Promise<PlatformConfig>;
234
+ };
280
235
  cms: {
281
236
  createNode(params: CreateNodeParams, options?: RequestOptions): Promise<any>;
282
237
  updateNode(params: UpdateNodeParams, options?: RequestOptions): Promise<any>;
@@ -362,6 +317,9 @@ declare function createArkySDK(config: HttpClientConfig & {
362
317
  getSubscribers(params: GetAudienceSubscribersParams, options?: RequestOptions): Promise<any>;
363
318
  revokeSubscription(params: RevokeAudienceSubscriptionParams, options?: RequestOptions): Promise<any>;
364
319
  };
320
+ analytics: {
321
+ track: typeof track;
322
+ };
365
323
  setBusinessId: (businessId: string) => void;
366
324
  getBusinessId: () => string;
367
325
  setMarket: (market: string) => void;
@@ -409,9 +367,7 @@ declare function createArkySDK(config: HttpClientConfig & {
409
367
  validateKey: typeof validateKey;
410
368
  toKey: typeof toKey;
411
369
  nameToKey: typeof nameToKey;
412
- injectGA4Script: typeof injectGA4Script;
413
- trackEvent: typeof trackEvent;
414
- isAnalyticsReady: typeof isAnalyticsReady;
370
+ track: typeof track;
415
371
  };
416
372
  }>;
417
373
 
package/dist/index.js CHANGED
@@ -209,7 +209,6 @@ function createHttpClient(cfg) {
209
209
  // src/api/account.ts
210
210
  var createAccountApi = (apiConfig) => {
211
211
  return {
212
- // ===== ACCOUNT PROFILE =====
213
212
  async updateAccount(params, options) {
214
213
  const payload = {};
215
214
  if (params.phoneNumbers !== void 0) payload.phoneNumbers = params.phoneNumbers;
@@ -238,7 +237,6 @@ var createAccountApi = (apiConfig) => {
238
237
  }
239
238
  });
240
239
  },
241
- // ===== SUBSCRIPTION =====
242
240
  async subscribe(params, options) {
243
241
  return apiConfig.httpClient.post("/v1/accounts/subscribe", params, options);
244
242
  }
@@ -248,17 +246,9 @@ var createAccountApi = (apiConfig) => {
248
246
  // src/api/auth.ts
249
247
  var createAuthApi = (apiConfig) => {
250
248
  return {
251
- /**
252
- * Create a guest session (anonymous user)
253
- * POST /auth/session
254
- */
255
249
  async session(options) {
256
250
  return apiConfig.httpClient.post("/v1/auth/session", {}, options);
257
251
  },
258
- /**
259
- * Sign in anonymously (creates guest session if not already authenticated)
260
- * Following Firebase/Supabase pattern - idempotent, safe to call multiple times
261
- */
262
252
  async signInAnonymously(options) {
263
253
  const tokens = await apiConfig.getToken();
264
254
  if (tokens?.accessToken) {
@@ -270,28 +260,15 @@ var createAuthApi = (apiConfig) => {
270
260
  }
271
261
  return result;
272
262
  },
273
- /**
274
- * Check if current user is a guest (anonymous)
275
- * Guest emails follow pattern: guest+uuid@arky.io
276
- */
277
263
  async isGuest() {
278
264
  const tokens = await apiConfig.getToken();
279
265
  if (!tokens?.accessToken) return true;
280
266
  const email = tokens.email || "";
281
267
  return !email || email.startsWith("guest+");
282
268
  },
283
- // ==================== PLATFORM AUTH (Admin) ====================
284
- /**
285
- * Request platform auth code (Arky admin)
286
- * POST /auth/code
287
- */
288
269
  async code(params, options) {
289
270
  return apiConfig.httpClient.post("/v1/auth/code", params, options);
290
271
  },
291
- /**
292
- * Verify platform auth code - automatically sets token on success
293
- * POST /auth/verify
294
- */
295
272
  async verify(params, options) {
296
273
  const result = await apiConfig.httpClient.post("/v1/auth/verify", params, options);
297
274
  if (result?.accessToken) {
@@ -299,25 +276,12 @@ var createAuthApi = (apiConfig) => {
299
276
  }
300
277
  return result;
301
278
  },
302
- /**
303
- * Refresh access token
304
- * POST /auth/refresh
305
- */
306
279
  async refresh(params, options) {
307
280
  return apiConfig.httpClient.post("/v1/auth/refresh", params, options);
308
281
  },
309
- // ==================== BUSINESS AUTH (arky.io, delfin, soulofstrings) ====================
310
- /**
311
- * Request business auth code
312
- * POST /businesses/{businessId}/auth/code
313
- */
314
282
  async businessCode(businessId, params, options) {
315
283
  return apiConfig.httpClient.post(`/v1/businesses/${businessId}/auth/code`, params, options);
316
284
  },
317
- /**
318
- * Verify business auth code - automatically sets token on success
319
- * POST /businesses/{businessId}/auth/verify
320
- */
321
285
  async businessVerify(businessId, params, options) {
322
286
  const result = await apiConfig.httpClient.post(`/v1/businesses/${businessId}/auth/verify`, params, options);
323
287
  if (result?.accessToken) {
@@ -325,10 +289,6 @@ var createAuthApi = (apiConfig) => {
325
289
  }
326
290
  return result;
327
291
  },
328
- // ==================== DEPRECATED (for backwards compatibility) ====================
329
- /**
330
- * @deprecated Use code() instead
331
- */
332
292
  async magicLink(params, options) {
333
293
  return apiConfig.httpClient.post("/v1/auth/code", params, options);
334
294
  }
@@ -465,6 +425,20 @@ var createBusinessApi = (apiConfig) => {
465
425
  { payload: params.payload },
466
426
  options
467
427
  );
428
+ },
429
+ async connectStripe(params, options) {
430
+ return apiConfig.httpClient.post(
431
+ `/v1/businesses/${params.businessId}/stripe/connect`,
432
+ { code: params.code },
433
+ options
434
+ );
435
+ },
436
+ async disconnectStripe(params, options) {
437
+ return apiConfig.httpClient.post(
438
+ `/v1/businesses/${params.businessId}/stripe/disconnect`,
439
+ {},
440
+ options
441
+ );
468
442
  }
469
443
  };
470
444
  };
@@ -857,7 +831,6 @@ var createCmsApi = (apiConfig) => {
857
831
  // src/api/eshop.ts
858
832
  var createEshopApi = (apiConfig) => {
859
833
  return {
860
- // ===== PRODUCTS =====
861
834
  async createProduct(params, options) {
862
835
  return apiConfig.httpClient.post(
863
836
  `/v1/businesses/${apiConfig.businessId}/products`,
@@ -901,7 +874,6 @@ var createEshopApi = (apiConfig) => {
901
874
  }
902
875
  );
903
876
  },
904
- // ===== ORDERS =====
905
877
  async createOrder(params, options) {
906
878
  return apiConfig.httpClient.post(
907
879
  `/v1/businesses/${apiConfig.businessId}/orders`,
@@ -931,7 +903,6 @@ var createEshopApi = (apiConfig) => {
931
903
  }
932
904
  );
933
905
  },
934
- // ===== PAYMENTS =====
935
906
  async getQuote(params, options) {
936
907
  const payload = {
937
908
  market: apiConfig.market,
@@ -970,7 +941,6 @@ var createEshopApi = (apiConfig) => {
970
941
  var createReservationApi = (apiConfig) => {
971
942
  let cart = [];
972
943
  return {
973
- // ===== CART =====
974
944
  addToCart(slot) {
975
945
  cart.push(slot);
976
946
  },
@@ -983,7 +953,6 @@ var createReservationApi = (apiConfig) => {
983
953
  clearCart() {
984
954
  cart = [];
985
955
  },
986
- // ===== RESERVATIONS =====
987
956
  async createReservation(params, options) {
988
957
  const { businessId, ...rest } = params;
989
958
  const targetBusinessId = businessId || apiConfig.businessId;
@@ -1043,7 +1012,6 @@ var createReservationApi = (apiConfig) => {
1043
1012
  }
1044
1013
  );
1045
1014
  },
1046
- // ===== QUOTES =====
1047
1015
  async getQuote(params, options) {
1048
1016
  const { businessId, ...rest } = params;
1049
1017
  const targetBusinessId = businessId || apiConfig.businessId;
@@ -1057,7 +1025,6 @@ var createReservationApi = (apiConfig) => {
1057
1025
  options
1058
1026
  );
1059
1027
  },
1060
- // ===== SERVICES =====
1061
1028
  async createService(params, options) {
1062
1029
  const { businessId, ...payload } = params;
1063
1030
  const targetBusinessId = businessId || apiConfig.businessId;
@@ -1116,7 +1083,6 @@ var createReservationApi = (apiConfig) => {
1116
1083
  }
1117
1084
  );
1118
1085
  },
1119
- // ===== PROVIDERS =====
1120
1086
  async createProvider(params, options) {
1121
1087
  const { businessId, ...payload } = params;
1122
1088
  const targetBusinessId = businessId || apiConfig.businessId;
@@ -1239,11 +1205,6 @@ var createLocationApi = (apiConfig) => {
1239
1205
  // src/api/network.ts
1240
1206
  var createNetworkApi = (apiConfig) => {
1241
1207
  return {
1242
- /**
1243
- * Search services across all businesses that have opted into a network
1244
- * @param networkKey - The network key (e.g., "delfin")
1245
- * @param params - Search parameters
1246
- */
1247
1208
  async searchServices(networkKey, params, options) {
1248
1209
  const queryParams = {};
1249
1210
  if (params?.limit !== void 0) queryParams.limit = params.limit;
@@ -1270,11 +1231,6 @@ var createNetworkApi = (apiConfig) => {
1270
1231
  params: queryParams
1271
1232
  });
1272
1233
  },
1273
- /**
1274
- * Search products across all businesses that have opted into a network
1275
- * @param networkKey - The network key (e.g., "delfin")
1276
- * @param params - Search parameters
1277
- */
1278
1234
  async searchProducts(networkKey, params, options) {
1279
1235
  const queryParams = {};
1280
1236
  if (params?.limit !== void 0) queryParams.limit = params.limit;
@@ -1301,11 +1257,6 @@ var createNetworkApi = (apiConfig) => {
1301
1257
  params: queryParams
1302
1258
  });
1303
1259
  },
1304
- /**
1305
- * Search providers across all businesses that have opted into a network
1306
- * @param networkKey - The network key (e.g., "delfin")
1307
- * @param params - Search parameters
1308
- */
1309
1260
  async searchProviders(networkKey, params, options) {
1310
1261
  const queryParams = {};
1311
1262
  if (params?.limit !== void 0) queryParams.limit = params.limit;
@@ -1371,10 +1322,6 @@ var createWorkflowApi = (apiConfig) => {
1371
1322
  params: Object.keys(queryParams).length > 0 ? queryParams : void 0
1372
1323
  });
1373
1324
  },
1374
- /**
1375
- * Trigger a workflow execution via webhook
1376
- * No authentication required - the secret in the URL validates the request
1377
- */
1378
1325
  async triggerWorkflow(params, options) {
1379
1326
  const { secret, ...input } = params;
1380
1327
  return apiConfig.httpClient.post(`/v1/workflows/trigger/${secret}`, input, options);
@@ -1455,6 +1402,15 @@ var createAudienceApi = (apiConfig) => {
1455
1402
  };
1456
1403
  };
1457
1404
 
1405
+ // src/api/platform.ts
1406
+ var createPlatformApi = (apiConfig) => {
1407
+ return {
1408
+ async getConfig(options) {
1409
+ return apiConfig.httpClient.get("/v1/platform/config", options);
1410
+ }
1411
+ };
1412
+ };
1413
+
1458
1414
  // src/utils/currency.ts
1459
1415
  function getCurrencySymbol(currency) {
1460
1416
  const currencySymbols = {
@@ -1745,7 +1701,6 @@ function slugify(text) {
1745
1701
  function humanize(text) {
1746
1702
  const slugifiedText = slugify(text);
1747
1703
  return slugifiedText.replace(/-/g, " ").replace(
1748
- // upper case first letter of every word, and lower case the rest
1749
1704
  /\w\S*/g,
1750
1705
  (w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()
1751
1706
  );
@@ -1855,19 +1810,15 @@ function injectGA4Script(measurementId) {
1855
1810
  script.src = `https://www.googletagmanager.com/gtag/js?id=${measurementId}`;
1856
1811
  document.head.appendChild(script);
1857
1812
  }
1858
- function trackEvent(eventName, params) {
1813
+ function track(eventName, params) {
1859
1814
  if (typeof window === "undefined") return;
1860
1815
  if (window.gtag) {
1861
1816
  window.gtag("event", eventName, params);
1862
1817
  }
1863
1818
  }
1864
- function isAnalyticsReady() {
1865
- if (typeof window === "undefined") return false;
1866
- return typeof window.gtag === "function";
1867
- }
1868
1819
 
1869
1820
  // src/index.ts
1870
- var SDK_VERSION = "0.3.168";
1821
+ var SDK_VERSION = "0.4.15";
1871
1822
  var SUPPORTED_FRAMEWORKS = [
1872
1823
  "astro",
1873
1824
  "react",
@@ -1889,13 +1840,23 @@ async function createArkySDK(config) {
1889
1840
  };
1890
1841
  const accountApi = createAccountApi(apiConfig);
1891
1842
  const authApi = createAuthApi(apiConfig);
1843
+ const businessApi = createBusinessApi(apiConfig);
1844
+ if (typeof window !== "undefined") {
1845
+ businessApi.getBusiness({}).then(({ data: business }) => {
1846
+ if (business?.config?.analytics?.measurementId) {
1847
+ injectGA4Script(business.config.analytics.measurementId);
1848
+ }
1849
+ }).catch(() => {
1850
+ });
1851
+ }
1892
1852
  const sdk = {
1893
1853
  auth: authApi,
1894
1854
  account: accountApi,
1895
- business: createBusinessApi(apiConfig),
1855
+ business: businessApi,
1896
1856
  media: createMediaApi(apiConfig),
1897
1857
  notification: createNotificationApi(apiConfig),
1898
1858
  promoCode: createPromoCodeApi(apiConfig),
1859
+ platform: createPlatformApi(apiConfig),
1899
1860
  cms: createCmsApi(apiConfig),
1900
1861
  eshop: createEshopApi(apiConfig),
1901
1862
  reservation: createReservationApi(apiConfig),
@@ -1904,6 +1865,9 @@ async function createArkySDK(config) {
1904
1865
  network: createNetworkApi(apiConfig),
1905
1866
  workflow: createWorkflowApi(apiConfig),
1906
1867
  audience: createAudienceApi(apiConfig),
1868
+ analytics: {
1869
+ track
1870
+ },
1907
1871
  setBusinessId: (businessId) => {
1908
1872
  apiConfig.businessId = businessId;
1909
1873
  },
@@ -1919,10 +1883,8 @@ async function createArkySDK(config) {
1919
1883
  isAuthenticated: config.isAuthenticated || (() => false),
1920
1884
  logout: config.logout,
1921
1885
  setToken: config.setToken,
1922
- // Top-level block utilities for convenience
1923
1886
  extractBlockValues,
1924
1887
  utils: {
1925
- // Block utilities
1926
1888
  getImageUrl: (imageBlock, isBlock = true) => getImageUrl(imageBlock, isBlock),
1927
1889
  getBlockValue,
1928
1890
  getBlockValues,
@@ -1933,37 +1895,27 @@ async function createArkySDK(config) {
1933
1895
  formatBlockValue,
1934
1896
  prepareBlocksForSubmission,
1935
1897
  extractBlockValues,
1936
- // Price utilities
1937
1898
  getMarketPrice,
1938
1899
  getPriceAmount,
1939
1900
  formatPayment,
1940
1901
  formatMinor,
1941
1902
  createPaymentForCheckout,
1942
- // Currency utilities
1943
1903
  getCurrencySymbol,
1944
- // Validation utilities
1945
1904
  validatePhoneNumber,
1946
- // Timezone utilities
1947
1905
  tzGroups,
1948
1906
  findTimeZone,
1949
- // Text utilities
1950
1907
  slugify,
1951
1908
  humanize,
1952
1909
  categorify,
1953
1910
  formatDate,
1954
- // SVG utilities
1955
1911
  getSvgContentForAstro,
1956
1912
  fetchSvgContent,
1957
1913
  injectSvgIntoElement,
1958
- // Key validation utilities
1959
1914
  isValidKey,
1960
1915
  validateKey,
1961
1916
  toKey,
1962
1917
  nameToKey,
1963
- // Analytics utilities
1964
- injectGA4Script,
1965
- trackEvent,
1966
- isAnalyticsReady
1918
+ track
1967
1919
  }
1968
1920
  };
1969
1921
  return sdk;