wip
This commit is contained in:
@@ -4,6 +4,7 @@ import { DIContainer } from './di-container';
|
||||
import type { HostedSessionConfig } from '@/packages/domain/entities/HostedSessionConfig';
|
||||
import { StepId } from '@/packages/domain/value-objects/StepId';
|
||||
import { AuthenticationState } from '@/packages/domain/value-objects/AuthenticationState';
|
||||
import { ElectronCheckoutConfirmationAdapter } from '@/packages/infrastructure/adapters/ipc/ElectronCheckoutConfirmationAdapter';
|
||||
|
||||
let progressMonitorInterval: NodeJS.Timeout | null = null;
|
||||
|
||||
@@ -14,6 +15,10 @@ export function setupIpcHandlers(mainWindow: BrowserWindow): void {
|
||||
const automationEngine = container.getAutomationEngine();
|
||||
const logger = container.getLogger();
|
||||
|
||||
// Setup checkout confirmation adapter and wire it into the container
|
||||
const checkoutConfirmationAdapter = new ElectronCheckoutConfirmationAdapter(mainWindow);
|
||||
container.setConfirmCheckoutUseCase(checkoutConfirmationAdapter);
|
||||
|
||||
// Authentication handlers
|
||||
ipcMain.handle('auth:check', async () => {
|
||||
try {
|
||||
@@ -21,11 +26,10 @@ export function setupIpcHandlers(mainWindow: BrowserWindow): void {
|
||||
const checkAuthUseCase = container.getCheckAuthenticationUseCase();
|
||||
|
||||
if (!checkAuthUseCase) {
|
||||
logger.warn('Authentication not available in mock mode');
|
||||
logger.error('Authentication use case not available');
|
||||
return {
|
||||
success: true,
|
||||
state: AuthenticationState.AUTHENTICATED,
|
||||
message: 'Mock mode - authentication bypassed'
|
||||
success: false,
|
||||
error: 'Authentication not available - check system configuration'
|
||||
};
|
||||
}
|
||||
|
||||
@@ -301,4 +305,36 @@ export function setupIpcHandlers(mainWindow: BrowserWindow): void {
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Browser mode control handlers
|
||||
ipcMain.handle('browser-mode:get', async () => {
|
||||
try {
|
||||
const loader = container.getBrowserModeConfigLoader();
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
return { mode: loader.getDevelopmentMode(), isDevelopment: true };
|
||||
}
|
||||
return { mode: 'headless', isDevelopment: false };
|
||||
} catch (error) {
|
||||
const err = error instanceof Error ? error : new Error('Unknown error');
|
||||
logger.error('Failed to get browser mode', err);
|
||||
return { mode: 'headless', isDevelopment: false };
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('browser-mode:set', async (_event: IpcMainInvokeEvent, mode: 'headed' | 'headless') => {
|
||||
try {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
const loader = container.getBrowserModeConfigLoader();
|
||||
loader.setDevelopmentMode(mode);
|
||||
logger.info('Browser mode updated', { mode });
|
||||
return { success: true, mode };
|
||||
}
|
||||
logger.warn('Browser mode change requested but not in development mode');
|
||||
return { success: false, error: 'Only available in development mode' };
|
||||
} catch (error) {
|
||||
const err = error instanceof Error ? error : new Error('Unknown error');
|
||||
logger.error('Failed to set browser mode', err);
|
||||
return { success: false, error: err.message };
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user