@@ -6,15 +6,8 @@ import type { BlockConfig, SubBlockConfig, SubBlockLayout, SubBlockType } from '
66
77const logger = createLogger ( 'FileBlock' )
88
9- // Create a safe client-only env subset to avoid server-side env access errors
10- const clientEnv = {
11- USE_S3 : process . env . USE_S3 ,
12- }
13-
14- const isS3Enabled = clientEnv . USE_S3
15- const shouldEnableURLInput = isProd || isS3Enabled
9+ const shouldEnableURLInput = isProd
1610
17- // Define sub-blocks conditionally
1811const inputMethodBlock : SubBlockConfig = {
1912 id : 'inputMethod' ,
2013 title : 'Select Input Method' ,
@@ -26,18 +19,6 @@ const inputMethodBlock: SubBlockConfig = {
2619 ] ,
2720}
2821
29- const fileUrlBlock : SubBlockConfig = {
30- id : 'filePath' ,
31- title : 'File URL' ,
32- type : 'short-input' as SubBlockType ,
33- layout : 'full' as SubBlockLayout ,
34- placeholder : 'Enter URL to a file (https://example.com/document.pdf)' ,
35- condition : {
36- field : 'inputMethod' ,
37- value : 'url' ,
38- } ,
39- }
40-
4122const fileUploadBlock : SubBlockConfig = {
4223 id : 'file' ,
4324 title : 'Upload Files' ,
@@ -62,7 +43,23 @@ export const FileBlock: BlockConfig<FileParserOutput> = {
6243 bgColor : '#40916C' ,
6344 icon : DocumentIcon ,
6445 subBlocks : [
65- ...( shouldEnableURLInput ? [ inputMethodBlock , fileUrlBlock ] : [ ] ) ,
46+ ...( shouldEnableURLInput ? [ inputMethodBlock ] : [ ] ) ,
47+ {
48+ id : 'filePath' ,
49+ title : 'File URL' ,
50+ type : 'short-input' as SubBlockType ,
51+ layout : 'full' as SubBlockLayout ,
52+ placeholder : 'Enter URL to a file (https://example.com/document.pdf)' ,
53+ ...( shouldEnableURLInput
54+ ? {
55+ condition : {
56+ field : 'inputMethod' ,
57+ value : 'url' ,
58+ } ,
59+ }
60+ : { } ) ,
61+ } ,
62+
6663 {
6764 ...fileUploadBlock ,
6865 ...( shouldEnableURLInput ? { condition : { field : 'inputMethod' , value : 'upload' } } : { } ) ,
0 commit comments