@tebuto/react-booking-widget 1.1.1 → 1.3.0
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/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/types.d.ts +16 -25
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -124,6 +124,7 @@ type ClaimResponse = {
|
|
|
124
124
|
isAvailable: boolean;
|
|
125
125
|
requirePhoneNumber: boolean;
|
|
126
126
|
requireAddress: boolean;
|
|
127
|
+
requireBirthdate: boolean;
|
|
127
128
|
};
|
|
128
129
|
/** Payment configuration */
|
|
129
130
|
type PaymentConfiguration = {
|
|
@@ -142,6 +143,7 @@ type ClientInfo = {
|
|
|
142
143
|
city: string;
|
|
143
144
|
zip: string;
|
|
144
145
|
};
|
|
146
|
+
birthdate?: string;
|
|
145
147
|
notes?: string;
|
|
146
148
|
};
|
|
147
149
|
/** Booking request payload */
|
|
@@ -197,6 +199,7 @@ type TebutoConfig = {
|
|
|
197
199
|
};
|
|
198
200
|
type TebutoContextValue = TebutoConfig & {
|
|
199
201
|
buildUrl: (path: string) => string;
|
|
202
|
+
fingerprint: string;
|
|
200
203
|
};
|
|
201
204
|
type TebutoProviderProps = {
|
|
202
205
|
therapistUUID: string;
|
|
@@ -344,8 +347,7 @@ type UseClaimSlotReturn = ClaimState & {
|
|
|
344
347
|
*/
|
|
345
348
|
declare function useClaimSlot(): UseClaimSlotReturn;
|
|
346
349
|
|
|
347
|
-
type
|
|
348
|
-
booking: BookingResponse | null;
|
|
350
|
+
type BookingRequestState = {
|
|
349
351
|
isLoading: boolean;
|
|
350
352
|
error: Error | null;
|
|
351
353
|
isSuccess: boolean;
|
|
@@ -355,44 +357,33 @@ type BookAppointmentParams = {
|
|
|
355
357
|
client: ClientInfo;
|
|
356
358
|
locationSelection?: AppointmentLocation;
|
|
357
359
|
};
|
|
358
|
-
type UseBookAppointmentReturn =
|
|
359
|
-
/**
|
|
360
|
-
book: (params: BookAppointmentParams) => Promise<
|
|
361
|
-
/** Reset the
|
|
360
|
+
type UseBookAppointmentReturn = BookingRequestState & {
|
|
361
|
+
/** Submit booking request - returns true on success */
|
|
362
|
+
book: (params: BookAppointmentParams) => Promise<boolean>;
|
|
363
|
+
/** Reset the state */
|
|
362
364
|
reset: () => void;
|
|
363
|
-
/** Download the calendar file (.ics) */
|
|
364
|
-
downloadCalendar: () => void;
|
|
365
365
|
};
|
|
366
366
|
/**
|
|
367
|
-
* useBookAppointment -
|
|
367
|
+
* useBookAppointment - Submit a public booking request
|
|
368
368
|
*
|
|
369
|
-
* Submits
|
|
370
|
-
* the
|
|
369
|
+
* Submits a booking request with client information. For public bookings,
|
|
370
|
+
* the client will receive a confirmation email to verify the appointment.
|
|
371
371
|
*
|
|
372
372
|
* @example
|
|
373
373
|
* ```tsx
|
|
374
|
-
* const { book,
|
|
374
|
+
* const { book, isLoading, isSuccess, error, reset } = useBookAppointment()
|
|
375
375
|
*
|
|
376
376
|
* const handleSubmit = async (clientInfo: ClientInfo) => {
|
|
377
|
-
* const
|
|
377
|
+
* const success = await book({
|
|
378
378
|
* slot: claimedSlot,
|
|
379
379
|
* client: clientInfo,
|
|
380
380
|
* locationSelection: selectedLocation
|
|
381
381
|
* })
|
|
382
382
|
*
|
|
383
|
-
* if (
|
|
383
|
+
* if (success) {
|
|
384
384
|
* setStep('confirmation')
|
|
385
385
|
* }
|
|
386
386
|
* }
|
|
387
|
-
*
|
|
388
|
-
* if (isSuccess) {
|
|
389
|
-
* return (
|
|
390
|
-
* <SuccessMessage>
|
|
391
|
-
* <button onClick={downloadCalendar}>Add to Calendar</button>
|
|
392
|
-
* <button onClick={reset}>Book Another</button>
|
|
393
|
-
* </SuccessMessage>
|
|
394
|
-
* )
|
|
395
|
-
* }
|
|
396
387
|
* ```
|
|
397
388
|
*/
|
|
398
389
|
declare function useBookAppointment(): UseBookAppointmentReturn;
|
|
@@ -401,8 +392,8 @@ type BookingStep = 'loading' | 'date-selection' | 'time-selection' | 'booking-fo
|
|
|
401
392
|
type UseBookingFlowOptions = {
|
|
402
393
|
/** Categories to filter by */
|
|
403
394
|
categories?: number[];
|
|
404
|
-
/** Callback when booking is
|
|
405
|
-
onBookingComplete?: (
|
|
395
|
+
/** Callback when booking request is submitted successfully */
|
|
396
|
+
onBookingComplete?: () => void;
|
|
406
397
|
/** Callback on any error */
|
|
407
398
|
onError?: (error: Error) => void;
|
|
408
399
|
};
|