@ai-matrx/records-ui 0.69.0 → 0.71.0

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/index.js CHANGED
@@ -530,7 +530,7 @@ function ReferenceBuilder({
530
530
 
531
531
  // src/PersonPicker.tsx
532
532
  import { useCallback, useEffect as useEffect3, useMemo as useMemo4, useState as useState4 } from "react";
533
- import { useRecordsClient as useRecordsClient3 } from "@ai-matrx/records/react";
533
+ import { useOptionalRecordsClient as useOptionalRecordsClient3 } from "@ai-matrx/records/react";
534
534
  import {
535
535
  BasicInput as BasicInput4,
536
536
  Button as Button4,
@@ -544,7 +544,7 @@ import {
544
544
  // src/editors.tsx
545
545
  import { useEffect as useEffect2, useState as useState3 } from "react";
546
546
  import { choiceValuesOf, isTheChosen, optionKey } from "@ai-matrx/records";
547
- import { useRecordsClient as useRecordsClient2 } from "@ai-matrx/records/react";
547
+ import { useOptionalRecordsClient as useOptionalRecordsClient2 } from "@ai-matrx/records/react";
548
548
  import {
549
549
  BasicInput as BasicInput3,
550
550
  BasicTextarea,
@@ -656,7 +656,7 @@ function fieldTypeLabel(field) {
656
656
 
657
657
  // src/RelationPicker.tsx
658
658
  import { useEffect, useMemo as useMemo3, useState as useState2 } from "react";
659
- import { useRecordsClient } from "@ai-matrx/records/react";
659
+ import { useOptionalRecordsClient } from "@ai-matrx/records/react";
660
660
  import {
661
661
  BasicInput as BasicInput2,
662
662
  Button as Button2,
@@ -667,8 +667,9 @@ import {
667
667
  cn as cn2
668
668
  } from "@ai-matrx/design-system";
669
669
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
670
+ var NO_STORE_ON_THIS_SCREEN_REASON = "cannot be answered on this page: it points at a record in somebody's own data, and a page answered without an account is never allowed to search that. Leave it blank and whoever receives this will fill it in.";
670
671
  function RelationPicker({ field, value, onChange, disabled, id, className, allowCreate = true }) {
671
- const client = useRecordsClient();
672
+ const client = useOptionalRecordsClient();
672
673
  const [rows, setRows] = useState2(null);
673
674
  const [words, setWords] = useState2({});
674
675
  const [refusal, setRefusal] = useState2(null);
@@ -686,7 +687,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
686
687
  );
687
688
  useEffect(() => {
688
689
  const target2 = field.relation_target;
689
- if (!target2) return;
690
+ if (!target2 || !client) return;
690
691
  let cancelled = false;
691
692
  void client.list({ table_id: target2, limit: 200 }).then((result) => {
692
693
  if (cancelled) return;
@@ -698,7 +699,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
698
699
  };
699
700
  }, [client, field.relation_target]);
700
701
  useEffect(() => {
701
- if (!rows) return;
702
+ if (!rows || !client) return;
702
703
  const wanted = [.../* @__PURE__ */ new Set([...rows.map((row) => row.id), ...picked])].filter(
703
704
  (id2) => words[id2] === void 0
704
705
  );
@@ -718,7 +719,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
718
719
  };
719
720
  }, [client, field.id, rows, picked, words]);
720
721
  useEffect(() => {
721
- if (!open || !allowCreate || target || targetRefusal) return;
722
+ if (!open || !allowCreate || target || targetRefusal || !client) return;
722
723
  const id2 = field.relation_target;
723
724
  if (!id2) return;
724
725
  let cancelled = false;
@@ -739,6 +740,13 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
739
740
  cancelled = true;
740
741
  };
741
742
  }, [client, open, allowCreate, target, targetRefusal, field.relation_target]);
743
+ if (!client) {
744
+ return /* @__PURE__ */ jsxs2("p", { id, className: cn2("text-xs text-muted-foreground", className), children: [
745
+ fieldName(field),
746
+ " ",
747
+ NO_STORE_ON_THIS_SCREEN_REASON
748
+ ] });
749
+ }
742
750
  if (!field.relation_target) {
743
751
  return /* @__PURE__ */ jsxs2("p", { className: "text-xs text-muted-foreground", children: [
744
752
  fieldName(field),
@@ -1069,10 +1077,11 @@ function JsonControl({ field, value, onChange, disabled, id }) {
1069
1077
  ] });
1070
1078
  }
1071
1079
  function OptionControl({ field, value, onChange, disabled, id }) {
1072
- const client = useRecordsClient2();
1080
+ const client = useOptionalRecordsClient2();
1073
1081
  const [options, setOptions] = useState3(null);
1074
1082
  const [refusal, setRefusal] = useState3(null);
1075
1083
  useEffect2(() => {
1084
+ if (!client) return;
1076
1085
  let cancelled = false;
1077
1086
  void client.fieldOptions({ field_id: field.id }).then((result) => {
1078
1087
  if (cancelled) return;
@@ -1083,6 +1092,23 @@ function OptionControl({ field, value, onChange, disabled, id }) {
1083
1092
  cancelled = true;
1084
1093
  };
1085
1094
  }, [client, field.id]);
1095
+ if (!client) {
1096
+ return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-1", children: [
1097
+ /* @__PURE__ */ jsx4(
1098
+ BasicInput3,
1099
+ {
1100
+ id,
1101
+ value: value === null || value === void 0 ? "" : String(value),
1102
+ disabled,
1103
+ onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
1104
+ }
1105
+ ),
1106
+ /* @__PURE__ */ jsxs3("p", { className: "text-xs text-muted-foreground", children: [
1107
+ fieldName(field),
1108
+ " is normally picked from a list. This page is answered without an account, so the list cannot be read here \u2014 type your answer and whoever receives it will match it up."
1109
+ ] })
1110
+ ] });
1111
+ }
1086
1112
  if (refusal) return /* @__PURE__ */ jsx4("p", { id, className: "text-xs text-destructive", children: refusal });
1087
1113
  if (!options) return /* @__PURE__ */ jsx4("p", { id, className: "text-xs text-muted-foreground", children: "Reading this field's choices\u2026" });
1088
1114
  if (options.length === 0) {
@@ -1167,7 +1193,7 @@ async function personRecordForMember(client, personTableId, people, member) {
1167
1193
  return written;
1168
1194
  }
1169
1195
  function PersonPicker({ field, value, onChange, disabled, id, className }) {
1170
- const client = useRecordsClient3();
1196
+ const client = useOptionalRecordsClient3();
1171
1197
  const host = useRecordsUi();
1172
1198
  const [members, setMembers] = useState4(null);
1173
1199
  const [people, setPeople] = useState4([]);
@@ -1182,7 +1208,7 @@ function PersonPicker({ field, value, onChange, disabled, id, className }) {
1182
1208
  [value]
1183
1209
  );
1184
1210
  const load = useCallback(async () => {
1185
- if (!membersPort) return;
1211
+ if (!membersPort || !client) return;
1186
1212
  const [roster, records] = await Promise.all([
1187
1213
  membersPort(),
1188
1214
  personTable ? client.list({ table_id: personTable, limit: 500 }) : Promise.resolve(null)
@@ -1199,7 +1225,7 @@ function PersonPicker({ field, value, onChange, disabled, id, className }) {
1199
1225
  void load();
1200
1226
  }, [open, load]);
1201
1227
  useEffect3(() => {
1202
- if (picked.length === 0 || !personTable || people.length > 0) return;
1228
+ if (picked.length === 0 || !personTable || people.length > 0 || !client) return;
1203
1229
  let cancelled = false;
1204
1230
  void client.list({ table_id: personTable, limit: 500 }).then((result) => {
1205
1231
  if (cancelled || !result.ok) return;
@@ -1209,7 +1235,7 @@ function PersonPicker({ field, value, onChange, disabled, id, className }) {
1209
1235
  cancelled = true;
1210
1236
  };
1211
1237
  }, [client, personTable, picked.length, people.length]);
1212
- if (!membersPort) {
1238
+ if (!membersPort || !client) {
1213
1239
  return /* @__PURE__ */ jsx5("p", { className: cn4("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
1214
1240
  }
1215
1241
  if (!personTable) {
@@ -1320,7 +1346,7 @@ function PersonPicker({ field, value, onChange, disabled, id, className }) {
1320
1346
  // src/gridEditing.tsx
1321
1347
  import { useCallback as useCallback4, useEffect as useEffect6, useMemo as useMemo7, useRef as useRef3, useState as useState7 } from "react";
1322
1348
  import { asWriteConflict } from "@ai-matrx/records/core";
1323
- import { useRecordsClient as useRecordsClient6 } from "@ai-matrx/records/react";
1349
+ import { useRecordsClient as useRecordsClient3 } from "@ai-matrx/records/react";
1324
1350
  import { Button as Button5, Checkbox as Checkbox3, cn as cn7 } from "@ai-matrx/design-system";
1325
1351
 
1326
1352
  // src/Refusal.tsx
@@ -1374,7 +1400,7 @@ function RefusalLine({ error, className }) {
1374
1400
 
1375
1401
  // src/whoChangedSource.tsx
1376
1402
  import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect4, useMemo as useMemo5, useRef, useState as useState5 } from "react";
1377
- import { useRecordsClient as useRecordsClient4 } from "@ai-matrx/records/react";
1403
+ import { useRecordsClient } from "@ai-matrx/records/react";
1378
1404
 
1379
1405
  // src/whoChanged.ts
1380
1406
  var SOMEBODY = "somebody in this organization";
@@ -1426,7 +1452,7 @@ function WhoChangedSource({
1426
1452
  labelOf,
1427
1453
  children
1428
1454
  }) {
1429
- const client = useRecordsClient4();
1455
+ const client = useRecordsClient();
1430
1456
  const host = useRecordsUi();
1431
1457
  const membersPort = host.members;
1432
1458
  const [answers, setAnswers] = useState5({});
@@ -1495,7 +1521,7 @@ import { Badge as Badge2, cn as cn6 } from "@ai-matrx/design-system";
1495
1521
 
1496
1522
  // src/labels.tsx
1497
1523
  import { createContext as createContext3, useCallback as useCallback3, useContext as useContext3, useEffect as useEffect5, useMemo as useMemo6, useRef as useRef2, useState as useState6 } from "react";
1498
- import { useRecordsClient as useRecordsClient5 } from "@ai-matrx/records/react";
1524
+ import { useRecordsClient as useRecordsClient2 } from "@ai-matrx/records/react";
1499
1525
  import { jsx as jsx8 } from "react/jsx-runtime";
1500
1526
  var LabelContext = createContext3({
1501
1527
  // With no provider the resolver is ABSENT, not silently empty: a caller gets
@@ -1523,7 +1549,7 @@ function pointsAtRecords(field) {
1523
1549
  return field.type === "list" || field.type === "relation";
1524
1550
  }
1525
1551
  function RecordLabelProvider({ children }) {
1526
- const client = useRecordsClient5();
1552
+ const client = useRecordsClient2();
1527
1553
  const [names, setNames] = useState6({});
1528
1554
  const [settled, setSettled] = useState6({});
1529
1555
  const [waitingLines, setWaitingLines] = useState6({});
@@ -1901,7 +1927,7 @@ function rememberVersion(cache, recordId, version) {
1901
1927
  if (held === void 0 || version > held) cache.set(recordId, version);
1902
1928
  }
1903
1929
  function useGridEditing({ tableId, fields, rows, reload, canWrite, mayWriteRow }) {
1904
- const client = useRecordsClient6();
1930
+ const client = useRecordsClient3();
1905
1931
  const [editing, setEditing] = useState7(null);
1906
1932
  const [draft, setDraft] = useState7(null);
1907
1933
  const typed = useRef3(null);
@@ -2448,7 +2474,7 @@ import { useCallback as useCallback6, useMemo as useMemo9, useRef as useRef4, us
2448
2474
  import {
2449
2475
  useFields as useFields3,
2450
2476
  useRecords as useRecords2,
2451
- useRecordsClient as useRecordsClient8,
2477
+ useRecordsClient as useRecordsClient5,
2452
2478
  useTable as useTable2
2453
2479
  } from "@ai-matrx/records/react";
2454
2480
  import { MatrxDataTable } from "@ai-matrx/design-system/data-table";
@@ -2626,7 +2652,7 @@ import { Button as Button8, Skeleton as Skeleton2, cn as cn9 } from "@ai-matrx/d
2626
2652
  import { useCallback as useCallback5, useEffect as useEffect7, useMemo as useMemo8, useState as useState8 } from "react";
2627
2653
  import {
2628
2654
  useFields as useFields2,
2629
- useRecordsClient as useRecordsClient7,
2655
+ useRecordsClient as useRecordsClient4,
2630
2656
  useTable
2631
2657
  } from "@ai-matrx/records/react";
2632
2658
  import {
@@ -2723,7 +2749,7 @@ function EnrichBadge({ cell, onPin, className }) {
2723
2749
  ] });
2724
2750
  }
2725
2751
  function useEnrichCells(tableId, recordIds) {
2726
- const client = useRecordsClient7();
2752
+ const client = useRecordsClient4();
2727
2753
  const [cells, setCells] = useState8(/* @__PURE__ */ new Map());
2728
2754
  const [error, setError] = useState8(null);
2729
2755
  const key = (recordIds ?? []).join(",");
@@ -2749,7 +2775,7 @@ function useEnrichCells(tableId, recordIds) {
2749
2775
  }
2750
2776
  var NEVER = "Fill it in once and leave it alone";
2751
2777
  function EnrichPanel({ tableId, fieldId, className }) {
2752
- const client = useRecordsClient7();
2778
+ const client = useRecordsClient4();
2753
2779
  const host = useRecordsUi();
2754
2780
  const table = useTable(tableId);
2755
2781
  const fields = useFields2(tableId);
@@ -3332,6 +3358,7 @@ var NO_COLUMNS_WHY = "A column is what a record holds \u2014 a name, a date, an
3332
3358
  function Grid({
3333
3359
  tableId,
3334
3360
  pageSize = 50,
3361
+ filter,
3335
3362
  onOpenRecord,
3336
3363
  onAddField,
3337
3364
  onNewRecordForm,
@@ -3343,11 +3370,11 @@ function Grid({
3343
3370
  onAskWhoChanged
3344
3371
  }) {
3345
3372
  const host = useRecordsUi();
3346
- const client = useRecordsClient8();
3373
+ const client = useRecordsClient5();
3347
3374
  const table = useTable2(tableId);
3348
3375
  const fields = useFields3(tableId);
3349
3376
  const [page, setPage] = useState10(0);
3350
- const records = useRecords2(tableId, { pageSize, page });
3377
+ const records = useRecords2(tableId, { pageSize, page, ...filter ? { filter } : {} });
3351
3378
  const rights = useTableRights(table.data);
3352
3379
  const rows = useMemo9(() => records.data?.rows ?? [], [records.data]);
3353
3380
  const rowIds = useMemo9(() => rows.map((row) => row.id), [rows]);
@@ -4083,7 +4110,7 @@ function ExportMenu({ tableId, rows, label, className }) {
4083
4110
 
4084
4111
  // src/ImportWizard.tsx
4085
4112
  import { useCallback as useCallback7, useMemo as useMemo10, useState as useState12 } from "react";
4086
- import { useFields as useFields5, useRecordsClient as useRecordsClient9, useTable as useTable3 } from "@ai-matrx/records/react";
4113
+ import { useFields as useFields5, useRecordsClient as useRecordsClient6, useTable as useTable3 } from "@ai-matrx/records/react";
4087
4114
  import {
4088
4115
  importCsv,
4089
4116
  importXlsx
@@ -4102,7 +4129,7 @@ function typeWord(t) {
4102
4129
  return fieldTypeChoice(t)?.label ?? (t === "relation" ? "Points at another table" : t);
4103
4130
  }
4104
4131
  function ImportWizard({ tableId, onDone, className }) {
4105
- const client = useRecordsClient9();
4132
+ const client = useRecordsClient6();
4106
4133
  const table = useTable3(tableId);
4107
4134
  const fields = useFields5(tableId);
4108
4135
  const rights = useTableRights(table.data);
@@ -4600,7 +4627,7 @@ function CustomFieldsSection({
4600
4627
 
4601
4628
  // src/FieldEditor.tsx
4602
4629
  import { useMemo as useMemo12, useState as useState14 } from "react";
4603
- import { useFieldMutation, useFields as useFields6, useRecords as useRecords4, useRecordsClient as useRecordsClient10, useTable as useTable4 } from "@ai-matrx/records/react";
4630
+ import { useFieldMutation, useFields as useFields6, useRecords as useRecords4, useRecordsClient as useRecordsClient7, useTable as useTable4 } from "@ai-matrx/records/react";
4604
4631
  import {
4605
4632
  BasicInput as BasicInput5,
4606
4633
  BasicTextarea as BasicTextarea2,
@@ -4642,7 +4669,7 @@ function FieldEditor({ tableId, field, onSaved, onCancel, onRemoved, className }
4642
4669
  const fields = useFields6(tableId);
4643
4670
  const rights = useTableRights(table.data);
4644
4671
  const mutation = useFieldMutation();
4645
- const client = useRecordsClient10();
4672
+ const client = useRecordsClient7();
4646
4673
  const [label, setLabel] = useState14(field?.label ?? "");
4647
4674
  const [type, setType] = useState14(() => startingType(field));
4648
4675
  const [required, setRequired] = useState14(field?.required ?? false);
@@ -5181,7 +5208,7 @@ function ValueOnTheOtherSide({
5181
5208
 
5182
5209
  // src/StageRules.tsx
5183
5210
  import { useCallback as useCallback8, useEffect as useEffect8, useMemo as useMemo13, useState as useState16 } from "react";
5184
- import { useFields as useFields7, useRecordsClient as useRecordsClient11, useTable as useTable5 } from "@ai-matrx/records/react";
5211
+ import { useFields as useFields7, useRecordsClient as useRecordsClient8, useTable as useTable5 } from "@ai-matrx/records/react";
5185
5212
  import { BasicInput as BasicInput7, BasicTextarea as BasicTextarea3, Button as Button14, Separator as Separator5, Skeleton as Skeleton3, cn as cn14 } from "@ai-matrx/design-system";
5186
5213
 
5187
5214
  // src/Condition.tsx
@@ -5519,7 +5546,7 @@ function draftOf(rule) {
5519
5546
  };
5520
5547
  }
5521
5548
  function StageRulesSection({ tableId, stage, className }) {
5522
- const client = useRecordsClient11();
5549
+ const client = useRecordsClient8();
5523
5550
  const table = useTable5(tableId);
5524
5551
  const rights = useTableRights(table.data);
5525
5552
  const fields = useFields7(tableId);
@@ -5969,17 +5996,17 @@ function TableSettings({
5969
5996
 
5970
5997
  // src/Peek.tsx
5971
5998
  import { useState as useState22 } from "react";
5972
- import { useFields as useFields10, useRecord as useRecord2, useRecordsClient as useRecordsClient14, useTable as useTable7 } from "@ai-matrx/records/react";
5999
+ import { useFields as useFields10, useRecord as useRecord2, useRecordsClient as useRecordsClient11, useTable as useTable7 } from "@ai-matrx/records/react";
5973
6000
  import { AlchemyMenu as AlchemyMenu2 } from "@ai-matrx/alchemy/react";
5974
6001
 
5975
6002
  // src/RecordChat.tsx
5976
6003
  import { useEffect as useEffect9, useMemo as useMemo14, useState as useState18 } from "react";
5977
- import { useRecordsClient as useRecordsClient12 } from "@ai-matrx/records/react";
6004
+ import { useRecordsClient as useRecordsClient9 } from "@ai-matrx/records/react";
5978
6005
  import { Skeleton as Skeleton4, cn as cn16 } from "@ai-matrx/design-system";
5979
6006
  import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
5980
6007
  var NO_CHAT_REASON = "Chatting about this record is not switched on here yet, so this panel is empty rather than showing a box that goes nowhere. It is on our list, not yours.";
5981
6008
  function RecordChat({ tableId, recordId, className }) {
5982
- const client = useRecordsClient12();
6009
+ const client = useRecordsClient9();
5983
6010
  const host = useRecordsUi();
5984
6011
  const [scope, setScope] = useState18(null);
5985
6012
  const [error, setError] = useState18(null);
@@ -6111,7 +6138,7 @@ import { Button as Button16, Separator as Separator7, cn as cn17 } from "@ai-mat
6111
6138
 
6112
6139
  // src/systemTable.ts
6113
6140
  import { useEffect as useEffect10, useMemo as useMemo15, useState as useState19 } from "react";
6114
- import { useRecordsClient as useRecordsClient13 } from "@ai-matrx/records/react";
6141
+ import { useRecordsClient as useRecordsClient10 } from "@ai-matrx/records/react";
6115
6142
  var inFlight = /* @__PURE__ */ new Map();
6116
6143
  async function ensureSystemTable(client, spec) {
6117
6144
  const cacheKey = `${client.config.organizationId}:${spec.slug}`;
@@ -6239,7 +6266,7 @@ async function declare(client, spec) {
6239
6266
  return { ok: true, data: table.data };
6240
6267
  }
6241
6268
  function useSystemTable(spec) {
6242
- const client = useRecordsClient13();
6269
+ const client = useRecordsClient10();
6243
6270
  const [state, setState] = useState19({ tableId: null, loading: true, error: null });
6244
6271
  const slug = spec.slug;
6245
6272
  const stable = useMemo15(() => spec, [slug]);
@@ -6259,7 +6286,7 @@ function useSystemTable(spec) {
6259
6286
  return state;
6260
6287
  }
6261
6288
  function useRecordVersion(recordId) {
6262
- const client = useRecordsClient13();
6289
+ const client = useRecordsClient10();
6263
6290
  const [version, setVersion] = useState19(null);
6264
6291
  useEffect10(() => {
6265
6292
  let cancelled = false;
@@ -6482,7 +6509,7 @@ function Peek({ tableId, recordId, onClose, className }) {
6482
6509
  const record = useRecord2(recordId, true);
6483
6510
  const may = useRecordRights(recordId);
6484
6511
  const host = useRecordsUi();
6485
- const organizationId = useRecordsClient14().config.organizationId;
6512
+ const organizationId = useRecordsClient11().config.organizationId;
6486
6513
  const [editing, setEditing] = useState22(false);
6487
6514
  const [talking, setTalking] = useState22(false);
6488
6515
  if (record.error) return /* @__PURE__ */ jsx24(RefusalNotice, { error: record.error, className });
@@ -6719,7 +6746,7 @@ function parseSorts(raw) {
6719
6746
 
6720
6747
  // src/ViewSwitcher.tsx
6721
6748
  import { useEffect as useEffect13, useMemo as useMemo18, useState as useState24 } from "react";
6722
- import { useFields as useFields12, useRecords as useRecords5, useRecordsClient as useRecordsClient16 } from "@ai-matrx/records/react";
6749
+ import { useFields as useFields12, useRecords as useRecords5, useRecordsClient as useRecordsClient13 } from "@ai-matrx/records/react";
6723
6750
  import { Button as Button20, Skeleton as Skeleton7, cn as cn20 } from "@ai-matrx/design-system";
6724
6751
 
6725
6752
  // src/Pipeline.tsx
@@ -6727,7 +6754,7 @@ import { useCallback as useCallback9, useEffect as useEffect12, useMemo as useMe
6727
6754
  import {
6728
6755
  mayDrag,
6729
6756
  useFields as useFields11,
6730
- useRecordsClient as useRecordsClient15
6757
+ useRecordsClient as useRecordsClient12
6731
6758
  } from "@ai-matrx/records/react";
6732
6759
  import { Button as Button19, Skeleton as Skeleton6, cn as cn19 } from "@ai-matrx/design-system";
6733
6760
  import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
@@ -6761,7 +6788,7 @@ function PipelineBoard({
6761
6788
  onMoved,
6762
6789
  className
6763
6790
  }) {
6764
- const client = useRecordsClient15();
6791
+ const client = useRecordsClient12();
6765
6792
  const fields = useFields11(tableId);
6766
6793
  const [definition, setDefinition] = useState23(null);
6767
6794
  const [columns, setColumns] = useState23([]);
@@ -7131,9 +7158,12 @@ function unplacedName(record, field, labels) {
7131
7158
  // src/ViewSwitcher.tsx
7132
7159
  import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
7133
7160
  var NO_FIELDS = [];
7134
- function useViewRecords(view, pageSize = 200) {
7135
- const client = useRecordsClient16();
7136
- const table = useRecords5(view.ruleId ? null : view.subject, { pageSize });
7161
+ function useViewRecords(view, pageSize = 200, filter) {
7162
+ const client = useRecordsClient13();
7163
+ const table = useRecords5(view.ruleId ? null : view.subject, {
7164
+ pageSize,
7165
+ ...filter ? { filter } : {}
7166
+ });
7137
7167
  const [ruled, setRuled] = useState24({
7138
7168
  rows: [],
7139
7169
  loading: Boolean(view.ruleId),
@@ -7188,6 +7218,7 @@ function ViewSwitcher({
7188
7218
  onNewRecordForm,
7189
7219
  onAskWhoChanged,
7190
7220
  pageSize = 200,
7221
+ filter,
7191
7222
  className
7192
7223
  }) {
7193
7224
  const [layout, setLayout] = useState24(view.layout);
@@ -7225,6 +7256,7 @@ function ViewSwitcher({
7225
7256
  {
7226
7257
  tableId: view.subject,
7227
7258
  pageSize,
7259
+ ...filter ? { filter } : {},
7228
7260
  ...local.presentation ?? view.presentation ? { presentation: local.presentation ?? view.presentation } : {},
7229
7261
  ...onViewChange ? { onPresentationChange: (next) => change({ presentation: next }) } : {},
7230
7262
  ...onOpenRecord ? { onOpenRecord } : {},
@@ -7236,6 +7268,7 @@ function ViewSwitcher({
7236
7268
  {
7237
7269
  view: { ...view, ...local, layout },
7238
7270
  pageSize,
7271
+ ...filter ? { filter } : {},
7239
7272
  onChange: change,
7240
7273
  remembered: Boolean(onViewChange),
7241
7274
  ...onOpenRecord ? { onOpenRecord } : {},
@@ -7252,7 +7285,7 @@ function offerableFields(all, want) {
7252
7285
  });
7253
7286
  }
7254
7287
  function useStageField(tableId) {
7255
- const client = useRecordsClient16();
7288
+ const client = useRecordsClient13();
7256
7289
  const [stage, setStage] = useState24({
7257
7290
  asked: false,
7258
7291
  key: null
@@ -7283,13 +7316,14 @@ function boardColumnChoice(fields, chosenKey, stage) {
7283
7316
  function Board({
7284
7317
  view,
7285
7318
  pageSize,
7319
+ filter,
7286
7320
  onChange,
7287
7321
  remembered,
7288
7322
  onOpenRecord,
7289
7323
  onMoved
7290
7324
  }) {
7291
7325
  const fields = useFields12(view.subject);
7292
- const records = useViewRecords(view, pageSize);
7326
+ const records = useViewRecords(view, pageSize, filter);
7293
7327
  const stage = useStageField(view.subject);
7294
7328
  if (fields.error) return /* @__PURE__ */ jsx26(RefusalNotice, { error: fields.error });
7295
7329
  if (records.error) return /* @__PURE__ */ jsx26(RefusalNotice, { error: records.error });
@@ -7529,7 +7563,7 @@ function Card2({
7529
7563
 
7530
7564
  // src/ViewBar.tsx
7531
7565
  import { useCallback as useCallback11, useEffect as useEffect14, useState as useState25 } from "react";
7532
- import { useRecordsClient as useRecordsClient17 } from "@ai-matrx/records/react";
7566
+ import { useRecordsClient as useRecordsClient14 } from "@ai-matrx/records/react";
7533
7567
  import { Button as Button21, Input as Input2, Skeleton as Skeleton8, cn as cn21 } from "@ai-matrx/design-system";
7534
7568
 
7535
7569
  // src/seedOnce.ts
@@ -7548,7 +7582,7 @@ import { useTable as useTable8 } from "@ai-matrx/records/react";
7548
7582
  import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
7549
7583
  var SAVED_VIEWS_UNAVAILABLE = "Saved views are not available in this organization right now, so the layout you pick here is not being kept. Everything else on this table works as usual.";
7550
7584
  function ViewBar({ tableId, activeViewId, onActiveView, seed, className }) {
7551
- const client = useRecordsClient17();
7585
+ const client = useRecordsClient14();
7552
7586
  const claimSeed = useSeedGuard();
7553
7587
  const table = useTable8(tableId);
7554
7588
  const rights = useTableRights(table.data);
@@ -7669,7 +7703,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, className }) {
7669
7703
 
7670
7704
  // src/ProposalRow.tsx
7671
7705
  import { useState as useState26 } from "react";
7672
- import { useRecordsClient as useRecordsClient18 } from "@ai-matrx/records/react";
7706
+ import { useRecordsClient as useRecordsClient15 } from "@ai-matrx/records/react";
7673
7707
  import { Badge as Badge7, Button as Button22, cn as cn22 } from "@ai-matrx/design-system";
7674
7708
  import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
7675
7709
  var ACT_WORD = PROPOSED_CHANGE_ACT_LABEL;
@@ -7682,7 +7716,7 @@ function ProposalRow({
7682
7716
  onSettled,
7683
7717
  className
7684
7718
  }) {
7685
- const client = useRecordsClient18();
7719
+ const client = useRecordsClient15();
7686
7720
  const [settled, setSettled] = useState26(outcome ?? null);
7687
7721
  const [busy, setBusy] = useState26(false);
7688
7722
  const [confirming, setConfirming] = useState26(false);
@@ -7771,12 +7805,12 @@ function ProposalRow({
7771
7805
 
7772
7806
  // src/ActionInbox.tsx
7773
7807
  import { useCallback as useCallback13, useEffect as useEffect16, useMemo as useMemo20, useRef as useRef7, useState as useState28 } from "react";
7774
- import { useRecordsClient as useRecordsClient20 } from "@ai-matrx/records/react";
7808
+ import { useRecordsClient as useRecordsClient17 } from "@ai-matrx/records/react";
7775
7809
  import { Badge as Badge9, Button as Button24, Skeleton as Skeleton10, cn as cn24 } from "@ai-matrx/design-system";
7776
7810
 
7777
7811
  // src/ChecklistRunner.tsx
7778
7812
  import { useCallback as useCallback12, useEffect as useEffect15, useMemo as useMemo19, useState as useState27 } from "react";
7779
- import { useRecordsClient as useRecordsClient19, useTable as useTable9 } from "@ai-matrx/records/react";
7813
+ import { useRecordsClient as useRecordsClient16, useTable as useTable9 } from "@ai-matrx/records/react";
7780
7814
  import { Badge as Badge8, BasicInput as BasicInput8, BasicTextarea as BasicTextarea4, Button as Button23, Skeleton as Skeleton9, cn as cn23 } from "@ai-matrx/design-system";
7781
7815
  import { Fragment as Fragment13, jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
7782
7816
  var DUE_WORD = DUE_STATE_LABEL;
@@ -7790,7 +7824,7 @@ function ChecklistRunner({
7790
7824
  offerToStart,
7791
7825
  className
7792
7826
  }) {
7793
- const client = useRecordsClient19();
7827
+ const client = useRecordsClient16();
7794
7828
  const table = useTable9(tableId ?? null);
7795
7829
  const rights = useTableRights(table.data);
7796
7830
  const [runs, setRuns] = useState27(null);
@@ -8039,7 +8073,7 @@ function StepRow({
8039
8073
  );
8040
8074
  }
8041
8075
  function useMyChecklistSteps(limit = 25) {
8042
- const client = useRecordsClient19();
8076
+ const client = useRecordsClient16();
8043
8077
  const me = client.config.actor.user_id ?? null;
8044
8078
  const [steps, setSteps] = useState27([]);
8045
8079
  const [loading, setLoading] = useState27(true);
@@ -8078,7 +8112,7 @@ function useMyChecklistSteps(limit = 25) {
8078
8112
  return { steps, loading, error, refresh };
8079
8113
  }
8080
8114
  function MyChecklistSteps({ className }) {
8081
- const client = useRecordsClient19();
8115
+ const client = useRecordsClient16();
8082
8116
  const { steps, loading, error, refresh } = useMyChecklistSteps();
8083
8117
  const [busy, setBusy] = useState27(null);
8084
8118
  const [refusal, setRefusal] = useState27(null);
@@ -8117,7 +8151,7 @@ function MyChecklistSteps({ className }) {
8117
8151
  ] });
8118
8152
  }
8119
8153
  function ChecklistsPanel({ tableId, onOpenRecord, className }) {
8120
- const client = useRecordsClient19();
8154
+ const client = useRecordsClient16();
8121
8155
  const table = useTable9(tableId);
8122
8156
  const rights = useTableRights(table.data);
8123
8157
  const [templates, setTemplates] = useState27(null);
@@ -8278,7 +8312,7 @@ function ChecklistTemplateEditor({
8278
8312
  onDone,
8279
8313
  className
8280
8314
  }) {
8281
- const client = useRecordsClient19();
8315
+ const client = useRecordsClient16();
8282
8316
  const [name, setName] = useState27("");
8283
8317
  const [rows, setRows] = useState27([{ ...EMPTY_ROW }]);
8284
8318
  const [refusal, setRefusal] = useState27(null);
@@ -8491,7 +8525,7 @@ var ACTION_KINDS = ["approval", "assignment", "proposal"];
8491
8525
  var KIND_WORD = WORK_INBOX_KIND_LABEL;
8492
8526
  var DUE_WORD2 = DUE_STATE_LABEL;
8493
8527
  function ActionInbox({ tableId, includeSettled = false, onOpenRecord, className }) {
8494
- const client = useRecordsClient20();
8528
+ const client = useRecordsClient17();
8495
8529
  const [items, setItems] = useState28(null);
8496
8530
  const [error, setError] = useState28(null);
8497
8531
  const [outcome, setOutcome] = useState28({});
@@ -8648,13 +8682,13 @@ function ActionInbox({ tableId, includeSettled = false, onOpenRecord, className
8648
8682
  import { useCallback as useCallback14, useEffect as useEffect17, useRef as useRef8, useState as useState29 } from "react";
8649
8683
  import {
8650
8684
  useFields as useFields13,
8651
- useRecordsClient as useRecordsClient21,
8685
+ useRecordsClient as useRecordsClient18,
8652
8686
  useTable as useTable10
8653
8687
  } from "@ai-matrx/records/react";
8654
8688
  import { Badge as Badge10, Button as Button25, Skeleton as Skeleton11, cn as cn25 } from "@ai-matrx/design-system";
8655
8689
  import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
8656
8690
  function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
8657
- const client = useRecordsClient21();
8691
+ const client = useRecordsClient18();
8658
8692
  const table = useTable10(tableId);
8659
8693
  const fields = useFields13(tableId);
8660
8694
  const rights = useTableRights(table.data);
@@ -8957,13 +8991,13 @@ function say(value, field) {
8957
8991
  import { useCallback as useCallback15, useEffect as useEffect18, useMemo as useMemo21, useRef as useRef9, useState as useState30 } from "react";
8958
8992
  import {
8959
8993
  useFields as useFields14,
8960
- useRecordsClient as useRecordsClient22,
8994
+ useRecordsClient as useRecordsClient19,
8961
8995
  useTable as useTable11
8962
8996
  } from "@ai-matrx/records/react";
8963
8997
  import { Badge as Badge11, Button as Button26, Skeleton as Skeleton12, Textarea, cn as cn26 } from "@ai-matrx/design-system";
8964
8998
  import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
8965
8999
  function CommentThread({ tableId, recordId, fieldKey, className }) {
8966
- const client = useRecordsClient22();
9000
+ const client = useRecordsClient19();
8967
9001
  const table = useTable11(tableId);
8968
9002
  const fields = useFields14(tableId);
8969
9003
  const host = useRecordsUi();
@@ -9200,7 +9234,7 @@ function Line({
9200
9234
  import { useCallback as useCallback16, useEffect as useEffect19, useState as useState31 } from "react";
9201
9235
  import {
9202
9236
  useFields as useFields15,
9203
- useRecordsClient as useRecordsClient23,
9237
+ useRecordsClient as useRecordsClient20,
9204
9238
  useTable as useTable12
9205
9239
  } from "@ai-matrx/records/react";
9206
9240
  import { Badge as Badge12, Button as Button27, Skeleton as Skeleton13, cn as cn27 } from "@ai-matrx/design-system";
@@ -9213,7 +9247,7 @@ function FieldHistoryPanel({
9213
9247
  onOpenRecord,
9214
9248
  className
9215
9249
  }) {
9216
- const client = useRecordsClient23();
9250
+ const client = useRecordsClient20();
9217
9251
  const table = useTable12(tableId);
9218
9252
  const fields = useFields15(tableId);
9219
9253
  const rights = useTableRights(table.data);
@@ -9426,12 +9460,12 @@ function submissionStamp(args) {
9426
9460
 
9427
9461
  // src/PortalBuilder.tsx
9428
9462
  import { useCallback as useCallback17, useEffect as useEffect20, useMemo as useMemo22, useState as useState32 } from "react";
9429
- import { useRecordsClient as useRecordsClient24, useTables as useTables3 } from "@ai-matrx/records/react";
9463
+ import { useRecordsClient as useRecordsClient21, useTables as useTables3 } from "@ai-matrx/records/react";
9430
9464
  import { BasicInput as BasicInput9, Button as Button28, Checkbox as Checkbox5, Label as Label5, Separator as Separator9, Skeleton as Skeleton14, cn as cn28 } from "@ai-matrx/design-system";
9431
9465
  import { Fragment as Fragment15, jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
9432
9466
  var RESTATING_REPLACES = "Saving replaces what this portal shows: a table you untick stops being visible to every client the moment you save. Who is invited is not touched.";
9433
9467
  function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
9434
- const client = useRecordsClient24();
9468
+ const client = useRecordsClient21();
9435
9469
  const tables = useTables3();
9436
9470
  const [title, setTitle] = useState32("");
9437
9471
  const [clientTableId, setClientTableId] = useState32(null);
@@ -9721,7 +9755,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
9721
9755
 
9722
9756
  // src/PortalsPanel.tsx
9723
9757
  import { useCallback as useCallback18, useEffect as useEffect21, useMemo as useMemo23, useState as useState33 } from "react";
9724
- import { useRecordsClient as useRecordsClient25 } from "@ai-matrx/records/react";
9758
+ import { useRecordsClient as useRecordsClient22 } from "@ai-matrx/records/react";
9725
9759
  import {
9726
9760
  portalPath
9727
9761
  } from "@ai-matrx/records";
@@ -9788,7 +9822,7 @@ function stateWords(person) {
9788
9822
  }
9789
9823
  var PORTAL_SUGGESTION = "Let each of my customers sign in and see their own jobs and invoices, and nothing else.";
9790
9824
  function PortalsPanel({ tableId, className }) {
9791
- const client = useRecordsClient25();
9825
+ const client = useRecordsClient22();
9792
9826
  const host = useRecordsUi();
9793
9827
  const [portals, setPortals] = useState33(null);
9794
9828
  const [exposures, setExposures] = useState33([]);
@@ -9971,7 +10005,7 @@ function PortalDetail({
9971
10005
  origin,
9972
10006
  onChanged
9973
10007
  }) {
9974
- const client = useRecordsClient25();
10008
+ const client = useRecordsClient22();
9975
10009
  const [card, setCard] = useState33(null);
9976
10010
  const [error, setError] = useState33(null);
9977
10011
  const load = useCallback18(async () => {
@@ -10214,7 +10248,7 @@ function Preview({
10214
10248
  ] });
10215
10249
  }
10216
10250
  function Invite({ card, onInvited }) {
10217
- const client = useRecordsClient25();
10251
+ const client = useRecordsClient22();
10218
10252
  const [rows, setRows] = useState33(null);
10219
10253
  const [clientTable, setClientTable] = useState33(null);
10220
10254
  const [search, setSearch] = useState33("");
@@ -10326,7 +10360,7 @@ function Invite({ card, onInvited }) {
10326
10360
 
10327
10361
  // src/DigestScheduler.tsx
10328
10362
  import { useCallback as useCallback19, useEffect as useEffect22, useMemo as useMemo24, useState as useState34 } from "react";
10329
- import { useRecordsClient as useRecordsClient26 } from "@ai-matrx/records/react";
10363
+ import { useRecordsClient as useRecordsClient23 } from "@ai-matrx/records/react";
10330
10364
  import { BasicInput as BasicInput11, Button as Button31, Checkbox as Checkbox6, Label as Label6, Separator as Separator11, Skeleton as Skeleton16, cn as cn31 } from "@ai-matrx/design-system";
10331
10365
  import { Fragment as Fragment17, jsx as jsx37, jsxs as jsxs33 } from "react/jsx-runtime";
10332
10366
  var WEEKDAYS = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
@@ -10350,7 +10384,7 @@ function DigestScheduler({
10350
10384
  onClose,
10351
10385
  className
10352
10386
  }) {
10353
- const client = useRecordsClient26();
10387
+ const client = useRecordsClient23();
10354
10388
  const host = useRecordsUi();
10355
10389
  const [views, setViews] = useState34(null);
10356
10390
  const [cadences, setCadences] = useState34([]);
@@ -10620,7 +10654,7 @@ function DigestScheduler({
10620
10654
 
10621
10655
  // src/SubscriptionsPanel.tsx
10622
10656
  import { useCallback as useCallback20, useEffect as useEffect23, useState as useState35 } from "react";
10623
- import { useRecordsClient as useRecordsClient27 } from "@ai-matrx/records/react";
10657
+ import { useRecordsClient as useRecordsClient24 } from "@ai-matrx/records/react";
10624
10658
  import { Badge as Badge14, Button as Button32, Skeleton as Skeleton17, Switch as Switch2, cn as cn32 } from "@ai-matrx/design-system";
10625
10659
  import { jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
10626
10660
  function whenItFires(subscription) {
@@ -10631,7 +10665,7 @@ function whenItFires(subscription) {
10631
10665
  var CHANNEL_WORDS2 = SUBSCRIPTION_CHANNEL_LABEL;
10632
10666
  var DIGEST_SUGGESTION = "Email me a summary of this every Monday at 8 in the morning.";
10633
10667
  function SubscriptionsPanel({ tableId, className }) {
10634
- const client = useRecordsClient27();
10668
+ const client = useRecordsClient24();
10635
10669
  const [rows, setRows] = useState35(null);
10636
10670
  const [error, setError] = useState35(null);
10637
10671
  const [busy, setBusy] = useState35(null);
@@ -10801,7 +10835,7 @@ function SubscriptionsPanel({ tableId, className }) {
10801
10835
 
10802
10836
  // src/FormBuilder.tsx
10803
10837
  import { useCallback as useCallback22, useEffect as useEffect25, useMemo as useMemo26, useState as useState37 } from "react";
10804
- import { useFields as useFields17, useRecordsClient as useRecordsClient28, useTable as useTable13 } from "@ai-matrx/records/react";
10838
+ import { useFields as useFields17, useRecordsClient as useRecordsClient25, useTable as useTable13 } from "@ai-matrx/records/react";
10805
10839
  import { publicFormPath } from "@ai-matrx/records";
10806
10840
  import {
10807
10841
  BasicInput as BasicInput12,
@@ -10815,7 +10849,7 @@ import {
10815
10849
 
10816
10850
  // src/FormRunner.tsx
10817
10851
  import { useCallback as useCallback21, useEffect as useEffect24, useMemo as useMemo25, useRef as useRef10, useState as useState36 } from "react";
10818
- import { useFields as useFields16, useOptionalRecordsClient } from "@ai-matrx/records/react";
10852
+ import { useFields as useFields16, useOptionalRecordsClient as useOptionalRecordsClient4 } from "@ai-matrx/records/react";
10819
10853
  import { Button as Button33, Progress, Skeleton as Skeleton18, cn as cn33 } from "@ai-matrx/design-system";
10820
10854
  import { Fragment as Fragment18, jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
10821
10855
  function FormRunner(props) {
@@ -10825,7 +10859,7 @@ function FormRunner(props) {
10825
10859
  return /* @__PURE__ */ jsx39(ConnectedFormRunner, { ...props });
10826
10860
  }
10827
10861
  function ConnectedFormRunner(props) {
10828
- const client = useOptionalRecordsClient();
10862
+ const client = useOptionalRecordsClient4();
10829
10863
  const fields = useFields16(props.form.subject);
10830
10864
  const { form, className } = props;
10831
10865
  const submit = useCallback21(
@@ -11130,7 +11164,7 @@ function whyNotAskable(fields, hidden = []) {
11130
11164
  // src/FormBuilder.tsx
11131
11165
  import { Fragment as Fragment19, jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
11132
11166
  function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
11133
- const client = useRecordsClient28();
11167
+ const client = useRecordsClient25();
11134
11168
  const host = useRecordsUi();
11135
11169
  const claimSeed = useSeedGuard();
11136
11170
  const table = useTable13(tableId);
@@ -11715,11 +11749,11 @@ function isSignatureField(field) {
11715
11749
 
11716
11750
  // src/DocTemplate.tsx
11717
11751
  import { useCallback as useCallback23, useEffect as useEffect27, useState as useState39 } from "react";
11718
- import { useFields as useFields18, useRecordsClient as useRecordsClient29, useTable as useTable14 } from "@ai-matrx/records/react";
11752
+ import { useFields as useFields18, useRecordsClient as useRecordsClient26, useTable as useTable14 } from "@ai-matrx/records/react";
11719
11753
  import { BasicInput as BasicInput13, BasicTextarea as BasicTextarea6, Button as Button35, Label as Label8, Skeleton as Skeleton20, cn as cn36 } from "@ai-matrx/design-system";
11720
11754
  import { jsx as jsx42, jsxs as jsxs38 } from "react/jsx-runtime";
11721
11755
  function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, className }) {
11722
- const client = useRecordsClient29();
11756
+ const client = useRecordsClient26();
11723
11757
  const claimSeed = useSeedGuard();
11724
11758
  const table = useTable14(tableId);
11725
11759
  const rights = useTableRights(table.data);
@@ -11894,11 +11928,11 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
11894
11928
 
11895
11929
  // src/DocRender.tsx
11896
11930
  import { useCallback as useCallback24, useEffect as useEffect28, useRef as useRef12, useState as useState40 } from "react";
11897
- import { useRecordsClient as useRecordsClient30 } from "@ai-matrx/records/react";
11931
+ import { useRecordsClient as useRecordsClient27 } from "@ai-matrx/records/react";
11898
11932
  import { Button as Button36, Skeleton as Skeleton21, cn as cn37 } from "@ai-matrx/design-system";
11899
11933
  import { jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
11900
11934
  function DocRender({ templateId, recordId, filename, onRendered, className }) {
11901
- const client = useRecordsClient30();
11935
+ const client = useRecordsClient27();
11902
11936
  const [preview, setPreview] = useState40(null);
11903
11937
  const [renders, setRenders] = useState40(null);
11904
11938
  const [showing, setShowing] = useState40(null);
@@ -12007,12 +12041,12 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
12007
12041
 
12008
12042
  // src/SignBlock.tsx
12009
12043
  import { useCallback as useCallback25, useEffect as useEffect29, useState as useState41 } from "react";
12010
- import { useFields as useFields19, useRecordsClient as useRecordsClient31 } from "@ai-matrx/records/react";
12044
+ import { useFields as useFields19, useRecordsClient as useRecordsClient28 } from "@ai-matrx/records/react";
12011
12045
  import { BasicInput as BasicInput14, Button as Button37, Skeleton as Skeleton22, cn as cn38 } from "@ai-matrx/design-system";
12012
12046
  import { useTable as useTable15 } from "@ai-matrx/records/react";
12013
12047
  import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
12014
12048
  function SignBlock({ tableId, recordId, render, className }) {
12015
- const client = useRecordsClient31();
12049
+ const client = useRecordsClient28();
12016
12050
  const table = useTable15(tableId);
12017
12051
  const rights = useTableRights(table.data);
12018
12052
  const fields = useFields19(tableId);
@@ -12144,13 +12178,13 @@ function SignBlock({ tableId, recordId, render, className }) {
12144
12178
 
12145
12179
  // src/NotifyRuleEditor.tsx
12146
12180
  import { useCallback as useCallback26, useEffect as useEffect30, useState as useState42 } from "react";
12147
- import { useRecordsClient as useRecordsClient32, useTable as useTable16 } from "@ai-matrx/records/react";
12181
+ import { useRecordsClient as useRecordsClient29, useTable as useTable16 } from "@ai-matrx/records/react";
12148
12182
  import { Button as Button38, Skeleton as Skeleton23, cn as cn39 } from "@ai-matrx/design-system";
12149
12183
  import { jsx as jsx45, jsxs as jsxs41 } from "react/jsx-runtime";
12150
12184
  var CADENCE_WORDS2 = SUBSCRIPTION_CADENCE_LABEL;
12151
12185
  var CHANNEL_WORDS3 = SUBSCRIPTION_CHANNEL_LABEL;
12152
12186
  function NotifyRuleEditor({ tableId, seed, className }) {
12153
- const client = useRecordsClient32();
12187
+ const client = useRecordsClient29();
12154
12188
  const host = useRecordsUi();
12155
12189
  const table = useTable16(tableId);
12156
12190
  const rights = useTableRights(table.data);
@@ -12664,11 +12698,11 @@ function Drawing({
12664
12698
 
12665
12699
  // src/DashboardCanvas.tsx
12666
12700
  import { useCallback as useCallback27, useEffect as useEffect31, useMemo as useMemo28, useState as useState43 } from "react";
12667
- import { useFields as useFields20, useRecordsClient as useRecordsClient33, useTable as useTable17 } from "@ai-matrx/records/react";
12701
+ import { useFields as useFields20, useRecordsClient as useRecordsClient30, useTable as useTable17 } from "@ai-matrx/records/react";
12668
12702
  import { BasicInput as BasicInput15, Button as Button39, Skeleton as Skeleton24, cn as cn41 } from "@ai-matrx/design-system";
12669
12703
  import { Fragment as Fragment21, jsx as jsx47, jsxs as jsxs43 } from "react/jsx-runtime";
12670
12704
  function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
12671
- const client = useRecordsClient33();
12705
+ const client = useRecordsClient30();
12672
12706
  const host = useRecordsUi();
12673
12707
  const table = useTable17(tableId);
12674
12708
  const rights = useTableRights(table.data);
@@ -12852,14 +12886,20 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
12852
12886
  rights.admin ? /* @__PURE__ */ jsx47(Button39, { size: "sm", variant: "ghost", onClick: () => void remove(board), children: "Delete" }) : null
12853
12887
  ] }) : null
12854
12888
  ] }),
12855
- board && scheduling ? /* @__PURE__ */ jsx47(
12856
- DigestScheduler,
12857
- {
12858
- tableId,
12859
- subjectName: board.name,
12860
- ...filter ? { filters: filter } : {},
12861
- onClose: () => setScheduling(false)
12862
- }
12889
+ board && scheduling ? (
12890
+ // ONE SHAPE, SO NO CAST. The dashboard's own filter, the saved view it
12891
+ // schedules over and the drill-through it opens are all the same
12892
+ // `RecordFilter`; the `as Record<string, unknown>` that used to be here
12893
+ // was the seam where they could have drifted.
12894
+ /* @__PURE__ */ jsx47(
12895
+ DigestScheduler,
12896
+ {
12897
+ tableId,
12898
+ subjectName: board.name,
12899
+ ...filter ? { filters: filter } : {},
12900
+ onClose: () => setScheduling(false)
12901
+ }
12902
+ )
12863
12903
  ) : null,
12864
12904
  board ? /* @__PURE__ */ jsxs43("div", { className: "flex flex-col gap-1", children: [
12865
12905
  /* @__PURE__ */ jsxs43("div", { className: "flex items-center gap-1", children: [
@@ -12921,7 +12961,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
12921
12961
 
12922
12962
  // src/FormsPanel.tsx
12923
12963
  import { useCallback as useCallback28, useEffect as useEffect32, useState as useState44 } from "react";
12924
- import { useRecordsClient as useRecordsClient34, useTable as useTable18 } from "@ai-matrx/records/react";
12964
+ import { useRecordsClient as useRecordsClient31, useTable as useTable18 } from "@ai-matrx/records/react";
12925
12965
  import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
12926
12966
  import { Badge as Badge15, Button as Button40, Skeleton as Skeleton25, cn as cn42 } from "@ai-matrx/design-system";
12927
12967
  import { Fragment as Fragment22, jsx as jsx48, jsxs as jsxs44 } from "react/jsx-runtime";
@@ -12932,7 +12972,7 @@ function formSuggestion(tableName2) {
12932
12972
  return `Make me a form that collects new ${subject} entries and tells me when somebody answers.`;
12933
12973
  }
12934
12974
  function FormsPanel({ tableId, className }) {
12935
- const client = useRecordsClient34();
12975
+ const client = useRecordsClient31();
12936
12976
  const host = useRecordsUi();
12937
12977
  const table = useTable18(tableId);
12938
12978
  const rights = useTableRights(table.data);
@@ -13068,7 +13108,7 @@ function FormsPanel({ tableId, className }) {
13068
13108
 
13069
13109
  // src/BookingBuilder.tsx
13070
13110
  import { useCallback as useCallback29, useEffect as useEffect33, useMemo as useMemo29, useState as useState45 } from "react";
13071
- import { useFields as useFields21, useRecordsClient as useRecordsClient35, useTable as useTable19 } from "@ai-matrx/records/react";
13111
+ import { useFields as useFields21, useRecordsClient as useRecordsClient32, useTable as useTable19 } from "@ai-matrx/records/react";
13072
13112
  import {
13073
13113
  bookingPath
13074
13114
  } from "@ai-matrx/records";
@@ -13098,7 +13138,7 @@ function draftWindows(availability) {
13098
13138
  });
13099
13139
  }
13100
13140
  function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
13101
- const client = useRecordsClient35();
13141
+ const client = useRecordsClient32();
13102
13142
  const host = useRecordsUi();
13103
13143
  const table = useTable19(tableId);
13104
13144
  const rights = useTableRights(table.data);
@@ -13415,7 +13455,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
13415
13455
 
13416
13456
  // src/BookingSlots.tsx
13417
13457
  import { useCallback as useCallback30, useEffect as useEffect34, useMemo as useMemo30, useState as useState46 } from "react";
13418
- import { useRecordsClient as useRecordsClient36, useMyLevels as useMyLevels2 } from "@ai-matrx/records/react";
13458
+ import { useRecordsClient as useRecordsClient33, useMyLevels as useMyLevels2 } from "@ai-matrx/records/react";
13419
13459
  import { bookingPath as bookingPath2 } from "@ai-matrx/records";
13420
13460
  import { Badge as Badge16, Button as Button42, Skeleton as Skeleton27, cn as cn44 } from "@ai-matrx/design-system";
13421
13461
  import { Fragment as Fragment24, jsx as jsx50, jsxs as jsxs46 } from "react/jsx-runtime";
@@ -13427,7 +13467,7 @@ function bookingSuggestion(tableName2) {
13427
13467
  var NO_ADMIN2 = "Opening a booking page lets people with no account take time in your calendar, so it needs the admin level on the table the appointments land in.";
13428
13468
  var STATE_WORDS = BOOKING_PAGE_STATE_LABEL;
13429
13469
  function BookingSlots({ tableId, className }) {
13430
- const client = useRecordsClient36();
13470
+ const client = useRecordsClient33();
13431
13471
  const host = useRecordsUi();
13432
13472
  const [pages, setPages] = useState46(null);
13433
13473
  const [error, setError] = useState46(null);
@@ -13615,7 +13655,7 @@ function nextInWords(page) {
13615
13655
 
13616
13656
  // src/CaptureSheet.tsx
13617
13657
  import { useCallback as useCallback32, useEffect as useEffect36, useRef as useRef14, useState as useState48 } from "react";
13618
- import { useFields as useFields22, useRecordsClient as useRecordsClient38, useTable as useTable20 } from "@ai-matrx/records/react";
13658
+ import { useFields as useFields22, useRecordsClient as useRecordsClient35, useTable as useTable20 } from "@ai-matrx/records/react";
13619
13659
  import { Button as Button44, Input as Input4, Skeleton as Skeleton29, Textarea as Textarea3, cn as cn46 } from "@ai-matrx/design-system";
13620
13660
 
13621
13661
  // src/CaptureRun.tsx
@@ -13625,7 +13665,7 @@ import {
13625
13665
  coercionLabel,
13626
13666
  openCaptureQueue
13627
13667
  } from "@ai-matrx/records";
13628
- import { useRecordsClient as useRecordsClient37 } from "@ai-matrx/records/react";
13668
+ import { useRecordsClient as useRecordsClient34 } from "@ai-matrx/records/react";
13629
13669
  import { Button as Button43, Input as Input3, Skeleton as Skeleton28, Textarea as Textarea2, cn as cn45 } from "@ai-matrx/design-system";
13630
13670
  import { jsx as jsx51, jsxs as jsxs47 } from "react/jsx-runtime";
13631
13671
  function controlFor(field) {
@@ -13664,7 +13704,7 @@ function whereWeAre(timeoutMs = 4e3) {
13664
13704
  });
13665
13705
  }
13666
13706
  function CaptureRun({ sheetId, face: given, className }) {
13667
- const client = useRecordsClient37();
13707
+ const client = useRecordsClient34();
13668
13708
  const host = useRecordsUi();
13669
13709
  const [face, setFace] = useState47(given);
13670
13710
  const [loadFailed, setLoadFailed] = useState47(null);
@@ -14026,7 +14066,7 @@ function AdHocCaptureSheet({
14026
14066
  attachmentField,
14027
14067
  className
14028
14068
  }) {
14029
- const client = useRecordsClient38();
14069
+ const client = useRecordsClient35();
14030
14070
  const host = useRecordsUi();
14031
14071
  const table = useTable20(tableId);
14032
14072
  const fields = useFields22(tableId);
@@ -14228,11 +14268,11 @@ function AdHocCaptureSheet({
14228
14268
 
14229
14269
  // src/PortalShell.tsx
14230
14270
  import { useCallback as useCallback33, useEffect as useEffect37, useState as useState49 } from "react";
14231
- import { useRecordsClient as useRecordsClient39 } from "@ai-matrx/records/react";
14271
+ import { useRecordsClient as useRecordsClient36 } from "@ai-matrx/records/react";
14232
14272
  import { Button as Button45, Skeleton as Skeleton30, cn as cn47 } from "@ai-matrx/design-system";
14233
14273
  import { jsx as jsx53, jsxs as jsxs49 } from "react/jsx-runtime";
14234
14274
  function PortalShell({ tableId, form, resourceType = "record", className }) {
14235
- const client = useRecordsClient39();
14275
+ const client = useRecordsClient36();
14236
14276
  const [card, setCard] = useState49(null);
14237
14277
  const [reach, setReach] = useState49(null);
14238
14278
  const [error, setError] = useState49(null);
@@ -14311,7 +14351,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
14311
14351
  ] });
14312
14352
  }
14313
14353
  function PortalRow({ tableId, recordId }) {
14314
- const client = useRecordsClient39();
14354
+ const client = useRecordsClient36();
14315
14355
  const [title, setTitle] = useState49(null);
14316
14356
  useEffect37(() => {
14317
14357
  let cancelled = false;
@@ -14334,11 +14374,11 @@ function PortalRow({ tableId, recordId }) {
14334
14374
 
14335
14375
  // src/PublicViewPage.tsx
14336
14376
  import { useCallback as useCallback34, useEffect as useEffect38, useState as useState50 } from "react";
14337
- import { useRecordsClient as useRecordsClient40 } from "@ai-matrx/records/react";
14377
+ import { useRecordsClient as useRecordsClient37 } from "@ai-matrx/records/react";
14338
14378
  import { Skeleton as Skeleton31, cn as cn48 } from "@ai-matrx/design-system";
14339
14379
  import { jsx as jsx54, jsxs as jsxs50 } from "react/jsx-runtime";
14340
14380
  function PublicViewPage({ slug, className }) {
14341
- const client = useRecordsClient40();
14381
+ const client = useRecordsClient37();
14342
14382
  const [binding, setBinding] = useState50(null);
14343
14383
  const [rows, setRows] = useState50(null);
14344
14384
  const [fields, setFields] = useState50(null);
@@ -14415,7 +14455,7 @@ function PublicRow({ row, fields }) {
14415
14455
 
14416
14456
  // src/EmbedFrame.tsx
14417
14457
  import { useCallback as useCallback35, useEffect as useEffect39, useState as useState51 } from "react";
14418
- import { useRecordsClient as useRecordsClient41 } from "@ai-matrx/records/react";
14458
+ import { useRecordsClient as useRecordsClient38 } from "@ai-matrx/records/react";
14419
14459
  import { Button as Button46, Input as Input5, Skeleton as Skeleton32, Textarea as Textarea4, cn as cn49 } from "@ai-matrx/design-system";
14420
14460
  import { useTable as useTable21 } from "@ai-matrx/records/react";
14421
14461
  import { Fragment as Fragment26, jsx as jsx55, jsxs as jsxs51 } from "react/jsx-runtime";
@@ -14427,7 +14467,7 @@ function EmbedFrame({
14427
14467
  embedUrl,
14428
14468
  className
14429
14469
  }) {
14430
- const client = useRecordsClient41();
14470
+ const client = useRecordsClient38();
14431
14471
  const host = useRecordsUi();
14432
14472
  const table = useTable21(tableId);
14433
14473
  const rights = useTableRights(table.data);
@@ -14521,7 +14561,7 @@ function EmbedFrame({
14521
14561
  ] });
14522
14562
  }
14523
14563
  function useEmbedHandshake(args) {
14524
- const client = useRecordsClient41();
14564
+ const client = useRecordsClient38();
14525
14565
  const [binding, setBinding] = useState51(null);
14526
14566
  const [error, setError] = useState51(null);
14527
14567
  const [loading, setLoading] = useState51(true);
@@ -14583,7 +14623,7 @@ function recordsDataSource(client, fallbackSchema = "custom") {
14583
14623
 
14584
14624
  // src/TablesHome.tsx
14585
14625
  import { useCallback as useCallback36, useEffect as useEffect40, useState as useState52 } from "react";
14586
- import { useRecordsClient as useRecordsClient42, useTables as useTables4 } from "@ai-matrx/records/react";
14626
+ import { useRecordsClient as useRecordsClient39, useTables as useTables4 } from "@ai-matrx/records/react";
14587
14627
  import { BasicInput as BasicInput17, Button as Button47, Skeleton as Skeleton33, cn as cn50 } from "@ai-matrx/design-system";
14588
14628
 
14589
14629
  // src/createTable.ts
@@ -14719,7 +14759,7 @@ function laneFor(table) {
14719
14759
  return "organization";
14720
14760
  }
14721
14761
  function TablesHome({ onOpenTable, className }) {
14722
- const client = useRecordsClient42();
14762
+ const client = useRecordsClient39();
14723
14763
  const tables = useTables4();
14724
14764
  const [creating, setCreating] = useState52(false);
14725
14765
  const [name, setName] = useState52("");
@@ -14862,12 +14902,38 @@ function TablesHome({ onOpenTable, className }) {
14862
14902
 
14863
14903
  // src/TablePage.tsx
14864
14904
  import { useCallback as useCallback37, useEffect as useEffect41, useState as useState53 } from "react";
14865
- import { useRecordsClient as useRecordsClient43, useTable as useTable22 } from "@ai-matrx/records/react";
14905
+ import { useFields as useFields23, useRecordsClient as useRecordsClient40, useTable as useTable22 } from "@ai-matrx/records/react";
14866
14906
  import { Button as Button48, Separator as Separator12, Skeleton as Skeleton34, cn as cn51 } from "@ai-matrx/design-system";
14867
14907
  import { Fragment as Fragment28, jsx as jsx58, jsxs as jsxs53 } from "react/jsx-runtime";
14868
- function cameFromLine(label, groupField) {
14869
- const grouped = groupField ? `grouped into the same columns the chart used` : `for this table`;
14870
- return `You came here from \u201C${label}\u201D. This is every record ${grouped} \u2014 not only the ones that number counted \u2014 so the column you clicked is here with the rest beside it.`;
14908
+ function filterInWords(filter, fields) {
14909
+ const nameOf = (key) => {
14910
+ const field = fields.find((f) => f.key === key);
14911
+ return field ? fieldName(field) : humanize(key);
14912
+ };
14913
+ const parts = Object.keys(filter).map((key) => {
14914
+ const value = filter[key];
14915
+ if (value === null || value === void 0) return `${nameOf(key)} is not filled in`;
14916
+ if (typeof value === "object") {
14917
+ const from = (value.from ?? "").toString().trim();
14918
+ const to = (value.to ?? "").toString().trim();
14919
+ if (from !== "" && to !== "") return `${nameOf(key)} from ${from} up to ${to}`;
14920
+ if (from !== "") return `${nameOf(key)} from ${from} onwards`;
14921
+ if (to !== "") return `${nameOf(key)} up to ${to}`;
14922
+ return `${nameOf(key)} in a period nobody named`;
14923
+ }
14924
+ return `${nameOf(key)} is ${String(value)}`;
14925
+ });
14926
+ if (parts.length === 0) return "";
14927
+ if (parts.length === 1) return parts[0];
14928
+ return `${parts.slice(0, -1).join(", ")} and ${parts[parts.length - 1]}`;
14929
+ }
14930
+ function cameFromLine(label, groupField, question) {
14931
+ const asked = (question ?? "").trim();
14932
+ if (asked === "") {
14933
+ const grouped = groupField ? " grouped into the same columns the chart used" : "";
14934
+ return `You came here from \u201C${label}\u201D. This is every record in this table${grouped} \u2014 that number was counted over all of them.`;
14935
+ }
14936
+ return `You came here from \u201C${label}\u201D. These are only the records that number counted: ${asked}. Everything else in this table is being held back \u2014 clear the filter to see all of it.`;
14871
14937
  }
14872
14938
  var TABLE_NOT_REACHABLE = "This table is not in the organization you are working in, so there is nothing here to show. Switch to the organization that owns it and open it again \u2014 or it may have been deleted.";
14873
14939
  var DEFAULT_VIEW_NAME = "All records";
@@ -14914,12 +14980,15 @@ function TablePage({
14914
14980
  onViewChanged,
14915
14981
  activeGroupField,
14916
14982
  cameFrom,
14983
+ filter,
14917
14984
  className
14918
14985
  }) {
14919
- const client = useRecordsClient43();
14986
+ const client = useRecordsClient40();
14920
14987
  const table = useTable22(tableId);
14921
14988
  const rights = useTableRights(table.data);
14922
- const organizationId = useRecordsClient43().config.organizationId;
14989
+ const pageFields = useFields23(filter ? tableId : null);
14990
+ const askedInWords = filter ? filterInWords(filter, pageFields.data ?? []) : null;
14991
+ const organizationId = useRecordsClient40().config.organizationId;
14923
14992
  const [view, setView] = useState53(null);
14924
14993
  const opening = openingRail(activeRecordId);
14925
14994
  const opened = openingView(activeView, activeDashboardId);
@@ -15112,7 +15181,7 @@ function TablePage({
15112
15181
  {
15113
15182
  "data-testid": "came-from-a-number",
15114
15183
  className: "rounded-md border px-3 py-2 text-xs leading-relaxed text-muted-foreground",
15115
- children: cameFromLine(cameFrom, activeGroupField ?? null)
15184
+ children: cameFromLine(cameFrom, activeGroupField ?? null, askedInWords)
15116
15185
  }
15117
15186
  ) : null,
15118
15187
  /* @__PURE__ */ jsx58(
@@ -15126,6 +15195,7 @@ function TablePage({
15126
15195
  ...activeGroupField ? { groupField: activeGroupField } : {}
15127
15196
  },
15128
15197
  pageSize,
15198
+ ...filter ? { filter } : {},
15129
15199
  onLayoutChange: (layout) => {
15130
15200
  setLayoutFromLink(layout);
15131
15201
  onViewChanged?.(layout);