bwh-auth 0.5.0 → 0.6.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/README.md +24 -0
- package/dist/index.cjs +436 -122
- package/dist/index.d.cts +77 -1
- package/dist/index.d.ts +77 -1
- package/dist/index.js +427 -121
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -944,25 +944,314 @@ function relyingApplicationsFrom(value) {
|
|
|
944
944
|
}
|
|
945
945
|
|
|
946
946
|
// src/api-credentials-section.tsx
|
|
947
|
+
import * as React6 from "react";
|
|
948
|
+
|
|
949
|
+
// src/scope-picker.tsx
|
|
950
|
+
import { ChevronRight, TriangleAlert } from "lucide-react";
|
|
947
951
|
import * as React5 from "react";
|
|
952
|
+
|
|
953
|
+
// src/scope-selection.ts
|
|
954
|
+
function closeImplications(implications) {
|
|
955
|
+
const closed = {};
|
|
956
|
+
for (const key of Object.keys(implications)) {
|
|
957
|
+
const seen = /* @__PURE__ */ new Set();
|
|
958
|
+
const walk = (id) => {
|
|
959
|
+
for (const needed of implications[id] ?? []) {
|
|
960
|
+
if (needed !== key && !seen.has(needed)) {
|
|
961
|
+
seen.add(needed);
|
|
962
|
+
walk(needed);
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
walk(key);
|
|
967
|
+
if (seen.size > 0) {
|
|
968
|
+
closed[key] = [...seen];
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
return closed;
|
|
972
|
+
}
|
|
973
|
+
function restrictImplications(implications, offered) {
|
|
974
|
+
const result = {};
|
|
975
|
+
for (const [key, needed] of Object.entries(implications ?? {})) {
|
|
976
|
+
if (!offered.has(key) || !Array.isArray(needed)) {
|
|
977
|
+
continue;
|
|
978
|
+
}
|
|
979
|
+
const kept = needed.filter((id) => offered.has(id));
|
|
980
|
+
if (kept.length > 0) {
|
|
981
|
+
result[key] = kept;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
return result;
|
|
985
|
+
}
|
|
986
|
+
function inCatalogOrder(ids, catalog) {
|
|
987
|
+
const wanted = new Set(ids);
|
|
988
|
+
return catalog.filter((id) => wanted.has(id));
|
|
989
|
+
}
|
|
990
|
+
function withScopes(selected, ids, closed) {
|
|
991
|
+
const next = new Set(selected);
|
|
992
|
+
for (const id of ids) {
|
|
993
|
+
next.add(id);
|
|
994
|
+
for (const needed of closed[id] ?? []) {
|
|
995
|
+
next.add(needed);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
return next;
|
|
999
|
+
}
|
|
1000
|
+
function withoutScopes(selected, ids, closed) {
|
|
1001
|
+
const removed = new Set(ids);
|
|
1002
|
+
const next = new Set(selected);
|
|
1003
|
+
for (const id of ids) {
|
|
1004
|
+
next.delete(id);
|
|
1005
|
+
}
|
|
1006
|
+
for (const [scope, needed] of Object.entries(closed)) {
|
|
1007
|
+
if (needed.some((id) => removed.has(id))) {
|
|
1008
|
+
next.delete(scope);
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
return next;
|
|
1012
|
+
}
|
|
1013
|
+
function neededBy(id, selected, closed) {
|
|
1014
|
+
return selected.filter((scope) => scope !== id && (closed[scope] ?? []).includes(id));
|
|
1015
|
+
}
|
|
1016
|
+
function sameSelection(a, b) {
|
|
1017
|
+
if (a.length !== b.length) {
|
|
1018
|
+
return false;
|
|
1019
|
+
}
|
|
1020
|
+
const set = new Set(a);
|
|
1021
|
+
return b.every((id) => set.has(id));
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
// src/scope-picker.tsx
|
|
948
1025
|
import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1026
|
+
function resolveGroups(scopes, groups) {
|
|
1027
|
+
if (!Array.isArray(groups) || groups.length === 0) {
|
|
1028
|
+
return null;
|
|
1029
|
+
}
|
|
1030
|
+
const byId = new Map(scopes.map((scope) => [scope.id, scope]));
|
|
1031
|
+
const placed = /* @__PURE__ */ new Set();
|
|
1032
|
+
const resolved = [];
|
|
1033
|
+
for (const group of groups) {
|
|
1034
|
+
const members = [];
|
|
1035
|
+
for (const id of group.scopes ?? []) {
|
|
1036
|
+
const scope = byId.get(id);
|
|
1037
|
+
if (scope && !placed.has(id)) {
|
|
1038
|
+
placed.add(id);
|
|
1039
|
+
members.push(scope);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
if (members.length > 0) {
|
|
1043
|
+
resolved.push({ id: group.id, label: group.label, description: group.description ?? null, sensitive: group.sensitive === true, scopes: members });
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
const rest = scopes.filter((scope) => !placed.has(scope.id));
|
|
1047
|
+
if (rest.length > 0) {
|
|
1048
|
+
resolved.push({ id: "other", label: "Other permissions", description: null, sensitive: false, scopes: rest });
|
|
1049
|
+
}
|
|
1050
|
+
return resolved.length > 0 ? resolved : null;
|
|
1051
|
+
}
|
|
1052
|
+
function DefaultBadge(props) {
|
|
1053
|
+
return /* @__PURE__ */ jsx4("span", { ...props });
|
|
1054
|
+
}
|
|
1055
|
+
var touchRow = {
|
|
1056
|
+
display: "flex",
|
|
1057
|
+
gap: "0.625rem",
|
|
1058
|
+
alignItems: "flex-start",
|
|
1059
|
+
minHeight: 44,
|
|
1060
|
+
padding: "0.5rem 0",
|
|
1061
|
+
boxSizing: "border-box",
|
|
1062
|
+
overflowWrap: "anywhere"
|
|
1063
|
+
};
|
|
1064
|
+
var mutedStyle = { opacity: 0.7 };
|
|
1065
|
+
var gridStyle = {
|
|
1066
|
+
display: "grid",
|
|
1067
|
+
gridTemplateColumns: "repeat(auto-fill, minmax(min(100%, 300px), 1fr))",
|
|
1068
|
+
gap: "1rem",
|
|
1069
|
+
alignItems: "start"
|
|
1070
|
+
};
|
|
1071
|
+
var boxStyle = { margin: 0, minWidth: 0, border: "1px solid rgba(128, 128, 128, 0.35)", borderRadius: 10, padding: "0.25rem 1rem 0.75rem" };
|
|
1072
|
+
function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected, onChange, components }) {
|
|
1073
|
+
const { Checkbox, Button, Badge, Alert } = resolveAuthComponents(components);
|
|
1074
|
+
const [open, setOpen] = React5.useState({});
|
|
1075
|
+
const catalog = React5.useMemo(() => scopes.map((scope) => scope.id), [scopes]);
|
|
1076
|
+
const closed = React5.useMemo(() => closeImplications(restrictImplications(implications, new Set(catalog))), [implications, catalog]);
|
|
1077
|
+
const layout = React5.useMemo(() => resolveGroups(scopes, groups), [scopes, groups]);
|
|
1078
|
+
const offeredPresets = React5.useMemo(
|
|
1079
|
+
() => (presets ?? []).filter((preset) => preset.scopes.length > 0 && preset.scopes.every((id) => catalog.includes(id))),
|
|
1080
|
+
[presets, catalog]
|
|
1081
|
+
);
|
|
1082
|
+
const cascades = Object.keys(closed).length > 0;
|
|
1083
|
+
const chosen = new Set(selected);
|
|
1084
|
+
const commit = (next) => onChange(inCatalogOrder(next, catalog));
|
|
1085
|
+
const toggle = (id, checked) => {
|
|
1086
|
+
if (layout === null && !cascades) {
|
|
1087
|
+
onChange(checked ? [...selected, id] : selected.filter((value) => value !== id));
|
|
1088
|
+
return;
|
|
1089
|
+
}
|
|
1090
|
+
commit(checked ? withScopes(selected, [id], closed) : withoutScopes(selected, [id], closed));
|
|
1091
|
+
};
|
|
1092
|
+
const renderRow = (scope, grouped) => {
|
|
1093
|
+
const id = `${idPrefix}-${scope.id}`;
|
|
1094
|
+
const needers = neededBy(scope.id, selected, closed);
|
|
1095
|
+
const noteId = `${id}-needed`;
|
|
1096
|
+
const row = /* @__PURE__ */ jsxs4("label", { htmlFor: id, style: grouped ? { ...touchRow, cursor: "pointer" } : { overflowWrap: "anywhere" }, children: [
|
|
1097
|
+
Checkbox ? /* @__PURE__ */ jsx4(Checkbox, { id, checked: chosen.has(scope.id), onCheckedChange: (checked) => toggle(scope.id, checked) }) : /* @__PURE__ */ jsx4(
|
|
1098
|
+
"input",
|
|
1099
|
+
{
|
|
1100
|
+
id,
|
|
1101
|
+
type: "checkbox",
|
|
1102
|
+
checked: chosen.has(scope.id),
|
|
1103
|
+
"aria-describedby": needers.length > 0 ? noteId : void 0,
|
|
1104
|
+
onChange: (event) => toggle(scope.id, event.target.checked),
|
|
1105
|
+
style: grouped ? { flex: "none", width: 16, height: 16, margin: "2px 0 0" } : void 0
|
|
1106
|
+
}
|
|
1107
|
+
),
|
|
1108
|
+
" ",
|
|
1109
|
+
/* @__PURE__ */ jsxs4("span", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: [
|
|
1110
|
+
/* @__PURE__ */ jsx4("code", { children: scope.id }),
|
|
1111
|
+
" ",
|
|
1112
|
+
/* @__PURE__ */ jsx4("span", { style: mutedStyle, children: scope.description })
|
|
1113
|
+
] })
|
|
1114
|
+
] }, scope.id);
|
|
1115
|
+
if (needers.length === 0) {
|
|
1116
|
+
return row;
|
|
1117
|
+
}
|
|
1118
|
+
return /* @__PURE__ */ jsxs4("div", { style: { minWidth: 0 }, children: [
|
|
1119
|
+
row,
|
|
1120
|
+
/* @__PURE__ */ jsxs4("small", { id: noteId, style: { ...mutedStyle, display: "block", paddingLeft: grouped ? 26 : 0, overflowWrap: "anywhere" }, children: [
|
|
1121
|
+
"needed by ",
|
|
1122
|
+
needers.join(", ")
|
|
1123
|
+
] })
|
|
1124
|
+
] }, scope.id);
|
|
1125
|
+
};
|
|
1126
|
+
if (layout === null) {
|
|
1127
|
+
return /* @__PURE__ */ jsxs4("fieldset", { style: { display: "grid", gap: "0.25rem", border: 0, padding: 0, minWidth: 0 }, children: [
|
|
1128
|
+
/* @__PURE__ */ jsx4("legend", { children: "Permissions" }),
|
|
1129
|
+
scopes.map((scope) => renderRow(scope, false))
|
|
1130
|
+
] });
|
|
1131
|
+
}
|
|
1132
|
+
const pressed = offeredPresets.find((preset) => sameSelection(selected, preset.scopes));
|
|
1133
|
+
const plain = layout.filter((group) => !group.sensitive);
|
|
1134
|
+
const sensitive = layout.filter((group) => group.sensitive);
|
|
1135
|
+
const Chip = Badge ?? DefaultBadge;
|
|
1136
|
+
return /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gap: "1rem", minWidth: 0 }, children: [
|
|
1137
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "grid", gap: "0.25rem" }, children: [
|
|
1138
|
+
/* @__PURE__ */ jsx4("strong", { children: "Permissions" }),
|
|
1139
|
+
offeredPresets.length > 0 && /* @__PURE__ */ jsx4("span", { style: mutedStyle, children: "Start from a preset, then adjust any permission below. The credential stores exactly the permissions you tick." })
|
|
1140
|
+
] }),
|
|
1141
|
+
offeredPresets.length > 0 && /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gap: "0.625rem" }, children: [
|
|
1142
|
+
/* @__PURE__ */ jsx4("div", { role: "group", "aria-label": "Presets", style: { display: "flex", flexWrap: "wrap", gap: "0.5rem" }, children: offeredPresets.map((preset) => {
|
|
1143
|
+
const isPressed = pressed?.id === preset.id;
|
|
1144
|
+
return /* @__PURE__ */ jsx4(
|
|
1145
|
+
Button,
|
|
1146
|
+
{
|
|
1147
|
+
type: "button",
|
|
1148
|
+
variant: isPressed ? "default" : "outline",
|
|
1149
|
+
"aria-pressed": isPressed,
|
|
1150
|
+
style: { minHeight: 44, maxWidth: "100%", overflowWrap: "anywhere", whiteSpace: "normal", textAlign: "left" },
|
|
1151
|
+
onClick: () => commit(withScopes([], preset.scopes, closed)),
|
|
1152
|
+
children: preset.label
|
|
1153
|
+
},
|
|
1154
|
+
preset.id
|
|
1155
|
+
);
|
|
1156
|
+
}) }),
|
|
1157
|
+
/* @__PURE__ */ jsx4("p", { "aria-live": "polite", style: { margin: 0, ...mutedStyle, overflowWrap: "anywhere" }, children: pressed ? pressed.description : "Custom selection. Pick a preset to replace it, or keep adjusting below." })
|
|
1158
|
+
] }),
|
|
1159
|
+
plain.length > 0 && /* @__PURE__ */ jsx4("div", { style: gridStyle, children: plain.map((group) => /* @__PURE__ */ jsxs4("fieldset", { style: { ...boxStyle, display: "grid", gridTemplateColumns: "minmax(0, 1fr)" }, children: [
|
|
1160
|
+
/* @__PURE__ */ jsx4("legend", { style: { padding: "0 0.375rem", fontWeight: 600, overflowWrap: "anywhere" }, children: group.label }),
|
|
1161
|
+
group.scopes.map((scope) => renderRow(scope, true))
|
|
1162
|
+
] }, group.id)) }),
|
|
1163
|
+
sensitive.map((group) => {
|
|
1164
|
+
const ids = group.scopes.map((scope) => scope.id);
|
|
1165
|
+
const count = ids.filter((id) => chosen.has(id)).length;
|
|
1166
|
+
const state = count === 0 ? "none" : count === ids.length ? "all" : "some";
|
|
1167
|
+
const parentId = `${idPrefix}-group-${group.id}`;
|
|
1168
|
+
const listId = `${parentId}-scopes`;
|
|
1169
|
+
const isOpen = open[group.id] === true;
|
|
1170
|
+
const warning = group.description !== null && group.description !== "" ? group.description : null;
|
|
1171
|
+
return /* @__PURE__ */ jsxs4("fieldset", { style: { ...boxStyle, display: "grid", gap: "0.375rem", paddingBottom: "0.875rem" }, children: [
|
|
1172
|
+
/* @__PURE__ */ jsxs4("legend", { style: { padding: "0 0.375rem", fontWeight: 600, display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
|
|
1173
|
+
/* @__PURE__ */ jsx4("span", { style: { overflowWrap: "anywhere" }, children: group.label }),
|
|
1174
|
+
/* @__PURE__ */ jsx4(Chip, { style: { fontSize: 12, fontWeight: 500, border: "1px solid currentColor", borderRadius: 999, padding: "3px 8px", lineHeight: 1 }, children: "Sensitive" })
|
|
1175
|
+
] }),
|
|
1176
|
+
warning !== null && (() => {
|
|
1177
|
+
const content = /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
1178
|
+
/* @__PURE__ */ jsx4(TriangleAlert, { "aria-hidden": "true", size: 16, style: { flex: "none", marginTop: 2 } }),
|
|
1179
|
+
/* @__PURE__ */ jsx4("span", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: warning })
|
|
1180
|
+
] });
|
|
1181
|
+
const style = { margin: "0.25rem 0 0", display: "flex", gap: "0.5rem", alignItems: "flex-start" };
|
|
1182
|
+
return Alert ? /* @__PURE__ */ jsx4(Alert, { style, children: content }) : /* @__PURE__ */ jsx4("p", { style: { ...style, color: "#b45309" }, children: content });
|
|
1183
|
+
})(),
|
|
1184
|
+
/* @__PURE__ */ jsxs4("label", { htmlFor: parentId, style: { ...touchRow, cursor: "pointer" }, children: [
|
|
1185
|
+
/* @__PURE__ */ jsx4(
|
|
1186
|
+
"input",
|
|
1187
|
+
{
|
|
1188
|
+
id: parentId,
|
|
1189
|
+
type: "checkbox",
|
|
1190
|
+
checked: state === "all",
|
|
1191
|
+
"aria-checked": state === "some" ? "mixed" : state === "all",
|
|
1192
|
+
ref: (element) => {
|
|
1193
|
+
if (element) {
|
|
1194
|
+
element.indeterminate = state === "some";
|
|
1195
|
+
}
|
|
1196
|
+
},
|
|
1197
|
+
onChange: () => commit(state === "all" ? withoutScopes(selected, ids, closed) : withScopes(selected, ids, closed)),
|
|
1198
|
+
style: { flex: "none", width: 16, height: 16, margin: "2px 0 0" }
|
|
1199
|
+
}
|
|
1200
|
+
),
|
|
1201
|
+
" ",
|
|
1202
|
+
/* @__PURE__ */ jsxs4("span", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: [
|
|
1203
|
+
/* @__PURE__ */ jsx4("strong", { children: group.label }),
|
|
1204
|
+
" ",
|
|
1205
|
+
/* @__PURE__ */ jsx4("span", { style: mutedStyle, children: state === "all" ? `All ${ids.length} ${group.label} permissions are selected.` : state === "some" ? `${count} of ${ids.length} ${group.label} permissions are selected.` : `Selects all ${ids.length} ${group.label} permissions.` })
|
|
1206
|
+
] })
|
|
1207
|
+
] }),
|
|
1208
|
+
/* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsxs4(
|
|
1209
|
+
Button,
|
|
1210
|
+
{
|
|
1211
|
+
type: "button",
|
|
1212
|
+
variant: "ghost",
|
|
1213
|
+
"aria-expanded": isOpen,
|
|
1214
|
+
"aria-controls": listId,
|
|
1215
|
+
style: { minHeight: 44, whiteSpace: "normal", textAlign: "left" },
|
|
1216
|
+
onClick: () => setOpen((current) => ({ ...current, [group.id]: !isOpen })),
|
|
1217
|
+
children: [
|
|
1218
|
+
/* @__PURE__ */ jsx4(ChevronRight, { "aria-hidden": "true", size: 16, style: { flex: "none", transition: "transform 120ms", transform: isOpen ? "rotate(90deg)" : "none" } }),
|
|
1219
|
+
isOpen ? "Hide" : "Adjust",
|
|
1220
|
+
" individual ",
|
|
1221
|
+
group.label,
|
|
1222
|
+
" permissions"
|
|
1223
|
+
]
|
|
1224
|
+
}
|
|
1225
|
+
) }),
|
|
1226
|
+
isOpen && /* @__PURE__ */ jsx4("div", { id: listId, style: { ...gridStyle, columnGap: "1.5rem", gap: "0 1.5rem", paddingLeft: "1.5rem", marginLeft: 7, borderLeft: "2px solid rgba(128, 128, 128, 0.35)" }, children: group.scopes.map((scope) => renderRow(scope, true)) })
|
|
1227
|
+
] }, group.id);
|
|
1228
|
+
}),
|
|
1229
|
+
/* @__PURE__ */ jsxs4("div", { style: { borderTop: "1px solid rgba(128, 128, 128, 0.35)", paddingTop: "0.875rem", display: "grid", gap: "0.5rem" }, children: [
|
|
1230
|
+
/* @__PURE__ */ jsx4("p", { style: { margin: 0, fontWeight: 500 }, role: "status", children: selected.length === 0 ? "No permissions selected." : `This credential will request ${selected.length} ${selected.length === 1 ? "permission" : "permissions"}:` }),
|
|
1231
|
+
selected.length > 0 && /* @__PURE__ */ jsx4("p", { style: { margin: 0, display: "flex", flexWrap: "wrap", gap: "0.375rem" }, children: selected.map((id) => /* @__PURE__ */ jsx4("code", { style: { overflowWrap: "anywhere" }, children: id }, id)) })
|
|
1232
|
+
] })
|
|
1233
|
+
] });
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
// src/api-credentials-section.tsx
|
|
1237
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
949
1238
|
function ApiCredentialsSection({ indexUrl, components, links = [], csrfToken, request, onSuccess, onError }) {
|
|
950
1239
|
const { Card, CardContent, CardDescription, CardHeader, CardTitle } = resolveAuthComponents(components);
|
|
951
|
-
const [index, setIndex] =
|
|
952
|
-
const [issued, setIssued] =
|
|
953
|
-
const issuedKey =
|
|
954
|
-
const addIssued =
|
|
1240
|
+
const [index, setIndex] = React6.useState(null);
|
|
1241
|
+
const [issued, setIssued] = React6.useState([]);
|
|
1242
|
+
const issuedKey = React6.useRef(0);
|
|
1243
|
+
const addIssued = React6.useCallback((credential) => {
|
|
955
1244
|
issuedKey.current += 1;
|
|
956
1245
|
const key = issuedKey.current;
|
|
957
1246
|
setIssued((current) => [...current, { key, credential }]);
|
|
958
1247
|
}, []);
|
|
959
|
-
const [loadError, setLoadError] =
|
|
960
|
-
const onErrorRef =
|
|
1248
|
+
const [loadError, setLoadError] = React6.useState(null);
|
|
1249
|
+
const onErrorRef = React6.useRef(onError);
|
|
961
1250
|
onErrorRef.current = onError;
|
|
962
|
-
const generation =
|
|
963
|
-
const context =
|
|
1251
|
+
const generation = React6.useRef(0);
|
|
1252
|
+
const context = React6.useRef({ indexUrl, csrfToken, request });
|
|
964
1253
|
context.current = { indexUrl, csrfToken, request };
|
|
965
|
-
const reload =
|
|
1254
|
+
const reload = React6.useCallback(async () => {
|
|
966
1255
|
generation.current += 1;
|
|
967
1256
|
const mine = generation.current;
|
|
968
1257
|
const { indexUrl: url, csrfToken: token, request: send } = context.current;
|
|
@@ -978,31 +1267,31 @@ function ApiCredentialsSection({ indexUrl, components, links = [], csrfToken, re
|
|
|
978
1267
|
onErrorRef.current?.("api-credentials", result.message);
|
|
979
1268
|
}
|
|
980
1269
|
}, []);
|
|
981
|
-
|
|
1270
|
+
React6.useEffect(() => {
|
|
982
1271
|
setIndex(null);
|
|
983
1272
|
void reload();
|
|
984
1273
|
}, [indexUrl, csrfToken, reload]);
|
|
985
|
-
const removeLocally =
|
|
1274
|
+
const removeLocally = React6.useCallback((list, id) => {
|
|
986
1275
|
setIndex(
|
|
987
1276
|
(current) => current === null ? current : list === "tokens" ? { ...current, tokens: current.tokens.filter((token) => token.id !== id) } : { ...current, apps: current.apps.filter((app) => app.id !== id) }
|
|
988
1277
|
);
|
|
989
1278
|
}, []);
|
|
990
1279
|
const shared = { components, csrfToken, request, onError, onSuccess, removeLocally };
|
|
991
|
-
return /* @__PURE__ */
|
|
992
|
-
/* @__PURE__ */
|
|
993
|
-
/* @__PURE__ */
|
|
994
|
-
/* @__PURE__ */
|
|
1280
|
+
return /* @__PURE__ */ jsxs5(Card, { children: [
|
|
1281
|
+
/* @__PURE__ */ jsxs5(CardHeader, { children: [
|
|
1282
|
+
/* @__PURE__ */ jsx5(CardTitle, { children: "API access" }),
|
|
1283
|
+
/* @__PURE__ */ jsx5(CardDescription, { children: "Connect apps that use the API. Register an OAuth app for apps that sign you in, or create an API token for apps that ask for a key. Each carries only the permissions you choose, and never more than your own access." })
|
|
995
1284
|
] }),
|
|
996
|
-
/* @__PURE__ */
|
|
997
|
-
links.length > 0 && /* @__PURE__ */
|
|
998
|
-
/* @__PURE__ */
|
|
999
|
-
/* @__PURE__ */
|
|
1000
|
-
/* @__PURE__ */
|
|
1285
|
+
/* @__PURE__ */ jsx5(CardContent, { children: /* @__PURE__ */ jsxs5("div", { style: { display: "grid", gap: "1.5rem", minWidth: 0 }, children: [
|
|
1286
|
+
links.length > 0 && /* @__PURE__ */ jsx5("dl", { style: { display: "grid", gap: "0.5rem", minWidth: 0 }, children: links.map((link) => /* @__PURE__ */ jsxs5("div", { style: { minWidth: 0 }, children: [
|
|
1287
|
+
/* @__PURE__ */ jsx5("dt", { children: link.label }),
|
|
1288
|
+
/* @__PURE__ */ jsxs5("dd", { style: { margin: 0, overflowWrap: "anywhere" }, children: [
|
|
1289
|
+
/* @__PURE__ */ jsx5("code", { children: link.url }),
|
|
1001
1290
|
" ",
|
|
1002
|
-
/* @__PURE__ */
|
|
1291
|
+
/* @__PURE__ */ jsx5(CopyButton, { text: link.url, label: link.label, components })
|
|
1003
1292
|
] })
|
|
1004
1293
|
] }, link.label)) }),
|
|
1005
|
-
issued.map(({ key, credential }) => /* @__PURE__ */
|
|
1294
|
+
issued.map(({ key, credential }) => /* @__PURE__ */ jsx5(
|
|
1006
1295
|
IssuedNotice,
|
|
1007
1296
|
{
|
|
1008
1297
|
issued: credential,
|
|
@@ -1011,29 +1300,36 @@ function ApiCredentialsSection({ indexUrl, components, links = [], csrfToken, re
|
|
|
1011
1300
|
},
|
|
1012
1301
|
key
|
|
1013
1302
|
)),
|
|
1014
|
-
loadError !== null && /* @__PURE__ */
|
|
1015
|
-
index !== null && /* @__PURE__ */
|
|
1016
|
-
(index.issue_token_href === null || index.register_app_href === null) && /* @__PURE__ */
|
|
1017
|
-
/* @__PURE__ */
|
|
1018
|
-
/* @__PURE__ */
|
|
1303
|
+
loadError !== null && /* @__PURE__ */ jsx5("p", { role: "alert", children: loadError }),
|
|
1304
|
+
index !== null && /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1305
|
+
(index.issue_token_href === null || index.register_app_href === null) && /* @__PURE__ */ jsx5("p", { role: "status", children: "Creating new credentials is unavailable right now. You can still revoke existing ones." }),
|
|
1306
|
+
/* @__PURE__ */ jsx5(TokenSection, { index, ...shared, onIssued: addIssued, reload }),
|
|
1307
|
+
/* @__PURE__ */ jsx5(AppSection, { index, ...shared, onIssued: addIssued, reload })
|
|
1019
1308
|
] })
|
|
1020
1309
|
] }) })
|
|
1021
1310
|
] });
|
|
1022
1311
|
}
|
|
1023
1312
|
function TokenSection({ index, components, csrfToken, request, onIssued, reload, onSuccess, onError, removeLocally }) {
|
|
1024
1313
|
const { Button, Input, Label, RadioGroup } = resolveAuthComponents(components);
|
|
1025
|
-
const [name, setName] =
|
|
1026
|
-
const [scopes, setScopes] =
|
|
1027
|
-
const [lifetime, setLifetime] =
|
|
1028
|
-
const
|
|
1029
|
-
|
|
1314
|
+
const [name, setName] = React6.useState("");
|
|
1315
|
+
const [scopes, setScopes] = React6.useState([]);
|
|
1316
|
+
const [lifetime, setLifetime] = React6.useState(index.token_lifetimes[0] ?? "");
|
|
1317
|
+
const tokenScopes = React6.useMemo(
|
|
1318
|
+
() => [...index.token_scopes ?? index.scopes, ...index.token_connection_scopes ?? []],
|
|
1319
|
+
[index.token_scopes, index.scopes, index.token_connection_scopes]
|
|
1320
|
+
);
|
|
1321
|
+
const connectionIds = new Set((index.token_connection_scopes ?? []).map((scope) => scope.id));
|
|
1322
|
+
const lifetimes = index.connection_token_lifetimes && index.connection_token_lifetimes.length > 0 && scopes.some((id) => connectionIds.has(id)) ? index.connection_token_lifetimes : index.token_lifetimes;
|
|
1323
|
+
const effectiveLifetime = lifetimes.includes(lifetime) ? lifetime : lifetimes[0] ?? "";
|
|
1324
|
+
const [busy, setBusy] = React6.useState(false);
|
|
1325
|
+
const [error, setError] = React6.useState(null);
|
|
1030
1326
|
async function create(event) {
|
|
1031
1327
|
event.preventDefault();
|
|
1032
1328
|
if (index.issue_token_href === null) {
|
|
1033
1329
|
return;
|
|
1034
1330
|
}
|
|
1035
1331
|
setBusy(true);
|
|
1036
|
-
const result = await credentialRequest("POST", index.issue_token_href, { name, scopes, lifetime }, csrfToken, request);
|
|
1332
|
+
const result = await credentialRequest("POST", index.issue_token_href, { name, scopes, lifetime: effectiveLifetime }, csrfToken, request);
|
|
1037
1333
|
setBusy(false);
|
|
1038
1334
|
if (!result.ok) {
|
|
1039
1335
|
setError(result.message);
|
|
@@ -1047,7 +1343,7 @@ function TokenSection({ index, components, csrfToken, request, onIssued, reload,
|
|
|
1047
1343
|
onSuccess?.("API token created.");
|
|
1048
1344
|
await reload();
|
|
1049
1345
|
}
|
|
1050
|
-
const [pending, setPending] =
|
|
1346
|
+
const [pending, setPending] = React6.useState([]);
|
|
1051
1347
|
async function revoke(token) {
|
|
1052
1348
|
if (pending.includes(token.id)) {
|
|
1053
1349
|
return;
|
|
@@ -1066,54 +1362,67 @@ function TokenSection({ index, components, csrfToken, request, onIssued, reload,
|
|
|
1066
1362
|
await reload();
|
|
1067
1363
|
setPending((current) => current.filter((id) => id !== token.id));
|
|
1068
1364
|
}
|
|
1069
|
-
return /* @__PURE__ */
|
|
1070
|
-
/* @__PURE__ */
|
|
1071
|
-
index.issue_token_href !== null && /* @__PURE__ */
|
|
1072
|
-
/* @__PURE__ */
|
|
1073
|
-
/* @__PURE__ */
|
|
1074
|
-
/* @__PURE__ */
|
|
1365
|
+
return /* @__PURE__ */ jsxs5("section", { style: { display: "grid", gap: "0.75rem", minWidth: 0 }, children: [
|
|
1366
|
+
/* @__PURE__ */ jsx5("h3", { children: "API tokens" }),
|
|
1367
|
+
index.issue_token_href !== null && /* @__PURE__ */ jsxs5("form", { onSubmit: create, style: { display: "grid", gap: "0.75rem" }, children: [
|
|
1368
|
+
/* @__PURE__ */ jsxs5("div", { style: { display: "grid", gap: "0.25rem" }, children: [
|
|
1369
|
+
/* @__PURE__ */ jsx5(Label, { htmlFor: "api-token-name", children: "Token name" }),
|
|
1370
|
+
/* @__PURE__ */ jsx5(Input, { id: "api-token-name", value: name, maxLength: 120, onChange: (event) => setName(event.target.value) })
|
|
1075
1371
|
] }),
|
|
1076
|
-
/* @__PURE__ */
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1372
|
+
/* @__PURE__ */ jsx5(
|
|
1373
|
+
ScopePicker,
|
|
1374
|
+
{
|
|
1375
|
+
idPrefix: "api-token-scope",
|
|
1376
|
+
scopes: tokenScopes,
|
|
1377
|
+
groups: index.token_scope_groups ?? index.scope_groups,
|
|
1378
|
+
presets: index.token_scope_presets ?? index.scope_presets,
|
|
1379
|
+
implications: index.token_scope_implications ?? index.scope_implications,
|
|
1380
|
+
selected: scopes,
|
|
1381
|
+
onChange: setScopes,
|
|
1382
|
+
components
|
|
1383
|
+
}
|
|
1384
|
+
),
|
|
1385
|
+
/* @__PURE__ */ jsxs5("fieldset", { style: { display: "grid", gap: "0.25rem", border: 0, padding: 0 }, children: [
|
|
1386
|
+
/* @__PURE__ */ jsx5("legend", { children: "Expires after" }),
|
|
1387
|
+
RadioGroup ? /* @__PURE__ */ jsx5(
|
|
1080
1388
|
RadioGroup,
|
|
1081
1389
|
{
|
|
1082
1390
|
name: "api-token-lifetime",
|
|
1083
|
-
value:
|
|
1391
|
+
value: effectiveLifetime,
|
|
1084
1392
|
onValueChange: setLifetime,
|
|
1085
|
-
options:
|
|
1393
|
+
options: lifetimes.map((spec) => ({ value: spec, label: describeDuration(spec) }))
|
|
1086
1394
|
}
|
|
1087
|
-
) :
|
|
1088
|
-
/* @__PURE__ */
|
|
1395
|
+
) : lifetimes.map((spec) => /* @__PURE__ */ jsxs5("label", { children: [
|
|
1396
|
+
/* @__PURE__ */ jsx5("input", { type: "radio", name: "api-token-lifetime", checked: effectiveLifetime === spec, onChange: () => setLifetime(spec) }),
|
|
1089
1397
|
" ",
|
|
1090
1398
|
describeDuration(spec)
|
|
1091
1399
|
] }, spec))
|
|
1092
1400
|
] }),
|
|
1093
|
-
/* @__PURE__ */
|
|
1401
|
+
/* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsx5(Button, { type: "submit", disabled: busy || name.trim() === "" || scopes.length === 0 || effectiveLifetime === "", children: "Create API token" }) })
|
|
1094
1402
|
] }),
|
|
1095
|
-
error !== null && /* @__PURE__ */
|
|
1096
|
-
/* @__PURE__ */
|
|
1097
|
-
/* @__PURE__ */
|
|
1403
|
+
error !== null && /* @__PURE__ */ jsx5("p", { role: "alert", children: error }),
|
|
1404
|
+
/* @__PURE__ */ jsx5("ul", { style: { display: "grid", gap: "0.5rem", listStyle: "none", padding: 0, margin: 0, minWidth: 0 }, children: index.tokens.map((token) => /* @__PURE__ */ jsxs5("li", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: [
|
|
1405
|
+
/* @__PURE__ */ jsx5("strong", { children: token.name }),
|
|
1098
1406
|
" \xB7 ",
|
|
1099
1407
|
token.scopes.join(", "),
|
|
1100
|
-
token.
|
|
1408
|
+
token.connection === true && /* @__PURE__ */ jsx5(Fragment2, { children: " \xB7 MCP connection" }),
|
|
1409
|
+
token.expires_at !== null && /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1101
1410
|
" \xB7 expires ",
|
|
1102
1411
|
new Date(token.expires_at).toLocaleString()
|
|
1103
1412
|
] }),
|
|
1104
1413
|
" ",
|
|
1105
|
-
/* @__PURE__ */
|
|
1414
|
+
/* @__PURE__ */ jsx5(Button, { type: "button", disabled: pending.includes(token.id), onClick: () => void revoke(token), children: "Revoke" })
|
|
1106
1415
|
] }, token.id)) })
|
|
1107
1416
|
] });
|
|
1108
1417
|
}
|
|
1109
1418
|
function AppSection({ index, components, csrfToken, request, onIssued, reload, onSuccess, onError, removeLocally }) {
|
|
1110
1419
|
const { Button, Input, Label, Textarea, RadioGroup } = resolveAuthComponents(components);
|
|
1111
|
-
const [name, setName] =
|
|
1112
|
-
const [redirects, setRedirects] =
|
|
1113
|
-
const [confidential, setConfidential] =
|
|
1114
|
-
const [scopes, setScopes] =
|
|
1115
|
-
const [busy, setBusy] =
|
|
1116
|
-
const [error, setError] =
|
|
1420
|
+
const [name, setName] = React6.useState("");
|
|
1421
|
+
const [redirects, setRedirects] = React6.useState("");
|
|
1422
|
+
const [confidential, setConfidential] = React6.useState(true);
|
|
1423
|
+
const [scopes, setScopes] = React6.useState([]);
|
|
1424
|
+
const [busy, setBusy] = React6.useState(false);
|
|
1425
|
+
const [error, setError] = React6.useState(null);
|
|
1117
1426
|
const redirectUris = redirects.split("\n").map((line) => line.trim()).filter((line) => line !== "");
|
|
1118
1427
|
async function register(event) {
|
|
1119
1428
|
event.preventDefault();
|
|
@@ -1142,7 +1451,7 @@ function AppSection({ index, components, csrfToken, request, onIssued, reload, o
|
|
|
1142
1451
|
onSuccess?.("OAuth app registered.");
|
|
1143
1452
|
await reload();
|
|
1144
1453
|
}
|
|
1145
|
-
const [pending, setPending] =
|
|
1454
|
+
const [pending, setPending] = React6.useState([]);
|
|
1146
1455
|
async function remove(app) {
|
|
1147
1456
|
if (pending.includes(app.id)) {
|
|
1148
1457
|
return;
|
|
@@ -1161,20 +1470,20 @@ function AppSection({ index, components, csrfToken, request, onIssued, reload, o
|
|
|
1161
1470
|
await reload();
|
|
1162
1471
|
setPending((current) => current.filter((id) => id !== app.id));
|
|
1163
1472
|
}
|
|
1164
|
-
return /* @__PURE__ */
|
|
1165
|
-
/* @__PURE__ */
|
|
1166
|
-
index.register_app_href !== null && /* @__PURE__ */
|
|
1167
|
-
/* @__PURE__ */
|
|
1168
|
-
/* @__PURE__ */
|
|
1169
|
-
/* @__PURE__ */
|
|
1473
|
+
return /* @__PURE__ */ jsxs5("section", { style: { display: "grid", gap: "0.75rem", minWidth: 0 }, children: [
|
|
1474
|
+
/* @__PURE__ */ jsx5("h3", { children: "OAuth apps" }),
|
|
1475
|
+
index.register_app_href !== null && /* @__PURE__ */ jsxs5("form", { onSubmit: register, style: { display: "grid", gap: "0.75rem" }, children: [
|
|
1476
|
+
/* @__PURE__ */ jsxs5("div", { style: { display: "grid", gap: "0.25rem" }, children: [
|
|
1477
|
+
/* @__PURE__ */ jsx5(Label, { htmlFor: "oauth-app-name", children: "App name" }),
|
|
1478
|
+
/* @__PURE__ */ jsx5(Input, { id: "oauth-app-name", value: name, maxLength: 120, onChange: (event) => setName(event.target.value) })
|
|
1170
1479
|
] }),
|
|
1171
|
-
/* @__PURE__ */
|
|
1172
|
-
/* @__PURE__ */
|
|
1173
|
-
Textarea ? /* @__PURE__ */
|
|
1480
|
+
/* @__PURE__ */ jsxs5("div", { style: { display: "grid", gap: "0.25rem" }, children: [
|
|
1481
|
+
/* @__PURE__ */ jsx5(Label, { htmlFor: "oauth-app-redirects", children: "Redirect URIs (one per line)" }),
|
|
1482
|
+
Textarea ? /* @__PURE__ */ jsx5(Textarea, { id: "oauth-app-redirects", rows: 3, value: redirects, onChange: (event) => setRedirects(event.target.value) }) : /* @__PURE__ */ jsx5("textarea", { id: "oauth-app-redirects", rows: 3, value: redirects, onChange: (event) => setRedirects(event.target.value) })
|
|
1174
1483
|
] }),
|
|
1175
|
-
/* @__PURE__ */
|
|
1176
|
-
/* @__PURE__ */
|
|
1177
|
-
RadioGroup ? /* @__PURE__ */
|
|
1484
|
+
/* @__PURE__ */ jsxs5("fieldset", { style: { display: "grid", gap: "0.25rem", border: 0, padding: 0 }, children: [
|
|
1485
|
+
/* @__PURE__ */ jsx5("legend", { children: "Client type" }),
|
|
1486
|
+
RadioGroup ? /* @__PURE__ */ jsx5(
|
|
1178
1487
|
RadioGroup,
|
|
1179
1488
|
{
|
|
1180
1489
|
name: "oauth-app-type",
|
|
@@ -1185,60 +1494,49 @@ function AppSection({ index, components, csrfToken, request, onIssued, reload, o
|
|
|
1185
1494
|
{ value: "public", label: "Public: no secret, PKCE only" }
|
|
1186
1495
|
]
|
|
1187
1496
|
}
|
|
1188
|
-
) : /* @__PURE__ */
|
|
1189
|
-
/* @__PURE__ */
|
|
1190
|
-
/* @__PURE__ */
|
|
1497
|
+
) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1498
|
+
/* @__PURE__ */ jsxs5("label", { children: [
|
|
1499
|
+
/* @__PURE__ */ jsx5("input", { type: "radio", name: "oauth-app-type", checked: confidential, onChange: () => setConfidential(true) }),
|
|
1191
1500
|
" Confidential: the app keeps a client secret on its server"
|
|
1192
1501
|
] }),
|
|
1193
|
-
/* @__PURE__ */
|
|
1194
|
-
/* @__PURE__ */
|
|
1502
|
+
/* @__PURE__ */ jsxs5("label", { children: [
|
|
1503
|
+
/* @__PURE__ */ jsx5("input", { type: "radio", name: "oauth-app-type", checked: !confidential, onChange: () => setConfidential(false) }),
|
|
1195
1504
|
" Public: no secret, PKCE only"
|
|
1196
1505
|
] })
|
|
1197
1506
|
] })
|
|
1198
1507
|
] }),
|
|
1199
|
-
/* @__PURE__ */
|
|
1200
|
-
|
|
1508
|
+
/* @__PURE__ */ jsx5(
|
|
1509
|
+
ScopePicker,
|
|
1510
|
+
{
|
|
1511
|
+
idPrefix: "oauth-app-scope",
|
|
1512
|
+
scopes: index.scopes,
|
|
1513
|
+
groups: index.scope_groups,
|
|
1514
|
+
presets: index.scope_presets,
|
|
1515
|
+
implications: index.scope_implications,
|
|
1516
|
+
selected: scopes,
|
|
1517
|
+
onChange: setScopes,
|
|
1518
|
+
components
|
|
1519
|
+
}
|
|
1520
|
+
),
|
|
1521
|
+
/* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsx5(Button, { type: "submit", disabled: busy || name.trim() === "" || redirectUris.length === 0 || scopes.length === 0, children: "Register OAuth app" }) })
|
|
1201
1522
|
] }),
|
|
1202
|
-
error !== null && /* @__PURE__ */
|
|
1203
|
-
/* @__PURE__ */
|
|
1204
|
-
/* @__PURE__ */
|
|
1523
|
+
error !== null && /* @__PURE__ */ jsx5("p", { role: "alert", children: error }),
|
|
1524
|
+
/* @__PURE__ */ jsx5("ul", { style: { display: "grid", gap: "0.5rem", listStyle: "none", padding: 0, margin: 0, minWidth: 0 }, children: index.apps.map((app) => /* @__PURE__ */ jsxs5("li", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: [
|
|
1525
|
+
/* @__PURE__ */ jsx5("strong", { children: app.name }),
|
|
1205
1526
|
" \xB7 client ID ",
|
|
1206
|
-
/* @__PURE__ */
|
|
1527
|
+
/* @__PURE__ */ jsx5("code", { children: app.id }),
|
|
1207
1528
|
" \xB7 ",
|
|
1208
1529
|
app.confidential ? "confidential" : "public",
|
|
1209
|
-
/* @__PURE__ */
|
|
1530
|
+
/* @__PURE__ */ jsx5("br", {}),
|
|
1210
1531
|
app.redirect_uris.join(", "),
|
|
1211
|
-
/* @__PURE__ */
|
|
1532
|
+
/* @__PURE__ */ jsx5("br", {}),
|
|
1212
1533
|
"May request: ",
|
|
1213
1534
|
app.scopes.join(", "),
|
|
1214
1535
|
" ",
|
|
1215
|
-
/* @__PURE__ */
|
|
1536
|
+
/* @__PURE__ */ jsx5(Button, { type: "button", disabled: pending.includes(app.id), onClick: () => void remove(app), children: "Delete" })
|
|
1216
1537
|
] }, app.id)) })
|
|
1217
1538
|
] });
|
|
1218
1539
|
}
|
|
1219
|
-
function ScopePicker({
|
|
1220
|
-
idPrefix,
|
|
1221
|
-
scopes,
|
|
1222
|
-
selected,
|
|
1223
|
-
onChange,
|
|
1224
|
-
components
|
|
1225
|
-
}) {
|
|
1226
|
-
const { Checkbox } = resolveAuthComponents(components);
|
|
1227
|
-
const toggle = (scopeId, checked) => onChange(checked ? [...selected, scopeId] : selected.filter((value) => value !== scopeId));
|
|
1228
|
-
return /* @__PURE__ */ jsxs4("fieldset", { style: { display: "grid", gap: "0.25rem", border: 0, padding: 0, minWidth: 0 }, children: [
|
|
1229
|
-
/* @__PURE__ */ jsx4("legend", { children: "Permissions" }),
|
|
1230
|
-
scopes.map((scope) => {
|
|
1231
|
-
const id = `${idPrefix}-${scope.id}`;
|
|
1232
|
-
return /* @__PURE__ */ jsxs4("label", { htmlFor: id, style: { overflowWrap: "anywhere" }, children: [
|
|
1233
|
-
Checkbox ? /* @__PURE__ */ jsx4(Checkbox, { id, checked: selected.includes(scope.id), onCheckedChange: (checked) => toggle(scope.id, checked) }) : /* @__PURE__ */ jsx4("input", { id, type: "checkbox", checked: selected.includes(scope.id), onChange: (event) => toggle(scope.id, event.target.checked) }),
|
|
1234
|
-
" ",
|
|
1235
|
-
/* @__PURE__ */ jsx4("code", { children: scope.id }),
|
|
1236
|
-
" ",
|
|
1237
|
-
scope.description
|
|
1238
|
-
] }, scope.id);
|
|
1239
|
-
})
|
|
1240
|
-
] });
|
|
1241
|
-
}
|
|
1242
1540
|
function IssuedNotice({
|
|
1243
1541
|
issued,
|
|
1244
1542
|
components,
|
|
@@ -1249,26 +1547,26 @@ function IssuedNotice({
|
|
|
1249
1547
|
{ label: "Client ID", url: issued.client_id },
|
|
1250
1548
|
...issued.client_secret !== null ? [{ label: "Client secret", url: issued.client_secret }] : []
|
|
1251
1549
|
];
|
|
1252
|
-
return /* @__PURE__ */
|
|
1253
|
-
/* @__PURE__ */
|
|
1550
|
+
return /* @__PURE__ */ jsxs5("div", { role: "status", style: { display: "grid", gap: "0.5rem", minWidth: 0 }, children: [
|
|
1551
|
+
/* @__PURE__ */ jsxs5("p", { style: { overflowWrap: "anywhere" }, children: [
|
|
1254
1552
|
issued.kind === "token" ? `API token \u201C${issued.name}\u201D created.` : `OAuth app \u201C${issued.name}\u201D registered.`,
|
|
1255
1553
|
" Copy it now: it will not be shown again."
|
|
1256
1554
|
] }),
|
|
1257
|
-
values.map((value) => /* @__PURE__ */
|
|
1555
|
+
values.map((value) => /* @__PURE__ */ jsxs5("div", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: [
|
|
1258
1556
|
value.label,
|
|
1259
1557
|
": ",
|
|
1260
|
-
/* @__PURE__ */
|
|
1558
|
+
/* @__PURE__ */ jsx5("code", { children: value.url }),
|
|
1261
1559
|
" ",
|
|
1262
|
-
/* @__PURE__ */
|
|
1560
|
+
/* @__PURE__ */ jsx5(CopyButton, { text: value.url, label: value.label, components })
|
|
1263
1561
|
] }, value.label)),
|
|
1264
|
-
/* @__PURE__ */
|
|
1562
|
+
/* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsx5(Button, { type: "button", onClick: onDismiss, children: "Done" }) })
|
|
1265
1563
|
] });
|
|
1266
1564
|
}
|
|
1267
1565
|
function CopyButton({ text, label, components }) {
|
|
1268
1566
|
const { Button } = resolveAuthComponents(components);
|
|
1269
|
-
const [state, setState] =
|
|
1270
|
-
return /* @__PURE__ */
|
|
1271
|
-
/* @__PURE__ */
|
|
1567
|
+
const [state, setState] = React6.useState("idle");
|
|
1568
|
+
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1569
|
+
/* @__PURE__ */ jsx5(
|
|
1272
1570
|
Button,
|
|
1273
1571
|
{
|
|
1274
1572
|
type: "button",
|
|
@@ -1288,7 +1586,7 @@ function CopyButton({ text, label, components }) {
|
|
|
1288
1586
|
children: state === "copied" ? "Copied" : "Copy"
|
|
1289
1587
|
}
|
|
1290
1588
|
),
|
|
1291
|
-
state === "failed" && /* @__PURE__ */
|
|
1589
|
+
state === "failed" && /* @__PURE__ */ jsx5("span", { role: "status", children: " Copying is unavailable here; select the text and copy it manually." })
|
|
1292
1590
|
] });
|
|
1293
1591
|
}
|
|
1294
1592
|
function describeDuration(spec) {
|
|
@@ -1367,17 +1665,25 @@ export {
|
|
|
1367
1665
|
PasskeySection,
|
|
1368
1666
|
PasswordResetRequestForm,
|
|
1369
1667
|
ResetPasswordForm,
|
|
1668
|
+
ScopePicker,
|
|
1370
1669
|
SignupForm,
|
|
1371
1670
|
TwoFactorForm,
|
|
1372
1671
|
arrayBufferToBase64url,
|
|
1373
1672
|
authenticateWithPasskey,
|
|
1374
1673
|
base64urlToArrayBuffer,
|
|
1674
|
+
closeImplications,
|
|
1375
1675
|
describeDuration,
|
|
1376
1676
|
getCsrfToken,
|
|
1377
1677
|
getDefaultPasskeyName,
|
|
1678
|
+
inCatalogOrder,
|
|
1378
1679
|
isAbortError,
|
|
1379
1680
|
isConditionalMediationAvailable,
|
|
1681
|
+
neededBy,
|
|
1380
1682
|
registerPasskey,
|
|
1381
1683
|
relyingApplicationsFrom,
|
|
1382
|
-
|
|
1684
|
+
restrictImplications,
|
|
1685
|
+
safeApplicationHref,
|
|
1686
|
+
sameSelection,
|
|
1687
|
+
withScopes,
|
|
1688
|
+
withoutScopes
|
|
1383
1689
|
};
|