@robosystems/core 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +252 -0
- package/actions/entity-actions.d.ts +8 -0
- package/actions/entity-actions.js +16 -0
- package/actions/graph-actions.d.ts +3 -0
- package/actions/graph-actions.js +13 -0
- package/auth-components/AppSwitcher.d.ts +6 -0
- package/auth-components/AppSwitcher.js +28 -0
- package/auth-components/AuthGuard.d.ts +7 -0
- package/auth-components/AuthGuard.js +31 -0
- package/auth-components/AuthProvider.d.ts +9 -0
- package/auth-components/AuthProvider.js +565 -0
- package/auth-components/SessionWarningDialog.d.ts +1 -0
- package/auth-components/SessionWarningDialog.js +51 -0
- package/auth-components/SignInForm.d.ts +20 -0
- package/auth-components/SignInForm.js +139 -0
- package/auth-components/SignUpForm.d.ts +15 -0
- package/auth-components/SignUpForm.js +167 -0
- package/auth-components/TurnstileWidget.d.ts +99 -0
- package/auth-components/TurnstileWidget.js +224 -0
- package/auth-components/index.d.ts +6 -0
- package/auth-components/index.js +6 -0
- package/auth-core/cleanup.d.ts +44 -0
- package/auth-core/cleanup.js +157 -0
- package/auth-core/client.d.ts +121 -0
- package/auth-core/client.js +767 -0
- package/auth-core/config.d.ts +19 -0
- package/auth-core/config.js +56 -0
- package/auth-core/hooks.d.ts +19 -0
- package/auth-core/hooks.js +63 -0
- package/auth-core/index.d.ts +6 -0
- package/auth-core/index.js +6 -0
- package/auth-core/sso.d.ts +42 -0
- package/auth-core/sso.js +281 -0
- package/auth-core/token-storage.d.ts +58 -0
- package/auth-core/token-storage.js +177 -0
- package/auth-core/types.d.ts +145 -0
- package/auth-core/types.js +1 -0
- package/components/EntitySelector.d.ts +44 -0
- package/components/EntitySelector.js +64 -0
- package/components/EntitySelectorCore.d.ts +45 -0
- package/components/EntitySelectorCore.js +67 -0
- package/components/GraphSelectorCore.d.ts +21 -0
- package/components/GraphSelectorCore.js +39 -0
- package/components/PageLayout.d.ts +8 -0
- package/components/PageLayout.js +5 -0
- package/components/RepositoryGuard.d.ts +68 -0
- package/components/RepositoryGuard.js +91 -0
- package/components/console/ConsoleContent.d.ts +4 -0
- package/components/console/ConsoleContent.js +612 -0
- package/components/console/ConsoleMarkdown.d.ts +11 -0
- package/components/console/ConsoleMarkdown.js +49 -0
- package/components/console/ProgressiveText.d.ts +6 -0
- package/components/console/ProgressiveText.js +21 -0
- package/components/console/graphAwareConfig.d.ts +70 -0
- package/components/console/graphAwareConfig.js +411 -0
- package/components/console/index.d.ts +6 -0
- package/components/console/index.js +4 -0
- package/components/console/types.d.ts +84 -0
- package/components/console/types.js +1 -0
- package/components/graph-filters.d.ts +75 -0
- package/components/graph-filters.js +111 -0
- package/components/index.d.ts +10 -0
- package/components/index.js +9 -0
- package/components/repositories/ActiveSubscriptions.d.ts +26 -0
- package/components/repositories/ActiveSubscriptions.js +103 -0
- package/components/repositories/BrowseRepositories.d.ts +11 -0
- package/components/repositories/BrowseRepositories.js +184 -0
- package/components/repositories/index.d.ts +2 -0
- package/components/repositories/index.js +2 -0
- package/components/search/SearchContent.d.ts +4 -0
- package/components/search/SearchContent.js +168 -0
- package/components/search/index.d.ts +2 -0
- package/components/search/index.js +1 -0
- package/components/search/types.d.ts +15 -0
- package/components/search/types.js +1 -0
- package/contexts/entity-context.d.ts +28 -0
- package/contexts/entity-context.js +89 -0
- package/contexts/graph-context.d.ts +27 -0
- package/contexts/graph-context.js +128 -0
- package/contexts/index.d.ts +5 -0
- package/contexts/index.js +5 -0
- package/contexts/org-context.d.ts +25 -0
- package/contexts/org-context.js +64 -0
- package/contexts/service-offerings-context.d.ts +45 -0
- package/contexts/service-offerings-context.js +98 -0
- package/contexts/sidebar-context.d.ts +18 -0
- package/contexts/sidebar-context.js +44 -0
- package/hooks/index.d.ts +6 -0
- package/hooks/index.js +6 -0
- package/hooks/use-api-error.d.ts +3 -0
- package/hooks/use-api-error.js +24 -0
- package/hooks/use-media-query.d.ts +1 -0
- package/hooks/use-media-query.js +21 -0
- package/hooks/use-streaming-query.d.ts +22 -0
- package/hooks/use-streaming-query.js +142 -0
- package/hooks/use-toast.d.ts +37 -0
- package/hooks/use-toast.js +117 -0
- package/hooks/use-user-limits.d.ts +12 -0
- package/hooks/use-user-limits.js +73 -0
- package/hooks/use-user.d.ts +11 -0
- package/hooks/use-user.js +39 -0
- package/index.d.ts +29 -0
- package/index.js +77 -0
- package/lib/entity-cookie.d.ts +10 -0
- package/lib/entity-cookie.js +38 -0
- package/lib/graph-cookie.d.ts +11 -0
- package/lib/graph-cookie.js +62 -0
- package/lib/graph-tiers.d.ts +41 -0
- package/lib/graph-tiers.js +107 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +3 -0
- package/lib/sidebar-cookie.d.ts +11 -0
- package/lib/sidebar-cookie.js +42 -0
- package/library/colors.d.ts +4 -0
- package/library/colors.js +41 -0
- package/library/components/ClassificationPicker.d.ts +8 -0
- package/library/components/ClassificationPicker.js +55 -0
- package/library/components/ElementBrowser.d.ts +11 -0
- package/library/components/ElementBrowser.js +106 -0
- package/library/components/ElementDetail.d.ts +7 -0
- package/library/components/ElementDetail.js +97 -0
- package/library/components/LibraryHierarchy.d.ts +13 -0
- package/library/components/LibraryHierarchy.js +380 -0
- package/library/components/TaxonomySidebar.d.ts +6 -0
- package/library/components/TaxonomySidebar.js +45 -0
- package/library/index.d.ts +8 -0
- package/library/index.js +7 -0
- package/package.json +37 -0
- package/research/CoverageCard.d.ts +12 -0
- package/research/CoverageCard.js +15 -0
- package/research/CoverageGrid.d.ts +6 -0
- package/research/CoverageGrid.js +9 -0
- package/research/CoverageHistory.d.ts +5 -0
- package/research/CoverageHistory.js +7 -0
- package/research/ResearchArticle.d.ts +15 -0
- package/research/ResearchArticle.js +26 -0
- package/research/catalog.d.ts +14 -0
- package/research/catalog.js +42 -0
- package/research/index.d.ts +6 -0
- package/research/index.js +9 -0
- package/research/types.d.ts +38 -0
- package/research/types.js +4 -0
- package/task-monitoring/hooks.d.ts +26 -0
- package/task-monitoring/hooks.js +126 -0
- package/task-monitoring/index.d.ts +5 -0
- package/task-monitoring/index.js +7 -0
- package/task-monitoring/operationErrors.d.ts +82 -0
- package/task-monitoring/operationErrors.js +251 -0
- package/task-monitoring/operationHooks.d.ts +117 -0
- package/task-monitoring/operationHooks.js +536 -0
- package/task-monitoring/operationMonitor.d.ts +78 -0
- package/task-monitoring/operationMonitor.js +200 -0
- package/task-monitoring/operationTypes.d.ts +236 -0
- package/task-monitoring/operationTypes.js +60 -0
- package/task-monitoring/taskMonitor.d.ts +14 -0
- package/task-monitoring/taskMonitor.js +132 -0
- package/task-monitoring/types.d.ts +31 -0
- package/task-monitoring/types.js +1 -0
- package/theme/flowbite-theme.d.ts +758 -0
- package/theme/flowbite-theme.js +765 -0
- package/theme/index.d.ts +1 -0
- package/theme/index.js +1 -0
- package/types/entity.d.ts +19 -0
- package/types/index.d.ts +2 -0
- package/types/index.js +1 -0
- package/types/user.d.ts +6 -0
- package/ui-components/ConfirmModal.d.ts +41 -0
- package/ui-components/ConfirmModal.js +19 -0
- package/ui-components/EmptyState.d.ts +22 -0
- package/ui-components/EmptyState.js +10 -0
- package/ui-components/LoadingState.d.ts +27 -0
- package/ui-components/LoadingState.js +12 -0
- package/ui-components/Logo.d.ts +28 -0
- package/ui-components/Logo.js +95 -0
- package/ui-components/Spinner.d.ts +37 -0
- package/ui-components/Spinner.js +48 -0
- package/ui-components/StatCard.d.ts +21 -0
- package/ui-components/StatCard.js +10 -0
- package/ui-components/api-keys/ApiKeyDisplay.d.ts +13 -0
- package/ui-components/api-keys/ApiKeyDisplay.js +7 -0
- package/ui-components/api-keys/ApiKeyTable.d.ts +9 -0
- package/ui-components/api-keys/ApiKeyTable.js +17 -0
- package/ui-components/api-keys/ApiKeysCard.d.ts +6 -0
- package/ui-components/api-keys/ApiKeysCard.js +97 -0
- package/ui-components/api-keys/CreateApiKeyModal.d.ts +11 -0
- package/ui-components/api-keys/CreateApiKeyModal.js +47 -0
- package/ui-components/api-keys/SecureApiKeyField.d.ts +13 -0
- package/ui-components/api-keys/SecureApiKeyField.js +64 -0
- package/ui-components/api-keys/index.d.ts +5 -0
- package/ui-components/api-keys/index.js +5 -0
- package/ui-components/chat/ChatHeader.d.ts +12 -0
- package/ui-components/chat/ChatHeader.js +5 -0
- package/ui-components/chat/ChatInputArea.d.ts +16 -0
- package/ui-components/chat/ChatInputArea.js +9 -0
- package/ui-components/chat/ChatMessage.d.ts +7 -0
- package/ui-components/chat/ChatMessage.js +24 -0
- package/ui-components/chat/DeepResearchToggle.d.ts +8 -0
- package/ui-components/chat/DeepResearchToggle.js +13 -0
- package/ui-components/chat/index.d.ts +9 -0
- package/ui-components/chat/index.js +8 -0
- package/ui-components/chat/types.d.ts +23 -0
- package/ui-components/chat/types.js +51 -0
- package/ui-components/forms/PasswordRequirements.d.ts +10 -0
- package/ui-components/forms/PasswordRequirements.js +15 -0
- package/ui-components/forms/SettingsCard.d.ts +11 -0
- package/ui-components/forms/SettingsCard.js +5 -0
- package/ui-components/forms/SettingsFormField.d.ts +18 -0
- package/ui-components/forms/SettingsFormField.js +17 -0
- package/ui-components/forms/StatusAlert.d.ts +8 -0
- package/ui-components/forms/StatusAlert.js +7 -0
- package/ui-components/forms/index.d.ts +4 -0
- package/ui-components/forms/index.js +4 -0
- package/ui-components/index.d.ts +13 -0
- package/ui-components/index.js +18 -0
- package/ui-components/layout/CoreNavbar.d.ts +14 -0
- package/ui-components/layout/CoreNavbar.js +53 -0
- package/ui-components/layout/CoreSidebar.d.ts +28 -0
- package/ui-components/layout/CoreSidebar.js +62 -0
- package/ui-components/layout/LandingFooter.d.ts +28 -0
- package/ui-components/layout/LandingFooter.js +34 -0
- package/ui-components/layout/PageContainer.d.ts +8 -0
- package/ui-components/layout/PageContainer.js +17 -0
- package/ui-components/layout/PageHeader.d.ts +23 -0
- package/ui-components/layout/PageHeader.js +12 -0
- package/ui-components/layout/SettingsContainer.d.ts +10 -0
- package/ui-components/layout/SettingsContainer.js +9 -0
- package/ui-components/layout/ThemeToggle.d.ts +4 -0
- package/ui-components/layout/ThemeToggle.js +6 -0
- package/ui-components/layout/index.d.ts +7 -0
- package/ui-components/layout/index.js +7 -0
- package/ui-components/settings/GeneralInformationCard.d.ts +12 -0
- package/ui-components/settings/GeneralInformationCard.js +72 -0
- package/ui-components/settings/PasswordInformationCard.d.ts +10 -0
- package/ui-components/settings/PasswordInformationCard.js +167 -0
- package/ui-components/settings/SettingsPageHeader.d.ts +7 -0
- package/ui-components/settings/SettingsPageHeader.js +6 -0
- package/ui-components/settings/index.d.ts +3 -0
- package/ui-components/settings/index.js +3 -0
- package/ui-components/support/SupportModal.d.ts +15 -0
- package/ui-components/support/SupportModal.js +74 -0
- package/ui-components/support/index.d.ts +2 -0
- package/ui-components/support/index.js +1 -0
- package/ui-components/types/index.d.ts +39 -0
- package/ui-components/types/index.js +1 -0
- package/utils/index.d.ts +31 -0
- package/utils/index.js +38 -0
- package/utils/turnstile-config.d.ts +11 -0
- package/utils/turnstile-config.js +19 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useAuth } from '../auth-components';
|
|
4
|
+
export function useUser() {
|
|
5
|
+
const { user: authUser, isLoading, isAuthenticated, refreshUser } = useAuth();
|
|
6
|
+
// Transform AuthUser to User format with graceful defaults for malformed data
|
|
7
|
+
const user = useMemo(() => {
|
|
8
|
+
if (!authUser)
|
|
9
|
+
return null;
|
|
10
|
+
// If authUser is not an object, return null
|
|
11
|
+
if (typeof authUser !== 'object' || authUser === null) {
|
|
12
|
+
if (process.env.NODE_ENV === 'development' &&
|
|
13
|
+
typeof jest === 'undefined') {
|
|
14
|
+
console.warn('AuthUser is not a valid object:', authUser);
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
// Gracefully handle malformed user data by providing safe defaults
|
|
19
|
+
const safeId = typeof authUser.id === 'string' ? authUser.id : '';
|
|
20
|
+
const safeEmail = typeof authUser.email === 'string' ? authUser.email : '';
|
|
21
|
+
const safeName = typeof authUser.name === 'string' ? authUser.name : '';
|
|
22
|
+
// Log warnings for malformed data in development (but not in tests)
|
|
23
|
+
if (process.env.NODE_ENV === 'development' && typeof jest === 'undefined') {
|
|
24
|
+
if (typeof authUser.id !== 'string' || !authUser.id) {
|
|
25
|
+
console.warn('AuthUser has invalid id field:', authUser.id);
|
|
26
|
+
}
|
|
27
|
+
if (typeof authUser.email !== 'string' || !authUser.email) {
|
|
28
|
+
console.warn('AuthUser has invalid email field:', authUser.email);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
id: safeId,
|
|
33
|
+
name: safeName,
|
|
34
|
+
email: safeEmail,
|
|
35
|
+
emailVerified: authUser.emailVerified,
|
|
36
|
+
};
|
|
37
|
+
}, [authUser]);
|
|
38
|
+
return { user, isLoading, isAuthenticated, refreshUser };
|
|
39
|
+
}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export * as AuthCore from './auth-core';
|
|
2
|
+
export { clearToken, getAuthHeader, getToken, getValidToken, handleAuthResponse, hasValidToken, storeToken, } from './auth-core/token-storage';
|
|
3
|
+
export { clearUserCookies, clearUserLocalStorage, clearUserSessionStorage, listUserData, performLogoutCleanup, resetUIState, } from './auth-core/cleanup';
|
|
4
|
+
export { AppSwitcher, AuthGuard, AuthProvider, SignInForm, SignUpForm, useAuth, } from './auth-components';
|
|
5
|
+
export { useApiError, useMediaQuery, useToast, useUser, useUserLimits, type ToastMessage, } from './hooks';
|
|
6
|
+
export { createGraphContext, createGraphProvider, createUseGraphContext, EntityProvider, GraphContext, GraphProvider, OrgProvider, ServiceOfferingsProvider, SidebarProvider, useEntity, useGraphContext, useOrg, useServiceOfferings, useSidebarContext, type EntityContextValue, type EntityProviderProps, type GraphContextValue, type GraphProviderProps, type GraphState, type OrgContextState, type OrgContextValue, type OrgProviderProps, type ServiceOfferings, } from './contexts';
|
|
7
|
+
export { clientGraphCookie, clientSidebarCookie, entityCookie, graphCookie, sidebarCookie, type EntityCookie, type GraphCookie, type SidebarCookie, } from './lib';
|
|
8
|
+
export { generateEntityUri, isUUID, UUID_REGEX } from './utils';
|
|
9
|
+
export { clearGraphSelection, getGraphSelection, persistGraphSelection, } from './actions/graph-actions';
|
|
10
|
+
export { clearEntitySelection, getEntitySelection, persistEntitySelection, } from './actions/entity-actions';
|
|
11
|
+
export type { Entities, Entity, User } from './types';
|
|
12
|
+
export { customTheme } from './theme';
|
|
13
|
+
export { buildGraphAwareConsoleConfig, ConsoleContent, EXAMPLE_SETS, getGraphExampleKind, useGraphAwareConsoleConfig, } from './components/console';
|
|
14
|
+
export type { ConsoleBranding, ConsoleCommandContext, ConsoleConfig, ConsoleExtraCommand, ConsoleHeaderConfig, ConsoleMcpConfig, ConsoleWelcomeConfig, GraphExampleKind, GraphExampleSet, SampleQuery, } from './components/console';
|
|
15
|
+
export { ActiveSubscriptions, BrowseRepositories, EntitySelector, EntitySelectorCore, GraphSelectorCore, PageLayout, RepositoryGuard, SearchContent, useIsRepository, type ActiveSubscriptionsProps, type BrowseRepositoriesProps, type EntityGroup, type EntityLike, type EntityRecord, type EntitySelectorProps, type GraphSelectorProps, type GraphWithEntities, type SearchConfig, type SearchFilterConfig, type SelectableEntity, } from './components';
|
|
16
|
+
export { composeFilters, excludeRepositories, excludeSubgraphs, GraphFilters, hasSchemaExtension, onlyRepositories, onlyUserGraphs, } from './components/graph-filters';
|
|
17
|
+
export { ApiKeyDisplay, ApiKeysCard, ApiKeyTable, BrandSpinner, categorizeError, ChatHeader, ChatInputArea, ChatMessage, ConfirmModal, CoreNavbar, CoreSidebar, CreateApiKeyModal, DeepResearchToggle, EmptyState, ErrorType, GeneralInformationCard, generateMessageId, getErrorMessage, LandingFooter, LoadingState, PageContainer, PageHeader, PasswordInformationCard, PasswordRequirements, SecureApiKeyField, SettingsCard, SettingsContainer, SettingsFormField, SettingsPageHeader, Spinner, StatCard, StatusAlert, SupportModal, ThemeToggle, } from './ui-components';
|
|
18
|
+
export type { AgentType, FooterLink, LandingFooterProps, Message, PageHeaderProps, SidebarItemData, SupportMetadata, } from './ui-components';
|
|
19
|
+
export * from './library';
|
|
20
|
+
export * as SDK from '@robosystems/client';
|
|
21
|
+
export { clients, EventType, executeQuery, monitorOperation, OperationClient, QueryClient, QueuedQueryError, RoboSystemsClients, SSEClient, streamQuery, useMultipleOperations, useOperation, useQuery, useSDKClients, useStreamingQuery, type OperationMonitorOptions, type OperationProgress, type OperationResult, type QueryOptions, type QueryRequest, type QueryResult, type QueuedQueryResponse, type RoboSystemsClientConfig, type SSEConfig, type SSEEvent, } from '@robosystems/client/clients';
|
|
22
|
+
export { cancelTask, getActiveTasks, pollTaskStatus, taskMonitor, } from './task-monitoring/taskMonitor';
|
|
23
|
+
export { getProgressFromStep, useEntityCreationTask, useTaskMonitoring, type UseTaskMonitoringResult, } from './task-monitoring/hooks';
|
|
24
|
+
export type { TaskCreateResponse, TaskMonitorState, TaskPollingOptions, TaskStatus, TaskStatusResponse, } from './task-monitoring';
|
|
25
|
+
export { useGraphCreation, useOperationMonitoring, useRepositorySubscription, type OperationMonitorState, type UseOperationMonitoringResult, } from './task-monitoring/operationHooks';
|
|
26
|
+
import { client } from '@robosystems/client';
|
|
27
|
+
export { client };
|
|
28
|
+
export type { APIKey, AppName, AuthContextType, AuthUser } from './auth-core';
|
|
29
|
+
export { CURRENT_APP } from './auth-core/config';
|
package/index.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Root package that re-exports all sub-packages
|
|
2
|
+
// Export auth-core with namespace to avoid conflicts
|
|
3
|
+
export * as AuthCore from './auth-core';
|
|
4
|
+
// Export token storage utilities for JWT authentication
|
|
5
|
+
export { clearToken, getAuthHeader, getToken, getValidToken, handleAuthResponse, hasValidToken, storeToken, } from './auth-core/token-storage';
|
|
6
|
+
// Export auth cleanup utilities
|
|
7
|
+
export { clearUserCookies, clearUserLocalStorage, clearUserSessionStorage, listUserData, performLogoutCleanup, resetUIState, } from './auth-core/cleanup';
|
|
8
|
+
// Export auth-components
|
|
9
|
+
export { AppSwitcher, AuthGuard, AuthProvider, SignInForm, SignUpForm, useAuth, } from './auth-components';
|
|
10
|
+
// Export hooks
|
|
11
|
+
export { useApiError, useMediaQuery, useToast, useUser, useUserLimits, } from './hooks';
|
|
12
|
+
// Export contexts
|
|
13
|
+
export {
|
|
14
|
+
// Graph context exports
|
|
15
|
+
createGraphContext, createGraphProvider, createUseGraphContext,
|
|
16
|
+
// Entity context exports
|
|
17
|
+
EntityProvider, GraphContext, GraphProvider,
|
|
18
|
+
// Org context exports
|
|
19
|
+
OrgProvider,
|
|
20
|
+
// Service offerings context
|
|
21
|
+
ServiceOfferingsProvider, SidebarProvider, useEntity, useGraphContext, useOrg, useServiceOfferings, useSidebarContext, } from './contexts';
|
|
22
|
+
// Export lib utilities
|
|
23
|
+
export { clientGraphCookie, clientSidebarCookie, entityCookie, graphCookie, sidebarCookie, } from './lib';
|
|
24
|
+
// Export utils
|
|
25
|
+
export { generateEntityUri, isUUID, UUID_REGEX } from './utils';
|
|
26
|
+
// Export server actions
|
|
27
|
+
export { clearGraphSelection, getGraphSelection, persistGraphSelection, } from './actions/graph-actions';
|
|
28
|
+
export { clearEntitySelection, getEntitySelection, persistEntitySelection, } from './actions/entity-actions';
|
|
29
|
+
// Export theme
|
|
30
|
+
export { customTheme } from './theme';
|
|
31
|
+
// Export components
|
|
32
|
+
// Export console components
|
|
33
|
+
export { buildGraphAwareConsoleConfig, ConsoleContent, EXAMPLE_SETS, getGraphExampleKind, useGraphAwareConsoleConfig, } from './components/console';
|
|
34
|
+
export { ActiveSubscriptions, BrowseRepositories, EntitySelector, EntitySelectorCore, GraphSelectorCore, PageLayout, RepositoryGuard, SearchContent, useIsRepository, } from './components';
|
|
35
|
+
// Export graph filters
|
|
36
|
+
export { composeFilters, excludeRepositories, excludeSubgraphs, GraphFilters, hasSchemaExtension, onlyRepositories, onlyUserGraphs, } from './components/graph-filters';
|
|
37
|
+
// Export app-components
|
|
38
|
+
export { ApiKeyDisplay, ApiKeysCard, ApiKeyTable, BrandSpinner, categorizeError, ChatHeader, ChatInputArea,
|
|
39
|
+
// Chat components
|
|
40
|
+
ChatMessage, ConfirmModal, CoreNavbar, CoreSidebar, CreateApiKeyModal, DeepResearchToggle, EmptyState, ErrorType, GeneralInformationCard, generateMessageId, getErrorMessage, LandingFooter, LoadingState, PageContainer, PageHeader, PasswordInformationCard, PasswordRequirements, SecureApiKeyField, SettingsCard, SettingsContainer, SettingsFormField, SettingsPageHeader, Spinner, StatCard, StatusAlert, SupportModal, ThemeToggle, } from './ui-components';
|
|
41
|
+
// Export library components, types, and helpers
|
|
42
|
+
export * from './library';
|
|
43
|
+
// Export SDK with namespace to avoid conflicts
|
|
44
|
+
export * as SDK from '@robosystems/client';
|
|
45
|
+
// Export SDK Clients (available with @robosystems/client v0.3.2+)
|
|
46
|
+
export { clients, EventType, executeQuery, monitorOperation, OperationClient, QueryClient, QueuedQueryError, RoboSystemsClients, SSEClient, streamQuery, useMultipleOperations, useOperation, useQuery, useSDKClients, useStreamingQuery, } from '@robosystems/client/clients';
|
|
47
|
+
// Export task monitoring utilities
|
|
48
|
+
export { cancelTask, getActiveTasks, pollTaskStatus, taskMonitor, } from './task-monitoring/taskMonitor';
|
|
49
|
+
export { getProgressFromStep, useEntityCreationTask, useTaskMonitoring, } from './task-monitoring/hooks';
|
|
50
|
+
// Export operation monitoring hooks
|
|
51
|
+
export { useGraphCreation, useOperationMonitoring, useRepositorySubscription, } from './task-monitoring/operationHooks';
|
|
52
|
+
// Configure and export client directly for convenience (since it's commonly used)
|
|
53
|
+
import { client } from '@robosystems/client';
|
|
54
|
+
import { getAuthHeader } from './auth-core/token-storage';
|
|
55
|
+
// Configure the SDK client with default settings
|
|
56
|
+
// Skip configuration in test environment to prevent connection attempts
|
|
57
|
+
if (process.env.NODE_ENV !== 'test') {
|
|
58
|
+
client.setConfig({
|
|
59
|
+
baseUrl: process.env.NEXT_PUBLIC_ROBOSYSTEMS_API_URL || 'http://localhost:8000',
|
|
60
|
+
// No longer using credentials: 'include' for cookies
|
|
61
|
+
// Using Bearer token authentication instead
|
|
62
|
+
headers: {
|
|
63
|
+
'Content-Type': 'application/json',
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
// Add Bearer token to all requests if authenticated
|
|
67
|
+
client.interceptors.request.use(async (request) => {
|
|
68
|
+
const authHeader = getAuthHeader();
|
|
69
|
+
if (authHeader) {
|
|
70
|
+
request.headers.set('Authorization', authHeader);
|
|
71
|
+
}
|
|
72
|
+
return request;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export { client };
|
|
76
|
+
// App identity
|
|
77
|
+
export { CURRENT_APP } from './auth-core/config';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const ENTITY_COOKIE_NAME = 'selected-entity';
|
|
2
|
+
// Server-side cookie utilities for Next.js 15
|
|
3
|
+
export const entityCookie = {
|
|
4
|
+
async get() {
|
|
5
|
+
// Only import cookies when actually needed (server-side)
|
|
6
|
+
const { cookies } = await import('next/headers');
|
|
7
|
+
const cookieStore = await cookies();
|
|
8
|
+
const cookie = cookieStore.get(ENTITY_COOKIE_NAME);
|
|
9
|
+
if (!(cookie === null || cookie === void 0 ? void 0 : cookie.value)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
return JSON.parse(decodeURIComponent(cookie.value));
|
|
14
|
+
}
|
|
15
|
+
catch (_a) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
async set(value) {
|
|
20
|
+
// Only import cookies when actually needed (server-side)
|
|
21
|
+
const { cookies } = await import('next/headers');
|
|
22
|
+
const cookieStore = await cookies();
|
|
23
|
+
const cookieValue = JSON.stringify(value);
|
|
24
|
+
cookieStore.set(ENTITY_COOKIE_NAME, encodeURIComponent(cookieValue), {
|
|
25
|
+
maxAge: 30 * 24 * 60 * 60, // 30 days
|
|
26
|
+
secure: process.env.NODE_ENV === 'production',
|
|
27
|
+
httpOnly: true,
|
|
28
|
+
sameSite: 'lax',
|
|
29
|
+
path: '/',
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
async delete() {
|
|
33
|
+
// Only import cookies when actually needed (server-side)
|
|
34
|
+
const { cookies } = await import('next/headers');
|
|
35
|
+
const cookieStore = await cookies();
|
|
36
|
+
cookieStore.delete(ENTITY_COOKIE_NAME);
|
|
37
|
+
},
|
|
38
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface GraphCookie {
|
|
2
|
+
graphId: string;
|
|
3
|
+
}
|
|
4
|
+
export declare const graphCookie: {
|
|
5
|
+
get(): Promise<GraphCookie | null>;
|
|
6
|
+
set(value: GraphCookie): Promise<void>;
|
|
7
|
+
delete(): Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
export declare const clientGraphCookie: {
|
|
10
|
+
get(): GraphCookie | null;
|
|
11
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const GRAPH_COOKIE_NAME = 'selected-graph';
|
|
2
|
+
// Server-side cookie utilities for Next.js 15
|
|
3
|
+
export const graphCookie = {
|
|
4
|
+
async get() {
|
|
5
|
+
// Only import cookies when actually needed (server-side)
|
|
6
|
+
const { cookies } = await import('next/headers');
|
|
7
|
+
const cookieStore = await cookies();
|
|
8
|
+
const cookie = cookieStore.get(GRAPH_COOKIE_NAME);
|
|
9
|
+
if (!(cookie === null || cookie === void 0 ? void 0 : cookie.value)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
return JSON.parse(decodeURIComponent(cookie.value));
|
|
14
|
+
}
|
|
15
|
+
catch (_a) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
async set(value) {
|
|
20
|
+
// Only import cookies when actually needed (server-side)
|
|
21
|
+
const { cookies } = await import('next/headers');
|
|
22
|
+
const cookieStore = await cookies();
|
|
23
|
+
const cookieValue = JSON.stringify(value);
|
|
24
|
+
cookieStore.set(GRAPH_COOKIE_NAME, encodeURIComponent(cookieValue), {
|
|
25
|
+
maxAge: 30 * 24 * 60 * 60, // 30 days
|
|
26
|
+
secure: process.env.NODE_ENV === 'production',
|
|
27
|
+
httpOnly: true,
|
|
28
|
+
sameSite: 'lax',
|
|
29
|
+
path: '/',
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
async delete() {
|
|
33
|
+
// Only import cookies when actually needed (server-side)
|
|
34
|
+
const { cookies } = await import('next/headers');
|
|
35
|
+
const cookieStore = await cookies();
|
|
36
|
+
cookieStore.delete(GRAPH_COOKIE_NAME);
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
// Client-side utilities (if needed)
|
|
40
|
+
export const clientGraphCookie = {
|
|
41
|
+
get() {
|
|
42
|
+
if (typeof document === 'undefined') {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const cookie = document.cookie
|
|
46
|
+
.split('; ')
|
|
47
|
+
.find((row) => row.startsWith(`${GRAPH_COOKIE_NAME}=`));
|
|
48
|
+
if (!cookie) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const cookieValue = cookie.split('=')[1];
|
|
52
|
+
if (!cookieValue) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
return JSON.parse(decodeURIComponent(cookieValue));
|
|
57
|
+
}
|
|
58
|
+
catch (_a) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type AvailableGraphTiersResponse, type GraphCapacityResponse, type GraphTierInfo, type GraphTierInstance, type GraphTierLimits, type TierCapacity } from '@robosystems/client';
|
|
2
|
+
/**
|
|
3
|
+
* Graph tier service for fetching tier configurations using the RoboSystems SDK
|
|
4
|
+
*/
|
|
5
|
+
export type { GraphTierInstance, GraphTierLimits, TierCapacity };
|
|
6
|
+
export type GraphTier = GraphTierInfo;
|
|
7
|
+
export type GraphTiersResponse = AvailableGraphTiersResponse;
|
|
8
|
+
/**
|
|
9
|
+
* Fetch available graph tiers from the API using the RoboSystems client
|
|
10
|
+
* Note: Uses the pre-configured client from core which includes auth interceptors
|
|
11
|
+
*/
|
|
12
|
+
export declare function fetchGraphTiers(includeDisabled?: boolean): Promise<GraphTiersResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Map tier to color for UI display based on price
|
|
15
|
+
* Uses a heuristic: lowest price = info, middle = warning, highest = success
|
|
16
|
+
*/
|
|
17
|
+
export declare function getTierColor(tier: GraphTier, allTiers: GraphTier[]): 'info' | 'warning' | 'success';
|
|
18
|
+
/**
|
|
19
|
+
* Get the popular/recommended tier (usually the middle tier)
|
|
20
|
+
* Returns the tier with median price or the middle index
|
|
21
|
+
*/
|
|
22
|
+
export declare function getPopularTier(tiers: GraphTier[]): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Check if a tier supports subgraphs
|
|
25
|
+
*/
|
|
26
|
+
export declare function supportsSubgraphs(tier: GraphTier): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Format tier for display in dropdown or selection
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatTierForDisplay(tier: GraphTier): string;
|
|
31
|
+
/**
|
|
32
|
+
* Fetch graph capacity from the API using the RoboSystems client
|
|
33
|
+
*/
|
|
34
|
+
export declare function fetchGraphCapacity(): Promise<GraphCapacityResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Get badge display properties for a capacity status
|
|
37
|
+
*/
|
|
38
|
+
export declare function getCapacityBadge(status: string): {
|
|
39
|
+
label: string;
|
|
40
|
+
color: 'success' | 'warning' | 'failure';
|
|
41
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { getAvailableGraphTiers, getGraphCapacity, } from '@robosystems/client';
|
|
2
|
+
// Import the pre-configured client from core (already set up with auth interceptors)
|
|
3
|
+
import { client } from '../index';
|
|
4
|
+
/**
|
|
5
|
+
* Fetch available graph tiers from the API using the RoboSystems client
|
|
6
|
+
* Note: Uses the pre-configured client from core which includes auth interceptors
|
|
7
|
+
*/
|
|
8
|
+
export async function fetchGraphTiers(includeDisabled = false) {
|
|
9
|
+
const response = await getAvailableGraphTiers({
|
|
10
|
+
client,
|
|
11
|
+
query: {
|
|
12
|
+
include_disabled: includeDisabled,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
if (response.error) {
|
|
16
|
+
const errorMsg = response.error &&
|
|
17
|
+
typeof response.error === 'object' &&
|
|
18
|
+
'message' in response.error
|
|
19
|
+
? String(response.error.message)
|
|
20
|
+
: 'Unknown error';
|
|
21
|
+
throw new Error(`Failed to fetch graph tiers: ${errorMsg}`);
|
|
22
|
+
}
|
|
23
|
+
return response.data;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Map tier to color for UI display based on price
|
|
27
|
+
* Uses a heuristic: lowest price = info, middle = warning, highest = success
|
|
28
|
+
*/
|
|
29
|
+
export function getTierColor(tier, allTiers) {
|
|
30
|
+
// Sort tiers by price (null/undefined treated as 0)
|
|
31
|
+
const sortedByPrice = [...allTiers].sort((a, b) => {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
const priceA = (_a = a.monthly_price) !== null && _a !== void 0 ? _a : 0;
|
|
34
|
+
const priceB = (_b = b.monthly_price) !== null && _b !== void 0 ? _b : 0;
|
|
35
|
+
return priceA - priceB;
|
|
36
|
+
});
|
|
37
|
+
const tierIndex = sortedByPrice.findIndex((t) => t.tier === tier.tier);
|
|
38
|
+
const totalTiers = sortedByPrice.length;
|
|
39
|
+
// Assign colors based on position in sorted list
|
|
40
|
+
if (tierIndex === 0)
|
|
41
|
+
return 'info'; // Lowest price
|
|
42
|
+
if (tierIndex === totalTiers - 1)
|
|
43
|
+
return 'success'; // Highest price
|
|
44
|
+
return 'warning'; // Middle tier(s)
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get the popular/recommended tier (usually the middle tier)
|
|
48
|
+
* Returns the tier with median price or the middle index
|
|
49
|
+
*/
|
|
50
|
+
export function getPopularTier(tiers) {
|
|
51
|
+
if (tiers.length === 0)
|
|
52
|
+
return null;
|
|
53
|
+
if (tiers.length === 1)
|
|
54
|
+
return tiers[0].tier;
|
|
55
|
+
// Sort by price and return the middle one
|
|
56
|
+
const sortedByPrice = [...tiers].sort((a, b) => {
|
|
57
|
+
var _a, _b;
|
|
58
|
+
const priceA = (_a = a.monthly_price) !== null && _a !== void 0 ? _a : 0;
|
|
59
|
+
const priceB = (_b = b.monthly_price) !== null && _b !== void 0 ? _b : 0;
|
|
60
|
+
return priceA - priceB;
|
|
61
|
+
});
|
|
62
|
+
const middleIndex = Math.floor(sortedByPrice.length / 2);
|
|
63
|
+
return sortedByPrice[middleIndex].tier;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Check if a tier supports subgraphs
|
|
67
|
+
*/
|
|
68
|
+
export function supportsSubgraphs(tier) {
|
|
69
|
+
return tier.max_subgraphs !== null && tier.max_subgraphs > 0;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Format tier for display in dropdown or selection
|
|
73
|
+
*/
|
|
74
|
+
export function formatTierForDisplay(tier) {
|
|
75
|
+
const price = tier.monthly_price ? `$${tier.monthly_price}/mo` : '';
|
|
76
|
+
return `${tier.display_name} ${price}`.trim();
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Fetch graph capacity from the API using the RoboSystems client
|
|
80
|
+
*/
|
|
81
|
+
export async function fetchGraphCapacity() {
|
|
82
|
+
const response = await getGraphCapacity({ client });
|
|
83
|
+
if (response.error) {
|
|
84
|
+
const errorMsg = response.error &&
|
|
85
|
+
typeof response.error === 'object' &&
|
|
86
|
+
'message' in response.error
|
|
87
|
+
? String(response.error.message)
|
|
88
|
+
: 'Unknown error';
|
|
89
|
+
throw new Error(`Failed to fetch graph capacity: ${errorMsg}`);
|
|
90
|
+
}
|
|
91
|
+
return response.data;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get badge display properties for a capacity status
|
|
95
|
+
*/
|
|
96
|
+
export function getCapacityBadge(status) {
|
|
97
|
+
switch (status) {
|
|
98
|
+
case 'ready':
|
|
99
|
+
return { label: 'Available', color: 'success' };
|
|
100
|
+
case 'scalable':
|
|
101
|
+
return { label: 'Available — 3-5 min setup', color: 'warning' };
|
|
102
|
+
case 'at_capacity':
|
|
103
|
+
return { label: 'At Capacity', color: 'failure' };
|
|
104
|
+
default:
|
|
105
|
+
return { label: 'Available', color: 'success' };
|
|
106
|
+
}
|
|
107
|
+
}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface SidebarCookie {
|
|
2
|
+
isCollapsed: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare const sidebarCookie: {
|
|
5
|
+
get(): Promise<SidebarCookie>;
|
|
6
|
+
set(value: SidebarCookie): Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
export declare const clientSidebarCookie: {
|
|
9
|
+
get(): SidebarCookie;
|
|
10
|
+
set(value: SidebarCookie): void;
|
|
11
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const NAME = 'sidebar-collapsed';
|
|
2
|
+
// Server-side cookie utilities (for Server Components)
|
|
3
|
+
export const sidebarCookie = {
|
|
4
|
+
async get() {
|
|
5
|
+
// Only import cookies when actually needed (server-side)
|
|
6
|
+
const { cookies } = await import('next/headers');
|
|
7
|
+
const cookie = (await cookies()).get(NAME);
|
|
8
|
+
const isCollapsed = (cookie === null || cookie === void 0 ? void 0 : cookie.value) === 'true';
|
|
9
|
+
return { isCollapsed };
|
|
10
|
+
},
|
|
11
|
+
async set(value) {
|
|
12
|
+
// Only import cookies when actually needed (server-side)
|
|
13
|
+
const { cookies } = await import('next/headers');
|
|
14
|
+
(await cookies()).set(NAME, String(value.isCollapsed), {
|
|
15
|
+
path: '/',
|
|
16
|
+
maxAge: 60 * 60 * 24 * 365, // 1 year
|
|
17
|
+
sameSite: 'lax',
|
|
18
|
+
secure: process.env.NODE_ENV === 'production',
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
// Client-side cookie utilities (for Client Components)
|
|
23
|
+
export const clientSidebarCookie = {
|
|
24
|
+
get() {
|
|
25
|
+
if (typeof document === 'undefined') {
|
|
26
|
+
return { isCollapsed: false };
|
|
27
|
+
}
|
|
28
|
+
const cookie = document.cookie
|
|
29
|
+
.split('; ')
|
|
30
|
+
.find((row) => row.startsWith(`${NAME}=`));
|
|
31
|
+
const isCollapsed = (cookie === null || cookie === void 0 ? void 0 : cookie.split('=')[1]) === 'true';
|
|
32
|
+
return { isCollapsed };
|
|
33
|
+
},
|
|
34
|
+
set(value) {
|
|
35
|
+
if (typeof document === 'undefined')
|
|
36
|
+
return;
|
|
37
|
+
// Set cookie with consistent options
|
|
38
|
+
const maxAge = 60 * 60 * 24 * 365; // 1 year in seconds
|
|
39
|
+
const secure = window.location.protocol === 'https:' ? '; secure' : '';
|
|
40
|
+
document.cookie = `${NAME}=${String(value.isCollapsed)}; path=/; max-age=${maxAge}; samesite=lax${secure}`;
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export function classificationColor(cls) {
|
|
2
|
+
switch (cls) {
|
|
3
|
+
case 'asset':
|
|
4
|
+
case 'contraAsset':
|
|
5
|
+
return 'success';
|
|
6
|
+
case 'liability':
|
|
7
|
+
case 'contraLiability':
|
|
8
|
+
return 'failure';
|
|
9
|
+
case 'equity':
|
|
10
|
+
case 'contraEquity':
|
|
11
|
+
case 'temporaryEquity':
|
|
12
|
+
return 'purple';
|
|
13
|
+
case 'revenue':
|
|
14
|
+
case 'expenseReversal':
|
|
15
|
+
case 'gain':
|
|
16
|
+
return 'info';
|
|
17
|
+
case 'expense':
|
|
18
|
+
case 'loss':
|
|
19
|
+
return 'warning';
|
|
20
|
+
case 'comprehensiveIncome':
|
|
21
|
+
case 'investmentByOwners':
|
|
22
|
+
case 'distributionToOwners':
|
|
23
|
+
return 'indigo';
|
|
24
|
+
case 'metric':
|
|
25
|
+
return 'pink';
|
|
26
|
+
default:
|
|
27
|
+
return 'gray';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export function arcTypeColor(assocType) {
|
|
31
|
+
switch (assocType) {
|
|
32
|
+
case 'equivalence':
|
|
33
|
+
return 'info';
|
|
34
|
+
case 'general-special':
|
|
35
|
+
return 'purple';
|
|
36
|
+
case 'essence-alias':
|
|
37
|
+
return 'indigo';
|
|
38
|
+
default:
|
|
39
|
+
return 'gray';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function ClassificationPicker({ selected, onSelect, activity, onActivityChange, disabled, }: {
|
|
2
|
+
selected: string | null;
|
|
3
|
+
onSelect: (value: string | null) => void;
|
|
4
|
+
/** Cash-flow activity axis (orthogonal to SFAC 6 EFS). Optional — omit to hide. */
|
|
5
|
+
activity?: string | null;
|
|
6
|
+
onActivityChange?: (value: string | null) => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
export function ClassificationPicker({ selected, onSelect, activity, onActivityChange, disabled, }) {
|
|
4
|
+
const balanceSheetClasses = [
|
|
5
|
+
{ value: 'asset', label: 'Asset' },
|
|
6
|
+
{ value: 'contraAsset', label: 'Contra Asset' },
|
|
7
|
+
{ value: 'liability', label: 'Liability' },
|
|
8
|
+
{ value: 'contraLiability', label: 'Contra Liability' },
|
|
9
|
+
{ value: 'equity', label: 'Equity' },
|
|
10
|
+
{ value: 'contraEquity', label: 'Contra Equity' },
|
|
11
|
+
{ value: 'temporaryEquity', label: 'Temp. Equity' },
|
|
12
|
+
];
|
|
13
|
+
const incomeStatementClasses = [
|
|
14
|
+
{ value: 'revenue', label: 'Revenue' },
|
|
15
|
+
{ value: 'expense', label: 'Expense' },
|
|
16
|
+
{ value: 'expenseReversal', label: 'Exp. Reversal' },
|
|
17
|
+
{ value: 'gain', label: 'Gain' },
|
|
18
|
+
{ value: 'loss', label: 'Loss' },
|
|
19
|
+
{ value: 'comprehensiveIncome', label: 'OCI' },
|
|
20
|
+
{ value: 'investmentByOwners', label: 'Investment' },
|
|
21
|
+
{ value: 'distributionToOwners', label: 'Distribution' },
|
|
22
|
+
];
|
|
23
|
+
const activityClasses = [
|
|
24
|
+
{
|
|
25
|
+
value: 'operatingActivity',
|
|
26
|
+
label: 'Operating',
|
|
27
|
+
title: 'Cash flows from operating activities',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
value: 'investingActivity',
|
|
31
|
+
label: 'Investing',
|
|
32
|
+
title: 'Cash flows from investing activities',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
value: 'financingActivity',
|
|
36
|
+
label: 'Financing',
|
|
37
|
+
title: 'Cash flows from financing activities',
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
const chipClass = (value) => `rounded px-2 py-1 text-xs ${selected === value
|
|
41
|
+
? 'bg-primary-600 text-white'
|
|
42
|
+
: 'bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-200'} ${disabled ? 'cursor-not-allowed opacity-50' : ''}`;
|
|
43
|
+
const allClass = `rounded px-2 py-1 text-xs ${selected === null
|
|
44
|
+
? 'bg-primary-600 text-white'
|
|
45
|
+
: 'bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-200'} ${disabled ? 'cursor-not-allowed opacity-50' : ''}`;
|
|
46
|
+
const activityChipClass = (value) => `rounded px-2 py-1 text-xs ${activity === value
|
|
47
|
+
? 'bg-emerald-600 text-white'
|
|
48
|
+
: 'bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-200'} ${disabled ? 'cursor-not-allowed opacity-50' : ''}`;
|
|
49
|
+
const showActivity = onActivityChange !== undefined;
|
|
50
|
+
return (_jsxs("div", { className: "flex flex-wrap gap-1", children: [_jsx("button", { onClick: () => onSelect(null), disabled: disabled, className: allClass, children: "All" }), balanceSheetClasses.map((c) => (_jsx("button", { onClick: () => onSelect(c.value), disabled: disabled, title: c.title, className: chipClass(c.value), children: c.label }, c.value))), _jsx("span", { className: "mx-1 self-center text-gray-300 dark:text-gray-600", children: "\u00B7" }), incomeStatementClasses.map((c) => (_jsx("button", { onClick: () => onSelect(c.value), disabled: disabled, title: c.title, className: chipClass(c.value), children: c.label }, c.value))), _jsx("button", { onClick: () => onSelect('metric'), disabled: disabled, title: "Derived metrics / subtotals (Net Income, Gross Profit, Comprehensive Income totals). Not SFAC 6 primary elements.", className: `rounded px-2 py-1 text-xs ${selected === 'metric'
|
|
51
|
+
? 'bg-pink-600 text-white'
|
|
52
|
+
: 'bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-200'} ${disabled ? 'cursor-not-allowed opacity-50' : ''}`, children: "Metric" }), _jsx("span", { className: "mx-1 self-center text-gray-300 dark:text-gray-600", children: "\u00B7" }), _jsx("button", { onClick: () => onSelect('abstract'), disabled: disabled, title: "Abstract grouping concepts (hypercubes, RollUps, LineItems).", className: `rounded px-2 py-1 text-xs ${selected === 'abstract'
|
|
53
|
+
? 'bg-secondary-600 text-white'
|
|
54
|
+
: 'bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-200'} ${disabled ? 'cursor-not-allowed opacity-50' : ''}`, children: "Abstract" }), showActivity && (_jsxs(_Fragment, { children: [_jsx("span", { className: "mx-1 self-center text-gray-300 dark:text-gray-600", children: "\u00B7" }), activityClasses.map((c) => (_jsx("button", { onClick: () => onActivityChange === null || onActivityChange === void 0 ? void 0 : onActivityChange(activity === c.value ? null : c.value), disabled: disabled, title: c.title, className: activityChipClass(c.value), children: c.label }, c.value)))] }))] }));
|
|
55
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LibraryClient, LibraryTaxonomy } from '@robosystems/client/clients';
|
|
2
|
+
export declare function ElementBrowser({ client, graphId, taxonomyId, taxonomies, onTaxonomyChange, selectedElementId, onSelectElement, }: {
|
|
3
|
+
client: LibraryClient;
|
|
4
|
+
graphId: string;
|
|
5
|
+
taxonomyId: string | null;
|
|
6
|
+
/** When provided, renders a taxonomy selector alongside search. */
|
|
7
|
+
taxonomies?: LibraryTaxonomy[];
|
|
8
|
+
onTaxonomyChange?: (id: string) => void;
|
|
9
|
+
selectedElementId: string | null;
|
|
10
|
+
onSelectElement: (id: string) => void;
|
|
11
|
+
}): import("react").JSX.Element;
|