@sonordev/site-kit 2.8.1 → 2.8.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/{chunk-AT2ZF3TL.mjs → chunk-FMZOZQBV.mjs} +91 -15
- package/dist/chunk-FMZOZQBV.mjs.map +1 -0
- package/dist/{chunk-ZQINTH5K.js → chunk-I2GTT2DG.js} +91 -15
- package/dist/chunk-I2GTT2DG.js.map +1 -0
- package/dist/commerce/index.d.mts +3 -3
- package/dist/commerce/index.d.ts +3 -3
- package/dist/commerce/server.d.mts +1 -1
- package/dist/commerce/server.d.ts +1 -1
- package/dist/index.d.mts +4 -190
- package/dist/index.d.ts +4 -190
- package/dist/index.js +13 -13
- package/dist/index.mjs +1 -1
- package/dist/sync/index.d.mts +213 -0
- package/dist/sync/index.d.ts +213 -0
- package/dist/sync/index.js +13 -13
- package/dist/sync/index.mjs +1 -1
- package/dist/{types-B0xmgGw-.d.mts → types-iZM4Lz71.d.mts} +1 -1
- package/dist/{types-B0xmgGw-.d.ts → types-iZM4Lz71.d.ts} +1 -1
- package/dist/{useEventModal-CJLCmH5Y.d.ts → useEventModal-CcxNZOvp.d.ts} +2 -2
- package/dist/{useEventModal-4W_y1SYY.d.mts → useEventModal-qJfX_1XG.d.mts} +2 -2
- package/package.json +2 -2
- package/dist/chunk-AT2ZF3TL.mjs.map +0 -1
- package/dist/chunk-ZQINTH5K.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export { c as AnalyticsConfig, b as AnalyticsEvent, P as PageView } from './type
|
|
|
3
3
|
export { C as ChatConfig, c as EngageElement, d as WidgetConfig } from './types-BnCwwUX3.js';
|
|
4
4
|
export { a as FormField, F as FormSubmission, M as ManagedFormConfig } from './types-0dmq3k20.js';
|
|
5
5
|
export { a as BlogAuthor, b as BlogCategory, B as BlogPostType } from './types-5P5B9RgV.js';
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
6
|
+
export { d as Cart, e as CartItem, a as CommerceCategory, C as CommerceOffering, c as CommerceSchedule, b as CommerceVariant, O as OfferingType } from './types-iZM4Lz71.js';
|
|
7
|
+
export { d as CalendarView, C as CheckoutForm, t as CheckoutLineItem, f as EventCalendar, c as EventCheckout, s as EventCheckoutProps, b as EventEmbed, e as EventModal, E as EventTile, O as OfferingCard, a as OfferingList, P as ProductEmbed, R as RegistrationForm, U as UpcomingEvents, m as createCheckoutSession, l as fetchNextEvent, h as fetchOffering, g as fetchOfferings, i as fetchProducts, j as fetchServices, k as fetchUpcomingEvents, o as formatDate, p as formatDateTime, n as formatPrice, q as getOfferingUrl, r as registerForEvent, u as useEventModal } from './useEventModal-CcxNZOvp.js';
|
|
8
8
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
9
|
import React__default from 'react';
|
|
10
10
|
export { RedirectConfig, RedirectRule, clearRedirectCache, fetchRedirectRules, generateNextRedirects, handleManagedRedirects } from './redirects/index.js';
|
|
@@ -12,6 +12,7 @@ export { g as ImageApiConfig, I as ImageFile, M as ManagedImage, b as ManagedIma
|
|
|
12
12
|
export { EngageOverride, ExperimentAssignment, ExperimentConfig, ExperimentConversion, ExperimentVariant, MetaOverride, PriceOverride, SignalBridge, SignalBridgeProps, SignalConfig, SignalContextValue, SignalEvent, SignalExperiment, SignalOutcome, useExperimentVariant, useSignal, useSignalConfig, useSignalEvent, useSignalExperiment, useSignalOutcome } from './signal/index.js';
|
|
13
13
|
export { TestimonialSection } from './reputation/index.js';
|
|
14
14
|
export { Review, ReviewStats, TestimonialSectionProps, fetchReviewStats, fetchReviews } from './reputation/server.js';
|
|
15
|
+
export { BookingResult, BookingType, BookingWidget, BookingWidgetProps, GuestInfo, Host, SlotHold, SyncWidgetConfig, TimeSlot, createBooking, createSlotHold, detectTimezone, fetchAvailability, fetchAvailableDates, fetchBookingTypeDetails, fetchBookingTypes, formatDate as formatBookingDate, formatTime as formatBookingTime, formatDuration, releaseSlotHold } from './sync/index.js';
|
|
15
16
|
import 'next';
|
|
16
17
|
import 'next/server';
|
|
17
18
|
|
|
@@ -221,191 +222,4 @@ interface AffiliatesWidgetProps {
|
|
|
221
222
|
*/
|
|
222
223
|
declare function AffiliatesWidget({ className, loadingComponent, emptyComponent, errorComponent, showOffers, renderAffiliate, limit, }: AffiliatesWidgetProps): string | number | bigint | true | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null;
|
|
223
224
|
|
|
224
|
-
|
|
225
|
-
* Sync Module Types - Booking Widget for Client Sites
|
|
226
|
-
*/
|
|
227
|
-
interface BookingType {
|
|
228
|
-
id: string;
|
|
229
|
-
slug: string;
|
|
230
|
-
name: string;
|
|
231
|
-
description?: string;
|
|
232
|
-
duration_minutes: number;
|
|
233
|
-
buffer_before?: number;
|
|
234
|
-
buffer_after?: number;
|
|
235
|
-
color?: string;
|
|
236
|
-
location_type: 'video' | 'phone' | 'in_person' | 'custom';
|
|
237
|
-
location_details?: string;
|
|
238
|
-
price_cents?: number;
|
|
239
|
-
currency?: string;
|
|
240
|
-
is_active: boolean;
|
|
241
|
-
}
|
|
242
|
-
interface TimeSlot {
|
|
243
|
-
start: string;
|
|
244
|
-
end: string;
|
|
245
|
-
hostId?: string;
|
|
246
|
-
available: boolean;
|
|
247
|
-
}
|
|
248
|
-
interface Host {
|
|
249
|
-
id: string;
|
|
250
|
-
name: string;
|
|
251
|
-
email?: string;
|
|
252
|
-
avatar?: string;
|
|
253
|
-
title?: string;
|
|
254
|
-
bio?: string;
|
|
255
|
-
}
|
|
256
|
-
interface SlotHold {
|
|
257
|
-
holdId: string;
|
|
258
|
-
expiresAt: string;
|
|
259
|
-
expiresInSeconds: number;
|
|
260
|
-
}
|
|
261
|
-
interface BookingResult {
|
|
262
|
-
success: boolean;
|
|
263
|
-
booking: {
|
|
264
|
-
id: string;
|
|
265
|
-
confirmationCode: string;
|
|
266
|
-
scheduledAt: string;
|
|
267
|
-
durationMinutes: number;
|
|
268
|
-
hostName?: string;
|
|
269
|
-
timezone: string;
|
|
270
|
-
};
|
|
271
|
-
cancelUrl: string;
|
|
272
|
-
rescheduleUrl: string;
|
|
273
|
-
calendarLinks: {
|
|
274
|
-
google: string;
|
|
275
|
-
outlook: string;
|
|
276
|
-
ics: string;
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
interface BookingWidgetProps {
|
|
280
|
-
/** Organization slug – required for public (unauthenticated) mode, optional with apiKey */
|
|
281
|
-
orgSlug?: string;
|
|
282
|
-
/** API key – when provided, uses authenticated /sync/widget/* endpoints (no orgSlug needed) */
|
|
283
|
-
apiKey?: string;
|
|
284
|
-
/** API base URL - defaults to https://api.sonor.io */
|
|
285
|
-
apiUrl?: string;
|
|
286
|
-
/** Specific booking type slug to show (optional - shows all if not provided) */
|
|
287
|
-
bookingTypeSlug?: string;
|
|
288
|
-
/** Guest's timezone (auto-detected if not provided) */
|
|
289
|
-
timezone?: string;
|
|
290
|
-
/** Custom class name for styling */
|
|
291
|
-
className?: string;
|
|
292
|
-
/** Number of days to show availability for */
|
|
293
|
-
daysToShow?: number;
|
|
294
|
-
/** Called when booking is completed */
|
|
295
|
-
onBookingComplete?: (result: BookingResult) => void;
|
|
296
|
-
/** Called when an error occurs */
|
|
297
|
-
onError?: (error: Error) => void;
|
|
298
|
-
/** Hide the booking type selector (for single type embed) */
|
|
299
|
-
hideTypeSelector?: boolean;
|
|
300
|
-
/** Custom styles */
|
|
301
|
-
styles?: {
|
|
302
|
-
primaryColor?: string;
|
|
303
|
-
borderRadius?: string;
|
|
304
|
-
fontFamily?: string;
|
|
305
|
-
/** Dark mode colors */
|
|
306
|
-
backgroundColor?: string;
|
|
307
|
-
surfaceColor?: string;
|
|
308
|
-
elevatedColor?: string;
|
|
309
|
-
textPrimary?: string;
|
|
310
|
-
textSecondary?: string;
|
|
311
|
-
textTertiary?: string;
|
|
312
|
-
borderColor?: string;
|
|
313
|
-
inputBorderColor?: string;
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
interface GuestInfo {
|
|
317
|
-
name: string;
|
|
318
|
-
email: string;
|
|
319
|
-
phone?: string;
|
|
320
|
-
notes?: string;
|
|
321
|
-
}
|
|
322
|
-
interface SyncWidgetConfig {
|
|
323
|
-
apiUrl: string;
|
|
324
|
-
orgSlug: string;
|
|
325
|
-
timezone: string;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
declare function BookingWidget({ orgSlug, apiKey: propApiKey, apiUrl: propApiUrl, bookingTypeSlug, timezone: propTimezone, className, daysToShow, onBookingComplete, onError, hideTypeSelector, styles, }: BookingWidgetProps): react_jsx_runtime.JSX.Element;
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Sync API Functions - Client-side API calls for booking widget
|
|
332
|
-
*
|
|
333
|
-
* Two modes:
|
|
334
|
-
* 1. API-key flow (preferred): Uses x-api-key header → /sync/widget/* endpoints.
|
|
335
|
-
* Project is resolved server-side from the key. No orgSlug needed.
|
|
336
|
-
* 2. Public/orgSlug flow (legacy): Uses /sync/public/:org/* endpoints. No auth.
|
|
337
|
-
*/
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
* Fetch booking types.
|
|
341
|
-
* - With apiKey → GET /sync/widget/types
|
|
342
|
-
* - With orgSlug → GET /sync/public/:org/types
|
|
343
|
-
*/
|
|
344
|
-
declare function fetchBookingTypes(orgSlug?: string, apiUrl?: string, apiKey?: string): Promise<BookingType[]>;
|
|
345
|
-
/**
|
|
346
|
-
* Fetch booking type details
|
|
347
|
-
*/
|
|
348
|
-
declare function fetchBookingTypeDetails(typeSlug: string, orgSlug?: string, apiUrl?: string, apiKey?: string): Promise<BookingType>;
|
|
349
|
-
/**
|
|
350
|
-
* Fetch available time slots for a specific date
|
|
351
|
-
*/
|
|
352
|
-
declare function fetchAvailability(typeSlug: string, date: string, // YYYY-MM-DD format
|
|
353
|
-
orgSlug?: string, apiUrl?: string, apiKey?: string, timezone?: string, hostId?: string): Promise<TimeSlot[]>;
|
|
354
|
-
/**
|
|
355
|
-
* Hold a time slot temporarily (5-10 minutes)
|
|
356
|
-
*/
|
|
357
|
-
declare function createSlotHold(holdData: {
|
|
358
|
-
bookingType: string;
|
|
359
|
-
slotStart: string;
|
|
360
|
-
slotEnd: string;
|
|
361
|
-
hostId: string;
|
|
362
|
-
sessionId: string;
|
|
363
|
-
guestEmail?: string;
|
|
364
|
-
}, apiUrl?: string, apiKey?: string): Promise<SlotHold>;
|
|
365
|
-
/**
|
|
366
|
-
* Release a slot hold
|
|
367
|
-
*/
|
|
368
|
-
declare function releaseSlotHold(holdId: string, apiUrl?: string, apiKey?: string): Promise<void>;
|
|
369
|
-
/**
|
|
370
|
-
* Create a booking
|
|
371
|
-
*/
|
|
372
|
-
declare function createBooking(bookingData: {
|
|
373
|
-
bookingType: string;
|
|
374
|
-
scheduledAt: string;
|
|
375
|
-
hostId: string;
|
|
376
|
-
name: string;
|
|
377
|
-
email: string;
|
|
378
|
-
phone?: string;
|
|
379
|
-
company?: string;
|
|
380
|
-
message?: string;
|
|
381
|
-
source: string;
|
|
382
|
-
timezone?: string;
|
|
383
|
-
holdId?: string;
|
|
384
|
-
sessionId?: string;
|
|
385
|
-
sourceUrl?: string;
|
|
386
|
-
}, apiUrl?: string, apiKey?: string): Promise<BookingResult>;
|
|
387
|
-
/**
|
|
388
|
-
* Get available dates for a month (helper for calendar view)
|
|
389
|
-
* Returns dates that have at least one available slot
|
|
390
|
-
*/
|
|
391
|
-
declare function fetchAvailableDates(typeSlug: string, startDate: string, // YYYY-MM-DD
|
|
392
|
-
endDate: string, // YYYY-MM-DD
|
|
393
|
-
orgSlug?: string, apiUrl?: string, apiKey?: string, timezone?: string): Promise<string[]>;
|
|
394
|
-
/**
|
|
395
|
-
* Detect user's timezone
|
|
396
|
-
*/
|
|
397
|
-
declare function detectTimezone(): string;
|
|
398
|
-
/**
|
|
399
|
-
* Format time for display
|
|
400
|
-
*/
|
|
401
|
-
declare function formatTime(isoString: string, timezone: string): string;
|
|
402
|
-
/**
|
|
403
|
-
* Format date for display
|
|
404
|
-
*/
|
|
405
|
-
declare function formatDate(isoString: string, timezone: string): string;
|
|
406
|
-
/**
|
|
407
|
-
* Format duration for display
|
|
408
|
-
*/
|
|
409
|
-
declare function formatDuration(minutes: number): string;
|
|
410
|
-
|
|
411
|
-
export { type Affiliate, AffiliateCard, type AffiliateCardProps, type AffiliateOffer, type AffiliateWithOffers, AffiliatesWidget, type AffiliatesWidgetProps, type BookingResult, type BookingType, BookingWidget, type BookingWidgetProps, type GuestInfo, type Host, type SiteKitConfig, type SlotHold, type SyncWidgetConfig, type TimeSlot, type UseAffiliatesResult, createBooking, createSlotHold, detectTimezone, fetchAffiliates, fetchAvailability, fetchAvailableDates, fetchBookingTypeDetails, fetchBookingTypes, formatDate as formatBookingDate, formatTime as formatBookingTime, formatDuration, getTrackingUrl, releaseSlotHold, useAffiliates };
|
|
225
|
+
export { type Affiliate, AffiliateCard, type AffiliateCardProps, type AffiliateOffer, type AffiliateWithOffers, AffiliatesWidget, type AffiliatesWidgetProps, type SiteKitConfig, type UseAffiliatesResult, fetchAffiliates, getTrackingUrl, useAffiliates };
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ require('./chunk-GCPPXUAI.js');
|
|
|
7
7
|
var chunkEHJANA5C_js = require('./chunk-EHJANA5C.js');
|
|
8
8
|
var chunkGSRT66PA_js = require('./chunk-GSRT66PA.js');
|
|
9
9
|
var chunk4LC4KETS_js = require('./chunk-4LC4KETS.js');
|
|
10
|
-
var
|
|
10
|
+
var chunkI2GTT2DG_js = require('./chunk-I2GTT2DG.js');
|
|
11
11
|
require('./chunk-LPSWITNZ.js');
|
|
12
12
|
require('./chunk-SYNJOJTP.js');
|
|
13
13
|
var chunkGQU4LXOP_js = require('./chunk-GQU4LXOP.js');
|
|
@@ -315,51 +315,51 @@ Object.defineProperty(exports, "useEventModal", {
|
|
|
315
315
|
});
|
|
316
316
|
Object.defineProperty(exports, "BookingWidget", {
|
|
317
317
|
enumerable: true,
|
|
318
|
-
get: function () { return
|
|
318
|
+
get: function () { return chunkI2GTT2DG_js.BookingWidget; }
|
|
319
319
|
});
|
|
320
320
|
Object.defineProperty(exports, "createBooking", {
|
|
321
321
|
enumerable: true,
|
|
322
|
-
get: function () { return
|
|
322
|
+
get: function () { return chunkI2GTT2DG_js.createBooking; }
|
|
323
323
|
});
|
|
324
324
|
Object.defineProperty(exports, "createSlotHold", {
|
|
325
325
|
enumerable: true,
|
|
326
|
-
get: function () { return
|
|
326
|
+
get: function () { return chunkI2GTT2DG_js.createSlotHold; }
|
|
327
327
|
});
|
|
328
328
|
Object.defineProperty(exports, "detectTimezone", {
|
|
329
329
|
enumerable: true,
|
|
330
|
-
get: function () { return
|
|
330
|
+
get: function () { return chunkI2GTT2DG_js.detectTimezone; }
|
|
331
331
|
});
|
|
332
332
|
Object.defineProperty(exports, "fetchAvailability", {
|
|
333
333
|
enumerable: true,
|
|
334
|
-
get: function () { return
|
|
334
|
+
get: function () { return chunkI2GTT2DG_js.fetchAvailability; }
|
|
335
335
|
});
|
|
336
336
|
Object.defineProperty(exports, "fetchAvailableDates", {
|
|
337
337
|
enumerable: true,
|
|
338
|
-
get: function () { return
|
|
338
|
+
get: function () { return chunkI2GTT2DG_js.fetchAvailableDates; }
|
|
339
339
|
});
|
|
340
340
|
Object.defineProperty(exports, "fetchBookingTypeDetails", {
|
|
341
341
|
enumerable: true,
|
|
342
|
-
get: function () { return
|
|
342
|
+
get: function () { return chunkI2GTT2DG_js.fetchBookingTypeDetails; }
|
|
343
343
|
});
|
|
344
344
|
Object.defineProperty(exports, "fetchBookingTypes", {
|
|
345
345
|
enumerable: true,
|
|
346
|
-
get: function () { return
|
|
346
|
+
get: function () { return chunkI2GTT2DG_js.fetchBookingTypes; }
|
|
347
347
|
});
|
|
348
348
|
Object.defineProperty(exports, "formatBookingDate", {
|
|
349
349
|
enumerable: true,
|
|
350
|
-
get: function () { return
|
|
350
|
+
get: function () { return chunkI2GTT2DG_js.formatDate; }
|
|
351
351
|
});
|
|
352
352
|
Object.defineProperty(exports, "formatBookingTime", {
|
|
353
353
|
enumerable: true,
|
|
354
|
-
get: function () { return
|
|
354
|
+
get: function () { return chunkI2GTT2DG_js.formatTime; }
|
|
355
355
|
});
|
|
356
356
|
Object.defineProperty(exports, "formatDuration", {
|
|
357
357
|
enumerable: true,
|
|
358
|
-
get: function () { return
|
|
358
|
+
get: function () { return chunkI2GTT2DG_js.formatDuration; }
|
|
359
359
|
});
|
|
360
360
|
Object.defineProperty(exports, "releaseSlotHold", {
|
|
361
361
|
enumerable: true,
|
|
362
|
-
get: function () { return
|
|
362
|
+
get: function () { return chunkI2GTT2DG_js.releaseSlotHold; }
|
|
363
363
|
});
|
|
364
364
|
Object.defineProperty(exports, "ExperimentConversion", {
|
|
365
365
|
enumerable: true,
|
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import './chunk-CU6OGBKK.mjs';
|
|
|
5
5
|
export { TestimonialSection } from './chunk-VIGRGMWR.mjs';
|
|
6
6
|
export { fetchReviewStats, fetchReviews } from './chunk-MU7DTEUF.mjs';
|
|
7
7
|
export { CalendarView, CheckoutForm, EventCalendar, EventCheckout, EventEmbed, EventModal, EventTile, OfferingCard, OfferingList, ProductEmbed, RegistrationForm, UpcomingEvents, createCheckoutSession, fetchNextEvent, fetchOffering, fetchOfferings, fetchProducts, fetchServices, fetchUpcomingEvents, formatDate, formatDateTime, formatPrice, getOfferingUrl, registerForEvent, useEventModal } from './chunk-RSUNHEBH.mjs';
|
|
8
|
-
export { BookingWidget, createBooking, createSlotHold, detectTimezone, fetchAvailability, fetchAvailableDates, fetchBookingTypeDetails, fetchBookingTypes, formatDate as formatBookingDate, formatTime as formatBookingTime, formatDuration, releaseSlotHold } from './chunk-
|
|
8
|
+
export { BookingWidget, createBooking, createSlotHold, detectTimezone, fetchAvailability, fetchAvailableDates, fetchBookingTypeDetails, fetchBookingTypes, formatDate as formatBookingDate, formatTime as formatBookingTime, formatDuration, releaseSlotHold } from './chunk-FMZOZQBV.mjs';
|
|
9
9
|
import './chunk-FO5EUANA.mjs';
|
|
10
10
|
import './chunk-IM57FXP7.mjs';
|
|
11
11
|
export { ExperimentConversion, SignalExperiment, useExperimentVariant } from './chunk-LBII2GAF.mjs';
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sync Module Types - Booking Widget for Client Sites
|
|
5
|
+
*/
|
|
6
|
+
interface BookingType {
|
|
7
|
+
id: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
duration_minutes: number;
|
|
12
|
+
buffer_before?: number;
|
|
13
|
+
buffer_after?: number;
|
|
14
|
+
color?: string;
|
|
15
|
+
location_type: 'virtual' | 'phone' | 'in_person' | 'custom';
|
|
16
|
+
location_details?: string;
|
|
17
|
+
price_cents?: number;
|
|
18
|
+
currency?: string;
|
|
19
|
+
is_active: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface TimeSlot {
|
|
22
|
+
start: string;
|
|
23
|
+
end: string;
|
|
24
|
+
hostId?: string;
|
|
25
|
+
available: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface Host {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
email?: string;
|
|
31
|
+
avatar?: string;
|
|
32
|
+
title?: string;
|
|
33
|
+
bio?: string;
|
|
34
|
+
}
|
|
35
|
+
interface SlotHold {
|
|
36
|
+
holdId: string;
|
|
37
|
+
expiresAt: string;
|
|
38
|
+
expiresInSeconds: number;
|
|
39
|
+
}
|
|
40
|
+
interface BookingResult {
|
|
41
|
+
success?: boolean;
|
|
42
|
+
/** Top-level confirmation code (matches the API's BookingConfirmation shape). */
|
|
43
|
+
confirmationCode?: string;
|
|
44
|
+
booking: {
|
|
45
|
+
id: string;
|
|
46
|
+
confirmationCode?: string;
|
|
47
|
+
scheduledAt?: string;
|
|
48
|
+
durationMinutes?: number;
|
|
49
|
+
hostName?: string;
|
|
50
|
+
timezone?: string;
|
|
51
|
+
video_link?: string;
|
|
52
|
+
};
|
|
53
|
+
cancelUrl: string;
|
|
54
|
+
rescheduleUrl: string;
|
|
55
|
+
calendarLinks: {
|
|
56
|
+
google: string;
|
|
57
|
+
outlook: string;
|
|
58
|
+
ics: string;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
interface BookingWidgetProps {
|
|
62
|
+
/** Organization slug – required for public (unauthenticated) mode, optional with apiKey */
|
|
63
|
+
orgSlug?: string;
|
|
64
|
+
/** API key – when provided, uses authenticated /sync/widget/* endpoints (no orgSlug needed) */
|
|
65
|
+
apiKey?: string;
|
|
66
|
+
/** API base URL - defaults to https://api.sonor.io */
|
|
67
|
+
apiUrl?: string;
|
|
68
|
+
/** Specific booking type slug to show (optional - shows all if not provided) */
|
|
69
|
+
bookingTypeSlug?: string;
|
|
70
|
+
/** Guest's timezone (auto-detected if not provided) */
|
|
71
|
+
timezone?: string;
|
|
72
|
+
/** Custom class name for styling */
|
|
73
|
+
className?: string;
|
|
74
|
+
/** Number of days to show availability for */
|
|
75
|
+
daysToShow?: number;
|
|
76
|
+
/** Called when booking is completed */
|
|
77
|
+
onBookingComplete?: (result: BookingResult) => void;
|
|
78
|
+
/** Called when an error occurs */
|
|
79
|
+
onError?: (error: Error) => void;
|
|
80
|
+
/** Hide the booking type selector (for single type embed) */
|
|
81
|
+
hideTypeSelector?: boolean;
|
|
82
|
+
/** Custom styles */
|
|
83
|
+
styles?: {
|
|
84
|
+
primaryColor?: string;
|
|
85
|
+
borderRadius?: string;
|
|
86
|
+
fontFamily?: string;
|
|
87
|
+
/** Dark mode colors */
|
|
88
|
+
backgroundColor?: string;
|
|
89
|
+
surfaceColor?: string;
|
|
90
|
+
elevatedColor?: string;
|
|
91
|
+
textPrimary?: string;
|
|
92
|
+
textSecondary?: string;
|
|
93
|
+
textTertiary?: string;
|
|
94
|
+
borderColor?: string;
|
|
95
|
+
inputBorderColor?: string;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
interface DatePickerProps {
|
|
99
|
+
selectedDate: Date | null;
|
|
100
|
+
onDateSelect: (date: Date) => void;
|
|
101
|
+
availableDates: string[];
|
|
102
|
+
className?: string;
|
|
103
|
+
}
|
|
104
|
+
interface TimeSlotPickerProps {
|
|
105
|
+
slots: TimeSlot[];
|
|
106
|
+
selectedSlot: TimeSlot | null;
|
|
107
|
+
onSlotSelect: (slot: TimeSlot) => void;
|
|
108
|
+
className?: string;
|
|
109
|
+
timezone: string;
|
|
110
|
+
}
|
|
111
|
+
interface BookingFormProps {
|
|
112
|
+
onSubmit: (data: GuestInfo) => Promise<void>;
|
|
113
|
+
isLoading?: boolean;
|
|
114
|
+
className?: string;
|
|
115
|
+
bookingType?: BookingType;
|
|
116
|
+
selectedSlot?: TimeSlot;
|
|
117
|
+
}
|
|
118
|
+
interface GuestInfo {
|
|
119
|
+
name: string;
|
|
120
|
+
email: string;
|
|
121
|
+
phone?: string;
|
|
122
|
+
notes?: string;
|
|
123
|
+
}
|
|
124
|
+
interface SyncWidgetConfig {
|
|
125
|
+
apiUrl: string;
|
|
126
|
+
orgSlug: string;
|
|
127
|
+
timezone: string;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
declare function BookingWidget({ orgSlug, apiKey: propApiKey, apiUrl: propApiUrl, bookingTypeSlug, timezone: propTimezone, className, daysToShow, onBookingComplete, onError, hideTypeSelector, styles, }: BookingWidgetProps): react_jsx_runtime.JSX.Element;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Sync API Functions - Client-side API calls for booking widget
|
|
134
|
+
*
|
|
135
|
+
* Two modes:
|
|
136
|
+
* 1. API-key flow (preferred): Uses x-api-key header → /sync/widget/* endpoints.
|
|
137
|
+
* Project is resolved server-side from the key. No orgSlug needed.
|
|
138
|
+
* 2. Public/orgSlug flow (legacy): Uses /sync/public/:org/* endpoints. No auth.
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Fetch booking types.
|
|
143
|
+
* - With apiKey → GET /sync/widget/types
|
|
144
|
+
* - With orgSlug → GET /sync/public/:org/types
|
|
145
|
+
*/
|
|
146
|
+
declare function fetchBookingTypes(orgSlug?: string, apiUrl?: string, apiKey?: string): Promise<BookingType[]>;
|
|
147
|
+
/**
|
|
148
|
+
* Fetch booking type details
|
|
149
|
+
*/
|
|
150
|
+
declare function fetchBookingTypeDetails(typeSlug: string, orgSlug?: string, apiUrl?: string, apiKey?: string): Promise<BookingType>;
|
|
151
|
+
/**
|
|
152
|
+
* Fetch available time slots for a specific date
|
|
153
|
+
*/
|
|
154
|
+
declare function fetchAvailability(typeSlug: string, date: string, // YYYY-MM-DD format
|
|
155
|
+
orgSlug?: string, apiUrl?: string, apiKey?: string, timezone?: string, hostId?: string): Promise<TimeSlot[]>;
|
|
156
|
+
/**
|
|
157
|
+
* Hold a time slot temporarily (5-10 minutes)
|
|
158
|
+
*/
|
|
159
|
+
declare function createSlotHold(holdData: {
|
|
160
|
+
bookingType: string;
|
|
161
|
+
slotStart: string;
|
|
162
|
+
slotEnd: string;
|
|
163
|
+
hostId: string;
|
|
164
|
+
sessionId: string;
|
|
165
|
+
guestEmail?: string;
|
|
166
|
+
}, apiUrl?: string, apiKey?: string): Promise<SlotHold>;
|
|
167
|
+
/**
|
|
168
|
+
* Release a slot hold
|
|
169
|
+
*/
|
|
170
|
+
declare function releaseSlotHold(holdId: string, apiUrl?: string, apiKey?: string): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Create a booking
|
|
173
|
+
*/
|
|
174
|
+
declare function createBooking(bookingData: {
|
|
175
|
+
bookingType: string;
|
|
176
|
+
scheduledAt: string;
|
|
177
|
+
hostId: string;
|
|
178
|
+
name: string;
|
|
179
|
+
email: string;
|
|
180
|
+
phone?: string;
|
|
181
|
+
company?: string;
|
|
182
|
+
message?: string;
|
|
183
|
+
source: string;
|
|
184
|
+
timezone?: string;
|
|
185
|
+
holdId?: string;
|
|
186
|
+
sessionId?: string;
|
|
187
|
+
sourceUrl?: string;
|
|
188
|
+
}, apiUrl?: string, apiKey?: string): Promise<BookingResult>;
|
|
189
|
+
/**
|
|
190
|
+
* Get available dates for a month (helper for calendar view)
|
|
191
|
+
* Returns dates that have at least one available slot
|
|
192
|
+
*/
|
|
193
|
+
declare function fetchAvailableDates(typeSlug: string, startDate: string, // YYYY-MM-DD
|
|
194
|
+
endDate: string, // YYYY-MM-DD
|
|
195
|
+
orgSlug?: string, apiUrl?: string, apiKey?: string, timezone?: string): Promise<string[]>;
|
|
196
|
+
/**
|
|
197
|
+
* Detect user's timezone
|
|
198
|
+
*/
|
|
199
|
+
declare function detectTimezone(): string;
|
|
200
|
+
/**
|
|
201
|
+
* Format time for display
|
|
202
|
+
*/
|
|
203
|
+
declare function formatTime(isoString: string, timezone: string): string;
|
|
204
|
+
/**
|
|
205
|
+
* Format date for display
|
|
206
|
+
*/
|
|
207
|
+
declare function formatDate(isoString: string, timezone: string): string;
|
|
208
|
+
/**
|
|
209
|
+
* Format duration for display
|
|
210
|
+
*/
|
|
211
|
+
declare function formatDuration(minutes: number): string;
|
|
212
|
+
|
|
213
|
+
export { type BookingFormProps, type BookingResult, type BookingType, BookingWidget, type BookingWidgetProps, type DatePickerProps, type GuestInfo, type Host, type SlotHold, type SyncWidgetConfig, type TimeSlot, type TimeSlotPickerProps, createBooking, createSlotHold, detectTimezone, fetchAvailability, fetchAvailableDates, fetchBookingTypeDetails, fetchBookingTypes, formatDate, formatDuration, formatTime, releaseSlotHold };
|