@taskforcehq/taskforce 0.3.302 → 0.3.303

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 (77) hide show
  1. package/dist/Taskforce.module.css +11 -0
  2. package/dist/TaskforceCore.js +59 -9
  3. package/dist/TaskforceCore.test.js +717 -14
  4. package/dist/components/task/TaskKanban.test.js +17 -0
  5. package/dist/components/views/PlansPage.d.ts +3 -1
  6. package/dist/components/views/PlansPage.js +110 -51
  7. package/dist/components/views/PlansPage.test.d.ts +1 -0
  8. package/dist/components/views/PlansPage.test.js +100 -0
  9. package/dist/components/views/StandaloneLayout.d.ts +1 -0
  10. package/dist/components/views/StandaloneLayout.js +106 -151
  11. package/dist/components/views/standalone/modals/AccountHubModal.d.ts +8 -3
  12. package/dist/components/views/standalone/modals/AccountHubModal.js +16 -2
  13. package/dist/components/views/standalone/modals/AccountHubModal.test.d.ts +1 -0
  14. package/dist/components/views/standalone/modals/AccountHubModal.test.js +26 -0
  15. package/dist/core/EntitlementsPolicy.test.js +2 -2
  16. package/dist/core/GlobalSettingsService.js +78 -18
  17. package/dist/core/PlanEntitlementService.d.ts +29 -5
  18. package/dist/core/PlanEntitlementService.js +297 -219
  19. package/dist/core/SignupMonetizationSettings.test.js +173 -49
  20. package/dist/core/SystemAdmin.test.js +186 -96
  21. package/dist/core/Taskforce.d.ts +51 -10
  22. package/dist/core/Taskforce.js +218 -49
  23. package/dist/core/Taskforce.mcpAuth.test.js +0 -2
  24. package/dist/core/UserProfileAvatarDrafts.test.js +12 -3
  25. package/dist/core/types.d.ts +11 -12
  26. package/dist/hooks/useSyncOrchestrator.js +17 -3
  27. package/dist/hooks/useSyncOrchestrator.retry-closure.test.js +97 -5
  28. package/dist/hooks/useTaskforce.d.ts +3 -0
  29. package/dist/hooks/useTaskforce.js +9 -4
  30. package/dist/mcp/runtime.js +90 -29
  31. package/dist/mcp/runtime.test.js +272 -81
  32. package/dist/migrations/billingSchemaParity.test.js +3 -0
  33. package/dist/migrations/taskSchemaMigrations.js +15 -0
  34. package/dist/server/index.cookieProxy.test.js +1 -0
  35. package/dist/server/index.js +2 -0
  36. package/dist/server/index.test.js +2 -1
  37. package/dist/server/mockStripe.d.ts +1 -0
  38. package/dist/server/mockStripe.js +2 -0
  39. package/dist/server/routes/admin.js +80 -23
  40. package/dist/server/routes/auth.d.ts +1 -0
  41. package/dist/server/routes/auth.js +194 -53
  42. package/dist/server/routes/billing.js +506 -23
  43. package/dist/server/routes/billing.test.js +937 -45
  44. package/dist/server/routes/shared.js +5 -3
  45. package/dist/server/routes/sync.integration.test.js +160 -0
  46. package/dist/server/routes/sync.js +15 -5
  47. package/dist/server/routes.js +3 -3
  48. package/dist/server/routes.test.js +287 -76
  49. package/dist/sync/cloudSyncApi.d.ts +1 -0
  50. package/dist/sync/contentSyncState.d.ts +10 -0
  51. package/dist/sync/contentSyncState.js +277 -16
  52. package/dist/sync/syncService.d.ts +1 -0
  53. package/dist/sync/syncService.js +21 -8
  54. package/dist/sync/workspacePullFeed.d.ts +10 -0
  55. package/dist/sync/workspacePullFeed.js +111 -63
  56. package/dist/sync/workspacePullFeed.test.js +112 -0
  57. package/dist/ui/assets/{AgentsModule-JG5jc3he.js → AgentsModule-CpsTmrIW.js} +1 -1
  58. package/dist/ui/assets/{AnnotatedAttachmentWorkspace-Dvi02Y7q.js → AnnotatedAttachmentWorkspace-C_TmXZwA.js} +1 -1
  59. package/dist/ui/assets/{DocumentWorkspace-iys3zfca.js → DocumentWorkspace-C3GyzrWm.js} +1 -1
  60. package/dist/ui/assets/{InitiativesModule-DJvLJI3A.js → InitiativesModule-4-Rh2K2n.js} +1 -1
  61. package/dist/ui/assets/PlansPage-BP7AYOqr.js +1 -0
  62. package/dist/ui/assets/{TaskSettings-Bqd4cCzW.js → TaskSettings-BOC5F6Ag.js} +1 -1
  63. package/dist/ui/assets/{WorkflowsModule-BguHeQaV.js → WorkflowsModule-CGk9s3NJ.js} +1 -1
  64. package/dist/ui/assets/index-CLIMgR6g.js +6 -0
  65. package/dist/ui/assets/index-DneETxcu.css +1 -0
  66. package/dist/ui/assets/{vendor-icons-C8EED3Oh.js → vendor-icons-pWocEipT.js} +1 -1
  67. package/dist/ui/index.html +3 -3
  68. package/dist/utils/accountProfileSummaryCache.d.ts +31 -0
  69. package/dist/utils/accountProfileSummaryCache.js +97 -0
  70. package/dist/utils/accountProfileSummaryCache.test.d.ts +1 -0
  71. package/dist/utils/accountProfileSummaryCache.test.js +63 -0
  72. package/package.json +3 -3
  73. package/dist/ui/assets/PlansPage-BMPlpFpw.js +0 -1
  74. package/dist/ui/assets/index-MXeWoebC.css +0 -1
  75. package/dist/ui/assets/index-YJ4k5QNa.js +0 -6
  76. package/dist/utils/billingStatusCache.d.ts +0 -21
  77. package/dist/utils/billingStatusCache.js +0 -70
@@ -1,21 +0,0 @@
1
- export type BillingStatusPayload = {
2
- stripeStatus?: string | null;
3
- stripeCustomerId?: string | null;
4
- stripeSubscriptionId?: string | null;
5
- stripePriceId?: string | null;
6
- billingInterval?: 'month' | 'year' | null;
7
- trialEnd?: string | null;
8
- currentPeriodEnd?: string | null;
9
- effectiveUntil?: string | null;
10
- entitlementState?: string;
11
- planVersionId?: string;
12
- planId?: string;
13
- planName?: string | null;
14
- gate?: string | null;
15
- message?: string | null;
16
- planSelectionRequired?: boolean;
17
- };
18
- export declare function invalidateBillingStatusCache(rawUrl: string): void;
19
- export declare function loadBillingStatusCached(rawUrl: string, options?: {
20
- force?: boolean;
21
- }): Promise<BillingStatusPayload | null>;
@@ -1,70 +0,0 @@
1
- import { logBootstrapDebug } from '../hooks/workspace/workspaceLocalState';
2
- const BILLING_STATUS_CACHE_TTL_MS = 5_000;
3
- const billingStatusCache = new Map();
4
- function getTimingNow() {
5
- return typeof performance !== 'undefined' ? performance.now() : Date.now();
6
- }
7
- function normalizeBillingStatusUrl(raw) {
8
- return String(raw || '').trim();
9
- }
10
- export function invalidateBillingStatusCache(rawUrl) {
11
- billingStatusCache.delete(normalizeBillingStatusUrl(rawUrl));
12
- }
13
- export async function loadBillingStatusCached(rawUrl, options) {
14
- const url = normalizeBillingStatusUrl(rawUrl);
15
- if (!url)
16
- return null;
17
- const force = options?.force === true;
18
- const now = Date.now();
19
- const cached = billingStatusCache.get(url);
20
- if (!force && cached?.payload !== undefined && (now - cached.fetchedAt) < BILLING_STATUS_CACHE_TTL_MS) {
21
- logBootstrapDebug('billing_status_cache_hit', {
22
- url,
23
- ageMs: now - cached.fetchedAt
24
- });
25
- return cached.payload;
26
- }
27
- if (!force && cached?.promise) {
28
- logBootstrapDebug('billing_status_request_reused', {
29
- url
30
- });
31
- return cached.promise;
32
- }
33
- const startedAt = getTimingNow();
34
- const request = (async () => {
35
- const res = await fetch(url, {
36
- method: 'GET',
37
- credentials: 'include'
38
- });
39
- if (!res.ok) {
40
- throw new Error(String((await res.json().catch(() => ({})))?.error || 'Failed to load billing status.'));
41
- }
42
- const payload = await res.json().catch(() => ({}));
43
- const normalized = (payload || null);
44
- billingStatusCache.set(url, {
45
- payload: normalized,
46
- fetchedAt: Date.now(),
47
- promise: null
48
- });
49
- logBootstrapDebug('billing_status_loaded', {
50
- url,
51
- durationMs: Math.round(getTimingNow() - startedAt),
52
- fromCache: false
53
- });
54
- return normalized;
55
- })().catch((error) => {
56
- billingStatusCache.delete(url);
57
- logBootstrapDebug('billing_status_failed', {
58
- url,
59
- durationMs: Math.round(getTimingNow() - startedAt),
60
- error: error instanceof Error ? error.message : String(error || 'Unknown error')
61
- });
62
- throw error;
63
- });
64
- billingStatusCache.set(url, {
65
- payload: cached?.payload ?? null,
66
- fetchedAt: cached?.fetchedAt ?? 0,
67
- promise: request
68
- });
69
- return request;
70
- }