1import{_ as V,a7 as i,ae as f,h as p,o as d,ab as u}from"./index.b39fe1b1.js";import{N as a,D as $,E as k,f as t,U as h,S as c,a0 as _,a4 as R}from"./vue.00f7c436.js";import"./sentry.09480738.js";const g="Something went wrong sending your voucher. Please try again later.",S={name:"ClaimReferralCouponPopup",data(){return{loadingCouponEmail:!1,startOpen:!1,image:null,referrerName:null,email:null}},computed:{referralCode(){return this.$route.query.referrer},popupCopy(){let e=this.referrerName,o="";return e?o=`If you're friends with ${i(e)}, you've got a friend in us. `:e="your friend",o+=`${i(e)} has arranged a special deal for you. 2 Your personal offer code will enable you to get \xA310 off your first order over \xA350. 3 Enter your email below and we will mail you our voucher and send ${i(this.referrerName)} 4 their reward for spreading the word. Welcome to the Party!`,o}},watch:{referralCode:{immediate:!0,handler(e){e&&this.getContent()}}},methods:{upperFirst:i,getContent(){f.get(p(`/omnis/v3/division/${this.$store.state.subdomain.division}/referrals/${this.referralCode}/claim-coupon-popup`)).success(e=>{this.image=e.image,this.referrerName=e.referrerName,this.image=e.image,this.startOpen=!0,d.open("claim-referral-coupon-popup")}).validation().handle(404,()=>{u("Sorry, that referral is unavailable")})},failVoucherSend(){this.loadingCouponEmail=!1,u.error(g)},async sendCouponEmail(e=0){var l;if(e===0&&(this.loadingCouponEmail||!await this.$refs.claimReferralCouponForm.validateAll()))return;const o=(l=this.$refs.captcha)==null?void 0:l.recaptcha;if(!o){if(e>=4){this.failVoucherSend();return}this.loadingCouponEmail=!0,setTimeout(()=>this.sendCouponEmail(e+1),500);return}this.loadingCouponEmail=!0,o.ifHuman(s=>{f.post(p(`/omnis/v3/division/${this.$store.state.subdomain.division}/referrals/${this.referralCode}/send-email/`),{email:this.email,v3captchaToken:s.v3Token,v2captchaToken:s.v2Token}).success(()=>{u("Email sent!"),d.close("claim-referral-coupon-popup")}).validation().oops(g).any(()=>{var r;return(r=this.$refs.captcha)==null?void 0:r.recaptcha.reload()}).finally(()=>{this.loadingCouponEmail=!1})}).ifBot(()=>this.failVoucherSend())},formatUrl:p}},x={class:"claim-referral-coupon-popup"},T={class:"mb-4"};function O(e,o,l,s,r,n){const y=a("tml-image"),v=a("tml-input"),C=a("tml-re-captcha"),E=a("tml-button"),b=a("tml-form"),w=a("tml-anchor"),N=a("tml-new-popup");return $(),k("div",x,[t(N,{name:"claim-referral-coupon-popup",title:"With love from "+(n.upperFirst(r.referrerName)||"your friend"),layout:"standard",size:"normal",height:"auto",fill:!1,"start-open":r.startOpen},{content:h(()=>[c("div",null,[t(y,{class:"mb-4",src:r.image,alt:"Refer a friend image"},null,8,["src"]),c("p",T,_(n.popupCopy),1),t(b,{ref:"claimReferralCouponForm","form-name":"claim-referral-coupon-form"},{default:h(()=>[t(v,{modelValue:r.email,"onUpdate:modelValue":o[0]||(o[0]=m=>r.email=m),class:"mb-4","field-name":"email",placeholder:"Email",type:"email","auto-complete":"email","focus-input":"","validation-rules":{required:!0,email:!0},onSubmit:o[1]||(o[1]=m=>n.sendCouponEmail())},null,8,["modelValue"]),t(C,{ref:"captcha",action:"subdomains_referrals_send_coupon_email"},null,512),t(E,{class:"mb-4",text:"Get voucher",loading:r.loadingCouponEmail,primary:"",fill:"",onClick:o[2]||(o[2]=m=>n.sendCouponEmail())},null,8,["loading"])]),_:1},512),c("p",null,[R(_(e.$store.state.subdomain.company.name)+" email marketing ",1),t(w,{text:"privacy policy",target:"_blank",href:"/privacy-policy/"})])])]),_:1},8,["title","start-open"])])}const U=V(S,[["render",O]]);export{U as default}; 5//# sourceMappingURL=ClaimReferralCouponPopup.19ea9da2.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.