@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.
Files changed (337) hide show
  1. package/dist/Taskforce.module.css +295 -89
  2. package/dist/TaskforceCore.js +215 -43
  3. package/dist/TaskforceCore.test.js +433 -28
  4. package/dist/assets/fonts/CourierPrime-Bold.woff2 +0 -0
  5. package/dist/assets/fonts/CourierPrime-BoldItalic.woff2 +0 -0
  6. package/dist/assets/fonts/CourierPrime-Italic.woff2 +0 -0
  7. package/dist/assets/fonts/CourierPrime-Regular.woff2 +0 -0
  8. package/dist/assets/fonts/Noir_medium.woff2 +0 -0
  9. package/dist/assets/fonts/Noir_regular.woff2 +0 -0
  10. package/dist/assets/fonts/RussoOne-Regular.woff2 +0 -0
  11. package/dist/assets/fonts/SpecialElite-Regular.woff2 +0 -0
  12. package/dist/compat/workspaceSyncCompat.js +46 -2
  13. package/dist/compat/workspaceSyncCompat.test.js +38 -1
  14. package/dist/components/context/ContextAttachmentManager.d.ts +14 -0
  15. package/dist/components/context/ContextAttachmentManager.js +549 -0
  16. package/dist/components/features/AgentsModule.d.ts +10 -1
  17. package/dist/components/features/AgentsModule.js +260 -15
  18. package/dist/components/features/AgentsModule.test.js +255 -5
  19. package/dist/components/features/DocumentViewer.d.ts +5 -1
  20. package/dist/components/features/DocumentViewer.js +60 -3
  21. package/dist/components/features/DocumentWorkspace.js +1 -1
  22. package/dist/components/features/DocumentWorkspace.test.js +33 -0
  23. package/dist/components/features/documentWorkspaceModel.d.ts +1 -1
  24. package/dist/components/task/TaskCard.js +19 -28
  25. package/dist/components/task/TaskCard.test.js +38 -3
  26. package/dist/components/task/TaskContextUpload.js +4 -526
  27. package/dist/components/task/TaskForm.js +85 -90
  28. package/dist/components/task/TaskForm.test.js +110 -8
  29. package/dist/components/task/TaskKanban.d.ts +2 -1
  30. package/dist/components/task/TaskKanban.js +94 -13
  31. package/dist/components/task/TaskKanban.test.js +36 -0
  32. package/dist/components/ui/EditableAvatarButton.d.ts +18 -0
  33. package/dist/components/ui/EditableAvatarButton.js +18 -0
  34. package/dist/components/views/PlanComparisonPage.d.ts +9 -1
  35. package/dist/components/views/PlanComparisonPage.js +70 -14
  36. package/dist/components/views/PlanComparisonPage.test.js +238 -0
  37. package/dist/components/views/PlansPage.js +127 -36
  38. package/dist/components/views/PlansPage.test.js +294 -12
  39. package/dist/components/views/StandaloneLayout.js +283 -533
  40. package/dist/components/views/panels/PlanningDrawer.d.ts +8 -1
  41. package/dist/components/views/panels/PlanningDrawer.js +18 -11
  42. package/dist/components/views/panels/PlanningDrawer.test.d.ts +1 -0
  43. package/dist/components/views/panels/PlanningDrawer.test.js +141 -0
  44. package/dist/components/views/planningScope.d.ts +20 -0
  45. package/dist/components/views/planningScope.js +25 -0
  46. package/dist/components/views/planningScope.test.d.ts +1 -0
  47. package/dist/components/views/planningScope.test.js +60 -0
  48. package/dist/components/views/standalone/modals/AccountHubModal.d.ts +26 -1
  49. package/dist/components/views/standalone/modals/AccountHubModal.js +76 -2
  50. package/dist/components/views/standalone/modals/AccountHubModal.test.js +20 -3
  51. package/dist/components/views/standalone/modals/AvatarImageManagerModal.d.ts +20 -0
  52. package/dist/components/views/standalone/modals/AvatarImageManagerModal.js +127 -0
  53. package/dist/components/views/standalone/modals/EditProfileModal.d.ts +2 -9
  54. package/dist/components/views/standalone/modals/EditProfileModal.js +3 -2
  55. package/dist/components/views/standalone/modals/SyncEnableWarningModal.d.ts +9 -0
  56. package/dist/components/views/standalone/modals/SyncEnableWarningModal.js +6 -0
  57. package/dist/components/views/standalone/modals/SyncEnableWarningModal.test.d.ts +1 -0
  58. package/dist/components/views/standalone/modals/SyncEnableWarningModal.test.js +24 -0
  59. package/dist/components/views/standalone/modals/SyncStatusModal.d.ts +2 -1
  60. package/dist/components/views/standalone/modals/SyncStatusModal.js +2 -2
  61. package/dist/core/AiProfileService.d.ts +39 -2
  62. package/dist/core/AiProfileService.js +639 -73
  63. package/dist/core/AiProfileService.test.js +19 -1
  64. package/dist/core/AiProfiles.test.js +566 -7
  65. package/dist/core/AttachmentLinkService.js +57 -15
  66. package/dist/core/AuthIdentityService.d.ts +107 -0
  67. package/dist/core/AuthIdentityService.js +284 -0
  68. package/dist/core/AuthTokenService.d.ts +4 -0
  69. package/dist/core/AuthTokenService.js +34 -6
  70. package/dist/core/AuthTokenService.test.js +3 -3
  71. package/dist/core/EntitlementsPolicy.test.js +2 -2
  72. package/dist/core/GlobalSettingsService.js +115 -6
  73. package/dist/core/PlanEntitlementService.d.ts +23 -2
  74. package/dist/core/PlanEntitlementService.js +343 -57
  75. package/dist/core/PlanFeatureCatalog.test.d.ts +1 -0
  76. package/dist/core/PlanFeatureCatalog.test.js +84 -0
  77. package/dist/core/PlanVersionPolicy.test.js +35 -2
  78. package/dist/core/PlanningEntities.test.js +52 -0
  79. package/dist/core/SignupMonetizationSettings.test.js +199 -27
  80. package/dist/core/SyncReconciliationService.js +2 -65
  81. package/dist/core/SystemAdmin.test.js +42 -42
  82. package/dist/core/TaskAttachmentsCanonical.test.js +51 -1
  83. package/dist/core/Taskforce.d.ts +225 -14
  84. package/dist/core/Taskforce.js +765 -192
  85. package/dist/core/Taskforce.listTasksSlim.test.d.ts +1 -0
  86. package/dist/core/Taskforce.listTasksSlim.test.js +91 -0
  87. package/dist/core/UserProfileAvatarDrafts.test.js +30 -3
  88. package/dist/core/WorkspaceLifecycleService.js +0 -5
  89. package/dist/core/WorkspacePermissions.test.js +25 -1
  90. package/dist/core/WorkspacePlanMode.test.js +117 -16
  91. package/dist/core/shared.d.ts +1 -1
  92. package/dist/core/shared.js +5 -1
  93. package/dist/core/types.d.ts +68 -2
  94. package/dist/hooks/auth/useTaskforceAuthBootstrap.js +26 -1
  95. package/dist/hooks/sync/bootstrap.js +2 -0
  96. package/dist/hooks/sync/controlPlane.d.ts +37 -0
  97. package/dist/hooks/sync/controlPlane.js +78 -0
  98. package/dist/hooks/sync/controlPlane.test.d.ts +1 -0
  99. package/dist/hooks/sync/controlPlane.test.js +121 -0
  100. package/dist/hooks/sync/lifecyclePolicy.d.ts +45 -0
  101. package/dist/hooks/sync/lifecyclePolicy.js +93 -0
  102. package/dist/hooks/sync/lifecyclePolicy.test.d.ts +1 -0
  103. package/dist/hooks/sync/lifecyclePolicy.test.js +124 -0
  104. package/dist/hooks/sync/orchestratorShared.d.ts +10 -1
  105. package/dist/hooks/sync/orchestratorShared.js +68 -47
  106. package/dist/hooks/sync/orchestratorShared.test.js +50 -1
  107. package/dist/hooks/sync/pullLifecycle.d.ts +31 -0
  108. package/dist/hooks/sync/pullLifecycle.js +24 -0
  109. package/dist/hooks/sync/pullLifecycle.test.d.ts +1 -0
  110. package/dist/hooks/sync/pullLifecycle.test.js +80 -0
  111. package/dist/hooks/sync/recovery.d.ts +16 -2
  112. package/dist/hooks/sync/recovery.js +171 -53
  113. package/dist/hooks/sync/recovery.test.d.ts +1 -0
  114. package/dist/hooks/sync/recovery.test.js +292 -0
  115. package/dist/hooks/sync/transfers.d.ts +15 -3
  116. package/dist/hooks/sync/transfers.js +179 -62
  117. package/dist/hooks/sync/transfers.test.d.ts +1 -0
  118. package/dist/hooks/sync/transfers.test.js +396 -0
  119. package/dist/hooks/sync/useRecentSyncEvents.d.ts +21 -0
  120. package/dist/hooks/sync/useRecentSyncEvents.js +92 -0
  121. package/dist/hooks/sync/useRecentSyncEvents.test.d.ts +1 -0
  122. package/dist/hooks/sync/useRecentSyncEvents.test.js +124 -0
  123. package/dist/hooks/sync/useSyncStatusActions.d.ts +30 -0
  124. package/dist/hooks/sync/useSyncStatusActions.js +88 -0
  125. package/dist/hooks/sync/useSyncStatusActions.test.d.ts +1 -0
  126. package/dist/hooks/sync/useSyncStatusActions.test.js +133 -0
  127. package/dist/hooks/sync/useSyncStatusControls.d.ts +25 -0
  128. package/dist/hooks/sync/useSyncStatusControls.js +60 -0
  129. package/dist/hooks/sync/useSyncStatusControls.test.d.ts +1 -0
  130. package/dist/hooks/sync/useSyncStatusControls.test.js +88 -0
  131. package/dist/hooks/useSyncOrchestrator.aiProfiles.test.js +12 -0
  132. package/dist/hooks/useSyncOrchestrator.d.ts +9 -2
  133. package/dist/hooks/useSyncOrchestrator.js +359 -178
  134. package/dist/hooks/useSyncOrchestrator.retry-closure.test.js +407 -0
  135. package/dist/hooks/useTaskData.js +8 -3
  136. package/dist/hooks/useTaskData.test.js +45 -0
  137. package/dist/hooks/useTaskforce.d.ts +60 -2
  138. package/dist/hooks/useTaskforce.js +549 -240
  139. package/dist/hooks/useTaskforce.runtime-routing.test.d.ts +1 -0
  140. package/dist/hooks/useTaskforce.runtime-routing.test.js +152 -0
  141. package/dist/hooks/useTaskforce.sync-behavior.test.js +2380 -212
  142. package/dist/hooks/useWorkspaceSyncController.d.ts +1 -0
  143. package/dist/hooks/useWorkspaceSyncController.js +6 -1
  144. package/dist/hooks/workspace/useTaskforceWorkspaceBootstrap.d.ts +16 -0
  145. package/dist/hooks/workspace/useTaskforceWorkspaceBootstrap.js +316 -35
  146. package/dist/localization/locales/en-US.d.ts +0 -1
  147. package/dist/localization/locales/en-US.js +0 -1
  148. package/dist/localization/locales/es-419.js +0 -1
  149. package/dist/localization/locales/pt-BR.js +0 -1
  150. package/dist/mcp/documentAssetRegistrar.js +3 -3
  151. package/dist/mcp/runtime.d.ts +2 -0
  152. package/dist/mcp/runtime.js +131 -64
  153. package/dist/mcp/runtime.test.js +291 -12
  154. package/dist/migrations/taskSchemaMigrations.d.ts +1 -1
  155. package/dist/migrations/taskSchemaMigrations.js +171 -61
  156. package/dist/migrations/taskSchemaMigrations.test.js +15 -0
  157. package/dist/resources/templates/workflow-sources/workflowDocs.mjs +6 -6
  158. package/dist/resources/templates/workflows/collaborate.yaml +1 -1
  159. package/dist/resources/templates/workflows/evaluate.yaml +2 -2
  160. package/dist/resources/templates/workflows/plan.yaml +1 -1
  161. package/dist/resources/templates/workflows/review.yaml +2 -2
  162. package/dist/server/annotatedAttachmentsRoutes.test.js +3 -3
  163. package/dist/server/auth/providers/apple.d.ts +33 -0
  164. package/dist/server/auth/providers/apple.js +82 -0
  165. package/dist/server/auth/providers/appleClientSecret.d.ts +37 -0
  166. package/dist/server/auth/providers/appleClientSecret.js +65 -0
  167. package/dist/server/auth/providers/github.d.ts +26 -0
  168. package/dist/server/auth/providers/github.js +86 -0
  169. package/dist/server/auth/providers/google.d.ts +21 -0
  170. package/dist/server/auth/providers/google.js +56 -0
  171. package/dist/server/auth/providers/types.d.ts +21 -0
  172. package/dist/server/auth/providers/types.js +1 -0
  173. package/dist/server/auth.d.ts +2 -0
  174. package/dist/server/auth.js +6 -3
  175. package/dist/server/documentReviewRoutes.test.js +36 -3
  176. package/dist/server/index.cookieProxy.test.js +1 -0
  177. package/dist/server/index.d.ts +12 -0
  178. package/dist/server/index.js +120 -9
  179. package/dist/server/index.rateLimit.test.js +3 -0
  180. package/dist/server/index.test.js +106 -3
  181. package/dist/server/routes/admin.d.ts +3 -0
  182. package/dist/server/routes/admin.js +272 -19
  183. package/dist/server/routes/auth.d.ts +15 -2
  184. package/dist/server/routes/auth.js +994 -57
  185. package/dist/server/routes/authSupport.d.ts +1 -1
  186. package/dist/server/routes/authSupport.js +1 -1
  187. package/dist/server/routes/billing.js +361 -35
  188. package/dist/server/routes/billing.test.js +592 -12
  189. package/dist/server/routes/documents.d.ts +1 -0
  190. package/dist/server/routes/documents.js +172 -70
  191. package/dist/server/routes/shared.d.ts +28 -2
  192. package/dist/server/routes/shared.js +69 -4
  193. package/dist/server/routes/sync.integration.test.js +437 -39
  194. package/dist/server/routes/sync.js +61 -605
  195. package/dist/server/routes/syncAuxRoutes.d.ts +15 -0
  196. package/dist/server/routes/syncAuxRoutes.js +91 -0
  197. package/dist/server/routes/syncAuxRoutes.test.d.ts +1 -0
  198. package/dist/server/routes/syncAuxRoutes.test.js +158 -0
  199. package/dist/server/routes/syncPullApplyRoutes.d.ts +36 -0
  200. package/dist/server/routes/syncPullApplyRoutes.js +204 -0
  201. package/dist/server/routes/syncPushRoutes.d.ts +24 -0
  202. package/dist/server/routes/syncPushRoutes.js +212 -0
  203. package/dist/server/routes/syncRouteGuards.d.ts +36 -0
  204. package/dist/server/routes/syncRouteGuards.js +67 -0
  205. package/dist/server/routes/syncRouteGuards.test.d.ts +1 -0
  206. package/dist/server/routes/syncRouteGuards.test.js +94 -0
  207. package/dist/server/routes/syncRouteTypes.d.ts +13 -0
  208. package/dist/server/routes/syncRouteTypes.js +1 -0
  209. package/dist/server/routes/syncSnapshotRoutes.d.ts +66 -0
  210. package/dist/server/routes/syncSnapshotRoutes.js +180 -0
  211. package/dist/server/routes/tasks.js +43 -1
  212. package/dist/server/routes/workspaces.js +36 -5
  213. package/dist/server/routes.js +60 -3
  214. package/dist/server/routes.test.js +1824 -171
  215. package/dist/services/workflowExportSnapshots.test.js +2 -0
  216. package/dist/shared/aiProfileSeatScope.d.ts +5 -0
  217. package/dist/shared/aiProfileSeatScope.js +21 -0
  218. package/dist/shared/passwordPolicy.d.ts +13 -0
  219. package/dist/shared/passwordPolicy.js +84 -0
  220. package/dist/shared/passwordPolicy.test.d.ts +1 -0
  221. package/dist/shared/passwordPolicy.test.js +34 -0
  222. package/dist/storage/workspaceAssetStore.d.ts +15 -3
  223. package/dist/storage/workspaceAssetStore.js +132 -44
  224. package/dist/storage/workspaceAssetStore.test.js +93 -6
  225. package/dist/styles/fonts.css +70 -0
  226. package/dist/sync/collaborationSyncPayload.d.ts +6 -1
  227. package/dist/sync/collaborationSyncPayload.js +17 -11
  228. package/dist/sync/collaborationSyncPayload.test.js +13 -1
  229. package/dist/sync/contentSyncState.d.ts +4 -8
  230. package/dist/sync/contentSyncState.js +17 -70
  231. package/dist/sync/syncApplyHandlers.d.ts +7 -0
  232. package/dist/sync/syncApplyHandlers.js +28 -13
  233. package/dist/sync/syncApplyHandlers.test.js +70 -3
  234. package/dist/sync/syncFieldSemantics.d.ts +12 -0
  235. package/dist/sync/syncFieldSemantics.js +55 -0
  236. package/dist/sync/syncResourceAdapters.d.ts +44 -0
  237. package/dist/sync/syncResourceAdapters.js +77 -0
  238. package/dist/sync/syncService.d.ts +5 -0
  239. package/dist/sync/syncService.js +52 -0
  240. package/dist/sync/syncService.test.js +57 -3
  241. package/dist/sync/taskSyncChangeKey.d.ts +2 -0
  242. package/dist/sync/taskSyncChangeKey.js +143 -0
  243. package/dist/sync/taskSyncPayload.js +3 -8
  244. package/dist/sync/workspacePullFeed.js +4 -3
  245. package/dist/sync/workspacePullFeed.test.js +43 -0
  246. package/dist/sync/workspaceRepair.js +5 -2
  247. package/dist/sync/workspaceSyncModel.d.ts +45 -0
  248. package/dist/sync/workspaceSyncModel.js +183 -28
  249. package/dist/sync/workspaceSyncModel.test.js +291 -12
  250. package/dist/sync/workspaceSyncState.d.ts +17 -0
  251. package/dist/sync/workspaceSyncState.js +2 -1
  252. package/dist/sync/workspaceSyncSurface.js +3 -8
  253. package/dist/types.d.ts +17 -0
  254. package/dist/ui/assets/AgentsModule-DrLawwNl.js +1 -0
  255. package/dist/ui/assets/{AnnotatedAttachmentWorkspace-BG6P_GVW.js → AnnotatedAttachmentWorkspace-Z9_whf7F.js} +1 -1
  256. package/dist/ui/assets/CourierPrime-Bold-BuLj_dpw.woff2 +0 -0
  257. package/dist/ui/assets/CourierPrime-BoldItalic-BrK2pUkZ.woff2 +0 -0
  258. package/dist/ui/assets/CourierPrime-Italic-DFUZK5Ey.woff2 +0 -0
  259. package/dist/ui/assets/CourierPrime-Regular-BsKphzVf.woff2 +0 -0
  260. package/dist/ui/assets/DocumentWorkspace-B03MaSkw.js +252 -0
  261. package/dist/ui/assets/DocumentWorkspace-Dhdso07p.css +1 -0
  262. package/dist/ui/assets/{InitiativesModule-Dhm7M8e7.js → InitiativesModule-9E6ParrY.js} +1 -1
  263. package/dist/ui/assets/Noir_medium-bxQwKGzB.woff2 +0 -0
  264. package/dist/ui/assets/Noir_regular-ojf2kxlG.woff2 +0 -0
  265. package/dist/ui/assets/PlansPage-CvfnMiWq.css +1 -0
  266. package/dist/ui/assets/PlansPage-DRXscYxH.js +1 -0
  267. package/dist/ui/assets/RussoOne-Regular-Cu_qq_qC.woff2 +0 -0
  268. package/dist/ui/assets/SpecialElite-Regular-Di6gSvAS.woff2 +0 -0
  269. package/dist/ui/assets/{TaskSettings-ln0aF7xc.js → TaskSettings-DZX4jk7e.js} +1 -1
  270. package/dist/ui/assets/{WorkflowsModule-BcS4afRn.js → WorkflowsModule-BA7jcEpH.js} +1 -1
  271. package/dist/ui/assets/index-9eT8e0Lu.css +1 -0
  272. package/dist/ui/assets/index-C6k75jr8.js +6 -0
  273. package/dist/ui/assets/{vendor-icons-BSUaRwF8.js → vendor-icons-DuEd_65c.js} +1 -1
  274. package/dist/ui/fonts/CourierPrime-Bold.ttf +0 -0
  275. package/dist/ui/fonts/CourierPrime-Bold.woff2 +0 -0
  276. package/dist/ui/fonts/CourierPrime-BoldItalic.ttf +0 -0
  277. package/dist/ui/fonts/CourierPrime-BoldItalic.woff2 +0 -0
  278. package/dist/ui/fonts/CourierPrime-Italic.ttf +0 -0
  279. package/dist/ui/fonts/CourierPrime-Italic.woff2 +0 -0
  280. package/dist/ui/fonts/CourierPrime-Regular.ttf +0 -0
  281. package/dist/ui/fonts/CourierPrime-Regular.woff2 +0 -0
  282. package/dist/ui/fonts/Noir_medium.otf +0 -0
  283. package/dist/ui/fonts/Noir_medium.woff2 +0 -0
  284. package/dist/ui/fonts/Noir_regular.otf +0 -0
  285. package/dist/ui/fonts/Noir_regular.woff2 +0 -0
  286. package/dist/ui/fonts/RussoOne-Regular.woff2 +0 -0
  287. package/dist/ui/fonts/SpecialElite-Regular.ttf +0 -0
  288. package/dist/ui/fonts/SpecialElite-Regular.woff2 +0 -0
  289. package/dist/ui/index.html +3 -3
  290. package/dist/utils/accountProfileSummaryCache.d.ts +5 -0
  291. package/dist/utils/assignees.d.ts +2 -0
  292. package/dist/utils/assignees.js +2 -0
  293. package/dist/utils/avatarUpload.d.ts +27 -0
  294. package/dist/utils/avatarUpload.js +132 -0
  295. package/dist/utils/avatarUpload.test.d.ts +1 -0
  296. package/dist/utils/avatarUpload.test.js +40 -0
  297. package/dist/utils/bootstrapTrace.d.ts +7 -0
  298. package/dist/utils/bootstrapTrace.js +29 -0
  299. package/dist/utils/commercialLifecyclePresentation.js +3 -0
  300. package/dist/utils/contextAssetEvents.d.ts +2 -0
  301. package/dist/utils/syncEventDetails.d.ts +3 -0
  302. package/dist/utils/syncEventDetails.js +64 -0
  303. package/dist/utils/syncEventDetails.test.d.ts +1 -0
  304. package/dist/utils/syncEventDetails.test.js +23 -0
  305. package/dist/utils/syncEventPresentation.d.ts +15 -0
  306. package/dist/utils/syncEventPresentation.js +129 -0
  307. package/dist/utils/syncEventPresentation.test.d.ts +1 -0
  308. package/dist/utils/syncEventPresentation.test.js +64 -0
  309. package/dist/utils/syncStatusPresentation.d.ts +72 -0
  310. package/dist/utils/syncStatusPresentation.js +217 -0
  311. package/dist/utils/syncStatusPresentation.test.d.ts +1 -0
  312. package/dist/utils/syncStatusPresentation.test.js +164 -0
  313. package/dist/utils/taskActivity.d.ts +2 -0
  314. package/dist/utils/taskActivity.js +228 -22
  315. package/dist/utils/taskActivity.test.js +119 -8
  316. package/dist/utils/workspaceSyncPresentation.d.ts +4 -0
  317. package/dist/utils/workspaceSyncPresentation.js +68 -2
  318. package/dist/utils/workspaceSyncPresentation.test.js +36 -1
  319. package/package.json +3 -2
  320. package/scripts/export-sqlite-to-postgres.mjs +7 -9
  321. package/scripts/run-e2e-realtime.sh +17 -3
  322. package/scripts/run-smoke.sh +17 -5
  323. package/scripts/run-soak.sh +17 -5
  324. package/src/resources/templates/workflow-sources/workflowDocs.mjs +6 -6
  325. package/src/resources/templates/workflows/collaborate.yaml +1 -1
  326. package/src/resources/templates/workflows/evaluate.yaml +2 -2
  327. package/src/resources/templates/workflows/plan.yaml +1 -1
  328. package/src/resources/templates/workflows/review.yaml +2 -2
  329. package/dist/ui/assets/AgentsModule-N2MnQBZk.js +0 -1
  330. package/dist/ui/assets/DocumentWorkspace-B3nV_Gc5.css +0 -1
  331. package/dist/ui/assets/DocumentWorkspace-DRbDMwh8.js +0 -252
  332. package/dist/ui/assets/PlansPage-C2dd2n1X.css +0 -1
  333. package/dist/ui/assets/PlansPage-Cq0zXj3I.js +0 -1
  334. package/dist/ui/assets/RussoOne-Regular-C3BxZIj7.ttf +0 -0
  335. package/dist/ui/assets/index-C2-OXZV7.css +0 -1
  336. package/dist/ui/assets/index-DcSI5F86.js +0 -6
  337. 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',
@@ -17,7 +18,16 @@ describe('PlansPage', () => {
17
18
  vi.useRealTimers();
18
19
  vi.unstubAllGlobals();
19
20
  });
21
+ it('builds the pricing endpoint through resolveCloudAuthUrl', async () => {
22
+ vi.stubGlobal('fetch', vi.fn(async () => ({
23
+ ok: true,
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
+ });
20
29
  it('shows recovery messaging only after bounded retries are exhausted', async () => {
30
+ vi.useFakeTimers();
21
31
  let profileSummaryCalls = 0;
22
32
  let confirmCalls = 0;
23
33
  const fetchMock = vi.fn(async (url) => {
@@ -65,14 +75,16 @@ describe('PlansPage', () => {
65
75
  });
66
76
  vi.stubGlobal('fetch', fetchMock);
67
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 }) }));
68
- expect(await screen.findByText('Checkout completed successfully. Finalizing your plan...')).toBeInTheDocument();
78
+ expect(screen.getByText('Checkout completed successfully. Finalizing your plan...')).toBeInTheDocument();
79
+ await act(async () => {
80
+ await Promise.resolve();
81
+ });
69
82
  expect(confirmCalls).toBe(1);
70
- await waitFor(() => {
71
- expect(confirmCalls).toBe(4);
72
- }, { timeout: 4500 });
73
- await waitFor(() => {
74
- expect(screen.getByText('Your previous checkout expired. Choose a plan to continue.')).toBeInTheDocument();
83
+ await act(async () => {
84
+ await vi.advanceTimersByTimeAsync(50000);
75
85
  });
86
+ expect(confirmCalls).toBeGreaterThanOrEqual(12);
87
+ expect(screen.getByText('Your previous checkout expired. Choose a plan to continue.')).toBeInTheDocument();
76
88
  expect(screen.queryByText('Checkout completed successfully.')).not.toBeInTheDocument();
77
89
  }, 10000);
78
90
  it('retries checkout confirmation when the first confirm is incomplete and later succeeds', async () => {
@@ -134,8 +146,153 @@ describe('PlansPage', () => {
134
146
  expect(await screen.findByText('Checkout completed successfully.')).toBeInTheDocument();
135
147
  expect(confirmCalls).toBe(2);
136
148
  }, 10000);
137
- it('does not attempt checkout confirmation before auth session is resolved', async () => {
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);
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 () => {
138
294
  let profileSummaryCalls = 0;
295
+ let confirmCalls = 0;
139
296
  const fetchMock = vi.fn(async (url) => {
140
297
  if (url.includes('/api/taskforce/account/profile-summary')) {
141
298
  profileSummaryCalls += 1;
@@ -163,6 +320,7 @@ describe('PlansPage', () => {
163
320
  };
164
321
  }
165
322
  if (url.includes('/api/taskforce/billing/checkout-session/confirm')) {
323
+ confirmCalls += 1;
166
324
  return {
167
325
  ok: true,
168
326
  status: 200,
@@ -177,12 +335,112 @@ describe('PlansPage', () => {
177
335
  vi.stubGlobal('fetch', fetchMock);
178
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 }) }));
179
337
  expect(await screen.findByText('Checkout completed successfully. Finalizing your plan...')).toBeInTheDocument();
180
- expect(fetchMock.mock.calls.some(([url]) => String(url).includes('/api/taskforce/billing/checkout-session/confirm'))).toBe(false);
338
+ await waitFor(() => {
339
+ expect(confirmCalls).toBe(1);
340
+ });
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);
181
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 }) }));
182
377
  await waitFor(() => {
183
378
  expect(fetchMock.mock.calls.some(([url]) => String(url).includes('/api/taskforce/billing/checkout-session/confirm'))).toBe(true);
184
379
  });
185
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
+ });
186
444
  it('shows conflict-specific recovery messaging when the account lands on plans already blocked', async () => {
187
445
  const fetchMock = vi.fn()
188
446
  .mockResolvedValueOnce({
@@ -258,7 +516,8 @@ describe('PlansPage', () => {
258
516
  });
259
517
  vi.stubGlobal('fetch', fetchMock);
260
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 }) }));
261
- expect(await screen.findByText('Choose a plan to continue.')).toBeInTheDocument();
519
+ await screen.findByRole('heading', { name: 'Subscription Plans' });
520
+ expect(screen.queryByText('Choose a plan to continue.')).not.toBeInTheDocument();
262
521
  fireEvent.click(screen.getByRole('button', { name: 'Select Free Plan' }));
263
522
  await waitFor(() => {
264
523
  expect(onContinueToTaskforce).toHaveBeenCalledTimes(1);
@@ -278,7 +537,7 @@ describe('PlansPage', () => {
278
537
  vi.stubGlobal('fetch', fetchMock);
279
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 }) }));
280
539
  expect(await screen.findByRole('button', { name: 'Back to App' })).toBeDisabled();
281
- expect(screen.getByText('Choose a plan to continue.')).toHaveAttribute('data-status-type', 'info');
540
+ expect(screen.queryByText('Choose a plan to continue.')).not.toBeInTheDocument();
282
541
  });
283
542
  it('does not auto-continue after an in-place paid interval update for an already active account', async () => {
284
543
  const onContinueToTaskforce = vi.fn();
@@ -390,6 +649,29 @@ describe('PlansPage', () => {
390
649
  expect(await screen.findByText(/Your trial is active through/)).toBeInTheDocument();
391
650
  expect(screen.getByRole('button', { name: 'Take Me to Taskforce' })).toBeEnabled();
392
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
+ });
393
675
  it('shows suspended accounts a billing-recovery message and keeps return blocked', async () => {
394
676
  const fetchMock = vi.fn().mockResolvedValue({
395
677
  ok: true,