@critical-path/react 0.14.0 → 0.14.2
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/package.json +10 -6
- package/CHANGELOG.md +0 -629
- package/dist/cancellation.test.d.ts +0 -2
- package/dist/cancellation.test.d.ts.map +0 -1
- package/dist/cancellation.test.js +0 -42
- package/dist/cancellation.test.js.map +0 -1
- package/dist/index.test.d.ts +0 -2
- package/dist/index.test.d.ts.map +0 -1
- package/dist/index.test.js +0 -25
- package/dist/index.test.js.map +0 -1
- package/src/cancellation.test.tsx +0 -58
- package/src/hooks.ts +0 -1318
- package/src/index.test.ts +0 -45
- package/src/index.ts +0 -2
- package/src/provider.tsx +0 -38
- package/tsconfig.json +0 -9
- package/tsconfig.tsbuildinfo +0 -1
package/src/index.test.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import {
|
|
3
|
-
CriticalPathProvider,
|
|
4
|
-
useCriticalPathClient,
|
|
5
|
-
useProjects,
|
|
6
|
-
useTasks,
|
|
7
|
-
useKanban,
|
|
8
|
-
useWorkflows,
|
|
9
|
-
useTaskTransitions,
|
|
10
|
-
useComments,
|
|
11
|
-
useAttachments,
|
|
12
|
-
useTaskActivity,
|
|
13
|
-
useDeliverables,
|
|
14
|
-
useDeliverableSummary,
|
|
15
|
-
useWebMCP,
|
|
16
|
-
useCriticalPath,
|
|
17
|
-
useTimelineLadder,
|
|
18
|
-
useTaskLadder,
|
|
19
|
-
useTaskMetrics,
|
|
20
|
-
useWorkloadDistribution
|
|
21
|
-
} from './index.js';
|
|
22
|
-
|
|
23
|
-
describe('@critical-path/react Exports Test', () => {
|
|
24
|
-
it('exports Provider and Hooks', () => {
|
|
25
|
-
expect(CriticalPathProvider).toBeDefined();
|
|
26
|
-
expect(useCriticalPathClient).toBeDefined();
|
|
27
|
-
expect(useProjects).toBeDefined();
|
|
28
|
-
expect(useTasks).toBeDefined();
|
|
29
|
-
expect(useKanban).toBeDefined();
|
|
30
|
-
expect(useWorkflows).toBeDefined();
|
|
31
|
-
expect(useTaskTransitions).toBeDefined();
|
|
32
|
-
expect(useComments).toBeDefined();
|
|
33
|
-
expect(useAttachments).toBeDefined();
|
|
34
|
-
expect(useTaskActivity).toBeDefined();
|
|
35
|
-
expect(useDeliverables).toBeDefined();
|
|
36
|
-
expect(useDeliverableSummary).toBeDefined();
|
|
37
|
-
expect(useWebMCP).toBeDefined();
|
|
38
|
-
expect(useCriticalPath).toBeDefined();
|
|
39
|
-
expect(useTimelineLadder).toBeDefined();
|
|
40
|
-
expect(useTaskLadder).toBeDefined();
|
|
41
|
-
expect(useTaskMetrics).toBeDefined();
|
|
42
|
-
expect(useWorkloadDistribution).toBeDefined();
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
package/src/index.ts
DELETED
package/src/provider.tsx
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React, { createContext, useContext, useMemo } from 'react';
|
|
4
|
-
import { CriticalPathClient, type ClientOptions } from '@critical-path/client';
|
|
5
|
-
|
|
6
|
-
interface CriticalPathContextValue {
|
|
7
|
-
client: CriticalPathClient;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const CriticalPathContext = createContext<CriticalPathContextValue | null>(null);
|
|
11
|
-
|
|
12
|
-
export interface CriticalPathProviderProps {
|
|
13
|
-
client?: CriticalPathClient;
|
|
14
|
-
options?: ClientOptions;
|
|
15
|
-
children: React.ReactNode;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function CriticalPathProvider({ client, options, children }: CriticalPathProviderProps) {
|
|
19
|
-
const activeClient = useMemo(() => {
|
|
20
|
-
if (client) return client;
|
|
21
|
-
if (options) return new CriticalPathClient(options);
|
|
22
|
-
return new CriticalPathClient({ baseUrl: '/api/critical-path' });
|
|
23
|
-
}, [client, options]);
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<CriticalPathContext.Provider value={{ client: activeClient }}>
|
|
27
|
-
{children}
|
|
28
|
-
</CriticalPathContext.Provider>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function useCriticalPathClient(): CriticalPathClient {
|
|
33
|
-
const ctx = useContext(CriticalPathContext);
|
|
34
|
-
if (!ctx) {
|
|
35
|
-
throw new Error('useCriticalPathClient must be used within a <CriticalPathProvider>');
|
|
36
|
-
}
|
|
37
|
-
return ctx.client;
|
|
38
|
-
}
|
package/tsconfig.json
DELETED
package/tsconfig.tsbuildinfo
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"root":["./src/cancellation.test.tsx","./src/hooks.ts","./src/index.test.ts","./src/index.ts","./src/provider.tsx"],"version":"5.9.3"}
|