@taskforcehq/taskforce 0.3.304 → 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/README.md +140 -247
- package/dist/Taskforce.module.css +295 -89
- package/dist/TaskforceCore.js +378 -111
- package/dist/TaskforceCore.test.js +1221 -107
- 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 +52 -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/DocumentIndex.d.ts +1 -1
- package/dist/components/features/DocumentIndex.js +1 -1
- package/dist/components/features/DocumentViewer.d.ts +6 -2
- package/dist/components/features/DocumentViewer.js +90 -10
- package/dist/components/features/DocumentWorkspace.d.ts +5 -22
- package/dist/components/features/DocumentWorkspace.js +12 -155
- package/dist/components/features/DocumentWorkspace.test.js +226 -6
- package/dist/components/features/TaskSettings.js +29 -3
- package/dist/components/features/TaskSettings.test.js +42 -1
- package/dist/components/features/documentWorkspaceModel.d.ts +24 -0
- package/dist/components/features/documentWorkspaceModel.js +57 -0
- package/dist/components/features/useDocumentWorkspaceController.d.ts +34 -0
- package/dist/components/features/useDocumentWorkspaceController.js +113 -0
- 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.d.ts +8 -8
- package/dist/components/task/TaskForm.js +362 -230
- package/dist/components/task/TaskForm.test.js +558 -381
- package/dist/components/task/TaskKanban.d.ts +2 -1
- package/dist/components/task/TaskKanban.js +96 -14
- 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 -17
- package/dist/components/views/PlanComparisonPage.test.js +289 -41
- package/dist/components/views/PlansPage.js +239 -106
- package/dist/components/views/PlansPage.test.js +593 -42
- package/dist/components/views/StandaloneLayout.js +310 -554
- package/dist/components/views/panels/FilterToolbar.test.js +6 -4
- 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 +27 -14
- package/dist/components/views/standalone/modals/AccountHubModal.js +87 -15
- package/dist/components/views/standalone/modals/AccountHubModal.test.js +42 -2
- 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/config/envSchema.js +1 -1
- package/dist/core/AiProfileService.d.ts +45 -3
- package/dist/core/AiProfileService.js +774 -63
- package/dist/core/AiProfileService.test.js +22 -2
- package/dist/core/AiProfiles.test.js +761 -2
- 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.d.ts +1 -0
- package/dist/core/AuthTokenService.test.js +78 -0
- package/dist/core/EntitlementsPolicy.test.js +77 -15
- package/dist/core/GlobalSettingsService.js +115 -6
- package/dist/core/PlanEntitlementService.d.ts +30 -3
- package/dist/core/PlanEntitlementService.js +454 -93
- package/dist/core/PlanFeatureCatalog.test.d.ts +1 -0
- package/dist/core/PlanFeatureCatalog.test.js +84 -0
- package/dist/core/PlanVersionPolicy.test.js +54 -28
- package/dist/core/PlanningEntities.test.js +52 -0
- package/dist/core/SignupMonetizationSettings.test.js +241 -44
- package/dist/core/SyncReconciliationService.js +2 -65
- package/dist/core/SystemAdmin.test.js +244 -88
- package/dist/core/TaskAttachmentsCanonical.test.js +51 -1
- package/dist/core/TaskTaxonomyValidation.test.js +53 -0
- package/dist/core/Taskforce.d.ts +228 -14
- package/dist/core/Taskforce.js +814 -201
- 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 +128 -27
- package/dist/core/shared.d.ts +3 -1
- package/dist/core/shared.js +16 -1
- package/dist/core/types.d.ts +68 -2
- package/dist/hooks/auth/useTaskforceAuthBootstrap.js +26 -1
- package/dist/hooks/sync/auth.js +3 -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 +16 -3
- package/dist/hooks/sync/transfers.js +186 -65
- 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 +16 -6
- package/dist/hooks/useSyncOrchestrator.js +424 -175
- package/dist/hooks/useSyncOrchestrator.retry-closure.test.js +487 -10
- package/dist/hooks/useTaskData.js +8 -3
- package/dist/hooks/useTaskData.test.js +45 -0
- package/dist/hooks/useTaskMutations.d.ts +2 -1
- package/dist/hooks/useTaskMutations.js +12 -1
- package/dist/hooks/useTaskMutations.test.js +30 -1
- package/dist/hooks/useTaskforce.d.ts +65 -4
- package/dist/hooks/useTaskforce.js +564 -243
- 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 +2454 -208
- package/dist/hooks/useWorkspaceSyncController.d.ts +4 -1
- package/dist/hooks/useWorkspaceSyncController.js +17 -2
- package/dist/hooks/useWorkspaceSyncController.test.js +1 -0
- 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/adminWorkspaceRegistrar.d.ts +2 -0
- package/dist/mcp/adminWorkspaceRegistrar.js +154 -0
- package/dist/mcp/collaborationRegistrar.d.ts +2 -0
- package/dist/mcp/collaborationRegistrar.js +71 -0
- package/dist/mcp/documentAssetRegistrar.d.ts +2 -0
- package/dist/mcp/documentAssetRegistrar.js +346 -0
- package/dist/mcp/runtime.d.ts +2 -0
- package/dist/mcp/runtime.js +2433 -3534
- package/dist/mcp/runtime.test.js +440 -2
- package/dist/mcp/taskPlanningRegistrar.d.ts +2 -0
- package/dist/mcp/taskPlanningRegistrar.js +418 -0
- package/dist/mcp/toolCatalog.d.ts +35 -0
- package/dist/mcp/toolCatalog.js +3 -0
- 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 +4 -5
- package/dist/server/routes/admin.js +410 -80
- package/dist/server/routes/annotatedAttachments.d.ts +1 -1
- package/dist/server/routes/annotatedAttachments.js +1 -1
- package/dist/server/routes/auth.d.ts +16 -6
- package/dist/server/routes/auth.js +1015 -118
- package/dist/server/routes/authSupport.d.ts +30 -0
- package/dist/server/routes/authSupport.js +81 -0
- package/dist/server/routes/billing.d.ts +1 -1
- package/dist/server/routes/billing.js +276 -34
- package/dist/server/routes/billing.test.js +760 -52
- package/dist/server/routes/documentReviews.d.ts +1 -1
- package/dist/server/routes/documentReviews.js +1 -1
- package/dist/server/routes/documents.d.ts +5 -2
- package/dist/server/routes/documents.js +242 -74
- package/dist/server/routes/primitives.d.ts +11 -0
- package/dist/server/routes/primitives.js +73 -0
- package/dist/server/routes/resources.d.ts +1 -1
- package/dist/server/routes/resources.js +1 -1
- package/dist/server/routes/shared.d.ts +29 -3
- package/dist/server/routes/shared.js +69 -4
- package/dist/server/routes/sync.d.ts +1 -1
- package/dist/server/routes/sync.integration.test.js +437 -39
- package/dist/server/routes/sync.js +62 -606
- 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.d.ts +1 -1
- package/dist/server/routes/tasks.js +44 -2
- package/dist/server/routes/workspaces.d.ts +1 -1
- package/dist/server/routes/workspaces.js +37 -6
- package/dist/server/routes.d.ts +2 -9
- package/dist/server/routes.js +136 -165
- package/dist/server/routes.test.js +2457 -162
- 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 +33 -77
- package/dist/sync/syncApplyHandlers.d.ts +7 -0
- package/dist/sync/syncApplyHandlers.js +28 -13
- package/dist/sync/syncApplyHandlers.test.js +72 -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 +6 -0
- package/dist/sync/syncService.js +60 -0
- package/dist/sync/syncService.test.js +71 -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 +48 -0
- package/dist/sync/workspaceSyncModel.js +195 -31
- package/dist/sync/workspaceSyncModel.test.js +325 -12
- package/dist/sync/workspaceSyncState.d.ts +19 -0
- package/dist/sync/workspaceSyncState.js +3 -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-BlS-cqnl.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-BjR6iBf9.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-DZX4jk7e.js +9 -0
- package/dist/ui/assets/{WorkflowsModule-DnFqdUME.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-I7ZwG1z_.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.d.ts +19 -0
- package/dist/utils/commercialLifecyclePresentation.js +199 -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 +10 -2
- package/scripts/check-cloud-mcp.mjs +83 -0
- package/scripts/export-sqlite-to-postgres.mjs +7 -9
- package/scripts/playwright-auth.sh +5 -1
- package/scripts/run-billing-performance-smoke.sh +24 -0
- 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-BLWVbuKP.js +0 -1
- package/dist/ui/assets/DocumentWorkspace-BH_6DF6x.js +0 -250
- package/dist/ui/assets/DocumentWorkspace-C_8T8oz-.css +0 -1
- package/dist/ui/assets/PlansPage-C2dd2n1X.css +0 -1
- package/dist/ui/assets/PlansPage-CSDQ4sLa.js +0 -1
- package/dist/ui/assets/RussoOne-Regular-C3BxZIj7.ttf +0 -0
- package/dist/ui/assets/TaskSettings-CEDy34Jo.js +0 -9
- package/dist/ui/assets/index-DXUdtH1B.js +0 -6
- package/dist/ui/assets/index-Ii0B0rTO.css +0 -1
- package/scripts/migrate-planning-model.ts +0 -233
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
3
3
|
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
4
4
|
import { MemoryRouter } from 'react-router-dom';
|
|
5
5
|
import { PlansPage } from './PlansPage';
|
|
6
|
+
import { ACCOUNT_PROFILE_SUMMARY_PATH, invalidateAccountProfileSummaryCache } from '../../utils/accountProfileSummaryCache';
|
|
6
7
|
vi.mock('./PlanComparisonPage', () => ({
|
|
7
|
-
PlanComparisonPage: ({ heading, statusBanner, topActions, onSelectPlan, onBack, backLabel, backDisabled }) => (_jsxs("div", { children: [_jsx("h1", { children: heading }), statusBanner?.message ? _jsx("div", { "data-status-type": statusBanner.type, children: statusBanner.message }) : null, topActions, onSelectPlan ? (_jsx("button", { onClick: () => onSelectPlan({
|
|
8
|
+
PlanComparisonPage: ({ heading, pricingEndpoint, statusBanner, topActions, onSelectPlan, onBack, backLabel, backDisabled }) => (_jsxs("div", { children: [_jsx("h1", { children: heading }), pricingEndpoint ? _jsx("div", { "data-testid": "pricing-endpoint", children: pricingEndpoint }) : null, statusBanner?.message ? _jsx("div", { "data-status-type": statusBanner.type, children: statusBanner.message }) : null, topActions, onSelectPlan ? (_jsx("button", { onClick: () => onSelectPlan({
|
|
8
9
|
planId: 'free',
|
|
9
10
|
planVersionId: 'free-v1',
|
|
10
11
|
interval: 'month',
|
|
@@ -14,56 +15,439 @@ vi.mock('./PlanComparisonPage', () => ({
|
|
|
14
15
|
}));
|
|
15
16
|
describe('PlansPage', () => {
|
|
16
17
|
afterEach(() => {
|
|
18
|
+
vi.useRealTimers();
|
|
17
19
|
vi.unstubAllGlobals();
|
|
18
20
|
});
|
|
19
|
-
it('
|
|
20
|
-
|
|
21
|
-
.mockResolvedValueOnce({
|
|
21
|
+
it('builds the pricing endpoint through resolveCloudAuthUrl', async () => {
|
|
22
|
+
vi.stubGlobal('fetch', vi.fn(async () => ({
|
|
22
23
|
ok: true,
|
|
23
|
-
json: async () => ({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
24
|
+
json: async () => ({})
|
|
25
|
+
})));
|
|
26
|
+
render(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans'], children: _jsx(PlansPage, { isAuthenticated: false, runtimeMode: "local", authSessionResolved: true, apiBaseUrl: "https://performance-app.taskforcehq.ai/api", resolveCloudAuthUrl: (path) => `/api/proxy?path=${encodeURIComponent(path)}` }) }));
|
|
27
|
+
expect(await screen.findByTestId('pricing-endpoint')).toHaveTextContent('/api/proxy?path=%2Fapi%2Ftaskforce%2Fpublic%2Fpricing');
|
|
28
|
+
});
|
|
29
|
+
it('shows recovery messaging only after bounded retries are exhausted', async () => {
|
|
30
|
+
vi.useFakeTimers();
|
|
31
|
+
let profileSummaryCalls = 0;
|
|
32
|
+
let confirmCalls = 0;
|
|
33
|
+
const fetchMock = vi.fn(async (url) => {
|
|
34
|
+
if (url.includes('/api/taskforce/account/profile-summary')) {
|
|
35
|
+
profileSummaryCalls += 1;
|
|
36
|
+
if (profileSummaryCalls <= 2) {
|
|
37
|
+
return {
|
|
38
|
+
ok: true,
|
|
39
|
+
json: async () => ({
|
|
40
|
+
planId: 'basic',
|
|
41
|
+
planVersionId: 'basic-v1',
|
|
42
|
+
entitlementState: 'checkout_pending',
|
|
43
|
+
gate: 'checkout_pending',
|
|
44
|
+
message: 'Complete checkout to continue.'
|
|
45
|
+
})
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
ok: true,
|
|
50
|
+
json: async () => ({
|
|
51
|
+
planId: 'basic',
|
|
52
|
+
planVersionId: 'basic-v1',
|
|
53
|
+
entitlementState: 'pending_plan_selection',
|
|
54
|
+
gate: 'plan_selection_required',
|
|
55
|
+
message: 'Your previous checkout expired. Choose a plan to continue.',
|
|
56
|
+
planSelectionRequired: true
|
|
57
|
+
})
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if (url.includes('/api/taskforce/billing/checkout-session/confirm')) {
|
|
61
|
+
confirmCalls += 1;
|
|
62
|
+
return {
|
|
63
|
+
ok: false,
|
|
64
|
+
status: 409,
|
|
65
|
+
json: async () => ({
|
|
66
|
+
error: 'Checkout session has not completed yet.',
|
|
67
|
+
code: 'CHECKOUT_SESSION_INCOMPLETE'
|
|
68
|
+
})
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
ok: true,
|
|
73
|
+
json: async () => ({})
|
|
74
|
+
};
|
|
48
75
|
});
|
|
49
76
|
vi.stubGlobal('fetch', fetchMock);
|
|
50
77
|
render(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans&checkout=success&session_id=cs_test_123'], children: _jsx(PlansPage, { isAuthenticated: true, authUserId: "u1", runtimeMode: "cloud", authSessionResolved: true, resolveCloudAuthUrl: (path) => path }) }));
|
|
78
|
+
expect(screen.getByText('Checkout completed successfully. Finalizing your plan...')).toBeInTheDocument();
|
|
79
|
+
await act(async () => {
|
|
80
|
+
await Promise.resolve();
|
|
81
|
+
});
|
|
82
|
+
expect(confirmCalls).toBe(1);
|
|
83
|
+
await act(async () => {
|
|
84
|
+
await vi.advanceTimersByTimeAsync(50000);
|
|
85
|
+
});
|
|
86
|
+
expect(confirmCalls).toBeGreaterThanOrEqual(12);
|
|
87
|
+
expect(screen.getByText('Your previous checkout expired. Choose a plan to continue.')).toBeInTheDocument();
|
|
88
|
+
expect(screen.queryByText('Checkout completed successfully.')).not.toBeInTheDocument();
|
|
89
|
+
}, 10000);
|
|
90
|
+
it('retries checkout confirmation when the first confirm is incomplete and later succeeds', async () => {
|
|
91
|
+
let profileSummaryCalls = 0;
|
|
92
|
+
let confirmCalls = 0;
|
|
93
|
+
const fetchMock = vi.fn(async (url) => {
|
|
94
|
+
if (url.includes('/api/taskforce/account/profile-summary')) {
|
|
95
|
+
profileSummaryCalls += 1;
|
|
96
|
+
if (profileSummaryCalls <= 2) {
|
|
97
|
+
return {
|
|
98
|
+
ok: true,
|
|
99
|
+
json: async () => ({
|
|
100
|
+
planId: 'basic',
|
|
101
|
+
planVersionId: 'basic-v1',
|
|
102
|
+
entitlementState: 'checkout_pending',
|
|
103
|
+
gate: 'checkout_pending',
|
|
104
|
+
message: 'Complete checkout to continue.'
|
|
105
|
+
})
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
ok: true,
|
|
110
|
+
json: async () => ({
|
|
111
|
+
entitlementState: 'active',
|
|
112
|
+
planId: 'basic',
|
|
113
|
+
planVersionId: 'basic-v1',
|
|
114
|
+
billingInterval: 'month',
|
|
115
|
+
gate: 'ok',
|
|
116
|
+
message: null
|
|
117
|
+
})
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
if (url.includes('/api/taskforce/billing/checkout-session/confirm')) {
|
|
121
|
+
confirmCalls += 1;
|
|
122
|
+
if (confirmCalls === 1) {
|
|
123
|
+
return {
|
|
124
|
+
ok: false,
|
|
125
|
+
status: 409,
|
|
126
|
+
json: async () => ({
|
|
127
|
+
error: 'Checkout session has not completed yet.',
|
|
128
|
+
code: 'CHECKOUT_SESSION_INCOMPLETE'
|
|
129
|
+
})
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
ok: true,
|
|
134
|
+
status: 200,
|
|
135
|
+
json: async () => ({ success: true })
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
ok: true,
|
|
140
|
+
json: async () => ({})
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
144
|
+
render(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans&checkout=success&session_id=cs_test_retry_success'], children: _jsx(PlansPage, { isAuthenticated: true, authUserId: "u1", runtimeMode: "cloud", authSessionResolved: true, resolveCloudAuthUrl: (path) => path }) }));
|
|
51
145
|
expect(await screen.findByText('Checkout completed successfully. Finalizing your plan...')).toBeInTheDocument();
|
|
52
|
-
expect(await screen.findByText('
|
|
146
|
+
expect(await screen.findByText('Checkout completed successfully.')).toBeInTheDocument();
|
|
147
|
+
expect(confirmCalls).toBe(2);
|
|
148
|
+
}, 10000);
|
|
149
|
+
it('treats an active entitlement summary as checkout success even when confirm still reports incomplete', async () => {
|
|
150
|
+
let profileSummaryCalls = 0;
|
|
151
|
+
let confirmCalls = 0;
|
|
152
|
+
const fetchMock = vi.fn(async (url) => {
|
|
153
|
+
if (url.includes('/api/taskforce/account/profile-summary')) {
|
|
154
|
+
profileSummaryCalls += 1;
|
|
155
|
+
if (profileSummaryCalls === 1) {
|
|
156
|
+
return {
|
|
157
|
+
ok: true,
|
|
158
|
+
json: async () => ({
|
|
159
|
+
planId: 'basic',
|
|
160
|
+
planVersionId: 'basic-v1',
|
|
161
|
+
entitlementState: 'checkout_pending',
|
|
162
|
+
gate: 'checkout_pending',
|
|
163
|
+
message: 'Complete checkout to continue.'
|
|
164
|
+
})
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
ok: true,
|
|
169
|
+
json: async () => ({
|
|
170
|
+
entitlementState: 'active',
|
|
171
|
+
planId: 'basic',
|
|
172
|
+
planVersionId: 'basic-v1',
|
|
173
|
+
billingInterval: 'month',
|
|
174
|
+
gate: 'ok',
|
|
175
|
+
message: null
|
|
176
|
+
})
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
if (url.includes('/api/taskforce/billing/checkout-session/confirm')) {
|
|
180
|
+
confirmCalls += 1;
|
|
181
|
+
return {
|
|
182
|
+
ok: false,
|
|
183
|
+
status: 409,
|
|
184
|
+
json: async () => ({
|
|
185
|
+
error: 'Checkout session is still finalizing your plan.',
|
|
186
|
+
code: 'CHECKOUT_SESSION_INCOMPLETE'
|
|
187
|
+
})
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
ok: true,
|
|
192
|
+
json: async () => ({})
|
|
193
|
+
};
|
|
194
|
+
});
|
|
195
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
196
|
+
render(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans&checkout=success&session_id=cs_test_summary_settled'], children: _jsx(PlansPage, { isAuthenticated: true, authUserId: "u1", runtimeMode: "cloud", authSessionResolved: true, resolveCloudAuthUrl: (path) => path }) }));
|
|
197
|
+
expect(await screen.findByText('Checkout completed successfully. Finalizing your plan...')).toBeInTheDocument();
|
|
198
|
+
expect(await screen.findByText('Checkout completed successfully.')).toBeInTheDocument();
|
|
199
|
+
expect(confirmCalls).toBe(1);
|
|
200
|
+
}, 10000);
|
|
201
|
+
it('does not treat an already-active account as settled until the requested interval change is visible', async () => {
|
|
202
|
+
vi.useFakeTimers();
|
|
203
|
+
let confirmCalls = 0;
|
|
204
|
+
const fetchMock = vi.fn(async (url) => {
|
|
205
|
+
if (url.includes('/api/taskforce/account/profile-summary')) {
|
|
206
|
+
return {
|
|
207
|
+
ok: true,
|
|
208
|
+
json: async () => ({
|
|
209
|
+
entitlementState: 'active',
|
|
210
|
+
planId: 'basic',
|
|
211
|
+
planVersionId: 'basic-v1',
|
|
212
|
+
billingInterval: 'month',
|
|
213
|
+
gate: 'ok',
|
|
214
|
+
message: null
|
|
215
|
+
})
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
if (url.includes('/api/taskforce/billing/checkout-session/confirm')) {
|
|
219
|
+
confirmCalls += 1;
|
|
220
|
+
return {
|
|
221
|
+
ok: false,
|
|
222
|
+
status: 409,
|
|
223
|
+
json: async () => ({
|
|
224
|
+
error: 'Checkout session is still finalizing your plan.',
|
|
225
|
+
code: 'CHECKOUT_SESSION_INCOMPLETE'
|
|
226
|
+
})
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
ok: true,
|
|
231
|
+
json: async () => ({})
|
|
232
|
+
};
|
|
233
|
+
});
|
|
234
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
235
|
+
render(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans&checkout=success&session_id=cs_test_existing_active_interval&planId=basic&planVersionId=basic-v1&interval=year'], children: _jsx(PlansPage, { isAuthenticated: true, authUserId: "u1", runtimeMode: "cloud", authSessionResolved: true, resolveCloudAuthUrl: (path) => path }) }));
|
|
236
|
+
expect(screen.getByText('Checkout completed successfully. Finalizing your plan...')).toBeInTheDocument();
|
|
237
|
+
await act(async () => {
|
|
238
|
+
await Promise.resolve();
|
|
239
|
+
});
|
|
240
|
+
expect(confirmCalls).toBe(1);
|
|
241
|
+
expect(screen.queryByText('Checkout completed successfully.')).not.toBeInTheDocument();
|
|
242
|
+
await act(async () => {
|
|
243
|
+
await vi.advanceTimersByTimeAsync(50000);
|
|
244
|
+
});
|
|
245
|
+
expect(confirmCalls).toBeGreaterThanOrEqual(12);
|
|
246
|
+
expect(screen.queryByText('Checkout completed successfully.')).not.toBeInTheDocument();
|
|
247
|
+
}, 10000);
|
|
248
|
+
it('does not retry checkout confirmation for account mismatch responses', async () => {
|
|
249
|
+
let confirmCalls = 0;
|
|
250
|
+
const fetchMock = vi.fn(async (url) => {
|
|
251
|
+
if (url.includes('/api/taskforce/account/profile-summary')) {
|
|
252
|
+
return {
|
|
253
|
+
ok: true,
|
|
254
|
+
json: async () => ({
|
|
255
|
+
planId: 'basic',
|
|
256
|
+
planVersionId: 'basic-v1',
|
|
257
|
+
entitlementState: 'checkout_pending',
|
|
258
|
+
gate: 'checkout_pending',
|
|
259
|
+
message: 'Complete checkout to continue.'
|
|
260
|
+
})
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
if (url.includes('/api/taskforce/billing/checkout-session/confirm')) {
|
|
264
|
+
confirmCalls += 1;
|
|
265
|
+
return {
|
|
266
|
+
ok: false,
|
|
267
|
+
status: 403,
|
|
268
|
+
json: async () => ({
|
|
269
|
+
error: 'Checkout session does not belong to the current account.',
|
|
270
|
+
code: 'CHECKOUT_SESSION_ACCOUNT_MISMATCH'
|
|
271
|
+
})
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
return {
|
|
275
|
+
ok: true,
|
|
276
|
+
json: async () => ({})
|
|
277
|
+
};
|
|
278
|
+
});
|
|
279
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
280
|
+
render(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans&checkout=success&session_id=cs_test_wrong_account'], children: _jsx(PlansPage, { isAuthenticated: true, authUserId: "u1", runtimeMode: "cloud", authSessionResolved: true, resolveCloudAuthUrl: (path) => path }) }));
|
|
281
|
+
expect(await screen.findByText('Checkout completed successfully. Finalizing your plan...')).toBeInTheDocument();
|
|
282
|
+
await waitFor(() => {
|
|
283
|
+
expect(confirmCalls).toBe(1);
|
|
284
|
+
});
|
|
285
|
+
await act(async () => {
|
|
286
|
+
await new Promise((resolve) => setTimeout(resolve, 1200));
|
|
287
|
+
});
|
|
288
|
+
expect(confirmCalls).toBe(1);
|
|
53
289
|
expect(screen.queryByText('Checkout completed successfully.')).not.toBeInTheDocument();
|
|
290
|
+
expect(screen.getByText('Checkout session does not belong to the current account.')).toBeInTheDocument();
|
|
291
|
+
expect(screen.queryByText('Complete checkout to continue.')).not.toBeInTheDocument();
|
|
292
|
+
}, 10000);
|
|
293
|
+
it('attempts checkout confirmation immediately when the user is already authenticated even if auth session is still resolving', async () => {
|
|
294
|
+
let profileSummaryCalls = 0;
|
|
295
|
+
let confirmCalls = 0;
|
|
296
|
+
const fetchMock = vi.fn(async (url) => {
|
|
297
|
+
if (url.includes('/api/taskforce/account/profile-summary')) {
|
|
298
|
+
profileSummaryCalls += 1;
|
|
299
|
+
if (profileSummaryCalls <= 2) {
|
|
300
|
+
return {
|
|
301
|
+
ok: true,
|
|
302
|
+
json: async () => ({
|
|
303
|
+
planId: 'basic',
|
|
304
|
+
planVersionId: 'basic-v1',
|
|
305
|
+
entitlementState: 'checkout_pending',
|
|
306
|
+
gate: 'checkout_pending',
|
|
307
|
+
message: 'Complete checkout to continue.'
|
|
308
|
+
})
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
return {
|
|
312
|
+
ok: true,
|
|
313
|
+
json: async () => ({
|
|
314
|
+
entitlementState: 'active',
|
|
315
|
+
planId: 'basic',
|
|
316
|
+
planVersionId: 'basic-v1',
|
|
317
|
+
gate: 'ok',
|
|
318
|
+
message: null
|
|
319
|
+
})
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
if (url.includes('/api/taskforce/billing/checkout-session/confirm')) {
|
|
323
|
+
confirmCalls += 1;
|
|
324
|
+
return {
|
|
325
|
+
ok: true,
|
|
326
|
+
status: 200,
|
|
327
|
+
json: async () => ({ success: true })
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
return {
|
|
331
|
+
ok: true,
|
|
332
|
+
json: async () => ({})
|
|
333
|
+
};
|
|
334
|
+
});
|
|
335
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
336
|
+
const view = render(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans&checkout=success&session_id=cs_test_auth_wait'], children: _jsx(PlansPage, { isAuthenticated: true, authUserId: "u_auth", runtimeMode: "cloud", authSessionResolved: false, resolveCloudAuthUrl: (path) => path }) }));
|
|
337
|
+
expect(await screen.findByText('Checkout completed successfully. Finalizing your plan...')).toBeInTheDocument();
|
|
54
338
|
await waitFor(() => {
|
|
55
|
-
expect(
|
|
56
|
-
method: 'POST'
|
|
57
|
-
}));
|
|
339
|
+
expect(confirmCalls).toBe(1);
|
|
58
340
|
});
|
|
59
341
|
});
|
|
342
|
+
it('waits to confirm checkout when auth is still unresolved and the user is not yet authenticated', async () => {
|
|
343
|
+
let profileSummaryCalls = 0;
|
|
344
|
+
let confirmCalls = 0;
|
|
345
|
+
const fetchMock = vi.fn(async (url) => {
|
|
346
|
+
if (url.includes('/api/taskforce/account/profile-summary')) {
|
|
347
|
+
profileSummaryCalls += 1;
|
|
348
|
+
return {
|
|
349
|
+
ok: true,
|
|
350
|
+
json: async () => ({
|
|
351
|
+
planId: 'basic',
|
|
352
|
+
planVersionId: 'basic-v1',
|
|
353
|
+
entitlementState: 'checkout_pending',
|
|
354
|
+
gate: 'checkout_pending',
|
|
355
|
+
message: 'Complete checkout to continue.'
|
|
356
|
+
})
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
if (url.includes('/api/taskforce/billing/checkout-session/confirm')) {
|
|
360
|
+
confirmCalls += 1;
|
|
361
|
+
return {
|
|
362
|
+
ok: true,
|
|
363
|
+
status: 200,
|
|
364
|
+
json: async () => ({ success: true })
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
return {
|
|
368
|
+
ok: true,
|
|
369
|
+
json: async () => ({})
|
|
370
|
+
};
|
|
371
|
+
});
|
|
372
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
373
|
+
const view = render(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans&checkout=success&session_id=cs_test_auth_wait'], children: _jsx(PlansPage, { isAuthenticated: false, authUserId: "u_auth", runtimeMode: "cloud", authSessionResolved: false, resolveCloudAuthUrl: (path) => path }) }));
|
|
374
|
+
expect(await screen.findByText('Checkout completed successfully. Finalizing your plan...')).toBeInTheDocument();
|
|
375
|
+
expect(confirmCalls).toBe(0);
|
|
376
|
+
view.rerender(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans&checkout=success&session_id=cs_test_auth_wait'], children: _jsx(PlansPage, { isAuthenticated: true, authUserId: "u_auth", runtimeMode: "cloud", authSessionResolved: true, resolveCloudAuthUrl: (path) => path }) }));
|
|
377
|
+
await waitFor(() => {
|
|
378
|
+
expect(fetchMock.mock.calls.some(([url]) => String(url).includes('/api/taskforce/billing/checkout-session/confirm'))).toBe(true);
|
|
379
|
+
});
|
|
380
|
+
});
|
|
381
|
+
it('restarts checkout confirmation after a mid-flight rerender before the first confirm attempt', async () => {
|
|
382
|
+
let confirmCalls = 0;
|
|
383
|
+
let profileSummaryCalls = 0;
|
|
384
|
+
let releaseBlockedProfileSummaries = false;
|
|
385
|
+
const blockedProfileSummaryResolvers = [];
|
|
386
|
+
const fetchMock = vi.fn(async (url) => {
|
|
387
|
+
if (url.includes('/api/taskforce/account/profile-summary')) {
|
|
388
|
+
profileSummaryCalls += 1;
|
|
389
|
+
if (!releaseBlockedProfileSummaries) {
|
|
390
|
+
return await new Promise((resolve) => {
|
|
391
|
+
blockedProfileSummaryResolvers.push(resolve);
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
return {
|
|
395
|
+
ok: true,
|
|
396
|
+
json: async () => ({
|
|
397
|
+
entitlementState: 'checkout_pending',
|
|
398
|
+
planId: 'basic',
|
|
399
|
+
planVersionId: 'basic-v1',
|
|
400
|
+
gate: 'checkout_pending',
|
|
401
|
+
message: 'Complete checkout to continue.'
|
|
402
|
+
})
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
if (url.includes('/api/taskforce/billing/checkout-session/confirm')) {
|
|
406
|
+
confirmCalls += 1;
|
|
407
|
+
return {
|
|
408
|
+
ok: true,
|
|
409
|
+
status: 200,
|
|
410
|
+
json: async () => ({ success: true })
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
return {
|
|
414
|
+
ok: true,
|
|
415
|
+
json: async () => ({})
|
|
416
|
+
};
|
|
417
|
+
});
|
|
418
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
419
|
+
const firstResolveCloudAuthUrl = (path) => path;
|
|
420
|
+
const secondResolveCloudAuthUrl = (path) => path;
|
|
421
|
+
const view = render(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans&checkout=success&session_id=cs_test_rerender'], children: _jsx(PlansPage, { isAuthenticated: true, authUserId: "u_rerender", runtimeMode: "cloud", authSessionResolved: true, resolveCloudAuthUrl: firstResolveCloudAuthUrl }) }));
|
|
422
|
+
await waitFor(() => {
|
|
423
|
+
expect(profileSummaryCalls).toBeGreaterThan(0);
|
|
424
|
+
});
|
|
425
|
+
view.rerender(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans&checkout=success&session_id=cs_test_rerender'], children: _jsx(PlansPage, { isAuthenticated: true, authUserId: "u_rerender", runtimeMode: "cloud", authSessionResolved: true, resolveCloudAuthUrl: secondResolveCloudAuthUrl }) }));
|
|
426
|
+
releaseBlockedProfileSummaries = true;
|
|
427
|
+
for (const resolve of blockedProfileSummaryResolvers.splice(0)) {
|
|
428
|
+
resolve({
|
|
429
|
+
ok: true,
|
|
430
|
+
json: async () => ({
|
|
431
|
+
entitlementState: 'checkout_pending',
|
|
432
|
+
planId: 'basic',
|
|
433
|
+
planVersionId: 'basic-v1',
|
|
434
|
+
gate: 'checkout_pending',
|
|
435
|
+
message: 'Complete checkout to continue.'
|
|
436
|
+
})
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
await waitFor(() => {
|
|
440
|
+
expect(confirmCalls).toBe(1);
|
|
441
|
+
});
|
|
442
|
+
expect(await screen.findByText('Checkout completed successfully.')).toBeInTheDocument();
|
|
443
|
+
});
|
|
60
444
|
it('shows conflict-specific recovery messaging when the account lands on plans already blocked', async () => {
|
|
61
445
|
const fetchMock = vi.fn()
|
|
62
446
|
.mockResolvedValueOnce({
|
|
63
447
|
ok: true,
|
|
64
448
|
json: async () => ({
|
|
65
|
-
planId: '
|
|
66
|
-
planVersionId: '
|
|
449
|
+
planId: 'basic',
|
|
450
|
+
planVersionId: 'basic-v1',
|
|
67
451
|
entitlementState: 'pending_plan_selection',
|
|
68
452
|
gate: 'plan_selection_required',
|
|
69
453
|
message: 'Choose a plan to continue.',
|
|
@@ -80,8 +464,8 @@ describe('PlansPage', () => {
|
|
|
80
464
|
.mockResolvedValueOnce({
|
|
81
465
|
ok: true,
|
|
82
466
|
json: async () => ({
|
|
83
|
-
planId: '
|
|
84
|
-
planVersionId: '
|
|
467
|
+
planId: 'basic',
|
|
468
|
+
planVersionId: 'basic-v1',
|
|
85
469
|
entitlementState: 'checkout_pending',
|
|
86
470
|
gate: 'checkout_pending',
|
|
87
471
|
message: 'Complete checkout to continue.'
|
|
@@ -90,8 +474,8 @@ describe('PlansPage', () => {
|
|
|
90
474
|
.mockResolvedValueOnce({
|
|
91
475
|
ok: true,
|
|
92
476
|
json: async () => ({
|
|
93
|
-
planId: '
|
|
94
|
-
planVersionId: '
|
|
477
|
+
planId: 'basic',
|
|
478
|
+
planVersionId: 'basic-v1',
|
|
95
479
|
entitlementState: 'pending_plan_selection',
|
|
96
480
|
gate: 'plan_selection_required',
|
|
97
481
|
message: 'Choose a plan to continue.',
|
|
@@ -132,7 +516,8 @@ describe('PlansPage', () => {
|
|
|
132
516
|
});
|
|
133
517
|
vi.stubGlobal('fetch', fetchMock);
|
|
134
518
|
render(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans&gate=plan_selection_required'], children: _jsx(PlansPage, { isAuthenticated: true, authUserId: "u4", runtimeMode: "cloud", authSessionResolved: true, resolveCloudAuthUrl: (path) => path, onContinueToTaskforce: onContinueToTaskforce }) }));
|
|
135
|
-
|
|
519
|
+
await screen.findByRole('heading', { name: 'Subscription Plans' });
|
|
520
|
+
expect(screen.queryByText('Choose a plan to continue.')).not.toBeInTheDocument();
|
|
136
521
|
fireEvent.click(screen.getByRole('button', { name: 'Select Free Plan' }));
|
|
137
522
|
await waitFor(() => {
|
|
138
523
|
expect(onContinueToTaskforce).toHaveBeenCalledTimes(1);
|
|
@@ -152,6 +537,172 @@ describe('PlansPage', () => {
|
|
|
152
537
|
vi.stubGlobal('fetch', fetchMock);
|
|
153
538
|
render(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans&gate=plan_selection_required'], children: _jsx(PlansPage, { isAuthenticated: true, authUserId: "u5", runtimeMode: "cloud", authSessionResolved: true, resolveCloudAuthUrl: (path) => path }) }));
|
|
154
539
|
expect(await screen.findByRole('button', { name: 'Back to App' })).toBeDisabled();
|
|
155
|
-
expect(screen.
|
|
540
|
+
expect(screen.queryByText('Choose a plan to continue.')).not.toBeInTheDocument();
|
|
541
|
+
});
|
|
542
|
+
it('does not auto-continue after an in-place paid interval update for an already active account', async () => {
|
|
543
|
+
const onContinueToTaskforce = vi.fn();
|
|
544
|
+
let profileSummaryCalls = 0;
|
|
545
|
+
const fetchMock = vi.fn(async (url) => {
|
|
546
|
+
if (url.includes('/api/taskforce/account/profile-summary')) {
|
|
547
|
+
profileSummaryCalls += 1;
|
|
548
|
+
if (profileSummaryCalls <= 2) {
|
|
549
|
+
return {
|
|
550
|
+
ok: true,
|
|
551
|
+
json: async () => ({
|
|
552
|
+
entitlementState: 'active',
|
|
553
|
+
planId: 'basic',
|
|
554
|
+
planVersionId: 'basic-v1',
|
|
555
|
+
gate: 'ok',
|
|
556
|
+
message: null
|
|
557
|
+
})
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
return {
|
|
561
|
+
ok: true,
|
|
562
|
+
json: async () => ({
|
|
563
|
+
entitlementState: 'active',
|
|
564
|
+
planId: 'basic',
|
|
565
|
+
planVersionId: 'basic-v1',
|
|
566
|
+
billingInterval: 'year',
|
|
567
|
+
gate: 'ok',
|
|
568
|
+
message: null
|
|
569
|
+
})
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
if (url.includes('/api/taskforce/billing/checkout-session')) {
|
|
573
|
+
return {
|
|
574
|
+
ok: true,
|
|
575
|
+
json: async () => ({
|
|
576
|
+
checkoutState: 'updated',
|
|
577
|
+
message: 'Your subscription was updated successfully.'
|
|
578
|
+
})
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
return {
|
|
582
|
+
ok: true,
|
|
583
|
+
json: async () => ({})
|
|
584
|
+
};
|
|
585
|
+
});
|
|
586
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
587
|
+
render(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans&checkout=start&planId=basic&planVersionId=basic-v1&interval=year'], children: _jsx(PlansPage, { isAuthenticated: true, authUserId: "u6", runtimeMode: "local", authSessionResolved: true, resolveCloudAuthUrl: (path) => path, onContinueToTaskforce: onContinueToTaskforce }) }));
|
|
588
|
+
expect(await screen.findByText('Your subscription was updated successfully.')).toBeInTheDocument();
|
|
589
|
+
expect(onContinueToTaskforce).not.toHaveBeenCalled();
|
|
590
|
+
});
|
|
591
|
+
it('does not auto-continue after confirming checkout when the account was already active', async () => {
|
|
592
|
+
const onContinueToTaskforce = vi.fn();
|
|
593
|
+
let profileSummaryCalls = 0;
|
|
594
|
+
const fetchMock = vi.fn(async (url) => {
|
|
595
|
+
if (url.includes('/api/taskforce/account/profile-summary')) {
|
|
596
|
+
profileSummaryCalls += 1;
|
|
597
|
+
if (profileSummaryCalls <= 2) {
|
|
598
|
+
return {
|
|
599
|
+
ok: true,
|
|
600
|
+
json: async () => ({
|
|
601
|
+
entitlementState: 'active',
|
|
602
|
+
planId: 'basic',
|
|
603
|
+
planVersionId: 'basic-v1',
|
|
604
|
+
gate: 'ok',
|
|
605
|
+
message: null
|
|
606
|
+
})
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
return {
|
|
610
|
+
ok: true,
|
|
611
|
+
json: async () => ({
|
|
612
|
+
entitlementState: 'active',
|
|
613
|
+
planId: 'team-5',
|
|
614
|
+
planVersionId: 'team-5-v1',
|
|
615
|
+
gate: 'ok',
|
|
616
|
+
message: null
|
|
617
|
+
})
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
if (url.includes('/api/taskforce/billing/checkout-session/confirm')) {
|
|
621
|
+
return {
|
|
622
|
+
ok: true,
|
|
623
|
+
json: async () => ({ success: true })
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
return {
|
|
627
|
+
ok: true,
|
|
628
|
+
json: async () => ({})
|
|
629
|
+
};
|
|
630
|
+
});
|
|
631
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
632
|
+
render(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans&checkout=success&session_id=cs_test_existing_active'], children: _jsx(PlansPage, { isAuthenticated: true, authUserId: "u7", runtimeMode: "local", authSessionResolved: true, resolveCloudAuthUrl: (path) => path, onContinueToTaskforce: onContinueToTaskforce }) }));
|
|
633
|
+
expect(await screen.findByText('Checkout completed successfully.')).toBeInTheDocument();
|
|
634
|
+
expect(onContinueToTaskforce).not.toHaveBeenCalled();
|
|
635
|
+
});
|
|
636
|
+
it('shows trial-specific messaging while still allowing return to Taskforce', async () => {
|
|
637
|
+
const fetchMock = vi.fn().mockResolvedValue({
|
|
638
|
+
ok: true,
|
|
639
|
+
json: async () => ({
|
|
640
|
+
entitlementState: 'trialing',
|
|
641
|
+
planId: 'starter',
|
|
642
|
+
planVersionId: 'starter-v1',
|
|
643
|
+
gate: 'ok',
|
|
644
|
+
trialEnd: '2026-05-01T12:00:00.000Z'
|
|
645
|
+
})
|
|
646
|
+
});
|
|
647
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
648
|
+
render(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans'], children: _jsx(PlansPage, { isAuthenticated: true, authUserId: "u8", runtimeMode: "cloud", authSessionResolved: true, resolveCloudAuthUrl: (path) => path, onContinueToTaskforce: vi.fn() }) }));
|
|
649
|
+
expect(await screen.findByText(/Your trial is active through/)).toBeInTheDocument();
|
|
650
|
+
expect(screen.getByRole('button', { name: 'Take Me to Taskforce' })).toBeEnabled();
|
|
651
|
+
});
|
|
652
|
+
it('does not claim an expired trial is still active through a past date', async () => {
|
|
653
|
+
const nowSpy = vi.spyOn(Date, 'now').mockReturnValue(new Date('2026-04-20T12:00:00.000Z').getTime());
|
|
654
|
+
const fetchMock = vi.fn().mockResolvedValue({
|
|
655
|
+
ok: true,
|
|
656
|
+
json: async () => ({
|
|
657
|
+
entitlementState: 'trialing',
|
|
658
|
+
planId: 'starter',
|
|
659
|
+
planVersionId: 'starter-v1',
|
|
660
|
+
gate: 'ok',
|
|
661
|
+
trialEnd: '2026-04-12T16:09:09.000Z'
|
|
662
|
+
})
|
|
663
|
+
});
|
|
664
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
665
|
+
invalidateAccountProfileSummaryCache(ACCOUNT_PROFILE_SUMMARY_PATH, { identityKey: 'u8' });
|
|
666
|
+
try {
|
|
667
|
+
render(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans'], children: _jsx(PlansPage, { isAuthenticated: true, authUserId: "u8", runtimeMode: "cloud", authSessionResolved: true, resolveCloudAuthUrl: (path) => path, onContinueToTaskforce: vi.fn() }) }));
|
|
668
|
+
expect(await screen.findByText('Your trial end date has passed. Billing status is updating.')).toBeInTheDocument();
|
|
669
|
+
expect(screen.queryByText(/Your trial is active through/)).not.toBeInTheDocument();
|
|
670
|
+
}
|
|
671
|
+
finally {
|
|
672
|
+
nowSpy.mockRestore();
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
it('shows suspended accounts a billing-recovery message and keeps return blocked', async () => {
|
|
676
|
+
const fetchMock = vi.fn().mockResolvedValue({
|
|
677
|
+
ok: true,
|
|
678
|
+
json: async () => ({
|
|
679
|
+
entitlementState: 'suspended',
|
|
680
|
+
planId: 'pro',
|
|
681
|
+
planVersionId: 'pro-v1',
|
|
682
|
+
gate: 'missing_entitlement',
|
|
683
|
+
stripeCustomerId: 'cus_123'
|
|
684
|
+
})
|
|
685
|
+
});
|
|
686
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
687
|
+
render(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans'], children: _jsx(PlansPage, { isAuthenticated: true, authUserId: "u9", runtimeMode: "cloud", authSessionResolved: true, resolveCloudAuthUrl: (path) => path }) }));
|
|
688
|
+
expect(await screen.findByText('Your access is suspended because billing needs attention. Update billing to restore access.')).toBeInTheDocument();
|
|
689
|
+
expect(screen.getByRole('button', { name: 'Back to App' })).toBeDisabled();
|
|
690
|
+
expect(screen.getByText('Your access is suspended because billing needs attention. Update billing to restore access.')).toHaveAttribute('data-status-type', 'error');
|
|
691
|
+
});
|
|
692
|
+
it('shows canceled accounts reactivation messaging instead of generic inactive copy', async () => {
|
|
693
|
+
const fetchMock = vi.fn().mockResolvedValue({
|
|
694
|
+
ok: true,
|
|
695
|
+
json: async () => ({
|
|
696
|
+
entitlementState: 'canceled',
|
|
697
|
+
planId: 'pro',
|
|
698
|
+
planVersionId: 'pro-v1',
|
|
699
|
+
gate: 'missing_entitlement',
|
|
700
|
+
message: 'This generic message should be ignored.'
|
|
701
|
+
})
|
|
702
|
+
});
|
|
703
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
704
|
+
render(_jsx(MemoryRouter, { initialEntries: ['/?screen=plans'], children: _jsx(PlansPage, { isAuthenticated: true, authUserId: "u10", runtimeMode: "cloud", authSessionResolved: true, resolveCloudAuthUrl: (path) => path }) }));
|
|
705
|
+
expect(await screen.findByText('Your access has ended. Choose a plan to reactivate your workspace.')).toBeInTheDocument();
|
|
706
|
+
expect(screen.queryByText('This generic message should be ignored.')).not.toBeInTheDocument();
|
|
156
707
|
});
|
|
157
708
|
});
|