@messenger-box/tailwind-ui-inbox 10.0.3-alpha.144 → 10.0.3-alpha.158

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 (66) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/lib/components/AIAgent/AIAgent.d.ts.map +1 -1
  3. package/lib/components/AIAgent/AIAgent.js +1 -55
  4. package/lib/components/AIAgent/AIAgent.js.map +1 -1
  5. package/lib/components/InboxMessage/message-widgets/ErrorFixCard.d.ts +1 -2
  6. package/lib/components/InboxMessage/message-widgets/ErrorFixCard.d.ts.map +1 -1
  7. package/lib/components/InboxMessage/message-widgets/ErrorFixCard.js.map +1 -1
  8. package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.d.ts +2 -2
  9. package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.d.ts.map +1 -1
  10. package/lib/components/ModelConfigPanel.d.ts +11 -0
  11. package/lib/components/ModelConfigPanel.d.ts.map +1 -1
  12. package/lib/components/ModelConfigPanel.js +29 -2
  13. package/lib/components/ModelConfigPanel.js.map +1 -1
  14. package/lib/components/filler-components/RightSiderBar.d.ts +1 -28
  15. package/lib/components/filler-components/RightSiderBar.d.ts.map +1 -1
  16. package/lib/components/filler-components/RightSiderBar.js +531 -458
  17. package/lib/components/filler-components/RightSiderBar.js.map +1 -1
  18. package/lib/container/Inbox.js +1 -1
  19. package/lib/container/Inbox.js.map +1 -1
  20. package/lib/container/ServiceInbox.js +1 -1
  21. package/lib/container/ServiceInbox.js.map +1 -1
  22. package/lib/container/TestInboxWithAiLoader.d.ts.map +1 -1
  23. package/lib/container/TestInboxWithAiLoader.js +1 -11
  24. package/lib/container/TestInboxWithAiLoader.js.map +1 -1
  25. package/lib/container/ThreadMessages.js +1 -1
  26. package/lib/container/ThreadMessages.js.map +1 -1
  27. package/lib/container/ThreadMessagesInbox.js +1 -1
  28. package/lib/container/ThreadMessagesInbox.js.map +1 -1
  29. package/lib/container/Threads.js +1 -1
  30. package/lib/container/Threads.js.map +1 -1
  31. package/lib/hooks/index.d.ts +0 -1
  32. package/lib/hooks/index.d.ts.map +1 -1
  33. package/lib/hooks/usePersistentModelConfig.d.ts +1 -0
  34. package/lib/hooks/usePersistentModelConfig.d.ts.map +1 -1
  35. package/lib/hooks/usePersistentModelConfig.js +1 -0
  36. package/lib/hooks/usePersistentModelConfig.js.map +1 -1
  37. package/lib/index.js +1 -1
  38. package/lib/module.js +1 -1
  39. package/lib/module.js.map +1 -1
  40. package/lib/templates/InboxWithAi.d.ts.map +1 -1
  41. package/lib/templates/InboxWithAi.js +2 -15
  42. package/lib/templates/InboxWithAi.js.map +1 -1
  43. package/lib/templates/InboxWithAi.tsx +2 -24
  44. package/package.json +4 -4
  45. package/src/components/AIAgent/AIAgent.tsx +3 -54
  46. package/src/components/InboxMessage/message-widgets/ErrorFixCard.tsx +1 -2
  47. package/src/components/InboxMessage/message-widgets/ModernMessageGroup.tsx +2 -2
  48. package/src/components/ModelConfigPanel.tsx +59 -0
  49. package/src/components/filler-components/RightSiderBar.tsx +570 -566
  50. package/src/container/TestInboxWithAiLoader.tsx +0 -8
  51. package/src/hooks/index.ts +0 -1
  52. package/src/hooks/usePersistentModelConfig.ts +2 -0
  53. package/src/templates/InboxWithAi.tsx +2 -24
  54. package/lib/components/live-code-editor/hybrid-live-editor.js +0 -68
  55. package/lib/components/live-code-editor/hybrid-live-editor.js.map +0 -1
  56. package/lib/components/live-code-editor/live-code-editor.js +0 -207
  57. package/lib/components/live-code-editor/live-code-editor.js.map +0 -1
  58. package/lib/hooks/use-file-sync.d.ts +0 -16
  59. package/lib/hooks/use-file-sync.d.ts.map +0 -1
  60. package/lib/hooks/use-file-sync.js +0 -63
  61. package/lib/hooks/use-file-sync.js.map +0 -1
  62. package/lib/utils/utils.js +0 -3
  63. package/lib/utils/utils.js.map +0 -1
  64. package/lib/xstate/rightSidebar.machine.js +0 -325
  65. package/lib/xstate/rightSidebar.machine.js.map +0 -1
  66. package/src/hooks/use-file-sync.ts +0 -91
@@ -1,18 +1,10 @@
1
1
  import React from 'react';
2
2
  import InboxWithAiLoader from './InboxWithAiLoader';
3
3
  import { useParams } from '@remix-run/react';
4
- import { useRecreateSandboxMutation } from 'common/graphql';
5
4
  const TestInboxWithAiLoaderOutlet = () => {
6
5
  const { orgName } = useParams();
7
- const [recreateSandbox, { loading, error }] = useRecreateSandboxMutation();
8
6
  const handleRecreateSandbox = async (messageId: string) => {
9
7
  console.log('recreateSandbox', messageId);
10
- const response = await recreateSandbox({
11
- variables: {
12
- messageId,
13
- },
14
- });
15
- return response;
16
8
  };
17
9
  return (
18
10
  <InboxWithAiLoader
@@ -1,2 +1 @@
1
1
  export * from './usePersistentModelConfig';
2
- export * from './use-file-sync';
@@ -25,6 +25,7 @@ export interface ModelConfig {
25
25
  stepName?: string;
26
26
  metadata?: ModelConfigMetadata;
27
27
  domain?: string;
28
+ mode: 'plan' | 'build';
28
29
  }
29
30
 
30
31
  const STORAGE_KEY = 'mbx:model-config';
@@ -52,6 +53,7 @@ const DEFAULTS: ModelConfig = {
52
53
  functionId: '',
53
54
  stepName: '',
54
55
  domain: 'yarntra.ai',
56
+ mode: 'plan',
55
57
  metadata: DEFAULT_METADATA,
56
58
  };
57
59
 
@@ -11,10 +11,8 @@ import React, {
11
11
  } from 'react';
12
12
  import { Outlet, useNavigate, useParams, useLocation } from '@remix-run/react';
13
13
  import { RightSidebarAi } from '../components/InboxMessage/RightSidebarAi';
14
- import { useRecreateSandboxMutation } from 'common/graphql';
15
14
  import { usePersistentModelConfig } from '../hooks/usePersistentModelConfig';
16
15
  import { ICreateChannelInput } from 'common';
17
- import { useFileSync } from '../hooks/use-file-sync';
18
16
 
19
17
  // Context for sharing tab state between header and sidebar
20
18
  const TabContext = createContext<{
@@ -128,7 +126,6 @@ const InboxWithAiInternal = (props: InboxProps) => {
128
126
  const { activeTab, setActiveTab } = useContext(TabContext);
129
127
  const [messages, setMessages] = useState<any[]>([]);
130
128
  const [selectedPost, setSelectedPost] = useState<any>(null);
131
- const [recreateSandbox] = useRecreateSandboxMutation();
132
129
  const { modelConfig, getValidatedConfig, hasApiKey } = usePersistentModelConfig();
133
130
  const [isLoading, setIsLoading] = useState(true);
134
131
  const [isCreatingSandbox, setIsCreatingSandbox] = useState(false);
@@ -138,12 +135,7 @@ const InboxWithAiInternal = (props: InboxProps) => {
138
135
  const showContextTab = props.showContextTab ?? true;
139
136
  const contextData = useMemo(() => {
140
137
  const cfg = selectedPost?.propsConfiguration;
141
- return (
142
- cfg?.contents?.fragment?.context ||
143
- cfg?.content?.fragment?.context ||
144
- cfg?.fragment?.context ||
145
- null
146
- );
138
+ return cfg?.contents?.fragment?.context || cfg?.content?.fragment?.context || cfg?.fragment?.context || null;
147
139
  }, [selectedPost]);
148
140
  // Extract channelId from query parameters (priority) or path parameters (fallback)
149
141
  const channelId = urlParams?.get('id') || pathChannelId;
@@ -167,27 +159,13 @@ const InboxWithAiInternal = (props: InboxProps) => {
167
159
  setError(null);
168
160
 
169
161
  props.handleRecreateSandbox?.(messageId);
170
-
171
- // const response = await recreateSandbox({
172
- // variables: {
173
- // messageId,
174
- // },
175
- // });
176
-
177
- // if (response.data?.recreateSandbox?.success) {
178
- // console.log('Sandbox recreation initiated successfully');
179
- // // The subscription will handle updating the UI with the new sandbox URL
180
- // } else {
181
- // const errorMsg = response.data?.recreateSandbox?.message || 'Failed to recreate sandbox';
182
- // throw new Error(errorMsg);
183
- // }
184
162
  } catch (err) {
185
163
  console.error('Error recreating sandbox:', err);
186
164
  setError(err instanceof Error ? err.message : 'Failed to recreate sandbox');
187
165
  setIsCreatingSandbox(false);
188
166
  }
189
167
  },
190
- [recreateSandbox, channelId],
168
+ [channelId],
191
169
  );
192
170
 
193
171
  // Handle refresh sandbox
@@ -1,68 +0,0 @@
1
- import React__default,{forwardRef,useCallback,useImperativeHandle}from'react';import {cn}from'../../utils/utils.js';import {LiveCodeEditor}from'./live-code-editor.js';const HybridLiveEditor = forwardRef(({
2
- projectId,
3
- fragmentId,
4
- files = {},
5
- className,
6
- sandboxUrl,
7
- onCopyToClipboard,
8
- onFileUpdate,
9
- readOnly = false,
10
- autoSave = true,
11
- debounceMs = 500,
12
- showFileExplorer = true
13
- }, ref) => {
14
- const handleOpenVSCodeInTab = useCallback(async () => {
15
- if (sandboxUrl) {
16
- try {
17
- // Start VS Code sync first
18
- if (projectId && fragmentId) {
19
- console.log('HybridLiveEditor - Starting VSCode sync for:', {
20
- projectId,
21
- fragmentId
22
- });
23
- // Note: You'll need to implement the VSCode sync mutation based on your GraphQL setup
24
- // await startVSCodeSyncMutation({
25
- // variables: { projectId, fragmentId }
26
- // });
27
- console.log('HybridLiveEditor - VSCode sync started successfully');
28
- }
29
- const url = new URL(sandboxUrl);
30
- let codeServerUrl;
31
- // Handle different URL formats
32
- if (url.hostname.includes('yarntra.ai')) {
33
- // Format: https://3000-{sandboxId}.yarntra.ai -> https://8080-{sandboxId}.yarntra.ai
34
- codeServerUrl = `${url.protocol}//${url.hostname.replace('3000-', '8080-')}${url.pathname}`;
35
- } else if (url.hostname.includes('e2b.dev')) {
36
- // Format: https://{sandboxId}.e2b.dev -> https://{sandboxId}-8080.e2b.dev
37
- codeServerUrl = `${url.protocol}//${url.hostname}-8080${url.pathname}`;
38
- } else {
39
- // Fallback: try port-based approach
40
- const port = url.port || '3000';
41
- codeServerUrl = sandboxUrl.replace(`:${port}`, ':8080');
42
- }
43
- window.open(codeServerUrl, '_blank');
44
- } catch (err) {
45
- console.error('Error opening VSCode in new tab:', err);
46
- }
47
- }
48
- }, [sandboxUrl, projectId, fragmentId]);
49
- // Expose the openVSCode function via ref
50
- useImperativeHandle(ref, () => ({
51
- openVSCode: handleOpenVSCodeInTab
52
- }), [handleOpenVSCodeInTab]);
53
- // Return Monaco Editor without header/footer, exposing VSCode function
54
- return React__default.createElement("div", {
55
- className: cn('flex flex-col h-full w-full', className)
56
- }, React__default.createElement("div", {
57
- className: "flex-1 overflow-hidden"
58
- }, React__default.createElement(LiveCodeEditor, {
59
- files: files,
60
- onCopyToClipboard: onCopyToClipboard,
61
- onFileUpdate: onFileUpdate,
62
- readOnly: readOnly,
63
- autoSave: autoSave,
64
- debounceMs: debounceMs,
65
- showFileExplorer: showFileExplorer,
66
- className: "h-full"
67
- })));
68
- });export{HybridLiveEditor};//# sourceMappingURL=hybrid-live-editor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hybrid-live-editor.js","sources":["../../../src/components/live-code-editor/hybrid-live-editor.tsx"],"sourcesContent":[null],"names":[],"mappings":"uKAuBO,MAAM,gBAAgB,GAAG,UAAU,CACtC,CACI;AAeA,EAAA;YACQ;AACA,EAAA,KAAA,GAAA,EAAA;;AAEI,EAAA,UAAA;;;;;;AAMI,EAAA,gBAAA,GAAA;;AAGJ,EAAA,MAAA,qBAAY,GAAI,WAAI,CAAA,YAAY;AAChC,IAAA,IAAA,UAAA,EAAI;;;qBAIA,IAAA,UAAA,EAAA;qBACA,CAAA,8CAAgD;qBACnD;;;AAEG;;;;AAGA,UAAA,OAAA,CAAA,GAAA,CAAA,qDAAgC,CAAA;;iBAEnC,GAAA,IAAA,GAAA,CAAA,UAAA,CAAA;AAED,QAAA,IAAA,aAAO;;YACT,GAAA,CAAA,QAAY,CAAC,QAAA,CAAA,YAAA,CAAA,EAAA;AACX;uBACH,GAAA,CAAA,EAAA,GAAA,CAAA,QAAA,CAAA,EAAA,EAAA,GAAA,CAAA,QAAA,CAAA,OAAA,CAAA,OAAA,EAAA,OAAA,CAAA,CAAA,EAAA,GAAA,CAAA,QAAA,CAAA,CAAA;QACL,CAAC,MAAA,IAAA,GAAA,CAAA,QAAA,CAAA,QAAA,CAAA,SAAA,CAAA,EAAA;;UAGL,aAAA,GAAA,CAAA,EAAA,GAAA,CAAA,QAAA,CAAA,EAAA,EAAyC,GAAA,CAAA,QAAA,CAAA,KAAA,EAAA,GAAA,CAAA,QAAA,CAAA,CAAA;AACzC,QAAA,CAAA,MAAA;AAGQ;AACH,UACA,MAAA,IAAA,GAAA,GAAA,CAAA,IAAsB,IACzB,MAAA;UAEF,aAAA,GAAA,UAAA,CAAA,OAAA,CAAA,CAAA,CAAA,EAAA,IAAA,CAAA,CAAA,EAAA,OAAA,CAAA;QACA;QAGQ,MAAA,CAAA,IAAA,CAAA,aAAA,EAAA,QAAK,CAAA;AACD,MAAA,CAAA,CAAA,OAAA,GAAA,EAAA;AAahB,QACF,OAAA,CAAA,KAAA,CAAA,kCAAA,EAAA,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,207 +0,0 @@
1
- import React__default,{useState,useRef,useEffect,useCallback}from'react';import {Editor}from'@monaco-editor/react';import {BsFileText}from'@react-icons/all-files/bs/BsFileText.js';// File Explorer Component
2
- const FileExplorer = ({
3
- files,
4
- currentFile,
5
- onFileSelect
6
- }) => {
7
- // Simple file list without folder structure
8
- const fileList = Object.keys(files);
9
- return React__default.createElement("div", {
10
- className: "w-48 bg-gray-50 border-l border-gray-200 flex flex-col"
11
- }, React__default.createElement("div", {
12
- className: "p-3 border-b border-gray-200 bg-white"
13
- }, React__default.createElement("h3", {
14
- className: "text-sm font-semibold text-gray-700"
15
- }, "Files")), React__default.createElement("div", {
16
- className: "flex-1 overflow-y-auto"
17
- }, fileList.map(filePath => {
18
- const fileName = filePath.split('/').pop() || filePath;
19
- const isSelected = currentFile === filePath;
20
- return React__default.createElement("div", {
21
- key: filePath,
22
- className: `flex items-center py-2 px-3 cursor-pointer hover:bg-gray-100 ${isSelected ? 'bg-blue-50 text-blue-600' : 'text-gray-700'}`,
23
- onClick: () => onFileSelect(filePath)
24
- }, React__default.createElement(BsFileText, {
25
- className: "w-4 h-4 mr-2 text-gray-500"
26
- }), React__default.createElement("span", {
27
- className: "text-sm"
28
- }, fileName));
29
- })));
30
- };
31
- const LiveCodeEditor = ({
32
- files = {},
33
- className = '',
34
- onCopyToClipboard,
35
- onFileUpdate,
36
- readOnly = false,
37
- autoSave = true,
38
- debounceMs = 500,
39
- showFileExplorer = true
40
- }) => {
41
- const [currentFile, setCurrentFile] = useState(Object.keys(files)[0] || '');
42
- const [fileContent, setFileContent] = useState(files[currentFile] || '');
43
- const editorRef = useRef(null);
44
- const timeoutRef = useRef(null);
45
- // Update file content when files prop changes
46
- useEffect(() => {
47
- if (files && Object.keys(files).length > 0) {
48
- const firstFile = Object.keys(files)[0];
49
- setCurrentFile(firstFile);
50
- setFileContent(files[firstFile] || '');
51
- }
52
- }, [files]);
53
- const handleEditorDidMount = useCallback((editor, monaco) => {
54
- editorRef.current = editor;
55
- // Configure editor options
56
- editor.updateOptions({
57
- readOnly,
58
- minimap: {
59
- enabled: false
60
- },
61
- scrollBeyondLastLine: false,
62
- wordWrap: 'on',
63
- lineNumbers: 'on',
64
- folding: true,
65
- lineDecorationsWidth: 0,
66
- lineNumbersMinChars: 0,
67
- renderLineHighlight: 'none',
68
- cursorStyle: 'line',
69
- cursorWidth: 1,
70
- fontSize: 14,
71
- fontFamily: "'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace"
72
- });
73
- // Add keyboard shortcuts
74
- editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyC, () => {
75
- const selection = editor.getSelection();
76
- const selectedText = editor.getModel()?.getValueInRange(selection) || '';
77
- if (selectedText && onCopyToClipboard) {
78
- onCopyToClipboard(selectedText);
79
- }
80
- });
81
- }, [readOnly, onCopyToClipboard]);
82
- const handleEditorChange = useCallback(value => {
83
- if (value !== undefined) {
84
- setFileContent(value);
85
- // Debounced auto-save
86
- if (autoSave && onFileUpdate && currentFile) {
87
- if (timeoutRef.current) {
88
- clearTimeout(timeoutRef.current);
89
- }
90
- timeoutRef.current = setTimeout(() => {
91
- onFileUpdate(currentFile, value);
92
- }, debounceMs);
93
- }
94
- }
95
- }, [autoSave, onFileUpdate, currentFile, debounceMs]);
96
- const getLanguageFromFileName = fileName => {
97
- const extension = fileName.split('.').pop()?.toLowerCase();
98
- const languageMap = {
99
- js: 'javascript',
100
- jsx: 'javascript',
101
- ts: 'typescript',
102
- tsx: 'typescript',
103
- py: 'python',
104
- java: 'java',
105
- cpp: 'cpp',
106
- c: 'c',
107
- cs: 'csharp',
108
- php: 'php',
109
- rb: 'ruby',
110
- go: 'go',
111
- rs: 'rust',
112
- html: 'html',
113
- css: 'css',
114
- scss: 'scss',
115
- sass: 'sass',
116
- less: 'less',
117
- json: 'json',
118
- xml: 'xml',
119
- yaml: 'yaml',
120
- yml: 'yaml',
121
- md: 'markdown',
122
- sql: 'sql',
123
- sh: 'shell',
124
- bash: 'shell',
125
- dockerfile: 'dockerfile'
126
- };
127
- return languageMap[extension || ''] || 'plaintext';
128
- };
129
- // Cleanup timeout on unmount
130
- useEffect(() => {
131
- return () => {
132
- if (timeoutRef.current) {
133
- clearTimeout(timeoutRef.current);
134
- }
135
- };
136
- }, []);
137
- const handleFileSelect = useCallback(filePath => {
138
- setCurrentFile(filePath);
139
- setFileContent(files[filePath] || '');
140
- }, [files]);
141
- return React__default.createElement("div", {
142
- className: `flex h-full w-full ${className}`
143
- }, React__default.createElement("div", {
144
- className: "flex-1 flex flex-col"
145
- }, React__default.createElement("div", {
146
- className: "flex items-center justify-between px-4 py-2 bg-gray-100 border-b border-gray-200"
147
- }, React__default.createElement("div", {
148
- className: "flex items-center"
149
- }, React__default.createElement(BsFileText, {
150
- className: "w-4 h-4 mr-2 text-gray-500"
151
- }), React__default.createElement("span", {
152
- className: "text-sm font-medium text-gray-700"
153
- }, currentFile.split('/').pop() || currentFile)), React__default.createElement("div", {
154
- className: "flex items-center space-x-2"
155
- }, React__default.createElement("button", {
156
- className: "text-gray-400 hover:text-gray-600"
157
- }, React__default.createElement("svg", {
158
- className: "w-4 h-4",
159
- fill: "none",
160
- stroke: "currentColor",
161
- viewBox: "0 0 24 24"
162
- }, React__default.createElement("path", {
163
- strokeLinecap: "round",
164
- strokeLinejoin: "round",
165
- strokeWidth: 2,
166
- d: "M6 18L18 6M6 6l12 12"
167
- }))))), React__default.createElement("div", {
168
- className: "flex-1",
169
- style: {
170
- height: '100%',
171
- minHeight: '400px'
172
- }
173
- }, React__default.createElement(Editor, {
174
- height: "100%",
175
- language: getLanguageFromFileName(currentFile),
176
- value: fileContent,
177
- onMount: handleEditorDidMount,
178
- onChange: handleEditorChange,
179
- options: {
180
- readOnly,
181
- minimap: {
182
- enabled: false
183
- },
184
- scrollBeyondLastLine: true,
185
- wordWrap: 'on',
186
- lineNumbers: 'on',
187
- folding: true,
188
- lineDecorationsWidth: 0,
189
- lineNumbersMinChars: 0,
190
- renderLineHighlight: 'none',
191
- cursorStyle: 'line',
192
- cursorWidth: 1,
193
- fontSize: 14,
194
- fontFamily: "'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace",
195
- scrollbar: {
196
- vertical: 'auto',
197
- horizontal: 'auto',
198
- verticalScrollbarSize: 8,
199
- horizontalScrollbarSize: 8
200
- }
201
- }
202
- }))), showFileExplorer && Object.keys(files).length > 0 && React__default.createElement(FileExplorer, {
203
- files: files,
204
- currentFile: currentFile,
205
- onFileSelect: handleFileSelect
206
- }));
207
- };export{LiveCodeEditor};//# sourceMappingURL=live-code-editor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"live-code-editor.js","sources":["../../../src/components/live-code-editor/live-code-editor.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"oLAyBA;AACA,MAAM,YAAY,GAIb,CAAC;OACF;aACM;AAEN,EAAA;;AAGY;QAEJ,QAAA,GAAA,MAAA,CAAA,IAAA,CAAA,KAAA,CAAK;AAEG,EAAA,OAAAA,cAAA,CAAA,aAAc,CAAG,KAAA,EAAA;AACjB,IAAA,SAAA,EAAA;AAEA,GAAA,EAAAA,cAAA,CAAA,aACI,CAAA,KAAA,EAAA;AAOI,IAAA,SAAA,EAAA;iCACA,CAAA,IAAA,EAAA;AAGZ,IAAA,SAGX,EAAC;AACN,GAAE,EAAA,OAAA,CAAA,CAAA,EAAAA,cAAA,CAAA,aA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A,MAAA;AACA,IAAA,OAAA,MAAA;AACA,MAAA,IAAA,UAAA,CAAA,OAAA,EAAA;AACA,QAAA,YAAA,CAAA,UAAA,CAAA,OAAA,CAAA;AACA,MAAA;AACA,IAAA,CAAA;AACA,EAAA,CAAA,EAAA,EAAA,CAAA;AACA,EAAA,MAAA,gBAAA,GAAA,WAAc,CAAA,QAAA,IAAA;AACd,IAAA,cAAA,CAAA,QAAA,CAAA;AACA,IAAA,cAAA,CAAA,KAAA,CAAA,QAAA,CAAU,IACN,EAAA,CAAA;AACJ,EAAA,CAAA,EAAA,CAAA,KAAA,CAAA,CAAA;AACI,EAAA,OAAAA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAQ;AACR,IAAA,SAAA,EAAA,CAAA,mBAAA,EAAA,SAAkB,CAAA;AAClB,GAAA,EAAAA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AACA,IAAA,SAAA,EAAA;AACH,GAAA,EAAAA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AACJ,IAAA,SAAA,EAAA;AAMZ,GAAA,EAAAA,cAAA,CAAA,aAAgB,CAAA,KAAI,EAAA;AAKjC,IAAE,SAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,16 +0,0 @@
1
- export interface FileSyncHookProps {
2
- projectId: string;
3
- messageId?: string;
4
- }
5
- export interface FileSyncResult {
6
- updateFile: (filePath: string, content: string) => Promise<void>;
7
- isUpdating: boolean;
8
- error: string | null;
9
- lastUpdate: {
10
- filePath: string;
11
- operation: string;
12
- timestamp: string;
13
- } | null;
14
- }
15
- export declare const useFileSync: ({ projectId, messageId }: FileSyncHookProps) => FileSyncResult;
16
- //# sourceMappingURL=use-file-sync.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-file-sync.d.ts","sourceRoot":"","sources":["../../src/hooks/use-file-sync.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC3B,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE;QACR,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KACrB,GAAG,IAAI,CAAC;CACZ;AAED,eAAO,MAAM,WAAW,GAAI,0BAA0B,iBAAiB,KAAG,cAuEzE,CAAC"}
@@ -1,63 +0,0 @@
1
- import {useState,useEffect,useCallback}from'react';import {useUpdateSandboxFileMutation,useFileUpdatedSubscription}from'common/graphql';const useFileSync = ({
2
- projectId,
3
- messageId
4
- }) => {
5
- const [isUpdating, setIsUpdating] = useState(false);
6
- const [error, setError] = useState(null);
7
- const [lastUpdate, setLastUpdate] = useState(null);
8
- // GraphQL mutations
9
- const [updateSandboxFileMutation] = useUpdateSandboxFileMutation();
10
- // Real-time file updates subscription
11
- const {
12
- data: fileUpdateData
13
- } = useFileUpdatedSubscription({
14
- variables: {
15
- projectId
16
- },
17
- skip: !projectId
18
- });
19
- // Handle real-time file updates
20
- useEffect(() => {
21
- if (fileUpdateData?.fileUpdated) {
22
- const update = fileUpdateData.fileUpdated;
23
- setLastUpdate({
24
- filePath: update.filePath,
25
- operation: update.operation,
26
- timestamp: update.timestamp
27
- });
28
- }
29
- }, [fileUpdateData]);
30
- const updateFile = useCallback(async (filePath, content) => {
31
- if (!messageId) {
32
- throw new Error('Fragment ID is required for file operations');
33
- }
34
- console.log('useFileSync.updateFile - Using fragmentId:', messageId);
35
- try {
36
- setIsUpdating(true);
37
- setError(null);
38
- const response = await updateSandboxFileMutation({
39
- variables: {
40
- projectId,
41
- messageId,
42
- filePath,
43
- content
44
- }
45
- });
46
- if (!response.data?.updateSandboxFile.success) {
47
- throw new Error(response.data?.updateSandboxFile.message || 'Failed to update file');
48
- }
49
- } catch (err) {
50
- const errorMessage = err instanceof Error ? err.message : 'Unknown error occurred';
51
- setError(errorMessage);
52
- throw err;
53
- } finally {
54
- setIsUpdating(false);
55
- }
56
- }, [updateSandboxFileMutation, projectId, messageId]);
57
- return {
58
- updateFile,
59
- isUpdating,
60
- error,
61
- lastUpdate
62
- };
63
- };export{useFileSync};//# sourceMappingURL=use-file-sync.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-file-sync.js","sources":["../../src/hooks/use-file-sync.ts"],"sourcesContent":[null],"names":[],"mappings":"wIAmBO,MAAM,WAAW,GAAG,CAAC;WACjB;;MAEP;QAMA,CAAA,UAAA,EAAA,aAAoB,CAAA,GAAA,QAAA,CAAA,KAAA,CAAA;AACpB,EAAA,MAAA,CAAA,KAAO,EAAA,QAAA,CAAA,GAAA,QAAyB,CAAC,IAAG,CAAA;QAEpC,CAAA,UAAA,EAAA,aAAA,CAAA,GAAA,QAAsC,CAAA,IAAA,CAAA;AACtC;QACI,CAAA,yBAAwB,CAAA,GAAA,4BAAA,EAAA;;AAE3B,EAAA,MAAE;IAEH,IAAA,EAAA;MACA,0BAAe,CAAA;AACX,IAAA,SAAI,EAAA;AACA,MAAA;AACA,KAAA;;;;AAIC,EAAA,SAAA,CAAA,MAAE;QACP,cAAC,EAAA,WAAA,EAAA;AACL,MAAC,MAAG,MAAA,GAAA,cAAiB,CAAA,WAAA;MAErB,aAAM,CAAU;QAER,QAAK,EAAA,MAAW,CAAC,QAAA;AACb,QAAA,SAAA,EAAM,MAAI,CAAA,SAAM;QACpB,SAAC,EAAA,MAAA,CAAA;AAED,OAAA,CAAA;AAEA,IAAA;oBACI,CAAA,CAAA;kBACA,GAAS,WAAM,CAAA,OAAA,QAAA,EAAA,OAAA,KAAA;AAEf,IAAA,IAAA,CAAA,SAAM,EAAA;AACF,MAAA,MAAA,IAAA,KAAA,CAAA,6CAAW,CAAA;;4DAEE,EAAA,SAAA,CAAA;;oBAET,IAAA,CAAA;AACH,MAAA,QAAA,CAAA,IAAA,CAAA;AACJ,MAAA,MAAA,QAAE,GAAA,MAAA,yBAAA,CAAA;iBAEE;AACD,UAAA,SAAA;mBACH;UACJ,QAAA;UAAC;AACE;;AAEA,MAAA,IAAA,CAAA,aAAU,EAAA,iBAAA,CAAA,OAAA,EAAA;QACd,MAAC,IAAA,KAAA,CAAA,QAAA,CAAA,IAAA,EAAA,iBAAA,CAAA,OAAA,IAAA,uBAAA,CAAA;;aACG,GAAA,EAAA;YACH,YAAA,GAAA,GAAA,YAAA,KAAA,GAAA,GAAA,CAAA,OAAA,GAAA,wBAAA;MACJ,QACA,CAAA,YAAA,CAAA;MAGL,MAAO,GAAA;cACH;mBACU,CAAA,KAAA,CAAA;;+BAEA,EAAA,SAAA,EAAA,SAAA,CAAA,CAAA;SACZ;AACN,IAAE,UAAA;;;;;"}
@@ -1,3 +0,0 @@
1
- function cn(...inputs) {
2
- return inputs.filter(Boolean).join(' ').trim();
3
- }export{cn};//# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sources":["../../src/utils/utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAM,SAAU,EAAE,CAAC,GAAG,MAA6C,EAAA;AAC/D,EAAA,OAAA,MAAO,CAAA,MAAO,CAAA,SAAc,IAAE,CAAA,GAAK,CAAA,CAAG,IAAE,EAAI;AAChD"}