(sendMessage, getXpaths)
| 74 | * Initialize comprehensive action tracking system |
| 75 | */ |
| 76 | export async function initializeActionTracking(sendMessage, getXpaths) { |
| 77 | try { |
| 78 | console.log('🎯 Initializing comprehensive action tracking...'); |
| 79 | |
| 80 | // Initialize reactive dropdown detection system |
| 81 | const dropdownDetector = initializeDropdownDetection(sendMessage, getXpaths); |
| 82 | console.log('✅ Reactive dropdown detection initialized'); |
| 83 | |
| 84 | // Create and initialize the action tracker |
| 85 | const actionTracker = new ActionTracker(sendMessage, getXpaths); |
| 86 | |
| 87 | // Wire dropdown detector to click and input trackers |
| 88 | // - Click tracker uses it for reactive detection on clicks |
| 89 | // - Input tracker uses it to record input interactions for correlation |
| 90 | actionTracker.trackers.click.setDropdownDetector(dropdownDetector); |
| 91 | actionTracker.trackers.input.setDropdownDetector(dropdownDetector); |
| 92 | console.log('✅ Dropdown detection wired to event trackers'); |
| 93 | |
| 94 | // Initialize file upload detection |
| 95 | const fileUploadDetector = initializeFileUploadDetection(getXpaths); |
| 96 | actionTracker.trackers.click.setFileUploadDetector(fileUploadDetector); |
| 97 | console.log('✅ File upload detection wired to click tracker'); |
| 98 | |
| 99 | // Initialize choice detection for Yes/No button groups |
| 100 | const choiceDetector = initializeChoiceDetection(getXpaths); |
| 101 | actionTracker.trackers.click.setChoiceDetector(choiceDetector); |
| 102 | console.log('✅ Choice detection wired to click tracker'); |
| 103 | |
| 104 | // Initialize radio/checkbox detection |
| 105 | const radioDetector = initializeRadioDetection(getXpaths); |
| 106 | actionTracker.trackers.click.setRadioDetector(radioDetector); |
| 107 | console.log('✅ Radio detection wired to click tracker'); |
| 108 | |
| 109 | // Initialize navigation tracking for cross-page URL context |
| 110 | initializeNavigationTracking(sendMessage); |
| 111 | console.log('✅ Navigation tracking initialized'); |
| 112 | |
| 113 | // Initialize all trackers |
| 114 | actionTracker.init(); |
| 115 | |
| 116 | console.log('InverseUI: Comprehensive action tracking initialized with reactive dropdown detection'); |
| 117 | return actionTracker; |
| 118 | } catch (error) { |
| 119 | console.error('Failed to initialize action tracking:', error); |
| 120 | throw error; |
| 121 | } |
| 122 | } |
no test coverage detected