@ai-matrx/records-ui 0.76.0 → 0.77.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -0
- package/dist/index.cjs +322 -291
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +248 -217
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -11450,8 +11450,35 @@ function SubscriptionsPanel({ tableId, className }) {
|
|
|
11450
11450
|
}
|
|
11451
11451
|
|
|
11452
11452
|
// src/FormBuilder.tsx
|
|
11453
|
-
import { useCallback as useCallback25, useEffect as
|
|
11454
|
-
import { useFields as useFields18, useRecordsClient as
|
|
11453
|
+
import { useCallback as useCallback25, useEffect as useEffect28, useMemo as useMemo26, useState as useState41 } from "react";
|
|
11454
|
+
import { useFields as useFields18, useRecordsClient as useRecordsClient28, useTable as useTable14 } from "@ai-matrx/records/react";
|
|
11455
|
+
|
|
11456
|
+
// src/publish-gate.ts
|
|
11457
|
+
import { useEffect as useEffect26, useState as useState39 } from "react";
|
|
11458
|
+
import { useRecordsClient as useRecordsClient27 } from "@ai-matrx/records/react";
|
|
11459
|
+
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.";
|
|
11460
|
+
function usePublishGate() {
|
|
11461
|
+
const client = useRecordsClient27();
|
|
11462
|
+
const [storeOpen, setStoreOpen] = useState39(null);
|
|
11463
|
+
useEffect26(() => {
|
|
11464
|
+
let alive = true;
|
|
11465
|
+
void (async () => {
|
|
11466
|
+
const answered = await client.storeIsOpen();
|
|
11467
|
+
if (!alive) return;
|
|
11468
|
+
setStoreOpen(answered.ok ? answered.data : null);
|
|
11469
|
+
})();
|
|
11470
|
+
return () => {
|
|
11471
|
+
alive = false;
|
|
11472
|
+
};
|
|
11473
|
+
}, [client]);
|
|
11474
|
+
return {
|
|
11475
|
+
storeOpen,
|
|
11476
|
+
blocked: storeOpen === false,
|
|
11477
|
+
why: storeOpen === false ? PUBLISH_NEEDS_THE_STORE_ON : null
|
|
11478
|
+
};
|
|
11479
|
+
}
|
|
11480
|
+
|
|
11481
|
+
// src/FormBuilder.tsx
|
|
11455
11482
|
import { publicFormPath } from "@ai-matrx/records";
|
|
11456
11483
|
import {
|
|
11457
11484
|
BasicInput as BasicInput13,
|
|
@@ -11464,7 +11491,7 @@ import {
|
|
|
11464
11491
|
} from "@ai-matrx/design-system";
|
|
11465
11492
|
|
|
11466
11493
|
// src/FormRunner.tsx
|
|
11467
|
-
import { useCallback as useCallback24, useEffect as
|
|
11494
|
+
import { useCallback as useCallback24, useEffect as useEffect27, useMemo as useMemo25, useRef as useRef11, useState as useState40 } from "react";
|
|
11468
11495
|
import { useFields as useFields17, useOptionalRecordsClient as useOptionalRecordsClient4 } from "@ai-matrx/records/react";
|
|
11469
11496
|
import { Button as Button36, Progress, Skeleton as Skeleton20, cn as cn36 } from "@ai-matrx/design-system";
|
|
11470
11497
|
import { Fragment as Fragment18, jsx as jsx42, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
@@ -11535,13 +11562,13 @@ function FormStage({
|
|
|
11535
11562
|
connected = false
|
|
11536
11563
|
}) {
|
|
11537
11564
|
const host = useRecordsUi();
|
|
11538
|
-
const [answers, setAnswers] =
|
|
11539
|
-
const [at, setAt] =
|
|
11540
|
-
const [error, setError] =
|
|
11541
|
-
const [refusal, setRefusal] =
|
|
11542
|
-
const [writing, setWriting] =
|
|
11543
|
-
const [done, setDone] =
|
|
11544
|
-
const [hidden, setHidden] =
|
|
11565
|
+
const [answers, setAnswers] = useState40({});
|
|
11566
|
+
const [at, setAt] = useState40(0);
|
|
11567
|
+
const [error, setError] = useState40(null);
|
|
11568
|
+
const [refusal, setRefusal] = useState40(null);
|
|
11569
|
+
const [writing, setWriting] = useState40(false);
|
|
11570
|
+
const [done, setDone] = useState40(null);
|
|
11571
|
+
const [hidden, setHidden] = useState40({});
|
|
11545
11572
|
const decoy = useRef11("");
|
|
11546
11573
|
const stage = useRef11(null);
|
|
11547
11574
|
const questions = useMemo25(() => {
|
|
@@ -11558,7 +11585,7 @@ function FormStage({
|
|
|
11558
11585
|
};
|
|
11559
11586
|
});
|
|
11560
11587
|
}, [fields, form.questions]);
|
|
11561
|
-
|
|
11588
|
+
useEffect27(() => {
|
|
11562
11589
|
let cancelled = false;
|
|
11563
11590
|
const conditional = questions.filter((q) => q.showIf);
|
|
11564
11591
|
if (conditional.length === 0 || !evaluate) return;
|
|
@@ -11629,7 +11656,7 @@ function FormStage({
|
|
|
11629
11656
|
if (event.shiftKey) retreat();
|
|
11630
11657
|
else advance();
|
|
11631
11658
|
}
|
|
11632
|
-
|
|
11659
|
+
useEffect27(() => {
|
|
11633
11660
|
const input = stage.current?.querySelector(
|
|
11634
11661
|
"input:not([tabindex='-1']), textarea, select, [role='combobox']"
|
|
11635
11662
|
);
|
|
@@ -11723,7 +11750,7 @@ function Question({
|
|
|
11723
11750
|
onChange,
|
|
11724
11751
|
upload
|
|
11725
11752
|
}) {
|
|
11726
|
-
const [uploadError, setUploadError] =
|
|
11753
|
+
const [uploadError, setUploadError] = useState40(null);
|
|
11727
11754
|
const field = question.field;
|
|
11728
11755
|
if (!field) return null;
|
|
11729
11756
|
const id = `form-${field.key}`;
|
|
@@ -11780,21 +11807,22 @@ function whyNotAskable(fields, hidden = []) {
|
|
|
11780
11807
|
// src/FormBuilder.tsx
|
|
11781
11808
|
import { Fragment as Fragment19, jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
11782
11809
|
function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
|
|
11783
|
-
const client =
|
|
11810
|
+
const client = useRecordsClient28();
|
|
11811
|
+
const publishGate = usePublishGate();
|
|
11784
11812
|
const host = useRecordsUi();
|
|
11785
11813
|
const claimSeed = useSeedGuard();
|
|
11786
11814
|
const table = useTable14(tableId);
|
|
11787
11815
|
const rights = useTableRights(table.data);
|
|
11788
11816
|
const fields = useFields18(tableId);
|
|
11789
|
-
const [forms, setForms] =
|
|
11790
|
-
const [error, setError] =
|
|
11791
|
-
const [activeId, setActiveId] =
|
|
11792
|
-
const [draft, setDraft] =
|
|
11793
|
-
const [saving, setSaving] =
|
|
11794
|
-
const [saved, setSaved] =
|
|
11795
|
-
const [publishing, setPublishing] =
|
|
11796
|
-
const [copied, setCopied] =
|
|
11797
|
-
const [shownUrl, setShownUrl] =
|
|
11817
|
+
const [forms, setForms] = useState41(null);
|
|
11818
|
+
const [error, setError] = useState41(null);
|
|
11819
|
+
const [activeId, setActiveId] = useState41(activeFormId ?? null);
|
|
11820
|
+
const [draft, setDraft] = useState41(null);
|
|
11821
|
+
const [saving, setSaving] = useState41(false);
|
|
11822
|
+
const [saved, setSaved] = useState41(null);
|
|
11823
|
+
const [publishing, setPublishing] = useState41(false);
|
|
11824
|
+
const [copied, setCopied] = useState41(false);
|
|
11825
|
+
const [shownUrl, setShownUrl] = useState41(null);
|
|
11798
11826
|
const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
|
|
11799
11827
|
const load = useCallback25(async () => {
|
|
11800
11828
|
const answered = await client.forms({ table_id: tableId });
|
|
@@ -11823,10 +11851,10 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
|
|
|
11823
11851
|
setError(null);
|
|
11824
11852
|
setForms(mine);
|
|
11825
11853
|
}, [client, tableId, seed, claimSeed]);
|
|
11826
|
-
|
|
11854
|
+
useEffect28(() => {
|
|
11827
11855
|
void load();
|
|
11828
11856
|
}, [load]);
|
|
11829
|
-
|
|
11857
|
+
useEffect28(() => {
|
|
11830
11858
|
if (!forms || forms.length === 0) return;
|
|
11831
11859
|
const chosen = forms.find((f) => f.id === (activeFormId ?? activeId)) ?? forms[0];
|
|
11832
11860
|
if (chosen.id !== activeId) setActiveId(chosen.id);
|
|
@@ -11937,8 +11965,8 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
|
|
|
11937
11965
|
{
|
|
11938
11966
|
url: `${publicOrigin}${publicFormPath(draft.id)}`,
|
|
11939
11967
|
state: draft.state,
|
|
11940
|
-
mayPublish: rights.structure,
|
|
11941
|
-
why: rights.why("structure"),
|
|
11968
|
+
mayPublish: rights.structure && !publishGate.blocked,
|
|
11969
|
+
why: publishGate.why ?? rights.why("structure"),
|
|
11942
11970
|
busy: publishing,
|
|
11943
11971
|
copied,
|
|
11944
11972
|
shownUrl,
|
|
@@ -12237,17 +12265,17 @@ function groupLabel(groups) {
|
|
|
12237
12265
|
|
|
12238
12266
|
// src/chartFrame.tsx
|
|
12239
12267
|
import {
|
|
12240
|
-
useEffect as
|
|
12268
|
+
useEffect as useEffect29,
|
|
12241
12269
|
useId as useId2,
|
|
12242
12270
|
useRef as useRef12,
|
|
12243
|
-
useState as
|
|
12271
|
+
useState as useState42
|
|
12244
12272
|
} from "react";
|
|
12245
12273
|
import { cn as cn38 } from "@ai-matrx/design-system";
|
|
12246
12274
|
import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
12247
12275
|
function useMeasuredWidth(fallback = 480) {
|
|
12248
12276
|
const ref = useRef12(null);
|
|
12249
|
-
const [width, setWidth] =
|
|
12250
|
-
|
|
12277
|
+
const [width, setWidth] = useState42(fallback);
|
|
12278
|
+
useEffect29(() => {
|
|
12251
12279
|
const node = ref.current;
|
|
12252
12280
|
if (!node) return;
|
|
12253
12281
|
const apply = () => {
|
|
@@ -12371,23 +12399,23 @@ function isSignatureField(field) {
|
|
|
12371
12399
|
}
|
|
12372
12400
|
|
|
12373
12401
|
// src/DocTemplate.tsx
|
|
12374
|
-
import { useCallback as useCallback26, useEffect as
|
|
12375
|
-
import { useFields as useFields19, useRecordsClient as
|
|
12402
|
+
import { useCallback as useCallback26, useEffect as useEffect30, useState as useState43 } from "react";
|
|
12403
|
+
import { useFields as useFields19, useRecordsClient as useRecordsClient29, useTable as useTable15 } from "@ai-matrx/records/react";
|
|
12376
12404
|
import { BasicInput as BasicInput14, BasicTextarea as BasicTextarea6, Button as Button38, Label as Label8, Skeleton as Skeleton22, cn as cn39 } from "@ai-matrx/design-system";
|
|
12377
12405
|
import { jsx as jsx45, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
12378
12406
|
function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, className }) {
|
|
12379
|
-
const client =
|
|
12407
|
+
const client = useRecordsClient29();
|
|
12380
12408
|
const claimSeed = useSeedGuard();
|
|
12381
12409
|
const table = useTable15(tableId);
|
|
12382
12410
|
const rights = useTableRights(table.data);
|
|
12383
12411
|
const fields = useFields19(tableId);
|
|
12384
|
-
const [templates, setTemplates] =
|
|
12385
|
-
const [error, setError] =
|
|
12386
|
-
const [activeId, setActiveId] =
|
|
12387
|
-
const [draftName, setDraftName] =
|
|
12388
|
-
const [draftBody, setDraftBody] =
|
|
12389
|
-
const [unresolved, setUnresolved] =
|
|
12390
|
-
const [saving, setSaving] =
|
|
12412
|
+
const [templates, setTemplates] = useState43(null);
|
|
12413
|
+
const [error, setError] = useState43(null);
|
|
12414
|
+
const [activeId, setActiveId] = useState43(activeTemplateId ?? null);
|
|
12415
|
+
const [draftName, setDraftName] = useState43("");
|
|
12416
|
+
const [draftBody, setDraftBody] = useState43("");
|
|
12417
|
+
const [unresolved, setUnresolved] = useState43([]);
|
|
12418
|
+
const [saving, setSaving] = useState43(false);
|
|
12391
12419
|
const load = useCallback26(async () => {
|
|
12392
12420
|
const held = await client.docTemplates({ table_id: tableId });
|
|
12393
12421
|
if (!held.ok) {
|
|
@@ -12419,10 +12447,10 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
12419
12447
|
setError(null);
|
|
12420
12448
|
setTemplates(rows);
|
|
12421
12449
|
}, [client, tableId, seed, fields.data]);
|
|
12422
|
-
|
|
12450
|
+
useEffect30(() => {
|
|
12423
12451
|
void load();
|
|
12424
12452
|
}, [load]);
|
|
12425
|
-
|
|
12453
|
+
useEffect30(() => {
|
|
12426
12454
|
if (!templates || templates.length === 0) return;
|
|
12427
12455
|
const chosen = templates.find((t) => t.id === (activeTemplateId ?? activeId)) ?? templates[0];
|
|
12428
12456
|
if (chosen.id !== activeId) setActiveId(chosen.id);
|
|
@@ -12430,7 +12458,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
12430
12458
|
setDraftBody(chosen.body);
|
|
12431
12459
|
onActiveTemplate?.(chosen);
|
|
12432
12460
|
}, [templates, activeTemplateId]);
|
|
12433
|
-
|
|
12461
|
+
useEffect30(() => {
|
|
12434
12462
|
let cancelled = false;
|
|
12435
12463
|
if (draftBody.trim() === "") {
|
|
12436
12464
|
setUnresolved([]);
|
|
@@ -12550,17 +12578,17 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
12550
12578
|
}
|
|
12551
12579
|
|
|
12552
12580
|
// src/DocRender.tsx
|
|
12553
|
-
import { useCallback as useCallback27, useEffect as
|
|
12554
|
-
import { useRecordsClient as
|
|
12581
|
+
import { useCallback as useCallback27, useEffect as useEffect31, useRef as useRef13, useState as useState44 } from "react";
|
|
12582
|
+
import { useRecordsClient as useRecordsClient30 } from "@ai-matrx/records/react";
|
|
12555
12583
|
import { Button as Button39, Skeleton as Skeleton23, cn as cn40 } from "@ai-matrx/design-system";
|
|
12556
12584
|
import { jsx as jsx46, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
12557
12585
|
function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
12558
|
-
const client =
|
|
12559
|
-
const [preview, setPreview] =
|
|
12560
|
-
const [renders, setRenders] =
|
|
12561
|
-
const [showing, setShowing] =
|
|
12562
|
-
const [error, setError] =
|
|
12563
|
-
const [busy, setBusy] =
|
|
12586
|
+
const client = useRecordsClient30();
|
|
12587
|
+
const [preview, setPreview] = useState44(null);
|
|
12588
|
+
const [renders, setRenders] = useState44(null);
|
|
12589
|
+
const [showing, setShowing] = useState44(null);
|
|
12590
|
+
const [error, setError] = useState44(null);
|
|
12591
|
+
const [busy, setBusy] = useState44(null);
|
|
12564
12592
|
const paper = useRef13(null);
|
|
12565
12593
|
const load = useCallback27(async () => {
|
|
12566
12594
|
const [body, held] = await Promise.all([
|
|
@@ -12579,7 +12607,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
12579
12607
|
setPreview(body.data);
|
|
12580
12608
|
setRenders(held.data.filter((r) => r.template_id === templateId));
|
|
12581
12609
|
}, [client, templateId, recordId]);
|
|
12582
|
-
|
|
12610
|
+
useEffect31(() => {
|
|
12583
12611
|
void load();
|
|
12584
12612
|
}, [load]);
|
|
12585
12613
|
async function freeze() {
|
|
@@ -12663,21 +12691,21 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
12663
12691
|
}
|
|
12664
12692
|
|
|
12665
12693
|
// src/SignBlock.tsx
|
|
12666
|
-
import { useCallback as useCallback28, useEffect as
|
|
12667
|
-
import { useFields as useFields20, useRecordsClient as
|
|
12694
|
+
import { useCallback as useCallback28, useEffect as useEffect32, useState as useState45 } from "react";
|
|
12695
|
+
import { useFields as useFields20, useRecordsClient as useRecordsClient31 } from "@ai-matrx/records/react";
|
|
12668
12696
|
import { BasicInput as BasicInput15, Button as Button40, Skeleton as Skeleton24, cn as cn41 } from "@ai-matrx/design-system";
|
|
12669
12697
|
import { useTable as useTable16 } from "@ai-matrx/records/react";
|
|
12670
12698
|
import { jsx as jsx47, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
12671
12699
|
function SignBlock({ tableId, recordId, render, className }) {
|
|
12672
|
-
const client =
|
|
12700
|
+
const client = useRecordsClient31();
|
|
12673
12701
|
const table = useTable16(tableId);
|
|
12674
12702
|
const rights = useTableRights(table.data);
|
|
12675
12703
|
const fields = useFields20(tableId);
|
|
12676
|
-
const [signatures, setSignatures] =
|
|
12677
|
-
const [verdicts, setVerdicts] =
|
|
12678
|
-
const [error, setError] =
|
|
12679
|
-
const [name, setName] =
|
|
12680
|
-
const [busy, setBusy] =
|
|
12704
|
+
const [signatures, setSignatures] = useState45(null);
|
|
12705
|
+
const [verdicts, setVerdicts] = useState45({});
|
|
12706
|
+
const [error, setError] = useState45(null);
|
|
12707
|
+
const [name, setName] = useState45("");
|
|
12708
|
+
const [busy, setBusy] = useState45(false);
|
|
12681
12709
|
const load = useCallback28(async () => {
|
|
12682
12710
|
const held = await client.docSignatures({ record_id: recordId });
|
|
12683
12711
|
if (!held.ok) {
|
|
@@ -12693,7 +12721,7 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
12693
12721
|
}
|
|
12694
12722
|
setVerdicts(answers);
|
|
12695
12723
|
}, [client, recordId]);
|
|
12696
|
-
|
|
12724
|
+
useEffect32(() => {
|
|
12697
12725
|
void load();
|
|
12698
12726
|
}, [load]);
|
|
12699
12727
|
async function sign(field) {
|
|
@@ -12800,22 +12828,22 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
12800
12828
|
}
|
|
12801
12829
|
|
|
12802
12830
|
// src/NotifyRuleEditor.tsx
|
|
12803
|
-
import { useCallback as useCallback29, useEffect as
|
|
12804
|
-
import { useRecordsClient as
|
|
12831
|
+
import { useCallback as useCallback29, useEffect as useEffect33, useState as useState46 } from "react";
|
|
12832
|
+
import { useRecordsClient as useRecordsClient32, useTable as useTable17 } from "@ai-matrx/records/react";
|
|
12805
12833
|
import { Button as Button41, Skeleton as Skeleton25, cn as cn42 } from "@ai-matrx/design-system";
|
|
12806
12834
|
import { jsx as jsx48, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
12807
12835
|
var CADENCE_WORDS2 = SUBSCRIPTION_CADENCE_LABEL;
|
|
12808
12836
|
var CHANNEL_WORDS3 = SUBSCRIPTION_CHANNEL_LABEL;
|
|
12809
12837
|
function NotifyRuleEditor({ tableId, seed, className }) {
|
|
12810
|
-
const client =
|
|
12838
|
+
const client = useRecordsClient32();
|
|
12811
12839
|
const host = useRecordsUi();
|
|
12812
12840
|
const table = useTable17(tableId);
|
|
12813
12841
|
const rights = useTableRights(table.data);
|
|
12814
|
-
const [subscriptions, setSubscriptions] =
|
|
12815
|
-
const [cadences, setCadences] =
|
|
12816
|
-
const [views, setViews] =
|
|
12817
|
-
const [error, setError] =
|
|
12818
|
-
const [busy, setBusy] =
|
|
12842
|
+
const [subscriptions, setSubscriptions] = useState46(null);
|
|
12843
|
+
const [cadences, setCadences] = useState46([]);
|
|
12844
|
+
const [views, setViews] = useState46(null);
|
|
12845
|
+
const [error, setError] = useState46(null);
|
|
12846
|
+
const [busy, setBusy] = useState46(false);
|
|
12819
12847
|
const load = useCallback29(async () => {
|
|
12820
12848
|
const [held, offered] = await Promise.all([
|
|
12821
12849
|
// THE PERSON'S OWN DOOR, not the notifier's. It answers what is addressed
|
|
@@ -12836,7 +12864,7 @@ function NotifyRuleEditor({ tableId, seed, className }) {
|
|
|
12836
12864
|
if (host.savedViews) setViews(await host.savedViews());
|
|
12837
12865
|
else setViews(null);
|
|
12838
12866
|
}, [client, host, tableId]);
|
|
12839
|
-
|
|
12867
|
+
useEffect33(() => {
|
|
12840
12868
|
void load();
|
|
12841
12869
|
}, [load]);
|
|
12842
12870
|
const write = useCallback29(
|
|
@@ -12864,7 +12892,7 @@ function NotifyRuleEditor({ tableId, seed, className }) {
|
|
|
12864
12892
|
},
|
|
12865
12893
|
[client, tableId]
|
|
12866
12894
|
);
|
|
12867
|
-
|
|
12895
|
+
useEffect33(() => {
|
|
12868
12896
|
if (!subscriptions || !seed || seed.length === 0) return;
|
|
12869
12897
|
const missing = seed.filter((s) => !subscriptions.some((held) => held.name === s.name));
|
|
12870
12898
|
if (missing.length === 0) return;
|
|
@@ -13320,24 +13348,24 @@ function Drawing({
|
|
|
13320
13348
|
}
|
|
13321
13349
|
|
|
13322
13350
|
// src/DashboardCanvas.tsx
|
|
13323
|
-
import { useCallback as useCallback30, useEffect as
|
|
13324
|
-
import { useFields as useFields21, useRecordsClient as
|
|
13351
|
+
import { useCallback as useCallback30, useEffect as useEffect34, useMemo as useMemo28, useState as useState47 } from "react";
|
|
13352
|
+
import { useFields as useFields21, useRecordsClient as useRecordsClient33, useTable as useTable18 } from "@ai-matrx/records/react";
|
|
13325
13353
|
import { BasicInput as BasicInput16, Button as Button42, Skeleton as Skeleton26, cn as cn44 } from "@ai-matrx/design-system";
|
|
13326
13354
|
import { Fragment as Fragment21, jsx as jsx50, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
13327
13355
|
function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
|
|
13328
|
-
const client =
|
|
13356
|
+
const client = useRecordsClient33();
|
|
13329
13357
|
const host = useRecordsUi();
|
|
13330
13358
|
const table = useTable18(tableId);
|
|
13331
13359
|
const rights = useTableRights(table.data);
|
|
13332
13360
|
const fields = useFields21(tableId);
|
|
13333
|
-
const [boards, setBoards] =
|
|
13334
|
-
const [error, setError] =
|
|
13335
|
-
const [activeId, setActiveId] =
|
|
13336
|
-
const [run, setRun] =
|
|
13337
|
-
const [running, setRunning] =
|
|
13338
|
-
const [question, setQuestion] =
|
|
13339
|
-
const [asking, setAsking] =
|
|
13340
|
-
const [scheduling, setScheduling] =
|
|
13361
|
+
const [boards, setBoards] = useState47(null);
|
|
13362
|
+
const [error, setError] = useState47(null);
|
|
13363
|
+
const [activeId, setActiveId] = useState47(activeDashboardId ?? null);
|
|
13364
|
+
const [run, setRun] = useState47(null);
|
|
13365
|
+
const [running, setRunning] = useState47(false);
|
|
13366
|
+
const [question, setQuestion] = useState47("");
|
|
13367
|
+
const [asking, setAsking] = useState47(false);
|
|
13368
|
+
const [scheduling, setScheduling] = useState47(false);
|
|
13341
13369
|
const load = useCallback30(async () => {
|
|
13342
13370
|
const answered = await client.dashboards({ table_id: tableId });
|
|
13343
13371
|
if (!answered.ok) {
|
|
@@ -13347,17 +13375,17 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
|
|
|
13347
13375
|
setError(null);
|
|
13348
13376
|
setBoards(answered.data.map(dashboardFromSummary));
|
|
13349
13377
|
}, [client, tableId]);
|
|
13350
|
-
|
|
13378
|
+
useEffect34(() => {
|
|
13351
13379
|
void load();
|
|
13352
13380
|
}, [load]);
|
|
13353
|
-
|
|
13381
|
+
useEffect34(() => {
|
|
13354
13382
|
if (!boards || boards.length === 0) return;
|
|
13355
13383
|
const chosen = boards.find((d) => d.id === (activeDashboardId ?? activeId)) ?? boards[0];
|
|
13356
13384
|
if (chosen.id !== activeId) setActiveId(chosen.id);
|
|
13357
13385
|
}, [boards, activeDashboardId]);
|
|
13358
13386
|
const board = useMemo28(() => boards?.find((d) => d.id === activeId) ?? null, [boards, activeId]);
|
|
13359
13387
|
const filterKey = JSON.stringify(filter ?? {});
|
|
13360
|
-
|
|
13388
|
+
useEffect34(() => {
|
|
13361
13389
|
if (!activeId) {
|
|
13362
13390
|
setRun(null);
|
|
13363
13391
|
return;
|
|
@@ -13588,8 +13616,8 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
|
|
|
13588
13616
|
}
|
|
13589
13617
|
|
|
13590
13618
|
// src/FormsPanel.tsx
|
|
13591
|
-
import { useCallback as useCallback31, useEffect as
|
|
13592
|
-
import { useRecordsClient as
|
|
13619
|
+
import { useCallback as useCallback31, useEffect as useEffect35, useState as useState48 } from "react";
|
|
13620
|
+
import { useRecordsClient as useRecordsClient34, useTable as useTable19 } from "@ai-matrx/records/react";
|
|
13593
13621
|
import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
|
|
13594
13622
|
import { Badge as Badge15, Button as Button43, Skeleton as Skeleton27, cn as cn45 } from "@ai-matrx/design-system";
|
|
13595
13623
|
import { Fragment as Fragment22, jsx as jsx51, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
@@ -13600,15 +13628,16 @@ function formSuggestion(tableName2) {
|
|
|
13600
13628
|
return `Make me a form that collects new ${subject} entries and tells me when somebody answers.`;
|
|
13601
13629
|
}
|
|
13602
13630
|
function FormsPanel({ tableId, className }) {
|
|
13603
|
-
const client =
|
|
13631
|
+
const client = useRecordsClient34();
|
|
13632
|
+
const publishGate = usePublishGate();
|
|
13604
13633
|
const host = useRecordsUi();
|
|
13605
13634
|
const table = useTable19(tableId);
|
|
13606
13635
|
const rights = useTableRights(table.data);
|
|
13607
|
-
const [forms, setForms] =
|
|
13608
|
-
const [error, setError] =
|
|
13609
|
-
const [busy, setBusy] =
|
|
13610
|
-
const [copied, setCopied] =
|
|
13611
|
-
const [building, setBuilding] =
|
|
13636
|
+
const [forms, setForms] = useState48(null);
|
|
13637
|
+
const [error, setError] = useState48(null);
|
|
13638
|
+
const [busy, setBusy] = useState48(null);
|
|
13639
|
+
const [copied, setCopied] = useState48(null);
|
|
13640
|
+
const [building, setBuilding] = useState48(false);
|
|
13612
13641
|
const load = useCallback31(async () => {
|
|
13613
13642
|
const answered = await client.forms({ table_id: tableId });
|
|
13614
13643
|
if (!answered.ok) {
|
|
@@ -13619,7 +13648,7 @@ function FormsPanel({ tableId, className }) {
|
|
|
13619
13648
|
setError(null);
|
|
13620
13649
|
setForms(answered.data);
|
|
13621
13650
|
}, [client, tableId]);
|
|
13622
|
-
|
|
13651
|
+
useEffect35(() => {
|
|
13623
13652
|
void load();
|
|
13624
13653
|
}, [load]);
|
|
13625
13654
|
const toggle = useCallback31(
|
|
@@ -13636,7 +13665,7 @@ function FormsPanel({ tableId, className }) {
|
|
|
13636
13665
|
},
|
|
13637
13666
|
[client, load]
|
|
13638
13667
|
);
|
|
13639
|
-
const [shown, setShown] =
|
|
13668
|
+
const [shown, setShown] = useState48(null);
|
|
13640
13669
|
const copy = useCallback31(async (url, formId) => {
|
|
13641
13670
|
try {
|
|
13642
13671
|
await navigator.clipboard.writeText(url);
|
|
@@ -13712,7 +13741,7 @@ function FormsPanel({ tableId, className }) {
|
|
|
13712
13741
|
] }),
|
|
13713
13742
|
/* @__PURE__ */ jsxs47("div", { className: "mt-2 flex flex-wrap items-center gap-1.5", children: [
|
|
13714
13743
|
form.published_at ? /* @__PURE__ */ jsx51(Button43, { size: "sm", variant: "outline", onClick: () => void copy(url, form.form_id), children: copied === form.form_id ? "Copied" : "Copy link" }) : null,
|
|
13715
|
-
rights.structure ? /* @__PURE__ */ jsx51(
|
|
13744
|
+
rights.structure && !publishGate.blocked ? /* @__PURE__ */ jsx51(
|
|
13716
13745
|
Button43,
|
|
13717
13746
|
{
|
|
13718
13747
|
size: "sm",
|
|
@@ -13723,6 +13752,7 @@ function FormsPanel({ tableId, className }) {
|
|
|
13723
13752
|
}
|
|
13724
13753
|
) : null
|
|
13725
13754
|
] }),
|
|
13755
|
+
rights.structure && publishGate.why ? /* @__PURE__ */ jsx51("p", { className: "mt-1.5 text-xs text-muted-foreground", children: publishGate.why }) : null,
|
|
13726
13756
|
shown && shown === url ? /* @__PURE__ */ jsxs47("p", { className: "mt-1.5 break-all rounded border border-dashed px-2 py-1 text-xs", children: [
|
|
13727
13757
|
"This browser would not let the page copy for you, so here it is to copy by hand:",
|
|
13728
13758
|
" ",
|
|
@@ -13735,8 +13765,8 @@ function FormsPanel({ tableId, className }) {
|
|
|
13735
13765
|
}
|
|
13736
13766
|
|
|
13737
13767
|
// src/BookingBuilder.tsx
|
|
13738
|
-
import { useCallback as useCallback32, useEffect as
|
|
13739
|
-
import { useFields as useFields22, useRecordsClient as
|
|
13768
|
+
import { useCallback as useCallback32, useEffect as useEffect36, useMemo as useMemo29, useState as useState49 } from "react";
|
|
13769
|
+
import { useFields as useFields22, useRecordsClient as useRecordsClient35, useTable as useTable20 } from "@ai-matrx/records/react";
|
|
13740
13770
|
import {
|
|
13741
13771
|
bookingPath
|
|
13742
13772
|
} from "@ai-matrx/records";
|
|
@@ -13766,28 +13796,29 @@ function draftWindows(availability) {
|
|
|
13766
13796
|
});
|
|
13767
13797
|
}
|
|
13768
13798
|
function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
13769
|
-
const client =
|
|
13799
|
+
const client = useRecordsClient35();
|
|
13800
|
+
const publishGate = usePublishGate();
|
|
13770
13801
|
const host = useRecordsUi();
|
|
13771
13802
|
const table = useTable20(tableId);
|
|
13772
13803
|
const rights = useTableRights(table.data);
|
|
13773
13804
|
const fields = useFields22(tableId);
|
|
13774
|
-
const [existing, setExisting] =
|
|
13775
|
-
const [loaded, setLoaded] =
|
|
13776
|
-
const [error, setError] =
|
|
13777
|
-
const [saving, setSaving] =
|
|
13778
|
-
const [publishing, setPublishing] =
|
|
13779
|
-
const [copied, setCopied] =
|
|
13780
|
-
const [title, setTitle] =
|
|
13781
|
-
const [minutes, setMinutes] =
|
|
13782
|
-
const [buffer, setBuffer] =
|
|
13783
|
-
const [lead, setLead] =
|
|
13784
|
-
const [perDay, setPerDay] =
|
|
13785
|
-
const [days, setDays] =
|
|
13786
|
-
const [windows, setWindows] =
|
|
13787
|
-
const [asked, setAsked] =
|
|
13788
|
-
const [confirmation, setConfirmation] =
|
|
13789
|
-
const [offer, setOffer] =
|
|
13790
|
-
const [formId, setFormId] =
|
|
13805
|
+
const [existing, setExisting] = useState49(null);
|
|
13806
|
+
const [loaded, setLoaded] = useState49(false);
|
|
13807
|
+
const [error, setError] = useState49(null);
|
|
13808
|
+
const [saving, setSaving] = useState49(false);
|
|
13809
|
+
const [publishing, setPublishing] = useState49(false);
|
|
13810
|
+
const [copied, setCopied] = useState49(false);
|
|
13811
|
+
const [title, setTitle] = useState49("");
|
|
13812
|
+
const [minutes, setMinutes] = useState49(30);
|
|
13813
|
+
const [buffer, setBuffer] = useState49(0);
|
|
13814
|
+
const [lead, setLead] = useState49(120);
|
|
13815
|
+
const [perDay, setPerDay] = useState49(8);
|
|
13816
|
+
const [days, setDays] = useState49(30);
|
|
13817
|
+
const [windows, setWindows] = useState49(() => draftWindows(null));
|
|
13818
|
+
const [asked, setAsked] = useState49([]);
|
|
13819
|
+
const [confirmation, setConfirmation] = useState49("");
|
|
13820
|
+
const [offer, setOffer] = useState49(null);
|
|
13821
|
+
const [formId, setFormId] = useState49(bookingId ?? null);
|
|
13791
13822
|
const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
|
|
13792
13823
|
const askable = useMemo29(
|
|
13793
13824
|
() => askableFields(fields.data ?? [], STORE_ANSWERS_THESE),
|
|
@@ -13809,18 +13840,18 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
|
13809
13840
|
setLoaded(true);
|
|
13810
13841
|
if (mine) setFormId(mine.form_id);
|
|
13811
13842
|
}, [client, tableId, bookingId]);
|
|
13812
|
-
|
|
13843
|
+
useEffect36(() => {
|
|
13813
13844
|
void load();
|
|
13814
13845
|
}, [load]);
|
|
13815
|
-
|
|
13846
|
+
useEffect36(() => {
|
|
13816
13847
|
if (title !== "" || !table.data) return;
|
|
13817
13848
|
setTitle(existing?.title ?? `Book a ${minutes}-minute ${table.data.name} appointment`);
|
|
13818
13849
|
}, [table.data, existing]);
|
|
13819
|
-
|
|
13850
|
+
useEffect36(() => {
|
|
13820
13851
|
if (!existing) return;
|
|
13821
13852
|
setMinutes(existing.slot_minutes);
|
|
13822
13853
|
}, [existing]);
|
|
13823
|
-
|
|
13854
|
+
useEffect36(() => {
|
|
13824
13855
|
if (!offer) return;
|
|
13825
13856
|
setWindows(draftWindows(offer));
|
|
13826
13857
|
setMinutes(offer.slot_minutes);
|
|
@@ -14066,7 +14097,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
|
14066
14097
|
children: copied ? "Copied" : "Copy link"
|
|
14067
14098
|
}
|
|
14068
14099
|
),
|
|
14069
|
-
/* @__PURE__ */ jsx52(
|
|
14100
|
+
publishGate.blocked ? null : /* @__PURE__ */ jsx52(
|
|
14070
14101
|
Button44,
|
|
14071
14102
|
{
|
|
14072
14103
|
size: "sm",
|
|
@@ -14075,15 +14106,15 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
|
|
|
14075
14106
|
children: publishing ? "\u2026" : existing?.published_at && !existing.closed_at ? "Unpublish" : "Publish"
|
|
14076
14107
|
}
|
|
14077
14108
|
),
|
|
14078
|
-
/* @__PURE__ */ jsx52("p", { className: "w-full text-xs text-muted-foreground", children: existing?.published_at && !existing.closed_at ? "Open. Anyone with this link can book a time." : "Not open yet \u2014 the link does not take bookings until you publish it." })
|
|
14109
|
+
/* @__PURE__ */ jsx52("p", { className: "w-full text-xs text-muted-foreground", children: publishGate.why ?? (existing?.published_at && !existing.closed_at ? "Open. Anyone with this link can book a time." : "Not open yet \u2014 the link does not take bookings until you publish it.") })
|
|
14079
14110
|
] }) : null
|
|
14080
14111
|
] })
|
|
14081
14112
|
);
|
|
14082
14113
|
}
|
|
14083
14114
|
|
|
14084
14115
|
// src/BookingSlots.tsx
|
|
14085
|
-
import { useCallback as useCallback33, useEffect as
|
|
14086
|
-
import { useRecordsClient as
|
|
14116
|
+
import { useCallback as useCallback33, useEffect as useEffect37, useMemo as useMemo30, useState as useState50 } from "react";
|
|
14117
|
+
import { useRecordsClient as useRecordsClient36, useMyLevels as useMyLevels2 } from "@ai-matrx/records/react";
|
|
14087
14118
|
import { bookingPath as bookingPath2 } from "@ai-matrx/records";
|
|
14088
14119
|
import { Badge as Badge16, Button as Button45, Skeleton as Skeleton29, cn as cn47 } from "@ai-matrx/design-system";
|
|
14089
14120
|
import { Fragment as Fragment24, jsx as jsx53, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
@@ -14095,14 +14126,14 @@ function bookingSuggestion(tableName2) {
|
|
|
14095
14126
|
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.";
|
|
14096
14127
|
var STATE_WORDS = BOOKING_PAGE_STATE_LABEL;
|
|
14097
14128
|
function BookingSlots({ tableId, className }) {
|
|
14098
|
-
const client =
|
|
14129
|
+
const client = useRecordsClient36();
|
|
14099
14130
|
const host = useRecordsUi();
|
|
14100
|
-
const [pages, setPages] =
|
|
14101
|
-
const [error, setError] =
|
|
14102
|
-
const [busy, setBusy] =
|
|
14103
|
-
const [copied, setCopied] =
|
|
14104
|
-
const [shown, setShown] =
|
|
14105
|
-
const [building, setBuilding] =
|
|
14131
|
+
const [pages, setPages] = useState50(null);
|
|
14132
|
+
const [error, setError] = useState50(null);
|
|
14133
|
+
const [busy, setBusy] = useState50(null);
|
|
14134
|
+
const [copied, setCopied] = useState50(null);
|
|
14135
|
+
const [shown, setShown] = useState50(null);
|
|
14136
|
+
const [building, setBuilding] = useState50(false);
|
|
14106
14137
|
const load = useCallback33(async () => {
|
|
14107
14138
|
const answered = await client.bookings(tableId ? { table_id: tableId } : {});
|
|
14108
14139
|
if (!answered.ok) {
|
|
@@ -14113,7 +14144,7 @@ function BookingSlots({ tableId, className }) {
|
|
|
14113
14144
|
setError(null);
|
|
14114
14145
|
setPages(answered.data);
|
|
14115
14146
|
}, [client, tableId]);
|
|
14116
|
-
|
|
14147
|
+
useEffect37(() => {
|
|
14117
14148
|
void load();
|
|
14118
14149
|
}, [load]);
|
|
14119
14150
|
const subjectIds = useMemo30(
|
|
@@ -14282,18 +14313,18 @@ function nextInWords(page) {
|
|
|
14282
14313
|
}
|
|
14283
14314
|
|
|
14284
14315
|
// src/CaptureSheet.tsx
|
|
14285
|
-
import { useCallback as useCallback35, useEffect as
|
|
14286
|
-
import { useFields as useFields23, useRecordsClient as
|
|
14316
|
+
import { useCallback as useCallback35, useEffect as useEffect39, useRef as useRef15, useState as useState52 } from "react";
|
|
14317
|
+
import { useFields as useFields23, useRecordsClient as useRecordsClient38, useTable as useTable21 } from "@ai-matrx/records/react";
|
|
14287
14318
|
import { Button as Button47, Input as Input4, Skeleton as Skeleton31, Textarea as Textarea3, cn as cn49 } from "@ai-matrx/design-system";
|
|
14288
14319
|
|
|
14289
14320
|
// src/CaptureRun.tsx
|
|
14290
|
-
import { useCallback as useCallback34, useEffect as
|
|
14321
|
+
import { useCallback as useCallback34, useEffect as useEffect38, useMemo as useMemo31, useRef as useRef14, useState as useState51 } from "react";
|
|
14291
14322
|
import {
|
|
14292
14323
|
coerceTypedAnswer as coerceTypedAnswer2,
|
|
14293
14324
|
coercionLabel,
|
|
14294
14325
|
openCaptureQueue
|
|
14295
14326
|
} from "@ai-matrx/records";
|
|
14296
|
-
import { useRecordsClient as
|
|
14327
|
+
import { useRecordsClient as useRecordsClient37 } from "@ai-matrx/records/react";
|
|
14297
14328
|
import { Button as Button46, Input as Input3, Skeleton as Skeleton30, Textarea as Textarea2, cn as cn48 } from "@ai-matrx/design-system";
|
|
14298
14329
|
import { jsx as jsx54, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
14299
14330
|
function controlFor(field) {
|
|
@@ -14332,21 +14363,21 @@ function whereWeAre(timeoutMs = 4e3) {
|
|
|
14332
14363
|
});
|
|
14333
14364
|
}
|
|
14334
14365
|
function CaptureRun({ sheetId, face: given, className }) {
|
|
14335
|
-
const client =
|
|
14366
|
+
const client = useRecordsClient37();
|
|
14336
14367
|
const host = useRecordsUi();
|
|
14337
|
-
const [face, setFace] =
|
|
14338
|
-
const [loadFailed, setLoadFailed] =
|
|
14339
|
-
const [at, setAt] =
|
|
14340
|
-
const [answers, setAnswers] =
|
|
14341
|
-
const [files, setFiles] =
|
|
14342
|
-
const [missing, setMissing] =
|
|
14343
|
-
const [done, setDone] =
|
|
14344
|
-
const [counts, setCounts] =
|
|
14345
|
-
const [items, setItems] =
|
|
14346
|
-
const [lastSynced, setLastSynced] =
|
|
14347
|
-
const [sending, setSending] =
|
|
14368
|
+
const [face, setFace] = useState51(given);
|
|
14369
|
+
const [loadFailed, setLoadFailed] = useState51(null);
|
|
14370
|
+
const [at, setAt] = useState51(0);
|
|
14371
|
+
const [answers, setAnswers] = useState51({});
|
|
14372
|
+
const [files, setFiles] = useState51({});
|
|
14373
|
+
const [missing, setMissing] = useState51(null);
|
|
14374
|
+
const [done, setDone] = useState51(null);
|
|
14375
|
+
const [counts, setCounts] = useState51({ waiting: 0, sending: 0, refused: 0, landed: 0 });
|
|
14376
|
+
const [items, setItems] = useState51([]);
|
|
14377
|
+
const [lastSynced, setLastSynced] = useState51(null);
|
|
14378
|
+
const [sending, setSending] = useState51(false);
|
|
14348
14379
|
const queueRef = useRef14(null);
|
|
14349
|
-
|
|
14380
|
+
useEffect38(() => {
|
|
14350
14381
|
const q2 = openCaptureQueue({
|
|
14351
14382
|
onChange: (c, all) => {
|
|
14352
14383
|
setCounts(c);
|
|
@@ -14384,7 +14415,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
14384
14415
|
void q2.sync().then(() => void q2.lastSyncedAt().then(setLastSynced));
|
|
14385
14416
|
return () => q2.dispose();
|
|
14386
14417
|
}, [client, host]);
|
|
14387
|
-
|
|
14418
|
+
useEffect38(() => {
|
|
14388
14419
|
if (given !== void 0) return;
|
|
14389
14420
|
let cancelled = false;
|
|
14390
14421
|
void client.captureOpen({ sheet_id: sheetId }).then((res) => {
|
|
@@ -14694,19 +14725,19 @@ function AdHocCaptureSheet({
|
|
|
14694
14725
|
attachmentField,
|
|
14695
14726
|
className
|
|
14696
14727
|
}) {
|
|
14697
|
-
const client =
|
|
14728
|
+
const client = useRecordsClient38();
|
|
14698
14729
|
const host = useRecordsUi();
|
|
14699
14730
|
const table = useTable21(tableId);
|
|
14700
14731
|
const fields = useFields23(tableId);
|
|
14701
|
-
const [mode, setMode] =
|
|
14702
|
-
const [reading, setReading] =
|
|
14703
|
-
const [note, setNote] =
|
|
14704
|
-
const [fileId, setFileId] =
|
|
14705
|
-
const [pending, setPending] =
|
|
14706
|
-
const [saved, setSaved] =
|
|
14707
|
-
const [error, setError] =
|
|
14708
|
-
const [uploadError, setUploadError] =
|
|
14709
|
-
const [flushing, setFlushing] =
|
|
14732
|
+
const [mode, setMode] = useState52("reading");
|
|
14733
|
+
const [reading, setReading] = useState52("");
|
|
14734
|
+
const [note, setNote] = useState52("");
|
|
14735
|
+
const [fileId, setFileId] = useState52(null);
|
|
14736
|
+
const [pending, setPending] = useState52(null);
|
|
14737
|
+
const [saved, setSaved] = useState52([]);
|
|
14738
|
+
const [error, setError] = useState52(null);
|
|
14739
|
+
const [uploadError, setUploadError] = useState52(null);
|
|
14740
|
+
const [flushing, setFlushing] = useState52(false);
|
|
14710
14741
|
const queue = useRef15([]);
|
|
14711
14742
|
const keep = useCallback35(
|
|
14712
14743
|
async (next) => {
|
|
@@ -14716,7 +14747,7 @@ function AdHocCaptureSheet({
|
|
|
14716
14747
|
},
|
|
14717
14748
|
[host]
|
|
14718
14749
|
);
|
|
14719
|
-
|
|
14750
|
+
useEffect39(() => {
|
|
14720
14751
|
let cancelled = false;
|
|
14721
14752
|
void (async () => {
|
|
14722
14753
|
const held = host.captureQueue ? await host.captureQueue.load() : [];
|
|
@@ -14895,17 +14926,17 @@ function AdHocCaptureSheet({
|
|
|
14895
14926
|
}
|
|
14896
14927
|
|
|
14897
14928
|
// src/PortalShell.tsx
|
|
14898
|
-
import { useCallback as useCallback36, useEffect as
|
|
14899
|
-
import { useRecordsClient as
|
|
14929
|
+
import { useCallback as useCallback36, useEffect as useEffect40, useState as useState53 } from "react";
|
|
14930
|
+
import { useRecordsClient as useRecordsClient39 } from "@ai-matrx/records/react";
|
|
14900
14931
|
import { Button as Button48, Skeleton as Skeleton32, cn as cn50 } from "@ai-matrx/design-system";
|
|
14901
14932
|
import { jsx as jsx56, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
14902
14933
|
function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
14903
|
-
const client =
|
|
14904
|
-
const [card, setCard] =
|
|
14905
|
-
const [reach, setReach] =
|
|
14906
|
-
const [error, setError] =
|
|
14907
|
-
const [open, setOpen] =
|
|
14908
|
-
const [sending, setSending] =
|
|
14934
|
+
const client = useRecordsClient39();
|
|
14935
|
+
const [card, setCard] = useState53(null);
|
|
14936
|
+
const [reach, setReach] = useState53(null);
|
|
14937
|
+
const [error, setError] = useState53(null);
|
|
14938
|
+
const [open, setOpen] = useState53(null);
|
|
14939
|
+
const [sending, setSending] = useState53(false);
|
|
14909
14940
|
const load = useCallback36(async () => {
|
|
14910
14941
|
const who = await client.externalPrincipalCard();
|
|
14911
14942
|
if (!who.ok) {
|
|
@@ -14921,7 +14952,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
|
14921
14952
|
}
|
|
14922
14953
|
setReach(reached.data.map((row) => row.resource_id));
|
|
14923
14954
|
}, [client, resourceType]);
|
|
14924
|
-
|
|
14955
|
+
useEffect40(() => {
|
|
14925
14956
|
void load();
|
|
14926
14957
|
}, [load]);
|
|
14927
14958
|
if (error) {
|
|
@@ -14979,9 +15010,9 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
|
14979
15010
|
] });
|
|
14980
15011
|
}
|
|
14981
15012
|
function PortalRow({ tableId, recordId }) {
|
|
14982
|
-
const client =
|
|
14983
|
-
const [title, setTitle] =
|
|
14984
|
-
|
|
15013
|
+
const client = useRecordsClient39();
|
|
15014
|
+
const [title, setTitle] = useState53(null);
|
|
15015
|
+
useEffect40(() => {
|
|
14985
15016
|
let cancelled = false;
|
|
14986
15017
|
void client.recordRead({ record_id: recordId }).then((answered) => {
|
|
14987
15018
|
if (cancelled) return;
|
|
@@ -15001,17 +15032,17 @@ function PortalRow({ tableId, recordId }) {
|
|
|
15001
15032
|
}
|
|
15002
15033
|
|
|
15003
15034
|
// src/PublicViewPage.tsx
|
|
15004
|
-
import { useCallback as useCallback37, useEffect as
|
|
15005
|
-
import { useRecordsClient as
|
|
15035
|
+
import { useCallback as useCallback37, useEffect as useEffect41, useState as useState54 } from "react";
|
|
15036
|
+
import { useRecordsClient as useRecordsClient40 } from "@ai-matrx/records/react";
|
|
15006
15037
|
import { Skeleton as Skeleton33, cn as cn51 } from "@ai-matrx/design-system";
|
|
15007
15038
|
import { jsx as jsx57, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
15008
15039
|
function PublicViewPage({ slug, className }) {
|
|
15009
|
-
const client =
|
|
15010
|
-
const [binding, setBinding] =
|
|
15011
|
-
const [rows, setRows] =
|
|
15012
|
-
const [fields, setFields] =
|
|
15013
|
-
const [error, setError] =
|
|
15014
|
-
const [gap, setGap] =
|
|
15040
|
+
const client = useRecordsClient40();
|
|
15041
|
+
const [binding, setBinding] = useState54(null);
|
|
15042
|
+
const [rows, setRows] = useState54(null);
|
|
15043
|
+
const [fields, setFields] = useState54(null);
|
|
15044
|
+
const [error, setError] = useState54(null);
|
|
15045
|
+
const [gap, setGap] = useState54(null);
|
|
15015
15046
|
const load = useCallback37(async () => {
|
|
15016
15047
|
const notice = await client.worldPublishGapNotice();
|
|
15017
15048
|
if (notice.ok) setGap(notice.data);
|
|
@@ -15045,7 +15076,7 @@ function PublicViewPage({ slug, className }) {
|
|
|
15045
15076
|
}
|
|
15046
15077
|
setRows([{ id: found.resource_id, document: read.data.document, level: "viewer", hidden: read.data.hidden }]);
|
|
15047
15078
|
}, [client, slug]);
|
|
15048
|
-
|
|
15079
|
+
useEffect41(() => {
|
|
15049
15080
|
void load();
|
|
15050
15081
|
}, [load]);
|
|
15051
15082
|
if (error) return /* @__PURE__ */ jsx57(RefusalNotice, { error, className });
|
|
@@ -15082,8 +15113,8 @@ function PublicRow({ row, fields }) {
|
|
|
15082
15113
|
}
|
|
15083
15114
|
|
|
15084
15115
|
// src/EmbedFrame.tsx
|
|
15085
|
-
import { useCallback as useCallback38, useEffect as
|
|
15086
|
-
import { useRecordsClient as
|
|
15116
|
+
import { useCallback as useCallback38, useEffect as useEffect42, useState as useState55 } from "react";
|
|
15117
|
+
import { useRecordsClient as useRecordsClient41 } from "@ai-matrx/records/react";
|
|
15087
15118
|
import { Button as Button49, Input as Input5, Skeleton as Skeleton34, Textarea as Textarea4, cn as cn52 } from "@ai-matrx/design-system";
|
|
15088
15119
|
import { useTable as useTable22 } from "@ai-matrx/records/react";
|
|
15089
15120
|
import { Fragment as Fragment26, jsx as jsx58, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
@@ -15095,15 +15126,15 @@ function EmbedFrame({
|
|
|
15095
15126
|
embedUrl,
|
|
15096
15127
|
className
|
|
15097
15128
|
}) {
|
|
15098
|
-
const client =
|
|
15129
|
+
const client = useRecordsClient41();
|
|
15099
15130
|
const host = useRecordsUi();
|
|
15100
15131
|
const table = useTable22(tableId);
|
|
15101
15132
|
const rights = useTableRights(table.data);
|
|
15102
|
-
const [origins, setOrigins] =
|
|
15103
|
-
const [secret, setSecret] =
|
|
15104
|
-
const [tokenId, setTokenId] =
|
|
15105
|
-
const [error, setError] =
|
|
15106
|
-
const [busy, setBusy] =
|
|
15133
|
+
const [origins, setOrigins] = useState55("");
|
|
15134
|
+
const [secret, setSecret] = useState55(null);
|
|
15135
|
+
const [tokenId, setTokenId] = useState55(null);
|
|
15136
|
+
const [error, setError] = useState55(null);
|
|
15137
|
+
const [busy, setBusy] = useState55(false);
|
|
15107
15138
|
const mode = formId ? "write" : "read";
|
|
15108
15139
|
const parsed = origins.split(/[\s,]+/).map((o) => o.trim()).filter((o) => o.length > 0);
|
|
15109
15140
|
const issue = useCallback38(async () => {
|
|
@@ -15189,13 +15220,13 @@ function EmbedFrame({
|
|
|
15189
15220
|
] });
|
|
15190
15221
|
}
|
|
15191
15222
|
function useEmbedHandshake(args) {
|
|
15192
|
-
const client =
|
|
15193
|
-
const [binding, setBinding] =
|
|
15194
|
-
const [error, setError] =
|
|
15195
|
-
const [loading, setLoading] =
|
|
15223
|
+
const client = useRecordsClient41();
|
|
15224
|
+
const [binding, setBinding] = useState55(null);
|
|
15225
|
+
const [error, setError] = useState55(null);
|
|
15226
|
+
const [loading, setLoading] = useState55(true);
|
|
15196
15227
|
const origin = args.origin ?? (typeof location === "undefined" ? "" : location.origin);
|
|
15197
15228
|
const { secret, requiredMode } = args;
|
|
15198
|
-
|
|
15229
|
+
useEffect42(() => {
|
|
15199
15230
|
let cancelled = false;
|
|
15200
15231
|
setLoading(true);
|
|
15201
15232
|
setError(null);
|
|
@@ -15250,8 +15281,8 @@ function recordsDataSource(client, fallbackSchema = "custom") {
|
|
|
15250
15281
|
}
|
|
15251
15282
|
|
|
15252
15283
|
// src/TablesHome.tsx
|
|
15253
|
-
import { useCallback as useCallback39, useEffect as
|
|
15254
|
-
import { useRecordsClient as
|
|
15284
|
+
import { useCallback as useCallback39, useEffect as useEffect43, useState as useState56 } from "react";
|
|
15285
|
+
import { useRecordsClient as useRecordsClient42, useTables as useTables4 } from "@ai-matrx/records/react";
|
|
15255
15286
|
import { BasicInput as BasicInput18, Button as Button50, Skeleton as Skeleton35, cn as cn53 } from "@ai-matrx/design-system";
|
|
15256
15287
|
|
|
15257
15288
|
// src/createTable.ts
|
|
@@ -15387,15 +15418,15 @@ function laneFor(table) {
|
|
|
15387
15418
|
return "organization";
|
|
15388
15419
|
}
|
|
15389
15420
|
function TablesHome({ onOpenTable, className }) {
|
|
15390
|
-
const client =
|
|
15421
|
+
const client = useRecordsClient42();
|
|
15391
15422
|
const tables = useTables4();
|
|
15392
|
-
const [creating, setCreating] =
|
|
15393
|
-
const [name, setName] =
|
|
15394
|
-
const [busy, setBusy] =
|
|
15395
|
-
const [error, setError] =
|
|
15396
|
-
const [importInto, setImportInto] =
|
|
15397
|
-
const [boards, setBoards] =
|
|
15398
|
-
|
|
15423
|
+
const [creating, setCreating] = useState56(false);
|
|
15424
|
+
const [name, setName] = useState56("");
|
|
15425
|
+
const [busy, setBusy] = useState56(false);
|
|
15426
|
+
const [error, setError] = useState56(null);
|
|
15427
|
+
const [importInto, setImportInto] = useState56(null);
|
|
15428
|
+
const [boards, setBoards] = useState56(null);
|
|
15429
|
+
useEffect43(() => {
|
|
15399
15430
|
let cancelled = false;
|
|
15400
15431
|
void client.dashboards({}).then((result) => {
|
|
15401
15432
|
if (cancelled) return;
|
|
@@ -15529,8 +15560,8 @@ function TablesHome({ onOpenTable, className }) {
|
|
|
15529
15560
|
}
|
|
15530
15561
|
|
|
15531
15562
|
// src/TablePage.tsx
|
|
15532
|
-
import { useCallback as useCallback40, useEffect as
|
|
15533
|
-
import { useFields as useFields24, useRecordsClient as
|
|
15563
|
+
import { useCallback as useCallback40, useEffect as useEffect44, useState as useState57 } from "react";
|
|
15564
|
+
import { useFields as useFields24, useRecordsClient as useRecordsClient43, useTable as useTable23 } from "@ai-matrx/records/react";
|
|
15534
15565
|
import { Button as Button51, Separator as Separator12, Skeleton as Skeleton36, cn as cn54 } from "@ai-matrx/design-system";
|
|
15535
15566
|
import { Fragment as Fragment28, jsx as jsx61, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
15536
15567
|
function filterInWords(filter, fields) {
|
|
@@ -15612,24 +15643,24 @@ function TablePage({
|
|
|
15612
15643
|
filter,
|
|
15613
15644
|
className
|
|
15614
15645
|
}) {
|
|
15615
|
-
const client =
|
|
15646
|
+
const client = useRecordsClient43();
|
|
15616
15647
|
const table = useTable23(tableId);
|
|
15617
15648
|
const rights = useTableRights(table.data);
|
|
15618
15649
|
const pageFields = useFields24(filter ? tableId : null);
|
|
15619
15650
|
const askedInWords = filter ? filterInWords(filter, pageFields.data ?? []) : null;
|
|
15620
|
-
const organizationId =
|
|
15621
|
-
const [view, setView] =
|
|
15651
|
+
const organizationId = useRecordsClient43().config.organizationId;
|
|
15652
|
+
const [view, setView] = useState57(null);
|
|
15622
15653
|
const opening = openingRail(activeRecordId);
|
|
15623
15654
|
const opened = openingView(activeView, activeDashboardId);
|
|
15624
|
-
const [asking, setAsking] =
|
|
15625
|
-
const [layoutFromLink, setLayoutFromLink] =
|
|
15626
|
-
const [surface, setSurface] =
|
|
15655
|
+
const [asking, setAsking] = useState57(null);
|
|
15656
|
+
const [layoutFromLink, setLayoutFromLink] = useState57(opened.layout);
|
|
15657
|
+
const [surface, setSurface] = useState57({
|
|
15627
15658
|
main: opened.main,
|
|
15628
15659
|
rail: opening.rail
|
|
15629
15660
|
});
|
|
15630
15661
|
const { main, rail } = surface;
|
|
15631
15662
|
const setRail = (next) => setSurface((now) => ({ ...now, rail: next }));
|
|
15632
|
-
const [openRecord, setOpenRecord] =
|
|
15663
|
+
const [openRecord, setOpenRecord] = useState57(opening.record);
|
|
15633
15664
|
const viewVersion = useRecordVersion(view?.id ?? null);
|
|
15634
15665
|
const shownLayout = layoutFromLink ?? view?.layout ?? "grid";
|
|
15635
15666
|
const press = (pressed) => {
|
|
@@ -15640,12 +15671,12 @@ function TablePage({
|
|
|
15640
15671
|
}
|
|
15641
15672
|
};
|
|
15642
15673
|
const show = (next) => press({ rail: next });
|
|
15643
|
-
|
|
15674
|
+
useEffect44(() => {
|
|
15644
15675
|
if (!activeRecordId) return;
|
|
15645
15676
|
setOpenRecord(activeRecordId);
|
|
15646
15677
|
setSurface((now) => ({ ...now, rail: "record" }));
|
|
15647
15678
|
}, [activeRecordId]);
|
|
15648
|
-
|
|
15679
|
+
useEffect44(() => {
|
|
15649
15680
|
const named = pageViewFromParam(activeView);
|
|
15650
15681
|
if (named === null) return;
|
|
15651
15682
|
const isLayout = named !== "dashboards" && named !== "archived";
|