@ai-matrx/records-ui 0.116.42 → 0.116.43

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.
@@ -54,7 +54,7 @@ import {
54
54
  useRecordsUi,
55
55
  useTableRights,
56
56
  withoutInternalCodes
57
- } from "./chunk-5IHVQ5MS.js";
57
+ } from "./chunk-KEILC5XG.js";
58
58
  import {
59
59
  kindItemWords,
60
60
  kindLabel,
@@ -4784,7 +4784,7 @@ import { AlchemyMenu } from "@ai-matrx/alchemy/react";
4784
4784
  import { OutboundLink as OutboundLink5 } from "@ai-matrx/kit/outbound-react";
4785
4785
  import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
4786
4786
  import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
4787
- var SaveToTable = lazy(() => import("./SaveToTable-T2CMF2SK.js").then((m) => ({ default: m.SaveToTable })));
4787
+ var SaveToTable = lazy(() => import("./SaveToTable-4B67TPSC.js").then((m) => ({ default: m.SaveToTable })));
4788
4788
  var LONGEST_READ = 5e5;
4789
4789
  var FENCE = /^```(?:json)?[ \t]*\r?\n([\s\S]*?)\r?\n?```$/;
4790
4790
  function isPlainObject(v) {
@@ -12325,4 +12325,4 @@ export {
12325
12325
  RecordNameText,
12326
12326
  HeldChangeDecision
12327
12327
  };
12328
- //# sourceMappingURL=chunk-JKM6DDSD.js.map
12328
+ //# sourceMappingURL=chunk-THRMANHB.js.map
package/dist/index.cjs CHANGED
@@ -996,14 +996,25 @@ function RefusalNotice({
996
996
  className,
997
997
  actions,
998
998
  onKeepEditing,
999
- onDiscard
999
+ onDiscard,
1000
+ onRetry
1000
1001
  }) {
1001
1002
  const archivedOrg = (0, import_core2.archivedOrganizationId)(error);
1002
1003
  if (archivedOrg) {
1003
1004
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ArchivedOrganizationNotice, { organizationId: archivedOrg, error, className });
1004
1005
  }
1005
1006
  const plain2 = refusalForAPerson(error);
1006
- const doors = onKeepEditing || onDiscard ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap items-center gap-1 pt-0.5", "data-refusal-doors": "", children: [
1007
+ const doors = onKeepEditing || onDiscard || onRetry ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap items-center gap-1 pt-0.5", "data-refusal-doors": "", children: [
1008
+ onRetry ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1009
+ "button",
1010
+ {
1011
+ type: "button",
1012
+ "data-refusal-retry": "",
1013
+ className: "rounded border px-2 py-0.5 text-xs hover:bg-muted",
1014
+ onClick: onRetry,
1015
+ children: "Try again"
1016
+ }
1017
+ ) : null,
1007
1018
  onKeepEditing ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1008
1019
  "button",
1009
1020
  {
@@ -43665,8 +43676,14 @@ function ViewNeeds({ layout, tableId, fields, onMade, className }) {
43665
43676
  const choices = options.map((o) => o.trim()).filter((o) => o !== "");
43666
43677
  const suggestion = need.ask(name, choices);
43667
43678
  const make = async () => {
43679
+ const retrying = refused !== null || mutation.error !== null;
43668
43680
  setRefused(null);
43669
- const made = pendingId ?? await mutation.declare({
43681
+ let already = null;
43682
+ if (retrying && !pendingId) {
43683
+ const now = await client.fields({ table_id: tableId });
43684
+ if (now.ok) already = now.data.find((f) => fieldName(f) === name && !fields.some((g) => g.id === f.id))?.id ?? null;
43685
+ }
43686
+ const made = pendingId ?? already ?? await mutation.declare({
43670
43687
  table_id: tableId,
43671
43688
  spec: columnDeclarationFor(need, name, choices, fields)
43672
43689
  });
@@ -43746,8 +43763,8 @@ function ViewNeeds({ layout, tableId, fields, onMade, className }) {
43746
43763
  children: rights.structure ? `${need.missing} ${need.does(name)}` : need.missing
43747
43764
  }
43748
43765
  ),
43749
- mutation.error ? /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(RefusalNotice, { error: mutation.error }) : null,
43750
- refused ? /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(RefusalNotice, { error: refused }) : null,
43766
+ mutation.error ? /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(RefusalNotice, { error: mutation.error, onRetry: rights.structure ? () => void make() : void 0 }) : null,
43767
+ refused ? /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(RefusalNotice, { error: refused, onRetry: rights.structure ? () => void make() : void 0 }) : null,
43751
43768
  pendingId ? /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("p", { className: "mt-2 text-xs text-muted-foreground", children: "The column was accepted but the table does not show it yet. Press Make it work again to look for it \u2014 it will not be added twice." }) : null
43752
43769
  ] });
43753
43770
  }