← back to Gmc Titlefix
step-c-verify-one.js
24 lines
// READ-ONLY verify — re-pulls the canary offer; confirms effective title == "Sample: ...".
const {token,MERCHANT}=require('./_auth');
const fs=require('fs');
const offerId=process.argv[2] || (fs.existsSync('/tmp/gmc-titlefix-canary-offer.txt')&&fs.readFileSync('/tmp/gmc-titlefix-canary-offer.txt','utf8').trim());
if(!offerId){ console.error('Usage: node step-c-verify-one.js <offerId>'); process.exit(1); }
(async()=>{
const tok=await token();
// Content API processed product (effective, merged) view:
const id=`online:en:US:${offerId}`;
const r=await fetch(`https://shoppingcontent.googleapis.com/content/v2.1/${MERCHANT}/products/${encodeURIComponent(id)}`,{headers:{Authorization:'Bearer '+tok}});
const j=await r.json();
console.log('HTTP',r.status);
console.log('offerId :',offerId);
console.log('EFFECTIVE title now:', j.title);
const pass = /^Sample:/.test(j.title||'');
if(pass){
fs.writeFileSync('/tmp/gmc-titlefix-verify-pass.txt', offerId);
console.log('PASS ✅ title flipped to Sample-prefixed — step-d is now UNLOCKED for this offer.');
} else {
try{ fs.unlinkSync('/tmp/gmc-titlefix-verify-pass.txt'); }catch(e){}
console.log('NOT YET ❌ — feed may take a few min to reprocess; re-run. step-d stays LOCKED until this PASSES.');
}
})();