@burdenoff/microfe-movethewheels 2026.716.2 → 2026.719.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/dist/generated/wspace-operations.d.ts +0 -42
- package/dist/hooks/index.js +0 -1
- package/dist/hooks/useAnalytics.js +11 -11
- package/dist/index.js +25 -26
- package/dist/movethewheels/hooks/index.d.ts +0 -1
- package/dist/movethewheels/pages/AIAssistantPage.d.ts +19 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/message-circle.js +8 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/shield-check.js +11 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/wallet.js +11 -0
- package/dist/pages/AIAssistantPage.js +74 -201
- package/package.json +1 -1
- package/src/generated/wspace-operations.ts +0 -52
- package/src/movethewheels/components/maps/leaflet-setup.ts +1 -8
- package/src/movethewheels/hooks/index.ts +0 -3
- package/src/movethewheels/hooks/useAnalytics.ts +17 -17
- package/src/movethewheels/index.ts +1 -1
- package/src/movethewheels/pages/AIAssistantPage.tsx +81 -185
- package/src/movethewheels/services/createSandboxAssistantTransport.ts +1 -2
- package/src/operations/wspace/movethewheels/queries/dashboard.graphql +0 -8
- package/dist/hooks/useAssistant.js +0 -39
- package/dist/movethewheels/hooks/useAssistant.d.ts +0 -17
- package/dist/node_modules/lucide-react/dist/esm/icons/lightbulb.js +0 -18
- package/dist/node_modules/lucide-react/dist/esm/icons/send.js +0 -11
- package/dist/node_modules/lucide-react/dist/esm/icons/sparkles.js +0 -26
- package/src/movethewheels/hooks/useAssistant.ts +0 -74
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
2
|
-
import { useMoveTheWheels } from '../providers/MoveTheWheelsProvider';
|
|
3
|
-
import { executeGraphQL } from '../utils/graphqlClient';
|
|
4
|
-
|
|
5
|
-
export interface AssistantAnswer {
|
|
6
|
-
answer: string;
|
|
7
|
-
generatedAt: string;
|
|
8
|
-
question: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const ASSISTANT_INSIGHTS_QUERY = `
|
|
12
|
-
query MovethewheelsAssistantInsights($question: String!) {
|
|
13
|
-
assistantInsights(question: $question) {
|
|
14
|
-
answer
|
|
15
|
-
generatedAt
|
|
16
|
-
question
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
interface UseAssistantResult {
|
|
22
|
-
ask: (question: string) => Promise<AssistantAnswer>;
|
|
23
|
-
isLoading: boolean;
|
|
24
|
-
error: Error | null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* useAssistant — queries the real logistics assistant (Query.assistantInsights).
|
|
29
|
-
* The backend answers from the caller's own operational data; there is no
|
|
30
|
-
* client-side canned response.
|
|
31
|
-
*/
|
|
32
|
-
export function useAssistant(): UseAssistantResult {
|
|
33
|
-
const { apiGatewayUrl, authToken, workspaceToken, workspaceId, tenantId, currentUser } =
|
|
34
|
-
useMoveTheWheels();
|
|
35
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
36
|
-
const [error, setError] = useState<Error | null>(null);
|
|
37
|
-
|
|
38
|
-
const graphQLOptions = useMemo(
|
|
39
|
-
() => ({
|
|
40
|
-
apiGatewayUrl,
|
|
41
|
-
authToken,
|
|
42
|
-
workspaceToken,
|
|
43
|
-
workspaceId,
|
|
44
|
-
tenantId,
|
|
45
|
-
actorId: currentUser?.id,
|
|
46
|
-
}),
|
|
47
|
-
[apiGatewayUrl, authToken, workspaceToken, workspaceId, tenantId, currentUser?.id]
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
const ask = useCallback(
|
|
51
|
-
async (question: string): Promise<AssistantAnswer> => {
|
|
52
|
-
setIsLoading(true);
|
|
53
|
-
setError(null);
|
|
54
|
-
try {
|
|
55
|
-
const data = await executeGraphQL<{ assistantInsights: AssistantAnswer }>(
|
|
56
|
-
graphQLOptions,
|
|
57
|
-
ASSISTANT_INSIGHTS_QUERY,
|
|
58
|
-
{ question }
|
|
59
|
-
);
|
|
60
|
-
return data.assistantInsights;
|
|
61
|
-
} catch (fetchError) {
|
|
62
|
-
const normalized =
|
|
63
|
-
fetchError instanceof Error ? fetchError : new Error('Failed to get assistant response');
|
|
64
|
-
setError(normalized);
|
|
65
|
-
throw normalized;
|
|
66
|
-
} finally {
|
|
67
|
-
setIsLoading(false);
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
[graphQLOptions]
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
return { ask, isLoading, error };
|
|
74
|
-
}
|