@deksden-com/cpa-kit-react 0.1.4 → 0.1.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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @deksden-com/cpa-kit-react
2
2
 
3
+ ## 0.1.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [935caa2]
8
+ - @deksden-com/cpa-kit@0.1.6
9
+
10
+ ## 0.1.5
11
+
12
+ ### Patch Changes
13
+
14
+ - Show a loading state while credential capabilities and lists are being fetched rather than falsely reporting unavailable or empty data.
15
+ - @deksden-com/cpa-kit@0.1.5
16
+
3
17
  ## 0.1.4
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ export function CpaConsole(props) {
32
32
  };
33
33
  const [localPanel, setPanel] = useState(props.initialPanel ?? "overview");
34
34
  const panel = props.panel ?? localPanel;
35
- const [status, setStatus] = useState(null), [credentials, setCredentials] = useState([]), [models, setModels] = useState(null), [releases, setReleases] = useState([]), [operations, setOperations] = useState([]);
35
+ const [status, setStatus] = useState(null), [credentials, setCredentials] = useState([]), [credentialsLoaded, setCredentialsLoaded] = useState(false), [models, setModels] = useState(null), [releases, setReleases] = useState([]), [operations, setOperations] = useState([]);
36
36
  const [nextCursor, setNextCursor] = useState(null), [operationId, setOperationId] = useState(props.initialOperationId ?? ""), [operation, setOperation] = useState(null), [error, setError] = useState(null), [loading, setLoading] = useState(false), [pending, setPending] = useState(false);
37
37
  const [draftOperationId, setDraftOperationId] = useState(props.initialOperationId ?? "");
38
38
  const [files, setFiles] = useState([]), [candidate, setCandidate] = useState(props.initialCandidateId ?? null), [preview, setPreview] = useState(null), [mode, setMode] = useState("merge"), [overwrite, setOverwrite] = useState([]), [confirmedRemovals, setConfirmedRemovals] = useState(false);
@@ -59,7 +59,7 @@ export function CpaConsole(props) {
59
59
  setError(null);
60
60
  };
61
61
  const capability = (kind) => status?.capabilities[kind];
62
- const reason = (kind) => capability(kind)?.reasonCode ?? l.unsupported;
62
+ const reason = (kind) => status ? capability(kind)?.reasonCode ?? l.unsupported : l.loading;
63
63
  const can = (kind) => capability(kind)?.enabled === true &&
64
64
  !pending &&
65
65
  (!(operation && active(operation)) || kind === "operation.cancel");
@@ -95,8 +95,10 @@ export function CpaConsole(props) {
95
95
  if (panel === "credentials" &&
96
96
  next.capabilities["credentials.list"]?.enabled) {
97
97
  const list = await client.credentials(controller.signal);
98
- if (!controller.signal.aborted)
98
+ if (!controller.signal.aborted) {
99
99
  setCredentials(list.items);
100
+ setCredentialsLoaded(true);
101
+ }
100
102
  }
101
103
  if (panel === "models" && next.capabilities["models.get"]?.enabled) {
102
104
  const data = await client.models(controller.signal);
@@ -360,7 +362,7 @@ export function CpaConsole(props) {
360
362
  });
361
363
  setCandidate(null);
362
364
  setPreview(null);
363
- }, children: l.cancel })] })] })) : (_jsx("p", { children: l.loading }))] })) : null, _jsxs("section", { className: "cpa-card", children: [_jsx("h3", { children: l.credentials }), !capability("credentials.list")?.enabled ? (_jsx("p", { children: reason("credentials.list") })) : credentials.length ? (credentials.map((c) => (_jsxs("div", { className: "cpa-row", children: [_jsxs("div", { children: [_jsx("strong", { children: c.provider }), _jsx("p", { className: "cpa-mono", children: c.fingerprint }), _jsx("span", { className: "cpa-badge", children: readable(c.usability) })] }), _jsx(Button, { className: "cpa-danger", disabled: !can("credential.delete") || credentials.length <= 1, reason: credentials.length <= 1
365
+ }, children: l.cancel })] })] })) : (_jsx("p", { children: l.loading }))] })) : null, _jsxs("section", { className: "cpa-card", children: [_jsx("h3", { children: l.credentials }), !status || (capability("credentials.list")?.enabled && !credentialsLoaded) ? (_jsx("p", { role: "status", children: l.loading })) : !capability("credentials.list")?.enabled ? (_jsx("p", { children: reason("credentials.list") })) : credentials.length ? (credentials.map((c) => (_jsxs("div", { className: "cpa-row", children: [_jsxs("div", { children: [_jsx("strong", { children: c.provider }), _jsx("p", { className: "cpa-mono", children: c.fingerprint }), _jsx("span", { className: "cpa-badge", children: readable(c.usability) })] }), _jsx(Button, { className: "cpa-danger", disabled: !can("credential.delete") || credentials.length <= 1, reason: credentials.length <= 1
364
366
  ? l.last
365
367
  : !can("credential.delete")
366
368
  ? reason("credential.delete")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deksden-com/cpa-kit-react",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -26,7 +26,7 @@
26
26
  "peerDependencies": {
27
27
  "react": ">=19.2.0 <20",
28
28
  "react-dom": ">=19.2.0 <20",
29
- "@deksden-com/cpa-kit": "0.1.4"
29
+ "@deksden-com/cpa-kit": "0.1.6"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/react": "^19.2.0",
@@ -37,7 +37,7 @@
37
37
  "vitest": "^4.0.15",
38
38
  "@testing-library/react": "^16.3.0",
39
39
  "jsdom": "^26.1.0",
40
- "@deksden-com/cpa-kit": "0.1.4"
40
+ "@deksden-com/cpa-kit": "0.1.6"
41
41
  },
42
42
  "publishConfig": {
43
43
  "registry": "https://registry.npmjs.org/",