2025-08-22 14:40:27 +01:00
import { useMemo } from 'react' ;
import { useTranslation } from 'react-i18next' ;
2025-08-25 16:07:55 +01:00
import React from 'react' ;
import LocalIcon from '../../../components/shared/LocalIcon' ;
2025-08-22 14:40:27 +01:00
import { SuggestedAutomation } from '../../../types/automation' ;
2025-08-25 16:07:55 +01:00
// Create icon components
const CompressIcon = ( ) = > React . createElement ( LocalIcon , { icon : 'compress' , width : '1.5rem' , height : '1.5rem' } ) ;
const TextFieldsIcon = ( ) = > React . createElement ( LocalIcon , { icon : 'text-fields' , width : '1.5rem' , height : '1.5rem' } ) ;
const SecurityIcon = ( ) = > React . createElement ( LocalIcon , { icon : 'security' , width : '1.5rem' , height : '1.5rem' } ) ;
const StarIcon = ( ) = > React . createElement ( LocalIcon , { icon : 'star' , width : '1.5rem' , height : '1.5rem' } ) ;
2025-08-22 14:40:27 +01:00
export function useSuggestedAutomations ( ) : SuggestedAutomation [ ] {
const { t } = useTranslation ( ) ;
const suggestedAutomations = useMemo < SuggestedAutomation [ ] > ( ( ) = > {
const now = new Date ( ) . toISOString ( ) ;
return [
{
2025-08-26 11:19:15 +01:00
id : "secure-pdf-ingestion" ,
name : t ( "automation.suggested.securePdfIngestion" , "Secure PDF Ingestion" ) ,
description : t ( "automation.suggested.securePdfIngestionDesc" , "Comprehensive PDF processing workflow that sanitizes documents, applies OCR with cleanup, converts to PDF/A format for long-term archival, and optimizes file size." ) ,
operations : [
{
operation : "sanitize" ,
parameters : {
removeJavaScript : true ,
removeEmbeddedFiles : true ,
removeXMPMetadata : true ,
removeMetadata : true ,
removeLinks : false ,
removeFonts : false ,
}
} ,
{
operation : "ocr" ,
parameters : {
languages : [ 'eng' ] ,
ocrType : 'skip-text' ,
ocrRenderType : 'hocr' ,
additionalOptions : [ 'clean' , 'cleanFinal' ] ,
}
} ,
{
operation : "convert" ,
parameters : {
fromExtension : 'pdf' ,
toExtension : 'pdfa' ,
pdfaOptions : {
outputFormat : 'pdfa-1' ,
}
}
} ,
{
operation : "compress" ,
parameters : {
compressionLevel : 5 ,
grayscale : false ,
expectedSize : '' ,
compressionMethod : 'quality' ,
fileSizeValue : '' ,
fileSizeUnit : 'MB' ,
}
}
] ,
createdAt : now ,
updatedAt : now ,
icon : SecurityIcon ,
} ,
{
id : "email-preparation" ,
name : t ( "automation.suggested.emailPreparation" , "Email Preparation" ) ,
description : t ( "automation.suggested.emailPreparationDesc" , "Optimizes PDFs for email distribution by compressing files, splitting large documents into 20MB chunks for email compatibility, and removing metadata for privacy." ) ,
2025-08-22 14:40:27 +01:00
operations : [
2025-08-25 13:10:13 +01:00
{
operation : "compress" ,
parameters : {
compressionLevel : 5 ,
grayscale : false ,
expectedSize : '' ,
compressionMethod : 'quality' ,
fileSizeValue : '' ,
fileSizeUnit : 'MB' ,
}
} ,
{
operation : "splitPdf" ,
parameters : {
mode : 'bySizeOrCount' ,
2025-08-26 11:19:15 +01:00
pages : '' ,
hDiv : '1' ,
vDiv : '1' ,
2025-08-25 13:10:13 +01:00
merge : false ,
2025-08-26 11:19:15 +01:00
splitType : 'size' ,
splitValue : '20MB' ,
2025-08-25 13:10:13 +01:00
bookmarkLevel : '1' ,
includeMetadata : false ,
allowDuplicates : false ,
}
2025-08-26 11:19:15 +01:00
} ,
2025-08-25 13:10:13 +01:00
{
2025-08-26 11:19:15 +01:00
operation : "sanitize" ,
2025-08-25 13:10:13 +01:00
parameters : {
2025-08-26 11:19:15 +01:00
removeJavaScript : false ,
removeEmbeddedFiles : false ,
removeXMPMetadata : true ,
removeMetadata : true ,
removeLinks : false ,
removeFonts : false ,
2025-08-25 13:10:13 +01:00
}
}
2025-08-22 14:40:27 +01:00
] ,
createdAt : now ,
updatedAt : now ,
2025-08-26 11:19:15 +01:00
icon : CompressIcon ,
2025-08-22 14:40:27 +01:00
} ,
{
id : "secure-workflow" ,
2025-08-25 13:10:13 +01:00
name : t ( "automation.suggested.secureWorkflow" , "Security Workflow" ) ,
2025-08-26 11:19:15 +01:00
description : t ( "automation.suggested.secureWorkflowDesc" , "Secures PDF documents by removing potentially malicious content like JavaScript and embedded files, then adds password protection to prevent unauthorized access." ) ,
2025-08-25 13:10:13 +01:00
operations : [
{
operation : "sanitize" ,
parameters : {
removeJavaScript : true ,
removeEmbeddedFiles : true ,
removeXMPMetadata : false ,
removeMetadata : false ,
removeLinks : false ,
removeFonts : false ,
}
} ,
{
operation : "addPassword" ,
parameters : {
password : 'password' ,
ownerPassword : '' ,
keyLength : 128 ,
permissions : {
preventAssembly : false ,
preventExtractContent : false ,
preventExtractForAccessibility : false ,
preventFillInForm : false ,
preventModify : false ,
preventModifyAnnotations : false ,
preventPrinting : false ,
preventPrintingFaithful : false ,
}
}
}
] ,
createdAt : now ,
updatedAt : now ,
icon : SecurityIcon ,
} ,
{
2025-08-26 11:19:15 +01:00
id : "process-images" ,
name : t ( "automation.suggested.processImages" , "Process Images" ) ,
description : t ( "automation.suggested.processImagesDesc" , "Converts multiple image files into a single PDF document, then applies OCR technology to extract searchable text from the images." ) ,
2025-08-22 14:40:27 +01:00
operations : [
2025-08-25 13:10:13 +01:00
{
2025-08-26 11:19:15 +01:00
operation : "convert" ,
parameters : {
fromExtension : 'image' ,
toExtension : 'pdf' ,
imageOptions : {
colorType : 'color' ,
dpi : 300 ,
singleOrMultiple : 'multiple' ,
fitOption : 'maintainAspectRatio' ,
autoRotate : true ,
combineImages : true ,
}
}
2025-08-25 13:10:13 +01:00
} ,
{
2025-08-26 11:19:15 +01:00
operation : "ocr" ,
2025-08-25 13:10:13 +01:00
parameters : {
2025-08-26 11:19:15 +01:00
languages : [ 'eng' ] ,
ocrType : 'skip-text' ,
ocrRenderType : 'hocr' ,
additionalOptions : [ ] ,
2025-08-25 13:10:13 +01:00
}
}
2025-08-22 14:40:27 +01:00
] ,
createdAt : now ,
updatedAt : now ,
icon : StarIcon ,
} ,
] ;
} , [ t ] ) ;
return suggestedAutomations ;
}