{"version":3,"sources":["webpack:///./source/application/contact-ask-callback.js","webpack:///./source/application/contact-ask-callback/contact-ask-callback.module.js","webpack:///./source/application/contact-ask-callback/contact-ask-callback.component.js"],"names":["angular","module","messagingService","vcRecaptcha","captchaService","component","ContactAskCallbackComponent","name","templateUrl","controller","$mdDialog","CommonConstants","$timeout","$cookies","$rootScope","notificationService","this","emailRegex","numberRegex","model","showRecaptcha","changes","formError","isFirstChange","backendError","copy","cancel","getCaptcha","then","response","captchaId","data","captchaImg","htmlFragment","error","window","ipEventBus","publish","message","askCallbackForm","captcha","$setValidity","vm","show","clickOutsideToClose","controllerAs","onComplete","captchaText","initCaptcha","hide","globalNotification","sendAskCallback","catch","status","$setPristine","$setUntouched","showError","captchaExpired"],"mappings":"gIAAA,Q,wGCAA,cACA,WAEA,WACA,WACA,S,mDAEA,I,EAEeA,UAAQC,OAFH,qBAEuB,CAACC,UAAkBC,UAAaC,YAAiBC,UAAU,qBAAsBC,+BAA6BC,K,0SCTlJ,IAAMD,EAA8B,CAC1CE,YAAa,4BACbC,WAAU,WACT,WAAYC,EAAWC,EAAiBC,EAAUV,EAAkBW,EAAUC,EAAYC,EAAqBX,I,4FAAgB,SAE9HY,KAAKN,UAAYA,EACjBM,KAAKH,SAAWA,EAChBG,KAAKd,iBAAmBA,EACxBc,KAAKJ,SAAWA,EAChBI,KAAKC,WAAa,yJAClBD,KAAKE,YAAc,QACnBF,KAAKG,MAAQ,GACbH,KAAKI,eAAgB,EACrBJ,KAAKL,gBAAkBA,EACvBK,KAAKF,WAAaA,EAClBE,KAAKD,oBAAsBA,EAC3BC,KAAKZ,eAAiBA,E,UAdd,8I,EAAA,G,EAAA,kCAiBEiB,GAENA,EAAQC,YAAcD,EAAQC,UAAUC,kBAC3CP,KAAKQ,aAAexB,QAAQyB,KAAKT,KAAKM,WACb,WAArBN,KAAKQ,cACRR,KAAKN,UAAUgB,YAtBT,oCA2BK,WACbV,KAAKZ,eAAeuB,aAAaC,MAChC,SAAAC,GACC,EAAKC,UAAYD,EAASE,KAAKD,UAC/B,EAAKE,WAAaH,EAASE,KAAKE,gBAEjC,SAAAC,GACCC,OAAOC,WAAWC,QAAQ,aAAc,CACvCC,QAAS,wBAnCJ,0CA0CRtB,KAAKuB,gBAAgBC,QAAQC,aAAa,WAAW,EAAMzB,KAAKuB,mBA1CxD,wCA6CS,WACXG,EAAK1B,KACXA,KAAKN,UAAUiC,KAAK,CACnBnC,YAAa,yBACboC,qBAAqB,EACrBnC,WAAY,kBAAM,GAClBoC,aAAc,QACdC,WALmB,WAMlBJ,EAAGK,YAAc,KACjBL,EAAGM,mBAtDG,yCA4DRhC,KAAKG,MAAQ,GACbH,KAAKN,UAAUuC,OACfjC,KAAKF,WAAWoC,mBAAqB,KA9D7B,6BAiEF,WACNlC,KAAKd,iBAAiBiD,gBAAgBnC,KAAKG,MAAO,CAACW,UAAWd,KAAKc,UAAWiB,YAAa/B,KAAK+B,cAAcnB,MAAK,SAACC,GACnH,EAAKf,WAAWoC,mBAAqB,CACpCZ,QAAS,+BAERc,OAAM,SAAClB,GAAU,MACC,KAAhBA,EAAMmB,QAAsC,YAArB,UAAAnB,EAAMH,YAAN,eAAYG,QACtC,EAAKK,gBAAgBC,QAAQC,aAAa,WAAW,EAAO,EAAKF,iBACjE,EAAKA,gBAAgBC,QAAQc,eAC7B,EAAKf,gBAAgBC,QAAQe,gBAC7B,EAAKR,YAAc,KACnB,EAAKC,eAEL,EAAKjC,oBAAoByC,UAAU,CAClClB,QAAS,sBAIZtB,KAAKyC,mBAnFG,uCAsFQ,WAChBzC,KAAKI,eAAgB,EAErBJ,KAAKJ,UAAS,WACb,EAAKQ,eAAgB,U,2BA1Fd,M","file":"application/contact-ask-callback.bundle.js","sourcesContent":["import './contact-ask-callback/contact-ask-callback.module';\n","import angular from 'angular';\nimport vcRecaptcha from 'angular-recaptcha';\n\nimport messagingService from './../messaging/messaging.module';\nimport captchaService from '../captcha/captcha.module'\nimport { ContactAskCallbackComponent } from './contact-ask-callback.component';\n\nconst MODULE_NAME = 'contactAskCallback';\n\nexport default angular.module(MODULE_NAME, [messagingService, vcRecaptcha, captchaService]).component('contactAskCallback', ContactAskCallbackComponent).name;\n","export const ContactAskCallbackComponent = {\n\ttemplateUrl: 'contact-ask-callback.html',\n\tcontroller: class ContactAskCallbackComponent {\n\t\tconstructor($mdDialog, CommonConstants, $timeout, messagingService, $cookies, $rootScope, notificationService, captchaService) {\n\t\t\t'ngInject';\n\t\t\tthis.$mdDialog = $mdDialog;\n\t\t\tthis.$cookies = $cookies;\n\t\t\tthis.messagingService = messagingService;\n\t\t\tthis.$timeout = $timeout;\n\t\t\tthis.emailRegex = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n\t\t\tthis.numberRegex = /^\\d+$/;\n\t\t\tthis.model = {};\n\t\t\tthis.showRecaptcha = true;\n\t\t\tthis.CommonConstants = CommonConstants;\n\t\t\tthis.$rootScope = $rootScope;\n\t\t\tthis.notificationService = notificationService;\n\t\t\tthis.captchaService = captchaService;\n\t\t}\n\n\t\t$onChanges(changes) {\n\t\t\t// Todo backend validáció ellenőrzése\n\t\t\tif (changes.formError && !changes.formError.isFirstChange()) {\n\t\t\t\tthis.backendError = angular.copy(this.formError);\n\t\t\t\tif (this.backendError == 'success') {\n\t\t\t\t\tthis.$mdDialog.cancel();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tinitCaptcha() {\n\t\t\tthis.captchaService.getCaptcha().then(\n\t\t\t\tresponse => {\n\t\t\t\t\tthis.captchaId = response.data.captchaId;\n\t\t\t\t\tthis.captchaImg = response.data.htmlFragment;\n\t\t\t\t},\n\t\t\t\terror => {\n\t\t\t\t\twindow.ipEventBus.publish('show-error', {\n\t\t\t\t\t\tmessage: 'technicalError'\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tresetCaptchaError() {\n\t\t\tthis.askCallbackForm.captcha.$setValidity('invalid', true, this.askCallbackForm)\n\t\t}\n\n\t\topenMessageForm() {\n\t\t\tconst vm = this;\n\t\t\tthis.$mdDialog.show({\n\t\t\t\ttemplateUrl: 'ask-callback-form.html',\n\t\t\t\tclickOutsideToClose: true,\n\t\t\t\tcontroller: () => this,\n\t\t\t\tcontrollerAs: '$ctrl',\n\t\t\t\tonComplete() {\n\t\t\t\t\tvm.captchaText = null;\n\t\t\t\t\tvm.initCaptcha();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tcloseMessageForm() {\n\t\t\tthis.model = {};\n\t\t\tthis.$mdDialog.hide();\n\t\t\tthis.$rootScope.globalNotification = {};\n\t\t}\n\n\t\tsend() {\n\t\t\tthis.messagingService.sendAskCallback(this.model, {captchaId: this.captchaId, captchaText: this.captchaText}).then((response) => {\n\t\t\t\tthis.$rootScope.globalNotification = {\n\t\t\t\t\tmessage: 'successShareNotification'\n\t\t\t\t};\n\t\t\t}).catch((error) => {\n\t\t\t\tif (error.status == 400 && error.data?.error == 'captcha') {\n\t\t\t\t\tthis.askCallbackForm.captcha.$setValidity('invalid', false, this.askCallbackForm)\n\t\t\t\t\tthis.askCallbackForm.captcha.$setPristine();\n\t\t\t\t\tthis.askCallbackForm.captcha.$setUntouched();\n\t\t\t\t\tthis.captchaText = null;\n\t\t\t\t\tthis.initCaptcha();\n\t\t\t\t} else {\n\t\t\t\t\tthis.notificationService.showError({\n\t\t\t\t\t\tmessage: 'technicalError'\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.captchaExpired();\n\t\t}\n\n\t\tcaptchaExpired() {\n\t\t\tthis.showRecaptcha = false;\n\n\t\t\tthis.$timeout(() => {\n\t\t\t\tthis.showRecaptcha = true;\n\t\t\t});\n\t\t}\n\t}\n};\n"],"sourceRoot":""}