@tebuto/react-booking-widget 1.2.0 → 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/types.d.ts CHANGED
@@ -347,8 +347,7 @@ type UseClaimSlotReturn = ClaimState & {
347
347
  */
348
348
  declare function useClaimSlot(): UseClaimSlotReturn;
349
349
 
350
- type BookingState = {
351
- booking: BookingResponse | null;
350
+ type BookingRequestState = {
352
351
  isLoading: boolean;
353
352
  error: Error | null;
354
353
  isSuccess: boolean;
@@ -358,44 +357,33 @@ type BookAppointmentParams = {
358
357
  client: ClientInfo;
359
358
  locationSelection?: AppointmentLocation;
360
359
  };
361
- type UseBookAppointmentReturn = BookingState & {
362
- /** Book the appointment */
363
- book: (params: BookAppointmentParams) => Promise<BookingResponse | null>;
364
- /** Reset the booking state */
360
+ type UseBookAppointmentReturn = BookingRequestState & {
361
+ /** Submit booking request - returns true on success */
362
+ book: (params: BookAppointmentParams) => Promise<boolean>;
363
+ /** Reset the state */
365
364
  reset: () => void;
366
- /** Download the calendar file (.ics) */
367
- downloadCalendar: () => void;
368
365
  };
369
366
  /**
370
- * useBookAppointment - Complete the booking process
367
+ * useBookAppointment - Submit a public booking request
371
368
  *
372
- * Submits the booking with client information and handles
373
- * the response including calendar download.
369
+ * Submits a booking request with client information. For public bookings,
370
+ * the client will receive a confirmation email to verify the appointment.
374
371
  *
375
372
  * @example
376
373
  * ```tsx
377
- * const { book, booking, isLoading, isSuccess, downloadCalendar, reset } = useBookAppointment()
374
+ * const { book, isLoading, isSuccess, error, reset } = useBookAppointment()
378
375
  *
379
376
  * const handleSubmit = async (clientInfo: ClientInfo) => {
380
- * const result = await book({
377
+ * const success = await book({
381
378
  * slot: claimedSlot,
382
379
  * client: clientInfo,
383
380
  * locationSelection: selectedLocation
384
381
  * })
385
382
  *
386
- * if (result) {
383
+ * if (success) {
387
384
  * setStep('confirmation')
388
385
  * }
389
386
  * }
390
- *
391
- * if (isSuccess) {
392
- * return (
393
- * <SuccessMessage>
394
- * <button onClick={downloadCalendar}>Add to Calendar</button>
395
- * <button onClick={reset}>Book Another</button>
396
- * </SuccessMessage>
397
- * )
398
- * }
399
387
  * ```
400
388
  */
401
389
  declare function useBookAppointment(): UseBookAppointmentReturn;
@@ -404,8 +392,8 @@ type BookingStep = 'loading' | 'date-selection' | 'time-selection' | 'booking-fo
404
392
  type UseBookingFlowOptions = {
405
393
  /** Categories to filter by */
406
394
  categories?: number[];
407
- /** Callback when booking is complete */
408
- onBookingComplete?: (booking: BookingResponse) => void;
395
+ /** Callback when booking request is submitted successfully */
396
+ onBookingComplete?: () => void;
409
397
  /** Callback on any error */
410
398
  onError?: (error: Error) => void;
411
399
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tebuto/react-booking-widget",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "React Component for the Tebuto Booking Widget",
5
5
  "author": "Tebuto GmbH",
6
6
  "homepage": "https://tebuto.de",