@cedros/login-react 0.0.40 → 0.0.41

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.
Files changed (94) hide show
  1. package/dist/{AuthenticationSettings-DUXpyiJ5.js → AuthenticationSettings-CSoFp-_2.js} +1 -1
  2. package/dist/{AuthenticationSettings-DUXpyiJ5.js.map → AuthenticationSettings-CSoFp-_2.js.map} +1 -1
  3. package/dist/{AuthenticationSettings-Dk1LX0CK.cjs → AuthenticationSettings-Cu5Z2mTC.cjs} +1 -1
  4. package/dist/{AuthenticationSettings-Dk1LX0CK.cjs.map → AuthenticationSettings-Cu5Z2mTC.cjs.map} +1 -1
  5. package/dist/{AuthenticationSettings-BF_7Ea6Z.js → AuthenticationSettings-D4ExU-2a.js} +1 -1
  6. package/dist/{AuthenticationSettings-BF_7Ea6Z.js.map → AuthenticationSettings-D4ExU-2a.js.map} +1 -1
  7. package/dist/{AuthenticationSettings-BMDrCVSf.cjs → AuthenticationSettings-DABzZHuI.cjs} +1 -1
  8. package/dist/{AuthenticationSettings-BMDrCVSf.cjs.map → AuthenticationSettings-DABzZHuI.cjs.map} +1 -1
  9. package/dist/AutosaveStatus-B1A1zORa.cjs +1 -0
  10. package/dist/AutosaveStatus-B1A1zORa.cjs.map +1 -0
  11. package/dist/{AutosaveStatus-CSZsp6w7.js → AutosaveStatus-DMjvXzP2.js} +526 -341
  12. package/dist/AutosaveStatus-DMjvXzP2.js.map +1 -0
  13. package/dist/CreditSystemSettings-BWuiRTtA.cjs +1 -0
  14. package/dist/CreditSystemSettings-BWuiRTtA.cjs.map +1 -0
  15. package/dist/{CreditSystemSettings-Cj21_Ug8.js → CreditSystemSettings-BjQdysRS.js} +1 -1
  16. package/dist/{CreditSystemSettings-Cj21_Ug8.js.map → CreditSystemSettings-BjQdysRS.js.map} +1 -1
  17. package/dist/{CreditSystemSettings-CLImarX-.cjs → CreditSystemSettings-DfSfQVE8.cjs} +1 -1
  18. package/dist/{CreditSystemSettings-CLImarX-.cjs.map → CreditSystemSettings-DfSfQVE8.cjs.map} +1 -1
  19. package/dist/{CreditSystemSettings-Buu7Y-7I.js → CreditSystemSettings-Du3ac0ID.js} +12 -7
  20. package/dist/CreditSystemSettings-Du3ac0ID.js.map +1 -0
  21. package/dist/EmailRegisterForm-CMXsa-_r.js +750 -0
  22. package/dist/EmailRegisterForm-CMXsa-_r.js.map +1 -0
  23. package/dist/EmailRegisterForm-i7f4St2N.cjs +1 -0
  24. package/dist/EmailRegisterForm-i7f4St2N.cjs.map +1 -0
  25. package/dist/EmailSettings-ASDHfI0K.js +86 -0
  26. package/dist/EmailSettings-ASDHfI0K.js.map +1 -0
  27. package/dist/EmailSettings-BcHo0cqk.cjs +1 -0
  28. package/dist/EmailSettings-BcHo0cqk.cjs.map +1 -0
  29. package/dist/{EmailSettings-CmxxnrA9.js → EmailSettings-CjngJwDS.js} +1 -1
  30. package/dist/{EmailSettings-CmxxnrA9.js.map → EmailSettings-CjngJwDS.js.map} +1 -1
  31. package/dist/{EmailSettings-9sdEAONl.cjs → EmailSettings-CswtKXhb.cjs} +1 -1
  32. package/dist/{EmailSettings-9sdEAONl.cjs.map → EmailSettings-CswtKXhb.cjs.map} +1 -1
  33. package/dist/{EmbeddedWalletSettings-BuLN_Uqc.cjs → EmbeddedWalletSettings-BXlboZ9-.cjs} +1 -1
  34. package/dist/{EmbeddedWalletSettings-BuLN_Uqc.cjs.map → EmbeddedWalletSettings-BXlboZ9-.cjs.map} +1 -1
  35. package/dist/{EmbeddedWalletSettings-DGq-kXbw.cjs → EmbeddedWalletSettings-BkwIbTkL.cjs} +1 -1
  36. package/dist/{EmbeddedWalletSettings-DGq-kXbw.cjs.map → EmbeddedWalletSettings-BkwIbTkL.cjs.map} +1 -1
  37. package/dist/{EmbeddedWalletSettings-CHkkCjyR.js → EmbeddedWalletSettings-CPLbqlxJ.js} +1 -1
  38. package/dist/{EmbeddedWalletSettings-CHkkCjyR.js.map → EmbeddedWalletSettings-CPLbqlxJ.js.map} +1 -1
  39. package/dist/{EmbeddedWalletSettings-M-D5N0eY.js → EmbeddedWalletSettings-CUY_X7Vj.js} +1 -1
  40. package/dist/{EmbeddedWalletSettings-M-D5N0eY.js.map → EmbeddedWalletSettings-CUY_X7Vj.js.map} +1 -1
  41. package/dist/{PermissionsSection-DEMVp7X3.cjs → PermissionsSection-B-6DJnN8.cjs} +1 -1
  42. package/dist/{PermissionsSection-DEMVp7X3.cjs.map → PermissionsSection-B-6DJnN8.cjs.map} +1 -1
  43. package/dist/{PermissionsSection-DNzOL1xW.js → PermissionsSection-BeFhIgQy.js} +22 -18
  44. package/dist/{PermissionsSection-DNzOL1xW.js.map → PermissionsSection-BeFhIgQy.js.map} +1 -1
  45. package/dist/{ServerSettings-DQemMrNv.js → ServerSettings-B9PNMse1.js} +1 -1
  46. package/dist/{ServerSettings-DQemMrNv.js.map → ServerSettings-B9PNMse1.js.map} +1 -1
  47. package/dist/{ServerSettings-qxi8aZO7.js → ServerSettings-BLoWX7KG.js} +1 -1
  48. package/dist/{ServerSettings-qxi8aZO7.js.map → ServerSettings-BLoWX7KG.js.map} +1 -1
  49. package/dist/{ServerSettings-CMmH5pZv.cjs → ServerSettings-BygCxOTY.cjs} +1 -1
  50. package/dist/{ServerSettings-CMmH5pZv.cjs.map → ServerSettings-BygCxOTY.cjs.map} +1 -1
  51. package/dist/{ServerSettings-DfimU7ay.cjs → ServerSettings-CgBdYspU.cjs} +1 -1
  52. package/dist/{ServerSettings-DfimU7ay.cjs.map → ServerSettings-CgBdYspU.cjs.map} +1 -1
  53. package/dist/{TeamSection-DopbZClq.cjs → TeamSection-B1t1tU-_.cjs} +1 -1
  54. package/dist/{TeamSection-DopbZClq.cjs.map → TeamSection-B1t1tU-_.cjs.map} +1 -1
  55. package/dist/{TeamSection-CoMXyFtz.js → TeamSection-DbSYDRdI.js} +1 -1
  56. package/dist/{TeamSection-CoMXyFtz.js.map → TeamSection-DbSYDRdI.js.map} +1 -1
  57. package/dist/{WebhookSettings-B8hAwhZ2.js → WebhookSettings-C-7Yxueu.js} +1 -1
  58. package/dist/{WebhookSettings-B8hAwhZ2.js.map → WebhookSettings-C-7Yxueu.js.map} +1 -1
  59. package/dist/{WebhookSettings-8QAqvkkO.js → WebhookSettings-C923ZSKa.js} +1 -1
  60. package/dist/{WebhookSettings-8QAqvkkO.js.map → WebhookSettings-C923ZSKa.js.map} +1 -1
  61. package/dist/{WebhookSettings-0sgWRI3U.cjs → WebhookSettings-CbU3cfTJ.cjs} +1 -1
  62. package/dist/{WebhookSettings-0sgWRI3U.cjs.map → WebhookSettings-CbU3cfTJ.cjs.map} +1 -1
  63. package/dist/{WebhookSettings-B6Y3Tnjv.cjs → WebhookSettings-D19u9Uok.cjs} +1 -1
  64. package/dist/{WebhookSettings-B6Y3Tnjv.cjs.map → WebhookSettings-D19u9Uok.cjs.map} +1 -1
  65. package/dist/admin-only.cjs +1 -1
  66. package/dist/admin-only.js +1 -1
  67. package/dist/email-only.cjs +1 -1
  68. package/dist/email-only.d.ts +1 -1
  69. package/dist/email-only.js +1 -1
  70. package/dist/index.cjs +13 -13
  71. package/dist/index.cjs.map +1 -1
  72. package/dist/index.d.ts +4 -4
  73. package/dist/index.js +3766 -3624
  74. package/dist/index.js.map +1 -1
  75. package/dist/login-react.css +1 -1
  76. package/dist/{plugin-C_NDZ2-D.js → plugin-BiftIhZe.js} +1 -1
  77. package/dist/{plugin-C_NDZ2-D.js.map → plugin-BiftIhZe.js.map} +1 -1
  78. package/dist/{plugin-CUxpAjL-.cjs → plugin-BtQdI_Ay.cjs} +1 -1
  79. package/dist/{plugin-CUxpAjL-.cjs.map → plugin-BtQdI_Ay.cjs.map} +1 -1
  80. package/package.json +1 -1
  81. package/dist/AutosaveStatus-BKsCIvPj.cjs +0 -1
  82. package/dist/AutosaveStatus-BKsCIvPj.cjs.map +0 -1
  83. package/dist/AutosaveStatus-CSZsp6w7.js.map +0 -1
  84. package/dist/CreditSystemSettings-Buu7Y-7I.js.map +0 -1
  85. package/dist/CreditSystemSettings-C2HkyMXy.cjs +0 -1
  86. package/dist/CreditSystemSettings-C2HkyMXy.cjs.map +0 -1
  87. package/dist/EmailRegisterForm-CNjYrqU6.cjs +0 -1
  88. package/dist/EmailRegisterForm-CNjYrqU6.cjs.map +0 -1
  89. package/dist/EmailRegisterForm-D2VaJouj.js +0 -750
  90. package/dist/EmailRegisterForm-D2VaJouj.js.map +0 -1
  91. package/dist/EmailSettings-DRfOF0Sf.js +0 -78
  92. package/dist/EmailSettings-DRfOF0Sf.js.map +0 -1
  93. package/dist/EmailSettings-eLlzzI5D.cjs +0 -1
  94. package/dist/EmailSettings-eLlzzI5D.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-CUxpAjL-.cjs","sources":["../src/components/admin/ProfileDropdown.tsx","../src/admin/AdminShell.tsx","../src/admin/icons.tsx","../src/admin/plugin.tsx"],"sourcesContent":["/**\n * Profile Dropdown Component\n *\n * Displays user avatar/name with a dropdown menu for settings and logout.\n */\n\nimport { useState, useRef, useEffect, useCallback } from 'react';\n\nexport interface ProfileDropdownProps {\n /** User's display name */\n name?: string;\n /** User's email */\n email?: string;\n /** User's profile picture URL */\n picture?: string;\n /** Callback when Settings is clicked */\n onSettings?: () => void;\n /** Callback when Logout is clicked */\n onLogout?: () => void;\n /** Additional CSS class */\n className?: string;\n}\n\n/**\n * Profile dropdown button with settings and logout options.\n *\n * @example\n * ```tsx\n * <ProfileDropdown\n * name={user.name}\n * email={user.email}\n * picture={user.picture}\n * onSettings={() => navigate('/settings')}\n * onLogout={logout}\n * />\n * ```\n */\nexport function ProfileDropdown({\n name,\n email,\n picture,\n onSettings,\n onLogout,\n className = '',\n}: ProfileDropdownProps) {\n const [isOpen, setIsOpen] = useState(false);\n const dropdownRef = useRef<HTMLDivElement>(null);\n\n // Close dropdown when clicking outside\n useEffect(() => {\n function handleClickOutside(event: MouseEvent) {\n if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {\n setIsOpen(false);\n }\n }\n\n if (isOpen) {\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }\n }, [isOpen]);\n\n // Close dropdown on escape key\n useEffect(() => {\n function handleEscape(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n setIsOpen(false);\n }\n }\n\n if (isOpen) {\n document.addEventListener('keydown', handleEscape);\n return () => document.removeEventListener('keydown', handleEscape);\n }\n }, [isOpen]);\n\n const handleSettings = useCallback(() => {\n setIsOpen(false);\n onSettings?.();\n }, [onSettings]);\n\n const handleLogout = useCallback(() => {\n setIsOpen(false);\n onLogout?.();\n }, [onLogout]);\n\n const displayName = name || 'User';\n const initial = (name?.[0] || email?.[0] || '?').toUpperCase();\n\n return (\n <div className={`cedros-profile-dropdown ${className}`} ref={dropdownRef}>\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__trigger\"\n onClick={() => setIsOpen(!isOpen)}\n aria-expanded={isOpen}\n aria-haspopup=\"menu\"\n >\n <div className=\"cedros-profile-dropdown__avatar\">\n {picture ? (\n <img\n src={picture}\n alt={displayName}\n className=\"cedros-profile-dropdown__avatar-img\"\n referrerPolicy=\"no-referrer\"\n />\n ) : (\n <span className=\"cedros-profile-dropdown__avatar-placeholder\">{initial}</span>\n )}\n </div>\n <div className=\"cedros-profile-dropdown__info\">\n <span className=\"cedros-profile-dropdown__name\">{displayName}</span>\n {email && <span className=\"cedros-profile-dropdown__email\">{email}</span>}\n </div>\n <svg\n className={`cedros-profile-dropdown__chevron ${isOpen ? 'cedros-profile-dropdown__chevron--open' : ''}`}\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n </button>\n\n {isOpen && (\n <div className=\"cedros-profile-dropdown__menu\" role=\"menu\">\n {onSettings && (\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__item\"\n onClick={handleSettings}\n role=\"menuitem\"\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n Settings\n </button>\n )}\n {onLogout && (\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__item cedros-profile-dropdown__item--danger\"\n onClick={handleLogout}\n role=\"menuitem\"\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4\" />\n <polyline points=\"16 17 21 12 16 7\" />\n <line x1=\"21\" x2=\"9\" y1=\"12\" y2=\"12\" />\n </svg>\n Log out\n </button>\n )}\n </div>\n )}\n </div>\n );\n}\n","/**\n * AdminShell - Unified Admin Dashboard Host\n *\n * A shell component that hosts admin plugins from cedros-login, cedros-pay,\n * or any compatible plugin. Provides unified sidebar navigation and content area.\n *\n * @example\n * ```tsx\n * import { AdminShell } from '@cedros/login-react';\n * import { cedrosLoginPlugin } from '@cedros/login-react';\n * import { cedrosPayPlugin } from '@cedros/pay-react';\n *\n * function AdminPage() {\n * const hostContext = useBuildHostContext();\n * return (\n * <AdminShell\n * plugins={[cedrosLoginPlugin, cedrosPayPlugin]}\n * hostContext={hostContext}\n * />\n * );\n * }\n * ```\n */\n\nimport React, {\n createContext,\n useContext,\n useState,\n useCallback,\n useMemo,\n useEffect,\n Suspense,\n type ReactNode,\n} from 'react';\nimport type {\n AdminPlugin,\n PluginRegistry,\n HostContext,\n QualifiedSectionId,\n PluginContext,\n ResolvedSection,\n} from './types';\nimport { LoadingSpinner } from '../components/shared/LoadingSpinner';\nimport { ProfileDropdown } from '../components/admin/ProfileDropdown';\nimport { CedrosLoginContext, type CedrosLoginContextValue } from '../context/CedrosLoginContext';\nimport type { AuthUser } from '../types';\n\n// ============================================================================\n// Plugin Registry Implementation\n// ============================================================================\n\nclass PluginRegistryImpl implements PluginRegistry {\n private plugins = new Map<string, AdminPlugin>();\n private listeners = new Set<(plugins: AdminPlugin[]) => void>();\n\n register(plugin: AdminPlugin): void {\n if (this.plugins.has(plugin.id)) {\n console.warn(`Plugin ${plugin.id} already registered, replacing...`);\n }\n this.plugins.set(plugin.id, plugin);\n plugin.onRegister?.(this);\n this.notify();\n }\n\n unregister(pluginId: string): void {\n const plugin = this.plugins.get(pluginId);\n if (plugin) {\n plugin.onUnregister?.();\n this.plugins.delete(pluginId);\n this.notify();\n }\n }\n\n get(pluginId: string): AdminPlugin | undefined {\n return this.plugins.get(pluginId);\n }\n\n getAll(): AdminPlugin[] {\n return Array.from(this.plugins.values());\n }\n\n subscribe(listener: (plugins: AdminPlugin[]) => void): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n private notify(): void {\n const plugins = this.getAll();\n this.listeners.forEach((listener) => listener(plugins));\n }\n}\n\n// ============================================================================\n// Context\n// ============================================================================\n\ninterface AdminShellContextValue {\n registry: PluginRegistry;\n hostContext: HostContext;\n activeSection: QualifiedSectionId | null;\n setActiveSection: (section: QualifiedSectionId) => void;\n getPluginContext: (pluginId: string) => PluginContext | null;\n}\n\nconst AdminShellContext = createContext<AdminShellContextValue | null>(null);\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useAdminShell(): AdminShellContextValue {\n const ctx = useContext(AdminShellContext);\n if (!ctx) throw new Error('useAdminShell must be used within AdminShell');\n return ctx;\n}\n\n// ============================================================================\n// Props\n// ============================================================================\n\nexport interface AdminShellProps {\n /** Dashboard title */\n title?: string;\n /** Plugins to load */\n plugins?: AdminPlugin[];\n /** Host context from parent providers */\n hostContext: HostContext;\n /** Default active section (qualified ID) */\n defaultSection?: QualifiedSectionId;\n /** Page size for lists */\n pageSize?: number;\n /** Refresh interval in ms (0 to disable) */\n refreshInterval?: number;\n /** Callback when section changes */\n onSectionChange?: (section: QualifiedSectionId) => void;\n /** Custom logo/header content */\n logo?: ReactNode;\n /** Additional sidebar footer content */\n sidebarFooter?: ReactNode;\n /** Callback when user clicks Settings in profile dropdown */\n onSettingsClick?: () => void;\n /** Callback when user clicks Logout in profile dropdown */\n onLogoutClick?: () => void;\n /** Additional CSS class */\n className?: string;\n}\n\n// ============================================================================\n// Group Order Helpers\n// ============================================================================\n\n/** Build a group-label → order map from all registered plugins' groups[] config. */\nfunction buildGroupOrder(plugins: AdminPlugin[]): Map<string, number> {\n const order = new Map<string, number>();\n for (const plugin of plugins) {\n for (const group of plugin.groups ?? []) {\n // Key by label (sections reference groups by display name via section.group).\n // First plugin to declare a group wins; later plugins don't override.\n if (!order.has(group.label)) {\n order.set(group.label, group.order);\n }\n }\n }\n return order;\n}\n\n// ============================================================================\n// AdminShell Component\n// ============================================================================\n\nexport function AdminShell({\n title = 'Admin',\n plugins: initialPlugins = [],\n hostContext,\n defaultSection,\n pageSize = 20,\n refreshInterval = 0,\n onSectionChange,\n logo,\n sidebarFooter,\n onSettingsClick,\n onLogoutClick,\n className = '',\n}: AdminShellProps): React.JSX.Element {\n // Plugin registry\n const [registry] = useState(() => {\n const reg = new PluginRegistryImpl();\n initialPlugins.forEach((p) => reg.register(p));\n return reg;\n });\n\n // Track registered plugins for re-renders\n const [registeredPlugins, setRegisteredPlugins] = useState<AdminPlugin[]>(() =>\n registry.getAll()\n );\n\n useEffect(() => {\n return registry.subscribe(setRegisteredPlugins);\n }, [registry]);\n\n // Aggregate sections from all plugins\n const allSections = useMemo(() => {\n return registeredPlugins.flatMap((plugin) =>\n plugin.sections\n .filter((section) => {\n // Check RBAC permissions (role-based)\n if (section.requiredPermission) {\n if (!plugin.checkPermission(section.requiredPermission, hostContext)) {\n return false;\n }\n }\n // Check dashboard section permissions (owner-configured per role)\n if (hostContext.dashboardPermissions) {\n if (!hostContext.dashboardPermissions.canAccess(section.id)) {\n return false;\n }\n }\n return true;\n })\n .map(\n (section): ResolvedSection => ({\n ...section,\n qualifiedId: `${plugin.id}:${section.id}` as QualifiedSectionId,\n pluginId: plugin.id,\n cssNamespace: plugin.cssNamespace,\n })\n )\n );\n }, [registeredPlugins, hostContext]);\n\n // Active section state\n const [activeSection, setActiveSectionInternal] = useState<QualifiedSectionId | null>(\n () => defaultSection ?? allSections[0]?.qualifiedId ?? null\n );\n\n // Collapsible groups state\n const [collapsedGroups, setCollapsedGroups] = useState<Set<string>>(new Set());\n\n const toggleGroup = useCallback((groupName: string) => {\n setCollapsedGroups((prev) => {\n const next = new Set(prev);\n if (next.has(groupName)) {\n next.delete(groupName);\n } else {\n next.add(groupName);\n }\n return next;\n });\n }, []);\n\n // Update active section when sections change and current is invalid\n useEffect(() => {\n if (activeSection && !allSections.find((s) => s.qualifiedId === activeSection)) {\n setActiveSectionInternal(allSections[0]?.qualifiedId ?? null);\n }\n }, [allSections, activeSection]);\n\n const setActiveSection = useCallback(\n (section: QualifiedSectionId) => {\n setActiveSectionInternal(section);\n onSectionChange?.(section);\n },\n [onSectionChange]\n );\n\n // Plugin context factory\n const getPluginContext = useCallback(\n (pluginId: string): PluginContext | null => {\n const plugin = registry.get(pluginId);\n if (!plugin) return null;\n return plugin.createPluginContext(hostContext);\n },\n [registry, hostContext]\n );\n\n // Group sections by group name, sorted by plugin-defined group order\n const groupedSections = useMemo(() => {\n const groupOrder = buildGroupOrder(registeredPlugins);\n const groups = new Map<string, ResolvedSection[]>();\n\n allSections.forEach((section) => {\n const groupName = section.group ?? 'Menu';\n const existing = groups.get(groupName) ?? [];\n groups.set(groupName, [...existing, section]);\n });\n\n // Sort groups by plugin-defined order (undeclared groups sink to bottom)\n const sortedGroups = Array.from(groups.entries()).sort(([a], [b]) => {\n const orderA = groupOrder.get(a) ?? 99;\n const orderB = groupOrder.get(b) ?? 99;\n return orderA - orderB;\n });\n\n return sortedGroups;\n }, [allSections, registeredPlugins]);\n\n // Get current section's component\n const currentSection = useMemo(() => {\n if (!activeSection) return null;\n const [pluginId, sectionId] = activeSection.split(':') as [string, string];\n const plugin = registry.get(pluginId);\n if (!plugin) return null;\n const Component = plugin.components[sectionId];\n if (!Component) return null;\n const pluginContext = plugin.createPluginContext(hostContext);\n return { Component, pluginContext, plugin };\n }, [activeSection, registry, hostContext]);\n\n // Context value\n const contextValue = useMemo<AdminShellContextValue>(\n () => ({\n registry,\n hostContext,\n activeSection,\n setActiveSection,\n getPluginContext,\n }),\n [registry, hostContext, activeSection, setActiveSection, getPluginContext]\n );\n\n // Bridge hostContext.cedrosLogin into CedrosLoginContext so hooks\n // (useOrgs, useAdminDeposits, etc.) work inside AdminShell sections.\n const cedrosLoginContextValue = useMemo<CedrosLoginContextValue | null>(() => {\n const cl = hostContext.cedrosLogin;\n if (!cl) return null;\n const user: AuthUser | null = cl.user\n ? { authMethods: [], emailVerified: false, createdAt: '', updatedAt: '', ...cl.user }\n : null;\n return {\n config: { serverUrl: cl.serverUrl },\n user,\n authState: cl.user ? 'authenticated' : 'unauthenticated',\n error: null,\n logout: async () => {},\n refreshUser: async () => {},\n isModalOpen: false,\n openModal: () => {},\n closeModal: () => {},\n _internal: {\n handleLoginSuccess: () => {},\n getAccessToken: cl.getAccessToken,\n },\n };\n }, [hostContext.cedrosLogin]);\n\n return (\n <AdminShellContext.Provider value={contextValue}>\n <CedrosLoginContext.Provider value={cedrosLoginContextValue}>\n <div className={`cedros-admin cedros-admin-shell ${className || ''}`}>\n {/* Sidebar */}\n <aside className=\"cedros-admin-shell__sidebar\">\n <div className=\"cedros-admin-shell__sidebar-header\">\n {logo ?? (\n <div className=\"cedros-admin-shell__logo\">\n <span className=\"cedros-admin-shell__logo-text\">{title}</span>\n </div>\n )}\n </div>\n\n <nav className=\"cedros-admin-shell__nav\">\n {groupedSections.map(([groupName, sections]) => {\n const isCollapsible = groupName === 'Configuration';\n const isCollapsed = collapsedGroups.has(groupName);\n\n return (\n <div key={groupName} className=\"cedros-admin-shell__nav-group\">\n {isCollapsible ? (\n <button\n type=\"button\"\n className=\"cedros-admin-shell__nav-label cedros-admin-shell__nav-label--collapsible\"\n onClick={() => toggleGroup(groupName)}\n aria-expanded={!isCollapsed}\n >\n <span>{groupName}</span>\n <span\n className={`cedros-admin-shell__nav-chevron ${!isCollapsed ? 'cedros-admin-shell__nav-chevron--expanded' : ''}`}\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </span>\n </button>\n ) : (\n <span className=\"cedros-admin-shell__nav-label\">{groupName}</span>\n )}\n {(!isCollapsible || !isCollapsed) &&\n sections\n .sort((a, b) => (a.order ?? 0) - (b.order ?? 0))\n .map((section) => (\n <button\n key={section.qualifiedId}\n type=\"button\"\n className={`cedros-admin-shell__nav-item ${\n activeSection === section.qualifiedId\n ? 'cedros-admin-shell__nav-item--active'\n : ''\n }`}\n onClick={() => setActiveSection(section.qualifiedId)}\n aria-current={\n activeSection === section.qualifiedId ? 'page' : undefined\n }\n >\n <span className=\"cedros-admin-shell__nav-icon\">{section.icon}</span>\n <span className=\"cedros-admin-shell__nav-text\">{section.label}</span>\n {section.badge && (\n <span className=\"cedros-admin-shell__nav-badge\">{section.badge}</span>\n )}\n </button>\n ))}\n </div>\n );\n })}\n </nav>\n\n {/* User profile dropdown + optional custom footer */}\n {(hostContext.cedrosLogin?.user || sidebarFooter) && (\n <div className=\"cedros-admin-shell__sidebar-footer\">\n {hostContext.cedrosLogin?.user && (\n <ProfileDropdown\n name={hostContext.cedrosLogin.user.name}\n email={hostContext.cedrosLogin.user.email}\n picture={hostContext.cedrosLogin.user.picture}\n onSettings={onSettingsClick}\n onLogout={onLogoutClick}\n />\n )}\n {sidebarFooter}\n </div>\n )}\n </aside>\n\n {/* Main Content */}\n <main className=\"cedros-admin-shell__main\">\n {currentSection ? (\n <Suspense fallback={<LoadingFallback />}>\n <div\n className=\"cedros-admin-shell__section\"\n data-plugin-namespace={currentSection.plugin.cssNamespace}\n >\n <currentSection.Component\n pluginContext={currentSection.pluginContext}\n pageSize={pageSize}\n refreshInterval={refreshInterval}\n />\n </div>\n </Suspense>\n ) : (\n <div className=\"cedros-admin-shell__empty\">\n {allSections.length === 0\n ? 'No plugins loaded'\n : 'Select a section from the sidebar'}\n </div>\n )}\n </main>\n </div>\n </CedrosLoginContext.Provider>\n </AdminShellContext.Provider>\n );\n}\n\n// ============================================================================\n// Helper Components\n// ============================================================================\n\nfunction LoadingFallback(): React.JSX.Element {\n return (\n <div className=\"cedros-admin-shell__loading\">\n <LoadingSpinner />\n <span>Loading...</span>\n </div>\n );\n}\n","/**\n * Admin Dashboard Icons\n *\n * SVG icons for the admin dashboard sidebar and sections.\n * Lucide-style, 24x24 viewBox rendered at 16x16.\n */\n\nimport type { ReactNode } from 'react';\n\nconst iconProps = {\n width: '16',\n height: '16',\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: '2',\n strokeLinecap: 'round' as const,\n strokeLinejoin: 'round' as const,\n};\n\nexport const Icons: Record<string, ReactNode> = {\n users: (\n <svg {...iconProps}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87\" />\n <path d=\"M16 3.13a4 4 0 0 1 0 7.75\" />\n </svg>\n ),\n\n members: (\n <svg {...iconProps}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87\" />\n <path d=\"M16 3.13a4 4 0 0 1 0 7.75\" />\n </svg>\n ),\n\n invites: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n <path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\" />\n </svg>\n ),\n\n deposits: (\n <svg {...iconProps}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8\" />\n <path d=\"M12 18V6\" />\n </svg>\n ),\n\n withdrawals: (\n <svg {...iconProps}>\n <rect width=\"16\" height=\"20\" x=\"4\" y=\"2\" rx=\"2\" ry=\"2\" />\n <path d=\"M9 22v-4h6v4\" />\n <path d=\"M8 6h.01\" />\n <path d=\"M16 6h.01\" />\n <path d=\"M12 6h.01\" />\n <path d=\"M12 10h.01\" />\n <path d=\"M12 14h.01\" />\n <path d=\"M16 10h.01\" />\n <path d=\"M16 14h.01\" />\n <path d=\"M8 10h.01\" />\n <path d=\"M8 14h.01\" />\n </svg>\n ),\n\n settings: (\n <svg {...iconProps}>\n <path d=\"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n ),\n\n wallet: (\n <svg {...iconProps}>\n <path d=\"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1\" />\n <path d=\"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4\" />\n </svg>\n ),\n\n chevronRight: (\n <svg {...iconProps}>\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n ),\n\n // Settings sub-page icons\n key: (\n <svg {...iconProps}>\n <path d=\"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4\" />\n </svg>\n ),\n\n toggles: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"12\" x=\"2\" y=\"6\" rx=\"6\" />\n <circle cx=\"8\" cy=\"12\" r=\"2\" />\n </svg>\n ),\n\n shield: (\n <svg {...iconProps}>\n <path d=\"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\" />\n </svg>\n ),\n\n mail: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n <path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\" />\n </svg>\n ),\n\n webhook: (\n <svg {...iconProps}>\n <path d=\"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2\" />\n <path d=\"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06\" />\n <path d=\"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8\" />\n </svg>\n ),\n\n coins: (\n <svg {...iconProps}>\n <circle cx=\"8\" cy=\"8\" r=\"6\" />\n <path d=\"M18.09 10.37A6 6 0 1 1 10.34 18\" />\n <path d=\"M7 6h1v4\" />\n <path d=\"m16.71 13.88.7.71-2.82 2.82\" />\n </svg>\n ),\n\n server: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"2\" rx=\"2\" ry=\"2\" />\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"14\" rx=\"2\" ry=\"2\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"6\" y2=\"6\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"18\" y2=\"18\" />\n </svg>\n ),\n};\n","/**\n * Cedros Login Admin Plugin\n *\n * Exports the cedrosLoginPlugin for use with AdminShell.\n * Provides user management, deposits, withdrawals, and configuration sections.\n */\n\nimport { lazy } from 'react';\nimport type { AdminPlugin, HostContext, PluginContext, AdminSectionConfig } from './types';\nimport { Icons } from './icons';\n\n// ============================================================================\n// Lazy-loaded Section Components\n// ============================================================================\n\nconst UsersSection = lazy(() => import('./sections/UsersSection'));\nconst TeamSection = lazy(() => import('./sections/TeamSection'));\nconst DepositsSection = lazy(() => import('./sections/DepositsSection'));\nconst WithdrawalsSection = lazy(() => import('./sections/WithdrawalsSection'));\nconst AuthenticationSettings = lazy(() => import('./sections/AuthenticationSettings'));\nconst EmbeddedWalletSettings = lazy(() => import('./sections/EmbeddedWalletSettings'));\nconst EmailSettings = lazy(() => import('./sections/EmailSettings'));\nconst WebhookSettings = lazy(() => import('./sections/WebhookSettings'));\nconst CreditSystemSettings = lazy(() => import('./sections/CreditSystemSettings'));\nconst ServerSettings = lazy(() => import('./sections/ServerSettings'));\n\n// ============================================================================\n// Permission Mapping\n// ============================================================================\n\ntype LoginPermission =\n | 'login:users:read'\n | 'login:users:write'\n | 'login:members:read'\n | 'login:members:write'\n | 'login:invites:read'\n | 'login:invites:write'\n | 'login:deposits:read'\n | 'login:deposits:write'\n | 'login:settings:read'\n | 'login:settings:write';\n\n/**\n * Maps plugin permissions to org-level permissions/roles.\n */\nconst PERMISSION_MAP: Record<LoginPermission, string[]> = {\n 'login:users:read': ['admin', 'owner'],\n 'login:users:write': ['admin', 'owner'],\n 'login:members:read': ['member:read', 'admin', 'owner'],\n 'login:members:write': ['member:remove', 'member:role_change'],\n 'login:invites:read': ['invite:read', 'admin', 'owner'],\n 'login:invites:write': ['invite:create', 'invite:cancel'],\n 'login:deposits:read': ['admin', 'owner'],\n 'login:deposits:write': ['admin', 'owner'],\n 'login:settings:read': ['admin', 'owner'],\n 'login:settings:write': ['admin', 'owner'],\n};\n\n// ============================================================================\n// Section Configuration\n// ============================================================================\n\nconst SECTIONS: AdminSectionConfig[] = [\n // Users group (main sections)\n {\n id: 'users',\n label: 'Users',\n icon: Icons.users,\n group: 'Users',\n order: 0,\n requiredPermission: 'login:users:read',\n },\n {\n id: 'team',\n label: 'Team',\n icon: Icons.members,\n group: 'Users',\n order: 1,\n requiredPermission: 'login:members:read',\n },\n {\n id: 'deposits',\n label: 'Deposits',\n icon: Icons.deposits,\n group: 'Users',\n order: 2,\n requiredPermission: 'login:deposits:read',\n },\n {\n id: 'withdrawals',\n label: 'Withdrawals',\n icon: Icons.withdrawals,\n group: 'Users',\n order: 3,\n requiredPermission: 'login:deposits:read',\n },\n\n // Configuration group (settings sections)\n {\n id: 'settings-auth',\n label: 'Authentication',\n icon: Icons.key,\n group: 'Configuration',\n order: 0,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-email',\n label: 'Email & SMTP',\n icon: Icons.mail,\n group: 'Configuration',\n order: 1,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-webhooks',\n label: 'Webhooks',\n icon: Icons.webhook,\n group: 'Configuration',\n order: 2,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-wallet',\n label: 'User Wallets',\n icon: Icons.wallet,\n group: 'Configuration',\n order: 3,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-credits',\n label: 'Credit System',\n icon: Icons.coins,\n group: 'Configuration',\n order: 4,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-server',\n label: 'Auth Server',\n icon: Icons.server,\n group: 'Configuration',\n order: 5,\n requiredPermission: 'login:settings:read',\n },\n];\n\n// ============================================================================\n// Plugin Definition\n// ============================================================================\n\nexport const cedrosLoginPlugin: AdminPlugin = {\n id: 'cedros-login',\n name: 'Cedros Login',\n version: '1.0.0',\n\n sections: SECTIONS,\n\n groups: [\n { id: 'users', label: 'Users', order: 0 },\n { id: 'configuration', label: 'Configuration', order: 2 },\n ],\n\n components: {\n users: UsersSection,\n team: TeamSection,\n deposits: DepositsSection,\n withdrawals: WithdrawalsSection,\n 'settings-auth': AuthenticationSettings,\n 'settings-wallet': EmbeddedWalletSettings,\n 'settings-email': EmailSettings,\n 'settings-webhooks': WebhookSettings,\n 'settings-credits': CreditSystemSettings,\n 'settings-server': ServerSettings,\n },\n\n createPluginContext(hostContext: HostContext): PluginContext {\n const cedrosLogin = hostContext.cedrosLogin;\n if (!cedrosLogin) {\n throw new Error('cedros-login plugin requires cedrosLogin in hostContext');\n }\n\n return {\n serverUrl: cedrosLogin.serverUrl,\n userId: cedrosLogin.user?.id,\n getAccessToken: cedrosLogin.getAccessToken,\n hasPermission: (permission) => this.checkPermission(permission, hostContext),\n orgId: hostContext.org?.orgId,\n pluginData: {\n user: cedrosLogin.user,\n orgRole: hostContext.org?.role,\n },\n };\n },\n\n checkPermission(permission: string, hostContext: HostContext): boolean {\n const org = hostContext.org;\n\n // No org context = admin-level access (for global admins)\n if (!org) {\n // Check if user is in cedrosLogin context - assume admin if present\n return Boolean(hostContext.cedrosLogin?.user);\n }\n\n const requiredPerms = PERMISSION_MAP[permission as LoginPermission];\n if (!requiredPerms) {\n // Unknown permission - default deny\n return false;\n }\n\n // Check if user has any of the required permissions\n return requiredPerms.some(\n (p) =>\n org.permissions.includes(p) ||\n p === org.role ||\n (p === 'admin' && ['admin', 'owner'].includes(org.role)) ||\n (p === 'owner' && org.role === 'owner')\n );\n },\n\n cssNamespace: 'cedros-dashboard',\n};\n\n// Named export for convenience\nexport { cedrosLoginPlugin as loginPlugin };\n\n/**\n * All section IDs registered by the cedros-login plugin.\n *\n * Use these to reference specific sections when configuring\n * `dashboardPermissions.canAccess()` or navigating programmatically.\n *\n * Qualified IDs (for multi-plugin use) are prefixed: `cedros-login:{id}`.\n */\nexport const CEDROS_LOGIN_SECTION_IDS = {\n users: 'users',\n team: 'team',\n deposits: 'deposits',\n withdrawals: 'withdrawals',\n settingsAuth: 'settings-auth',\n settingsEmail: 'settings-email',\n settingsWebhooks: 'settings-webhooks',\n settingsWallet: 'settings-wallet',\n settingsCredits: 'settings-credits',\n settingsServer: 'settings-server',\n} as const;\n"],"names":["ProfileDropdown","name","email","picture","onSettings","onLogout","className","isOpen","setIsOpen","useState","dropdownRef","useRef","useEffect","handleClickOutside","event","handleEscape","handleSettings","useCallback","handleLogout","displayName","initial","jsxs","jsx","PluginRegistryImpl","plugin","pluginId","listener","plugins","AdminShellContext","createContext","useAdminShell","ctx","useContext","buildGroupOrder","order","group","AdminShell","title","initialPlugins","hostContext","defaultSection","pageSize","refreshInterval","onSectionChange","logo","sidebarFooter","onSettingsClick","onLogoutClick","registry","reg","p","registeredPlugins","setRegisteredPlugins","allSections","useMemo","section","activeSection","setActiveSectionInternal","collapsedGroups","setCollapsedGroups","toggleGroup","groupName","prev","next","setActiveSection","getPluginContext","groupedSections","groupOrder","groups","existing","a","b","orderA","orderB","currentSection","sectionId","Component","pluginContext","contextValue","cedrosLoginContextValue","cl","user","CedrosLoginContext","sections","isCollapsible","isCollapsed","Suspense","LoadingFallback","LoadingSpinner","iconProps","Icons","UsersSection","lazy","TeamSection","DepositsSection","WithdrawalsSection","AuthenticationSettings","EmbeddedWalletSettings","EmailSettings","WebhookSettings","CreditSystemSettings","ServerSettings","PERMISSION_MAP","SECTIONS","cedrosLoginPlugin","cedrosLogin","permission","org","requiredPerms","CEDROS_LOGIN_SECTION_IDS"],"mappings":"gHAqCO,SAASA,EAAgB,CAC9B,KAAAC,EACA,MAAAC,EACA,QAAAC,EACA,WAAAC,EACA,SAAAC,EACA,UAAAC,EAAY,EACd,EAAyB,CACvB,KAAM,CAACC,EAAQC,CAAS,EAAIC,EAAAA,SAAS,EAAK,EACpCC,EAAcC,EAAAA,OAAuB,IAAI,EAG/CC,EAAAA,UAAU,IAAM,CACd,SAASC,EAAmBC,EAAmB,CACzCJ,EAAY,SAAW,CAACA,EAAY,QAAQ,SAASI,EAAM,MAAc,GAC3EN,EAAU,EAAK,CAEnB,CAEA,GAAID,EACF,gBAAS,iBAAiB,YAAaM,CAAkB,EAClD,IAAM,SAAS,oBAAoB,YAAaA,CAAkB,CAE7E,EAAG,CAACN,CAAM,CAAC,EAGXK,EA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MAAM,yDAAyD,EAG3E,MAAO,CACL,UAAWA,EAAY,UACvB,OAAQA,EAAY,MAAM,GAC1B,eAAgBA,EAAY,eAC5B,cAAgBC,GAAe,KAAK,gBAAgBA,EAAYnE,CAAW,EAC3E,MAAOA,EAAY,KAAK,MACxB,WAAY,CACV,KAAMkE,EAAY,KAClB,QAASlE,EAAY,KAAK,IAAA,CAC5B,CAEJ,EAEA,gBAAgBmE,EAAoBnE,EAAmC,CACrE,MAAMoE,EAAMpE,EAAY,IAGxB,GAAI,CAACoE,EAEH,MAAO,EAAQpE,EAAY,aAAa,KAG1C,MAAMqE,EAAgBN,GAAeI,CAA6B,EAClE,OAAKE,EAMEA,EAAc,KAClB,GACCD,EAAI,YAAY,SAAS,CAAC,GAC1B,IAAMA,EAAI,MACT,IAAM,SAAW,CAAC,QAAS,OAAO,EAAE,SAASA,EAAI,IAAI,GACrD,IAAM,SAAWA,EAAI,OAAS,OAAA,EAT1B,EAWX,EAEA,aAAc,kBAChB,EAaaE,GAA2B,CACtC,MAAO,QACP,KAAM,OACN,SAAU,WACV,YAAa,cACb,aAAc,gBACd,cAAe,iBACf,iBAAkB,oBAClB,eAAgB,kBAChB,gBAAiB,mBACjB,eAAgB,iBAClB"}
1
+ {"version":3,"file":"plugin-BtQdI_Ay.cjs","sources":["../src/components/admin/ProfileDropdown.tsx","../src/admin/AdminShell.tsx","../src/admin/icons.tsx","../src/admin/plugin.tsx"],"sourcesContent":["/**\n * Profile Dropdown Component\n *\n * Displays user avatar/name with a dropdown menu for settings and logout.\n */\n\nimport { useState, useRef, useEffect, useCallback } from 'react';\n\nexport interface ProfileDropdownProps {\n /** User's display name */\n name?: string;\n /** User's email */\n email?: string;\n /** User's profile picture URL */\n picture?: string;\n /** Callback when Settings is clicked */\n onSettings?: () => void;\n /** Callback when Logout is clicked */\n onLogout?: () => void;\n /** Additional CSS class */\n className?: string;\n}\n\n/**\n * Profile dropdown button with settings and logout options.\n *\n * @example\n * ```tsx\n * <ProfileDropdown\n * name={user.name}\n * email={user.email}\n * picture={user.picture}\n * onSettings={() => navigate('/settings')}\n * onLogout={logout}\n * />\n * ```\n */\nexport function ProfileDropdown({\n name,\n email,\n picture,\n onSettings,\n onLogout,\n className = '',\n}: ProfileDropdownProps) {\n const [isOpen, setIsOpen] = useState(false);\n const dropdownRef = useRef<HTMLDivElement>(null);\n\n // Close dropdown when clicking outside\n useEffect(() => {\n function handleClickOutside(event: MouseEvent) {\n if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {\n setIsOpen(false);\n }\n }\n\n if (isOpen) {\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }\n }, [isOpen]);\n\n // Close dropdown on escape key\n useEffect(() => {\n function handleEscape(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n setIsOpen(false);\n }\n }\n\n if (isOpen) {\n document.addEventListener('keydown', handleEscape);\n return () => document.removeEventListener('keydown', handleEscape);\n }\n }, [isOpen]);\n\n const handleSettings = useCallback(() => {\n setIsOpen(false);\n onSettings?.();\n }, [onSettings]);\n\n const handleLogout = useCallback(() => {\n setIsOpen(false);\n onLogout?.();\n }, [onLogout]);\n\n const displayName = name || 'User';\n const initial = (name?.[0] || email?.[0] || '?').toUpperCase();\n\n return (\n <div className={`cedros-profile-dropdown ${className}`} ref={dropdownRef}>\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__trigger\"\n onClick={() => setIsOpen(!isOpen)}\n aria-expanded={isOpen}\n aria-haspopup=\"menu\"\n >\n <div className=\"cedros-profile-dropdown__avatar\">\n {picture ? (\n <img\n src={picture}\n alt={displayName}\n className=\"cedros-profile-dropdown__avatar-img\"\n referrerPolicy=\"no-referrer\"\n />\n ) : (\n <span className=\"cedros-profile-dropdown__avatar-placeholder\">{initial}</span>\n )}\n </div>\n <div className=\"cedros-profile-dropdown__info\">\n <span className=\"cedros-profile-dropdown__name\">{displayName}</span>\n {email && <span className=\"cedros-profile-dropdown__email\">{email}</span>}\n </div>\n <svg\n className={`cedros-profile-dropdown__chevron ${isOpen ? 'cedros-profile-dropdown__chevron--open' : ''}`}\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n </button>\n\n {isOpen && (\n <div className=\"cedros-profile-dropdown__menu\" role=\"menu\">\n {onSettings && (\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__item\"\n onClick={handleSettings}\n role=\"menuitem\"\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n Settings\n </button>\n )}\n {onLogout && (\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__item cedros-profile-dropdown__item--danger\"\n onClick={handleLogout}\n role=\"menuitem\"\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4\" />\n <polyline points=\"16 17 21 12 16 7\" />\n <line x1=\"21\" x2=\"9\" y1=\"12\" y2=\"12\" />\n </svg>\n Log out\n </button>\n )}\n </div>\n )}\n </div>\n );\n}\n","/**\n * AdminShell - Unified Admin Dashboard Host\n *\n * A shell component that hosts admin plugins from cedros-login, cedros-pay,\n * or any compatible plugin. Provides unified sidebar navigation and content area.\n *\n * @example\n * ```tsx\n * import { AdminShell } from '@cedros/login-react';\n * import { cedrosLoginPlugin } from '@cedros/login-react';\n * import { cedrosPayPlugin } from '@cedros/pay-react';\n *\n * function AdminPage() {\n * const hostContext = useBuildHostContext();\n * return (\n * <AdminShell\n * plugins={[cedrosLoginPlugin, cedrosPayPlugin]}\n * hostContext={hostContext}\n * />\n * );\n * }\n * ```\n */\n\nimport React, {\n createContext,\n useContext,\n useState,\n useCallback,\n useMemo,\n useEffect,\n Suspense,\n type ReactNode,\n} from 'react';\nimport type {\n AdminPlugin,\n PluginRegistry,\n HostContext,\n QualifiedSectionId,\n PluginContext,\n ResolvedSection,\n} from './types';\nimport { LoadingSpinner } from '../components/shared/LoadingSpinner';\nimport { ProfileDropdown } from '../components/admin/ProfileDropdown';\nimport { CedrosLoginContext, type CedrosLoginContextValue } from '../context/CedrosLoginContext';\nimport type { AuthUser } from '../types';\n\n// ============================================================================\n// Plugin Registry Implementation\n// ============================================================================\n\nclass PluginRegistryImpl implements PluginRegistry {\n private plugins = new Map<string, AdminPlugin>();\n private listeners = new Set<(plugins: AdminPlugin[]) => void>();\n\n register(plugin: AdminPlugin): void {\n if (this.plugins.has(plugin.id)) {\n console.warn(`Plugin ${plugin.id} already registered, replacing...`);\n }\n this.plugins.set(plugin.id, plugin);\n plugin.onRegister?.(this);\n this.notify();\n }\n\n unregister(pluginId: string): void {\n const plugin = this.plugins.get(pluginId);\n if (plugin) {\n plugin.onUnregister?.();\n this.plugins.delete(pluginId);\n this.notify();\n }\n }\n\n get(pluginId: string): AdminPlugin | undefined {\n return this.plugins.get(pluginId);\n }\n\n getAll(): AdminPlugin[] {\n return Array.from(this.plugins.values());\n }\n\n subscribe(listener: (plugins: AdminPlugin[]) => void): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n private notify(): void {\n const plugins = this.getAll();\n this.listeners.forEach((listener) => listener(plugins));\n }\n}\n\n// ============================================================================\n// Context\n// ============================================================================\n\ninterface AdminShellContextValue {\n registry: PluginRegistry;\n hostContext: HostContext;\n activeSection: QualifiedSectionId | null;\n setActiveSection: (section: QualifiedSectionId) => void;\n getPluginContext: (pluginId: string) => PluginContext | null;\n}\n\nconst AdminShellContext = createContext<AdminShellContextValue | null>(null);\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useAdminShell(): AdminShellContextValue {\n const ctx = useContext(AdminShellContext);\n if (!ctx) throw new Error('useAdminShell must be used within AdminShell');\n return ctx;\n}\n\n// ============================================================================\n// Props\n// ============================================================================\n\nexport interface AdminShellProps {\n /** Dashboard title */\n title?: string;\n /** Plugins to load */\n plugins?: AdminPlugin[];\n /** Host context from parent providers */\n hostContext: HostContext;\n /** Default active section (qualified ID) */\n defaultSection?: QualifiedSectionId;\n /** Page size for lists */\n pageSize?: number;\n /** Refresh interval in ms (0 to disable) */\n refreshInterval?: number;\n /** Callback when section changes */\n onSectionChange?: (section: QualifiedSectionId) => void;\n /** Custom logo/header content */\n logo?: ReactNode;\n /** Additional sidebar footer content */\n sidebarFooter?: ReactNode;\n /** Callback when user clicks Settings in profile dropdown */\n onSettingsClick?: () => void;\n /** Callback when user clicks Logout in profile dropdown */\n onLogoutClick?: () => void;\n /** Additional CSS class */\n className?: string;\n}\n\n// ============================================================================\n// Group Order Helpers\n// ============================================================================\n\n/** Build a group-label → order map from all registered plugins' groups[] config. */\nfunction buildGroupOrder(plugins: AdminPlugin[]): Map<string, number> {\n const order = new Map<string, number>();\n for (const plugin of plugins) {\n for (const group of plugin.groups ?? []) {\n // Key by label (sections reference groups by display name via section.group).\n // First plugin to declare a group wins; later plugins don't override.\n if (!order.has(group.label)) {\n order.set(group.label, group.order);\n }\n }\n }\n return order;\n}\n\n// ============================================================================\n// AdminShell Component\n// ============================================================================\n\nexport function AdminShell({\n title = 'Admin',\n plugins: initialPlugins = [],\n hostContext,\n defaultSection,\n pageSize = 20,\n refreshInterval = 0,\n onSectionChange,\n logo,\n sidebarFooter,\n onSettingsClick,\n onLogoutClick,\n className = '',\n}: AdminShellProps): React.JSX.Element {\n // Plugin registry\n const [registry] = useState(() => {\n const reg = new PluginRegistryImpl();\n initialPlugins.forEach((p) => reg.register(p));\n return reg;\n });\n\n // Track registered plugins for re-renders\n const [registeredPlugins, setRegisteredPlugins] = useState<AdminPlugin[]>(() =>\n registry.getAll()\n );\n\n useEffect(() => {\n return registry.subscribe(setRegisteredPlugins);\n }, [registry]);\n\n // Aggregate sections from all plugins\n const allSections = useMemo(() => {\n return registeredPlugins.flatMap((plugin) =>\n plugin.sections\n .filter((section) => {\n // Check RBAC permissions (role-based)\n if (section.requiredPermission) {\n if (!plugin.checkPermission(section.requiredPermission, hostContext)) {\n return false;\n }\n }\n // Check dashboard section permissions (owner-configured per role)\n if (hostContext.dashboardPermissions) {\n if (!hostContext.dashboardPermissions.canAccess(section.id)) {\n return false;\n }\n }\n return true;\n })\n .map(\n (section): ResolvedSection => ({\n ...section,\n qualifiedId: `${plugin.id}:${section.id}` as QualifiedSectionId,\n pluginId: plugin.id,\n cssNamespace: plugin.cssNamespace,\n })\n )\n );\n }, [registeredPlugins, hostContext]);\n\n // Active section state\n const [activeSection, setActiveSectionInternal] = useState<QualifiedSectionId | null>(\n () => defaultSection ?? allSections[0]?.qualifiedId ?? null\n );\n\n // Collapsible groups state\n const [collapsedGroups, setCollapsedGroups] = useState<Set<string>>(new Set());\n\n const toggleGroup = useCallback((groupName: string) => {\n setCollapsedGroups((prev) => {\n const next = new Set(prev);\n if (next.has(groupName)) {\n next.delete(groupName);\n } else {\n next.add(groupName);\n }\n return next;\n });\n }, []);\n\n // Update active section when sections change and current is invalid\n useEffect(() => {\n if (activeSection && !allSections.find((s) => s.qualifiedId === activeSection)) {\n setActiveSectionInternal(allSections[0]?.qualifiedId ?? null);\n }\n }, [allSections, activeSection]);\n\n const setActiveSection = useCallback(\n (section: QualifiedSectionId) => {\n setActiveSectionInternal(section);\n onSectionChange?.(section);\n },\n [onSectionChange]\n );\n\n // Plugin context factory\n const getPluginContext = useCallback(\n (pluginId: string): PluginContext | null => {\n const plugin = registry.get(pluginId);\n if (!plugin) return null;\n return plugin.createPluginContext(hostContext);\n },\n [registry, hostContext]\n );\n\n // Group sections by group name, sorted by plugin-defined group order\n const groupedSections = useMemo(() => {\n const groupOrder = buildGroupOrder(registeredPlugins);\n const groups = new Map<string, ResolvedSection[]>();\n\n allSections.forEach((section) => {\n const groupName = section.group ?? 'Menu';\n const existing = groups.get(groupName) ?? [];\n groups.set(groupName, [...existing, section]);\n });\n\n // Sort groups by plugin-defined order (undeclared groups sink to bottom)\n const sortedGroups = Array.from(groups.entries()).sort(([a], [b]) => {\n const orderA = groupOrder.get(a) ?? 99;\n const orderB = groupOrder.get(b) ?? 99;\n return orderA - orderB;\n });\n\n return sortedGroups;\n }, [allSections, registeredPlugins]);\n\n // Get current section's component\n const currentSection = useMemo(() => {\n if (!activeSection) return null;\n const [pluginId, sectionId] = activeSection.split(':') as [string, string];\n const plugin = registry.get(pluginId);\n if (!plugin) return null;\n const Component = plugin.components[sectionId];\n if (!Component) return null;\n const pluginContext = plugin.createPluginContext(hostContext);\n return { Component, pluginContext, plugin };\n }, [activeSection, registry, hostContext]);\n\n // Context value\n const contextValue = useMemo<AdminShellContextValue>(\n () => ({\n registry,\n hostContext,\n activeSection,\n setActiveSection,\n getPluginContext,\n }),\n [registry, hostContext, activeSection, setActiveSection, getPluginContext]\n );\n\n // Bridge hostContext.cedrosLogin into CedrosLoginContext so hooks\n // (useOrgs, useAdminDeposits, etc.) work inside AdminShell sections.\n const cedrosLoginContextValue = useMemo<CedrosLoginContextValue | null>(() => {\n const cl = hostContext.cedrosLogin;\n if (!cl) return null;\n const user: AuthUser | null = cl.user\n ? { authMethods: [], emailVerified: false, createdAt: '', updatedAt: '', ...cl.user }\n : null;\n return {\n config: { serverUrl: cl.serverUrl },\n user,\n authState: cl.user ? 'authenticated' : 'unauthenticated',\n error: null,\n logout: async () => {},\n refreshUser: async () => {},\n isModalOpen: false,\n openModal: () => {},\n closeModal: () => {},\n _internal: {\n handleLoginSuccess: () => {},\n getAccessToken: cl.getAccessToken,\n },\n };\n }, [hostContext.cedrosLogin]);\n\n return (\n <AdminShellContext.Provider value={contextValue}>\n <CedrosLoginContext.Provider value={cedrosLoginContextValue}>\n <div className={`cedros-admin cedros-admin-shell ${className || ''}`}>\n {/* Sidebar */}\n <aside className=\"cedros-admin-shell__sidebar\">\n <div className=\"cedros-admin-shell__sidebar-header\">\n {logo ?? (\n <div className=\"cedros-admin-shell__logo\">\n <span className=\"cedros-admin-shell__logo-text\">{title}</span>\n </div>\n )}\n </div>\n\n <nav className=\"cedros-admin-shell__nav\">\n {groupedSections.map(([groupName, sections]) => {\n const isCollapsible = groupName === 'Configuration';\n const isCollapsed = collapsedGroups.has(groupName);\n\n return (\n <div key={groupName} className=\"cedros-admin-shell__nav-group\">\n {isCollapsible ? (\n <button\n type=\"button\"\n className=\"cedros-admin-shell__nav-label cedros-admin-shell__nav-label--collapsible\"\n onClick={() => toggleGroup(groupName)}\n aria-expanded={!isCollapsed}\n >\n <span>{groupName}</span>\n <span\n className={`cedros-admin-shell__nav-chevron ${!isCollapsed ? 'cedros-admin-shell__nav-chevron--expanded' : ''}`}\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </span>\n </button>\n ) : (\n <span className=\"cedros-admin-shell__nav-label\">{groupName}</span>\n )}\n {(!isCollapsible || !isCollapsed) &&\n sections\n .sort((a, b) => (a.order ?? 0) - (b.order ?? 0))\n .map((section) => (\n <button\n key={section.qualifiedId}\n type=\"button\"\n className={`cedros-admin-shell__nav-item ${\n activeSection === section.qualifiedId\n ? 'cedros-admin-shell__nav-item--active'\n : ''\n }`}\n onClick={() => setActiveSection(section.qualifiedId)}\n aria-current={\n activeSection === section.qualifiedId ? 'page' : undefined\n }\n >\n <span className=\"cedros-admin-shell__nav-icon\">{section.icon}</span>\n <span className=\"cedros-admin-shell__nav-text\">{section.label}</span>\n {section.badge && (\n <span className=\"cedros-admin-shell__nav-badge\">{section.badge}</span>\n )}\n </button>\n ))}\n </div>\n );\n })}\n </nav>\n\n {/* User profile dropdown + optional custom footer */}\n {(hostContext.cedrosLogin?.user || sidebarFooter) && (\n <div className=\"cedros-admin-shell__sidebar-footer\">\n {hostContext.cedrosLogin?.user && (\n <ProfileDropdown\n name={hostContext.cedrosLogin.user.name}\n email={hostContext.cedrosLogin.user.email}\n picture={hostContext.cedrosLogin.user.picture}\n onSettings={onSettingsClick}\n onLogout={onLogoutClick}\n />\n )}\n {sidebarFooter}\n </div>\n )}\n </aside>\n\n {/* Main Content */}\n <main className=\"cedros-admin-shell__main\">\n {currentSection ? (\n <Suspense fallback={<LoadingFallback />}>\n <div\n className=\"cedros-admin-shell__section\"\n data-plugin-namespace={currentSection.plugin.cssNamespace}\n >\n <currentSection.Component\n pluginContext={currentSection.pluginContext}\n pageSize={pageSize}\n refreshInterval={refreshInterval}\n />\n </div>\n </Suspense>\n ) : (\n <div className=\"cedros-admin-shell__empty\">\n {allSections.length === 0\n ? 'No plugins loaded'\n : 'Select a section from the sidebar'}\n </div>\n )}\n </main>\n </div>\n </CedrosLoginContext.Provider>\n </AdminShellContext.Provider>\n );\n}\n\n// ============================================================================\n// Helper Components\n// ============================================================================\n\nfunction LoadingFallback(): React.JSX.Element {\n return (\n <div className=\"cedros-admin-shell__loading\">\n <LoadingSpinner />\n <span>Loading...</span>\n </div>\n );\n}\n","/**\n * Admin Dashboard Icons\n *\n * SVG icons for the admin dashboard sidebar and sections.\n * Lucide-style, 24x24 viewBox rendered at 16x16.\n */\n\nimport type { ReactNode } from 'react';\n\nconst iconProps = {\n width: '16',\n height: '16',\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: '2',\n strokeLinecap: 'round' as const,\n strokeLinejoin: 'round' as const,\n};\n\nexport const Icons: Record<string, ReactNode> = {\n users: (\n <svg {...iconProps}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87\" />\n <path d=\"M16 3.13a4 4 0 0 1 0 7.75\" />\n </svg>\n ),\n\n members: (\n <svg {...iconProps}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87\" />\n <path d=\"M16 3.13a4 4 0 0 1 0 7.75\" />\n </svg>\n ),\n\n invites: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n <path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\" />\n </svg>\n ),\n\n deposits: (\n <svg {...iconProps}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8\" />\n <path d=\"M12 18V6\" />\n </svg>\n ),\n\n withdrawals: (\n <svg {...iconProps}>\n <rect width=\"16\" height=\"20\" x=\"4\" y=\"2\" rx=\"2\" ry=\"2\" />\n <path d=\"M9 22v-4h6v4\" />\n <path d=\"M8 6h.01\" />\n <path d=\"M16 6h.01\" />\n <path d=\"M12 6h.01\" />\n <path d=\"M12 10h.01\" />\n <path d=\"M12 14h.01\" />\n <path d=\"M16 10h.01\" />\n <path d=\"M16 14h.01\" />\n <path d=\"M8 10h.01\" />\n <path d=\"M8 14h.01\" />\n </svg>\n ),\n\n settings: (\n <svg {...iconProps}>\n <path d=\"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n ),\n\n wallet: (\n <svg {...iconProps}>\n <path d=\"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1\" />\n <path d=\"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4\" />\n </svg>\n ),\n\n chevronRight: (\n <svg {...iconProps}>\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n ),\n\n // Settings sub-page icons\n key: (\n <svg {...iconProps}>\n <path d=\"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4\" />\n </svg>\n ),\n\n toggles: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"12\" x=\"2\" y=\"6\" rx=\"6\" />\n <circle cx=\"8\" cy=\"12\" r=\"2\" />\n </svg>\n ),\n\n shield: (\n <svg {...iconProps}>\n <path d=\"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\" />\n </svg>\n ),\n\n mail: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n <path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\" />\n </svg>\n ),\n\n webhook: (\n <svg {...iconProps}>\n <path d=\"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2\" />\n <path d=\"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06\" />\n <path d=\"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8\" />\n </svg>\n ),\n\n coins: (\n <svg {...iconProps}>\n <circle cx=\"8\" cy=\"8\" r=\"6\" />\n <path d=\"M18.09 10.37A6 6 0 1 1 10.34 18\" />\n <path d=\"M7 6h1v4\" />\n <path d=\"m16.71 13.88.7.71-2.82 2.82\" />\n </svg>\n ),\n\n server: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"2\" rx=\"2\" ry=\"2\" />\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"14\" rx=\"2\" ry=\"2\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"6\" y2=\"6\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"18\" y2=\"18\" />\n </svg>\n ),\n};\n","/**\n * Cedros Login Admin Plugin\n *\n * Exports the cedrosLoginPlugin for use with AdminShell.\n * Provides user management, deposits, withdrawals, and configuration sections.\n */\n\nimport { lazy } from 'react';\nimport type { AdminPlugin, HostContext, PluginContext, AdminSectionConfig } from './types';\nimport { Icons } from './icons';\n\n// ============================================================================\n// Lazy-loaded Section Components\n// ============================================================================\n\nconst UsersSection = lazy(() => import('./sections/UsersSection'));\nconst TeamSection = lazy(() => import('./sections/TeamSection'));\nconst DepositsSection = lazy(() => import('./sections/DepositsSection'));\nconst WithdrawalsSection = lazy(() => import('./sections/WithdrawalsSection'));\nconst AuthenticationSettings = lazy(() => import('./sections/AuthenticationSettings'));\nconst EmbeddedWalletSettings = lazy(() => import('./sections/EmbeddedWalletSettings'));\nconst EmailSettings = lazy(() => import('./sections/EmailSettings'));\nconst WebhookSettings = lazy(() => import('./sections/WebhookSettings'));\nconst CreditSystemSettings = lazy(() => import('./sections/CreditSystemSettings'));\nconst ServerSettings = lazy(() => import('./sections/ServerSettings'));\n\n// ============================================================================\n// Permission Mapping\n// ============================================================================\n\ntype LoginPermission =\n | 'login:users:read'\n | 'login:users:write'\n | 'login:members:read'\n | 'login:members:write'\n | 'login:invites:read'\n | 'login:invites:write'\n | 'login:deposits:read'\n | 'login:deposits:write'\n | 'login:settings:read'\n | 'login:settings:write';\n\n/**\n * Maps plugin permissions to org-level permissions/roles.\n */\nconst PERMISSION_MAP: Record<LoginPermission, string[]> = {\n 'login:users:read': ['admin', 'owner'],\n 'login:users:write': ['admin', 'owner'],\n 'login:members:read': ['member:read', 'admin', 'owner'],\n 'login:members:write': ['member:remove', 'member:role_change'],\n 'login:invites:read': ['invite:read', 'admin', 'owner'],\n 'login:invites:write': ['invite:create', 'invite:cancel'],\n 'login:deposits:read': ['admin', 'owner'],\n 'login:deposits:write': ['admin', 'owner'],\n 'login:settings:read': ['admin', 'owner'],\n 'login:settings:write': ['admin', 'owner'],\n};\n\n// ============================================================================\n// Section Configuration\n// ============================================================================\n\nconst SECTIONS: AdminSectionConfig[] = [\n // Users group (main sections)\n {\n id: 'users',\n label: 'Users',\n icon: Icons.users,\n group: 'Users',\n order: 0,\n requiredPermission: 'login:users:read',\n },\n {\n id: 'team',\n label: 'Team',\n icon: Icons.members,\n group: 'Users',\n order: 1,\n requiredPermission: 'login:members:read',\n },\n {\n id: 'deposits',\n label: 'Deposits',\n icon: Icons.deposits,\n group: 'Users',\n order: 2,\n requiredPermission: 'login:deposits:read',\n },\n {\n id: 'withdrawals',\n label: 'Withdrawals',\n icon: Icons.withdrawals,\n group: 'Users',\n order: 3,\n requiredPermission: 'login:deposits:read',\n },\n\n // Configuration group (settings sections)\n {\n id: 'settings-auth',\n label: 'Authentication',\n icon: Icons.key,\n group: 'Configuration',\n order: 0,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-email',\n label: 'Email & SMTP',\n icon: Icons.mail,\n group: 'Configuration',\n order: 1,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-webhooks',\n label: 'Webhooks',\n icon: Icons.webhook,\n group: 'Configuration',\n order: 2,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-wallet',\n label: 'User Wallets',\n icon: Icons.wallet,\n group: 'Configuration',\n order: 3,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-credits',\n label: 'Credit System',\n icon: Icons.coins,\n group: 'Configuration',\n order: 4,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-server',\n label: 'Auth Server',\n icon: Icons.server,\n group: 'Configuration',\n order: 5,\n requiredPermission: 'login:settings:read',\n },\n];\n\n// ============================================================================\n// Plugin Definition\n// ============================================================================\n\nexport const cedrosLoginPlugin: AdminPlugin = {\n id: 'cedros-login',\n name: 'Cedros Login',\n version: '1.0.0',\n\n sections: SECTIONS,\n\n groups: [\n { id: 'users', label: 'Users', order: 0 },\n { id: 'configuration', label: 'Configuration', order: 2 },\n ],\n\n components: {\n users: UsersSection,\n team: TeamSection,\n deposits: DepositsSection,\n withdrawals: WithdrawalsSection,\n 'settings-auth': AuthenticationSettings,\n 'settings-wallet': EmbeddedWalletSettings,\n 'settings-email': EmailSettings,\n 'settings-webhooks': WebhookSettings,\n 'settings-credits': CreditSystemSettings,\n 'settings-server': ServerSettings,\n },\n\n createPluginContext(hostContext: HostContext): PluginContext {\n const cedrosLogin = hostContext.cedrosLogin;\n if (!cedrosLogin) {\n throw new Error('cedros-login plugin requires cedrosLogin in hostContext');\n }\n\n return {\n serverUrl: cedrosLogin.serverUrl,\n userId: cedrosLogin.user?.id,\n getAccessToken: cedrosLogin.getAccessToken,\n hasPermission: (permission) => this.checkPermission(permission, hostContext),\n orgId: hostContext.org?.orgId,\n pluginData: {\n user: cedrosLogin.user,\n orgRole: hostContext.org?.role,\n },\n };\n },\n\n checkPermission(permission: string, hostContext: HostContext): boolean {\n const org = hostContext.org;\n\n // No org context = admin-level access (for global admins)\n if (!org) {\n // Check if user is in cedrosLogin context - assume admin if present\n return Boolean(hostContext.cedrosLogin?.user);\n }\n\n const requiredPerms = PERMISSION_MAP[permission as LoginPermission];\n if (!requiredPerms) {\n // Unknown permission - default deny\n return false;\n }\n\n // Check if user has any of the required permissions\n return requiredPerms.some(\n (p) =>\n org.permissions.includes(p) ||\n p === org.role ||\n (p === 'admin' && ['admin', 'owner'].includes(org.role)) ||\n (p === 'owner' && org.role === 'owner')\n );\n },\n\n cssNamespace: 'cedros-dashboard',\n};\n\n// Named export for convenience\nexport { cedrosLoginPlugin as loginPlugin };\n\n/**\n * All section IDs registered by the cedros-login plugin.\n *\n * Use these to reference specific sections when configuring\n * `dashboardPermissions.canAccess()` or navigating programmatically.\n *\n * Qualified IDs (for multi-plugin use) are prefixed: `cedros-login:{id}`.\n */\nexport const CEDROS_LOGIN_SECTION_IDS = {\n users: 'users',\n team: 'team',\n deposits: 'deposits',\n withdrawals: 'withdrawals',\n settingsAuth: 'settings-auth',\n settingsEmail: 'settings-email',\n settingsWebhooks: 'settings-webhooks',\n settingsWallet: 'settings-wallet',\n settingsCredits: 'settings-credits',\n settingsServer: 'settings-server',\n} as const;\n"],"names":["ProfileDropdown","name","email","picture","onSettings","onLogout","className","isOpen","setIsOpen","useState","dropdownRef","useRef","useEffect","handleClickOutside","event","handleEscape","handleSettings","useCallback","handleLogout","displayName","initial","jsxs","jsx","PluginRegistryImpl","plugin","pluginId","listener","plugins","AdminShellContext","createContext","useAdminShell","ctx","useContext","buildGroupOrder","order","group","AdminShell","title","initialPlugins","hostContext","defaultSection","pageSize","refreshInterval","onSectionChange","logo","sidebarFooter","onSettingsClick","onLogoutClick","registry","reg","p","registeredPlugins","setRegisteredPlugins","allSections","useMemo","section","activeSection","setActiveSectionInternal","collapsedGroups","setCollapsedGroups","toggleGroup","groupName","prev","next","setActiveSection","getPluginContext","groupedSections","groupOrder","groups","existing","a","b","orderA","orderB","currentSection","sectionId","Component","pluginContext","contextValue","cedrosLoginContextValue","cl","user","CedrosLoginContext","sections","isCollapsible","isCollapsed","Suspense","LoadingFallback","LoadingSpinner","iconProps","Icons","UsersSection","lazy","TeamSection","DepositsSection","WithdrawalsSection","AuthenticationSettings","EmbeddedWalletSettings","EmailSettings","WebhookSettings","CreditSystemSettings","ServerSettings","PERMISSION_MAP","SECTIONS","cedrosLoginPlugin","cedrosLogin","permission","org","requiredPerms","CEDROS_LOGIN_SECTION_IDS"],"mappings":"gHAqCO,SAASA,EAAgB,CAC9B,KAAAC,EACA,MAAAC,EACA,QAAAC,EACA,WAAAC,EACA,SAAAC,EACA,UAAAC,EAAY,EACd,EAAyB,CACvB,KAAM,CAACC,EAAQC,CAAS,EAAIC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S,MAAO,CAAA,EACtC,CAAE,GAAI,gBAAiB,MAAO,gBAAiB,MAAO,CAAA,CAAE,EAG1D,WAAY,CACV,MAAOZ,EACP,KAAME,EACN,SAAUC,EACV,YAAaC,EACb,gBAAiBC,EACjB,kBAAmBC,EACnB,iBAAkBC,EAClB,oBAAqBC,EACrB,mBAAoBC,GACpB,kBAAmBC,EAAA,EAGrB,oBAAoB9D,EAAyC,CAC3D,MAAMkE,EAAclE,EAAY,YAChC,GAAI,CAACkE,EACH,MAAM,IAAI,MAAM,yDAAyD,EAG3E,MAAO,CACL,UAAWA,EAAY,UACvB,OAAQA,EAAY,MAAM,GAC1B,eAAgBA,EAAY,eAC5B,cAAgBC,GAAe,KAAK,gBAAgBA,EAAYnE,CAAW,EAC3E,MAAOA,EAAY,KAAK,MACxB,WAAY,CACV,KAAMkE,EAAY,KAClB,QAASlE,EAAY,KAAK,IAAA,CAC5B,CAEJ,EAEA,gBAAgBmE,EAAoBnE,EAAmC,CACrE,MAAMoE,EAAMpE,EAAY,IAGxB,GAAI,CAACoE,EAEH,MAAO,EAAQpE,EAAY,aAAa,KAG1C,MAAMqE,EAAgBN,GAAeI,CAA6B,EAClE,OAAKE,EAMEA,EAAc,KAClB,GACCD,EAAI,YAAY,SAAS,CAAC,GAC1B,IAAMA,EAAI,MACT,IAAM,SAAW,CAAC,QAAS,OAAO,EAAE,SAASA,EAAI,IAAI,GACrD,IAAM,SAAWA,EAAI,OAAS,OAAA,EAT1B,EAWX,EAEA,aAAc,kBAChB,EAaaE,GAA2B,CACtC,MAAO,QACP,KAAM,OACN,SAAU,WACV,YAAa,cACb,aAAc,gBACd,cAAe,iBACf,iBAAkB,oBAClB,eAAgB,kBAChB,gBAAiB,mBACjB,eAAgB,iBAClB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedros/login-react",
3
- "version": "0.0.40",
3
+ "version": "0.0.41",
4
4
  "description": "React component library for authentication with email/password, Google OAuth, and Solana wallet sign-in",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -1 +0,0 @@
1
- "use strict";const e=require("react/jsx-runtime"),u=require("react"),C=require("./useSystemSettings-B2jY51ob.cjs");function N(t){const s=Math.floor(t/86400),a=Math.floor(t%86400/3600),n=Math.floor(t%3600/60),l=t%60;return{days:s,hours:a,minutes:n,seconds:l}}function A(t){const{days:s,hours:a,minutes:n}=N(t),l=[];return s>0&&l.push(`${s}d`),a>0&&l.push(`${a}h`),n>0&&l.push(`${n}m`),l.length===0&&l.push(`${t}s`),l.join(" ")}const S={auth_email_enabled:{key:"auth_email_enabled",label:"Enable Email Authentication",description:"Allow users to sign up and log in with email/password.",inputType:"boolean"},auth_email_require_verification:{key:"auth_email_require_verification",label:"Require Email Verification",description:"Users must verify their email address before they can log in.",inputType:"boolean"},auth_email_block_disposable:{key:"auth_email_block_disposable",label:"Block Disposable Emails",description:"Reject registrations from known disposable email providers.",inputType:"boolean"},auth_google_enabled:{key:"auth_google_enabled",label:"Enable Google Sign-In",description:'Allow users to authenticate with their Google account. Configure at <a href="https://console.cloud.google.com/apis/credentials" target="_blank" rel="noopener">Google Cloud Console &gt; Credentials</a>.',inputType:"boolean"},auth_google_client_id:{key:"auth_google_client_id",label:"Google Client ID",description:"OAuth 2.0 client ID from Google Cloud Console. Create a Web application credential and add your frontend URL to Authorized JavaScript origins.",inputType:"text"},auth_apple_enabled:{key:"auth_apple_enabled",label:"Enable Sign in with Apple",description:'Allow users to authenticate with their Apple ID. Configure at <a href="https://developer.apple.com/account/resources/identifiers" target="_blank" rel="noopener">Apple Developer &gt; Identifiers</a>.',inputType:"boolean"},auth_apple_client_id:{key:"auth_apple_client_id",label:"Apple Services ID",description:"Your Client ID (e.g. com.yourdomain.service). Create at Identifiers &gt; Services IDs, then enable Sign in with Apple and add your frontend URL as a Return URL (e.g. https://yourdomain.com).",inputType:"text",placeholder:"com.yourdomain.service"},auth_apple_team_id:{key:"auth_apple_team_id",label:"Apple Team ID",description:'Identifies your developer account. Found at the top-right of <a href="https://developer.apple.com/account" target="_blank" rel="noopener">Apple Developer</a>.',inputType:"text"},auth_solana_enabled:{key:"auth_solana_enabled",label:"Enable Solana Wallet Auth",description:"Allow users to authenticate by signing with their Solana wallet.",inputType:"boolean"},auth_solana_challenge_expiry:{key:"auth_solana_challenge_expiry",label:"Challenge Expiry",description:"How long a wallet signature challenge is valid.",inputType:"duration",min:60,presets:[{label:"1 minute",value:"60"},{label:"5 minutes",value:"300"},{label:"10 minutes",value:"600"}]},auth_webauthn_enabled:{key:"auth_webauthn_enabled",label:"Enable WebAuthn/Passkeys",description:"Allow passwordless authentication with FIDO2/WebAuthn credentials.",inputType:"boolean"},auth_webauthn_rp_id:{key:"auth_webauthn_rp_id",label:"Relying Party ID",description:"Usually your domain (e.g., example.com). Passkeys are bound to this.",inputType:"text"},auth_webauthn_rp_name:{key:"auth_webauthn_rp_name",label:"Relying Party Name",description:"Display name shown to users during passkey registration.",inputType:"text"},auth_webauthn_rp_origin:{key:"auth_webauthn_rp_origin",label:"Allowed Origins",description:"Comma-separated origins allowed for WebAuthn (e.g., https://example.com).",inputType:"text"},auth_instantlink_enabled:{key:"auth_instantlink_enabled",label:"Enable Instant Link",description:'When enabled, "Forgot your password?" on the sign-in form sends a one-time sign-in link instead of a password reset. This replaces the password reset flow — it is not a separate login button.',inputType:"boolean"},auth_instantlink_expiry:{key:"auth_instantlink_expiry",label:"Link Expiry",description:"How long the magic link remains valid.",inputType:"duration",min:60,presets:[{label:"5 minutes",value:"300"},{label:"15 minutes",value:"900"},{label:"30 minutes",value:"1800"},{label:"1 hour",value:"3600"}]},auth_instantlink_rate_limit:{key:"auth_instantlink_rate_limit",label:"Rate Limit",description:"Maximum instant link requests per email per hour.",inputType:"select",presets:[{label:"3 per hour",value:"3"},{label:"5 per hour",value:"5"},{label:"10 per hour",value:"10"}]},feature_organizations:{key:"feature_organizations",label:"Organizations",description:"Enable multi-user organizations with role-based access.",inputType:"boolean"},feature_sso:{key:"feature_sso",label:"Enterprise SSO",description:"Enable SAML/OIDC single sign-on for enterprise customers.",inputType:"boolean"},feature_mfa:{key:"feature_mfa",label:"Two-Factor Authentication",description:"Allow users to enable TOTP-based two-factor authentication for email/password sign-in. OAuth (Google, Apple) and passkey logins are not affected — those providers handle their own verification.",inputType:"boolean"},feature_wallet_signing:{key:"feature_wallet_signing",label:"Enable Embedded Wallet",description:"Enable the embedded wallet for transaction signing.",inputType:"boolean"},wallet_recovery_mode:{key:"wallet_recovery_mode",label:"Recovery Mode",description:"Controls whether users can recover their embedded wallet seed. <b>Share C Only</b> lets users export a single key share (cannot reconstruct the full seed). <b>Full Seed</b> lets users export the complete seed phrase. <b>No Recovery</b> prevents any seed export — required when Private Deposits are enabled, because recoverable seeds would let users front-run privacy withdrawals.",inputType:"select",presets:[{label:"Share C Only (Recommended)",value:"share_c_only"},{label:"Full Seed Phrase",value:"full_seed"},{label:"No Recovery (Required for Private Deposits)",value:"none"}]},feature_credits:{key:"feature_credits",label:"Credit System",description:"Enable the deposits and credits system. Users can deposit tokens to receive platform credits.",inputType:"boolean"},feature_user_withdrawals:{key:"feature_user_withdrawals",label:"User Withdrawals",description:"Allow users to initiate withdrawals from their embedded wallet to external addresses. This is separate from the automated privacy withdrawal worker, which moves funds from the privacy pool to the treasury.",inputType:"boolean"},security_require_mfa:{key:"security_require_mfa",label:"Require Two-Factor Authentication",description:'Require users with email/password credentials to set up TOTP two-factor authentication. Users will be prompted to enroll after their next sign-in. Does not affect OAuth, passkey, or wallet sign-in methods. Works independently of the "Two-Factor Authentication" feature flag (which controls UI visibility).',inputType:"boolean"},security_cors_origins:{key:"security_cors_origins",label:"CORS Origins",description:"Allowed origins for cross-origin requests (comma-separated). Empty = same origin only.",inputType:"text"},security_cookie_domain:{key:"security_cookie_domain",label:"Cookie Domain",description:"Domain for auth cookies. Empty uses the request origin.",inputType:"text"},security_cookie_secure:{key:"security_cookie_secure",label:"Secure Cookies",description:"Require HTTPS for cookies. Disable only for local development.",inputType:"boolean"},security_cookie_same_site:{key:"security_cookie_same_site",label:"Cookie SameSite",description:'SameSite policy for cookies. Use "none" only if needed for cross-site embeds.',inputType:"select",presets:[{label:"Strict",value:"strict"},{label:"Lax (Recommended)",value:"lax"},{label:"None (cross-site)",value:"none"}]},security_session_timeout:{key:"security_session_timeout",label:"Session Timeout",description:"How long sessions remain valid before requiring re-authentication.",inputType:"duration",min:300,presets:[{label:"1 hour",value:"3600"},{label:"24 hours",value:"86400"},{label:"7 days",value:"604800"},{label:"30 days",value:"2592000"}]},security_jwt_issuer:{key:"security_jwt_issuer",label:"JWT Issuer",description:"Issuer claim for JWTs. Empty uses the server URL.",inputType:"text"},security_jwt_audience:{key:"security_jwt_audience",label:"JWT Audience",description:"Audience claim for JWTs. Empty uses default.",inputType:"text"},email_provider:{key:"email_provider",label:"Email Provider",description:"Select a provider to auto-configure SMTP host, port, and TLS. Choose Custom SMTP to enter settings manually.",inputType:"select",presets:[{label:"Mailgun",value:"mailgun"},{label:"SendGrid",value:"sendgrid"},{label:"Postmark",value:"postmark"},{label:"AWS SES",value:"ses"},{label:"Resend",value:"resend"},{label:"Custom SMTP",value:"custom"}]},email_smtp_host:{key:"email_smtp_host",label:"SMTP Host",description:"SMTP server hostname. Auto-filled when selecting a provider above.",inputType:"text",placeholder:"smtp.example.com"},email_smtp_port:{key:"email_smtp_port",label:"SMTP Port",description:"SMTP server port. Most providers use 587 (TLS).",inputType:"select",presets:[{label:"587 (TLS)",value:"587"},{label:"465 (SSL)",value:"465"},{label:"25 (Plain)",value:"25"}]},email_smtp_user:{key:"email_smtp_user",label:"SMTP Username",description:'Username for SMTP authentication. For SendGrid use "apikey", for Postmark use your server API token, for Mailgun use your full Mailgun SMTP login.',inputType:"text"},email_smtp_password:{key:"email_smtp_password",label:"API Key",description:"API key or password for your email provider. For SendGrid this is your API key, for Postmark your server API token, for Mailgun your SMTP password.",inputType:"secret"},email_smtp_tls:{key:"email_smtp_tls",label:"Use TLS",description:"Enable TLS encryption for SMTP connections. Required by most providers.",inputType:"boolean"},email_from_address:{key:"email_from_address",label:"From Address",description:"Sender email address for verification, password reset, and instant link emails. Must be verified with your provider.",inputType:"text",placeholder:"noreply@yourdomain.com"},email_from_name:{key:"email_from_name",label:"From Name",description:'Display name shown in the "From" field of outbound emails.',inputType:"text",placeholder:"My App"},webhook_enabled:{key:"webhook_enabled",label:"Enable Webhooks",description:"Send notifications to a Discord or Slack webhook URL.",inputType:"boolean"},webhook_url:{key:"webhook_url",label:"Webhook URL",description:"Discord or Slack webhook URL to receive notifications.",inputType:"text",placeholder:"https://discord.com/api/webhooks/..."},webhook_notify_registrations:{key:"webhook_notify_registrations",label:"New Registrations",description:"Notify when a new user registers.",inputType:"boolean"},webhook_notify_signins:{key:"webhook_notify_signins",label:"Sign-Ins",description:"Notify when a user signs in.",inputType:"boolean"},webhook_notify_deposits:{key:"webhook_notify_deposits",label:"Deposits",description:"Notify when a user makes a deposit.",inputType:"boolean"},server_frontend_url:{key:"server_frontend_url",label:"Frontend URL",description:"URL of your frontend app (for redirects and email links).",inputType:"text"},server_base_path:{key:"server_base_path",label:"Base Path",description:"Base path for auth endpoints (e.g., /auth).",inputType:"text"},server_trust_proxy:{key:"server_trust_proxy",label:"Trust Proxy",description:"Trust X-Forwarded-For headers. Enable if behind a reverse proxy.",inputType:"boolean"},feature_cedros_pay:{key:"feature_cedros_pay",label:"Cedros Pay Integration",description:"Enable Cedros Pay integration. When enabled, shows the Integrations tab with API key configuration. Not needed for co-located deployments using JWT/JWKS inter-service auth.",inputType:"boolean"},server_cedros_pay_api_key:{key:"server_cedros_pay_api_key",label:"Cedros Pay API Key",description:"API key for Cedros Pay to authenticate with this server. Copy this into your Cedros Pay settings.",inputType:"secret"},jupiter_api_key:{key:"jupiter_api_key",label:"Jupiter API Key",description:'API key for Jupiter Ultra API (gasless swaps). Get a free key at <a href="https://portal.jup.ag" target="_blank" rel="noopener">portal.jup.ag</a>.',inputType:"secret"},server_metrics_api_key:{key:"server_metrics_api_key",label:"Metrics API Key",description:"API key for Prometheus/Grafana to scrape the /metrics endpoint. Use with Authorization: Bearer header.",inputType:"secret"},server_log_level:{key:"server_log_level",label:"Log Level",description:"Minimum severity level for log output. Lower levels are more verbose.",inputType:"select",presets:[{label:"Trace (most verbose)",value:"trace"},{label:"Debug",value:"debug"},{label:"Info",value:"info"},{label:"Warn",value:"warn"},{label:"Error (least verbose)",value:"error"}]},server_log_format:{key:"server_log_format",label:"Log Format",description:"Output format for log messages.",inputType:"select",presets:[{label:"JSON (structured)",value:"json"},{label:"Pretty (human-readable)",value:"pretty"}]},server_environment:{key:"server_environment",label:"Environment",description:"Deployment environment. Affects default behaviors and log verbosity.",inputType:"select",presets:[{label:"Development",value:"development"},{label:"Staging",value:"staging"},{label:"Production",value:"production"}]},privacy_period_secs:{key:"privacy_period_secs",label:"Privacy Period",description:"How long deposits are held before withdrawal to provide timing privacy. Longer periods provide better privacy but delay user access to funds.",inputType:"duration",min:0,presets:[{label:"Disabled",value:"0"},{label:"1 hour",value:"3600"},{label:"6 hours",value:"21600"},{label:"24 hours",value:"86400"},{label:"7 days",value:"604800"},{label:"14 days",value:"1209600"},{label:"30 days",value:"2592000"}],warningThreshold:{below:3600,message:"Very short privacy periods may not provide adequate timing protection."}},treasury_wallet_address:{key:"treasury_wallet_address",label:"Treasury Wallet Address",description:"Solana wallet address where funds are sent. Used for privacy cash withdrawals, micro payment batches, and direct payments.",inputType:"text",placeholder:"e.g., 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"},withdrawal_poll_interval_secs:{key:"withdrawal_poll_interval_secs",label:"Worker Poll Interval",description:"How often the withdrawal worker checks for deposits ready to process. Lower values process faster but increase server load.",inputType:"duration",min:60,presets:[{label:"1 minute",value:"60"},{label:"5 minutes",value:"300"},{label:"15 minutes",value:"900"},{label:"1 hour",value:"3600"},{label:"6 hours",value:"21600"}],warningThreshold:{below:60,message:"Polling more than once per minute may cause excessive load."}},withdrawal_batch_size:{key:"withdrawal_batch_size",label:"Batch Size",description:"Maximum number of withdrawals to process in a single batch. Higher values improve throughput but may cause timeouts.",inputType:"select",min:1,max:100,presets:[{label:"1 (Sequential)",value:"1"},{label:"5",value:"5"},{label:"10 (Recommended)",value:"10"},{label:"25",value:"25"},{label:"50",value:"50"},{label:"100 (Max)",value:"100"}]},withdrawal_timeout_secs:{key:"withdrawal_timeout_secs",label:"Transaction Timeout",description:"How long to wait for a withdrawal transaction to confirm before considering it failed.",inputType:"duration",min:30,presets:[{label:"30 seconds",value:"30"},{label:"1 minute",value:"60"},{label:"2 minutes",value:"120"},{label:"5 minutes",value:"300"}],warningThreshold:{below:30,message:"Very short timeouts may cause premature failure on slow networks."}},withdrawal_max_retries:{key:"withdrawal_max_retries",label:"Max Retries",description:"Number of times to retry a failed withdrawal before marking it as permanently failed.",inputType:"select",min:0,max:10,presets:[{label:"0 (No retries)",value:"0"},{label:"1",value:"1"},{label:"3 (Recommended)",value:"3"},{label:"5",value:"5"},{label:"10",value:"10"}]},withdrawal_percentage:{key:"withdrawal_percentage",label:"Withdrawal Percentage",description:"Percentage of ready funds to withdraw each cycle. Lower values spread withdrawals over time for better privacy.",inputType:"percentage",min:1,max:100,step:5,presets:[{label:"25%",value:"25"},{label:"50%",value:"50"},{label:"75%",value:"75"},{label:"100% (All at once)",value:"100"}],warningThreshold:{above:75,message:"High percentages may reduce timing privacy by processing most withdrawals together."}},partial_withdrawal_count:{key:"partial_withdrawal_count",label:"Partial Withdrawals",description:"Maximum partial withdrawals per batch. Partial withdrawals add noise to timing analysis. Set to 0 to disable.",inputType:"select",min:0,presets:[{label:"Disabled",value:"0"},{label:"1",value:"1"},{label:"3",value:"3"},{label:"5",value:"5"},{label:"10",value:"10"}]},partial_withdrawal_min_lamports:{key:"partial_withdrawal_min_lamports",label:"Min Balance for Partial",description:"Minimum account balance (in lamports) required before partial withdrawals are considered. 1 SOL = 1,000,000,000 lamports.",inputType:"select",min:0,presets:[{label:"0.1 SOL",value:"100000000"},{label:"0.5 SOL",value:"500000000"},{label:"1 SOL",value:"1000000000"},{label:"5 SOL",value:"5000000000"},{label:"10 SOL",value:"10000000000"}]},rate_limit_auth:{key:"rate_limit_auth",label:"Auth Request Limit",description:"Maximum authentication attempts (login, register, password reset) per IP per window. Protects against brute force attacks.",inputType:"select",min:1,unit:"requests",presets:[{label:"5 (Strict)",value:"5"},{label:"10 (Recommended)",value:"10"},{label:"20",value:"20"},{label:"50 (Permissive)",value:"50"}],warningThreshold:{above:20,message:"High auth limits may allow brute force attempts."}},rate_limit_general:{key:"rate_limit_general",label:"General Request Limit",description:"Maximum general API requests per IP per window. Affects all non-auth endpoints.",inputType:"select",min:1,unit:"requests",presets:[{label:"30",value:"30"},{label:"60 (Recommended)",value:"60"},{label:"120",value:"120"},{label:"300",value:"300"}]},rate_limit_credit:{key:"rate_limit_credit",label:"Credit Request Limit",description:"Maximum credit/balance check requests per IP per window. Higher for apps that poll balance frequently.",inputType:"select",min:1,unit:"requests",presets:[{label:"10",value:"10"},{label:"30 (Recommended)",value:"30"},{label:"60",value:"60"},{label:"120",value:"120"}]},rate_limit_window:{key:"rate_limit_window",label:"Rate Limit Window",description:'Time window for rate limiting. All limits above are "per window". Shorter windows are stricter.',inputType:"duration",min:1,presets:[{label:"30 seconds",value:"30"},{label:"1 minute",value:"60"},{label:"5 minutes",value:"300"},{label:"15 minutes",value:"900"}]},solana_rpc_url:{key:"solana_rpc_url",label:"Solana RPC URL",description:'Get a fast RPC endpoint from <a href="https://helius.dev" target="_blank" rel="noopener">Helius</a> or <a href="https://quicknode.com" target="_blank" rel="noopener">QuickNode</a>.',inputType:"text",placeholder:"https://api.mainnet-beta.solana.com"},solana_network:{key:"solana_network",label:"Solana Network",description:"The Solana network to use for deposits and withdrawals.",inputType:"select",presets:[{label:"Mainnet",value:"mainnet-beta"},{label:"Devnet",value:"devnet"}]},deposit_privacy_enabled:{key:"deposit_privacy_enabled",label:"Enable Private Deposits",description:"When enabled, deposits are held for a privacy period before withdrawal. Provides timing privacy but delays fund availability.",inputType:"boolean"},deposit_company_token:{key:"deposit_company_token",label:"Platform Token",description:"The token that represents platform credits. Deposits are converted to this token. Common choices: USDC, SOL.",inputType:"select",presets:[{label:"USDC",value:"USDC"},{label:"USDT",value:"USDT"},{label:"SOL",value:"SOL"},{label:"EURC",value:"EURC"}]},deposit_micro_enabled:{key:"deposit_micro_enabled",label:"SOL Micro Payments",description:"Allow small SOL deposits (under $10) that are batched together for efficiency.",inputType:"boolean"},deposit_gasless_swap_enabled:{key:"deposit_gasless_swap_enabled",label:"Gasless Swap Payments",description:"Allow deposits via Jupiter swaps.",inputType:"boolean"},deposit_min_usd:{key:"deposit_min_usd",label:"Minimum Deposit",description:"Minimum deposit amount in USD equivalent.",inputType:"select",unit:"USD",presets:[{label:"$1",value:"1"},{label:"$5",value:"5"},{label:"$10",value:"10"},{label:"$25",value:"25"}]},deposit_max_usd:{key:"deposit_max_usd",label:"Maximum Deposit",description:"Maximum deposit amount per transaction in USD equivalent. Set to 0 for unlimited.",inputType:"select",unit:"USD",presets:[{label:"Unlimited",value:"0"},{label:"$1,000",value:"1000"},{label:"$10,000",value:"10000"},{label:"$100,000",value:"100000"}]},deposit_show_explainer:{key:"deposit_show_explainer",label:"Show Explainer Screen",description:"Show the introductory explainer screen at the start of the deposit flow.",inputType:"boolean"},deposit_quick_action_tokens:{key:"deposit_quick_action_tokens",label:"Quick Action Tokens",description:"Comma-separated token symbols shown as quick action buttons. First token is the default.",inputType:"tokenSymbolList"},deposit_custom_tokens:{key:"deposit_custom_tokens",label:"Custom Dropdown Tokens",description:'Comma-separated token symbols shown in the "Custom" dropdown. Leave empty to show all.',inputType:"tokenSymbolList"},deposit_custom_tokens_json:{key:"deposit_custom_tokens_json",label:"Custom Token Definitions",description:"Add tokens beyond the built-in list. Define symbol, mint address, decimals, and logo URL.",inputType:"tokenList"},deposit_fee_policy:{key:"deposit_fee_policy",label:"Fee Policy",description:"Who pays deposit fees: company absorbs all, or user pays swap/privacy/all fees.",inputType:"select",presets:[{label:"Company Pays All",value:"company_pays_all"},{label:"User Pays Swap Fees",value:"user_pays_swap"},{label:"User Pays Privacy Fees",value:"user_pays_privacy"},{label:"User Pays All Fees",value:"user_pays_all"}]},privacy_fee_fixed_lamports:{key:"privacy_fee_fixed_lamports",label:"Privacy Fixed Fee",description:"Fixed fee for Privacy Cash deposits in lamports. 1 SOL = 1,000,000,000 lamports.",inputType:"select",unit:"lamports",presets:[{label:"0 SOL",value:"0"},{label:"0.001 SOL",value:"1000000"},{label:"0.005 SOL",value:"5000000"},{label:"0.006 SOL (Default)",value:"6000000"},{label:"0.01 SOL",value:"10000000"}]},privacy_fee_percent_bps:{key:"privacy_fee_percent_bps",label:"Privacy Percentage Fee",description:"Percentage fee for Privacy Cash deposits in basis points. 100 bps = 1%.",inputType:"select",unit:"bps",presets:[{label:"0%",value:"0"},{label:"0.25%",value:"25"},{label:"0.35% (Default)",value:"35"},{label:"0.5%",value:"50"},{label:"1%",value:"100"}]},swap_fee_fixed_lamports:{key:"swap_fee_fixed_lamports",label:"Swap Fixed Fee",description:"Fixed fee for Jupiter swaps in lamports. Covers transaction costs.",inputType:"select",unit:"lamports",presets:[{label:"0 SOL",value:"0"},{label:"0.001 SOL (Default)",value:"1000000"},{label:"0.002 SOL",value:"2000000"},{label:"0.005 SOL",value:"5000000"}]},swap_fee_percent_bps:{key:"swap_fee_percent_bps",label:"Swap Percentage Fee",description:"Percentage fee for Jupiter swaps in basis points. 100 bps = 1%.",inputType:"select",unit:"bps",presets:[{label:"0%",value:"0"},{label:"0.1% (Default)",value:"10"},{label:"0.25%",value:"25"},{label:"0.5%",value:"50"}]},company_fee_fixed_lamports:{key:"company_fee_fixed_lamports",label:"Company Fixed Fee",description:"Additional fixed processing fee in lamports. Set to 0 to disable.",inputType:"select",unit:"lamports",presets:[{label:"Disabled",value:"0"},{label:"0.001 SOL",value:"1000000"},{label:"0.005 SOL",value:"5000000"},{label:"0.01 SOL",value:"10000000"}]},company_fee_percent_bps:{key:"company_fee_percent_bps",label:"Company Percentage Fee",description:"Additional percentage processing fee in basis points. 100 bps = 1%.",inputType:"select",unit:"bps",presets:[{label:"Disabled",value:"0"},{label:"0.1%",value:"10"},{label:"0.25%",value:"25"},{label:"0.5%",value:"50"},{label:"1%",value:"100"}]},micro_batch_threshold_usd:{key:"micro_batch_threshold_usd",label:"Batch Threshold",description:"Minimum accumulated USD value before triggering a batch swap. Jupiter requires ~$10 minimum.",inputType:"select",unit:"USD",presets:[{label:"$10 (Minimum)",value:"10"},{label:"$25",value:"25"},{label:"$50",value:"50"},{label:"$100",value:"100"}]},micro_batch_poll_secs:{key:"micro_batch_poll_secs",label:"Batch Poll Interval",description:"How often to check for batchable micro deposits. Lower values process faster but increase load.",inputType:"duration",min:60,presets:[{label:"1 minute",value:"60"},{label:"5 minutes (Default)",value:"300"},{label:"15 minutes",value:"900"},{label:"1 hour",value:"3600"}]},private_deposit_min_lamports:{key:"private_deposit_min_lamports",label:"Min Private Deposit",description:"Minimum amount for Privacy Cash deposits in lamports. Smaller deposits use micro batching.",inputType:"select",unit:"lamports",presets:[{label:"0.1 SOL",value:"100000000"},{label:"0.25 SOL (Default)",value:"250000000"},{label:"0.5 SOL",value:"500000000"},{label:"1 SOL",value:"1000000000"}]},withdrawal_min_lamports:{key:"withdrawal_min_lamports",label:"Min Withdrawal Amount",description:"Minimum amount to withdraw in lamports. Deposits below this remain pending. Fees are ~0.006 SOL + 0.35% + Jupiter.",inputType:"select",unit:"lamports",presets:[{label:"0.5 SOL",value:"500000000"},{label:"1 SOL (Default)",value:"1000000000"},{label:"2 SOL",value:"2000000000"},{label:"5 SOL",value:"5000000000"}],warningThreshold:{below:5e8,message:"Very small withdrawals may lose significant value to fees."}},postlogin_redirect_url:{key:"postlogin_redirect_url",label:"Redirect URL",description:"URL to redirect to after login. Leave empty for default behavior (consumer app decides).",inputType:"text",placeholder:"https://example.com/dashboard"},postlogin_welcome_enabled:{key:"postlogin_welcome_enabled",label:"Enable Welcome Page",description:"Show a one-time welcome/onboarding page to new users after their first login.",inputType:"boolean"},postlogin_welcome_route:{key:"postlogin_welcome_route",label:"Welcome Route",description:"Route for the welcome/onboarding page.",inputType:"text",placeholder:"/welcome"},postlogin_complete_enabled:{key:"postlogin_complete_enabled",label:"Prompt Profile Completion",description:"Prompt users to fill in missing name or email after login. Shows every login until the user completes or skips.",inputType:"boolean"},postlogin_username_enabled:{key:"postlogin_username_enabled",label:"Require Username Selection",description:"Prompt new users to choose a unique handle-style username (e.g. @swift_falcon_42) after signup. Shows until the user picks a username or skips.",inputType:"boolean"},postlogin_wallet_enroll_enabled:{key:"postlogin_wallet_enroll_enabled",label:"Prompt Wallet Enrollment",description:"Prompt users to enroll an embedded wallet after signup. Requires the Embedded Wallet feature to be enabled.",inputType:"boolean"},wallet_enroll_solana_users:{key:"wallet_enroll_solana_users",label:"Enroll Solana Wallet Users",description:"Also prompt Solana wallet users to enroll an embedded wallet. By default they are skipped since they already have a wallet.",inputType:"boolean"},postlogin_show_recovery_enabled:{key:"postlogin_show_recovery_enabled",label:"Show Recovery Info",description:"Show wallet recovery information screen after account creation. Displays recovery phrase based on the configured recovery mode.",inputType:"boolean"}},L={"auth.apple":{label:"Apple Sign-In",description:"Configure Sign in with Apple OAuth integration.",icon:""},"auth.email":{label:"Email Authentication",description:"Configure email/password authentication settings.",icon:""},"auth.google":{label:"Google Sign-In",description:"Configure Google OAuth integration.",icon:""},"auth.solana":{label:"Solana Wallet Auth",description:"Configure Solana wallet signature authentication.",icon:""},"auth.webauthn":{label:"WebAuthn / Passkeys",description:"Configure FIDO2/WebAuthn passwordless authentication.",icon:""},"auth.instantlink":{label:"Instant Link",description:'Passwordless sign-in via email link. Replaces "Forgot your password?" with a one-time login link instead of a password reset.',icon:""},"deposit.general":{label:"General",description:"Core deposit and credit system configuration.",icon:""},postlogin:{label:"Post-Login",description:"Configure what happens after a user logs in.",icon:""},"postlogin.welcome":{label:"Welcome Page",description:"One-time onboarding page shown to new users after first login.",icon:""},"postlogin.complete":{label:"Profile Completion",description:"Prompt users to fill in missing profile information.",icon:""},"postlogin.username":{label:"Username Selection",description:"Prompt users to choose a unique handle-style username.",icon:""},"postlogin.wallet":{label:"Wallet Enrollment",description:"Prompt users to enroll an embedded wallet after signup.",icon:""},deposit:{label:"Deposit Settings",description:"Configure deposit tokens, fees, and related settings.",icon:""},email:{label:"Email / SMTP",description:"Configure outbound email delivery for verification, password reset, and notifications.",icon:""},features:{label:"Feature Flags",description:"Enable or disable major platform features.",icon:""},privacy:{label:"Privacy Settings",description:"Control the privacy period for deposits. Longer periods provide better timing privacy but delay fund availability.",icon:""},rate_limit:{label:"Rate Limiting",description:"Protect the system from abuse by limiting request rates. Balance security with user experience.",icon:""},security:{label:"Security",description:"Configure CORS, cookies, sessions, and JWT settings.",icon:""},server:{label:"Server",description:"Server infrastructure settings. Some may be overridden by environment variables.",icon:""},webhook:{label:"Webhooks",description:"Configure HTTP webhook notifications for auth events.",icon:""},withdrawal:{label:"Withdrawal Worker",description:"Configure how the automated withdrawal processor handles pending withdrawals. These settings affect throughput and privacy.",icon:""}},T=["SOL","USDC","USDT","EURC","USD1","PYUSD","USDH","CASH","BONK","ORE"];function w(t){const s=t.split(/(<a\s[^>]*>.*?<\/a>)/g);return s.length===1?t:s.map((a,n)=>{const l=a.match(/^<a\s+href="([^"]+)"[^>]*>([^<]+)<\/a>$/);return l?e.jsx("a",{href:l[1],target:"_blank",rel:"noopener noreferrer",children:l[2]},n):a})}function D({settings:t,edits:s,onChange:a,externalWarnings:n}){return e.jsx("div",{className:"cedros-settings-grid",children:t.map(l=>e.jsx(E,{setting:l,editValue:s[l.key],onChange:a,externalWarning:n?.[l.key]},l.key))})}function E({setting:t,editValue:s,onChange:a,externalWarning:n}){const l=S[t.key],i=s??t.value,p=s!==void 0&&s!==t.value,o=l?.inputType==="boolean",r=u.useMemo(()=>{if(n)return n;if(!l?.warningThreshold)return null;const c=parseInt(i,10);if(isNaN(c))return null;const{above:d,below:h,message:y}=l.warningThreshold;return d!==void 0&&c>d||h!==void 0&&c<h?y:null},[i,l?.warningThreshold,n]);return l?e.jsx("div",{className:`cedros-setting-row ${p?"cedros-setting-row-changed":""} ${r?"cedros-setting-row-warning":""} ${o?"cedros-setting-row-toggle":""}`,children:o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cedros-setting-control cedros-setting-control-toggle",children:[e.jsx(k,{meta:l,value:i,onChange:c=>a(t.key,c)}),r&&e.jsx("div",{className:"cedros-setting-warning",children:r})]}),e.jsxs("div",{className:"cedros-setting-label",children:[e.jsx("span",{className:"cedros-setting-name",children:l.label}),e.jsx("span",{className:"cedros-setting-description",children:w(l.description)})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cedros-setting-label",children:[e.jsx("span",{className:"cedros-setting-name",children:l.label}),e.jsx("span",{className:"cedros-setting-description",children:w(l.description)})]}),e.jsxs("div",{className:"cedros-setting-control",children:[e.jsx(k,{meta:l,value:i,onChange:c=>a(t.key,c)}),r&&e.jsx("div",{className:"cedros-setting-warning",children:r})]})]})}):e.jsxs("div",{className:`cedros-setting-row ${p?"cedros-setting-row-changed":""}`,children:[e.jsxs("div",{className:"cedros-setting-label",children:[e.jsx("span",{className:"cedros-setting-name",children:t.key}),t.description&&e.jsx("span",{className:"cedros-setting-description",children:t.description})]}),e.jsx("div",{className:"cedros-setting-input-wrapper",children:e.jsx("input",{type:"text",value:i,onChange:c=>a(t.key,c.target.value),className:"cedros-setting-input"})})]})}function k({meta:t,value:s,onChange:a}){switch(t.inputType){case"duration":return e.jsx(R,{value:s,onChange:a,presets:t.presets,min:t.min});case"percentage":return e.jsx(O,{value:s,onChange:a,min:t.min??1,max:t.max??100,step:t.step??5,presets:t.presets});case"select":return e.jsx(I,{value:s,onChange:a,presets:t.presets??[],unit:t.unit});case"number":return e.jsx(M,{value:s,onChange:a,min:t.min,max:t.max,unit:t.unit});case"tokenList":return e.jsx(q,{value:s,onChange:a});case"text":return e.jsx("input",{type:"text",value:s,onChange:n=>a(n.target.value),className:"cedros-setting-input",placeholder:t.label});case"boolean":return e.jsx(U,{value:s,onChange:a});case"secret":return e.jsx(F,{value:s,onChange:a,multiline:t.multiline});case"tokenSymbolList":return e.jsx(W,{value:s,onChange:a});default:return e.jsx("input",{type:"text",value:s,onChange:n=>a(n.target.value),className:"cedros-setting-input"})}}function R({value:t,onChange:s,presets:a,min:n=0}){const l=parseInt(t,10)||0,i=A(l),p=u.useCallback(r=>{r.target.value&&s(r.target.value)},[s]),o=u.useCallback(r=>{const c=Math.max(n,parseInt(r.target.value,10)||0);s(String(c))},[s,n]);return e.jsxs("div",{className:"cedros-duration-input",children:[a&&a.length>0&&e.jsxs("select",{value:a.find(r=>r.value===t)?.value??"",onChange:p,className:"cedros-setting-select",children:[e.jsx("option",{value:"",children:"Custom..."}),a.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))]}),e.jsxs("div",{className:"cedros-duration-custom",children:[e.jsx("input",{type:"number",value:l,onChange:o,min:n,className:"cedros-setting-input cedros-setting-input-sm"}),e.jsx("span",{className:"cedros-setting-unit",children:"seconds"}),e.jsxs("span",{className:"cedros-duration-display",children:["= ",i]})]})]})}function O({value:t,onChange:s,min:a,max:n,step:l,presets:i}){const p=parseInt(t,10)||a,o=u.useCallback(c=>{s(c.target.value)},[s]),r=u.useCallback(c=>{s(c)},[s]);return e.jsxs("div",{className:"cedros-percentage-input",children:[e.jsxs("div",{className:"cedros-percentage-slider-row",children:[e.jsx("input",{type:"range",value:p,onChange:o,min:a,max:n,step:l,className:"cedros-percentage-slider"}),e.jsxs("span",{className:"cedros-percentage-value",children:[p,"%"]})]}),i&&i.length>0&&e.jsx("div",{className:"cedros-preset-buttons",children:i.map(c=>e.jsx("button",{type:"button",className:`cedros-preset-button ${c.value===t?"cedros-preset-button-active":""}`,onClick:()=>r(c.value),children:c.label},c.value))})]})}function I({value:t,onChange:s,presets:a,unit:n}){const l=!a.some(o=>o.value===t),i=u.useCallback(o=>{o.target.value!=="__custom__"&&s(o.target.value)},[s]),p=u.useCallback(o=>{s(o.target.value)},[s]);return e.jsxs("div",{className:"cedros-select-input",children:[e.jsxs("select",{value:l?"__custom__":t,onChange:i,className:"cedros-setting-select",children:[a.map(o=>e.jsx("option",{value:o.value,children:o.label},o.value)),e.jsx("option",{value:"__custom__",children:"Custom..."})]}),l&&e.jsxs("div",{className:"cedros-select-custom",children:[e.jsx("input",{type:"number",value:t,onChange:p,className:"cedros-setting-input cedros-setting-input-sm"}),n&&e.jsx("span",{className:"cedros-setting-unit",children:n})]})]})}function M({value:t,onChange:s,min:a,max:n,unit:l}){const i=u.useCallback(p=>{s(p.target.value)},[s]);return e.jsxs("div",{className:"cedros-number-input",children:[e.jsx("input",{type:"number",value:t,onChange:i,min:a,max:n,className:"cedros-setting-input"}),l&&e.jsx("span",{className:"cedros-setting-unit",children:l})]})}function U({value:t,onChange:s}){const a=t==="true",n=u.useCallback(()=>{s(a?"false":"true")},[a,s]);return e.jsxs("button",{type:"button",role:"switch","aria-checked":a,className:`cedros-toggle ${a?"cedros-toggle-on":"cedros-toggle-off"}`,onClick:n,children:[e.jsx("span",{className:"cedros-toggle-track",children:e.jsx("span",{className:"cedros-toggle-thumb"})}),e.jsx("span",{className:"cedros-toggle-label",children:a?"Enabled":"Disabled"})]})}function F({value:t,onChange:s,multiline:a}){const[n,l]=u.useState(!1),[i,p]=u.useState(!1),o=t&&t.length>0,r=u.useCallback(()=>{l(!0),p(!0)},[]),c=u.useCallback(()=>{l(!1),p(!1)},[]),d=u.useCallback(h=>{s(h.target.value)},[s]);return!n&&o?e.jsxs("div",{className:"cedros-secret-input cedros-secret-input-masked",children:[e.jsx("span",{className:"cedros-secret-masked",children:"•".repeat(Math.min(t.length,20))}),e.jsx("button",{type:"button",className:"cedros-secret-edit-btn",onClick:r,children:"Edit"})]}):e.jsxs("div",{className:"cedros-secret-input",children:[a?e.jsx("textarea",{value:t,onChange:d,className:"cedros-setting-input cedros-setting-textarea",placeholder:"Enter secret value...",rows:4}):e.jsx("input",{type:i?"text":"password",value:t,onChange:d,className:"cedros-setting-input",placeholder:"Enter secret value..."}),e.jsxs("div",{className:"cedros-secret-actions",children:[!a&&e.jsx("button",{type:"button",className:"cedros-secret-toggle-btn",onClick:()=>p(!i),children:i?"Hide":"Show"}),n&&e.jsx("button",{type:"button",className:"cedros-secret-done-btn",onClick:c,children:"Done"})]})]})}function q({value:t,onChange:s}){const a=u.useMemo(()=>{try{return JSON.parse(t||"[]")}catch{return[]}},[t]),n=u.useCallback(o=>{s(JSON.stringify(o))},[s]),l=u.useCallback(()=>{n([...a,{symbol:"",mint:"",decimals:6}])},[a,n]),i=u.useCallback((o,r,c)=>{const d=[...a];d[o]={...d[o],[r]:c},n(d)},[a,n]),p=u.useCallback(o=>{n(a.filter((r,c)=>c!==o))},[a,n]);return e.jsxs("div",{className:"cedros-token-list-input",children:[e.jsxs("div",{className:"cedros-token-presets",children:[e.jsx("span",{className:"cedros-token-presets-label",children:"Built-in tokens:"}),e.jsx("div",{className:"cedros-token-presets-list",children:T.map(o=>e.jsx("span",{className:"cedros-token-preset-chip",children:o},o))})]}),a.length===0&&e.jsx("p",{className:"cedros-token-list-empty",children:"No custom tokens added. Use the built-in tokens above or add your own."}),a.map((o,r)=>e.jsxs("div",{className:"cedros-token-row",children:[e.jsxs("div",{className:"cedros-token-row-fields",children:[e.jsx("input",{type:"text",placeholder:"Symbol",value:o.symbol,onChange:c=>i(r,"symbol",c.target.value.toUpperCase()),className:"cedros-setting-input cedros-token-input-symbol",maxLength:10}),e.jsx("input",{type:"text",placeholder:"Mint address",value:o.mint,onChange:c=>i(r,"mint",c.target.value),className:"cedros-setting-input cedros-token-input-mint"}),e.jsx("input",{type:"number",placeholder:"Decimals",value:o.decimals,onChange:c=>i(r,"decimals",parseInt(c.target.value,10)||0),className:"cedros-setting-input cedros-token-input-decimals",min:0,max:18}),e.jsx("input",{type:"text",placeholder:"Logo URL (optional)",value:o.logoUrl||"",onChange:c=>i(r,"logoUrl",c.target.value||void 0),className:"cedros-setting-input cedros-token-input-logo"})]}),e.jsx("button",{type:"button",className:"cedros-token-remove-btn",onClick:()=>p(r),title:"Remove token",children:"×"})]},r)),e.jsx("button",{type:"button",className:"cedros-token-add-btn",onClick:l,children:"+ Add Token"})]})}function W({value:t,onChange:s}){const a=u.useMemo(()=>t.split(",").map(i=>i.trim()).filter(Boolean),[t]),n=u.useCallback(i=>{if(!i||a.includes(i))return;const p=[...a,i].join(", ");s(p)},[a,s]),l=u.useCallback(i=>{const p=a.filter(o=>o!==i).join(", ");s(p)},[a,s]);return e.jsxs("div",{className:"cedros-token-symbol-list-input",children:[e.jsxs("div",{className:"cedros-token-presets",children:[e.jsx("span",{className:"cedros-token-presets-label",children:"Click to add:"}),e.jsx("div",{className:"cedros-token-presets-list",children:T.map(i=>{const p=a.includes(i);return e.jsxs("button",{type:"button",className:`cedros-token-preset-chip ${p?"cedros-token-preset-chip-selected":""}`,onClick:()=>p?l(i):n(i),title:p?`Remove ${i}`:`Add ${i}`,children:[i,p&&e.jsx("span",{className:"cedros-token-chip-check",children:"✓"})]},i)})})]}),e.jsx("input",{type:"text",value:t,onChange:i=>s(i.target.value),className:"cedros-setting-input",placeholder:"USDC, SOL, BONK..."})]})}const $=800,G=2e3;function J(){const{settings:t,isLoading:s,error:a,fetchSettings:n,updateSettings:l}=C.useSystemSettings(),[i,p]=u.useState({}),[o,r]=u.useState("idle"),[c,d]=u.useState(null),h=u.useRef(null),y=u.useRef(null),g=u.useRef({});u.useEffect(()=>()=>{h.current&&clearTimeout(h.current),y.current&&clearTimeout(y.current)},[]);const f=u.useCallback(async()=>{const b={...g.current};if(Object.keys(b).length===0){r("idle");return}r("saving"),d(null);const _=Object.entries(b).map(([m,v])=>({key:m,value:v}));try{await l(_),p(m=>{const v={...m};for(const P of Object.keys(b))delete v[P];return v});for(const m of Object.keys(b))delete g.current[m];r("saved"),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{r("idle")},G)}catch(m){r("error"),d(m instanceof Error?m.message:"Failed to save")}},[l]),x=u.useCallback((b,_)=>{p(m=>({...m,[b]:_})),g.current[b]=_,d(null),r("pending"),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{f()},$)},[f]),j=u.useCallback(b=>{if(i[b]!==void 0)return i[b];for(const _ of Object.values(t)){const m=_.find(v=>v.key===b);if(m)return m.value}return""},[i,t]);return{settings:t,edits:i,isLoading:s,autosaveStatus:o,autosaveError:c,error:a,fetchSettings:n,handleChange:x,getEffectiveValue:j}}function B({status:t,error:s}){return t==="idle"?null:e.jsxs("div",{className:`cedros-autosave-status cedros-autosave-status--${t}`,children:[t==="pending"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"cedros-autosave-dot"}),e.jsx("span",{children:"Unsaved changes"})]}),t==="saving"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"cedros-autosave-spinner"}),e.jsx("span",{children:"Saving..."})]}),t==="saved"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"cedros-autosave-check",children:"✓"}),e.jsx("span",{children:"Saved"})]}),t==="error"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"cedros-autosave-error-icon",children:"!"}),e.jsx("span",{children:s||"Save failed"})]})]})}exports.AutosaveStatus=B;exports.CATEGORY_METADATA=L;exports.SETTING_METADATA=S;exports.SettingsSection=D;exports.useSettingsAutosave=J;