@ai-matrx/records-ui 0.59.0 → 0.61.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/CHANGELOG.md +38 -0
- package/dist/index.cjs +966 -651
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +133 -4
- package/dist/index.d.ts +133 -4
- package/dist/index.js +856 -541
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -262,11 +262,17 @@ function recordName(document2, titleKey, fallback = "Untitled") {
|
|
|
262
262
|
);
|
|
263
263
|
for (const key of keys) {
|
|
264
264
|
const value = data[key];
|
|
265
|
-
if (typeof value === "string" && value.trim() !== ""
|
|
265
|
+
if (typeof value === "string" && value.trim() !== "" && !looksLikeId(value.trim())) {
|
|
266
|
+
return value.trim();
|
|
267
|
+
}
|
|
266
268
|
if (typeof value === "number") return String(value);
|
|
267
269
|
}
|
|
268
270
|
return fallback;
|
|
269
271
|
}
|
|
272
|
+
var RECORD_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
273
|
+
function looksLikeId(value) {
|
|
274
|
+
return typeof value === "string" && RECORD_ID.test(value.trim());
|
|
275
|
+
}
|
|
270
276
|
function rowName(row, titleKey, fallback = "Untitled") {
|
|
271
277
|
return recordName(row?.document, titleKey, fallback);
|
|
272
278
|
}
|
|
@@ -1172,8 +1178,13 @@ var LabelContext = createContext3({
|
|
|
1172
1178
|
// provides one, so this is only ever a bare unit test.
|
|
1173
1179
|
lookup: () => null,
|
|
1174
1180
|
want: () => {
|
|
1175
|
-
}
|
|
1181
|
+
},
|
|
1182
|
+
waiting: () => null
|
|
1176
1183
|
});
|
|
1184
|
+
var SAY_WHAT_YOU_ARE_WAITING_FOR_AFTER_MS = 1e3;
|
|
1185
|
+
function waitingLineFor(field, target) {
|
|
1186
|
+
return field.type === "list" ? "Reading this column\u2019s list of choices\u2026" : `Reading the ${target ?? "records"} this column points at\u2026`;
|
|
1187
|
+
}
|
|
1177
1188
|
function idsOf(value) {
|
|
1178
1189
|
if (Array.isArray(value)) return value.map(String).filter(isId);
|
|
1179
1190
|
if (typeof value === "string" && isId(value)) return [value];
|
|
@@ -1190,13 +1201,48 @@ function RecordLabelProvider({ children }) {
|
|
|
1190
1201
|
const client = useRecordsClient5();
|
|
1191
1202
|
const [names, setNames] = useState5({});
|
|
1192
1203
|
const [settled, setSettled] = useState5({});
|
|
1204
|
+
const [waitingLines, setWaitingLines] = useState5({});
|
|
1193
1205
|
const asked = useRef2(/* @__PURE__ */ new Set());
|
|
1194
1206
|
const chased = useRef2(/* @__PURE__ */ new Set());
|
|
1207
|
+
const timers = useRef2(/* @__PURE__ */ new Map());
|
|
1208
|
+
const startWaitClock = useCallback3((field, target) => {
|
|
1209
|
+
if (timers.current.has(field.id)) return;
|
|
1210
|
+
timers.current.set(
|
|
1211
|
+
field.id,
|
|
1212
|
+
setTimeout(() => {
|
|
1213
|
+
timers.current.delete(field.id);
|
|
1214
|
+
setWaitingLines(
|
|
1215
|
+
(current) => current[field.id] ? current : { ...current, [field.id]: waitingLineFor(field, target) }
|
|
1216
|
+
);
|
|
1217
|
+
}, SAY_WHAT_YOU_ARE_WAITING_FOR_AFTER_MS)
|
|
1218
|
+
);
|
|
1219
|
+
}, []);
|
|
1220
|
+
const stopWaitClock = useCallback3((fieldId) => {
|
|
1221
|
+
const timer = timers.current.get(fieldId);
|
|
1222
|
+
if (timer) {
|
|
1223
|
+
clearTimeout(timer);
|
|
1224
|
+
timers.current.delete(fieldId);
|
|
1225
|
+
}
|
|
1226
|
+
setWaitingLines((current) => {
|
|
1227
|
+
if (!current[fieldId]) return current;
|
|
1228
|
+
const next = { ...current };
|
|
1229
|
+
delete next[fieldId];
|
|
1230
|
+
return next;
|
|
1231
|
+
});
|
|
1232
|
+
}, []);
|
|
1233
|
+
useEffect5(
|
|
1234
|
+
() => () => {
|
|
1235
|
+
for (const timer of timers.current.values()) clearTimeout(timer);
|
|
1236
|
+
timers.current.clear();
|
|
1237
|
+
},
|
|
1238
|
+
[]
|
|
1239
|
+
);
|
|
1195
1240
|
const want = useCallback3(
|
|
1196
1241
|
(field) => {
|
|
1197
1242
|
if (!pointsAtRecords(field)) return;
|
|
1198
1243
|
if (asked.current.has(field.id)) return;
|
|
1199
1244
|
asked.current.add(field.id);
|
|
1245
|
+
startWaitClock(field, null);
|
|
1200
1246
|
void (async () => {
|
|
1201
1247
|
if (field.type === "list") {
|
|
1202
1248
|
const result = await client.fieldOptions({ field_id: field.id });
|
|
@@ -1210,11 +1256,13 @@ function RecordLabelProvider({ children }) {
|
|
|
1210
1256
|
});
|
|
1211
1257
|
}
|
|
1212
1258
|
setSettled((current) => ({ ...current, [field.id]: true }));
|
|
1259
|
+
stopWaitClock(field.id);
|
|
1213
1260
|
return;
|
|
1214
1261
|
}
|
|
1215
1262
|
const target = field.relation_target;
|
|
1216
1263
|
if (!target) {
|
|
1217
1264
|
setSettled((current) => ({ ...current, [field.id]: true }));
|
|
1265
|
+
stopWaitClock(field.id);
|
|
1218
1266
|
return;
|
|
1219
1267
|
}
|
|
1220
1268
|
const [rows, tables] = await Promise.all([
|
|
@@ -1232,24 +1280,54 @@ function RecordLabelProvider({ children }) {
|
|
|
1232
1280
|
});
|
|
1233
1281
|
}
|
|
1234
1282
|
setSettled((current) => ({ ...current, [field.id]: true }));
|
|
1283
|
+
stopWaitClock(field.id);
|
|
1235
1284
|
})();
|
|
1236
1285
|
},
|
|
1237
|
-
[client]
|
|
1286
|
+
[client, startWaitClock, stopWaitClock]
|
|
1238
1287
|
);
|
|
1288
|
+
const queued = useRef2(/* @__PURE__ */ new Map());
|
|
1289
|
+
const flushing = useRef2(null);
|
|
1290
|
+
const flush = useCallback3(() => {
|
|
1291
|
+
flushing.current = null;
|
|
1292
|
+
const batch = [...queued.current.entries()];
|
|
1293
|
+
queued.current.clear();
|
|
1294
|
+
if (batch.length === 0) return;
|
|
1295
|
+
void (async () => {
|
|
1296
|
+
const learned = {};
|
|
1297
|
+
const LANES = 6;
|
|
1298
|
+
let at = 0;
|
|
1299
|
+
await Promise.all(
|
|
1300
|
+
Array.from({ length: Math.min(LANES, batch.length) }, async () => {
|
|
1301
|
+
for (; ; ) {
|
|
1302
|
+
const next = batch[at];
|
|
1303
|
+
at += 1;
|
|
1304
|
+
if (!next) return;
|
|
1305
|
+
const [id] = next;
|
|
1306
|
+
const result = await client.recordRead({ record_id: id });
|
|
1307
|
+
learned[id] = result.ok ? recordName(result.data.document, null, "Untitled") : WITHHELD_RECORD_LABEL;
|
|
1308
|
+
}
|
|
1309
|
+
})
|
|
1310
|
+
);
|
|
1311
|
+
setNames((current) => ({ ...current, ...learned }));
|
|
1312
|
+
for (const [, field] of batch) stopWaitClock(field.id);
|
|
1313
|
+
})();
|
|
1314
|
+
}, [client, stopWaitClock]);
|
|
1239
1315
|
const chase = useCallback3(
|
|
1240
1316
|
(field, id) => {
|
|
1241
1317
|
const key = `${field.id}:${id}`;
|
|
1242
1318
|
if (chased.current.has(key)) return;
|
|
1243
1319
|
chased.current.add(key);
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
...current,
|
|
1248
|
-
[id]: result.ok ? recordName(result.data.document, null, "Untitled") : WITHHELD_RECORD_LABEL
|
|
1249
|
-
}));
|
|
1250
|
-
})();
|
|
1320
|
+
queued.current.set(id, field);
|
|
1321
|
+
startWaitClock(field, null);
|
|
1322
|
+
if (flushing.current === null) flushing.current = setTimeout(flush, 0);
|
|
1251
1323
|
},
|
|
1252
|
-
[
|
|
1324
|
+
[flush, startWaitClock]
|
|
1325
|
+
);
|
|
1326
|
+
useEffect5(
|
|
1327
|
+
() => () => {
|
|
1328
|
+
if (flushing.current !== null) clearTimeout(flushing.current);
|
|
1329
|
+
},
|
|
1330
|
+
[]
|
|
1253
1331
|
);
|
|
1254
1332
|
const lookup = useCallback3(
|
|
1255
1333
|
(field, id) => {
|
|
@@ -1260,7 +1338,8 @@ function RecordLabelProvider({ children }) {
|
|
|
1260
1338
|
},
|
|
1261
1339
|
[names, settled, chase]
|
|
1262
1340
|
);
|
|
1263
|
-
const
|
|
1341
|
+
const waiting = useCallback3((field) => waitingLines[field.id] ?? null, [waitingLines]);
|
|
1342
|
+
const value = useMemo5(() => ({ lookup, want, waiting }), [lookup, want, waiting]);
|
|
1264
1343
|
return /* @__PURE__ */ jsx7(LabelContext.Provider, { value, children });
|
|
1265
1344
|
}
|
|
1266
1345
|
function useRecordLabels(fields) {
|
|
@@ -1270,6 +1349,10 @@ function useRecordLabels(fields) {
|
|
|
1270
1349
|
}, [fields, want]);
|
|
1271
1350
|
return lookup;
|
|
1272
1351
|
}
|
|
1352
|
+
function useLabelWait(field) {
|
|
1353
|
+
const { waiting } = useContext3(LabelContext);
|
|
1354
|
+
return field ? waiting(field) : null;
|
|
1355
|
+
}
|
|
1273
1356
|
|
|
1274
1357
|
// src/values.tsx
|
|
1275
1358
|
import { Fragment as Fragment2, jsx as jsx8 } from "react/jsx-runtime";
|
|
@@ -1283,7 +1366,7 @@ var ABSENCE_WORDS = {
|
|
|
1283
1366
|
refused: "refused",
|
|
1284
1367
|
conflicting: "conflicting"
|
|
1285
1368
|
};
|
|
1286
|
-
function renderValue(field, value, document2, labels) {
|
|
1369
|
+
function renderValue(field, value, document2, labels, stillWaitingFor) {
|
|
1287
1370
|
const envelope = envelopeFor(document2, field.key);
|
|
1288
1371
|
if (envelope?.absent) {
|
|
1289
1372
|
return /* @__PURE__ */ jsx8("span", { className: "text-xs italic text-muted-foreground", title: `VAL-2: ${envelope.absent}`, children: ABSENCE_WORDS[String(envelope.absent)] ?? String(envelope.absent) });
|
|
@@ -1304,13 +1387,13 @@ function renderValue(field, value, document2, labels) {
|
|
|
1304
1387
|
if (typeof value === "boolean") {
|
|
1305
1388
|
return /* @__PURE__ */ jsx8("span", { className: kind === "checkbox" ? "text-sm" : "", title: value ? "Yes" : "No", children: value ? "\u2713" : "\u2014" });
|
|
1306
1389
|
}
|
|
1307
|
-
return /* @__PURE__ */ jsx8("span", { className: cn5("truncate", kind === "number" || kind === "currency" || kind === "percent" ? "tabular-nums" : ""), children: scalarText(field, value, labels) });
|
|
1390
|
+
return /* @__PURE__ */ jsx8("span", { className: cn5("truncate", kind === "number" || kind === "currency" || kind === "percent" ? "tabular-nums" : ""), children: scalarText(field, value, labels, stillWaitingFor) });
|
|
1308
1391
|
}
|
|
1309
|
-
function scalarText(field, value, labels) {
|
|
1392
|
+
function scalarText(field, value, labels, stillWaitingFor) {
|
|
1310
1393
|
if (value === null || value === void 0) return "\u2014";
|
|
1311
1394
|
const kind = editorKindFor(field);
|
|
1312
1395
|
if (isId(value) && (field.type === "list" || field.type === "relation")) {
|
|
1313
|
-
return labels?.(field, String(value)) ?? "Loading\u2026";
|
|
1396
|
+
return labels?.(field, String(value)) ?? stillWaitingFor ?? "Loading\u2026";
|
|
1314
1397
|
}
|
|
1315
1398
|
if (typeof value === "number") {
|
|
1316
1399
|
if (kind === "percent") return `${value}%`;
|
|
@@ -1342,9 +1425,10 @@ function RecordValue({
|
|
|
1342
1425
|
format
|
|
1343
1426
|
}) {
|
|
1344
1427
|
const labels = useRecordLabels(ONE_FIELD_ARRAY_CACHE(field));
|
|
1428
|
+
const stillWaitingFor = useLabelWait(field);
|
|
1345
1429
|
const formatted = format ? formatColumnValue({ format }, value) : null;
|
|
1346
1430
|
if (formatted) return /* @__PURE__ */ jsx8(FormattedCell, { result: formatted });
|
|
1347
|
-
return /* @__PURE__ */ jsx8(Fragment2, { children: renderValue(field, value, document2, labels) });
|
|
1431
|
+
return /* @__PURE__ */ jsx8(Fragment2, { children: renderValue(field, value, document2, labels, stillWaitingFor) });
|
|
1348
1432
|
}
|
|
1349
1433
|
var ONE_FIELD_ARRAYS = /* @__PURE__ */ new WeakMap();
|
|
1350
1434
|
function ONE_FIELD_ARRAY_CACHE(field) {
|
|
@@ -4788,12 +4872,13 @@ function ValueOnTheOtherSide({
|
|
|
4788
4872
|
}
|
|
4789
4873
|
|
|
4790
4874
|
// src/StageRules.tsx
|
|
4791
|
-
import { useCallback as useCallback8, useEffect as useEffect8, useMemo as useMemo12, useState as
|
|
4875
|
+
import { useCallback as useCallback8, useEffect as useEffect8, useMemo as useMemo12, useState as useState15 } from "react";
|
|
4792
4876
|
import { useFields as useFields6, useRecordsClient as useRecordsClient11, useTable as useTable5 } from "@ai-matrx/records/react";
|
|
4793
|
-
import { BasicInput as BasicInput6, BasicTextarea as BasicTextarea3, Button as
|
|
4877
|
+
import { BasicInput as BasicInput6, BasicTextarea as BasicTextarea3, Button as Button13, Separator as Separator5, Skeleton as Skeleton3, cn as cn13 } from "@ai-matrx/design-system";
|
|
4794
4878
|
|
|
4795
4879
|
// src/Condition.tsx
|
|
4796
|
-
import {
|
|
4880
|
+
import { useState as useState14 } from "react";
|
|
4881
|
+
import { BasicInput as BasicInput5, Button as Button12 } from "@ai-matrx/design-system";
|
|
4797
4882
|
import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4798
4883
|
var CONDITION_OPS = [
|
|
4799
4884
|
{ op: "eq", label: "is" },
|
|
@@ -4922,6 +5007,155 @@ function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", cla
|
|
|
4922
5007
|
] }) : null
|
|
4923
5008
|
] });
|
|
4924
5009
|
}
|
|
5010
|
+
var JOINERS = [
|
|
5011
|
+
{ op: "and", label: "All of these are true" },
|
|
5012
|
+
{ op: "or", label: "Any of these is true" }
|
|
5013
|
+
];
|
|
5014
|
+
function asNode(expr) {
|
|
5015
|
+
return expr && typeof expr === "object" && !Array.isArray(expr) ? expr : null;
|
|
5016
|
+
}
|
|
5017
|
+
function groupOf(expr) {
|
|
5018
|
+
const node = asNode(expr);
|
|
5019
|
+
if (!node) return null;
|
|
5020
|
+
const op = node["op"];
|
|
5021
|
+
if (op !== "and" && op !== "or") return null;
|
|
5022
|
+
const args = Array.isArray(node["args"]) ? node["args"] : [];
|
|
5023
|
+
return { op, args };
|
|
5024
|
+
}
|
|
5025
|
+
function conditionIsDrawable(expr, depth = 1) {
|
|
5026
|
+
if (expr === null || expr === void 0) return true;
|
|
5027
|
+
const group = groupOf(expr);
|
|
5028
|
+
if (!group) return conditionIsSimple(expr);
|
|
5029
|
+
if (group.args.length === 0) return true;
|
|
5030
|
+
return group.args.every((arg) => {
|
|
5031
|
+
const node = asNode(arg);
|
|
5032
|
+
if (node === null) return false;
|
|
5033
|
+
return conditionIsSimple(node) || depth > 0 && conditionIsDrawable(node, depth - 1);
|
|
5034
|
+
});
|
|
5035
|
+
}
|
|
5036
|
+
function clausesOf(expr) {
|
|
5037
|
+
const group = groupOf(expr);
|
|
5038
|
+
if (group) return group;
|
|
5039
|
+
return { op: "and", args: expr === null || expr === void 0 ? [] : [expr] };
|
|
5040
|
+
}
|
|
5041
|
+
function writeGroup(op, args) {
|
|
5042
|
+
const kept = args.filter((a) => a !== null && a !== void 0);
|
|
5043
|
+
if (kept.length === 0) return null;
|
|
5044
|
+
if (kept.length === 1) return kept[0];
|
|
5045
|
+
return { op, args: kept };
|
|
5046
|
+
}
|
|
5047
|
+
function ConditionGroup({
|
|
5048
|
+
lead,
|
|
5049
|
+
expr,
|
|
5050
|
+
fields,
|
|
5051
|
+
onChange,
|
|
5052
|
+
emptyLabel = "always",
|
|
5053
|
+
allowNesting = true,
|
|
5054
|
+
className
|
|
5055
|
+
}) {
|
|
5056
|
+
const { op, args } = clausesOf(expr);
|
|
5057
|
+
const [drafting, setDrafting] = useState14(false);
|
|
5058
|
+
const replaceAt = (index, next) => {
|
|
5059
|
+
const nextArgs = args.slice();
|
|
5060
|
+
if (next === null || next === void 0) nextArgs.splice(index, 1);
|
|
5061
|
+
else nextArgs[index] = next;
|
|
5062
|
+
onChange(writeGroup(op, nextArgs));
|
|
5063
|
+
};
|
|
5064
|
+
const joinWord = (index) => index === 0 ? lead : op === "and" ? "and" : "or";
|
|
5065
|
+
return /* @__PURE__ */ jsxs13("div", { className: className ?? "flex flex-col gap-1 text-xs", "data-testid": "condition-group", children: [
|
|
5066
|
+
args.length > 1 ? /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
|
|
5067
|
+
/* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: lead }),
|
|
5068
|
+
/* @__PURE__ */ jsx17(
|
|
5069
|
+
"select",
|
|
5070
|
+
{
|
|
5071
|
+
"aria-label": "How these conditions are joined",
|
|
5072
|
+
className: "h-8 rounded border bg-background px-1 text-xs",
|
|
5073
|
+
value: op,
|
|
5074
|
+
onChange: (e) => onChange(writeGroup(e.target.value, args)),
|
|
5075
|
+
children: JOINERS.map((j) => /* @__PURE__ */ jsx17("option", { value: j.op, children: j.label }, j.op))
|
|
5076
|
+
}
|
|
5077
|
+
)
|
|
5078
|
+
] }) : null,
|
|
5079
|
+
args.length === 0 ? /* @__PURE__ */ jsx17(
|
|
5080
|
+
ConditionRow,
|
|
5081
|
+
{
|
|
5082
|
+
lead,
|
|
5083
|
+
emptyLabel,
|
|
5084
|
+
expr: null,
|
|
5085
|
+
fields,
|
|
5086
|
+
onChange: (next) => onChange(next)
|
|
5087
|
+
}
|
|
5088
|
+
) : args.map((arg, index) => {
|
|
5089
|
+
const nested = groupOf(arg);
|
|
5090
|
+
const key = `clause-${index}`;
|
|
5091
|
+
if (nested && allowNesting) {
|
|
5092
|
+
return /* @__PURE__ */ jsx17("div", { className: "ml-4 rounded border border-dashed p-1", "data-testid": "condition-nested-group", children: /* @__PURE__ */ jsx17(
|
|
5093
|
+
ConditionGroup,
|
|
5094
|
+
{
|
|
5095
|
+
lead: op === "and" ? "and also, any of:" : "or, all of:",
|
|
5096
|
+
expr: arg,
|
|
5097
|
+
fields,
|
|
5098
|
+
onChange: (next) => replaceAt(index, next),
|
|
5099
|
+
emptyLabel,
|
|
5100
|
+
allowNesting: false
|
|
5101
|
+
}
|
|
5102
|
+
) }, key);
|
|
5103
|
+
}
|
|
5104
|
+
return /* @__PURE__ */ jsx17(
|
|
5105
|
+
ConditionRow,
|
|
5106
|
+
{
|
|
5107
|
+
lead: args.length > 1 ? joinWord(index) : lead,
|
|
5108
|
+
emptyLabel,
|
|
5109
|
+
expr: arg,
|
|
5110
|
+
fields,
|
|
5111
|
+
onChange: (next) => replaceAt(index, next)
|
|
5112
|
+
},
|
|
5113
|
+
key
|
|
5114
|
+
);
|
|
5115
|
+
}),
|
|
5116
|
+
drafting ? /* @__PURE__ */ jsx17(
|
|
5117
|
+
ConditionRow,
|
|
5118
|
+
{
|
|
5119
|
+
lead: op === "and" ? "and" : "or",
|
|
5120
|
+
emptyLabel,
|
|
5121
|
+
expr: null,
|
|
5122
|
+
fields,
|
|
5123
|
+
onChange: (next) => {
|
|
5124
|
+
if (next === null) return;
|
|
5125
|
+
setDrafting(false);
|
|
5126
|
+
onChange(writeGroup(op, [...args, next]));
|
|
5127
|
+
}
|
|
5128
|
+
}
|
|
5129
|
+
) : null,
|
|
5130
|
+
args.length > 0 && !drafting ? /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
|
|
5131
|
+
/* @__PURE__ */ jsx17(
|
|
5132
|
+
Button12,
|
|
5133
|
+
{
|
|
5134
|
+
size: "sm",
|
|
5135
|
+
variant: "ghost",
|
|
5136
|
+
className: "h-6 px-1 text-xs",
|
|
5137
|
+
"data-testid": "condition-add-clause",
|
|
5138
|
+
onClick: () => setDrafting(true),
|
|
5139
|
+
children: "Add another condition"
|
|
5140
|
+
}
|
|
5141
|
+
),
|
|
5142
|
+
allowNesting && args.length > 1 && !args.some((a) => groupOf(a) !== null) ? /* @__PURE__ */ jsx17(
|
|
5143
|
+
Button12,
|
|
5144
|
+
{
|
|
5145
|
+
size: "sm",
|
|
5146
|
+
variant: "ghost",
|
|
5147
|
+
className: "h-6 px-1 text-xs",
|
|
5148
|
+
"data-testid": "condition-add-group",
|
|
5149
|
+
onClick: () => replaceAt(args.length - 1, {
|
|
5150
|
+
op: op === "and" ? "or" : "and",
|
|
5151
|
+
args: [args[args.length - 1]]
|
|
5152
|
+
}),
|
|
5153
|
+
children: "Group the last one"
|
|
5154
|
+
}
|
|
5155
|
+
) : null
|
|
5156
|
+
] }) : null
|
|
5157
|
+
] });
|
|
5158
|
+
}
|
|
4925
5159
|
|
|
4926
5160
|
// src/StageRules.tsx
|
|
4927
5161
|
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
@@ -4959,15 +5193,15 @@ function StageRulesSection({ tableId, stage, className }) {
|
|
|
4959
5193
|
const table = useTable5(tableId);
|
|
4960
5194
|
const rights = useTableRights(table.data);
|
|
4961
5195
|
const fields = useFields6(tableId);
|
|
4962
|
-
const [pipeline, setPipeline] =
|
|
4963
|
-
const [enforcement, setEnforcement] =
|
|
4964
|
-
const [asked, setAsked] =
|
|
4965
|
-
const [error, setError] =
|
|
4966
|
-
const [chosen, setChosen] =
|
|
4967
|
-
const [draft, setDraft] =
|
|
4968
|
-
const [preview, setPreview] =
|
|
4969
|
-
const [previewError, setPreviewError] =
|
|
4970
|
-
const [saving, setSaving] =
|
|
5196
|
+
const [pipeline, setPipeline] = useState15(null);
|
|
5197
|
+
const [enforcement, setEnforcement] = useState15(null);
|
|
5198
|
+
const [asked, setAsked] = useState15(false);
|
|
5199
|
+
const [error, setError] = useState15(null);
|
|
5200
|
+
const [chosen, setChosen] = useState15(stage ?? null);
|
|
5201
|
+
const [draft, setDraft] = useState15(null);
|
|
5202
|
+
const [preview, setPreview] = useState15(null);
|
|
5203
|
+
const [previewError, setPreviewError] = useState15(null);
|
|
5204
|
+
const [saving, setSaving] = useState15(false);
|
|
4971
5205
|
const load = useCallback8(async () => {
|
|
4972
5206
|
const [read, mode] = await Promise.all([client.pipelineRead({ table_id: tableId }), client.stageRuleEnforcement()]);
|
|
4973
5207
|
if (!read.ok) setError(read.error);
|
|
@@ -5067,7 +5301,7 @@ function StageRulesSection({ tableId, stage, className }) {
|
|
|
5067
5301
|
),
|
|
5068
5302
|
/* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: gates.length }),
|
|
5069
5303
|
canEdit && !draft ? /* @__PURE__ */ jsx18(
|
|
5070
|
-
|
|
5304
|
+
Button13,
|
|
5071
5305
|
{
|
|
5072
5306
|
size: "sm",
|
|
5073
5307
|
variant: "outline",
|
|
@@ -5089,7 +5323,7 @@ function StageRulesSection({ tableId, stage, className }) {
|
|
|
5089
5323
|
/* @__PURE__ */ jsx18("div", { className: "text-muted-foreground", children: rule.message }),
|
|
5090
5324
|
/* @__PURE__ */ jsx18("div", { className: "text-muted-foreground", children: (rule.on_fail ?? "refuse") === "require_approval" ? "Asks for approval" : "Turns it away" })
|
|
5091
5325
|
] }),
|
|
5092
|
-
canEdit ? /* @__PURE__ */ jsx18(
|
|
5326
|
+
canEdit ? /* @__PURE__ */ jsx18(Button13, { size: "sm", variant: "ghost", onClick: () => setDraft(draftOf(rule)), children: "Edit" }) : null
|
|
5093
5327
|
] }, rule.id)) }) : null,
|
|
5094
5328
|
draft ? /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2 rounded border p-2", children: [
|
|
5095
5329
|
draft.opaque ? /* @__PURE__ */ jsxs14("p", { className: "rounded border border-amber-500/40 bg-amber-500/5 px-2 py-1 text-muted-foreground", children: [
|
|
@@ -5155,8 +5389,8 @@ function StageRulesSection({ tableId, stage, className }) {
|
|
|
5155
5389
|
previewError ? /* @__PURE__ */ jsx18(RefusalNotice, { error: previewError }) : preview ? /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", "data-testid": "stage-rule-preview", children: preview.refused === 0 ? `No ${preview.noun ?? "card"}s on this board would be stopped by this today, out of ${preview.considered} that could move here.` : `${preview.refused} of ${preview.considered} ${preview.noun ?? "card"}s would be ${(draft.on_fail ?? "refuse") === "require_approval" ? "sent for approval" : "refused"} today \u2014 ${preview.examples.map((e) => e.title).join(", ")}${preview.refused > preview.examples.length ? " and others" : ""}.` }) : null,
|
|
5156
5390
|
error ? /* @__PURE__ */ jsx18(RefusalNotice, { error }) : null,
|
|
5157
5391
|
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
|
|
5158
|
-
draft.message.trim() && Object.keys(draft.demands ?? {}).length > 0 ? /* @__PURE__ */ jsx18(
|
|
5159
|
-
/* @__PURE__ */ jsx18(
|
|
5392
|
+
draft.message.trim() && Object.keys(draft.demands ?? {}).length > 0 ? /* @__PURE__ */ jsx18(Button13, { size: "sm", onClick: () => void save(), disabled: saving, children: saving ? "Saving\u2026" : "Save this rule" }) : /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: Object.keys(draft.demands ?? {}).length === 0 ? "Say what a card needs before it can get here." : NEEDS_A_SENTENCE }),
|
|
5393
|
+
/* @__PURE__ */ jsx18(Button13, { size: "sm", variant: "ghost", onClick: () => setDraft(null), children: "Cancel" })
|
|
5160
5394
|
] })
|
|
5161
5395
|
] }) : null,
|
|
5162
5396
|
/* @__PURE__ */ jsx18(Separator5, {})
|
|
@@ -5169,15 +5403,15 @@ function Clause({
|
|
|
5169
5403
|
fields,
|
|
5170
5404
|
onChange
|
|
5171
5405
|
}) {
|
|
5172
|
-
const [replacing, setReplacing] =
|
|
5173
|
-
const drawable =
|
|
5406
|
+
const [replacing, setReplacing] = useState15(false);
|
|
5407
|
+
const drawable = conditionIsDrawable(expr) || replacing;
|
|
5174
5408
|
if (drawable) {
|
|
5175
5409
|
return /* @__PURE__ */ jsx18(
|
|
5176
|
-
|
|
5410
|
+
ConditionGroup,
|
|
5177
5411
|
{
|
|
5178
5412
|
lead,
|
|
5179
5413
|
emptyLabel,
|
|
5180
|
-
expr: replacing && !
|
|
5414
|
+
expr: replacing && !conditionIsDrawable(expr) ? null : expr,
|
|
5181
5415
|
fields,
|
|
5182
5416
|
onChange
|
|
5183
5417
|
}
|
|
@@ -5192,7 +5426,7 @@ function Clause({
|
|
|
5192
5426
|
", so it is shown as it reads."
|
|
5193
5427
|
] }),
|
|
5194
5428
|
/* @__PURE__ */ jsx18(
|
|
5195
|
-
|
|
5429
|
+
Button13,
|
|
5196
5430
|
{
|
|
5197
5431
|
size: "sm",
|
|
5198
5432
|
variant: "ghost",
|
|
@@ -5208,14 +5442,14 @@ function Clause({
|
|
|
5208
5442
|
}
|
|
5209
5443
|
|
|
5210
5444
|
// src/TableSettings.tsx
|
|
5211
|
-
import { useState as
|
|
5445
|
+
import { useState as useState16 } from "react";
|
|
5212
5446
|
import {
|
|
5213
5447
|
useFieldMutation as useFieldMutation2,
|
|
5214
5448
|
useFields as useFields7,
|
|
5215
5449
|
useRecordMutation,
|
|
5216
5450
|
useTable as useTable6
|
|
5217
5451
|
} from "@ai-matrx/records/react";
|
|
5218
|
-
import { Badge as Badge6, Button as
|
|
5452
|
+
import { Badge as Badge6, Button as Button14, Separator as Separator6, cn as cn14 } from "@ai-matrx/design-system";
|
|
5219
5453
|
import { Fragment as Fragment9, jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5220
5454
|
function TableSettings({
|
|
5221
5455
|
tableId,
|
|
@@ -5230,10 +5464,10 @@ function TableSettings({
|
|
|
5230
5464
|
const rights = useTableRights(table.data);
|
|
5231
5465
|
const mutation = useRecordMutation();
|
|
5232
5466
|
const shape = useFieldMutation2();
|
|
5233
|
-
const [editing, setEditing] =
|
|
5234
|
-
const [askingToDelete, setAskingToDelete] =
|
|
5235
|
-
const [askingToRemove, setAskingToRemove] =
|
|
5236
|
-
const [enriching, setEnriching] =
|
|
5467
|
+
const [editing, setEditing] = useState16(null);
|
|
5468
|
+
const [askingToDelete, setAskingToDelete] = useState16(false);
|
|
5469
|
+
const [askingToRemove, setAskingToRemove] = useState16(null);
|
|
5470
|
+
const [enriching, setEnriching] = useState16(null);
|
|
5237
5471
|
if (table.error) return /* @__PURE__ */ jsx19(RefusalNotice, { error: table.error, className });
|
|
5238
5472
|
if (fields.error) return /* @__PURE__ */ jsx19(RefusalNotice, { error: fields.error, className });
|
|
5239
5473
|
if (!rights.structure) return /* @__PURE__ */ jsx19("p", { className: cn14("text-xs text-muted-foreground", className), children: rights.why("structure") });
|
|
@@ -5263,7 +5497,7 @@ function TableSettings({
|
|
|
5263
5497
|
return /* @__PURE__ */ jsxs15("div", { className, children: [
|
|
5264
5498
|
/* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between px-2 pt-2", children: [
|
|
5265
5499
|
/* @__PURE__ */ jsx19("h2", { className: "text-sm font-medium", children: fieldName(enriching) }),
|
|
5266
|
-
/* @__PURE__ */ jsx19(
|
|
5500
|
+
/* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "ghost", onClick: () => {
|
|
5267
5501
|
setEnriching(null);
|
|
5268
5502
|
fields.reload();
|
|
5269
5503
|
}, children: "Back" })
|
|
@@ -5291,7 +5525,7 @@ function TableSettings({
|
|
|
5291
5525
|
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2", children: [
|
|
5292
5526
|
/* @__PURE__ */ jsx19("span", { className: "font-medium", children: "Fields" }),
|
|
5293
5527
|
/* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: rows.length }),
|
|
5294
|
-
/* @__PURE__ */ jsx19(
|
|
5528
|
+
/* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "outline", className: "ml-auto", onClick: () => setEditing("new"), children: "Add a field" })
|
|
5295
5529
|
] }),
|
|
5296
5530
|
mutation.error ? /* @__PURE__ */ jsx19(RefusalNotice, { error: mutation.error }) : null,
|
|
5297
5531
|
shape.error ? /* @__PURE__ */ jsx19(RefusalNotice, { error: shape.error }) : null,
|
|
@@ -5302,7 +5536,7 @@ function TableSettings({
|
|
|
5302
5536
|
" takes it off every record of this table. The values stay in each record's history and nothing else is deleted."
|
|
5303
5537
|
] }),
|
|
5304
5538
|
/* @__PURE__ */ jsx19(
|
|
5305
|
-
|
|
5539
|
+
Button14,
|
|
5306
5540
|
{
|
|
5307
5541
|
size: "sm",
|
|
5308
5542
|
variant: "destructive",
|
|
@@ -5311,7 +5545,7 @@ function TableSettings({
|
|
|
5311
5545
|
children: shape.saving ? "Removing\u2026" : "Remove it"
|
|
5312
5546
|
}
|
|
5313
5547
|
),
|
|
5314
|
-
/* @__PURE__ */ jsx19(
|
|
5548
|
+
/* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "ghost", onClick: () => setAskingToRemove(null), children: "Keep it" })
|
|
5315
5549
|
] }) : null,
|
|
5316
5550
|
/* @__PURE__ */ jsxs15("ul", { className: "divide-y rounded border", children: [
|
|
5317
5551
|
rows.map((field, index) => /* @__PURE__ */ jsxs15("li", { className: "flex items-center gap-2 px-2 py-1.5", children: [
|
|
@@ -5319,7 +5553,7 @@ function TableSettings({
|
|
|
5319
5553
|
/* @__PURE__ */ jsx19(Badge6, { variant: "outline", className: "text-[10px] font-normal", children: fieldTypeLabel(field) }),
|
|
5320
5554
|
field.required ? /* @__PURE__ */ jsx19("span", { className: "text-[10px] text-destructive", children: "required" }) : null,
|
|
5321
5555
|
/* @__PURE__ */ jsx19(
|
|
5322
|
-
|
|
5556
|
+
Button14,
|
|
5323
5557
|
{
|
|
5324
5558
|
size: "sm",
|
|
5325
5559
|
variant: "ghost",
|
|
@@ -5330,7 +5564,7 @@ function TableSettings({
|
|
|
5330
5564
|
}
|
|
5331
5565
|
),
|
|
5332
5566
|
/* @__PURE__ */ jsx19(
|
|
5333
|
-
|
|
5567
|
+
Button14,
|
|
5334
5568
|
{
|
|
5335
5569
|
size: "sm",
|
|
5336
5570
|
variant: "ghost",
|
|
@@ -5341,9 +5575,9 @@ function TableSettings({
|
|
|
5341
5575
|
}
|
|
5342
5576
|
),
|
|
5343
5577
|
field.source === "agent" ? /* @__PURE__ */ jsx19(Badge6, { variant: "secondary", className: "text-[10px] font-normal", children: "a model fills this in" }) : null,
|
|
5344
|
-
/* @__PURE__ */ jsx19(
|
|
5578
|
+
/* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "ghost", onClick: () => setEditing(field), children: "Edit" }),
|
|
5345
5579
|
/* @__PURE__ */ jsx19(
|
|
5346
|
-
|
|
5580
|
+
Button14,
|
|
5347
5581
|
{
|
|
5348
5582
|
size: "sm",
|
|
5349
5583
|
variant: "ghost",
|
|
@@ -5353,7 +5587,7 @@ function TableSettings({
|
|
|
5353
5587
|
}
|
|
5354
5588
|
),
|
|
5355
5589
|
/* @__PURE__ */ jsx19(
|
|
5356
|
-
|
|
5590
|
+
Button14,
|
|
5357
5591
|
{
|
|
5358
5592
|
size: "sm",
|
|
5359
5593
|
variant: "ghost",
|
|
@@ -5376,8 +5610,8 @@ function TableSettings({
|
|
|
5376
5610
|
/* @__PURE__ */ jsx19("span", { className: "min-w-0 flex-1 truncate", children: proposal.field.label || proposal.field.key }),
|
|
5377
5611
|
/* @__PURE__ */ jsx19("span", { className: "min-w-0 flex-1 truncate text-muted-foreground", children: proposal.why }),
|
|
5378
5612
|
/* @__PURE__ */ jsx19(Badge6, { variant: "secondary", className: "text-[10px] font-normal", children: proposal.proposed_by }),
|
|
5379
|
-
/* @__PURE__ */ jsx19(
|
|
5380
|
-
/* @__PURE__ */ jsx19(
|
|
5613
|
+
/* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "outline", onClick: () => onAcceptProposal?.(proposal), children: "Accept" }),
|
|
5614
|
+
/* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "ghost", onClick: () => onRejectProposal?.(proposal), children: "Reject" })
|
|
5381
5615
|
] }, proposal.id)) }),
|
|
5382
5616
|
/* @__PURE__ */ jsx19(Separator6, {}),
|
|
5383
5617
|
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
|
|
@@ -5394,22 +5628,22 @@ function TableSettings({
|
|
|
5394
5628
|
table.data?.retention_days ? ` The store keeps them for ${table.data.retention_days} days, so it can still be restored.` : " The store keeps them, so it can still be restored."
|
|
5395
5629
|
] }),
|
|
5396
5630
|
/* @__PURE__ */ jsxs15("div", { className: "flex gap-1", children: [
|
|
5397
|
-
/* @__PURE__ */ jsx19(
|
|
5398
|
-
/* @__PURE__ */ jsx19(
|
|
5631
|
+
/* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "destructive", disabled: mutation.saving, onClick: () => void deleteTable(), children: mutation.saving ? "Deleting\u2026" : "Delete this table" }),
|
|
5632
|
+
/* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "ghost", onClick: () => setAskingToDelete(false), children: "Keep it" })
|
|
5399
5633
|
] })
|
|
5400
|
-
] }) : /* @__PURE__ */ jsx19("div", { children: /* @__PURE__ */ jsx19(
|
|
5634
|
+
] }) : /* @__PURE__ */ jsx19("div", { children: /* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "outline", onClick: () => setAskingToDelete(true), children: "Delete this table" }) }),
|
|
5401
5635
|
mutation.error ? /* @__PURE__ */ jsx19(RefusalNotice, { error: mutation.error }) : null
|
|
5402
5636
|
] })
|
|
5403
5637
|
] });
|
|
5404
5638
|
}
|
|
5405
5639
|
|
|
5406
5640
|
// src/Peek.tsx
|
|
5407
|
-
import { useState as
|
|
5641
|
+
import { useState as useState21 } from "react";
|
|
5408
5642
|
import { useFields as useFields9, useRecord as useRecord2, useRecordsClient as useRecordsClient14, useTable as useTable7 } from "@ai-matrx/records/react";
|
|
5409
5643
|
import { AlchemyMenu as AlchemyMenu2 } from "@ai-matrx/alchemy/react";
|
|
5410
5644
|
|
|
5411
5645
|
// src/RecordChat.tsx
|
|
5412
|
-
import { useEffect as useEffect9, useMemo as useMemo13, useState as
|
|
5646
|
+
import { useEffect as useEffect9, useMemo as useMemo13, useState as useState17 } from "react";
|
|
5413
5647
|
import { useRecordsClient as useRecordsClient12 } from "@ai-matrx/records/react";
|
|
5414
5648
|
import { Skeleton as Skeleton4, cn as cn15 } from "@ai-matrx/design-system";
|
|
5415
5649
|
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
@@ -5417,8 +5651,8 @@ var NO_CHAT_REASON = "No chat port is bound, so this panel is absent rather than
|
|
|
5417
5651
|
function RecordChat({ tableId, recordId, className }) {
|
|
5418
5652
|
const client = useRecordsClient12();
|
|
5419
5653
|
const host = useRecordsUi();
|
|
5420
|
-
const [scope, setScope] =
|
|
5421
|
-
const [error, setError] =
|
|
5654
|
+
const [scope, setScope] = useState17(null);
|
|
5655
|
+
const [error, setError] = useState17(null);
|
|
5422
5656
|
useEffect9(() => {
|
|
5423
5657
|
let cancelled = false;
|
|
5424
5658
|
setScope(null);
|
|
@@ -5533,20 +5767,20 @@ function entriesFor(scope) {
|
|
|
5533
5767
|
}
|
|
5534
5768
|
|
|
5535
5769
|
// src/Peek.tsx
|
|
5536
|
-
import { Button as
|
|
5770
|
+
import { Button as Button17, Separator as Separator8, Skeleton as Skeleton5, cn as cn17 } from "@ai-matrx/design-system";
|
|
5537
5771
|
|
|
5538
5772
|
// src/RecordForm.tsx
|
|
5539
|
-
import { useEffect as useEffect11, useMemo as useMemo15, useState as
|
|
5773
|
+
import { useEffect as useEffect11, useMemo as useMemo15, useState as useState19 } from "react";
|
|
5540
5774
|
import {
|
|
5541
5775
|
useFields as useFields8,
|
|
5542
5776
|
useRecord,
|
|
5543
5777
|
useRecordMutation as useRecordMutation2
|
|
5544
5778
|
} from "@ai-matrx/records/react";
|
|
5545
5779
|
import { predictWriteRefusals } from "@ai-matrx/records/core";
|
|
5546
|
-
import { Button as
|
|
5780
|
+
import { Button as Button15, Separator as Separator7, cn as cn16 } from "@ai-matrx/design-system";
|
|
5547
5781
|
|
|
5548
5782
|
// src/systemTable.ts
|
|
5549
|
-
import { useEffect as useEffect10, useMemo as useMemo14, useState as
|
|
5783
|
+
import { useEffect as useEffect10, useMemo as useMemo14, useState as useState18 } from "react";
|
|
5550
5784
|
import { useRecordsClient as useRecordsClient13 } from "@ai-matrx/records/react";
|
|
5551
5785
|
var inFlight = /* @__PURE__ */ new Map();
|
|
5552
5786
|
async function ensureSystemTable(client, spec) {
|
|
@@ -5676,7 +5910,7 @@ async function declare(client, spec) {
|
|
|
5676
5910
|
}
|
|
5677
5911
|
function useSystemTable(spec) {
|
|
5678
5912
|
const client = useRecordsClient13();
|
|
5679
|
-
const [state, setState] =
|
|
5913
|
+
const [state, setState] = useState18({ tableId: null, loading: true, error: null });
|
|
5680
5914
|
const slug = spec.slug;
|
|
5681
5915
|
const stable = useMemo14(() => spec, [slug]);
|
|
5682
5916
|
useEffect10(() => {
|
|
@@ -5696,7 +5930,7 @@ function useSystemTable(spec) {
|
|
|
5696
5930
|
}
|
|
5697
5931
|
function useRecordVersion(recordId) {
|
|
5698
5932
|
const client = useRecordsClient13();
|
|
5699
|
-
const [version, setVersion] =
|
|
5933
|
+
const [version, setVersion] = useState18(null);
|
|
5700
5934
|
useEffect10(() => {
|
|
5701
5935
|
let cancelled = false;
|
|
5702
5936
|
setVersion(null);
|
|
@@ -5730,8 +5964,8 @@ function RecordForm({
|
|
|
5730
5964
|
const fields = useFields8(tableId, recordType);
|
|
5731
5965
|
const existing = useRecord(recordId ?? null);
|
|
5732
5966
|
const mutation = useRecordMutation2();
|
|
5733
|
-
const [draft, setDraft] =
|
|
5734
|
-
const [touched, setTouched] =
|
|
5967
|
+
const [draft, setDraft] = useState19({});
|
|
5968
|
+
const [touched, setTouched] = useState19(false);
|
|
5735
5969
|
const loaded = useRecordVersion(recordId ?? null);
|
|
5736
5970
|
const loadedVersion = loaded.version;
|
|
5737
5971
|
useEffect11(() => {
|
|
@@ -5814,7 +6048,7 @@ function RecordForm({
|
|
|
5814
6048
|
] }, key);
|
|
5815
6049
|
}),
|
|
5816
6050
|
/* @__PURE__ */ jsx21(
|
|
5817
|
-
|
|
6051
|
+
Button15,
|
|
5818
6052
|
{
|
|
5819
6053
|
type: "button",
|
|
5820
6054
|
size: "sm",
|
|
@@ -5832,8 +6066,8 @@ function RecordForm({
|
|
|
5832
6066
|
) : null,
|
|
5833
6067
|
/* @__PURE__ */ jsx21(Separator7, {}),
|
|
5834
6068
|
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
5835
|
-
/* @__PURE__ */ jsx21(
|
|
5836
|
-
onCancel ? /* @__PURE__ */ jsx21(
|
|
6069
|
+
/* @__PURE__ */ jsx21(Button15, { type: "submit", size: "sm", disabled: mutation.saving, children: mutation.saving ? "Saving\u2026" : recordId ? "Save" : "Create" }),
|
|
6070
|
+
onCancel ? /* @__PURE__ */ jsx21(Button15, { type: "button", size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null
|
|
5837
6071
|
] })
|
|
5838
6072
|
]
|
|
5839
6073
|
}
|
|
@@ -5861,8 +6095,8 @@ function asWords(value) {
|
|
|
5861
6095
|
}
|
|
5862
6096
|
|
|
5863
6097
|
// src/ShareControl.tsx
|
|
5864
|
-
import { useState as
|
|
5865
|
-
import { Button as
|
|
6098
|
+
import { useState as useState20 } from "react";
|
|
6099
|
+
import { Button as Button16 } from "@ai-matrx/design-system";
|
|
5866
6100
|
import { Fragment as Fragment10, jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5867
6101
|
function useCanShare() {
|
|
5868
6102
|
return typeof useRecordsUi().share === "function";
|
|
@@ -5881,14 +6115,14 @@ function ShareControl({
|
|
|
5881
6115
|
className
|
|
5882
6116
|
}) {
|
|
5883
6117
|
const host = useRecordsUi();
|
|
5884
|
-
const [open, setOpen] =
|
|
6118
|
+
const [open, setOpen] = useState20(false);
|
|
5885
6119
|
const asked = useRecordRights(may === void 0 ? subjectId : null);
|
|
5886
6120
|
const mayShare = may ?? asked.share;
|
|
5887
6121
|
if (!host.share) return null;
|
|
5888
6122
|
if (!mayShare) return null;
|
|
5889
6123
|
return /* @__PURE__ */ jsxs18(Fragment10, { children: [
|
|
5890
6124
|
/* @__PURE__ */ jsx22(
|
|
5891
|
-
|
|
6125
|
+
Button16,
|
|
5892
6126
|
{
|
|
5893
6127
|
size,
|
|
5894
6128
|
variant,
|
|
@@ -5919,8 +6153,8 @@ function Peek({ tableId, recordId, onClose, className }) {
|
|
|
5919
6153
|
const may = useRecordRights(recordId);
|
|
5920
6154
|
const host = useRecordsUi();
|
|
5921
6155
|
const organizationId = useRecordsClient14().config.organizationId;
|
|
5922
|
-
const [editing, setEditing] =
|
|
5923
|
-
const [talking, setTalking] =
|
|
6156
|
+
const [editing, setEditing] = useState21(false);
|
|
6157
|
+
const [talking, setTalking] = useState21(false);
|
|
5924
6158
|
if (record.error) return /* @__PURE__ */ jsx23(RefusalNotice, { error: record.error, className });
|
|
5925
6159
|
if (fields.error) return /* @__PURE__ */ jsx23(RefusalNotice, { error: fields.error, className });
|
|
5926
6160
|
const document2 = record.data?.document;
|
|
@@ -5952,21 +6186,21 @@ function Peek({ tableId, recordId, onClose, className }) {
|
|
|
5952
6186
|
),
|
|
5953
6187
|
href ? /* @__PURE__ */ jsx23("a", { className: "text-primary underline-offset-2 hover:underline", href, children: "Open" }) : null,
|
|
5954
6188
|
host.talkToRecord ? /* @__PURE__ */ jsx23(
|
|
5955
|
-
|
|
6189
|
+
Button17,
|
|
5956
6190
|
{
|
|
5957
6191
|
size: "sm",
|
|
5958
6192
|
variant: "outline",
|
|
5959
6193
|
onClick: () => host.talkToRecord?.({ tableId, recordId, title: title || "this record" }),
|
|
5960
6194
|
children: "Talk to this record"
|
|
5961
6195
|
}
|
|
5962
|
-
) : host.chat ? /* @__PURE__ */ jsx23(
|
|
6196
|
+
) : host.chat ? /* @__PURE__ */ jsx23(Button17, { size: "sm", variant: talking ? "ghost" : "outline", onClick: () => setTalking((t) => !t), children: talking ? "Close chat" : "Talk to this record" }) : null,
|
|
5963
6197
|
/* @__PURE__ */ jsx23(ShareControl, { kind: "record", organizationId, subjectId: recordId, name: title, may: may.share }),
|
|
5964
|
-
may.write ? /* @__PURE__ */ jsx23(
|
|
6198
|
+
may.write ? /* @__PURE__ */ jsx23(Button17, { size: "sm", variant: editing ? "ghost" : "outline", onClick: () => setEditing((e) => !e), children: editing ? "Stop editing" : "Edit" }) : may.known ? (
|
|
5965
6199
|
// Absent AND explained: no Edit button, and one sentence saying what
|
|
5966
6200
|
// it would take and who can give it.
|
|
5967
6201
|
/* @__PURE__ */ jsx23("span", { className: "max-w-[18rem] text-[11px] text-muted-foreground", children: may.why("write") })
|
|
5968
6202
|
) : null,
|
|
5969
|
-
onClose ? /* @__PURE__ */ jsx23(
|
|
6203
|
+
onClose ? /* @__PURE__ */ jsx23(Button17, { size: "sm", variant: "ghost", onClick: onClose, "aria-label": "Close", children: "\xD7" }) : null
|
|
5970
6204
|
] }),
|
|
5971
6205
|
/* @__PURE__ */ jsx23(Separator8, {}),
|
|
5972
6206
|
talking && host.chat ? /* @__PURE__ */ jsxs19(Fragment11, { children: [
|
|
@@ -6058,6 +6292,37 @@ var LAYOUT_FIELD_KIND = {
|
|
|
6058
6292
|
calendar: "date",
|
|
6059
6293
|
gallery: null
|
|
6060
6294
|
};
|
|
6295
|
+
var PAGE_VIEWS = [...VIEW_LAYOUTS, "dashboards"];
|
|
6296
|
+
var PAGE_VIEW_LABEL = {
|
|
6297
|
+
...LAYOUT_LABEL,
|
|
6298
|
+
dashboards: "Dashboards"
|
|
6299
|
+
};
|
|
6300
|
+
var PAGE_VIEW_SPELLINGS = {
|
|
6301
|
+
grid: "grid",
|
|
6302
|
+
table: "grid",
|
|
6303
|
+
rows: "grid",
|
|
6304
|
+
list: "grid",
|
|
6305
|
+
kanban: "kanban",
|
|
6306
|
+
board: "kanban",
|
|
6307
|
+
pipeline: "kanban",
|
|
6308
|
+
calendar: "calendar",
|
|
6309
|
+
month: "calendar",
|
|
6310
|
+
schedule: "calendar",
|
|
6311
|
+
gallery: "gallery",
|
|
6312
|
+
cards: "gallery",
|
|
6313
|
+
dashboards: "dashboards",
|
|
6314
|
+
dashboard: "dashboards",
|
|
6315
|
+
charts: "dashboards"
|
|
6316
|
+
};
|
|
6317
|
+
function pageViewFromParam(raw) {
|
|
6318
|
+
if (typeof raw !== "string") return null;
|
|
6319
|
+
const token = raw.trim().toLowerCase();
|
|
6320
|
+
if (token === "") return null;
|
|
6321
|
+
return PAGE_VIEW_SPELLINGS[token] ?? null;
|
|
6322
|
+
}
|
|
6323
|
+
function unknownViewLine(raw) {
|
|
6324
|
+
return `The link asked for a view called \u201C${raw}\u201D, which this table has no view for, so you are looking at ${PAGE_VIEW_LABEL.grid}. The views this table has are ${PAGE_VIEWS.map((v) => PAGE_VIEW_LABEL[v]).join(", ")} \u2014 pick one above and the address follows it.`;
|
|
6325
|
+
}
|
|
6061
6326
|
var LAYOUT_NO_FIELD = {
|
|
6062
6327
|
grid: "",
|
|
6063
6328
|
kanban: "This table has no choice field yet, so there is nothing to make columns from. Add a field that holds one of a set of choices \u2014 Add field, then Select \u2014 and it appears here.",
|
|
@@ -6123,18 +6388,18 @@ function parseSorts(raw) {
|
|
|
6123
6388
|
}
|
|
6124
6389
|
|
|
6125
6390
|
// src/ViewSwitcher.tsx
|
|
6126
|
-
import { useEffect as useEffect13, useMemo as useMemo17, useState as
|
|
6391
|
+
import { useEffect as useEffect13, useMemo as useMemo17, useState as useState23 } from "react";
|
|
6127
6392
|
import { useFields as useFields11, useRecords as useRecords4, useRecordsClient as useRecordsClient16 } from "@ai-matrx/records/react";
|
|
6128
|
-
import { Button as
|
|
6393
|
+
import { Button as Button19, Skeleton as Skeleton7, cn as cn19 } from "@ai-matrx/design-system";
|
|
6129
6394
|
|
|
6130
6395
|
// src/Pipeline.tsx
|
|
6131
|
-
import { useCallback as useCallback9, useEffect as useEffect12, useMemo as useMemo16, useRef as useRef5, useState as
|
|
6396
|
+
import { useCallback as useCallback9, useEffect as useEffect12, useMemo as useMemo16, useRef as useRef5, useState as useState22 } from "react";
|
|
6132
6397
|
import {
|
|
6133
6398
|
mayDrag,
|
|
6134
6399
|
useFields as useFields10,
|
|
6135
6400
|
useRecordsClient as useRecordsClient15
|
|
6136
6401
|
} from "@ai-matrx/records/react";
|
|
6137
|
-
import { Button as
|
|
6402
|
+
import { Button as Button18, Skeleton as Skeleton6, cn as cn18 } from "@ai-matrx/design-system";
|
|
6138
6403
|
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6139
6404
|
var UNPLACED = "\0unplaced";
|
|
6140
6405
|
function stageOfCard(row, stageKey, stages) {
|
|
@@ -6168,14 +6433,14 @@ function PipelineBoard({
|
|
|
6168
6433
|
}) {
|
|
6169
6434
|
const client = useRecordsClient15();
|
|
6170
6435
|
const fields = useFields10(tableId);
|
|
6171
|
-
const [definition, setDefinition] =
|
|
6172
|
-
const [columns, setColumns] =
|
|
6173
|
-
const [error, setError] =
|
|
6174
|
-
const [loading, setLoading] =
|
|
6175
|
-
const [pending, setPending] =
|
|
6176
|
-
const [waiting, setWaiting] =
|
|
6177
|
-
const [dragging, setDragging] =
|
|
6178
|
-
const [over, setOver] =
|
|
6436
|
+
const [definition, setDefinition] = useState22(null);
|
|
6437
|
+
const [columns, setColumns] = useState22([]);
|
|
6438
|
+
const [error, setError] = useState22(null);
|
|
6439
|
+
const [loading, setLoading] = useState22(true);
|
|
6440
|
+
const [pending, setPending] = useState22({ kind: "none" });
|
|
6441
|
+
const [waiting, setWaiting] = useState22(/* @__PURE__ */ new Map());
|
|
6442
|
+
const [dragging, setDragging] = useState22(null);
|
|
6443
|
+
const [over, setOver] = useState22(null);
|
|
6179
6444
|
const alive = useRef5(true);
|
|
6180
6445
|
useEffect12(() => {
|
|
6181
6446
|
alive.current = true;
|
|
@@ -6220,6 +6485,7 @@ function PipelineBoard({
|
|
|
6220
6485
|
() => all.find((f) => f.key !== stageKey) ?? all[0],
|
|
6221
6486
|
[all, stageKey]
|
|
6222
6487
|
);
|
|
6488
|
+
const unplacedLabels = useRecordLabels(titleField ? [titleField] : []);
|
|
6223
6489
|
const measurable = useMemo16(
|
|
6224
6490
|
() => all.filter((f) => ["number", "currency", "percentage"].includes(String(f.type ?? ""))),
|
|
6225
6491
|
[all]
|
|
@@ -6390,7 +6656,7 @@ function PipelineBoard({
|
|
|
6390
6656
|
unplaced.length > 0 ? /* @__PURE__ */ jsxs20("p", { className: "text-xs text-muted-foreground", "data-testid": "pipeline-unplaced", children: [
|
|
6391
6657
|
unplaced.length === 1 ? "One record is" : `${unplaced.length} records are`,
|
|
6392
6658
|
" not in any of these columns \u2014 ",
|
|
6393
|
-
unplaced.slice(0, 3).map((r) =>
|
|
6659
|
+
unplaced.slice(0, 3).map((r) => unplacedName(r, titleField, unplacedLabels)).join(", "),
|
|
6394
6660
|
unplaced.length > 3 ? ` and ${unplaced.length - 3} more` : "",
|
|
6395
6661
|
". Their stage is not one this pipeline offers, so nothing here can draw them; open one from the grid to move it."
|
|
6396
6662
|
] }) : null
|
|
@@ -6406,14 +6672,14 @@ function Held({
|
|
|
6406
6672
|
onFill,
|
|
6407
6673
|
onAsk
|
|
6408
6674
|
}) {
|
|
6409
|
-
const [draft, setDraft] =
|
|
6675
|
+
const [draft, setDraft] = useState22({});
|
|
6410
6676
|
if (pending.kind === "asking") {
|
|
6411
6677
|
return /* @__PURE__ */ jsx24("p", { className: "px-2 py-1 text-xs text-muted-foreground", children: "Asking\u2026" });
|
|
6412
6678
|
}
|
|
6413
6679
|
if (pending.kind === "refused") {
|
|
6414
6680
|
return /* @__PURE__ */ jsxs20("div", { className: "mt-1 rounded border border-destructive/50 bg-destructive/5 p-2 text-xs", children: [
|
|
6415
6681
|
/* @__PURE__ */ jsx24("p", { children: pending.verdict.why }),
|
|
6416
|
-
/* @__PURE__ */ jsx24(
|
|
6682
|
+
/* @__PURE__ */ jsx24(Button18, { size: "sm", variant: "ghost", className: "mt-1 h-6", onClick: onCancel, children: "Close" })
|
|
6417
6683
|
] });
|
|
6418
6684
|
}
|
|
6419
6685
|
if (pending.kind === "approval") {
|
|
@@ -6421,8 +6687,8 @@ function Held({
|
|
|
6421
6687
|
/* @__PURE__ */ jsx24("p", { children: pending.verdict.why }),
|
|
6422
6688
|
pending.verdict.what_happens ? /* @__PURE__ */ jsx24("p", { className: "text-muted-foreground", children: pending.verdict.what_happens }) : null,
|
|
6423
6689
|
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1", children: [
|
|
6424
|
-
/* @__PURE__ */ jsx24(
|
|
6425
|
-
/* @__PURE__ */ jsx24(
|
|
6690
|
+
/* @__PURE__ */ jsx24(Button18, { size: "sm", className: "h-6", onClick: onAsk, children: "Ask for approval" }),
|
|
6691
|
+
/* @__PURE__ */ jsx24(Button18, { size: "sm", variant: "ghost", className: "h-6", onClick: onCancel, children: "Leave it where it was" })
|
|
6426
6692
|
] })
|
|
6427
6693
|
] });
|
|
6428
6694
|
}
|
|
@@ -6435,7 +6701,7 @@ function Held({
|
|
|
6435
6701
|
(pending.result.approvers ?? []).map((a) => a.name ?? "somebody who can approve it").join(", "),
|
|
6436
6702
|
"."
|
|
6437
6703
|
] }) : null,
|
|
6438
|
-
/* @__PURE__ */ jsx24(
|
|
6704
|
+
/* @__PURE__ */ jsx24(Button18, { size: "sm", variant: "ghost", className: "mt-1 h-6", onClick: onCancel, children: "Close" })
|
|
6439
6705
|
] });
|
|
6440
6706
|
}
|
|
6441
6707
|
if (pending.kind === "warned") {
|
|
@@ -6444,7 +6710,7 @@ function Held({
|
|
|
6444
6710
|
/* @__PURE__ */ jsx24("p", { children: w.why }),
|
|
6445
6711
|
/* @__PURE__ */ jsx24("p", { className: "text-muted-foreground", children: w.what_to_do })
|
|
6446
6712
|
] }, w.rule_id)),
|
|
6447
|
-
/* @__PURE__ */ jsx24(
|
|
6713
|
+
/* @__PURE__ */ jsx24(Button18, { size: "sm", variant: "ghost", className: "h-6 self-start", onClick: onCancel, children: "Close" })
|
|
6448
6714
|
] });
|
|
6449
6715
|
}
|
|
6450
6716
|
if (pending.kind !== "needs") return null;
|
|
@@ -6465,7 +6731,7 @@ function Held({
|
|
|
6465
6731
|
] }, m.key)),
|
|
6466
6732
|
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1", children: [
|
|
6467
6733
|
ready ? /* @__PURE__ */ jsx24(
|
|
6468
|
-
|
|
6734
|
+
Button18,
|
|
6469
6735
|
{
|
|
6470
6736
|
size: "sm",
|
|
6471
6737
|
className: "h-6",
|
|
@@ -6477,7 +6743,7 @@ function Held({
|
|
|
6477
6743
|
missing.length === 1 ? "it" : "them",
|
|
6478
6744
|
" in and the move goes through."
|
|
6479
6745
|
] }),
|
|
6480
|
-
/* @__PURE__ */ jsx24(
|
|
6746
|
+
/* @__PURE__ */ jsx24(Button18, { size: "sm", variant: "ghost", className: "h-6", onClick: onCancel, children: "Leave it where it was" })
|
|
6481
6747
|
] }),
|
|
6482
6748
|
fields.length === 0 ? null : null
|
|
6483
6749
|
] });
|
|
@@ -6527,6 +6793,10 @@ function Card({
|
|
|
6527
6793
|
}
|
|
6528
6794
|
);
|
|
6529
6795
|
}
|
|
6796
|
+
function unplacedName(record, field, labels) {
|
|
6797
|
+
if (!field) return rowName(record, null, "Untitled");
|
|
6798
|
+
return scalarText(field, (record.document ?? {})[field.key], labels);
|
|
6799
|
+
}
|
|
6530
6800
|
|
|
6531
6801
|
// src/ViewSwitcher.tsx
|
|
6532
6802
|
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
@@ -6534,7 +6804,7 @@ var NO_FIELDS = [];
|
|
|
6534
6804
|
function useViewRecords(view, pageSize = 200) {
|
|
6535
6805
|
const client = useRecordsClient16();
|
|
6536
6806
|
const table = useRecords4(view.ruleId ? null : view.subject, { pageSize });
|
|
6537
|
-
const [ruled, setRuled] =
|
|
6807
|
+
const [ruled, setRuled] = useState23({
|
|
6538
6808
|
rows: [],
|
|
6539
6809
|
loading: Boolean(view.ruleId),
|
|
6540
6810
|
error: null
|
|
@@ -6590,8 +6860,8 @@ function ViewSwitcher({
|
|
|
6590
6860
|
pageSize = 200,
|
|
6591
6861
|
className
|
|
6592
6862
|
}) {
|
|
6593
|
-
const [layout, setLayout] =
|
|
6594
|
-
const [local, setLocal] =
|
|
6863
|
+
const [layout, setLayout] = useState23(view.layout);
|
|
6864
|
+
const [local, setLocal] = useState23({});
|
|
6595
6865
|
useEffect13(() => {
|
|
6596
6866
|
setLayout(view.layout);
|
|
6597
6867
|
setLocal({});
|
|
@@ -6609,7 +6879,7 @@ function ViewSwitcher({
|
|
|
6609
6879
|
/* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-2", children: [
|
|
6610
6880
|
/* @__PURE__ */ jsx25("span", { className: "truncate text-sm font-medium", children: view.name }),
|
|
6611
6881
|
/* @__PURE__ */ jsx25("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Layout", children: VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx25(
|
|
6612
|
-
|
|
6882
|
+
Button19,
|
|
6613
6883
|
{
|
|
6614
6884
|
size: "sm",
|
|
6615
6885
|
variant: option === layout ? "secondary" : "ghost",
|
|
@@ -6653,7 +6923,7 @@ function offerableFields(all, want) {
|
|
|
6653
6923
|
}
|
|
6654
6924
|
function useStageField(tableId) {
|
|
6655
6925
|
const client = useRecordsClient16();
|
|
6656
|
-
const [stage, setStage] =
|
|
6926
|
+
const [stage, setStage] = useState23({
|
|
6657
6927
|
asked: false,
|
|
6658
6928
|
key: null
|
|
6659
6929
|
});
|
|
@@ -6922,9 +7192,9 @@ function Card2({
|
|
|
6922
7192
|
}
|
|
6923
7193
|
|
|
6924
7194
|
// src/ViewBar.tsx
|
|
6925
|
-
import { useCallback as useCallback11, useEffect as useEffect14, useState as
|
|
7195
|
+
import { useCallback as useCallback11, useEffect as useEffect14, useState as useState24 } from "react";
|
|
6926
7196
|
import { useRecordsClient as useRecordsClient17 } from "@ai-matrx/records/react";
|
|
6927
|
-
import { Button as
|
|
7197
|
+
import { Button as Button20, Input as Input2, Skeleton as Skeleton8, cn as cn20 } from "@ai-matrx/design-system";
|
|
6928
7198
|
|
|
6929
7199
|
// src/seedOnce.ts
|
|
6930
7200
|
import { useCallback as useCallback10, useRef as useRef6 } from "react";
|
|
@@ -6947,11 +7217,11 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, className }) {
|
|
|
6947
7217
|
const table = useTable8(tableId);
|
|
6948
7218
|
const rights = useTableRights(table.data);
|
|
6949
7219
|
const home = useSystemTable(VIEW_TABLE);
|
|
6950
|
-
const [views, setViews] =
|
|
6951
|
-
const [error, setError] =
|
|
6952
|
-
const [active, setActive] =
|
|
6953
|
-
const [naming, setNaming] =
|
|
6954
|
-
const [draftName, setDraftName] =
|
|
7220
|
+
const [views, setViews] = useState24(null);
|
|
7221
|
+
const [error, setError] = useState24(null);
|
|
7222
|
+
const [active, setActive] = useState24(activeViewId ?? null);
|
|
7223
|
+
const [naming, setNaming] = useState24(false);
|
|
7224
|
+
const [draftName, setDraftName] = useState24("");
|
|
6955
7225
|
const viewTableId = home.tableId;
|
|
6956
7226
|
const load = useCallback11(async () => {
|
|
6957
7227
|
if (!viewTableId) return;
|
|
@@ -7012,11 +7282,11 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, className }) {
|
|
|
7012
7282
|
if (home.error) {
|
|
7013
7283
|
return /* @__PURE__ */ jsx26("div", { className: cn20("flex min-w-0 items-center gap-2 overflow-x-auto", className), children: /* @__PURE__ */ jsx26("span", { className: "truncate text-xs text-muted-foreground", children: SAVED_VIEWS_UNAVAILABLE }) });
|
|
7014
7284
|
}
|
|
7015
|
-
if (error) return /* @__PURE__ */ jsx26(RefusalNotice, { error, className, actions: /* @__PURE__ */ jsx26(
|
|
7285
|
+
if (error) return /* @__PURE__ */ jsx26(RefusalNotice, { error, className, actions: /* @__PURE__ */ jsx26(Button20, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" }) });
|
|
7016
7286
|
if (home.loading || views === null) return /* @__PURE__ */ jsx26(Skeleton8, { className: cn20("h-7 w-64", className) });
|
|
7017
7287
|
return /* @__PURE__ */ jsxs22("div", { className: cn20("flex items-center gap-1 overflow-x-auto", className), role: "group", "aria-label": "Saved views", children: [
|
|
7018
7288
|
views.map((view) => /* @__PURE__ */ jsxs22(
|
|
7019
|
-
|
|
7289
|
+
Button20,
|
|
7020
7290
|
{
|
|
7021
7291
|
size: "sm",
|
|
7022
7292
|
variant: view.id === active ? "secondary" : "ghost",
|
|
@@ -7053,18 +7323,18 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, className }) {
|
|
|
7053
7323
|
placeholder: "View name"
|
|
7054
7324
|
}
|
|
7055
7325
|
),
|
|
7056
|
-
/* @__PURE__ */ jsx26(
|
|
7326
|
+
/* @__PURE__ */ jsx26(Button20, { size: "sm", type: "submit", children: "Save" })
|
|
7057
7327
|
]
|
|
7058
7328
|
}
|
|
7059
|
-
) : /* @__PURE__ */ jsx26(
|
|
7329
|
+
) : /* @__PURE__ */ jsx26(Button20, { size: "sm", variant: "ghost", className: "ml-1", onClick: () => setNaming(true), children: "New view" }) : null,
|
|
7060
7330
|
views.length === 0 && !rights.admin ? /* @__PURE__ */ jsx26("span", { className: "text-xs text-muted-foreground", children: rights.why("structure") }) : null
|
|
7061
7331
|
] });
|
|
7062
7332
|
}
|
|
7063
7333
|
|
|
7064
7334
|
// src/ProposalRow.tsx
|
|
7065
|
-
import { useState as
|
|
7335
|
+
import { useState as useState25 } from "react";
|
|
7066
7336
|
import { useRecordsClient as useRecordsClient18 } from "@ai-matrx/records/react";
|
|
7067
|
-
import { Badge as Badge7, Button as
|
|
7337
|
+
import { Badge as Badge7, Button as Button21, cn as cn21 } from "@ai-matrx/design-system";
|
|
7068
7338
|
import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7069
7339
|
var ACT_WORD = {
|
|
7070
7340
|
add: "Add",
|
|
@@ -7081,9 +7351,9 @@ function ProposalRow({
|
|
|
7081
7351
|
className
|
|
7082
7352
|
}) {
|
|
7083
7353
|
const client = useRecordsClient18();
|
|
7084
|
-
const [settled, setSettled] =
|
|
7085
|
-
const [busy, setBusy] =
|
|
7086
|
-
const [confirming, setConfirming] =
|
|
7354
|
+
const [settled, setSettled] = useState25(outcome ?? null);
|
|
7355
|
+
const [busy, setBusy] = useState25(false);
|
|
7356
|
+
const [confirming, setConfirming] = useState25(false);
|
|
7087
7357
|
async function applyThroughTheStore() {
|
|
7088
7358
|
if (change.act === "add") {
|
|
7089
7359
|
if (!change.table) {
|
|
@@ -7136,7 +7406,7 @@ function ProposalRow({
|
|
|
7136
7406
|
}
|
|
7137
7407
|
) : readOnlyReason ? null : /* @__PURE__ */ jsxs23("span", { className: "flex shrink-0 items-center gap-1", children: [
|
|
7138
7408
|
/* @__PURE__ */ jsx27(
|
|
7139
|
-
|
|
7409
|
+
Button21,
|
|
7140
7410
|
{
|
|
7141
7411
|
size: "sm",
|
|
7142
7412
|
variant: "ghost",
|
|
@@ -7146,7 +7416,7 @@ function ProposalRow({
|
|
|
7146
7416
|
}
|
|
7147
7417
|
),
|
|
7148
7418
|
/* @__PURE__ */ jsx27(
|
|
7149
|
-
|
|
7419
|
+
Button21,
|
|
7150
7420
|
{
|
|
7151
7421
|
size: "sm",
|
|
7152
7422
|
disabled: busy,
|
|
@@ -7160,22 +7430,22 @@ function ProposalRow({
|
|
|
7160
7430
|
settled ? /* @__PURE__ */ jsx27("p", { className: "text-xs text-muted-foreground", children: settled.sentence }) : null,
|
|
7161
7431
|
confirming ? /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2 rounded bg-destructive/10 p-2 text-xs", children: [
|
|
7162
7432
|
/* @__PURE__ */ jsx27("span", { className: "min-w-0 flex-1", children: "Accepting this deletes the record. It stays restorable for this table's retention, and after that it is gone." }),
|
|
7163
|
-
/* @__PURE__ */ jsx27(
|
|
7164
|
-
/* @__PURE__ */ jsx27(
|
|
7433
|
+
/* @__PURE__ */ jsx27(Button21, { size: "sm", variant: "ghost", onClick: () => setConfirming(false), children: "Cancel" }),
|
|
7434
|
+
/* @__PURE__ */ jsx27(Button21, { size: "sm", variant: "destructive", disabled: busy, onClick: () => void accept(), children: "Delete it" })
|
|
7165
7435
|
] }) : null,
|
|
7166
7436
|
readOnlyReason && !settled ? /* @__PURE__ */ jsx27("p", { className: "text-xs text-muted-foreground", children: readOnlyReason }) : null
|
|
7167
7437
|
] });
|
|
7168
7438
|
}
|
|
7169
7439
|
|
|
7170
7440
|
// src/ActionInbox.tsx
|
|
7171
|
-
import { useCallback as useCallback13, useEffect as useEffect16, useMemo as useMemo19, useRef as useRef7, useState as
|
|
7441
|
+
import { useCallback as useCallback13, useEffect as useEffect16, useMemo as useMemo19, useRef as useRef7, useState as useState27 } from "react";
|
|
7172
7442
|
import { useRecordsClient as useRecordsClient20 } from "@ai-matrx/records/react";
|
|
7173
|
-
import { Badge as Badge9, Button as
|
|
7443
|
+
import { Badge as Badge9, Button as Button23, Skeleton as Skeleton10, cn as cn23 } from "@ai-matrx/design-system";
|
|
7174
7444
|
|
|
7175
7445
|
// src/ChecklistRunner.tsx
|
|
7176
|
-
import { useCallback as useCallback12, useEffect as useEffect15, useMemo as useMemo18, useState as
|
|
7446
|
+
import { useCallback as useCallback12, useEffect as useEffect15, useMemo as useMemo18, useState as useState26 } from "react";
|
|
7177
7447
|
import { useRecordsClient as useRecordsClient19, useTable as useTable9 } from "@ai-matrx/records/react";
|
|
7178
|
-
import { Badge as Badge8, BasicInput as BasicInput7, BasicTextarea as BasicTextarea4, Button as
|
|
7448
|
+
import { Badge as Badge8, BasicInput as BasicInput7, BasicTextarea as BasicTextarea4, Button as Button22, Skeleton as Skeleton9, cn as cn22 } from "@ai-matrx/design-system";
|
|
7179
7449
|
import { Fragment as Fragment12, jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
7180
7450
|
var DUE_WORD = {
|
|
7181
7451
|
overdue: "Overdue",
|
|
@@ -7204,13 +7474,13 @@ function ChecklistRunner({
|
|
|
7204
7474
|
const client = useRecordsClient19();
|
|
7205
7475
|
const table = useTable9(tableId ?? null);
|
|
7206
7476
|
const rights = useTableRights(table.data);
|
|
7207
|
-
const [runs, setRuns] =
|
|
7208
|
-
const [activeId, setActiveId] =
|
|
7209
|
-
const [steps, setSteps] =
|
|
7210
|
-
const [templates, setTemplates] =
|
|
7211
|
-
const [error, setError] =
|
|
7212
|
-
const [busy, setBusy] =
|
|
7213
|
-
const [said, setSaid] =
|
|
7477
|
+
const [runs, setRuns] = useState26(null);
|
|
7478
|
+
const [activeId, setActiveId] = useState26(runId ?? null);
|
|
7479
|
+
const [steps, setSteps] = useState26(null);
|
|
7480
|
+
const [templates, setTemplates] = useState26(null);
|
|
7481
|
+
const [error, setError] = useState26(null);
|
|
7482
|
+
const [busy, setBusy] = useState26(null);
|
|
7483
|
+
const [said, setSaid] = useState26(null);
|
|
7214
7484
|
const mayStart = offerToStart ?? Boolean(recordId);
|
|
7215
7485
|
const loadRuns = useCallback12(async () => {
|
|
7216
7486
|
if (runId) {
|
|
@@ -7357,7 +7627,7 @@ function ChecklistRunner({
|
|
|
7357
7627
|
mayStart && rights.write && templates && templates.length > 0 ? /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-1.5 border-t pt-2", children: [
|
|
7358
7628
|
/* @__PURE__ */ jsx28("span", { className: "text-xs text-muted-foreground", children: "Start:" }),
|
|
7359
7629
|
templates.map((t) => /* @__PURE__ */ jsx28(
|
|
7360
|
-
|
|
7630
|
+
Button22,
|
|
7361
7631
|
{
|
|
7362
7632
|
size: "sm",
|
|
7363
7633
|
variant: "outline",
|
|
@@ -7377,7 +7647,7 @@ function StepRow({
|
|
|
7377
7647
|
onComplete,
|
|
7378
7648
|
className
|
|
7379
7649
|
}) {
|
|
7380
|
-
const [answer, setAnswer] =
|
|
7650
|
+
const [answer, setAnswer] = useState26("");
|
|
7381
7651
|
const key = step2.requires_key ?? (step2.requires === "note" ? "note" : null);
|
|
7382
7652
|
const asksHere = step2.requires === "note" || step2.requires === "answer";
|
|
7383
7653
|
const needsAnswer = asksHere && answer.trim().length === 0;
|
|
@@ -7434,7 +7704,7 @@ function StepRow({
|
|
|
7434
7704
|
) : null,
|
|
7435
7705
|
step2.requires === "record_field" || step2.requires === "form" || step2.requires === "document" ? /* @__PURE__ */ jsx28("span", { className: "flex-1 text-[11px] text-muted-foreground", children: step2.requires_label ?? REQUIRES_WORD[step2.requires] }) : null,
|
|
7436
7706
|
/* @__PURE__ */ jsx28(
|
|
7437
|
-
|
|
7707
|
+
Button22,
|
|
7438
7708
|
{
|
|
7439
7709
|
size: "sm",
|
|
7440
7710
|
className: "h-7 px-2 text-[11px]",
|
|
@@ -7452,9 +7722,9 @@ function StepRow({
|
|
|
7452
7722
|
function useMyChecklistSteps(limit = 25) {
|
|
7453
7723
|
const client = useRecordsClient19();
|
|
7454
7724
|
const me = client.config.actor.user_id ?? null;
|
|
7455
|
-
const [steps, setSteps] =
|
|
7456
|
-
const [loading, setLoading] =
|
|
7457
|
-
const [error, setError] =
|
|
7725
|
+
const [steps, setSteps] = useState26([]);
|
|
7726
|
+
const [loading, setLoading] = useState26(true);
|
|
7727
|
+
const [error, setError] = useState26(null);
|
|
7458
7728
|
const refresh = useCallback12(async () => {
|
|
7459
7729
|
if (!me) {
|
|
7460
7730
|
setSteps([]);
|
|
@@ -7491,8 +7761,8 @@ function useMyChecklistSteps(limit = 25) {
|
|
|
7491
7761
|
function MyChecklistSteps({ className }) {
|
|
7492
7762
|
const client = useRecordsClient19();
|
|
7493
7763
|
const { steps, loading, error, refresh } = useMyChecklistSteps();
|
|
7494
|
-
const [busy, setBusy] =
|
|
7495
|
-
const [refusal, setRefusal] =
|
|
7764
|
+
const [busy, setBusy] = useState26(null);
|
|
7765
|
+
const [refusal, setRefusal] = useState26(null);
|
|
7496
7766
|
const complete = useCallback12(
|
|
7497
7767
|
async (step2, evidence) => {
|
|
7498
7768
|
setBusy(step2.step_id);
|
|
@@ -7531,11 +7801,11 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
|
|
|
7531
7801
|
const client = useRecordsClient19();
|
|
7532
7802
|
const table = useTable9(tableId);
|
|
7533
7803
|
const rights = useTableRights(table.data);
|
|
7534
|
-
const [templates, setTemplates] =
|
|
7535
|
-
const [runs, setRuns] =
|
|
7536
|
-
const [error, setError] =
|
|
7537
|
-
const [editing, setEditing] =
|
|
7538
|
-
const [openRun, setOpenRun] =
|
|
7804
|
+
const [templates, setTemplates] = useState26(null);
|
|
7805
|
+
const [runs, setRuns] = useState26(null);
|
|
7806
|
+
const [error, setError] = useState26(null);
|
|
7807
|
+
const [editing, setEditing] = useState26(null);
|
|
7808
|
+
const [openRun, setOpenRun] = useState26(null);
|
|
7539
7809
|
const load = useCallback12(async () => {
|
|
7540
7810
|
const [t, r] = await Promise.all([
|
|
7541
7811
|
client.checklistTemplates({ about_table_id: tableId, limit: 100 }),
|
|
@@ -7570,7 +7840,7 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
|
|
|
7570
7840
|
}
|
|
7571
7841
|
if (openRun) {
|
|
7572
7842
|
return /* @__PURE__ */ jsxs24("div", { className: cn22("flex flex-col gap-2", className), children: [
|
|
7573
|
-
/* @__PURE__ */ jsx28(
|
|
7843
|
+
/* @__PURE__ */ jsx28(Button22, { size: "sm", variant: "ghost", className: "self-start", onClick: () => setOpenRun(null), children: "Back to checklists" }),
|
|
7574
7844
|
/* @__PURE__ */ jsx28(ChecklistRunner, { tableId, runId: openRun, offerToStart: false })
|
|
7575
7845
|
] });
|
|
7576
7846
|
}
|
|
@@ -7578,7 +7848,7 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
|
|
|
7578
7848
|
/* @__PURE__ */ jsxs24("header", { className: "flex items-center gap-2", children: [
|
|
7579
7849
|
/* @__PURE__ */ jsx28("h3", { className: "text-sm font-medium", children: "Checklists" }),
|
|
7580
7850
|
/* @__PURE__ */ jsx28("span", { className: "text-xs text-muted-foreground", children: templates.length === 0 ? "none yet" : `${templates.length}` }),
|
|
7581
|
-
rights.structure ? /* @__PURE__ */ jsx28(
|
|
7851
|
+
rights.structure ? /* @__PURE__ */ jsx28(Button22, { size: "sm", variant: "outline", className: "ml-auto", onClick: () => setEditing("new"), children: "Write one" }) : null
|
|
7582
7852
|
] }),
|
|
7583
7853
|
error ? /* @__PURE__ */ jsx28(RefusalNotice, { error }) : null,
|
|
7584
7854
|
templates.length === 0 ? /* @__PURE__ */ jsx28("p", { className: "text-xs text-muted-foreground", children: NO_TEMPLATES }) : null,
|
|
@@ -7605,7 +7875,7 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
|
|
|
7605
7875
|
] })
|
|
7606
7876
|
] }),
|
|
7607
7877
|
rights.structure ? /* @__PURE__ */ jsx28(
|
|
7608
|
-
|
|
7878
|
+
Button22,
|
|
7609
7879
|
{
|
|
7610
7880
|
size: "sm",
|
|
7611
7881
|
variant: "ghost",
|
|
@@ -7690,12 +7960,12 @@ function ChecklistTemplateEditor({
|
|
|
7690
7960
|
className
|
|
7691
7961
|
}) {
|
|
7692
7962
|
const client = useRecordsClient19();
|
|
7693
|
-
const [name, setName] =
|
|
7694
|
-
const [rows, setRows] =
|
|
7695
|
-
const [refusal, setRefusal] =
|
|
7696
|
-
const [error, setError] =
|
|
7697
|
-
const [busy, setBusy] =
|
|
7698
|
-
const [loading, setLoading] =
|
|
7963
|
+
const [name, setName] = useState26("");
|
|
7964
|
+
const [rows, setRows] = useState26([{ ...EMPTY_ROW }]);
|
|
7965
|
+
const [refusal, setRefusal] = useState26(null);
|
|
7966
|
+
const [error, setError] = useState26(null);
|
|
7967
|
+
const [busy, setBusy] = useState26(false);
|
|
7968
|
+
const [loading, setLoading] = useState26(Boolean(templateId));
|
|
7699
7969
|
useEffect15(() => {
|
|
7700
7970
|
if (!templateId) return;
|
|
7701
7971
|
let cancelled = false;
|
|
@@ -7766,7 +8036,7 @@ function ChecklistTemplateEditor({
|
|
|
7766
8036
|
return /* @__PURE__ */ jsxs24("section", { className: cn22("flex flex-col gap-2", className), "data-testid": "checklist-editor", children: [
|
|
7767
8037
|
/* @__PURE__ */ jsxs24("header", { className: "flex items-center gap-2", children: [
|
|
7768
8038
|
/* @__PURE__ */ jsx28("h3", { className: "text-sm font-medium", children: templateId ? "Change this checklist" : "Write a checklist" }),
|
|
7769
|
-
/* @__PURE__ */ jsx28(
|
|
8039
|
+
/* @__PURE__ */ jsx28(Button22, { size: "sm", variant: "ghost", className: "ml-auto", onClick: () => onDone?.(), children: "Cancel" })
|
|
7770
8040
|
] }),
|
|
7771
8041
|
/* @__PURE__ */ jsx28(
|
|
7772
8042
|
BasicInput7,
|
|
@@ -7793,7 +8063,7 @@ function ChecklistTemplateEditor({
|
|
|
7793
8063
|
}
|
|
7794
8064
|
),
|
|
7795
8065
|
/* @__PURE__ */ jsx28(
|
|
7796
|
-
|
|
8066
|
+
Button22,
|
|
7797
8067
|
{
|
|
7798
8068
|
size: "sm",
|
|
7799
8069
|
variant: "ghost",
|
|
@@ -7859,8 +8129,8 @@ function ChecklistTemplateEditor({
|
|
|
7859
8129
|
] })
|
|
7860
8130
|
] }, index)) }),
|
|
7861
8131
|
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-1.5", children: [
|
|
7862
|
-
/* @__PURE__ */ jsx28(
|
|
7863
|
-
/* @__PURE__ */ jsx28(
|
|
8132
|
+
/* @__PURE__ */ jsx28(Button22, { size: "sm", variant: "outline", onClick: () => setRows((held) => [...held, { ...EMPTY_ROW }]), children: "Add a step" }),
|
|
8133
|
+
/* @__PURE__ */ jsx28(Button22, { size: "sm", disabled: busy || refusal !== null || spec.steps.length === 0, onClick: () => void save(), children: busy ? "\u2026" : "Save" })
|
|
7864
8134
|
] }),
|
|
7865
8135
|
refusal ? /* @__PURE__ */ jsx28("p", { className: "text-xs text-muted-foreground", "data-testid": "checklist-editor-refusal", children: refusal }) : null
|
|
7866
8136
|
] });
|
|
@@ -7913,11 +8183,11 @@ var DUE_WORD2 = {
|
|
|
7913
8183
|
};
|
|
7914
8184
|
function ActionInbox({ tableId, includeSettled = false, onOpenRecord, className }) {
|
|
7915
8185
|
const client = useRecordsClient20();
|
|
7916
|
-
const [items, setItems] =
|
|
7917
|
-
const [error, setError] =
|
|
7918
|
-
const [outcome, setOutcome] =
|
|
7919
|
-
const [busy, setBusy] =
|
|
7920
|
-
const [cursor, setCursor] =
|
|
8186
|
+
const [items, setItems] = useState27(null);
|
|
8187
|
+
const [error, setError] = useState27(null);
|
|
8188
|
+
const [outcome, setOutcome] = useState27({});
|
|
8189
|
+
const [busy, setBusy] = useState27(null);
|
|
8190
|
+
const [cursor, setCursor] = useState27(0);
|
|
7921
8191
|
const listRef = useRef7(null);
|
|
7922
8192
|
const load = useCallback13(async () => {
|
|
7923
8193
|
const result = await client.workInbox({ limit: 200, includeDecided: includeSettled });
|
|
@@ -8002,7 +8272,7 @@ function ActionInbox({ tableId, includeSettled = false, onOpenRecord, className
|
|
|
8002
8272
|
/* @__PURE__ */ jsx29("h3", { className: "text-sm font-medium", children: "Inbox" }),
|
|
8003
8273
|
/* @__PURE__ */ jsx29("span", { className: "text-xs text-muted-foreground", children: shown.length }),
|
|
8004
8274
|
/* @__PURE__ */ jsx29("span", { className: "ml-auto hidden text-[10px] text-muted-foreground sm:inline", children: "j/k move \xB7 a approve \xB7 d decline \xB7 o open \xB7 r refresh" }),
|
|
8005
|
-
/* @__PURE__ */ jsx29(
|
|
8275
|
+
/* @__PURE__ */ jsx29(Button23, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Refresh" })
|
|
8006
8276
|
] }),
|
|
8007
8277
|
error ? /* @__PURE__ */ jsx29(RefusalNotice, { error }) : null,
|
|
8008
8278
|
shown.length === 0 ? /* @__PURE__ */ jsx29("p", { className: "text-xs text-muted-foreground", children: includeSettled ? "Nothing has come through this inbox yet." : "Nothing is waiting on you." }) : /* @__PURE__ */ jsx29("ol", { ref: listRef, className: "flex min-h-0 flex-col gap-1 overflow-y-auto", children: shown.map((item, index) => {
|
|
@@ -8030,12 +8300,12 @@ function ActionInbox({ tableId, includeSettled = false, onOpenRecord, className
|
|
|
8030
8300
|
children: DUE_WORD2[item.due_state] ?? item.due_state
|
|
8031
8301
|
}
|
|
8032
8302
|
) : null,
|
|
8033
|
-
item.subject_id && onOpenRecord ? /* @__PURE__ */ jsx29(
|
|
8303
|
+
item.subject_id && onOpenRecord ? /* @__PURE__ */ jsx29(Button23, { size: "sm", variant: "ghost", className: "h-5 px-1 text-[11px]", onClick: () => open(item), children: "Open" }) : null
|
|
8034
8304
|
] }),
|
|
8035
8305
|
item.summary ? /* @__PURE__ */ jsx29("p", { className: "text-xs text-muted-foreground", children: item.summary }) : null,
|
|
8036
8306
|
settled ? /* @__PURE__ */ jsx29("p", { className: "text-xs", children: settled }) : item.kind === "assignment" ? /* @__PURE__ */ jsx29("p", { className: "text-[11px] text-muted-foreground", children: item.state === "open" ? "Waiting on you." : `${item.state}.` }) : item.actionable ? /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-1", children: [
|
|
8037
8307
|
/* @__PURE__ */ jsx29(
|
|
8038
|
-
|
|
8308
|
+
Button23,
|
|
8039
8309
|
{
|
|
8040
8310
|
size: "sm",
|
|
8041
8311
|
variant: "ghost",
|
|
@@ -8044,7 +8314,7 @@ function ActionInbox({ tableId, includeSettled = false, onOpenRecord, className
|
|
|
8044
8314
|
children: "Decline"
|
|
8045
8315
|
}
|
|
8046
8316
|
),
|
|
8047
|
-
/* @__PURE__ */ jsx29(
|
|
8317
|
+
/* @__PURE__ */ jsx29(Button23, { size: "sm", disabled: busy === item.item_id, onClick: () => void decide(item, true), children: "Approve" }),
|
|
8048
8318
|
item.requested_by_name ? /* @__PURE__ */ jsxs25("span", { className: "text-[11px] text-muted-foreground", children: [
|
|
8049
8319
|
item.origin === "agent" ? "An agent asked, for " : "Asked by ",
|
|
8050
8320
|
item.requested_by_name
|
|
@@ -8066,24 +8336,24 @@ function ActionInbox({ tableId, includeSettled = false, onOpenRecord, className
|
|
|
8066
8336
|
}
|
|
8067
8337
|
|
|
8068
8338
|
// src/HistoryPanel.tsx
|
|
8069
|
-
import { useCallback as useCallback14, useEffect as useEffect17, useRef as useRef8, useState as
|
|
8339
|
+
import { useCallback as useCallback14, useEffect as useEffect17, useRef as useRef8, useState as useState28 } from "react";
|
|
8070
8340
|
import {
|
|
8071
8341
|
useFields as useFields12,
|
|
8072
8342
|
useRecordsClient as useRecordsClient21,
|
|
8073
8343
|
useTable as useTable10
|
|
8074
8344
|
} from "@ai-matrx/records/react";
|
|
8075
|
-
import { Badge as Badge10, Button as
|
|
8345
|
+
import { Badge as Badge10, Button as Button24, Skeleton as Skeleton11, cn as cn24 } from "@ai-matrx/design-system";
|
|
8076
8346
|
import { jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
8077
8347
|
function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
|
|
8078
8348
|
const client = useRecordsClient21();
|
|
8079
8349
|
const table = useTable10(tableId);
|
|
8080
8350
|
const fields = useFields12(tableId);
|
|
8081
8351
|
const rights = useTableRights(table.data);
|
|
8082
|
-
const [entries, setEntries] =
|
|
8083
|
-
const [error, setError] =
|
|
8084
|
-
const [open, setOpen] =
|
|
8085
|
-
const [pending, setPending] =
|
|
8086
|
-
const [said, setSaid] =
|
|
8352
|
+
const [entries, setEntries] = useState28(null);
|
|
8353
|
+
const [error, setError] = useState28(null);
|
|
8354
|
+
const [open, setOpen] = useState28(null);
|
|
8355
|
+
const [pending, setPending] = useState28({ phase: "idle" });
|
|
8356
|
+
const [said, setSaid] = useState28(null);
|
|
8087
8357
|
const listRef = useRef8(null);
|
|
8088
8358
|
const load = useCallback14(async () => {
|
|
8089
8359
|
const answered = await client.recordHistory({ record_id: recordId });
|
|
@@ -8257,7 +8527,7 @@ function VersionRow({
|
|
|
8257
8527
|
onCancel
|
|
8258
8528
|
}
|
|
8259
8529
|
) : mine && pending.phase === "writing" ? /* @__PURE__ */ jsx30("p", { className: "text-[11px] text-muted-foreground", children: "Putting it back\u2026" }) : /* @__PURE__ */ jsx30("div", { className: "flex", children: /* @__PURE__ */ jsx30(
|
|
8260
|
-
|
|
8530
|
+
Button24,
|
|
8261
8531
|
{
|
|
8262
8532
|
size: "sm",
|
|
8263
8533
|
variant: "secondary",
|
|
@@ -8317,7 +8587,7 @@ function ChangeLine({
|
|
|
8317
8587
|
}
|
|
8318
8588
|
) : null,
|
|
8319
8589
|
onAskAboutField ? /* @__PURE__ */ jsx30(
|
|
8320
|
-
|
|
8590
|
+
Button24,
|
|
8321
8591
|
{
|
|
8322
8592
|
size: "sm",
|
|
8323
8593
|
variant: "ghost",
|
|
@@ -8326,7 +8596,7 @@ function ChangeLine({
|
|
|
8326
8596
|
children: "Who changed this?"
|
|
8327
8597
|
}
|
|
8328
8598
|
) : null,
|
|
8329
|
-
canRestore ? /* @__PURE__ */ jsx30(
|
|
8599
|
+
canRestore ? /* @__PURE__ */ jsx30(Button24, { size: "sm", variant: "ghost", className: "h-5 shrink-0 px-1 text-[10px]", onClick: onRestore, children: "Put this one back" }) : null
|
|
8330
8600
|
] });
|
|
8331
8601
|
}
|
|
8332
8602
|
function ConfirmRestore({
|
|
@@ -8346,8 +8616,8 @@ function ConfirmRestore({
|
|
|
8346
8616
|
] }, change.key)) }),
|
|
8347
8617
|
/* @__PURE__ */ jsx30("p", { className: "text-[11px] text-muted-foreground", children: "It is saved as a new version. Nothing in the history is erased, and this can be put back too." }),
|
|
8348
8618
|
/* @__PURE__ */ jsxs26("div", { className: "flex gap-1", children: [
|
|
8349
|
-
/* @__PURE__ */ jsx30(
|
|
8350
|
-
/* @__PURE__ */ jsx30(
|
|
8619
|
+
/* @__PURE__ */ jsx30(Button24, { size: "sm", className: "h-6 px-2 text-[11px]", disabled: busy || preview.count === 0, onClick: onConfirm, children: busy ? "Putting it back\u2026" : "Yes, put it back" }),
|
|
8620
|
+
/* @__PURE__ */ jsx30(Button24, { size: "sm", variant: "ghost", className: "h-6 px-2 text-[11px]", onClick: onCancel, children: "Cancel" })
|
|
8351
8621
|
] })
|
|
8352
8622
|
] });
|
|
8353
8623
|
}
|
|
@@ -8375,29 +8645,29 @@ function say(value, field) {
|
|
|
8375
8645
|
}
|
|
8376
8646
|
|
|
8377
8647
|
// src/CommentThread.tsx
|
|
8378
|
-
import { useCallback as useCallback15, useEffect as useEffect18, useMemo as useMemo20, useRef as useRef9, useState as
|
|
8648
|
+
import { useCallback as useCallback15, useEffect as useEffect18, useMemo as useMemo20, useRef as useRef9, useState as useState29 } from "react";
|
|
8379
8649
|
import {
|
|
8380
8650
|
useFields as useFields13,
|
|
8381
8651
|
useRecordsClient as useRecordsClient22,
|
|
8382
8652
|
useTable as useTable11
|
|
8383
8653
|
} from "@ai-matrx/records/react";
|
|
8384
|
-
import { Badge as Badge11, Button as
|
|
8654
|
+
import { Badge as Badge11, Button as Button25, Skeleton as Skeleton12, Textarea, cn as cn25 } from "@ai-matrx/design-system";
|
|
8385
8655
|
import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
8386
8656
|
function CommentThread({ tableId, recordId, fieldKey, className }) {
|
|
8387
8657
|
const client = useRecordsClient22();
|
|
8388
8658
|
const table = useTable11(tableId);
|
|
8389
8659
|
const fields = useFields13(tableId);
|
|
8390
8660
|
const host = useRecordsUi();
|
|
8391
|
-
const [thread, setThread] =
|
|
8392
|
-
const [error, setError] =
|
|
8393
|
-
const [draft, setDraft] =
|
|
8394
|
-
const [replyTo, setReplyTo] =
|
|
8395
|
-
const [busy, setBusy] =
|
|
8396
|
-
const [said, setSaid] =
|
|
8397
|
-
const [showResolved, setShowResolved] =
|
|
8398
|
-
const [people, setPeople] =
|
|
8399
|
-
const [mentionQuery, setMentionQuery] =
|
|
8400
|
-
const [picked, setPicked] =
|
|
8661
|
+
const [thread, setThread] = useState29(null);
|
|
8662
|
+
const [error, setError] = useState29(null);
|
|
8663
|
+
const [draft, setDraft] = useState29("");
|
|
8664
|
+
const [replyTo, setReplyTo] = useState29(null);
|
|
8665
|
+
const [busy, setBusy] = useState29(false);
|
|
8666
|
+
const [said, setSaid] = useState29(null);
|
|
8667
|
+
const [showResolved, setShowResolved] = useState29(false);
|
|
8668
|
+
const [people, setPeople] = useState29([]);
|
|
8669
|
+
const [mentionQuery, setMentionQuery] = useState29(null);
|
|
8670
|
+
const [picked, setPicked] = useState29([]);
|
|
8401
8671
|
const box = useRef9(null);
|
|
8402
8672
|
const load = useCallback15(async () => {
|
|
8403
8673
|
const answered = await client.commentThread({ record_id: recordId, include_resolved: showResolved });
|
|
@@ -8486,7 +8756,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
|
|
|
8486
8756
|
/* @__PURE__ */ jsx31("h3", { className: "text-sm font-medium", children: fieldLabel ? `Comments on ${fieldLabel}` : "Comments" }),
|
|
8487
8757
|
/* @__PURE__ */ jsx31("span", { className: "text-xs text-muted-foreground", children: shown.length }),
|
|
8488
8758
|
/* @__PURE__ */ jsx31(
|
|
8489
|
-
|
|
8759
|
+
Button25,
|
|
8490
8760
|
{
|
|
8491
8761
|
size: "sm",
|
|
8492
8762
|
variant: "ghost",
|
|
@@ -8520,7 +8790,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
|
|
|
8520
8790
|
children: [
|
|
8521
8791
|
replyTo ? /* @__PURE__ */ jsxs27("span", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
8522
8792
|
"Replying",
|
|
8523
|
-
/* @__PURE__ */ jsx31(
|
|
8793
|
+
/* @__PURE__ */ jsx31(Button25, { size: "sm", variant: "ghost", className: "h-5 px-1", type: "button", onClick: () => setReplyTo(null), children: "Cancel" })
|
|
8524
8794
|
] }) : null,
|
|
8525
8795
|
picked.length > 0 ? /* @__PURE__ */ jsx31("div", { className: "flex flex-wrap gap-1", children: picked.map((p) => /* @__PURE__ */ jsxs27(Badge11, { variant: "secondary", className: "text-[10px]", children: [
|
|
8526
8796
|
p.name,
|
|
@@ -8578,7 +8848,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
|
|
|
8578
8848
|
) }, p.userId)) }) : null,
|
|
8579
8849
|
/* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2", children: [
|
|
8580
8850
|
!host.members ? /* @__PURE__ */ jsx31("span", { className: "text-[11px] text-muted-foreground", children: "Naming somebody needs this screen to know who is in the organization, and it has not been told." }) : null,
|
|
8581
|
-
/* @__PURE__ */ jsx31(
|
|
8851
|
+
/* @__PURE__ */ jsx31(Button25, { size: "sm", type: "submit", className: "ml-auto h-6 px-2 text-[11px]", disabled: busy || draft.trim() === "", children: busy ? "Posting\u2026" : "Comment" })
|
|
8582
8852
|
] })
|
|
8583
8853
|
]
|
|
8584
8854
|
}
|
|
@@ -8605,8 +8875,8 @@ function Line({
|
|
|
8605
8875
|
comment.resolved_by_name ? ` by ${comment.resolved_by_name}` : ""
|
|
8606
8876
|
] }) : null,
|
|
8607
8877
|
/* @__PURE__ */ jsxs27("span", { className: "ml-auto flex gap-1", children: [
|
|
8608
|
-
onReply ? /* @__PURE__ */ jsx31(
|
|
8609
|
-
onResolve ? /* @__PURE__ */ jsx31(
|
|
8878
|
+
onReply ? /* @__PURE__ */ jsx31(Button25, { size: "sm", variant: "ghost", className: "h-5 px-1 text-[11px]", onClick: onReply, children: "Reply" }) : null,
|
|
8879
|
+
onResolve ? /* @__PURE__ */ jsx31(Button25, { size: "sm", variant: "ghost", className: "h-5 px-1 text-[11px]", onClick: onResolve, children: comment.resolved_at ? "Re-open" : "Resolve" }) : null
|
|
8610
8880
|
] })
|
|
8611
8881
|
] }),
|
|
8612
8882
|
/* @__PURE__ */ jsx31("p", { className: "whitespace-pre-wrap text-xs", children: comment.body }),
|
|
@@ -8618,13 +8888,13 @@ function Line({
|
|
|
8618
8888
|
}
|
|
8619
8889
|
|
|
8620
8890
|
// src/FieldHistoryPanel.tsx
|
|
8621
|
-
import { useCallback as useCallback16, useEffect as useEffect19, useState as
|
|
8891
|
+
import { useCallback as useCallback16, useEffect as useEffect19, useState as useState30 } from "react";
|
|
8622
8892
|
import {
|
|
8623
8893
|
useFields as useFields14,
|
|
8624
8894
|
useRecordsClient as useRecordsClient23,
|
|
8625
8895
|
useTable as useTable12
|
|
8626
8896
|
} from "@ai-matrx/records/react";
|
|
8627
|
-
import { Badge as Badge12, Button as
|
|
8897
|
+
import { Badge as Badge12, Button as Button26, Skeleton as Skeleton13, cn as cn26 } from "@ai-matrx/design-system";
|
|
8628
8898
|
import { Fragment as Fragment13, jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
8629
8899
|
function FieldHistoryPanel({
|
|
8630
8900
|
tableId,
|
|
@@ -8638,10 +8908,10 @@ function FieldHistoryPanel({
|
|
|
8638
8908
|
const table = useTable12(tableId);
|
|
8639
8909
|
const fields = useFields14(tableId);
|
|
8640
8910
|
const rights = useTableRights(table.data);
|
|
8641
|
-
const [rows, setRows] =
|
|
8642
|
-
const [error, setError] =
|
|
8643
|
-
const [pending, setPending] =
|
|
8644
|
-
const [said, setSaid] =
|
|
8911
|
+
const [rows, setRows] = useState30(null);
|
|
8912
|
+
const [error, setError] = useState30(null);
|
|
8913
|
+
const [pending, setPending] = useState30({ phase: "idle" });
|
|
8914
|
+
const [said, setSaid] = useState30(null);
|
|
8645
8915
|
const load = useCallback16(async () => {
|
|
8646
8916
|
const answered = await client.fieldHistory(
|
|
8647
8917
|
recordId ? { table_id: tableId, field_key: fieldKey, record_id: recordId } : { table_id: tableId, field_key: fieldKey }
|
|
@@ -8693,7 +8963,7 @@ function FieldHistoryPanel({
|
|
|
8693
8963
|
"?"
|
|
8694
8964
|
] }),
|
|
8695
8965
|
/* @__PURE__ */ jsx32("span", { className: "text-xs text-muted-foreground", children: recordId ? "on this record" : "on every record you can see" }),
|
|
8696
|
-
onClose ? /* @__PURE__ */ jsx32(
|
|
8966
|
+
onClose ? /* @__PURE__ */ jsx32(Button26, { size: "sm", variant: "ghost", className: "ml-auto h-6 px-2 text-[11px]", onClick: onClose, children: "Close" }) : null
|
|
8697
8967
|
] }),
|
|
8698
8968
|
said ? /* @__PURE__ */ jsx32("p", { role: "status", className: "text-xs text-muted-foreground", children: said }) : null,
|
|
8699
8969
|
rows.length === 0 ? /* @__PURE__ */ jsxs28("p", { className: "text-xs text-muted-foreground", children: [
|
|
@@ -8705,7 +8975,7 @@ function FieldHistoryPanel({
|
|
|
8705
8975
|
return /* @__PURE__ */ jsxs28("li", { className: "flex flex-col", children: [
|
|
8706
8976
|
/* @__PURE__ */ jsxs28("div", { className: "flex items-baseline gap-2 px-2 py-1.5 text-xs", children: [
|
|
8707
8977
|
onOpenRecord ? /* @__PURE__ */ jsx32(
|
|
8708
|
-
|
|
8978
|
+
Button26,
|
|
8709
8979
|
{
|
|
8710
8980
|
size: "sm",
|
|
8711
8981
|
variant: "ghost",
|
|
@@ -8734,7 +9004,7 @@ function FieldHistoryPanel({
|
|
|
8734
9004
|
}
|
|
8735
9005
|
),
|
|
8736
9006
|
rights.write ? /* @__PURE__ */ jsx32(
|
|
8737
|
-
|
|
9007
|
+
Button26,
|
|
8738
9008
|
{
|
|
8739
9009
|
size: "sm",
|
|
8740
9010
|
variant: "ghost",
|
|
@@ -8846,27 +9116,27 @@ function submissionStamp(args) {
|
|
|
8846
9116
|
}
|
|
8847
9117
|
|
|
8848
9118
|
// src/PortalBuilder.tsx
|
|
8849
|
-
import { useCallback as useCallback17, useEffect as useEffect20, useMemo as useMemo21, useState as
|
|
9119
|
+
import { useCallback as useCallback17, useEffect as useEffect20, useMemo as useMemo21, useState as useState31 } from "react";
|
|
8850
9120
|
import { useRecordsClient as useRecordsClient24, useTables as useTables2 } from "@ai-matrx/records/react";
|
|
8851
|
-
import { BasicInput as BasicInput8, Button as
|
|
9121
|
+
import { BasicInput as BasicInput8, Button as Button27, Checkbox as Checkbox4, Label as Label4, Separator as Separator9, Skeleton as Skeleton14, cn as cn27 } from "@ai-matrx/design-system";
|
|
8852
9122
|
import { Fragment as Fragment14, jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
8853
9123
|
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.";
|
|
8854
9124
|
function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
8855
9125
|
const client = useRecordsClient24();
|
|
8856
9126
|
const tables = useTables2();
|
|
8857
|
-
const [title, setTitle] =
|
|
8858
|
-
const [clientTableId, setClientTableId] =
|
|
8859
|
-
const [exposures, setExposures] =
|
|
8860
|
-
const [fieldsByTable, setFieldsByTable] =
|
|
8861
|
-
const [error, setError] =
|
|
8862
|
-
const [saving, setSaving] =
|
|
8863
|
-
const [savedId, setSavedId] =
|
|
8864
|
-
const [existing, setExisting] =
|
|
8865
|
-
const [loading, setLoading] =
|
|
8866
|
-
const [inviteEmail, setInviteEmail] =
|
|
8867
|
-
const [inviteRecordId, setInviteRecordId] =
|
|
8868
|
-
const [inviting, setInviting] =
|
|
8869
|
-
const [invitationSaid, setInvitationSaid] =
|
|
9127
|
+
const [title, setTitle] = useState31("");
|
|
9128
|
+
const [clientTableId, setClientTableId] = useState31(null);
|
|
9129
|
+
const [exposures, setExposures] = useState31({});
|
|
9130
|
+
const [fieldsByTable, setFieldsByTable] = useState31({});
|
|
9131
|
+
const [error, setError] = useState31(null);
|
|
9132
|
+
const [saving, setSaving] = useState31(false);
|
|
9133
|
+
const [savedId, setSavedId] = useState31(portalId ?? null);
|
|
9134
|
+
const [existing, setExisting] = useState31(null);
|
|
9135
|
+
const [loading, setLoading] = useState31(Boolean(portalId));
|
|
9136
|
+
const [inviteEmail, setInviteEmail] = useState31("");
|
|
9137
|
+
const [inviteRecordId, setInviteRecordId] = useState31("");
|
|
9138
|
+
const [inviting, setInviting] = useState31(false);
|
|
9139
|
+
const [invitationSaid, setInvitationSaid] = useState31(null);
|
|
8870
9140
|
const loadFields = useCallback17(
|
|
8871
9141
|
async (id) => {
|
|
8872
9142
|
if (fieldsByTable[id]) return;
|
|
@@ -8969,8 +9239,8 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
8969
9239
|
/* @__PURE__ */ jsxs29("header", { className: "flex items-center gap-2", children: [
|
|
8970
9240
|
/* @__PURE__ */ jsx33("h3", { className: "text-sm font-medium", children: existing ? "Portal" : "New client portal" }),
|
|
8971
9241
|
/* @__PURE__ */ jsx33("div", { className: "flex-1" }),
|
|
8972
|
-
/* @__PURE__ */ jsx33(
|
|
8973
|
-
onClose ? /* @__PURE__ */ jsx33(
|
|
9242
|
+
/* @__PURE__ */ jsx33(Button27, { size: "sm", disabled: saving || !ready, onClick: () => void save(), children: saving ? "Saving\u2026" : "Save" }),
|
|
9243
|
+
onClose ? /* @__PURE__ */ jsx33(Button27, { size: "sm", variant: "ghost", onClick: onClose, children: "Close" }) : null
|
|
8974
9244
|
] }),
|
|
8975
9245
|
error ? /* @__PURE__ */ jsx33(RefusalNotice, { error }) : null,
|
|
8976
9246
|
/* @__PURE__ */ jsxs29("label", { className: "flex flex-col gap-1", children: [
|
|
@@ -9125,7 +9395,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
9125
9395
|
)
|
|
9126
9396
|
] }),
|
|
9127
9397
|
/* @__PURE__ */ jsx33(
|
|
9128
|
-
|
|
9398
|
+
Button27,
|
|
9129
9399
|
{
|
|
9130
9400
|
size: "sm",
|
|
9131
9401
|
disabled: inviting || inviteEmail.trim() === "" || inviteRecordId.trim() === "",
|
|
@@ -9141,15 +9411,15 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
9141
9411
|
}
|
|
9142
9412
|
|
|
9143
9413
|
// src/PortalsPanel.tsx
|
|
9144
|
-
import { useCallback as useCallback18, useEffect as useEffect21, useMemo as useMemo22, useState as
|
|
9414
|
+
import { useCallback as useCallback18, useEffect as useEffect21, useMemo as useMemo22, useState as useState32 } from "react";
|
|
9145
9415
|
import { useRecordsClient as useRecordsClient25 } from "@ai-matrx/records/react";
|
|
9146
9416
|
import {
|
|
9147
9417
|
portalPath
|
|
9148
9418
|
} from "@ai-matrx/records";
|
|
9149
|
-
import { Badge as Badge13, BasicInput as BasicInput9, Button as
|
|
9419
|
+
import { Badge as Badge13, BasicInput as BasicInput9, Button as Button29, Separator as Separator10, Skeleton as Skeleton15, cn as cn29 } from "@ai-matrx/design-system";
|
|
9150
9420
|
|
|
9151
9421
|
// src/BuildOrAsk.tsx
|
|
9152
|
-
import { Button as
|
|
9422
|
+
import { Button as Button28, cn as cn28 } from "@ai-matrx/design-system";
|
|
9153
9423
|
import { jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
9154
9424
|
var NO_AGENT_PORT = "Asking for one in words needs an agent, which this screen reaches through its host's `onAskForOne` port \u2014 it is not bound here, so build it below instead.";
|
|
9155
9425
|
function BuildOrAsk({
|
|
@@ -9165,8 +9435,8 @@ function BuildOrAsk({
|
|
|
9165
9435
|
return /* @__PURE__ */ jsxs30("div", { className: cn28("rounded-md border border-dashed p-3", className), children: [
|
|
9166
9436
|
/* @__PURE__ */ jsx34("p", { className: "text-xs text-muted-foreground", children }),
|
|
9167
9437
|
/* @__PURE__ */ jsxs30("div", { className: "mt-2.5 flex flex-wrap items-center gap-2", children: [
|
|
9168
|
-
onAsk ? /* @__PURE__ */ jsx34(
|
|
9169
|
-
mayBuild ? /* @__PURE__ */ jsx34(
|
|
9438
|
+
onAsk ? /* @__PURE__ */ jsx34(Button28, { size: "sm", variant: "outline", onClick: onAsk, children: "Ask an agent" }) : null,
|
|
9439
|
+
mayBuild ? /* @__PURE__ */ jsx34(Button28, { size: "sm", onClick: onBuild, children: buildLabel }) : null
|
|
9170
9440
|
] }),
|
|
9171
9441
|
onAsk ? /* @__PURE__ */ jsxs30("p", { className: "mt-2 text-xs text-muted-foreground", children: [
|
|
9172
9442
|
"You would say something like: \u201C",
|
|
@@ -9211,10 +9481,10 @@ var PORTAL_SUGGESTION = "Let each of my customers sign in and see their own jobs
|
|
|
9211
9481
|
function PortalsPanel({ tableId, className }) {
|
|
9212
9482
|
const client = useRecordsClient25();
|
|
9213
9483
|
const host = useRecordsUi();
|
|
9214
|
-
const [portals, setPortals] =
|
|
9215
|
-
const [listError, setListError] =
|
|
9216
|
-
const [openId, setOpenId] =
|
|
9217
|
-
const [building, setBuilding] =
|
|
9484
|
+
const [portals, setPortals] = useState32(null);
|
|
9485
|
+
const [listError, setListError] = useState32(null);
|
|
9486
|
+
const [openId, setOpenId] = useState32(null);
|
|
9487
|
+
const [building, setBuilding] = useState32(false);
|
|
9218
9488
|
const load = useCallback18(async () => {
|
|
9219
9489
|
const answered = await client.portals();
|
|
9220
9490
|
if (!answered.ok) {
|
|
@@ -9235,7 +9505,7 @@ function PortalsPanel({ tableId, className }) {
|
|
|
9235
9505
|
/* @__PURE__ */ jsx35("h3", { className: "text-sm font-medium", children: "Portals" }),
|
|
9236
9506
|
/* @__PURE__ */ jsx35("span", { className: "text-xs text-muted-foreground", children: portals.length === 0 ? "none yet" : `${portals.length}` }),
|
|
9237
9507
|
/* @__PURE__ */ jsx35("div", { className: "flex-1" }),
|
|
9238
|
-
portals.length > 0 ? /* @__PURE__ */ jsx35(
|
|
9508
|
+
portals.length > 0 ? /* @__PURE__ */ jsx35(Button29, { size: "sm", variant: building ? "secondary" : "ghost", onClick: () => setBuilding((b) => !b), children: building ? "Done building" : "Build a portal" }) : null
|
|
9239
9509
|
] }),
|
|
9240
9510
|
listError ? /* @__PURE__ */ jsx35(RefusalNotice, { error: listError }) : null,
|
|
9241
9511
|
building ? /* @__PURE__ */ jsx35(
|
|
@@ -9285,7 +9555,7 @@ function PortalsPanel({ tableId, className }) {
|
|
|
9285
9555
|
/* @__PURE__ */ jsxs31("div", { className: "mt-2 flex flex-wrap items-center gap-1.5", children: [
|
|
9286
9556
|
/* @__PURE__ */ jsx35(CopyLink, { url }),
|
|
9287
9557
|
/* @__PURE__ */ jsx35(
|
|
9288
|
-
|
|
9558
|
+
Button29,
|
|
9289
9559
|
{
|
|
9290
9560
|
size: "sm",
|
|
9291
9561
|
variant: "ghost",
|
|
@@ -9307,11 +9577,11 @@ function PortalsPanel({ tableId, className }) {
|
|
|
9307
9577
|
] });
|
|
9308
9578
|
}
|
|
9309
9579
|
function CopyLink({ url }) {
|
|
9310
|
-
const [copied, setCopied] =
|
|
9311
|
-
const [shown, setShown] =
|
|
9580
|
+
const [copied, setCopied] = useState32(false);
|
|
9581
|
+
const [shown, setShown] = useState32(false);
|
|
9312
9582
|
return /* @__PURE__ */ jsxs31(Fragment15, { children: [
|
|
9313
9583
|
/* @__PURE__ */ jsx35(
|
|
9314
|
-
|
|
9584
|
+
Button29,
|
|
9315
9585
|
{
|
|
9316
9586
|
size: "sm",
|
|
9317
9587
|
variant: "outline",
|
|
@@ -9342,8 +9612,8 @@ function PortalDetail({
|
|
|
9342
9612
|
onChanged
|
|
9343
9613
|
}) {
|
|
9344
9614
|
const client = useRecordsClient25();
|
|
9345
|
-
const [card, setCard] =
|
|
9346
|
-
const [error, setError] =
|
|
9615
|
+
const [card, setCard] = useState32(null);
|
|
9616
|
+
const [error, setError] = useState32(null);
|
|
9347
9617
|
const load = useCallback18(async () => {
|
|
9348
9618
|
const answered = await client.portalCard({ portal_id: portalId });
|
|
9349
9619
|
if (!answered.ok) {
|
|
@@ -9452,11 +9722,11 @@ function People({
|
|
|
9452
9722
|
onRevoke,
|
|
9453
9723
|
onPreview
|
|
9454
9724
|
}) {
|
|
9455
|
-
const [askingToRevoke, setAskingToRevoke] =
|
|
9456
|
-
const [busy, setBusy] =
|
|
9457
|
-
const [said, setSaid] =
|
|
9458
|
-
const [error, setError] =
|
|
9459
|
-
const [previewing, setPreviewing] =
|
|
9725
|
+
const [askingToRevoke, setAskingToRevoke] = useState32(null);
|
|
9726
|
+
const [busy, setBusy] = useState32(false);
|
|
9727
|
+
const [said, setSaid] = useState32(null);
|
|
9728
|
+
const [error, setError] = useState32(null);
|
|
9729
|
+
const [previewing, setPreviewing] = useState32(null);
|
|
9460
9730
|
const revoke = useCallback18(
|
|
9461
9731
|
async (person) => {
|
|
9462
9732
|
setBusy(true);
|
|
@@ -9494,7 +9764,7 @@ function People({
|
|
|
9494
9764
|
/* @__PURE__ */ jsx35("p", { className: "mt-0.5 text-muted-foreground", children: state.why }),
|
|
9495
9765
|
person.is_active ? /* @__PURE__ */ jsxs31("div", { className: "mt-1.5 flex flex-wrap gap-1.5", children: [
|
|
9496
9766
|
/* @__PURE__ */ jsx35(
|
|
9497
|
-
|
|
9767
|
+
Button29,
|
|
9498
9768
|
{
|
|
9499
9769
|
size: "sm",
|
|
9500
9770
|
variant: "outline",
|
|
@@ -9502,13 +9772,13 @@ function People({
|
|
|
9502
9772
|
children: showing ? "Stop viewing as them" : "View as this client"
|
|
9503
9773
|
}
|
|
9504
9774
|
),
|
|
9505
|
-
/* @__PURE__ */ jsx35(
|
|
9775
|
+
/* @__PURE__ */ jsx35(Button29, { size: "sm", variant: "ghost", onClick: () => setAskingToRevoke(person), children: "Remove their access" })
|
|
9506
9776
|
] }) : null,
|
|
9507
9777
|
asking ? /* @__PURE__ */ jsxs31("div", { className: "mt-1.5 flex flex-col gap-1.5 rounded border border-destructive/40 px-2 py-1.5", children: [
|
|
9508
9778
|
/* @__PURE__ */ jsx35("span", { className: "text-destructive", children: revokeConsequence(person, card.title) }),
|
|
9509
9779
|
/* @__PURE__ */ jsxs31("div", { className: "flex flex-wrap gap-1.5", children: [
|
|
9510
9780
|
/* @__PURE__ */ jsx35(
|
|
9511
|
-
|
|
9781
|
+
Button29,
|
|
9512
9782
|
{
|
|
9513
9783
|
size: "sm",
|
|
9514
9784
|
variant: "destructive",
|
|
@@ -9517,7 +9787,7 @@ function People({
|
|
|
9517
9787
|
children: busy ? "Removing\u2026" : "Remove their access"
|
|
9518
9788
|
}
|
|
9519
9789
|
),
|
|
9520
|
-
/* @__PURE__ */ jsx35(
|
|
9790
|
+
/* @__PURE__ */ jsx35(Button29, { size: "sm", variant: "ghost", onClick: () => setAskingToRevoke(null), children: "Keep it" })
|
|
9521
9791
|
] })
|
|
9522
9792
|
] }) : null,
|
|
9523
9793
|
showing ? /* @__PURE__ */ jsx35(Preview, { card, person, onPreview }) : null
|
|
@@ -9534,9 +9804,9 @@ function Preview({
|
|
|
9534
9804
|
onPreview
|
|
9535
9805
|
}) {
|
|
9536
9806
|
const first = card.tables[0];
|
|
9537
|
-
const [which, setWhich] =
|
|
9538
|
-
const [rows, setRows] =
|
|
9539
|
-
const [error, setError] =
|
|
9807
|
+
const [which, setWhich] = useState32(first?.table_id ?? null);
|
|
9808
|
+
const [rows, setRows] = useState32(null);
|
|
9809
|
+
const [error, setError] = useState32(null);
|
|
9540
9810
|
useEffect21(() => {
|
|
9541
9811
|
if (!which) return;
|
|
9542
9812
|
let cancelled = false;
|
|
@@ -9559,7 +9829,7 @@ function Preview({
|
|
|
9559
9829
|
return /* @__PURE__ */ jsxs31("div", { className: "mt-1.5 rounded border border-border bg-card px-2 py-1.5", children: [
|
|
9560
9830
|
/* @__PURE__ */ jsx35("p", { className: "text-xs text-muted-foreground", children: previewLine(person) }),
|
|
9561
9831
|
card.tables.length > 1 ? /* @__PURE__ */ jsx35("div", { className: "mt-1.5 flex flex-wrap gap-1.5", children: card.tables.map((exposed) => /* @__PURE__ */ jsx35(
|
|
9562
|
-
|
|
9832
|
+
Button29,
|
|
9563
9833
|
{
|
|
9564
9834
|
size: "sm",
|
|
9565
9835
|
variant: exposed.table_id === which ? "secondary" : "ghost",
|
|
@@ -9575,14 +9845,14 @@ function Preview({
|
|
|
9575
9845
|
}
|
|
9576
9846
|
function Invite({ card, onInvited }) {
|
|
9577
9847
|
const client = useRecordsClient25();
|
|
9578
|
-
const [rows, setRows] =
|
|
9579
|
-
const [titleKey, setTitleKey] =
|
|
9580
|
-
const [search, setSearch] =
|
|
9581
|
-
const [picked, setPicked] =
|
|
9582
|
-
const [email, setEmail] =
|
|
9583
|
-
const [busy, setBusy] =
|
|
9584
|
-
const [said, setSaid] =
|
|
9585
|
-
const [error, setError] =
|
|
9848
|
+
const [rows, setRows] = useState32(null);
|
|
9849
|
+
const [titleKey, setTitleKey] = useState32(null);
|
|
9850
|
+
const [search, setSearch] = useState32("");
|
|
9851
|
+
const [picked, setPicked] = useState32(null);
|
|
9852
|
+
const [email, setEmail] = useState32("");
|
|
9853
|
+
const [busy, setBusy] = useState32(false);
|
|
9854
|
+
const [said, setSaid] = useState32(null);
|
|
9855
|
+
const [error, setError] = useState32(null);
|
|
9586
9856
|
useEffect21(() => {
|
|
9587
9857
|
let cancelled = false;
|
|
9588
9858
|
void client.list({ table_id: card.client_table_id, limit: 200 }).then((answered) => {
|
|
@@ -9648,7 +9918,7 @@ function Invite({ card, onInvited }) {
|
|
|
9648
9918
|
picked ? null : /* @__PURE__ */ jsxs31("ul", { className: "flex max-h-40 flex-col gap-0.5 overflow-y-auto", children: [
|
|
9649
9919
|
options.length === 0 ? /* @__PURE__ */ jsx35("li", { className: "text-xs text-muted-foreground", children: "No client of this portal's client Table matches that. A portal principal is one of those rows \u2014 add the client there first." }) : null,
|
|
9650
9920
|
options.map((option) => /* @__PURE__ */ jsx35("li", { children: /* @__PURE__ */ jsx35(
|
|
9651
|
-
|
|
9921
|
+
Button29,
|
|
9652
9922
|
{
|
|
9653
9923
|
size: "sm",
|
|
9654
9924
|
variant: "ghost",
|
|
@@ -9672,7 +9942,7 @@ function Invite({ card, onInvited }) {
|
|
|
9672
9942
|
}
|
|
9673
9943
|
),
|
|
9674
9944
|
/* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(
|
|
9675
|
-
|
|
9945
|
+
Button29,
|
|
9676
9946
|
{
|
|
9677
9947
|
size: "sm",
|
|
9678
9948
|
disabled: busy || !picked || email.trim() === "",
|
|
@@ -9685,9 +9955,9 @@ function Invite({ card, onInvited }) {
|
|
|
9685
9955
|
}
|
|
9686
9956
|
|
|
9687
9957
|
// src/DigestScheduler.tsx
|
|
9688
|
-
import { useCallback as useCallback19, useEffect as useEffect22, useMemo as useMemo23, useState as
|
|
9958
|
+
import { useCallback as useCallback19, useEffect as useEffect22, useMemo as useMemo23, useState as useState33 } from "react";
|
|
9689
9959
|
import { useRecordsClient as useRecordsClient26 } from "@ai-matrx/records/react";
|
|
9690
|
-
import { BasicInput as BasicInput10, Button as
|
|
9960
|
+
import { BasicInput as BasicInput10, Button as Button30, Checkbox as Checkbox5, Label as Label5, Separator as Separator11, Skeleton as Skeleton16, cn as cn30 } from "@ai-matrx/design-system";
|
|
9691
9961
|
import { Fragment as Fragment16, jsx as jsx36, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
9692
9962
|
var WEEKDAYS = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
|
|
9693
9963
|
var CADENCE_WORDS = {
|
|
@@ -9712,24 +9982,24 @@ function DigestScheduler({
|
|
|
9712
9982
|
}) {
|
|
9713
9983
|
const client = useRecordsClient26();
|
|
9714
9984
|
const host = useRecordsUi();
|
|
9715
|
-
const [views, setViews] =
|
|
9716
|
-
const [cadences, setCadences] =
|
|
9717
|
-
const [members, setMembers] =
|
|
9718
|
-
const [error, setError] =
|
|
9719
|
-
const [viewId, setViewId] =
|
|
9720
|
-
const [name, setName] =
|
|
9721
|
-
const [cadence, setCadence] =
|
|
9722
|
-
const [weekday, setWeekday] =
|
|
9723
|
-
const [time, setTime] =
|
|
9724
|
-
const [channel, setChannel] =
|
|
9725
|
-
const [quiet, setQuiet] =
|
|
9726
|
-
const [quietFrom, setQuietFrom] =
|
|
9727
|
-
const [quietTo, setQuietTo] =
|
|
9728
|
-
const [recipients, setRecipients] =
|
|
9729
|
-
const [saving, setSaving] =
|
|
9730
|
-
const [outcomes, setOutcomes] =
|
|
9731
|
-
const [preview, setPreview] =
|
|
9732
|
-
const [previewing, setPreviewing] =
|
|
9985
|
+
const [views, setViews] = useState33(null);
|
|
9986
|
+
const [cadences, setCadences] = useState33([]);
|
|
9987
|
+
const [members, setMembers] = useState33(null);
|
|
9988
|
+
const [error, setError] = useState33(null);
|
|
9989
|
+
const [viewId, setViewId] = useState33(savedViewId ?? "");
|
|
9990
|
+
const [name, setName] = useState33(subjectName?.trim() ? `${subjectName.trim()} summary` : "");
|
|
9991
|
+
const [cadence, setCadence] = useState33("weekly");
|
|
9992
|
+
const [weekday, setWeekday] = useState33("monday");
|
|
9993
|
+
const [time, setTime] = useState33("08:00");
|
|
9994
|
+
const [channel, setChannel] = useState33("in_app");
|
|
9995
|
+
const [quiet, setQuiet] = useState33(false);
|
|
9996
|
+
const [quietFrom, setQuietFrom] = useState33("22:00");
|
|
9997
|
+
const [quietTo, setQuietTo] = useState33("07:00");
|
|
9998
|
+
const [recipients, setRecipients] = useState33([]);
|
|
9999
|
+
const [saving, setSaving] = useState33(false);
|
|
10000
|
+
const [outcomes, setOutcomes] = useState33(null);
|
|
10001
|
+
const [preview, setPreview] = useState33(null);
|
|
10002
|
+
const [previewing, setPreviewing] = useState33(false);
|
|
9733
10003
|
const load = useCallback19(async () => {
|
|
9734
10004
|
const [saved, offered] = await Promise.all([
|
|
9735
10005
|
// The store's own door onto `platform.saved_view`, narrowed in SQL to
|
|
@@ -9820,8 +10090,8 @@ function DigestScheduler({
|
|
|
9820
10090
|
/* @__PURE__ */ jsxs32("header", { className: "flex items-center gap-2", children: [
|
|
9821
10091
|
/* @__PURE__ */ jsx36("h3", { className: "text-sm font-medium", children: "Send this on a schedule" }),
|
|
9822
10092
|
/* @__PURE__ */ jsx36("div", { className: "flex-1" }),
|
|
9823
|
-
/* @__PURE__ */ jsx36(
|
|
9824
|
-
onClose ? /* @__PURE__ */ jsx36(
|
|
10093
|
+
/* @__PURE__ */ jsx36(Button30, { size: "sm", disabled: saving, onClick: () => void scheduleIt(), children: saving ? "Scheduling\u2026" : "Schedule it" }),
|
|
10094
|
+
onClose ? /* @__PURE__ */ jsx36(Button30, { size: "sm", variant: "ghost", onClick: onClose, children: "Close" }) : null
|
|
9825
10095
|
] }),
|
|
9826
10096
|
error ? /* @__PURE__ */ jsx36(RefusalNotice, { error }) : null,
|
|
9827
10097
|
/* @__PURE__ */ jsxs32("label", { className: "flex flex-col gap-1", children: [
|
|
@@ -9947,7 +10217,7 @@ function DigestScheduler({
|
|
|
9947
10217
|
".",
|
|
9948
10218
|
" ",
|
|
9949
10219
|
/* @__PURE__ */ jsx36(
|
|
9950
|
-
|
|
10220
|
+
Button30,
|
|
9951
10221
|
{
|
|
9952
10222
|
size: "sm",
|
|
9953
10223
|
variant: "ghost",
|
|
@@ -9973,15 +10243,15 @@ function DigestScheduler({
|
|
|
9973
10243
|
preview.changed.map((e) => e.name).join(", ")
|
|
9974
10244
|
] }) : null,
|
|
9975
10245
|
/* @__PURE__ */ jsx36("p", { className: "mt-1.5 text-muted-foreground", children: "Nothing was sent and nothing was recorded \u2014 this is what the next one would say." }),
|
|
9976
|
-
/* @__PURE__ */ jsx36(
|
|
10246
|
+
/* @__PURE__ */ jsx36(Button30, { size: "sm", variant: "ghost", className: "mt-1", onClick: () => setPreview(null), children: "Close" })
|
|
9977
10247
|
] }) : null
|
|
9978
10248
|
] });
|
|
9979
10249
|
}
|
|
9980
10250
|
|
|
9981
10251
|
// src/SubscriptionsPanel.tsx
|
|
9982
|
-
import { useCallback as useCallback20, useEffect as useEffect23, useState as
|
|
10252
|
+
import { useCallback as useCallback20, useEffect as useEffect23, useState as useState34 } from "react";
|
|
9983
10253
|
import { useRecordsClient as useRecordsClient27 } from "@ai-matrx/records/react";
|
|
9984
|
-
import { Badge as Badge14, Button as
|
|
10254
|
+
import { Badge as Badge14, Button as Button31, Skeleton as Skeleton17, Switch as Switch2, cn as cn31 } from "@ai-matrx/design-system";
|
|
9985
10255
|
import { jsx as jsx37, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
9986
10256
|
function whenItFires(subscription) {
|
|
9987
10257
|
if (subscription.cadence === "instant") return "as it happens";
|
|
@@ -9996,11 +10266,11 @@ var CHANNEL_WORDS2 = {
|
|
|
9996
10266
|
var DIGEST_SUGGESTION = "Email me a summary of this every Monday at 8 in the morning.";
|
|
9997
10267
|
function SubscriptionsPanel({ tableId, className }) {
|
|
9998
10268
|
const client = useRecordsClient27();
|
|
9999
|
-
const [rows, setRows] =
|
|
10000
|
-
const [error, setError] =
|
|
10001
|
-
const [busy, setBusy] =
|
|
10002
|
-
const [preview, setPreview] =
|
|
10003
|
-
const [scheduling, setScheduling] =
|
|
10269
|
+
const [rows, setRows] = useState34(null);
|
|
10270
|
+
const [error, setError] = useState34(null);
|
|
10271
|
+
const [busy, setBusy] = useState34(null);
|
|
10272
|
+
const [preview, setPreview] = useState34(null);
|
|
10273
|
+
const [scheduling, setScheduling] = useState34(false);
|
|
10004
10274
|
const host = useRecordsUi();
|
|
10005
10275
|
const load = useCallback20(async () => {
|
|
10006
10276
|
const answered = await client.subscriptions({ table_id: tableId });
|
|
@@ -10052,7 +10322,7 @@ function SubscriptionsPanel({ tableId, className }) {
|
|
|
10052
10322
|
/* @__PURE__ */ jsx37("span", { className: "text-xs text-muted-foreground", children: rows.length === 0 ? "none" : `${rows.filter((r) => !r.muted).length} on` }),
|
|
10053
10323
|
/* @__PURE__ */ jsx37("div", { className: "flex-1" }),
|
|
10054
10324
|
rows.length > 0 ? /* @__PURE__ */ jsx37(
|
|
10055
|
-
|
|
10325
|
+
Button31,
|
|
10056
10326
|
{
|
|
10057
10327
|
size: "sm",
|
|
10058
10328
|
variant: scheduling ? "secondary" : "ghost",
|
|
@@ -10123,7 +10393,7 @@ function SubscriptionsPanel({ tableId, className }) {
|
|
|
10123
10393
|
" \u2014 a send inside those hours waits until they end."
|
|
10124
10394
|
] }) : null,
|
|
10125
10395
|
subscription.cadence === "instant" ? null : /* @__PURE__ */ jsx37(
|
|
10126
|
-
|
|
10396
|
+
Button31,
|
|
10127
10397
|
{
|
|
10128
10398
|
size: "sm",
|
|
10129
10399
|
variant: "ghost",
|
|
@@ -10157,20 +10427,20 @@ function SubscriptionsPanel({ tableId, className }) {
|
|
|
10157
10427
|
preview.changed.map((e) => e.name).join(", ")
|
|
10158
10428
|
] }) : null,
|
|
10159
10429
|
/* @__PURE__ */ jsx37("p", { className: "mt-1.5 text-muted-foreground", children: "Nothing was sent and nothing was recorded \u2014 this is what the next one would say." }),
|
|
10160
|
-
/* @__PURE__ */ jsx37(
|
|
10430
|
+
/* @__PURE__ */ jsx37(Button31, { size: "sm", variant: "ghost", className: "mt-1", onClick: () => setPreview(null), children: "Close" })
|
|
10161
10431
|
] }) : null
|
|
10162
10432
|
] }, subscription.rule_id)) })
|
|
10163
10433
|
] });
|
|
10164
10434
|
}
|
|
10165
10435
|
|
|
10166
10436
|
// src/FormBuilder.tsx
|
|
10167
|
-
import { useCallback as useCallback22, useEffect as useEffect25, useMemo as useMemo25, useState as
|
|
10437
|
+
import { useCallback as useCallback22, useEffect as useEffect25, useMemo as useMemo25, useState as useState36 } from "react";
|
|
10168
10438
|
import { useFields as useFields16, useRecordsClient as useRecordsClient28, useTable as useTable13 } from "@ai-matrx/records/react";
|
|
10169
10439
|
import { publicFormPath } from "@ai-matrx/records";
|
|
10170
10440
|
import {
|
|
10171
10441
|
BasicInput as BasicInput11,
|
|
10172
10442
|
BasicTextarea as BasicTextarea5,
|
|
10173
|
-
Button as
|
|
10443
|
+
Button as Button33,
|
|
10174
10444
|
Checkbox as Checkbox6,
|
|
10175
10445
|
Label as Label6,
|
|
10176
10446
|
Skeleton as Skeleton19,
|
|
@@ -10178,9 +10448,9 @@ import {
|
|
|
10178
10448
|
} from "@ai-matrx/design-system";
|
|
10179
10449
|
|
|
10180
10450
|
// src/FormRunner.tsx
|
|
10181
|
-
import { useCallback as useCallback21, useEffect as useEffect24, useMemo as useMemo24, useRef as useRef10, useState as
|
|
10451
|
+
import { useCallback as useCallback21, useEffect as useEffect24, useMemo as useMemo24, useRef as useRef10, useState as useState35 } from "react";
|
|
10182
10452
|
import { useFields as useFields15, useOptionalRecordsClient } from "@ai-matrx/records/react";
|
|
10183
|
-
import { Button as
|
|
10453
|
+
import { Button as Button32, Progress, Skeleton as Skeleton18, cn as cn32 } from "@ai-matrx/design-system";
|
|
10184
10454
|
import { Fragment as Fragment17, jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
10185
10455
|
function FormRunner(props) {
|
|
10186
10456
|
if (props.fields && props.onSubmit) {
|
|
@@ -10249,13 +10519,13 @@ function FormStage({
|
|
|
10249
10519
|
connected = false
|
|
10250
10520
|
}) {
|
|
10251
10521
|
const host = useRecordsUi();
|
|
10252
|
-
const [answers, setAnswers] =
|
|
10253
|
-
const [at, setAt] =
|
|
10254
|
-
const [error, setError] =
|
|
10255
|
-
const [refusal, setRefusal] =
|
|
10256
|
-
const [writing, setWriting] =
|
|
10257
|
-
const [done, setDone] =
|
|
10258
|
-
const [hidden, setHidden] =
|
|
10522
|
+
const [answers, setAnswers] = useState35({});
|
|
10523
|
+
const [at, setAt] = useState35(0);
|
|
10524
|
+
const [error, setError] = useState35(null);
|
|
10525
|
+
const [refusal, setRefusal] = useState35(null);
|
|
10526
|
+
const [writing, setWriting] = useState35(false);
|
|
10527
|
+
const [done, setDone] = useState35(null);
|
|
10528
|
+
const [hidden, setHidden] = useState35({});
|
|
10259
10529
|
const decoy = useRef10("");
|
|
10260
10530
|
const stage = useRef10(null);
|
|
10261
10531
|
const questions = useMemo24(() => {
|
|
@@ -10417,8 +10687,8 @@ function FormStage({
|
|
|
10417
10687
|
)
|
|
10418
10688
|
] }) : null,
|
|
10419
10689
|
/* @__PURE__ */ jsxs34("footer", { className: cn32("flex flex-wrap items-center gap-2", centred && "justify-center"), children: [
|
|
10420
|
-
oneAtATime && index > 0 ? /* @__PURE__ */ jsx38(
|
|
10421
|
-
oneAtATime && index < live.length - 1 ? /* @__PURE__ */ jsx38(
|
|
10690
|
+
oneAtATime && index > 0 ? /* @__PURE__ */ jsx38(Button32, { size: "sm", variant: "ghost", onClick: retreat, children: "Back" }) : null,
|
|
10691
|
+
oneAtATime && index < live.length - 1 ? /* @__PURE__ */ jsx38(Button32, { size: "sm", onClick: advance, children: "Next" }) : /* @__PURE__ */ jsx38(Button32, { size: "sm", disabled: writing || missing.length > 0, onClick: () => void submit(), children: writing ? "Sending\u2026" : form.submitLabel ?? "Submit" }),
|
|
10422
10692
|
missing.length > 0 && (!oneAtATime || index === live.length - 1) ? /* @__PURE__ */ jsxs34("span", { className: "text-xs text-muted-foreground", children: [
|
|
10423
10693
|
missing.map((q) => q.ask).join(", "),
|
|
10424
10694
|
" still ",
|
|
@@ -10437,7 +10707,7 @@ function Question({
|
|
|
10437
10707
|
onChange,
|
|
10438
10708
|
upload
|
|
10439
10709
|
}) {
|
|
10440
|
-
const [uploadError, setUploadError] =
|
|
10710
|
+
const [uploadError, setUploadError] = useState35(null);
|
|
10441
10711
|
const field = question.field;
|
|
10442
10712
|
if (!field) return null;
|
|
10443
10713
|
const id = `form-${field.key}`;
|
|
@@ -10500,15 +10770,15 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
|
|
|
10500
10770
|
const table = useTable13(tableId);
|
|
10501
10771
|
const rights = useTableRights(table.data);
|
|
10502
10772
|
const fields = useFields16(tableId);
|
|
10503
|
-
const [forms, setForms] =
|
|
10504
|
-
const [error, setError] =
|
|
10505
|
-
const [activeId, setActiveId] =
|
|
10506
|
-
const [draft, setDraft] =
|
|
10507
|
-
const [saving, setSaving] =
|
|
10508
|
-
const [saved, setSaved] =
|
|
10509
|
-
const [publishing, setPublishing] =
|
|
10510
|
-
const [copied, setCopied] =
|
|
10511
|
-
const [shownUrl, setShownUrl] =
|
|
10773
|
+
const [forms, setForms] = useState36(null);
|
|
10774
|
+
const [error, setError] = useState36(null);
|
|
10775
|
+
const [activeId, setActiveId] = useState36(activeFormId ?? null);
|
|
10776
|
+
const [draft, setDraft] = useState36(null);
|
|
10777
|
+
const [saving, setSaving] = useState36(false);
|
|
10778
|
+
const [saved, setSaved] = useState36(null);
|
|
10779
|
+
const [publishing, setPublishing] = useState36(false);
|
|
10780
|
+
const [copied, setCopied] = useState36(false);
|
|
10781
|
+
const [shownUrl, setShownUrl] = useState36(null);
|
|
10512
10782
|
const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
|
|
10513
10783
|
const load = useCallback22(async () => {
|
|
10514
10784
|
const answered = await client.forms({ table_id: tableId });
|
|
@@ -10614,7 +10884,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
|
|
|
10614
10884
|
{
|
|
10615
10885
|
error,
|
|
10616
10886
|
className,
|
|
10617
|
-
actions: /* @__PURE__ */ jsx39(
|
|
10887
|
+
actions: /* @__PURE__ */ jsx39(Button33, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
|
|
10618
10888
|
}
|
|
10619
10889
|
);
|
|
10620
10890
|
}
|
|
@@ -10626,7 +10896,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
|
|
|
10626
10896
|
/* @__PURE__ */ jsxs35("div", { className: "flex min-w-0 flex-1 flex-col gap-2 overflow-auto", children: [
|
|
10627
10897
|
/* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-1 overflow-x-auto", role: "group", "aria-label": "Forms", children: [
|
|
10628
10898
|
forms.map((form) => /* @__PURE__ */ jsx39(
|
|
10629
|
-
|
|
10899
|
+
Button33,
|
|
10630
10900
|
{
|
|
10631
10901
|
size: "sm",
|
|
10632
10902
|
variant: form.id === activeId ? "secondary" : "ghost",
|
|
@@ -10639,10 +10909,10 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
|
|
|
10639
10909
|
},
|
|
10640
10910
|
form.id
|
|
10641
10911
|
)),
|
|
10642
|
-
(fields.data ?? []).length > 0 ? /* @__PURE__ */ jsx39(
|
|
10912
|
+
(fields.data ?? []).length > 0 ? /* @__PURE__ */ jsx39(Button33, { size: "sm", variant: "ghost", onClick: () => void create(`Form ${forms.length + 1}`), children: "New form" }) : null,
|
|
10643
10913
|
/* @__PURE__ */ jsxs35("span", { className: "ml-auto flex items-center gap-2", children: [
|
|
10644
10914
|
saved ? /* @__PURE__ */ jsx39("span", { className: "text-xs text-muted-foreground", children: saved }) : null,
|
|
10645
|
-
/* @__PURE__ */ jsx39(
|
|
10915
|
+
/* @__PURE__ */ jsx39(Button33, { size: "sm", disabled: saving || !draft, onClick: () => void save(), children: saving ? "Saving\u2026" : "Save" })
|
|
10646
10916
|
] })
|
|
10647
10917
|
] }),
|
|
10648
10918
|
!draft ? /* @__PURE__ */ jsx39("p", { className: "text-xs text-muted-foreground", children: (fields.data ?? []).length === 0 ? "This table has no fields yet, so there is nothing a form could ask for. Add a field first \u2014 every question is one of this table's own fields." : 'No form collects into this table yet. "New form" makes one, or you ask an agent for the whole thing in a sentence.' }) : /* @__PURE__ */ jsxs35(Fragment18, { children: [
|
|
@@ -10805,7 +11075,7 @@ function PublishRow({
|
|
|
10805
11075
|
return /* @__PURE__ */ jsxs35("div", { className: "flex flex-col gap-1.5 rounded border px-2.5 py-2", children: [
|
|
10806
11076
|
/* @__PURE__ */ jsxs35("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
10807
11077
|
mayPublish ? /* @__PURE__ */ jsx39(
|
|
10808
|
-
|
|
11078
|
+
Button33,
|
|
10809
11079
|
{
|
|
10810
11080
|
size: "sm",
|
|
10811
11081
|
variant: open ? "ghost" : "default",
|
|
@@ -10825,7 +11095,7 @@ function PublishRow({
|
|
|
10825
11095
|
children: url
|
|
10826
11096
|
}
|
|
10827
11097
|
),
|
|
10828
|
-
/* @__PURE__ */ jsx39(
|
|
11098
|
+
/* @__PURE__ */ jsx39(Button33, { size: "sm", variant: "outline", onClick: () => onCopy(url), children: copied ? "Copied" : "Copy link" })
|
|
10829
11099
|
] }) : null
|
|
10830
11100
|
] }),
|
|
10831
11101
|
/* @__PURE__ */ jsx39("p", { className: "text-xs text-muted-foreground", children: FORM_STATE_WORDS[state] }),
|
|
@@ -10842,13 +11112,13 @@ function Condition({
|
|
|
10842
11112
|
onChange
|
|
10843
11113
|
}) {
|
|
10844
11114
|
return /* @__PURE__ */ jsx39(
|
|
10845
|
-
|
|
11115
|
+
ConditionGroup,
|
|
10846
11116
|
{
|
|
10847
11117
|
lead: "Ask only when",
|
|
10848
11118
|
expr: question.showIf,
|
|
10849
11119
|
fields: fieldKeys,
|
|
10850
11120
|
onChange,
|
|
10851
|
-
className: "col-span-2 flex
|
|
11121
|
+
className: "col-span-2 flex flex-col gap-1 text-xs"
|
|
10852
11122
|
}
|
|
10853
11123
|
);
|
|
10854
11124
|
}
|
|
@@ -10942,13 +11212,13 @@ import {
|
|
|
10942
11212
|
useEffect as useEffect26,
|
|
10943
11213
|
useId,
|
|
10944
11214
|
useRef as useRef11,
|
|
10945
|
-
useState as
|
|
11215
|
+
useState as useState37
|
|
10946
11216
|
} from "react";
|
|
10947
11217
|
import { cn as cn34 } from "@ai-matrx/design-system";
|
|
10948
11218
|
import { jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
10949
11219
|
function useMeasuredWidth(fallback = 480) {
|
|
10950
11220
|
const ref = useRef11(null);
|
|
10951
|
-
const [width, setWidth] =
|
|
11221
|
+
const [width, setWidth] = useState37(fallback);
|
|
10952
11222
|
useEffect26(() => {
|
|
10953
11223
|
const node = ref.current;
|
|
10954
11224
|
if (!node) return;
|
|
@@ -11073,9 +11343,9 @@ function isSignatureField(field) {
|
|
|
11073
11343
|
}
|
|
11074
11344
|
|
|
11075
11345
|
// src/DocTemplate.tsx
|
|
11076
|
-
import { useCallback as useCallback23, useEffect as useEffect27, useState as
|
|
11346
|
+
import { useCallback as useCallback23, useEffect as useEffect27, useState as useState38 } from "react";
|
|
11077
11347
|
import { useFields as useFields17, useRecordsClient as useRecordsClient29, useTable as useTable14 } from "@ai-matrx/records/react";
|
|
11078
|
-
import { BasicInput as BasicInput12, BasicTextarea as BasicTextarea6, Button as
|
|
11348
|
+
import { BasicInput as BasicInput12, BasicTextarea as BasicTextarea6, Button as Button34, Label as Label7, Skeleton as Skeleton20, cn as cn35 } from "@ai-matrx/design-system";
|
|
11079
11349
|
import { jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
11080
11350
|
function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, className }) {
|
|
11081
11351
|
const client = useRecordsClient29();
|
|
@@ -11083,13 +11353,13 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
11083
11353
|
const table = useTable14(tableId);
|
|
11084
11354
|
const rights = useTableRights(table.data);
|
|
11085
11355
|
const fields = useFields17(tableId);
|
|
11086
|
-
const [templates, setTemplates] =
|
|
11087
|
-
const [error, setError] =
|
|
11088
|
-
const [activeId, setActiveId] =
|
|
11089
|
-
const [draftName, setDraftName] =
|
|
11090
|
-
const [draftBody, setDraftBody] =
|
|
11091
|
-
const [unresolved, setUnresolved] =
|
|
11092
|
-
const [saving, setSaving] =
|
|
11356
|
+
const [templates, setTemplates] = useState38(null);
|
|
11357
|
+
const [error, setError] = useState38(null);
|
|
11358
|
+
const [activeId, setActiveId] = useState38(activeTemplateId ?? null);
|
|
11359
|
+
const [draftName, setDraftName] = useState38("");
|
|
11360
|
+
const [draftBody, setDraftBody] = useState38("");
|
|
11361
|
+
const [unresolved, setUnresolved] = useState38([]);
|
|
11362
|
+
const [saving, setSaving] = useState38(false);
|
|
11093
11363
|
const load = useCallback23(async () => {
|
|
11094
11364
|
const held = await client.docTemplates({ table_id: tableId });
|
|
11095
11365
|
if (!held.ok) {
|
|
@@ -11169,7 +11439,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
11169
11439
|
{
|
|
11170
11440
|
error,
|
|
11171
11441
|
className,
|
|
11172
|
-
actions: /* @__PURE__ */ jsx41(
|
|
11442
|
+
actions: /* @__PURE__ */ jsx41(Button34, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
|
|
11173
11443
|
}
|
|
11174
11444
|
);
|
|
11175
11445
|
}
|
|
@@ -11180,7 +11450,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
11180
11450
|
return /* @__PURE__ */ jsxs37("div", { className: cn35("flex flex-col gap-2", className), children: [
|
|
11181
11451
|
/* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-1 overflow-x-auto", role: "group", "aria-label": "Templates", children: [
|
|
11182
11452
|
templates.map((t) => /* @__PURE__ */ jsxs37(
|
|
11183
|
-
|
|
11453
|
+
Button34,
|
|
11184
11454
|
{
|
|
11185
11455
|
size: "sm",
|
|
11186
11456
|
variant: t.id === activeId ? "secondary" : "ghost",
|
|
@@ -11201,7 +11471,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
11201
11471
|
t.id
|
|
11202
11472
|
)),
|
|
11203
11473
|
/* @__PURE__ */ jsx41(
|
|
11204
|
-
|
|
11474
|
+
Button34,
|
|
11205
11475
|
{
|
|
11206
11476
|
size: "sm",
|
|
11207
11477
|
variant: "ghost",
|
|
@@ -11213,7 +11483,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
11213
11483
|
children: "New template"
|
|
11214
11484
|
}
|
|
11215
11485
|
),
|
|
11216
|
-
/* @__PURE__ */ jsx41(
|
|
11486
|
+
/* @__PURE__ */ jsx41(Button34, { size: "sm", className: "ml-auto", disabled: saving, onClick: () => void save(), children: saving ? "Saving\u2026" : "Save" })
|
|
11217
11487
|
] }),
|
|
11218
11488
|
/* @__PURE__ */ jsxs37("label", { className: "flex flex-col gap-1", children: [
|
|
11219
11489
|
/* @__PURE__ */ jsx41(Label7, { className: "text-xs font-medium", children: "Name" }),
|
|
@@ -11222,7 +11492,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
11222
11492
|
/* @__PURE__ */ jsxs37("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
11223
11493
|
/* @__PURE__ */ jsx41("span", { className: "text-xs text-muted-foreground", children: "Insert" }),
|
|
11224
11494
|
(fields.data ?? []).map((field) => /* @__PURE__ */ jsx41(
|
|
11225
|
-
|
|
11495
|
+
Button34,
|
|
11226
11496
|
{
|
|
11227
11497
|
size: "sm",
|
|
11228
11498
|
variant: "ghost",
|
|
@@ -11252,17 +11522,17 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
11252
11522
|
}
|
|
11253
11523
|
|
|
11254
11524
|
// src/DocRender.tsx
|
|
11255
|
-
import { useCallback as useCallback24, useEffect as useEffect28, useRef as useRef12, useState as
|
|
11525
|
+
import { useCallback as useCallback24, useEffect as useEffect28, useRef as useRef12, useState as useState39 } from "react";
|
|
11256
11526
|
import { useRecordsClient as useRecordsClient30 } from "@ai-matrx/records/react";
|
|
11257
|
-
import { Button as
|
|
11527
|
+
import { Button as Button35, Skeleton as Skeleton21, cn as cn36 } from "@ai-matrx/design-system";
|
|
11258
11528
|
import { jsx as jsx42, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
11259
11529
|
function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
11260
11530
|
const client = useRecordsClient30();
|
|
11261
|
-
const [preview, setPreview] =
|
|
11262
|
-
const [renders, setRenders] =
|
|
11263
|
-
const [showing, setShowing] =
|
|
11264
|
-
const [error, setError] =
|
|
11265
|
-
const [busy, setBusy] =
|
|
11531
|
+
const [preview, setPreview] = useState39(null);
|
|
11532
|
+
const [renders, setRenders] = useState39(null);
|
|
11533
|
+
const [showing, setShowing] = useState39(null);
|
|
11534
|
+
const [error, setError] = useState39(null);
|
|
11535
|
+
const [busy, setBusy] = useState39(null);
|
|
11266
11536
|
const paper = useRef12(null);
|
|
11267
11537
|
const load = useCallback24(async () => {
|
|
11268
11538
|
const [body, held] = await Promise.all([
|
|
@@ -11323,7 +11593,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
11323
11593
|
{
|
|
11324
11594
|
error,
|
|
11325
11595
|
className,
|
|
11326
|
-
actions: /* @__PURE__ */ jsx42(
|
|
11596
|
+
actions: /* @__PURE__ */ jsx42(Button35, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
|
|
11327
11597
|
}
|
|
11328
11598
|
);
|
|
11329
11599
|
}
|
|
@@ -11333,7 +11603,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
11333
11603
|
return /* @__PURE__ */ jsxs38("div", { className: cn36("flex flex-col gap-2", className), children: [
|
|
11334
11604
|
/* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-1 text-xs", children: [
|
|
11335
11605
|
/* @__PURE__ */ jsx42(
|
|
11336
|
-
|
|
11606
|
+
Button35,
|
|
11337
11607
|
{
|
|
11338
11608
|
size: "sm",
|
|
11339
11609
|
variant: frozen ? "ghost" : "secondary",
|
|
@@ -11343,7 +11613,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
11343
11613
|
}
|
|
11344
11614
|
),
|
|
11345
11615
|
renders.map((render) => /* @__PURE__ */ jsx42(
|
|
11346
|
-
|
|
11616
|
+
Button35,
|
|
11347
11617
|
{
|
|
11348
11618
|
size: "sm",
|
|
11349
11619
|
variant: render.id === showing ? "secondary" : "ghost",
|
|
@@ -11355,8 +11625,8 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
11355
11625
|
render.id
|
|
11356
11626
|
)),
|
|
11357
11627
|
/* @__PURE__ */ jsxs38("span", { className: "ml-auto flex items-center gap-1", children: [
|
|
11358
|
-
/* @__PURE__ */ jsx42(
|
|
11359
|
-
/* @__PURE__ */ jsx42(
|
|
11628
|
+
/* @__PURE__ */ jsx42(Button35, { size: "sm", disabled: busy !== null, onClick: () => void freeze(), children: busy === "freeze" ? "Freezing\u2026" : "Freeze this version" }),
|
|
11629
|
+
/* @__PURE__ */ jsx42(Button35, { size: "sm", variant: "ghost", disabled: busy !== null, onClick: () => void toPdf(), children: busy === "pdf" ? "Making the PDF\u2026" : "PDF" })
|
|
11360
11630
|
] })
|
|
11361
11631
|
] }),
|
|
11362
11632
|
/* @__PURE__ */ jsx42("div", { ref: paper, className: "whitespace-pre-wrap rounded border bg-background p-4 text-sm text-foreground", children: text }),
|
|
@@ -11365,9 +11635,9 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
11365
11635
|
}
|
|
11366
11636
|
|
|
11367
11637
|
// src/SignBlock.tsx
|
|
11368
|
-
import { useCallback as useCallback25, useEffect as useEffect29, useState as
|
|
11638
|
+
import { useCallback as useCallback25, useEffect as useEffect29, useState as useState40 } from "react";
|
|
11369
11639
|
import { useFields as useFields18, useRecordsClient as useRecordsClient31 } from "@ai-matrx/records/react";
|
|
11370
|
-
import { BasicInput as BasicInput13, Button as
|
|
11640
|
+
import { BasicInput as BasicInput13, Button as Button36, Skeleton as Skeleton22, cn as cn37 } from "@ai-matrx/design-system";
|
|
11371
11641
|
import { useTable as useTable15 } from "@ai-matrx/records/react";
|
|
11372
11642
|
import { jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
11373
11643
|
function SignBlock({ tableId, recordId, render, className }) {
|
|
@@ -11375,11 +11645,11 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
11375
11645
|
const table = useTable15(tableId);
|
|
11376
11646
|
const rights = useTableRights(table.data);
|
|
11377
11647
|
const fields = useFields18(tableId);
|
|
11378
|
-
const [signatures, setSignatures] =
|
|
11379
|
-
const [verdicts, setVerdicts] =
|
|
11380
|
-
const [error, setError] =
|
|
11381
|
-
const [name, setName] =
|
|
11382
|
-
const [busy, setBusy] =
|
|
11648
|
+
const [signatures, setSignatures] = useState40(null);
|
|
11649
|
+
const [verdicts, setVerdicts] = useState40({});
|
|
11650
|
+
const [error, setError] = useState40(null);
|
|
11651
|
+
const [name, setName] = useState40("");
|
|
11652
|
+
const [busy, setBusy] = useState40(false);
|
|
11383
11653
|
const load = useCallback25(async () => {
|
|
11384
11654
|
const held = await client.docSignatures({ record_id: recordId });
|
|
11385
11655
|
if (!held.ok) {
|
|
@@ -11422,7 +11692,7 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
11422
11692
|
{
|
|
11423
11693
|
error,
|
|
11424
11694
|
className,
|
|
11425
|
-
actions: /* @__PURE__ */ jsx43(
|
|
11695
|
+
actions: /* @__PURE__ */ jsx43(Button36, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
|
|
11426
11696
|
}
|
|
11427
11697
|
);
|
|
11428
11698
|
}
|
|
@@ -11485,7 +11755,7 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
11485
11755
|
onChange: (e) => setName(e.target.value)
|
|
11486
11756
|
}
|
|
11487
11757
|
),
|
|
11488
|
-
/* @__PURE__ */ jsx43(
|
|
11758
|
+
/* @__PURE__ */ jsx43(Button36, { size: "sm", type: "submit", disabled: busy || name.trim() === "", children: "Sign" }),
|
|
11489
11759
|
/* @__PURE__ */ jsxs39("span", { className: "text-xs text-muted-foreground", children: [
|
|
11490
11760
|
"seals version ",
|
|
11491
11761
|
render.template_version,
|
|
@@ -11502,9 +11772,9 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
11502
11772
|
}
|
|
11503
11773
|
|
|
11504
11774
|
// src/NotifyRuleEditor.tsx
|
|
11505
|
-
import { useCallback as useCallback26, useEffect as useEffect30, useState as
|
|
11775
|
+
import { useCallback as useCallback26, useEffect as useEffect30, useState as useState41 } from "react";
|
|
11506
11776
|
import { useRecordsClient as useRecordsClient32, useTable as useTable16 } from "@ai-matrx/records/react";
|
|
11507
|
-
import { Button as
|
|
11777
|
+
import { Button as Button37, Skeleton as Skeleton23, cn as cn38 } from "@ai-matrx/design-system";
|
|
11508
11778
|
import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
11509
11779
|
var CADENCE_WORDS2 = {
|
|
11510
11780
|
instant: "as it happens",
|
|
@@ -11522,11 +11792,11 @@ function NotifyRuleEditor({ tableId, seed, className }) {
|
|
|
11522
11792
|
const host = useRecordsUi();
|
|
11523
11793
|
const table = useTable16(tableId);
|
|
11524
11794
|
const rights = useTableRights(table.data);
|
|
11525
|
-
const [subscriptions, setSubscriptions] =
|
|
11526
|
-
const [cadences, setCadences] =
|
|
11527
|
-
const [views, setViews] =
|
|
11528
|
-
const [error, setError] =
|
|
11529
|
-
const [busy, setBusy] =
|
|
11795
|
+
const [subscriptions, setSubscriptions] = useState41(null);
|
|
11796
|
+
const [cadences, setCadences] = useState41([]);
|
|
11797
|
+
const [views, setViews] = useState41(null);
|
|
11798
|
+
const [error, setError] = useState41(null);
|
|
11799
|
+
const [busy, setBusy] = useState41(false);
|
|
11530
11800
|
const load = useCallback26(async () => {
|
|
11531
11801
|
const [held, offered] = await Promise.all([
|
|
11532
11802
|
// THE PERSON'S OWN DOOR, not the notifier's. It answers what is addressed
|
|
@@ -11615,7 +11885,7 @@ function NotifyRuleEditor({ tableId, seed, className }) {
|
|
|
11615
11885
|
{
|
|
11616
11886
|
error,
|
|
11617
11887
|
className,
|
|
11618
|
-
actions: /* @__PURE__ */ jsx44(
|
|
11888
|
+
actions: /* @__PURE__ */ jsx44(Button37, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
|
|
11619
11889
|
}
|
|
11620
11890
|
);
|
|
11621
11891
|
}
|
|
@@ -11648,7 +11918,7 @@ function NotifyRuleEditor({ tableId, seed, className }) {
|
|
|
11648
11918
|
held.saved_view_id === null ? /* @__PURE__ */ jsx44("span", { className: "text-destructive", children: "This one names no view, so the store never admits a record to it." }) : null,
|
|
11649
11919
|
held.muted ? /* @__PURE__ */ jsx44("span", { className: "text-muted-foreground", children: "Switched off \u2014 it tells nobody until somebody switches it back on." }) : null,
|
|
11650
11920
|
rights.write ? /* @__PURE__ */ jsx44(
|
|
11651
|
-
|
|
11921
|
+
Button37,
|
|
11652
11922
|
{
|
|
11653
11923
|
size: "sm",
|
|
11654
11924
|
variant: "ghost",
|
|
@@ -11709,7 +11979,7 @@ function NotifyRuleEditor({ tableId, seed, className }) {
|
|
|
11709
11979
|
className: "h-7 rounded border bg-background px-1 text-xs"
|
|
11710
11980
|
}
|
|
11711
11981
|
),
|
|
11712
|
-
/* @__PURE__ */ jsx44(
|
|
11982
|
+
/* @__PURE__ */ jsx44(Button37, { size: "sm", type: "submit", disabled: busy, children: "Tell me" }),
|
|
11713
11983
|
/* @__PURE__ */ jsx44("p", { className: "w-full text-xs text-muted-foreground", children: "A send inside your quiet hours is held until they end \u2014 it is never dropped. Leave the schedule blank for the store's own default of 08:00." })
|
|
11714
11984
|
]
|
|
11715
11985
|
}
|
|
@@ -12031,9 +12301,9 @@ function Drawing({
|
|
|
12031
12301
|
}
|
|
12032
12302
|
|
|
12033
12303
|
// src/DashboardCanvas.tsx
|
|
12034
|
-
import { useCallback as useCallback27, useEffect as useEffect31, useMemo as useMemo27, useState as
|
|
12304
|
+
import { useCallback as useCallback27, useEffect as useEffect31, useMemo as useMemo27, useState as useState42 } from "react";
|
|
12035
12305
|
import { useFields as useFields19, useRecordsClient as useRecordsClient33, useTable as useTable17 } from "@ai-matrx/records/react";
|
|
12036
|
-
import { BasicInput as BasicInput14, Button as
|
|
12306
|
+
import { BasicInput as BasicInput14, Button as Button38, Skeleton as Skeleton24, cn as cn40 } from "@ai-matrx/design-system";
|
|
12037
12307
|
import { Fragment as Fragment20, jsx as jsx46, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
12038
12308
|
function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
|
|
12039
12309
|
const client = useRecordsClient33();
|
|
@@ -12041,14 +12311,14 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
|
|
|
12041
12311
|
const table = useTable17(tableId);
|
|
12042
12312
|
const rights = useTableRights(table.data);
|
|
12043
12313
|
const fields = useFields19(tableId);
|
|
12044
|
-
const [boards, setBoards] =
|
|
12045
|
-
const [error, setError] =
|
|
12046
|
-
const [activeId, setActiveId] =
|
|
12047
|
-
const [run, setRun] =
|
|
12048
|
-
const [running, setRunning] =
|
|
12049
|
-
const [question, setQuestion] =
|
|
12050
|
-
const [asking, setAsking] =
|
|
12051
|
-
const [scheduling, setScheduling] =
|
|
12314
|
+
const [boards, setBoards] = useState42(null);
|
|
12315
|
+
const [error, setError] = useState42(null);
|
|
12316
|
+
const [activeId, setActiveId] = useState42(activeDashboardId ?? null);
|
|
12317
|
+
const [run, setRun] = useState42(null);
|
|
12318
|
+
const [running, setRunning] = useState42(false);
|
|
12319
|
+
const [question, setQuestion] = useState42("");
|
|
12320
|
+
const [asking, setAsking] = useState42(false);
|
|
12321
|
+
const [scheduling, setScheduling] = useState42(false);
|
|
12052
12322
|
const load = useCallback27(async () => {
|
|
12053
12323
|
const answered = await client.dashboards({ table_id: tableId });
|
|
12054
12324
|
if (!answered.ok) {
|
|
@@ -12178,7 +12448,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
|
|
|
12178
12448
|
{
|
|
12179
12449
|
error,
|
|
12180
12450
|
className,
|
|
12181
|
-
actions: /* @__PURE__ */ jsx46(
|
|
12451
|
+
actions: /* @__PURE__ */ jsx46(Button38, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
|
|
12182
12452
|
}
|
|
12183
12453
|
);
|
|
12184
12454
|
}
|
|
@@ -12186,7 +12456,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
|
|
|
12186
12456
|
return /* @__PURE__ */ jsxs42("div", { className: cn40("flex min-h-0 flex-col gap-2", className), children: [
|
|
12187
12457
|
/* @__PURE__ */ jsxs42("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Dashboards", children: [
|
|
12188
12458
|
boards.map((d) => /* @__PURE__ */ jsx46(
|
|
12189
|
-
|
|
12459
|
+
Button38,
|
|
12190
12460
|
{
|
|
12191
12461
|
size: "sm",
|
|
12192
12462
|
variant: d.id === activeId ? "secondary" : "ghost",
|
|
@@ -12196,10 +12466,10 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
|
|
|
12196
12466
|
},
|
|
12197
12467
|
d.id
|
|
12198
12468
|
)),
|
|
12199
|
-
rights.admin ? /* @__PURE__ */ jsx46(
|
|
12469
|
+
rights.admin ? /* @__PURE__ */ jsx46(Button38, { size: "sm", variant: "ghost", onClick: () => void create(), children: "New dashboard" }) : null,
|
|
12200
12470
|
board ? /* @__PURE__ */ jsxs42("span", { className: "ml-auto flex items-center gap-1", children: [
|
|
12201
12471
|
/* @__PURE__ */ jsx46(
|
|
12202
|
-
|
|
12472
|
+
Button38,
|
|
12203
12473
|
{
|
|
12204
12474
|
size: "sm",
|
|
12205
12475
|
variant: "ghost",
|
|
@@ -12209,7 +12479,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
|
|
|
12209
12479
|
}
|
|
12210
12480
|
),
|
|
12211
12481
|
/* @__PURE__ */ jsx46(
|
|
12212
|
-
|
|
12482
|
+
Button38,
|
|
12213
12483
|
{
|
|
12214
12484
|
size: "sm",
|
|
12215
12485
|
variant: scheduling ? "secondary" : "ghost",
|
|
@@ -12217,7 +12487,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
|
|
|
12217
12487
|
children: scheduling ? "Done" : "Send on a schedule"
|
|
12218
12488
|
}
|
|
12219
12489
|
),
|
|
12220
|
-
rights.admin ? /* @__PURE__ */ jsx46(
|
|
12490
|
+
rights.admin ? /* @__PURE__ */ jsx46(Button38, { size: "sm", variant: "ghost", onClick: () => void remove(board), children: "Delete" }) : null
|
|
12221
12491
|
] }) : null
|
|
12222
12492
|
] }),
|
|
12223
12493
|
board && scheduling ? /* @__PURE__ */ jsx46(
|
|
@@ -12245,7 +12515,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
|
|
|
12245
12515
|
className: "h-8 min-w-0 flex-1 text-xs"
|
|
12246
12516
|
}
|
|
12247
12517
|
),
|
|
12248
|
-
/* @__PURE__ */ jsx46(
|
|
12518
|
+
/* @__PURE__ */ jsx46(Button38, { size: "sm", disabled: !host.onReask || asking || question.trim() === "", onClick: () => void reask(), children: asking ? "Asking" : "Ask" })
|
|
12249
12519
|
] }),
|
|
12250
12520
|
!host.onReask ? /* @__PURE__ */ jsx46("p", { className: "text-xs text-muted-foreground", children: NO_REASK_REASON }) : null
|
|
12251
12521
|
] }) : null,
|
|
@@ -12269,7 +12539,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
|
|
|
12269
12539
|
}
|
|
12270
12540
|
),
|
|
12271
12541
|
/* @__PURE__ */ jsx46(
|
|
12272
|
-
|
|
12542
|
+
Button38,
|
|
12273
12543
|
{
|
|
12274
12544
|
size: "sm",
|
|
12275
12545
|
variant: "ghost",
|
|
@@ -12288,10 +12558,10 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
|
|
|
12288
12558
|
}
|
|
12289
12559
|
|
|
12290
12560
|
// src/FormsPanel.tsx
|
|
12291
|
-
import { useCallback as useCallback28, useEffect as useEffect32, useState as
|
|
12561
|
+
import { useCallback as useCallback28, useEffect as useEffect32, useState as useState43 } from "react";
|
|
12292
12562
|
import { useRecordsClient as useRecordsClient34, useTable as useTable18 } from "@ai-matrx/records/react";
|
|
12293
12563
|
import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
|
|
12294
|
-
import { Badge as Badge15, Button as
|
|
12564
|
+
import { Badge as Badge15, Button as Button39, Skeleton as Skeleton25, cn as cn41 } from "@ai-matrx/design-system";
|
|
12295
12565
|
import { Fragment as Fragment21, jsx as jsx47, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
12296
12566
|
var WHAT_A_FORM_IS = "A form asks for this table's own fields, and its answers land here as ordinary records stamped with the form they came through.";
|
|
12297
12567
|
var NO_ADMIN = "This table has no forms. Making one needs the admin level on it, because a form decides what people with no account may add here.";
|
|
@@ -12304,11 +12574,11 @@ function FormsPanel({ tableId, className }) {
|
|
|
12304
12574
|
const host = useRecordsUi();
|
|
12305
12575
|
const table = useTable18(tableId);
|
|
12306
12576
|
const rights = useTableRights(table.data);
|
|
12307
|
-
const [forms, setForms] =
|
|
12308
|
-
const [error, setError] =
|
|
12309
|
-
const [busy, setBusy] =
|
|
12310
|
-
const [copied, setCopied] =
|
|
12311
|
-
const [building, setBuilding] =
|
|
12577
|
+
const [forms, setForms] = useState43(null);
|
|
12578
|
+
const [error, setError] = useState43(null);
|
|
12579
|
+
const [busy, setBusy] = useState43(null);
|
|
12580
|
+
const [copied, setCopied] = useState43(null);
|
|
12581
|
+
const [building, setBuilding] = useState43(false);
|
|
12312
12582
|
const load = useCallback28(async () => {
|
|
12313
12583
|
const answered = await client.forms({ table_id: tableId });
|
|
12314
12584
|
if (!answered.ok) {
|
|
@@ -12336,7 +12606,7 @@ function FormsPanel({ tableId, className }) {
|
|
|
12336
12606
|
},
|
|
12337
12607
|
[client, load]
|
|
12338
12608
|
);
|
|
12339
|
-
const [shown, setShown] =
|
|
12609
|
+
const [shown, setShown] = useState43(null);
|
|
12340
12610
|
const copy = useCallback28(async (url, formId) => {
|
|
12341
12611
|
try {
|
|
12342
12612
|
await navigator.clipboard.writeText(url);
|
|
@@ -12354,7 +12624,7 @@ function FormsPanel({ tableId, className }) {
|
|
|
12354
12624
|
/* @__PURE__ */ jsx47("h3", { className: "text-sm font-medium", children: "Forms" }),
|
|
12355
12625
|
/* @__PURE__ */ jsx47("span", { className: "text-xs text-muted-foreground", children: forms.length === 0 ? "none yet" : `${forms.length}` }),
|
|
12356
12626
|
/* @__PURE__ */ jsx47("div", { className: "flex-1" }),
|
|
12357
|
-
rights.structure && forms.length > 0 ? /* @__PURE__ */ jsx47(
|
|
12627
|
+
rights.structure && forms.length > 0 ? /* @__PURE__ */ jsx47(Button39, { size: "sm", variant: building ? "secondary" : "ghost", onClick: () => setBuilding((b) => !b), children: building ? "Done building" : "Build a form" }) : null
|
|
12358
12628
|
] }),
|
|
12359
12629
|
error ? /* @__PURE__ */ jsx47(RefusalNotice, { error }) : null,
|
|
12360
12630
|
building ? /* @__PURE__ */ jsx47(
|
|
@@ -12411,9 +12681,9 @@ function FormsPanel({ tableId, className }) {
|
|
|
12411
12681
|
] }) : null
|
|
12412
12682
|
] }),
|
|
12413
12683
|
/* @__PURE__ */ jsxs43("div", { className: "mt-2 flex flex-wrap items-center gap-1.5", children: [
|
|
12414
|
-
form.published_at ? /* @__PURE__ */ jsx47(
|
|
12684
|
+
form.published_at ? /* @__PURE__ */ jsx47(Button39, { size: "sm", variant: "outline", onClick: () => void copy(url, form.form_id), children: copied === form.form_id ? "Copied" : "Copy link" }) : null,
|
|
12415
12685
|
rights.structure ? /* @__PURE__ */ jsx47(
|
|
12416
|
-
|
|
12686
|
+
Button39,
|
|
12417
12687
|
{
|
|
12418
12688
|
size: "sm",
|
|
12419
12689
|
variant: "ghost",
|
|
@@ -12435,12 +12705,12 @@ function FormsPanel({ tableId, className }) {
|
|
|
12435
12705
|
}
|
|
12436
12706
|
|
|
12437
12707
|
// src/BookingBuilder.tsx
|
|
12438
|
-
import { useCallback as useCallback29, useEffect as useEffect33, useMemo as useMemo28, useState as
|
|
12708
|
+
import { useCallback as useCallback29, useEffect as useEffect33, useMemo as useMemo28, useState as useState44 } from "react";
|
|
12439
12709
|
import { useFields as useFields20, useRecordsClient as useRecordsClient35, useTable as useTable19 } from "@ai-matrx/records/react";
|
|
12440
12710
|
import {
|
|
12441
12711
|
bookingPath
|
|
12442
12712
|
} from "@ai-matrx/records";
|
|
12443
|
-
import { BasicInput as BasicInput15, BasicTextarea as BasicTextarea7, Button as
|
|
12713
|
+
import { BasicInput as BasicInput15, BasicTextarea as BasicTextarea7, Button as Button40, Checkbox as Checkbox7, Label as Label8, Skeleton as Skeleton26, cn as cn42 } from "@ai-matrx/design-system";
|
|
12444
12714
|
import { Fragment as Fragment22, jsx as jsx48, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
12445
12715
|
var STORE_ANSWERS_THESE = ["slot", "status", "booked_with"];
|
|
12446
12716
|
var DAYS = [
|
|
@@ -12471,23 +12741,23 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
|
12471
12741
|
const table = useTable19(tableId);
|
|
12472
12742
|
const rights = useTableRights(table.data);
|
|
12473
12743
|
const fields = useFields20(tableId);
|
|
12474
|
-
const [existing, setExisting] =
|
|
12475
|
-
const [loaded, setLoaded] =
|
|
12476
|
-
const [error, setError] =
|
|
12477
|
-
const [saving, setSaving] =
|
|
12478
|
-
const [publishing, setPublishing] =
|
|
12479
|
-
const [copied, setCopied] =
|
|
12480
|
-
const [title, setTitle] =
|
|
12481
|
-
const [minutes, setMinutes] =
|
|
12482
|
-
const [buffer, setBuffer] =
|
|
12483
|
-
const [lead, setLead] =
|
|
12484
|
-
const [perDay, setPerDay] =
|
|
12485
|
-
const [days, setDays] =
|
|
12486
|
-
const [windows, setWindows] =
|
|
12487
|
-
const [asked, setAsked] =
|
|
12488
|
-
const [confirmation, setConfirmation] =
|
|
12489
|
-
const [offer, setOffer] =
|
|
12490
|
-
const [formId, setFormId] =
|
|
12744
|
+
const [existing, setExisting] = useState44(null);
|
|
12745
|
+
const [loaded, setLoaded] = useState44(false);
|
|
12746
|
+
const [error, setError] = useState44(null);
|
|
12747
|
+
const [saving, setSaving] = useState44(false);
|
|
12748
|
+
const [publishing, setPublishing] = useState44(false);
|
|
12749
|
+
const [copied, setCopied] = useState44(false);
|
|
12750
|
+
const [title, setTitle] = useState44("");
|
|
12751
|
+
const [minutes, setMinutes] = useState44(30);
|
|
12752
|
+
const [buffer, setBuffer] = useState44(0);
|
|
12753
|
+
const [lead, setLead] = useState44(120);
|
|
12754
|
+
const [perDay, setPerDay] = useState44(8);
|
|
12755
|
+
const [days, setDays] = useState44(30);
|
|
12756
|
+
const [windows, setWindows] = useState44(() => draftWindows(null));
|
|
12757
|
+
const [asked, setAsked] = useState44([]);
|
|
12758
|
+
const [confirmation, setConfirmation] = useState44("");
|
|
12759
|
+
const [offer, setOffer] = useState44(null);
|
|
12760
|
+
const [formId, setFormId] = useState44(bookingId ?? null);
|
|
12491
12761
|
const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
|
|
12492
12762
|
const askable = useMemo28(
|
|
12493
12763
|
() => askableFields(fields.data ?? [], STORE_ANSWERS_THESE),
|
|
@@ -12592,8 +12862,8 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
|
12592
12862
|
/* @__PURE__ */ jsxs44("header", { className: "flex items-center gap-2", children: [
|
|
12593
12863
|
/* @__PURE__ */ jsx48("h3", { className: "text-sm font-medium", children: existing ? "Booking page" : "New booking page" }),
|
|
12594
12864
|
/* @__PURE__ */ jsx48("div", { className: "flex-1" }),
|
|
12595
|
-
/* @__PURE__ */ jsx48(
|
|
12596
|
-
onClose ? /* @__PURE__ */ jsx48(
|
|
12865
|
+
/* @__PURE__ */ jsx48(Button40, { size: "sm", disabled: saving, onClick: () => void save(), children: saving ? "Saving\u2026" : "Save" }),
|
|
12866
|
+
onClose ? /* @__PURE__ */ jsx48(Button40, { size: "sm", variant: "ghost", onClick: onClose, children: "Close" }) : null
|
|
12597
12867
|
] }),
|
|
12598
12868
|
error ? /* @__PURE__ */ jsx48(RefusalNotice, { error }) : null,
|
|
12599
12869
|
/* @__PURE__ */ jsxs44("label", { className: "flex flex-col gap-1", children: [
|
|
@@ -12753,7 +13023,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
|
12753
13023
|
url ? /* @__PURE__ */ jsxs44("div", { className: "flex flex-wrap items-center gap-2 rounded-md border p-2.5", children: [
|
|
12754
13024
|
/* @__PURE__ */ jsx48("span", { className: "min-w-0 flex-1 break-all text-xs", children: url }),
|
|
12755
13025
|
/* @__PURE__ */ jsx48(
|
|
12756
|
-
|
|
13026
|
+
Button40,
|
|
12757
13027
|
{
|
|
12758
13028
|
size: "sm",
|
|
12759
13029
|
variant: "outline",
|
|
@@ -12767,7 +13037,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
|
12767
13037
|
}
|
|
12768
13038
|
),
|
|
12769
13039
|
/* @__PURE__ */ jsx48(
|
|
12770
|
-
|
|
13040
|
+
Button40,
|
|
12771
13041
|
{
|
|
12772
13042
|
size: "sm",
|
|
12773
13043
|
disabled: publishing,
|
|
@@ -12782,10 +13052,10 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
|
12782
13052
|
}
|
|
12783
13053
|
|
|
12784
13054
|
// src/BookingSlots.tsx
|
|
12785
|
-
import { useCallback as useCallback30, useEffect as useEffect34, useMemo as useMemo29, useState as
|
|
13055
|
+
import { useCallback as useCallback30, useEffect as useEffect34, useMemo as useMemo29, useState as useState45 } from "react";
|
|
12786
13056
|
import { useRecordsClient as useRecordsClient36, useMyLevels as useMyLevels2 } from "@ai-matrx/records/react";
|
|
12787
13057
|
import { bookingPath as bookingPath2 } from "@ai-matrx/records";
|
|
12788
|
-
import { Badge as Badge16, Button as
|
|
13058
|
+
import { Badge as Badge16, Button as Button41, Skeleton as Skeleton27, cn as cn43 } from "@ai-matrx/design-system";
|
|
12789
13059
|
import { Fragment as Fragment23, jsx as jsx49, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
12790
13060
|
var WHAT_A_BOOKING_PAGE_IS = "A booking page offers times you are free and writes each appointment into this table as an ordinary record.";
|
|
12791
13061
|
function bookingSuggestion(tableName2) {
|
|
@@ -12802,12 +13072,12 @@ var STATE_WORDS = {
|
|
|
12802
13072
|
function BookingSlots({ tableId, className }) {
|
|
12803
13073
|
const client = useRecordsClient36();
|
|
12804
13074
|
const host = useRecordsUi();
|
|
12805
|
-
const [pages, setPages] =
|
|
12806
|
-
const [error, setError] =
|
|
12807
|
-
const [busy, setBusy] =
|
|
12808
|
-
const [copied, setCopied] =
|
|
12809
|
-
const [shown, setShown] =
|
|
12810
|
-
const [building, setBuilding] =
|
|
13075
|
+
const [pages, setPages] = useState45(null);
|
|
13076
|
+
const [error, setError] = useState45(null);
|
|
13077
|
+
const [busy, setBusy] = useState45(null);
|
|
13078
|
+
const [copied, setCopied] = useState45(null);
|
|
13079
|
+
const [shown, setShown] = useState45(null);
|
|
13080
|
+
const [building, setBuilding] = useState45(false);
|
|
12811
13081
|
const load = useCallback30(async () => {
|
|
12812
13082
|
const answered = await client.bookings(tableId ? { table_id: tableId } : {});
|
|
12813
13083
|
if (!answered.ok) {
|
|
@@ -12858,7 +13128,7 @@ function BookingSlots({ tableId, className }) {
|
|
|
12858
13128
|
/* @__PURE__ */ jsx49("h3", { className: "text-sm font-medium", children: "Bookings" }),
|
|
12859
13129
|
/* @__PURE__ */ jsx49("span", { className: "text-xs text-muted-foreground", children: pages.length === 0 ? "none yet" : `${pages.length}` }),
|
|
12860
13130
|
/* @__PURE__ */ jsx49("div", { className: "flex-1" }),
|
|
12861
|
-
tableId && pages.length > 0 ? /* @__PURE__ */ jsx49(
|
|
13131
|
+
tableId && pages.length > 0 ? /* @__PURE__ */ jsx49(Button41, { size: "sm", variant: building ? "secondary" : "ghost", onClick: () => setBuilding((b) => !b), children: building ? "Done building" : "Build a booking page" }) : null
|
|
12862
13132
|
] }),
|
|
12863
13133
|
error ? /* @__PURE__ */ jsx49(RefusalNotice, { error }) : null,
|
|
12864
13134
|
building && tableId ? /* @__PURE__ */ jsx49(
|
|
@@ -12925,9 +13195,9 @@ function BookingSlots({ tableId, className }) {
|
|
|
12925
13195
|
] }),
|
|
12926
13196
|
/* @__PURE__ */ jsx49("p", { className: "mt-1 text-xs text-muted-foreground", children: nextInWords(page) }),
|
|
12927
13197
|
/* @__PURE__ */ jsxs45("div", { className: "mt-2 flex flex-wrap items-center gap-1.5", children: [
|
|
12928
|
-
/* @__PURE__ */ jsx49(
|
|
13198
|
+
/* @__PURE__ */ jsx49(Button41, { size: "sm", variant: "outline", onClick: () => void copy(url, page.form_id), children: copied === page.form_id ? "Copied" : "Copy link" }),
|
|
12929
13199
|
mayOpen ? /* @__PURE__ */ jsx49(
|
|
12930
|
-
|
|
13200
|
+
Button41,
|
|
12931
13201
|
{
|
|
12932
13202
|
size: "sm",
|
|
12933
13203
|
variant: "ghost",
|
|
@@ -12975,17 +13245,17 @@ function nextInWords(page) {
|
|
|
12975
13245
|
}
|
|
12976
13246
|
|
|
12977
13247
|
// src/CaptureSheet.tsx
|
|
12978
|
-
import { useCallback as useCallback32, useEffect as useEffect36, useRef as useRef14, useState as
|
|
13248
|
+
import { useCallback as useCallback32, useEffect as useEffect36, useRef as useRef14, useState as useState47 } from "react";
|
|
12979
13249
|
import { useFields as useFields21, useRecordsClient as useRecordsClient38, useTable as useTable20 } from "@ai-matrx/records/react";
|
|
12980
|
-
import { Button as
|
|
13250
|
+
import { Button as Button43, Input as Input4, Skeleton as Skeleton29, Textarea as Textarea3, cn as cn45 } from "@ai-matrx/design-system";
|
|
12981
13251
|
|
|
12982
13252
|
// src/CaptureRun.tsx
|
|
12983
|
-
import { useCallback as useCallback31, useEffect as useEffect35, useMemo as useMemo30, useRef as useRef13, useState as
|
|
13253
|
+
import { useCallback as useCallback31, useEffect as useEffect35, useMemo as useMemo30, useRef as useRef13, useState as useState46 } from "react";
|
|
12984
13254
|
import {
|
|
12985
13255
|
openCaptureQueue
|
|
12986
13256
|
} from "@ai-matrx/records";
|
|
12987
13257
|
import { useRecordsClient as useRecordsClient37 } from "@ai-matrx/records/react";
|
|
12988
|
-
import { Button as
|
|
13258
|
+
import { Button as Button42, Input as Input3, Skeleton as Skeleton28, Textarea as Textarea2, cn as cn44 } from "@ai-matrx/design-system";
|
|
12989
13259
|
import { jsx as jsx50, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
12990
13260
|
function controlFor(field) {
|
|
12991
13261
|
if (!field) return "text";
|
|
@@ -13025,17 +13295,17 @@ function whereWeAre(timeoutMs = 4e3) {
|
|
|
13025
13295
|
function CaptureRun({ sheetId, face: given, className }) {
|
|
13026
13296
|
const client = useRecordsClient37();
|
|
13027
13297
|
const host = useRecordsUi();
|
|
13028
|
-
const [face, setFace] =
|
|
13029
|
-
const [loadFailed, setLoadFailed] =
|
|
13030
|
-
const [at, setAt] =
|
|
13031
|
-
const [answers, setAnswers] =
|
|
13032
|
-
const [files, setFiles] =
|
|
13033
|
-
const [missing, setMissing] =
|
|
13034
|
-
const [done, setDone] =
|
|
13035
|
-
const [counts, setCounts] =
|
|
13036
|
-
const [items, setItems] =
|
|
13037
|
-
const [lastSynced, setLastSynced] =
|
|
13038
|
-
const [sending, setSending] =
|
|
13298
|
+
const [face, setFace] = useState46(given);
|
|
13299
|
+
const [loadFailed, setLoadFailed] = useState46(null);
|
|
13300
|
+
const [at, setAt] = useState46(0);
|
|
13301
|
+
const [answers, setAnswers] = useState46({});
|
|
13302
|
+
const [files, setFiles] = useState46({});
|
|
13303
|
+
const [missing, setMissing] = useState46(null);
|
|
13304
|
+
const [done, setDone] = useState46(null);
|
|
13305
|
+
const [counts, setCounts] = useState46({ waiting: 0, sending: 0, refused: 0, landed: 0 });
|
|
13306
|
+
const [items, setItems] = useState46([]);
|
|
13307
|
+
const [lastSynced, setLastSynced] = useState46(null);
|
|
13308
|
+
const [sending, setSending] = useState46(false);
|
|
13039
13309
|
const queueRef = useRef13(null);
|
|
13040
13310
|
useEffect35(() => {
|
|
13041
13311
|
const q2 = openCaptureQueue({
|
|
@@ -13176,7 +13446,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
13176
13446
|
] }) : null,
|
|
13177
13447
|
/* @__PURE__ */ jsx50("span", { className: "ml-auto", "data-testid": "capture-last-synced", children: lastSynced ? `Last synced ${new Date(lastSynced).toLocaleTimeString()}` : "Not synced yet" }),
|
|
13178
13448
|
waiting > 0 || counts.refused > 0 ? /* @__PURE__ */ jsx50(
|
|
13179
|
-
|
|
13449
|
+
Button42,
|
|
13180
13450
|
{
|
|
13181
13451
|
size: "sm",
|
|
13182
13452
|
variant: "ghost",
|
|
@@ -13192,7 +13462,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
13192
13462
|
/* @__PURE__ */ jsx50("span", { className: "tabular-nums text-muted-foreground", children: new Date(i.captured_at).toLocaleTimeString() }),
|
|
13193
13463
|
/* @__PURE__ */ jsx50("span", { className: cn44("flex-1", i.state === "refused" && "text-destructive"), children: i.state === "refused" ? i.last_error ?? "This one was refused." : i.last_error ?? "Waiting for a signal." }),
|
|
13194
13464
|
i.state === "refused" ? /* @__PURE__ */ jsx50(
|
|
13195
|
-
|
|
13465
|
+
Button42,
|
|
13196
13466
|
{
|
|
13197
13467
|
size: "sm",
|
|
13198
13468
|
variant: "ghost",
|
|
@@ -13215,7 +13485,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
13215
13485
|
return /* @__PURE__ */ jsxs46("section", { className: cn44("mx-auto flex w-full max-w-sm flex-col gap-3 p-4", className), children: [
|
|
13216
13486
|
/* @__PURE__ */ jsx50("h2", { className: "text-lg font-medium", "data-testid": "capture-thankyou", children: thanks.title ?? "Logged" }),
|
|
13217
13487
|
/* @__PURE__ */ jsx50("p", { className: "text-sm text-muted-foreground", children: done.queued ? "There is no signal, so this one is on the phone and goes up the moment there is. Nothing is lost." : thanks.body ?? "Ready for the next one." }),
|
|
13218
|
-
/* @__PURE__ */ jsx50(
|
|
13488
|
+
/* @__PURE__ */ jsx50(Button42, { className: "h-12", onClick: () => setDone(null), "data-testid": "capture-next", children: "Next one" }),
|
|
13219
13489
|
queueLine,
|
|
13220
13490
|
queuePanel
|
|
13221
13491
|
] });
|
|
@@ -13309,7 +13579,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
13309
13579
|
missing ? /* @__PURE__ */ jsx50("p", { className: "text-sm text-destructive", "data-testid": "capture-missing", children: missing }) : null,
|
|
13310
13580
|
/* @__PURE__ */ jsxs46("div", { className: "flex items-center gap-2", children: [
|
|
13311
13581
|
at > 0 ? /* @__PURE__ */ jsx50(
|
|
13312
|
-
|
|
13582
|
+
Button42,
|
|
13313
13583
|
{
|
|
13314
13584
|
variant: "ghost",
|
|
13315
13585
|
className: "h-12 px-3",
|
|
@@ -13319,7 +13589,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
13319
13589
|
}
|
|
13320
13590
|
) : null,
|
|
13321
13591
|
last ? /* @__PURE__ */ jsx50(
|
|
13322
|
-
|
|
13592
|
+
Button42,
|
|
13323
13593
|
{
|
|
13324
13594
|
className: "h-12 flex-1 text-base",
|
|
13325
13595
|
onClick: () => void capture(),
|
|
@@ -13327,7 +13597,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
13327
13597
|
children: "Capture"
|
|
13328
13598
|
}
|
|
13329
13599
|
) : /* @__PURE__ */ jsx50(
|
|
13330
|
-
|
|
13600
|
+
Button42,
|
|
13331
13601
|
{
|
|
13332
13602
|
className: "h-12 flex-1 text-base",
|
|
13333
13603
|
onClick: () => setAt(at + 1),
|
|
@@ -13385,15 +13655,15 @@ function AdHocCaptureSheet({
|
|
|
13385
13655
|
const host = useRecordsUi();
|
|
13386
13656
|
const table = useTable20(tableId);
|
|
13387
13657
|
const fields = useFields21(tableId);
|
|
13388
|
-
const [mode, setMode] =
|
|
13389
|
-
const [reading, setReading] =
|
|
13390
|
-
const [note, setNote] =
|
|
13391
|
-
const [fileId, setFileId] =
|
|
13392
|
-
const [pending, setPending] =
|
|
13393
|
-
const [saved, setSaved] =
|
|
13394
|
-
const [error, setError] =
|
|
13395
|
-
const [uploadError, setUploadError] =
|
|
13396
|
-
const [flushing, setFlushing] =
|
|
13658
|
+
const [mode, setMode] = useState47("reading");
|
|
13659
|
+
const [reading, setReading] = useState47("");
|
|
13660
|
+
const [note, setNote] = useState47("");
|
|
13661
|
+
const [fileId, setFileId] = useState47(null);
|
|
13662
|
+
const [pending, setPending] = useState47(null);
|
|
13663
|
+
const [saved, setSaved] = useState47([]);
|
|
13664
|
+
const [error, setError] = useState47(null);
|
|
13665
|
+
const [uploadError, setUploadError] = useState47(null);
|
|
13666
|
+
const [flushing, setFlushing] = useState47(false);
|
|
13397
13667
|
const queue = useRef14([]);
|
|
13398
13668
|
const keep = useCallback32(
|
|
13399
13669
|
async (next) => {
|
|
@@ -13482,7 +13752,7 @@ function AdHocCaptureSheet({
|
|
|
13482
13752
|
return /* @__PURE__ */ jsxs47("section", { className: cn45("mx-auto flex w-full max-w-sm flex-col gap-2", className), children: [
|
|
13483
13753
|
/* @__PURE__ */ jsxs47("header", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
13484
13754
|
CAPTURE_MODES.map((m) => /* @__PURE__ */ jsx51(
|
|
13485
|
-
|
|
13755
|
+
Button43,
|
|
13486
13756
|
{
|
|
13487
13757
|
size: "sm",
|
|
13488
13758
|
variant: m === mode ? "default" : "ghost",
|
|
@@ -13553,12 +13823,12 @@ function AdHocCaptureSheet({
|
|
|
13553
13823
|
onChange: (e) => setNote(e.target.value)
|
|
13554
13824
|
}
|
|
13555
13825
|
),
|
|
13556
|
-
/* @__PURE__ */ jsx51(
|
|
13826
|
+
/* @__PURE__ */ jsx51(Button43, { className: "h-12", onClick: () => void capture(), children: "Capture" }),
|
|
13557
13827
|
pending.length > 0 ? /* @__PURE__ */ jsxs47("div", { className: "flex flex-col gap-1 rounded border p-2", children: [
|
|
13558
13828
|
/* @__PURE__ */ jsxs47("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
13559
13829
|
/* @__PURE__ */ jsx51("span", { className: "font-medium", children: "Waiting to send" }),
|
|
13560
13830
|
/* @__PURE__ */ jsx51(
|
|
13561
|
-
|
|
13831
|
+
Button43,
|
|
13562
13832
|
{
|
|
13563
13833
|
size: "sm",
|
|
13564
13834
|
variant: "ghost",
|
|
@@ -13582,17 +13852,17 @@ function AdHocCaptureSheet({
|
|
|
13582
13852
|
}
|
|
13583
13853
|
|
|
13584
13854
|
// src/PortalShell.tsx
|
|
13585
|
-
import { useCallback as useCallback33, useEffect as useEffect37, useState as
|
|
13855
|
+
import { useCallback as useCallback33, useEffect as useEffect37, useState as useState48 } from "react";
|
|
13586
13856
|
import { useRecordsClient as useRecordsClient39 } from "@ai-matrx/records/react";
|
|
13587
|
-
import { Button as
|
|
13857
|
+
import { Button as Button44, Skeleton as Skeleton30, cn as cn46 } from "@ai-matrx/design-system";
|
|
13588
13858
|
import { jsx as jsx52, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
13589
13859
|
function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
13590
13860
|
const client = useRecordsClient39();
|
|
13591
|
-
const [card, setCard] =
|
|
13592
|
-
const [reach, setReach] =
|
|
13593
|
-
const [error, setError] =
|
|
13594
|
-
const [open, setOpen] =
|
|
13595
|
-
const [sending, setSending] =
|
|
13861
|
+
const [card, setCard] = useState48(null);
|
|
13862
|
+
const [reach, setReach] = useState48(null);
|
|
13863
|
+
const [error, setError] = useState48(null);
|
|
13864
|
+
const [open, setOpen] = useState48(null);
|
|
13865
|
+
const [sending, setSending] = useState48(false);
|
|
13596
13866
|
const load = useCallback33(async () => {
|
|
13597
13867
|
const who = await client.externalPrincipalCard();
|
|
13598
13868
|
if (!who.ok) {
|
|
@@ -13622,7 +13892,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
|
13622
13892
|
return /* @__PURE__ */ jsxs48("section", { className: cn46("flex min-h-0 flex-col gap-2", className), children: [
|
|
13623
13893
|
/* @__PURE__ */ jsxs48("header", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
13624
13894
|
/* @__PURE__ */ jsx52("span", { className: "font-medium text-foreground", children: form.name }),
|
|
13625
|
-
/* @__PURE__ */ jsx52(
|
|
13895
|
+
/* @__PURE__ */ jsx52(Button44, { size: "sm", variant: "ghost", className: "ml-auto h-6 px-2 text-[11px]", onClick: () => setSending(false), children: "Back" })
|
|
13626
13896
|
] }),
|
|
13627
13897
|
/* @__PURE__ */ jsx52(
|
|
13628
13898
|
FormRunner,
|
|
@@ -13643,7 +13913,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
|
13643
13913
|
/* @__PURE__ */ jsxs48("header", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
13644
13914
|
/* @__PURE__ */ jsx52("span", { className: "font-medium text-foreground", children: "Shared with you" }),
|
|
13645
13915
|
/* @__PURE__ */ jsx52("span", { className: "tabular-nums", children: reach.length }),
|
|
13646
|
-
form ? /* @__PURE__ */ jsx52(
|
|
13916
|
+
form ? /* @__PURE__ */ jsx52(Button44, { size: "sm", className: "ml-auto h-7 px-2 text-[11px]", onClick: () => setSending(true), children: form.submitLabel ?? form.name }) : null
|
|
13647
13917
|
] }),
|
|
13648
13918
|
reach.length === 0 ? (
|
|
13649
13919
|
// EMPTY, AND IT SAYS WHICH EMPTY. "Nobody has shared anything with you"
|
|
@@ -13667,7 +13937,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
|
13667
13937
|
}
|
|
13668
13938
|
function PortalRow({ tableId, recordId }) {
|
|
13669
13939
|
const client = useRecordsClient39();
|
|
13670
|
-
const [title, setTitle] =
|
|
13940
|
+
const [title, setTitle] = useState48(null);
|
|
13671
13941
|
useEffect37(() => {
|
|
13672
13942
|
let cancelled = false;
|
|
13673
13943
|
void client.recordRead({ record_id: recordId }).then((answered) => {
|
|
@@ -13688,17 +13958,17 @@ function PortalRow({ tableId, recordId }) {
|
|
|
13688
13958
|
}
|
|
13689
13959
|
|
|
13690
13960
|
// src/PublicViewPage.tsx
|
|
13691
|
-
import { useCallback as useCallback34, useEffect as useEffect38, useState as
|
|
13961
|
+
import { useCallback as useCallback34, useEffect as useEffect38, useState as useState49 } from "react";
|
|
13692
13962
|
import { useRecordsClient as useRecordsClient40 } from "@ai-matrx/records/react";
|
|
13693
13963
|
import { Skeleton as Skeleton31, cn as cn47 } from "@ai-matrx/design-system";
|
|
13694
13964
|
import { jsx as jsx53, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
13695
13965
|
function PublicViewPage({ slug, className }) {
|
|
13696
13966
|
const client = useRecordsClient40();
|
|
13697
|
-
const [binding, setBinding] =
|
|
13698
|
-
const [rows, setRows] =
|
|
13699
|
-
const [fields, setFields] =
|
|
13700
|
-
const [error, setError] =
|
|
13701
|
-
const [gap, setGap] =
|
|
13967
|
+
const [binding, setBinding] = useState49(null);
|
|
13968
|
+
const [rows, setRows] = useState49(null);
|
|
13969
|
+
const [fields, setFields] = useState49(null);
|
|
13970
|
+
const [error, setError] = useState49(null);
|
|
13971
|
+
const [gap, setGap] = useState49(null);
|
|
13702
13972
|
const load = useCallback34(async () => {
|
|
13703
13973
|
const notice = await client.worldPublishGapNotice();
|
|
13704
13974
|
if (notice.ok) setGap(notice.data);
|
|
@@ -13769,9 +14039,9 @@ function PublicRow({ row, fields }) {
|
|
|
13769
14039
|
}
|
|
13770
14040
|
|
|
13771
14041
|
// src/EmbedFrame.tsx
|
|
13772
|
-
import { useCallback as useCallback35, useEffect as useEffect39, useState as
|
|
14042
|
+
import { useCallback as useCallback35, useEffect as useEffect39, useState as useState50 } from "react";
|
|
13773
14043
|
import { useRecordsClient as useRecordsClient41 } from "@ai-matrx/records/react";
|
|
13774
|
-
import { Button as
|
|
14044
|
+
import { Button as Button45, Input as Input5, Skeleton as Skeleton32, Textarea as Textarea4, cn as cn48 } from "@ai-matrx/design-system";
|
|
13775
14045
|
import { useTable as useTable21 } from "@ai-matrx/records/react";
|
|
13776
14046
|
import { Fragment as Fragment25, jsx as jsx54, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
13777
14047
|
function EmbedFrame({
|
|
@@ -13786,11 +14056,11 @@ function EmbedFrame({
|
|
|
13786
14056
|
const host = useRecordsUi();
|
|
13787
14057
|
const table = useTable21(tableId);
|
|
13788
14058
|
const rights = useTableRights(table.data);
|
|
13789
|
-
const [origins, setOrigins] =
|
|
13790
|
-
const [secret, setSecret] =
|
|
13791
|
-
const [tokenId, setTokenId] =
|
|
13792
|
-
const [error, setError] =
|
|
13793
|
-
const [busy, setBusy] =
|
|
14059
|
+
const [origins, setOrigins] = useState50("");
|
|
14060
|
+
const [secret, setSecret] = useState50(null);
|
|
14061
|
+
const [tokenId, setTokenId] = useState50(null);
|
|
14062
|
+
const [error, setError] = useState50(null);
|
|
14063
|
+
const [busy, setBusy] = useState50(false);
|
|
13794
14064
|
const mode = formId ? "write" : "read";
|
|
13795
14065
|
const parsed = origins.split(/[\s,]+/).map((o) => o.trim()).filter((o) => o.length > 0);
|
|
13796
14066
|
const issue = useCallback35(async () => {
|
|
@@ -13857,12 +14127,12 @@ function EmbedFrame({
|
|
|
13857
14127
|
" will not pass."
|
|
13858
14128
|
] })
|
|
13859
14129
|
] }),
|
|
13860
|
-
!secret ? /* @__PURE__ */ jsx54(
|
|
14130
|
+
!secret ? /* @__PURE__ */ jsx54(Button45, { size: "sm", className: "self-start", disabled: busy || parsed.length === 0, onClick: () => void issue(), children: busy ? "Issuing\u2026" : "Issue embed" }) : /* @__PURE__ */ jsxs50(Fragment25, { children: [
|
|
13861
14131
|
/* @__PURE__ */ jsx54("p", { className: "rounded border px-2 py-1 text-xs text-muted-foreground", children: "Copy this now. Only its digest is stored, so nobody \u2014 including us \u2014 can show it to you again; if it is lost, issue a new one and replace the old." }),
|
|
13862
14132
|
/* @__PURE__ */ jsx54(Textarea4, { "aria-label": "Embed snippet", readOnly: true, rows: 3, className: "font-mono text-[11px]", value: snippet ?? "" }),
|
|
13863
14133
|
/* @__PURE__ */ jsxs50("div", { className: "flex gap-2", children: [
|
|
13864
14134
|
/* @__PURE__ */ jsx54(
|
|
13865
|
-
|
|
14135
|
+
Button45,
|
|
13866
14136
|
{
|
|
13867
14137
|
size: "sm",
|
|
13868
14138
|
variant: "outline",
|
|
@@ -13870,16 +14140,16 @@ function EmbedFrame({
|
|
|
13870
14140
|
children: "Copy"
|
|
13871
14141
|
}
|
|
13872
14142
|
),
|
|
13873
|
-
/* @__PURE__ */ jsx54(
|
|
14143
|
+
/* @__PURE__ */ jsx54(Button45, { size: "sm", variant: "ghost", disabled: busy, onClick: () => void revoke(), children: "Revoke" })
|
|
13874
14144
|
] })
|
|
13875
14145
|
] })
|
|
13876
14146
|
] });
|
|
13877
14147
|
}
|
|
13878
14148
|
function useEmbedHandshake(args) {
|
|
13879
14149
|
const client = useRecordsClient41();
|
|
13880
|
-
const [binding, setBinding] =
|
|
13881
|
-
const [error, setError] =
|
|
13882
|
-
const [loading, setLoading] =
|
|
14150
|
+
const [binding, setBinding] = useState50(null);
|
|
14151
|
+
const [error, setError] = useState50(null);
|
|
14152
|
+
const [loading, setLoading] = useState50(true);
|
|
13883
14153
|
const origin = args.origin ?? (typeof location === "undefined" ? "" : location.origin);
|
|
13884
14154
|
const { secret, requiredMode } = args;
|
|
13885
14155
|
useEffect39(() => {
|
|
@@ -13937,9 +14207,9 @@ function recordsDataSource(client, fallbackSchema = "custom") {
|
|
|
13937
14207
|
}
|
|
13938
14208
|
|
|
13939
14209
|
// src/TablesHome.tsx
|
|
13940
|
-
import { useCallback as useCallback36, useEffect as useEffect40, useState as
|
|
14210
|
+
import { useCallback as useCallback36, useEffect as useEffect40, useState as useState51 } from "react";
|
|
13941
14211
|
import { useRecordsClient as useRecordsClient42, useTables as useTables3 } from "@ai-matrx/records/react";
|
|
13942
|
-
import { BasicInput as BasicInput16, Button as
|
|
14212
|
+
import { BasicInput as BasicInput16, Button as Button46, Skeleton as Skeleton33, cn as cn49 } from "@ai-matrx/design-system";
|
|
13943
14213
|
|
|
13944
14214
|
// src/createTable.ts
|
|
13945
14215
|
function tokenFor(name) {
|
|
@@ -14076,12 +14346,12 @@ function laneFor(table) {
|
|
|
14076
14346
|
function TablesHome({ onOpenTable, className }) {
|
|
14077
14347
|
const client = useRecordsClient42();
|
|
14078
14348
|
const tables = useTables3();
|
|
14079
|
-
const [creating, setCreating] =
|
|
14080
|
-
const [name, setName] =
|
|
14081
|
-
const [busy, setBusy] =
|
|
14082
|
-
const [error, setError] =
|
|
14083
|
-
const [importInto, setImportInto] =
|
|
14084
|
-
const [boards, setBoards] =
|
|
14349
|
+
const [creating, setCreating] = useState51(false);
|
|
14350
|
+
const [name, setName] = useState51("");
|
|
14351
|
+
const [busy, setBusy] = useState51(false);
|
|
14352
|
+
const [error, setError] = useState51(null);
|
|
14353
|
+
const [importInto, setImportInto] = useState51(null);
|
|
14354
|
+
const [boards, setBoards] = useState51(null);
|
|
14085
14355
|
useEffect40(() => {
|
|
14086
14356
|
let cancelled = false;
|
|
14087
14357
|
void client.dashboards({}).then((result) => {
|
|
@@ -14128,9 +14398,9 @@ function TablesHome({ onOpenTable, className }) {
|
|
|
14128
14398
|
className: "h-8 max-w-xs"
|
|
14129
14399
|
}
|
|
14130
14400
|
),
|
|
14131
|
-
/* @__PURE__ */ jsx56(
|
|
14401
|
+
/* @__PURE__ */ jsx56(Button46, { size: "sm", disabled: busy || name.trim().length === 0, onClick: () => void create("open"), children: busy ? "Declaring\u2026" : "Create" }),
|
|
14132
14402
|
/* @__PURE__ */ jsx56(
|
|
14133
|
-
|
|
14403
|
+
Button46,
|
|
14134
14404
|
{
|
|
14135
14405
|
size: "sm",
|
|
14136
14406
|
variant: "outline",
|
|
@@ -14139,12 +14409,12 @@ function TablesHome({ onOpenTable, className }) {
|
|
|
14139
14409
|
children: "Create and import a file"
|
|
14140
14410
|
}
|
|
14141
14411
|
),
|
|
14142
|
-
/* @__PURE__ */ jsx56(
|
|
14143
|
-
] }) : /* @__PURE__ */ jsx56(
|
|
14412
|
+
/* @__PURE__ */ jsx56(Button46, { size: "sm", variant: "ghost", onClick: () => setCreating(false), children: "Cancel" })
|
|
14413
|
+
] }) : /* @__PURE__ */ jsx56(Button46, { size: "sm", onClick: () => setCreating(true), children: "New table" }) }),
|
|
14144
14414
|
error ? /* @__PURE__ */ jsx56(RefusalNotice, { error }) : null,
|
|
14145
14415
|
importInto ? /* @__PURE__ */ jsxs51("div", { className: "rounded-md border p-3", children: [
|
|
14146
14416
|
/* @__PURE__ */ jsx56(ImportWizard, { tableId: importInto, onDone: () => setImportInto(null) }),
|
|
14147
|
-
/* @__PURE__ */ jsx56(
|
|
14417
|
+
/* @__PURE__ */ jsx56(Button46, { size: "sm", variant: "ghost", className: "mt-2", onClick: () => onOpenTable?.(importInto), children: "Open the table" })
|
|
14148
14418
|
] }) : null,
|
|
14149
14419
|
tables.error ? /* @__PURE__ */ jsx56(RefusalNotice, { error: tables.error }) : null,
|
|
14150
14420
|
tables.loading && !tables.data ? /* @__PURE__ */ jsxs51("div", { className: "space-y-2", children: [
|
|
@@ -14216,9 +14486,9 @@ function TablesHome({ onOpenTable, className }) {
|
|
|
14216
14486
|
}
|
|
14217
14487
|
|
|
14218
14488
|
// src/TablePage.tsx
|
|
14219
|
-
import { useCallback as useCallback37, useEffect as useEffect41, useState as
|
|
14489
|
+
import { useCallback as useCallback37, useEffect as useEffect41, useState as useState52 } from "react";
|
|
14220
14490
|
import { useRecordsClient as useRecordsClient43, useTable as useTable22 } from "@ai-matrx/records/react";
|
|
14221
|
-
import { Button as
|
|
14491
|
+
import { Button as Button47, Separator as Separator12, Skeleton as Skeleton34, cn as cn50 } from "@ai-matrx/design-system";
|
|
14222
14492
|
import { Fragment as Fragment27, jsx as jsx57, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
14223
14493
|
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.";
|
|
14224
14494
|
var DEFAULT_VIEW_NAME = "All records";
|
|
@@ -14240,6 +14510,19 @@ function surfaceChosen(current, asking) {
|
|
|
14240
14510
|
function openingRail(activeRecordId) {
|
|
14241
14511
|
return activeRecordId ? { rail: "record", record: activeRecordId } : { rail: "none", record: null };
|
|
14242
14512
|
}
|
|
14513
|
+
function openingView(activeView, activeDashboardId) {
|
|
14514
|
+
const named = pageViewFromParam(activeView);
|
|
14515
|
+
if (named === null) {
|
|
14516
|
+
const asked = typeof activeView === "string" ? activeView.trim() : "";
|
|
14517
|
+
return {
|
|
14518
|
+
main: activeDashboardId ? "dashboards" : "records",
|
|
14519
|
+
layout: null,
|
|
14520
|
+
unknown: asked === "" ? null : asked
|
|
14521
|
+
};
|
|
14522
|
+
}
|
|
14523
|
+
if (named === "dashboards") return { main: "dashboards", layout: null, unknown: null };
|
|
14524
|
+
return { main: "records", layout: named, unknown: null };
|
|
14525
|
+
}
|
|
14243
14526
|
function TablePage({
|
|
14244
14527
|
tableId,
|
|
14245
14528
|
pageSize = 100,
|
|
@@ -14248,30 +14531,47 @@ function TablePage({
|
|
|
14248
14531
|
leaveLabel = "Back to your tables",
|
|
14249
14532
|
activeDashboardId,
|
|
14250
14533
|
activeRecordId,
|
|
14534
|
+
activeView,
|
|
14535
|
+
onViewChanged,
|
|
14251
14536
|
className
|
|
14252
14537
|
}) {
|
|
14253
14538
|
const client = useRecordsClient43();
|
|
14254
14539
|
const table = useTable22(tableId);
|
|
14255
14540
|
const rights = useTableRights(table.data);
|
|
14256
14541
|
const organizationId = useRecordsClient43().config.organizationId;
|
|
14257
|
-
const [view, setView] =
|
|
14542
|
+
const [view, setView] = useState52(null);
|
|
14258
14543
|
const opening = openingRail(activeRecordId);
|
|
14259
|
-
const
|
|
14260
|
-
const [
|
|
14261
|
-
|
|
14544
|
+
const opened = openingView(activeView, activeDashboardId);
|
|
14545
|
+
const [asking, setAsking] = useState52(null);
|
|
14546
|
+
const [layoutFromLink, setLayoutFromLink] = useState52(opened.layout);
|
|
14547
|
+
const [surface, setSurface] = useState52({
|
|
14548
|
+
main: opened.main,
|
|
14262
14549
|
rail: opening.rail
|
|
14263
14550
|
});
|
|
14264
14551
|
const { main, rail } = surface;
|
|
14265
14552
|
const setRail = (next) => setSurface((now) => ({ ...now, rail: next }));
|
|
14266
|
-
const [openRecord, setOpenRecord] =
|
|
14553
|
+
const [openRecord, setOpenRecord] = useState52(opening.record);
|
|
14267
14554
|
const viewVersion = useRecordVersion(view?.id ?? null);
|
|
14268
|
-
const
|
|
14555
|
+
const shownLayout = layoutFromLink ?? view?.layout ?? "grid";
|
|
14556
|
+
const press = (pressed) => {
|
|
14557
|
+
const next = chooseSurface(surface, pressed);
|
|
14558
|
+
setSurface(next);
|
|
14559
|
+
if (next.main !== surface.main) {
|
|
14560
|
+
onViewChanged?.(next.main === "dashboards" ? "dashboards" : shownLayout);
|
|
14561
|
+
}
|
|
14562
|
+
};
|
|
14269
14563
|
const show = (next) => press({ rail: next });
|
|
14270
14564
|
useEffect41(() => {
|
|
14271
14565
|
if (!activeRecordId) return;
|
|
14272
14566
|
setOpenRecord(activeRecordId);
|
|
14273
14567
|
setSurface((now) => ({ ...now, rail: "record" }));
|
|
14274
14568
|
}, [activeRecordId]);
|
|
14569
|
+
useEffect41(() => {
|
|
14570
|
+
const named = pageViewFromParam(activeView);
|
|
14571
|
+
if (named === null) return;
|
|
14572
|
+
setLayoutFromLink(named === "dashboards" ? null : named);
|
|
14573
|
+
setSurface((now) => ({ ...now, main: named === "dashboards" ? "dashboards" : "records" }));
|
|
14574
|
+
}, [activeView]);
|
|
14275
14575
|
const patchView = useCallback37(
|
|
14276
14576
|
async (patch) => {
|
|
14277
14577
|
const current = view;
|
|
@@ -14294,7 +14594,7 @@ function TablePage({
|
|
|
14294
14594
|
return /* @__PURE__ */ jsxs52("div", { className: cn50("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
|
|
14295
14595
|
/* @__PURE__ */ jsx57("p", { className: "text-sm font-medium", children: "This table is not here" }),
|
|
14296
14596
|
/* @__PURE__ */ jsx57("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_NOT_REACHABLE }),
|
|
14297
|
-
onLeave ? /* @__PURE__ */ jsx57(
|
|
14597
|
+
onLeave ? /* @__PURE__ */ jsx57(Button47, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
|
|
14298
14598
|
] });
|
|
14299
14599
|
}
|
|
14300
14600
|
return /* @__PURE__ */ jsxs52("div", { className: cn50("flex min-h-0 gap-4", className), children: [
|
|
@@ -14309,10 +14609,10 @@ function TablePage({
|
|
|
14309
14609
|
className: "min-w-0 flex-1"
|
|
14310
14610
|
}
|
|
14311
14611
|
),
|
|
14312
|
-
rights.write && view && view.layout !== "grid" ? /* @__PURE__ */ jsx57(
|
|
14612
|
+
rights.write && view && view.layout !== "grid" ? /* @__PURE__ */ jsx57(Button47, { size: "sm", onClick: () => show("new-record"), children: "New record" }) : null,
|
|
14313
14613
|
rights.structure ? /* @__PURE__ */ jsxs52(Fragment27, { children: [
|
|
14314
14614
|
/* @__PURE__ */ jsx57(
|
|
14315
|
-
|
|
14615
|
+
Button47,
|
|
14316
14616
|
{
|
|
14317
14617
|
size: "sm",
|
|
14318
14618
|
variant: surfaceChosen(surface, { rail: "field" }) ? "secondary" : "outline",
|
|
@@ -14322,7 +14622,7 @@ function TablePage({
|
|
|
14322
14622
|
}
|
|
14323
14623
|
),
|
|
14324
14624
|
/* @__PURE__ */ jsx57(
|
|
14325
|
-
|
|
14625
|
+
Button47,
|
|
14326
14626
|
{
|
|
14327
14627
|
size: "sm",
|
|
14328
14628
|
variant: surfaceChosen(surface, { rail: "settings" }) ? "secondary" : "ghost",
|
|
@@ -14332,7 +14632,7 @@ function TablePage({
|
|
|
14332
14632
|
}
|
|
14333
14633
|
),
|
|
14334
14634
|
/* @__PURE__ */ jsx57(
|
|
14335
|
-
|
|
14635
|
+
Button47,
|
|
14336
14636
|
{
|
|
14337
14637
|
size: "sm",
|
|
14338
14638
|
variant: surfaceChosen(surface, { rail: "import" }) ? "secondary" : "ghost",
|
|
@@ -14343,7 +14643,7 @@ function TablePage({
|
|
|
14343
14643
|
)
|
|
14344
14644
|
] }) : null,
|
|
14345
14645
|
/* @__PURE__ */ jsx57(
|
|
14346
|
-
|
|
14646
|
+
Button47,
|
|
14347
14647
|
{
|
|
14348
14648
|
size: "sm",
|
|
14349
14649
|
variant: surfaceChosen(surface, { main: "dashboards" }) ? "secondary" : "ghost",
|
|
@@ -14353,7 +14653,7 @@ function TablePage({
|
|
|
14353
14653
|
}
|
|
14354
14654
|
),
|
|
14355
14655
|
/* @__PURE__ */ jsx57(
|
|
14356
|
-
|
|
14656
|
+
Button47,
|
|
14357
14657
|
{
|
|
14358
14658
|
size: "sm",
|
|
14359
14659
|
variant: surfaceChosen(surface, { rail: "forms" }) ? "secondary" : "ghost",
|
|
@@ -14363,7 +14663,7 @@ function TablePage({
|
|
|
14363
14663
|
}
|
|
14364
14664
|
),
|
|
14365
14665
|
/* @__PURE__ */ jsx57(
|
|
14366
|
-
|
|
14666
|
+
Button47,
|
|
14367
14667
|
{
|
|
14368
14668
|
size: "sm",
|
|
14369
14669
|
variant: surfaceChosen(surface, { rail: "bookings" }) ? "secondary" : "ghost",
|
|
@@ -14373,7 +14673,7 @@ function TablePage({
|
|
|
14373
14673
|
}
|
|
14374
14674
|
),
|
|
14375
14675
|
/* @__PURE__ */ jsx57(
|
|
14376
|
-
|
|
14676
|
+
Button47,
|
|
14377
14677
|
{
|
|
14378
14678
|
size: "sm",
|
|
14379
14679
|
variant: surfaceChosen(surface, { rail: "checklists" }) ? "secondary" : "ghost",
|
|
@@ -14383,7 +14683,7 @@ function TablePage({
|
|
|
14383
14683
|
}
|
|
14384
14684
|
),
|
|
14385
14685
|
/* @__PURE__ */ jsx57(
|
|
14386
|
-
|
|
14686
|
+
Button47,
|
|
14387
14687
|
{
|
|
14388
14688
|
size: "sm",
|
|
14389
14689
|
variant: surfaceChosen(surface, { rail: "notifications" }) ? "secondary" : "ghost",
|
|
@@ -14393,7 +14693,7 @@ function TablePage({
|
|
|
14393
14693
|
}
|
|
14394
14694
|
),
|
|
14395
14695
|
/* @__PURE__ */ jsx57(
|
|
14396
|
-
|
|
14696
|
+
Button47,
|
|
14397
14697
|
{
|
|
14398
14698
|
size: "sm",
|
|
14399
14699
|
variant: surfaceChosen(surface, { rail: "portals" }) ? "secondary" : "ghost",
|
|
@@ -14403,7 +14703,7 @@ function TablePage({
|
|
|
14403
14703
|
}
|
|
14404
14704
|
),
|
|
14405
14705
|
/* @__PURE__ */ jsx57(
|
|
14406
|
-
|
|
14706
|
+
Button47,
|
|
14407
14707
|
{
|
|
14408
14708
|
size: "sm",
|
|
14409
14709
|
variant: surfaceChosen(surface, { rail: "inbox" }) ? "secondary" : "ghost",
|
|
@@ -14425,11 +14725,16 @@ function TablePage({
|
|
|
14425
14725
|
/* @__PURE__ */ jsx57(ExportMenu, { tableId })
|
|
14426
14726
|
] }),
|
|
14427
14727
|
main === "dashboards" ? /* @__PURE__ */ jsx57(DashboardCanvas, { tableId, activeDashboardId: activeDashboardId ?? null }) : /* @__PURE__ */ jsxs52(Fragment27, { children: [
|
|
14728
|
+
opened.unknown ? /* @__PURE__ */ jsx57("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: unknownViewLine(opened.unknown) }) : null,
|
|
14428
14729
|
/* @__PURE__ */ jsx57(
|
|
14429
14730
|
ViewSwitcher,
|
|
14430
14731
|
{
|
|
14431
|
-
view: view ?? defaultView(tableId),
|
|
14732
|
+
view: { ...view ?? defaultView(tableId), layout: shownLayout },
|
|
14432
14733
|
pageSize,
|
|
14734
|
+
onLayoutChange: (layout) => {
|
|
14735
|
+
setLayoutFromLink(layout);
|
|
14736
|
+
onViewChanged?.(layout);
|
|
14737
|
+
},
|
|
14433
14738
|
...view ? { onViewChange: (patch) => void patchView(patch) } : {},
|
|
14434
14739
|
...rights.write ? { onNewRecordForm: () => setRail("new-record") } : {},
|
|
14435
14740
|
onOpenRecord: (recordId) => {
|
|
@@ -14546,6 +14851,7 @@ export {
|
|
|
14546
14851
|
ChecklistTemplateEditor,
|
|
14547
14852
|
ChecklistsPanel,
|
|
14548
14853
|
CommentThread,
|
|
14854
|
+
ConditionGroup,
|
|
14549
14855
|
ConditionRow,
|
|
14550
14856
|
CustomFieldsSection,
|
|
14551
14857
|
DEFAULT_FIELDS,
|
|
@@ -14604,6 +14910,8 @@ export {
|
|
|
14604
14910
|
NO_SHARE_REASON,
|
|
14605
14911
|
NO_UPLOAD_REASON,
|
|
14606
14912
|
NotifyRuleEditor,
|
|
14913
|
+
PAGE_VIEWS,
|
|
14914
|
+
PAGE_VIEW_LABEL,
|
|
14607
14915
|
PARITY_LABEL,
|
|
14608
14916
|
PARITY_MADE_OF,
|
|
14609
14917
|
Peek,
|
|
@@ -14627,6 +14935,7 @@ export {
|
|
|
14627
14935
|
RefusalNotice,
|
|
14628
14936
|
RelationPicker,
|
|
14629
14937
|
SAVED_VIEWS_UNAVAILABLE,
|
|
14938
|
+
SAY_WHAT_YOU_ARE_WAITING_FOR_AFTER_MS,
|
|
14630
14939
|
SERIES_COLORS,
|
|
14631
14940
|
SOMEBODY,
|
|
14632
14941
|
STORE_ANSWERS_THESE,
|
|
@@ -14660,6 +14969,7 @@ export {
|
|
|
14660
14969
|
colorFromTheValue,
|
|
14661
14970
|
columnForField,
|
|
14662
14971
|
conditionInWords,
|
|
14972
|
+
conditionIsDrawable,
|
|
14663
14973
|
conditionIsSimple,
|
|
14664
14974
|
conditionValue,
|
|
14665
14975
|
controlFor,
|
|
@@ -14696,6 +15006,9 @@ export {
|
|
|
14696
15006
|
machineIdentityIn,
|
|
14697
15007
|
memberName,
|
|
14698
15008
|
nextInWords,
|
|
15009
|
+
openingRail,
|
|
15010
|
+
openingView,
|
|
15011
|
+
pageViewFromParam,
|
|
14699
15012
|
parityTypesWithNoExplanation,
|
|
14700
15013
|
parseGridPresentation,
|
|
14701
15014
|
personActor,
|
|
@@ -14721,10 +15034,12 @@ export {
|
|
|
14721
15034
|
tableName,
|
|
14722
15035
|
tableRightsAt,
|
|
14723
15036
|
tokenFor,
|
|
15037
|
+
unknownViewLine,
|
|
14724
15038
|
useCanShare,
|
|
14725
15039
|
useEmbedHandshake,
|
|
14726
15040
|
useEnrichCells,
|
|
14727
15041
|
useGridEditing,
|
|
15042
|
+
useLabelWait,
|
|
14728
15043
|
useMeasuredWidth,
|
|
14729
15044
|
useMyChecklistSteps,
|
|
14730
15045
|
useRecordLabels,
|