@ai-matrx/records-ui 0.116.85 → 0.116.86
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/CHANGELOG.md +16 -2
- package/dist/{SaveToTable-IHKEDRQY.js → SaveToTable-NJQZTAMX.js} +3 -3
- package/dist/{chunk-OGEB2WDY.js → chunk-7IBO6WSM.js} +100 -4
- package/dist/{chunk-OGEB2WDY.js.map → chunk-7IBO6WSM.js.map} +1 -1
- package/dist/{chunk-3I6HFES6.js → chunk-NSRAGMZ2.js} +314 -57
- package/dist/chunk-NSRAGMZ2.js.map +1 -0
- package/dist/{chunk-PDIM4BLZ.js → chunk-OBRFVN3V.js} +1670 -1864
- package/dist/chunk-OBRFVN3V.js.map +1 -0
- package/dist/index.cjs +449 -266
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +329 -246
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +2 -2
- package/package.json +4 -4
- package/dist/chunk-3I6HFES6.js.map +0 -1
- package/dist/chunk-PDIM4BLZ.js.map +0 -1
- /package/dist/{SaveToTable-IHKEDRQY.js.map → SaveToTable-NJQZTAMX.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1494,6 +1494,285 @@ var init_PickOrAdd = __esm({
|
|
|
1494
1494
|
}
|
|
1495
1495
|
});
|
|
1496
1496
|
|
|
1497
|
+
// src/PersonPicker.tsx
|
|
1498
|
+
function personFromRow(row) {
|
|
1499
|
+
const data = row.document ?? {};
|
|
1500
|
+
const userId = data["user_id"];
|
|
1501
|
+
return {
|
|
1502
|
+
id: row.id,
|
|
1503
|
+
userId: typeof userId === "string" && userId !== "" ? userId : null,
|
|
1504
|
+
name: String(data["full_name"] ?? data["name"] ?? data["email"] ?? "").trim()
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
function memberName(member) {
|
|
1508
|
+
const display = (member.name ?? "").trim();
|
|
1509
|
+
if (display !== "") return display;
|
|
1510
|
+
const email = (member.email ?? "").trim();
|
|
1511
|
+
if (email !== "") return email;
|
|
1512
|
+
return "A member with no name set";
|
|
1513
|
+
}
|
|
1514
|
+
async function personRecordForMember(client, personTableId, people, member) {
|
|
1515
|
+
const held = people.find((p) => p.userId === member.userId);
|
|
1516
|
+
if (held) return { ok: true, data: held.id };
|
|
1517
|
+
const written = await client.recordWrite({
|
|
1518
|
+
table_id: personTableId,
|
|
1519
|
+
data: {
|
|
1520
|
+
user_id: member.userId,
|
|
1521
|
+
full_name: memberName(member),
|
|
1522
|
+
...member.email ? { email: member.email } : {}
|
|
1523
|
+
}
|
|
1524
|
+
});
|
|
1525
|
+
return written;
|
|
1526
|
+
}
|
|
1527
|
+
function PersonPicker({ field: field2, value, onChange, disabled, id, className, autoOpen, onClose, onCancel, initialSearch }) {
|
|
1528
|
+
const client = (0, import_react17.useOptionalRecordsClient)();
|
|
1529
|
+
const host = useRecordsUi();
|
|
1530
|
+
const [members, setMembers] = (0, import_react16.useState)(null);
|
|
1531
|
+
const [people, setPeople] = (0, import_react16.useState)([]);
|
|
1532
|
+
const [error, setError] = (0, import_react16.useState)(null);
|
|
1533
|
+
const [search, setSearch] = (0, import_react16.useState)(initialSearch ?? "");
|
|
1534
|
+
const [open, setOpenState] = (0, import_react16.useState)(autoOpen === true);
|
|
1535
|
+
const onCloseRef = (0, import_react16.useRef)(onClose);
|
|
1536
|
+
onCloseRef.current = onClose;
|
|
1537
|
+
const setOpen = (0, import_react16.useCallback)((next) => {
|
|
1538
|
+
setOpenState(next);
|
|
1539
|
+
if (!next) onCloseRef.current?.();
|
|
1540
|
+
}, []);
|
|
1541
|
+
const [busy, setBusy] = (0, import_react16.useState)(false);
|
|
1542
|
+
const membersPort = host.members;
|
|
1543
|
+
const personTable = field2.relation_target;
|
|
1544
|
+
const picked = (0, import_react16.useMemo)(
|
|
1545
|
+
() => Array.isArray(value) ? value.map(String) : value === null || value === void 0 ? [] : [String(value)],
|
|
1546
|
+
[value]
|
|
1547
|
+
);
|
|
1548
|
+
const load = (0, import_react16.useCallback)(async () => {
|
|
1549
|
+
if (!membersPort || !client) return;
|
|
1550
|
+
const [roster, records] = await Promise.all([
|
|
1551
|
+
membersPort(),
|
|
1552
|
+
personTable ? client.list({ table_id: personTable, limit: 500 }) : Promise.resolve(null)
|
|
1553
|
+
]);
|
|
1554
|
+
setMembers(roster);
|
|
1555
|
+
if (records && !records.ok) {
|
|
1556
|
+
setError(records.error);
|
|
1557
|
+
return;
|
|
1558
|
+
}
|
|
1559
|
+
setPeople(records ? records.data.rows.map(personFromRow).filter((p) => p.userId !== null) : []);
|
|
1560
|
+
}, [membersPort, client, personTable]);
|
|
1561
|
+
(0, import_react16.useEffect)(() => {
|
|
1562
|
+
if (!open) return;
|
|
1563
|
+
void load();
|
|
1564
|
+
}, [open, load]);
|
|
1565
|
+
(0, import_react16.useEffect)(() => {
|
|
1566
|
+
if (picked.length === 0 || !personTable || people.length > 0 || !client) return;
|
|
1567
|
+
let cancelled = false;
|
|
1568
|
+
void client.list({ table_id: personTable, limit: 500 }).then((result) => {
|
|
1569
|
+
if (cancelled || !result.ok) return;
|
|
1570
|
+
setPeople(result.data.rows.map(personFromRow).filter((p) => p.userId !== null));
|
|
1571
|
+
});
|
|
1572
|
+
return () => {
|
|
1573
|
+
cancelled = true;
|
|
1574
|
+
};
|
|
1575
|
+
}, [client, personTable, picked.length, people.length]);
|
|
1576
|
+
const listed = (0, import_records4.rankTypedMatches)(members ?? [], search, memberName);
|
|
1577
|
+
if (!membersPort || !client) {
|
|
1578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: (0, import_design_system9.cn)("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
|
|
1579
|
+
}
|
|
1580
|
+
if (!personTable) {
|
|
1581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: (0, import_design_system9.cn)("text-xs text-muted-foreground", className), children: [
|
|
1582
|
+
fieldName(field2),
|
|
1583
|
+
" is a person field, but it does not say which Table the people are records of yet, so there is nothing to pick from. A table admin sets its target in the field editor."
|
|
1584
|
+
] });
|
|
1585
|
+
}
|
|
1586
|
+
const displayNameOf = (userId, recordName2) => {
|
|
1587
|
+
const member = userId ? (members ?? []).find((m) => m.userId === userId) : void 0;
|
|
1588
|
+
const own3 = (member?.name ?? "").trim();
|
|
1589
|
+
if (own3 !== "") return own3;
|
|
1590
|
+
const kept2 = (recordName2 ?? people.find((p) => p.userId === userId)?.name ?? "").trim();
|
|
1591
|
+
const email = (member?.email ?? "").trim();
|
|
1592
|
+
return kept2 !== "" && kept2 !== email ? kept2 : null;
|
|
1593
|
+
};
|
|
1594
|
+
const nameOfRecord = (recordId) => {
|
|
1595
|
+
const person = people.find((p) => p.id === recordId);
|
|
1596
|
+
if (!person) return "Loading\u2026";
|
|
1597
|
+
const member = (members ?? []).find((m) => m.userId === person.userId);
|
|
1598
|
+
return displayNameOf(person.userId, person.name) ?? (member ? memberName(member) : person.name || "A member with no name set");
|
|
1599
|
+
};
|
|
1600
|
+
const pick = async (member) => {
|
|
1601
|
+
setBusy(true);
|
|
1602
|
+
setError(null);
|
|
1603
|
+
const resolved = await personRecordForMember(client, personTable, people, member);
|
|
1604
|
+
setBusy(false);
|
|
1605
|
+
if (!resolved.ok) {
|
|
1606
|
+
setError(resolved.error);
|
|
1607
|
+
return;
|
|
1608
|
+
}
|
|
1609
|
+
if (!people.some((p) => p.id === resolved.data)) {
|
|
1610
|
+
setPeople((held) => [...held, { id: resolved.data, userId: member.userId, name: memberName(member) }]);
|
|
1611
|
+
}
|
|
1612
|
+
if (!field2.multi) {
|
|
1613
|
+
onChange(picked[0] === resolved.data ? null : resolved.data);
|
|
1614
|
+
setOpen(false);
|
|
1615
|
+
return;
|
|
1616
|
+
}
|
|
1617
|
+
const next = new Set(picked);
|
|
1618
|
+
if (next.has(resolved.data)) next.delete(resolved.data);
|
|
1619
|
+
else next.add(resolved.data);
|
|
1620
|
+
onChange(next.size === 0 ? null : [...next]);
|
|
1621
|
+
};
|
|
1622
|
+
const drop = (recordId) => {
|
|
1623
|
+
const next = picked.filter((id2) => id2 !== recordId);
|
|
1624
|
+
onChange(next.length === 0 ? null : field2.multi ? next : next[0] ?? null);
|
|
1625
|
+
};
|
|
1626
|
+
const visible = listed;
|
|
1627
|
+
const pickedUserIds = new Set(
|
|
1628
|
+
picked.map((recordId) => people.find((p) => p.id === recordId)?.userId).filter(Boolean)
|
|
1629
|
+
);
|
|
1630
|
+
const anchored = autoOpen === true;
|
|
1631
|
+
const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PersonChip, { name: nameOfRecord(recordId), ...disabled || anchored ? {} : { onRemove: () => drop(recordId) } }, recordId));
|
|
1632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: (0, import_design_system9.cn)("flex flex-wrap items-center gap-1", className), children: [
|
|
1633
|
+
anchored && !disabled ? null : cellChips,
|
|
1634
|
+
disabled ? null : (
|
|
1635
|
+
// THE ONE "PICK OR ADD" BUILDER (lane CELL-EDITORS, 2026-10-06): the person list used to carry
|
|
1636
|
+
// its own copy of the list's layout and keys; it now draws the same rows, ticks, highlight and
|
|
1637
|
+
// head chips as every other picker, and in a grid cell hangs from the cell.
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1639
|
+
PickOrAdd,
|
|
1640
|
+
{
|
|
1641
|
+
...anchored && onCancel ? { onEscape: onCancel } : {},
|
|
1642
|
+
anchored,
|
|
1643
|
+
multi: field2.multi,
|
|
1644
|
+
triggerId: id,
|
|
1645
|
+
triggerLabel: `Pick a person for ${fieldName(field2)}`,
|
|
1646
|
+
triggerText: picked.length === 0 ? "Pick a person" : "Change",
|
|
1647
|
+
open,
|
|
1648
|
+
onOpenChange: setOpen,
|
|
1649
|
+
search,
|
|
1650
|
+
onSearch: setSearch,
|
|
1651
|
+
chips: picked.map((recordId) => ({ id: recordId, label: nameOfRecord(recordId), person: true, onRemove: () => drop(recordId) })),
|
|
1652
|
+
items: visible.map((member) => ({
|
|
1653
|
+
id: member.userId,
|
|
1654
|
+
label: displayNameOf(member.userId) ?? memberName(member),
|
|
1655
|
+
// A name and an email with nothing between them read as one run-on string (verdict,
|
|
1656
|
+
// 19 September). They are two facts, so they are drawn as two.
|
|
1657
|
+
detail: displayNameOf(member.userId) !== null && member.email ? member.email : null,
|
|
1658
|
+
picked: pickedUserIds.has(member.userId),
|
|
1659
|
+
person: true,
|
|
1660
|
+
disabled: busy
|
|
1661
|
+
})),
|
|
1662
|
+
onPick: (userId) => {
|
|
1663
|
+
const member = visible.find((m) => m.userId === userId);
|
|
1664
|
+
if (member && !busy) void pick(member);
|
|
1665
|
+
},
|
|
1666
|
+
notice: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
1667
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RefusalLine, { error, className: "p-2" }) : null,
|
|
1668
|
+
members === null ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading the members\u2026" }) : null
|
|
1669
|
+
] }),
|
|
1670
|
+
empty: members !== null ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: members.length === 0 ? "This organization has no other members yet, so there is nobody to assign." : "Nobody in this organization matches." }) : null,
|
|
1671
|
+
children: anchored ? cellChips : null
|
|
1672
|
+
}
|
|
1673
|
+
)
|
|
1674
|
+
)
|
|
1675
|
+
] });
|
|
1676
|
+
}
|
|
1677
|
+
var import_react16, import_records4, import_react17, import_design_system9, import_jsx_runtime14;
|
|
1678
|
+
var init_PersonPicker = __esm({
|
|
1679
|
+
"src/PersonPicker.tsx"() {
|
|
1680
|
+
"use strict";
|
|
1681
|
+
"use client";
|
|
1682
|
+
import_react16 = require("react");
|
|
1683
|
+
import_records4 = require("@ai-matrx/records");
|
|
1684
|
+
import_react17 = require("@ai-matrx/records/react");
|
|
1685
|
+
import_design_system9 = require("@ai-matrx/design-system");
|
|
1686
|
+
init_PickOrAdd();
|
|
1687
|
+
init_personChip();
|
|
1688
|
+
init_host();
|
|
1689
|
+
init_host();
|
|
1690
|
+
init_names();
|
|
1691
|
+
init_Refusal();
|
|
1692
|
+
import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1693
|
+
}
|
|
1694
|
+
});
|
|
1695
|
+
|
|
1696
|
+
// src/userIds.ts
|
|
1697
|
+
var PERSON_NOT_IN_ORGANIZATION;
|
|
1698
|
+
var init_userIds = __esm({
|
|
1699
|
+
"src/userIds.ts"() {
|
|
1700
|
+
"use strict";
|
|
1701
|
+
PERSON_NOT_IN_ORGANIZATION = "A person no longer in this organization";
|
|
1702
|
+
}
|
|
1703
|
+
});
|
|
1704
|
+
|
|
1705
|
+
// src/memberNames.ts
|
|
1706
|
+
function memberWords(member) {
|
|
1707
|
+
const name = member?.name?.trim();
|
|
1708
|
+
if (name) return name;
|
|
1709
|
+
const email = member?.email?.trim();
|
|
1710
|
+
return email ? email : null;
|
|
1711
|
+
}
|
|
1712
|
+
function useMemberRoster() {
|
|
1713
|
+
const host = useRecordsUi();
|
|
1714
|
+
const members = host.members;
|
|
1715
|
+
const [roster, setRoster] = (0, import_react18.useState)(null);
|
|
1716
|
+
(0, import_react18.useEffect)(() => {
|
|
1717
|
+
if (!members) {
|
|
1718
|
+
setRoster(/* @__PURE__ */ new Map());
|
|
1719
|
+
return;
|
|
1720
|
+
}
|
|
1721
|
+
let cancelled = false;
|
|
1722
|
+
void members().then((list) => !cancelled && setRoster(new Map(list.map((m) => [m.userId.toLowerCase(), m])))).catch(() => !cancelled && setRoster(/* @__PURE__ */ new Map()));
|
|
1723
|
+
return () => {
|
|
1724
|
+
cancelled = true;
|
|
1725
|
+
};
|
|
1726
|
+
}, [members]);
|
|
1727
|
+
return roster;
|
|
1728
|
+
}
|
|
1729
|
+
async function resolveKeptPerson(client, id, roster) {
|
|
1730
|
+
if (client) {
|
|
1731
|
+
try {
|
|
1732
|
+
const read = await client.recordRead({ record_id: id });
|
|
1733
|
+
if (read.ok) {
|
|
1734
|
+
const person = personFromRow({ id, document: read.data.document });
|
|
1735
|
+
const member = person.userId ? roster.get(person.userId.toLowerCase()) : void 0;
|
|
1736
|
+
const named = memberWords(member) ?? (person.name !== "" ? person.name : null);
|
|
1737
|
+
const doc = read.data.document ?? {};
|
|
1738
|
+
const email = (typeof doc["email"] === "string" && doc["email"].trim() !== "" ? doc["email"].trim() : null) ?? member?.email?.trim() ?? null;
|
|
1739
|
+
if (person.userId || named) return { id, recordId: id, name: named ?? PERSON_NOT_IN_ORGANIZATION, userId: person.userId, email };
|
|
1740
|
+
}
|
|
1741
|
+
} catch {
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
const direct = roster.get(id.toLowerCase());
|
|
1745
|
+
return { id, recordId: null, name: memberWords(direct) ?? PERSON_NOT_IN_ORGANIZATION, userId: direct ? id : null, email: direct?.email?.trim() || null };
|
|
1746
|
+
}
|
|
1747
|
+
function useKeptPeople(value, roster) {
|
|
1748
|
+
const client = (0, import_react19.useOptionalRecordsClient)();
|
|
1749
|
+
const ids = (0, import_react18.useMemo)(() => (Array.isArray(value) ? value : [value]).filter(import_uuid3.isUuidShape), [value]);
|
|
1750
|
+
const key = ids.join(",");
|
|
1751
|
+
const [people, setPeople] = (0, import_react18.useState)(null);
|
|
1752
|
+
(0, import_react18.useEffect)(() => {
|
|
1753
|
+
if (!roster) return;
|
|
1754
|
+
let cancelled = false;
|
|
1755
|
+
void Promise.all(ids.map((id) => resolveKeptPerson(client, id, roster))).then((named) => !cancelled && setPeople(named));
|
|
1756
|
+
return () => {
|
|
1757
|
+
cancelled = true;
|
|
1758
|
+
};
|
|
1759
|
+
}, [key, roster, client]);
|
|
1760
|
+
return people;
|
|
1761
|
+
}
|
|
1762
|
+
var import_react18, import_react19, import_uuid3;
|
|
1763
|
+
var init_memberNames = __esm({
|
|
1764
|
+
"src/memberNames.ts"() {
|
|
1765
|
+
"use strict";
|
|
1766
|
+
"use client";
|
|
1767
|
+
import_react18 = require("react");
|
|
1768
|
+
import_react19 = require("@ai-matrx/records/react");
|
|
1769
|
+
init_host();
|
|
1770
|
+
init_PersonPicker();
|
|
1771
|
+
import_uuid3 = require("@ai-matrx/kit/uuid");
|
|
1772
|
+
init_userIds();
|
|
1773
|
+
}
|
|
1774
|
+
});
|
|
1775
|
+
|
|
1497
1776
|
// src/recordVersions.ts
|
|
1498
1777
|
var recordVersions_exports = {};
|
|
1499
1778
|
var init_recordVersions = __esm({
|
|
@@ -5728,6 +6007,12 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
|
|
|
5728
6007
|
const [days, setDays] = (0, import_react62.useState)(30);
|
|
5729
6008
|
const [timezone, setTimezone] = (0, import_react62.useState)(() => ownTimeZone());
|
|
5730
6009
|
const [windows, setWindows] = (0, import_react62.useState)(() => draftWindows(null));
|
|
6010
|
+
const [capacity, setCapacity] = (0, import_react62.useState)(1);
|
|
6011
|
+
const [video, setVideo] = (0, import_react62.useState)("none");
|
|
6012
|
+
const [videoUrl, setVideoUrl] = (0, import_react62.useState)("");
|
|
6013
|
+
const [busyFeed, setBusyFeed] = (0, import_react62.useState)("");
|
|
6014
|
+
const [hosts, setHosts] = (0, import_react62.useState)([]);
|
|
6015
|
+
const roster = useMemberRoster();
|
|
5731
6016
|
const [asked4, setAsked] = (0, import_react62.useState)([]);
|
|
5732
6017
|
const [confirmation, setConfirmation] = (0, import_react62.useState)("");
|
|
5733
6018
|
const [messages, setMessages] = (0, import_react62.useState)({});
|
|
@@ -5802,6 +6087,11 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
|
|
|
5802
6087
|
setLead(offer.lead_minutes);
|
|
5803
6088
|
setPerDay(offer.max_per_day);
|
|
5804
6089
|
setDays(offer.days);
|
|
6090
|
+
setCapacity(offer.capacity ?? 1);
|
|
6091
|
+
setVideo(offer.video ?? "none");
|
|
6092
|
+
setVideoUrl(offer.video_url ?? "");
|
|
6093
|
+
if (offer.busy_feed !== void 0) setBusyFeed(offer.busy_feed ?? "");
|
|
6094
|
+
setHosts([...new Set(offer.windows.map((w) => w.member_user_id).filter((id) => typeof id === "string" && id !== ""))]);
|
|
5805
6095
|
if (offer.timezone && offer.timezone !== "UTC") setTimezone(offer.timezone);
|
|
5806
6096
|
}, [offer]);
|
|
5807
6097
|
const availability = (0, import_react62.useCallback)(
|
|
@@ -5812,9 +6102,16 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
|
|
|
5812
6102
|
lead_minutes: lead,
|
|
5813
6103
|
max_per_day: perDay,
|
|
5814
6104
|
days,
|
|
5815
|
-
|
|
6105
|
+
// Every host keeps the same hours; with nobody named the bookings are with the organization.
|
|
6106
|
+
windows: windows.filter((w) => w.on).flatMap(
|
|
6107
|
+
(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 }))
|
|
6108
|
+
),
|
|
6109
|
+
capacity,
|
|
6110
|
+
video,
|
|
6111
|
+
...video === "link" ? { video_url: videoUrl.trim() } : {},
|
|
6112
|
+
...busyFeed.trim() !== "" ? { busy_feed: busyFeed.trim() } : {}
|
|
5816
6113
|
}),
|
|
5817
|
-
[timezone, minutes, buffer, lead, perDay, days, windows]
|
|
6114
|
+
[timezone, minutes, buffer, lead, perDay, days, windows, hosts, capacity, video, videoUrl, busyFeed]
|
|
5818
6115
|
);
|
|
5819
6116
|
const startedAsking = (0, import_react62.useRef)(false);
|
|
5820
6117
|
(0, import_react62.useEffect)(() => {
|
|
@@ -6032,6 +6329,82 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
|
|
|
6032
6329
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "text-xs text-muted-foreground", children: "not taking bookings" })
|
|
6033
6330
|
] }, w.weekday))
|
|
6034
6331
|
] }),
|
|
6332
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "grid grid-cols-1 gap-2 @md:grid-cols-2", "data-booking-calendly": "", children: [
|
|
6333
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
6334
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system36.Label, { className: "text-xs font-medium", children: "People at one time" }),
|
|
6335
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6336
|
+
import_design_system36.BasicInput,
|
|
6337
|
+
{
|
|
6338
|
+
type: "number",
|
|
6339
|
+
min: 1,
|
|
6340
|
+
max: 100,
|
|
6341
|
+
"aria-label": "People at one time",
|
|
6342
|
+
"data-booking-capacity": "",
|
|
6343
|
+
value: capacity,
|
|
6344
|
+
onChange: (e) => setCapacity(Math.min(100, Math.max(1, Number(e.target.value) || 1)))
|
|
6345
|
+
}
|
|
6346
|
+
)
|
|
6347
|
+
] }),
|
|
6348
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
6349
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system36.Label, { className: "text-xs font-medium", children: "Video" }),
|
|
6350
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6351
|
+
import_controls2.Select,
|
|
6352
|
+
{
|
|
6353
|
+
"aria-label": "Video",
|
|
6354
|
+
value: video,
|
|
6355
|
+
onValueChange: (v) => setVideo(v),
|
|
6356
|
+
options: [
|
|
6357
|
+
{ value: "none", label: "No video" },
|
|
6358
|
+
{ value: "auto", label: "A new video room for each booking" },
|
|
6359
|
+
{ value: "link", label: "My own video room" }
|
|
6360
|
+
]
|
|
6361
|
+
}
|
|
6362
|
+
)
|
|
6363
|
+
] }),
|
|
6364
|
+
video === "link" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex flex-col gap-1 @md:col-span-2", children: [
|
|
6365
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system36.Label, { className: "text-xs font-medium", children: "Your video room's link" }),
|
|
6366
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6367
|
+
import_design_system36.BasicInput,
|
|
6368
|
+
{
|
|
6369
|
+
"aria-label": "Your video room's link",
|
|
6370
|
+
"data-booking-video-url": "",
|
|
6371
|
+
value: videoUrl,
|
|
6372
|
+
placeholder: "https://meet.google.com/abc-defg-hij",
|
|
6373
|
+
onChange: (e) => setVideoUrl(e.target.value)
|
|
6374
|
+
}
|
|
6375
|
+
)
|
|
6376
|
+
] }) : null,
|
|
6377
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex flex-col gap-1 @md:col-span-2", children: [
|
|
6378
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system36.Label, { className: "text-xs font-medium", children: "Connected calendar (private iCal address)" }),
|
|
6379
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6380
|
+
import_design_system36.BasicInput,
|
|
6381
|
+
{
|
|
6382
|
+
"aria-label": "Connected calendar",
|
|
6383
|
+
"data-booking-busy-feed": "",
|
|
6384
|
+
value: busyFeed,
|
|
6385
|
+
placeholder: "https://calendar.google.com/calendar/ical/\u2026/private-\u2026/basic.ics",
|
|
6386
|
+
onChange: (e) => setBusyFeed(e.target.value)
|
|
6387
|
+
}
|
|
6388
|
+
),
|
|
6389
|
+
offer?.busy_problem ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "text-xs text-destructive", "data-booking-busy-problem": "", children: offer.busy_problem }) : offer?.busy_feed && offer.busy_read_at ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "text-xs text-muted-foreground", "data-booking-busy-read": "", children: [
|
|
6390
|
+
"Busy times read ",
|
|
6391
|
+
new Date(offer.busy_read_at).toLocaleString()
|
|
6392
|
+
] }) : null
|
|
6393
|
+
] }),
|
|
6394
|
+
roster && roster.size > 1 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-col gap-1 @md:col-span-2", "data-booking-hosts": "", children: [
|
|
6395
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system36.Label, { className: "text-xs font-medium", children: "Who takes bookings (in turn)" }),
|
|
6396
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex flex-wrap gap-x-4 gap-y-1.5", children: [...roster.values()].map((m) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex items-center gap-1.5 text-xs", children: [
|
|
6397
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6398
|
+
import_design_system36.Checkbox,
|
|
6399
|
+
{
|
|
6400
|
+
checked: hosts.includes(m.userId),
|
|
6401
|
+
onCheckedChange: (on) => setHosts((prev) => on ? [...prev, m.userId] : prev.filter((id) => id !== m.userId))
|
|
6402
|
+
}
|
|
6403
|
+
),
|
|
6404
|
+
memberName(m)
|
|
6405
|
+
] }, m.userId)) })
|
|
6406
|
+
] }) : null
|
|
6407
|
+
] }),
|
|
6035
6408
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
6036
6409
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system36.Label, { className: "text-xs font-medium", children: "What to ask the person booking" }),
|
|
6037
6410
|
askable.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("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__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex flex-wrap gap-x-4 gap-y-1.5", children: askable.map((f) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex items-center gap-1.5 text-xs", children: [
|
|
@@ -6254,6 +6627,8 @@ var init_BookingBuilder = __esm({
|
|
|
6254
6627
|
init_host();
|
|
6255
6628
|
init_names();
|
|
6256
6629
|
init_parity();
|
|
6630
|
+
init_memberNames();
|
|
6631
|
+
init_PersonPicker();
|
|
6257
6632
|
import_jsx_runtime42 = require("react/jsx-runtime");
|
|
6258
6633
|
STORE_ANSWERS_THESE = ["slot", "status", "booked_with"];
|
|
6259
6634
|
DAYS = [
|
|
@@ -11461,272 +11836,13 @@ init_names();
|
|
|
11461
11836
|
init_Refusal();
|
|
11462
11837
|
init_host();
|
|
11463
11838
|
init_plainWords();
|
|
11464
|
-
|
|
11465
|
-
// src/memberNames.ts
|
|
11466
|
-
var import_react18 = require("react");
|
|
11467
|
-
var import_react19 = require("@ai-matrx/records/react");
|
|
11468
|
-
init_host();
|
|
11469
|
-
|
|
11470
|
-
// src/PersonPicker.tsx
|
|
11471
|
-
var import_react16 = require("react");
|
|
11472
|
-
var import_records4 = require("@ai-matrx/records");
|
|
11473
|
-
var import_react17 = require("@ai-matrx/records/react");
|
|
11474
|
-
var import_design_system9 = require("@ai-matrx/design-system");
|
|
11475
|
-
init_PickOrAdd();
|
|
11476
|
-
init_personChip();
|
|
11477
|
-
init_host();
|
|
11478
|
-
init_host();
|
|
11479
|
-
init_names();
|
|
11480
|
-
init_Refusal();
|
|
11481
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
11482
|
-
function personFromRow(row) {
|
|
11483
|
-
const data = row.document ?? {};
|
|
11484
|
-
const userId = data["user_id"];
|
|
11485
|
-
return {
|
|
11486
|
-
id: row.id,
|
|
11487
|
-
userId: typeof userId === "string" && userId !== "" ? userId : null,
|
|
11488
|
-
name: String(data["full_name"] ?? data["name"] ?? data["email"] ?? "").trim()
|
|
11489
|
-
};
|
|
11490
|
-
}
|
|
11491
|
-
function memberName(member) {
|
|
11492
|
-
const display = (member.name ?? "").trim();
|
|
11493
|
-
if (display !== "") return display;
|
|
11494
|
-
const email = (member.email ?? "").trim();
|
|
11495
|
-
if (email !== "") return email;
|
|
11496
|
-
return "A member with no name set";
|
|
11497
|
-
}
|
|
11498
|
-
async function personRecordForMember(client, personTableId, people, member) {
|
|
11499
|
-
const held = people.find((p) => p.userId === member.userId);
|
|
11500
|
-
if (held) return { ok: true, data: held.id };
|
|
11501
|
-
const written = await client.recordWrite({
|
|
11502
|
-
table_id: personTableId,
|
|
11503
|
-
data: {
|
|
11504
|
-
user_id: member.userId,
|
|
11505
|
-
full_name: memberName(member),
|
|
11506
|
-
...member.email ? { email: member.email } : {}
|
|
11507
|
-
}
|
|
11508
|
-
});
|
|
11509
|
-
return written;
|
|
11510
|
-
}
|
|
11511
|
-
function PersonPicker({ field: field2, value, onChange, disabled, id, className, autoOpen, onClose, onCancel, initialSearch }) {
|
|
11512
|
-
const client = (0, import_react17.useOptionalRecordsClient)();
|
|
11513
|
-
const host = useRecordsUi();
|
|
11514
|
-
const [members, setMembers] = (0, import_react16.useState)(null);
|
|
11515
|
-
const [people, setPeople] = (0, import_react16.useState)([]);
|
|
11516
|
-
const [error, setError] = (0, import_react16.useState)(null);
|
|
11517
|
-
const [search, setSearch] = (0, import_react16.useState)(initialSearch ?? "");
|
|
11518
|
-
const [open, setOpenState] = (0, import_react16.useState)(autoOpen === true);
|
|
11519
|
-
const onCloseRef = (0, import_react16.useRef)(onClose);
|
|
11520
|
-
onCloseRef.current = onClose;
|
|
11521
|
-
const setOpen = (0, import_react16.useCallback)((next) => {
|
|
11522
|
-
setOpenState(next);
|
|
11523
|
-
if (!next) onCloseRef.current?.();
|
|
11524
|
-
}, []);
|
|
11525
|
-
const [busy, setBusy] = (0, import_react16.useState)(false);
|
|
11526
|
-
const membersPort = host.members;
|
|
11527
|
-
const personTable = field2.relation_target;
|
|
11528
|
-
const picked = (0, import_react16.useMemo)(
|
|
11529
|
-
() => Array.isArray(value) ? value.map(String) : value === null || value === void 0 ? [] : [String(value)],
|
|
11530
|
-
[value]
|
|
11531
|
-
);
|
|
11532
|
-
const load = (0, import_react16.useCallback)(async () => {
|
|
11533
|
-
if (!membersPort || !client) return;
|
|
11534
|
-
const [roster, records] = await Promise.all([
|
|
11535
|
-
membersPort(),
|
|
11536
|
-
personTable ? client.list({ table_id: personTable, limit: 500 }) : Promise.resolve(null)
|
|
11537
|
-
]);
|
|
11538
|
-
setMembers(roster);
|
|
11539
|
-
if (records && !records.ok) {
|
|
11540
|
-
setError(records.error);
|
|
11541
|
-
return;
|
|
11542
|
-
}
|
|
11543
|
-
setPeople(records ? records.data.rows.map(personFromRow).filter((p) => p.userId !== null) : []);
|
|
11544
|
-
}, [membersPort, client, personTable]);
|
|
11545
|
-
(0, import_react16.useEffect)(() => {
|
|
11546
|
-
if (!open) return;
|
|
11547
|
-
void load();
|
|
11548
|
-
}, [open, load]);
|
|
11549
|
-
(0, import_react16.useEffect)(() => {
|
|
11550
|
-
if (picked.length === 0 || !personTable || people.length > 0 || !client) return;
|
|
11551
|
-
let cancelled = false;
|
|
11552
|
-
void client.list({ table_id: personTable, limit: 500 }).then((result) => {
|
|
11553
|
-
if (cancelled || !result.ok) return;
|
|
11554
|
-
setPeople(result.data.rows.map(personFromRow).filter((p) => p.userId !== null));
|
|
11555
|
-
});
|
|
11556
|
-
return () => {
|
|
11557
|
-
cancelled = true;
|
|
11558
|
-
};
|
|
11559
|
-
}, [client, personTable, picked.length, people.length]);
|
|
11560
|
-
const listed = (0, import_records4.rankTypedMatches)(members ?? [], search, memberName);
|
|
11561
|
-
if (!membersPort || !client) {
|
|
11562
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: (0, import_design_system9.cn)("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
|
|
11563
|
-
}
|
|
11564
|
-
if (!personTable) {
|
|
11565
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: (0, import_design_system9.cn)("text-xs text-muted-foreground", className), children: [
|
|
11566
|
-
fieldName(field2),
|
|
11567
|
-
" is a person field, but it does not say which Table the people are records of yet, so there is nothing to pick from. A table admin sets its target in the field editor."
|
|
11568
|
-
] });
|
|
11569
|
-
}
|
|
11570
|
-
const displayNameOf = (userId, recordName2) => {
|
|
11571
|
-
const member = userId ? (members ?? []).find((m) => m.userId === userId) : void 0;
|
|
11572
|
-
const own3 = (member?.name ?? "").trim();
|
|
11573
|
-
if (own3 !== "") return own3;
|
|
11574
|
-
const kept2 = (recordName2 ?? people.find((p) => p.userId === userId)?.name ?? "").trim();
|
|
11575
|
-
const email = (member?.email ?? "").trim();
|
|
11576
|
-
return kept2 !== "" && kept2 !== email ? kept2 : null;
|
|
11577
|
-
};
|
|
11578
|
-
const nameOfRecord = (recordId) => {
|
|
11579
|
-
const person = people.find((p) => p.id === recordId);
|
|
11580
|
-
if (!person) return "Loading\u2026";
|
|
11581
|
-
const member = (members ?? []).find((m) => m.userId === person.userId);
|
|
11582
|
-
return displayNameOf(person.userId, person.name) ?? (member ? memberName(member) : person.name || "A member with no name set");
|
|
11583
|
-
};
|
|
11584
|
-
const pick = async (member) => {
|
|
11585
|
-
setBusy(true);
|
|
11586
|
-
setError(null);
|
|
11587
|
-
const resolved = await personRecordForMember(client, personTable, people, member);
|
|
11588
|
-
setBusy(false);
|
|
11589
|
-
if (!resolved.ok) {
|
|
11590
|
-
setError(resolved.error);
|
|
11591
|
-
return;
|
|
11592
|
-
}
|
|
11593
|
-
if (!people.some((p) => p.id === resolved.data)) {
|
|
11594
|
-
setPeople((held) => [...held, { id: resolved.data, userId: member.userId, name: memberName(member) }]);
|
|
11595
|
-
}
|
|
11596
|
-
if (!field2.multi) {
|
|
11597
|
-
onChange(picked[0] === resolved.data ? null : resolved.data);
|
|
11598
|
-
setOpen(false);
|
|
11599
|
-
return;
|
|
11600
|
-
}
|
|
11601
|
-
const next = new Set(picked);
|
|
11602
|
-
if (next.has(resolved.data)) next.delete(resolved.data);
|
|
11603
|
-
else next.add(resolved.data);
|
|
11604
|
-
onChange(next.size === 0 ? null : [...next]);
|
|
11605
|
-
};
|
|
11606
|
-
const drop = (recordId) => {
|
|
11607
|
-
const next = picked.filter((id2) => id2 !== recordId);
|
|
11608
|
-
onChange(next.length === 0 ? null : field2.multi ? next : next[0] ?? null);
|
|
11609
|
-
};
|
|
11610
|
-
const visible = listed;
|
|
11611
|
-
const pickedUserIds = new Set(
|
|
11612
|
-
picked.map((recordId) => people.find((p) => p.id === recordId)?.userId).filter(Boolean)
|
|
11613
|
-
);
|
|
11614
|
-
const anchored = autoOpen === true;
|
|
11615
|
-
const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PersonChip, { name: nameOfRecord(recordId), ...disabled || anchored ? {} : { onRemove: () => drop(recordId) } }, recordId));
|
|
11616
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: (0, import_design_system9.cn)("flex flex-wrap items-center gap-1", className), children: [
|
|
11617
|
-
anchored && !disabled ? null : cellChips,
|
|
11618
|
-
disabled ? null : (
|
|
11619
|
-
// THE ONE "PICK OR ADD" BUILDER (lane CELL-EDITORS, 2026-10-06): the person list used to carry
|
|
11620
|
-
// its own copy of the list's layout and keys; it now draws the same rows, ticks, highlight and
|
|
11621
|
-
// head chips as every other picker, and in a grid cell hangs from the cell.
|
|
11622
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
11623
|
-
PickOrAdd,
|
|
11624
|
-
{
|
|
11625
|
-
...anchored && onCancel ? { onEscape: onCancel } : {},
|
|
11626
|
-
anchored,
|
|
11627
|
-
multi: field2.multi,
|
|
11628
|
-
triggerId: id,
|
|
11629
|
-
triggerLabel: `Pick a person for ${fieldName(field2)}`,
|
|
11630
|
-
triggerText: picked.length === 0 ? "Pick a person" : "Change",
|
|
11631
|
-
open,
|
|
11632
|
-
onOpenChange: setOpen,
|
|
11633
|
-
search,
|
|
11634
|
-
onSearch: setSearch,
|
|
11635
|
-
chips: picked.map((recordId) => ({ id: recordId, label: nameOfRecord(recordId), person: true, onRemove: () => drop(recordId) })),
|
|
11636
|
-
items: visible.map((member) => ({
|
|
11637
|
-
id: member.userId,
|
|
11638
|
-
label: displayNameOf(member.userId) ?? memberName(member),
|
|
11639
|
-
// A name and an email with nothing between them read as one run-on string (verdict,
|
|
11640
|
-
// 19 September). They are two facts, so they are drawn as two.
|
|
11641
|
-
detail: displayNameOf(member.userId) !== null && member.email ? member.email : null,
|
|
11642
|
-
picked: pickedUserIds.has(member.userId),
|
|
11643
|
-
person: true,
|
|
11644
|
-
disabled: busy
|
|
11645
|
-
})),
|
|
11646
|
-
onPick: (userId) => {
|
|
11647
|
-
const member = visible.find((m) => m.userId === userId);
|
|
11648
|
-
if (member && !busy) void pick(member);
|
|
11649
|
-
},
|
|
11650
|
-
notice: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
11651
|
-
error ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RefusalLine, { error, className: "p-2" }) : null,
|
|
11652
|
-
members === null ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading the members\u2026" }) : null
|
|
11653
|
-
] }),
|
|
11654
|
-
empty: members !== null ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: members.length === 0 ? "This organization has no other members yet, so there is nobody to assign." : "Nobody in this organization matches." }) : null,
|
|
11655
|
-
children: anchored ? cellChips : null
|
|
11656
|
-
}
|
|
11657
|
-
)
|
|
11658
|
-
)
|
|
11659
|
-
] });
|
|
11660
|
-
}
|
|
11661
|
-
|
|
11662
|
-
// src/memberNames.ts
|
|
11663
|
-
var import_uuid3 = require("@ai-matrx/kit/uuid");
|
|
11664
|
-
|
|
11665
|
-
// src/userIds.ts
|
|
11666
|
-
var PERSON_NOT_IN_ORGANIZATION = "A person no longer in this organization";
|
|
11667
|
-
|
|
11668
|
-
// src/memberNames.ts
|
|
11669
|
-
function memberWords(member) {
|
|
11670
|
-
const name = member?.name?.trim();
|
|
11671
|
-
if (name) return name;
|
|
11672
|
-
const email = member?.email?.trim();
|
|
11673
|
-
return email ? email : null;
|
|
11674
|
-
}
|
|
11675
|
-
function useMemberRoster() {
|
|
11676
|
-
const host = useRecordsUi();
|
|
11677
|
-
const members = host.members;
|
|
11678
|
-
const [roster, setRoster] = (0, import_react18.useState)(null);
|
|
11679
|
-
(0, import_react18.useEffect)(() => {
|
|
11680
|
-
if (!members) {
|
|
11681
|
-
setRoster(/* @__PURE__ */ new Map());
|
|
11682
|
-
return;
|
|
11683
|
-
}
|
|
11684
|
-
let cancelled = false;
|
|
11685
|
-
void members().then((list) => !cancelled && setRoster(new Map(list.map((m) => [m.userId.toLowerCase(), m])))).catch(() => !cancelled && setRoster(/* @__PURE__ */ new Map()));
|
|
11686
|
-
return () => {
|
|
11687
|
-
cancelled = true;
|
|
11688
|
-
};
|
|
11689
|
-
}, [members]);
|
|
11690
|
-
return roster;
|
|
11691
|
-
}
|
|
11692
|
-
async function resolveKeptPerson(client, id, roster) {
|
|
11693
|
-
if (client) {
|
|
11694
|
-
try {
|
|
11695
|
-
const read = await client.recordRead({ record_id: id });
|
|
11696
|
-
if (read.ok) {
|
|
11697
|
-
const person = personFromRow({ id, document: read.data.document });
|
|
11698
|
-
const member = person.userId ? roster.get(person.userId.toLowerCase()) : void 0;
|
|
11699
|
-
const named = memberWords(member) ?? (person.name !== "" ? person.name : null);
|
|
11700
|
-
const doc = read.data.document ?? {};
|
|
11701
|
-
const email = (typeof doc["email"] === "string" && doc["email"].trim() !== "" ? doc["email"].trim() : null) ?? member?.email?.trim() ?? null;
|
|
11702
|
-
if (person.userId || named) return { id, recordId: id, name: named ?? PERSON_NOT_IN_ORGANIZATION, userId: person.userId, email };
|
|
11703
|
-
}
|
|
11704
|
-
} catch {
|
|
11705
|
-
}
|
|
11706
|
-
}
|
|
11707
|
-
const direct = roster.get(id.toLowerCase());
|
|
11708
|
-
return { id, recordId: null, name: memberWords(direct) ?? PERSON_NOT_IN_ORGANIZATION, userId: direct ? id : null, email: direct?.email?.trim() || null };
|
|
11709
|
-
}
|
|
11710
|
-
function useKeptPeople(value, roster) {
|
|
11711
|
-
const client = (0, import_react19.useOptionalRecordsClient)();
|
|
11712
|
-
const ids = (0, import_react18.useMemo)(() => (Array.isArray(value) ? value : [value]).filter(import_uuid3.isUuidShape), [value]);
|
|
11713
|
-
const key = ids.join(",");
|
|
11714
|
-
const [people, setPeople] = (0, import_react18.useState)(null);
|
|
11715
|
-
(0, import_react18.useEffect)(() => {
|
|
11716
|
-
if (!roster) return;
|
|
11717
|
-
let cancelled = false;
|
|
11718
|
-
void Promise.all(ids.map((id) => resolveKeptPerson(client, id, roster))).then((named) => !cancelled && setPeople(named));
|
|
11719
|
-
return () => {
|
|
11720
|
-
cancelled = true;
|
|
11721
|
-
};
|
|
11722
|
-
}, [key, roster, client]);
|
|
11723
|
-
return people;
|
|
11724
|
-
}
|
|
11839
|
+
init_memberNames();
|
|
11725
11840
|
|
|
11726
11841
|
// src/personRetype.ts
|
|
11727
11842
|
init_recordVersions();
|
|
11728
11843
|
init_plainWords();
|
|
11729
11844
|
var import_uuid4 = require("@ai-matrx/kit/uuid");
|
|
11845
|
+
init_memberNames();
|
|
11730
11846
|
var PAGE = 500;
|
|
11731
11847
|
var CEILING = 2e4;
|
|
11732
11848
|
function idsIn(value) {
|
|
@@ -15827,6 +15943,7 @@ function withFormulaDisplayNow(field2, fields, kindOf, currencyCodeOf) {
|
|
|
15827
15943
|
// src/values.tsx
|
|
15828
15944
|
var import_records25 = require("@ai-matrx/records");
|
|
15829
15945
|
var import_uuid7 = require("@ai-matrx/kit/uuid");
|
|
15946
|
+
init_userIds();
|
|
15830
15947
|
|
|
15831
15948
|
// src/personNames.ts
|
|
15832
15949
|
var import_react52 = require("react");
|
|
@@ -15896,6 +16013,7 @@ init_names();
|
|
|
15896
16013
|
init_recordVersions();
|
|
15897
16014
|
init_personChip();
|
|
15898
16015
|
var import_uuid5 = require("@ai-matrx/kit/uuid");
|
|
16016
|
+
init_memberNames();
|
|
15899
16017
|
init_host();
|
|
15900
16018
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
15901
16019
|
function same(a, b) {
|
|
@@ -17096,6 +17214,8 @@ function conditionInWords(expr, fields) {
|
|
|
17096
17214
|
has_none: "has none of",
|
|
17097
17215
|
is_exactly: "is exactly"
|
|
17098
17216
|
};
|
|
17217
|
+
const flat = flatFilterInWords(expr, fields);
|
|
17218
|
+
if (flat !== null) return flat;
|
|
17099
17219
|
const walk = (node) => {
|
|
17100
17220
|
if (node === null || node === void 0) return "nothing";
|
|
17101
17221
|
const n = node;
|
|
@@ -17133,9 +17253,66 @@ function conditionInWords(expr, fields) {
|
|
|
17133
17253
|
if (op2 === "and" || op2 === "or") return args.map(walk).join(` ${word} `);
|
|
17134
17254
|
if (args.length === 2) return `${walk(args[0])} ${word} ${walk(args[1])}`;
|
|
17135
17255
|
if (args.length === 1) return `${walk(args[0])} ${word}`;
|
|
17136
|
-
return op2;
|
|
17256
|
+
return op2 || UNREADABLE_CONDITION;
|
|
17257
|
+
};
|
|
17258
|
+
return walk(expr) || UNREADABLE_CONDITION;
|
|
17259
|
+
}
|
|
17260
|
+
var UNREADABLE_CONDITION = "a condition this screen cannot read";
|
|
17261
|
+
var RULE_NODE_KEYS = ["op", "const", "field", "args"];
|
|
17262
|
+
function flatFilterInWords(expr, fields) {
|
|
17263
|
+
if (expr === null || expr === void 0 || typeof expr !== "object" || Array.isArray(expr)) return null;
|
|
17264
|
+
const map = expr;
|
|
17265
|
+
if (RULE_NODE_KEYS.some((k) => k in map)) return null;
|
|
17266
|
+
const keys = Object.keys(map);
|
|
17267
|
+
if (keys.length === 0) return "every record";
|
|
17268
|
+
const name = (key) => {
|
|
17269
|
+
const f = fields.find((x) => x.key === key || x.id === key);
|
|
17270
|
+
if (f) return f.label || f.key;
|
|
17271
|
+
const words2 = key.replace(/[._]+/g, " ").trim();
|
|
17272
|
+
return words2 ? words2.charAt(0).toUpperCase() + words2.slice(1) : "a column";
|
|
17273
|
+
};
|
|
17274
|
+
const one = (v) => v === null || v === void 0 ? "nothing" : typeof v === "string" ? JSON.stringify(v) : String(v);
|
|
17275
|
+
const list = (v, joiner) => (Array.isArray(v) ? v : [v]).map(one).join(` ${joiner} `);
|
|
17276
|
+
const listSaid = {
|
|
17277
|
+
contains: ["contains", "or"],
|
|
17278
|
+
not_contains: ["does not contain", "or"],
|
|
17279
|
+
has_any: ["has any of", "or"],
|
|
17280
|
+
has_all: ["has all of", "and"],
|
|
17281
|
+
has_none: ["has none of", "or"],
|
|
17282
|
+
is_exactly: ["is exactly", "and"]
|
|
17283
|
+
};
|
|
17284
|
+
const clause = (key, v) => {
|
|
17285
|
+
const who = name(key);
|
|
17286
|
+
if (v === null) return `${who} is empty`;
|
|
17287
|
+
if (Array.isArray(v)) return v.length === 0 ? `${who} is empty` : `${who} is ${list(v, "or")}`;
|
|
17288
|
+
if (typeof v !== "object") return `${who} is ${one(v)}`;
|
|
17289
|
+
const o = v;
|
|
17290
|
+
const parts = [];
|
|
17291
|
+
for (const [word, arg] of Object.entries(o)) {
|
|
17292
|
+
if (word === "link") continue;
|
|
17293
|
+
if (word === "not" || word === "is_not") {
|
|
17294
|
+
parts.push(Array.isArray(arg) ? `is none of ${list(arg, "or")}` : `is not ${one(arg)}`);
|
|
17295
|
+
} else if (word === "from" || word === "to") {
|
|
17296
|
+
if (word === "to" && "from" in o) continue;
|
|
17297
|
+
parts.push(
|
|
17298
|
+
word === "from" && "to" in o ? `is from ${one(arg)} to ${one(o["to"])}` : word === "from" ? `is from ${one(arg)} on` : `is up to ${one(arg)}`
|
|
17299
|
+
);
|
|
17300
|
+
} else if (word === "relative") {
|
|
17301
|
+
parts.push(`is ${String(arg).replace(/_/g, " ")}`);
|
|
17302
|
+
} else if (word === "is_empty" || word === "is_not_empty") {
|
|
17303
|
+
const empty = word === "is_empty" === (arg !== false);
|
|
17304
|
+
parts.push(empty ? "is empty" : "is not empty");
|
|
17305
|
+
} else if (listSaid[word]) {
|
|
17306
|
+
const [said2, joiner] = listSaid[word];
|
|
17307
|
+
parts.push(`${said2} ${list(arg, joiner)}`);
|
|
17308
|
+
} else {
|
|
17309
|
+
parts.push(`${word.replace(/_/g, " ")} ${one(typeof arg === "object" ? JSON.stringify(arg) : arg)}`);
|
|
17310
|
+
}
|
|
17311
|
+
}
|
|
17312
|
+
const link = o["link"] === "every" ? "every linked " : o["link"] === "none" ? "no linked " : "";
|
|
17313
|
+
return `${link}${who} ${parts.length > 0 ? parts.join(" and ") : "is set"}`;
|
|
17137
17314
|
};
|
|
17138
|
-
return
|
|
17315
|
+
return keys.map((k) => clause(k, map[k])).join(" and ");
|
|
17139
17316
|
}
|
|
17140
17317
|
function conditionValue(typed2) {
|
|
17141
17318
|
const trimmed = typed2.trim();
|
|
@@ -20236,6 +20413,7 @@ function ButtonValue({ field: field2, recordId, inCell, beforeSave }) {
|
|
|
20236
20413
|
// src/editors.tsx
|
|
20237
20414
|
init_host();
|
|
20238
20415
|
init_PickOrAdd();
|
|
20416
|
+
init_PersonPicker();
|
|
20239
20417
|
init_Refusal();
|
|
20240
20418
|
|
|
20241
20419
|
// src/FloatingRefusal.tsx
|
|
@@ -23479,6 +23657,7 @@ async function saveTableDescription(client, tableId, text) {
|
|
|
23479
23657
|
init_rights();
|
|
23480
23658
|
init_plainWords();
|
|
23481
23659
|
init_names();
|
|
23660
|
+
init_PersonPicker();
|
|
23482
23661
|
|
|
23483
23662
|
// src/gridEditing.tsx
|
|
23484
23663
|
var import_react112 = require("react");
|
|
@@ -26614,6 +26793,7 @@ var import_react130 = require("@ai-matrx/records/react");
|
|
|
26614
26793
|
// src/PersonNamesBridge.tsx
|
|
26615
26794
|
var import_react127 = require("react");
|
|
26616
26795
|
var import_react128 = require("@ai-matrx/records/react");
|
|
26796
|
+
init_memberNames();
|
|
26617
26797
|
function PersonNamesBridge() {
|
|
26618
26798
|
const client = (0, import_react128.useOptionalRecordsClient)();
|
|
26619
26799
|
const roster = useMemberRoster();
|
|
@@ -38379,6 +38559,7 @@ function RecordStepper({ neighbors, onStep, expanded, onToggleExpand, full, onTo
|
|
|
38379
38559
|
|
|
38380
38560
|
// src/HistoryPanel.tsx
|
|
38381
38561
|
var import_uuid9 = require("@ai-matrx/kit/uuid");
|
|
38562
|
+
init_userIds();
|
|
38382
38563
|
var import_react217 = require("react");
|
|
38383
38564
|
init_recordVersions();
|
|
38384
38565
|
|
|
@@ -40068,6 +40249,7 @@ function roleKey(said2) {
|
|
|
40068
40249
|
|
|
40069
40250
|
// src/CommentThread.tsx
|
|
40070
40251
|
var import_uuid10 = require("@ai-matrx/kit/uuid");
|
|
40252
|
+
init_userIds();
|
|
40071
40253
|
var import_react225 = require("react");
|
|
40072
40254
|
var import_react226 = require("@ai-matrx/records/react");
|
|
40073
40255
|
var import_design_system116 = require("@ai-matrx/design-system");
|
|
@@ -55460,7 +55642,7 @@ function ThankYou({
|
|
|
55460
55642
|
// SAID TO THE PERSON WHO ANSWERED (lane HANDOVER, 2026-09-29): "Saved to Form 1, with
|
|
55461
55643
|
// this form stamped on it" was the owner's bookkeeping read out to a front-desk member
|
|
55462
55644
|
// and to strangers. Where it landed is the owner's to see on the table.
|
|
55463
|
-
|
|
55645
|
+
words2.received
|
|
55464
55646
|
) : done })
|
|
55465
55647
|
] });
|
|
55466
55648
|
}
|
|
@@ -63342,6 +63524,7 @@ init_host();
|
|
|
63342
63524
|
// src/presence.tsx
|
|
63343
63525
|
var import_react373 = require("react");
|
|
63344
63526
|
init_host();
|
|
63527
|
+
init_memberNames();
|
|
63345
63528
|
var import_jsx_runtime213 = require("react/jsx-runtime");
|
|
63346
63529
|
var NO_PEOPLE = [];
|
|
63347
63530
|
var MAX_AVATARS = 4;
|