@ai-matrx/records-ui 0.116.44 → 0.116.46
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 +36 -1
- package/dist/{SaveToTable-EGBEB5WG.js → SaveToTable-SWB2ZN5X.js} +3 -3
- package/dist/{chunk-CV4D2BZY.js → chunk-UTMV5ES2.js} +5 -5
- package/dist/{chunk-CV4D2BZY.js.map → chunk-UTMV5ES2.js.map} +1 -1
- package/dist/{chunk-KP2R7LVO.js → chunk-Y5QOV3XA.js} +79 -76
- package/dist/chunk-Y5QOV3XA.js.map +1 -0
- package/dist/{chunk-KEILC5XG.js → chunk-ZUQUZOL5.js} +43 -20
- package/dist/chunk-ZUQUZOL5.js.map +1 -0
- package/dist/helpers.cjs +6 -4
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.js +6 -4
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +2392 -2332
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +240 -210
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +565 -538
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-KEILC5XG.js.map +0 -1
- package/dist/chunk-KP2R7LVO.js.map +0 -1
- /package/dist/{SaveToTable-EGBEB5WG.js.map → SaveToTable-SWB2ZN5X.js.map} +0 -0
|
@@ -328,23 +328,25 @@ function exampleOf(error) {
|
|
|
328
328
|
const example = detail.example;
|
|
329
329
|
return typeof example === "string" && example.trim() !== "" ? example.trim() : null;
|
|
330
330
|
}
|
|
331
|
+
var TIMED_OUT_SAID = "This took too long. Please try again.";
|
|
331
332
|
function refusalForAPerson(error) {
|
|
332
333
|
const code = error.code ?? "internal";
|
|
334
|
+
const timedOut = code === "timed_out" || error.sqlstate === "57014" || /canceling statement due to statement timeout/i.test(String(error.message ?? ""));
|
|
333
335
|
const ours = error.ours === true;
|
|
334
336
|
const hint = plainSentence(String(error.hint ?? ""));
|
|
335
337
|
const message = ours ? plainSentence(String(error.message ?? "")) : peopleSentence(String(error.message ?? ""));
|
|
336
|
-
const title = TITLE[code] ?? "That was refused";
|
|
338
|
+
const title = timedOut ? TITLE["timed_out"] : TITLE[code] ?? "That was refused";
|
|
337
339
|
const hintIsForEngineers = isDeveloperHint(String(error.hint ?? ""));
|
|
338
340
|
const example = exampleOf(error);
|
|
339
|
-
const remedy = (example ? `Enter it like ${example}.` : null) ?? (hintIsForEngineers ? null : hint.kept) ?? REMEDY[code] ?? REMEDY["internal"];
|
|
341
|
+
const remedy = (example ? `Enter it like ${example}.` : null) ?? (hintIsForEngineers ? null : hint.kept) ?? (timedOut ? REMEDY["timed_out"] : REMEDY[code]) ?? REMEDY["internal"];
|
|
340
342
|
const messageIsForEngineers = isEngineerText(String(error.message ?? ""));
|
|
341
|
-
const said = (messageIsForEngineers ? "" : message.kept ?? "").trim();
|
|
343
|
+
const said = timedOut ? TIMED_OUT_SAID : (messageIsForEngineers ? "" : message.kept ?? "").trim();
|
|
342
344
|
const forEngineers = [
|
|
343
345
|
error.sqlstate ? `SQLSTATE ${error.sqlstate}.` : null,
|
|
344
346
|
// The client's own note about a class it did not recognize, or a call that
|
|
345
347
|
// never reached the store. It is rendered out of sight, never as a sentence.
|
|
346
348
|
error.diagnostic ? error.diagnostic : null,
|
|
347
|
-
messageIsForEngineers ? `Message: ${error.message}` : null,
|
|
349
|
+
messageIsForEngineers || timedOut ? `Message: ${error.message}` : null,
|
|
348
350
|
error.hint && (hintIsForEngineers || hint.kept !== error.hint) ? `Hint: ${error.hint}` : null,
|
|
349
351
|
message.dropped.length > 0 || hint.dropped.length > 0 ? `Dropped from the person's view: ${[...message.dropped, ...hint.dropped].join(" | ")}` : null
|
|
350
352
|
].filter(Boolean).join(" ");
|
|
@@ -374,7 +376,7 @@ function withoutInternalCodes(text) {
|
|
|
374
376
|
|
|
375
377
|
// src/Refusal.tsx
|
|
376
378
|
import { archivedOrganizationId } from "@ai-matrx/records/core";
|
|
377
|
-
import { Alert as Alert2, AlertDescription as AlertDescription2, AlertTitle as AlertTitle2, ErrorBox, cn as cn2 } from "@ai-matrx/design-system";
|
|
379
|
+
import { Alert as Alert2, AlertDescription as AlertDescription2, AlertTitle as AlertTitle2, ErrorBox, TIMED_OUT_SENTENCE as TIMED_OUT_SENTENCE2, cn as cn2 } from "@ai-matrx/design-system";
|
|
378
380
|
|
|
379
381
|
// src/ArchivedOrganizationNotice.tsx
|
|
380
382
|
import { useEffect, useState } from "react";
|
|
@@ -450,8 +452,17 @@ function ArchivedOrganizationNotice({
|
|
|
450
452
|
);
|
|
451
453
|
}
|
|
452
454
|
|
|
455
|
+
// src/refusalSaid.ts
|
|
456
|
+
import { TIMED_OUT_SENTENCE, isTimedOutError } from "@ai-matrx/design-system";
|
|
457
|
+
function refusalTimedOut(error) {
|
|
458
|
+
return isTimedOutError(error);
|
|
459
|
+
}
|
|
460
|
+
function refusalSaid(error) {
|
|
461
|
+
return refusalTimedOut(error) ? TIMED_OUT_SENTENCE : refusalSentence(error);
|
|
462
|
+
}
|
|
463
|
+
|
|
453
464
|
// src/Refusal.tsx
|
|
454
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
465
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
455
466
|
function hintIsMachineIdentity(hint) {
|
|
456
467
|
return isMachineIdentity(hint);
|
|
457
468
|
}
|
|
@@ -473,7 +484,8 @@ function RefusalNotice({
|
|
|
473
484
|
if (archivedOrg) {
|
|
474
485
|
return /* @__PURE__ */ jsx3(ArchivedOrganizationNotice, { organizationId: archivedOrg, error, className });
|
|
475
486
|
}
|
|
476
|
-
const
|
|
487
|
+
const said = refusalForAPerson(error);
|
|
488
|
+
const plain = refusalTimedOut(error) ? { ...said, sentence: TIMED_OUT_SENTENCE2, storeSaid: true } : said;
|
|
477
489
|
const doors = onKeepEditing || onDiscard || onRetry ? /* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap items-center gap-1 pt-0.5", "data-refusal-doors": "", children: [
|
|
478
490
|
onRetry ? /* @__PURE__ */ jsx3(
|
|
479
491
|
"button",
|
|
@@ -528,19 +540,28 @@ function RefusalNotice({
|
|
|
528
540
|
}
|
|
529
541
|
);
|
|
530
542
|
}
|
|
531
|
-
function RefusalLine({
|
|
543
|
+
function RefusalLine({
|
|
544
|
+
error,
|
|
545
|
+
className,
|
|
546
|
+
onRetry
|
|
547
|
+
}) {
|
|
532
548
|
const plain = refusalForAPerson(error);
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
549
|
+
const timedOut = refusalTimedOut(error);
|
|
550
|
+
const line = timedOut ? TIMED_OUT_SENTENCE2 : refusalLineForAPerson(error);
|
|
551
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
552
|
+
/* @__PURE__ */ jsx3(
|
|
553
|
+
ErrorBox,
|
|
554
|
+
{
|
|
555
|
+
"data-refusal-line": "",
|
|
556
|
+
className: cn2("whitespace-normal break-words text-xs text-destructive [overflow-wrap:anywhere]", className),
|
|
557
|
+
message: archivedOrganizationId(error) ? "This organization is archived. An owner can restore it." : line,
|
|
558
|
+
error,
|
|
559
|
+
origin: "records-ui/RefusalLine",
|
|
560
|
+
...plain.forEngineers ? { "data-for-engineers": plain.forEngineers } : {}
|
|
561
|
+
}
|
|
562
|
+
),
|
|
563
|
+
timedOut && onRetry ? /* @__PURE__ */ jsx3("button", { type: "button", "data-refusal-retry": "", className: "rounded border px-2 py-0.5 text-xs hover:bg-muted", onClick: onRetry, children: "Try again" }) : null
|
|
564
|
+
] });
|
|
544
565
|
}
|
|
545
566
|
|
|
546
567
|
// src/PickOrAdd.tsx
|
|
@@ -1357,6 +1378,8 @@ export {
|
|
|
1357
1378
|
refusalLineForAPerson,
|
|
1358
1379
|
refusalIsMissingInput,
|
|
1359
1380
|
withoutInternalCodes,
|
|
1381
|
+
refusalTimedOut,
|
|
1382
|
+
refusalSaid,
|
|
1360
1383
|
hintIsMachineIdentity,
|
|
1361
1384
|
hintForAPerson,
|
|
1362
1385
|
RefusalNotice,
|
|
@@ -1409,4 +1432,4 @@ export {
|
|
|
1409
1432
|
choiceNudgeOf,
|
|
1410
1433
|
useChoiceNudge
|
|
1411
1434
|
};
|
|
1412
|
-
//# sourceMappingURL=chunk-
|
|
1435
|
+
//# sourceMappingURL=chunk-ZUQUZOL5.js.map
|