{"version":3,"file":"js/signup/affiliate/index-a0e3c5c5d89c04807c37.js","mappings":"mHAEAA,SAASC,iBAAiB,oBAAoB,MAC5CC,EAAAA,EAAAA,IAAe,G,uBCQjB,SAASC,EAAeC,EAAMC,EAASC,GACrC,MAAMC,EAZR,SAA2BH,GACzB,MAAMG,EAAQP,SAASQ,cAAc,SAOrC,OALAD,EAAME,KAAO,SACbF,EAAMG,KAAO,uBAEbN,EAAKO,YAAYJ,GAEVA,CACT,CAGgBK,CAAkBR,GAEhCA,EAAKH,iBAAiB,UAAWY,IAC/BA,EAAMC,iBAENC,WAAWC,WAAWC,OAAMC,UAC1B,MAAMC,QAAcJ,WAAWC,WAAWI,QAAQf,EAAS,CAAEC,WAC7DC,EAAMc,MAAQF,EACdf,EAAKkB,QAAQ,GACb,GAEN,CAEO,SAASpB,IACAF,SAASuB,iBAAiB,iBAElCC,SAASpB,IACb,GAAsC,SAAlCA,EAAKqB,QAAQC,iBAA6B,CAI5CvB,EAAeC,EAHCA,EAAKqB,QAAQpB,QACdD,EAAKqB,QAAQnB,OAG9B,IAEJ,C","sources":["webpack://paypro/./app/javascript/packs/signup/affiliate/index.js","webpack://paypro/./app/javascript/recaptcha/index.js"],"sourcesContent":["import { initRecaptcha } from 'recaptcha';\n\ndocument.addEventListener('DOMContentLoaded', () => {\n initRecaptcha();\n});\n","function createHiddenInput(form) {\n const input = document.createElement('input');\n\n input.type = 'hidden';\n input.name = 'g-recaptcha-response';\n\n form.appendChild(input);\n\n return input;\n}\n\nfunction setupRecaptcha(form, siteKey, action) {\n const input = createHiddenInput(form);\n\n form.addEventListener('submit', (event) => {\n event.preventDefault();\n\n grecaptcha.enterprise.ready(async () => {\n const token = await grecaptcha.enterprise.execute(siteKey, { action });\n input.value = token;\n form.submit();\n });\n });\n}\n\nexport function initRecaptcha() {\n const forms = document.querySelectorAll('.js-recaptcha');\n\n forms.forEach((form) => {\n if (form.dataset.recaptchaEnabled === 'true') {\n const siteKey = form.dataset.siteKey;\n const action = form.dataset.action;\n\n setupRecaptcha(form, siteKey, action);\n }\n });\n}\n"],"names":["document","addEventListener","initRecaptcha","setupRecaptcha","form","siteKey","action","input","createElement","type","name","appendChild","createHiddenInput","event","preventDefault","grecaptcha","enterprise","ready","async","token","execute","value","submit","querySelectorAll","forEach","dataset","recaptchaEnabled"],"sourceRoot":""}