@taskforcehq/taskforce 0.3.305 → 0.3.306
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Taskforce.module.css +295 -89
- package/dist/TaskforceCore.js +215 -43
- package/dist/TaskforceCore.test.js +433 -28
- package/dist/assets/fonts/CourierPrime-Bold.woff2 +0 -0
- package/dist/assets/fonts/CourierPrime-BoldItalic.woff2 +0 -0
- package/dist/assets/fonts/CourierPrime-Italic.woff2 +0 -0
- package/dist/assets/fonts/CourierPrime-Regular.woff2 +0 -0
- package/dist/assets/fonts/Noir_medium.woff2 +0 -0
- package/dist/assets/fonts/Noir_regular.woff2 +0 -0
- package/dist/assets/fonts/RussoOne-Regular.woff2 +0 -0
- package/dist/assets/fonts/SpecialElite-Regular.woff2 +0 -0
- package/dist/compat/workspaceSyncCompat.js +46 -2
- package/dist/compat/workspaceSyncCompat.test.js +38 -1
- package/dist/components/context/ContextAttachmentManager.d.ts +14 -0
- package/dist/components/context/ContextAttachmentManager.js +549 -0
- package/dist/components/features/AgentsModule.d.ts +10 -1
- package/dist/components/features/AgentsModule.js +260 -15
- package/dist/components/features/AgentsModule.test.js +255 -5
- package/dist/components/features/DocumentViewer.d.ts +5 -1
- package/dist/components/features/DocumentViewer.js +60 -3
- package/dist/components/features/DocumentWorkspace.js +1 -1
- package/dist/components/features/DocumentWorkspace.test.js +33 -0
- package/dist/components/features/documentWorkspaceModel.d.ts +1 -1
- package/dist/components/task/TaskCard.js +19 -28
- package/dist/components/task/TaskCard.test.js +38 -3
- package/dist/components/task/TaskContextUpload.js +4 -526
- package/dist/components/task/TaskForm.js +85 -90
- package/dist/components/task/TaskForm.test.js +110 -8
- package/dist/components/task/TaskKanban.d.ts +2 -1
- package/dist/components/task/TaskKanban.js +94 -13
- package/dist/components/task/TaskKanban.test.js +36 -0
- package/dist/components/ui/EditableAvatarButton.d.ts +18 -0
- package/dist/components/ui/EditableAvatarButton.js +18 -0
- package/dist/components/views/PlanComparisonPage.d.ts +9 -1
- package/dist/components/views/PlanComparisonPage.js +70 -14
- package/dist/components/views/PlanComparisonPage.test.js +238 -0
- package/dist/components/views/PlansPage.js +127 -36
- package/dist/components/views/PlansPage.test.js +294 -12
- package/dist/components/views/StandaloneLayout.js +283 -533
- package/dist/components/views/panels/PlanningDrawer.d.ts +8 -1
- package/dist/components/views/panels/PlanningDrawer.js +18 -11
- package/dist/components/views/panels/PlanningDrawer.test.d.ts +1 -0
- package/dist/components/views/panels/PlanningDrawer.test.js +141 -0
- package/dist/components/views/planningScope.d.ts +20 -0
- package/dist/components/views/planningScope.js +25 -0
- package/dist/components/views/planningScope.test.d.ts +1 -0
- package/dist/components/views/planningScope.test.js +60 -0
- package/dist/components/views/standalone/modals/AccountHubModal.d.ts +26 -1
- package/dist/components/views/standalone/modals/AccountHubModal.js +76 -2
- package/dist/components/views/standalone/modals/AccountHubModal.test.js +20 -3
- package/dist/components/views/standalone/modals/AvatarImageManagerModal.d.ts +20 -0
- package/dist/components/views/standalone/modals/AvatarImageManagerModal.js +127 -0
- package/dist/components/views/standalone/modals/EditProfileModal.d.ts +2 -9
- package/dist/components/views/standalone/modals/EditProfileModal.js +3 -2
- package/dist/components/views/standalone/modals/SyncEnableWarningModal.d.ts +9 -0
- package/dist/components/views/standalone/modals/SyncEnableWarningModal.js +6 -0
- package/dist/components/views/standalone/modals/SyncEnableWarningModal.test.d.ts +1 -0
- package/dist/components/views/standalone/modals/SyncEnableWarningModal.test.js +24 -0
- package/dist/components/views/standalone/modals/SyncStatusModal.d.ts +2 -1
- package/dist/components/views/standalone/modals/SyncStatusModal.js +2 -2
- package/dist/core/AiProfileService.d.ts +39 -2
- package/dist/core/AiProfileService.js +639 -73
- package/dist/core/AiProfileService.test.js +19 -1
- package/dist/core/AiProfiles.test.js +566 -7
- package/dist/core/AttachmentLinkService.js +57 -15
- package/dist/core/AuthIdentityService.d.ts +107 -0
- package/dist/core/AuthIdentityService.js +284 -0
- package/dist/core/AuthTokenService.d.ts +4 -0
- package/dist/core/AuthTokenService.js +34 -6
- package/dist/core/AuthTokenService.test.js +3 -3
- package/dist/core/EntitlementsPolicy.test.js +2 -2
- package/dist/core/GlobalSettingsService.js +115 -6
- package/dist/core/PlanEntitlementService.d.ts +23 -2
- package/dist/core/PlanEntitlementService.js +343 -57
- package/dist/core/PlanFeatureCatalog.test.d.ts +1 -0
- package/dist/core/PlanFeatureCatalog.test.js +84 -0
- package/dist/core/PlanVersionPolicy.test.js +35 -2
- package/dist/core/PlanningEntities.test.js +52 -0
- package/dist/core/SignupMonetizationSettings.test.js +199 -27
- package/dist/core/SyncReconciliationService.js +2 -65
- package/dist/core/SystemAdmin.test.js +42 -42
- package/dist/core/TaskAttachmentsCanonical.test.js +51 -1
- package/dist/core/Taskforce.d.ts +225 -14
- package/dist/core/Taskforce.js +765 -192
- package/dist/core/Taskforce.listTasksSlim.test.d.ts +1 -0
- package/dist/core/Taskforce.listTasksSlim.test.js +91 -0
- package/dist/core/UserProfileAvatarDrafts.test.js +30 -3
- package/dist/core/WorkspaceLifecycleService.js +0 -5
- package/dist/core/WorkspacePermissions.test.js +25 -1
- package/dist/core/WorkspacePlanMode.test.js +117 -16
- package/dist/core/shared.d.ts +1 -1
- package/dist/core/shared.js +5 -1
- package/dist/core/types.d.ts +68 -2
- package/dist/hooks/auth/useTaskforceAuthBootstrap.js +26 -1
- package/dist/hooks/sync/bootstrap.js +2 -0
- package/dist/hooks/sync/controlPlane.d.ts +37 -0
- package/dist/hooks/sync/controlPlane.js +78 -0
- package/dist/hooks/sync/controlPlane.test.d.ts +1 -0
- package/dist/hooks/sync/controlPlane.test.js +121 -0
- package/dist/hooks/sync/lifecyclePolicy.d.ts +45 -0
- package/dist/hooks/sync/lifecyclePolicy.js +93 -0
- package/dist/hooks/sync/lifecyclePolicy.test.d.ts +1 -0
- package/dist/hooks/sync/lifecyclePolicy.test.js +124 -0
- package/dist/hooks/sync/orchestratorShared.d.ts +10 -1
- package/dist/hooks/sync/orchestratorShared.js +68 -47
- package/dist/hooks/sync/orchestratorShared.test.js +50 -1
- package/dist/hooks/sync/pullLifecycle.d.ts +31 -0
- package/dist/hooks/sync/pullLifecycle.js +24 -0
- package/dist/hooks/sync/pullLifecycle.test.d.ts +1 -0
- package/dist/hooks/sync/pullLifecycle.test.js +80 -0
- package/dist/hooks/sync/recovery.d.ts +16 -2
- package/dist/hooks/sync/recovery.js +171 -53
- package/dist/hooks/sync/recovery.test.d.ts +1 -0
- package/dist/hooks/sync/recovery.test.js +292 -0
- package/dist/hooks/sync/transfers.d.ts +15 -3
- package/dist/hooks/sync/transfers.js +179 -62
- package/dist/hooks/sync/transfers.test.d.ts +1 -0
- package/dist/hooks/sync/transfers.test.js +396 -0
- package/dist/hooks/sync/useRecentSyncEvents.d.ts +21 -0
- package/dist/hooks/sync/useRecentSyncEvents.js +92 -0
- package/dist/hooks/sync/useRecentSyncEvents.test.d.ts +1 -0
- package/dist/hooks/sync/useRecentSyncEvents.test.js +124 -0
- package/dist/hooks/sync/useSyncStatusActions.d.ts +30 -0
- package/dist/hooks/sync/useSyncStatusActions.js +88 -0
- package/dist/hooks/sync/useSyncStatusActions.test.d.ts +1 -0
- package/dist/hooks/sync/useSyncStatusActions.test.js +133 -0
- package/dist/hooks/sync/useSyncStatusControls.d.ts +25 -0
- package/dist/hooks/sync/useSyncStatusControls.js +60 -0
- package/dist/hooks/sync/useSyncStatusControls.test.d.ts +1 -0
- package/dist/hooks/sync/useSyncStatusControls.test.js +88 -0
- package/dist/hooks/useSyncOrchestrator.aiProfiles.test.js +12 -0
- package/dist/hooks/useSyncOrchestrator.d.ts +9 -2
- package/dist/hooks/useSyncOrchestrator.js +359 -178
- package/dist/hooks/useSyncOrchestrator.retry-closure.test.js +407 -0
- package/dist/hooks/useTaskData.js +8 -3
- package/dist/hooks/useTaskData.test.js +45 -0
- package/dist/hooks/useTaskforce.d.ts +60 -2
- package/dist/hooks/useTaskforce.js +549 -240
- package/dist/hooks/useTaskforce.runtime-routing.test.d.ts +1 -0
- package/dist/hooks/useTaskforce.runtime-routing.test.js +152 -0
- package/dist/hooks/useTaskforce.sync-behavior.test.js +2380 -212
- package/dist/hooks/useWorkspaceSyncController.d.ts +1 -0
- package/dist/hooks/useWorkspaceSyncController.js +6 -1
- package/dist/hooks/workspace/useTaskforceWorkspaceBootstrap.d.ts +16 -0
- package/dist/hooks/workspace/useTaskforceWorkspaceBootstrap.js +316 -35
- package/dist/localization/locales/en-US.d.ts +0 -1
- package/dist/localization/locales/en-US.js +0 -1
- package/dist/localization/locales/es-419.js +0 -1
- package/dist/localization/locales/pt-BR.js +0 -1
- package/dist/mcp/documentAssetRegistrar.js +3 -3
- package/dist/mcp/runtime.d.ts +2 -0
- package/dist/mcp/runtime.js +131 -64
- package/dist/mcp/runtime.test.js +291 -12
- package/dist/migrations/taskSchemaMigrations.d.ts +1 -1
- package/dist/migrations/taskSchemaMigrations.js +171 -61
- package/dist/migrations/taskSchemaMigrations.test.js +15 -0
- package/dist/resources/templates/workflow-sources/workflowDocs.mjs +6 -6
- package/dist/resources/templates/workflows/collaborate.yaml +1 -1
- package/dist/resources/templates/workflows/evaluate.yaml +2 -2
- package/dist/resources/templates/workflows/plan.yaml +1 -1
- package/dist/resources/templates/workflows/review.yaml +2 -2
- package/dist/server/annotatedAttachmentsRoutes.test.js +3 -3
- package/dist/server/auth/providers/apple.d.ts +33 -0
- package/dist/server/auth/providers/apple.js +82 -0
- package/dist/server/auth/providers/appleClientSecret.d.ts +37 -0
- package/dist/server/auth/providers/appleClientSecret.js +65 -0
- package/dist/server/auth/providers/github.d.ts +26 -0
- package/dist/server/auth/providers/github.js +86 -0
- package/dist/server/auth/providers/google.d.ts +21 -0
- package/dist/server/auth/providers/google.js +56 -0
- package/dist/server/auth/providers/types.d.ts +21 -0
- package/dist/server/auth/providers/types.js +1 -0
- package/dist/server/auth.d.ts +2 -0
- package/dist/server/auth.js +6 -3
- package/dist/server/documentReviewRoutes.test.js +36 -3
- package/dist/server/index.cookieProxy.test.js +1 -0
- package/dist/server/index.d.ts +12 -0
- package/dist/server/index.js +120 -9
- package/dist/server/index.rateLimit.test.js +3 -0
- package/dist/server/index.test.js +106 -3
- package/dist/server/routes/admin.d.ts +3 -0
- package/dist/server/routes/admin.js +272 -19
- package/dist/server/routes/auth.d.ts +15 -2
- package/dist/server/routes/auth.js +994 -57
- package/dist/server/routes/authSupport.d.ts +1 -1
- package/dist/server/routes/authSupport.js +1 -1
- package/dist/server/routes/billing.js +361 -35
- package/dist/server/routes/billing.test.js +592 -12
- package/dist/server/routes/documents.d.ts +1 -0
- package/dist/server/routes/documents.js +172 -70
- package/dist/server/routes/shared.d.ts +28 -2
- package/dist/server/routes/shared.js +69 -4
- package/dist/server/routes/sync.integration.test.js +437 -39
- package/dist/server/routes/sync.js +61 -605
- package/dist/server/routes/syncAuxRoutes.d.ts +15 -0
- package/dist/server/routes/syncAuxRoutes.js +91 -0
- package/dist/server/routes/syncAuxRoutes.test.d.ts +1 -0
- package/dist/server/routes/syncAuxRoutes.test.js +158 -0
- package/dist/server/routes/syncPullApplyRoutes.d.ts +36 -0
- package/dist/server/routes/syncPullApplyRoutes.js +204 -0
- package/dist/server/routes/syncPushRoutes.d.ts +24 -0
- package/dist/server/routes/syncPushRoutes.js +212 -0
- package/dist/server/routes/syncRouteGuards.d.ts +36 -0
- package/dist/server/routes/syncRouteGuards.js +67 -0
- package/dist/server/routes/syncRouteGuards.test.d.ts +1 -0
- package/dist/server/routes/syncRouteGuards.test.js +94 -0
- package/dist/server/routes/syncRouteTypes.d.ts +13 -0
- package/dist/server/routes/syncRouteTypes.js +1 -0
- package/dist/server/routes/syncSnapshotRoutes.d.ts +66 -0
- package/dist/server/routes/syncSnapshotRoutes.js +180 -0
- package/dist/server/routes/tasks.js +43 -1
- package/dist/server/routes/workspaces.js +36 -5
- package/dist/server/routes.js +60 -3
- package/dist/server/routes.test.js +1824 -171
- package/dist/services/workflowExportSnapshots.test.js +2 -0
- package/dist/shared/aiProfileSeatScope.d.ts +5 -0
- package/dist/shared/aiProfileSeatScope.js +21 -0
- package/dist/shared/passwordPolicy.d.ts +13 -0
- package/dist/shared/passwordPolicy.js +84 -0
- package/dist/shared/passwordPolicy.test.d.ts +1 -0
- package/dist/shared/passwordPolicy.test.js +34 -0
- package/dist/storage/workspaceAssetStore.d.ts +15 -3
- package/dist/storage/workspaceAssetStore.js +132 -44
- package/dist/storage/workspaceAssetStore.test.js +93 -6
- package/dist/styles/fonts.css +70 -0
- package/dist/sync/collaborationSyncPayload.d.ts +6 -1
- package/dist/sync/collaborationSyncPayload.js +17 -11
- package/dist/sync/collaborationSyncPayload.test.js +13 -1
- package/dist/sync/contentSyncState.d.ts +4 -8
- package/dist/sync/contentSyncState.js +17 -70
- package/dist/sync/syncApplyHandlers.d.ts +7 -0
- package/dist/sync/syncApplyHandlers.js +28 -13
- package/dist/sync/syncApplyHandlers.test.js +70 -3
- package/dist/sync/syncFieldSemantics.d.ts +12 -0
- package/dist/sync/syncFieldSemantics.js +55 -0
- package/dist/sync/syncResourceAdapters.d.ts +44 -0
- package/dist/sync/syncResourceAdapters.js +77 -0
- package/dist/sync/syncService.d.ts +5 -0
- package/dist/sync/syncService.js +52 -0
- package/dist/sync/syncService.test.js +57 -3
- package/dist/sync/taskSyncChangeKey.d.ts +2 -0
- package/dist/sync/taskSyncChangeKey.js +143 -0
- package/dist/sync/taskSyncPayload.js +3 -8
- package/dist/sync/workspacePullFeed.js +4 -3
- package/dist/sync/workspacePullFeed.test.js +43 -0
- package/dist/sync/workspaceRepair.js +5 -2
- package/dist/sync/workspaceSyncModel.d.ts +45 -0
- package/dist/sync/workspaceSyncModel.js +183 -28
- package/dist/sync/workspaceSyncModel.test.js +291 -12
- package/dist/sync/workspaceSyncState.d.ts +17 -0
- package/dist/sync/workspaceSyncState.js +2 -1
- package/dist/sync/workspaceSyncSurface.js +3 -8
- package/dist/types.d.ts +17 -0
- package/dist/ui/assets/AgentsModule-DrLawwNl.js +1 -0
- package/dist/ui/assets/{AnnotatedAttachmentWorkspace-BG6P_GVW.js → AnnotatedAttachmentWorkspace-Z9_whf7F.js} +1 -1
- package/dist/ui/assets/CourierPrime-Bold-BuLj_dpw.woff2 +0 -0
- package/dist/ui/assets/CourierPrime-BoldItalic-BrK2pUkZ.woff2 +0 -0
- package/dist/ui/assets/CourierPrime-Italic-DFUZK5Ey.woff2 +0 -0
- package/dist/ui/assets/CourierPrime-Regular-BsKphzVf.woff2 +0 -0
- package/dist/ui/assets/DocumentWorkspace-B03MaSkw.js +252 -0
- package/dist/ui/assets/DocumentWorkspace-Dhdso07p.css +1 -0
- package/dist/ui/assets/{InitiativesModule-Dhm7M8e7.js → InitiativesModule-9E6ParrY.js} +1 -1
- package/dist/ui/assets/Noir_medium-bxQwKGzB.woff2 +0 -0
- package/dist/ui/assets/Noir_regular-ojf2kxlG.woff2 +0 -0
- package/dist/ui/assets/PlansPage-CvfnMiWq.css +1 -0
- package/dist/ui/assets/PlansPage-DRXscYxH.js +1 -0
- package/dist/ui/assets/RussoOne-Regular-Cu_qq_qC.woff2 +0 -0
- package/dist/ui/assets/SpecialElite-Regular-Di6gSvAS.woff2 +0 -0
- package/dist/ui/assets/{TaskSettings-ln0aF7xc.js → TaskSettings-DZX4jk7e.js} +1 -1
- package/dist/ui/assets/{WorkflowsModule-BcS4afRn.js → WorkflowsModule-BA7jcEpH.js} +1 -1
- package/dist/ui/assets/index-9eT8e0Lu.css +1 -0
- package/dist/ui/assets/index-C6k75jr8.js +6 -0
- package/dist/ui/assets/{vendor-icons-BSUaRwF8.js → vendor-icons-DuEd_65c.js} +1 -1
- package/dist/ui/fonts/CourierPrime-Bold.ttf +0 -0
- package/dist/ui/fonts/CourierPrime-Bold.woff2 +0 -0
- package/dist/ui/fonts/CourierPrime-BoldItalic.ttf +0 -0
- package/dist/ui/fonts/CourierPrime-BoldItalic.woff2 +0 -0
- package/dist/ui/fonts/CourierPrime-Italic.ttf +0 -0
- package/dist/ui/fonts/CourierPrime-Italic.woff2 +0 -0
- package/dist/ui/fonts/CourierPrime-Regular.ttf +0 -0
- package/dist/ui/fonts/CourierPrime-Regular.woff2 +0 -0
- package/dist/ui/fonts/Noir_medium.otf +0 -0
- package/dist/ui/fonts/Noir_medium.woff2 +0 -0
- package/dist/ui/fonts/Noir_regular.otf +0 -0
- package/dist/ui/fonts/Noir_regular.woff2 +0 -0
- package/dist/ui/fonts/RussoOne-Regular.woff2 +0 -0
- package/dist/ui/fonts/SpecialElite-Regular.ttf +0 -0
- package/dist/ui/fonts/SpecialElite-Regular.woff2 +0 -0
- package/dist/ui/index.html +3 -3
- package/dist/utils/accountProfileSummaryCache.d.ts +5 -0
- package/dist/utils/assignees.d.ts +2 -0
- package/dist/utils/assignees.js +2 -0
- package/dist/utils/avatarUpload.d.ts +27 -0
- package/dist/utils/avatarUpload.js +132 -0
- package/dist/utils/avatarUpload.test.d.ts +1 -0
- package/dist/utils/avatarUpload.test.js +40 -0
- package/dist/utils/bootstrapTrace.d.ts +7 -0
- package/dist/utils/bootstrapTrace.js +29 -0
- package/dist/utils/commercialLifecyclePresentation.js +3 -0
- package/dist/utils/contextAssetEvents.d.ts +2 -0
- package/dist/utils/syncEventDetails.d.ts +3 -0
- package/dist/utils/syncEventDetails.js +64 -0
- package/dist/utils/syncEventDetails.test.d.ts +1 -0
- package/dist/utils/syncEventDetails.test.js +23 -0
- package/dist/utils/syncEventPresentation.d.ts +15 -0
- package/dist/utils/syncEventPresentation.js +129 -0
- package/dist/utils/syncEventPresentation.test.d.ts +1 -0
- package/dist/utils/syncEventPresentation.test.js +64 -0
- package/dist/utils/syncStatusPresentation.d.ts +72 -0
- package/dist/utils/syncStatusPresentation.js +217 -0
- package/dist/utils/syncStatusPresentation.test.d.ts +1 -0
- package/dist/utils/syncStatusPresentation.test.js +164 -0
- package/dist/utils/taskActivity.d.ts +2 -0
- package/dist/utils/taskActivity.js +228 -22
- package/dist/utils/taskActivity.test.js +119 -8
- package/dist/utils/workspaceSyncPresentation.d.ts +4 -0
- package/dist/utils/workspaceSyncPresentation.js +68 -2
- package/dist/utils/workspaceSyncPresentation.test.js +36 -1
- package/package.json +3 -2
- package/scripts/export-sqlite-to-postgres.mjs +7 -9
- package/scripts/run-e2e-realtime.sh +17 -3
- package/scripts/run-smoke.sh +17 -5
- package/scripts/run-soak.sh +17 -5
- package/src/resources/templates/workflow-sources/workflowDocs.mjs +6 -6
- package/src/resources/templates/workflows/collaborate.yaml +1 -1
- package/src/resources/templates/workflows/evaluate.yaml +2 -2
- package/src/resources/templates/workflows/plan.yaml +1 -1
- package/src/resources/templates/workflows/review.yaml +2 -2
- package/dist/ui/assets/AgentsModule-N2MnQBZk.js +0 -1
- package/dist/ui/assets/DocumentWorkspace-B3nV_Gc5.css +0 -1
- package/dist/ui/assets/DocumentWorkspace-DRbDMwh8.js +0 -252
- package/dist/ui/assets/PlansPage-C2dd2n1X.css +0 -1
- package/dist/ui/assets/PlansPage-Cq0zXj3I.js +0 -1
- package/dist/ui/assets/RussoOne-Regular-C3BxZIj7.ttf +0 -0
- package/dist/ui/assets/index-C2-OXZV7.css +0 -1
- package/dist/ui/assets/index-DcSI5F86.js +0 -6
- package/scripts/migrate-planning-model.ts +0 -233
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AttachmentItem } from '../../../types';
|
|
1
2
|
export declare const PLANNING_DRAWER_TREE_WIDTH_PX = 332;
|
|
2
3
|
export declare const PLANNING_DRAWER_DETAIL_WIDTH_PX = 392;
|
|
3
4
|
export declare const PLANNING_DRAWER_COLLAPSED_PANE_WIDTH_PX = 56;
|
|
@@ -14,6 +15,7 @@ export type PlanningNodeSummary = {
|
|
|
14
15
|
workstreamCount?: number;
|
|
15
16
|
commentCount?: number;
|
|
16
17
|
attachmentCount?: number;
|
|
18
|
+
attachments?: Array<string | AttachmentItem>;
|
|
17
19
|
isArchived?: boolean;
|
|
18
20
|
};
|
|
19
21
|
export type PlanningTaskPreview = {
|
|
@@ -65,6 +67,7 @@ type PlanningDrawerProps = {
|
|
|
65
67
|
detail: PlanningDrawerDetail;
|
|
66
68
|
editor: PlanningEditorState | null;
|
|
67
69
|
secondaryPane: PlanningDrawerSecondaryPane;
|
|
70
|
+
currentWorkspaceId?: string | null;
|
|
68
71
|
assigneeOptions: Array<{
|
|
69
72
|
value: string;
|
|
70
73
|
label: string;
|
|
@@ -90,6 +93,7 @@ type PlanningDrawerProps = {
|
|
|
90
93
|
secondaryCollapsed: boolean;
|
|
91
94
|
onCancelEditor: () => void;
|
|
92
95
|
onSubmitEditor: () => void;
|
|
96
|
+
isSubmittingEditor: boolean;
|
|
93
97
|
onCreateInitiative: () => void;
|
|
94
98
|
onCreateWorkstream: () => void;
|
|
95
99
|
onToggleInitiative: (initiativeId: string) => void;
|
|
@@ -110,6 +114,9 @@ type PlanningDrawerProps = {
|
|
|
110
114
|
onOpenTaskById?: (taskId: string) => void;
|
|
111
115
|
onAttachTaskToWorkstreamByReference?: (workstreamId: string, taskReference: string) => void;
|
|
112
116
|
onAttachWorkstreamToInitiativeByReference?: (initiativeId: string, workstreamReference: string) => void;
|
|
117
|
+
onAddPlanningContextFile?: (entityType: 'initiative' | 'workstream', entityId: string, file: AttachmentItem) => void;
|
|
118
|
+
onRemovePlanningContextFile?: (entityType: 'initiative' | 'workstream', entityId: string, index: number) => void;
|
|
119
|
+
onUpdatePlanningContextCaption?: (entityType: 'initiative' | 'workstream', entityId: string, index: number, caption: string) => void;
|
|
113
120
|
};
|
|
114
|
-
export declare function PlanningDrawer({ open, leftOffset, initiatives, standaloneWorkstreams, activeInitiativeId, activeWorkstreamId, expandedInitiativeIds, detail, editor, secondaryPane, assigneeOptions, draftInitiativeSummary, draftTitle, draftDescription, draftOwner, draftInitiativeId, onChangeDraftTitle, onChangeDraftDescription, onChangeDraftOwner, onChangeDraftInitiativeId, onCollapseTreePane, onExpandTreePane, onCollapsePrimaryPane, onExpandPrimaryPane, onCollapseSecondaryPane, onExpandSecondaryPane, onBackFromSecondary, treeCollapsed, primaryCollapsed, secondaryCollapsed, onCancelEditor, onSubmitEditor, onCreateInitiative, onCreateWorkstream, onToggleInitiative, onSelectInitiative, onSelectWorkstream, onOpenInitiativeDetails, onOpenWorkstreamDetails, onOpenNestedWorkstreamDetails, onEditInitiative, onEditWorkstream, onArchiveInitiative, onUnarchiveInitiative, onArchiveWorkstream, onUnarchiveWorkstream, onCreateTaskInWorkstream, onCreateWorkstreamInInitiative, onAssignInitiativeToWorkstream, onOpenTaskById, onAttachTaskToWorkstreamByReference, onAttachWorkstreamToInitiativeByReference, }: PlanningDrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
121
|
+
export declare function PlanningDrawer({ open, leftOffset, initiatives, standaloneWorkstreams, activeInitiativeId, activeWorkstreamId, expandedInitiativeIds, detail, editor, secondaryPane, currentWorkspaceId, assigneeOptions, draftInitiativeSummary, draftTitle, draftDescription, draftOwner, draftInitiativeId, onChangeDraftTitle, onChangeDraftDescription, onChangeDraftOwner, onChangeDraftInitiativeId, onCollapseTreePane, onExpandTreePane, onCollapsePrimaryPane, onExpandPrimaryPane, onCollapseSecondaryPane, onExpandSecondaryPane, onBackFromSecondary, treeCollapsed, primaryCollapsed, secondaryCollapsed, onCancelEditor, onSubmitEditor, isSubmittingEditor, onCreateInitiative, onCreateWorkstream, onToggleInitiative, onSelectInitiative, onSelectWorkstream, onOpenInitiativeDetails, onOpenWorkstreamDetails, onOpenNestedWorkstreamDetails, onEditInitiative, onEditWorkstream, onArchiveInitiative, onUnarchiveInitiative, onArchiveWorkstream, onUnarchiveWorkstream, onCreateTaskInWorkstream, onCreateWorkstreamInInitiative, onAssignInitiativeToWorkstream, onOpenTaskById, onAttachTaskToWorkstreamByReference, onAttachWorkstreamToInitiativeByReference, onAddPlanningContextFile, onRemovePlanningContextFile, onUpdatePlanningContextCaption, }: PlanningDrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
115
122
|
export {};
|
|
@@ -6,6 +6,7 @@ import { ChevronLeft, ChevronRight, ChevronsDown, ChevronsRight, Filter, Plus, }
|
|
|
6
6
|
import styles from '../../../Taskforce.module.css';
|
|
7
7
|
import panelStyles from './PlanningDrawer.module.css';
|
|
8
8
|
import { ReferenceBadgeButton } from '../../ui/ReferenceBadgeButton';
|
|
9
|
+
import { ContextAttachmentManager } from '../../context/ContextAttachmentManager';
|
|
9
10
|
import { IconMap, getStatusDefinition, resolveColor } from '../../../utils/constants';
|
|
10
11
|
import { formatInitiativeReference, formatWorkstreamReference, } from '../../../utils/planningReferences.js';
|
|
11
12
|
export const PLANNING_DRAWER_TREE_WIDTH_PX = 332;
|
|
@@ -121,7 +122,7 @@ function PlanningDrawerList({ initiatives, standaloneWorkstreams, activeInitiati
|
|
|
121
122
|
onOpenWorkstreamDetails(workstream.id);
|
|
122
123
|
} }, workstream.id))) })] })] }));
|
|
123
124
|
}
|
|
124
|
-
function PlanningDrawerDetailView({ detail, onOpenNestedWorkstreamDetails, onEdit, onArchive, onUnarchive, onCreateTaskInWorkstream, onCreateWorkstreamInInitiative, onOpenTaskById, onAttachTaskToWorkstreamByReference, onAttachWorkstreamToInitiativeByReference, }) {
|
|
125
|
+
function PlanningDrawerDetailView({ detail, currentWorkspaceId, onOpenNestedWorkstreamDetails, onEdit, onArchive, onUnarchive, onCreateTaskInWorkstream, onCreateWorkstreamInInitiative, onOpenTaskById, onAttachTaskToWorkstreamByReference, onAttachWorkstreamToInitiativeByReference, onAddPlanningContextFile, onRemovePlanningContextFile, onUpdatePlanningContextCaption, }) {
|
|
125
126
|
const [attachReference, setAttachReference] = React.useState('');
|
|
126
127
|
const { active } = useDndContext();
|
|
127
128
|
const dragType = String(active?.data?.current?.type || '');
|
|
@@ -174,16 +175,22 @@ function PlanningDrawerDetailView({ detail, onOpenNestedWorkstreamDetails, onEdi
|
|
|
174
175
|
return (_jsx("button", { type: "button", className: `${panelStyles.listItemButton} ${panelStyles.detailCardButton}`.trim(), onClick: () => onOpenTaskById?.(task.id), children: _jsxs("div", { className: `${panelStyles.listItem} ${panelStyles.detailChildCard}`.trim(), children: [_jsxs("div", { className: panelStyles.detailChildCardTopRow, children: [referenceLabel ? (_jsx(PlanningReferenceBadge, { label: referenceLabel, entityType: "task" })) : _jsx("span", { "aria-hidden": "true" }), _jsx("span", { className: panelStyles.taskStatusIcon, style: {
|
|
175
176
|
color: statusColor,
|
|
176
177
|
}, "aria-label": statusDefinition.shortLabel || formatTaskStatusLabel(task.status), title: statusDefinition.shortLabel || formatTaskStatusLabel(task.status), children: StatusIcon ? _jsx(StatusIcon, { size: 18, strokeWidth: 2.4 }) : null })] }), _jsxs("div", { className: panelStyles.listItemText, children: [_jsx("span", { className: panelStyles.listItemTitle, children: task.title }), _jsx("span", { className: panelStyles.listItemMeta, children: formatTaskStatusLabel(task.status) })] })] }) }, task.id));
|
|
177
|
-
}) : (_jsxs("div", { className: panelStyles.sectionNote, children: ["No tasks are linked to this workstream yet. Use the ", _jsx("code", { children: "+" }), " action above to add the first one."] })))] }),
|
|
178
|
+
}) : (_jsxs("div", { className: panelStyles.sectionNote, children: ["No tasks are linked to this workstream yet. Use the ", _jsx("code", { children: "+" }), " action above to add the first one."] })))] }), _jsx("div", { className: panelStyles.listCard, children: _jsx(ContextAttachmentManager, { ownerType: detail.type, ownerId: detail.item.id, ownerReferenceLabel: detailReferenceLabel, workspaceId: currentWorkspaceId, attachments: detail.item.attachments || [], onAddAttachment: (file) => onAddPlanningContextFile?.(detail.type, detail.item.id, file), onRemoveAttachment: (index) => onRemovePlanningContextFile?.(detail.type, detail.item.id, index), onUpdateAttachmentCaption: (index, caption) => (onUpdatePlanningContextCaption?.(detail.type, detail.item.id, index, caption)) }) })] }));
|
|
178
179
|
}
|
|
179
|
-
function PlanningDrawerEditor({ editor, draftTitle, draftDescription, draftOwner, draftInitiativeId, assigneeOptions, draftInitiativeSummary, onChangeDraftTitle, onChangeDraftDescription, onChangeDraftOwner, onChangeDraftInitiativeId, onCancel, onSubmit, onAssignInitiativeToWorkstream, }) {
|
|
180
|
+
function PlanningDrawerEditor({ editor, draftTitle, draftDescription, draftOwner, draftInitiativeId, assigneeOptions, draftInitiativeSummary, onChangeDraftTitle, onChangeDraftDescription, onChangeDraftOwner, onChangeDraftInitiativeId, onCancel, onSubmit, isSubmitting, onAssignInitiativeToWorkstream, }) {
|
|
180
181
|
const entityLabel = editor.entityType === 'initiative' ? 'Initiative' : 'Workstream';
|
|
181
|
-
const submitLabel =
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
const submitLabel = isSubmitting
|
|
183
|
+
? (editor.mode === 'create' ? `Creating ${entityLabel}...` : `Saving ${entityLabel}...`)
|
|
184
|
+
: (editor.mode === 'create' ? `Create ${entityLabel}` : `Save ${entityLabel}`);
|
|
185
|
+
const handleSubmit = React.useCallback((event) => {
|
|
186
|
+
event.preventDefault();
|
|
187
|
+
onSubmit();
|
|
188
|
+
}, [onSubmit]);
|
|
189
|
+
return (_jsxs("form", { className: panelStyles.editorCard, onSubmit: handleSubmit, children: [_jsxs("div", { className: panelStyles.editorField, children: [_jsx("label", { className: panelStyles.editorLabel, children: "Title" }), _jsx("input", { className: styles.input, disabled: isSubmitting, value: draftTitle, onChange: (event) => onChangeDraftTitle(event.target.value), placeholder: editor.entityType === 'initiative' ? 'Q3 Product Launch' : 'Content Production' })] }), _jsxs("div", { className: panelStyles.editorField, children: [_jsx("label", { className: panelStyles.editorLabel, children: "Description" }), _jsx("textarea", { className: styles.textarea, disabled: isSubmitting, value: draftDescription, onChange: (event) => onChangeDraftDescription(event.target.value), placeholder: editor.entityType === 'initiative'
|
|
190
|
+
? 'Describe the broader outcome this initiative is meant to achieve.'
|
|
191
|
+
: 'Describe the lane of work this workstream will coordinate.', rows: 5 })] }), editor.entityType === 'workstream' && (_jsxs("div", { className: panelStyles.editorField, children: [_jsx("label", { className: panelStyles.editorLabel, children: "Initiative" }), draftInitiativeSummary && (_jsxs("div", { className: panelStyles.editorHint, children: ["Current: ", draftInitiativeSummary.title] })), _jsxs("div", { className: styles.pathInputGroup, children: [_jsx("input", { type: "text", className: styles.input, disabled: isSubmitting, placeholder: "Paste initiative reference (e.g. IN-123)", value: draftInitiativeId, onChange: (event) => onChangeDraftInitiativeId(event.target.value) }), editor.mode === 'edit' && (_jsx("button", { type: "button", className: styles.secondaryHeaderBtn, disabled: isSubmitting, onClick: () => onAssignInitiativeToWorkstream?.(editor.targetId), children: "Set Initiative" }))] }), editor.mode === 'edit' && (_jsx("div", { className: panelStyles.editorSubActions, children: _jsx("button", { type: "button", className: styles.secondaryHeaderBtn, disabled: isSubmitting, onClick: () => onAssignInitiativeToWorkstream?.(editor.targetId, null), children: "Clear Initiative" }) }))] })), _jsxs("div", { className: panelStyles.editorField, children: [_jsx("label", { className: panelStyles.editorLabel, children: "Owner" }), _jsxs("select", { className: `${styles.select} ${styles.groupBySelect}`, disabled: isSubmitting, value: draftOwner, onChange: (event) => onChangeDraftOwner(event.target.value), children: [_jsx("option", { value: "", children: "Unassigned" }), assigneeOptions.map((option) => (_jsx("option", { value: option.value, children: option.label }, option.value)))] })] }), _jsxs("div", { className: panelStyles.editorActions, children: [_jsx("button", { type: "button", className: styles.secondaryHeaderBtn, onClick: onCancel, disabled: isSubmitting, children: "Cancel" }), _jsx("button", { type: "submit", className: styles.primaryUpdateBtn, disabled: isSubmitting, children: submitLabel })] })] }));
|
|
185
192
|
}
|
|
186
|
-
export function PlanningDrawer({ open, leftOffset = 0, initiatives, standaloneWorkstreams, activeInitiativeId, activeWorkstreamId, expandedInitiativeIds, detail, editor, secondaryPane, assigneeOptions, draftInitiativeSummary, draftTitle, draftDescription, draftOwner, draftInitiativeId, onChangeDraftTitle, onChangeDraftDescription, onChangeDraftOwner, onChangeDraftInitiativeId, onCollapseTreePane, onExpandTreePane, onCollapsePrimaryPane, onExpandPrimaryPane, onCollapseSecondaryPane, onExpandSecondaryPane, onBackFromSecondary, treeCollapsed, primaryCollapsed, secondaryCollapsed, onCancelEditor, onSubmitEditor, onCreateInitiative, onCreateWorkstream, onToggleInitiative, onSelectInitiative, onSelectWorkstream, onOpenInitiativeDetails, onOpenWorkstreamDetails, onOpenNestedWorkstreamDetails, onEditInitiative, onEditWorkstream, onArchiveInitiative, onUnarchiveInitiative, onArchiveWorkstream, onUnarchiveWorkstream, onCreateTaskInWorkstream, onCreateWorkstreamInInitiative, onAssignInitiativeToWorkstream, onOpenTaskById, onAttachTaskToWorkstreamByReference, onAttachWorkstreamToInitiativeByReference, }) {
|
|
193
|
+
export function PlanningDrawer({ open, leftOffset = 0, initiatives, standaloneWorkstreams, activeInitiativeId, activeWorkstreamId, expandedInitiativeIds, detail, editor, secondaryPane, currentWorkspaceId, assigneeOptions, draftInitiativeSummary, draftTitle, draftDescription, draftOwner, draftInitiativeId, onChangeDraftTitle, onChangeDraftDescription, onChangeDraftOwner, onChangeDraftInitiativeId, onCollapseTreePane, onExpandTreePane, onCollapsePrimaryPane, onExpandPrimaryPane, onCollapseSecondaryPane, onExpandSecondaryPane, onBackFromSecondary, treeCollapsed, primaryCollapsed, secondaryCollapsed, onCancelEditor, onSubmitEditor, isSubmittingEditor, onCreateInitiative, onCreateWorkstream, onToggleInitiative, onSelectInitiative, onSelectWorkstream, onOpenInitiativeDetails, onOpenWorkstreamDetails, onOpenNestedWorkstreamDetails, onEditInitiative, onEditWorkstream, onArchiveInitiative, onUnarchiveInitiative, onArchiveWorkstream, onUnarchiveWorkstream, onCreateTaskInWorkstream, onCreateWorkstreamInInitiative, onAssignInitiativeToWorkstream, onOpenTaskById, onAttachTaskToWorkstreamByReference, onAttachWorkstreamToInitiativeByReference, onAddPlanningContextFile, onRemovePlanningContextFile, onUpdatePlanningContextCaption, }) {
|
|
187
194
|
const hasPrimaryPane = Boolean(detail || editor);
|
|
188
195
|
const hasSecondaryPane = Boolean(secondaryPane);
|
|
189
196
|
const drawerWidth = getPlanningDrawerWidthPx(treeCollapsed, hasPrimaryPane, primaryCollapsed, hasSecondaryPane, secondaryCollapsed);
|
|
@@ -222,16 +229,16 @@ export function PlanningDrawer({ open, leftOffset = 0, initiatives, standaloneWo
|
|
|
222
229
|
width: `${PLANNING_DRAWER_DETAIL_WIDTH_PX}px`,
|
|
223
230
|
minWidth: `${PLANNING_DRAWER_DETAIL_WIDTH_PX}px`,
|
|
224
231
|
maxWidth: `${PLANNING_DRAWER_DETAIL_WIDTH_PX}px`,
|
|
225
|
-
}, children: [_jsxs("div", { className: panelStyles.paneHeader, children: [_jsx("span", { className: panelStyles.paneHeaderLabel, children: primaryPaneLabel }), _jsx("button", { type: "button", className: "tf-control-icon", onClick: onCollapsePrimaryPane, children: _jsx(ChevronLeft, { size: 16 }) })] }), _jsx("div", { className: panelStyles.paneContent, children: editor ? (_jsx(PlanningDrawerEditor, { editor: editor, draftTitle: draftTitle, draftDescription: draftDescription, draftOwner: draftOwner, draftInitiativeId: draftInitiativeId, assigneeOptions: assigneeOptions, draftInitiativeSummary: draftInitiativeSummary, onChangeDraftTitle: onChangeDraftTitle, onChangeDraftDescription: onChangeDraftDescription, onChangeDraftOwner: onChangeDraftOwner, onChangeDraftInitiativeId: onChangeDraftInitiativeId, onCancel: onCancelEditor, onSubmit: onSubmitEditor, onAssignInitiativeToWorkstream: onAssignInitiativeToWorkstream })) : detail ? (_jsx(PlanningDrawerDetailView, { detail: detail, onOpenNestedWorkstreamDetails: detail.type === 'initiative' ? onOpenNestedWorkstreamDetails : undefined, onCreateTaskInWorkstream: detail.type === 'workstream' ? onCreateTaskInWorkstream : undefined, onCreateWorkstreamInInitiative: detail.type === 'initiative' ? onCreateWorkstreamInInitiative : undefined, onOpenTaskById: detail.type === 'workstream' ? onOpenTaskById : undefined, onAttachTaskToWorkstreamByReference: detail.type === 'workstream' ? onAttachTaskToWorkstreamByReference : undefined, onAttachWorkstreamToInitiativeByReference: detail.type === 'initiative' ? onAttachWorkstreamToInitiativeByReference : undefined, onEdit: () => detail.type === 'initiative'
|
|
232
|
+
}, children: [_jsxs("div", { className: panelStyles.paneHeader, children: [_jsx("span", { className: panelStyles.paneHeaderLabel, children: primaryPaneLabel }), _jsx("button", { type: "button", className: "tf-control-icon", onClick: onCollapsePrimaryPane, children: _jsx(ChevronLeft, { size: 16 }) })] }), _jsx("div", { className: panelStyles.paneContent, children: editor ? (_jsx(PlanningDrawerEditor, { editor: editor, draftTitle: draftTitle, draftDescription: draftDescription, draftOwner: draftOwner, draftInitiativeId: draftInitiativeId, assigneeOptions: assigneeOptions, draftInitiativeSummary: draftInitiativeSummary, onChangeDraftTitle: onChangeDraftTitle, onChangeDraftDescription: onChangeDraftDescription, onChangeDraftOwner: onChangeDraftOwner, onChangeDraftInitiativeId: onChangeDraftInitiativeId, onCancel: onCancelEditor, onSubmit: onSubmitEditor, isSubmitting: isSubmittingEditor, onAssignInitiativeToWorkstream: onAssignInitiativeToWorkstream })) : detail ? (_jsx(PlanningDrawerDetailView, { detail: detail, currentWorkspaceId: currentWorkspaceId, onOpenNestedWorkstreamDetails: detail.type === 'initiative' ? onOpenNestedWorkstreamDetails : undefined, onCreateTaskInWorkstream: detail.type === 'workstream' ? onCreateTaskInWorkstream : undefined, onCreateWorkstreamInInitiative: detail.type === 'initiative' ? onCreateWorkstreamInInitiative : undefined, onOpenTaskById: detail.type === 'workstream' ? onOpenTaskById : undefined, onAttachTaskToWorkstreamByReference: detail.type === 'workstream' ? onAttachTaskToWorkstreamByReference : undefined, onAttachWorkstreamToInitiativeByReference: detail.type === 'initiative' ? onAttachWorkstreamToInitiativeByReference : undefined, onEdit: () => detail.type === 'initiative'
|
|
226
233
|
? onEditInitiative(detail.item.id)
|
|
227
234
|
: onEditWorkstream(detail.item.id), onArchive: () => detail.type === 'initiative'
|
|
228
235
|
? onArchiveInitiative(detail.item.id)
|
|
229
236
|
: onArchiveWorkstream(detail.item.id), onUnarchive: () => detail.type === 'initiative'
|
|
230
237
|
? onUnarchiveInitiative(detail.item.id)
|
|
231
|
-
: onUnarchiveWorkstream(detail.item.id) })) : null })] }))), hasSecondaryPane && (secondaryCollapsed ? (_jsx(CollapsedPane, { label: secondaryPaneLabel, onExpand: onExpandSecondaryPane })) : (_jsxs("div", { className: `${panelStyles.paneShell} ${styles.appScrollbar} tf-scrollbar ${panelStyles.detailPane}`.trim(), style: {
|
|
238
|
+
: onUnarchiveWorkstream(detail.item.id), onAddPlanningContextFile: onAddPlanningContextFile, onRemovePlanningContextFile: onRemovePlanningContextFile, onUpdatePlanningContextCaption: onUpdatePlanningContextCaption })) : null })] }))), hasSecondaryPane && (secondaryCollapsed ? (_jsx(CollapsedPane, { label: secondaryPaneLabel, onExpand: onExpandSecondaryPane })) : (_jsxs("div", { className: `${panelStyles.paneShell} ${styles.appScrollbar} tf-scrollbar ${panelStyles.detailPane}`.trim(), style: {
|
|
232
239
|
flex: `0 0 ${PLANNING_DRAWER_DETAIL_WIDTH_PX}px`,
|
|
233
240
|
width: `${PLANNING_DRAWER_DETAIL_WIDTH_PX}px`,
|
|
234
241
|
minWidth: `${PLANNING_DRAWER_DETAIL_WIDTH_PX}px`,
|
|
235
242
|
maxWidth: `${PLANNING_DRAWER_DETAIL_WIDTH_PX}px`,
|
|
236
|
-
}, children: [_jsxs("div", { className: panelStyles.paneHeader, children: [_jsx("span", { className: panelStyles.paneHeaderLabel, children: secondaryPaneLabel }), _jsx("button", { type: "button", className: "tf-control-icon", onClick: onCollapseSecondaryPane, children: _jsx(ChevronLeft, { size: 16 }) })] }), _jsx("div", { className: panelStyles.paneContent, children: secondaryPane?.kind === 'editor' ? (_jsx(PlanningDrawerEditor, { editor: secondaryPane.editor, draftTitle: draftTitle, draftDescription: draftDescription, draftOwner: draftOwner, draftInitiativeId: draftInitiativeId, assigneeOptions: assigneeOptions, draftInitiativeSummary: draftInitiativeSummary, onChangeDraftTitle: onChangeDraftTitle, onChangeDraftDescription: onChangeDraftDescription, onChangeDraftOwner: onChangeDraftOwner, onChangeDraftInitiativeId: onChangeDraftInitiativeId, onCancel: onBackFromSecondary, onSubmit: onSubmitEditor, onAssignInitiativeToWorkstream: onAssignInitiativeToWorkstream })) : secondaryPane ? (_jsx(PlanningDrawerDetailView, { detail: secondaryPane.detail, onCreateTaskInWorkstream: onCreateTaskInWorkstream, onOpenTaskById: onOpenTaskById, onAttachTaskToWorkstreamByReference: onAttachTaskToWorkstreamByReference, onEdit: () => onEditWorkstream(secondaryPane.detail.item.id), onArchive: () => onArchiveWorkstream(secondaryPane.detail.item.id), onUnarchive: () => onUnarchiveWorkstream(secondaryPane.detail.item.id) })) : null })] })))] }) }));
|
|
243
|
+
}, children: [_jsxs("div", { className: panelStyles.paneHeader, children: [_jsx("span", { className: panelStyles.paneHeaderLabel, children: secondaryPaneLabel }), _jsx("button", { type: "button", className: "tf-control-icon", onClick: onCollapseSecondaryPane, children: _jsx(ChevronLeft, { size: 16 }) })] }), _jsx("div", { className: panelStyles.paneContent, children: secondaryPane?.kind === 'editor' ? (_jsx(PlanningDrawerEditor, { editor: secondaryPane.editor, draftTitle: draftTitle, draftDescription: draftDescription, draftOwner: draftOwner, draftInitiativeId: draftInitiativeId, assigneeOptions: assigneeOptions, draftInitiativeSummary: draftInitiativeSummary, onChangeDraftTitle: onChangeDraftTitle, onChangeDraftDescription: onChangeDraftDescription, onChangeDraftOwner: onChangeDraftOwner, onChangeDraftInitiativeId: onChangeDraftInitiativeId, onCancel: onBackFromSecondary, onSubmit: onSubmitEditor, isSubmitting: isSubmittingEditor, onAssignInitiativeToWorkstream: onAssignInitiativeToWorkstream })) : secondaryPane ? (_jsx(PlanningDrawerDetailView, { detail: secondaryPane.detail, currentWorkspaceId: currentWorkspaceId, onCreateTaskInWorkstream: onCreateTaskInWorkstream, onOpenTaskById: onOpenTaskById, onAttachTaskToWorkstreamByReference: onAttachTaskToWorkstreamByReference, onEdit: () => onEditWorkstream(secondaryPane.detail.item.id), onArchive: () => onArchiveWorkstream(secondaryPane.detail.item.id), onUnarchive: () => onUnarchiveWorkstream(secondaryPane.detail.item.id), onAddPlanningContextFile: onAddPlanningContextFile, onRemovePlanningContextFile: onRemovePlanningContextFile, onUpdatePlanningContextCaption: onUpdatePlanningContextCaption })) : null })] })))] }) }));
|
|
237
244
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
6
|
+
import { PlanningDrawer, } from './PlanningDrawer';
|
|
7
|
+
vi.mock('@dnd-kit/core', async () => {
|
|
8
|
+
const actual = await vi.importActual('@dnd-kit/core');
|
|
9
|
+
return {
|
|
10
|
+
...actual,
|
|
11
|
+
useDndContext: () => ({ active: null }),
|
|
12
|
+
useDraggable: () => ({
|
|
13
|
+
attributes: {},
|
|
14
|
+
listeners: {},
|
|
15
|
+
setNodeRef: () => { },
|
|
16
|
+
transform: null,
|
|
17
|
+
isDragging: false,
|
|
18
|
+
}),
|
|
19
|
+
useDroppable: () => ({
|
|
20
|
+
setNodeRef: () => { },
|
|
21
|
+
isOver: false,
|
|
22
|
+
}),
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
const initiativeSummary = {
|
|
26
|
+
id: 'initiative-1',
|
|
27
|
+
referenceNumber: 12,
|
|
28
|
+
title: 'Platform Launch',
|
|
29
|
+
description: 'Coordinate launch work',
|
|
30
|
+
ownerLabel: null,
|
|
31
|
+
progressPercent: 0,
|
|
32
|
+
taskCount: 0,
|
|
33
|
+
completedTaskCount: 0,
|
|
34
|
+
workstreamCount: 0,
|
|
35
|
+
workstreams: [],
|
|
36
|
+
};
|
|
37
|
+
function renderPlanningDrawerHarness(options) {
|
|
38
|
+
const createWorkstream = vi.fn();
|
|
39
|
+
const submitEditor = vi.fn();
|
|
40
|
+
const removePlanningContextFile = options?.onRemovePlanningContextFile || vi.fn();
|
|
41
|
+
const updatePlanningContextCaption = options?.onUpdatePlanningContextCaption || vi.fn();
|
|
42
|
+
function Harness() {
|
|
43
|
+
const [editor, setEditor] = React.useState(null);
|
|
44
|
+
const [secondaryPane, setSecondaryPane] = React.useState(null);
|
|
45
|
+
const [draftTitle, setDraftTitle] = React.useState('');
|
|
46
|
+
const [draftDescription, setDraftDescription] = React.useState('');
|
|
47
|
+
const [draftOwner, setDraftOwner] = React.useState('');
|
|
48
|
+
const [draftInitiativeId, setDraftInitiativeId] = React.useState('');
|
|
49
|
+
const handleSubmitEditor = () => {
|
|
50
|
+
submitEditor();
|
|
51
|
+
if ((secondaryPane?.kind === 'editor' && secondaryPane.editor.entityType === 'workstream')
|
|
52
|
+
|| editor?.entityType === 'workstream') {
|
|
53
|
+
createWorkstream({
|
|
54
|
+
title: draftTitle.trim() || 'Untitled Workstream',
|
|
55
|
+
initiativeId: draftInitiativeId === 'IN-12' ? initiativeSummary.id : null,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return (_jsx(PlanningDrawer, { open: true, initiatives: [initiativeSummary], standaloneWorkstreams: [], activeInitiativeId: "", activeWorkstreamId: "", expandedInitiativeIds: new Set(['initiative-1']), detail: options?.detail ?? null, editor: editor, secondaryPane: secondaryPane, assigneeOptions: [], draftInitiativeSummary: draftInitiativeId === 'IN-12' ? initiativeSummary : null, draftTitle: draftTitle, draftDescription: draftDescription, draftOwner: draftOwner, draftInitiativeId: draftInitiativeId, onChangeDraftTitle: setDraftTitle, onChangeDraftDescription: setDraftDescription, onChangeDraftOwner: setDraftOwner, onChangeDraftInitiativeId: setDraftInitiativeId, onCollapseTreePane: () => { }, onExpandTreePane: () => { }, onCollapsePrimaryPane: () => { }, onExpandPrimaryPane: () => { }, onCollapseSecondaryPane: () => { }, onExpandSecondaryPane: () => { }, onBackFromSecondary: () => setSecondaryPane(null), treeCollapsed: false, primaryCollapsed: false, secondaryCollapsed: false, onCancelEditor: () => setEditor(null), onSubmitEditor: handleSubmitEditor, isSubmittingEditor: false, onCreateInitiative: () => { }, onCreateWorkstream: () => {
|
|
60
|
+
setSecondaryPane(null);
|
|
61
|
+
setDraftTitle('');
|
|
62
|
+
setDraftDescription('');
|
|
63
|
+
setDraftOwner('');
|
|
64
|
+
setDraftInitiativeId('');
|
|
65
|
+
setEditor({ mode: 'create', entityType: 'workstream' });
|
|
66
|
+
}, onToggleInitiative: () => { }, onSelectInitiative: () => { }, onSelectWorkstream: () => { }, onOpenInitiativeDetails: () => { }, onOpenWorkstreamDetails: () => { }, onOpenNestedWorkstreamDetails: () => { }, onEditInitiative: () => { }, onEditWorkstream: () => { }, onArchiveInitiative: () => { }, onUnarchiveInitiative: () => { }, onArchiveWorkstream: () => { }, onUnarchiveWorkstream: () => { }, onCreateTaskInWorkstream: () => { }, onCreateWorkstreamInInitiative: (initiativeId) => {
|
|
67
|
+
setDraftTitle('');
|
|
68
|
+
setDraftDescription('');
|
|
69
|
+
setDraftOwner('');
|
|
70
|
+
setDraftInitiativeId(initiativeId === initiativeSummary.id ? 'IN-12' : '');
|
|
71
|
+
setSecondaryPane({
|
|
72
|
+
kind: 'editor',
|
|
73
|
+
editor: { mode: 'create', entityType: 'workstream' },
|
|
74
|
+
});
|
|
75
|
+
}, onAssignInitiativeToWorkstream: () => { }, onRemovePlanningContextFile: removePlanningContextFile, onUpdatePlanningContextCaption: updatePlanningContextCaption }));
|
|
76
|
+
}
|
|
77
|
+
render(_jsx(Harness, {}));
|
|
78
|
+
return { createWorkstream, removePlanningContextFile, submitEditor, updatePlanningContextCaption };
|
|
79
|
+
}
|
|
80
|
+
describe('PlanningDrawer workstream create submit', () => {
|
|
81
|
+
it('submits the top-level workstream create editor with Enter', async () => {
|
|
82
|
+
const user = userEvent.setup();
|
|
83
|
+
const { createWorkstream, submitEditor } = renderPlanningDrawerHarness();
|
|
84
|
+
await user.click(screen.getByRole('button', { name: 'Create workstream' }));
|
|
85
|
+
await user.type(screen.getByPlaceholderText('Content Production'), 'Release Readiness{Enter}');
|
|
86
|
+
await waitFor(() => {
|
|
87
|
+
expect(submitEditor).toHaveBeenCalledTimes(1);
|
|
88
|
+
});
|
|
89
|
+
expect(createWorkstream).toHaveBeenCalledWith({
|
|
90
|
+
title: 'Release Readiness',
|
|
91
|
+
initiativeId: null,
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
it('submits the in-initiative workstream create editor with Enter', async () => {
|
|
95
|
+
const user = userEvent.setup();
|
|
96
|
+
const { createWorkstream, submitEditor } = renderPlanningDrawerHarness({
|
|
97
|
+
detail: { type: 'initiative', item: initiativeSummary },
|
|
98
|
+
});
|
|
99
|
+
await user.click(screen.getByRole('button', { name: 'Create workstream in this initiative' }));
|
|
100
|
+
await user.type(screen.getByPlaceholderText('Content Production'), 'Execution Lane{Enter}');
|
|
101
|
+
await waitFor(() => {
|
|
102
|
+
expect(submitEditor).toHaveBeenCalledTimes(1);
|
|
103
|
+
});
|
|
104
|
+
expect(createWorkstream).toHaveBeenCalledWith({
|
|
105
|
+
title: 'Execution Lane',
|
|
106
|
+
initiativeId: 'initiative-1',
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
describe('PlanningDrawer context attachments', () => {
|
|
111
|
+
it('wires workstream context caption and remove actions through planning callbacks', async () => {
|
|
112
|
+
const user = userEvent.setup();
|
|
113
|
+
const workstreamSummary = {
|
|
114
|
+
id: 'workstream-1',
|
|
115
|
+
referenceNumber: 44,
|
|
116
|
+
title: 'Execution Lane',
|
|
117
|
+
description: 'Ship the work',
|
|
118
|
+
ownerLabel: null,
|
|
119
|
+
progressPercent: 0,
|
|
120
|
+
taskCount: 0,
|
|
121
|
+
completedTaskCount: 0,
|
|
122
|
+
attachmentCount: 1,
|
|
123
|
+
attachments: [{ path: '/api/taskforce/context/spec.pdf', caption: '', timestamp: '' }],
|
|
124
|
+
tasks: [],
|
|
125
|
+
};
|
|
126
|
+
const removePlanningContextFile = vi.fn();
|
|
127
|
+
const updatePlanningContextCaption = vi.fn();
|
|
128
|
+
renderPlanningDrawerHarness({
|
|
129
|
+
detail: { type: 'workstream', item: workstreamSummary },
|
|
130
|
+
onRemovePlanningContextFile: removePlanningContextFile,
|
|
131
|
+
onUpdatePlanningContextCaption: updatePlanningContextCaption,
|
|
132
|
+
});
|
|
133
|
+
await user.click(screen.getByText('Context Documents (1)'));
|
|
134
|
+
fireEvent.change(screen.getByPlaceholderText('Add a label...'), {
|
|
135
|
+
target: { value: 'Brief' },
|
|
136
|
+
});
|
|
137
|
+
await user.click(screen.getByTitle('Delete'));
|
|
138
|
+
expect(updatePlanningContextCaption).toHaveBeenLastCalledWith('workstream', 'workstream-1', 0, 'Brief');
|
|
139
|
+
expect(removePlanningContextFile).toHaveBeenCalledWith('workstream', 'workstream-1', 0);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type PlanningTaskScope = 'open' | 'archived' | 'deleted';
|
|
2
|
+
type PlanningWorkstreamLike = {
|
|
3
|
+
id: string;
|
|
4
|
+
initiativeId?: string | null;
|
|
5
|
+
isArchived?: boolean;
|
|
6
|
+
};
|
|
7
|
+
type PlanningInitiativeLike<TWorkstream extends PlanningWorkstreamLike> = {
|
|
8
|
+
id: string;
|
|
9
|
+
isArchived?: boolean;
|
|
10
|
+
workstreams: TWorkstream[];
|
|
11
|
+
};
|
|
12
|
+
export declare function isPlanningEntityVisibleForScope(taskScope: PlanningTaskScope, isArchived: boolean): boolean;
|
|
13
|
+
export declare function scopePlanningSummaries<TWorkstream extends PlanningWorkstreamLike, TInitiative extends PlanningInitiativeLike<TWorkstream>>(initiatives: TInitiative[], workstreams: TWorkstream[], taskScope: PlanningTaskScope): {
|
|
14
|
+
initiatives: TInitiative[];
|
|
15
|
+
standaloneWorkstreams: TWorkstream[];
|
|
16
|
+
visibleWorkstreams: TWorkstream[];
|
|
17
|
+
initiativeById: Map<string, TInitiative>;
|
|
18
|
+
workstreamById: Map<string, TWorkstream>;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function isPlanningEntityVisibleForScope(taskScope, isArchived) {
|
|
2
|
+
if (taskScope === 'deleted')
|
|
3
|
+
return false;
|
|
4
|
+
return taskScope === 'archived' ? isArchived : !isArchived;
|
|
5
|
+
}
|
|
6
|
+
export function scopePlanningSummaries(initiatives, workstreams, taskScope) {
|
|
7
|
+
const scopedWorkstreams = workstreams.filter((workstream) => (isPlanningEntityVisibleForScope(taskScope, Boolean(workstream.isArchived))));
|
|
8
|
+
const visibleInitiatives = taskScope === 'deleted'
|
|
9
|
+
? []
|
|
10
|
+
: initiatives
|
|
11
|
+
.filter((initiative) => isPlanningEntityVisibleForScope(taskScope, Boolean(initiative.isArchived)))
|
|
12
|
+
.map((initiative) => ({
|
|
13
|
+
...initiative,
|
|
14
|
+
workstreams: scopedWorkstreams.filter((workstream) => workstream.initiativeId === initiative.id),
|
|
15
|
+
}));
|
|
16
|
+
const standaloneWorkstreams = scopedWorkstreams.filter((workstream) => !workstream.initiativeId);
|
|
17
|
+
const visibleWorkstreams = [...visibleInitiatives.flatMap((initiative) => initiative.workstreams), ...standaloneWorkstreams];
|
|
18
|
+
return {
|
|
19
|
+
initiatives: visibleInitiatives,
|
|
20
|
+
standaloneWorkstreams,
|
|
21
|
+
visibleWorkstreams,
|
|
22
|
+
initiativeById: new Map(visibleInitiatives.map((initiative) => [initiative.id, initiative])),
|
|
23
|
+
workstreamById: new Map(visibleWorkstreams.map((workstream) => [workstream.id, workstream])),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { isPlanningEntityVisibleForScope, scopePlanningSummaries } from './planningScope';
|
|
3
|
+
describe('planningScope', () => {
|
|
4
|
+
it('hides archived entities from open scope and filters archived child workstreams out of visible initiatives', () => {
|
|
5
|
+
const archivedChild = { id: 'ws-archived', initiativeId: 'in-active', isArchived: true };
|
|
6
|
+
const activeChild = { id: 'ws-active', initiativeId: 'in-active', isArchived: false };
|
|
7
|
+
const standaloneActive = { id: 'ws-standalone', initiativeId: null, isArchived: false };
|
|
8
|
+
const archivedInitiativeChild = { id: 'ws-under-archived', initiativeId: 'in-archived', isArchived: false };
|
|
9
|
+
const scoped = scopePlanningSummaries([
|
|
10
|
+
{
|
|
11
|
+
id: 'in-active',
|
|
12
|
+
isArchived: false,
|
|
13
|
+
workstreams: [activeChild, archivedChild],
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: 'in-archived',
|
|
17
|
+
isArchived: true,
|
|
18
|
+
workstreams: [archivedInitiativeChild],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 'in-standalone',
|
|
22
|
+
isArchived: false,
|
|
23
|
+
workstreams: [standaloneActive],
|
|
24
|
+
},
|
|
25
|
+
], [activeChild, archivedChild, standaloneActive, archivedInitiativeChild], 'open');
|
|
26
|
+
expect(isPlanningEntityVisibleForScope('open', false)).toBe(true);
|
|
27
|
+
expect(isPlanningEntityVisibleForScope('open', true)).toBe(false);
|
|
28
|
+
expect(scoped.initiatives.map((initiative) => initiative.id)).toEqual(['in-active', 'in-standalone']);
|
|
29
|
+
expect(scoped.initiatives.find((initiative) => initiative.id === 'in-active')?.workstreams.map((workstream) => workstream.id)).toEqual(['ws-active']);
|
|
30
|
+
expect(scoped.workstreamById.has('ws-archived')).toBe(false);
|
|
31
|
+
expect(scoped.workstreamById.has('ws-under-archived')).toBe(false);
|
|
32
|
+
expect(scoped.standaloneWorkstreams.map((workstream) => workstream.id)).toEqual(['ws-standalone']);
|
|
33
|
+
});
|
|
34
|
+
it('shows only archived entities in archived scope', () => {
|
|
35
|
+
const scoped = scopePlanningSummaries([
|
|
36
|
+
{
|
|
37
|
+
id: 'in-active',
|
|
38
|
+
isArchived: false,
|
|
39
|
+
workstreams: [{ id: 'ws-active', initiativeId: 'in-active', isArchived: false }],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: 'in-archived',
|
|
43
|
+
isArchived: true,
|
|
44
|
+
workstreams: [
|
|
45
|
+
{ id: 'ws-archived', initiativeId: 'in-archived', isArchived: true },
|
|
46
|
+
{ id: 'ws-active-under-archived', initiativeId: 'in-archived', isArchived: false },
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
], [
|
|
50
|
+
{ id: 'ws-active', initiativeId: 'in-active', isArchived: false },
|
|
51
|
+
{ id: 'ws-archived', initiativeId: 'in-archived', isArchived: true },
|
|
52
|
+
{ id: 'ws-active-under-archived', initiativeId: 'in-archived', isArchived: false },
|
|
53
|
+
], 'archived');
|
|
54
|
+
expect(isPlanningEntityVisibleForScope('archived', true)).toBe(true);
|
|
55
|
+
expect(isPlanningEntityVisibleForScope('archived', false)).toBe(false);
|
|
56
|
+
expect(scoped.initiatives.map((initiative) => initiative.id)).toEqual(['in-archived']);
|
|
57
|
+
expect(scoped.initiatives[0]?.workstreams.map((workstream) => workstream.id)).toEqual(['ws-archived']);
|
|
58
|
+
expect(scoped.workstreamById.has('ws-active-under-archived')).toBe(false);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { AccountProfileSummary } from '../../../../utils/accountProfileSummaryCache';
|
|
2
2
|
import type { ModalRuntimeMode, ModalThemeName } from './types';
|
|
3
|
+
interface LoginMethod {
|
|
4
|
+
provider: string;
|
|
5
|
+
providerEmail: string | null;
|
|
6
|
+
displayNameSnapshot: string | null;
|
|
7
|
+
linkedAt: string | null;
|
|
8
|
+
lastLoginAt: string | null;
|
|
9
|
+
}
|
|
3
10
|
interface AccountHubModalProps {
|
|
4
11
|
isOpen: boolean;
|
|
5
12
|
theme: ModalThemeName;
|
|
@@ -22,6 +29,24 @@ interface AccountHubModalProps {
|
|
|
22
29
|
syncStatusLabel: string;
|
|
23
30
|
workspaceSyncError: string | null;
|
|
24
31
|
syncControlBusy: boolean;
|
|
32
|
+
cloudAuthEnabled: boolean;
|
|
33
|
+
availableAuthProviders: string[];
|
|
34
|
+
onFetchLoginMethods: () => Promise<{
|
|
35
|
+
success: boolean;
|
|
36
|
+
error?: string;
|
|
37
|
+
methods?: LoginMethod[];
|
|
38
|
+
}>;
|
|
39
|
+
onUnlinkLoginMethod: (provider: string) => Promise<{
|
|
40
|
+
success: boolean;
|
|
41
|
+
error?: string;
|
|
42
|
+
code?: string;
|
|
43
|
+
}>;
|
|
44
|
+
onAddPassword: (password: string) => Promise<{
|
|
45
|
+
success: boolean;
|
|
46
|
+
error?: string;
|
|
47
|
+
code?: string;
|
|
48
|
+
}>;
|
|
49
|
+
onLinkProvider: (provider: string) => void;
|
|
25
50
|
onClose: () => void;
|
|
26
51
|
onOpenWorkspaceAudit: () => void;
|
|
27
52
|
onBillingIntervalChange: (value: 'month' | 'year') => void;
|
|
@@ -32,5 +57,5 @@ interface AccountHubModalProps {
|
|
|
32
57
|
onToggleWorkspaceSync: (enabled: boolean) => void;
|
|
33
58
|
onOpenHelp: () => void;
|
|
34
59
|
}
|
|
35
|
-
export declare function AccountHubModal({ isOpen, theme, runtimeMode, authRequiredForApi, isAuthenticated, hasAuthIdentity, authIdentityLabel, billingLoading, billingError, billingActionError, billingNotice, billingActionBusy, billingIntervalChoice, accountProfileSummary, currentWorkspaceId, canOpenTeamManagement, canManageWorkspaceSync, workspaceCloudSyncEnabled, syncStatusLabel, workspaceSyncError, syncControlBusy, onClose, onOpenWorkspaceAudit, onBillingIntervalChange, onRefreshBilling, onUpdateInterval, onManageBilling, onStartCheckout, onToggleWorkspaceSync, onOpenHelp, }: AccountHubModalProps): import("react/jsx-runtime").JSX.Element;
|
|
60
|
+
export declare function AccountHubModal({ isOpen, theme, runtimeMode, authRequiredForApi, isAuthenticated, hasAuthIdentity, authIdentityLabel, billingLoading, billingError, billingActionError, billingNotice, billingActionBusy, billingIntervalChoice, accountProfileSummary, currentWorkspaceId, canOpenTeamManagement, canManageWorkspaceSync, workspaceCloudSyncEnabled, syncStatusLabel, workspaceSyncError, syncControlBusy, cloudAuthEnabled, availableAuthProviders, onFetchLoginMethods, onUnlinkLoginMethod, onAddPassword, onLinkProvider, onClose, onOpenWorkspaceAudit, onBillingIntervalChange, onRefreshBilling, onUpdateInterval, onManageBilling, onStartCheckout, onToggleWorkspaceSync, onOpenHelp, }: AccountHubModalProps): import("react/jsx-runtime").JSX.Element;
|
|
36
61
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
2
3
|
import { Modal } from '../../../ui/Modal';
|
|
3
4
|
import modalStyles from '../../../ui/Modal.module.css';
|
|
4
5
|
import accountStyles from '../../StandaloneAccount.module.css';
|
|
@@ -6,8 +7,10 @@ import authStyles from '../../AuthShell.module.css';
|
|
|
6
7
|
import managementStyles from '../../StandaloneManagement.module.css';
|
|
7
8
|
import styles from '../../../../Taskforce.module.css';
|
|
8
9
|
import { resolveCommercialLifecyclePresentation } from '../../../../utils/commercialLifecyclePresentation';
|
|
9
|
-
|
|
10
|
+
import { getPasswordPolicyGuidance, validatePasswordPolicy } from '../../../../shared/passwordPolicy';
|
|
11
|
+
export function AccountHubModal({ isOpen, theme, runtimeMode, authRequiredForApi, isAuthenticated, hasAuthIdentity, authIdentityLabel, billingLoading, billingError, billingActionError, billingNotice, billingActionBusy, billingIntervalChoice, accountProfileSummary, currentWorkspaceId, canOpenTeamManagement, canManageWorkspaceSync, workspaceCloudSyncEnabled, syncStatusLabel, workspaceSyncError, syncControlBusy, cloudAuthEnabled, availableAuthProviders, onFetchLoginMethods, onUnlinkLoginMethod, onAddPassword, onLinkProvider, onClose, onOpenWorkspaceAudit, onBillingIntervalChange, onRefreshBilling, onUpdateInterval, onManageBilling, onStartCheckout, onToggleWorkspaceSync, onOpenHelp, }) {
|
|
10
12
|
const lifecyclePresentation = resolveCommercialLifecyclePresentation(accountProfileSummary);
|
|
13
|
+
const addPasswordGuidance = getPasswordPolicyGuidance();
|
|
11
14
|
const billingRecoveryMessage = lifecyclePresentation.message;
|
|
12
15
|
const startCheckoutLabel = lifecyclePresentation.primaryLabel || 'Start Checkout';
|
|
13
16
|
const resolvedPlanLabel = String(accountProfileSummary?.planName || accountProfileSummary?.planId || 'n/a').trim() || 'n/a';
|
|
@@ -18,6 +21,77 @@ export function AccountHubModal({ isOpen, theme, runtimeMode, authRequiredForApi
|
|
|
18
21
|
}
|
|
19
22
|
onStartCheckout();
|
|
20
23
|
};
|
|
24
|
+
// ── Login methods state ──────────────────────────────────────────────────────
|
|
25
|
+
const [loginMethods, setLoginMethods] = useState([]);
|
|
26
|
+
const [loginMethodsLoading, setLoginMethodsLoading] = useState(false);
|
|
27
|
+
const [loginMethodsError, setLoginMethodsError] = useState(null);
|
|
28
|
+
const [unlinkBusy, setUnlinkBusy] = useState(null); // provider being unlinked
|
|
29
|
+
const [unlinkError, setUnlinkError] = useState(null);
|
|
30
|
+
const [showAddPassword, setShowAddPassword] = useState(false);
|
|
31
|
+
const [addPasswordValue, setAddPasswordValue] = useState('');
|
|
32
|
+
const [addPasswordBusy, setAddPasswordBusy] = useState(false);
|
|
33
|
+
const [addPasswordError, setAddPasswordError] = useState(null);
|
|
34
|
+
const [addPasswordDone, setAddPasswordDone] = useState(false);
|
|
35
|
+
// Reload login methods whenever the modal opens (and auth is available)
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!isOpen || !isAuthenticated || !cloudAuthEnabled)
|
|
38
|
+
return;
|
|
39
|
+
setLoginMethodsLoading(true);
|
|
40
|
+
setLoginMethodsError(null);
|
|
41
|
+
onFetchLoginMethods().then(result => {
|
|
42
|
+
setLoginMethodsLoading(false);
|
|
43
|
+
if (result.success && result.methods) {
|
|
44
|
+
setLoginMethods(result.methods);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
setLoginMethodsError(result.error || 'Failed to load login methods.');
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}, [isOpen, isAuthenticated, cloudAuthEnabled, onFetchLoginMethods]);
|
|
51
|
+
const handleUnlink = async (provider) => {
|
|
52
|
+
setUnlinkBusy(provider);
|
|
53
|
+
setUnlinkError(null);
|
|
54
|
+
const result = await onUnlinkLoginMethod(provider);
|
|
55
|
+
setUnlinkBusy(null);
|
|
56
|
+
if (!result.success) {
|
|
57
|
+
setUnlinkError(result.error || 'Unlink failed.');
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
setLoginMethods(prev => prev.filter(m => m.provider !== provider));
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const handleAddPassword = async () => {
|
|
64
|
+
const validation = validatePasswordPolicy(addPasswordValue);
|
|
65
|
+
if (!validation.ok) {
|
|
66
|
+
setAddPasswordError(validation.message || 'Password does not meet the password policy.');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
setAddPasswordBusy(true);
|
|
70
|
+
setAddPasswordError(null);
|
|
71
|
+
const result = await onAddPassword(addPasswordValue);
|
|
72
|
+
setAddPasswordBusy(false);
|
|
73
|
+
if (!result.success) {
|
|
74
|
+
setAddPasswordError(result.error || 'Failed to add password.');
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
setAddPasswordDone(true);
|
|
78
|
+
setAddPasswordValue('');
|
|
79
|
+
setShowAddPassword(false);
|
|
80
|
+
// Refresh the list to show the new password method
|
|
81
|
+
const updated = await onFetchLoginMethods();
|
|
82
|
+
if (updated.success && updated.methods)
|
|
83
|
+
setLoginMethods(updated.methods);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const PROVIDER_LABELS = {
|
|
87
|
+
password: 'Email & Password',
|
|
88
|
+
google: 'Google',
|
|
89
|
+
github: 'GitHub',
|
|
90
|
+
apple: 'Apple',
|
|
91
|
+
};
|
|
92
|
+
const linkedProviders = new Set(loginMethods.map(m => m.provider));
|
|
93
|
+
const hasPassword = linkedProviders.has('password');
|
|
94
|
+
const linkableProviders = availableAuthProviders.filter(p => p !== 'password' && !linkedProviders.has(p));
|
|
21
95
|
return (_jsx(Modal, { isOpen: isOpen, onClose: onClose, title: "Account Hub", size: "md", theme: theme, draggable: true, children: _jsxs("div", { className: `${modalStyles.form} ${managementStyles.modalBody}`, children: [_jsx("p", { className: managementStyles.mutedText, children: "Manage sign in, profile, and workspace controls from one place." }), _jsxs("div", { className: accountStyles.accountHubCard, children: [_jsx("strong", { children: "Authentication" }), _jsx("p", { className: managementStyles.sectionText, children: runtimeMode === 'cloud'
|
|
22
96
|
? (authRequiredForApi
|
|
23
97
|
? (isAuthenticated ? 'Signed in. API access is enabled.' : 'Cloud mode requires sign in before app usage.')
|
|
@@ -26,7 +100,7 @@ export function AccountHubModal({ isOpen, theme, runtimeMode, authRequiredForApi
|
|
|
26
100
|
? (hasAuthIdentity
|
|
27
101
|
? _jsxs(_Fragment, { children: ["Signed in as ", _jsx("span", { className: accountStyles.accountIdentityEmail, children: authIdentityLabel })] })
|
|
28
102
|
: 'Signed in')
|
|
29
|
-
: 'Signed in as: not signed in' }), runtimeMode === 'cloud' && authRequiredForApi && !isAuthenticated && (_jsx("p", { className: managementStyles.sectionTextTop, children: "Use the `/login` screen to sign in." }))] }), _jsxs("div", { className: accountStyles.accountHubCard, children: [_jsx("strong", { children: "Profile & Account" }), _jsx("p", { className: managementStyles.sectionText, children: "Profile editing and account preferences will live here." })] }), _jsxs("div", { className: accountStyles.accountHubCard, children: [_jsx("strong", { children: "Billing" }), !isAuthenticated ? (_jsx("p", { className: managementStyles.sectionText, children: "Sign in to manage subscription billing." })) : runtimeMode !== 'cloud' ? (_jsx("p", { className: managementStyles.sectionText, children: "Billing remains cloud-backed in local runtime and uses your connected cloud account." })) : (_jsxs(_Fragment, { children: [billingLoading && (_jsx("p", { className: managementStyles.sectionTextSpaced, children: "Loading billing status..." })), billingError && (_jsx("p", { className: `${authStyles.loginError} ${managementStyles.errorText}`, children: billingError })), billingActionError && (_jsx("p", { className: `${authStyles.loginError} ${managementStyles.errorText}`, children: billingActionError })), billingNotice && (_jsx("p", { className: managementStyles.errorText, children: billingNotice })), billingRecoveryMessage && (_jsx("p", { className: managementStyles.sectionText, children: billingRecoveryMessage })), _jsxs("p", { className: managementStyles.sectionTextSpaced, children: ["Plan: ", _jsx("code", { children: resolvedPlanLabel }), ' · ', "Entitlement: ", _jsx("code", { children: String(accountProfileSummary?.entitlementState || 'n/a') })] }), _jsxs("p", { className: managementStyles.sectionText, children: ["Stripe status: ", _jsx("code", { children: String(accountProfileSummary?.stripeStatus || 'n/a') }), accountProfileSummary?.effectiveUntil ? ` · Effective until ${new Date(accountProfileSummary.effectiveUntil).toLocaleString()}` : ''] }), _jsx("div", { className: managementStyles.wrapRow, children: _jsxs("label", { className: `${accountStyles.accountMenuMeta} ${managementStyles.inlineFieldLabel}`, children: ["Interval", _jsxs("select", { className: styles.input, value: billingIntervalChoice, onChange: (event) => onBillingIntervalChange(event.target.value === 'year' ? 'year' : 'month'), disabled: billingActionBusy, children: [_jsx("option", { value: "month", children: "Monthly" }), _jsx("option", { value: "year", children: "Yearly" })] })] }) }), _jsxs("div", { className: managementStyles.actionRowEnd, children: [_jsx("button", { className: styles.cancelBtn, onClick: onRefreshBilling, disabled: billingActionBusy || billingLoading, children: "Refresh Billing" }), _jsx("button", { className: styles.cancelBtn, onClick: onUpdateInterval, disabled: billingActionBusy || !accountProfileSummary?.stripeSubscriptionId, children: "Update Interval" }), _jsx("button", { className: styles.cancelBtn, onClick: onManageBilling, disabled: billingActionBusy || !accountProfileSummary?.stripeCustomerId, children: "Manage Billing" }), _jsx("button", { className: styles.submitBtn, onClick: primaryBillingAction, disabled: billingActionBusy || (lifecyclePresentation.primaryAction === 'manage_billing' && !accountProfileSummary?.stripeCustomerId), children: billingActionBusy ? 'Working...' : startCheckoutLabel })] })] }))] }), _jsxs("div", { className: accountStyles.accountHubCard, children: [_jsx("strong", { children: "Workspace Audit Log" }), _jsx("p", { className: managementStyles.sectionText, children: "Audit entries are workspace-scoped for the active workspace, not global account history." }), _jsxs("p", { className: managementStyles.sectionText, children: ["Active workspace: ", _jsx("code", { children: currentWorkspaceId })] }), _jsx("div", { className: managementStyles.actionRowEnd, children: _jsx("button", { className: styles.cancelBtn, onClick: onOpenWorkspaceAudit, disabled: !canOpenTeamManagement, children: "Open Workspace Audit" }) })] }), _jsxs("div", { className: accountStyles.accountHubCard, children: [_jsx("strong", { children: "Workspace Cloud Sync" }), _jsx("p", { className: managementStyles.sectionText, children: canManageWorkspaceSync
|
|
103
|
+
: 'Signed in as: not signed in' }), runtimeMode === 'cloud' && authRequiredForApi && !isAuthenticated && (_jsx("p", { className: managementStyles.sectionTextTop, children: "Use the `/login` screen to sign in." }))] }), isAuthenticated && cloudAuthEnabled && (_jsxs("div", { className: accountStyles.accountHubCard, children: [_jsx("strong", { children: "Login Methods" }), loginMethodsLoading && (_jsx("p", { className: managementStyles.sectionText, children: "Loading..." })), loginMethodsError && (_jsx("p", { className: `${authStyles.loginError} ${managementStyles.errorText}`, children: loginMethodsError })), unlinkError && (_jsx("p", { className: `${authStyles.loginError} ${managementStyles.errorText}`, children: unlinkError })), addPasswordDone && (_jsx("p", { className: managementStyles.sectionText, style: { color: 'var(--color-success, #4ade80)' }, children: "Password login added." })), !loginMethodsLoading && loginMethods.length > 0 && (_jsx("div", { style: { marginTop: 8, display: 'grid', gap: 6 }, children: loginMethods.map(method => (_jsxs("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8, flexWrap: 'wrap' }, children: [_jsxs("span", { className: managementStyles.sectionText, children: [_jsx("strong", { children: PROVIDER_LABELS[method.provider] || method.provider }), method.providerEmail ? _jsxs(_Fragment, { children: [" \u00B7 ", _jsx("span", { className: accountStyles.accountMenuMeta, children: method.providerEmail })] }) : null] }), loginMethods.length > 1 && (_jsx("button", { className: styles.cancelBtn, style: { fontSize: 11, padding: '2px 8px' }, disabled: unlinkBusy === method.provider, onClick: () => handleUnlink(method.provider), children: unlinkBusy === method.provider ? 'Removing…' : 'Remove' }))] }, method.provider))) })), !loginMethodsLoading && !hasPassword && !showAddPassword && (_jsx("div", { className: managementStyles.actionRowEnd, children: _jsx("button", { className: styles.cancelBtn, onClick: () => { setShowAddPassword(true); setAddPasswordDone(false); setAddPasswordError(null); }, children: "Add Password Login" }) })), showAddPassword && (_jsxs("div", { style: { marginTop: 10, display: 'grid', gap: 6 }, children: [_jsxs("label", { className: accountStyles.accountMenuMeta, style: { display: 'block' }, children: ["New password", _jsx("input", { type: "password", className: styles.input, placeholder: "Use 12+ characters", value: addPasswordValue, onChange: e => setAddPasswordValue(e.target.value), disabled: addPasswordBusy, style: { marginTop: 4, display: 'block', width: '100%' }, autoComplete: "new-password" })] }), _jsx("p", { className: accountStyles.accountMenuMeta, style: { margin: 0 }, children: addPasswordGuidance.join(' ') }), addPasswordError && (_jsx("p", { className: `${authStyles.loginError} ${managementStyles.errorText}`, children: addPasswordError })), _jsxs("div", { className: managementStyles.actionRowEnd, children: [_jsx("button", { className: styles.cancelBtn, onClick: () => { setShowAddPassword(false); setAddPasswordValue(''); setAddPasswordError(null); }, disabled: addPasswordBusy, children: "Cancel" }), _jsx("button", { className: styles.submitBtn, onClick: handleAddPassword, disabled: addPasswordBusy || !addPasswordValue, children: addPasswordBusy ? 'Saving…' : 'Save Password' })] })] })), !loginMethodsLoading && linkableProviders.length > 0 && (_jsxs("div", { style: { marginTop: 10 }, children: [_jsx("p", { className: accountStyles.accountMenuMeta, style: { marginBottom: 6 }, children: "Link another account:" }), _jsx("div", { className: authStyles.oauthButtons, children: linkableProviders.map(provider => (_jsx("button", { className: authStyles.oauthButton, onClick: () => onLinkProvider(provider), children: PROVIDER_LABELS[provider] || provider }, provider))) })] }))] })), _jsxs("div", { className: accountStyles.accountHubCard, children: [_jsx("strong", { children: "Profile & Account" }), _jsx("p", { className: managementStyles.sectionText, children: "Profile editing and account preferences will live here." })] }), _jsxs("div", { className: accountStyles.accountHubCard, children: [_jsx("strong", { children: "Billing" }), !isAuthenticated ? (_jsx("p", { className: managementStyles.sectionText, children: "Sign in to manage subscription billing." })) : runtimeMode !== 'cloud' ? (_jsx("p", { className: managementStyles.sectionText, children: "Billing remains cloud-backed in local runtime and uses your connected cloud account." })) : (_jsxs(_Fragment, { children: [billingLoading && (_jsx("p", { className: managementStyles.sectionTextSpaced, children: "Loading billing status..." })), billingError && (_jsx("p", { className: `${authStyles.loginError} ${managementStyles.errorText}`, children: billingError })), billingActionError && (_jsx("p", { className: `${authStyles.loginError} ${managementStyles.errorText}`, children: billingActionError })), billingNotice && (_jsx("p", { className: managementStyles.errorText, children: billingNotice })), billingRecoveryMessage && (_jsx("p", { className: managementStyles.sectionText, children: billingRecoveryMessage })), _jsxs("p", { className: managementStyles.sectionTextSpaced, children: ["Plan: ", _jsx("code", { children: resolvedPlanLabel }), ' · ', "Entitlement: ", _jsx("code", { children: String(accountProfileSummary?.entitlementState || 'n/a') })] }), _jsxs("p", { className: managementStyles.sectionText, children: ["Stripe status: ", _jsx("code", { children: String(accountProfileSummary?.stripeStatus || 'n/a') }), accountProfileSummary?.effectiveUntil ? ` · Effective until ${new Date(accountProfileSummary.effectiveUntil).toLocaleString()}` : ''] }), _jsx("div", { className: managementStyles.wrapRow, children: _jsxs("label", { className: `${accountStyles.accountMenuMeta} ${managementStyles.inlineFieldLabel}`, children: ["Interval", _jsxs("select", { className: styles.input, value: billingIntervalChoice, onChange: (event) => onBillingIntervalChange(event.target.value === 'year' ? 'year' : 'month'), disabled: billingActionBusy, children: [_jsx("option", { value: "month", children: "Monthly" }), _jsx("option", { value: "year", children: "Yearly" })] })] }) }), _jsxs("div", { className: managementStyles.actionRowEnd, children: [_jsx("button", { className: styles.cancelBtn, onClick: onRefreshBilling, disabled: billingActionBusy || billingLoading, children: "Refresh Billing" }), _jsx("button", { className: styles.cancelBtn, onClick: onUpdateInterval, disabled: billingActionBusy || !accountProfileSummary?.stripeSubscriptionId, children: "Update Interval" }), _jsx("button", { className: styles.cancelBtn, onClick: onManageBilling, disabled: billingActionBusy || !accountProfileSummary?.stripeCustomerId, children: "Manage Billing" }), _jsx("button", { className: styles.submitBtn, onClick: primaryBillingAction, disabled: billingActionBusy || (lifecyclePresentation.primaryAction === 'manage_billing' && !accountProfileSummary?.stripeCustomerId), children: billingActionBusy ? 'Working...' : startCheckoutLabel })] })] }))] }), _jsxs("div", { className: accountStyles.accountHubCard, children: [_jsx("strong", { children: "Workspace Audit Log" }), _jsx("p", { className: managementStyles.sectionText, children: "Audit entries are workspace-scoped for the active workspace, not global account history." }), _jsxs("p", { className: managementStyles.sectionText, children: ["Active workspace: ", _jsx("code", { children: currentWorkspaceId })] }), _jsx("div", { className: managementStyles.actionRowEnd, children: _jsx("button", { className: styles.cancelBtn, onClick: onOpenWorkspaceAudit, disabled: !canOpenTeamManagement, children: "Open Workspace Audit" }) })] }), _jsxs("div", { className: accountStyles.accountHubCard, children: [_jsx("strong", { children: "Workspace Cloud Sync" }), _jsx("p", { className: managementStyles.sectionText, children: canManageWorkspaceSync
|
|
30
104
|
? (workspaceCloudSyncEnabled
|
|
31
105
|
? `Enabled · ${syncStatusLabel}`
|
|
32
106
|
: 'Disabled')
|