@thunderid/tanstack-router 1.3.1 → 1.5.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.
@@ -310,7 +310,190 @@ const CallbackRoute = ({ onError, onNavigate }) => {
310
310
  };
311
311
  var CallbackRoute_default = CallbackRoute;
312
312
 
313
+ //#endregion
314
+ //#region src/routes/AdminPage.tsx
315
+ const SECTION_PAGES = {
316
+ agents: {
317
+ create: ({ options, toDetails }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.AgentCreate, {
318
+ preferences: options.preferences,
319
+ onCreated: (agent) => toDetails(agent.id)
320
+ }),
321
+ details: ({ id, options, toList }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.AgentDetails, {
322
+ agentId: id,
323
+ deletable: options.deletable,
324
+ preferences: options.preferences,
325
+ onDeleted: toList
326
+ }),
327
+ list: ({ createAction, options, toDetails }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.AgentList, {
328
+ actions: createAction,
329
+ preferences: options.preferences,
330
+ onSelect: (agent) => toDetails(agent.id)
331
+ })
332
+ },
333
+ groups: {
334
+ create: ({ options, toDetails }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.GroupCreate, {
335
+ preferences: options.preferences,
336
+ onCreated: (group) => toDetails(group.id)
337
+ }),
338
+ details: ({ id, options }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.GroupMembers, {
339
+ groupId: id,
340
+ editable: options.editable,
341
+ preferences: options.preferences
342
+ }),
343
+ list: ({ createAction, options, toDetails }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.GroupList, {
344
+ actions: createAction,
345
+ preferences: options.preferences,
346
+ onSelect: (group) => toDetails(group.id)
347
+ })
348
+ },
349
+ roles: {
350
+ create: ({ options, toDetails }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.RoleCreate, {
351
+ preferences: options.preferences,
352
+ onCreated: (role) => toDetails(role.id)
353
+ }),
354
+ details: ({ id, options }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.RolePermissions, {
355
+ roleId: id,
356
+ preferences: options.preferences
357
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.RoleAssignments, {
358
+ roleId: id,
359
+ editable: options.editable,
360
+ preferences: options.preferences
361
+ })] }),
362
+ list: ({ createAction, options, toDetails }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.RoleList, {
363
+ actions: createAction,
364
+ preferences: options.preferences,
365
+ onSelect: (role) => toDetails(role.id)
366
+ })
367
+ },
368
+ users: {
369
+ create: ({ options, toDetails }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.UserCreate, {
370
+ preferences: options.preferences,
371
+ onCreated: (user) => toDetails(user.id)
372
+ }),
373
+ details: ({ id, options, toList }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.UserDetails, {
374
+ userId: id,
375
+ deletable: options.deletable,
376
+ editable: options.editable,
377
+ preferences: options.preferences,
378
+ onDeleted: toList
379
+ }),
380
+ list: ({ createAction, options, toDetails }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.UserList, {
381
+ actions: createAction,
382
+ preferences: options.preferences,
383
+ onSelect: (user) => toDetails(user.id)
384
+ })
385
+ }
386
+ };
387
+ /**
388
+ * Renders one admin page and wires its callbacks to navigation within its section.
389
+ */
390
+ const AdminPage = ({ getSectionPath, kind, options, section }) => {
391
+ const navigate = (0, __tanstack_react_router.useNavigate)();
392
+ const id = (0, __tanstack_react_router.useParams)({
393
+ select: (params) => params.id ?? "",
394
+ strict: false
395
+ });
396
+ const { t } = (0, __thunderid_react.useTranslation)(options.preferences?.i18n);
397
+ const sectionPath = getSectionPath().replace(/\/+$/, "");
398
+ const toList = () => {
399
+ navigate({ to: sectionPath });
400
+ };
401
+ const toDetails = (resourceId) => {
402
+ navigate({
403
+ params: { id: resourceId },
404
+ to: `${sectionPath}/$id`
405
+ });
406
+ };
407
+ const createAction = kind === "list" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.Button, {
408
+ onClick: () => void navigate({ to: `${sectionPath}/new` }),
409
+ children: t(`admin.${section}.create.title`)
410
+ }) : null;
411
+ return SECTION_PAGES[section][kind]({
412
+ createAction,
413
+ id,
414
+ options,
415
+ toDetails,
416
+ toList
417
+ });
418
+ };
419
+ var AdminPage_default = AdminPage;
420
+
421
+ //#endregion
422
+ //#region src/routes/createAdminRoutes.tsx
423
+ const DEFAULT_SECTIONS = [
424
+ "users",
425
+ "groups",
426
+ "roles",
427
+ "agents"
428
+ ];
429
+ /**
430
+ * Builds TanStack Router routes that mount the admin (management) sections of `@thunderid/react`
431
+ * under `parentRoute`: for each section a list at `<section>`, a create form at `<section>/new`, and
432
+ * a details page at `<section>/$id`. Selecting, creating and deleting navigate between them.
433
+ *
434
+ * The routes are built with `createRoute`, so they carry no route-tree types of their own; navigate
435
+ * to them with string paths.
436
+ *
437
+ * @param parentRoute - The route to mount the sections under, such as the root route or an `/admin` route.
438
+ * @param options - Which sections to mount and how to render them.
439
+ * @returns One route per section, each with its pages as children, for `parentRoute.addChildren`.
440
+ *
441
+ * @example
442
+ * ```tsx
443
+ * const adminRoute = createRoute({getParentRoute: () => rootRoute, path: '/admin'});
444
+ *
445
+ * const routeTree = rootRoute.addChildren([
446
+ * indexRoute,
447
+ * adminRoute.addChildren(createAdminRoutes(adminRoute, {protect: {redirectTo: '/signin'}})),
448
+ * ]);
449
+ * ```
450
+ */
451
+ const createAdminRoutes = (parentRoute, options = {}) => {
452
+ const { protect, sections = DEFAULT_SECTIONS } = options;
453
+ return sections.map((section) => {
454
+ const sectionRoute = (0, __tanstack_react_router.createRoute)({
455
+ getParentRoute: () => parentRoute,
456
+ path: section
457
+ });
458
+ const page = (kind) => {
459
+ const Page = () => {
460
+ const element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdminPage_default, {
461
+ getSectionPath: () => sectionRoute.fullPath,
462
+ kind,
463
+ options,
464
+ section
465
+ });
466
+ return protect ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProtectedRoute_default, {
467
+ ...protect,
468
+ children: element
469
+ }) : element;
470
+ };
471
+ Page.displayName = `Admin(${section}/${kind})`;
472
+ return Page;
473
+ };
474
+ return sectionRoute.addChildren([
475
+ (0, __tanstack_react_router.createRoute)({
476
+ component: page("list"),
477
+ getParentRoute: () => sectionRoute,
478
+ path: "/"
479
+ }),
480
+ (0, __tanstack_react_router.createRoute)({
481
+ component: page("create"),
482
+ getParentRoute: () => sectionRoute,
483
+ path: "new"
484
+ }),
485
+ (0, __tanstack_react_router.createRoute)({
486
+ component: page("details"),
487
+ getParentRoute: () => sectionRoute,
488
+ path: "$id"
489
+ })
490
+ ]);
491
+ });
492
+ };
493
+ var createAdminRoutes_default = createAdminRoutes;
494
+
313
495
  //#endregion
314
496
  exports.CallbackRoute = CallbackRoute_default;
315
497
  exports.ProtectedRoute = ProtectedRoute_default;
498
+ exports.createAdminRoutes = createAdminRoutes_default;
316
499
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["ProtectedRoute: FC<ProtectedRouteProps>","Navigate","ThunderIDRuntimeError","CallbackRoute: FC<CallbackRouteProps>","router: ReturnType<typeof useRouter>","fullPath: string","basename: string","navigationPath: string","Callback"],"sources":["../../../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.development.js","../../../../node_modules/.pnpm/react@19.2.3/node_modules/react/jsx-runtime.js","../../src/components/ProtectedRoute.tsx","../../src/components/CallbackRoute.tsx"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return type.displayName || \"Context\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function getTaskName(type) {\n if (type === REACT_FRAGMENT_TYPE) return \"<>\";\n if (\n \"object\" === typeof type &&\n null !== type &&\n type.$$typeof === REACT_LAZY_TYPE\n )\n return \"<...>\";\n try {\n var name = getComponentNameFromType(type);\n return name ? \"<\" + name + \">\" : \"<...>\";\n } catch (x) {\n return \"<...>\";\n }\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function UnknownOwner() {\n return Error(\"react-stack-top-frame\");\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(type, key, props, owner, debugStack, debugTask) {\n var refProp = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== refProp ? refProp : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.defineProperty(type, \"_debugStack\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugStack\n });\n Object.defineProperty(type, \"_debugTask\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugTask\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function jsxDEVImpl(\n type,\n config,\n maybeKey,\n isStaticChildren,\n debugStack,\n debugTask\n ) {\n var children = config.children;\n if (void 0 !== children)\n if (isStaticChildren)\n if (isArrayImpl(children)) {\n for (\n isStaticChildren = 0;\n isStaticChildren < children.length;\n isStaticChildren++\n )\n validateChildKeys(children[isStaticChildren]);\n Object.freeze && Object.freeze(children);\n } else\n console.error(\n \"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.\"\n );\n else validateChildKeys(children);\n if (hasOwnProperty.call(config, \"key\")) {\n children = getComponentNameFromType(type);\n var keys = Object.keys(config).filter(function (k) {\n return \"key\" !== k;\n });\n isStaticChildren =\n 0 < keys.length\n ? \"{key: someKey, \" + keys.join(\": ..., \") + \": ...}\"\n : \"{key: someKey}\";\n didWarnAboutKeySpread[children + isStaticChildren] ||\n ((keys =\n 0 < keys.length ? \"{\" + keys.join(\": ..., \") + \": ...}\" : \"{}\"),\n console.error(\n 'A props object containing a \"key\" prop is being spread into JSX:\\n let props = %s;\\n <%s {...props} />\\nReact keys must be passed directly to JSX without using spread:\\n let props = %s;\\n <%s key={someKey} {...props} />',\n isStaticChildren,\n children,\n keys,\n children\n ),\n (didWarnAboutKeySpread[children + isStaticChildren] = !0));\n }\n children = null;\n void 0 !== maybeKey &&\n (checkKeyStringCoercion(maybeKey), (children = \"\" + maybeKey));\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (children = \"\" + config.key));\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n children &&\n defineKeyPropWarningGetter(\n maybeKey,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n return ReactElement(\n type,\n children,\n maybeKey,\n getOwner(),\n debugStack,\n debugTask\n );\n }\n function validateChildKeys(node) {\n isValidElement(node)\n ? node._store && (node._store.validated = 1)\n : \"object\" === typeof node &&\n null !== node &&\n node.$$typeof === REACT_LAZY_TYPE &&\n (\"fulfilled\" === node._payload.status\n ? isValidElement(node._payload.value) &&\n node._payload.value._store &&\n (node._payload.value._store.validated = 1)\n : node._store && (node._store.validated = 1));\n }\n function isValidElement(object) {\n return (\n \"object\" === typeof object &&\n null !== object &&\n object.$$typeof === REACT_ELEMENT_TYPE\n );\n }\n var React = require(\"react\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\"),\n REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n isArrayImpl = Array.isArray,\n createTask = console.createTask\n ? console.createTask\n : function () {\n return null;\n };\n React = {\n react_stack_bottom_frame: function (callStackForError) {\n return callStackForError();\n }\n };\n var specialPropKeyWarningShown;\n var didWarnAboutElementRef = {};\n var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(\n React,\n UnknownOwner\n )();\n var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));\n var didWarnAboutKeySpread = {};\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.jsx = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !1,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n exports.jsxs = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !0,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Navigate} from '@tanstack/react-router';\nimport {useThunderID, ThunderIDRuntimeError} from '@thunderid/react';\nimport {FC, ReactElement, ReactNode} from 'react';\n\n/**\n * Props for the ProtectedRoute component.\n */\nexport interface ProtectedRouteProps {\n /**\n * The element to render when the user is authenticated.\n */\n children: ReactElement;\n /**\n * Custom fallback element to render when the user is not authenticated.\n * If provided, this takes precedence over redirectTo.\n */\n fallback?: ReactElement;\n /**\n * Custom loading element to render while authentication status is being determined.\n */\n loader?: ReactNode;\n /**\n * URL to redirect to when the user is not authenticated.\n * Required unless a fallback element is provided.\n */\n redirectTo?: string;\n}\n\n/**\n * A protected route component that requires authentication to access.\n *\n * This component should be used as the component prop of a TanStack Router route.\n * It checks authentication status and either renders the protected content,\n * shows a loading state, redirects, or shows a fallback.\n *\n * Either a `redirectTo` prop or a `fallback` prop must be provided to handle\n * unauthenticated users.\n *\n * @example Basic usage with redirect\n * ```tsx\n * const dashboardRoute = createRouteConfig({\n * path: '/dashboard',\n * component: () => (\n * <ProtectedRoute redirectTo=\"/signin\">\n * <Dashboard />\n * </ProtectedRoute>\n * )\n * })\n * ```\n *\n * @example With custom fallback\n * ```tsx\n * const adminRoute = createRouteConfig({\n * path: '/admin',\n * component: () => (\n * <ProtectedRoute fallback={<div>Access denied</div>}>\n * <AdminPanel />\n * </ProtectedRoute>\n * )\n * })\n * ```\n */\nconst ProtectedRoute: FC<ProtectedRouteProps> = ({\n children,\n fallback,\n redirectTo,\n loader = null,\n}: ProtectedRouteProps) => {\n const {isSignedIn, isLoading} = useThunderID();\n\n if (isLoading) {\n return loader;\n }\n\n if (isSignedIn) {\n return children;\n }\n\n if (fallback) {\n return fallback;\n }\n\n if (redirectTo) {\n return <Navigate to={redirectTo} />;\n }\n\n throw new ThunderIDRuntimeError(\n '\"fallback\" or \"redirectTo\" prop is required.',\n 'ProtectedRoute-ValidationError-001',\n 'tanstack-router',\n 'Either \"fallback\" or \"redirectTo\" prop must be provided to handle unauthenticated users.',\n );\n};\n\nexport default ProtectedRoute;\n","// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {useRouter, useRouterState} from '@tanstack/react-router';\nimport {Callback} from '@thunderid/react';\nimport {FC} from 'react';\n\n/**\n * Props for the CallbackRoute component.\n */\nexport interface CallbackRouteProps {\n /**\n * Callback function called when an error occurs during OAuth processing.\n * @param error - The error that occurred\n */\n onError?: (error: Error) => void;\n\n /**\n * Optional custom navigation handler.\n * If provided, this will be called instead of the default navigate() behavior.\n * Useful for apps that need custom navigation logic.\n * @param path - The path to navigate to\n */\n onNavigate?: (path: string) => void;\n}\n\n/**\n * Handles OAuth callback redirects for TanStack Router applications.\n * Processes authorization code, validates CSRF state, and navigates back to the original path.\n * Automatically handles TanStack Router basepath when configured.\n *\n * @example\n * ```tsx\n * const callbackRoute = createRoute({\n * getParentRoute: () => rootRoute,\n * path: '/callback',\n * component: CallbackRoute,\n * });\n * ```\n */\nconst CallbackRoute: FC<CallbackRouteProps> = ({onError, onNavigate}: CallbackRouteProps) => {\n const router: ReturnType<typeof useRouter> = useRouter();\n const routerState: ReturnType<typeof useRouterState> = useRouterState();\n const {pathname}: {pathname: string} = routerState.location;\n\n const handleNavigate = (path: string): void => {\n if (onNavigate) {\n onNavigate(path);\n return;\n }\n\n const fullPath: string = window.location.pathname;\n const basename: string = fullPath.endsWith(pathname) ? fullPath.slice(0, -pathname.length).replace(/\\/$/, '') : '';\n\n const navigationPath: string = basename && path.startsWith(basename) ? path.slice(basename.length) || '/' : path;\n\n router.navigate({to: navigationPath}).catch(() => {});\n };\n\n return (\n <Callback\n onNavigate={handleNavigate}\n onError={\n onError ||\n ((error: Error): void => {\n // eslint-disable-next-line no-console\n console.error('OAuth callback error:', error);\n })\n }\n />\n );\n};\n\nexport default CallbackRoute;\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,EACG,WAAY;EACX,SAAS,yBAAyB,MAAM;AAC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f,MAAMC,iBAAyC,EAAC,SAAS,iBAAoC;CAC3F,MAAMC,iDAAkD;CAExD,MAAM,EAAC,0DADgE,CACpB;CAEnD,MAAM,kBAAkB,SAAuB;AAC7C,MAAI,YAAY;AACd,cAAW,KAAK;AAChB;;EAGF,MAAMC,WAAmB,OAAO,SAAS;EACzC,MAAMC,WAAmB,SAAS,SAAS,SAAS,GAAG,SAAS,MAAM,GAAG,CAAC,SAAS,OAAO,CAAC,QAAQ,OAAO,GAAG,GAAG;EAEhH,MAAMC,iBAAyB,YAAY,KAAK,WAAW,SAAS,GAAG,KAAK,MAAM,SAAS,OAAO,IAAI,MAAM;AAE5G,SAAO,SAAS,EAAC,IAAI,gBAAe,CAAC,CAAC,YAAY,GAAG;;AAGvD,QACE,4CAACC;EACC,YAAY;EACZ,SACE,aACE,UAAuB;AAEvB,WAAQ,MAAM,yBAAyB,MAAM;;GAGjD;;AAIN,4BAAe"}
1
+ {"version":3,"file":"index.cjs","names":["ProtectedRoute: FC<ProtectedRouteProps>","Navigate","ThunderIDRuntimeError","CallbackRoute: FC<CallbackRouteProps>","router: ReturnType<typeof useRouter>","fullPath: string","basename: string","navigationPath: string","Callback","SECTION_PAGES: Record<AdminSection, Record<AdminPageKind, AdminPageRenderer>>","AgentCreate","AgentDetails","AgentList","GroupCreate","GroupMembers","GroupList","RoleCreate","RolePermissions","RoleAssignments","RoleList","UserCreate","UserDetails","UserList","AdminPage: FC<AdminPageProps>","navigate: ReturnType<typeof useNavigate>","id: string","sectionPath: string","createAction: ReactNode","Button","DEFAULT_SECTIONS: AdminSection[]","sectionRoute: AnyRoute","element: ReactElement","AdminPage","ProtectedRoute"],"sources":["../../../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.development.js","../../../../node_modules/.pnpm/react@19.2.3/node_modules/react/jsx-runtime.js","../../src/components/ProtectedRoute.tsx","../../src/components/CallbackRoute.tsx","../../src/routes/AdminPage.tsx","../../src/routes/createAdminRoutes.tsx"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return type.displayName || \"Context\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function getTaskName(type) {\n if (type === REACT_FRAGMENT_TYPE) return \"<>\";\n if (\n \"object\" === typeof type &&\n null !== type &&\n type.$$typeof === REACT_LAZY_TYPE\n )\n return \"<...>\";\n try {\n var name = getComponentNameFromType(type);\n return name ? \"<\" + name + \">\" : \"<...>\";\n } catch (x) {\n return \"<...>\";\n }\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function UnknownOwner() {\n return Error(\"react-stack-top-frame\");\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(type, key, props, owner, debugStack, debugTask) {\n var refProp = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== refProp ? refProp : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.defineProperty(type, \"_debugStack\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugStack\n });\n Object.defineProperty(type, \"_debugTask\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugTask\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function jsxDEVImpl(\n type,\n config,\n maybeKey,\n isStaticChildren,\n debugStack,\n debugTask\n ) {\n var children = config.children;\n if (void 0 !== children)\n if (isStaticChildren)\n if (isArrayImpl(children)) {\n for (\n isStaticChildren = 0;\n isStaticChildren < children.length;\n isStaticChildren++\n )\n validateChildKeys(children[isStaticChildren]);\n Object.freeze && Object.freeze(children);\n } else\n console.error(\n \"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.\"\n );\n else validateChildKeys(children);\n if (hasOwnProperty.call(config, \"key\")) {\n children = getComponentNameFromType(type);\n var keys = Object.keys(config).filter(function (k) {\n return \"key\" !== k;\n });\n isStaticChildren =\n 0 < keys.length\n ? \"{key: someKey, \" + keys.join(\": ..., \") + \": ...}\"\n : \"{key: someKey}\";\n didWarnAboutKeySpread[children + isStaticChildren] ||\n ((keys =\n 0 < keys.length ? \"{\" + keys.join(\": ..., \") + \": ...}\" : \"{}\"),\n console.error(\n 'A props object containing a \"key\" prop is being spread into JSX:\\n let props = %s;\\n <%s {...props} />\\nReact keys must be passed directly to JSX without using spread:\\n let props = %s;\\n <%s key={someKey} {...props} />',\n isStaticChildren,\n children,\n keys,\n children\n ),\n (didWarnAboutKeySpread[children + isStaticChildren] = !0));\n }\n children = null;\n void 0 !== maybeKey &&\n (checkKeyStringCoercion(maybeKey), (children = \"\" + maybeKey));\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (children = \"\" + config.key));\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n children &&\n defineKeyPropWarningGetter(\n maybeKey,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n return ReactElement(\n type,\n children,\n maybeKey,\n getOwner(),\n debugStack,\n debugTask\n );\n }\n function validateChildKeys(node) {\n isValidElement(node)\n ? node._store && (node._store.validated = 1)\n : \"object\" === typeof node &&\n null !== node &&\n node.$$typeof === REACT_LAZY_TYPE &&\n (\"fulfilled\" === node._payload.status\n ? isValidElement(node._payload.value) &&\n node._payload.value._store &&\n (node._payload.value._store.validated = 1)\n : node._store && (node._store.validated = 1));\n }\n function isValidElement(object) {\n return (\n \"object\" === typeof object &&\n null !== object &&\n object.$$typeof === REACT_ELEMENT_TYPE\n );\n }\n var React = require(\"react\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\"),\n REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n isArrayImpl = Array.isArray,\n createTask = console.createTask\n ? console.createTask\n : function () {\n return null;\n };\n React = {\n react_stack_bottom_frame: function (callStackForError) {\n return callStackForError();\n }\n };\n var specialPropKeyWarningShown;\n var didWarnAboutElementRef = {};\n var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(\n React,\n UnknownOwner\n )();\n var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));\n var didWarnAboutKeySpread = {};\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.jsx = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !1,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n exports.jsxs = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !0,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Navigate} from '@tanstack/react-router';\nimport {useThunderID, ThunderIDRuntimeError} from '@thunderid/react';\nimport {FC, ReactElement, ReactNode} from 'react';\n\n/**\n * Props for the ProtectedRoute component.\n */\nexport interface ProtectedRouteProps {\n /**\n * The element to render when the user is authenticated.\n */\n children: ReactElement;\n /**\n * Custom fallback element to render when the user is not authenticated.\n * If provided, this takes precedence over redirectTo.\n */\n fallback?: ReactElement;\n /**\n * Custom loading element to render while authentication status is being determined.\n */\n loader?: ReactNode;\n /**\n * URL to redirect to when the user is not authenticated.\n * Required unless a fallback element is provided.\n */\n redirectTo?: string;\n}\n\n/**\n * A protected route component that requires authentication to access.\n *\n * This component should be used as the component prop of a TanStack Router route.\n * It checks authentication status and either renders the protected content,\n * shows a loading state, redirects, or shows a fallback.\n *\n * Either a `redirectTo` prop or a `fallback` prop must be provided to handle\n * unauthenticated users.\n *\n * @example Basic usage with redirect\n * ```tsx\n * const dashboardRoute = createRouteConfig({\n * path: '/dashboard',\n * component: () => (\n * <ProtectedRoute redirectTo=\"/signin\">\n * <Dashboard />\n * </ProtectedRoute>\n * )\n * })\n * ```\n *\n * @example With custom fallback\n * ```tsx\n * const adminRoute = createRouteConfig({\n * path: '/admin',\n * component: () => (\n * <ProtectedRoute fallback={<div>Access denied</div>}>\n * <AdminPanel />\n * </ProtectedRoute>\n * )\n * })\n * ```\n */\nconst ProtectedRoute: FC<ProtectedRouteProps> = ({\n children,\n fallback,\n redirectTo,\n loader = null,\n}: ProtectedRouteProps) => {\n const {isSignedIn, isLoading} = useThunderID();\n\n if (isLoading) {\n return loader;\n }\n\n if (isSignedIn) {\n return children;\n }\n\n if (fallback) {\n return fallback;\n }\n\n if (redirectTo) {\n return <Navigate to={redirectTo} />;\n }\n\n throw new ThunderIDRuntimeError(\n '\"fallback\" or \"redirectTo\" prop is required.',\n 'ProtectedRoute-ValidationError-001',\n 'tanstack-router',\n 'Either \"fallback\" or \"redirectTo\" prop must be provided to handle unauthenticated users.',\n );\n};\n\nexport default ProtectedRoute;\n","// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {useRouter, useRouterState} from '@tanstack/react-router';\nimport {Callback} from '@thunderid/react';\nimport {FC} from 'react';\n\n/**\n * Props for the CallbackRoute component.\n */\nexport interface CallbackRouteProps {\n /**\n * Callback function called when an error occurs during OAuth processing.\n * @param error - The error that occurred\n */\n onError?: (error: Error) => void;\n\n /**\n * Optional custom navigation handler.\n * If provided, this will be called instead of the default navigate() behavior.\n * Useful for apps that need custom navigation logic.\n * @param path - The path to navigate to\n */\n onNavigate?: (path: string) => void;\n}\n\n/**\n * Handles OAuth callback redirects for TanStack Router applications.\n * Processes authorization code, validates CSRF state, and navigates back to the original path.\n * Automatically handles TanStack Router basepath when configured.\n *\n * @example\n * ```tsx\n * const callbackRoute = createRoute({\n * getParentRoute: () => rootRoute,\n * path: '/callback',\n * component: CallbackRoute,\n * });\n * ```\n */\nconst CallbackRoute: FC<CallbackRouteProps> = ({onError, onNavigate}: CallbackRouteProps) => {\n const router: ReturnType<typeof useRouter> = useRouter();\n const routerState: ReturnType<typeof useRouterState> = useRouterState();\n const {pathname}: {pathname: string} = routerState.location;\n\n const handleNavigate = (path: string): void => {\n if (onNavigate) {\n onNavigate(path);\n return;\n }\n\n const fullPath: string = window.location.pathname;\n const basename: string = fullPath.endsWith(pathname) ? fullPath.slice(0, -pathname.length).replace(/\\/$/, '') : '';\n\n const navigationPath: string = basename && path.startsWith(basename) ? path.slice(basename.length) || '/' : path;\n\n router.navigate({to: navigationPath}).catch(() => {});\n };\n\n return (\n <Callback\n onNavigate={handleNavigate}\n onError={\n onError ||\n ((error: Error): void => {\n // eslint-disable-next-line no-console\n console.error('OAuth callback error:', error);\n })\n }\n />\n );\n};\n\nexport default CallbackRoute;\n","// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {useNavigate, useParams} from '@tanstack/react-router';\nimport {\n AgentCreate,\n AgentDetails,\n AgentList,\n Button,\n GroupCreate,\n GroupList,\n GroupMembers,\n RoleAssignments,\n RoleCreate,\n RoleList,\n RolePermissions,\n UserCreate,\n UserDetails,\n UserList,\n useTranslation,\n} from '@thunderid/react';\nimport {FC, ReactElement, ReactNode} from 'react';\nimport type {AdminRoutesOptions, AdminSection} from './createAdminRoutes';\n\nexport type AdminPageKind = 'create' | 'details' | 'list';\n\n/**\n * Navigation between the pages of one section.\n */\ninterface AdminNavigation {\n createAction: ReactNode;\n toDetails: (id: string) => void;\n toList: () => void;\n}\n\ninterface AdminPageContext extends AdminNavigation {\n id: string;\n options: AdminRoutesOptions;\n}\n\ntype AdminPageRenderer = (context: AdminPageContext) => ReactElement;\n\nconst SECTION_PAGES: Record<AdminSection, Record<AdminPageKind, AdminPageRenderer>> = {\n agents: {\n create: ({options, toDetails}: AdminPageContext) => (\n <AgentCreate preferences={options.preferences} onCreated={(agent: {id: string}) => toDetails(agent.id)} />\n ),\n details: ({id, options, toList}: AdminPageContext) => (\n <AgentDetails agentId={id} deletable={options.deletable} preferences={options.preferences} onDeleted={toList} />\n ),\n list: ({createAction, options, toDetails}: AdminPageContext) => (\n <AgentList\n actions={createAction}\n preferences={options.preferences}\n onSelect={(agent: {id: string}) => toDetails(agent.id)}\n />\n ),\n },\n groups: {\n create: ({options, toDetails}: AdminPageContext) => (\n <GroupCreate preferences={options.preferences} onCreated={(group: {id: string}) => toDetails(group.id)} />\n ),\n details: ({id, options}: AdminPageContext) => (\n <GroupMembers groupId={id} editable={options.editable} preferences={options.preferences} />\n ),\n list: ({createAction, options, toDetails}: AdminPageContext) => (\n <GroupList\n actions={createAction}\n preferences={options.preferences}\n onSelect={(group: {id: string}) => toDetails(group.id)}\n />\n ),\n },\n roles: {\n create: ({options, toDetails}: AdminPageContext) => (\n <RoleCreate preferences={options.preferences} onCreated={(role: {id: string}) => toDetails(role.id)} />\n ),\n details: ({id, options}: AdminPageContext) => (\n <>\n <RolePermissions roleId={id} preferences={options.preferences} />\n <RoleAssignments roleId={id} editable={options.editable} preferences={options.preferences} />\n </>\n ),\n list: ({createAction, options, toDetails}: AdminPageContext) => (\n <RoleList\n actions={createAction}\n preferences={options.preferences}\n onSelect={(role: {id: string}) => toDetails(role.id)}\n />\n ),\n },\n users: {\n create: ({options, toDetails}: AdminPageContext) => (\n <UserCreate preferences={options.preferences} onCreated={(user: {id: string}) => toDetails(user.id)} />\n ),\n details: ({id, options, toList}: AdminPageContext) => (\n <UserDetails\n userId={id}\n deletable={options.deletable}\n editable={options.editable}\n preferences={options.preferences}\n onDeleted={toList}\n />\n ),\n list: ({createAction, options, toDetails}: AdminPageContext) => (\n <UserList\n actions={createAction}\n preferences={options.preferences}\n onSelect={(user: {id: string}) => toDetails(user.id)}\n />\n ),\n },\n};\n\ninterface AdminPageProps {\n /**\n * Returns the full path of the section route. Read at render time, once the router has resolved it.\n */\n getSectionPath: () => string;\n kind: AdminPageKind;\n options: AdminRoutesOptions;\n section: AdminSection;\n}\n\n/**\n * Renders one admin page and wires its callbacks to navigation within its section.\n */\nconst AdminPage: FC<AdminPageProps> = ({getSectionPath, kind, options, section}: AdminPageProps): ReactElement => {\n const navigate: ReturnType<typeof useNavigate> = useNavigate();\n const id: string = useParams({\n select: (params: {id?: string}): string => params.id ?? '',\n strict: false,\n });\n const {t} = useTranslation(options.preferences?.i18n);\n const sectionPath: string = getSectionPath().replace(/\\/+$/, '');\n\n const toList = (): void => {\n void navigate({to: sectionPath});\n };\n // The identifier goes through `params`, so the router encodes it.\n const toDetails = (resourceId: string): void => {\n void navigate({params: {id: resourceId}, to: `${sectionPath}/$id`});\n };\n\n const createAction: ReactNode =\n kind === 'list' ? (\n <Button onClick={(): void => void navigate({to: `${sectionPath}/new`})}>\n {t(`admin.${section}.create.title`)}\n </Button>\n ) : null;\n\n return SECTION_PAGES[section][kind]({createAction, id, options, toDetails, toList});\n};\n\nexport default AdminPage;\n","// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {AnyRoute, createRoute} from '@tanstack/react-router';\nimport type {UserListProps} from '@thunderid/react';\nimport {ReactElement} from 'react';\nimport AdminPage, {AdminPageKind} from './AdminPage';\nimport ProtectedRoute, {ProtectedRouteProps} from '../components/ProtectedRoute';\n\n/**\n * An admin section that {@link createAdminRoutes} can mount.\n */\nexport type AdminSection = 'agents' | 'groups' | 'roles' | 'users';\n\n/**\n * Options for {@link createAdminRoutes}.\n */\nexport interface AdminRoutesOptions {\n /**\n * Shows the delete action on the user and agent details pages.\n * @default false\n */\n deletable?: boolean;\n /**\n * Allows editing on the details pages: user attributes, group members and role assignments. When\n * unset, each component keeps its own default.\n */\n editable?: boolean;\n /**\n * Passed to every admin component.\n */\n preferences?: UserListProps['preferences'];\n /**\n * Wraps every admin page in {@link ProtectedRoute} with these props. The management API still\n * checks every request, so this only decides what an unauthenticated visitor sees.\n */\n protect?: Omit<ProtectedRouteProps, 'children'>;\n /**\n * The sections to mount.\n * @default ['users', 'groups', 'roles', 'agents']\n */\n sections?: AdminSection[];\n}\n\nconst DEFAULT_SECTIONS: AdminSection[] = ['users', 'groups', 'roles', 'agents'];\n\n/**\n * Builds TanStack Router routes that mount the admin (management) sections of `@thunderid/react`\n * under `parentRoute`: for each section a list at `<section>`, a create form at `<section>/new`, and\n * a details page at `<section>/$id`. Selecting, creating and deleting navigate between them.\n *\n * The routes are built with `createRoute`, so they carry no route-tree types of their own; navigate\n * to them with string paths.\n *\n * @param parentRoute - The route to mount the sections under, such as the root route or an `/admin` route.\n * @param options - Which sections to mount and how to render them.\n * @returns One route per section, each with its pages as children, for `parentRoute.addChildren`.\n *\n * @example\n * ```tsx\n * const adminRoute = createRoute({getParentRoute: () => rootRoute, path: '/admin'});\n *\n * const routeTree = rootRoute.addChildren([\n * indexRoute,\n * adminRoute.addChildren(createAdminRoutes(adminRoute, {protect: {redirectTo: '/signin'}})),\n * ]);\n * ```\n */\nconst createAdminRoutes = (parentRoute: AnyRoute, options: AdminRoutesOptions = {}): AnyRoute[] => {\n const {protect, sections = DEFAULT_SECTIONS} = options;\n\n return sections.map((section: AdminSection): AnyRoute => {\n const sectionRoute: AnyRoute = createRoute({getParentRoute: () => parentRoute, path: section});\n\n const page = (kind: AdminPageKind): (() => ReactElement) => {\n const Page = (): ReactElement => {\n const element: ReactElement = (\n <AdminPage\n getSectionPath={(): string => sectionRoute.fullPath as string}\n kind={kind}\n options={options}\n section={section}\n />\n );\n\n return protect ? <ProtectedRoute {...protect}>{element}</ProtectedRoute> : element;\n };\n\n Page.displayName = `Admin(${section}/${kind})`;\n\n return Page;\n };\n\n return sectionRoute.addChildren([\n createRoute({component: page('list'), getParentRoute: () => sectionRoute, path: '/'}),\n createRoute({component: page('create'), getParentRoute: () => sectionRoute, path: 'new'}),\n createRoute({component: page('details'), getParentRoute: () => sectionRoute, path: '$id'}),\n ]) as AnyRoute;\n });\n};\n\nexport default createAdminRoutes;\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,EACG,WAAY;EACX,SAAS,yBAAyB,MAAM;AACtC,OAAI,QAAQ,KAAM,QAAO;AACzB,OAAI,eAAe,OAAO,KACxB,QAAO,KAAK,aAAa,yBACrB,OACA,KAAK,eAAe,KAAK,QAAQ;AACvC,OAAI,aAAa,OAAO,KAAM,QAAO;AACrC,WAAQ,MAAR;IACE,KAAK,oBACH,QAAO;IACT,KAAK,oBACH,QAAO;IACT,KAAK,uBACH,QAAO;IACT,KAAK,oBACH,QAAO;IACT,KAAK,yBACH,QAAO;IACT,KAAK,oBACH,QAAO;;AAEX,OAAI,aAAa,OAAO,KACtB,SACG,aAAa,OAAO,KAAK,OACxB,QAAQ,MACN,oHACD,EACH,KAAK,UALP;IAOE,KAAK,kBACH,QAAO;IACT,KAAK,mBACH,QAAO,KAAK,eAAe;IAC7B,KAA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,wDAAqC;GAAC,sBAAsB;GAAa,MAAM;GAAQ,CAAC;EAE9F,MAAM,QAAQ,SAA8C;GAC1D,MAAM,aAA2B;IAC/B,MAAMC,UACJ,4CAACC;KACC,sBAA8B,aAAa;KACrC;KACG;KACA;MACT;AAGJ,WAAO,UAAU,4CAACC;KAAe,GAAI;eAAU;MAAyB,GAAG;;AAG7E,QAAK,cAAc,SAAS,QAAQ,GAAG,KAAK;AAE5C,UAAO;;AAGT,SAAO,aAAa,YAAY;4CAClB;IAAC,WAAW,KAAK,OAAO;IAAE,sBAAsB;IAAc,MAAM;IAAI,CAAC;4CACzE;IAAC,WAAW,KAAK,SAAS;IAAE,sBAAsB;IAAc,MAAM;IAAM,CAAC;4CAC7E;IAAC,WAAW,KAAK,UAAU;IAAE,sBAAsB;IAAc,MAAM;IAAM,CAAC;GAC3F,CAAC;GACF;;AAGJ,gCAAe"}
package/dist/index.d.ts CHANGED
@@ -2,4 +2,6 @@ export { default as ProtectedRoute } from './components/ProtectedRoute';
2
2
  export * from './components/ProtectedRoute';
3
3
  export { default as CallbackRoute } from './components/CallbackRoute';
4
4
  export * from './components/CallbackRoute';
5
+ export { default as createAdminRoutes } from './routes/createAdminRoutes';
6
+ export * from './routes/createAdminRoutes';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,6BAA6B,CAAC;AACtE,cAAc,6BAA6B,CAAC;AAE5C,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACpE,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,6BAA6B,CAAC;AACtE,cAAc,6BAA6B,CAAC;AAE5C,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACpE,cAAc,4BAA4B,CAAC;AAE3C,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,MAAM,4BAA4B,CAAC;AACxE,cAAc,4BAA4B,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { Navigate, useRouter, useRouterState } from "@tanstack/react-router";
2
- import { Callback, ThunderIDRuntimeError, useThunderID } from "@thunderid/react";
1
+ import { Navigate, createRoute, useNavigate, useParams, useRouter, useRouterState } from "@tanstack/react-router";
2
+ import { AgentCreate, AgentDetails, AgentList, Button, Callback, GroupCreate, GroupList, GroupMembers, RoleAssignments, RoleCreate, RoleList, RolePermissions, ThunderIDRuntimeError, UserCreate, UserDetails, UserList, useThunderID, useTranslation } from "@thunderid/react";
3
3
 
4
4
  //#region rolldown:runtime
5
5
  var __create = Object.create;
@@ -313,5 +313,187 @@ const CallbackRoute = ({ onError, onNavigate }) => {
313
313
  var CallbackRoute_default = CallbackRoute;
314
314
 
315
315
  //#endregion
316
- export { CallbackRoute_default as CallbackRoute, ProtectedRoute_default as ProtectedRoute };
316
+ //#region src/routes/AdminPage.tsx
317
+ const SECTION_PAGES = {
318
+ agents: {
319
+ create: ({ options, toDetails }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AgentCreate, {
320
+ preferences: options.preferences,
321
+ onCreated: (agent) => toDetails(agent.id)
322
+ }),
323
+ details: ({ id, options, toList }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AgentDetails, {
324
+ agentId: id,
325
+ deletable: options.deletable,
326
+ preferences: options.preferences,
327
+ onDeleted: toList
328
+ }),
329
+ list: ({ createAction, options, toDetails }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AgentList, {
330
+ actions: createAction,
331
+ preferences: options.preferences,
332
+ onSelect: (agent) => toDetails(agent.id)
333
+ })
334
+ },
335
+ groups: {
336
+ create: ({ options, toDetails }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GroupCreate, {
337
+ preferences: options.preferences,
338
+ onCreated: (group) => toDetails(group.id)
339
+ }),
340
+ details: ({ id, options }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GroupMembers, {
341
+ groupId: id,
342
+ editable: options.editable,
343
+ preferences: options.preferences
344
+ }),
345
+ list: ({ createAction, options, toDetails }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GroupList, {
346
+ actions: createAction,
347
+ preferences: options.preferences,
348
+ onSelect: (group) => toDetails(group.id)
349
+ })
350
+ },
351
+ roles: {
352
+ create: ({ options, toDetails }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RoleCreate, {
353
+ preferences: options.preferences,
354
+ onCreated: (role) => toDetails(role.id)
355
+ }),
356
+ details: ({ id, options }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RolePermissions, {
357
+ roleId: id,
358
+ preferences: options.preferences
359
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RoleAssignments, {
360
+ roleId: id,
361
+ editable: options.editable,
362
+ preferences: options.preferences
363
+ })] }),
364
+ list: ({ createAction, options, toDetails }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RoleList, {
365
+ actions: createAction,
366
+ preferences: options.preferences,
367
+ onSelect: (role) => toDetails(role.id)
368
+ })
369
+ },
370
+ users: {
371
+ create: ({ options, toDetails }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserCreate, {
372
+ preferences: options.preferences,
373
+ onCreated: (user) => toDetails(user.id)
374
+ }),
375
+ details: ({ id, options, toList }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserDetails, {
376
+ userId: id,
377
+ deletable: options.deletable,
378
+ editable: options.editable,
379
+ preferences: options.preferences,
380
+ onDeleted: toList
381
+ }),
382
+ list: ({ createAction, options, toDetails }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserList, {
383
+ actions: createAction,
384
+ preferences: options.preferences,
385
+ onSelect: (user) => toDetails(user.id)
386
+ })
387
+ }
388
+ };
389
+ /**
390
+ * Renders one admin page and wires its callbacks to navigation within its section.
391
+ */
392
+ const AdminPage = ({ getSectionPath, kind, options, section }) => {
393
+ const navigate = useNavigate();
394
+ const id = useParams({
395
+ select: (params) => params.id ?? "",
396
+ strict: false
397
+ });
398
+ const { t } = useTranslation(options.preferences?.i18n);
399
+ const sectionPath = getSectionPath().replace(/\/+$/, "");
400
+ const toList = () => {
401
+ navigate({ to: sectionPath });
402
+ };
403
+ const toDetails = (resourceId) => {
404
+ navigate({
405
+ params: { id: resourceId },
406
+ to: `${sectionPath}/$id`
407
+ });
408
+ };
409
+ const createAction = kind === "list" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
410
+ onClick: () => void navigate({ to: `${sectionPath}/new` }),
411
+ children: t(`admin.${section}.create.title`)
412
+ }) : null;
413
+ return SECTION_PAGES[section][kind]({
414
+ createAction,
415
+ id,
416
+ options,
417
+ toDetails,
418
+ toList
419
+ });
420
+ };
421
+ var AdminPage_default = AdminPage;
422
+
423
+ //#endregion
424
+ //#region src/routes/createAdminRoutes.tsx
425
+ const DEFAULT_SECTIONS = [
426
+ "users",
427
+ "groups",
428
+ "roles",
429
+ "agents"
430
+ ];
431
+ /**
432
+ * Builds TanStack Router routes that mount the admin (management) sections of `@thunderid/react`
433
+ * under `parentRoute`: for each section a list at `<section>`, a create form at `<section>/new`, and
434
+ * a details page at `<section>/$id`. Selecting, creating and deleting navigate between them.
435
+ *
436
+ * The routes are built with `createRoute`, so they carry no route-tree types of their own; navigate
437
+ * to them with string paths.
438
+ *
439
+ * @param parentRoute - The route to mount the sections under, such as the root route or an `/admin` route.
440
+ * @param options - Which sections to mount and how to render them.
441
+ * @returns One route per section, each with its pages as children, for `parentRoute.addChildren`.
442
+ *
443
+ * @example
444
+ * ```tsx
445
+ * const adminRoute = createRoute({getParentRoute: () => rootRoute, path: '/admin'});
446
+ *
447
+ * const routeTree = rootRoute.addChildren([
448
+ * indexRoute,
449
+ * adminRoute.addChildren(createAdminRoutes(adminRoute, {protect: {redirectTo: '/signin'}})),
450
+ * ]);
451
+ * ```
452
+ */
453
+ const createAdminRoutes = (parentRoute, options = {}) => {
454
+ const { protect, sections = DEFAULT_SECTIONS } = options;
455
+ return sections.map((section) => {
456
+ const sectionRoute = createRoute({
457
+ getParentRoute: () => parentRoute,
458
+ path: section
459
+ });
460
+ const page = (kind) => {
461
+ const Page = () => {
462
+ const element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdminPage_default, {
463
+ getSectionPath: () => sectionRoute.fullPath,
464
+ kind,
465
+ options,
466
+ section
467
+ });
468
+ return protect ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProtectedRoute_default, {
469
+ ...protect,
470
+ children: element
471
+ }) : element;
472
+ };
473
+ Page.displayName = `Admin(${section}/${kind})`;
474
+ return Page;
475
+ };
476
+ return sectionRoute.addChildren([
477
+ createRoute({
478
+ component: page("list"),
479
+ getParentRoute: () => sectionRoute,
480
+ path: "/"
481
+ }),
482
+ createRoute({
483
+ component: page("create"),
484
+ getParentRoute: () => sectionRoute,
485
+ path: "new"
486
+ }),
487
+ createRoute({
488
+ component: page("details"),
489
+ getParentRoute: () => sectionRoute,
490
+ path: "$id"
491
+ })
492
+ ]);
493
+ });
494
+ };
495
+ var createAdminRoutes_default = createAdminRoutes;
496
+
497
+ //#endregion
498
+ export { CallbackRoute_default as CallbackRoute, ProtectedRoute_default as ProtectedRoute, createAdminRoutes_default as createAdminRoutes };
317
499
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ProtectedRoute: FC<ProtectedRouteProps>","CallbackRoute: FC<CallbackRouteProps>","router: ReturnType<typeof useRouter>","fullPath: string","basename: string","navigationPath: string"],"sources":["../../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.development.js","../../../node_modules/.pnpm/react@19.2.3/node_modules/react/jsx-runtime.js","../src/components/ProtectedRoute.tsx","../src/components/CallbackRoute.tsx"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return type.displayName || \"Context\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function getTaskName(type) {\n if (type === REACT_FRAGMENT_TYPE) return \"<>\";\n if (\n \"object\" === typeof type &&\n null !== type &&\n type.$$typeof === REACT_LAZY_TYPE\n )\n return \"<...>\";\n try {\n var name = getComponentNameFromType(type);\n return name ? \"<\" + name + \">\" : \"<...>\";\n } catch (x) {\n return \"<...>\";\n }\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function UnknownOwner() {\n return Error(\"react-stack-top-frame\");\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(type, key, props, owner, debugStack, debugTask) {\n var refProp = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== refProp ? refProp : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.defineProperty(type, \"_debugStack\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugStack\n });\n Object.defineProperty(type, \"_debugTask\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugTask\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function jsxDEVImpl(\n type,\n config,\n maybeKey,\n isStaticChildren,\n debugStack,\n debugTask\n ) {\n var children = config.children;\n if (void 0 !== children)\n if (isStaticChildren)\n if (isArrayImpl(children)) {\n for (\n isStaticChildren = 0;\n isStaticChildren < children.length;\n isStaticChildren++\n )\n validateChildKeys(children[isStaticChildren]);\n Object.freeze && Object.freeze(children);\n } else\n console.error(\n \"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.\"\n );\n else validateChildKeys(children);\n if (hasOwnProperty.call(config, \"key\")) {\n children = getComponentNameFromType(type);\n var keys = Object.keys(config).filter(function (k) {\n return \"key\" !== k;\n });\n isStaticChildren =\n 0 < keys.length\n ? \"{key: someKey, \" + keys.join(\": ..., \") + \": ...}\"\n : \"{key: someKey}\";\n didWarnAboutKeySpread[children + isStaticChildren] ||\n ((keys =\n 0 < keys.length ? \"{\" + keys.join(\": ..., \") + \": ...}\" : \"{}\"),\n console.error(\n 'A props object containing a \"key\" prop is being spread into JSX:\\n let props = %s;\\n <%s {...props} />\\nReact keys must be passed directly to JSX without using spread:\\n let props = %s;\\n <%s key={someKey} {...props} />',\n isStaticChildren,\n children,\n keys,\n children\n ),\n (didWarnAboutKeySpread[children + isStaticChildren] = !0));\n }\n children = null;\n void 0 !== maybeKey &&\n (checkKeyStringCoercion(maybeKey), (children = \"\" + maybeKey));\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (children = \"\" + config.key));\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n children &&\n defineKeyPropWarningGetter(\n maybeKey,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n return ReactElement(\n type,\n children,\n maybeKey,\n getOwner(),\n debugStack,\n debugTask\n );\n }\n function validateChildKeys(node) {\n isValidElement(node)\n ? node._store && (node._store.validated = 1)\n : \"object\" === typeof node &&\n null !== node &&\n node.$$typeof === REACT_LAZY_TYPE &&\n (\"fulfilled\" === node._payload.status\n ? isValidElement(node._payload.value) &&\n node._payload.value._store &&\n (node._payload.value._store.validated = 1)\n : node._store && (node._store.validated = 1));\n }\n function isValidElement(object) {\n return (\n \"object\" === typeof object &&\n null !== object &&\n object.$$typeof === REACT_ELEMENT_TYPE\n );\n }\n var React = require(\"react\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\"),\n REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n isArrayImpl = Array.isArray,\n createTask = console.createTask\n ? console.createTask\n : function () {\n return null;\n };\n React = {\n react_stack_bottom_frame: function (callStackForError) {\n return callStackForError();\n }\n };\n var specialPropKeyWarningShown;\n var didWarnAboutElementRef = {};\n var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(\n React,\n UnknownOwner\n )();\n var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));\n var didWarnAboutKeySpread = {};\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.jsx = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !1,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n exports.jsxs = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !0,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Navigate} from '@tanstack/react-router';\nimport {useThunderID, ThunderIDRuntimeError} from '@thunderid/react';\nimport {FC, ReactElement, ReactNode} from 'react';\n\n/**\n * Props for the ProtectedRoute component.\n */\nexport interface ProtectedRouteProps {\n /**\n * The element to render when the user is authenticated.\n */\n children: ReactElement;\n /**\n * Custom fallback element to render when the user is not authenticated.\n * If provided, this takes precedence over redirectTo.\n */\n fallback?: ReactElement;\n /**\n * Custom loading element to render while authentication status is being determined.\n */\n loader?: ReactNode;\n /**\n * URL to redirect to when the user is not authenticated.\n * Required unless a fallback element is provided.\n */\n redirectTo?: string;\n}\n\n/**\n * A protected route component that requires authentication to access.\n *\n * This component should be used as the component prop of a TanStack Router route.\n * It checks authentication status and either renders the protected content,\n * shows a loading state, redirects, or shows a fallback.\n *\n * Either a `redirectTo` prop or a `fallback` prop must be provided to handle\n * unauthenticated users.\n *\n * @example Basic usage with redirect\n * ```tsx\n * const dashboardRoute = createRouteConfig({\n * path: '/dashboard',\n * component: () => (\n * <ProtectedRoute redirectTo=\"/signin\">\n * <Dashboard />\n * </ProtectedRoute>\n * )\n * })\n * ```\n *\n * @example With custom fallback\n * ```tsx\n * const adminRoute = createRouteConfig({\n * path: '/admin',\n * component: () => (\n * <ProtectedRoute fallback={<div>Access denied</div>}>\n * <AdminPanel />\n * </ProtectedRoute>\n * )\n * })\n * ```\n */\nconst ProtectedRoute: FC<ProtectedRouteProps> = ({\n children,\n fallback,\n redirectTo,\n loader = null,\n}: ProtectedRouteProps) => {\n const {isSignedIn, isLoading} = useThunderID();\n\n if (isLoading) {\n return loader;\n }\n\n if (isSignedIn) {\n return children;\n }\n\n if (fallback) {\n return fallback;\n }\n\n if (redirectTo) {\n return <Navigate to={redirectTo} />;\n }\n\n throw new ThunderIDRuntimeError(\n '\"fallback\" or \"redirectTo\" prop is required.',\n 'ProtectedRoute-ValidationError-001',\n 'tanstack-router',\n 'Either \"fallback\" or \"redirectTo\" prop must be provided to handle unauthenticated users.',\n );\n};\n\nexport default ProtectedRoute;\n","// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {useRouter, useRouterState} from '@tanstack/react-router';\nimport {Callback} from '@thunderid/react';\nimport {FC} from 'react';\n\n/**\n * Props for the CallbackRoute component.\n */\nexport interface CallbackRouteProps {\n /**\n * Callback function called when an error occurs during OAuth processing.\n * @param error - The error that occurred\n */\n onError?: (error: Error) => void;\n\n /**\n * Optional custom navigation handler.\n * If provided, this will be called instead of the default navigate() behavior.\n * Useful for apps that need custom navigation logic.\n * @param path - The path to navigate to\n */\n onNavigate?: (path: string) => void;\n}\n\n/**\n * Handles OAuth callback redirects for TanStack Router applications.\n * Processes authorization code, validates CSRF state, and navigates back to the original path.\n * Automatically handles TanStack Router basepath when configured.\n *\n * @example\n * ```tsx\n * const callbackRoute = createRoute({\n * getParentRoute: () => rootRoute,\n * path: '/callback',\n * component: CallbackRoute,\n * });\n * ```\n */\nconst CallbackRoute: FC<CallbackRouteProps> = ({onError, onNavigate}: CallbackRouteProps) => {\n const router: ReturnType<typeof useRouter> = useRouter();\n const routerState: ReturnType<typeof useRouterState> = useRouterState();\n const {pathname}: {pathname: string} = routerState.location;\n\n const handleNavigate = (path: string): void => {\n if (onNavigate) {\n onNavigate(path);\n return;\n }\n\n const fullPath: string = window.location.pathname;\n const basename: string = fullPath.endsWith(pathname) ? fullPath.slice(0, -pathname.length).replace(/\\/$/, '') : '';\n\n const navigationPath: string = basename && path.startsWith(basename) ? path.slice(basename.length) || '/' : path;\n\n router.navigate({to: navigationPath}).catch(() => {});\n };\n\n return (\n <Callback\n onNavigate={handleNavigate}\n onError={\n onError ||\n ((error: Error): void => {\n // eslint-disable-next-line no-console\n console.error('OAuth callback error:', error);\n })\n }\n />\n );\n};\n\nexport default CallbackRoute;\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,EACG,WAAY;EACX,SAAS,yBAAyB,MAAM;AACtC,OAAI,QAAQ,KAAM,QAAO;AACzB,OAAI,eAAe,OAAO,KACxB,QAAO,KAAK,aAAa,yBACrB,OACA,KAAK,eAAe,KAAK,QAAQ;AACvC,OAAI,aAAa,OAAO,KAAM,QAAO;AACrC,WAAQ,MAAR;IACE,KAAK,oBACH,QAAO;IACT,KAAK,oBACH,QAAO;IACT,KAAK,uBACH,QAAO;IACT,KAAK,oBACH,QAAO;IACT,KAAK,yBACH,QAAO;IACT,KAAK,oBACH,QAAO;;AAEX,OAAI,aAAa,OAAO,KACtB,SACG,aAAa,OAAO,KAAK,OACxB,QAAQ,MACN,oHACD,EACH,KAAK,UALP;IAOE,KAAK,kBACH,QAAO;IACT,KAAK,mBACH,QAAO,KAAK,eAAe;IAC7B,KAAK,oBACH,SAAQ,KAAK,SAAS,eAAe,aAAa;IACpD,KAAK;KACH,IAAI,YAAY,KAAK;AACrB,YAAO,KAAK;AACZ,cACI,OAAO,UAAU,eAAe,UAAU,QAAQ,IACnD,OAAO,OAAO,OAAO,gBAAgB,OAAO,MAAM;AACrD,YAAO;IACT,KAAK,gBACH,QACG,YAAY,KAAK,eAAe,MACjC,SAAS,YACL,YACA,yBAAyB,KAAK,KAAK,IAAI;IAE/C,KAAK;AACH,iBAAY,KAAK;AACjB,YAAO,KAAK;AACZ,SAAI;AACF,aAAO,yBAAyB,KAAK,UAAU,CAAC;cACzC,GAAG;;AAElB,UAAO;;EAET,SAAS,mBAAmB,OAAO;AACjC,UAAO,KAAK;;EAEd,SAAS,uBAAuB,OAAO;AACrC,OAAI;AACF,uBAAmB,MAAM;IACzB,IAAI,2BAA2B,CAAC;YACzB,GAAG;AACV,+BAA2B,CAA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,UACF,QAAO;AAGT,KAAI,WACF,QAAO;AAGT,KAAI,SACF,QAAO;AAGT,KAAI,WACF,QAAO,4CAAC,YAAS,IAAI,aAAc;AAGrC,OAAM,IAAI,sBACR,oDACA,sCACA,mBACA,+FACD;;AAGH,6BAAe;;;;;;;;;;;;;;;;;;ACzDf,MAAMC,iBAAyC,EAAC,SAAS,iBAAoC;CAC3F,MAAMC,SAAuC,WAAW;CAExD,MAAM,EAAC,aADgD,gBAAgB,CACpB;CAEnD,MAAM,kBAAkB,SAAuB;AAC7C,MAAI,YAAY;AACd,cAAW,KAAK;AAChB;;EAGF,MAAMC,WAAmB,OAAO,SAAS;EACzC,MAAMC,WAAmB,SAAS,SAAS,SAAS,GAAG,SAAS,MAAM,GAAG,CAAC,SAAS,OAAO,CAAC,QAAQ,OAAO,GAAG,GAAG;EAEhH,MAAMC,iBAAyB,YAAY,KAAK,WAAW,SAAS,GAAG,KAAK,MAAM,SAAS,OAAO,IAAI,MAAM;AAE5G,SAAO,SAAS,EAAC,IAAI,gBAAe,CAAC,CAAC,YAAY,GAAG;;AAGvD,QACE,4CAAC;EACC,YAAY;EACZ,SACE,aACE,UAAuB;AAEvB,WAAQ,MAAM,yBAAyB,MAAM;;GAGjD;;AAIN,4BAAe"}
1
+ {"version":3,"file":"index.js","names":["ProtectedRoute: FC<ProtectedRouteProps>","CallbackRoute: FC<CallbackRouteProps>","router: ReturnType<typeof useRouter>","fullPath: string","basename: string","navigationPath: string","SECTION_PAGES: Record<AdminSection, Record<AdminPageKind, AdminPageRenderer>>","AdminPage: FC<AdminPageProps>","navigate: ReturnType<typeof useNavigate>","id: string","sectionPath: string","createAction: ReactNode","DEFAULT_SECTIONS: AdminSection[]","sectionRoute: AnyRoute","element: ReactElement","AdminPage","ProtectedRoute"],"sources":["../../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.development.js","../../../node_modules/.pnpm/react@19.2.3/node_modules/react/jsx-runtime.js","../src/components/ProtectedRoute.tsx","../src/components/CallbackRoute.tsx","../src/routes/AdminPage.tsx","../src/routes/createAdminRoutes.tsx"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return type.displayName || \"Context\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function getTaskName(type) {\n if (type === REACT_FRAGMENT_TYPE) return \"<>\";\n if (\n \"object\" === typeof type &&\n null !== type &&\n type.$$typeof === REACT_LAZY_TYPE\n )\n return \"<...>\";\n try {\n var name = getComponentNameFromType(type);\n return name ? \"<\" + name + \">\" : \"<...>\";\n } catch (x) {\n return \"<...>\";\n }\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function UnknownOwner() {\n return Error(\"react-stack-top-frame\");\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(type, key, props, owner, debugStack, debugTask) {\n var refProp = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== refProp ? refProp : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.defineProperty(type, \"_debugStack\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugStack\n });\n Object.defineProperty(type, \"_debugTask\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugTask\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function jsxDEVImpl(\n type,\n config,\n maybeKey,\n isStaticChildren,\n debugStack,\n debugTask\n ) {\n var children = config.children;\n if (void 0 !== children)\n if (isStaticChildren)\n if (isArrayImpl(children)) {\n for (\n isStaticChildren = 0;\n isStaticChildren < children.length;\n isStaticChildren++\n )\n validateChildKeys(children[isStaticChildren]);\n Object.freeze && Object.freeze(children);\n } else\n console.error(\n \"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.\"\n );\n else validateChildKeys(children);\n if (hasOwnProperty.call(config, \"key\")) {\n children = getComponentNameFromType(type);\n var keys = Object.keys(config).filter(function (k) {\n return \"key\" !== k;\n });\n isStaticChildren =\n 0 < keys.length\n ? \"{key: someKey, \" + keys.join(\": ..., \") + \": ...}\"\n : \"{key: someKey}\";\n didWarnAboutKeySpread[children + isStaticChildren] ||\n ((keys =\n 0 < keys.length ? \"{\" + keys.join(\": ..., \") + \": ...}\" : \"{}\"),\n console.error(\n 'A props object containing a \"key\" prop is being spread into JSX:\\n let props = %s;\\n <%s {...props} />\\nReact keys must be passed directly to JSX without using spread:\\n let props = %s;\\n <%s key={someKey} {...props} />',\n isStaticChildren,\n children,\n keys,\n children\n ),\n (didWarnAboutKeySpread[children + isStaticChildren] = !0));\n }\n children = null;\n void 0 !== maybeKey &&\n (checkKeyStringCoercion(maybeKey), (children = \"\" + maybeKey));\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (children = \"\" + config.key));\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n children &&\n defineKeyPropWarningGetter(\n maybeKey,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n return ReactElement(\n type,\n children,\n maybeKey,\n getOwner(),\n debugStack,\n debugTask\n );\n }\n function validateChildKeys(node) {\n isValidElement(node)\n ? node._store && (node._store.validated = 1)\n : \"object\" === typeof node &&\n null !== node &&\n node.$$typeof === REACT_LAZY_TYPE &&\n (\"fulfilled\" === node._payload.status\n ? isValidElement(node._payload.value) &&\n node._payload.value._store &&\n (node._payload.value._store.validated = 1)\n : node._store && (node._store.validated = 1));\n }\n function isValidElement(object) {\n return (\n \"object\" === typeof object &&\n null !== object &&\n object.$$typeof === REACT_ELEMENT_TYPE\n );\n }\n var React = require(\"react\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\"),\n REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n isArrayImpl = Array.isArray,\n createTask = console.createTask\n ? console.createTask\n : function () {\n return null;\n };\n React = {\n react_stack_bottom_frame: function (callStackForError) {\n return callStackForError();\n }\n };\n var specialPropKeyWarningShown;\n var didWarnAboutElementRef = {};\n var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(\n React,\n UnknownOwner\n )();\n var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));\n var didWarnAboutKeySpread = {};\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.jsx = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !1,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n exports.jsxs = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !0,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Navigate} from '@tanstack/react-router';\nimport {useThunderID, ThunderIDRuntimeError} from '@thunderid/react';\nimport {FC, ReactElement, ReactNode} from 'react';\n\n/**\n * Props for the ProtectedRoute component.\n */\nexport interface ProtectedRouteProps {\n /**\n * The element to render when the user is authenticated.\n */\n children: ReactElement;\n /**\n * Custom fallback element to render when the user is not authenticated.\n * If provided, this takes precedence over redirectTo.\n */\n fallback?: ReactElement;\n /**\n * Custom loading element to render while authentication status is being determined.\n */\n loader?: ReactNode;\n /**\n * URL to redirect to when the user is not authenticated.\n * Required unless a fallback element is provided.\n */\n redirectTo?: string;\n}\n\n/**\n * A protected route component that requires authentication to access.\n *\n * This component should be used as the component prop of a TanStack Router route.\n * It checks authentication status and either renders the protected content,\n * shows a loading state, redirects, or shows a fallback.\n *\n * Either a `redirectTo` prop or a `fallback` prop must be provided to handle\n * unauthenticated users.\n *\n * @example Basic usage with redirect\n * ```tsx\n * const dashboardRoute = createRouteConfig({\n * path: '/dashboard',\n * component: () => (\n * <ProtectedRoute redirectTo=\"/signin\">\n * <Dashboard />\n * </ProtectedRoute>\n * )\n * })\n * ```\n *\n * @example With custom fallback\n * ```tsx\n * const adminRoute = createRouteConfig({\n * path: '/admin',\n * component: () => (\n * <ProtectedRoute fallback={<div>Access denied</div>}>\n * <AdminPanel />\n * </ProtectedRoute>\n * )\n * })\n * ```\n */\nconst ProtectedRoute: FC<ProtectedRouteProps> = ({\n children,\n fallback,\n redirectTo,\n loader = null,\n}: ProtectedRouteProps) => {\n const {isSignedIn, isLoading} = useThunderID();\n\n if (isLoading) {\n return loader;\n }\n\n if (isSignedIn) {\n return children;\n }\n\n if (fallback) {\n return fallback;\n }\n\n if (redirectTo) {\n return <Navigate to={redirectTo} />;\n }\n\n throw new ThunderIDRuntimeError(\n '\"fallback\" or \"redirectTo\" prop is required.',\n 'ProtectedRoute-ValidationError-001',\n 'tanstack-router',\n 'Either \"fallback\" or \"redirectTo\" prop must be provided to handle unauthenticated users.',\n );\n};\n\nexport default ProtectedRoute;\n","// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {useRouter, useRouterState} from '@tanstack/react-router';\nimport {Callback} from '@thunderid/react';\nimport {FC} from 'react';\n\n/**\n * Props for the CallbackRoute component.\n */\nexport interface CallbackRouteProps {\n /**\n * Callback function called when an error occurs during OAuth processing.\n * @param error - The error that occurred\n */\n onError?: (error: Error) => void;\n\n /**\n * Optional custom navigation handler.\n * If provided, this will be called instead of the default navigate() behavior.\n * Useful for apps that need custom navigation logic.\n * @param path - The path to navigate to\n */\n onNavigate?: (path: string) => void;\n}\n\n/**\n * Handles OAuth callback redirects for TanStack Router applications.\n * Processes authorization code, validates CSRF state, and navigates back to the original path.\n * Automatically handles TanStack Router basepath when configured.\n *\n * @example\n * ```tsx\n * const callbackRoute = createRoute({\n * getParentRoute: () => rootRoute,\n * path: '/callback',\n * component: CallbackRoute,\n * });\n * ```\n */\nconst CallbackRoute: FC<CallbackRouteProps> = ({onError, onNavigate}: CallbackRouteProps) => {\n const router: ReturnType<typeof useRouter> = useRouter();\n const routerState: ReturnType<typeof useRouterState> = useRouterState();\n const {pathname}: {pathname: string} = routerState.location;\n\n const handleNavigate = (path: string): void => {\n if (onNavigate) {\n onNavigate(path);\n return;\n }\n\n const fullPath: string = window.location.pathname;\n const basename: string = fullPath.endsWith(pathname) ? fullPath.slice(0, -pathname.length).replace(/\\/$/, '') : '';\n\n const navigationPath: string = basename && path.startsWith(basename) ? path.slice(basename.length) || '/' : path;\n\n router.navigate({to: navigationPath}).catch(() => {});\n };\n\n return (\n <Callback\n onNavigate={handleNavigate}\n onError={\n onError ||\n ((error: Error): void => {\n // eslint-disable-next-line no-console\n console.error('OAuth callback error:', error);\n })\n }\n />\n );\n};\n\nexport default CallbackRoute;\n","// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {useNavigate, useParams} from '@tanstack/react-router';\nimport {\n AgentCreate,\n AgentDetails,\n AgentList,\n Button,\n GroupCreate,\n GroupList,\n GroupMembers,\n RoleAssignments,\n RoleCreate,\n RoleList,\n RolePermissions,\n UserCreate,\n UserDetails,\n UserList,\n useTranslation,\n} from '@thunderid/react';\nimport {FC, ReactElement, ReactNode} from 'react';\nimport type {AdminRoutesOptions, AdminSection} from './createAdminRoutes';\n\nexport type AdminPageKind = 'create' | 'details' | 'list';\n\n/**\n * Navigation between the pages of one section.\n */\ninterface AdminNavigation {\n createAction: ReactNode;\n toDetails: (id: string) => void;\n toList: () => void;\n}\n\ninterface AdminPageContext extends AdminNavigation {\n id: string;\n options: AdminRoutesOptions;\n}\n\ntype AdminPageRenderer = (context: AdminPageContext) => ReactElement;\n\nconst SECTION_PAGES: Record<AdminSection, Record<AdminPageKind, AdminPageRenderer>> = {\n agents: {\n create: ({options, toDetails}: AdminPageContext) => (\n <AgentCreate preferences={options.preferences} onCreated={(agent: {id: string}) => toDetails(agent.id)} />\n ),\n details: ({id, options, toList}: AdminPageContext) => (\n <AgentDetails agentId={id} deletable={options.deletable} preferences={options.preferences} onDeleted={toList} />\n ),\n list: ({createAction, options, toDetails}: AdminPageContext) => (\n <AgentList\n actions={createAction}\n preferences={options.preferences}\n onSelect={(agent: {id: string}) => toDetails(agent.id)}\n />\n ),\n },\n groups: {\n create: ({options, toDetails}: AdminPageContext) => (\n <GroupCreate preferences={options.preferences} onCreated={(group: {id: string}) => toDetails(group.id)} />\n ),\n details: ({id, options}: AdminPageContext) => (\n <GroupMembers groupId={id} editable={options.editable} preferences={options.preferences} />\n ),\n list: ({createAction, options, toDetails}: AdminPageContext) => (\n <GroupList\n actions={createAction}\n preferences={options.preferences}\n onSelect={(group: {id: string}) => toDetails(group.id)}\n />\n ),\n },\n roles: {\n create: ({options, toDetails}: AdminPageContext) => (\n <RoleCreate preferences={options.preferences} onCreated={(role: {id: string}) => toDetails(role.id)} />\n ),\n details: ({id, options}: AdminPageContext) => (\n <>\n <RolePermissions roleId={id} preferences={options.preferences} />\n <RoleAssignments roleId={id} editable={options.editable} preferences={options.preferences} />\n </>\n ),\n list: ({createAction, options, toDetails}: AdminPageContext) => (\n <RoleList\n actions={createAction}\n preferences={options.preferences}\n onSelect={(role: {id: string}) => toDetails(role.id)}\n />\n ),\n },\n users: {\n create: ({options, toDetails}: AdminPageContext) => (\n <UserCreate preferences={options.preferences} onCreated={(user: {id: string}) => toDetails(user.id)} />\n ),\n details: ({id, options, toList}: AdminPageContext) => (\n <UserDetails\n userId={id}\n deletable={options.deletable}\n editable={options.editable}\n preferences={options.preferences}\n onDeleted={toList}\n />\n ),\n list: ({createAction, options, toDetails}: AdminPageContext) => (\n <UserList\n actions={createAction}\n preferences={options.preferences}\n onSelect={(user: {id: string}) => toDetails(user.id)}\n />\n ),\n },\n};\n\ninterface AdminPageProps {\n /**\n * Returns the full path of the section route. Read at render time, once the router has resolved it.\n */\n getSectionPath: () => string;\n kind: AdminPageKind;\n options: AdminRoutesOptions;\n section: AdminSection;\n}\n\n/**\n * Renders one admin page and wires its callbacks to navigation within its section.\n */\nconst AdminPage: FC<AdminPageProps> = ({getSectionPath, kind, options, section}: AdminPageProps): ReactElement => {\n const navigate: ReturnType<typeof useNavigate> = useNavigate();\n const id: string = useParams({\n select: (params: {id?: string}): string => params.id ?? '',\n strict: false,\n });\n const {t} = useTranslation(options.preferences?.i18n);\n const sectionPath: string = getSectionPath().replace(/\\/+$/, '');\n\n const toList = (): void => {\n void navigate({to: sectionPath});\n };\n // The identifier goes through `params`, so the router encodes it.\n const toDetails = (resourceId: string): void => {\n void navigate({params: {id: resourceId}, to: `${sectionPath}/$id`});\n };\n\n const createAction: ReactNode =\n kind === 'list' ? (\n <Button onClick={(): void => void navigate({to: `${sectionPath}/new`})}>\n {t(`admin.${section}.create.title`)}\n </Button>\n ) : null;\n\n return SECTION_PAGES[section][kind]({createAction, id, options, toDetails, toList});\n};\n\nexport default AdminPage;\n","// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {AnyRoute, createRoute} from '@tanstack/react-router';\nimport type {UserListProps} from '@thunderid/react';\nimport {ReactElement} from 'react';\nimport AdminPage, {AdminPageKind} from './AdminPage';\nimport ProtectedRoute, {ProtectedRouteProps} from '../components/ProtectedRoute';\n\n/**\n * An admin section that {@link createAdminRoutes} can mount.\n */\nexport type AdminSection = 'agents' | 'groups' | 'roles' | 'users';\n\n/**\n * Options for {@link createAdminRoutes}.\n */\nexport interface AdminRoutesOptions {\n /**\n * Shows the delete action on the user and agent details pages.\n * @default false\n */\n deletable?: boolean;\n /**\n * Allows editing on the details pages: user attributes, group members and role assignments. When\n * unset, each component keeps its own default.\n */\n editable?: boolean;\n /**\n * Passed to every admin component.\n */\n preferences?: UserListProps['preferences'];\n /**\n * Wraps every admin page in {@link ProtectedRoute} with these props. The management API still\n * checks every request, so this only decides what an unauthenticated visitor sees.\n */\n protect?: Omit<ProtectedRouteProps, 'children'>;\n /**\n * The sections to mount.\n * @default ['users', 'groups', 'roles', 'agents']\n */\n sections?: AdminSection[];\n}\n\nconst DEFAULT_SECTIONS: AdminSection[] = ['users', 'groups', 'roles', 'agents'];\n\n/**\n * Builds TanStack Router routes that mount the admin (management) sections of `@thunderid/react`\n * under `parentRoute`: for each section a list at `<section>`, a create form at `<section>/new`, and\n * a details page at `<section>/$id`. Selecting, creating and deleting navigate between them.\n *\n * The routes are built with `createRoute`, so they carry no route-tree types of their own; navigate\n * to them with string paths.\n *\n * @param parentRoute - The route to mount the sections under, such as the root route or an `/admin` route.\n * @param options - Which sections to mount and how to render them.\n * @returns One route per section, each with its pages as children, for `parentRoute.addChildren`.\n *\n * @example\n * ```tsx\n * const adminRoute = createRoute({getParentRoute: () => rootRoute, path: '/admin'});\n *\n * const routeTree = rootRoute.addChildren([\n * indexRoute,\n * adminRoute.addChildren(createAdminRoutes(adminRoute, {protect: {redirectTo: '/signin'}})),\n * ]);\n * ```\n */\nconst createAdminRoutes = (parentRoute: AnyRoute, options: AdminRoutesOptions = {}): AnyRoute[] => {\n const {protect, sections = DEFAULT_SECTIONS} = options;\n\n return sections.map((section: AdminSection): AnyRoute => {\n const sectionRoute: AnyRoute = createRoute({getParentRoute: () => parentRoute, path: section});\n\n const page = (kind: AdminPageKind): (() => ReactElement) => {\n const Page = (): ReactElement => {\n const element: ReactElement = (\n <AdminPage\n getSectionPath={(): string => sectionRoute.fullPath as string}\n kind={kind}\n options={options}\n section={section}\n />\n );\n\n return protect ? <ProtectedRoute {...protect}>{element}</ProtectedRoute> : element;\n };\n\n Page.displayName = `Admin(${section}/${kind})`;\n\n return Page;\n };\n\n return sectionRoute.addChildren([\n createRoute({component: page('list'), getParentRoute: () => sectionRoute, path: '/'}),\n createRoute({component: page('create'), getParentRoute: () => sectionRoute, path: 'new'}),\n createRoute({component: page('details'), getParentRoute: () => sectionRoute, path: '$id'}),\n ]) as AnyRoute;\n });\n};\n\nexport default createAdminRoutes;\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,EACG,WAAY;EACX,SAAS,yBAAyB,MAAM;AACtC,OAAI,QAAQ,KAAM,QAAO;AACzB,OAAI,eAAe,OAAO,KACxB,QAAO,KAAK,aAAa,yBACrB,OACA,KAAK,eAAe,KAAK,QAAQ;AACvC,OAAI,aAAa,OAAO,KAAM,QAAO;AACrC,WAAQ,MAAR;IACE,KAAK,oBACH,QAAO;IACT,KAAK,oBACH,QAAO;IACT,KAAK,uBACH,QAAO;IACT,KAAK,oBACH,QAAO;IACT,KAAK,yBACH,QAAO;IACT,KAAK,oBACH,QAAO;;AAEX,OAAI,aAAa,OAAO,KACtB,SACG,aAAa,OAAO,KAAK,OACxB,QAAQ,MACN,oHACD,EACH,KAAK,UAL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,KAAiB;CACjG,MAAM,EAAC,SAAS,WAAW,qBAAoB;AAE/C,QAAO,SAAS,KAAK,YAAoC;EACvD,MAAMC,eAAyB,YAAY;GAAC,sBAAsB;GAAa,MAAM;GAAQ,CAAC;EAE9F,MAAM,QAAQ,SAA8C;GAC1D,MAAM,aAA2B;IAC/B,MAAMC,UACJ,4CAACC;KACC,sBAA8B,aAAa;KACrC;KACG;KACA;MACT;AAGJ,WAAO,UAAU,4CAACC;KAAe,GAAI;eAAU;MAAyB,GAAG;;AAG7E,QAAK,cAAc,SAAS,QAAQ,GAAG,KAAK;AAE5C,UAAO;;AAGT,SAAO,aAAa,YAAY;GAC9B,YAAY;IAAC,WAAW,KAAK,OAAO;IAAE,sBAAsB;IAAc,MAAM;IAAI,CAAC;GACrF,YAAY;IAAC,WAAW,KAAK,SAAS;IAAE,sBAAsB;IAAc,MAAM;IAAM,CAAC;GACzF,YAAY;IAAC,WAAW,KAAK,UAAU;IAAE,sBAAsB;IAAc,MAAM;IAAM,CAAC;GAC3F,CAAC;GACF;;AAGJ,gCAAe"}
@@ -0,0 +1,18 @@
1
+ import { FC } from 'react';
2
+ import type { AdminRoutesOptions, AdminSection } from './createAdminRoutes';
3
+ export type AdminPageKind = 'create' | 'details' | 'list';
4
+ interface AdminPageProps {
5
+ /**
6
+ * Returns the full path of the section route. Read at render time, once the router has resolved it.
7
+ */
8
+ getSectionPath: () => string;
9
+ kind: AdminPageKind;
10
+ options: AdminRoutesOptions;
11
+ section: AdminSection;
12
+ }
13
+ /**
14
+ * Renders one admin page and wires its callbacks to navigation within its section.
15
+ */
16
+ declare const AdminPage: FC<AdminPageProps>;
17
+ export default AdminPage;
18
+ //# sourceMappingURL=AdminPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdminPage.d.ts","sourceRoot":"","sources":["../../src/routes/AdminPage.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAC,EAAE,EAA0B,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAC,kBAAkB,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAE1E,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AA0F1D,UAAU,cAAc;IACtB;;OAEG;IACH,cAAc,EAAE,MAAM,MAAM,CAAC;IAC7B,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;GAEG;AACH,QAAA,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAyBjC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { AnyRoute } from '@tanstack/react-router';
2
+ import type { UserListProps } from '@thunderid/react';
3
+ import { ProtectedRouteProps } from '../components/ProtectedRoute';
4
+ /**
5
+ * An admin section that {@link createAdminRoutes} can mount.
6
+ */
7
+ export type AdminSection = 'agents' | 'groups' | 'roles' | 'users';
8
+ /**
9
+ * Options for {@link createAdminRoutes}.
10
+ */
11
+ export interface AdminRoutesOptions {
12
+ /**
13
+ * Shows the delete action on the user and agent details pages.
14
+ * @default false
15
+ */
16
+ deletable?: boolean;
17
+ /**
18
+ * Allows editing on the details pages: user attributes, group members and role assignments. When
19
+ * unset, each component keeps its own default.
20
+ */
21
+ editable?: boolean;
22
+ /**
23
+ * Passed to every admin component.
24
+ */
25
+ preferences?: UserListProps['preferences'];
26
+ /**
27
+ * Wraps every admin page in {@link ProtectedRoute} with these props. The management API still
28
+ * checks every request, so this only decides what an unauthenticated visitor sees.
29
+ */
30
+ protect?: Omit<ProtectedRouteProps, 'children'>;
31
+ /**
32
+ * The sections to mount.
33
+ * @default ['users', 'groups', 'roles', 'agents']
34
+ */
35
+ sections?: AdminSection[];
36
+ }
37
+ /**
38
+ * Builds TanStack Router routes that mount the admin (management) sections of `@thunderid/react`
39
+ * under `parentRoute`: for each section a list at `<section>`, a create form at `<section>/new`, and
40
+ * a details page at `<section>/$id`. Selecting, creating and deleting navigate between them.
41
+ *
42
+ * The routes are built with `createRoute`, so they carry no route-tree types of their own; navigate
43
+ * to them with string paths.
44
+ *
45
+ * @param parentRoute - The route to mount the sections under, such as the root route or an `/admin` route.
46
+ * @param options - Which sections to mount and how to render them.
47
+ * @returns One route per section, each with its pages as children, for `parentRoute.addChildren`.
48
+ *
49
+ * @example
50
+ * ```tsx
51
+ * const adminRoute = createRoute({getParentRoute: () => rootRoute, path: '/admin'});
52
+ *
53
+ * const routeTree = rootRoute.addChildren([
54
+ * indexRoute,
55
+ * adminRoute.addChildren(createAdminRoutes(adminRoute, {protect: {redirectTo: '/signin'}})),
56
+ * ]);
57
+ * ```
58
+ */
59
+ declare const createAdminRoutes: (parentRoute: AnyRoute, options?: AdminRoutesOptions) => AnyRoute[];
60
+ export default createAdminRoutes;
61
+ //# sourceMappingURL=createAdminRoutes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createAdminRoutes.d.ts","sourceRoot":"","sources":["../../src/routes/createAdminRoutes.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAC,QAAQ,EAAc,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAGpD,OAAuB,EAAC,mBAAmB,EAAC,MAAM,8BAA8B,CAAC;AAEjF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IAC3C;;;OAGG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;IAChD;;;OAGG;IACH,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAID;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,QAAA,MAAM,iBAAiB,GAAI,aAAa,QAAQ,EAAE,UAAS,kBAAuB,KAAG,QAAQ,EA+B5F,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thunderid/tanstack-router",
3
- "version": "1.3.1",
3
+ "version": "1.5.0",
4
4
  "description": "TanStack Router integration for ThunderID",
5
5
  "keywords": [
6
6
  "thunderid",
@@ -37,7 +37,7 @@
37
37
  "@testing-library/react": "16.3.0",
38
38
  "@thunderid/eslint-plugin": "1.0.1",
39
39
  "@thunderid/prettier-config": "1.0.1",
40
- "@thunderid/react": "^1.4.1",
40
+ "@thunderid/react": "^1.6.0",
41
41
  "@types/node": "24.7.2",
42
42
  "@types/react": "19.2.14",
43
43
  "@vitest/browser-playwright": "4.1.11",