import BID_TYPE from "../system/bid-type.js"; 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; browser_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 { // await this.page_context.waitForSelector('#pageContainer', { timeout: 10000 }); console.log( `✅ Page fully loaded. Taking snapshot for ${ this.type === BID_TYPE.PRODUCT_TAB ? "Product ID" : "Tracking 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 ); } }, 1000); async isLogin() {} }