"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const playwright_1 = require("playwright"); async function extractJarsAzStoreIds() { const browser = await playwright_1.chromium.launch({ headless: true }); const page = await browser.newPage(); const results = []; const capturedIds = []; const allRequests = []; // Intercept network requests to find Dutchie Plus API calls page.on('request', (request) => { const url = request.url(); allRequests.push(url.substring(0, 100)); if (url.includes('dutchie') || url.includes('graphql')) { const postData = request.postData(); console.log('Dutchie request to:', url.substring(0, 80)); if (postData) { // Look for retailerId in GraphQL variables const match = postData.match(/"retailerId"\s*:\s*"([a-f0-9-]{36})"/i); if (match) { const id = match[1]; if (capturedIds.indexOf(id) === -1) { capturedIds.push(id); console.log('Captured retailerId from request:', id); } } } } }); try { // Just load one page first and thoroughly debug it console.log('Loading Mesa store with full network debugging...'); await page.goto('https://jarscannabis.com/shop/mesa-az/', { waitUntil: 'networkidle', timeout: 60000 }); console.log('\nWaiting 5 seconds for dynamic content...'); await page.waitForTimeout(5000); // Get page title and content const title = await page.title(); console.log('Page title:', title); const content = await page.content(); console.log('Page content length:', content.length); // Save screenshot await page.screenshot({ path: '/tmp/jars-mesa-debug.png', fullPage: true }); console.log('Screenshot saved to /tmp/jars-mesa-debug.png'); // Look for all UUIDs in content const uuidPattern = /[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/gi; const uuids = content.match(uuidPattern); if (uuids) { const uniqueUuids = [...new Set(uuids)]; console.log('\n=== All UUIDs found on page ==='); uniqueUuids.forEach(u => console.log(u)); } // Look for all iframes const iframes = await page.evaluate(() => { return Array.from(document.querySelectorAll('iframe')).map(f => ({ src: f.src, id: f.id, name: f.name, className: f.className })); }); console.log('\n=== Iframes ==='); console.log(JSON.stringify(iframes, null, 2)); // Look for any elements with dutchie const dutchieElements = await page.evaluate(() => { const elements = document.body.innerHTML.match(/dutchie[^<>]*\"/gi) || []; return elements.slice(0, 20); }); console.log('\n=== Dutchie mentions ==='); dutchieElements.forEach(e => console.log(e)); // Look for script src containing dutchie const scripts = await page.evaluate(() => { return Array.from(document.querySelectorAll('script[src]')) .map(s => s.getAttribute('src')) .filter(src => src && (src.includes('dutchie') || src.includes('embed'))); }); console.log('\n=== Relevant scripts ==='); scripts.forEach(s => console.log(s)); // Look for __NEXT_DATA__ const nextData = await page.evaluate(() => { const el = document.getElementById('__NEXT_DATA__'); return el ? el.textContent : null; }); if (nextData) { console.log('\n=== __NEXT_DATA__ found ==='); const data = JSON.parse(nextData); // Look for retailer in various places const propsStr = JSON.stringify(data, null, 2); // Find all UUID patterns in the props const propsUuids = propsStr.match(/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/gi); if (propsUuids) { console.log('UUIDs in __NEXT_DATA__:', [...new Set(propsUuids)]); } } else { console.log('\nNo __NEXT_DATA__ found'); } // Look for specific Dutchie embed patterns const embedPatterns = content.match(/https:\/\/[^"'\s]*dutchie[^"'\s]*/gi); if (embedPatterns) { console.log('\n=== Dutchie embed URLs ==='); [...new Set(embedPatterns)].forEach(u => console.log(u)); } console.log('\n=== Network requests summary ==='); console.log('Total requests:', allRequests.length); const dutchieRequests = allRequests.filter(r => r.includes('dutchie')); console.log('Dutchie requests:', dutchieRequests.length); dutchieRequests.forEach(r => console.log(r)); console.log('\n=== CAPTURED IDS ==='); console.log(capturedIds); } finally { await browser.close(); } } extractJarsAzStoreIds().catch(e => console.error('Error:', e.message));