Path: blob/master/phs/ola-otpbypass/index_files/sso-verifyotp.bd2f1dee.js.download
996 views
"use strict";Vue.component("sso-verifyotp",{_scopeId:"data-v-97ac9418",owCSS:".sso[data-v-97ac9418]{position:relative;padding:25px;text-align:center;margin:8% auto 16px;width:372px;border-radius:4px;background-color:#fff;box-shadow:0 2px 4px 0 rgba(0,0,0,.1)}.sso__title[data-v-97ac9418]{font-size:18px;font-weight:500;padding-bottom:8px;letter-spacing:-.4px}.sso__sub-title[data-v-97ac9418]{opacity:.5;font-size:14px;line-height:1.21;letter-spacing:-.2px}.sso__new-user__otp-wrapper[data-v-97ac9418]{position:relative;height:48px;border-radius:4px;background-color:#fff;border:1px solid #e5e5e5}.sso__new-user__otp-icon[data-v-97ac9418]{border-right:1px solid #ebebeb;padding:0 14px 0 4px}.sso__new-user__otp-icon[data-v-97ac9418],.sso__new-user__otp[data-v-97ac9418]{display:inline-block;vertical-align:middle;opacity:.5;font-size:16px;letter-spacing:-.3px}.sso__new-user__otp[data-v-97ac9418]{height:44px;border-radius:4px;background-color:#fff;border:none;width:75%;padding-left:8px;outline:none}.sso__new-user__otp-wrapper[data-v-97ac9418]{margin-top:16px;border-radius:8px}.sso__clear-icon[data-v-97ac9418],.sso__new-user__otp-icon[data-v-97ac9418]{padding:0;border:0;width:24px;height:24px}.sso__clear-icon[data-v-97ac9418]{opacity:1}.sso__cta[data-v-97ac9418]{margin-top:15px;border-radius:4px;background-color:#e6e6e6;padding:12px;cursor:pointer;color:rgba(0,0,0,.4)}.sso__cta.enabled[data-v-97ac9418]{background-color:#000;color:#cddc39}.sso__resend-otp[data-v-97ac9418]{font-size:14px;text-align:center;color:#448dff;margin:0 auto;cursor:pointer}.sso__notice a[data-v-97ac9418]{color:#000}.sso__back[data-v-97ac9418]{position:absolute;left:20px;top:18px}.sso__back-btn[data-v-97ac9418]{width:24px;height:24px;opacity:1;cursor:pointer}.sso__clear[data-v-97ac9418]{position:absolute;width:40px;right:0;top:12px}@media screen and (max-width:500px){.sso[data-v-97ac9418]{margin:0;background:none;box-shadow:none;width:100%;padding:12px 0 0}.sso__cta[data-v-97ac9418]{border-radius:4px;z-index:10;margin:20px 8px 8px}.sso__new-user__otp-wrapper[data-v-97ac9418]{width:94%;margin:0 auto 10px;height:46px}.sso__logo[data-v-97ac9418]{padding-bottom:12px}.sso__new-user__otp-wrapper[data-v-97ac9418]{margin-top:20px;margin-bottom:0}.sso__resend-otp[data-v-97ac9418]{margin:16px auto 0}.sso__back[data-v-97ac9418]{left:12px;top:12px}}",render:function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"sso__wrapper"},[s("div",{staticClass:"sso"},[e.owRegistry["sso-header"]?s("sso-header",{attrs:{hideback:!1},on:{back:e.goback}}):e._e(),e._v(" "),s("div",{staticClass:"sso__content"},[s("div",{staticClass:"sso__title"},[e._v(e._s(e.info.title))]),e._v(" "),s("div",{staticClass:"sso__sub-title"},[e._v(e._s(e.info.subtitle))]),e._v(" "),s("div",{staticClass:"sso__new-user__otp-wrapper"},[s("ow-icon",{staticClass:"sso__new-user__otp-icon",attrs:{name:"KEY",width:"24",height:"24",viewbox:"0 0 24 24",fill:"#000000"}}),e._v(" "),s("input",{directives:[{name:"model",rawName:"v-model",value:e.otp,expression:"otp"}],staticClass:"sso__new-user__otp",attrs:{type:"tel",pattern:"\\d*",oninput:"javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);",placeholder:"Enter 4 digit OTP",id:"otp",maxlength:"4",minlength:"4"},domProps:{value:e.otp},on:{keyup:function(t){if(!("button"in t)&&e._k(t.keyCode,"enter",13))return null;e.click(t)},input:function(t){t.target.composing||(e.otp=t.target.value)}}}),e._v(" "),s("div",{directives:[{name:"show",rawName:"v-show",value:e.otp,expression:"otp"}],staticClass:"sso__clear",on:{click:function(){e.otp=""}}},[s("div",{staticClass:"sso__clear-icon"},[e.owRegistry["ow-icon"]?s("ow-icon",{staticClass:"sso__clear-icon",attrs:{name:"CLEAR",width:"24",height:"24",viewbox:"0 0 24 24",opacity:"1"}}):e._e()],1)])],1)]),e._v(" "),s("ow-ajax",{attrs:{trigger:e.fetch_data,url:e.info.url,headers:e.info.headers,method:"POST",body:e.info.data},on:{success:e.populateAjaxResponse}}),e._v(" "),s("div",{staticClass:"sso__cta",class:{enabled:e.enableCTA},on:{click:e.click}},[e._v(e._s(e.info.cta))])],1),e._v(" "),s("div",{staticClass:"sso__resend-otp",on:{click:e.clickResend}},[e._v("\n Resend OTP\n "),e.owRegistry["ow-ajax"]&&e.triggerResendOtp?s("ow-ajax",{attrs:{trigger:e.triggerResendOtp,url:e.partner?"/api/partner/resend":"/api/resend",method:"POST",body:e.resendOtpData},on:{success:e.resendOTP}}):e._e()],1),e._v(" "),e.owRegistry["ow-ajax"]?s("ow-ajax",{attrs:{trigger:e.triggerIVR,url:"/gatekeeper-api/ivr/trigger",method:"POST",body:e.triggerIVRRequest},on:{success:e.handleIVR}}):e._e(),e._v(" "),e.owRegistry["sso-bridge"]?s("sso-bridge",{on:{interaction:e.populateOtpFromApp}}):e._e(),e._v(" "),e.owRegistry["ow-top-loader"]?s("ow-top-loader",{attrs:{overlay:!0,show:e.ajaxInProgress}}):e._e()],1)},staticRenderFns:[],name:"ssoVerifyotp",data:function(){return{otp:"",toast:{show:!1,type:"",content:""},fetch_data:"dormant",triggerResendOtp:"dormant",triggerIVR:"dormant",ajaxInProgress:!1,ivrRetry:!0}},props:{iframe:Boolean,phone_number:[String,Number],verificationId:String,newUser:Boolean,captcha:Object,selectedCountry:Object,returnurl:String,name:String,email:String,autofillotp:[String,Number],partner:Boolean,partnerUserActions:Object,trackingParams:Object,liteParams:Object,platform:String,app_version:String},watch:{autofillotp:function(t){t&&(this.otp=v,this.click(),this.info.cta="Verifying")},otp:function(t){t=t.replace(/[^\d]/g,""),this.otp=t}},mounted:function(){var t=this,e=this;setTimeout(function(){e.$el.querySelector(".sso__new-user__otp").focus()},500),this.autofillotp&&(this.otp=this.autofillotp,this.click(),this.info.cta="Verifying"),Vue.nextTick(function(){console.log("Adding the listener"),window.addEventListener("message",t.receiveMessage,!1)})},computed:{info:function(){return{title:"Verify and log in",subtitle:"Enter the OTP sent to your mobile {{phone_number}}".replace(/{{phone_number}}/g,this.phone_number),cta:this.newUser?"Sign up":"Log In",url:this.partner?"/api/partner/verify":"/api/verify",headers:this.partner||this.trackingParams.utm_source!=window.owConfig.FKUtmSource?{}:{utm_source:this.trackingParams.utm_source,grant_token:window.FKToken},data:{otp:this.otp,name:this.name,email:this.email||null,newUser:this.newUser,mobileNumber:this.phone_number,countryCode:this.selectedCountry.countryCode,dialingCode:this.selectedCountry.dialingCode,verificationId:this.verificationId,platform:this.platform,app_version:this.app_version,captchaInfo:{fingerPrint:this.captcha.fingerPrint,storageId:this.captcha.storageId},liteParams:window.params}}},resendOtpData:function(){return{newUser:this.newUser,mobileNumber:this.phone_number,dialingCode:this.selectedCountry.dialingCode,countryCode:this.selectedCountry.countryCode,verificationId:this.verificationId,captchaInfo:this.captcha.showCaptcha?{gcaptcha:this.captcha.gcaptcha,fingerPrint:this.captcha.fingerPrint,storageId:this.captcha.storageId}:{fingerPrint:this.captcha.fingerPrint,storageId:this.captcha.storageId},liteParams:window.params}},enableCTA:function(){return"fire"!==this.fetch_data&&4===this.otp.length},triggerIVRRequest:function(){return{"2faId":this.mfaInfo&&this.mfaInfo.mfaId,verificationId:this.verificationId,liteParams:window.params}}},methods:{receiveMessage:function(t){var e=this;if(console.log("In receive Message function"),/^https?:\/\/([a-zA-Z\d-]+\.){0,}olacabs\.com\/*/.test(t.origin)){var s=(t.data&&t.data.message).split(" ");s.length&&s.forEach(function(t){4===(t=t.replace(/\./g,"")).length&&parseInt(t)&&/\d{4}$/.test(t)&&(e.otp=t,e.click(),console.log("I have autofilled"),e.info.cta="Verifying")})}},populateOtpFromApp:function(t){t["autoread-otp"]&&t["autoread-otp"].message&&(this.receiveMessage({data:{message:t["autoread-otp"].message},origin:"https://www.olacabs.com"}),t["autoread-otp"]=void 0),t["autoread-userinfo"]&&t["autoread-userinfo"].app_metadata&&(this.trackingParams.app_metadata=t["autoread-userinfo"].app_metadata)},click:function(){var t={show:!0,type:"warning",content:"Please enter a valid OTP"};4===this.otp.length?(/\d{4}$/.test(this.otp)||(this.toast=t,this.$emit("showtoast",this.toast)),this.fetch_data="fire",this.ajaxInProgress=!0):(this.toast=t,this.$emit("showtoast",this.toast)),this.sendGAEvent&&this.sendGAEvent("SSO","verify_otp_clicked"),this.trackEvent&&(this.trackingParams.newUser=this.newUser,this.trackEvent({eventName:"verify_otp_clicked",eventValue:this.trackingParams}))},clickResend:function(){this.triggerResendOtp="fire"},populateAjaxResponse:function(t){if(t.response)if("SUCCESS"===t.response.status)if(t.response.mfaRequired){var e=t.response.mfaInfo&&t.response.mfaInfo.requirePassword?"verifypwd":"verifycall";t.response.ivrInfo&&"failed"===t.response.ivrInfo.status&&this.ivrRetry?(this.$emit("setstate",{mfaInfo:t.response.mfaInfo,ivrInfo:t.response.ivrInfo}),this.ajaxInProgress=!0,this.triggerIVR="fire",this.ivrRetry=!1):this.$emit("setstate",{screen:e,mfaInfo:t.response.mfaInfo,passwordInfo:t.response.passwordInfo,ivrInfo:t.response.ivrInfo})}else this.partner?this.$emit("setstate",{screen:"permission",partnerInfo:{showPermissionPage:t.response.showPermissionPage,partnerUserId:t.response.partnerUserId,partnerName:t.response.partnerName,denyUrl:t.response.denyUrl,tnc:t.response.tnc}}):this.redirectToNext(t);else(t.response.status="FAILURE")&&(this.toast={show:!0,type:"warning",content:null!=t.response.message?t.response.message:"Something went wrong"},t.response.error&&701===t.response.error.status?(this.$emit("screen","signup"),this.$emit("setstate",{email:""})):this.otp="");this.$emit("showtoast",this.toast),this.$set(this,"fetch_data","dormant"),this.ajaxInProgress=!1},resendOTP:function(t){t.response&&("SUCCESS"===t.response.status?(this.toast={show:!0,type:"success",content:"OTP sent successfully"},this.$emit("showtoast",this.toast)):"FAILURE"===t.response.status&&t.response.loginRequired?(this.captcha.gcaptcha="",this.captcha.reset=!0,this.$emit("screen","login"),this.$emit("setstate",{captcha:this.captcha}),this.toast={show:!0,type:"warning",content:t.response.message},this.$emit("showtoast",this.toast)):t.response.message&&(this.toast={show:!0,type:"warning",content:t.response.message},this.$emit("showtoast",this.toast))),this.triggerResendOtp="dormant",this.sendGAEvent&&this.sendGAEvent("SSO","resend_otp_clicked"),this.trackEvent&&this.trackEvent({eventName:"resend_otp_clicked",eventValue:this.trackingParams})},goback:function(){this.newUser?this.$emit("screen","signup"):this.$emit("screen","login"),this.$set(this,"otp",""),this.captcha.gcaptcha="",this.captcha.reset=!0,this.$emit("setstate",{captcha:this.captcha}),this.sendGAEvent&&this.sendGAEvent("SSO","back_button_otp_entry_page"),this.trackEvent&&this.trackEvent({eventName:"back_button_otp_entry_page",eventValue:this.trackingParams})},handleIVR:function(t){t.response&&t.response.data?this.$emit("setstate",{screen:"verifycall",ivrInfo:t.response.data}):(this.toast={show:!0,type:"warning",content:t.response.message||"Sorry, there was an error. Please try again."},this.$emit("screen","login"),this.$emit("showtoast",this.toast)),this.ajaxInProgress=!1,this.triggerIVR="dormant"},redirectToNext:function(t){this.returnurl?this.returnurl&&-1<window.owConfig.domainList.indexOf(this.extractHostname(this.returnurl))?window.location.href=this.returnurl:this.toast={show:!0,type:"warning",content:"Invalid domain"}:this.iframe&&parent.postMessage(t.response,"*")}}}); //# sourceMappingURL=../sourcemap/components/sso-verifyotp.bd2f1dee.js.map