29 lines
		
	
	
		
			837 B
		
	
	
	
		
			JavaScript
		
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			837 B
		
	
	
	
		
			JavaScript
		
	
	
	
import CONSTANTS from '../system/constants.js';
 | 
						|
import { takeSnapshot } from '../system/utils.js';
 | 
						|
import _ from 'lodash';
 | 
						|
 | 
						|
export class Bid {
 | 
						|
    type;
 | 
						|
    puppeteer_connect;
 | 
						|
    url;
 | 
						|
    action;
 | 
						|
    page_context;
 | 
						|
 | 
						|
    constructor(type, url, puppeteer_connect) {
 | 
						|
        this.type = type;
 | 
						|
        this.url = url;
 | 
						|
        this.puppeteer_connect = puppeteer_connect;
 | 
						|
    }
 | 
						|
 | 
						|
    handleTakeWorkSnapshot = _.debounce(async () => {
 | 
						|
        if (!this.page_context) return;
 | 
						|
 | 
						|
        try {
 | 
						|
            console.log(`✅ Page loaded. Taking snapshot for Product ID: ${this.id}`);
 | 
						|
            takeSnapshot(this.page_context, this, 'working', CONSTANTS.TYPE_IMAGE.WORK);
 | 
						|
        } catch (error) {
 | 
						|
            console.error(`❌ Error taking snapshot for Product ID: ${this.id}:`, error.message);
 | 
						|
        }
 | 
						|
    }, 500);
 | 
						|
}
 |