@flamingo-stack/openframe-frontend-core 0.0.575-snapshot.20260827225444 → 0.0.575
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/components/meeting-scheduler/index.cjs +5 -9
- package/dist/components/meeting-scheduler/index.cjs.map +1 -1
- package/dist/components/meeting-scheduler/index.d.ts.map +1 -1
- package/dist/components/meeting-scheduler/index.js +6 -10
- package/dist/components/meeting-scheduler/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/meeting-scheduler/index.tsx +14 -16
package/package.json
CHANGED
|
@@ -39,7 +39,6 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
39
39
|
import { useIsHydrated } from '../../hooks/ui/use-is-hydrated';
|
|
40
40
|
import { useHumanitySignals } from '../../hooks/use-humanity-signals';
|
|
41
41
|
import { useMeetingBooking } from '../../hooks/use-meeting-booking';
|
|
42
|
-
import { useToast } from '../../hooks/use-toast';
|
|
43
42
|
import {
|
|
44
43
|
isSupportedFormField,
|
|
45
44
|
type BookingConfirmation,
|
|
@@ -57,11 +56,11 @@ import { SlotPicker, SlotPickerSkeleton, dayKeyInZone } from './slot-picker';
|
|
|
57
56
|
|
|
58
57
|
/**
|
|
59
58
|
* Visitor-facing copy per booking-error code. Everything except SLOT_TAKEN
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* the calendar instead: its recovery flow returns the visitor there.
|
|
64
|
-
* unrecognized code (newer host than widget) falls back to the VALIDATION
|
|
59
|
+
* renders in a prominent `<Alert>` ABOVE the form the visitor just submitted
|
|
60
|
+
* (an inline alert is deterministic in every embed context — a toast needs a
|
|
61
|
+
* host-mounted provider this widget cannot assume). SLOT_TAKEN renders above
|
|
62
|
+
* the calendar instead: its recovery flow returns the visitor there.
|
|
63
|
+
* An unrecognized code (newer host than widget) falls back to the VALIDATION
|
|
65
64
|
* copy — fail-safe, never blank.
|
|
66
65
|
*/
|
|
67
66
|
const BOOKING_ERROR_COPY: Record<Exclude<MeetingBookingErrorCode, 'SLOT_TAKEN'>, string> = {
|
|
@@ -305,7 +304,6 @@ export function HubSpotMeetingScheduler({
|
|
|
305
304
|
const [bookingError, setBookingError] = useState<MeetingBookingErrorCode | null>(null);
|
|
306
305
|
|
|
307
306
|
const { honeypotInputProps, getSignals, resetSignals } = useHumanitySignals();
|
|
308
|
-
const { toast } = useToast();
|
|
309
307
|
|
|
310
308
|
// Reset the machine when the host switches links. Adjusted while rendering —
|
|
311
309
|
// React's documented pattern for a prop-driven reset — so the swapped-in link
|
|
@@ -415,17 +413,9 @@ export function HubSpotMeetingScheduler({
|
|
|
415
413
|
setStep('slot');
|
|
416
414
|
resetSignals();
|
|
417
415
|
void refetchAvailability();
|
|
418
|
-
} else {
|
|
419
|
-
// The error surface is the TOAST, full stop (host-mounted Toaster —
|
|
420
|
-
// every hub platform mounts it globally; embedders must too).
|
|
421
|
-
toast({
|
|
422
|
-
variant: 'error',
|
|
423
|
-
title: 'Booking failed',
|
|
424
|
-
description: BOOKING_ERROR_COPY[code] ?? BOOKING_ERROR_COPY.VALIDATION,
|
|
425
|
-
});
|
|
426
416
|
}
|
|
427
417
|
},
|
|
428
|
-
[book, onBooked, refetchAvailability, resetSignals
|
|
418
|
+
[book, onBooked, refetchAvailability, resetSignals],
|
|
429
419
|
);
|
|
430
420
|
|
|
431
421
|
const escapeHatch = fallbackUrl ? (
|
|
@@ -535,6 +525,14 @@ export function HubSpotMeetingScheduler({
|
|
|
535
525
|
}).format(new Date(selectedSlot))}{' '}
|
|
536
526
|
· {formatDurationCompact(durationMs / 1000)}
|
|
537
527
|
</p>
|
|
528
|
+
{bookingError && bookingError !== 'SLOT_TAKEN' && (
|
|
529
|
+
<Alert variant="error" className="flex flex-col items-start gap-[var(--spacing-system-xs)]">
|
|
530
|
+
<AlertDescription>
|
|
531
|
+
{BOOKING_ERROR_COPY[bookingError] ?? BOOKING_ERROR_COPY.VALIDATION}
|
|
532
|
+
</AlertDescription>
|
|
533
|
+
{escapeHatch}
|
|
534
|
+
</Alert>
|
|
535
|
+
)}
|
|
538
536
|
<BookingForm
|
|
539
537
|
availability={availability}
|
|
540
538
|
meetingId={meetingId}
|