const fs = require('fs');

const file = 'app/(onboarding)/onboarding/page.tsx';
let code = fs.readFileSync(file, 'utf8');

code = code.replace(
  'const close = () => { window.location.href = "index.html"; };',
  'const close = () => { if (typeof window !== "undefined") window.location.href = "/"; };'
);
code = code.replace(
  'const openChat = () => { window.location.href = "index.html"; };',
  'const openChat = () => { if (typeof window !== "undefined") window.location.href = "/"; };'
);

fs.writeFileSync(file, code);
