const fs = require('fs');

try {
    let appFinalJs = fs.readFileSync('app_final.js', 'utf8');

    appFinalJs = appFinalJs.replace(
        /closeModal\('storekeeper-review-modal'\);/g,
        `closeModal('storekeeper-review-modal');
  alert('?? ?????? ??????? ??????? ??????');
  if (typeof renderNotifications === 'function') renderNotifications();`
    );

    fs.writeFileSync('app_final.js', appFinalJs, 'utf8');
    
    let indexHtml = fs.readFileSync('index.html', 'utf8');
    indexHtml = indexHtml.replace(/app_final\.js\?v=\d+/g, 'app_final.js?v=' + Date.now());
    fs.writeFileSync('index.html', indexHtml, 'utf8');

    console.log("Alert added successfully.");
} catch (e) {
    console.error(e);
}
