@devicai/ui 0.1.0

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 (70) hide show
  1. package/README.md +363 -0
  2. package/dist/cjs/api/client.js +118 -0
  3. package/dist/cjs/api/client.js.map +1 -0
  4. package/dist/cjs/components/ChatDrawer/ChatDrawer.js +122 -0
  5. package/dist/cjs/components/ChatDrawer/ChatDrawer.js.map +1 -0
  6. package/dist/cjs/components/ChatDrawer/ChatInput.js +128 -0
  7. package/dist/cjs/components/ChatDrawer/ChatInput.js.map +1 -0
  8. package/dist/cjs/components/ChatDrawer/ChatMessages.js +56 -0
  9. package/dist/cjs/components/ChatDrawer/ChatMessages.js.map +1 -0
  10. package/dist/cjs/components/ChatDrawer/ToolTimeline.js +26 -0
  11. package/dist/cjs/components/ChatDrawer/ToolTimeline.js.map +1 -0
  12. package/dist/cjs/hooks/useDevicChat.js +258 -0
  13. package/dist/cjs/hooks/useDevicChat.js.map +1 -0
  14. package/dist/cjs/hooks/useModelInterface.js +130 -0
  15. package/dist/cjs/hooks/useModelInterface.js.map +1 -0
  16. package/dist/cjs/hooks/usePolling.js +109 -0
  17. package/dist/cjs/hooks/usePolling.js.map +1 -0
  18. package/dist/cjs/index.js +36 -0
  19. package/dist/cjs/index.js.map +1 -0
  20. package/dist/cjs/provider/DevicContext.js +32 -0
  21. package/dist/cjs/provider/DevicContext.js.map +1 -0
  22. package/dist/cjs/provider/DevicProvider.js +43 -0
  23. package/dist/cjs/provider/DevicProvider.js.map +1 -0
  24. package/dist/cjs/styles.css +1 -0
  25. package/dist/cjs/utils/index.js +117 -0
  26. package/dist/cjs/utils/index.js.map +1 -0
  27. package/dist/esm/api/client.d.ts +56 -0
  28. package/dist/esm/api/client.js +115 -0
  29. package/dist/esm/api/client.js.map +1 -0
  30. package/dist/esm/api/types.d.ts +184 -0
  31. package/dist/esm/components/ChatDrawer/ChatDrawer.d.ts +27 -0
  32. package/dist/esm/components/ChatDrawer/ChatDrawer.js +120 -0
  33. package/dist/esm/components/ChatDrawer/ChatDrawer.js.map +1 -0
  34. package/dist/esm/components/ChatDrawer/ChatDrawer.types.d.ts +197 -0
  35. package/dist/esm/components/ChatDrawer/ChatInput.d.ts +5 -0
  36. package/dist/esm/components/ChatDrawer/ChatInput.js +126 -0
  37. package/dist/esm/components/ChatDrawer/ChatInput.js.map +1 -0
  38. package/dist/esm/components/ChatDrawer/ChatMessages.d.ts +5 -0
  39. package/dist/esm/components/ChatDrawer/ChatMessages.js +54 -0
  40. package/dist/esm/components/ChatDrawer/ChatMessages.js.map +1 -0
  41. package/dist/esm/components/ChatDrawer/ToolTimeline.d.ts +5 -0
  42. package/dist/esm/components/ChatDrawer/ToolTimeline.js +24 -0
  43. package/dist/esm/components/ChatDrawer/ToolTimeline.js.map +1 -0
  44. package/dist/esm/components/ChatDrawer/index.d.ts +5 -0
  45. package/dist/esm/hooks/index.d.ts +6 -0
  46. package/dist/esm/hooks/useDevicChat.d.ts +120 -0
  47. package/dist/esm/hooks/useDevicChat.js +256 -0
  48. package/dist/esm/hooks/useDevicChat.js.map +1 -0
  49. package/dist/esm/hooks/useModelInterface.d.ts +68 -0
  50. package/dist/esm/hooks/useModelInterface.js +128 -0
  51. package/dist/esm/hooks/useModelInterface.js.map +1 -0
  52. package/dist/esm/hooks/usePolling.d.ts +64 -0
  53. package/dist/esm/hooks/usePolling.js +107 -0
  54. package/dist/esm/hooks/usePolling.js.map +1 -0
  55. package/dist/esm/index.d.ts +10 -0
  56. package/dist/esm/index.js +12 -0
  57. package/dist/esm/index.js.map +1 -0
  58. package/dist/esm/provider/DevicContext.d.ts +15 -0
  59. package/dist/esm/provider/DevicContext.js +28 -0
  60. package/dist/esm/provider/DevicContext.js.map +1 -0
  61. package/dist/esm/provider/DevicProvider.d.ts +17 -0
  62. package/dist/esm/provider/DevicProvider.js +41 -0
  63. package/dist/esm/provider/DevicProvider.js.map +1 -0
  64. package/dist/esm/provider/index.d.ts +3 -0
  65. package/dist/esm/provider/types.d.ts +58 -0
  66. package/dist/esm/styles.css +1 -0
  67. package/dist/esm/utils/index.d.ts +32 -0
  68. package/dist/esm/utils/index.js +109 -0
  69. package/dist/esm/utils/index.js.map +1 -0
  70. package/package.json +68 -0
@@ -0,0 +1,107 @@
1
+ import { useState, useRef, useEffect, useCallback } from 'react';
2
+
3
+ /**
4
+ * Hook for polling real-time chat history
5
+ *
6
+ * @param chatUid - The chat UID to poll for
7
+ * @param fetchFn - Function that fetches the realtime history
8
+ * @param options - Polling options
9
+ */
10
+ function usePolling(chatUid, fetchFn, options = {}) {
11
+ const { interval = 1000, enabled = true, stopStatuses = ['completed', 'error'], onStop, onUpdate, onError, } = options;
12
+ const [data, setData] = useState(null);
13
+ const [isPolling, setIsPolling] = useState(false);
14
+ const [error, setError] = useState(null);
15
+ const intervalRef = useRef(null);
16
+ const isMountedRef = useRef(true);
17
+ // Refs for callbacks to avoid stale closures
18
+ const onStopRef = useRef(onStop);
19
+ const onUpdateRef = useRef(onUpdate);
20
+ const onErrorRef = useRef(onError);
21
+ const fetchFnRef = useRef(fetchFn);
22
+ useEffect(() => {
23
+ onStopRef.current = onStop;
24
+ onUpdateRef.current = onUpdate;
25
+ onErrorRef.current = onError;
26
+ fetchFnRef.current = fetchFn;
27
+ });
28
+ const clearPolling = useCallback(() => {
29
+ if (intervalRef.current) {
30
+ clearInterval(intervalRef.current);
31
+ intervalRef.current = null;
32
+ }
33
+ }, []);
34
+ const fetchData = useCallback(async () => {
35
+ if (!isMountedRef.current)
36
+ return;
37
+ try {
38
+ const result = await fetchFnRef.current();
39
+ if (!isMountedRef.current)
40
+ return;
41
+ setData(result);
42
+ setError(null);
43
+ onUpdateRef.current?.(result);
44
+ // Check if we should stop polling
45
+ if (stopStatuses.includes(result.status)) {
46
+ clearPolling();
47
+ setIsPolling(false);
48
+ onStopRef.current?.(result);
49
+ }
50
+ }
51
+ catch (err) {
52
+ if (!isMountedRef.current)
53
+ return;
54
+ const error = err instanceof Error ? err : new Error(String(err));
55
+ setError(error);
56
+ onErrorRef.current?.(error);
57
+ // Stop polling on error
58
+ clearPolling();
59
+ setIsPolling(false);
60
+ }
61
+ }, [stopStatuses, clearPolling]);
62
+ const start = useCallback(() => {
63
+ if (!chatUid || intervalRef.current)
64
+ return;
65
+ setIsPolling(true);
66
+ setError(null);
67
+ // Immediate first fetch
68
+ fetchData();
69
+ // Set up interval
70
+ intervalRef.current = setInterval(fetchData, interval);
71
+ }, [chatUid, interval, fetchData]);
72
+ const stop = useCallback(() => {
73
+ clearPolling();
74
+ setIsPolling(false);
75
+ }, [clearPolling]);
76
+ const refetch = useCallback(async () => {
77
+ await fetchData();
78
+ }, [fetchData]);
79
+ // Auto-start polling when enabled and chatUid is set
80
+ useEffect(() => {
81
+ if (enabled && chatUid && !isPolling) {
82
+ start();
83
+ }
84
+ return () => {
85
+ clearPolling();
86
+ };
87
+ }, [enabled, chatUid, start, isPolling, clearPolling]);
88
+ // Cleanup on unmount
89
+ useEffect(() => {
90
+ isMountedRef.current = true;
91
+ return () => {
92
+ isMountedRef.current = false;
93
+ clearPolling();
94
+ };
95
+ }, [clearPolling]);
96
+ return {
97
+ data,
98
+ isPolling,
99
+ error,
100
+ start,
101
+ stop,
102
+ refetch,
103
+ };
104
+ }
105
+
106
+ export { usePolling };
107
+ //# sourceMappingURL=usePolling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePolling.js","sources":["../../../src/hooks/usePolling.ts"],"sourcesContent":["import { useState, useEffect, useRef, useCallback } from 'react';\nimport type { RealtimeChatHistory, RealtimeStatus } from '../api/types';\n\nexport interface UsePollingOptions {\n /**\n * Polling interval in milliseconds\n * @default 1000\n */\n interval?: number;\n\n /**\n * Whether polling is enabled\n * @default true\n */\n enabled?: boolean;\n\n /**\n * Statuses that should stop polling\n * @default ['completed', 'error']\n */\n stopStatuses?: RealtimeStatus[];\n\n /**\n * Callback when polling stops\n */\n onStop?: (data: RealtimeChatHistory | null) => void;\n\n /**\n * Callback on each poll update\n */\n onUpdate?: (data: RealtimeChatHistory) => void;\n\n /**\n * Callback on poll error\n */\n onError?: (error: Error) => void;\n}\n\nexport interface UsePollingResult {\n /**\n * Current polling data\n */\n data: RealtimeChatHistory | null;\n\n /**\n * Whether polling is currently active\n */\n isPolling: boolean;\n\n /**\n * Last error that occurred\n */\n error: Error | null;\n\n /**\n * Start polling\n */\n start: () => void;\n\n /**\n * Stop polling\n */\n stop: () => void;\n\n /**\n * Manually trigger a fetch\n */\n refetch: () => Promise<void>;\n}\n\n/**\n * Hook for polling real-time chat history\n *\n * @param chatUid - The chat UID to poll for\n * @param fetchFn - Function that fetches the realtime history\n * @param options - Polling options\n */\nexport function usePolling(\n chatUid: string | null,\n fetchFn: () => Promise<RealtimeChatHistory>,\n options: UsePollingOptions = {}\n): UsePollingResult {\n const {\n interval = 1000,\n enabled = true,\n stopStatuses = ['completed', 'error'],\n onStop,\n onUpdate,\n onError,\n } = options;\n\n const [data, setData] = useState<RealtimeChatHistory | null>(null);\n const [isPolling, setIsPolling] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);\n const isMountedRef = useRef(true);\n\n // Refs for callbacks to avoid stale closures\n const onStopRef = useRef(onStop);\n const onUpdateRef = useRef(onUpdate);\n const onErrorRef = useRef(onError);\n const fetchFnRef = useRef(fetchFn);\n\n useEffect(() => {\n onStopRef.current = onStop;\n onUpdateRef.current = onUpdate;\n onErrorRef.current = onError;\n fetchFnRef.current = fetchFn;\n });\n\n const clearPolling = useCallback(() => {\n if (intervalRef.current) {\n clearInterval(intervalRef.current);\n intervalRef.current = null;\n }\n }, []);\n\n const fetchData = useCallback(async () => {\n if (!isMountedRef.current) return;\n\n try {\n const result = await fetchFnRef.current();\n\n if (!isMountedRef.current) return;\n\n setData(result);\n setError(null);\n onUpdateRef.current?.(result);\n\n // Check if we should stop polling\n if (stopStatuses.includes(result.status)) {\n clearPolling();\n setIsPolling(false);\n onStopRef.current?.(result);\n }\n } catch (err) {\n if (!isMountedRef.current) return;\n\n const error = err instanceof Error ? err : new Error(String(err));\n setError(error);\n onErrorRef.current?.(error);\n\n // Stop polling on error\n clearPolling();\n setIsPolling(false);\n }\n }, [stopStatuses, clearPolling]);\n\n const start = useCallback(() => {\n if (!chatUid || intervalRef.current) return;\n\n setIsPolling(true);\n setError(null);\n\n // Immediate first fetch\n fetchData();\n\n // Set up interval\n intervalRef.current = setInterval(fetchData, interval);\n }, [chatUid, interval, fetchData]);\n\n const stop = useCallback(() => {\n clearPolling();\n setIsPolling(false);\n }, [clearPolling]);\n\n const refetch = useCallback(async () => {\n await fetchData();\n }, [fetchData]);\n\n // Auto-start polling when enabled and chatUid is set\n useEffect(() => {\n if (enabled && chatUid && !isPolling) {\n start();\n }\n\n return () => {\n clearPolling();\n };\n }, [enabled, chatUid, start, isPolling, clearPolling]);\n\n // Cleanup on unmount\n useEffect(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n clearPolling();\n };\n }, [clearPolling]);\n\n return {\n data,\n isPolling,\n error,\n start,\n stop,\n refetch,\n };\n}\n"],"names":[],"mappings":";;AAsEA;;;;;;AAMG;AACG,SAAU,UAAU,CACxB,OAAsB,EACtB,OAA2C,EAC3C,UAA6B,EAAE,EAAA;IAE/B,MAAM,EACJ,QAAQ,GAAG,IAAI,EACf,OAAO,GAAG,IAAI,EACd,YAAY,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,EACrC,MAAM,EACN,QAAQ,EACR,OAAO,GACR,GAAG,OAAO;IAEX,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAA6B,IAAI,CAAC;IAClE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;IACjD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC;AAEtD,IAAA,MAAM,WAAW,GAAG,MAAM,CAAwC,IAA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AAY,CAAC,CAAC;;IAGtD,SAAS,CAAC,MAAK;AACb,QAAA,YAAY,CAAC,OAAO,GAAG,IAAI;AAC3B,QAAA,OAAO,MAAK;AACV,YAAA,YAAY,CAAC,OAAO,GAAG,KAAK;AAC5B,YAAA,YAAY,EAAE;AAChB,QAAA,CAAC;AACH,IAAA,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;IAElB,OAAO;QACL,IAAI;QACJ,SAAS;QACT,KAAK;QACL,KAAK;QACL,IAAI;QACJ,OAAO;KACR;AACH;;;;"}
@@ -0,0 +1,10 @@
1
+ export { DevicProvider, DevicContext, useDevicContext, useOptionalDevicContext } from './provider';
2
+ export type { DevicProviderConfig, DevicProviderProps, DevicContextValue } from './provider';
3
+ export { ChatDrawer, ChatMessages, ChatInput, ToolTimeline } from './components/ChatDrawer';
4
+ export type { ChatDrawerProps, ChatDrawerOptions, ChatMessagesProps, ChatInputProps, ToolTimelineProps, AllowedFileTypes, } from './components/ChatDrawer';
5
+ export { useDevicChat, usePolling, useModelInterface } from './hooks';
6
+ export type { UseDevicChatOptions, UseDevicChatResult, UsePollingOptions, UsePollingResult, UseModelInterfaceOptions, UseModelInterfaceResult, } from './hooks';
7
+ export { DevicApiClient, DevicApiError } from './api/client';
8
+ export type { DevicApiClientConfig } from './api/client';
9
+ export type { ChatMessage, ChatFile, MessageContent, ToolCall, ToolCallResponse, ProcessMessageDto, AssistantResponse, AsyncResponse, RealtimeChatHistory, RealtimeStatus, ChatHistory, AssistantSpecialization, ModelInterfaceTool, ModelInterfaceToolSchema, PreviousMessage, ApiError, } from './api/types';
10
+ export { generateId, deepMerge, debounce, throttle, formatFileSize, storage } from './utils';
@@ -0,0 +1,12 @@
1
+ export { DevicProvider } from './provider/DevicProvider.js';
2
+ export { DevicContext, useDevicContext, useOptionalDevicContext } from './provider/DevicContext.js';
3
+ export { ChatDrawer } from './components/ChatDrawer/ChatDrawer.js';
4
+ export { ChatMessages } from './components/ChatDrawer/ChatMessages.js';
5
+ export { ChatInput } from './components/ChatDrawer/ChatInput.js';
6
+ export { ToolTimeline } from './components/ChatDrawer/ToolTimeline.js';
7
+ export { useDevicChat } from './hooks/useDevicChat.js';
8
+ export { usePolling } from './hooks/usePolling.js';
9
+ export { useModelInterface } from './hooks/useModelInterface.js';
10
+ export { DevicApiClient, DevicApiError } from './api/client.js';
11
+ export { debounce, deepMerge, formatFileSize, generateId, storage, throttle } from './utils/index.js';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
@@ -0,0 +1,15 @@
1
+ import type { DevicContextValue } from './types';
2
+ /**
3
+ * Context for Devic configuration
4
+ */
5
+ export declare const DevicContext: import("react").Context<DevicContextValue | null>;
6
+ /**
7
+ * Hook to access the Devic context
8
+ * @throws Error if used outside of DevicProvider
9
+ */
10
+ export declare function useDevicContext(): DevicContextValue;
11
+ /**
12
+ * Hook to optionally access the Devic context
13
+ * Returns null if not within a provider (for components that can work standalone)
14
+ */
15
+ export declare function useOptionalDevicContext(): DevicContextValue | null;
@@ -0,0 +1,28 @@
1
+ import { createContext, useContext } from 'react';
2
+
3
+ /**
4
+ * Context for Devic configuration
5
+ */
6
+ const DevicContext = createContext(null);
7
+ /**
8
+ * Hook to access the Devic context
9
+ * @throws Error if used outside of DevicProvider
10
+ */
11
+ function useDevicContext() {
12
+ const context = useContext(DevicContext);
13
+ if (!context) {
14
+ throw new Error('useDevicContext must be used within a DevicProvider. ' +
15
+ 'Make sure to wrap your component tree with <DevicProvider>.');
16
+ }
17
+ return context;
18
+ }
19
+ /**
20
+ * Hook to optionally access the Devic context
21
+ * Returns null if not within a provider (for components that can work standalone)
22
+ */
23
+ function useOptionalDevicContext() {
24
+ return useContext(DevicContext);
25
+ }
26
+
27
+ export { DevicContext, useDevicContext, useOptionalDevicContext };
28
+ //# sourceMappingURL=DevicContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DevicContext.js","sources":["../../../src/provider/DevicContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport type { DevicContextValue } from './types';\n\n/**\n * Context for Devic configuration\n */\nexport const DevicContext = createContext<DevicContextValue | null>(null);\n\n/**\n * Hook to access the Devic context\n * @throws Error if used outside of DevicProvider\n */\nexport function useDevicContext(): DevicContextValue {\n const context = useContext(DevicContext);\n if (!context) {\n throw new Error(\n 'useDevicContext must be used within a DevicProvider. ' +\n 'Make sure to wrap your component tree with <DevicProvider>.'\n );\n }\n return context;\n}\n\n/**\n * Hook to optionally access the Devic context\n * Returns null if not within a provider (for components that can work standalone)\n */\nexport function useOptionalDevicContext(): DevicContextValue | null {\n return useContext(DevicContext);\n}\n"],"names":[],"mappings":";;AAGA;;AAEG;MACU,YAAY,GAAG,aAAa,CAA2B,IAAI;AAExE;;;AAGG;SACa,eAAe,GAAA;AAC7B,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC;IACxC,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,uDAAuD;AACvD,YAAA,6DAA6D,CAC9D;IACH;AACA,IAAA,OAAO,OAAO;AAChB;AAEA;;;AAGG;SACa,uBAAuB,GAAA;AACrC,IAAA,OAAO,UAAU,CAAC,YAAY,CAAC;AACjC;;;;"}
@@ -0,0 +1,17 @@
1
+ import type { DevicProviderProps } from './types';
2
+ /**
3
+ * Provider component for Devic UI configuration
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <DevicProvider
8
+ * apiKey="devic-xxx"
9
+ * baseUrl="https://api.devic.ai"
10
+ * tenantId="tenant-123"
11
+ * tenantMetadata={{ userId: '456' }}
12
+ * >
13
+ * <App />
14
+ * </DevicProvider>
15
+ * ```
16
+ */
17
+ export declare function DevicProvider({ apiKey, baseUrl, tenantId, tenantMetadata, children, }: DevicProviderProps): JSX.Element;
@@ -0,0 +1,41 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useMemo } from 'react';
3
+ import { DevicContext } from './DevicContext.js';
4
+ import { DevicApiClient } from '../api/client.js';
5
+
6
+ const DEFAULT_BASE_URL = 'https://api.devic.ai';
7
+ /**
8
+ * Provider component for Devic UI configuration
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * <DevicProvider
13
+ * apiKey="devic-xxx"
14
+ * baseUrl="https://api.devic.ai"
15
+ * tenantId="tenant-123"
16
+ * tenantMetadata={{ userId: '456' }}
17
+ * >
18
+ * <App />
19
+ * </DevicProvider>
20
+ * ```
21
+ */
22
+ function DevicProvider({ apiKey, baseUrl = DEFAULT_BASE_URL, tenantId, tenantMetadata, children, }) {
23
+ const contextValue = useMemo(() => {
24
+ const client = new DevicApiClient({
25
+ apiKey,
26
+ baseUrl,
27
+ });
28
+ return {
29
+ client,
30
+ apiKey,
31
+ baseUrl,
32
+ tenantId,
33
+ tenantMetadata,
34
+ isConfigured: !!apiKey,
35
+ };
36
+ }, [apiKey, baseUrl, tenantId, tenantMetadata]);
37
+ return (jsx(DevicContext.Provider, { value: contextValue, children: children }));
38
+ }
39
+
40
+ export { DevicProvider };
41
+ //# sourceMappingURL=DevicProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DevicProvider.js","sources":["../../../src/provider/DevicProvider.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { DevicContext } from './DevicContext';\nimport { DevicApiClient } from '../api/client';\nimport type { DevicProviderProps, DevicContextValue } from './types';\n\nconst DEFAULT_BASE_URL = 'https://api.devic.ai';\n\n/**\n * Provider component for Devic UI configuration\n *\n * @example\n * ```tsx\n * <DevicProvider\n * apiKey=\"devic-xxx\"\n * baseUrl=\"https://api.devic.ai\"\n * tenantId=\"tenant-123\"\n * tenantMetadata={{ userId: '456' }}\n * >\n * <App />\n * </DevicProvider>\n * ```\n */\nexport function DevicProvider({\n apiKey,\n baseUrl = DEFAULT_BASE_URL,\n tenantId,\n tenantMetadata,\n children,\n}: DevicProviderProps): JSX.Element {\n const contextValue = useMemo<DevicContextValue>(() => {\n const client = new DevicApiClient({\n apiKey,\n baseUrl,\n });\n\n return {\n client,\n apiKey,\n baseUrl,\n tenantId,\n tenantMetadata,\n isConfigured: !!apiKey,\n };\n }, [apiKey, baseUrl, tenantId, tenantMetadata]);\n\n return (\n <DevicContext.Provider value={contextValue}>\n {children}\n </DevicContext.Provider>\n );\n}\n"],"names":["_jsx"],"mappings":";;;;;AAKA,MAAM,gBAAgB,GAAG,sBAAsB;AAE/C;;;;;;;;;;;;;;AAcG;AACG,SAAU,aAAa,CAAC,EAC5B,MAAM,EACN,OAAO,GAAG,gBAAgB,EAC1B,QAAQ,EACR,cAAc,EACd,QAAQ,GACW,EAAA;AACnB,IAAA,MAAM,YAAY,GAAG,OAAO,CAAoB,MAAK;AACnD,QAAA,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC;YAChC,MAAM;YACN,OAAO;AACR,SAAA,CAAC;QAEF,OAAO;YACL,MAAM;YACN,MAAM;YACN,OAAO;YACP,QAAQ;YACR,cAAc;YACd,YAAY,EAAE,CAAC,CAAC,MAAM;SACvB;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AAE/C,IAAA,QACEA,GAAA,CAAC,YAAY,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,YAAY,EAAA,QAAA,EACvC,QAAQ,EAAA,CACa;AAE5B;;;;"}
@@ -0,0 +1,3 @@
1
+ export { DevicProvider } from './DevicProvider';
2
+ export { DevicContext, useDevicContext, useOptionalDevicContext } from './DevicContext';
3
+ export type { DevicProviderConfig, DevicProviderProps, DevicContextValue, } from './types';
@@ -0,0 +1,58 @@
1
+ import type { DevicApiClient } from '../api/client';
2
+ /**
3
+ * Configuration for the DevicProvider
4
+ */
5
+ export interface DevicProviderConfig {
6
+ /**
7
+ * API key for authentication
8
+ */
9
+ apiKey: string;
10
+ /**
11
+ * Base URL for the Devic API
12
+ * @default 'https://api.devic.ai'
13
+ */
14
+ baseUrl?: string;
15
+ /**
16
+ * Global tenant ID for multi-tenant environments
17
+ */
18
+ tenantId?: string;
19
+ /**
20
+ * Global tenant metadata
21
+ */
22
+ tenantMetadata?: Record<string, any>;
23
+ }
24
+ /**
25
+ * Context value provided by DevicProvider
26
+ */
27
+ export interface DevicContextValue {
28
+ /**
29
+ * API client instance
30
+ */
31
+ client: DevicApiClient;
32
+ /**
33
+ * Current API key
34
+ */
35
+ apiKey: string;
36
+ /**
37
+ * Base URL for the API
38
+ */
39
+ baseUrl: string;
40
+ /**
41
+ * Global tenant ID
42
+ */
43
+ tenantId?: string;
44
+ /**
45
+ * Global tenant metadata
46
+ */
47
+ tenantMetadata?: Record<string, any>;
48
+ /**
49
+ * Whether the provider is properly configured
50
+ */
51
+ isConfigured: boolean;
52
+ }
53
+ /**
54
+ * Props for the DevicProvider component
55
+ */
56
+ export interface DevicProviderProps extends DevicProviderConfig {
57
+ children: React.ReactNode;
58
+ }
@@ -0,0 +1 @@
1
+ .devic-chat-drawer{--devic-primary:#1890ff;--devic-primary-hover:#40a9ff;--devic-primary-light:#e6f7ff;--devic-bg:#fff;--devic-bg-secondary:#f5f5f5;--devic-text:#333;--devic-text-secondary:#666;--devic-text-muted:#999;--devic-border:#e8e8e8;--devic-shadow:0 4px 12px rgba(0,0,0,.15);--devic-radius:8px;--devic-radius-sm:4px;--devic-radius-lg:16px;--devic-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;--devic-transition:0.3s ease;background:var(--devic-bg);bottom:0;box-shadow:var(--devic-shadow);color:var(--devic-text);display:flex;flex-direction:column;font-family:var(--devic-font-family);font-size:14px;line-height:1.5;position:fixed;top:0;transition:transform var(--devic-transition);width:400px}.devic-chat-drawer[data-position=right]{right:0;transform:translateX(100%)}.devic-chat-drawer[data-position=left]{left:0;transform:translateX(-100%)}.devic-chat-drawer[data-open=true]{transform:translateX(0)}.devic-drawer-overlay{background:rgba(0,0,0,.3);inset:0;opacity:0;position:fixed;transition:opacity var(--devic-transition),visibility var(--devic-transition);visibility:hidden}.devic-drawer-overlay[data-open=true]{opacity:1;visibility:visible}.devic-drawer-header{align-items:center;border-bottom:1px solid var(--devic-border);display:flex;flex-shrink:0;justify-content:space-between;padding:16px}.devic-drawer-title{font-size:16px;font-weight:600;margin:0}.devic-drawer-close{background:none;border:none;border-radius:var(--devic-radius-sm);color:var(--devic-text-secondary);cursor:pointer;padding:8px;transition:background var(--devic-transition),color var(--devic-transition)}.devic-drawer-close:hover{background:var(--devic-bg-secondary);color:var(--devic-text)}.devic-messages-container{display:flex;flex:1;flex-direction:column;gap:12px;overflow-y:auto;padding:16px}.devic-welcome{color:var(--devic-text-secondary);padding:24px 16px;text-align:center}.devic-welcome-text{font-size:16px;margin-bottom:16px}.devic-suggested-messages{display:flex;flex-wrap:wrap;gap:8px;justify-content:center}.devic-suggested-btn{background:var(--devic-bg);border:1px solid var(--devic-border);border-radius:var(--devic-radius-lg);color:var(--devic-text);cursor:pointer;font-size:13px;padding:8px 16px;transition:border-color var(--devic-transition),background var(--devic-transition)}.devic-suggested-btn:hover{background:var(--devic-primary-light);border-color:var(--devic-primary)}.devic-message{display:flex;flex-direction:column;max-width:85%}.devic-message[data-role=user]{align-self:flex-end}.devic-message[data-role=assistant],.devic-message[data-role=tool]{align-self:flex-start}.devic-message-bubble{word-wrap:break-word;border-radius:var(--devic-radius);padding:10px 14px}.devic-message[data-role=user] .devic-message-bubble{background:var(--devic-primary);border-bottom-right-radius:var(--devic-radius-sm);color:#fff}.devic-message[data-role=assistant] .devic-message-bubble{background:var(--devic-bg-secondary);border-bottom-left-radius:var(--devic-radius-sm);color:var(--devic-text)}.devic-message[data-role=tool] .devic-message-bubble{background:var(--devic-primary-light);border:1px solid var(--devic-primary);color:var(--devic-text);font-size:12px}.devic-message-time{color:var(--devic-text-muted);font-size:11px;margin-top:4px}.devic-message[data-role=user] .devic-message-time{text-align:right}.devic-message-files{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}.devic-message-file{align-items:center;background:hsla(0,0%,100%,.2);border-radius:var(--devic-radius-sm);display:flex;font-size:12px;gap:6px;padding:6px 10px}.devic-loading{align-self:flex-start;display:flex;gap:4px;padding:10px 14px}.devic-loading-dot{animation:devic-bounce 1.4s ease-in-out infinite both;background:var(--devic-text-muted);border-radius:50%;height:8px;width:8px}.devic-loading-dot:first-child{animation-delay:-.32s}.devic-loading-dot:nth-child(2){animation-delay:-.16s}@keyframes devic-bounce{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.devic-tool-timeline{background:var(--devic-bg-secondary);border-radius:var(--devic-radius);font-size:12px;margin:8px 0;padding:8px 12px}.devic-tool-item{align-items:center;display:flex;gap:8px;padding:6px 0}.devic-tool-item+.devic-tool-item{border-top:1px solid var(--devic-border)}.devic-tool-status{border-radius:50%;flex-shrink:0;height:8px;width:8px}.devic-tool-status[data-status=pending]{background:var(--devic-text-muted)}.devic-tool-status[data-status=executing]{animation:devic-pulse 1s infinite;background:var(--devic-primary)}.devic-tool-status[data-status=completed]{background:#52c41a}.devic-tool-status[data-status=error]{background:#ff4d4f}@keyframes devic-pulse{0%,to{opacity:1}50%{opacity:.5}}.devic-tool-name{color:var(--devic-text);font-weight:500}.devic-input-area{border-top:1px solid var(--devic-border);flex-shrink:0;padding:16px}.devic-input-wrapper{align-items:flex-end;background:var(--devic-bg-secondary);border-radius:var(--devic-radius);display:flex;gap:8px;padding:8px 12px}.devic-input{background:none;border:none;color:var(--devic-text);flex:1;font-family:inherit;font-size:14px;line-height:1.5;max-height:120px;min-height:24px;outline:none;resize:none}.devic-input::placeholder{color:var(--devic-text-muted)}.devic-input-btn{background:none;border:none;border-radius:var(--devic-radius-sm);color:var(--devic-text-secondary);cursor:pointer;flex-shrink:0;padding:4px;transition:color var(--devic-transition)}.devic-input-btn:hover:not(:disabled){color:var(--devic-primary)}.devic-input-btn:disabled{cursor:not-allowed;opacity:.5}.devic-send-btn{background:var(--devic-primary);border-radius:var(--devic-radius-sm);color:#fff;padding:6px 12px}.devic-send-btn:hover:not(:disabled){background:var(--devic-primary-hover);color:#fff}.devic-file-preview{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:8px}.devic-file-preview-item{align-items:center;background:var(--devic-bg);border:1px solid var(--devic-border);border-radius:var(--devic-radius-sm);display:flex;font-size:12px;gap:6px;padding:4px 8px}.devic-file-remove{background:none;border:none;color:var(--devic-text-muted);cursor:pointer;font-size:16px;line-height:1;padding:0}.devic-file-remove:hover{color:#ff4d4f}.devic-trigger{align-items:center;background:var(--devic-primary);border:none;border-radius:50%;box-shadow:var(--devic-shadow);color:#fff;cursor:pointer;display:flex;height:56px;justify-content:center;position:fixed;transition:background var(--devic-transition),transform var(--devic-transition);width:56px}.devic-trigger:hover{background:var(--devic-primary-hover);transform:scale(1.05)}.devic-trigger svg{height:24px;width:24px}.devic-error{background:#fff2f0;border:1px solid #ffccc7;border-radius:var(--devic-radius);color:#ff4d4f;font-size:13px;margin:8px 16px;padding:12px}.devic-messages-container::-webkit-scrollbar{width:6px}.devic-messages-container::-webkit-scrollbar-track{background:transparent}.devic-messages-container::-webkit-scrollbar-thumb{background:var(--devic-border);border-radius:3px}.devic-messages-container::-webkit-scrollbar-thumb:hover{background:var(--devic-text-muted)}@media (max-width:480px){.devic-chat-drawer{width:100%}}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Generate a unique ID
3
+ */
4
+ export declare function generateId(): string;
5
+ /**
6
+ * Deep merge two objects
7
+ */
8
+ export declare function deepMerge<T extends Record<string, any>>(target: T, source: Partial<T>): T;
9
+ /**
10
+ * Debounce a function
11
+ */
12
+ export declare function debounce<T extends (...args: any[]) => any>(fn: T, delay: number): (...args: Parameters<T>) => void;
13
+ /**
14
+ * Throttle a function
15
+ */
16
+ export declare function throttle<T extends (...args: any[]) => any>(fn: T, delay: number): (...args: Parameters<T>) => void;
17
+ /**
18
+ * Format file size for display
19
+ */
20
+ export declare function formatFileSize(bytes: number): string;
21
+ /**
22
+ * Check if running in browser
23
+ */
24
+ export declare function isBrowser(): boolean;
25
+ /**
26
+ * Local storage helper with JSON serialization
27
+ */
28
+ export declare const storage: {
29
+ get<T>(key: string, defaultValue?: T): T | null;
30
+ set<T>(key: string, value: T): void;
31
+ remove(key: string): void;
32
+ };
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Generate a unique ID
3
+ */
4
+ function generateId() {
5
+ return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
6
+ }
7
+ /**
8
+ * Deep merge two objects
9
+ */
10
+ function deepMerge(target, source) {
11
+ const result = { ...target };
12
+ for (const key in source) {
13
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
14
+ const sourceValue = source[key];
15
+ const targetValue = result[key];
16
+ if (sourceValue &&
17
+ typeof sourceValue === 'object' &&
18
+ !Array.isArray(sourceValue) &&
19
+ targetValue &&
20
+ typeof targetValue === 'object' &&
21
+ !Array.isArray(targetValue)) {
22
+ result[key] = deepMerge(targetValue, sourceValue);
23
+ }
24
+ else if (sourceValue !== undefined) {
25
+ result[key] = sourceValue;
26
+ }
27
+ }
28
+ }
29
+ return result;
30
+ }
31
+ /**
32
+ * Debounce a function
33
+ */
34
+ function debounce(fn, delay) {
35
+ let timeoutId;
36
+ return (...args) => {
37
+ clearTimeout(timeoutId);
38
+ timeoutId = setTimeout(() => fn(...args), delay);
39
+ };
40
+ }
41
+ /**
42
+ * Throttle a function
43
+ */
44
+ function throttle(fn, delay) {
45
+ let lastCall = 0;
46
+ return (...args) => {
47
+ const now = Date.now();
48
+ if (now - lastCall >= delay) {
49
+ lastCall = now;
50
+ fn(...args);
51
+ }
52
+ };
53
+ }
54
+ /**
55
+ * Format file size for display
56
+ */
57
+ function formatFileSize(bytes) {
58
+ if (bytes === 0)
59
+ return '0 B';
60
+ const units = ['B', 'KB', 'MB', 'GB'];
61
+ const k = 1024;
62
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
63
+ return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${units[i]}`;
64
+ }
65
+ /**
66
+ * Check if running in browser
67
+ */
68
+ function isBrowser() {
69
+ return typeof window !== 'undefined';
70
+ }
71
+ /**
72
+ * Local storage helper with JSON serialization
73
+ */
74
+ const storage = {
75
+ get(key, defaultValue) {
76
+ if (!isBrowser())
77
+ return defaultValue ?? null;
78
+ try {
79
+ const item = localStorage.getItem(key);
80
+ return item ? JSON.parse(item) : (defaultValue ?? null);
81
+ }
82
+ catch {
83
+ return defaultValue ?? null;
84
+ }
85
+ },
86
+ set(key, value) {
87
+ if (!isBrowser())
88
+ return;
89
+ try {
90
+ localStorage.setItem(key, JSON.stringify(value));
91
+ }
92
+ catch {
93
+ // Storage full or other error
94
+ }
95
+ },
96
+ remove(key) {
97
+ if (!isBrowser())
98
+ return;
99
+ try {
100
+ localStorage.removeItem(key);
101
+ }
102
+ catch {
103
+ // Error removing item
104
+ }
105
+ },
106
+ };
107
+
108
+ export { debounce, deepMerge, formatFileSize, generateId, isBrowser, storage, throttle };
109
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/utils/index.ts"],"sourcesContent":["/**\n * Generate a unique ID\n */\nexport function generateId(): string {\n return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;\n}\n\n/**\n * Deep merge two objects\n */\nexport function deepMerge<T extends Record<string, any>>(\n target: T,\n source: Partial<T>\n): T {\n const result = { ...target };\n\n for (const key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n const sourceValue = source[key];\n const targetValue = result[key];\n\n if (\n sourceValue &&\n typeof sourceValue === 'object' &&\n !Array.isArray(sourceValue) &&\n targetValue &&\n typeof targetValue === 'object' &&\n !Array.isArray(targetValue)\n ) {\n result[key] = deepMerge(targetValue, sourceValue as any);\n } else if (sourceValue !== undefined) {\n result[key] = sourceValue as any;\n }\n }\n }\n\n return result;\n}\n\n/**\n * Debounce a function\n */\nexport function debounce<T extends (...args: any[]) => any>(\n fn: T,\n delay: number\n): (...args: Parameters<T>) => void {\n let timeoutId: ReturnType<typeof setTimeout>;\n\n return (...args: Parameters<T>) => {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => fn(...args), delay);\n };\n}\n\n/**\n * Throttle a function\n */\nexport function throttle<T extends (...args: any[]) => any>(\n fn: T,\n delay: number\n): (...args: Parameters<T>) => void {\n let lastCall = 0;\n\n return (...args: Parameters<T>) => {\n const now = Date.now();\n if (now - lastCall >= delay) {\n lastCall = now;\n fn(...args);\n }\n };\n}\n\n/**\n * Format file size for display\n */\nexport function formatFileSize(bytes: number): string {\n if (bytes === 0) return '0 B';\n\n const units = ['B', 'KB', 'MB', 'GB'];\n const k = 1024;\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n\n return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${units[i]}`;\n}\n\n/**\n * Check if running in browser\n */\nexport function isBrowser(): boolean {\n return typeof window !== 'undefined';\n}\n\n/**\n * Local storage helper with JSON serialization\n */\nexport const storage = {\n get<T>(key: string, defaultValue?: T): T | null {\n if (!isBrowser()) return defaultValue ?? null;\n\n try {\n const item = localStorage.getItem(key);\n return item ? JSON.parse(item) : (defaultValue ?? null);\n } catch {\n return defaultValue ?? null;\n }\n },\n\n set<T>(key: string, value: T): void {\n if (!isBrowser()) return;\n\n try {\n localStorage.setItem(key, JSON.stringify(value));\n } catch {\n // Storage full or other error\n }\n },\n\n remove(key: string): void {\n if (!isBrowser()) return;\n\n try {\n localStorage.removeItem(key);\n } catch {\n // Error removing item\n }\n },\n};\n"],"names":[],"mappings":"AAAA;;AAEG;SACa,UAAU,GAAA;IACxB,OAAO,CAAA,EAAG,IAAI,CAAC,GAAG,EAAE,CAAA,CAAA,EAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,CAAE;AACtE;AAEA;;AAEG;AACG,SAAU,SAAS,CACvB,MAAS,EACT,MAAkB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AA,IAAI;AACF,YAAA,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAClD;AAAE,QAAA,MAAM;;QAER;IACF,CAAC;AAED,IAAA,MAAM,CAAC,GAAW,EAAA;QAChB,IAAI,CAAC,SAAS,EAAE;YAAE;AAElB,QAAA,IAAI;AACF,YAAA,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC;QAC9B;AAAE,QAAA,MAAM;;QAER;IACF,CAAC;;;;;"}
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@devicai/ui",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "React component library for Devic AI assistants",
6
+ "engines": {
7
+ "node": ">=20.0.0"
8
+ },
9
+ "main": "dist/cjs/index.js",
10
+ "module": "dist/esm/index.js",
11
+ "types": "dist/esm/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/esm/index.js",
15
+ "require": "./dist/cjs/index.js",
16
+ "types": "./dist/esm/index.d.ts"
17
+ },
18
+ "./styles.css": "./dist/esm/styles.css"
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "scripts": {
24
+ "build": "rollup -c",
25
+ "dev": "rollup -c -w",
26
+ "clean": "rm -rf dist",
27
+ "prepublishOnly": "npm run clean && npm run build",
28
+ "typecheck": "tsc --noEmit"
29
+ },
30
+ "peerDependencies": {
31
+ "react": ">=17.0.0",
32
+ "react-dom": ">=17.0.0"
33
+ },
34
+ "devDependencies": {
35
+ "@rollup/plugin-commonjs": "^25.0.0",
36
+ "@rollup/plugin-node-resolve": "^15.0.0",
37
+ "@rollup/plugin-typescript": "^11.0.0",
38
+ "@types/react": "^18.0.0",
39
+ "@types/react-dom": "^18.0.0",
40
+ "react": "^18.0.0",
41
+ "react-dom": "^18.0.0",
42
+ "rollup": "^4.0.0",
43
+ "rollup-plugin-postcss": "^4.0.0",
44
+ "tslib": "^2.6.0",
45
+ "typescript": "^5.0.0"
46
+ },
47
+ "keywords": [
48
+ "react",
49
+ "devic",
50
+ "ai",
51
+ "chat",
52
+ "assistant",
53
+ "components"
54
+ ],
55
+ "author": "Devic <hello@devic.ai>",
56
+ "license": "MIT",
57
+ "repository": {
58
+ "type": "git",
59
+ "url": "git+https://github.com/devicai/devicui.git"
60
+ },
61
+ "homepage": "https://github.com/devicai/devicui#readme",
62
+ "bugs": {
63
+ "url": "https://github.com/devicai/devicui/issues"
64
+ },
65
+ "sideEffects": [
66
+ "**/*.css"
67
+ ]
68
+ }