@flamingo-stack/openframe-frontend-core 0.0.575-snapshot.20260827225211 → 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 +3 -11
- 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 +4 -12
- package/dist/components/meeting-scheduler/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/meeting-scheduler/index.tsx +11 -23
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,12 +56,12 @@ 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
|
|
64
|
-
*
|
|
65
|
-
*
|
|
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
|
|
64
|
+
* copy — fail-safe, never blank.
|
|
66
65
|
*/
|
|
67
66
|
const BOOKING_ERROR_COPY: Record<Exclude<MeetingBookingErrorCode, 'SLOT_TAKEN'>, string> = {
|
|
68
67
|
INVALID_EMAIL:
|
|
@@ -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,19 +413,9 @@ export function HubSpotMeetingScheduler({
|
|
|
415
413
|
setStep('slot');
|
|
416
414
|
resetSignals();
|
|
417
415
|
void refetchAvailability();
|
|
418
|
-
} else {
|
|
419
|
-
// Primary error surface is a TOAST (host-mounted Toaster — every hub
|
|
420
|
-
// platform mounts it globally). The compact inline line below the
|
|
421
|
-
// date heading stays as the fallback for embedders without a Toaster,
|
|
422
|
-
// and carries the escape hatch.
|
|
423
|
-
toast({
|
|
424
|
-
variant: 'error',
|
|
425
|
-
title: 'Booking failed',
|
|
426
|
-
description: BOOKING_ERROR_COPY[code] ?? BOOKING_ERROR_COPY.VALIDATION,
|
|
427
|
-
});
|
|
428
416
|
}
|
|
429
417
|
},
|
|
430
|
-
[book, onBooked, refetchAvailability, resetSignals
|
|
418
|
+
[book, onBooked, refetchAvailability, resetSignals],
|
|
431
419
|
);
|
|
432
420
|
|
|
433
421
|
const escapeHatch = fallbackUrl ? (
|
|
@@ -538,12 +526,12 @@ export function HubSpotMeetingScheduler({
|
|
|
538
526
|
· {formatDurationCompact(durationMs / 1000)}
|
|
539
527
|
</p>
|
|
540
528
|
{bookingError && bookingError !== 'SLOT_TAKEN' && (
|
|
541
|
-
<
|
|
542
|
-
<
|
|
529
|
+
<Alert variant="error" className="flex flex-col items-start gap-[var(--spacing-system-xs)]">
|
|
530
|
+
<AlertDescription>
|
|
543
531
|
{BOOKING_ERROR_COPY[bookingError] ?? BOOKING_ERROR_COPY.VALIDATION}
|
|
544
|
-
</
|
|
532
|
+
</AlertDescription>
|
|
545
533
|
{escapeHatch}
|
|
546
|
-
</
|
|
534
|
+
</Alert>
|
|
547
535
|
)}
|
|
548
536
|
<BookingForm
|
|
549
537
|
availability={availability}
|