@ai-matrx/records-ui 0.116.85 → 0.116.87

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.
@@ -12,6 +12,7 @@ import {
12
12
  declareTable,
13
13
  fieldName,
14
14
  hintForAPerson,
15
+ memberName,
15
16
  realPlural,
16
17
  recordName,
17
18
  recordVersions_exports,
@@ -22,10 +23,11 @@ import {
22
23
  tablePickerEntries,
23
24
  tokenFor,
24
25
  useChoiceNudge,
26
+ useMemberRoster,
25
27
  useRecordsUi,
26
28
  useTableRights,
27
29
  writeOnTheWinningVersion_exports
28
- } from "./chunk-3I6HFES6.js";
30
+ } from "./chunk-HYC2SPZZ.js";
29
31
  import {
30
32
  guessColumn,
31
33
  readTableShapes,
@@ -3044,6 +3046,12 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
3044
3046
  const [days, setDays] = useState3(30);
3045
3047
  const [timezone, setTimezone] = useState3(() => ownTimeZone());
3046
3048
  const [windows, setWindows] = useState3(() => draftWindows(null));
3049
+ const [capacity, setCapacity] = useState3(1);
3050
+ const [video, setVideo] = useState3("none");
3051
+ const [videoUrl, setVideoUrl] = useState3("");
3052
+ const [busyFeed, setBusyFeed] = useState3("");
3053
+ const [hosts, setHosts] = useState3([]);
3054
+ const roster = useMemberRoster();
3047
3055
  const [asked, setAsked] = useState3([]);
3048
3056
  const [confirmation, setConfirmation] = useState3("");
3049
3057
  const [messages, setMessages] = useState3({});
@@ -3118,6 +3126,11 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
3118
3126
  setLead(offer.lead_minutes);
3119
3127
  setPerDay(offer.max_per_day);
3120
3128
  setDays(offer.days);
3129
+ setCapacity(offer.capacity ?? 1);
3130
+ setVideo(offer.video ?? "none");
3131
+ setVideoUrl(offer.video_url ?? "");
3132
+ if (offer.busy_feed !== void 0) setBusyFeed(offer.busy_feed ?? "");
3133
+ setHosts([...new Set(offer.windows.map((w) => w.member_user_id).filter((id) => typeof id === "string" && id !== ""))]);
3121
3134
  if (offer.timezone && offer.timezone !== "UTC") setTimezone(offer.timezone);
3122
3135
  }, [offer]);
3123
3136
  const availability = useCallback3(
@@ -3128,9 +3141,16 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
3128
3141
  lead_minutes: lead,
3129
3142
  max_per_day: perDay,
3130
3143
  days,
3131
- windows: windows.filter((w) => w.on).map((w) => ({ weekday: w.weekday, from: w.from, to: w.to }))
3144
+ // Every host keeps the same hours; with nobody named the bookings are with the organization.
3145
+ windows: windows.filter((w) => w.on).flatMap(
3146
+ (w) => hosts.length === 0 ? [{ weekday: w.weekday, from: w.from, to: w.to }] : hosts.map((member_user_id) => ({ weekday: w.weekday, from: w.from, to: w.to, member_user_id }))
3147
+ ),
3148
+ capacity,
3149
+ video,
3150
+ ...video === "link" ? { video_url: videoUrl.trim() } : {},
3151
+ ...busyFeed.trim() !== "" ? { busy_feed: busyFeed.trim() } : {}
3132
3152
  }),
3133
- [timezone, minutes, buffer, lead, perDay, days, windows]
3153
+ [timezone, minutes, buffer, lead, perDay, days, windows, hosts, capacity, video, videoUrl, busyFeed]
3134
3154
  );
3135
3155
  const startedAsking = useRef2(false);
3136
3156
  useEffect2(() => {
@@ -3348,6 +3368,82 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
3348
3368
  ] }) : /* @__PURE__ */ jsx4("span", { className: "text-xs text-muted-foreground", children: "not taking bookings" })
3349
3369
  ] }, w.weekday))
3350
3370
  ] }),
3371
+ /* @__PURE__ */ jsxs4("div", { className: "grid grid-cols-1 gap-2 @md:grid-cols-2", "data-booking-calendly": "", children: [
3372
+ /* @__PURE__ */ jsxs4("label", { className: "flex flex-col gap-1", children: [
3373
+ /* @__PURE__ */ jsx4(Label3, { className: "text-xs font-medium", children: "People at one time" }),
3374
+ /* @__PURE__ */ jsx4(
3375
+ BasicInput3,
3376
+ {
3377
+ type: "number",
3378
+ min: 1,
3379
+ max: 100,
3380
+ "aria-label": "People at one time",
3381
+ "data-booking-capacity": "",
3382
+ value: capacity,
3383
+ onChange: (e) => setCapacity(Math.min(100, Math.max(1, Number(e.target.value) || 1)))
3384
+ }
3385
+ )
3386
+ ] }),
3387
+ /* @__PURE__ */ jsxs4("label", { className: "flex flex-col gap-1", children: [
3388
+ /* @__PURE__ */ jsx4(Label3, { className: "text-xs font-medium", children: "Video" }),
3389
+ /* @__PURE__ */ jsx4(
3390
+ Select3,
3391
+ {
3392
+ "aria-label": "Video",
3393
+ value: video,
3394
+ onValueChange: (v) => setVideo(v),
3395
+ options: [
3396
+ { value: "none", label: "No video" },
3397
+ { value: "auto", label: "A new video room for each booking" },
3398
+ { value: "link", label: "My own video room" }
3399
+ ]
3400
+ }
3401
+ )
3402
+ ] }),
3403
+ video === "link" ? /* @__PURE__ */ jsxs4("label", { className: "flex flex-col gap-1 @md:col-span-2", children: [
3404
+ /* @__PURE__ */ jsx4(Label3, { className: "text-xs font-medium", children: "Your video room's link" }),
3405
+ /* @__PURE__ */ jsx4(
3406
+ BasicInput3,
3407
+ {
3408
+ "aria-label": "Your video room's link",
3409
+ "data-booking-video-url": "",
3410
+ value: videoUrl,
3411
+ placeholder: "https://meet.google.com/abc-defg-hij",
3412
+ onChange: (e) => setVideoUrl(e.target.value)
3413
+ }
3414
+ )
3415
+ ] }) : null,
3416
+ /* @__PURE__ */ jsxs4("label", { className: "flex flex-col gap-1 @md:col-span-2", children: [
3417
+ /* @__PURE__ */ jsx4(Label3, { className: "text-xs font-medium", children: "Connected calendar (private iCal address)" }),
3418
+ /* @__PURE__ */ jsx4(
3419
+ BasicInput3,
3420
+ {
3421
+ "aria-label": "Connected calendar",
3422
+ "data-booking-busy-feed": "",
3423
+ value: busyFeed,
3424
+ placeholder: "https://calendar.google.com/calendar/ical/\u2026/private-\u2026/basic.ics",
3425
+ onChange: (e) => setBusyFeed(e.target.value)
3426
+ }
3427
+ ),
3428
+ offer?.busy_problem ? /* @__PURE__ */ jsx4("span", { className: "text-xs text-destructive", "data-booking-busy-problem": "", children: offer.busy_problem }) : offer?.busy_feed && offer.busy_read_at ? /* @__PURE__ */ jsxs4("span", { className: "text-xs text-muted-foreground", "data-booking-busy-read": "", children: [
3429
+ "Busy times read ",
3430
+ new Date(offer.busy_read_at).toLocaleString()
3431
+ ] }) : null
3432
+ ] }),
3433
+ roster && roster.size > 1 ? /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-1 @md:col-span-2", "data-booking-hosts": "", children: [
3434
+ /* @__PURE__ */ jsx4(Label3, { className: "text-xs font-medium", children: "Who takes bookings (in turn)" }),
3435
+ /* @__PURE__ */ jsx4("div", { className: "flex flex-wrap gap-x-4 gap-y-1.5", children: [...roster.values()].map((m) => /* @__PURE__ */ jsxs4("label", { className: "flex items-center gap-1.5 text-xs", children: [
3436
+ /* @__PURE__ */ jsx4(
3437
+ Checkbox,
3438
+ {
3439
+ checked: hosts.includes(m.userId),
3440
+ onCheckedChange: (on) => setHosts((prev) => on ? [...prev, m.userId] : prev.filter((id) => id !== m.userId))
3441
+ }
3442
+ ),
3443
+ memberName(m)
3444
+ ] }, m.userId)) })
3445
+ ] }) : null
3446
+ ] }),
3351
3447
  /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-1.5", children: [
3352
3448
  /* @__PURE__ */ jsx4(Label3, { className: "text-xs font-medium", children: "What to ask the person booking" }),
3353
3449
  askable.length === 0 ? /* @__PURE__ */ jsx4("p", { className: "text-xs text-muted-foreground", children: "This table has no fields yet, so there is nothing a booking page could ask for. Add a field first \u2014 every question is one of this table's own fields." }) : /* @__PURE__ */ jsx4("div", { className: "flex flex-wrap gap-x-4 gap-y-1.5", children: askable.map((f) => /* @__PURE__ */ jsxs4("label", { className: "flex items-center gap-1.5 text-xs", children: [
@@ -5109,4 +5205,4 @@ export {
5109
5205
  shapesOfSource,
5110
5206
  SaveToTable
5111
5207
  };
5112
- //# sourceMappingURL=chunk-OGEB2WDY.js.map
5208
+ //# sourceMappingURL=chunk-Y5UJD4FV.js.map