const fs = require('fs');
let app = fs.readFileSync('app_final.js', 'utf8');

app = app.replace(
  /window\.openContactStatement = function\(contactId\) \{/g,
  "window.openContactStatement = function(contactId) {\n  window.currentStatementAccountId = null;\n"
);

app = app.replace(
  /window\.openAccountStatement = function\(accountId\) \{/g,
  "window.openAccountStatement = function(accountId) {\n  window.currentStatementContactId = null;\n"
);

fs.writeFileSync('app_final.js', app, 'utf8');
console.log('Fixed statement ID resets!');
