@gemina/elements 0.13.1 → 0.13.2
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/dist/chat.cjs +1 -1
- package/dist/chat.cjs.map +1 -1
- package/dist/chat.js +2 -2
- package/dist/{chunk-6KHHCUSJ.js → chunk-HRWPF27V.js} +2 -2
- package/dist/{chunk-A5PZTHDE.js → chunk-JGZOUFGG.js} +46 -25
- package/dist/chunk-JGZOUFGG.js.map +1 -0
- package/dist/{chunk-X5TSIIUP.js → chunk-R7LDCMGS.js} +2 -2
- package/dist/{chunk-X5TSIIUP.js.map → chunk-R7LDCMGS.js.map} +1 -1
- package/dist/index.cjs +45 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/verification.cjs +45 -24
- package/dist/verification.cjs.map +1 -1
- package/dist/verification.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-A5PZTHDE.js.map +0 -1
- /package/dist/{chunk-6KHHCUSJ.js.map → chunk-HRWPF27V.js.map} +0 -0
|
@@ -45,7 +45,7 @@ async function readErrorEnvelope(error) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// src/version.ts
|
|
48
|
-
var VERSION = "0.13.
|
|
48
|
+
var VERSION = "0.13.2";
|
|
49
49
|
|
|
50
50
|
export {
|
|
51
51
|
getResponseLike,
|
|
@@ -53,4 +53,4 @@ export {
|
|
|
53
53
|
readErrorEnvelope,
|
|
54
54
|
VERSION
|
|
55
55
|
};
|
|
56
|
-
//# sourceMappingURL=chunk-
|
|
56
|
+
//# sourceMappingURL=chunk-R7LDCMGS.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internal/response-like.ts","../src/version.ts"],"sourcesContent":["/**\n * Shared transport-error helpers for the widgets (chat + verification).\n *\n * Extracted verbatim from chat.tsx so both components read thrown SDK errors\n * the same way. Pure and dependency-free: no React, no DOM.\n */\n\n/**\n * The response-like object carried by a thrown transport error. We pull it off\n * by shape rather than `instanceof ResponseError` — robust against duplicated\n * `@gemina/sdk` copies in a bundle (class identity is not shared across\n * copies). On the fetch transport this is the raw `Response`, so `status`,\n * `headers`, and the JSON body are all reachable from here.\n */\nexport interface ResponseLike {\n status?: number;\n headers?: { get?: (name: string) => string | null };\n json?: () => Promise<unknown>;\n clone?: () => ResponseLike;\n}\n\nexport function getResponseLike(error: unknown): ResponseLike | undefined {\n if (error !== null && typeof error === 'object' && 'response' in error) {\n const response = (error as { response?: unknown }).response;\n if (response !== null && typeof response === 'object') {\n return response as ResponseLike;\n }\n }\n return undefined;\n}\n\n/** Extract an HTTP status from a thrown value, or `undefined`. */\nexport function httpStatus(error: unknown): number | undefined {\n const status = getResponseLike(error)?.status;\n return typeof status === 'number' ? status : undefined;\n}\n\n/** What the standard backend error envelope reliably carries. */\nexport interface ErrorEnvelope {\n status: number | undefined;\n /** Stable backend `errors[0].error_code`. */\n errorCode: string | undefined;\n /** Human-readable server fallback (`errors[0].description`). */\n description: string | undefined;\n}\n\n/**\n * Read what the backend actually sent on an error. Only the HTTP status and\n * the stable `errors[0].error_code` / `description` are reliable across\n * environments — production strips `errors[0].detail`, so we never touch it.\n * The fetch body can be read once, so we clone defensively; if that fails\n * (non-JSON, empty, or already consumed) the status still stands.\n */\nexport async function readErrorEnvelope(error: unknown): Promise<ErrorEnvelope> {\n const response = getResponseLike(error);\n const info: ErrorEnvelope = {\n status: typeof response?.status === 'number' ? response.status : undefined,\n errorCode: undefined,\n description: undefined,\n };\n if (response === undefined) {\n return info;\n }\n\n let body: unknown;\n try {\n const source = typeof response.clone === 'function' ? response.clone() : response;\n body = typeof source.json === 'function' ? await source.json() : undefined;\n } catch {\n body = undefined;\n }\n if (body !== null && typeof body === 'object') {\n const errors = (body as { errors?: unknown }).errors;\n if (\n Array.isArray(errors) &&\n errors.length > 0 &&\n errors[0] !== null &&\n typeof errors[0] === 'object'\n ) {\n const first = errors[0] as { error_code?: unknown; description?: unknown };\n if (typeof first.error_code === 'string') {\n info.errorCode = first.error_code;\n }\n if (typeof first.description === 'string') {\n info.description = first.description;\n }\n }\n }\n return info;\n}\n","/** Package version. Keep in sync with package.json. */\nexport const VERSION = '0.13.
|
|
1
|
+
{"version":3,"sources":["../src/internal/response-like.ts","../src/version.ts"],"sourcesContent":["/**\n * Shared transport-error helpers for the widgets (chat + verification).\n *\n * Extracted verbatim from chat.tsx so both components read thrown SDK errors\n * the same way. Pure and dependency-free: no React, no DOM.\n */\n\n/**\n * The response-like object carried by a thrown transport error. We pull it off\n * by shape rather than `instanceof ResponseError` — robust against duplicated\n * `@gemina/sdk` copies in a bundle (class identity is not shared across\n * copies). On the fetch transport this is the raw `Response`, so `status`,\n * `headers`, and the JSON body are all reachable from here.\n */\nexport interface ResponseLike {\n status?: number;\n headers?: { get?: (name: string) => string | null };\n json?: () => Promise<unknown>;\n clone?: () => ResponseLike;\n}\n\nexport function getResponseLike(error: unknown): ResponseLike | undefined {\n if (error !== null && typeof error === 'object' && 'response' in error) {\n const response = (error as { response?: unknown }).response;\n if (response !== null && typeof response === 'object') {\n return response as ResponseLike;\n }\n }\n return undefined;\n}\n\n/** Extract an HTTP status from a thrown value, or `undefined`. */\nexport function httpStatus(error: unknown): number | undefined {\n const status = getResponseLike(error)?.status;\n return typeof status === 'number' ? status : undefined;\n}\n\n/** What the standard backend error envelope reliably carries. */\nexport interface ErrorEnvelope {\n status: number | undefined;\n /** Stable backend `errors[0].error_code`. */\n errorCode: string | undefined;\n /** Human-readable server fallback (`errors[0].description`). */\n description: string | undefined;\n}\n\n/**\n * Read what the backend actually sent on an error. Only the HTTP status and\n * the stable `errors[0].error_code` / `description` are reliable across\n * environments — production strips `errors[0].detail`, so we never touch it.\n * The fetch body can be read once, so we clone defensively; if that fails\n * (non-JSON, empty, or already consumed) the status still stands.\n */\nexport async function readErrorEnvelope(error: unknown): Promise<ErrorEnvelope> {\n const response = getResponseLike(error);\n const info: ErrorEnvelope = {\n status: typeof response?.status === 'number' ? response.status : undefined,\n errorCode: undefined,\n description: undefined,\n };\n if (response === undefined) {\n return info;\n }\n\n let body: unknown;\n try {\n const source = typeof response.clone === 'function' ? response.clone() : response;\n body = typeof source.json === 'function' ? await source.json() : undefined;\n } catch {\n body = undefined;\n }\n if (body !== null && typeof body === 'object') {\n const errors = (body as { errors?: unknown }).errors;\n if (\n Array.isArray(errors) &&\n errors.length > 0 &&\n errors[0] !== null &&\n typeof errors[0] === 'object'\n ) {\n const first = errors[0] as { error_code?: unknown; description?: unknown };\n if (typeof first.error_code === 'string') {\n info.errorCode = first.error_code;\n }\n if (typeof first.description === 'string') {\n info.description = first.description;\n }\n }\n }\n return info;\n}\n","/** Package version. Keep in sync with package.json. */\nexport const VERSION = '0.13.2';\n"],"mappings":";AAqBO,SAAS,gBAAgB,OAA0C;AACxE,MAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,cAAc,OAAO;AACtE,UAAM,WAAY,MAAiC;AACnD,QAAI,aAAa,QAAQ,OAAO,aAAa,UAAU;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAGO,SAAS,WAAW,OAAoC;AAC7D,QAAM,SAAS,gBAAgB,KAAK,GAAG;AACvC,SAAO,OAAO,WAAW,WAAW,SAAS;AAC/C;AAkBA,eAAsB,kBAAkB,OAAwC;AAC9E,QAAM,WAAW,gBAAgB,KAAK;AACtC,QAAM,OAAsB;AAAA,IAC1B,QAAQ,OAAO,UAAU,WAAW,WAAW,SAAS,SAAS;AAAA,IACjE,WAAW;AAAA,IACX,aAAa;AAAA,EACf;AACA,MAAI,aAAa,QAAW;AAC1B,WAAO;AAAA,EACT;AAEA,MAAI;AACJ,MAAI;AACF,UAAM,SAAS,OAAO,SAAS,UAAU,aAAa,SAAS,MAAM,IAAI;AACzE,WAAO,OAAO,OAAO,SAAS,aAAa,MAAM,OAAO,KAAK,IAAI;AAAA,EACnE,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI,SAAS,QAAQ,OAAO,SAAS,UAAU;AAC7C,UAAM,SAAU,KAA8B;AAC9C,QACE,MAAM,QAAQ,MAAM,KACpB,OAAO,SAAS,KAChB,OAAO,CAAC,MAAM,QACd,OAAO,OAAO,CAAC,MAAM,UACrB;AACA,YAAM,QAAQ,OAAO,CAAC;AACtB,UAAI,OAAO,MAAM,eAAe,UAAU;AACxC,aAAK,YAAY,MAAM;AAAA,MACzB;AACA,UAAI,OAAO,MAAM,gBAAgB,UAAU;AACzC,aAAK,cAAc,MAAM;AAAA,MAC3B;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;;;ACxFO,IAAM,UAAU;","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -221,7 +221,7 @@ async function readErrorEnvelope(error) {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
// src/version.ts
|
|
224
|
-
var VERSION = "0.13.
|
|
224
|
+
var VERSION = "0.13.2";
|
|
225
225
|
|
|
226
226
|
// src/chat.tsx
|
|
227
227
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -1720,8 +1720,16 @@ function forEachRowUnit(tables, plannedTables, visit) {
|
|
|
1720
1720
|
const meta = row?.[ROW_META_KEY];
|
|
1721
1721
|
return meta?.confidence ?? null;
|
|
1722
1722
|
};
|
|
1723
|
+
const planFor = (tablePointer) => {
|
|
1724
|
+
const exact = plannedTables.get(tablePointer);
|
|
1725
|
+
if (exact !== void 0) return exact;
|
|
1726
|
+
for (const [serverPointer, planned] of plannedTables) {
|
|
1727
|
+
if (matchesTablePointer(serverPointer, tablePointer)) return planned;
|
|
1728
|
+
}
|
|
1729
|
+
return void 0;
|
|
1730
|
+
};
|
|
1723
1731
|
for (const table of tables) {
|
|
1724
|
-
const planned =
|
|
1732
|
+
const planned = planFor(table.pointer);
|
|
1725
1733
|
if (planned) {
|
|
1726
1734
|
for (const row of planned) {
|
|
1727
1735
|
const { source } = row.entry;
|
|
@@ -2857,35 +2865,42 @@ function HeaderSection(props) {
|
|
|
2857
2865
|
}
|
|
2858
2866
|
function EntitySection(props) {
|
|
2859
2867
|
const { entity, shared } = props;
|
|
2860
|
-
const visibleItems = entity.items.map((item) =>
|
|
2861
|
-
|
|
2862
|
-
|
|
2868
|
+
const visibleItems = entity.items.map((item, index) => ({
|
|
2869
|
+
index,
|
|
2870
|
+
cells: Object.fromEntries(
|
|
2871
|
+
Object.entries(item).filter(([, cellValue]) => !shared.hidden.fields.has(cellValue.pointer))
|
|
2872
|
+
)
|
|
2873
|
+
})).filter(({ cells }) => Object.keys(cells).length > 0);
|
|
2863
2874
|
const label = formatLabel(entity.key);
|
|
2864
2875
|
const singular = label.replace(/s$/, "");
|
|
2865
2876
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "gemina-verification__section", "aria-label": label, children: [
|
|
2866
2877
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "gemina-verification__section-header", children: [
|
|
2867
2878
|
label,
|
|
2868
2879
|
" (",
|
|
2869
|
-
|
|
2880
|
+
entity.items.length,
|
|
2870
2881
|
")"
|
|
2871
2882
|
] }),
|
|
2872
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "gemina-verification__section-body", children: visibleItems.map((
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2883
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "gemina-verification__section-body", children: visibleItems.map(({ index, cells }) => (
|
|
2884
|
+
// Keyed by the original index, never the filtered position, or React
|
|
2885
|
+
// reuses a hidden card's DOM (and its focus) for its successor.
|
|
2886
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "gemina-verification__card", children: [
|
|
2887
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "gemina-verification__card-header", children: [
|
|
2888
|
+
singular,
|
|
2889
|
+
" ",
|
|
2890
|
+
index + 1
|
|
2891
|
+
] }),
|
|
2892
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dl", { className: "gemina-verification__dl", children: Object.entries(cells).map(([fieldKey, cell]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2893
|
+
FieldPair,
|
|
2894
|
+
{
|
|
2895
|
+
label: formatLabel(fieldKey),
|
|
2896
|
+
ariaLabel: `${singular} ${index + 1} \u2014 ${formatLabel(fieldKey)}`,
|
|
2897
|
+
cell,
|
|
2898
|
+
shared
|
|
2899
|
+
},
|
|
2900
|
+
fieldKey
|
|
2901
|
+
)) })
|
|
2902
|
+
] }, index)
|
|
2903
|
+
)) })
|
|
2889
2904
|
] });
|
|
2890
2905
|
}
|
|
2891
2906
|
function TableRowView(props) {
|
|
@@ -3076,6 +3091,7 @@ function TableSection(props) {
|
|
|
3076
3091
|
needsReview > 0 ? ` \xB7 ${needsReview} need review` : "",
|
|
3077
3092
|
")"
|
|
3078
3093
|
] }),
|
|
3094
|
+
shared.filterOn && mutable !== void 0 && !shared.readOnly ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "gemina-verification__filter-note", children: "Row editing is off while filtering" }) : null,
|
|
3079
3095
|
table.overallConfidence ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "gemina-verification__overall-confidence", children: [
|
|
3080
3096
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Overall confidence" }),
|
|
3081
3097
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ConfidenceDot, { confidence: table.overallConfidence })
|
|
@@ -3824,6 +3840,10 @@ var VERIFICATION_CSS = `
|
|
|
3824
3840
|
font-size: 12px;
|
|
3825
3841
|
color: var(--gemina-verification-muted);
|
|
3826
3842
|
}
|
|
3843
|
+
.gemina-verification__filter-note {
|
|
3844
|
+
font-size: 12px;
|
|
3845
|
+
color: var(--gemina-verification-muted);
|
|
3846
|
+
}
|
|
3827
3847
|
.gemina-verification__all-scored {
|
|
3828
3848
|
margin: 0;
|
|
3829
3849
|
padding: 12px;
|
|
@@ -4542,6 +4562,7 @@ function GeminaVerification(props) {
|
|
|
4542
4562
|
[classified, rendered, plannedTables, unmatched]
|
|
4543
4563
|
);
|
|
4544
4564
|
const visibleUnits = totalUnits - hidden.fields.size - hidden.rows.size;
|
|
4565
|
+
const allClear = filterOn && totalUnits > 0 && visibleUnits === 0;
|
|
4545
4566
|
const invalidCount = (0, import_react5.useMemo)(() => {
|
|
4546
4567
|
const rowLevel = pairErrors.size;
|
|
4547
4568
|
if (edits.size === 0) {
|
|
@@ -4702,7 +4723,7 @@ function GeminaVerification(props) {
|
|
|
4702
4723
|
onImageExpired: handleImageExpired
|
|
4703
4724
|
}
|
|
4704
4725
|
),
|
|
4705
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4726
|
+
allClear ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "gemina-verification__all-scored", role: "status", children: `Nothing needs review \u2014 all ${totalUnits} fields scored high.` }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4706
4727
|
VerificationForm,
|
|
4707
4728
|
{
|
|
4708
4729
|
classified,
|