@flamingo-stack/openframe-frontend-core 0.0.792 → 0.0.793

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.
Files changed (57) hide show
  1. package/dist/{chunk-ABZGBMC2.cjs → chunk-BI6FE3HO.cjs} +10 -10
  2. package/dist/{chunk-W3Q7ZQLS.cjs → chunk-BTI4RRU2.cjs} +2 -2
  3. package/dist/{chunk-4G2KZHZW.cjs → chunk-CASWVIJC.cjs} +3 -3
  4. package/dist/{chunk-OKQQJ5TD.cjs → chunk-CB24ILOB.cjs} +13 -13
  5. package/dist/{chunk-YWNXZAQ2.cjs → chunk-CKSAUEEL.cjs} +16 -16
  6. package/dist/{chunk-3AN35WAO.cjs → chunk-DWYMZ3LO.cjs} +24 -24
  7. package/dist/{chunk-YPWFYQFE.cjs → chunk-FEARCFP4.cjs} +5 -5
  8. package/dist/{chunk-O4TKEWNW.cjs → chunk-LMZICTQW.cjs} +3 -3
  9. package/dist/{chunk-EPWLLLGW.cjs → chunk-LVBSVUHD.cjs} +2 -2
  10. package/dist/{chunk-6ZPHUDTP.cjs → chunk-XGE2WCOH.cjs} +3 -3
  11. package/dist/{chunk-WWWLOMZI.cjs → chunk-YDH5OVRQ.cjs} +31 -31
  12. package/dist/{chunk-2I2AXIBD.cjs → chunk-ZCNEO273.cjs} +75 -55
  13. package/dist/{cloud-tenants-CQOD6DDR.cjs → cloud-tenants-BISHVU2T.cjs} +2 -2
  14. package/dist/components/case-studies/index.cjs +11 -11
  15. package/dist/components/contact/index.cjs +3 -3
  16. package/dist/components/docs/index.cjs +5 -5
  17. package/dist/components/embeds/index.cjs +3 -3
  18. package/dist/components/faq/index.cjs +3 -3
  19. package/dist/components/features/conversation-card.d.ts.map +1 -1
  20. package/dist/components/features/conversation-card.js +77 -56
  21. package/dist/components/features/index.cjs +2 -2
  22. package/dist/components/help-center-pages/index.cjs +49 -49
  23. package/dist/components/index.cjs +18 -18
  24. package/dist/components/meeting-scheduler/booking-context-summary.d.ts +8 -0
  25. package/dist/components/meeting-scheduler/booking-context-summary.d.ts.map +1 -0
  26. package/dist/components/meeting-scheduler/booking-context-summary.js +54 -0
  27. package/dist/components/meeting-scheduler/booking-form.d.ts +14 -1
  28. package/dist/components/meeting-scheduler/booking-form.d.ts.map +1 -1
  29. package/dist/components/meeting-scheduler/booking-form.js +13 -3
  30. package/dist/components/meeting-scheduler/index.cjs +134 -60
  31. package/dist/components/meeting-scheduler/index.d.ts +6 -2
  32. package/dist/components/meeting-scheduler/index.d.ts.map +1 -1
  33. package/dist/components/meeting-scheduler/index.js +7 -2
  34. package/dist/components/navigation/index.cjs +3 -3
  35. package/dist/components/onboarding-guides/index.cjs +4 -4
  36. package/dist/components/product-demo/index.cjs +11 -11
  37. package/dist/components/tickets/index.cjs +5 -5
  38. package/dist/components/ui/index.cjs +2 -2
  39. package/dist/{devices-PEBUW34G.cjs → devices-GMR73ZF3.cjs} +3 -3
  40. package/dist/index.cjs +3 -3
  41. package/dist/{knowledge-KL4BP2YK.cjs → knowledge-XC2K5VQO.cjs} +2 -2
  42. package/dist/loading-standard/engine.d.mts.map +1 -1
  43. package/dist/{logs-TO277M4F.cjs → logs-LBGQLETC.cjs} +10 -10
  44. package/dist/{policies-6HSKMG4I.cjs → policies-3XVE6266.cjs} +6 -6
  45. package/dist/schemas/meeting-booking-schema.cjs +21 -0
  46. package/dist/schemas/meeting-booking-schema.d.ts +43 -0
  47. package/dist/schemas/meeting-booking-schema.d.ts.map +1 -1
  48. package/dist/schemas/meeting-booking-schema.js +21 -0
  49. package/dist/{scripts-4IO2LPMY.cjs → scripts-NE5IL4NC.cjs} +7 -7
  50. package/dist/{software-update-RMAWEZKX.cjs → software-update-EJDKTFAP.cjs} +5 -5
  51. package/package.json +1 -1
  52. package/src/components/features/conversation-card.tsx +89 -64
  53. package/src/components/meeting-scheduler/booking-context-summary.tsx +100 -0
  54. package/src/components/meeting-scheduler/booking-form.tsx +28 -0
  55. package/src/components/meeting-scheduler/index.tsx +23 -2
  56. package/src/loading-standard/engine.mjs +6 -2
  57. package/src/schemas/meeting-booking-schema.ts +62 -0
@@ -0,0 +1,100 @@
1
+ 'use client';
2
+
3
+ /**
4
+ * The booking form's summary of what the visitor told the page before it (a `BookingContext`): its label, then one
5
+ * tag per line. Read only: the visitor changes it where they gave it (the page above the form).
6
+ *
7
+ * With a `slot` (`BookingContextSlot`) the block keeps the space of its most lines from its first paint: a grid of
8
+ * that many cells, one line each. Loading, every cell is a tag's skeleton; loaded, the given lines fill the cells in
9
+ * order, and with none an empty state (the slot's `emptyText`) fills the whole space. The block is one height in all
10
+ * three, so picking a card never moves the page. Without a slot it takes room only once it has a line.
11
+ */
12
+ import type { ReactNode } from 'react';
13
+ import { type BookingContext, type BookingContextSlot, hasBookingContext } from '../../schemas/meeting-booking-schema';
14
+ import { cn } from '../../utils/cn';
15
+ import { useLoadingScope } from '../ui/loading-scope';
16
+ import { Tag } from '../ui/tag';
17
+
18
+ /** The cells: one column on a phone, two from `content-md`. ONE class for every state. */
19
+ const SLOT_GRID_CLASS = 'grid grid-cols-1 gap-[var(--spacing-system-xs)] content-md:grid-cols-2';
20
+ /** A cell: a flex row, so a tag (or its inline skeleton) is the cell's whole height, with no line box around it. */
21
+ const SLOT_CELL_CLASS = 'flex min-w-0';
22
+ /** A line's tag: the sentence tag, never wider than its cell (a longer line clips, whole in the tag's tooltip). */
23
+ const LINE_TAG_PROPS = { variant: 'outline', size: 'sentence', className: 'max-w-full' } as const;
24
+ /** A line while loading: a typical sentence's width, not the tag skeleton's label width. */
25
+ const LOADING_LINE_CLASS = 'w-3/4';
26
+ /** The empty state, over the whole reserved space (its slots hidden under it). */
27
+ const EMPTY_CLASS =
28
+ 'absolute inset-0 flex items-center justify-center rounded-md border border-dashed border-ods-border px-[var(--spacing-system-sf)] text-center text-ods-text-secondary text-h6';
29
+ /** A cell no line has filled yet: a dashed slot at a tag's height, so the reserved space reads as places to fill. */
30
+ const EMPTY_CELL_CLASS = 'h-9 w-full rounded-md border border-dashed border-ods-border';
31
+
32
+ export function BookingContextSummary({
33
+ context,
34
+ slot,
35
+ loading: loadingProp,
36
+ }: {
37
+ context?: BookingContext | null;
38
+ slot?: BookingContextSlot;
39
+ /** Draw the loading form outside a loading scope too. */
40
+ loading?: boolean;
41
+ }) {
42
+ const loading = useLoadingScope() || loadingProp;
43
+ const items = hasBookingContext(context) ? context.items.filter(item => item.trim()) : [];
44
+ const label = slot?.label ?? context?.label;
45
+ if (!label || (!slot && items.length === 0)) return null;
46
+ if (!slot) {
47
+ return (
48
+ <SummaryFrame label={label}>
49
+ <ul className="flex flex-wrap gap-[var(--spacing-system-xs)]" aria-label={label}>
50
+ {items.map(item => (
51
+ <li key={item} className="min-w-0 max-w-full">
52
+ <Tag label={item} {...LINE_TAG_PROPS} />
53
+ </li>
54
+ ))}
55
+ </ul>
56
+ </SummaryFrame>
57
+ );
58
+ }
59
+ const cells = Array.from({ length: Math.max(slot.slots, items.length) }, (_, index) => items[index]);
60
+ return (
61
+ <SummaryFrame label={label}>
62
+ <div className="relative">
63
+ <ul className={SLOT_GRID_CLASS} aria-label={label}>
64
+ {cells.map((item, index) => {
65
+ const empty = !loading && !item;
66
+ return (
67
+ <li
68
+ key={item ?? `empty-${index}`}
69
+ className={SLOT_CELL_CLASS}
70
+ aria-hidden={empty || undefined}
71
+ // Each cell is an item of the list in every state, so loading and loaded count the same cells.
72
+ data-loading-item=""
73
+ >
74
+ {loading ? (
75
+ <Tag label="" loading {...LINE_TAG_PROPS} className={LOADING_LINE_CLASS} />
76
+ ) : item ? (
77
+ <Tag label={item} {...LINE_TAG_PROPS} />
78
+ ) : (
79
+ // With no line at all the empty state covers every slot; with some, the rest stay as slots.
80
+ <span className={cn(EMPTY_CELL_CLASS, items.length === 0 && 'invisible')} />
81
+ )}
82
+ </li>
83
+ );
84
+ })}
85
+ </ul>
86
+ {!loading && items.length === 0 && <p className={EMPTY_CLASS}>{slot.emptyText}</p>}
87
+ </div>
88
+ </SummaryFrame>
89
+ );
90
+ }
91
+
92
+ function SummaryFrame({ label, children }: { label: string; children: ReactNode }) {
93
+ return (
94
+ <div className="flex flex-col gap-[var(--spacing-system-xs)]">
95
+ {/* The label is the page's copy: drawn for real while loading too. */}
96
+ <p className="text-ods-text-secondary text-h6">{label}</p>
97
+ {children}
98
+ </div>
99
+ );
100
+ }
@@ -26,6 +26,9 @@ import {
26
26
  type MeetingFormField,
27
27
  type SupportedMeetingFormField,
28
28
  type BookingFormValues,
29
+ bookingContextFields,
30
+ type BookingContext,
31
+ type BookingContextSlot,
29
32
  } from '../../schemas/meeting-booking-schema';
30
33
  import { cn } from '../../utils/cn';
31
34
  import type { FormRescueDefinition } from '../../utils/form-rescue';
@@ -53,6 +56,7 @@ import {
53
56
  import { HoneypotField } from '../ui/honeypot-field';
54
57
  import { LOADING_NOOP, useLoadingScope } from '../ui/loading-scope';
55
58
  import { TOGGLE_SIZE_CLASS } from '../ui/toggle';
59
+ import { BookingContextSummary } from './booking-context-summary';
56
60
 
57
61
  /**
58
62
  * One field in a host-supplied row. `name` is a built-in (`email`, `firstName`,
@@ -466,6 +470,19 @@ export interface BookingFormProps {
466
470
  * does not ask is ignored.
467
471
  */
468
472
  answers?: Readonly<Record<string, string>>;
473
+ /**
474
+ * What the visitor told the page before the form, beside the link's questions (the cards they picked): drawn at
475
+ * the top of the form as a summary of tags and sent with the booking (`BOOKING_CONTEXT_FIELD`), whatever questions
476
+ * the link declares. Read live, so a change made above the form shows at once; omitted or empty draws nothing.
477
+ * In `deferSlot` mode the form only shows it: the parent attaches the live context when it POSTs.
478
+ */
479
+ context?: BookingContext | null;
480
+ /**
481
+ * The space the form keeps for `context` from its first paint (loading included), so the page does not jump when
482
+ * a line is added: its label, the most lines, and what it shows while there are none. Omitted: the context takes
483
+ * room only once it has a line.
484
+ */
485
+ contextSlot?: BookingContextSlot;
469
486
  /** Defaults to "Confirm Booking"; details-first says "Continue". */
470
487
  submitLabel?: string;
471
488
  /** Small print beside the submit (details-first sets expectations). */
@@ -546,6 +563,7 @@ export function BookingForm(props: BookingFormProps) {
546
563
  consent={props.consent}
547
564
  footerNote={props.footerNote}
548
565
  submitLabel={props.submitLabel}
566
+ contextSlot={props.contextSlot}
549
567
  />
550
568
  );
551
569
  }
@@ -561,6 +579,8 @@ function BookingFormBody({
561
579
  deferSlot = false,
562
580
  initialValues,
563
581
  answers,
582
+ context,
583
+ contextSlot,
564
584
  submitLabel,
565
585
  footerNote,
566
586
  fieldRows,
@@ -738,6 +758,7 @@ function BookingFormBody({
738
758
  // must do so synchronously in this call — this form and its honeypot are
739
759
  // still mounted here, and `getSignals()` reads a detached ref once they
740
760
  // unmount, which would silently disable the decoy.
761
+ // No context here: it can change while the visitor picks a time, so the parent attaches it live at the POST.
741
762
  await onSubmit({ ...data, meetingId, [HOST_CONSENT_KEY]: consented, ...formRescue.submitFields() });
742
763
  return;
743
764
  }
@@ -748,6 +769,8 @@ function BookingFormBody({
748
769
  startTimeMs,
749
770
  durationMs,
750
771
  timezone,
772
+ // The page's context rides beside the answers, never inside them: the server strips it from the booking.
773
+ ...bookingContextFields(context),
751
774
  ...getSignals(),
752
775
  ...formRescue.submitFields(),
753
776
  });
@@ -851,6 +874,7 @@ function BookingFormBody({
851
874
  return (
852
875
  <form id={formId} onSubmit={submit} className={FORM_STACK} noValidate {...HUBSPOT_DO_NOT_COLLECT_FORM_PROPS}>
853
876
  <HoneypotField {...honeypotInputProps} />
877
+ <BookingContextSummary context={context} slot={contextSlot} />
854
878
 
855
879
  {/* Email first, name pair below — the order the desktop and mobile mocks
856
880
  both draw. The pair stays TWO columns even on a phone (164px each at
@@ -1000,6 +1024,7 @@ function BookingFormPending({
1000
1024
  consent,
1001
1025
  footerNote,
1002
1026
  submitLabel = DEFAULT_SUBMIT_LABEL,
1027
+ contextSlot,
1003
1028
  }: {
1004
1029
  fieldRows?: BookingFieldRow[];
1005
1030
  /** The optional questions the form asks (`BookingForm`'s `optionalFields`): a row slot naming another optional
@@ -1015,6 +1040,8 @@ function BookingFormPending({
1015
1040
  footerNote?: string;
1016
1041
  /** The submit button's label (`BookingForm`'s `submitLabel`): the button is drawn for real at its own size. */
1017
1042
  submitLabel?: string;
1043
+ /** The context's reserved space (`BookingForm`'s `contextSlot`), drawn as its loading form at its full size. */
1044
+ contextSlot?: BookingContextSlot;
1018
1045
  }) {
1019
1046
  const consentId = useId();
1020
1047
  // The real submit button (static copy), inert with the rest of the form.
@@ -1026,6 +1053,7 @@ function BookingFormPending({
1026
1053
  return (
1027
1054
  // Inert: the fields are the form's own controls, drawn so each is its loaded size; none takes focus.
1028
1055
  <div className={cn('flex-1', FORM_STACK)} aria-hidden inert>
1056
+ <BookingContextSummary slot={contextSlot} loading />
1029
1057
  {/* The host's rows (or the built-in layout) through the SAME grid, column
1030
1058
  rule and normalisation as the loaded form — see `normalizeFieldRows`. */}
1031
1059
  {skeletonRows(fieldRows ?? DEFAULT_FIELD_ROWS, optionalFields).map(row => (
@@ -48,6 +48,7 @@ import { BOOKING_IN_FLIGHT_MESSAGE, useMeetingBooking } from '../../hooks/use-me
48
48
  import { useToast } from '../../hooks/use-toast';
49
49
  import {
50
50
  blocksNativeBooking,
51
+ bookingContextFields,
51
52
  type BookingConfirmation,
52
53
  type MeetingAvailability,
53
54
  type MeetingBookingErrorCode,
@@ -156,10 +157,20 @@ export interface HubSpotMeetingSchedulerProps {
156
157
  * so a Server Component can pass it across the RSC boundary where a component
157
158
  * cannot. `answers` are what the page took outside the form (a choice made
158
159
  * higher up the page), written into questions the visitor has not answered.
160
+ * `context` is what the page learned outside the link's questions, shown in the
161
+ * form and sent with the booking (`BookingContext`); `contextSlot` is the space the
162
+ * form keeps for it from its first paint.
159
163
  */
160
164
  detailsFormProps?: Pick<
161
165
  BookingFormProps,
162
- 'fieldRows' | 'optionalFields' | 'consent' | 'fieldCopy' | 'deniedEmailDomains' | 'answers'
166
+ | 'fieldRows'
167
+ | 'optionalFields'
168
+ | 'consent'
169
+ | 'fieldCopy'
170
+ | 'deniedEmailDomains'
171
+ | 'answers'
172
+ | 'context'
173
+ | 'contextSlot'
163
174
  >;
164
175
  /** Form rescue for the details form (`RESCUE_FORMS.meetingBooking`). OPT-IN:
165
176
  * omitted or `null` saves nothing. */
@@ -1174,6 +1185,8 @@ export function HubSpotMeetingScheduler({
1174
1185
  // copies frozen at that point can be stale.
1175
1186
  durationMs,
1176
1187
  timezone,
1188
+ // Live too: the page's context can change while the visitor is on the calendar.
1189
+ ...bookingContextFields(detailsFormProps?.context),
1177
1190
  }).finally(() => {
1178
1191
  inFlightRef.current = false;
1179
1192
  });
@@ -1213,10 +1226,18 @@ export {
1213
1226
  type BookingFormConsent,
1214
1227
  } from './booking-form';
1215
1228
 
1229
+ export { BookingContextSummary } from './booking-context-summary';
1230
+
1216
1231
  export {
1217
1232
  MeetingSchedulerDirectory,
1218
1233
  MEETING_DIRECTORY_PAGE_SIZE,
1219
1234
  type MeetingSchedulerDirectoryProps,
1220
1235
  } from './directory';
1221
1236
  export type { MeetingAvailability, BookingConfirmation, MeetingBookingErrorCode, MeetingHost };
1222
- export type { SchedulingLink, SchedulingLinksPayload, DeniedEmailDomains } from '../../schemas/meeting-booking-schema';
1237
+ export type {
1238
+ SchedulingLink,
1239
+ SchedulingLinksPayload,
1240
+ DeniedEmailDomains,
1241
+ BookingContext,
1242
+ BookingContextSlot,
1243
+ } from '../../schemas/meeting-booking-schema';
@@ -257,9 +257,13 @@ const LOADERS = new Set([
257
257
  'OpenmspHeartbeatLoader',
258
258
  'Spinner',
259
259
  ]);
260
- /** The lib's skeleton parts: what a `*Skeleton` (or a component's own loading branch) is built from. */
260
+ /**
261
+ * The lib's skeleton parts: what a `*Skeleton` (or a component's own loading branch) is built from.
262
+ * `TextLinesByBreakpointSkeleton` is `TextLineSkeleton` at a line count per width (a wrapping title or paragraph):
263
+ * bars with no component of their own, like the rest of the list.
264
+ */
261
265
  const PRIMITIVE =
262
- /^(?:UnifiedSkeleton|TextLineSkeleton|FieldValueSkeleton|TextHold|LayoutHold|Skeleton)$|^(?:TextSkeleton|MediaSkeleton|InteractiveSkeleton)\./;
266
+ /^(?:UnifiedSkeleton|TextLineSkeleton|TextLinesByBreakpointSkeleton|FieldValueSkeleton|TextHold|LayoutHold|Skeleton)$|^(?:TextSkeleton|MediaSkeleton|InteractiveSkeleton)\./;
263
267
  /** The lib's loading wrappers (not loading states of a component). */
264
268
  const LOADING_WRAPPER = /^(?:Loading(?:Items|When|Fallback|Suspense|Scope|Region)|InertWhileLoading)$/;
265
269
  const WHOLE_VIEW =
@@ -753,3 +753,65 @@ export type MeetingBookingPayload = z.infer<ReturnType<typeof makeBookingSchema>
753
753
  * the two survives only on TS's bivariant method-parameter check.
754
754
  */
755
755
  export type BookingFormValues = z.infer<ReturnType<typeof makeDeferredBookingSchema>>;
756
+
757
+ // ---------------------------------------------------------------------------
758
+ // Booking context
759
+ // ---------------------------------------------------------------------------
760
+
761
+ /**
762
+ * What the visitor told the host page BEFORE its form, beside the link's own
763
+ * questions: a labelled list ("Fix these first:" and the cards they picked).
764
+ * The form shows it as a summary of tags and sends it with the booking under
765
+ * `BOOKING_CONTEXT_FIELD`; it never depends on a question the link declares, so
766
+ * a page can carry it on any link. The host reads it on its server with
767
+ * `readBookingContext` and records it where the person running the call sees
768
+ * it (the hub: a note on the HubSpot contact). Never sent to the booking
769
+ * itself: the server schema strips it like any undeclared key.
770
+ */
771
+ export interface BookingContext {
772
+ /** The summary's heading and the note's lead ("Fix these first:"). */
773
+ label: string;
774
+ /** One line each, in the order the visitor gave them. */
775
+ items: string[];
776
+ }
777
+
778
+ /**
779
+ * The space a form keeps for its context BEFORE any line is given: the page knows how many lines it can hold (the
780
+ * cards it lists), so the form reserves that many from its first paint, loading included, and the page never jumps
781
+ * when the visitor picks. Display only: never sent.
782
+ */
783
+ export interface BookingContextSlot {
784
+ /** The block's heading, the context's own label ("Fix these first:"). */
785
+ label: string;
786
+ /** The most lines it can hold: the space reserved. */
787
+ slots: number;
788
+ /** Shown in that space while no line is given ("Nothing picked yet…"). */
789
+ emptyText: string;
790
+ }
791
+
792
+ /** The booking body's key for the context. */
793
+ export const BOOKING_CONTEXT_FIELD = 'bookingContext';
794
+
795
+ /** Bounds of a context the server accepts; a longer list or line is refused whole. */
796
+ export const BOOKING_CONTEXT_LIMITS = { label: 120, items: 20, item: 400 } as const;
797
+
798
+ const bookingContextSchema = z.object({
799
+ label: z.string().trim().min(1).max(BOOKING_CONTEXT_LIMITS.label),
800
+ items: z.array(z.string().trim().min(1).max(BOOKING_CONTEXT_LIMITS.item)).min(1).max(BOOKING_CONTEXT_LIMITS.items),
801
+ });
802
+
803
+ /** A context worth showing and sending: a label and at least one line. */
804
+ export function hasBookingContext(context: BookingContext | null | undefined): context is BookingContext {
805
+ return Boolean(context && context.label.trim() && context.items.some(item => item.trim()));
806
+ }
807
+
808
+ /** The body fields that carry a context: none when there is nothing to send. */
809
+ export function bookingContextFields(context: BookingContext | null | undefined): Record<string, BookingContext> {
810
+ return hasBookingContext(context) ? { [BOOKING_CONTEXT_FIELD]: context } : {};
811
+ }
812
+
813
+ /** The context a booking body carries (`BOOKING_CONTEXT_FIELD`), validated; null when absent or malformed. */
814
+ export function readBookingContext(body: Record<string, unknown>): BookingContext | null {
815
+ const parsed = bookingContextSchema.safeParse(body[BOOKING_CONTEXT_FIELD]);
816
+ return parsed.success ? parsed.data : null;
817
+ }