@everysk/apps-sdk 0.1.0-beta.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 +128 -0
- package/dist/EveryskApp.d.ts +73 -0
- package/dist/EveryskApp.d.ts.map +1 -0
- package/dist/EveryskApp.js +66 -0
- package/dist/EveryskApp.js.map +1 -0
- package/dist/agGrid/agGridTheme.d.ts +77 -0
- package/dist/agGrid/agGridTheme.d.ts.map +1 -0
- package/dist/agGrid/agGridTheme.js +88 -0
- package/dist/agGrid/agGridTheme.js.map +1 -0
- package/dist/agGrid/index.d.ts +4 -0
- package/dist/agGrid/index.d.ts.map +1 -0
- package/dist/agGrid/index.js +3 -0
- package/dist/api/datastore.d.ts +68 -0
- package/dist/api/datastore.d.ts.map +1 -0
- package/dist/api/datastore.js +125 -0
- package/dist/api/datastore.js.map +1 -0
- package/dist/api/entityQuery.d.ts +78 -0
- package/dist/api/entityQuery.d.ts.map +1 -0
- package/dist/api/entityQuery.js +100 -0
- package/dist/api/entityQuery.js.map +1 -0
- package/dist/api/file.d.ts +70 -0
- package/dist/api/file.d.ts.map +1 -0
- package/dist/api/file.js +126 -0
- package/dist/api/file.js.map +1 -0
- package/dist/api/portfolio.d.ts +67 -0
- package/dist/api/portfolio.d.ts.map +1 -0
- package/dist/api/portfolio.js +125 -0
- package/dist/api/portfolio.js.map +1 -0
- package/dist/api/profile.d.ts +40 -0
- package/dist/api/profile.d.ts.map +1 -0
- package/dist/api/profile.js +71 -0
- package/dist/api/profile.js.map +1 -0
- package/dist/api/websocketsConfig.d.ts +13 -0
- package/dist/api/websocketsConfig.d.ts.map +1 -0
- package/dist/api/websocketsConfig.js +25 -0
- package/dist/api/websocketsConfig.js.map +1 -0
- package/dist/api/workflow.d.ts +154 -0
- package/dist/api/workflow.d.ts.map +1 -0
- package/dist/api/workflow.js +289 -0
- package/dist/api/workflow.js.map +1 -0
- package/dist/api/workspace.d.ts +29 -0
- package/dist/api/workspace.d.ts.map +1 -0
- package/dist/api/workspace.js +54 -0
- package/dist/api/workspace.js.map +1 -0
- package/dist/components/ui/EveryskIcon/index.d.ts +5 -0
- package/dist/components/ui/EveryskIcon/index.d.ts.map +1 -0
- package/dist/components/ui/EveryskIcon/index.js +25 -0
- package/dist/components/ui/EveryskIcon/index.js.map +1 -0
- package/dist/components/ui/Footer/index.d.ts +5 -0
- package/dist/components/ui/Footer/index.d.ts.map +1 -0
- package/dist/components/ui/Footer/index.js +23 -0
- package/dist/components/ui/Footer/index.js.map +1 -0
- package/dist/components/ui/GlobalLoading/index.d.ts +8 -0
- package/dist/components/ui/GlobalLoading/index.d.ts.map +1 -0
- package/dist/components/ui/GlobalLoading/index.js +42 -0
- package/dist/components/ui/GlobalLoading/index.js.map +1 -0
- package/dist/components/ui/PageContainer/index.d.ts +7 -0
- package/dist/components/ui/PageContainer/index.d.ts.map +1 -0
- package/dist/components/ui/PageContainer/index.js +20 -0
- package/dist/components/ui/PageContainer/index.js.map +1 -0
- package/dist/components/ui/Toolbar/index.d.ts +5 -0
- package/dist/components/ui/Toolbar/index.d.ts.map +1 -0
- package/dist/components/ui/Toolbar/index.js +32 -0
- package/dist/components/ui/Toolbar/index.js.map +1 -0
- package/dist/contexts/agGridLicenseContext/provider.d.ts +51 -0
- package/dist/contexts/agGridLicenseContext/provider.d.ts.map +1 -0
- package/dist/contexts/agGridLicenseContext/provider.js +58 -0
- package/dist/contexts/agGridLicenseContext/provider.js.map +1 -0
- package/dist/contexts/appAlertContext/index.d.ts +3 -0
- package/dist/contexts/appAlertContext/index.d.ts.map +1 -0
- package/dist/contexts/appAlertContext/index.js +7 -0
- package/dist/contexts/appAlertContext/index.js.map +1 -0
- package/dist/contexts/appAlertContext/provider.d.ts +40 -0
- package/dist/contexts/appAlertContext/provider.d.ts.map +1 -0
- package/dist/contexts/appAlertContext/provider.js +96 -0
- package/dist/contexts/appAlertContext/provider.js.map +1 -0
- package/dist/contexts/appAlertContext/types.d.ts +15 -0
- package/dist/contexts/appAlertContext/types.d.ts.map +1 -0
- package/dist/contexts/appAlertContext/useAppAlert.d.ts +30 -0
- package/dist/contexts/appAlertContext/useAppAlert.d.ts.map +1 -0
- package/dist/contexts/appAlertContext/useAppAlert.js +40 -0
- package/dist/contexts/appAlertContext/useAppAlert.js.map +1 -0
- package/dist/contexts/appConfigContext/index.d.ts +3 -0
- package/dist/contexts/appConfigContext/index.d.ts.map +1 -0
- package/dist/contexts/appConfigContext/index.js +7 -0
- package/dist/contexts/appConfigContext/index.js.map +1 -0
- package/dist/contexts/appConfigContext/provider.d.ts +45 -0
- package/dist/contexts/appConfigContext/provider.d.ts.map +1 -0
- package/dist/contexts/appConfigContext/provider.js +63 -0
- package/dist/contexts/appConfigContext/provider.js.map +1 -0
- package/dist/contexts/appConfigContext/types.d.ts +28 -0
- package/dist/contexts/appConfigContext/types.d.ts.map +1 -0
- package/dist/contexts/appConfigContext/useAppConfig.d.ts +20 -0
- package/dist/contexts/appConfigContext/useAppConfig.d.ts.map +1 -0
- package/dist/contexts/appConfigContext/useAppConfig.js +30 -0
- package/dist/contexts/appConfigContext/useAppConfig.js.map +1 -0
- package/dist/contexts/webSocketContext/constants.d.ts +4 -0
- package/dist/contexts/webSocketContext/constants.d.ts.map +1 -0
- package/dist/contexts/webSocketContext/constants.js +8 -0
- package/dist/contexts/webSocketContext/constants.js.map +1 -0
- package/dist/contexts/webSocketContext/handler.d.ts +43 -0
- package/dist/contexts/webSocketContext/handler.d.ts.map +1 -0
- package/dist/contexts/webSocketContext/handler.js +87 -0
- package/dist/contexts/webSocketContext/handler.js.map +1 -0
- package/dist/contexts/webSocketContext/hooks/useAppNotificationSubscription/index.d.ts +19 -0
- package/dist/contexts/webSocketContext/hooks/useAppNotificationSubscription/index.d.ts.map +1 -0
- package/dist/contexts/webSocketContext/hooks/useAppNotificationSubscription/index.js +31 -0
- package/dist/contexts/webSocketContext/hooks/useAppNotificationSubscription/index.js.map +1 -0
- package/dist/contexts/webSocketContext/hooks/useWebSocket/index.d.ts +11 -0
- package/dist/contexts/webSocketContext/hooks/useWebSocket/index.d.ts.map +1 -0
- package/dist/contexts/webSocketContext/hooks/useWebSocket/index.js +21 -0
- package/dist/contexts/webSocketContext/hooks/useWebSocket/index.js.map +1 -0
- package/dist/contexts/webSocketContext/hooks/useWebSocketSubscription/index.d.ts +30 -0
- package/dist/contexts/webSocketContext/hooks/useWebSocketSubscription/index.d.ts.map +1 -0
- package/dist/contexts/webSocketContext/hooks/useWebSocketSubscription/index.js +44 -0
- package/dist/contexts/webSocketContext/hooks/useWebSocketSubscription/index.js.map +1 -0
- package/dist/contexts/webSocketContext/index.d.ts +3 -0
- package/dist/contexts/webSocketContext/index.d.ts.map +1 -0
- package/dist/contexts/webSocketContext/index.js +7 -0
- package/dist/contexts/webSocketContext/index.js.map +1 -0
- package/dist/contexts/webSocketContext/provider.d.ts +39 -0
- package/dist/contexts/webSocketContext/provider.d.ts.map +1 -0
- package/dist/contexts/webSocketContext/provider.js +121 -0
- package/dist/contexts/webSocketContext/provider.js.map +1 -0
- package/dist/contexts/webSocketContext/types.d.ts +41 -0
- package/dist/contexts/webSocketContext/types.d.ts.map +1 -0
- package/dist/datastore/index.d.ts +7 -0
- package/dist/datastore/index.d.ts.map +1 -0
- package/dist/file/index.d.ts +6 -0
- package/dist/file/index.d.ts.map +1 -0
- package/dist/hooks/datastore/useDatastoreMutations.d.ts +151 -0
- package/dist/hooks/datastore/useDatastoreMutations.d.ts.map +1 -0
- package/dist/hooks/datastore/useDatastoreMutations.js +198 -0
- package/dist/hooks/datastore/useDatastoreMutations.js.map +1 -0
- package/dist/hooks/datastore/useFetchDatastore.d.ts +205 -0
- package/dist/hooks/datastore/useFetchDatastore.d.ts.map +1 -0
- package/dist/hooks/datastore/useFetchDatastore.js +85 -0
- package/dist/hooks/datastore/useFetchDatastore.js.map +1 -0
- package/dist/hooks/datastore/useFetchDatastores.d.ts +70 -0
- package/dist/hooks/datastore/useFetchDatastores.d.ts.map +1 -0
- package/dist/hooks/datastore/useFetchDatastores.js +105 -0
- package/dist/hooks/datastore/useFetchDatastores.js.map +1 -0
- package/dist/hooks/file/useFetchFile.d.ts +212 -0
- package/dist/hooks/file/useFetchFile.d.ts.map +1 -0
- package/dist/hooks/file/useFetchFile.js +87 -0
- package/dist/hooks/file/useFetchFile.js.map +1 -0
- package/dist/hooks/file/useFetchFiles.d.ts +60 -0
- package/dist/hooks/file/useFetchFiles.d.ts.map +1 -0
- package/dist/hooks/file/useFetchFiles.js +89 -0
- package/dist/hooks/file/useFetchFiles.js.map +1 -0
- package/dist/hooks/file/useFileMutations.d.ts +161 -0
- package/dist/hooks/file/useFileMutations.d.ts.map +1 -0
- package/dist/hooks/file/useFileMutations.js +208 -0
- package/dist/hooks/file/useFileMutations.js.map +1 -0
- package/dist/hooks/portfolio/useFetchPortfolio.d.ts +210 -0
- package/dist/hooks/portfolio/useFetchPortfolio.d.ts.map +1 -0
- package/dist/hooks/portfolio/useFetchPortfolio.js +85 -0
- package/dist/hooks/portfolio/useFetchPortfolio.js.map +1 -0
- package/dist/hooks/portfolio/useFetchPortfolios.d.ts +60 -0
- package/dist/hooks/portfolio/useFetchPortfolios.d.ts.map +1 -0
- package/dist/hooks/portfolio/useFetchPortfolios.js +89 -0
- package/dist/hooks/portfolio/useFetchPortfolios.js.map +1 -0
- package/dist/hooks/portfolio/usePortfolioMutations.d.ts +171 -0
- package/dist/hooks/portfolio/usePortfolioMutations.d.ts.map +1 -0
- package/dist/hooks/portfolio/usePortfolioMutations.js +218 -0
- package/dist/hooks/portfolio/usePortfolioMutations.js.map +1 -0
- package/dist/hooks/profile/useFetchProfile.d.ts +206 -0
- package/dist/hooks/profile/useFetchProfile.d.ts.map +1 -0
- package/dist/hooks/profile/useFetchProfile.js +70 -0
- package/dist/hooks/profile/useFetchProfile.js.map +1 -0
- package/dist/hooks/useAxios.d.ts +40 -0
- package/dist/hooks/useAxios.d.ts.map +1 -0
- package/dist/hooks/useAxios.js +76 -0
- package/dist/hooks/useAxios.js.map +1 -0
- package/dist/hooks/workflow/useFetchWorkerExecution.d.ts +198 -0
- package/dist/hooks/workflow/useFetchWorkerExecution.d.ts.map +1 -0
- package/dist/hooks/workflow/useFetchWorkerExecution.js +69 -0
- package/dist/hooks/workflow/useFetchWorkerExecution.js.map +1 -0
- package/dist/hooks/workflow/useFetchWorkerExecutions.d.ts +52 -0
- package/dist/hooks/workflow/useFetchWorkerExecutions.d.ts.map +1 -0
- package/dist/hooks/workflow/useFetchWorkerExecutions.js +83 -0
- package/dist/hooks/workflow/useFetchWorkerExecutions.js.map +1 -0
- package/dist/hooks/workflow/useFetchWorkflow.d.ts +195 -0
- package/dist/hooks/workflow/useFetchWorkflow.d.ts.map +1 -0
- package/dist/hooks/workflow/useFetchWorkflow.js +70 -0
- package/dist/hooks/workflow/useFetchWorkflow.js.map +1 -0
- package/dist/hooks/workflow/useFetchWorkflowExecution.d.ts +198 -0
- package/dist/hooks/workflow/useFetchWorkflowExecution.d.ts.map +1 -0
- package/dist/hooks/workflow/useFetchWorkflowExecution.js +69 -0
- package/dist/hooks/workflow/useFetchWorkflowExecution.js.map +1 -0
- package/dist/hooks/workflow/useFetchWorkflowExecutions.d.ts +49 -0
- package/dist/hooks/workflow/useFetchWorkflowExecutions.d.ts.map +1 -0
- package/dist/hooks/workflow/useFetchWorkflowExecutions.js +77 -0
- package/dist/hooks/workflow/useFetchWorkflowExecutions.js.map +1 -0
- package/dist/hooks/workflow/useFetchWorkflows.d.ts +47 -0
- package/dist/hooks/workflow/useFetchWorkflows.d.ts.map +1 -0
- package/dist/hooks/workflow/useFetchWorkflows.js +67 -0
- package/dist/hooks/workflow/useFetchWorkflows.js.map +1 -0
- package/dist/hooks/workflow/useRunWorkflow.d.ts +30 -0
- package/dist/hooks/workflow/useRunWorkflow.d.ts.map +1 -0
- package/dist/hooks/workflow/useRunWorkflow.js +50 -0
- package/dist/hooks/workflow/useRunWorkflow.js.map +1 -0
- package/dist/hooks/workspace/useFetchWorkspace.d.ts +197 -0
- package/dist/hooks/workspace/useFetchWorkspace.d.ts.map +1 -0
- package/dist/hooks/workspace/useFetchWorkspace.js +65 -0
- package/dist/hooks/workspace/useFetchWorkspace.js.map +1 -0
- package/dist/hooks/workspace/useFetchWorkspaces.d.ts +46 -0
- package/dist/hooks/workspace/useFetchWorkspaces.d.ts.map +1 -0
- package/dist/hooks/workspace/useFetchWorkspaces.js +66 -0
- package/dist/hooks/workspace/useFetchWorkspaces.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +50 -0
- package/dist/lib/datastoreTable.d.ts +126 -0
- package/dist/lib/datastoreTable.d.ts.map +1 -0
- package/dist/lib/datastoreTable.js +146 -0
- package/dist/lib/datastoreTable.js.map +1 -0
- package/dist/lib/queryClient.d.ts +24 -0
- package/dist/lib/queryClient.d.ts.map +1 -0
- package/dist/lib/queryClient.js +48 -0
- package/dist/lib/queryClient.js.map +1 -0
- package/dist/portfolio/index.d.ts +6 -0
- package/dist/portfolio/index.d.ts.map +1 -0
- package/dist/profile/index.d.ts +4 -0
- package/dist/profile/index.d.ts.map +1 -0
- package/dist/socket/index.d.ts +10 -0
- package/dist/socket/index.d.ts.map +1 -0
- package/dist/socket/index.js +9 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +2 -0
- package/dist/test/mocks/agGridEnterprise.d.ts +38 -0
- package/dist/test/mocks/agGridEnterprise.d.ts.map +1 -0
- package/dist/test/mocks/agGridEnterprise.js +43 -0
- package/dist/test/mocks/agGridEnterprise.js.map +1 -0
- package/dist/test/mocks/agGridReact.d.ts +42 -0
- package/dist/test/mocks/agGridReact.d.ts.map +1 -0
- package/dist/test/mocks/agGridReact.js +47 -0
- package/dist/test/mocks/agGridReact.js.map +1 -0
- package/dist/test/mocks/index.d.ts +5 -0
- package/dist/test/mocks/index.d.ts.map +1 -0
- package/dist/test/mocks/index.js +4 -0
- package/dist/test/mocks/socketIoClient.d.ts +45 -0
- package/dist/test/mocks/socketIoClient.d.ts.map +1 -0
- package/dist/test/mocks/socketIoClient.js +54 -0
- package/dist/test/mocks/socketIoClient.js.map +1 -0
- package/dist/test/renderWithProviders.d.ts +107 -0
- package/dist/test/renderWithProviders.d.ts.map +1 -0
- package/dist/test/renderWithProviders.js +85 -0
- package/dist/test/renderWithProviders.js.map +1 -0
- package/dist/test/setup.d.ts +2 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/test/setup.js +25 -0
- package/dist/test/setup.js.map +1 -0
- package/dist/theme/ThemeProvider.d.ts +12 -0
- package/dist/theme/ThemeProvider.d.ts.map +1 -0
- package/dist/theme/ThemeProvider.js +22 -0
- package/dist/theme/ThemeProvider.js.map +1 -0
- package/dist/theme/index.d.ts +9 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/overrides/index.d.ts +7 -0
- package/dist/theme/overrides/index.d.ts.map +1 -0
- package/dist/theme/overrides/index.js +31 -0
- package/dist/theme/overrides/index.js.map +1 -0
- package/dist/theme/overrides/muiButton.d.ts +3 -0
- package/dist/theme/overrides/muiButton.d.ts.map +1 -0
- package/dist/theme/overrides/muiButton.js +6 -0
- package/dist/theme/overrides/muiButton.js.map +1 -0
- package/dist/theme/overrides/muiCssBaseline.d.ts +31 -0
- package/dist/theme/overrides/muiCssBaseline.d.ts.map +1 -0
- package/dist/theme/overrides/muiCssBaseline.js +27 -0
- package/dist/theme/overrides/muiCssBaseline.js.map +1 -0
- package/dist/theme/overrides/muiDatePicker.d.ts +10 -0
- package/dist/theme/overrides/muiDatePicker.d.ts.map +1 -0
- package/dist/theme/overrides/muiDatePicker.js +6 -0
- package/dist/theme/overrides/muiDatePicker.js.map +1 -0
- package/dist/theme/overrides/muiFormControl.d.ts +3 -0
- package/dist/theme/overrides/muiFormControl.d.ts.map +1 -0
- package/dist/theme/overrides/muiFormControl.js +6 -0
- package/dist/theme/overrides/muiFormControl.js.map +1 -0
- package/dist/theme/overrides/muiIconButton.d.ts +3 -0
- package/dist/theme/overrides/muiIconButton.d.ts.map +1 -0
- package/dist/theme/overrides/muiIconButton.js +6 -0
- package/dist/theme/overrides/muiIconButton.js.map +1 -0
- package/dist/theme/overrides/muiSelect.d.ts +3 -0
- package/dist/theme/overrides/muiSelect.d.ts.map +1 -0
- package/dist/theme/overrides/muiSelect.js +6 -0
- package/dist/theme/overrides/muiSelect.js.map +1 -0
- package/dist/theme/overrides/muiSvgIcon.d.ts +3 -0
- package/dist/theme/overrides/muiSvgIcon.d.ts.map +1 -0
- package/dist/theme/overrides/muiSvgIcon.js +6 -0
- package/dist/theme/overrides/muiSvgIcon.js.map +1 -0
- package/dist/theme/overrides/muiTextField.d.ts +3 -0
- package/dist/theme/overrides/muiTextField.d.ts.map +1 -0
- package/dist/theme/overrides/muiTextField.js +6 -0
- package/dist/theme/overrides/muiTextField.js.map +1 -0
- package/dist/theme/overrides/muiToggleButton.d.ts +3 -0
- package/dist/theme/overrides/muiToggleButton.d.ts.map +1 -0
- package/dist/theme/overrides/muiToggleButton.js +6 -0
- package/dist/theme/overrides/muiToggleButton.js.map +1 -0
- package/dist/theme/overrides/muiToggleButtonGroup.d.ts +3 -0
- package/dist/theme/overrides/muiToggleButtonGroup.d.ts.map +1 -0
- package/dist/theme/overrides/muiToggleButtonGroup.js +6 -0
- package/dist/theme/overrides/muiToggleButtonGroup.js.map +1 -0
- package/dist/theme/themes/DefaultDark.d.ts +7 -0
- package/dist/theme/themes/DefaultDark.d.ts.map +1 -0
- package/dist/theme/themes/DefaultDark.js +15 -0
- package/dist/theme/themes/DefaultDark.js.map +1 -0
- package/dist/theme/themes/DefaultLight.d.ts +7 -0
- package/dist/theme/themes/DefaultLight.d.ts.map +1 -0
- package/dist/theme/themes/DefaultLight.js +15 -0
- package/dist/theme/themes/DefaultLight.js.map +1 -0
- package/dist/theme/themes/EveryskDark.d.ts +15 -0
- package/dist/theme/themes/EveryskDark.d.ts.map +1 -0
- package/dist/theme/themes/EveryskDark.js +63 -0
- package/dist/theme/themes/EveryskDark.js.map +1 -0
- package/dist/theme/themes/EveryskLight.d.ts +21 -0
- package/dist/theme/themes/EveryskLight.d.ts.map +1 -0
- package/dist/theme/themes/EveryskLight.js +69 -0
- package/dist/theme/themes/EveryskLight.js.map +1 -0
- package/dist/theme/themes/MidnightEmber.d.ts +3 -0
- package/dist/theme/themes/MidnightEmber.d.ts.map +1 -0
- package/dist/theme/themes/MidnightEmber.js +31 -0
- package/dist/theme/themes/MidnightEmber.js.map +1 -0
- package/dist/theme/themes/index.d.ts +17 -0
- package/dist/theme/themes/index.d.ts.map +1 -0
- package/dist/theme/themes/index.js +32 -0
- package/dist/theme/themes/index.js.map +1 -0
- package/dist/types/anyRecord.d.ts +4 -0
- package/dist/types/anyRecord.d.ts.map +1 -0
- package/dist/types/datastore.d.ts +26 -0
- package/dist/types/datastore.d.ts.map +1 -0
- package/dist/types/entityQuery.d.ts +47 -0
- package/dist/types/entityQuery.d.ts.map +1 -0
- package/dist/types/file.d.ts +29 -0
- package/dist/types/file.d.ts.map +1 -0
- package/dist/types/portfolio.d.ts +77 -0
- package/dist/types/portfolio.d.ts.map +1 -0
- package/dist/types/profile.d.ts +37 -0
- package/dist/types/profile.d.ts.map +1 -0
- package/dist/types/workflow.d.ts +68 -0
- package/dist/types/workflow.d.ts.map +1 -0
- package/dist/types/workspace.d.ts +13 -0
- package/dist/types/workspace.d.ts.map +1 -0
- package/dist/ui/index.d.ts +6 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/workflow/index.d.ts +10 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workspace/index.d.ts +5 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/package.json +148 -0
- package/src/EveryskApp.tsx +108 -0
- package/src/agGrid/agGridTheme.ts +113 -0
- package/src/agGrid/index.ts +15 -0
- package/src/api/datastore.ts +175 -0
- package/src/api/entityQuery.ts +101 -0
- package/src/api/file.ts +174 -0
- package/src/api/portfolio.ts +190 -0
- package/src/api/profile.ts +80 -0
- package/src/api/websocketsConfig.ts +32 -0
- package/src/api/workflow.ts +427 -0
- package/src/api/workspace.ts +72 -0
- package/src/components/ui/EveryskIcon/index.tsx +24 -0
- package/src/components/ui/Footer/index.tsx +30 -0
- package/src/components/ui/GlobalLoading/index.tsx +38 -0
- package/src/components/ui/PageContainer/index.tsx +14 -0
- package/src/components/ui/Toolbar/index.tsx +44 -0
- package/src/contexts/agGridLicenseContext/provider.tsx +63 -0
- package/src/contexts/appAlertContext/index.tsx +4 -0
- package/src/contexts/appAlertContext/provider.tsx +92 -0
- package/src/contexts/appAlertContext/types.ts +17 -0
- package/src/contexts/appAlertContext/useAppAlert.ts +39 -0
- package/src/contexts/appConfigContext/index.tsx +4 -0
- package/src/contexts/appConfigContext/provider.tsx +67 -0
- package/src/contexts/appConfigContext/types.ts +28 -0
- package/src/contexts/appConfigContext/useAppConfig.ts +30 -0
- package/src/contexts/webSocketContext/constants.ts +3 -0
- package/src/contexts/webSocketContext/handler.ts +108 -0
- package/src/contexts/webSocketContext/hooks/useAppNotificationSubscription/index.ts +36 -0
- package/src/contexts/webSocketContext/hooks/useWebSocket/index.ts +18 -0
- package/src/contexts/webSocketContext/hooks/useWebSocketSubscription/index.ts +45 -0
- package/src/contexts/webSocketContext/index.tsx +5 -0
- package/src/contexts/webSocketContext/provider.tsx +125 -0
- package/src/contexts/webSocketContext/types.ts +50 -0
- package/src/datastore/index.ts +14 -0
- package/src/file/index.ts +13 -0
- package/src/hooks/datastore/useDatastoreMutations.ts +221 -0
- package/src/hooks/datastore/useFetchDatastore.ts +95 -0
- package/src/hooks/datastore/useFetchDatastores.ts +162 -0
- package/src/hooks/file/useFetchFile.ts +93 -0
- package/src/hooks/file/useFetchFiles.ts +109 -0
- package/src/hooks/file/useFileMutations.ts +240 -0
- package/src/hooks/portfolio/useFetchPortfolio.ts +94 -0
- package/src/hooks/portfolio/useFetchPortfolios.ts +109 -0
- package/src/hooks/portfolio/usePortfolioMutations.ts +250 -0
- package/src/hooks/profile/useFetchProfile.ts +93 -0
- package/src/hooks/useAxios.ts +98 -0
- package/src/hooks/workflow/useFetchWorkerExecution.ts +78 -0
- package/src/hooks/workflow/useFetchWorkerExecutions.ts +98 -0
- package/src/hooks/workflow/useFetchWorkflow.ts +76 -0
- package/src/hooks/workflow/useFetchWorkflowExecution.ts +79 -0
- package/src/hooks/workflow/useFetchWorkflowExecutions.ts +95 -0
- package/src/hooks/workflow/useFetchWorkflows.ts +84 -0
- package/src/hooks/workflow/useRunWorkflow.ts +62 -0
- package/src/hooks/workspace/useFetchWorkspace.ts +78 -0
- package/src/hooks/workspace/useFetchWorkspaces.ts +86 -0
- package/src/index.ts +72 -0
- package/src/lib/datastoreTable.ts +159 -0
- package/src/lib/queryClient.ts +60 -0
- package/src/portfolio/index.ts +13 -0
- package/src/profile/index.ts +11 -0
- package/src/socket/index.ts +19 -0
- package/src/test/index.ts +10 -0
- package/src/test/mocks/agGridEnterprise.ts +45 -0
- package/src/test/mocks/agGridReact.tsx +61 -0
- package/src/test/mocks/index.ts +22 -0
- package/src/test/mocks/socketIoClient.ts +78 -0
- package/src/test/renderWithProviders.tsx +114 -0
- package/src/test/setup.ts +46 -0
- package/src/theme/ThemeProvider.tsx +33 -0
- package/src/theme/index.ts +15 -0
- package/src/theme/overrides/index.ts +31 -0
- package/src/theme/overrides/muiButton.ts +7 -0
- package/src/theme/overrides/muiCssBaseline.ts +35 -0
- package/src/theme/overrides/muiDatePicker.ts +5 -0
- package/src/theme/overrides/muiFormControl.ts +7 -0
- package/src/theme/overrides/muiIconButton.ts +7 -0
- package/src/theme/overrides/muiSelect.ts +7 -0
- package/src/theme/overrides/muiSvgIcon.ts +7 -0
- package/src/theme/overrides/muiTextField.ts +7 -0
- package/src/theme/overrides/muiToggleButton.ts +7 -0
- package/src/theme/overrides/muiToggleButtonGroup.ts +7 -0
- package/src/theme/themes/DefaultDark.ts +14 -0
- package/src/theme/themes/DefaultLight.ts +14 -0
- package/src/theme/themes/EveryskDark.ts +62 -0
- package/src/theme/themes/EveryskLight.ts +68 -0
- package/src/theme/themes/MidnightEmber.ts +30 -0
- package/src/theme/themes/index.ts +35 -0
- package/src/types/anyRecord.ts +4 -0
- package/src/types/datastore.ts +33 -0
- package/src/types/entityQuery.ts +64 -0
- package/src/types/file.ts +32 -0
- package/src/types/portfolio.ts +81 -0
- package/src/types/profile.ts +39 -0
- package/src/types/workflow.ts +76 -0
- package/src/types/workspace.ts +15 -0
- package/src/ui/index.ts +14 -0
- package/src/workflow/index.ts +17 -0
- package/src/workspace/index.ts +12 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { EveryskIcon } from "../EveryskIcon/index.js";
|
|
2
|
+
import { useTheme } from "@mui/material/styles";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import clsx$1 from "clsx";
|
|
5
|
+
import AppBar from "@mui/material/AppBar";
|
|
6
|
+
import MuiToolbar from "@mui/material/Toolbar";
|
|
7
|
+
//#region src/components/ui/Toolbar/index.tsx
|
|
8
|
+
var Toolbar = ({ children, className }) => {
|
|
9
|
+
const theme = useTheme();
|
|
10
|
+
return /* @__PURE__ */ jsx(AppBar, {
|
|
11
|
+
position: "relative",
|
|
12
|
+
...{
|
|
13
|
+
light: {
|
|
14
|
+
color: "transparent",
|
|
15
|
+
elevation: 0,
|
|
16
|
+
sx: { border: "1px solid rgba(0, 0, 0, 0.12)" }
|
|
17
|
+
},
|
|
18
|
+
dark: {
|
|
19
|
+
color: "default",
|
|
20
|
+
elevation: 1
|
|
21
|
+
}
|
|
22
|
+
}[theme.palette.mode],
|
|
23
|
+
children: /* @__PURE__ */ jsx(MuiToolbar, { children: /* @__PURE__ */ jsxs("div", {
|
|
24
|
+
className: clsx$1("flex items-center gap-4", className),
|
|
25
|
+
children: [/* @__PURE__ */ jsx(EveryskIcon, {}), children]
|
|
26
|
+
}) })
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { Toolbar };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/ui/Toolbar/index.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\n\nimport AppBar from '@mui/material/AppBar';\nimport { useTheme, type Theme } from '@mui/material/styles';\nimport MuiToolbar from '@mui/material/Toolbar';\n\nimport clsx from 'clsx';\n\nimport { EveryskIcon } from '@/components/ui/EveryskIcon';\n\nimport type { AnyRecord } from '@/types/anyRecord';\n\nexport const Toolbar = ({ children, className }: PropsWithChildren<{ className?: string }>) => {\n const theme: Theme = useTheme();\n\n const styles: AnyRecord = {\n light: {\n color: 'transparent',\n elevation: 0,\n sx: {\n border: \"1px solid rgba(0, 0, 0, 0.12)\"\n }\n },\n dark: {\n // 'default', not ''. An empty string is not a value the AppBar API takes — it\n // produced the class `MuiAppBar-color` with no variant suffix, which rendered the\n // same only because the brand theme overrides AppBar anyway. This is the explicit\n // spelling of what already happens, and it survives a theme that does not.\n color: 'default',\n elevation: 1\n }\n };\n\n return (\n <AppBar position='relative' {...styles?.[theme.palette.mode]}>\n <MuiToolbar >\n <div className={clsx(\"flex items-center gap-4\", className)}>\n <EveryskIcon />\n {children}\n </div>\n </MuiToolbar>\n </AppBar>\n );\n}\n"],"mappings":";;;;;;;AAYA,IAAa,WAAW,EAAE,UAAU,gBAA2D;CAC3F,MAAM,QAAe,SAAS;CAoB9B,OACI,oBAAC,QAAD;EAAQ,UAAS;EAAW,GAAI;GAlBhC,OAAO;IACH,OAAO;IACP,WAAW;IACX,IAAI,EACA,QAAQ,gCACZ;GACJ;GACA,MAAM;IAKF,OAAO;IACP,WAAW;GACf;EAIgC,EAAS,MAAM,QAAQ;EACnD,UAAA,oBAAC,YAAD,EAAA,UACI,qBAAC,OAAD;GAAK,WAAW,OAAK,2BAA2B,SAAS;GAAzD,UAAA,CACI,oBAAC,aAAD,CAAc,CAAA,GACb,QACA;EACG,CAAA,EAAA,CAAA;CACR,CAAA;AAEhB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* setAgGridLicense
|
|
4
|
+
*
|
|
5
|
+
* Registers the AG Grid Enterprise license. A no-op when the key is missing or empty, so an
|
|
6
|
+
* app that has not configured one degrades to the watermark instead of throwing.
|
|
7
|
+
*
|
|
8
|
+
* The key is a **parameter**, not something this package reads from the environment. The
|
|
9
|
+
* template read `import.meta.env.VITE_AG_GRID_LICENSE_KEY` at module scope, which works
|
|
10
|
+
* inside an app and silently breaks inside a published package: Vite replaces
|
|
11
|
+
* `import.meta.env.VITE_*` with a literal at the build of whoever compiles the file, so the
|
|
12
|
+
* value would freeze to whatever the SDK's own CI had — nothing — and the consuming app's
|
|
13
|
+
* environment would never reach it. No build error, no runtime error, just the watermark.
|
|
14
|
+
*
|
|
15
|
+
* The app keeps ownership of its own environment:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* // src/main.tsx
|
|
19
|
+
* setAgGridLicense(import.meta.env.VITE_AG_GRID_LICENSE_KEY);
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @param {string} [licenseKey] - The license key, typically from the app's build environment.
|
|
23
|
+
*/
|
|
24
|
+
export declare const setAgGridLicense: (licenseKey?: string) => void;
|
|
25
|
+
export type AgGridLicenseProviderProps = PropsWithChildren<{
|
|
26
|
+
/** The license key. Omitted or empty, the provider only renders its children. */
|
|
27
|
+
licenseKey?: string;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* AgGridLicenseProvider
|
|
31
|
+
*
|
|
32
|
+
* Provider form of `setAgGridLicense`, for apps that would rather configure the license in
|
|
33
|
+
* the component tree than at bootstrap. It holds no context — it registers the key and
|
|
34
|
+
* renders its children.
|
|
35
|
+
*
|
|
36
|
+
* The registration happens in the render body rather than in an effect on purpose: AG Grid
|
|
37
|
+
* reads the license when a grid first renders, and an effect runs *after* that commit, so a
|
|
38
|
+
* grid mounted in the same commit would flash the watermark. React renders a parent's body
|
|
39
|
+
* before its children, which is exactly the ordering needed here. `setLicenseKey` is an
|
|
40
|
+
* idempotent setter on a module global, so StrictMode's double render is harmless.
|
|
41
|
+
*
|
|
42
|
+
* ```tsx
|
|
43
|
+
* <EveryskApp>
|
|
44
|
+
* <AgGridLicenseProvider licenseKey={import.meta.env.VITE_AG_GRID_LICENSE_KEY}>
|
|
45
|
+
* <Routes />
|
|
46
|
+
* </AgGridLicenseProvider>
|
|
47
|
+
* </EveryskApp>
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare const AgGridLicenseProvider: ({ children, licenseKey }: AgGridLicenseProviderProps) => import("react").JSX.Element;
|
|
51
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/contexts/agGridLicenseContext/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI/C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,gBAAgB,GAAI,aAAa,MAAM,KAAG,IAItD,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,iBAAiB,CAAC;IACvD,iFAAiF;IACjF,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,qBAAqB,GAAI,0BAA0B,0BAA0B,gCAIzF,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { LicenseManager } from "ag-grid-enterprise";
|
|
4
|
+
//#region src/contexts/agGridLicenseContext/provider.tsx
|
|
5
|
+
/**
|
|
6
|
+
* setAgGridLicense
|
|
7
|
+
*
|
|
8
|
+
* Registers the AG Grid Enterprise license. A no-op when the key is missing or empty, so an
|
|
9
|
+
* app that has not configured one degrades to the watermark instead of throwing.
|
|
10
|
+
*
|
|
11
|
+
* The key is a **parameter**, not something this package reads from the environment. The
|
|
12
|
+
* template read `import.meta.env.VITE_AG_GRID_LICENSE_KEY` at module scope, which works
|
|
13
|
+
* inside an app and silently breaks inside a published package: Vite replaces
|
|
14
|
+
* `import.meta.env.VITE_*` with a literal at the build of whoever compiles the file, so the
|
|
15
|
+
* value would freeze to whatever the SDK's own CI had — nothing — and the consuming app's
|
|
16
|
+
* environment would never reach it. No build error, no runtime error, just the watermark.
|
|
17
|
+
*
|
|
18
|
+
* The app keeps ownership of its own environment:
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* // src/main.tsx
|
|
22
|
+
* setAgGridLicense(import.meta.env.VITE_AG_GRID_LICENSE_KEY);
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @param {string} [licenseKey] - The license key, typically from the app's build environment.
|
|
26
|
+
*/
|
|
27
|
+
var setAgGridLicense = (licenseKey) => {
|
|
28
|
+
if (typeof licenseKey === "string" && licenseKey) LicenseManager.setLicenseKey(licenseKey);
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* AgGridLicenseProvider
|
|
32
|
+
*
|
|
33
|
+
* Provider form of `setAgGridLicense`, for apps that would rather configure the license in
|
|
34
|
+
* the component tree than at bootstrap. It holds no context — it registers the key and
|
|
35
|
+
* renders its children.
|
|
36
|
+
*
|
|
37
|
+
* The registration happens in the render body rather than in an effect on purpose: AG Grid
|
|
38
|
+
* reads the license when a grid first renders, and an effect runs *after* that commit, so a
|
|
39
|
+
* grid mounted in the same commit would flash the watermark. React renders a parent's body
|
|
40
|
+
* before its children, which is exactly the ordering needed here. `setLicenseKey` is an
|
|
41
|
+
* idempotent setter on a module global, so StrictMode's double render is harmless.
|
|
42
|
+
*
|
|
43
|
+
* ```tsx
|
|
44
|
+
* <EveryskApp>
|
|
45
|
+
* <AgGridLicenseProvider licenseKey={import.meta.env.VITE_AG_GRID_LICENSE_KEY}>
|
|
46
|
+
* <Routes />
|
|
47
|
+
* </AgGridLicenseProvider>
|
|
48
|
+
* </EveryskApp>
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
var AgGridLicenseProvider = ({ children, licenseKey }) => {
|
|
52
|
+
setAgGridLicense(licenseKey);
|
|
53
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
54
|
+
};
|
|
55
|
+
//#endregion
|
|
56
|
+
export { AgGridLicenseProvider, setAgGridLicense };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","names":[],"sources":["../../../src/contexts/agGridLicenseContext/provider.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\n\nimport { LicenseManager } from \"ag-grid-enterprise\";\n\n/**\n * setAgGridLicense\n *\n * Registers the AG Grid Enterprise license. A no-op when the key is missing or empty, so an\n * app that has not configured one degrades to the watermark instead of throwing.\n *\n * The key is a **parameter**, not something this package reads from the environment. The\n * template read `import.meta.env.VITE_AG_GRID_LICENSE_KEY` at module scope, which works\n * inside an app and silently breaks inside a published package: Vite replaces\n * `import.meta.env.VITE_*` with a literal at the build of whoever compiles the file, so the\n * value would freeze to whatever the SDK's own CI had — nothing — and the consuming app's\n * environment would never reach it. No build error, no runtime error, just the watermark.\n *\n * The app keeps ownership of its own environment:\n *\n * ```ts\n * // src/main.tsx\n * setAgGridLicense(import.meta.env.VITE_AG_GRID_LICENSE_KEY);\n * ```\n *\n * @param {string} [licenseKey] - The license key, typically from the app's build environment.\n */\nexport const setAgGridLicense = (licenseKey?: string): void => {\n if (typeof licenseKey === \"string\" && licenseKey) {\n LicenseManager.setLicenseKey(licenseKey);\n }\n};\n\nexport type AgGridLicenseProviderProps = PropsWithChildren<{\n /** The license key. Omitted or empty, the provider only renders its children. */\n licenseKey?: string;\n}>;\n\n/**\n * AgGridLicenseProvider\n *\n * Provider form of `setAgGridLicense`, for apps that would rather configure the license in\n * the component tree than at bootstrap. It holds no context — it registers the key and\n * renders its children.\n *\n * The registration happens in the render body rather than in an effect on purpose: AG Grid\n * reads the license when a grid first renders, and an effect runs *after* that commit, so a\n * grid mounted in the same commit would flash the watermark. React renders a parent's body\n * before its children, which is exactly the ordering needed here. `setLicenseKey` is an\n * idempotent setter on a module global, so StrictMode's double render is harmless.\n *\n * ```tsx\n * <EveryskApp>\n * <AgGridLicenseProvider licenseKey={import.meta.env.VITE_AG_GRID_LICENSE_KEY}>\n * <Routes />\n * </AgGridLicenseProvider>\n * </EveryskApp>\n * ```\n */\nexport const AgGridLicenseProvider = ({ children, licenseKey }: AgGridLicenseProviderProps) => {\n setAgGridLicense(licenseKey);\n\n return <>{children}</>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAa,oBAAoB,eAA8B;CAC3D,IAAI,OAAO,eAAe,YAAY,YAClC,eAAe,cAAc,UAAU;AAE/C;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAa,yBAAyB,EAAE,UAAU,iBAA6C;CAC3F,iBAAiB,UAAU;CAE3B,OAAO,oBAAA,UAAA,EAAG,SAAW,CAAA;AACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/contexts/appAlertContext/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,eAAe,qDAAkD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/contexts/appAlertContext/index.tsx"],"sourcesContent":["import { createContext } from \"react\";\nimport type { AppAlertContextType } from \"./types\";\n\nexport const AppAlertContext = createContext<AppAlertContextType | null>(null);\n"],"mappings":";;AAGA,IAAa,kBAAkB,cAA0C,IAAI"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* AppAlertProvider
|
|
4
|
+
*
|
|
5
|
+
* React context provider responsible for exposing a global application alert API and rendering
|
|
6
|
+
* a Material UI `Snackbar` + `Alert` pair anchored to the viewport.
|
|
7
|
+
*
|
|
8
|
+
* What this provider does:
|
|
9
|
+
* - Maintains an internal `AppAlertState` that controls:
|
|
10
|
+
* - visibility (`open`)
|
|
11
|
+
* - displayed text (`message`)
|
|
12
|
+
* - alert tone (`severity`)
|
|
13
|
+
* - auto-dismiss timing (`autoHideDuration`)
|
|
14
|
+
* - screen position (`anchorOrigin`)
|
|
15
|
+
* - Exposes an imperative API via context:
|
|
16
|
+
* - `showAlert(options)` to open/update the alert
|
|
17
|
+
* - `hideAlert()` to close the alert
|
|
18
|
+
* - Renders the `Snackbar`/`Alert` components once (at the provider level), so any descendant can
|
|
19
|
+
* trigger alerts without needing to manage UI state locally.
|
|
20
|
+
*
|
|
21
|
+
* Behavior:
|
|
22
|
+
* - `showAlert(options)` performs a shallow merge of the provided options into the current state
|
|
23
|
+
* and forces `open: true`.
|
|
24
|
+
* - `hideAlert()` sets `open: false` (preserving the remaining state).
|
|
25
|
+
* - Snackbar `onClose` ignores the `"clickaway"` reason to prevent accidental dismissals when the user
|
|
26
|
+
* clicks outside the toast.
|
|
27
|
+
*
|
|
28
|
+
* Performance / stability:
|
|
29
|
+
* - `showAlert` and `hideAlert` should be stable (e.g., created with `useCallback`) so the context value
|
|
30
|
+
* does not change on every render, avoiding unnecessary re-renders in consumers.
|
|
31
|
+
*
|
|
32
|
+
* Usage:
|
|
33
|
+
* ```ts
|
|
34
|
+
* <AppAlertProvider>
|
|
35
|
+
* <App />
|
|
36
|
+
* </AppAlertProvider>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare const AppAlertProvider: ({ children }: PropsWithChildren) => import("react").JSX.Element;
|
|
40
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/contexts/appAlertContext/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAO/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,eAAO,MAAM,gBAAgB,GAAI,cAAc,iBAAiB,gCA8C/D,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { AppAlertContext } from "./index.js";
|
|
2
|
+
import { useCallback, useMemo, useState } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import Alert from "@mui/material/Alert";
|
|
5
|
+
import Snackbar from "@mui/material/Snackbar";
|
|
6
|
+
//#region src/contexts/appAlertContext/provider.tsx
|
|
7
|
+
/**
|
|
8
|
+
* AppAlertProvider
|
|
9
|
+
*
|
|
10
|
+
* React context provider responsible for exposing a global application alert API and rendering
|
|
11
|
+
* a Material UI `Snackbar` + `Alert` pair anchored to the viewport.
|
|
12
|
+
*
|
|
13
|
+
* What this provider does:
|
|
14
|
+
* - Maintains an internal `AppAlertState` that controls:
|
|
15
|
+
* - visibility (`open`)
|
|
16
|
+
* - displayed text (`message`)
|
|
17
|
+
* - alert tone (`severity`)
|
|
18
|
+
* - auto-dismiss timing (`autoHideDuration`)
|
|
19
|
+
* - screen position (`anchorOrigin`)
|
|
20
|
+
* - Exposes an imperative API via context:
|
|
21
|
+
* - `showAlert(options)` to open/update the alert
|
|
22
|
+
* - `hideAlert()` to close the alert
|
|
23
|
+
* - Renders the `Snackbar`/`Alert` components once (at the provider level), so any descendant can
|
|
24
|
+
* trigger alerts without needing to manage UI state locally.
|
|
25
|
+
*
|
|
26
|
+
* Behavior:
|
|
27
|
+
* - `showAlert(options)` performs a shallow merge of the provided options into the current state
|
|
28
|
+
* and forces `open: true`.
|
|
29
|
+
* - `hideAlert()` sets `open: false` (preserving the remaining state).
|
|
30
|
+
* - Snackbar `onClose` ignores the `"clickaway"` reason to prevent accidental dismissals when the user
|
|
31
|
+
* clicks outside the toast.
|
|
32
|
+
*
|
|
33
|
+
* Performance / stability:
|
|
34
|
+
* - `showAlert` and `hideAlert` should be stable (e.g., created with `useCallback`) so the context value
|
|
35
|
+
* does not change on every render, avoiding unnecessary re-renders in consumers.
|
|
36
|
+
*
|
|
37
|
+
* Usage:
|
|
38
|
+
* ```ts
|
|
39
|
+
* <AppAlertProvider>
|
|
40
|
+
* <App />
|
|
41
|
+
* </AppAlertProvider>
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
var AppAlertProvider = ({ children }) => {
|
|
45
|
+
const [state, setState] = useState({
|
|
46
|
+
open: false,
|
|
47
|
+
message: "",
|
|
48
|
+
severity: "info",
|
|
49
|
+
autoHideDuration: 4e3,
|
|
50
|
+
anchorOrigin: {
|
|
51
|
+
vertical: "bottom",
|
|
52
|
+
horizontal: "right"
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const hideAlert = useCallback(() => {
|
|
56
|
+
setState((prev) => ({
|
|
57
|
+
...prev,
|
|
58
|
+
open: false
|
|
59
|
+
}));
|
|
60
|
+
}, []);
|
|
61
|
+
const showAlert = useCallback((options) => {
|
|
62
|
+
setState((prev) => ({
|
|
63
|
+
...prev,
|
|
64
|
+
...options,
|
|
65
|
+
open: true
|
|
66
|
+
}));
|
|
67
|
+
}, []);
|
|
68
|
+
const value = useMemo(() => ({
|
|
69
|
+
showAlert,
|
|
70
|
+
hideAlert
|
|
71
|
+
}), [showAlert, hideAlert]);
|
|
72
|
+
return /* @__PURE__ */ jsxs(AppAlertContext.Provider, {
|
|
73
|
+
value,
|
|
74
|
+
children: [children, /* @__PURE__ */ jsx(Snackbar, {
|
|
75
|
+
open: state.open,
|
|
76
|
+
message: state.message,
|
|
77
|
+
autoHideDuration: state.autoHideDuration,
|
|
78
|
+
anchorOrigin: state.anchorOrigin,
|
|
79
|
+
onClose: (_, reason) => {
|
|
80
|
+
if (reason === "clickaway") return;
|
|
81
|
+
hideAlert();
|
|
82
|
+
},
|
|
83
|
+
children: /* @__PURE__ */ jsx(Alert, {
|
|
84
|
+
onClose: hideAlert,
|
|
85
|
+
severity: state.severity,
|
|
86
|
+
variant: "filled",
|
|
87
|
+
elevation: 6,
|
|
88
|
+
children: state.message
|
|
89
|
+
})
|
|
90
|
+
})]
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
//#endregion
|
|
94
|
+
export { AppAlertProvider };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","names":[],"sources":["../../../src/contexts/appAlertContext/provider.tsx"],"sourcesContent":["import { useCallback, useMemo, useState, type PropsWithChildren } from \"react\";\nimport Alert from \"@mui/material/Alert\";\nimport Snackbar, { type SnackbarCloseReason } from \"@mui/material/Snackbar\";\n\nimport { AppAlertContext } from \".\";\nimport type { AppAlertContextType, AppAlertState, ShowAlertOptions } from \"./types\";\n\n/**\n * AppAlertProvider\n *\n * React context provider responsible for exposing a global application alert API and rendering\n * a Material UI `Snackbar` + `Alert` pair anchored to the viewport.\n *\n * What this provider does:\n * - Maintains an internal `AppAlertState` that controls:\n * - visibility (`open`)\n * - displayed text (`message`)\n * - alert tone (`severity`)\n * - auto-dismiss timing (`autoHideDuration`)\n * - screen position (`anchorOrigin`)\n * - Exposes an imperative API via context:\n * - `showAlert(options)` to open/update the alert\n * - `hideAlert()` to close the alert\n * - Renders the `Snackbar`/`Alert` components once (at the provider level), so any descendant can\n * trigger alerts without needing to manage UI state locally.\n *\n * Behavior:\n * - `showAlert(options)` performs a shallow merge of the provided options into the current state\n * and forces `open: true`.\n * - `hideAlert()` sets `open: false` (preserving the remaining state).\n * - Snackbar `onClose` ignores the `\"clickaway\"` reason to prevent accidental dismissals when the user\n * clicks outside the toast.\n *\n * Performance / stability:\n * - `showAlert` and `hideAlert` should be stable (e.g., created with `useCallback`) so the context value\n * does not change on every render, avoiding unnecessary re-renders in consumers.\n *\n * Usage:\n * ```ts\n * <AppAlertProvider>\n * <App />\n * </AppAlertProvider>\n * ```\n */\n\nexport const AppAlertProvider = ({ children }: PropsWithChildren) => {\n const [state, setState] = useState<AppAlertState>({\n open: false,\n message: \"\",\n severity: \"info\",\n autoHideDuration: 4000,\n anchorOrigin: { vertical: \"bottom\", horizontal: \"right\" },\n });\n\n const hideAlert = useCallback(() => {\n setState((prev) => ({ ...prev, open: false }));\n }, []);\n\n const showAlert = useCallback((options: ShowAlertOptions) => {\n setState((prev) => ({\n ...prev,\n ...options,\n open: true,\n }));\n }, []);\n\n const value: AppAlertContextType = useMemo(\n () => ({ showAlert, hideAlert }),\n [showAlert, hideAlert]\n );\n\n return (\n <AppAlertContext.Provider value={value}>\n {children}\n\n <Snackbar\n open={state.open}\n message={state.message}\n autoHideDuration={state.autoHideDuration}\n anchorOrigin={state.anchorOrigin}\n onClose={(_, reason: SnackbarCloseReason) => {\n if (reason === \"clickaway\") return;\n hideAlert();\n }}\n >\n <Alert onClose={hideAlert} severity={state.severity} variant=\"filled\" elevation={6}>\n {state.message}\n </Alert>\n </Snackbar>\n </AppAlertContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,IAAa,oBAAoB,EAAE,eAAkC;CACjE,MAAM,CAAC,OAAO,YAAY,SAAwB;EAC9C,MAAM;EACN,SAAS;EACT,UAAU;EACV,kBAAkB;EAClB,cAAc;GAAE,UAAU;GAAU,YAAY;EAAQ;CAC5D,CAAC;CAED,MAAM,YAAY,kBAAkB;EAChC,UAAU,UAAU;GAAE,GAAG;GAAM,MAAM;EAAM,EAAE;CACjD,GAAG,CAAC,CAAC;CAEL,MAAM,YAAY,aAAa,YAA8B;EACzD,UAAU,UAAU;GAChB,GAAG;GACH,GAAG;GACH,MAAM;EACV,EAAE;CACN,GAAG,CAAC,CAAC;CAEL,MAAM,QAA6B,eACxB;EAAE;EAAW;CAAU,IAC9B,CAAC,WAAW,SAAS,CACzB;CAEA,OACI,qBAAC,gBAAgB,UAAjB;EAAiC;EAAjC,UAAA,CACK,UAED,oBAAC,UAAD;GACI,MAAM,MAAM;GACZ,SAAS,MAAM;GACf,kBAAkB,MAAM;GACxB,cAAc,MAAM;GACpB,UAAU,GAAG,WAAgC;IACzC,IAAI,WAAW,aAAa;IAC5B,UAAU;GACd;GAEA,UAAA,oBAAC,OAAD;IAAO,SAAS;IAAW,UAAU,MAAM;IAAU,SAAQ;IAAS,WAAW;IAC5E,UAAA,MAAM;GACJ,CAAA;EACD,CAAA,CACY;;AAElC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AlertColor } from "@mui/material/Alert";
|
|
2
|
+
import type { SnackbarProps } from "@mui/material/Snackbar";
|
|
3
|
+
export type AppAlertState = Omit<SnackbarProps, "open" | "onClose" | "message"> & {
|
|
4
|
+
open: boolean;
|
|
5
|
+
message: string;
|
|
6
|
+
severity: AlertColor;
|
|
7
|
+
};
|
|
8
|
+
export type ShowAlertOptions = Partial<Omit<AppAlertState, "open">> & {
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
export type AppAlertContextType = {
|
|
12
|
+
showAlert: (options: ShowAlertOptions) => void;
|
|
13
|
+
hideAlert: () => void;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/contexts/appAlertContext/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC,GAAG;IAC9E,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,GAAG;IAClE,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC/C,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useAppAlert
|
|
3
|
+
*
|
|
4
|
+
* Convenience hook that reads the alert API from `AppAlertContext`.
|
|
5
|
+
*
|
|
6
|
+
* Behavior:
|
|
7
|
+
* - Returns the functions exposed by `<AppAlertProvider>`, typically:
|
|
8
|
+
* - `showAlert(options)` to display an alert
|
|
9
|
+
* - `hideAlert()` to close the current alert
|
|
10
|
+
*
|
|
11
|
+
* Error handling:
|
|
12
|
+
* - Throws a descriptive error if called outside of an `<AppAlertProvider>` scope, to fail fast
|
|
13
|
+
* and prevent silent no-op alert calls.
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* ```ts
|
|
17
|
+
* const { showAlert } = useAppAlert();
|
|
18
|
+
*
|
|
19
|
+
* showAlert({
|
|
20
|
+
* message: "Saved successfully.",
|
|
21
|
+
* severity: "success",
|
|
22
|
+
* autoHideDuration: 3000,
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @throws {Error}
|
|
27
|
+
* Throws if the hook is used outside of `<AppAlertProvider>`.
|
|
28
|
+
*/
|
|
29
|
+
export declare const useAppAlert: () => import("./types").AppAlertContextType;
|
|
30
|
+
//# sourceMappingURL=useAppAlert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppAlert.d.ts","sourceRoot":"","sources":["../../../src/contexts/appAlertContext/useAppAlert.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,eAAO,MAAM,WAAW,6CAMvB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AppAlertContext } from "./index.js";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
//#region src/contexts/appAlertContext/useAppAlert.ts
|
|
4
|
+
/**
|
|
5
|
+
* useAppAlert
|
|
6
|
+
*
|
|
7
|
+
* Convenience hook that reads the alert API from `AppAlertContext`.
|
|
8
|
+
*
|
|
9
|
+
* Behavior:
|
|
10
|
+
* - Returns the functions exposed by `<AppAlertProvider>`, typically:
|
|
11
|
+
* - `showAlert(options)` to display an alert
|
|
12
|
+
* - `hideAlert()` to close the current alert
|
|
13
|
+
*
|
|
14
|
+
* Error handling:
|
|
15
|
+
* - Throws a descriptive error if called outside of an `<AppAlertProvider>` scope, to fail fast
|
|
16
|
+
* and prevent silent no-op alert calls.
|
|
17
|
+
*
|
|
18
|
+
* Usage:
|
|
19
|
+
* ```ts
|
|
20
|
+
* const { showAlert } = useAppAlert();
|
|
21
|
+
*
|
|
22
|
+
* showAlert({
|
|
23
|
+
* message: "Saved successfully.",
|
|
24
|
+
* severity: "success",
|
|
25
|
+
* autoHideDuration: 3000,
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @throws {Error}
|
|
30
|
+
* Throws if the hook is used outside of `<AppAlertProvider>`.
|
|
31
|
+
*/
|
|
32
|
+
var useAppAlert = () => {
|
|
33
|
+
const ctx = useContext(AppAlertContext);
|
|
34
|
+
if (!ctx) throw new Error("useAppAlert must be used within <AppAlertProvider>.");
|
|
35
|
+
return ctx;
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
38
|
+
export { useAppAlert };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=useAppAlert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppAlert.js","names":[],"sources":["../../../src/contexts/appAlertContext/useAppAlert.ts"],"sourcesContent":["import { useContext } from \"react\";\nimport { AppAlertContext } from \".\";\n\n/**\n * useAppAlert\n *\n * Convenience hook that reads the alert API from `AppAlertContext`.\n *\n * Behavior:\n * - Returns the functions exposed by `<AppAlertProvider>`, typically:\n * - `showAlert(options)` to display an alert\n * - `hideAlert()` to close the current alert\n *\n * Error handling:\n * - Throws a descriptive error if called outside of an `<AppAlertProvider>` scope, to fail fast\n * and prevent silent no-op alert calls.\n *\n * Usage:\n * ```ts\n * const { showAlert } = useAppAlert();\n *\n * showAlert({\n * message: \"Saved successfully.\",\n * severity: \"success\",\n * autoHideDuration: 3000,\n * });\n * ```\n *\n * @throws {Error}\n * Throws if the hook is used outside of `<AppAlertProvider>`.\n */\n\nexport const useAppAlert = () => {\n const ctx = useContext(AppAlertContext);\n if (!ctx) {\n throw new Error(\"useAppAlert must be used within <AppAlertProvider>.\");\n }\n return ctx;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAa,oBAAoB;CAC7B,MAAM,MAAM,WAAW,eAAe;CACtC,IAAI,CAAC,KACD,MAAM,IAAI,MAAM,qDAAqD;CAEzE,OAAO;AACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/contexts/appConfigContext/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,eAAO,MAAM,gBAAgB,sDAAmD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/contexts/appConfigContext/index.tsx"],"sourcesContent":["import { createContext } from \"react\";\nimport type { AppConfigContextType } from \"./types\";\n\nexport const AppConfigContext = createContext<AppConfigContextType | null>(null)\n"],"mappings":";;AAGA,IAAa,mBAAmB,cAA2C,IAAI"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AppConfigProviderProps } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* AppConfigProvider
|
|
4
|
+
*
|
|
5
|
+
* React context provider responsible for exposing the application's runtime configuration
|
|
6
|
+
* (`AppConfigContextType`) to the component tree.
|
|
7
|
+
*
|
|
8
|
+
* Configuration sources, in order of precedence:
|
|
9
|
+
*
|
|
10
|
+
* 1. The `appId` / `appEnvironmentVar` props.
|
|
11
|
+
* Explicit injection, for tests and for hosts that resolve configuration themselves rather
|
|
12
|
+
* than through the page globals. A prop wins over the corresponding global; passing
|
|
13
|
+
* `appId={null}` forces "no app id" instead of falling through to `window.APP_ID`.
|
|
14
|
+
*
|
|
15
|
+
* 2. `window.APP_ID` and `window.APP_CONFIG`.
|
|
16
|
+
* Injected into the page by the platform (from the app's `config.json` `env_vars`) before
|
|
17
|
+
* the bundle executes.
|
|
18
|
+
*
|
|
19
|
+
* In dev there is no platform to inject them, so the app's dev server serves the `env_vars` at
|
|
20
|
+
* `/app-config.json` and the app merges them into `window.APP_CONFIG` during bootstrap, before
|
|
21
|
+
* React mounts. That merge is shallow and belongs to the app, not to this provider: nested
|
|
22
|
+
* objects are replaced whole, not deep-merged.
|
|
23
|
+
*
|
|
24
|
+
* Lifecycle notes:
|
|
25
|
+
* - This provider performs no network request and does not update its value after mount.
|
|
26
|
+
* - Because configuration is resolved before `createRoot(...).render(...)`, the tree receives a
|
|
27
|
+
* consistent configuration from the first render.
|
|
28
|
+
*
|
|
29
|
+
* Example:
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <AppConfigProvider>
|
|
32
|
+
* <App />
|
|
33
|
+
* </AppConfigProvider>
|
|
34
|
+
*
|
|
35
|
+
* // In a test, with no page globals:
|
|
36
|
+
* <AppConfigProvider appId="app_42" appEnvironmentVar={{ API_URL: "/api" }}>
|
|
37
|
+
* <ComponentUnderTest />
|
|
38
|
+
* </AppConfigProvider>
|
|
39
|
+
*
|
|
40
|
+
* // Consumer hook usage
|
|
41
|
+
* const { appId, appEnvironmentVar } = useAppConfig();
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare const AppConfigProvider: ({ children, appId, appEnvironmentVar, }: AppConfigProviderProps) => import("react").JSX.Element;
|
|
45
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/contexts/appConfigContext/provider.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAwB,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,iBAAiB,GAAI,yCAI/B,sBAAsB,gCAexB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { AppConfigContext } from "./index.js";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/contexts/appConfigContext/provider.tsx
|
|
5
|
+
/**
|
|
6
|
+
* AppConfigProvider
|
|
7
|
+
*
|
|
8
|
+
* React context provider responsible for exposing the application's runtime configuration
|
|
9
|
+
* (`AppConfigContextType`) to the component tree.
|
|
10
|
+
*
|
|
11
|
+
* Configuration sources, in order of precedence:
|
|
12
|
+
*
|
|
13
|
+
* 1. The `appId` / `appEnvironmentVar` props.
|
|
14
|
+
* Explicit injection, for tests and for hosts that resolve configuration themselves rather
|
|
15
|
+
* than through the page globals. A prop wins over the corresponding global; passing
|
|
16
|
+
* `appId={null}` forces "no app id" instead of falling through to `window.APP_ID`.
|
|
17
|
+
*
|
|
18
|
+
* 2. `window.APP_ID` and `window.APP_CONFIG`.
|
|
19
|
+
* Injected into the page by the platform (from the app's `config.json` `env_vars`) before
|
|
20
|
+
* the bundle executes.
|
|
21
|
+
*
|
|
22
|
+
* In dev there is no platform to inject them, so the app's dev server serves the `env_vars` at
|
|
23
|
+
* `/app-config.json` and the app merges them into `window.APP_CONFIG` during bootstrap, before
|
|
24
|
+
* React mounts. That merge is shallow and belongs to the app, not to this provider: nested
|
|
25
|
+
* objects are replaced whole, not deep-merged.
|
|
26
|
+
*
|
|
27
|
+
* Lifecycle notes:
|
|
28
|
+
* - This provider performs no network request and does not update its value after mount.
|
|
29
|
+
* - Because configuration is resolved before `createRoot(...).render(...)`, the tree receives a
|
|
30
|
+
* consistent configuration from the first render.
|
|
31
|
+
*
|
|
32
|
+
* Example:
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <AppConfigProvider>
|
|
35
|
+
* <App />
|
|
36
|
+
* </AppConfigProvider>
|
|
37
|
+
*
|
|
38
|
+
* // In a test, with no page globals:
|
|
39
|
+
* <AppConfigProvider appId="app_42" appEnvironmentVar={{ API_URL: "/api" }}>
|
|
40
|
+
* <ComponentUnderTest />
|
|
41
|
+
* </AppConfigProvider>
|
|
42
|
+
*
|
|
43
|
+
* // Consumer hook usage
|
|
44
|
+
* const { appId, appEnvironmentVar } = useAppConfig();
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
var AppConfigProvider = ({ children, appId, appEnvironmentVar }) => {
|
|
48
|
+
const value = useMemo(() => {
|
|
49
|
+
const globalConfig = globalThis.window?.APP_CONFIG ?? {};
|
|
50
|
+
return {
|
|
51
|
+
appId: appId !== void 0 ? appId : globalThis.window?.APP_ID ?? null,
|
|
52
|
+
appEnvironmentVar: appEnvironmentVar ?? globalConfig
|
|
53
|
+
};
|
|
54
|
+
}, [appId, appEnvironmentVar]);
|
|
55
|
+
return /* @__PURE__ */ jsx(AppConfigContext.Provider, {
|
|
56
|
+
value,
|
|
57
|
+
children
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
export { AppConfigProvider };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","names":[],"sources":["../../../src/contexts/appConfigContext/provider.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { AppConfigContext } from \".\";\nimport type { AppConfigContextType, AppConfigProviderProps } from \"./types\";\n\n/**\n * AppConfigProvider\n *\n * React context provider responsible for exposing the application's runtime configuration\n * (`AppConfigContextType`) to the component tree.\n *\n * Configuration sources, in order of precedence:\n *\n * 1. The `appId` / `appEnvironmentVar` props.\n * Explicit injection, for tests and for hosts that resolve configuration themselves rather\n * than through the page globals. A prop wins over the corresponding global; passing\n * `appId={null}` forces \"no app id\" instead of falling through to `window.APP_ID`.\n *\n * 2. `window.APP_ID` and `window.APP_CONFIG`.\n * Injected into the page by the platform (from the app's `config.json` `env_vars`) before\n * the bundle executes.\n *\n * In dev there is no platform to inject them, so the app's dev server serves the `env_vars` at\n * `/app-config.json` and the app merges them into `window.APP_CONFIG` during bootstrap, before\n * React mounts. That merge is shallow and belongs to the app, not to this provider: nested\n * objects are replaced whole, not deep-merged.\n *\n * Lifecycle notes:\n * - This provider performs no network request and does not update its value after mount.\n * - Because configuration is resolved before `createRoot(...).render(...)`, the tree receives a\n * consistent configuration from the first render.\n *\n * Example:\n * ```tsx\n * <AppConfigProvider>\n * <App />\n * </AppConfigProvider>\n *\n * // In a test, with no page globals:\n * <AppConfigProvider appId=\"app_42\" appEnvironmentVar={{ API_URL: \"/api\" }}>\n * <ComponentUnderTest />\n * </AppConfigProvider>\n *\n * // Consumer hook usage\n * const { appId, appEnvironmentVar } = useAppConfig();\n * ```\n */\nexport const AppConfigProvider = ({\n children,\n appId,\n appEnvironmentVar,\n}: AppConfigProviderProps) => {\n const value: AppConfigContextType = useMemo(() => {\n const globalConfig = (globalThis.window?.APP_CONFIG ?? {}) as Record<string, unknown>;\n\n return {\n appId: appId !== undefined ? appId : (globalThis.window?.APP_ID ?? null),\n appEnvironmentVar: appEnvironmentVar ?? globalConfig,\n };\n }, [appId, appEnvironmentVar]);\n\n return (\n <AppConfigContext.Provider value={value}>\n {children}\n </AppConfigContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAa,qBAAqB,EAC9B,UACA,OACA,wBAC0B;CAC1B,MAAM,QAA8B,cAAc;EAC9C,MAAM,eAAgB,WAAW,QAAQ,cAAc,CAAC;EAExD,OAAO;GACH,OAAO,UAAU,KAAA,IAAY,QAAS,WAAW,QAAQ,UAAU;GACnE,mBAAmB,qBAAqB;EAC5C;CACJ,GAAG,CAAC,OAAO,iBAAiB,CAAC;CAE7B,OACI,oBAAC,iBAAiB,UAAlB;EAAkC;EAC7B;CACsB,CAAA;AAEnC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { AnyRecord } from "../../types/anyRecord.d.ts";
|
|
3
|
+
/**
|
|
4
|
+
* The platform injects these into the host page before the bundle runs. Both are optional:
|
|
5
|
+
* this augmentation reaches every consumer of the package, and declaring them as required
|
|
6
|
+
* would be a lie in dev, where nothing injects them — `AppConfigProvider` itself has always
|
|
7
|
+
* read `window.APP_ID ?? null`.
|
|
8
|
+
*/
|
|
9
|
+
declare global {
|
|
10
|
+
interface Window {
|
|
11
|
+
APP_ID?: string;
|
|
12
|
+
APP_CONFIG?: {
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export type AppConfigContextType = {
|
|
18
|
+
appId: string | null;
|
|
19
|
+
appEnvironmentVar: AnyRecord;
|
|
20
|
+
};
|
|
21
|
+
export type AppConfigProviderProps = {
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
/** Overrides `window.APP_ID`. Pass `null` to force "no app id". */
|
|
24
|
+
appId?: string | null;
|
|
25
|
+
/** Overrides `window.APP_CONFIG` wholesale (not merged into it). */
|
|
26
|
+
appEnvironmentVar?: AnyRecord;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/contexts/appConfigContext/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;GAKG;AACH,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;SAAE,CAAC;KAC3C;CACJ;AAED,MAAM,MAAM,oBAAoB,GAAG;IAC/B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,iBAAiB,EAAE,SAAS,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACjC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,oEAAoE;IACpE,iBAAiB,CAAC,EAAE,SAAS,CAAC;CACjC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useAppConfig
|
|
3
|
+
*
|
|
4
|
+
* Convenience hook that reads the current application configuration from `AppConfigContext`.
|
|
5
|
+
*
|
|
6
|
+
* Behavior:
|
|
7
|
+
* - Returns the `AppConfigContextType` value provided by `<AppConfigProvider>`.
|
|
8
|
+
* - Throws a descriptive error if called outside of an `<AppConfigProvider>` scope, to fail fast and
|
|
9
|
+
* avoid undefined configuration usage throughout the app.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* ```ts
|
|
13
|
+
* const { appId, appEnvironmentVar } = useAppConfig();
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @throws {Error}
|
|
17
|
+
* Throws if the hook is used outside of `<AppConfigProvider>`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const useAppConfig: () => import("./types").AppConfigContextType;
|
|
20
|
+
//# sourceMappingURL=useAppConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppConfig.d.ts","sourceRoot":"","sources":["../../../src/contexts/appConfigContext/useAppConfig.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,YAAY,8CAMxB,CAAC"}
|