@ai-matrx/records-ui 0.93.4 → 0.93.6
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 +18 -0
- package/dist/index.cjs +95 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +68 -2
- package/dist/index.d.ts +68 -2
- package/dist/index.js +496 -404
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13118,13 +13118,24 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
|
|
|
13118
13118
|
}
|
|
13119
13119
|
|
|
13120
13120
|
// src/CustomFieldsSection.tsx
|
|
13121
|
-
import { useMemo as useMemo24, useState as useState34 } from "react";
|
|
13121
|
+
import { useEffect as useEffect27, useMemo as useMemo24, useRef as useRef15, useState as useState34 } from "react";
|
|
13122
13122
|
import {
|
|
13123
13123
|
useEntityFieldMutation,
|
|
13124
13124
|
useEntityFieldRights,
|
|
13125
|
-
useEntityRecord
|
|
13125
|
+
useEntityRecord,
|
|
13126
|
+
useRecordsClient as useRecordsClient22
|
|
13126
13127
|
} from "@ai-matrx/records/react";
|
|
13127
|
-
import {
|
|
13128
|
+
import {
|
|
13129
|
+
BasicInput as BasicInput10,
|
|
13130
|
+
Button as Button30,
|
|
13131
|
+
Select as Select5,
|
|
13132
|
+
SelectContent as SelectContent5,
|
|
13133
|
+
SelectItem as SelectItem5,
|
|
13134
|
+
SelectTrigger as SelectTrigger5,
|
|
13135
|
+
SelectValue as SelectValue5,
|
|
13136
|
+
Separator as Separator4,
|
|
13137
|
+
cn as cn23
|
|
13138
|
+
} from "@ai-matrx/design-system";
|
|
13128
13139
|
import { jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
13129
13140
|
var ADDABLE_TYPE_IDS = [
|
|
13130
13141
|
"text",
|
|
@@ -13143,6 +13154,32 @@ var ADDABLE_TYPES = ADDABLE_TYPE_IDS.map((value) => ({
|
|
|
13143
13154
|
value,
|
|
13144
13155
|
label: fieldTypeChoice(value)?.label ?? value
|
|
13145
13156
|
}));
|
|
13157
|
+
var ADDABLE_TYPE_SET = new Set(ADDABLE_TYPE_IDS);
|
|
13158
|
+
function customFieldRequestProblems(requests, existingLabels) {
|
|
13159
|
+
const problems = [];
|
|
13160
|
+
const taken = new Set(existingLabels.map((l) => l.trim().toLowerCase()));
|
|
13161
|
+
const asked = /* @__PURE__ */ new Set();
|
|
13162
|
+
if (requests.length === 0) problems.push("Name at least one field to add.");
|
|
13163
|
+
requests.forEach((request, index) => {
|
|
13164
|
+
const at = requests.length > 1 ? `Field ${index + 1}: ` : "";
|
|
13165
|
+
const label = typeof request?.label === "string" ? request.label.trim() : "";
|
|
13166
|
+
if (!label) {
|
|
13167
|
+
problems.push(`${at}a field needs a name.`);
|
|
13168
|
+
return;
|
|
13169
|
+
}
|
|
13170
|
+
const type = request.type ?? "text";
|
|
13171
|
+
if (!ADDABLE_TYPE_SET.has(type)) {
|
|
13172
|
+
problems.push(
|
|
13173
|
+
`${at}"${label}" cannot hold "${String(type)}". Choose one of: ${ADDABLE_TYPE_IDS.join(", ")}.`
|
|
13174
|
+
);
|
|
13175
|
+
}
|
|
13176
|
+
const key = label.toLowerCase();
|
|
13177
|
+
if (taken.has(key)) problems.push(`${at}there is already a field named "${label}".`);
|
|
13178
|
+
else if (asked.has(key)) problems.push(`${at}"${label}" is asked for twice.`);
|
|
13179
|
+
asked.add(key);
|
|
13180
|
+
});
|
|
13181
|
+
return problems;
|
|
13182
|
+
}
|
|
13146
13183
|
function asField(f) {
|
|
13147
13184
|
return {
|
|
13148
13185
|
id: f.id,
|
|
@@ -13163,8 +13200,10 @@ function CustomFieldsSection({
|
|
|
13163
13200
|
entityToken,
|
|
13164
13201
|
recordId,
|
|
13165
13202
|
title = "Custom fields",
|
|
13166
|
-
className
|
|
13203
|
+
className,
|
|
13204
|
+
agentDoor
|
|
13167
13205
|
}) {
|
|
13206
|
+
const client = useRecordsClient22();
|
|
13168
13207
|
const read = useEntityRecord(entityToken, recordId);
|
|
13169
13208
|
const rights = useEntityFieldRights(entityToken);
|
|
13170
13209
|
const mutation = useEntityFieldMutation();
|
|
@@ -13175,14 +13214,70 @@ function CustomFieldsSection({
|
|
|
13175
13214
|
const [draft, setDraft] = useState34({});
|
|
13176
13215
|
const fields = useMemo24(() => read.data?.fields ?? [], [read.data]);
|
|
13177
13216
|
const mayAdd = rights.data?.may_declare === true;
|
|
13217
|
+
const live = useRef15({ fields, rights: rights.data, loading: rights.loading, reload: read.reload });
|
|
13218
|
+
useEffect27(() => {
|
|
13219
|
+
live.current = { fields, rights: rights.data, loading: rights.loading, reload: read.reload };
|
|
13220
|
+
});
|
|
13221
|
+
useEffect27(() => {
|
|
13222
|
+
if (!agentDoor) return;
|
|
13223
|
+
const state = () => {
|
|
13224
|
+
const now = live.current;
|
|
13225
|
+
return {
|
|
13226
|
+
entityToken,
|
|
13227
|
+
recordId,
|
|
13228
|
+
entityLabel: now.rights?.label ?? null,
|
|
13229
|
+
mayAdd: now.rights ? now.rights.may_declare === true : now.loading ? null : false,
|
|
13230
|
+
refusal: now.rights && !now.rights.may_declare ? now.rights.reason ?? null : null,
|
|
13231
|
+
fields: now.fields.map((f) => ({ key: f.key, label: f.label, type: f.type })),
|
|
13232
|
+
types: ADDABLE_TYPES
|
|
13233
|
+
};
|
|
13234
|
+
};
|
|
13235
|
+
const check = (requests) => {
|
|
13236
|
+
const now = state();
|
|
13237
|
+
if (now.mayAdd === false) {
|
|
13238
|
+
return [now.refusal ?? "This person may not add a field here."];
|
|
13239
|
+
}
|
|
13240
|
+
if (now.mayAdd === null) return ["The section is still reading who may add a field. Try again in a moment."];
|
|
13241
|
+
return customFieldRequestProblems(requests, now.fields.map((f) => f.label));
|
|
13242
|
+
};
|
|
13243
|
+
const addField = async (request) => {
|
|
13244
|
+
const problems = check([request]);
|
|
13245
|
+
if (problems.length > 0) return { ok: false, message: problems.join(" ") };
|
|
13246
|
+
const label = request.label.trim();
|
|
13247
|
+
const type = request.type ?? "text";
|
|
13248
|
+
const declared2 = await client.entityFieldDeclare({ token: entityToken, spec: { label, type } });
|
|
13249
|
+
if (!declared2.ok) {
|
|
13250
|
+
const hint = hintForAPerson(declared2.error.hint);
|
|
13251
|
+
return { ok: false, message: hint ? `${declared2.error.message} ${hint}` : declared2.error.message };
|
|
13252
|
+
}
|
|
13253
|
+
const back = await client.entityRecordRead({ token: entityToken, record_id: recordId });
|
|
13254
|
+
live.current.reload();
|
|
13255
|
+
if (!back.ok || !(back.data?.fields ?? []).some((f) => f.id === declared2.data)) {
|
|
13256
|
+
return {
|
|
13257
|
+
ok: false,
|
|
13258
|
+
message: `The store took "${label}" but this record does not show it yet. Nothing was lost \u2014 read the page again before adding it a second time.`
|
|
13259
|
+
};
|
|
13260
|
+
}
|
|
13261
|
+
return { ok: true, field_id: declared2.data, label, type };
|
|
13262
|
+
};
|
|
13263
|
+
return agentDoor({ entityToken, recordId, state, check, addField });
|
|
13264
|
+
}, [agentDoor, client, entityToken, recordId]);
|
|
13178
13265
|
if (!read.loading && !read.error && fields.length === 0 && !mayAdd) return null;
|
|
13179
13266
|
if (read.error) return /* @__PURE__ */ jsx45(RefusalLine, { error: read.error, className });
|
|
13180
13267
|
const values = read.data?.custom ?? {};
|
|
13181
13268
|
const written = read.data?.custom_written ?? {};
|
|
13269
|
+
const empty = fields.length === 0;
|
|
13270
|
+
if (empty && !adding) {
|
|
13271
|
+
return /* @__PURE__ */ jsxs39("section", { className: cn23("flex min-w-0 items-center gap-2 text-xs", className), children: [
|
|
13272
|
+
/* @__PURE__ */ jsx45("h3", { className: "text-sm font-medium", children: title }),
|
|
13273
|
+
!read.loading ? /* @__PURE__ */ jsx45("span", { className: "text-muted-foreground", children: "None yet" }) : null,
|
|
13274
|
+
mayAdd ? /* @__PURE__ */ jsx45(Button30, { size: "sm", variant: "ghost", className: "ml-auto", onClick: () => setAdding(true), children: "Add field" }) : null
|
|
13275
|
+
] });
|
|
13276
|
+
}
|
|
13182
13277
|
return /* @__PURE__ */ jsxs39("section", { className: cn23("flex min-w-0 flex-col gap-2 text-xs", className), children: [
|
|
13183
13278
|
/* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-2", children: [
|
|
13184
13279
|
/* @__PURE__ */ jsx45("h3", { className: "text-sm font-medium", children: title }),
|
|
13185
|
-
/* @__PURE__ */ jsx45("span", { className: "text-muted-foreground", children: fields.length }),
|
|
13280
|
+
!empty ? /* @__PURE__ */ jsx45("span", { className: "text-muted-foreground", children: fields.length }) : null,
|
|
13186
13281
|
fields.length > 0 ? /* @__PURE__ */ jsx45(
|
|
13187
13282
|
Button30,
|
|
13188
13283
|
{
|
|
@@ -13251,9 +13346,9 @@ function CustomFieldsSection({
|
|
|
13251
13346
|
/* @__PURE__ */ jsxs39("label", { className: "flex flex-col gap-1", children: [
|
|
13252
13347
|
/* @__PURE__ */ jsx45("span", { className: "text-muted-foreground", children: "Name" }),
|
|
13253
13348
|
/* @__PURE__ */ jsx45(
|
|
13254
|
-
|
|
13349
|
+
BasicInput10,
|
|
13255
13350
|
{
|
|
13256
|
-
className: "h-8
|
|
13351
|
+
className: "h-8",
|
|
13257
13352
|
value: newLabel,
|
|
13258
13353
|
onChange: (e) => setNewLabel(e.target.value),
|
|
13259
13354
|
placeholder: "Account tier",
|
|
@@ -13261,17 +13356,12 @@ function CustomFieldsSection({
|
|
|
13261
13356
|
}
|
|
13262
13357
|
)
|
|
13263
13358
|
] }),
|
|
13264
|
-
/* @__PURE__ */ jsxs39("
|
|
13359
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1", children: [
|
|
13265
13360
|
/* @__PURE__ */ jsx45("span", { className: "text-muted-foreground", children: "Holds" }),
|
|
13266
|
-
/* @__PURE__ */
|
|
13267
|
-
"
|
|
13268
|
-
{
|
|
13269
|
-
|
|
13270
|
-
value: newType,
|
|
13271
|
-
onChange: (e) => setNewType(e.target.value),
|
|
13272
|
-
children: ADDABLE_TYPES.map((t) => /* @__PURE__ */ jsx45("option", { value: t.value, children: t.label }, t.value))
|
|
13273
|
-
}
|
|
13274
|
-
)
|
|
13361
|
+
/* @__PURE__ */ jsxs39(Select5, { value: newType, onValueChange: setNewType, children: [
|
|
13362
|
+
/* @__PURE__ */ jsx45(SelectTrigger5, { size: "sm", "aria-label": "What this field holds", children: /* @__PURE__ */ jsx45(SelectValue5, {}) }),
|
|
13363
|
+
/* @__PURE__ */ jsx45(SelectContent5, { children: ADDABLE_TYPES.map((t) => /* @__PURE__ */ jsx45(SelectItem5, { value: t.value, children: t.label }, t.value)) })
|
|
13364
|
+
] })
|
|
13275
13365
|
] }),
|
|
13276
13366
|
/* @__PURE__ */ jsx45(Button30, { size: "sm", type: "submit", disabled: mutation.saving || newLabel.trim() === "", children: mutation.saving ? "Adding\u2026" : "Add" })
|
|
13277
13367
|
]
|
|
@@ -13303,13 +13393,13 @@ function CustomFieldsSection({
|
|
|
13303
13393
|
}
|
|
13304
13394
|
|
|
13305
13395
|
// src/StageRules.tsx
|
|
13306
|
-
import { useCallback as useCallback18, useEffect as
|
|
13307
|
-
import { useFields as useFields7, useRecordsClient as
|
|
13308
|
-
import { BasicInput as
|
|
13396
|
+
import { useCallback as useCallback18, useEffect as useEffect28, useMemo as useMemo25, useState as useState36 } from "react";
|
|
13397
|
+
import { useFields as useFields7, useRecordsClient as useRecordsClient23, useTable as useTable5 } from "@ai-matrx/records/react";
|
|
13398
|
+
import { BasicInput as BasicInput12, BasicTextarea as BasicTextarea7, Button as Button32, Separator as Separator5, Skeleton as Skeleton3, cn as cn24 } from "@ai-matrx/design-system";
|
|
13309
13399
|
|
|
13310
13400
|
// src/Condition.tsx
|
|
13311
13401
|
import { useState as useState35 } from "react";
|
|
13312
|
-
import { BasicInput as
|
|
13402
|
+
import { BasicInput as BasicInput11, Button as Button31 } from "@ai-matrx/design-system";
|
|
13313
13403
|
import { Fragment as Fragment17, jsx as jsx46, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
13314
13404
|
var CONDITION_OPS = [
|
|
13315
13405
|
{ op: "eq", label: "is" },
|
|
@@ -13451,7 +13541,7 @@ function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", cla
|
|
|
13451
13541
|
}
|
|
13452
13542
|
)
|
|
13453
13543
|
) : /* @__PURE__ */ jsx46(
|
|
13454
|
-
|
|
13544
|
+
BasicInput11,
|
|
13455
13545
|
{
|
|
13456
13546
|
className: "h-8 w-28 text-xs",
|
|
13457
13547
|
"aria-label": "Condition value",
|
|
@@ -13682,7 +13772,7 @@ function draftOf(rule) {
|
|
|
13682
13772
|
};
|
|
13683
13773
|
}
|
|
13684
13774
|
function StageRulesSection({ tableId, stage, className }) {
|
|
13685
|
-
const client =
|
|
13775
|
+
const client = useRecordsClient23();
|
|
13686
13776
|
const table = useTable5(tableId);
|
|
13687
13777
|
const rights = useTableRights(table.data);
|
|
13688
13778
|
const fields = useFields7(tableId);
|
|
@@ -13702,7 +13792,7 @@ function StageRulesSection({ tableId, stage, className }) {
|
|
|
13702
13792
|
if (mode.ok) setEnforcement(mode.data);
|
|
13703
13793
|
setAsked(true);
|
|
13704
13794
|
}, [client, tableId]);
|
|
13705
|
-
|
|
13795
|
+
useEffect28(() => {
|
|
13706
13796
|
void load();
|
|
13707
13797
|
}, [load]);
|
|
13708
13798
|
const stages = pipeline?.stages ?? [];
|
|
@@ -13713,7 +13803,7 @@ function StageRulesSection({ tableId, stage, className }) {
|
|
|
13713
13803
|
() => (fields.data ?? []).map((f) => ({ id: String(f.id), key: f.key, label: fieldName(f), field: f })),
|
|
13714
13804
|
[fields.data]
|
|
13715
13805
|
);
|
|
13716
|
-
|
|
13806
|
+
useEffect28(() => {
|
|
13717
13807
|
if (!draft || !stageKey || !draft.demands || Object.keys(draft.demands).length === 0) {
|
|
13718
13808
|
setPreview(null);
|
|
13719
13809
|
setPreviewError(null);
|
|
@@ -13825,7 +13915,7 @@ function StageRulesSection({ tableId, stage, className }) {
|
|
|
13825
13915
|
"\u201D. Writing a condition below replaces it."
|
|
13826
13916
|
] }) : null,
|
|
13827
13917
|
/* @__PURE__ */ jsx47(
|
|
13828
|
-
|
|
13918
|
+
BasicInput12,
|
|
13829
13919
|
{
|
|
13830
13920
|
className: "h-8 text-xs",
|
|
13831
13921
|
"aria-label": "Rule name",
|
|
@@ -13945,26 +14035,26 @@ import {
|
|
|
13945
14035
|
import { Badge as Badge10, Button as Button34, Separator as Separator6, cn as cn27 } from "@ai-matrx/design-system";
|
|
13946
14036
|
|
|
13947
14037
|
// src/RowActionsEditor.tsx
|
|
13948
|
-
import { useCallback as useCallback19, useEffect as
|
|
13949
|
-
import { useFields as useFields8, useRecords as useRecords5, useRecordsClient as
|
|
14038
|
+
import { useCallback as useCallback19, useEffect as useEffect30, useMemo as useMemo26, useState as useState38 } from "react";
|
|
14039
|
+
import { useFields as useFields8, useRecords as useRecords5, useRecordsClient as useRecordsClient25 } from "@ai-matrx/records/react";
|
|
13950
14040
|
import {
|
|
13951
14041
|
Badge as Badge9,
|
|
13952
|
-
BasicInput as
|
|
14042
|
+
BasicInput as BasicInput13,
|
|
13953
14043
|
BasicTextarea as BasicTextarea8,
|
|
13954
14044
|
Button as Button33,
|
|
13955
14045
|
Checkbox as Checkbox6,
|
|
13956
14046
|
Label as Label11,
|
|
13957
|
-
Select as
|
|
13958
|
-
SelectContent as
|
|
13959
|
-
SelectItem as
|
|
13960
|
-
SelectTrigger as
|
|
13961
|
-
SelectValue as
|
|
14047
|
+
Select as Select6,
|
|
14048
|
+
SelectContent as SelectContent6,
|
|
14049
|
+
SelectItem as SelectItem6,
|
|
14050
|
+
SelectTrigger as SelectTrigger6,
|
|
14051
|
+
SelectValue as SelectValue6,
|
|
13962
14052
|
cn as cn26
|
|
13963
14053
|
} from "@ai-matrx/design-system";
|
|
13964
14054
|
|
|
13965
14055
|
// src/rowActionPreview.tsx
|
|
13966
|
-
import { useEffect as
|
|
13967
|
-
import { useRecordsClient as
|
|
14056
|
+
import { useEffect as useEffect29, useState as useState37 } from "react";
|
|
14057
|
+
import { useRecordsClient as useRecordsClient24 } from "@ai-matrx/records/react";
|
|
13968
14058
|
import { cn as cn25 } from "@ai-matrx/design-system";
|
|
13969
14059
|
import { jsx as jsx48, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
13970
14060
|
function isComputed(field2) {
|
|
@@ -14015,10 +14105,10 @@ var RESULT_WORDS = {
|
|
|
14015
14105
|
unknown: "a value"
|
|
14016
14106
|
};
|
|
14017
14107
|
function useFormulaReadings(tableId, formulas) {
|
|
14018
|
-
const client =
|
|
14108
|
+
const client = useRecordsClient24();
|
|
14019
14109
|
const [readings, setReadings] = useState37({});
|
|
14020
14110
|
const key = formulas.join("\0");
|
|
14021
|
-
|
|
14111
|
+
useEffect29(() => {
|
|
14022
14112
|
if (!tableId) return;
|
|
14023
14113
|
let live = true;
|
|
14024
14114
|
for (const text of formulas) {
|
|
@@ -14174,7 +14264,7 @@ function describe(action, fields) {
|
|
|
14174
14264
|
return says.charAt(0).toUpperCase() + says.slice(1) + ".";
|
|
14175
14265
|
}
|
|
14176
14266
|
function RowActionsSection({ tableId, className }) {
|
|
14177
|
-
const client =
|
|
14267
|
+
const client = useRecordsClient25();
|
|
14178
14268
|
const fields = useFields8(tableId);
|
|
14179
14269
|
const records = useRecords5(tableId, { pageSize: 20 });
|
|
14180
14270
|
const [actions, setActions] = useState38([]);
|
|
@@ -14198,10 +14288,10 @@ function RowActionsSection({ tableId, className }) {
|
|
|
14198
14288
|
setActions(answered.data?.actions ?? []);
|
|
14199
14289
|
setStale((answered.data?.stale ?? []).length);
|
|
14200
14290
|
}, [client, tableId]);
|
|
14201
|
-
|
|
14291
|
+
useEffect30(() => {
|
|
14202
14292
|
void reload();
|
|
14203
14293
|
}, [reload]);
|
|
14204
|
-
|
|
14294
|
+
useEffect30(() => {
|
|
14205
14295
|
let live = true;
|
|
14206
14296
|
void client.tableDecorations({ table_id: tableId }).then((answered) => {
|
|
14207
14297
|
if (live && answered.ok) setColors(answered.data?.colors ?? []);
|
|
@@ -14406,7 +14496,7 @@ function ActionForm({
|
|
|
14406
14496
|
/* @__PURE__ */ jsxs43("label", { className: "flex flex-col gap-1", children: [
|
|
14407
14497
|
/* @__PURE__ */ jsx49(Label11, { className: "text-xs", children: "Name" }),
|
|
14408
14498
|
/* @__PURE__ */ jsx49(
|
|
14409
|
-
|
|
14499
|
+
BasicInput13,
|
|
14410
14500
|
{
|
|
14411
14501
|
value: draft.name,
|
|
14412
14502
|
autoFocus: true,
|
|
@@ -14460,7 +14550,7 @@ function ActionForm({
|
|
|
14460
14550
|
rows.length > 0 ? /* @__PURE__ */ jsxs43("div", { className: "ml-auto flex items-center gap-1", children: [
|
|
14461
14551
|
/* @__PURE__ */ jsx49("span", { className: "text-muted-foreground", children: "Start from a record" }),
|
|
14462
14552
|
/* @__PURE__ */ jsxs43(
|
|
14463
|
-
|
|
14553
|
+
Select6,
|
|
14464
14554
|
{
|
|
14465
14555
|
value: "",
|
|
14466
14556
|
onValueChange: (id) => {
|
|
@@ -14478,8 +14568,8 @@ function ActionForm({
|
|
|
14478
14568
|
setPreviewId(row.id);
|
|
14479
14569
|
},
|
|
14480
14570
|
children: [
|
|
14481
|
-
/* @__PURE__ */ jsx49(
|
|
14482
|
-
/* @__PURE__ */ jsx49(
|
|
14571
|
+
/* @__PURE__ */ jsx49(SelectTrigger6, { size: "sm", "aria-label": "Start from a record", children: /* @__PURE__ */ jsx49(SelectValue6, { placeholder: "Pick one" }) }),
|
|
14572
|
+
/* @__PURE__ */ jsx49(SelectContent6, { children: rows.map((row) => /* @__PURE__ */ jsx49(SelectItem6, { value: row.id, children: rowName2(row) }, row.id)) })
|
|
14483
14573
|
]
|
|
14484
14574
|
}
|
|
14485
14575
|
)
|
|
@@ -14487,20 +14577,20 @@ function ActionForm({
|
|
|
14487
14577
|
] }),
|
|
14488
14578
|
draft.steps.length === 0 ? /* @__PURE__ */ jsx49("p", { className: "text-muted-foreground", children: "Nothing yet. Add a change, or start from a record and remove the columns it should leave alone." }) : null,
|
|
14489
14579
|
draft.steps.map((step2, index) => /* @__PURE__ */ jsxs43("div", { className: "flex flex-wrap items-center gap-1", "data-records-action-step": index, children: [
|
|
14490
|
-
/* @__PURE__ */ jsxs43(
|
|
14491
|
-
/* @__PURE__ */ jsx49(
|
|
14492
|
-
/* @__PURE__ */ jsx49(
|
|
14580
|
+
/* @__PURE__ */ jsxs43(Select6, { value: step2.field, onValueChange: (v) => setStep(index, { field: v }), children: [
|
|
14581
|
+
/* @__PURE__ */ jsx49(SelectTrigger6, { size: "sm", "aria-label": `Column for change ${index + 1}`, children: /* @__PURE__ */ jsx49(SelectValue6, { placeholder: "Column" }) }),
|
|
14582
|
+
/* @__PURE__ */ jsx49(SelectContent6, { children: settable.map((f) => /* @__PURE__ */ jsx49(SelectItem6, { value: f.id, children: fieldName(f) }, f.id)) })
|
|
14493
14583
|
] }),
|
|
14494
|
-
/* @__PURE__ */ jsxs43(
|
|
14495
|
-
/* @__PURE__ */ jsx49(
|
|
14496
|
-
/* @__PURE__ */ jsxs43(
|
|
14497
|
-
/* @__PURE__ */ jsx49(
|
|
14498
|
-
/* @__PURE__ */ jsx49(
|
|
14499
|
-
/* @__PURE__ */ jsx49(
|
|
14584
|
+
/* @__PURE__ */ jsxs43(Select6, { value: step2.set, onValueChange: (v) => setStep(index, { set: v }), children: [
|
|
14585
|
+
/* @__PURE__ */ jsx49(SelectTrigger6, { size: "sm", "aria-label": `How change ${index + 1} sets it`, children: /* @__PURE__ */ jsx49(SelectValue6, {}) }),
|
|
14586
|
+
/* @__PURE__ */ jsxs43(SelectContent6, { children: [
|
|
14587
|
+
/* @__PURE__ */ jsx49(SelectItem6, { value: "value", children: "Set to" }),
|
|
14588
|
+
/* @__PURE__ */ jsx49(SelectItem6, { value: "clear", children: "Clear" }),
|
|
14589
|
+
/* @__PURE__ */ jsx49(SelectItem6, { value: "compute", children: "Work out" })
|
|
14500
14590
|
] })
|
|
14501
14591
|
] }),
|
|
14502
14592
|
step2.set === "value" ? /* @__PURE__ */ jsx49(
|
|
14503
|
-
|
|
14593
|
+
BasicInput13,
|
|
14504
14594
|
{
|
|
14505
14595
|
className: "h-7 w-40",
|
|
14506
14596
|
value: step2.value,
|
|
@@ -14508,7 +14598,7 @@ function ActionForm({
|
|
|
14508
14598
|
onChange: (e) => setStep(index, { value: e.target.value })
|
|
14509
14599
|
}
|
|
14510
14600
|
) : step2.set === "compute" ? /* @__PURE__ */ jsx49(
|
|
14511
|
-
|
|
14601
|
+
BasicInput13,
|
|
14512
14602
|
{
|
|
14513
14603
|
className: "h-7 w-56",
|
|
14514
14604
|
value: step2.formula,
|
|
@@ -14541,9 +14631,9 @@ function ActionForm({
|
|
|
14541
14631
|
/* @__PURE__ */ jsxs43("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
14542
14632
|
/* @__PURE__ */ jsx49("span", { className: "font-medium", children: "Before and after" }),
|
|
14543
14633
|
/* @__PURE__ */ jsx49("span", { className: "text-muted-foreground", children: "on" }),
|
|
14544
|
-
/* @__PURE__ */ jsxs43(
|
|
14545
|
-
/* @__PURE__ */ jsx49(
|
|
14546
|
-
/* @__PURE__ */ jsx49(
|
|
14634
|
+
/* @__PURE__ */ jsxs43(Select6, { value: previewRow.id, onValueChange: (v) => setPreviewId(v), children: [
|
|
14635
|
+
/* @__PURE__ */ jsx49(SelectTrigger6, { size: "sm", "aria-label": "Record to preview on", children: /* @__PURE__ */ jsx49(SelectValue6, {}) }),
|
|
14636
|
+
/* @__PURE__ */ jsx49(SelectContent6, { children: rows.map((row) => /* @__PURE__ */ jsx49(SelectItem6, { value: row.id, children: rowName2(row) }, row.id)) })
|
|
14547
14637
|
] })
|
|
14548
14638
|
] }),
|
|
14549
14639
|
/* @__PURE__ */ jsx49(
|
|
@@ -14578,15 +14668,15 @@ function ActionForm({
|
|
|
14578
14668
|
colors.length > 0 ? /* @__PURE__ */ jsxs43("div", { className: "flex items-center gap-1", children: [
|
|
14579
14669
|
/* @__PURE__ */ jsx49("span", { className: "text-muted-foreground", children: "Color" }),
|
|
14580
14670
|
/* @__PURE__ */ jsxs43(
|
|
14581
|
-
|
|
14671
|
+
Select6,
|
|
14582
14672
|
{
|
|
14583
14673
|
value: draft.color || NO_COLOR,
|
|
14584
14674
|
onValueChange: (v) => setDraft((d) => ({ ...d, color: v === NO_COLOR ? "" : v })),
|
|
14585
14675
|
children: [
|
|
14586
|
-
/* @__PURE__ */ jsx49(
|
|
14587
|
-
/* @__PURE__ */ jsxs43(
|
|
14588
|
-
/* @__PURE__ */ jsx49(
|
|
14589
|
-
colors.map((c) => /* @__PURE__ */ jsx49(
|
|
14676
|
+
/* @__PURE__ */ jsx49(SelectTrigger6, { size: "sm", "aria-label": "Button color", children: /* @__PURE__ */ jsx49(SelectValue6, {}) }),
|
|
14677
|
+
/* @__PURE__ */ jsxs43(SelectContent6, { children: [
|
|
14678
|
+
/* @__PURE__ */ jsx49(SelectItem6, { value: NO_COLOR, children: "None" }),
|
|
14679
|
+
colors.map((c) => /* @__PURE__ */ jsx49(SelectItem6, { value: c, children: c.charAt(0).toUpperCase() + c.slice(1) }, c))
|
|
14590
14680
|
] })
|
|
14591
14681
|
]
|
|
14592
14682
|
}
|
|
@@ -14819,21 +14909,21 @@ function TableSettings({
|
|
|
14819
14909
|
|
|
14820
14910
|
// src/Peek.tsx
|
|
14821
14911
|
import { useState as useState44 } from "react";
|
|
14822
|
-
import { useFields as useFields11, useRecord as useRecord2, useRecordsClient as
|
|
14912
|
+
import { useFields as useFields11, useRecord as useRecord2, useRecordsClient as useRecordsClient29, useTable as useTable7 } from "@ai-matrx/records/react";
|
|
14823
14913
|
import { AlchemyMenu as AlchemyMenu2 } from "@ai-matrx/alchemy/react";
|
|
14824
14914
|
|
|
14825
14915
|
// src/RecordChat.tsx
|
|
14826
|
-
import { useEffect as
|
|
14827
|
-
import { useRecordsClient as
|
|
14916
|
+
import { useEffect as useEffect31, useMemo as useMemo27, useState as useState40 } from "react";
|
|
14917
|
+
import { useRecordsClient as useRecordsClient26 } from "@ai-matrx/records/react";
|
|
14828
14918
|
import { Skeleton as Skeleton4, cn as cn28 } from "@ai-matrx/design-system";
|
|
14829
14919
|
import { jsx as jsx51, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
14830
14920
|
var NO_CHAT_REASON = "Chatting about this record is not switched on here yet, so this panel is empty rather than showing a box that goes nowhere. It is on our list, not yours.";
|
|
14831
14921
|
function RecordChat({ tableId, recordId, className }) {
|
|
14832
|
-
const client =
|
|
14922
|
+
const client = useRecordsClient26();
|
|
14833
14923
|
const host = useRecordsUi();
|
|
14834
14924
|
const [scope, setScope] = useState40(null);
|
|
14835
14925
|
const [error, setError] = useState40(null);
|
|
14836
|
-
|
|
14926
|
+
useEffect31(() => {
|
|
14837
14927
|
let cancelled = false;
|
|
14838
14928
|
setScope(null);
|
|
14839
14929
|
setError(null);
|
|
@@ -14950,12 +15040,12 @@ function entriesFor(scope) {
|
|
|
14950
15040
|
import { Button as Button37, Separator as Separator8, Skeleton as Skeleton5, cn as cn30 } from "@ai-matrx/design-system";
|
|
14951
15041
|
|
|
14952
15042
|
// src/RecordForm.tsx
|
|
14953
|
-
import { useEffect as
|
|
15043
|
+
import { useEffect as useEffect33, useMemo as useMemo29, useRef as useRef16, useState as useState42 } from "react";
|
|
14954
15044
|
import {
|
|
14955
15045
|
useFields as useFields10,
|
|
14956
15046
|
useRecord,
|
|
14957
15047
|
useRecordMutation,
|
|
14958
|
-
useRecordsClient as
|
|
15048
|
+
useRecordsClient as useRecordsClient28
|
|
14959
15049
|
} from "@ai-matrx/records/react";
|
|
14960
15050
|
import { asWriteConflict as asWriteConflict3, predictWriteRefusals, wholeValueOf as wholeValueOf5 } from "@ai-matrx/records/core";
|
|
14961
15051
|
|
|
@@ -14993,8 +15083,8 @@ async function updateOnTheWinningVersion(client, recordId, patch, expectedVersio
|
|
|
14993
15083
|
import { Button as Button35, Separator as Separator7, cn as cn29 } from "@ai-matrx/design-system";
|
|
14994
15084
|
|
|
14995
15085
|
// src/systemTable.ts
|
|
14996
|
-
import { useEffect as
|
|
14997
|
-
import { useRecordsClient as
|
|
15086
|
+
import { useEffect as useEffect32, useMemo as useMemo28, useState as useState41 } from "react";
|
|
15087
|
+
import { useRecordsClient as useRecordsClient27 } from "@ai-matrx/records/react";
|
|
14998
15088
|
var inFlight = /* @__PURE__ */ new Map();
|
|
14999
15089
|
async function ensureSystemTable(client, spec) {
|
|
15000
15090
|
const cacheKey = `${client.config.organizationId}:${spec.slug}`;
|
|
@@ -15122,11 +15212,11 @@ async function declare(client, spec) {
|
|
|
15122
15212
|
return { ok: true, data: table.data };
|
|
15123
15213
|
}
|
|
15124
15214
|
function useSystemTable(spec) {
|
|
15125
|
-
const client =
|
|
15215
|
+
const client = useRecordsClient27();
|
|
15126
15216
|
const [state, setState] = useState41({ tableId: null, loading: true, error: null });
|
|
15127
15217
|
const slug = spec.slug;
|
|
15128
15218
|
const stable = useMemo28(() => spec, [slug]);
|
|
15129
|
-
|
|
15219
|
+
useEffect32(() => {
|
|
15130
15220
|
let cancelled = false;
|
|
15131
15221
|
setState({ tableId: null, loading: true, error: null });
|
|
15132
15222
|
void ensureSystemTable(client, stable).then((result) => {
|
|
@@ -15142,9 +15232,9 @@ function useSystemTable(spec) {
|
|
|
15142
15232
|
return state;
|
|
15143
15233
|
}
|
|
15144
15234
|
function useRecordVersion(recordId) {
|
|
15145
|
-
const client =
|
|
15235
|
+
const client = useRecordsClient27();
|
|
15146
15236
|
const [version, setVersion] = useState41(null);
|
|
15147
|
-
|
|
15237
|
+
useEffect32(() => {
|
|
15148
15238
|
let cancelled = false;
|
|
15149
15239
|
setVersion(null);
|
|
15150
15240
|
if (!recordId) return;
|
|
@@ -15177,7 +15267,7 @@ function RecordForm({
|
|
|
15177
15267
|
const fields = useFields10(tableId, recordType);
|
|
15178
15268
|
const existing = useRecord(recordId ?? null);
|
|
15179
15269
|
const mutation = useRecordMutation();
|
|
15180
|
-
const client =
|
|
15270
|
+
const client = useRecordsClient28();
|
|
15181
15271
|
const [edit, setEdit] = useState42({
|
|
15182
15272
|
saving: false,
|
|
15183
15273
|
error: null,
|
|
@@ -15198,9 +15288,9 @@ function RecordForm({
|
|
|
15198
15288
|
const [answered, setAnswered] = useState42(null);
|
|
15199
15289
|
const loaded = useRecordVersion(recordId ?? null);
|
|
15200
15290
|
const loadedVersion = loaded.version;
|
|
15201
|
-
const changedRef =
|
|
15291
|
+
const changedRef = useRef16({});
|
|
15202
15292
|
changedRef.current = changed;
|
|
15203
|
-
|
|
15293
|
+
useEffect33(() => {
|
|
15204
15294
|
const document3 = existing.data?.document;
|
|
15205
15295
|
if (!document3) return;
|
|
15206
15296
|
const mine = changedRef.current;
|
|
@@ -15401,7 +15491,7 @@ function asWords(value) {
|
|
|
15401
15491
|
}
|
|
15402
15492
|
|
|
15403
15493
|
// src/ShareControl.tsx
|
|
15404
|
-
import { useEffect as
|
|
15494
|
+
import { useEffect as useEffect34, useState as useState43 } from "react";
|
|
15405
15495
|
import { Button as Button36 } from "@ai-matrx/design-system";
|
|
15406
15496
|
import { Fragment as Fragment19, jsx as jsx53, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
15407
15497
|
function useCanShare() {
|
|
@@ -15423,7 +15513,7 @@ function ShareControl({
|
|
|
15423
15513
|
}) {
|
|
15424
15514
|
const host = useRecordsUi();
|
|
15425
15515
|
const [open, setOpen] = useState43(initiallyOpen);
|
|
15426
|
-
|
|
15516
|
+
useEffect34(() => {
|
|
15427
15517
|
if (initiallyOpen) setOpen(true);
|
|
15428
15518
|
}, [initiallyOpen]);
|
|
15429
15519
|
const asked = useRecordRights(may === void 0 ? subjectId : null);
|
|
@@ -15462,7 +15552,7 @@ function Peek({ tableId, recordId, onClose, className }) {
|
|
|
15462
15552
|
const record = useRecord2(recordId, true);
|
|
15463
15553
|
const may = useRecordRights(recordId);
|
|
15464
15554
|
const host = useRecordsUi();
|
|
15465
|
-
const organizationId =
|
|
15555
|
+
const organizationId = useRecordsClient29().config.organizationId;
|
|
15466
15556
|
const [editing, setEditing] = useState44(false);
|
|
15467
15557
|
const [talking, setTalking] = useState44(false);
|
|
15468
15558
|
if (record.error) return /* @__PURE__ */ jsx54(RefusalNotice, { error: record.error, className });
|
|
@@ -15639,8 +15729,8 @@ var LOOK_WORDS = {
|
|
|
15639
15729
|
};
|
|
15640
15730
|
|
|
15641
15731
|
// src/ViewSwitcher.tsx
|
|
15642
|
-
import { useEffect as
|
|
15643
|
-
import { useFields as useFields13, useRecords as useRecords6, useRecordsClient as
|
|
15732
|
+
import { useEffect as useEffect36, useMemo as useMemo31, useState as useState46 } from "react";
|
|
15733
|
+
import { useFields as useFields13, useRecords as useRecords6, useRecordsClient as useRecordsClient31 } from "@ai-matrx/records/react";
|
|
15644
15734
|
import { stableFilterKey as stableFilterKey4 } from "@ai-matrx/records";
|
|
15645
15735
|
import { Button as Button39, Skeleton as Skeleton7, cn as cn32 } from "@ai-matrx/design-system";
|
|
15646
15736
|
import {
|
|
@@ -15649,11 +15739,11 @@ import {
|
|
|
15649
15739
|
} from "@ai-matrx/design-system/data-table";
|
|
15650
15740
|
|
|
15651
15741
|
// src/Pipeline.tsx
|
|
15652
|
-
import { useCallback as useCallback20, useEffect as
|
|
15742
|
+
import { useCallback as useCallback20, useEffect as useEffect35, useMemo as useMemo30, useRef as useRef17, useState as useState45 } from "react";
|
|
15653
15743
|
import {
|
|
15654
15744
|
mayDrag,
|
|
15655
15745
|
useFields as useFields12,
|
|
15656
|
-
useRecordsClient as
|
|
15746
|
+
useRecordsClient as useRecordsClient30
|
|
15657
15747
|
} from "@ai-matrx/records/react";
|
|
15658
15748
|
import { stableFilterKey as stableFilterKey3 } from "@ai-matrx/records";
|
|
15659
15749
|
import {
|
|
@@ -15745,7 +15835,7 @@ function PipelineBoard({
|
|
|
15745
15835
|
dateFields,
|
|
15746
15836
|
className
|
|
15747
15837
|
}) {
|
|
15748
|
-
const client =
|
|
15838
|
+
const client = useRecordsClient30();
|
|
15749
15839
|
const fields = useFields12(tableId);
|
|
15750
15840
|
const ownDecorations = useTableDecorations(style ? null : tableId);
|
|
15751
15841
|
const cardStyle = useMemo30(
|
|
@@ -15760,15 +15850,15 @@ function PipelineBoard({
|
|
|
15760
15850
|
const [waiting, setWaiting] = useState45(/* @__PURE__ */ new Map());
|
|
15761
15851
|
const [dragging, setDragging] = useState45(null);
|
|
15762
15852
|
const [over, setOver] = useState45(null);
|
|
15763
|
-
const alive =
|
|
15853
|
+
const alive = useRef17(true);
|
|
15764
15854
|
const [selected, setSelected] = useState45(/* @__PURE__ */ new Set());
|
|
15765
|
-
const anchor =
|
|
15855
|
+
const anchor = useRef17(null);
|
|
15766
15856
|
const [versions, setVersions] = useState45(null);
|
|
15767
15857
|
const [batch, setBatch] = useState45(/* @__PURE__ */ new Map());
|
|
15768
15858
|
const [batchSaid, setBatchSaid] = useState45(null);
|
|
15769
15859
|
const [batchError, setBatchError] = useState45(null);
|
|
15770
15860
|
const [moving, setMoving] = useState45(false);
|
|
15771
|
-
|
|
15861
|
+
useEffect35(() => {
|
|
15772
15862
|
alive.current = true;
|
|
15773
15863
|
return () => {
|
|
15774
15864
|
alive.current = false;
|
|
@@ -15793,10 +15883,10 @@ function PipelineBoard({
|
|
|
15793
15883
|
setWaiting(held.ok ? new Map((held.data ?? []).map((p) => [p.record_id, p])) : /* @__PURE__ */ new Map());
|
|
15794
15884
|
setColumns(board.ok ? board.data ?? [] : []);
|
|
15795
15885
|
}, [client, tableId, measure, filterKey]);
|
|
15796
|
-
|
|
15886
|
+
useEffect35(() => {
|
|
15797
15887
|
void reload();
|
|
15798
15888
|
}, [reload]);
|
|
15799
|
-
|
|
15889
|
+
useEffect35(() => {
|
|
15800
15890
|
const ids = rows.filter((r) => mayDrag(r.level)).map((r) => r.id);
|
|
15801
15891
|
if (ids.length === 0) {
|
|
15802
15892
|
setVersions({ ok: true, map: /* @__PURE__ */ new Map() });
|
|
@@ -16396,7 +16486,7 @@ function batchSentence(moved, waiting, notMoved, label) {
|
|
|
16396
16486
|
import { Fragment as Fragment22, jsx as jsx57, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
16397
16487
|
var NO_FIELDS = [];
|
|
16398
16488
|
function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
16399
|
-
const client =
|
|
16489
|
+
const client = useRecordsClient31();
|
|
16400
16490
|
const table = useRecords6(view.ruleId ? null : view.subject, {
|
|
16401
16491
|
pageSize,
|
|
16402
16492
|
...filter ? { filter } : {}
|
|
@@ -16407,7 +16497,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
16407
16497
|
error: null
|
|
16408
16498
|
});
|
|
16409
16499
|
const ruleId = view.ruleId ?? null;
|
|
16410
|
-
|
|
16500
|
+
useEffect36(() => {
|
|
16411
16501
|
if (!ruleId) return;
|
|
16412
16502
|
let cancelled = false;
|
|
16413
16503
|
setRuled({ rows: [], loading: true, error: null });
|
|
@@ -16494,7 +16584,7 @@ function ViewSwitcher({
|
|
|
16494
16584
|
const hostLayouts = useRecordsUi().layouts ?? [];
|
|
16495
16585
|
const drawnByHost = hostLayout ? hostLayouts.find((h) => h.id === hostLayout) ?? null : null;
|
|
16496
16586
|
const [local, setLocal] = useState46({});
|
|
16497
|
-
|
|
16587
|
+
useEffect36(() => {
|
|
16498
16588
|
setLayout(view.layout);
|
|
16499
16589
|
setLocal({});
|
|
16500
16590
|
}, [view.layout, view.name, view.subject]);
|
|
@@ -16601,12 +16691,12 @@ function offerableFields(all, want) {
|
|
|
16601
16691
|
});
|
|
16602
16692
|
}
|
|
16603
16693
|
function useStageField(tableId) {
|
|
16604
|
-
const client =
|
|
16694
|
+
const client = useRecordsClient31();
|
|
16605
16695
|
const [stage, setStage] = useState46({
|
|
16606
16696
|
asked: false,
|
|
16607
16697
|
key: null
|
|
16608
16698
|
});
|
|
16609
|
-
|
|
16699
|
+
useEffect36(() => {
|
|
16610
16700
|
let cancelled = false;
|
|
16611
16701
|
setStage({ asked: false, key: null });
|
|
16612
16702
|
void client.tableStageField({ table_id: tableId }).then((r) => {
|
|
@@ -17014,7 +17104,7 @@ function Card2({
|
|
|
17014
17104
|
}
|
|
17015
17105
|
|
|
17016
17106
|
// src/ArchivedView.tsx
|
|
17017
|
-
import { useCallback as useCallback21, useEffect as
|
|
17107
|
+
import { useCallback as useCallback21, useEffect as useEffect37, useState as useState47 } from "react";
|
|
17018
17108
|
import {
|
|
17019
17109
|
ARCHIVE_LANES,
|
|
17020
17110
|
ARCHIVE_LANE_LABEL,
|
|
@@ -17023,7 +17113,7 @@ import {
|
|
|
17023
17113
|
archivedByLine,
|
|
17024
17114
|
emptyArchiveLine
|
|
17025
17115
|
} from "@ai-matrx/records";
|
|
17026
|
-
import { useFields as useFields14, useRecordsClient as
|
|
17116
|
+
import { useFields as useFields14, useRecordsClient as useRecordsClient32, useTable as useTable8 } from "@ai-matrx/records/react";
|
|
17027
17117
|
import { Button as Button40, Skeleton as Skeleton8, cn as cn33 } from "@ai-matrx/design-system";
|
|
17028
17118
|
import { jsx as jsx58, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
17029
17119
|
var ARCHIVE_MEANS = "Archiving never destroys anything. A record you remove from the grid waits here until somebody brings it back.";
|
|
@@ -17042,7 +17132,7 @@ function ArchivedView({
|
|
|
17042
17132
|
onRestored,
|
|
17043
17133
|
className
|
|
17044
17134
|
}) {
|
|
17045
|
-
const client =
|
|
17135
|
+
const client = useRecordsClient32();
|
|
17046
17136
|
const table = useTable8(tableId);
|
|
17047
17137
|
const rights = useTableRights(table.data);
|
|
17048
17138
|
const fields = useFields14(tableId);
|
|
@@ -17052,7 +17142,7 @@ function ArchivedView({
|
|
|
17052
17142
|
const [error, setError] = useState47(null);
|
|
17053
17143
|
const [restoring, setRestoring] = useState47(null);
|
|
17054
17144
|
const [refusal2, setRefusal] = useState47(null);
|
|
17055
|
-
|
|
17145
|
+
useEffect37(() => {
|
|
17056
17146
|
if (laneFromHost) setLane(laneFromHost);
|
|
17057
17147
|
}, [laneFromHost]);
|
|
17058
17148
|
const read = useCallback21(async () => {
|
|
@@ -17067,7 +17157,7 @@ function ArchivedView({
|
|
|
17067
17157
|
}
|
|
17068
17158
|
setLoading(false);
|
|
17069
17159
|
}, [client, tableId, lane, pageSize]);
|
|
17070
|
-
|
|
17160
|
+
useEffect37(() => {
|
|
17071
17161
|
void read();
|
|
17072
17162
|
}, [read]);
|
|
17073
17163
|
const pick = (next) => {
|
|
@@ -17149,14 +17239,14 @@ function ArchivedView({
|
|
|
17149
17239
|
}
|
|
17150
17240
|
|
|
17151
17241
|
// src/ArchivedDisclosure.tsx
|
|
17152
|
-
import { useCallback as useCallback22, useEffect as
|
|
17242
|
+
import { useCallback as useCallback22, useEffect as useEffect38, useState as useState48 } from "react";
|
|
17153
17243
|
import {
|
|
17154
17244
|
emptyPortalArchiveLine,
|
|
17155
17245
|
portalConfirmLine,
|
|
17156
17246
|
portalTitleTypedBack
|
|
17157
17247
|
} from "@ai-matrx/records";
|
|
17158
|
-
import { useRecordsClient as
|
|
17159
|
-
import { BasicInput as
|
|
17248
|
+
import { useRecordsClient as useRecordsClient33 } from "@ai-matrx/records/react";
|
|
17249
|
+
import { BasicInput as BasicInput14, Button as Button41, Skeleton as Skeleton9, cn as cn34 } from "@ai-matrx/design-system";
|
|
17160
17250
|
import { jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
17161
17251
|
var ARCHIVED_NEVER_DESTROYED = "Archiving never destroys anything. What you put away waits here until somebody brings it back.";
|
|
17162
17252
|
function ArchivedDisclosure({
|
|
@@ -17200,7 +17290,7 @@ function ArchivedPortals({
|
|
|
17200
17290
|
defaultOpen,
|
|
17201
17291
|
className
|
|
17202
17292
|
}) {
|
|
17203
|
-
const client =
|
|
17293
|
+
const client = useRecordsClient33();
|
|
17204
17294
|
const [rows, setRows] = useState48(null);
|
|
17205
17295
|
const [error, setError] = useState48(null);
|
|
17206
17296
|
const [confirming, setConfirming] = useState48(null);
|
|
@@ -17218,7 +17308,7 @@ function ArchivedPortals({
|
|
|
17218
17308
|
setError(answered.error);
|
|
17219
17309
|
}
|
|
17220
17310
|
}, [client]);
|
|
17221
|
-
|
|
17311
|
+
useEffect38(() => {
|
|
17222
17312
|
void read();
|
|
17223
17313
|
}, [read, refreshToken]);
|
|
17224
17314
|
const restore = async (portal) => {
|
|
@@ -17301,7 +17391,7 @@ function ArchivedPortals({
|
|
|
17301
17391
|
] }),
|
|
17302
17392
|
/* @__PURE__ */ jsxs53("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
17303
17393
|
/* @__PURE__ */ jsx59(
|
|
17304
|
-
|
|
17394
|
+
BasicInput14,
|
|
17305
17395
|
{
|
|
17306
17396
|
value: typed,
|
|
17307
17397
|
placeholder: portal.title,
|
|
@@ -17334,14 +17424,14 @@ function ArchivedPortals({
|
|
|
17334
17424
|
}
|
|
17335
17425
|
|
|
17336
17426
|
// src/ViewBar.tsx
|
|
17337
|
-
import { useCallback as useCallback24, useEffect as
|
|
17338
|
-
import { useRecordsClient as
|
|
17427
|
+
import { useCallback as useCallback24, useEffect as useEffect39, useState as useState49 } from "react";
|
|
17428
|
+
import { useRecordsClient as useRecordsClient34 } from "@ai-matrx/records/react";
|
|
17339
17429
|
import { Badge as Badge11, Button as Button42, Input as Input2, Popover as Popover5, PopoverContent as PopoverContent5, PopoverTrigger as PopoverTrigger5, Skeleton as Skeleton10, cn as cn35 } from "@ai-matrx/design-system";
|
|
17340
17430
|
|
|
17341
17431
|
// src/seedOnce.ts
|
|
17342
|
-
import { useCallback as useCallback23, useRef as
|
|
17432
|
+
import { useCallback as useCallback23, useRef as useRef18 } from "react";
|
|
17343
17433
|
function useSeedGuard() {
|
|
17344
|
-
const claimed =
|
|
17434
|
+
const claimed = useRef18(/* @__PURE__ */ new Set());
|
|
17345
17435
|
return useCallback23((name) => {
|
|
17346
17436
|
if (claimed.current.has(name)) return false;
|
|
17347
17437
|
claimed.current.add(name);
|
|
@@ -17358,7 +17448,7 @@ function seedIsSatisfied(seed, views) {
|
|
|
17358
17448
|
return seed.isDefault === true && views.some((v) => v.isDefault);
|
|
17359
17449
|
}
|
|
17360
17450
|
function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews, className }) {
|
|
17361
|
-
const client =
|
|
17451
|
+
const client = useRecordsClient34();
|
|
17362
17452
|
const claimSeed = useSeedGuard();
|
|
17363
17453
|
const table = useTable9(tableId);
|
|
17364
17454
|
const rights = useTableRights(table.data);
|
|
@@ -17410,10 +17500,10 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
17410
17500
|
setViews(mine);
|
|
17411
17501
|
onViews?.(mine);
|
|
17412
17502
|
}, [client, readViews, tableId, seedKey]);
|
|
17413
|
-
|
|
17503
|
+
useEffect39(() => {
|
|
17414
17504
|
void load();
|
|
17415
17505
|
}, [load]);
|
|
17416
|
-
|
|
17506
|
+
useEffect39(() => {
|
|
17417
17507
|
if (!views || views.length === 0) return;
|
|
17418
17508
|
const chosen = views.find((v) => v.id === (activeViewId ?? active)) ?? defaultViewOf(views) ?? views[0];
|
|
17419
17509
|
if (chosen.id !== active) setActive(chosen.id);
|
|
@@ -17517,7 +17607,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
17517
17607
|
|
|
17518
17608
|
// src/ProposalRow.tsx
|
|
17519
17609
|
import { useState as useState50 } from "react";
|
|
17520
|
-
import { useRecordsClient as
|
|
17610
|
+
import { useRecordsClient as useRecordsClient35 } from "@ai-matrx/records/react";
|
|
17521
17611
|
import { Badge as Badge12, Button as Button43, cn as cn36 } from "@ai-matrx/design-system";
|
|
17522
17612
|
import { jsx as jsx61, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
17523
17613
|
var ACT_WORD = PROPOSED_CHANGE_ACT_LABEL;
|
|
@@ -17530,7 +17620,7 @@ function ProposalRow({
|
|
|
17530
17620
|
onSettled,
|
|
17531
17621
|
className
|
|
17532
17622
|
}) {
|
|
17533
|
-
const client =
|
|
17623
|
+
const client = useRecordsClient35();
|
|
17534
17624
|
const [settled, setSettled] = useState50(outcome ?? null);
|
|
17535
17625
|
const [busy, setBusy] = useState50(false);
|
|
17536
17626
|
const [confirming, setConfirming] = useState50(false);
|
|
@@ -17618,15 +17708,15 @@ function ProposalRow({
|
|
|
17618
17708
|
}
|
|
17619
17709
|
|
|
17620
17710
|
// src/ActionInbox.tsx
|
|
17621
|
-
import { useCallback as useCallback26, useEffect as
|
|
17622
|
-
import { useRecordsClient as
|
|
17711
|
+
import { useCallback as useCallback26, useEffect as useEffect41, useMemo as useMemo33, useRef as useRef19, useState as useState52 } from "react";
|
|
17712
|
+
import { useRecordsClient as useRecordsClient37 } from "@ai-matrx/records/react";
|
|
17623
17713
|
import { Badge as Badge14, Button as Button45, Checkbox as Checkbox7, Skeleton as Skeleton12, cn as cn38 } from "@ai-matrx/design-system";
|
|
17624
17714
|
import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/data-table";
|
|
17625
17715
|
|
|
17626
17716
|
// src/ChecklistRunner.tsx
|
|
17627
|
-
import { useCallback as useCallback25, useEffect as
|
|
17628
|
-
import { useRecordsClient as
|
|
17629
|
-
import { Badge as Badge13, BasicInput as
|
|
17717
|
+
import { useCallback as useCallback25, useEffect as useEffect40, useMemo as useMemo32, useState as useState51 } from "react";
|
|
17718
|
+
import { useRecordsClient as useRecordsClient36, useTable as useTable10 } from "@ai-matrx/records/react";
|
|
17719
|
+
import { Badge as Badge13, BasicInput as BasicInput15, BasicTextarea as BasicTextarea9, Button as Button44, Skeleton as Skeleton11, cn as cn37 } from "@ai-matrx/design-system";
|
|
17630
17720
|
import { Fragment as Fragment23, jsx as jsx62, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
17631
17721
|
var DUE_WORD = DUE_STATE_LABEL;
|
|
17632
17722
|
var REQUIRES_WORD = CHECKLIST_REQUIREMENT_LABEL;
|
|
@@ -17639,7 +17729,7 @@ function ChecklistRunner({
|
|
|
17639
17729
|
offerToStart,
|
|
17640
17730
|
className
|
|
17641
17731
|
}) {
|
|
17642
|
-
const client =
|
|
17732
|
+
const client = useRecordsClient36();
|
|
17643
17733
|
const table = useTable10(tableId ?? null);
|
|
17644
17734
|
const rights = useTableRights(table.data);
|
|
17645
17735
|
const [runs, setRuns] = useState51(null);
|
|
@@ -17672,10 +17762,10 @@ function ChecklistRunner({
|
|
|
17672
17762
|
(held) => held && answered.data.some((r) => r.run_id === held) ? held : answered.data[0]?.run_id ?? null
|
|
17673
17763
|
);
|
|
17674
17764
|
}, [client, includeClosed, recordId, runId, tableId]);
|
|
17675
|
-
|
|
17765
|
+
useEffect40(() => {
|
|
17676
17766
|
void loadRuns();
|
|
17677
17767
|
}, [loadRuns]);
|
|
17678
|
-
|
|
17768
|
+
useEffect40(() => {
|
|
17679
17769
|
if (runId) setActiveId(runId);
|
|
17680
17770
|
}, [runId]);
|
|
17681
17771
|
const loadSteps = useCallback25(async () => {
|
|
@@ -17692,10 +17782,10 @@ function ChecklistRunner({
|
|
|
17692
17782
|
setError(null);
|
|
17693
17783
|
setSteps(answered.data);
|
|
17694
17784
|
}, [client, activeId]);
|
|
17695
|
-
|
|
17785
|
+
useEffect40(() => {
|
|
17696
17786
|
void loadSteps();
|
|
17697
17787
|
}, [loadSteps]);
|
|
17698
|
-
|
|
17788
|
+
useEffect40(() => {
|
|
17699
17789
|
if (!mayStart || !tableId) return;
|
|
17700
17790
|
let cancelled = false;
|
|
17701
17791
|
void client.checklistTemplates({ about_table_id: tableId, limit: 50 }).then((answered) => {
|
|
@@ -17861,7 +17951,7 @@ function StepRow({
|
|
|
17861
17951
|
}
|
|
17862
17952
|
) : null,
|
|
17863
17953
|
step2.requires === "answer" ? /* @__PURE__ */ jsx62(
|
|
17864
|
-
|
|
17954
|
+
BasicInput15,
|
|
17865
17955
|
{
|
|
17866
17956
|
"aria-label": step2.requires_label ?? REQUIRES_WORD.answer,
|
|
17867
17957
|
placeholder: step2.requires_label ?? REQUIRES_WORD.answer,
|
|
@@ -17888,7 +17978,7 @@ function StepRow({
|
|
|
17888
17978
|
);
|
|
17889
17979
|
}
|
|
17890
17980
|
function useMyChecklistSteps(limit = 25) {
|
|
17891
|
-
const client =
|
|
17981
|
+
const client = useRecordsClient36();
|
|
17892
17982
|
const me = client.config.actor.user_id ?? null;
|
|
17893
17983
|
const [steps, setSteps] = useState51([]);
|
|
17894
17984
|
const [loading, setLoading] = useState51(true);
|
|
@@ -17921,7 +18011,7 @@ function useMyChecklistSteps(limit = 25) {
|
|
|
17921
18011
|
setSteps(held);
|
|
17922
18012
|
setLoading(false);
|
|
17923
18013
|
}, [client, limit, me]);
|
|
17924
|
-
|
|
18014
|
+
useEffect40(() => {
|
|
17925
18015
|
void refresh();
|
|
17926
18016
|
}, [refresh]);
|
|
17927
18017
|
return { steps, loading, error, refresh };
|
|
@@ -17932,9 +18022,9 @@ function MyChecklistSteps({
|
|
|
17932
18022
|
onSteps,
|
|
17933
18023
|
actions
|
|
17934
18024
|
}) {
|
|
17935
|
-
const client =
|
|
18025
|
+
const client = useRecordsClient36();
|
|
17936
18026
|
const { steps: held, loading, error, refresh } = useMyChecklistSteps();
|
|
17937
|
-
|
|
18027
|
+
useEffect40(() => {
|
|
17938
18028
|
onSteps?.(held.map((s) => s.step_id));
|
|
17939
18029
|
}, [held, onSteps]);
|
|
17940
18030
|
const steps = onlyIds ? held.filter((s) => onlyIds.has(s.step_id)) : held;
|
|
@@ -17980,7 +18070,7 @@ function MyChecklistSteps({
|
|
|
17980
18070
|
] });
|
|
17981
18071
|
}
|
|
17982
18072
|
function ChecklistsPanel({ tableId, onOpenRecord, className }) {
|
|
17983
|
-
const client =
|
|
18073
|
+
const client = useRecordsClient36();
|
|
17984
18074
|
const table = useTable10(tableId);
|
|
17985
18075
|
const rights = useTableRights(table.data);
|
|
17986
18076
|
const [templates, setTemplates] = useState51(null);
|
|
@@ -18002,7 +18092,7 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
|
|
|
18002
18092
|
if (!r.ok) setRuns([]);
|
|
18003
18093
|
else setRuns(r.data);
|
|
18004
18094
|
}, [client, tableId]);
|
|
18005
|
-
|
|
18095
|
+
useEffect40(() => {
|
|
18006
18096
|
void load();
|
|
18007
18097
|
}, [load]);
|
|
18008
18098
|
if (templates === null) return /* @__PURE__ */ jsx62(Skeleton11, { className: cn37("h-40 w-full", className) });
|
|
@@ -18141,14 +18231,14 @@ function ChecklistTemplateEditor({
|
|
|
18141
18231
|
onDone,
|
|
18142
18232
|
className
|
|
18143
18233
|
}) {
|
|
18144
|
-
const client =
|
|
18234
|
+
const client = useRecordsClient36();
|
|
18145
18235
|
const [name, setName] = useState51("");
|
|
18146
18236
|
const [rows, setRows] = useState51([{ ...EMPTY_ROW }]);
|
|
18147
18237
|
const [refusal2, setRefusal] = useState51(null);
|
|
18148
18238
|
const [error, setError] = useState51(null);
|
|
18149
18239
|
const [busy, setBusy] = useState51(false);
|
|
18150
18240
|
const [loading, setLoading] = useState51(Boolean(templateId));
|
|
18151
|
-
|
|
18241
|
+
useEffect40(() => {
|
|
18152
18242
|
if (!templateId) return;
|
|
18153
18243
|
let cancelled = false;
|
|
18154
18244
|
void client.checklistTemplateShape({ template_id: templateId }).then((answered) => {
|
|
@@ -18185,7 +18275,7 @@ function ChecklistTemplateEditor({
|
|
|
18185
18275
|
}),
|
|
18186
18276
|
[aboutTableId, name, rows]
|
|
18187
18277
|
);
|
|
18188
|
-
|
|
18278
|
+
useEffect40(() => {
|
|
18189
18279
|
if (spec.steps.length === 0 || spec.name.length === 0) {
|
|
18190
18280
|
setRefusal(null);
|
|
18191
18281
|
return;
|
|
@@ -18221,7 +18311,7 @@ function ChecklistTemplateEditor({
|
|
|
18221
18311
|
/* @__PURE__ */ jsx62(Button44, { size: "sm", variant: "ghost", className: "ml-auto", onClick: () => onDone?.(), children: "Cancel" })
|
|
18222
18312
|
] }),
|
|
18223
18313
|
/* @__PURE__ */ jsx62(
|
|
18224
|
-
|
|
18314
|
+
BasicInput15,
|
|
18225
18315
|
{
|
|
18226
18316
|
"aria-label": "Checklist name",
|
|
18227
18317
|
placeholder: "What is this checklist called?",
|
|
@@ -18235,7 +18325,7 @@ function ChecklistTemplateEditor({
|
|
|
18235
18325
|
/* @__PURE__ */ jsxs56("div", { className: "flex items-center gap-1.5", children: [
|
|
18236
18326
|
/* @__PURE__ */ jsx62("span", { className: "w-4 text-right text-[11px] tabular-nums text-muted-foreground", children: index + 1 }),
|
|
18237
18327
|
/* @__PURE__ */ jsx62(
|
|
18238
|
-
|
|
18328
|
+
BasicInput15,
|
|
18239
18329
|
{
|
|
18240
18330
|
"aria-label": `Step ${index + 1}`,
|
|
18241
18331
|
placeholder: "What happens in this step?",
|
|
@@ -18258,7 +18348,7 @@ function ChecklistTemplateEditor({
|
|
|
18258
18348
|
] }),
|
|
18259
18349
|
/* @__PURE__ */ jsxs56("div", { className: "mt-1 flex flex-wrap items-center gap-1.5 pl-6", children: [
|
|
18260
18350
|
/* @__PURE__ */ jsx62(
|
|
18261
|
-
|
|
18351
|
+
BasicInput15,
|
|
18262
18352
|
{
|
|
18263
18353
|
"aria-label": `Step ${index + 1} role`,
|
|
18264
18354
|
placeholder: "whose? (a role)",
|
|
@@ -18268,7 +18358,7 @@ function ChecklistTemplateEditor({
|
|
|
18268
18358
|
}
|
|
18269
18359
|
),
|
|
18270
18360
|
/* @__PURE__ */ jsx62(
|
|
18271
|
-
|
|
18361
|
+
BasicInput15,
|
|
18272
18362
|
{
|
|
18273
18363
|
"aria-label": `Step ${index + 1} due days`,
|
|
18274
18364
|
placeholder: "days in",
|
|
@@ -18279,7 +18369,7 @@ function ChecklistTemplateEditor({
|
|
|
18279
18369
|
}
|
|
18280
18370
|
),
|
|
18281
18371
|
/* @__PURE__ */ jsx62(
|
|
18282
|
-
|
|
18372
|
+
BasicInput15,
|
|
18283
18373
|
{
|
|
18284
18374
|
"aria-label": `Step ${index + 1} waits for`,
|
|
18285
18375
|
placeholder: "waits for (step numbers)",
|
|
@@ -18299,7 +18389,7 @@ function ChecklistTemplateEditor({
|
|
|
18299
18389
|
}
|
|
18300
18390
|
),
|
|
18301
18391
|
row.requires === "answer" || row.requires === "record_field" ? /* @__PURE__ */ jsx62(
|
|
18302
|
-
|
|
18392
|
+
BasicInput15,
|
|
18303
18393
|
{
|
|
18304
18394
|
"aria-label": `Step ${index + 1} asks for which value`,
|
|
18305
18395
|
placeholder: "which value?",
|
|
@@ -18432,7 +18522,7 @@ function ActionInbox({
|
|
|
18432
18522
|
onOpenRecord,
|
|
18433
18523
|
className
|
|
18434
18524
|
}) {
|
|
18435
|
-
const client =
|
|
18525
|
+
const client = useRecordsClient37();
|
|
18436
18526
|
const [showDecided, setShowDecided] = useState52(includeSettled);
|
|
18437
18527
|
const [groupBy, setGroupBy] = useState52(defaultGroupBy);
|
|
18438
18528
|
const [everyTable, setEveryTable] = useState52(false);
|
|
@@ -18441,9 +18531,9 @@ function ActionInbox({
|
|
|
18441
18531
|
const [outcome, setOutcome] = useState52({});
|
|
18442
18532
|
const [busy, setBusy] = useState52(null);
|
|
18443
18533
|
const [cursor, setCursor] = useState52(0);
|
|
18444
|
-
const listRef =
|
|
18534
|
+
const listRef = useRef19(null);
|
|
18445
18535
|
const [selected, setSelected] = useState52(/* @__PURE__ */ new Set());
|
|
18446
|
-
const anchor =
|
|
18536
|
+
const anchor = useRef19(null);
|
|
18447
18537
|
const [deciding, setDeciding] = useState52(false);
|
|
18448
18538
|
const [batchSaid, setBatchSaid] = useState52(null);
|
|
18449
18539
|
const [view, setView] = useState52("inbox");
|
|
@@ -18467,7 +18557,7 @@ function ActionInbox({
|
|
|
18467
18557
|
setError(null);
|
|
18468
18558
|
setItems(result.data);
|
|
18469
18559
|
}, [client, showDecided, view]);
|
|
18470
|
-
|
|
18560
|
+
useEffect41(() => {
|
|
18471
18561
|
void load();
|
|
18472
18562
|
}, [load]);
|
|
18473
18563
|
const narrowed = useMemo33(() => {
|
|
@@ -18482,10 +18572,10 @@ function ActionInbox({
|
|
|
18482
18572
|
const groups = useMemo33(() => groupInbox(narrowed, groupBy), [narrowed, groupBy]);
|
|
18483
18573
|
const shown3 = useMemo33(() => groups.flatMap((g) => g.items), [groups]);
|
|
18484
18574
|
const elsewhere = (items?.length ?? 0) - narrowed.length;
|
|
18485
|
-
|
|
18575
|
+
useEffect41(() => {
|
|
18486
18576
|
if (cursor >= shown3.length) setCursor(Math.max(0, shown3.length - 1));
|
|
18487
18577
|
}, [shown3.length, cursor]);
|
|
18488
|
-
|
|
18578
|
+
useEffect41(() => {
|
|
18489
18579
|
const el = listRef.current?.querySelector(`[data-row="${cursor}"]`);
|
|
18490
18580
|
el?.scrollIntoView({ block: "nearest" });
|
|
18491
18581
|
}, [cursor, shown3.length]);
|
|
@@ -18506,11 +18596,11 @@ function ActionInbox({
|
|
|
18506
18596
|
[client, load]
|
|
18507
18597
|
);
|
|
18508
18598
|
const [held, setHeld] = useState52({});
|
|
18509
|
-
const holds2 =
|
|
18510
|
-
const lastHold =
|
|
18511
|
-
const holdSeq =
|
|
18599
|
+
const holds2 = useRef19(/* @__PURE__ */ new Map());
|
|
18600
|
+
const lastHold = useRef19(null);
|
|
18601
|
+
const holdSeq = useRef19(0);
|
|
18512
18602
|
const [, tick] = useState52(0);
|
|
18513
|
-
|
|
18603
|
+
useEffect41(() => {
|
|
18514
18604
|
if (Object.keys(held).length === 0) return;
|
|
18515
18605
|
const t = setInterval(() => tick((n) => n + 1), 250);
|
|
18516
18606
|
return () => clearInterval(t);
|
|
@@ -18555,7 +18645,7 @@ function ActionInbox({
|
|
|
18555
18645
|
});
|
|
18556
18646
|
setSaid({ text: entry.ids.length === 1 ? "Undone. It is waiting on you again, exactly as it was." : `Undone. All ${entry.ids.length} are waiting on you again, exactly as they were.`, undo: null });
|
|
18557
18647
|
}, []);
|
|
18558
|
-
|
|
18648
|
+
useEffect41(() => {
|
|
18559
18649
|
const flush = () => {
|
|
18560
18650
|
for (const entry of [...holds2.current.values()]) entry.commit();
|
|
18561
18651
|
};
|
|
@@ -18565,8 +18655,8 @@ function ActionInbox({
|
|
|
18565
18655
|
flush();
|
|
18566
18656
|
};
|
|
18567
18657
|
}, []);
|
|
18568
|
-
const resumed =
|
|
18569
|
-
|
|
18658
|
+
const resumed = useRef19(false);
|
|
18659
|
+
useEffect41(() => {
|
|
18570
18660
|
if (resumed.current || items === null || view !== "inbox") return;
|
|
18571
18661
|
resumed.current = true;
|
|
18572
18662
|
const kept = readHolds();
|
|
@@ -19169,17 +19259,17 @@ function ActionInbox({
|
|
|
19169
19259
|
}
|
|
19170
19260
|
|
|
19171
19261
|
// src/HistoryPanel.tsx
|
|
19172
|
-
import { useCallback as useCallback27, useEffect as
|
|
19262
|
+
import { useCallback as useCallback27, useEffect as useEffect42, useRef as useRef20, useState as useState53 } from "react";
|
|
19173
19263
|
import {
|
|
19174
19264
|
useFields as useFields15,
|
|
19175
19265
|
useRecordChangeRevision,
|
|
19176
|
-
useRecordsClient as
|
|
19266
|
+
useRecordsClient as useRecordsClient38,
|
|
19177
19267
|
useTable as useTable11
|
|
19178
19268
|
} from "@ai-matrx/records/react";
|
|
19179
19269
|
import { Badge as Badge15, Button as Button46, Skeleton as Skeleton13, cn as cn39 } from "@ai-matrx/design-system";
|
|
19180
19270
|
import { jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
19181
19271
|
function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
|
|
19182
|
-
const client =
|
|
19272
|
+
const client = useRecordsClient38();
|
|
19183
19273
|
const table = useTable11(tableId);
|
|
19184
19274
|
const fields = useFields15(tableId);
|
|
19185
19275
|
const rights = useTableRights(table.data);
|
|
@@ -19188,7 +19278,7 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
|
|
|
19188
19278
|
const [open, setOpen] = useState53(null);
|
|
19189
19279
|
const [pending, setPending] = useState53({ phase: "idle" });
|
|
19190
19280
|
const [said, setSaid] = useState53(null);
|
|
19191
|
-
const listRef =
|
|
19281
|
+
const listRef = useRef20(null);
|
|
19192
19282
|
const changed = useRecordChangeRevision(recordId);
|
|
19193
19283
|
const load = useCallback27(async () => {
|
|
19194
19284
|
const answered = await client.recordHistory({ record_id: recordId });
|
|
@@ -19199,7 +19289,7 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
|
|
|
19199
19289
|
setError(null);
|
|
19200
19290
|
setEntries(answered.data);
|
|
19201
19291
|
}, [client, recordId, changed]);
|
|
19202
|
-
|
|
19292
|
+
useEffect42(() => {
|
|
19203
19293
|
void load();
|
|
19204
19294
|
}, [load]);
|
|
19205
19295
|
if (error) return /* @__PURE__ */ jsx64(RefusalNotice, { error, className });
|
|
@@ -19480,16 +19570,16 @@ function say(value, field2) {
|
|
|
19480
19570
|
}
|
|
19481
19571
|
|
|
19482
19572
|
// src/CommentThread.tsx
|
|
19483
|
-
import { useCallback as useCallback28, useEffect as
|
|
19573
|
+
import { useCallback as useCallback28, useEffect as useEffect43, useMemo as useMemo34, useRef as useRef21, useState as useState54 } from "react";
|
|
19484
19574
|
import {
|
|
19485
19575
|
useFields as useFields16,
|
|
19486
|
-
useRecordsClient as
|
|
19576
|
+
useRecordsClient as useRecordsClient39,
|
|
19487
19577
|
useTable as useTable12
|
|
19488
19578
|
} from "@ai-matrx/records/react";
|
|
19489
19579
|
import { Badge as Badge16, Button as Button47, Skeleton as Skeleton14, Textarea, cn as cn40 } from "@ai-matrx/design-system";
|
|
19490
19580
|
import { jsx as jsx65, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
19491
19581
|
function CommentThread({ tableId, recordId, fieldKey, className }) {
|
|
19492
|
-
const client =
|
|
19582
|
+
const client = useRecordsClient39();
|
|
19493
19583
|
const table = useTable12(tableId);
|
|
19494
19584
|
const fields = useFields16(tableId);
|
|
19495
19585
|
const host = useRecordsUi();
|
|
@@ -19503,7 +19593,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
|
|
|
19503
19593
|
const [people, setPeople] = useState54([]);
|
|
19504
19594
|
const [mentionQuery, setMentionQuery] = useState54(null);
|
|
19505
19595
|
const [picked, setPicked] = useState54([]);
|
|
19506
|
-
const box =
|
|
19596
|
+
const box = useRef21(null);
|
|
19507
19597
|
const load = useCallback28(async () => {
|
|
19508
19598
|
const answered = await client.commentThread({ record_id: recordId, include_resolved: showResolved });
|
|
19509
19599
|
if (!answered.ok) {
|
|
@@ -19517,10 +19607,10 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
|
|
|
19517
19607
|
mayResolve: answered.data.may_resolve
|
|
19518
19608
|
});
|
|
19519
19609
|
}, [client, recordId, showResolved]);
|
|
19520
|
-
|
|
19610
|
+
useEffect43(() => {
|
|
19521
19611
|
void load();
|
|
19522
19612
|
}, [load]);
|
|
19523
|
-
|
|
19613
|
+
useEffect43(() => {
|
|
19524
19614
|
let alive = true;
|
|
19525
19615
|
if (!host.members) return;
|
|
19526
19616
|
void host.members().then((roster) => {
|
|
@@ -19723,10 +19813,10 @@ function Line({
|
|
|
19723
19813
|
}
|
|
19724
19814
|
|
|
19725
19815
|
// src/FieldHistoryPanel.tsx
|
|
19726
|
-
import { useCallback as useCallback29, useEffect as
|
|
19816
|
+
import { useCallback as useCallback29, useEffect as useEffect44, useState as useState55 } from "react";
|
|
19727
19817
|
import {
|
|
19728
19818
|
useFields as useFields17,
|
|
19729
|
-
useRecordsClient as
|
|
19819
|
+
useRecordsClient as useRecordsClient40,
|
|
19730
19820
|
useTable as useTable13
|
|
19731
19821
|
} from "@ai-matrx/records/react";
|
|
19732
19822
|
import { Badge as Badge17, Button as Button48, Skeleton as Skeleton15, cn as cn41 } from "@ai-matrx/design-system";
|
|
@@ -19739,7 +19829,7 @@ function FieldHistoryPanel({
|
|
|
19739
19829
|
onOpenRecord,
|
|
19740
19830
|
className
|
|
19741
19831
|
}) {
|
|
19742
|
-
const client =
|
|
19832
|
+
const client = useRecordsClient40();
|
|
19743
19833
|
const table = useTable13(tableId);
|
|
19744
19834
|
const fields = useFields17(tableId);
|
|
19745
19835
|
const rights = useTableRights(table.data);
|
|
@@ -19758,7 +19848,7 @@ function FieldHistoryPanel({
|
|
|
19758
19848
|
setError(null);
|
|
19759
19849
|
setRows(answered.data);
|
|
19760
19850
|
}, [client, tableId, fieldKey, recordId]);
|
|
19761
|
-
|
|
19851
|
+
useEffect44(() => {
|
|
19762
19852
|
void load();
|
|
19763
19853
|
}, [load]);
|
|
19764
19854
|
const label = (fields.data ?? []).find((f) => f.key === fieldKey)?.label || humanize(fieldKey);
|
|
@@ -19970,13 +20060,13 @@ function submissionStamp(args) {
|
|
|
19970
20060
|
}
|
|
19971
20061
|
|
|
19972
20062
|
// src/PortalBuilder.tsx
|
|
19973
|
-
import { useCallback as useCallback30, useEffect as
|
|
19974
|
-
import { useRecordsClient as
|
|
19975
|
-
import { BasicInput as
|
|
20063
|
+
import { useCallback as useCallback30, useEffect as useEffect45, useMemo as useMemo35, useState as useState56 } from "react";
|
|
20064
|
+
import { useRecordsClient as useRecordsClient41, useTables as useTables3 } from "@ai-matrx/records/react";
|
|
20065
|
+
import { BasicInput as BasicInput16, Button as Button49, Checkbox as Checkbox8, Label as Label12, Separator as Separator9, Skeleton as Skeleton16, cn as cn42 } from "@ai-matrx/design-system";
|
|
19976
20066
|
import { Fragment as Fragment26, jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
19977
20067
|
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.";
|
|
19978
20068
|
function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
19979
|
-
const client =
|
|
20069
|
+
const client = useRecordsClient41();
|
|
19980
20070
|
const tables = useTables3();
|
|
19981
20071
|
const [title, setTitle] = useState56("");
|
|
19982
20072
|
const [clientTableId, setClientTableId] = useState56(null);
|
|
@@ -20003,7 +20093,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
20003
20093
|
},
|
|
20004
20094
|
[client, fieldsByTable]
|
|
20005
20095
|
);
|
|
20006
|
-
|
|
20096
|
+
useEffect45(() => {
|
|
20007
20097
|
if (!portalId) return;
|
|
20008
20098
|
void (async () => {
|
|
20009
20099
|
const answered = await client.portalCard({ portal_id: portalId });
|
|
@@ -20017,7 +20107,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
20017
20107
|
setClientTableId(answered.data.client_table_id);
|
|
20018
20108
|
})();
|
|
20019
20109
|
}, [client, portalId]);
|
|
20020
|
-
|
|
20110
|
+
useEffect45(() => {
|
|
20021
20111
|
if (!tableId) return;
|
|
20022
20112
|
setExposures(
|
|
20023
20113
|
(prev) => prev[tableId] ? prev : {
|
|
@@ -20100,7 +20190,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
20100
20190
|
/* @__PURE__ */ jsxs61("label", { className: "flex flex-col gap-1", children: [
|
|
20101
20191
|
/* @__PURE__ */ jsx67(Label12, { className: "text-xs font-medium", children: "What your clients see it called" }),
|
|
20102
20192
|
/* @__PURE__ */ jsx67(
|
|
20103
|
-
|
|
20193
|
+
BasicInput16,
|
|
20104
20194
|
{
|
|
20105
20195
|
value: title,
|
|
20106
20196
|
placeholder: "Your jobs and invoices",
|
|
@@ -20228,7 +20318,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
20228
20318
|
/* @__PURE__ */ jsxs61("label", { className: "flex flex-col gap-1", children: [
|
|
20229
20319
|
/* @__PURE__ */ jsx67("span", { className: "text-xs text-muted-foreground", children: "Their email" }),
|
|
20230
20320
|
/* @__PURE__ */ jsx67(
|
|
20231
|
-
|
|
20321
|
+
BasicInput16,
|
|
20232
20322
|
{
|
|
20233
20323
|
className: "h-8 w-full @md:w-56",
|
|
20234
20324
|
value: inviteEmail,
|
|
@@ -20239,7 +20329,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
20239
20329
|
/* @__PURE__ */ jsxs61("label", { className: "flex flex-col gap-1", children: [
|
|
20240
20330
|
/* @__PURE__ */ jsx67("span", { className: "text-xs text-muted-foreground", children: "Their record in the client table" }),
|
|
20241
20331
|
/* @__PURE__ */ jsx67(
|
|
20242
|
-
|
|
20332
|
+
BasicInput16,
|
|
20243
20333
|
{
|
|
20244
20334
|
className: "h-8 w-full @md:w-80",
|
|
20245
20335
|
placeholder: "the record id",
|
|
@@ -20265,15 +20355,15 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
20265
20355
|
}
|
|
20266
20356
|
|
|
20267
20357
|
// src/PortalsPanel.tsx
|
|
20268
|
-
import { useCallback as useCallback31, useEffect as
|
|
20269
|
-
import { useRecordsClient as
|
|
20358
|
+
import { useCallback as useCallback31, useEffect as useEffect47, useMemo as useMemo37, useState as useState58 } from "react";
|
|
20359
|
+
import { useRecordsClient as useRecordsClient43 } from "@ai-matrx/records/react";
|
|
20270
20360
|
import {
|
|
20271
20361
|
portalArchiveConsequence,
|
|
20272
20362
|
portalConfirmLine as portalConfirmLine2,
|
|
20273
20363
|
portalPath,
|
|
20274
20364
|
portalTitleTypedBack as portalTitleTypedBack2
|
|
20275
20365
|
} from "@ai-matrx/records";
|
|
20276
|
-
import { Badge as Badge18, BasicInput as
|
|
20366
|
+
import { Badge as Badge18, BasicInput as BasicInput18, Button as Button52, Separator as Separator10, Skeleton as Skeleton17, cn as cn45 } from "@ai-matrx/design-system";
|
|
20277
20367
|
|
|
20278
20368
|
// src/BuildOrAsk.tsx
|
|
20279
20369
|
import { Button as Button50, cn as cn43 } from "@ai-matrx/design-system";
|
|
@@ -20305,9 +20395,9 @@ function BuildOrAsk({
|
|
|
20305
20395
|
}
|
|
20306
20396
|
|
|
20307
20397
|
// src/PortalLookEditor.tsx
|
|
20308
|
-
import { useEffect as
|
|
20309
|
-
import { useRecordsClient as
|
|
20310
|
-
import { BasicInput as
|
|
20398
|
+
import { useEffect as useEffect46, useMemo as useMemo36, useState as useState57 } from "react";
|
|
20399
|
+
import { useRecordsClient as useRecordsClient42 } from "@ai-matrx/records/react";
|
|
20400
|
+
import { BasicInput as BasicInput17, Button as Button51, cn as cn44 } from "@ai-matrx/design-system";
|
|
20311
20401
|
import { STYLE_COLOR_LABELS as STYLE_COLOR_LABELS3, SWATCH_CLASS as SWATCH_CLASS2 } from "@ai-matrx/design-system/data-table";
|
|
20312
20402
|
import { jsx as jsx69, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
20313
20403
|
function candidateRows(card, available) {
|
|
@@ -20334,7 +20424,7 @@ function candidateRows(card, available) {
|
|
|
20334
20424
|
return rows;
|
|
20335
20425
|
}
|
|
20336
20426
|
function PortalLookEditor({ card, onSaved, className }) {
|
|
20337
|
-
const client =
|
|
20427
|
+
const client = useRecordsClient42();
|
|
20338
20428
|
const stored = card.config?.style ?? {};
|
|
20339
20429
|
const [name, setName] = useState57(stored.display_name ?? "");
|
|
20340
20430
|
const [welcome, setWelcome] = useState57(stored.welcome ?? "");
|
|
@@ -20347,7 +20437,7 @@ function PortalLookEditor({ card, onSaved, className }) {
|
|
|
20347
20437
|
const [said, setSaid] = useState57(null);
|
|
20348
20438
|
const [formsError, setFormsError] = useState57(null);
|
|
20349
20439
|
const [formsUnread, setFormsUnread] = useState57(false);
|
|
20350
|
-
|
|
20440
|
+
useEffect46(() => {
|
|
20351
20441
|
let cancelled = false;
|
|
20352
20442
|
void (async () => {
|
|
20353
20443
|
try {
|
|
@@ -20424,7 +20514,7 @@ function PortalLookEditor({ card, onSaved, className }) {
|
|
|
20424
20514
|
/* @__PURE__ */ jsxs63("label", { className: "flex flex-col gap-1 text-xs", children: [
|
|
20425
20515
|
/* @__PURE__ */ jsx69("span", { children: "Business name clients see" }),
|
|
20426
20516
|
/* @__PURE__ */ jsx69(
|
|
20427
|
-
|
|
20517
|
+
BasicInput17,
|
|
20428
20518
|
{
|
|
20429
20519
|
value: name,
|
|
20430
20520
|
placeholder: orgName ?? card.style.display_name,
|
|
@@ -20441,7 +20531,7 @@ function PortalLookEditor({ card, onSaved, className }) {
|
|
|
20441
20531
|
/* @__PURE__ */ jsxs63("label", { className: "flex flex-col gap-1 text-xs", children: [
|
|
20442
20532
|
/* @__PURE__ */ jsx69("span", { children: "Welcome line" }),
|
|
20443
20533
|
/* @__PURE__ */ jsx69(
|
|
20444
|
-
|
|
20534
|
+
BasicInput17,
|
|
20445
20535
|
{
|
|
20446
20536
|
value: welcome,
|
|
20447
20537
|
placeholder: "Your service calls and invoices, in one place.",
|
|
@@ -20512,7 +20602,7 @@ function PortalLookEditor({ card, onSaved, className }) {
|
|
|
20512
20602
|
// never pushed past the edge (measured at 390: it was clipped).
|
|
20513
20603
|
/* @__PURE__ */ jsxs63("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
20514
20604
|
/* @__PURE__ */ jsx69(
|
|
20515
|
-
|
|
20605
|
+
BasicInput17,
|
|
20516
20606
|
{
|
|
20517
20607
|
className: "min-w-0 flex-1 basis-32",
|
|
20518
20608
|
value: link.label,
|
|
@@ -20522,7 +20612,7 @@ function PortalLookEditor({ card, onSaved, className }) {
|
|
|
20522
20612
|
}
|
|
20523
20613
|
),
|
|
20524
20614
|
/* @__PURE__ */ jsx69(
|
|
20525
|
-
|
|
20615
|
+
BasicInput17,
|
|
20526
20616
|
{
|
|
20527
20617
|
className: "min-w-0 flex-1 basis-40",
|
|
20528
20618
|
value: link.url,
|
|
@@ -20565,7 +20655,7 @@ function PortalLookEditor({ card, onSaved, className }) {
|
|
|
20565
20655
|
] }),
|
|
20566
20656
|
/* @__PURE__ */ jsxs63("div", { className: "flex items-center gap-1.5 pl-5", children: [
|
|
20567
20657
|
/* @__PURE__ */ jsx69(
|
|
20568
|
-
|
|
20658
|
+
BasicInput17,
|
|
20569
20659
|
{
|
|
20570
20660
|
className: "h-7 min-w-0 flex-1",
|
|
20571
20661
|
value: f.label,
|
|
@@ -20629,13 +20719,13 @@ function stateWords(person) {
|
|
|
20629
20719
|
}
|
|
20630
20720
|
var PORTAL_SUGGESTION = "Let each of my customers sign in and see their own jobs and invoices, and nothing else.";
|
|
20631
20721
|
function PortalsPanel({ tableId, activePortalId, className }) {
|
|
20632
|
-
const client =
|
|
20722
|
+
const client = useRecordsClient43();
|
|
20633
20723
|
const host = useRecordsUi();
|
|
20634
20724
|
const [portals, setPortals] = useState58(null);
|
|
20635
20725
|
const [exposures, setExposures] = useState58([]);
|
|
20636
20726
|
const [listError, setListError] = useState58(null);
|
|
20637
20727
|
const [openId, setOpenId] = useState58(activePortalId ?? null);
|
|
20638
|
-
|
|
20728
|
+
useEffect47(() => {
|
|
20639
20729
|
if (activePortalId) setOpenId(activePortalId);
|
|
20640
20730
|
}, [activePortalId]);
|
|
20641
20731
|
const [building, setBuilding] = useState58(false);
|
|
@@ -20653,7 +20743,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
|
|
|
20653
20743
|
setPortals(answered.data);
|
|
20654
20744
|
setExposures(mapped.ok ? mapped.data : []);
|
|
20655
20745
|
}, [client]);
|
|
20656
|
-
|
|
20746
|
+
useEffect47(() => {
|
|
20657
20747
|
void load();
|
|
20658
20748
|
}, [load]);
|
|
20659
20749
|
if (portals === null) return /* @__PURE__ */ jsx70(Skeleton17, { className: cn45("h-32 w-full", className) });
|
|
@@ -20809,7 +20899,7 @@ function ArchivePortalControl({
|
|
|
20809
20899
|
portal,
|
|
20810
20900
|
onArchived
|
|
20811
20901
|
}) {
|
|
20812
|
-
const client =
|
|
20902
|
+
const client = useRecordsClient43();
|
|
20813
20903
|
const [asking, setAsking] = useState58(false);
|
|
20814
20904
|
const [typed, setTyped] = useState58("");
|
|
20815
20905
|
const [busy, setBusy] = useState58(false);
|
|
@@ -20855,7 +20945,7 @@ function ArchivePortalControl({
|
|
|
20855
20945
|
/* @__PURE__ */ jsx70("p", { className: "text-xs text-muted-foreground", children: portalConfirmLine2(portal.title) }),
|
|
20856
20946
|
/* @__PURE__ */ jsxs64("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
20857
20947
|
/* @__PURE__ */ jsx70(
|
|
20858
|
-
|
|
20948
|
+
BasicInput18,
|
|
20859
20949
|
{
|
|
20860
20950
|
value: typed,
|
|
20861
20951
|
placeholder: portal.title,
|
|
@@ -20916,7 +21006,7 @@ function PortalDetail({
|
|
|
20916
21006
|
origin,
|
|
20917
21007
|
onChanged
|
|
20918
21008
|
}) {
|
|
20919
|
-
const client =
|
|
21009
|
+
const client = useRecordsClient43();
|
|
20920
21010
|
const [card, setCard] = useState58(null);
|
|
20921
21011
|
const [error, setError] = useState58(null);
|
|
20922
21012
|
const load = useCallback31(async () => {
|
|
@@ -20929,7 +21019,7 @@ function PortalDetail({
|
|
|
20929
21019
|
setError(null);
|
|
20930
21020
|
setCard(answered.data);
|
|
20931
21021
|
}, [client, portalId]);
|
|
20932
|
-
|
|
21022
|
+
useEffect47(() => {
|
|
20933
21023
|
void load();
|
|
20934
21024
|
}, [load]);
|
|
20935
21025
|
const revoke = useCallback31(
|
|
@@ -21137,7 +21227,7 @@ function Preview({
|
|
|
21137
21227
|
const [which, setWhich] = useState58(first?.table_id ?? null);
|
|
21138
21228
|
const [rows, setRows] = useState58(null);
|
|
21139
21229
|
const [error, setError] = useState58(null);
|
|
21140
|
-
|
|
21230
|
+
useEffect47(() => {
|
|
21141
21231
|
if (!which) return;
|
|
21142
21232
|
let cancelled = false;
|
|
21143
21233
|
setRows(null);
|
|
@@ -21174,7 +21264,7 @@ function Preview({
|
|
|
21174
21264
|
] });
|
|
21175
21265
|
}
|
|
21176
21266
|
function Invite({ card, onInvited }) {
|
|
21177
|
-
const client =
|
|
21267
|
+
const client = useRecordsClient43();
|
|
21178
21268
|
const [rows, setRows] = useState58(null);
|
|
21179
21269
|
const [clientTable, setClientTable] = useState58(null);
|
|
21180
21270
|
const [search, setSearch] = useState58("");
|
|
@@ -21183,7 +21273,7 @@ function Invite({ card, onInvited }) {
|
|
|
21183
21273
|
const [busy, setBusy] = useState58(false);
|
|
21184
21274
|
const [said, setSaid] = useState58(null);
|
|
21185
21275
|
const [error, setError] = useState58(null);
|
|
21186
|
-
|
|
21276
|
+
useEffect47(() => {
|
|
21187
21277
|
let cancelled = false;
|
|
21188
21278
|
void client.list({ table_id: card.client_table_id, limit: 200 }).then((answered) => {
|
|
21189
21279
|
if (cancelled) return;
|
|
@@ -21234,7 +21324,7 @@ function Invite({ card, onInvited }) {
|
|
|
21234
21324
|
said ? /* @__PURE__ */ jsx70("p", { className: "text-xs text-muted-foreground", children: said }) : null,
|
|
21235
21325
|
rows === null ? /* @__PURE__ */ jsx70(Skeleton17, { className: "h-9 w-full" }) : /* @__PURE__ */ jsxs64(Fragment27, { children: [
|
|
21236
21326
|
/* @__PURE__ */ jsx70(
|
|
21237
|
-
|
|
21327
|
+
BasicInput18,
|
|
21238
21328
|
{
|
|
21239
21329
|
className: "text-base",
|
|
21240
21330
|
placeholder: "Find the client\u2026",
|
|
@@ -21262,7 +21352,7 @@ function Invite({ card, onInvited }) {
|
|
|
21262
21352
|
) }, option.id))
|
|
21263
21353
|
] }),
|
|
21264
21354
|
/* @__PURE__ */ jsx70(
|
|
21265
|
-
|
|
21355
|
+
BasicInput18,
|
|
21266
21356
|
{
|
|
21267
21357
|
className: "text-base",
|
|
21268
21358
|
type: "email",
|
|
@@ -21285,9 +21375,9 @@ function Invite({ card, onInvited }) {
|
|
|
21285
21375
|
}
|
|
21286
21376
|
|
|
21287
21377
|
// src/DigestScheduler.tsx
|
|
21288
|
-
import { useCallback as useCallback32, useEffect as
|
|
21289
|
-
import { useRecordsClient as
|
|
21290
|
-
import { BasicInput as
|
|
21378
|
+
import { useCallback as useCallback32, useEffect as useEffect48, useMemo as useMemo38, useState as useState59 } from "react";
|
|
21379
|
+
import { useRecordsClient as useRecordsClient44 } from "@ai-matrx/records/react";
|
|
21380
|
+
import { BasicInput as BasicInput19, Button as Button53, Checkbox as Checkbox9, Label as Label13, Separator as Separator11, Skeleton as Skeleton18, cn as cn46 } from "@ai-matrx/design-system";
|
|
21291
21381
|
import { Fragment as Fragment28, jsx as jsx71, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
21292
21382
|
var WEEKDAYS = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
|
|
21293
21383
|
var CADENCE_WORDS = {
|
|
@@ -21310,7 +21400,7 @@ function DigestScheduler({
|
|
|
21310
21400
|
onClose,
|
|
21311
21401
|
className
|
|
21312
21402
|
}) {
|
|
21313
|
-
const client =
|
|
21403
|
+
const client = useRecordsClient44();
|
|
21314
21404
|
const host = useRecordsUi();
|
|
21315
21405
|
const [views, setViews] = useState59(null);
|
|
21316
21406
|
const [cadences, setCadences] = useState59([]);
|
|
@@ -21349,7 +21439,7 @@ function DigestScheduler({
|
|
|
21349
21439
|
setMembers([]);
|
|
21350
21440
|
}
|
|
21351
21441
|
}, [client, tableId, host]);
|
|
21352
|
-
|
|
21442
|
+
useEffect48(() => {
|
|
21353
21443
|
void load();
|
|
21354
21444
|
}, [load]);
|
|
21355
21445
|
const schedule = useMemo38(() => {
|
|
@@ -21427,7 +21517,7 @@ function DigestScheduler({
|
|
|
21427
21517
|
/* @__PURE__ */ jsxs65("label", { className: "flex flex-col gap-1", children: [
|
|
21428
21518
|
/* @__PURE__ */ jsx71(Label13, { className: "text-xs font-medium", children: "What to call it" }),
|
|
21429
21519
|
/* @__PURE__ */ jsx71(
|
|
21430
|
-
|
|
21520
|
+
BasicInput19,
|
|
21431
21521
|
{
|
|
21432
21522
|
value: name,
|
|
21433
21523
|
placeholder: "Monday donor summary",
|
|
@@ -21478,7 +21568,7 @@ function DigestScheduler({
|
|
|
21478
21568
|
] }) : null,
|
|
21479
21569
|
cadence === "weekly" || cadence === "daily" ? /* @__PURE__ */ jsxs65("label", { className: "flex flex-col gap-1", children: [
|
|
21480
21570
|
/* @__PURE__ */ jsx71(Label13, { className: "text-xs font-medium", children: "At" }),
|
|
21481
|
-
/* @__PURE__ */ jsx71(
|
|
21571
|
+
/* @__PURE__ */ jsx71(BasicInput19, { type: "time", value: time, onChange: (e) => setTime(e.target.value) })
|
|
21482
21572
|
] }) : null,
|
|
21483
21573
|
cadence !== "instant" ? /* @__PURE__ */ jsxs65(
|
|
21484
21574
|
"p",
|
|
@@ -21529,7 +21619,7 @@ function DigestScheduler({
|
|
|
21529
21619
|
] }),
|
|
21530
21620
|
quiet ? /* @__PURE__ */ jsxs65("div", { className: "flex items-center gap-2", children: [
|
|
21531
21621
|
/* @__PURE__ */ jsx71(
|
|
21532
|
-
|
|
21622
|
+
BasicInput19,
|
|
21533
21623
|
{
|
|
21534
21624
|
type: "time",
|
|
21535
21625
|
className: "h-8 w-28",
|
|
@@ -21539,7 +21629,7 @@ function DigestScheduler({
|
|
|
21539
21629
|
),
|
|
21540
21630
|
/* @__PURE__ */ jsx71("span", { className: "text-xs text-muted-foreground", children: "and" }),
|
|
21541
21631
|
/* @__PURE__ */ jsx71(
|
|
21542
|
-
|
|
21632
|
+
BasicInput19,
|
|
21543
21633
|
{
|
|
21544
21634
|
type: "time",
|
|
21545
21635
|
className: "h-8 w-28",
|
|
@@ -21601,14 +21691,14 @@ function DigestScheduler({
|
|
|
21601
21691
|
}
|
|
21602
21692
|
|
|
21603
21693
|
// src/SubscriptionsPanel.tsx
|
|
21604
|
-
import { useCallback as useCallback34, useEffect as
|
|
21605
|
-
import { useRecordsClient as
|
|
21694
|
+
import { useCallback as useCallback34, useEffect as useEffect50, useState as useState61 } from "react";
|
|
21695
|
+
import { useRecordsClient as useRecordsClient46 } from "@ai-matrx/records/react";
|
|
21606
21696
|
import { Badge as Badge19, Button as Button55, Skeleton as Skeleton20, Switch as Switch2, cn as cn48 } from "@ai-matrx/design-system";
|
|
21607
21697
|
|
|
21608
21698
|
// src/WebhooksPanel.tsx
|
|
21609
|
-
import { useCallback as useCallback33, useEffect as
|
|
21610
|
-
import { useRecordsClient as
|
|
21611
|
-
import { BasicInput as
|
|
21699
|
+
import { useCallback as useCallback33, useEffect as useEffect49, useState as useState60 } from "react";
|
|
21700
|
+
import { useRecordsClient as useRecordsClient45, useTable as useTable14 } from "@ai-matrx/records/react";
|
|
21701
|
+
import { BasicInput as BasicInput20, Button as Button54, Checkbox as Checkbox10, ConfirmDialog as ConfirmDialog6, Label as Label14, Skeleton as Skeleton19, cn as cn47 } from "@ai-matrx/design-system";
|
|
21612
21702
|
import { jsx as jsx72, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
21613
21703
|
var WEBHOOK_EVENT_LABEL = {
|
|
21614
21704
|
"record.created": "A record is added",
|
|
@@ -21627,7 +21717,7 @@ function health(hook) {
|
|
|
21627
21717
|
return "Nothing has changed since it was set up, so nothing has been sent yet.";
|
|
21628
21718
|
}
|
|
21629
21719
|
function WebhooksPanel({ tableId, className }) {
|
|
21630
|
-
const client =
|
|
21720
|
+
const client = useRecordsClient45();
|
|
21631
21721
|
const table = useTable14(tableId);
|
|
21632
21722
|
const rights = useTableRights(table.data);
|
|
21633
21723
|
const [hooks, setHooks] = useState60(null);
|
|
@@ -21649,7 +21739,7 @@ function WebhooksPanel({ tableId, className }) {
|
|
|
21649
21739
|
setError(null);
|
|
21650
21740
|
setHooks(answered.data ?? []);
|
|
21651
21741
|
}, [client, tableId]);
|
|
21652
|
-
|
|
21742
|
+
useEffect49(() => {
|
|
21653
21743
|
void load();
|
|
21654
21744
|
}, [load]);
|
|
21655
21745
|
const declare2 = async () => {
|
|
@@ -21698,7 +21788,7 @@ function WebhooksPanel({ tableId, className }) {
|
|
|
21698
21788
|
/* @__PURE__ */ jsxs66("label", { className: "flex flex-col gap-1", children: [
|
|
21699
21789
|
/* @__PURE__ */ jsx72(Label14, { className: "text-xs", children: "Where to send it (an https address)" }),
|
|
21700
21790
|
/* @__PURE__ */ jsx72(
|
|
21701
|
-
|
|
21791
|
+
BasicInput20,
|
|
21702
21792
|
{
|
|
21703
21793
|
value: url,
|
|
21704
21794
|
"aria-label": "Webhook address",
|
|
@@ -21710,7 +21800,7 @@ function WebhooksPanel({ tableId, className }) {
|
|
|
21710
21800
|
/* @__PURE__ */ jsxs66("label", { className: "flex flex-col gap-1", children: [
|
|
21711
21801
|
/* @__PURE__ */ jsx72(Label14, { className: "text-xs", children: "What it is for" }),
|
|
21712
21802
|
/* @__PURE__ */ jsx72(
|
|
21713
|
-
|
|
21803
|
+
BasicInput20,
|
|
21714
21804
|
{
|
|
21715
21805
|
value: description,
|
|
21716
21806
|
"aria-label": "What this webhook is for",
|
|
@@ -21807,7 +21897,7 @@ function nextSummaryAt(subscription, now) {
|
|
|
21807
21897
|
var CHANNEL_WORDS2 = SUBSCRIPTION_CHANNEL_LABEL;
|
|
21808
21898
|
var DIGEST_SUGGESTION = "Email me a summary of this every Monday at 8 in the morning.";
|
|
21809
21899
|
function SubscriptionsPanel({ tableId, activeRuleId, className }) {
|
|
21810
|
-
const client =
|
|
21900
|
+
const client = useRecordsClient46();
|
|
21811
21901
|
const [rows, setRows] = useState61(null);
|
|
21812
21902
|
const [error, setError] = useState61(null);
|
|
21813
21903
|
const [busy, setBusy] = useState61(null);
|
|
@@ -21824,7 +21914,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
|
|
|
21824
21914
|
setError(null);
|
|
21825
21915
|
setRows(answered.data);
|
|
21826
21916
|
}, [client, tableId]);
|
|
21827
|
-
|
|
21917
|
+
useEffect50(() => {
|
|
21828
21918
|
void load();
|
|
21829
21919
|
}, [load]);
|
|
21830
21920
|
const flip = useCallback34(
|
|
@@ -22000,17 +22090,17 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
|
|
|
22000
22090
|
}
|
|
22001
22091
|
|
|
22002
22092
|
// src/FormBuilder.tsx
|
|
22003
|
-
import { useCallback as useCallback37, useEffect as
|
|
22004
|
-
import { useFields as useFields19, useRecordsClient as
|
|
22093
|
+
import { useCallback as useCallback37, useEffect as useEffect54, useMemo as useMemo40, useState as useState65 } from "react";
|
|
22094
|
+
import { useFields as useFields19, useRecordsClient as useRecordsClient49, useTable as useTable16 } from "@ai-matrx/records/react";
|
|
22005
22095
|
|
|
22006
22096
|
// src/publish-gate.ts
|
|
22007
|
-
import { useEffect as
|
|
22008
|
-
import { useRecordsClient as
|
|
22097
|
+
import { useEffect as useEffect51, useState as useState62 } from "react";
|
|
22098
|
+
import { useRecordsClient as useRecordsClient47 } from "@ai-matrx/records/react";
|
|
22009
22099
|
var PUBLISH_NEEDS_THE_STORE_ON = "This organization has its record store switched off, so publishing would hand you a link that opens nothing. An owner or an administrator turns it on under Database settings, on the unified data screen \u2014 everything you have already built here is kept and starts working the moment they do.";
|
|
22010
22100
|
function usePublishGate() {
|
|
22011
|
-
const client =
|
|
22101
|
+
const client = useRecordsClient47();
|
|
22012
22102
|
const [storeOpen, setStoreOpen] = useState62(null);
|
|
22013
|
-
|
|
22103
|
+
useEffect51(() => {
|
|
22014
22104
|
let alive = true;
|
|
22015
22105
|
void (async () => {
|
|
22016
22106
|
const answered = await client.storeIsOpen();
|
|
@@ -22031,7 +22121,7 @@ function usePublishGate() {
|
|
|
22031
22121
|
// src/FormBuilder.tsx
|
|
22032
22122
|
import { publicFormPath } from "@ai-matrx/records";
|
|
22033
22123
|
import {
|
|
22034
|
-
BasicInput as
|
|
22124
|
+
BasicInput as BasicInput21,
|
|
22035
22125
|
BasicTextarea as BasicTextarea10,
|
|
22036
22126
|
Button as Button58,
|
|
22037
22127
|
Checkbox as Checkbox11,
|
|
@@ -22041,7 +22131,7 @@ import {
|
|
|
22041
22131
|
} from "@ai-matrx/design-system";
|
|
22042
22132
|
|
|
22043
22133
|
// src/FormRunner.tsx
|
|
22044
|
-
import { useCallback as useCallback35, useEffect as
|
|
22134
|
+
import { useCallback as useCallback35, useEffect as useEffect52, useMemo as useMemo39, useRef as useRef22, useState as useState63 } from "react";
|
|
22045
22135
|
import { useFields as useFields18, useOptionalRecordsClient as useOptionalRecordsClient6 } from "@ai-matrx/records/react";
|
|
22046
22136
|
import { Button as Button56, Progress, Skeleton as Skeleton21, cn as cn49 } from "@ai-matrx/design-system";
|
|
22047
22137
|
import { Fragment as Fragment29, jsx as jsx74, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
@@ -22141,8 +22231,8 @@ function FormStage({
|
|
|
22141
22231
|
const [writing, setWriting] = useState63(false);
|
|
22142
22232
|
const [done, setDone] = useState63(null);
|
|
22143
22233
|
const [hidden, setHidden] = useState63({});
|
|
22144
|
-
const decoy =
|
|
22145
|
-
const stage =
|
|
22234
|
+
const decoy = useRef22("");
|
|
22235
|
+
const stage = useRef22(null);
|
|
22146
22236
|
const questions = useMemo39(() => {
|
|
22147
22237
|
const byKey = new Map((fields ?? []).map((f) => [f.key, f]));
|
|
22148
22238
|
return (form.questions ?? []).map((q) => {
|
|
@@ -22157,7 +22247,7 @@ function FormStage({
|
|
|
22157
22247
|
};
|
|
22158
22248
|
});
|
|
22159
22249
|
}, [fields, form.questions]);
|
|
22160
|
-
|
|
22250
|
+
useEffect52(() => {
|
|
22161
22251
|
if (!whichAsked) return;
|
|
22162
22252
|
if (!questions.some((q) => q.showIf)) return;
|
|
22163
22253
|
let cancelled = false;
|
|
@@ -22200,19 +22290,19 @@ function FormStage({
|
|
|
22200
22290
|
};
|
|
22201
22291
|
}, [whichAsked, questions, answers]);
|
|
22202
22292
|
const live = questions.filter((q) => !hidden[q.key]);
|
|
22203
|
-
const told =
|
|
22204
|
-
|
|
22293
|
+
const told = useRef22(answers);
|
|
22294
|
+
useEffect52(() => {
|
|
22205
22295
|
if (told.current === answers) return;
|
|
22206
22296
|
told.current = answers;
|
|
22207
22297
|
onAnswersChange?.(answers);
|
|
22208
22298
|
}, [answers, onAnswersChange]);
|
|
22209
|
-
const resumeAt =
|
|
22299
|
+
const resumeAt = useRef22(
|
|
22210
22300
|
resumed && initialAnswers && Object.keys(initialAnswers).length > 0 ? questions.find((q) => {
|
|
22211
22301
|
const v = initialAnswers[q.key];
|
|
22212
22302
|
return v === void 0 || v === null || v === "";
|
|
22213
22303
|
})?.key ?? null : null
|
|
22214
22304
|
);
|
|
22215
|
-
|
|
22305
|
+
useEffect52(() => {
|
|
22216
22306
|
const key = resumeAt.current;
|
|
22217
22307
|
if (!key) return;
|
|
22218
22308
|
const i = live.findIndex((q) => q.key === key);
|
|
@@ -22278,7 +22368,7 @@ function FormStage({
|
|
|
22278
22368
|
if (event.shiftKey) retreat();
|
|
22279
22369
|
else advance();
|
|
22280
22370
|
}
|
|
22281
|
-
|
|
22371
|
+
useEffect52(() => {
|
|
22282
22372
|
const input = stage.current?.querySelector(
|
|
22283
22373
|
"input:not([tabindex='-1']), textarea, select, [role='combobox']"
|
|
22284
22374
|
);
|
|
@@ -22389,7 +22479,7 @@ function ThankYou({ form, done, className }) {
|
|
|
22389
22479
|
const host = useRecordsUi();
|
|
22390
22480
|
const redirect = form.thankYou?.redirectUrl?.trim() || null;
|
|
22391
22481
|
const going = redirect !== null && done !== "preview";
|
|
22392
|
-
|
|
22482
|
+
useEffect52(() => {
|
|
22393
22483
|
if (!going || !redirect) return;
|
|
22394
22484
|
const timer = window.setTimeout(() => window.location.assign(redirect), REDIRECT_AFTER_MS);
|
|
22395
22485
|
return () => window.clearTimeout(timer);
|
|
@@ -22448,14 +22538,14 @@ function Question({
|
|
|
22448
22538
|
}
|
|
22449
22539
|
|
|
22450
22540
|
// src/NotifyRuleEditor.tsx
|
|
22451
|
-
import { useCallback as useCallback36, useEffect as
|
|
22452
|
-
import { useRecordsClient as
|
|
22541
|
+
import { useCallback as useCallback36, useEffect as useEffect53, useState as useState64 } from "react";
|
|
22542
|
+
import { useRecordsClient as useRecordsClient48, useTable as useTable15 } from "@ai-matrx/records/react";
|
|
22453
22543
|
import { Button as Button57, Skeleton as Skeleton22, cn as cn50 } from "@ai-matrx/design-system";
|
|
22454
22544
|
import { jsx as jsx75, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
22455
22545
|
var CADENCE_WORDS2 = SUBSCRIPTION_CADENCE_LABEL;
|
|
22456
22546
|
var CHANNEL_WORDS3 = SUBSCRIPTION_CHANNEL_LABEL;
|
|
22457
22547
|
function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className }) {
|
|
22458
|
-
const client =
|
|
22548
|
+
const client = useRecordsClient48();
|
|
22459
22549
|
const host = useRecordsUi();
|
|
22460
22550
|
const table = useTable15(tableId);
|
|
22461
22551
|
const rights = useTableRights(table.data);
|
|
@@ -22493,7 +22583,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
|
|
|
22493
22583
|
}
|
|
22494
22584
|
setViews(listed.data.map((v) => ({ id: v.view_id, name: v.name })));
|
|
22495
22585
|
}, [client, host, tableId]);
|
|
22496
|
-
|
|
22586
|
+
useEffect53(() => {
|
|
22497
22587
|
void load();
|
|
22498
22588
|
}, [load]);
|
|
22499
22589
|
const write = useCallback36(
|
|
@@ -22521,7 +22611,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
|
|
|
22521
22611
|
},
|
|
22522
22612
|
[client, tableId]
|
|
22523
22613
|
);
|
|
22524
|
-
|
|
22614
|
+
useEffect53(() => {
|
|
22525
22615
|
if (!subscriptions || !seed || seed.length === 0) return;
|
|
22526
22616
|
const missing = seed.filter((s) => !subscriptions.some((held) => held.name === s.name));
|
|
22527
22617
|
if (missing.length === 0) return;
|
|
@@ -22726,7 +22816,7 @@ function whyNotAskable(fields, hidden = []) {
|
|
|
22726
22816
|
// src/FormBuilder.tsx
|
|
22727
22817
|
import { Fragment as Fragment30, jsx as jsx76, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
22728
22818
|
function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
|
|
22729
|
-
const client =
|
|
22819
|
+
const client = useRecordsClient49();
|
|
22730
22820
|
const publishGate = usePublishGate();
|
|
22731
22821
|
const host = useRecordsUi();
|
|
22732
22822
|
const claimSeed = useSeedGuard();
|
|
@@ -22771,10 +22861,10 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
|
|
|
22771
22861
|
setError(null);
|
|
22772
22862
|
setForms(mine);
|
|
22773
22863
|
}, [client, tableId, seed, claimSeed]);
|
|
22774
|
-
|
|
22864
|
+
useEffect54(() => {
|
|
22775
22865
|
void load();
|
|
22776
22866
|
}, [load]);
|
|
22777
|
-
|
|
22867
|
+
useEffect54(() => {
|
|
22778
22868
|
if (!forms || forms.length === 0) return;
|
|
22779
22869
|
const chosen = forms.find((f) => f.id === (activeFormId ?? activeId)) ?? forms[0];
|
|
22780
22870
|
if (chosen.id !== activeId) setActiveId(chosen.id);
|
|
@@ -22941,7 +23031,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
|
|
|
22941
23031
|
/* @__PURE__ */ jsxs70("label", { className: "flex flex-col gap-1", children: [
|
|
22942
23032
|
/* @__PURE__ */ jsx76(Label15, { className: "text-xs font-medium", children: "Thank-you title" }),
|
|
22943
23033
|
/* @__PURE__ */ jsx76(
|
|
22944
|
-
|
|
23034
|
+
BasicInput21,
|
|
22945
23035
|
{
|
|
22946
23036
|
value: draft.thankYou?.title ?? "",
|
|
22947
23037
|
placeholder: "Thank you",
|
|
@@ -22952,7 +23042,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
|
|
|
22952
23042
|
/* @__PURE__ */ jsxs70("label", { className: "flex flex-col gap-1", children: [
|
|
22953
23043
|
/* @__PURE__ */ jsx76(Label15, { className: "text-xs font-medium", children: "Then go to (optional)" }),
|
|
22954
23044
|
/* @__PURE__ */ jsx76(
|
|
22955
|
-
|
|
23045
|
+
BasicInput21,
|
|
22956
23046
|
{
|
|
22957
23047
|
type: "url",
|
|
22958
23048
|
inputMode: "url",
|
|
@@ -22979,7 +23069,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
|
|
|
22979
23069
|
/* @__PURE__ */ jsxs70("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
22980
23070
|
/* @__PURE__ */ jsxs70("label", { className: "flex flex-col gap-1", children: [
|
|
22981
23071
|
/* @__PURE__ */ jsx76(Label15, { className: "text-xs font-medium", children: "Name" }),
|
|
22982
|
-
/* @__PURE__ */ jsx76(
|
|
23072
|
+
/* @__PURE__ */ jsx76(BasicInput21, { value: draft.name, onChange: (e) => patch({ name: e.target.value }) })
|
|
22983
23073
|
] }),
|
|
22984
23074
|
/* @__PURE__ */ jsxs70("label", { className: "flex flex-col gap-1", children: [
|
|
22985
23075
|
/* @__PURE__ */ jsx76(Label15, { className: "text-xs font-medium", children: "Flow" }),
|
|
@@ -23007,7 +23097,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
|
|
|
23007
23097
|
/* @__PURE__ */ jsxs70("label", { className: "flex flex-col gap-1", children: [
|
|
23008
23098
|
/* @__PURE__ */ jsx76(Label15, { className: "text-xs font-medium", children: "Submit button" }),
|
|
23009
23099
|
/* @__PURE__ */ jsx76(
|
|
23010
|
-
|
|
23100
|
+
BasicInput21,
|
|
23011
23101
|
{
|
|
23012
23102
|
value: draft.submitLabel ?? "",
|
|
23013
23103
|
placeholder: "Submit",
|
|
@@ -23048,7 +23138,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
|
|
|
23048
23138
|
] }),
|
|
23049
23139
|
asked && question ? /* @__PURE__ */ jsxs70("div", { className: "mt-1.5 grid grid-cols-2 gap-2 pl-6", children: [
|
|
23050
23140
|
/* @__PURE__ */ jsx76(
|
|
23051
|
-
|
|
23141
|
+
BasicInput21,
|
|
23052
23142
|
{
|
|
23053
23143
|
className: "h-8 text-xs",
|
|
23054
23144
|
placeholder: fieldName(field2),
|
|
@@ -23058,7 +23148,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
|
|
|
23058
23148
|
}
|
|
23059
23149
|
),
|
|
23060
23150
|
/* @__PURE__ */ jsx76(
|
|
23061
|
-
|
|
23151
|
+
BasicInput21,
|
|
23062
23152
|
{
|
|
23063
23153
|
className: "h-8 text-xs",
|
|
23064
23154
|
placeholder: "Help text",
|
|
@@ -23352,17 +23442,17 @@ function bucketWindow(groupKey, value) {
|
|
|
23352
23442
|
|
|
23353
23443
|
// src/chartFrame.tsx
|
|
23354
23444
|
import {
|
|
23355
|
-
useEffect as
|
|
23445
|
+
useEffect as useEffect55,
|
|
23356
23446
|
useId as useId2,
|
|
23357
|
-
useRef as
|
|
23447
|
+
useRef as useRef23,
|
|
23358
23448
|
useState as useState66
|
|
23359
23449
|
} from "react";
|
|
23360
23450
|
import { cn as cn52 } from "@ai-matrx/design-system";
|
|
23361
23451
|
import { jsx as jsx77, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
23362
23452
|
function useMeasuredWidth(fallback = 480) {
|
|
23363
|
-
const ref =
|
|
23453
|
+
const ref = useRef23(null);
|
|
23364
23454
|
const [width, setWidth] = useState66(fallback);
|
|
23365
|
-
|
|
23455
|
+
useEffect55(() => {
|
|
23366
23456
|
const node = ref.current;
|
|
23367
23457
|
if (!node) return;
|
|
23368
23458
|
const apply = () => {
|
|
@@ -23486,12 +23576,12 @@ function isSignatureField(field2) {
|
|
|
23486
23576
|
}
|
|
23487
23577
|
|
|
23488
23578
|
// src/DocTemplate.tsx
|
|
23489
|
-
import { useCallback as useCallback38, useEffect as
|
|
23490
|
-
import { useFields as useFields20, useRecordsClient as
|
|
23491
|
-
import { BasicInput as
|
|
23579
|
+
import { useCallback as useCallback38, useEffect as useEffect56, useState as useState67 } from "react";
|
|
23580
|
+
import { useFields as useFields20, useRecordsClient as useRecordsClient50, useTable as useTable17 } from "@ai-matrx/records/react";
|
|
23581
|
+
import { BasicInput as BasicInput22, BasicTextarea as BasicTextarea11, Button as Button59, Label as Label16, Skeleton as Skeleton24, cn as cn53 } from "@ai-matrx/design-system";
|
|
23492
23582
|
import { jsx as jsx78, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
23493
23583
|
function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, className }) {
|
|
23494
|
-
const client =
|
|
23584
|
+
const client = useRecordsClient50();
|
|
23495
23585
|
const claimSeed = useSeedGuard();
|
|
23496
23586
|
const table = useTable17(tableId);
|
|
23497
23587
|
const rights = useTableRights(table.data);
|
|
@@ -23534,10 +23624,10 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
23534
23624
|
setError(null);
|
|
23535
23625
|
setTemplates(rows);
|
|
23536
23626
|
}, [client, tableId, seed, fields.data]);
|
|
23537
|
-
|
|
23627
|
+
useEffect56(() => {
|
|
23538
23628
|
void load();
|
|
23539
23629
|
}, [load]);
|
|
23540
|
-
|
|
23630
|
+
useEffect56(() => {
|
|
23541
23631
|
if (!templates || templates.length === 0) return;
|
|
23542
23632
|
const chosen = templates.find((t) => t.id === (activeTemplateId ?? activeId)) ?? templates[0];
|
|
23543
23633
|
if (chosen.id !== activeId) setActiveId(chosen.id);
|
|
@@ -23545,7 +23635,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
23545
23635
|
setDraftBody(chosen.body);
|
|
23546
23636
|
onActiveTemplate?.(chosen);
|
|
23547
23637
|
}, [templates, activeTemplateId]);
|
|
23548
|
-
|
|
23638
|
+
useEffect56(() => {
|
|
23549
23639
|
let cancelled = false;
|
|
23550
23640
|
if (draftBody.trim() === "") {
|
|
23551
23641
|
setUnresolved([]);
|
|
@@ -23630,7 +23720,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
23630
23720
|
] }),
|
|
23631
23721
|
/* @__PURE__ */ jsxs72("label", { className: "flex flex-col gap-1", children: [
|
|
23632
23722
|
/* @__PURE__ */ jsx78(Label16, { className: "text-xs font-medium", children: "Name" }),
|
|
23633
|
-
/* @__PURE__ */ jsx78(
|
|
23723
|
+
/* @__PURE__ */ jsx78(BasicInput22, { value: draftName, onChange: (e) => setDraftName(e.target.value), placeholder: "Agreement" })
|
|
23634
23724
|
] }),
|
|
23635
23725
|
/* @__PURE__ */ jsxs72("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
23636
23726
|
/* @__PURE__ */ jsx78("span", { className: "text-xs text-muted-foreground", children: "Insert" }),
|
|
@@ -23670,18 +23760,18 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
23670
23760
|
}
|
|
23671
23761
|
|
|
23672
23762
|
// src/DocRender.tsx
|
|
23673
|
-
import { useCallback as useCallback39, useEffect as
|
|
23674
|
-
import { useRecordsClient as
|
|
23763
|
+
import { useCallback as useCallback39, useEffect as useEffect57, useRef as useRef24, useState as useState68 } from "react";
|
|
23764
|
+
import { useRecordsClient as useRecordsClient51 } from "@ai-matrx/records/react";
|
|
23675
23765
|
import { Button as Button60, Skeleton as Skeleton25, cn as cn54 } from "@ai-matrx/design-system";
|
|
23676
23766
|
import { jsx as jsx79, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
23677
23767
|
function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
23678
|
-
const client =
|
|
23768
|
+
const client = useRecordsClient51();
|
|
23679
23769
|
const [preview, setPreview] = useState68(null);
|
|
23680
23770
|
const [renders, setRenders] = useState68(null);
|
|
23681
23771
|
const [showing, setShowing] = useState68(null);
|
|
23682
23772
|
const [error, setError] = useState68(null);
|
|
23683
23773
|
const [busy, setBusy] = useState68(null);
|
|
23684
|
-
const paper =
|
|
23774
|
+
const paper = useRef24(null);
|
|
23685
23775
|
const load = useCallback39(async () => {
|
|
23686
23776
|
const [body, held] = await Promise.all([
|
|
23687
23777
|
client.docRenderBody({ template_id: templateId, record_id: recordId }),
|
|
@@ -23699,7 +23789,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
23699
23789
|
setPreview(body.data);
|
|
23700
23790
|
setRenders(held.data.filter((r) => r.template_id === templateId));
|
|
23701
23791
|
}, [client, templateId, recordId]);
|
|
23702
|
-
|
|
23792
|
+
useEffect57(() => {
|
|
23703
23793
|
void load();
|
|
23704
23794
|
}, [load]);
|
|
23705
23795
|
async function freeze() {
|
|
@@ -23783,13 +23873,13 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
23783
23873
|
}
|
|
23784
23874
|
|
|
23785
23875
|
// src/SignBlock.tsx
|
|
23786
|
-
import { useCallback as useCallback40, useEffect as
|
|
23787
|
-
import { useFields as useFields21, useRecordsClient as
|
|
23788
|
-
import { BasicInput as
|
|
23876
|
+
import { useCallback as useCallback40, useEffect as useEffect58, useState as useState69 } from "react";
|
|
23877
|
+
import { useFields as useFields21, useRecordsClient as useRecordsClient52 } from "@ai-matrx/records/react";
|
|
23878
|
+
import { BasicInput as BasicInput23, Button as Button61, Skeleton as Skeleton26, cn as cn55 } from "@ai-matrx/design-system";
|
|
23789
23879
|
import { useTable as useTable18 } from "@ai-matrx/records/react";
|
|
23790
23880
|
import { jsx as jsx80, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
23791
23881
|
function SignBlock({ tableId, recordId, render, className }) {
|
|
23792
|
-
const client =
|
|
23882
|
+
const client = useRecordsClient52();
|
|
23793
23883
|
const table = useTable18(tableId);
|
|
23794
23884
|
const rights = useTableRights(table.data);
|
|
23795
23885
|
const fields = useFields21(tableId);
|
|
@@ -23813,7 +23903,7 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
23813
23903
|
}
|
|
23814
23904
|
setVerdicts(answers);
|
|
23815
23905
|
}, [client, recordId]);
|
|
23816
|
-
|
|
23906
|
+
useEffect58(() => {
|
|
23817
23907
|
void load();
|
|
23818
23908
|
}, [load]);
|
|
23819
23909
|
async function sign(field2) {
|
|
@@ -23908,7 +23998,7 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
23908
23998
|
},
|
|
23909
23999
|
children: [
|
|
23910
24000
|
/* @__PURE__ */ jsx80(
|
|
23911
|
-
|
|
24001
|
+
BasicInput23,
|
|
23912
24002
|
{
|
|
23913
24003
|
className: "h-8 w-56 text-xs",
|
|
23914
24004
|
"aria-label": `Sign ${fieldName(field2)}`,
|
|
@@ -24378,22 +24468,22 @@ function Drawing({
|
|
|
24378
24468
|
}
|
|
24379
24469
|
|
|
24380
24470
|
// src/DashboardCanvas.tsx
|
|
24381
|
-
import { useCallback as useCallback41, useEffect as
|
|
24382
|
-
import { useFields as useFields22, useRecordsClient as
|
|
24471
|
+
import { useCallback as useCallback41, useEffect as useEffect59, useMemo as useMemo42, useState as useState70 } from "react";
|
|
24472
|
+
import { useFields as useFields22, useRecordsClient as useRecordsClient53, useTable as useTable19 } from "@ai-matrx/records/react";
|
|
24383
24473
|
import {
|
|
24384
|
-
BasicInput as
|
|
24474
|
+
BasicInput as BasicInput24,
|
|
24385
24475
|
Button as Button62,
|
|
24386
|
-
Select as
|
|
24387
|
-
SelectContent as
|
|
24388
|
-
SelectItem as
|
|
24389
|
-
SelectTrigger as
|
|
24390
|
-
SelectValue as
|
|
24476
|
+
Select as Select7,
|
|
24477
|
+
SelectContent as SelectContent7,
|
|
24478
|
+
SelectItem as SelectItem7,
|
|
24479
|
+
SelectTrigger as SelectTrigger7,
|
|
24480
|
+
SelectValue as SelectValue7,
|
|
24391
24481
|
Skeleton as Skeleton27,
|
|
24392
24482
|
cn as cn57
|
|
24393
24483
|
} from "@ai-matrx/design-system";
|
|
24394
24484
|
import { Fragment as Fragment32, jsx as jsx82, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
24395
24485
|
function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
|
|
24396
|
-
const client =
|
|
24486
|
+
const client = useRecordsClient53();
|
|
24397
24487
|
const host = useRecordsUi();
|
|
24398
24488
|
const table = useTable19(tableId);
|
|
24399
24489
|
const rights = useTableRights(table.data);
|
|
@@ -24425,17 +24515,17 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
|
|
|
24425
24515
|
return read;
|
|
24426
24516
|
}, [client, tableId]);
|
|
24427
24517
|
const [notKept, setNotKept] = useState70(null);
|
|
24428
|
-
|
|
24518
|
+
useEffect59(() => {
|
|
24429
24519
|
void load();
|
|
24430
24520
|
}, [load]);
|
|
24431
|
-
|
|
24521
|
+
useEffect59(() => {
|
|
24432
24522
|
if (!boards || boards.length === 0) return;
|
|
24433
24523
|
const chosen = boards.find((d) => d.id === (activeDashboardId ?? activeId)) ?? boards[0];
|
|
24434
24524
|
if (chosen.id !== activeId) setActiveId(chosen.id);
|
|
24435
24525
|
}, [boards, activeDashboardId]);
|
|
24436
24526
|
const board = useMemo42(() => boards?.find((d) => d.id === activeId) ?? null, [boards, activeId]);
|
|
24437
24527
|
const filterKey = JSON.stringify(filter ?? {});
|
|
24438
|
-
|
|
24528
|
+
useEffect59(() => {
|
|
24439
24529
|
if (!activeId) {
|
|
24440
24530
|
setRun(null);
|
|
24441
24531
|
return;
|
|
@@ -24566,15 +24656,15 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
|
|
|
24566
24656
|
rights.admin ? /* @__PURE__ */ jsx82(Button62, { size: "sm", variant: "ghost", onClick: () => void create(), children: "New dashboard" }) : null,
|
|
24567
24657
|
board ? /* @__PURE__ */ jsxs76("span", { className: "ml-auto flex items-center gap-1", children: [
|
|
24568
24658
|
(board.blocks ?? []).some((b) => !!b.bucket) ? /* @__PURE__ */ jsxs76(
|
|
24569
|
-
|
|
24659
|
+
Select7,
|
|
24570
24660
|
{
|
|
24571
24661
|
value: grain ?? "saved",
|
|
24572
24662
|
onValueChange: (v) => setGrain(v === "saved" ? null : v),
|
|
24573
24663
|
children: [
|
|
24574
|
-
/* @__PURE__ */ jsx82(
|
|
24575
|
-
/* @__PURE__ */ jsxs76(
|
|
24576
|
-
/* @__PURE__ */ jsx82(
|
|
24577
|
-
Object.keys(GRAIN_LABEL).map((g) => /* @__PURE__ */ jsxs76(
|
|
24664
|
+
/* @__PURE__ */ jsx82(SelectTrigger7, { size: "sm", "aria-label": "Date grain for every chart on this dashboard", className: "h-7 min-w-[8rem] text-xs", children: /* @__PURE__ */ jsx82(SelectValue7, {}) }),
|
|
24665
|
+
/* @__PURE__ */ jsxs76(SelectContent7, { children: [
|
|
24666
|
+
/* @__PURE__ */ jsx82(SelectItem7, { value: "saved", children: "By the saved grain" }),
|
|
24667
|
+
Object.keys(GRAIN_LABEL).map((g) => /* @__PURE__ */ jsxs76(SelectItem7, { value: g, children: [
|
|
24578
24668
|
"By ",
|
|
24579
24669
|
GRAIN_LABEL[g].toLowerCase()
|
|
24580
24670
|
] }, g))
|
|
@@ -24626,7 +24716,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
|
|
|
24626
24716
|
board ? /* @__PURE__ */ jsxs76("div", { className: "flex flex-col gap-1", children: [
|
|
24627
24717
|
/* @__PURE__ */ jsxs76("div", { className: "flex items-center gap-1", children: [
|
|
24628
24718
|
/* @__PURE__ */ jsx82(
|
|
24629
|
-
|
|
24719
|
+
BasicInput24,
|
|
24630
24720
|
{
|
|
24631
24721
|
value: question,
|
|
24632
24722
|
"aria-label": "Ask for a change to this dashboard",
|
|
@@ -24752,18 +24842,18 @@ function GroupingPicker({
|
|
|
24752
24842
|
const known = choices.some((c) => c.field.key === current);
|
|
24753
24843
|
return /* @__PURE__ */ jsxs76(Fragment32, { children: [
|
|
24754
24844
|
/* @__PURE__ */ jsx82("label", { className: "text-muted-foreground", htmlFor: `block-group-${block.title}`, children: "Group by" }),
|
|
24755
|
-
/* @__PURE__ */ jsxs76(
|
|
24845
|
+
/* @__PURE__ */ jsxs76(Select7, { value: known ? current : "", onValueChange: onPick, children: [
|
|
24756
24846
|
/* @__PURE__ */ jsx82(
|
|
24757
|
-
|
|
24847
|
+
SelectTrigger7,
|
|
24758
24848
|
{
|
|
24759
24849
|
size: "sm",
|
|
24760
24850
|
id: `block-group-${block.title}`,
|
|
24761
24851
|
"aria-label": `Which column ${block.title} is grouped by`,
|
|
24762
24852
|
className: "h-7 min-w-[10rem] text-xs",
|
|
24763
|
-
children: /* @__PURE__ */ jsx82(
|
|
24853
|
+
children: /* @__PURE__ */ jsx82(SelectValue7, { placeholder: "Choose a column" })
|
|
24764
24854
|
}
|
|
24765
24855
|
),
|
|
24766
|
-
/* @__PURE__ */ jsx82(
|
|
24856
|
+
/* @__PURE__ */ jsx82(SelectContent7, { children: choices.map(({ field: field2, unusual }) => /* @__PURE__ */ jsx82(SelectItem7, { value: field2.key, children: unusual ? `${fieldName(field2)} \u2014 ${UNUSUAL_FIELD_NOTE}` : fieldName(field2) }, field2.key)) })
|
|
24767
24857
|
] }),
|
|
24768
24858
|
known ? null : /* @__PURE__ */ jsx82("span", { className: "text-muted-foreground", children: "The column this block was grouped by is no longer on this table \u2014 choose another." })
|
|
24769
24859
|
] });
|
|
@@ -24849,7 +24939,7 @@ function CompareControl({
|
|
|
24849
24939
|
);
|
|
24850
24940
|
return /* @__PURE__ */ jsxs76(Fragment32, { children: [
|
|
24851
24941
|
/* @__PURE__ */ jsxs76(
|
|
24852
|
-
|
|
24942
|
+
Select7,
|
|
24853
24943
|
{
|
|
24854
24944
|
value: current ?? "none",
|
|
24855
24945
|
onValueChange: (v) => {
|
|
@@ -24863,22 +24953,22 @@ function CompareControl({
|
|
|
24863
24953
|
});
|
|
24864
24954
|
},
|
|
24865
24955
|
children: [
|
|
24866
|
-
/* @__PURE__ */ jsx82(
|
|
24867
|
-
/* @__PURE__ */ jsxs76(
|
|
24868
|
-
/* @__PURE__ */ jsx82(
|
|
24869
|
-
kinds.map((k) => /* @__PURE__ */ jsx82(
|
|
24956
|
+
/* @__PURE__ */ jsx82(SelectTrigger7, { size: "sm", "aria-label": `What ${block.title} is compared with`, className: "h-7 w-auto min-w-[9rem] text-xs", children: /* @__PURE__ */ jsx82(SelectValue7, {}) }),
|
|
24957
|
+
/* @__PURE__ */ jsxs76(SelectContent7, { children: [
|
|
24958
|
+
/* @__PURE__ */ jsx82(SelectItem7, { value: "none", children: "No comparison" }),
|
|
24959
|
+
kinds.map((k) => /* @__PURE__ */ jsx82(SelectItem7, { value: k, children: COMPARE_LABEL[k] }, k))
|
|
24870
24960
|
] })
|
|
24871
24961
|
]
|
|
24872
24962
|
}
|
|
24873
24963
|
),
|
|
24874
24964
|
current && !explicitWindow ? /* @__PURE__ */ jsxs76(
|
|
24875
|
-
|
|
24965
|
+
Select7,
|
|
24876
24966
|
{
|
|
24877
24967
|
value: period,
|
|
24878
24968
|
onValueChange: (v) => onChange({ ...block.compare ?? { against: current, key }, period: v }),
|
|
24879
24969
|
children: [
|
|
24880
|
-
/* @__PURE__ */ jsx82(
|
|
24881
|
-
/* @__PURE__ */ jsx82(
|
|
24970
|
+
/* @__PURE__ */ jsx82(SelectTrigger7, { size: "sm", "aria-label": `Which period ${block.title} shows`, className: "h-7 w-auto min-w-[7rem] text-xs", children: /* @__PURE__ */ jsx82(SelectValue7, {}) }),
|
|
24971
|
+
/* @__PURE__ */ jsx82(SelectContent7, { children: Object.keys(GRAIN_LABEL).map((g) => /* @__PURE__ */ jsxs76(SelectItem7, { value: g, children: [
|
|
24882
24972
|
"This ",
|
|
24883
24973
|
GRAIN_LABEL[g].toLowerCase()
|
|
24884
24974
|
] }, g)) })
|
|
@@ -24896,7 +24986,7 @@ function TargetControl({
|
|
|
24896
24986
|
const [mode, setMode] = useState70(saved);
|
|
24897
24987
|
const savedValue = block.target && "value" in block.target && typeof block.target.value === "number" ? block.target.value : null;
|
|
24898
24988
|
const [draft, setDraft] = useState70(savedValue === null ? "" : String(savedValue));
|
|
24899
|
-
|
|
24989
|
+
useEffect59(() => {
|
|
24900
24990
|
setMode(saved);
|
|
24901
24991
|
setDraft(savedValue === null ? "" : String(savedValue));
|
|
24902
24992
|
}, [saved, savedValue]);
|
|
@@ -24911,7 +25001,7 @@ function TargetControl({
|
|
|
24911
25001
|
}
|
|
24912
25002
|
return /* @__PURE__ */ jsxs76(Fragment32, { children: [
|
|
24913
25003
|
/* @__PURE__ */ jsxs76(
|
|
24914
|
-
|
|
25004
|
+
Select7,
|
|
24915
25005
|
{
|
|
24916
25006
|
value: mode,
|
|
24917
25007
|
onValueChange: (v) => {
|
|
@@ -24920,17 +25010,17 @@ function TargetControl({
|
|
|
24920
25010
|
if (next === "none" && saved !== "none") onChange(null);
|
|
24921
25011
|
},
|
|
24922
25012
|
children: [
|
|
24923
|
-
/* @__PURE__ */ jsx82(
|
|
24924
|
-
/* @__PURE__ */ jsxs76(
|
|
24925
|
-
/* @__PURE__ */ jsx82(
|
|
24926
|
-
/* @__PURE__ */ jsx82(
|
|
24927
|
-
columns.length > 0 ? /* @__PURE__ */ jsx82(
|
|
25013
|
+
/* @__PURE__ */ jsx82(SelectTrigger7, { size: "sm", "aria-label": `The target ${block.title} aims for`, className: "h-7 w-auto min-w-[8rem] text-xs", children: /* @__PURE__ */ jsx82(SelectValue7, {}) }),
|
|
25014
|
+
/* @__PURE__ */ jsxs76(SelectContent7, { children: [
|
|
25015
|
+
/* @__PURE__ */ jsx82(SelectItem7, { value: "none", children: "No target" }),
|
|
25016
|
+
/* @__PURE__ */ jsx82(SelectItem7, { value: "value", children: "A target number" }),
|
|
25017
|
+
columns.length > 0 ? /* @__PURE__ */ jsx82(SelectItem7, { value: "field", children: "A goal column" }) : null
|
|
24928
25018
|
] })
|
|
24929
25019
|
]
|
|
24930
25020
|
}
|
|
24931
25021
|
),
|
|
24932
25022
|
mode === "value" ? /* @__PURE__ */ jsx82(
|
|
24933
|
-
|
|
25023
|
+
BasicInput24,
|
|
24934
25024
|
{
|
|
24935
25025
|
inputMode: "decimal",
|
|
24936
25026
|
value: draft,
|
|
@@ -24945,7 +25035,7 @@ function TargetControl({
|
|
|
24945
25035
|
}
|
|
24946
25036
|
) : null,
|
|
24947
25037
|
mode === "field" ? /* @__PURE__ */ jsxs76(
|
|
24948
|
-
|
|
25038
|
+
Select7,
|
|
24949
25039
|
{
|
|
24950
25040
|
value: block.target && "field" in block.target && block.target.field ? block.target.field : "",
|
|
24951
25041
|
onValueChange: (key) => {
|
|
@@ -24954,8 +25044,8 @@ function TargetControl({
|
|
|
24954
25044
|
onChange({ field: key, op: "sum", label: fieldName(picked) });
|
|
24955
25045
|
},
|
|
24956
25046
|
children: [
|
|
24957
|
-
/* @__PURE__ */ jsx82(
|
|
24958
|
-
/* @__PURE__ */ jsx82(
|
|
25047
|
+
/* @__PURE__ */ jsx82(SelectTrigger7, { size: "sm", "aria-label": `Which column holds the goal for ${block.title}`, className: "h-7 w-auto min-w-[9rem] text-xs", children: /* @__PURE__ */ jsx82(SelectValue7, { placeholder: "Choose a column" }) }),
|
|
25048
|
+
/* @__PURE__ */ jsx82(SelectContent7, { children: columns.map((f) => /* @__PURE__ */ jsx82(SelectItem7, { value: f.key, children: fieldName(f) }, f.key)) })
|
|
24959
25049
|
]
|
|
24960
25050
|
}
|
|
24961
25051
|
) : null
|
|
@@ -24963,8 +25053,8 @@ function TargetControl({
|
|
|
24963
25053
|
}
|
|
24964
25054
|
|
|
24965
25055
|
// src/FormsPanel.tsx
|
|
24966
|
-
import { useCallback as useCallback42, useEffect as
|
|
24967
|
-
import { useRecordsClient as
|
|
25056
|
+
import { useCallback as useCallback42, useEffect as useEffect60, useState as useState71 } from "react";
|
|
25057
|
+
import { useRecordsClient as useRecordsClient54, useTable as useTable20 } from "@ai-matrx/records/react";
|
|
24968
25058
|
import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
|
|
24969
25059
|
import { Badge as Badge20, Button as Button63, Skeleton as Skeleton28, cn as cn58 } from "@ai-matrx/design-system";
|
|
24970
25060
|
import { Fragment as Fragment33, jsx as jsx83, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
@@ -24976,7 +25066,7 @@ function formSuggestion(tableName2) {
|
|
|
24976
25066
|
return `Make me a form that collects new ${subject} entries and tells me when somebody answers.`;
|
|
24977
25067
|
}
|
|
24978
25068
|
function FormsPanel({ tableId, activeFormId, className }) {
|
|
24979
|
-
const client =
|
|
25069
|
+
const client = useRecordsClient54();
|
|
24980
25070
|
const publishGate = usePublishGate();
|
|
24981
25071
|
const host = useRecordsUi();
|
|
24982
25072
|
const table = useTable20(tableId);
|
|
@@ -24988,7 +25078,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
24988
25078
|
const [building, setBuilding] = useState71(false);
|
|
24989
25079
|
const linked = activeFormId && forms !== null ? forms.find((f) => f.form_id === activeFormId) ?? null : null;
|
|
24990
25080
|
const linkedMissing = Boolean(activeFormId) && forms !== null && linked === null;
|
|
24991
|
-
|
|
25081
|
+
useEffect60(() => {
|
|
24992
25082
|
if (linked && rights.structure) setBuilding(true);
|
|
24993
25083
|
}, [linked, rights.structure]);
|
|
24994
25084
|
const load = useCallback42(async () => {
|
|
@@ -25001,7 +25091,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
25001
25091
|
setError(null);
|
|
25002
25092
|
setForms(answered.data);
|
|
25003
25093
|
}, [client, tableId]);
|
|
25004
|
-
|
|
25094
|
+
useEffect60(() => {
|
|
25005
25095
|
void load();
|
|
25006
25096
|
}, [load]);
|
|
25007
25097
|
const toggle = useCallback42(
|
|
@@ -25132,12 +25222,12 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
25132
25222
|
}
|
|
25133
25223
|
|
|
25134
25224
|
// src/BookingBuilder.tsx
|
|
25135
|
-
import { useCallback as useCallback43, useEffect as
|
|
25136
|
-
import { useFields as useFields23, useRecordsClient as
|
|
25225
|
+
import { useCallback as useCallback43, useEffect as useEffect61, useMemo as useMemo43, useState as useState72 } from "react";
|
|
25226
|
+
import { useFields as useFields23, useRecordsClient as useRecordsClient55, useTable as useTable21 } from "@ai-matrx/records/react";
|
|
25137
25227
|
import {
|
|
25138
25228
|
bookingPath
|
|
25139
25229
|
} from "@ai-matrx/records";
|
|
25140
|
-
import { BasicInput as
|
|
25230
|
+
import { BasicInput as BasicInput25, BasicTextarea as BasicTextarea12, Button as Button64, Checkbox as Checkbox12, Label as Label17, Skeleton as Skeleton29, cn as cn59 } from "@ai-matrx/design-system";
|
|
25141
25231
|
import { Fragment as Fragment34, jsx as jsx84, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
25142
25232
|
var STORE_ANSWERS_THESE = ["slot", "status", "booked_with"];
|
|
25143
25233
|
var DAYS = [
|
|
@@ -25163,7 +25253,7 @@ function draftWindows(availability) {
|
|
|
25163
25253
|
});
|
|
25164
25254
|
}
|
|
25165
25255
|
function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
25166
|
-
const client =
|
|
25256
|
+
const client = useRecordsClient55();
|
|
25167
25257
|
const publishGate = usePublishGate();
|
|
25168
25258
|
const host = useRecordsUi();
|
|
25169
25259
|
const table = useTable21(tableId);
|
|
@@ -25207,18 +25297,18 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
|
25207
25297
|
setLoaded(true);
|
|
25208
25298
|
if (mine) setFormId(mine.form_id);
|
|
25209
25299
|
}, [client, tableId, bookingId]);
|
|
25210
|
-
|
|
25300
|
+
useEffect61(() => {
|
|
25211
25301
|
void load();
|
|
25212
25302
|
}, [load]);
|
|
25213
|
-
|
|
25303
|
+
useEffect61(() => {
|
|
25214
25304
|
if (title !== "" || !table.data) return;
|
|
25215
25305
|
setTitle(existing?.title ?? `Book a ${minutes}-minute ${table.data.name} appointment`);
|
|
25216
25306
|
}, [table.data, existing]);
|
|
25217
|
-
|
|
25307
|
+
useEffect61(() => {
|
|
25218
25308
|
if (!existing) return;
|
|
25219
25309
|
setMinutes(existing.slot_minutes);
|
|
25220
25310
|
}, [existing]);
|
|
25221
|
-
|
|
25311
|
+
useEffect61(() => {
|
|
25222
25312
|
if (!offer) return;
|
|
25223
25313
|
setWindows(draftWindows(offer));
|
|
25224
25314
|
setMinutes(offer.slot_minutes);
|
|
@@ -25296,7 +25386,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
|
25296
25386
|
error ? /* @__PURE__ */ jsx84(RefusalNotice, { error }) : null,
|
|
25297
25387
|
/* @__PURE__ */ jsxs78("label", { className: "flex flex-col gap-1", children: [
|
|
25298
25388
|
/* @__PURE__ */ jsx84(Label17, { className: "text-xs font-medium", children: "What it is called" }),
|
|
25299
|
-
/* @__PURE__ */ jsx84(
|
|
25389
|
+
/* @__PURE__ */ jsx84(BasicInput25, { value: title, onChange: (e) => setTitle(e.target.value) })
|
|
25300
25390
|
] }),
|
|
25301
25391
|
/* @__PURE__ */ jsxs78("div", { className: "grid grid-cols-1 gap-2 @md:grid-cols-2", children: [
|
|
25302
25392
|
/* @__PURE__ */ jsxs78("label", { className: "flex flex-col gap-1", children: [
|
|
@@ -25341,7 +25431,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
|
25341
25431
|
/* @__PURE__ */ jsxs78("label", { className: "flex flex-col gap-1", children: [
|
|
25342
25432
|
/* @__PURE__ */ jsx84(Label17, { className: "text-xs font-medium", children: "Most in one day" }),
|
|
25343
25433
|
/* @__PURE__ */ jsx84(
|
|
25344
|
-
|
|
25434
|
+
BasicInput25,
|
|
25345
25435
|
{
|
|
25346
25436
|
type: "number",
|
|
25347
25437
|
min: 1,
|
|
@@ -25381,7 +25471,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
|
25381
25471
|
] }),
|
|
25382
25472
|
w.on ? /* @__PURE__ */ jsxs78(Fragment34, { children: [
|
|
25383
25473
|
/* @__PURE__ */ jsx84(
|
|
25384
|
-
|
|
25474
|
+
BasicInput25,
|
|
25385
25475
|
{
|
|
25386
25476
|
type: "time",
|
|
25387
25477
|
className: "h-8 w-28",
|
|
@@ -25391,7 +25481,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
|
25391
25481
|
),
|
|
25392
25482
|
/* @__PURE__ */ jsx84("span", { className: "text-xs text-muted-foreground", children: "to" }),
|
|
25393
25483
|
/* @__PURE__ */ jsx84(
|
|
25394
|
-
|
|
25484
|
+
BasicInput25,
|
|
25395
25485
|
{
|
|
25396
25486
|
type: "time",
|
|
25397
25487
|
className: "h-8 w-28",
|
|
@@ -25480,8 +25570,8 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
|
25480
25570
|
}
|
|
25481
25571
|
|
|
25482
25572
|
// src/BookingSlots.tsx
|
|
25483
|
-
import { useCallback as useCallback44, useEffect as
|
|
25484
|
-
import { useRecordsClient as
|
|
25573
|
+
import { useCallback as useCallback44, useEffect as useEffect62, useMemo as useMemo44, useState as useState73 } from "react";
|
|
25574
|
+
import { useRecordsClient as useRecordsClient56, useMyLevels as useMyLevels2 } from "@ai-matrx/records/react";
|
|
25485
25575
|
import { bookingPath as bookingPath2 } from "@ai-matrx/records";
|
|
25486
25576
|
import { Badge as Badge21, Button as Button65, Skeleton as Skeleton30, cn as cn60 } from "@ai-matrx/design-system";
|
|
25487
25577
|
import { Fragment as Fragment35, jsx as jsx85, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
@@ -25494,7 +25584,7 @@ function bookingSuggestion(tableName2) {
|
|
|
25494
25584
|
var NO_ADMIN2 = "Opening a booking page lets people with no account take time in your calendar, so it needs the admin level on the table the appointments land in.";
|
|
25495
25585
|
var STATE_WORDS = BOOKING_PAGE_STATE_LABEL;
|
|
25496
25586
|
function BookingSlots({ tableId, activeBookingId, className }) {
|
|
25497
|
-
const client =
|
|
25587
|
+
const client = useRecordsClient56();
|
|
25498
25588
|
const host = useRecordsUi();
|
|
25499
25589
|
const [pages, setPages] = useState73(null);
|
|
25500
25590
|
const [error, setError] = useState73(null);
|
|
@@ -25512,7 +25602,7 @@ function BookingSlots({ tableId, activeBookingId, className }) {
|
|
|
25512
25602
|
setError(null);
|
|
25513
25603
|
setPages(answered.data);
|
|
25514
25604
|
}, [client, tableId]);
|
|
25515
|
-
|
|
25605
|
+
useEffect62(() => {
|
|
25516
25606
|
void load();
|
|
25517
25607
|
}, [load]);
|
|
25518
25608
|
const subjectIds = useMemo44(
|
|
@@ -25695,18 +25785,18 @@ function nextInWords(page) {
|
|
|
25695
25785
|
}
|
|
25696
25786
|
|
|
25697
25787
|
// src/CaptureSheet.tsx
|
|
25698
|
-
import { useCallback as useCallback46, useEffect as
|
|
25699
|
-
import { useFields as useFields24, useRecordsClient as
|
|
25788
|
+
import { useCallback as useCallback46, useEffect as useEffect64, useRef as useRef26, useState as useState75 } from "react";
|
|
25789
|
+
import { useFields as useFields24, useRecordsClient as useRecordsClient58, useTable as useTable22 } from "@ai-matrx/records/react";
|
|
25700
25790
|
import { Button as Button67, Input as Input4, Skeleton as Skeleton32, Textarea as Textarea3, cn as cn62 } from "@ai-matrx/design-system";
|
|
25701
25791
|
|
|
25702
25792
|
// src/CaptureRun.tsx
|
|
25703
|
-
import { useCallback as useCallback45, useEffect as
|
|
25793
|
+
import { useCallback as useCallback45, useEffect as useEffect63, useMemo as useMemo45, useRef as useRef25, useState as useState74 } from "react";
|
|
25704
25794
|
import {
|
|
25705
25795
|
coerceTypedAnswer as coerceTypedAnswer3,
|
|
25706
25796
|
coercionLabel,
|
|
25707
25797
|
openCaptureQueue
|
|
25708
25798
|
} from "@ai-matrx/records";
|
|
25709
|
-
import { useRecordsClient as
|
|
25799
|
+
import { useRecordsClient as useRecordsClient57 } from "@ai-matrx/records/react";
|
|
25710
25800
|
import { Button as Button66, Input as Input3, Skeleton as Skeleton31, Textarea as Textarea2, cn as cn61 } from "@ai-matrx/design-system";
|
|
25711
25801
|
import { jsx as jsx86, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
25712
25802
|
function controlFor(field2) {
|
|
@@ -25745,7 +25835,7 @@ function whereWeAre(timeoutMs = 4e3) {
|
|
|
25745
25835
|
});
|
|
25746
25836
|
}
|
|
25747
25837
|
function CaptureRun({ sheetId, face: given, className }) {
|
|
25748
|
-
const client =
|
|
25838
|
+
const client = useRecordsClient57();
|
|
25749
25839
|
const host = useRecordsUi();
|
|
25750
25840
|
const [face, setFace] = useState74(given);
|
|
25751
25841
|
const [loadFailed, setLoadFailed] = useState74(null);
|
|
@@ -25758,8 +25848,8 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
25758
25848
|
const [items, setItems] = useState74([]);
|
|
25759
25849
|
const [lastSynced, setLastSynced] = useState74(null);
|
|
25760
25850
|
const [sending, setSending] = useState74(false);
|
|
25761
|
-
const queueRef =
|
|
25762
|
-
|
|
25851
|
+
const queueRef = useRef25(null);
|
|
25852
|
+
useEffect63(() => {
|
|
25763
25853
|
const q2 = openCaptureQueue({
|
|
25764
25854
|
onChange: (c, all) => {
|
|
25765
25855
|
setCounts(c);
|
|
@@ -25797,7 +25887,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
25797
25887
|
void q2.sync().then(() => void q2.lastSyncedAt().then(setLastSynced));
|
|
25798
25888
|
return () => q2.dispose();
|
|
25799
25889
|
}, [client, host]);
|
|
25800
|
-
|
|
25890
|
+
useEffect63(() => {
|
|
25801
25891
|
if (given !== void 0) return;
|
|
25802
25892
|
let cancelled = false;
|
|
25803
25893
|
void client.captureOpen({ sheet_id: sheetId }).then((res) => {
|
|
@@ -26125,7 +26215,7 @@ function AdHocCaptureSheet({
|
|
|
26125
26215
|
attachmentField,
|
|
26126
26216
|
className
|
|
26127
26217
|
}) {
|
|
26128
|
-
const client =
|
|
26218
|
+
const client = useRecordsClient58();
|
|
26129
26219
|
const host = useRecordsUi();
|
|
26130
26220
|
const table = useTable22(tableId);
|
|
26131
26221
|
const fields = useFields24(tableId);
|
|
@@ -26138,7 +26228,7 @@ function AdHocCaptureSheet({
|
|
|
26138
26228
|
const [error, setError] = useState75(null);
|
|
26139
26229
|
const [uploadError, setUploadError] = useState75(null);
|
|
26140
26230
|
const [flushing, setFlushing] = useState75(false);
|
|
26141
|
-
const queue =
|
|
26231
|
+
const queue = useRef26([]);
|
|
26142
26232
|
const keep = useCallback46(
|
|
26143
26233
|
async (next) => {
|
|
26144
26234
|
queue.current = next;
|
|
@@ -26147,7 +26237,7 @@ function AdHocCaptureSheet({
|
|
|
26147
26237
|
},
|
|
26148
26238
|
[host]
|
|
26149
26239
|
);
|
|
26150
|
-
|
|
26240
|
+
useEffect64(() => {
|
|
26151
26241
|
let cancelled = false;
|
|
26152
26242
|
void (async () => {
|
|
26153
26243
|
const held = host.captureQueue ? await host.captureQueue.load() : [];
|
|
@@ -26326,12 +26416,12 @@ function AdHocCaptureSheet({
|
|
|
26326
26416
|
}
|
|
26327
26417
|
|
|
26328
26418
|
// src/PortalShell.tsx
|
|
26329
|
-
import { useCallback as useCallback47, useEffect as
|
|
26330
|
-
import { useRecordsClient as
|
|
26419
|
+
import { useCallback as useCallback47, useEffect as useEffect65, useState as useState76 } from "react";
|
|
26420
|
+
import { useRecordsClient as useRecordsClient59 } from "@ai-matrx/records/react";
|
|
26331
26421
|
import { Button as Button68, Skeleton as Skeleton33, cn as cn63 } from "@ai-matrx/design-system";
|
|
26332
26422
|
import { jsx as jsx88, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
26333
26423
|
function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
26334
|
-
const client =
|
|
26424
|
+
const client = useRecordsClient59();
|
|
26335
26425
|
const [card, setCard] = useState76(null);
|
|
26336
26426
|
const [reach, setReach] = useState76(null);
|
|
26337
26427
|
const [error, setError] = useState76(null);
|
|
@@ -26352,7 +26442,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
|
26352
26442
|
}
|
|
26353
26443
|
setReach(reached.data.map((row) => row.resource_id));
|
|
26354
26444
|
}, [client, resourceType]);
|
|
26355
|
-
|
|
26445
|
+
useEffect65(() => {
|
|
26356
26446
|
void load();
|
|
26357
26447
|
}, [load]);
|
|
26358
26448
|
if (error) {
|
|
@@ -26410,9 +26500,9 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
|
26410
26500
|
] });
|
|
26411
26501
|
}
|
|
26412
26502
|
function PortalRow({ tableId, recordId }) {
|
|
26413
|
-
const client =
|
|
26503
|
+
const client = useRecordsClient59();
|
|
26414
26504
|
const [title, setTitle] = useState76(null);
|
|
26415
|
-
|
|
26505
|
+
useEffect65(() => {
|
|
26416
26506
|
let cancelled = false;
|
|
26417
26507
|
void client.recordRead({ record_id: recordId }).then((answered) => {
|
|
26418
26508
|
if (cancelled) return;
|
|
@@ -26432,12 +26522,12 @@ function PortalRow({ tableId, recordId }) {
|
|
|
26432
26522
|
}
|
|
26433
26523
|
|
|
26434
26524
|
// src/PublicViewPage.tsx
|
|
26435
|
-
import { useCallback as useCallback48, useEffect as
|
|
26436
|
-
import { useRecordsClient as
|
|
26525
|
+
import { useCallback as useCallback48, useEffect as useEffect66, useState as useState77 } from "react";
|
|
26526
|
+
import { useRecordsClient as useRecordsClient60 } from "@ai-matrx/records/react";
|
|
26437
26527
|
import { Skeleton as Skeleton34, cn as cn64 } from "@ai-matrx/design-system";
|
|
26438
26528
|
import { jsx as jsx89, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
26439
26529
|
function PublicViewPage({ slug, className }) {
|
|
26440
|
-
const client =
|
|
26530
|
+
const client = useRecordsClient60();
|
|
26441
26531
|
const [binding, setBinding] = useState77(null);
|
|
26442
26532
|
const [rows, setRows] = useState77(null);
|
|
26443
26533
|
const [fields, setFields] = useState77(null);
|
|
@@ -26476,7 +26566,7 @@ function PublicViewPage({ slug, className }) {
|
|
|
26476
26566
|
}
|
|
26477
26567
|
setRows([{ id: found.resource_id, document: read.data.document, level: "viewer", hidden: read.data.hidden }]);
|
|
26478
26568
|
}, [client, slug]);
|
|
26479
|
-
|
|
26569
|
+
useEffect66(() => {
|
|
26480
26570
|
void load();
|
|
26481
26571
|
}, [load]);
|
|
26482
26572
|
if (error) return /* @__PURE__ */ jsx89(RefusalNotice, { error, className });
|
|
@@ -26513,8 +26603,8 @@ function PublicRow({ row, fields }) {
|
|
|
26513
26603
|
}
|
|
26514
26604
|
|
|
26515
26605
|
// src/EmbedFrame.tsx
|
|
26516
|
-
import { useCallback as useCallback49, useEffect as
|
|
26517
|
-
import { useRecordsClient as
|
|
26606
|
+
import { useCallback as useCallback49, useEffect as useEffect67, useState as useState78 } from "react";
|
|
26607
|
+
import { useRecordsClient as useRecordsClient61 } from "@ai-matrx/records/react";
|
|
26518
26608
|
import { Button as Button69, Input as Input5, Skeleton as Skeleton35, Textarea as Textarea4, cn as cn65 } from "@ai-matrx/design-system";
|
|
26519
26609
|
import { useTable as useTable23 } from "@ai-matrx/records/react";
|
|
26520
26610
|
import { Fragment as Fragment37, jsx as jsx90, jsxs as jsxs84 } from "react/jsx-runtime";
|
|
@@ -26526,7 +26616,7 @@ function EmbedFrame({
|
|
|
26526
26616
|
embedUrl,
|
|
26527
26617
|
className
|
|
26528
26618
|
}) {
|
|
26529
|
-
const client =
|
|
26619
|
+
const client = useRecordsClient61();
|
|
26530
26620
|
const host = useRecordsUi();
|
|
26531
26621
|
const table = useTable23(tableId);
|
|
26532
26622
|
const rights = useTableRights(table.data);
|
|
@@ -26620,13 +26710,13 @@ function EmbedFrame({
|
|
|
26620
26710
|
] });
|
|
26621
26711
|
}
|
|
26622
26712
|
function useEmbedHandshake(args) {
|
|
26623
|
-
const client =
|
|
26713
|
+
const client = useRecordsClient61();
|
|
26624
26714
|
const [binding, setBinding] = useState78(null);
|
|
26625
26715
|
const [error, setError] = useState78(null);
|
|
26626
26716
|
const [loading, setLoading] = useState78(true);
|
|
26627
26717
|
const origin = args.origin ?? (typeof location === "undefined" ? "" : location.origin);
|
|
26628
26718
|
const { secret, requiredMode } = args;
|
|
26629
|
-
|
|
26719
|
+
useEffect67(() => {
|
|
26630
26720
|
let cancelled = false;
|
|
26631
26721
|
setLoading(true);
|
|
26632
26722
|
setError(null);
|
|
@@ -26648,7 +26738,7 @@ function useEmbedHandshake(args) {
|
|
|
26648
26738
|
}
|
|
26649
26739
|
|
|
26650
26740
|
// src/RecordsMount.tsx
|
|
26651
|
-
import { useRef as
|
|
26741
|
+
import { useRef as useRef27 } from "react";
|
|
26652
26742
|
import { RecordsProvider } from "@ai-matrx/records/react";
|
|
26653
26743
|
import { jsx as jsx91 } from "react/jsx-runtime";
|
|
26654
26744
|
var STORE_DECIDES_REASON = "This host offers exactly what the record store says this person may do: the level comes back with the table on the read door, so a control they cannot use is never drawn in the first place.";
|
|
@@ -26666,7 +26756,7 @@ function RecordsMount({
|
|
|
26666
26756
|
return /* @__PURE__ */ jsx91(RecordsProvider, { config, children: /* @__PURE__ */ jsx91(RecordsUiProvider, { value: bound, children: /* @__PURE__ */ jsx91(RecordLabelProvider, { children }) }) });
|
|
26667
26757
|
}
|
|
26668
26758
|
function useShallowStableHost(host) {
|
|
26669
|
-
const held =
|
|
26759
|
+
const held = useRef27(null);
|
|
26670
26760
|
const next = host ?? {};
|
|
26671
26761
|
const previous = held.current;
|
|
26672
26762
|
if (previous !== null && sameParts(previous, next)) return previous;
|
|
@@ -26698,15 +26788,15 @@ function recordsDataSource(client, fallbackSchema = "custom") {
|
|
|
26698
26788
|
}
|
|
26699
26789
|
|
|
26700
26790
|
// src/TablesHome.tsx
|
|
26701
|
-
import { useCallback as useCallback50, useEffect as
|
|
26702
|
-
import { useRecordsClient as
|
|
26791
|
+
import { useCallback as useCallback50, useEffect as useEffect70, useState as useState81 } from "react";
|
|
26792
|
+
import { useRecordsClient as useRecordsClient64, useTables as useTables4 } from "@ai-matrx/records/react";
|
|
26703
26793
|
import { withTableFacts } from "@ai-matrx/records/core";
|
|
26704
26794
|
import { withTablePlacement } from "@ai-matrx/records";
|
|
26705
|
-
import { BasicInput as
|
|
26795
|
+
import { BasicInput as BasicInput26, Button as Button72, Skeleton as Skeleton37, cn as cn67 } from "@ai-matrx/design-system";
|
|
26706
26796
|
|
|
26707
26797
|
// src/ExampleTables.tsx
|
|
26708
|
-
import { useEffect as
|
|
26709
|
-
import { useRecordsClient as
|
|
26798
|
+
import { useEffect as useEffect68, useState as useState79 } from "react";
|
|
26799
|
+
import { useRecordsClient as useRecordsClient62 } from "@ai-matrx/records/react";
|
|
26710
26800
|
import { loadUseCase, summarize as summarize2, useCaseIds } from "@ai-matrx/records/use-cases";
|
|
26711
26801
|
import { Button as Button70, Skeleton as Skeleton36, cn as cn66 } from "@ai-matrx/design-system";
|
|
26712
26802
|
import { jsx as jsx92, jsxs as jsxs85 } from "react/jsx-runtime";
|
|
@@ -26715,12 +26805,12 @@ function ExampleTables({
|
|
|
26715
26805
|
onClose,
|
|
26716
26806
|
className
|
|
26717
26807
|
}) {
|
|
26718
|
-
const client =
|
|
26808
|
+
const client = useRecordsClient62();
|
|
26719
26809
|
const [summaries, setSummaries] = useState79(null);
|
|
26720
26810
|
const [busy, setBusy] = useState79(null);
|
|
26721
26811
|
const [error, setError] = useState79(null);
|
|
26722
26812
|
const [built, setBuilt] = useState79(null);
|
|
26723
|
-
|
|
26813
|
+
useEffect68(() => {
|
|
26724
26814
|
let alive = true;
|
|
26725
26815
|
void Promise.all(useCaseIds().map(async (id) => summarize2(await loadUseCase(id)))).then((rows) => {
|
|
26726
26816
|
if (alive) setSummaries(rows);
|
|
@@ -26804,13 +26894,13 @@ import {
|
|
|
26804
26894
|
} from "@ai-matrx/records/core";
|
|
26805
26895
|
|
|
26806
26896
|
// src/WhereItLives.tsx
|
|
26807
|
-
import { useEffect as
|
|
26897
|
+
import { useEffect as useEffect69, useState as useState80 } from "react";
|
|
26808
26898
|
import { moveConsequence } from "@ai-matrx/records";
|
|
26809
|
-
import { useRecordsClient as
|
|
26899
|
+
import { useRecordsClient as useRecordsClient63 } from "@ai-matrx/records/react";
|
|
26810
26900
|
import { Button as Button71, ErrorBox as ErrorBox2, Popover as Popover6, PopoverContent as PopoverContent6, PopoverTrigger as PopoverTrigger6 } from "@ai-matrx/design-system";
|
|
26811
26901
|
import { jsx as jsx93, jsxs as jsxs86 } from "react/jsx-runtime";
|
|
26812
26902
|
function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "header" }) {
|
|
26813
|
-
const client =
|
|
26903
|
+
const client = useRecordsClient63();
|
|
26814
26904
|
const host = useRecordsUi();
|
|
26815
26905
|
const [answer, setAnswer] = useState80(null);
|
|
26816
26906
|
const [attempt, setAttempt] = useState80(0);
|
|
@@ -26819,7 +26909,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
|
|
|
26819
26909
|
const [choosing, setChoosing] = useState80(null);
|
|
26820
26910
|
const [moving, setMoving] = useState80(false);
|
|
26821
26911
|
const [said, setSaid] = useState80(null);
|
|
26822
|
-
|
|
26912
|
+
useEffect69(() => {
|
|
26823
26913
|
if (!armed) return;
|
|
26824
26914
|
let alive = true;
|
|
26825
26915
|
setAnswer(null);
|
|
@@ -27065,11 +27155,11 @@ function visibilityLaneFor(table) {
|
|
|
27065
27155
|
return "organization";
|
|
27066
27156
|
}
|
|
27067
27157
|
function TablesHome({ onOpenTable, organizationName, makingOnly = false, className }) {
|
|
27068
|
-
const client =
|
|
27158
|
+
const client = useRecordsClient64();
|
|
27069
27159
|
const tables = useTables4();
|
|
27070
27160
|
const me = client.config.actor.user_id ?? null;
|
|
27071
27161
|
const [facts, setFacts] = useState81({ phase: "reading" });
|
|
27072
|
-
|
|
27162
|
+
useEffect70(() => {
|
|
27073
27163
|
let alive = true;
|
|
27074
27164
|
void client.tableFacts().then((answered) => {
|
|
27075
27165
|
if (!alive) return;
|
|
@@ -27087,7 +27177,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, classNa
|
|
|
27087
27177
|
const keptCount = listed.filter((t) => laneFor(t) === "app").length;
|
|
27088
27178
|
const [askedName, setAskedName] = useState81(null);
|
|
27089
27179
|
const firstTableId = listed[0]?.id ?? null;
|
|
27090
|
-
|
|
27180
|
+
useEffect70(() => {
|
|
27091
27181
|
if (organizationName || !firstTableId) return;
|
|
27092
27182
|
let alive = true;
|
|
27093
27183
|
void client.tableHome({ table_id: firstTableId }).then((answered) => {
|
|
@@ -27107,7 +27197,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, classNa
|
|
|
27107
27197
|
const [importInto, setImportInto] = useState81(null);
|
|
27108
27198
|
const [examples, setExamples] = useState81(false);
|
|
27109
27199
|
const [boards, setBoards] = useState81(null);
|
|
27110
|
-
|
|
27200
|
+
useEffect70(() => {
|
|
27111
27201
|
if (makingOnly) return;
|
|
27112
27202
|
let cancelled = false;
|
|
27113
27203
|
void client.dashboards({}).then((result) => {
|
|
@@ -27141,7 +27231,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, classNa
|
|
|
27141
27231
|
return /* @__PURE__ */ jsxs87("div", { className: cn67("flex min-h-0 flex-col gap-4", className), children: [
|
|
27142
27232
|
/* @__PURE__ */ jsx94("div", { className: "flex items-center gap-2", children: creating ? /* @__PURE__ */ jsxs87(Fragment38, { children: [
|
|
27143
27233
|
/* @__PURE__ */ jsx94(
|
|
27144
|
-
|
|
27234
|
+
BasicInput26,
|
|
27145
27235
|
{
|
|
27146
27236
|
autoFocus: true,
|
|
27147
27237
|
value: name,
|
|
@@ -27283,9 +27373,9 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, classNa
|
|
|
27283
27373
|
}
|
|
27284
27374
|
|
|
27285
27375
|
// src/TablePage.tsx
|
|
27286
|
-
import { useCallback as useCallback51, useEffect as
|
|
27376
|
+
import { useCallback as useCallback51, useEffect as useEffect73, useRef as useRef28, useState as useState84 } from "react";
|
|
27287
27377
|
import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
|
|
27288
|
-
import { useFields as useFields26, useRecordsClient as
|
|
27378
|
+
import { useFields as useFields26, useRecordsClient as useRecordsClient65, useTable as useTable24 } from "@ai-matrx/records/react";
|
|
27289
27379
|
import {
|
|
27290
27380
|
BottomSheet,
|
|
27291
27381
|
Button as Button74,
|
|
@@ -27306,7 +27396,7 @@ import {
|
|
|
27306
27396
|
} from "@ai-matrx/design-system";
|
|
27307
27397
|
|
|
27308
27398
|
// src/ViewFilter.tsx
|
|
27309
|
-
import { useEffect as
|
|
27399
|
+
import { useEffect as useEffect71, useMemo as useMemo46, useState as useState82 } from "react";
|
|
27310
27400
|
import { Button as Button73, cn as cn68 } from "@ai-matrx/design-system";
|
|
27311
27401
|
import { useFields as useFields25 } from "@ai-matrx/records/react";
|
|
27312
27402
|
import { jsx as jsx95, jsxs as jsxs88 } from "react/jsx-runtime";
|
|
@@ -27324,7 +27414,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
27324
27414
|
const saved = view?.where ?? null;
|
|
27325
27415
|
const [draft, setDraft] = useState82(saved);
|
|
27326
27416
|
const savedKey = JSON.stringify(saved);
|
|
27327
|
-
|
|
27417
|
+
useEffect71(() => {
|
|
27328
27418
|
setDraft(saved);
|
|
27329
27419
|
}, [view?.id, savedKey]);
|
|
27330
27420
|
const conditionFields = useMemo46(
|
|
@@ -27407,7 +27497,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
27407
27497
|
}
|
|
27408
27498
|
|
|
27409
27499
|
// src/toolbarFit.ts
|
|
27410
|
-
import { useEffect as
|
|
27500
|
+
import { useEffect as useEffect72, useState as useState83 } from "react";
|
|
27411
27501
|
var FOLDED_GUESS = { look: 104, chooser: 96, tools: 120 };
|
|
27412
27502
|
function toolbarFold(input) {
|
|
27413
27503
|
const { available, needsNow, gap, folded } = input;
|
|
@@ -27459,7 +27549,7 @@ function rowNeeds(row) {
|
|
|
27459
27549
|
}
|
|
27460
27550
|
function useToolbarFit(row) {
|
|
27461
27551
|
const [fold, setFold] = useState83(0);
|
|
27462
|
-
|
|
27552
|
+
useEffect72(() => {
|
|
27463
27553
|
if (!row) return;
|
|
27464
27554
|
const widths = {
|
|
27465
27555
|
look: { full: null, folded: null },
|
|
@@ -27540,7 +27630,7 @@ function clippedEnds(scrollLeft, clientWidth, scrollWidth) {
|
|
|
27540
27630
|
}
|
|
27541
27631
|
function useSlotScroll(slot) {
|
|
27542
27632
|
const [ends, setEnds] = useState83("none");
|
|
27543
|
-
|
|
27633
|
+
useEffect72(() => {
|
|
27544
27634
|
if (!slot) return;
|
|
27545
27635
|
let pending = 0;
|
|
27546
27636
|
const read = () => {
|
|
@@ -27656,11 +27746,11 @@ function TableNotHere({
|
|
|
27656
27746
|
leaveLabel,
|
|
27657
27747
|
className
|
|
27658
27748
|
}) {
|
|
27659
|
-
const client =
|
|
27749
|
+
const client = useRecordsClient65();
|
|
27660
27750
|
const [archived, setArchived] = useState84({ phase: "asking" });
|
|
27661
27751
|
const [restoring, setRestoring] = useState84(false);
|
|
27662
27752
|
const [refusal2, setRefusal] = useState84(null);
|
|
27663
|
-
|
|
27753
|
+
useEffect73(() => {
|
|
27664
27754
|
let alive = true;
|
|
27665
27755
|
void client.tableArchived({ table_id: tableId }).then((answered) => {
|
|
27666
27756
|
if (!alive) return;
|
|
@@ -27837,15 +27927,15 @@ function TablePage({
|
|
|
27837
27927
|
onShownViewChange,
|
|
27838
27928
|
className
|
|
27839
27929
|
}) {
|
|
27840
|
-
const client =
|
|
27930
|
+
const client = useRecordsClient65();
|
|
27841
27931
|
const table = useTable24(tableId);
|
|
27842
27932
|
const rights = useTableRights(table.data);
|
|
27843
27933
|
const pageFields = useFields26(filter ? tableId : null);
|
|
27844
27934
|
const askedInWords = filter ? filterInWords(filter, pageFields.data ?? []) : null;
|
|
27845
|
-
const organizationId =
|
|
27935
|
+
const organizationId = useRecordsClient65().config.organizationId;
|
|
27846
27936
|
const [view, setView] = useState84(null);
|
|
27847
27937
|
const [looks, setLooks] = useState84(void 0);
|
|
27848
|
-
|
|
27938
|
+
useEffect73(() => {
|
|
27849
27939
|
let live = true;
|
|
27850
27940
|
setLooks(void 0);
|
|
27851
27941
|
void readLooks(client, tableId).then((answered) => {
|
|
@@ -27894,7 +27984,7 @@ function TablePage({
|
|
|
27894
27984
|
const chooserInline = !designated && !phone && toolbarFold2 < 2;
|
|
27895
27985
|
const chooserCompact = !designated && !phone && toolbarFold2 >= 2;
|
|
27896
27986
|
const controlsInSheet = phone && !designated;
|
|
27897
|
-
|
|
27987
|
+
useEffect73(() => {
|
|
27898
27988
|
if (face.kind !== "designated") return;
|
|
27899
27989
|
if (hostFromLink || opened.layout || layoutChosen) return;
|
|
27900
27990
|
setHostLayout(face.hostLayout);
|
|
@@ -27925,9 +28015,9 @@ function TablePage({
|
|
|
27925
28015
|
lookDiffers: view ? lookDiffers(view, look) : false
|
|
27926
28016
|
};
|
|
27927
28017
|
const shownSignature = JSON.stringify(shownReport);
|
|
27928
|
-
const reportRef =
|
|
28018
|
+
const reportRef = useRef28(onShownViewChange);
|
|
27929
28019
|
reportRef.current = onShownViewChange;
|
|
27930
|
-
|
|
28020
|
+
useEffect73(() => {
|
|
27931
28021
|
reportRef.current?.(JSON.parse(shownSignature));
|
|
27932
28022
|
}, [shownSignature]);
|
|
27933
28023
|
const pickLayout = (next) => {
|
|
@@ -27945,18 +28035,18 @@ function TablePage({
|
|
|
27945
28035
|
onViewChanged?.(id);
|
|
27946
28036
|
};
|
|
27947
28037
|
const openedFromMenu = MENU.find((entry) => entry.press.main !== void 0 && entry.press.main === main) ?? MENU.find((entry) => entry.press.rail !== void 0 && entry.press.rail === rail) ?? null;
|
|
27948
|
-
|
|
28038
|
+
useEffect73(() => {
|
|
27949
28039
|
if (!activeRecordId) return;
|
|
27950
28040
|
setOpenRecord(activeRecordId);
|
|
27951
28041
|
setSurface((now) => ({ ...now, rail: "record" }));
|
|
27952
28042
|
}, [activeRecordId]);
|
|
27953
|
-
|
|
28043
|
+
useEffect73(() => {
|
|
27954
28044
|
if (activeRecordId) return;
|
|
27955
28045
|
const named = railFromParam(activeRail);
|
|
27956
28046
|
if (named === null || named === "share") return;
|
|
27957
28047
|
setSurface((now) => ({ ...now, rail: named }));
|
|
27958
28048
|
}, [activeRail, activeRecordId]);
|
|
27959
|
-
|
|
28049
|
+
useEffect73(() => {
|
|
27960
28050
|
const host = hostLayoutFor(activeView);
|
|
27961
28051
|
if (host) {
|
|
27962
28052
|
setHostLayout(host);
|
|
@@ -28583,6 +28673,7 @@ export {
|
|
|
28583
28673
|
CHECKLIST_REQUIREMENT_LABEL,
|
|
28584
28674
|
CONDITION_OPS,
|
|
28585
28675
|
CONTEXT_POLICY_LABEL,
|
|
28676
|
+
ADDABLE_TYPES as CUSTOM_FIELD_ADDABLE_TYPES,
|
|
28586
28677
|
CaptureRun,
|
|
28587
28678
|
CaptureSheet,
|
|
28588
28679
|
ChartBlock,
|
|
@@ -28775,6 +28866,7 @@ export {
|
|
|
28775
28866
|
conditionValue,
|
|
28776
28867
|
controlFor,
|
|
28777
28868
|
currencyCodeFor,
|
|
28869
|
+
customFieldRequestProblems,
|
|
28778
28870
|
dashboardDeclareArgs,
|
|
28779
28871
|
dashboardFromSummary,
|
|
28780
28872
|
dateFormatFor,
|