Skip to content

Commit

Permalink
Fixing Invoke Service workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
jalagari committed Aug 22, 2024
1 parent 40075df commit b7f9b0e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion blocks/form/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,21 @@ function calculateEMI(loanAmount, annualROI, termMonths) {
return emi.toFixed(2);
}

/**
* Workaround for Invoke Service Issue
*/
function applyInvokeServiceWorkaround(submitButton) {
const submitButton;
// eslint-disable-next-line no-underscore-dangle
if (submitButton && submitButton._jsonModel && submitButton._jsonModel.events
// eslint-disable-next-line no-underscore-dangle
&& submitButton._jsonModel.events.click) {
// eslint-disable-next-line no-underscore-dangle
submitButton._jsonModel.events.click[0] = 'request(externalize(\'/content/NFL/index/jcr:content/root/section/form.af.dermis\'),\'POST\',{ "operationName":\'POST NFLPerson\', "input":toString({xdmEntity: {_formsinternal01: {winningTeam: $form.panelcontainer1724059998351.panelcontainer1724060010408.panelcontainer_8924168121724239056896.winningTeam.$value,favoriteTeam: $form.panelcontainer1724059998351.panelcontainer_1441474551724069378434.teamSelection.favTeam.$value},person: {name: {firstName: firstName.$value,lastName: lastName.$value}},personID: email.$value}}),"functionToExecute":\'invokeFDMOperation\',"apiVersion":\'2\',"formDataModelId":\'/content/dam/formsanddocuments-fdm/aep-connector\',"runValidation":\'false\',"guideNodePath":\'/content/NFL/index/jcr:content/root/section/form/panelcontainer/panelcontainer_957069440/panelcontainer_1445695439/button\'}, {"Content-Type" : \'application/x-www-form-urlencoded\'}, \'custom:wsdlSuccess_1724268855999\',\'custom:wsdlError_1724268855999\')';
}
}

// eslint-disable-next-line import/prefer-default-export
export {
getFullName, days, isReturningVisitor, calculateEMI,
getFullName, days, isReturningVisitor, calculateEMI, applyInvokeServiceWorkaround,
};

0 comments on commit b7f9b0e

Please sign in to comment.