@@ -304,7 +304,7 @@ export class TypebotService extends BaseChatbotService<TypebotModel, any> {
304304 let detectMarkerEnabled = true ;
305305 try {
306306 // eslint-disable-next-line @typescript-eslint/no-var-requires
307- const { chatbotChatwootService : markerSvc } = require ( '@api/server.module' ) ;
307+ const { chatbotChatwootService : markerSvc } = eval ( ' require' ) ( '@api/server.module' ) ;
308308 if ( markerSvc ) {
309309 const instDb = await this . prismaRepository . instance . findFirst ( { where : { name : instance . instanceName } } ) ;
310310 if ( instDb ) {
@@ -335,7 +335,9 @@ export class TypebotService extends BaseChatbotService<TypebotModel, any> {
335335 if ( detectMarkerEnabled && formattedText . includes ( '[transfer_human]' ) ) {
336336 transferToHumanRequested = true ;
337337 formattedText = formattedText . replace ( '[transfer_human]' , '' ) . trim ( ) ;
338- this . logger . log ( `[Coordination] Detected [transfer_human] marker in Typebot message for ${ session . remoteJid } ` ) ;
338+ this . logger . log (
339+ `[Coordination] Detected [transfer_human] marker in Typebot message for ${ session . remoteJid } ` ,
340+ ) ;
339341 if ( ! formattedText ) continue ; // skip empty message after stripping marker
340342 }
341343
@@ -432,9 +434,10 @@ export class TypebotService extends BaseChatbotService<TypebotModel, any> {
432434 const currentParams = ( session . parameters as Record < string , any > ) || { } ;
433435 const updatedParams : any = {
434436 ...currentParams ,
435- lastChoiceMap : input . type === 'choice input' ? Object . fromEntries (
436- input . items . map ( ( item : any , idx : number ) => [ String ( idx + 1 ) , item . content ] )
437- ) : undefined ,
437+ lastChoiceMap :
438+ input . type === 'choice input'
439+ ? Object . fromEntries ( input . items . map ( ( item : any , idx : number ) => [ String ( idx + 1 ) , item . content ] ) )
440+ : undefined ,
438441 } ;
439442 await prismaRepository . integrationSession . update ( {
440443 where : {
@@ -461,9 +464,11 @@ export class TypebotService extends BaseChatbotService<TypebotModel, any> {
461464 if ( transferToHumanRequested && ! sessionPaused ) {
462465 try {
463466 // eslint-disable-next-line @typescript-eslint/no-var-requires
464- const { chatbotChatwootService } = require ( '@api/server.module' ) ;
467+ const { chatbotChatwootService } = eval ( ' require' ) ( '@api/server.module' ) ;
465468 if ( chatbotChatwootService ) {
466- const instanceDb = await this . prismaRepository . instance . findFirst ( { where : { name : instance . instanceName } } ) ;
469+ const instanceDb = await this . prismaRepository . instance . findFirst ( {
470+ where : { name : instance . instanceName } ,
471+ } ) ;
467472 if ( instanceDb ) {
468473 const result = await chatbotChatwootService . transferToHuman ( instanceDb . id , session . remoteJid ) ;
469474 this . logger . log ( `[Coordination] transferToHuman result: ${ JSON . stringify ( result ) } ` ) ;
@@ -499,9 +504,11 @@ export class TypebotService extends BaseChatbotService<TypebotModel, any> {
499504 let shouldAutoResolve = true ;
500505 try {
501506 // eslint-disable-next-line @typescript-eslint/no-var-requires
502- const { chatbotChatwootService } = require ( '@api/server.module' ) ;
507+ const { chatbotChatwootService } = eval ( ' require' ) ( '@api/server.module' ) ;
503508 if ( chatbotChatwootService ) {
504- const instanceDb = await this . prismaRepository . instance . findFirst ( { where : { name : instance . instanceName } } ) ;
509+ const instanceDb = await this . prismaRepository . instance . findFirst ( {
510+ where : { name : instance . instanceName } ,
511+ } ) ;
505512 if ( instanceDb ) {
506513 const config = await chatbotChatwootService . getCoordinationConfig ( instanceDb . id ) ;
507514 shouldAutoResolve = config . autoResolve ;
0 commit comments