@cedros/login-react 0.0.47 → 0.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AdminWithdrawalHistory-CgYehfMH.js +948 -0
- package/dist/AdminWithdrawalHistory-CgYehfMH.js.map +1 -0
- package/dist/AdminWithdrawalHistory-zDUhPDNi.cjs +1 -0
- package/dist/AdminWithdrawalHistory-zDUhPDNi.cjs.map +1 -0
- package/dist/{WithdrawalsSection-BN-FjTEV.js → WithdrawalsSection-BCG_-DAP.js} +1 -1
- package/dist/{WithdrawalsSection-BN-FjTEV.js.map → WithdrawalsSection-BCG_-DAP.js.map} +1 -1
- package/dist/{WithdrawalsSection-BhuCwFat.cjs → WithdrawalsSection-DKpL2mt8.cjs} +1 -1
- package/dist/{WithdrawalsSection-BhuCwFat.cjs.map → WithdrawalsSection-DKpL2mt8.cjs.map} +1 -1
- package/dist/admin-only.cjs +1 -1
- package/dist/admin-only.js +1 -1
- package/dist/index.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4235 -4208
- package/dist/index.js.map +1 -1
- package/dist/{plugin-DNFjEfYp.cjs → plugin-C7dru1t-.cjs} +1 -1
- package/dist/{plugin-DNFjEfYp.cjs.map → plugin-C7dru1t-.cjs.map} +1 -1
- package/dist/{plugin-WYMrRNbz.js → plugin-DivbaxSZ.js} +1 -1
- package/dist/{plugin-WYMrRNbz.js.map → plugin-DivbaxSZ.js.map} +1 -1
- package/package.json +1 -1
- package/dist/AdminWithdrawalHistory-B2EY2ZmH.cjs +0 -1
- package/dist/AdminWithdrawalHistory-B2EY2ZmH.cjs.map +0 -1
- package/dist/AdminWithdrawalHistory-C76bkbjX.js +0 -916
- package/dist/AdminWithdrawalHistory-C76bkbjX.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-WYMrRNbz.js","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 getReferralCode: () => null,\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","s","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":";;;AAqCO,SAASA,EAAgB;AAAA,EAC9B,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AACd,GAAyB;AACvB,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpCC,IAAcC,EAAuB,IAAI;AAG/C,EAAAC,EAAU,MAAM;AACd,aAASC,EAAmBC,GAAmB;AAC7C,MAAIJ,EAAY,WAAW,CAACA,EAAY,QAAQ,SAASI,EAAM,MAAc,KAC3EN,EAAU,EAAK;AAAA,IAEnB;AAEA,QAAID;AACF,sBAAS,iBAAiB,aAAaM,CAAkB,GAClD,MAAM,SAAS,oBAAoB,aAAaA,CAAkB;AAAA,EAE7E,GAAG,CAACN,CAAM,CAAC,GAGXK,EAAU,MAAM;AACd,aAASG,EAAaD,GAAsB;AAC1C,MAAIA,EAAM,QAAQ,YAChBN,EAAU,EAAK;AAAA,IAEnB;AAEA,QAAID;AACF,sBAAS,iBAAiB,WAAWQ,CAAY,GAC1C,MAAM,SAAS,oBAAoB,WAAWA,CAAY;AAAA,EAErE,GAAG,CAACR,CAAM,CAAC;AAEX,QAAMS,IAAiBC,EAAY,MAAM;AACvC,IAAAT,EAAU,EAAK,GACfJ,IAAA;AAAA,EACF,GAAG,CAACA,CAAU,CAAC,GAETc,IAAeD,EAAY,MAAM;AACrC,IAAAT,EAAU,EAAK,GACfH,IAAA;AAAA,EACF,GAAG,CAACA,CAAQ,CAAC,GAEPc,IAAclB,KAAQ,QACtBmB,KAAWnB,IAAO,CAAC,K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rE,UAAMqE,IAAMrE,EAAY;AAGxB,QAAI,CAACqE;AAEH,aAAO,EAAQrE,EAAY,aAAa;AAG1C,UAAMsE,IAAgBN,GAAeI,CAA6B;AAClE,WAAKE,IAMEA,EAAc;AAAA,MACnB,CAAC3D,MACC0D,EAAI,YAAY,SAAS1D,CAAC,KAC1BA,MAAM0D,EAAI,QACT1D,MAAM,WAAW,CAAC,SAAS,OAAO,EAAE,SAAS0D,EAAI,IAAI,KACrD1D,MAAM,WAAW0D,EAAI,SAAS;AAAA,IAAA,IAT1B;AAAA,EAWX;AAAA,EAEA,cAAc;AAChB,GAaaE,KAA2B;AAAA,EACtC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,UAAU;AAAA,EACV,aAAa;AAAA,EACb,cAAc;AAAA,EACd,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,gBAAgB;AAClB;"}
|
|
1
|
+
{"version":3,"file":"plugin-DivbaxSZ.js","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 getReferralCode: () => null,\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","s","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":";;;AAqCO,SAASA,EAAgB;AAAA,EAC9B,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AACd,GAAyB;AACvB,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpCC,IAAcC,EAAuB,IAAI;AAG/C,EAAAC,EAAU,MAAM;AACd,aAASC,EAAmBC,GAAmB;AAC7C,MAAIJ,EAAY,WAAW,C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;AAAA,EACjB,gBAAgB;AAClB;"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),a=require("react"),U=require("./useAdminDeposits-CpLd68oP.cjs"),J=require("./StatsBar-DTUZCwDD.cjs");function se({refreshInterval:s=0,refreshSignal:o,className:h="",onLoad:w}){const{getStats:b,isLoading:i,error:v,clearError:p}=U.useAdminDeposits(),[g,q]=a.useState(null),[N,A]=a.useState(null),u=a.useCallback(async()=>{try{const d=await b();q(d),w?.(d),A(null)}catch(d){const k=d&&typeof d=="object"&&"message"in d?String(d.message):"Failed to load stats";A(k)}},[b,w]);a.useEffect(()=>{u()},[u]),a.useEffect(()=>{o!==void 0&&u()},[o,u]),a.useEffect(()=>{if(o!==void 0||s<=0)return;const d=setInterval(u,s);return()=>clearInterval(d)},[s,o,u]);const C=N||v;return C?e.jsxs("div",{className:`cedros-admin-stats ${h}`,children:[e.jsx("p",{className:"cedros-admin-error",children:C}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline",onClick:()=>{p(),A(null),u()},children:"Retry"})]}):i&&!g?e.jsx("div",{className:`cedros-admin-stats ${h}`,children:e.jsx(J.StatsBar,{stats:[{label:"Total Withdrawn",value:0},{label:"Pending Withdraw",value:0},{label:"In Privacy Period",value:0},{label:"Microbatch (SOL)",value:"0.0000"}],isLoading:!0})}):g?e.jsx("div",{className:`cedros-admin-stats ${h}`,children:e.jsx(J.StatsBar,{stats:[{label:"Total Withdrawn",value:g.totalWithdrawnCount},{label:"Pending Withdraw",value:g.pendingWithdrawalCount},{label:"In Privacy Period",value:g.inPrivacyPeriodCount??0},{label:"Microbatch (SOL)",value:g.readyForWithdrawalSol?.toFixed(4)??"0.0000"}],isLoading:i,onRefresh:u})}):null}function X(s){return s==null?"—":`${(s/1e9).toFixed(4)} SOL`}function Y(s){return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Z(s){return s.length<=12?s:`${s.slice(0,6)}...${s.slice(-4)}`}function te(s){const o=new Date(s),w=new Date().getTime()-o.getTime(),b=Math.floor(w/6e4),i=Math.floor(b/60),v=Math.floor(i/24);return v>0?`${v}d ago`:i>0?`${i}h ago`:b>0?`${b}m ago`:"just now"}function z(s){return s?new Date(s)>new Date:!0}function ae({pageSize:s=20,refreshInterval:o=0,refreshSignal:h,className:w="",onLoad:b,onItemClick:i,onWithdrawalProcessed:v,onAllProcessed:p}){const{listPendingWithdrawals:g,processWithdrawal:q,processAllWithdrawals:N,isLoading:A,error:u,clearError:C}=U.useAdminDeposits(),[d,k]=a.useState([]),[T,E]=a.useState(0),[c,W]=a.useState(0),[f,D]=a.useState(null),[y,n]=a.useState("withdrawalAvailableAt"),[l,O]=a.useState("asc"),L=t=>{y===t?O(l==="asc"?"desc":"asc"):(n(t),O(t==="withdrawalAvailableAt"?"asc":"desc"))},K=a.useMemo(()=>[...d].sort((t,x)=>{let j,$;switch(y){case"userId":j=t.userId.toLowerCase(),$=x.userId.toLowerCase();break;case"amountLamports":j=t.amountLamports??0,$=x.amountLamports??0;break;case"withdrawalAvailableAt":j=t.withdrawalAvailableAt?new Date(t.withdrawalAvailableAt).getTime():0,$=x.withdrawalAvailableAt?new Date(x.withdrawalAvailableAt).getTime():0;break;default:return 0}return j<$?l==="asc"?-1:1:j>$?l==="asc"?1:-1:0}),[d,y,l]),[R,r]=a.useState(null),[m,I]=a.useState(!1),[P,M]=a.useState(null),[F,_]=a.useState(null),S=a.useCallback(async()=>{try{const t=await g({limit:s,offset:c});k(t.deposits),E(t.total),b?.(t),D(null)}catch(t){const x=t&&typeof t=="object"&&"message"in t?String(t.message):"Failed to load pending withdrawals";D(x)}},[s,c,g,b]);a.useEffect(()=>{W(0)},[s]),a.useEffect(()=>{S()},[S]),a.useEffect(()=>{h!==void 0&&S()},[h,S]),a.useEffect(()=>{if(h!==void 0||o<=0)return;const t=setInterval(S,o);return()=>clearInterval(t)},[o,h,S]),a.useEffect(()=>{if(!P)return;const t=setTimeout(()=>M(null),5e3);return()=>clearTimeout(t)},[P]);const V=Math.ceil(T/s),H=Math.floor(c/s)+1,B=t=>{const x=(t-1)*s;W(Math.max(0,Math.min(x,Math.max(0,T-1))))},Q=async(t,x=!1)=>{if(!x&&z(t.withdrawalAvailableAt)){_(t);return}r(t.id),M(null);try{const j=await q(t.id,{force:x});j.success?(M({type:"success",message:`Withdrawal processed: ${j.txSignature?.slice(0,12)}...`}),v?.(j),await S()):M({type:"error",message:j.error||"Failed to process withdrawal"})}catch(j){M({type:"error",message:j instanceof Error?j.message:"Failed to process withdrawal"})}finally{r(null),_(null)}},ee=async()=>{if(d.length!==0){I(!0),M(null);try{const t=await N();t.totalSucceeded>0?M({type:"success",message:`Processed ${t.totalSucceeded}/${t.totalProcessed} withdrawals`}):t.totalFailed>0&&M({type:"error",message:`Failed to process ${t.totalFailed} withdrawals`}),p?.(t),await S()}catch(t){M({type:"error",message:t instanceof Error?t.message:"Failed to process withdrawals"})}finally{I(!1)}}},G=f||u;return G?e.jsxs("div",{className:`cedros-admin-withdrawal-queue cedros-admin-withdrawal-queue-error ${w}`,children:[e.jsx("p",{className:"cedros-admin-error",children:G}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline",onClick:()=>{C(),D(null),S()},children:"Retry"})]}):A&&d.length===0&&!R&&!m?e.jsxs("div",{className:`cedros-admin-withdrawal-queue cedros-admin-withdrawal-queue-loading ${w}`,children:[e.jsx("span",{className:"cedros-admin-loading-indicator"}),e.jsx("span",{className:"cedros-admin-loading-text",children:"Loading withdrawal queue..."})]}):e.jsxs("div",{className:`cedros-admin-withdrawal-queue ${w}`,children:[F&&e.jsx("div",{className:"cedros-admin-modal-overlay",onClick:()=>_(null),onKeyDown:t=>t.key==="Escape"&&_(null),role:"dialog","aria-modal":"true","aria-labelledby":"early-withdrawal-title",children:e.jsxs("div",{className:"cedros-admin-modal cedros-admin-modal-warning",onClick:t=>t.stopPropagation(),onKeyDown:()=>{},role:"document",children:[e.jsx("h3",{id:"early-withdrawal-title",className:"cedros-admin-modal-title",children:"Early Withdrawal Warning"}),e.jsxs("div",{className:"cedros-admin-modal-content",children:[e.jsx("p",{className:"cedros-admin-modal-warning-text",children:e.jsx("strong",{children:"This deposit is still within its privacy period."})}),e.jsx("p",{children:"Processing this withdrawal early may compromise user privacy. The privacy period exists to provide plausible deniability for deposits."}),e.jsxs("p",{className:"cedros-admin-modal-details",children:["User: ",Z(F.userId),e.jsx("br",{}),"Amount: ",X(F.amountLamports),e.jsx("br",{}),"Available at:"," ",F.withdrawalAvailableAt?Y(F.withdrawalAvailableAt):"—"]}),e.jsx("p",{children:"Are you sure you want to process this withdrawal early?"})]}),e.jsxs("div",{className:"cedros-admin-modal-actions",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline",onClick:()=>_(null),children:"Cancel"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-danger",onClick:()=>Q(F,!0),disabled:R===F.id,children:R===F.id?"Processing...":"Process Early"})]})]})}),P&&e.jsx("div",{className:`cedros-admin-result cedros-admin-result-${P.type}`,role:"status","aria-live":"polite",children:P.message}),e.jsxs("div",{className:"cedros-admin-withdrawal-queue-header",children:[e.jsx("h4",{className:"cedros-admin-withdrawal-queue-title",children:"Pending Withdrawals"}),e.jsxs("div",{className:"cedros-admin-withdrawal-queue-actions",children:[e.jsxs("span",{className:"cedros-admin-queue-count",children:[T," pending"]}),e.jsx("button",{type:"button",className:"cedros-admin__stats-bar-refresh",onClick:S,disabled:A||m,title:"Refresh queue","aria-label":"Refresh queue",children:A&&!m?"...":"↻"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary cedros-button-sm",onClick:ee,disabled:A||m||d.length===0,title:"Process all ready withdrawals",children:m?"Processing...":"Process All"})]})]}),d.length===0?e.jsx("div",{className:"cedros-admin-empty",children:e.jsx("p",{className:"cedros-admin-empty-message",children:"No pending withdrawals."})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cedros-admin-withdrawal-table",children:[e.jsxs("div",{className:"cedros-admin-withdrawal-thead",children:[e.jsx("div",{className:"cedros-admin-withdrawal-th",children:e.jsxs("button",{type:"button",className:`cedros-admin-sort-button ${y==="userId"?"cedros-admin-sort-active":""}`,onClick:()=>L("userId"),"aria-label":"Sort by user",children:["User"," ",e.jsx("span",{className:"cedros-admin-sort-icon",children:y==="userId"?l==="asc"?"↑":"↓":"↕"})]})}),e.jsx("div",{className:"cedros-admin-withdrawal-th",children:e.jsxs("button",{type:"button",className:`cedros-admin-sort-button ${y==="amountLamports"?"cedros-admin-sort-active":""}`,onClick:()=>L("amountLamports"),"aria-label":"Sort by amount",children:["Amount"," ",e.jsx("span",{className:"cedros-admin-sort-icon",children:y==="amountLamports"?l==="asc"?"↑":"↓":"↕"})]})}),e.jsx("div",{className:"cedros-admin-withdrawal-th",children:e.jsxs("button",{type:"button",className:`cedros-admin-sort-button ${y==="withdrawalAvailableAt"?"cedros-admin-sort-active":""}`,onClick:()=>L("withdrawalAvailableAt"),"aria-label":"Sort by ready since",children:["Ready Since"," ",e.jsx("span",{className:"cedros-admin-sort-icon",children:y==="withdrawalAvailableAt"?l==="asc"?"↑":"↓":"↕"})]})}),e.jsx("div",{className:"cedros-admin-withdrawal-th",children:"Waiting"}),e.jsx("div",{className:"cedros-admin-withdrawal-th cedros-admin-withdrawal-th-action",children:"Action"})]}),K.map(t=>{const x=z(t.withdrawalAvailableAt),j=R===t.id;return e.jsxs("div",{className:`cedros-admin-withdrawal-row ${x?"cedros-admin-withdrawal-row-early":""}`,onClick:()=>i?.(t),onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),i?.(t))},role:i?"button":void 0,tabIndex:i?0:void 0,children:[e.jsx("div",{className:"cedros-admin-withdrawal-td",title:t.userId,children:Z(t.userId)}),e.jsx("div",{className:"cedros-admin-withdrawal-td",children:X(t.amountLamports)}),e.jsx("div",{className:"cedros-admin-withdrawal-td",children:t.withdrawalAvailableAt?Y(t.withdrawalAvailableAt):"—"}),e.jsx("div",{className:"cedros-admin-withdrawal-td cedros-admin-withdrawal-waiting",children:t.withdrawalAvailableAt?x?"In privacy period":te(t.withdrawalAvailableAt):"—"}),e.jsx("div",{className:"cedros-admin-withdrawal-td cedros-admin-withdrawal-td-action",children:e.jsx("button",{type:"button",className:`cedros-button cedros-button-sm ${x?"cedros-button-warning":"cedros-button-primary"}`,onClick:$=>{$.stopPropagation(),Q(t)},disabled:j||m,title:x?"Early withdrawal (requires confirmation)":"Process this withdrawal",children:j?"...":x?"Early":"Process"})})]},t.id)})]}),V>1&&e.jsxs("div",{className:"cedros-admin-pagination",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>B(H-1),disabled:H<=1,children:"Previous"}),e.jsxs("span",{className:"cedros-admin-page-info",children:["Page ",H," of ",V," (",T," total)"]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>B(H+1),disabled:H>=V,children:"Next"})]})]})]})}function re(s){return s==null?"—":`${(s/1e9).toFixed(4)} SOL`}function ie(s){return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function ne(s){return s.length<=12?s:`${s.slice(0,6)}...${s.slice(-4)}`}function oe(s){const o=new Date(s),h=new Date,w=o.getTime()-h.getTime();if(w<=0)return"Ready";const b=Math.floor(w/6e4),i=Math.floor(b/60),v=Math.floor(i/24);if(v>0){const p=i%24;return p>0?`${v}d ${p}h`:`${v}d`}if(i>0){const p=b%60;return p>0?`${i}h ${p}m`:`${i}h`}return`${b}m`}function de({pageSize:s=20,refreshInterval:o=0,refreshSignal:h,className:w="",onLoad:b,onItemClick:i}){const{listInPrivacyPeriod:v,isLoading:p,error:g,clearError:q}=U.useAdminDeposits(),[N,A]=a.useState([]),[u,C]=a.useState(0),[d,k]=a.useState(0),[T,E]=a.useState(null),c=a.useCallback(async()=>{try{const n=await v({limit:s,offset:d});A(n.deposits),C(n.total),b?.(n),E(null)}catch(n){const l=n&&typeof n=="object"&&"message"in n?String(n.message):"Failed to load deposits";E(l)}},[s,d,v,b]);a.useEffect(()=>{k(0)},[s]),a.useEffect(()=>{c()},[c]),a.useEffect(()=>{h!==void 0&&c()},[h,c]),a.useEffect(()=>{if(h!==void 0||o<=0)return;const n=setInterval(c,o);return()=>clearInterval(n)},[o,h,c]);const W=Math.ceil(u/s),f=Math.floor(d/s)+1,D=n=>{const l=(n-1)*s;k(Math.max(0,Math.min(l,Math.max(0,u-1))))},y=T||g;return y?e.jsxs("div",{className:`cedros-admin-privacy-deposits cedros-admin-privacy-deposits-error ${w}`,children:[e.jsx("p",{className:"cedros-admin-error",children:y}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline",onClick:()=>{q(),E(null),c()},children:"Retry"})]}):p&&N.length===0?e.jsxs("div",{className:`cedros-admin-privacy-deposits cedros-admin-privacy-deposits-loading ${w}`,children:[e.jsx("span",{className:"cedros-admin-loading-indicator"}),e.jsx("span",{className:"cedros-admin-loading-text",children:"Loading deposits..."})]}):e.jsxs("div",{className:`cedros-admin-privacy-deposits ${w}`,children:[e.jsxs("div",{className:"cedros-admin-privacy-deposits-header",children:[e.jsx("h4",{className:"cedros-admin-privacy-deposits-title",children:"In Privacy Period"}),e.jsxs("div",{className:"cedros-admin-privacy-deposits-actions",children:[e.jsxs("span",{className:"cedros-admin-queue-count",children:[u," deposit",u!==1?"s":""]}),e.jsx("button",{type:"button",className:"cedros-admin__stats-bar-refresh",onClick:c,disabled:p,title:"Refresh list","aria-label":"Refresh list",children:p?"...":"↻"})]})]}),N.length===0?e.jsx("div",{className:"cedros-admin-empty",children:e.jsx("p",{className:"cedros-admin-empty-message",children:"No deposits in privacy period."})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cedros-admin-privacy-table",children:[e.jsxs("div",{className:"cedros-admin-privacy-thead",children:[e.jsx("div",{className:"cedros-admin-privacy-th",children:e.jsxs("button",{type:"button",className:"cedros-admin-sort-button","aria-label":"Sort by user",children:["User ",e.jsx("span",{className:"cedros-admin-sort-icon",children:"↕"})]})}),e.jsx("div",{className:"cedros-admin-privacy-th",children:e.jsxs("button",{type:"button",className:"cedros-admin-sort-button","aria-label":"Sort by amount",children:["Amount ",e.jsx("span",{className:"cedros-admin-sort-icon",children:"↕"})]})}),e.jsx("div",{className:"cedros-admin-privacy-th",children:e.jsxs("button",{type:"button",className:"cedros-admin-sort-button","aria-label":"Sort by deposited",children:["Deposited ",e.jsx("span",{className:"cedros-admin-sort-icon",children:"↕"})]})}),e.jsx("div",{className:"cedros-admin-privacy-th",children:e.jsxs("button",{type:"button",className:"cedros-admin-sort-button","aria-label":"Sort by ready in",children:["Ready In ",e.jsx("span",{className:"cedros-admin-sort-icon",children:"↕"})]})})]}),N.map(n=>e.jsxs("div",{className:"cedros-admin-privacy-row",onClick:()=>i?.(n),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),i?.(n))},role:i?"button":void 0,tabIndex:i?0:void 0,children:[e.jsx("div",{className:"cedros-admin-privacy-td",title:n.userId,children:ne(n.userId)}),e.jsx("div",{className:"cedros-admin-privacy-td",children:re(n.amountLamports)}),e.jsx("div",{className:"cedros-admin-privacy-td",children:n.completedAt?ie(n.completedAt):"—"}),e.jsx("div",{className:"cedros-admin-privacy-td cedros-admin-privacy-remaining",children:n.withdrawalAvailableAt?oe(n.withdrawalAvailableAt):"—"})]},n.id))]}),W>1&&e.jsxs("div",{className:"cedros-admin-pagination",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>D(f-1),disabled:f<=1,children:"Previous"}),e.jsxs("span",{className:"cedros-admin-page-info",children:["Page ",f," of ",W," (",u," total)"]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>D(f+1),disabled:f>=W,children:"Next"})]})]})]})}function ce(s){return s==null?"—":`${(s/1e9).toFixed(4)} SOL`}function le(s){return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function ue(s){return s.length<=16?s:`${s.slice(0,8)}...${s.slice(-6)}`}function me(s){return s.length<=12?s:`${s.slice(0,6)}...${s.slice(-4)}`}function he({pageSize:s=20,refreshInterval:o=0,refreshSignal:h,className:w="",onLoad:b,onItemClick:i}){const{listDeposits:v,isLoading:p,error:g,clearError:q}=U.useAdminDeposits(),[N,A]=a.useState([]),[u,C]=a.useState(0),[d,k]=a.useState(0),[T,E]=a.useState(null),[c,W]=a.useState("completedAt"),[f,D]=a.useState("desc"),y=r=>{c===r?D(f==="asc"?"desc":"asc"):(W(r),D("desc"))},n=a.useMemo(()=>[...N].sort((r,m)=>{let I,P;switch(c){case"userId":I=r.userId.toLowerCase(),P=m.userId.toLowerCase();break;case"amountLamports":I=r.amountLamports??0,P=m.amountLamports??0;break;case"completedAt":I=r.completedAt?new Date(r.completedAt).getTime():0,P=m.completedAt?new Date(m.completedAt).getTime():0;break;case"withdrawalTxSignature":I=r.withdrawalTxSignature||"",P=m.withdrawalTxSignature||"";break;default:return 0}return I<P?f==="asc"?-1:1:I>P?f==="asc"?1:-1:0}),[N,c,f]),l=a.useCallback(async()=>{try{const r=await v({status:"withdrawn",limit:s,offset:d});A(r.deposits),C(r.total),b?.(r),E(null)}catch(r){const m=r&&typeof r=="object"&&"message"in r?String(r.message):"Failed to load withdrawal history";E(m)}},[s,d,v,b]);a.useEffect(()=>{k(0)},[s]),a.useEffect(()=>{l()},[l]),a.useEffect(()=>{h!==void 0&&l()},[h,l]),a.useEffect(()=>{if(h!==void 0||o<=0)return;const r=setInterval(l,o);return()=>clearInterval(r)},[o,h,l]);const O=Math.ceil(u/s),L=Math.floor(d/s)+1,K=r=>{const m=(r-1)*s;k(Math.max(0,Math.min(m,Math.max(0,u-1))))},R=T||g;return R?e.jsxs("div",{className:`cedros-admin-withdrawal-history cedros-admin-withdrawal-history-error ${w}`,children:[e.jsx("p",{className:"cedros-admin-error",children:R}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline",onClick:()=>{q(),E(null),l()},children:"Retry"})]}):p&&N.length===0?e.jsxs("div",{className:`cedros-admin-withdrawal-history cedros-admin-withdrawal-history-loading ${w}`,children:[e.jsx("span",{className:"cedros-admin-loading-indicator"}),e.jsx("span",{className:"cedros-admin-loading-text",children:"Loading withdrawal history..."})]}):e.jsxs("div",{className:`cedros-admin-withdrawal-history ${w}`,children:[e.jsxs("div",{className:"cedros-admin-withdrawal-history-header",children:[e.jsx("h4",{className:"cedros-admin-withdrawal-history-title",children:"Withdrawal History"}),e.jsxs("div",{className:"cedros-admin-withdrawal-history-actions",children:[e.jsxs("span",{className:"cedros-admin-queue-count",children:[u," withdrawal",u!==1?"s":""]}),e.jsx("button",{type:"button",className:"cedros-admin__stats-bar-refresh",onClick:l,disabled:p,title:"Refresh list","aria-label":"Refresh list",children:p?"...":"↻"})]})]}),N.length===0?e.jsx("div",{className:"cedros-admin-empty",children:e.jsx("p",{className:"cedros-admin-empty-message",children:"No withdrawals processed yet."})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cedros-admin-history-table",children:[e.jsxs("div",{className:"cedros-admin-history-thead",children:[e.jsx("div",{className:"cedros-admin-history-th",children:e.jsxs("button",{type:"button",className:`cedros-admin-sort-button ${c==="userId"?"cedros-admin-sort-active":""}`,onClick:()=>y("userId"),"aria-label":"Sort by user",children:["User"," ",e.jsx("span",{className:"cedros-admin-sort-icon",children:c==="userId"?f==="asc"?"↑":"↓":"↕"})]})}),e.jsx("div",{className:"cedros-admin-history-th",children:e.jsxs("button",{type:"button",className:`cedros-admin-sort-button ${c==="amountLamports"?"cedros-admin-sort-active":""}`,onClick:()=>y("amountLamports"),"aria-label":"Sort by amount",children:["Amount"," ",e.jsx("span",{className:"cedros-admin-sort-icon",children:c==="amountLamports"?f==="asc"?"↑":"↓":"↕"})]})}),e.jsx("div",{className:"cedros-admin-history-th",children:e.jsxs("button",{type:"button",className:`cedros-admin-sort-button ${c==="completedAt"?"cedros-admin-sort-active":""}`,onClick:()=>y("completedAt"),"aria-label":"Sort by processed",children:["Processed"," ",e.jsx("span",{className:"cedros-admin-sort-icon",children:c==="completedAt"?f==="asc"?"↑":"↓":"↕"})]})}),e.jsx("div",{className:"cedros-admin-history-th",children:e.jsxs("button",{type:"button",className:`cedros-admin-sort-button ${c==="withdrawalTxSignature"?"cedros-admin-sort-active":""}`,onClick:()=>y("withdrawalTxSignature"),"aria-label":"Sort by transaction",children:["Transaction"," ",e.jsx("span",{className:"cedros-admin-sort-icon",children:c==="withdrawalTxSignature"?f==="asc"?"↑":"↓":"↕"})]})})]}),n.map(r=>e.jsxs("div",{className:"cedros-admin-history-row",onClick:()=>i?.(r),onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),i?.(r))},role:i?"button":void 0,tabIndex:i?0:void 0,children:[e.jsx("div",{className:"cedros-admin-history-td",title:r.userId,children:me(r.userId)}),e.jsx("div",{className:"cedros-admin-history-td",children:ce(r.amountLamports)}),e.jsx("div",{className:"cedros-admin-history-td",children:r.completedAt?le(r.completedAt):"—"}),e.jsx("div",{className:"cedros-admin-history-td",children:r.withdrawalTxSignature?e.jsx("a",{href:`https://orbmarkets.io/tx/${r.withdrawalTxSignature}`,target:"_blank",rel:"noopener noreferrer",className:"cedros-admin-tx-link",onClick:m=>m.stopPropagation(),title:r.withdrawalTxSignature,children:ue(r.withdrawalTxSignature)}):"—"})]},r.id))]}),O>1&&e.jsxs("div",{className:"cedros-admin-pagination",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>K(L-1),disabled:L<=1,children:"Previous"}),e.jsxs("span",{className:"cedros-admin-page-info",children:["Page ",L," of ",O," (",u," total)"]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>K(L+1),disabled:L>=O,children:"Next"})]})]})]})}exports.AdminPrivacyPeriodDeposits=de;exports.AdminWithdrawalHistory=he;exports.AdminWithdrawalQueue=ae;exports.AdminWithdrawalStats=se;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AdminWithdrawalHistory-B2EY2ZmH.cjs","sources":["../src/components/deposit/admin/AdminWithdrawalStats.tsx","../src/components/deposit/admin/AdminWithdrawalQueue.tsx","../src/components/deposit/admin/AdminPrivacyPeriodDeposits.tsx","../src/components/deposit/admin/AdminWithdrawalHistory.tsx"],"sourcesContent":["/**\n * Admin withdrawal statistics component\n *\n * Shows high-level withdrawal pipeline stats in a single row.\n */\n\nimport { useState, useEffect, useCallback } from 'react';\nimport { useAdminDeposits } from '../../../hooks/useAdminDeposits';\nimport type { AdminDepositStatsResponse } from '../../../types/deposit';\nimport { FeatureDisabledMessage } from './FeatureDisabledMessage';\nimport { isFeatureDisabledError } from './featureDisabled';\nimport { StatsBar } from '../../admin/StatsBar';\n\nexport interface AdminWithdrawalStatsProps {\n /** Auto-refresh interval in milliseconds (0 to disable) */\n refreshInterval?: number;\n /** External refresh signal from parent coordinator */\n refreshSignal?: number;\n /** Additional CSS classes */\n className?: string;\n /** Callback when stats are loaded */\n onLoad?: (stats: AdminDepositStatsResponse) => void;\n}\n\nexport function AdminWithdrawalStats({\n refreshInterval = 0,\n refreshSignal,\n className = '',\n onLoad,\n}: AdminWithdrawalStatsProps) {\n const { getStats, isLoading, error, clearError } = useAdminDeposits();\n\n const [stats, setStats] = useState<AdminDepositStatsResponse | null>(null);\n const [loadError, setLoadError] = useState<string | null>(null);\n\n const fetchStats = useCallback(async () => {\n try {\n const result = await getStats();\n setStats(result);\n onLoad?.(result);\n setLoadError(null);\n } catch (err) {\n const message =\n err && typeof err === 'object' && 'message' in err\n ? String((err as { message: unknown }).message)\n : 'Failed to load stats';\n setLoadError(message);\n }\n }, [getStats, onLoad]);\n\n useEffect(() => {\n fetchStats();\n }, [fetchStats]);\n\n useEffect(() => {\n if (refreshSignal === undefined) return;\n fetchStats();\n }, [refreshSignal, fetchStats]);\n\n useEffect(() => {\n if (refreshSignal !== undefined) return;\n if (refreshInterval <= 0) return;\n const interval = setInterval(fetchStats, refreshInterval);\n return () => clearInterval(interval);\n }, [refreshInterval, refreshSignal, fetchStats]);\n\n const errorMessage = loadError || error;\n if (isFeatureDisabledError(errorMessage)) {\n return <FeatureDisabledMessage feature=\"Privacy Cash\" className={className} />;\n }\n\n if (errorMessage) {\n return (\n <div className={`cedros-admin-stats ${className}`}>\n <p className=\"cedros-admin-error\">{errorMessage}</p>\n <button\n type=\"button\"\n className=\"cedros-button cedros-button-outline\"\n onClick={() => {\n clearError();\n setLoadError(null);\n fetchStats();\n }}\n >\n Retry\n </button>\n </div>\n );\n }\n\n if (isLoading && !stats) {\n return (\n <div className={`cedros-admin-stats ${className}`}>\n <StatsBar\n stats={[\n { label: 'Total Withdrawn', value: 0 },\n { label: 'Pending Withdraw', value: 0 },\n { label: 'In Privacy Period', value: 0 },\n { label: 'Microbatch (SOL)', value: '0.0000' },\n ]}\n isLoading\n />\n </div>\n );\n }\n\n if (!stats) return null;\n\n return (\n <div className={`cedros-admin-stats ${className}`}>\n <StatsBar\n stats={[\n { label: 'Total Withdrawn', value: stats.totalWithdrawnCount },\n { label: 'Pending Withdraw', value: stats.pendingWithdrawalCount },\n { label: 'In Privacy Period', value: stats.inPrivacyPeriodCount ?? 0 },\n { label: 'Microbatch (SOL)', value: stats.readyForWithdrawalSol?.toFixed(4) ?? '0.0000' },\n ]}\n isLoading={isLoading}\n onRefresh={fetchStats}\n />\n </div>\n );\n}\n","/**\n * Admin withdrawal queue component\n *\n * Shows deposits that are ready for withdrawal (privacy period elapsed).\n * Includes buttons to process individual or all withdrawals.\n * Requires system admin privileges.\n */\n\nimport { useState, useEffect, useCallback, useMemo } from 'react';\nimport { useAdminDeposits } from '../../../hooks/useAdminDeposits';\nimport type {\n AdminDepositItem,\n AdminDepositListResponse,\n ProcessWithdrawalResponse,\n ProcessAllWithdrawalsResponse,\n} from '../../../types/deposit';\nimport { FeatureDisabledMessage } from './FeatureDisabledMessage';\nimport { isFeatureDisabledError } from './featureDisabled';\n\ntype QueueSortField = 'userId' | 'amountLamports' | 'withdrawalAvailableAt';\ntype SortOrder = 'asc' | 'desc';\n\nexport interface AdminWithdrawalQueueProps {\n /** Number of items per page (default: 20) */\n pageSize?: number;\n /** Auto-refresh interval in milliseconds (0 to disable) */\n refreshInterval?: number;\n /** External refresh signal from parent coordinator */\n refreshSignal?: number;\n /** Additional CSS classes */\n className?: string;\n /** Callback when list is loaded */\n onLoad?: (response: AdminDepositListResponse) => void;\n /** Callback when a withdrawal item is clicked */\n onItemClick?: (item: AdminDepositItem) => void;\n /** Callback when a withdrawal is processed */\n onWithdrawalProcessed?: (response: ProcessWithdrawalResponse) => void;\n /** Callback when all withdrawals are processed */\n onAllProcessed?: (response: ProcessAllWithdrawalsResponse) => void;\n}\n\nfunction formatAmount(lamports: number | null): string {\n if (lamports === null || lamports === undefined) return '—';\n const solAmount = lamports / 1_000_000_000;\n return `${solAmount.toFixed(4)} SOL`;\n}\n\nfunction formatDate(dateString: string): string {\n const date = new Date(dateString);\n return date.toLocaleDateString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n });\n}\n\nfunction truncateId(id: string): string {\n if (id.length <= 12) return id;\n return `${id.slice(0, 6)}...${id.slice(-4)}`;\n}\n\nfunction getTimeElapsed(dateString: string): string {\n const date = new Date(dateString);\n const now = new Date();\n const diffMs = now.getTime() - date.getTime();\n const diffMins = Math.floor(diffMs / 60000);\n const diffHours = Math.floor(diffMins / 60);\n const diffDays = Math.floor(diffHours / 24);\n\n if (diffDays > 0) return `${diffDays}d ago`;\n if (diffHours > 0) return `${diffHours}h ago`;\n if (diffMins > 0) return `${diffMins}m ago`;\n return 'just now';\n}\n\nfunction isWithinPrivacyPeriod(withdrawalAvailableAt: string | undefined): boolean {\n if (!withdrawalAvailableAt) return true;\n return new Date(withdrawalAvailableAt) > new Date();\n}\n\n/**\n * Admin withdrawal queue display\n *\n * Shows deposits ready for withdrawal processing with action buttons.\n */\nexport function AdminWithdrawalQueue({\n pageSize = 20,\n refreshInterval = 0,\n refreshSignal,\n className = '',\n onLoad,\n onItemClick,\n onWithdrawalProcessed,\n onAllProcessed,\n}: AdminWithdrawalQueueProps) {\n const {\n listPendingWithdrawals,\n processWithdrawal,\n processAllWithdrawals,\n isLoading,\n error,\n clearError,\n } = useAdminDeposits();\n\n const [items, setItems] = useState<AdminDepositItem[]>([]);\n const [total, setTotal] = useState(0);\n const [offset, setOffset] = useState(0);\n const [loadError, setLoadError] = useState<string | null>(null);\n const [sortField, setSortField] = useState<QueueSortField>('withdrawalAvailableAt');\n const [sortOrder, setSortOrder] = useState<SortOrder>('asc');\n\n const toggleSort = (field: QueueSortField) => {\n if (sortField === field) {\n setSortOrder(sortOrder === 'asc' ? 'desc' : 'asc');\n } else {\n setSortField(field);\n setSortOrder(field === 'withdrawalAvailableAt' ? 'asc' : 'desc');\n }\n };\n\n const sortedItems = useMemo(() => {\n return [...items].sort((a, b) => {\n let aVal: string | number;\n let bVal: string | number;\n\n switch (sortField) {\n case 'userId':\n aVal = a.userId.toLowerCase();\n bVal = b.userId.toLowerCase();\n break;\n case 'amountLamports':\n aVal = a.amountLamports ?? 0;\n bVal = b.amountLamports ?? 0;\n break;\n case 'withdrawalAvailableAt':\n aVal = a.withdrawalAvailableAt ? new Date(a.withdrawalAvailableAt).getTime() : 0;\n bVal = b.withdrawalAvailableAt ? new Date(b.withdrawalAvailableAt).getTime() : 0;\n break;\n default:\n return 0;\n }\n\n if (aVal < bVal) return sortOrder === 'asc' ? -1 : 1;\n if (aVal > bVal) return sortOrder === 'asc' ? 1 : -1;\n return 0;\n });\n }, [items, sortField, sortOrder]);\n\n // Processing state\n const [processingId, setProcessingId] = useState<string | null>(null);\n const [processingAll, setProcessingAll] = useState(false);\n const [processResult, setProcessResult] = useState<{\n type: 'success' | 'error';\n message: string;\n } | null>(null);\n\n // Early withdrawal confirmation modal\n const [earlyWithdrawalItem, setEarlyWithdrawalItem] = useState<AdminDepositItem | null>(null);\n\n const fetchItems = useCallback(async () => {\n try {\n const result = await listPendingWithdrawals({ limit: pageSize, offset });\n setItems(result.deposits);\n setTotal(result.total);\n onLoad?.(result);\n setLoadError(null);\n } catch (err) {\n const message =\n err && typeof err === 'object' && 'message' in err\n ? String((err as { message: unknown }).message)\n : 'Failed to load pending withdrawals';\n setLoadError(message);\n }\n }, [pageSize, offset, listPendingWithdrawals, onLoad]);\n\n // Reset offset when page size changes\n useEffect(() => {\n setOffset(0);\n }, [pageSize]);\n\n // Fetch on mount and when dependencies change\n useEffect(() => {\n fetchItems();\n }, [fetchItems]);\n\n useEffect(() => {\n if (refreshSignal === undefined) return;\n fetchItems();\n }, [refreshSignal, fetchItems]);\n\n // Auto-refresh\n useEffect(() => {\n if (refreshSignal !== undefined) return;\n if (refreshInterval <= 0) return;\n\n const interval = setInterval(fetchItems, refreshInterval);\n return () => clearInterval(interval);\n }, [refreshInterval, refreshSignal, fetchItems]);\n\n // Clear result message after 5 seconds\n useEffect(() => {\n if (!processResult) return;\n const timer = setTimeout(() => setProcessResult(null), 5000);\n return () => clearTimeout(timer);\n }, [processResult]);\n\n const totalPages = Math.ceil(total / pageSize);\n const currentPage = Math.floor(offset / pageSize) + 1;\n\n const goToPage = (page: number) => {\n const newOffset = (page - 1) * pageSize;\n setOffset(Math.max(0, Math.min(newOffset, Math.max(0, total - 1))));\n };\n\n const handleProcessSingle = async (item: AdminDepositItem, force = false) => {\n // Check if within privacy period and not forcing\n if (!force && isWithinPrivacyPeriod(item.withdrawalAvailableAt)) {\n setEarlyWithdrawalItem(item);\n return;\n }\n\n setProcessingId(item.id);\n setProcessResult(null);\n\n try {\n const result = await processWithdrawal(item.id, { force });\n if (result.success) {\n setProcessResult({\n type: 'success',\n message: `Withdrawal processed: ${result.txSignature?.slice(0, 12)}...`,\n });\n onWithdrawalProcessed?.(result);\n // Refresh the list\n await fetchItems();\n } else {\n setProcessResult({\n type: 'error',\n message: result.error || 'Failed to process withdrawal',\n });\n }\n } catch (err) {\n setProcessResult({\n type: 'error',\n message: err instanceof Error ? err.message : 'Failed to process withdrawal',\n });\n } finally {\n setProcessingId(null);\n setEarlyWithdrawalItem(null);\n }\n };\n\n const handleProcessAll = async () => {\n if (items.length === 0) return;\n\n setProcessingAll(true);\n setProcessResult(null);\n\n try {\n const result = await processAllWithdrawals();\n if (result.totalSucceeded > 0) {\n setProcessResult({\n type: 'success',\n message: `Processed ${result.totalSucceeded}/${result.totalProcessed} withdrawals`,\n });\n } else if (result.totalFailed > 0) {\n setProcessResult({\n type: 'error',\n message: `Failed to process ${result.totalFailed} withdrawals`,\n });\n }\n onAllProcessed?.(result);\n // Refresh the list\n await fetchItems();\n } catch (err) {\n setProcessResult({\n type: 'error',\n message: err instanceof Error ? err.message : 'Failed to process withdrawals',\n });\n } finally {\n setProcessingAll(false);\n }\n };\n\n // Feature disabled state\n const errorMessage = loadError || error;\n if (isFeatureDisabledError(errorMessage)) {\n return <FeatureDisabledMessage feature=\"Privacy Cash\" className={className} />;\n }\n\n // Error state\n if (errorMessage) {\n return (\n <div\n className={`cedros-admin-withdrawal-queue cedros-admin-withdrawal-queue-error ${className}`}\n >\n <p className=\"cedros-admin-error\">{errorMessage}</p>\n <button\n type=\"button\"\n className=\"cedros-button cedros-button-outline\"\n onClick={() => {\n clearError();\n setLoadError(null);\n fetchItems();\n }}\n >\n Retry\n </button>\n </div>\n );\n }\n\n // Loading state (initial load only)\n if (isLoading && items.length === 0 && !processingId && !processingAll) {\n return (\n <div\n className={`cedros-admin-withdrawal-queue cedros-admin-withdrawal-queue-loading ${className}`}\n >\n <span className=\"cedros-admin-loading-indicator\" />\n <span className=\"cedros-admin-loading-text\">Loading withdrawal queue...</span>\n </div>\n );\n }\n\n return (\n <div className={`cedros-admin-withdrawal-queue ${className}`}>\n {/* Early Withdrawal Confirmation Modal */}\n {earlyWithdrawalItem && (\n <div\n className=\"cedros-admin-modal-overlay\"\n onClick={() => setEarlyWithdrawalItem(null)}\n onKeyDown={(e) => e.key === 'Escape' && setEarlyWithdrawalItem(null)}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"early-withdrawal-title\"\n >\n <div\n className=\"cedros-admin-modal cedros-admin-modal-warning\"\n onClick={(e) => e.stopPropagation()}\n onKeyDown={() => {}}\n role=\"document\"\n >\n <h3 id=\"early-withdrawal-title\" className=\"cedros-admin-modal-title\">\n Early Withdrawal Warning\n </h3>\n <div className=\"cedros-admin-modal-content\">\n <p className=\"cedros-admin-modal-warning-text\">\n <strong>This deposit is still within its privacy period.</strong>\n </p>\n <p>\n Processing this withdrawal early may compromise user privacy. The privacy period\n exists to provide plausible deniability for deposits.\n </p>\n <p className=\"cedros-admin-modal-details\">\n User: {truncateId(earlyWithdrawalItem.userId)}\n <br />\n Amount: {formatAmount(earlyWithdrawalItem.amountLamports)}\n <br />\n Available at:{' '}\n {earlyWithdrawalItem.withdrawalAvailableAt\n ? formatDate(earlyWithdrawalItem.withdrawalAvailableAt)\n : '—'}\n </p>\n <p>Are you sure you want to process this withdrawal early?</p>\n </div>\n <div className=\"cedros-admin-modal-actions\">\n <button\n type=\"button\"\n className=\"cedros-button cedros-button-outline\"\n onClick={() => setEarlyWithdrawalItem(null)}\n >\n Cancel\n </button>\n <button\n type=\"button\"\n className=\"cedros-button cedros-button-danger\"\n onClick={() => handleProcessSingle(earlyWithdrawalItem, true)}\n disabled={processingId === earlyWithdrawalItem.id}\n >\n {processingId === earlyWithdrawalItem.id ? 'Processing...' : 'Process Early'}\n </button>\n </div>\n </div>\n </div>\n )}\n\n {/* Result message */}\n {processResult && (\n <div\n className={`cedros-admin-result cedros-admin-result-${processResult.type}`}\n role=\"status\"\n aria-live=\"polite\"\n >\n {processResult.message}\n </div>\n )}\n\n <div className=\"cedros-admin-withdrawal-queue-header\">\n <h4 className=\"cedros-admin-withdrawal-queue-title\">Pending Withdrawals</h4>\n <div className=\"cedros-admin-withdrawal-queue-actions\">\n <span className=\"cedros-admin-queue-count\">{total} pending</span>\n <button\n type=\"button\"\n className=\"cedros-admin__stats-bar-refresh\"\n onClick={fetchItems}\n disabled={isLoading || processingAll}\n title=\"Refresh queue\"\n aria-label=\"Refresh queue\"\n >\n {isLoading && !processingAll ? '...' : '↻'}\n </button>\n <button\n type=\"button\"\n className=\"cedros-button cedros-button-primary cedros-button-sm\"\n onClick={handleProcessAll}\n disabled={isLoading || processingAll || items.length === 0}\n title=\"Process all ready withdrawals\"\n >\n {processingAll ? 'Processing...' : 'Process All'}\n </button>\n </div>\n </div>\n\n {items.length === 0 ? (\n <div className=\"cedros-admin-empty\">\n <p className=\"cedros-admin-empty-message\">No pending withdrawals.</p>\n </div>\n ) : (\n <>\n <div className=\"cedros-admin-withdrawal-table\">\n <div className=\"cedros-admin-withdrawal-thead\">\n <div className=\"cedros-admin-withdrawal-th\">\n <button\n type=\"button\"\n className={`cedros-admin-sort-button ${sortField === 'userId' ? 'cedros-admin-sort-active' : ''}`}\n onClick={() => toggleSort('userId')}\n aria-label=\"Sort by user\"\n >\n User{' '}\n <span className=\"cedros-admin-sort-icon\">\n {sortField === 'userId' ? (sortOrder === 'asc' ? '↑' : '↓') : '↕'}\n </span>\n </button>\n </div>\n <div className=\"cedros-admin-withdrawal-th\">\n <button\n type=\"button\"\n className={`cedros-admin-sort-button ${sortField === 'amountLamports' ? 'cedros-admin-sort-active' : ''}`}\n onClick={() => toggleSort('amountLamports')}\n aria-label=\"Sort by amount\"\n >\n Amount{' '}\n <span className=\"cedros-admin-sort-icon\">\n {sortField === 'amountLamports' ? (sortOrder === 'asc' ? '↑' : '↓') : '↕'}\n </span>\n </button>\n </div>\n <div className=\"cedros-admin-withdrawal-th\">\n <button\n type=\"button\"\n className={`cedros-admin-sort-button ${sortField === 'withdrawalAvailableAt' ? 'cedros-admin-sort-active' : ''}`}\n onClick={() => toggleSort('withdrawalAvailableAt')}\n aria-label=\"Sort by ready since\"\n >\n Ready Since{' '}\n <span className=\"cedros-admin-sort-icon\">\n {sortField === 'withdrawalAvailableAt'\n ? sortOrder === 'asc'\n ? '↑'\n : '↓'\n : '↕'}\n </span>\n </button>\n </div>\n <div className=\"cedros-admin-withdrawal-th\">Waiting</div>\n <div className=\"cedros-admin-withdrawal-th cedros-admin-withdrawal-th-action\">\n Action\n </div>\n </div>\n {sortedItems.map((item) => {\n const withinPrivacyPeriod = isWithinPrivacyPeriod(item.withdrawalAvailableAt);\n const isProcessing = processingId === item.id;\n\n return (\n <div\n key={item.id}\n className={`cedros-admin-withdrawal-row ${withinPrivacyPeriod ? 'cedros-admin-withdrawal-row-early' : ''}`}\n onClick={() => onItemClick?.(item)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onItemClick?.(item);\n }\n }}\n role={onItemClick ? 'button' : undefined}\n tabIndex={onItemClick ? 0 : undefined}\n >\n <div className=\"cedros-admin-withdrawal-td\" title={item.userId}>\n {truncateId(item.userId)}\n </div>\n <div className=\"cedros-admin-withdrawal-td\">\n {formatAmount(item.amountLamports)}\n </div>\n <div className=\"cedros-admin-withdrawal-td\">\n {item.withdrawalAvailableAt ? formatDate(item.withdrawalAvailableAt) : '—'}\n </div>\n <div className=\"cedros-admin-withdrawal-td cedros-admin-withdrawal-waiting\">\n {item.withdrawalAvailableAt\n ? withinPrivacyPeriod\n ? 'In privacy period'\n : getTimeElapsed(item.withdrawalAvailableAt)\n : '—'}\n </div>\n <div className=\"cedros-admin-withdrawal-td cedros-admin-withdrawal-td-action\">\n <button\n type=\"button\"\n className={`cedros-button cedros-button-sm ${withinPrivacyPeriod ? 'cedros-button-warning' : 'cedros-button-primary'}`}\n onClick={(e) => {\n e.stopPropagation();\n handleProcessSingle(item);\n }}\n disabled={isProcessing || processingAll}\n title={\n withinPrivacyPeriod\n ? 'Early withdrawal (requires confirmation)'\n : 'Process this withdrawal'\n }\n >\n {isProcessing ? '...' : withinPrivacyPeriod ? 'Early' : 'Process'}\n </button>\n </div>\n </div>\n );\n })}\n </div>\n\n {totalPages > 1 && (\n <div className=\"cedros-admin-pagination\">\n <button\n type=\"button\"\n className=\"cedros-button cedros-button-outline cedros-button-sm\"\n onClick={() => goToPage(currentPage - 1)}\n disabled={currentPage <= 1}\n >\n Previous\n </button>\n <span className=\"cedros-admin-page-info\">\n Page {currentPage} of {totalPages} ({total} total)\n </span>\n <button\n type=\"button\"\n className=\"cedros-button cedros-button-outline cedros-button-sm\"\n onClick={() => goToPage(currentPage + 1)}\n disabled={currentPage >= totalPages}\n >\n Next\n </button>\n </div>\n )}\n </>\n )}\n </div>\n );\n}\n","/**\n * Admin privacy period deposits component\n *\n * Shows deposits that are still in the privacy period (completed but not yet ready for withdrawal).\n * Requires system admin privileges.\n */\n\nimport { useState, useEffect, useCallback } from 'react';\nimport { useAdminDeposits } from '../../../hooks/useAdminDeposits';\nimport type { AdminDepositItem, AdminDepositListResponse } from '../../../types/deposit';\nimport { FeatureDisabledMessage } from './FeatureDisabledMessage';\nimport { isFeatureDisabledError } from './featureDisabled';\n\nexport interface AdminPrivacyPeriodDepositsProps {\n /** Number of items per page (default: 20) */\n pageSize?: number;\n /** Auto-refresh interval in milliseconds (0 to disable) */\n refreshInterval?: number;\n /** External refresh signal from parent coordinator */\n refreshSignal?: number;\n /** Additional CSS classes */\n className?: string;\n /** Callback when list is loaded */\n onLoad?: (response: AdminDepositListResponse) => void;\n /** Callback when a deposit item is clicked */\n onItemClick?: (item: AdminDepositItem) => void;\n}\n\nfunction formatAmount(lamports: number | null): string {\n if (lamports === null || lamports === undefined) return '—';\n const solAmount = lamports / 1_000_000_000;\n return `${solAmount.toFixed(4)} SOL`;\n}\n\nfunction formatDate(dateString: string): string {\n const date = new Date(dateString);\n return date.toLocaleDateString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n });\n}\n\nfunction truncateId(id: string): string {\n if (id.length <= 12) return id;\n return `${id.slice(0, 6)}...${id.slice(-4)}`;\n}\n\nfunction getTimeRemaining(dateString: string): string {\n const date = new Date(dateString);\n const now = new Date();\n const diffMs = date.getTime() - now.getTime();\n\n if (diffMs <= 0) return 'Ready';\n\n const diffMins = Math.floor(diffMs / 60000);\n const diffHours = Math.floor(diffMins / 60);\n const diffDays = Math.floor(diffHours / 24);\n\n if (diffDays > 0) {\n const remainingHours = diffHours % 24;\n return remainingHours > 0 ? `${diffDays}d ${remainingHours}h` : `${diffDays}d`;\n }\n if (diffHours > 0) {\n const remainingMins = diffMins % 60;\n return remainingMins > 0 ? `${diffHours}h ${remainingMins}m` : `${diffHours}h`;\n }\n return `${diffMins}m`;\n}\n\n/**\n * Admin privacy period deposits display\n *\n * Shows deposits that are still in the privacy period (not yet available for withdrawal).\n */\nexport function AdminPrivacyPeriodDeposits({\n pageSize = 20,\n refreshInterval = 0,\n refreshSignal,\n className = '',\n onLoad,\n onItemClick,\n}: AdminPrivacyPeriodDepositsProps) {\n const { listInPrivacyPeriod, isLoading, error, clearError } = useAdminDeposits();\n\n const [items, setItems] = useState<AdminDepositItem[]>([]);\n const [total, setTotal] = useState(0);\n const [offset, setOffset] = useState(0);\n const [loadError, setLoadError] = useState<string | null>(null);\n\n const fetchItems = useCallback(async () => {\n try {\n const result = await listInPrivacyPeriod({ limit: pageSize, offset });\n setItems(result.deposits);\n setTotal(result.total);\n onLoad?.(result);\n setLoadError(null);\n } catch (err) {\n const message =\n err && typeof err === 'object' && 'message' in err\n ? String((err as { message: unknown }).message)\n : 'Failed to load deposits';\n setLoadError(message);\n }\n }, [pageSize, offset, listInPrivacyPeriod, onLoad]);\n\n // Reset offset when page size changes\n useEffect(() => {\n setOffset(0);\n }, [pageSize]);\n\n // Fetch on mount and when dependencies change\n useEffect(() => {\n fetchItems();\n }, [fetchItems]);\n\n useEffect(() => {\n if (refreshSignal === undefined) return;\n fetchItems();\n }, [refreshSignal, fetchItems]);\n\n // Auto-refresh\n useEffect(() => {\n if (refreshSignal !== undefined) return;\n if (refreshInterval <= 0) return;\n\n const interval = setInterval(fetchItems, refreshInterval);\n return () => clearInterval(interval);\n }, [refreshInterval, refreshSignal, fetchItems]);\n\n const totalPages = Math.ceil(total / pageSize);\n const currentPage = Math.floor(offset / pageSize) + 1;\n\n const goToPage = (page: number) => {\n const newOffset = (page - 1) * pageSize;\n setOffset(Math.max(0, Math.min(newOffset, Math.max(0, total - 1))));\n };\n\n // Feature disabled state\n const errorMessage = loadError || error;\n if (isFeatureDisabledError(errorMessage)) {\n return <FeatureDisabledMessage feature=\"Privacy Cash\" className={className} />;\n }\n\n // Error state\n if (errorMessage) {\n return (\n <div\n className={`cedros-admin-privacy-deposits cedros-admin-privacy-deposits-error ${className}`}\n >\n <p className=\"cedros-admin-error\">{errorMessage}</p>\n <button\n type=\"button\"\n className=\"cedros-button cedros-button-outline\"\n onClick={() => {\n clearError();\n setLoadError(null);\n fetchItems();\n }}\n >\n Retry\n </button>\n </div>\n );\n }\n\n // Loading state (initial load only)\n if (isLoading && items.length === 0) {\n return (\n <div\n className={`cedros-admin-privacy-deposits cedros-admin-privacy-deposits-loading ${className}`}\n >\n <span className=\"cedros-admin-loading-indicator\" />\n <span className=\"cedros-admin-loading-text\">Loading deposits...</span>\n </div>\n );\n }\n\n return (\n <div className={`cedros-admin-privacy-deposits ${className}`}>\n <div className=\"cedros-admin-privacy-deposits-header\">\n <h4 className=\"cedros-admin-privacy-deposits-title\">In Privacy Period</h4>\n <div className=\"cedros-admin-privacy-deposits-actions\">\n <span className=\"cedros-admin-queue-count\">\n {total} deposit{total !== 1 ? 's' : ''}\n </span>\n <button\n type=\"button\"\n className=\"cedros-admin__stats-bar-refresh\"\n onClick={fetchItems}\n disabled={isLoading}\n title=\"Refresh list\"\n aria-label=\"Refresh list\"\n >\n {isLoading ? '...' : '↻'}\n </button>\n </div>\n </div>\n\n {items.length === 0 ? (\n <div className=\"cedros-admin-empty\">\n <p className=\"cedros-admin-empty-message\">No deposits in privacy period.</p>\n </div>\n ) : (\n <>\n <div className=\"cedros-admin-privacy-table\">\n <div className=\"cedros-admin-privacy-thead\">\n <div className=\"cedros-admin-privacy-th\">\n <button\n type=\"button\"\n className=\"cedros-admin-sort-button\"\n aria-label=\"Sort by user\"\n >\n User <span className=\"cedros-admin-sort-icon\">↕</span>\n </button>\n </div>\n <div className=\"cedros-admin-privacy-th\">\n <button\n type=\"button\"\n className=\"cedros-admin-sort-button\"\n aria-label=\"Sort by amount\"\n >\n Amount <span className=\"cedros-admin-sort-icon\">↕</span>\n </button>\n </div>\n <div className=\"cedros-admin-privacy-th\">\n <button\n type=\"button\"\n className=\"cedros-admin-sort-button\"\n aria-label=\"Sort by deposited\"\n >\n Deposited <span className=\"cedros-admin-sort-icon\">↕</span>\n </button>\n </div>\n <div className=\"cedros-admin-privacy-th\">\n <button\n type=\"button\"\n className=\"cedros-admin-sort-button\"\n aria-label=\"Sort by ready in\"\n >\n Ready In <span className=\"cedros-admin-sort-icon\">↕</span>\n </button>\n </div>\n </div>\n {items.map((item) => (\n <div\n key={item.id}\n className=\"cedros-admin-privacy-row\"\n onClick={() => onItemClick?.(item)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onItemClick?.(item);\n }\n }}\n role={onItemClick ? 'button' : undefined}\n tabIndex={onItemClick ? 0 : undefined}\n >\n <div className=\"cedros-admin-privacy-td\" title={item.userId}>\n {truncateId(item.userId)}\n </div>\n <div className=\"cedros-admin-privacy-td\">{formatAmount(item.amountLamports)}</div>\n <div className=\"cedros-admin-privacy-td\">\n {item.completedAt ? formatDate(item.completedAt) : '—'}\n </div>\n <div className=\"cedros-admin-privacy-td cedros-admin-privacy-remaining\">\n {item.withdrawalAvailableAt ? getTimeRemaining(item.withdrawalAvailableAt) : '—'}\n </div>\n </div>\n ))}\n </div>\n\n {totalPages > 1 && (\n <div className=\"cedros-admin-pagination\">\n <button\n type=\"button\"\n className=\"cedros-button cedros-button-outline cedros-button-sm\"\n onClick={() => goToPage(currentPage - 1)}\n disabled={currentPage <= 1}\n >\n Previous\n </button>\n <span className=\"cedros-admin-page-info\">\n Page {currentPage} of {totalPages} ({total} total)\n </span>\n <button\n type=\"button\"\n className=\"cedros-button cedros-button-outline cedros-button-sm\"\n onClick={() => goToPage(currentPage + 1)}\n disabled={currentPage >= totalPages}\n >\n Next\n </button>\n </div>\n )}\n </>\n )}\n </div>\n );\n}\n","/**\n * Admin withdrawal history component\n *\n * Shows deposits that have been fully withdrawn (processed).\n * Requires system admin privileges.\n */\n\nimport { useState, useEffect, useCallback, useMemo } from 'react';\nimport { useAdminDeposits } from '../../../hooks/useAdminDeposits';\nimport type { AdminDepositItem, AdminDepositListResponse } from '../../../types/deposit';\nimport { FeatureDisabledMessage } from './FeatureDisabledMessage';\nimport { isFeatureDisabledError } from './featureDisabled';\n\ntype WithdrawalSortField = 'userId' | 'amountLamports' | 'completedAt' | 'withdrawalTxSignature';\ntype SortOrder = 'asc' | 'desc';\n\nexport interface AdminWithdrawalHistoryProps {\n /** Number of items per page (default: 20) */\n pageSize?: number;\n /** Auto-refresh interval in milliseconds (0 to disable) */\n refreshInterval?: number;\n /** External refresh signal from parent coordinator */\n refreshSignal?: number;\n /** Additional CSS classes */\n className?: string;\n /** Callback when list is loaded */\n onLoad?: (response: AdminDepositListResponse) => void;\n /** Callback when a withdrawal item is clicked */\n onItemClick?: (item: AdminDepositItem) => void;\n}\n\nfunction formatAmount(lamports: number | null): string {\n if (lamports === null || lamports === undefined) return '—';\n const solAmount = lamports / 1_000_000_000;\n return `${solAmount.toFixed(4)} SOL`;\n}\n\nfunction formatDate(dateString: string): string {\n const date = new Date(dateString);\n return date.toLocaleDateString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n });\n}\n\nfunction truncateSignature(sig: string): string {\n if (sig.length <= 16) return sig;\n return `${sig.slice(0, 8)}...${sig.slice(-6)}`;\n}\n\nfunction truncateId(id: string): string {\n if (id.length <= 12) return id;\n return `${id.slice(0, 6)}...${id.slice(-4)}`;\n}\n\n/**\n * Admin withdrawal history display\n *\n * Shows deposits that have been fully withdrawn.\n */\nexport function AdminWithdrawalHistory({\n pageSize = 20,\n refreshInterval = 0,\n refreshSignal,\n className = '',\n onLoad,\n onItemClick,\n}: AdminWithdrawalHistoryProps) {\n const { listDeposits, isLoading, error, clearError } = useAdminDeposits();\n\n const [items, setItems] = useState<AdminDepositItem[]>([]);\n const [total, setTotal] = useState(0);\n const [offset, setOffset] = useState(0);\n const [loadError, setLoadError] = useState<string | null>(null);\n const [sortField, setSortField] = useState<WithdrawalSortField>('completedAt');\n const [sortOrder, setSortOrder] = useState<SortOrder>('desc');\n\n const toggleSort = (field: WithdrawalSortField) => {\n if (sortField === field) {\n setSortOrder(sortOrder === 'asc' ? 'desc' : 'asc');\n } else {\n setSortField(field);\n setSortOrder('desc');\n }\n };\n\n const sortedItems = useMemo(() => {\n return [...items].sort((a, b) => {\n let aVal: string | number;\n let bVal: string | number;\n\n switch (sortField) {\n case 'userId':\n aVal = a.userId.toLowerCase();\n bVal = b.userId.toLowerCase();\n break;\n case 'amountLamports':\n aVal = a.amountLamports ?? 0;\n bVal = b.amountLamports ?? 0;\n break;\n case 'completedAt':\n aVal = a.completedAt ? new Date(a.completedAt).getTime() : 0;\n bVal = b.completedAt ? new Date(b.completedAt).getTime() : 0;\n break;\n case 'withdrawalTxSignature':\n aVal = a.withdrawalTxSignature || '';\n bVal = b.withdrawalTxSignature || '';\n break;\n default:\n return 0;\n }\n\n if (aVal < bVal) return sortOrder === 'asc' ? -1 : 1;\n if (aVal > bVal) return sortOrder === 'asc' ? 1 : -1;\n return 0;\n });\n }, [items, sortField, sortOrder]);\n\n const fetchItems = useCallback(async () => {\n try {\n const result = await listDeposits({ status: 'withdrawn', limit: pageSize, offset });\n setItems(result.deposits);\n setTotal(result.total);\n onLoad?.(result);\n setLoadError(null);\n } catch (err) {\n const message =\n err && typeof err === 'object' && 'message' in err\n ? String((err as { message: unknown }).message)\n : 'Failed to load withdrawal history';\n setLoadError(message);\n }\n }, [pageSize, offset, listDeposits, onLoad]);\n\n // Reset offset when page size changes\n useEffect(() => {\n setOffset(0);\n }, [pageSize]);\n\n // Fetch on mount and when dependencies change\n useEffect(() => {\n fetchItems();\n }, [fetchItems]);\n\n useEffect(() => {\n if (refreshSignal === undefined) return;\n fetchItems();\n }, [refreshSignal, fetchItems]);\n\n // Auto-refresh\n useEffect(() => {\n if (refreshSignal !== undefined) return;\n if (refreshInterval <= 0) return;\n\n const interval = setInterval(fetchItems, refreshInterval);\n return () => clearInterval(interval);\n }, [refreshInterval, refreshSignal, fetchItems]);\n\n const totalPages = Math.ceil(total / pageSize);\n const currentPage = Math.floor(offset / pageSize) + 1;\n\n const goToPage = (page: number) => {\n const newOffset = (page - 1) * pageSize;\n setOffset(Math.max(0, Math.min(newOffset, Math.max(0, total - 1))));\n };\n\n // Feature disabled state\n const errorMessage = loadError || error;\n if (isFeatureDisabledError(errorMessage)) {\n return <FeatureDisabledMessage feature=\"Privacy Cash\" className={className} />;\n }\n\n // Error state\n if (errorMessage) {\n return (\n <div\n className={`cedros-admin-withdrawal-history cedros-admin-withdrawal-history-error ${className}`}\n >\n <p className=\"cedros-admin-error\">{errorMessage}</p>\n <button\n type=\"button\"\n className=\"cedros-button cedros-button-outline\"\n onClick={() => {\n clearError();\n setLoadError(null);\n fetchItems();\n }}\n >\n Retry\n </button>\n </div>\n );\n }\n\n // Loading state (initial load only)\n if (isLoading && items.length === 0) {\n return (\n <div\n className={`cedros-admin-withdrawal-history cedros-admin-withdrawal-history-loading ${className}`}\n >\n <span className=\"cedros-admin-loading-indicator\" />\n <span className=\"cedros-admin-loading-text\">Loading withdrawal history...</span>\n </div>\n );\n }\n\n return (\n <div className={`cedros-admin-withdrawal-history ${className}`}>\n <div className=\"cedros-admin-withdrawal-history-header\">\n <h4 className=\"cedros-admin-withdrawal-history-title\">Withdrawal History</h4>\n <div className=\"cedros-admin-withdrawal-history-actions\">\n <span className=\"cedros-admin-queue-count\">\n {total} withdrawal{total !== 1 ? 's' : ''}\n </span>\n <button\n type=\"button\"\n className=\"cedros-admin__stats-bar-refresh\"\n onClick={fetchItems}\n disabled={isLoading}\n title=\"Refresh list\"\n aria-label=\"Refresh list\"\n >\n {isLoading ? '...' : '↻'}\n </button>\n </div>\n </div>\n\n {items.length === 0 ? (\n <div className=\"cedros-admin-empty\">\n <p className=\"cedros-admin-empty-message\">No withdrawals processed yet.</p>\n </div>\n ) : (\n <>\n <div className=\"cedros-admin-history-table\">\n <div className=\"cedros-admin-history-thead\">\n <div className=\"cedros-admin-history-th\">\n <button\n type=\"button\"\n className={`cedros-admin-sort-button ${sortField === 'userId' ? 'cedros-admin-sort-active' : ''}`}\n onClick={() => toggleSort('userId')}\n aria-label=\"Sort by user\"\n >\n User{' '}\n <span className=\"cedros-admin-sort-icon\">\n {sortField === 'userId' ? (sortOrder === 'asc' ? '↑' : '↓') : '↕'}\n </span>\n </button>\n </div>\n <div className=\"cedros-admin-history-th\">\n <button\n type=\"button\"\n className={`cedros-admin-sort-button ${sortField === 'amountLamports' ? 'cedros-admin-sort-active' : ''}`}\n onClick={() => toggleSort('amountLamports')}\n aria-label=\"Sort by amount\"\n >\n Amount{' '}\n <span className=\"cedros-admin-sort-icon\">\n {sortField === 'amountLamports' ? (sortOrder === 'asc' ? '↑' : '↓') : '↕'}\n </span>\n </button>\n </div>\n <div className=\"cedros-admin-history-th\">\n <button\n type=\"button\"\n className={`cedros-admin-sort-button ${sortField === 'completedAt' ? 'cedros-admin-sort-active' : ''}`}\n onClick={() => toggleSort('completedAt')}\n aria-label=\"Sort by processed\"\n >\n Processed{' '}\n <span className=\"cedros-admin-sort-icon\">\n {sortField === 'completedAt' ? (sortOrder === 'asc' ? '↑' : '↓') : '↕'}\n </span>\n </button>\n </div>\n <div className=\"cedros-admin-history-th\">\n <button\n type=\"button\"\n className={`cedros-admin-sort-button ${sortField === 'withdrawalTxSignature' ? 'cedros-admin-sort-active' : ''}`}\n onClick={() => toggleSort('withdrawalTxSignature')}\n aria-label=\"Sort by transaction\"\n >\n Transaction{' '}\n <span className=\"cedros-admin-sort-icon\">\n {sortField === 'withdrawalTxSignature'\n ? sortOrder === 'asc'\n ? '↑'\n : '↓'\n : '↕'}\n </span>\n </button>\n </div>\n </div>\n {sortedItems.map((item) => (\n <div\n key={item.id}\n className=\"cedros-admin-history-row\"\n onClick={() => onItemClick?.(item)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onItemClick?.(item);\n }\n }}\n role={onItemClick ? 'button' : undefined}\n tabIndex={onItemClick ? 0 : undefined}\n >\n <div className=\"cedros-admin-history-td\" title={item.userId}>\n {truncateId(item.userId)}\n </div>\n <div className=\"cedros-admin-history-td\">{formatAmount(item.amountLamports)}</div>\n <div className=\"cedros-admin-history-td\">\n {item.completedAt ? formatDate(item.completedAt) : '—'}\n </div>\n <div className=\"cedros-admin-history-td\">\n {item.withdrawalTxSignature ? (\n <a\n href={`https://orbmarkets.io/tx/${item.withdrawalTxSignature}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"cedros-admin-tx-link\"\n onClick={(e) => e.stopPropagation()}\n title={item.withdrawalTxSignature}\n >\n {truncateSignature(item.withdrawalTxSignature)}\n </a>\n ) : (\n '—'\n )}\n </div>\n </div>\n ))}\n </div>\n\n {totalPages > 1 && (\n <div className=\"cedros-admin-pagination\">\n <button\n type=\"button\"\n className=\"cedros-button cedros-button-outline cedros-button-sm\"\n onClick={() => goToPage(currentPage - 1)}\n disabled={currentPage <= 1}\n >\n Previous\n </button>\n <span className=\"cedros-admin-page-info\">\n Page {currentPage} of {totalPages} ({total} total)\n </span>\n <button\n type=\"button\"\n className=\"cedros-button cedros-button-outline cedros-button-sm\"\n onClick={() => goToPage(currentPage + 1)}\n disabled={currentPage >= totalPages}\n >\n Next\n </button>\n </div>\n )}\n </>\n )}\n </div>\n );\n}\n"],"names":["AdminWithdrawalStats","refreshInterval","refreshSignal","className","onLoad","getStats","isLoading","error","clearError","useAdminDeposits","stats","setStats","useState","loadError","setLoadError","fetchStats","useCallback","result","err","message","useEffect","interval","errorMessage","jsxs","jsx","StatsBar","formatAmount","lamports","formatDate","dateString","truncateId","id","getTimeElapsed","date","diffMs","diffMins","diffHours","diffDays","isWithinPrivacyPeriod","withdrawalAvailableAt","AdminWithdrawalQueue","pageSize","onItemClick","onWithdrawalProcessed","onAllProcessed","listPendingWithdrawals","processWithdrawal","processAllWithdrawals","items","setItems","total","setTotal","offset","setOffset","sortField","setSortField","sortOrder","setSortOrder","toggleSort","field","sortedItems","useMemo","a","b","aVal","bVal","processingId","setProcessingId","processingAll","setProcessingAll","processResult","setProcessResult","earlyWithdrawalItem","setEarlyWithdrawalItem","fetchItems","timer","totalPages","currentPage","goToPage","page","newOffset","handleProcessSingle","item","force","handleProcessAll","e","Fragment","withinPrivacyPeriod","isProcessing","getTimeRemaining","now","remainingHours","remainingMins","AdminPrivacyPeriodDeposits","listInPrivacyPeriod","truncateSignature","sig","AdminWithdrawalHistory","listDeposits"],"mappings":"uJAwBO,SAASA,GAAqB,CACnC,gBAAAC,EAAkB,EAClB,cAAAC,EACA,UAAAC,EAAY,GACZ,OAAAC,CACF,EAA8B,CAC5B,KAAM,CAAE,SAAAC,EAAU,UAAAC,EAAW,MAAAC,EAAO,WAAAC,CAAA,EAAeC,EAAAA,iBAAA,EAE7C,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAA2C,IAAI,EACnE,CAACC,EAAWC,CAAY,EAAIF,EAAAA,SAAwB,IAAI,EAExDG,EAAaC,EAAAA,YAAY,SAAY,CACzC,GAAI,CACF,MAAMC,EAAS,MAAMZ,EAAA,EACrBM,EAASM,CAAM,EACfb,IAASa,CAAM,EACfH,EAAa,IAAI,CACnB,OAASI,EAAK,CACZ,MAAMC,EACJD,GAAO,OAAOA,GAAQ,UAAY,YAAaA,EAC3C,OAAQA,EAA6B,OAAO,EAC5C,uBACNJ,EAAaK,CAAO,CACtB,CACF,EA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