1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1460],{81460:function(e,a,r){r.r(a),r.d(a,{default:function(){return S}});var l=r(57437),o={src:"/_next/static/media/google.80654783.svg",height:30,width:30,blurWidth:0,blurHeight:0},s=r(33145),t=r(51268),i=r(35217),n=r(1896),d=r(11614),c=r(1902),u=r(68575),m=r(19434),p=r(18229),v=r(99376),h=r(21125),x=r(34804),y=r(27648),g=r(2265),f=r(70764),b=r.n(f),N=r(84280),_=r(8933),w=r(90596),j=r(40059),k=r(30166);r(23294);var O=r(4497);let{BlockLoading:P}={BlockLoading:(0,k.default)(()=>r.e(2069).then(r.bind(r,82069)),{loadableGenerated:{webpack:()=>[82069]},suspense:!0,ssr:!0})};function S(e){let{business:a,location:r,businessLoyalty:f,authLoyalty:k,cartLoyalty:S,checkoutStep:C,setCheckoutStep:T,authUserRedux:Z,cartLoyaltyFetched:I,cartDetail:L}=e,[E,B]=(0,g.useState)(!1),[A,q]=(0,g.useState)(!1),J=(0,u.I0)(),D=(0,x.Ee)(),F=(0,d.getCookie)("platformId");(0,v.useRouter)();let K=(0,v.useSearchParams)(),U=(0,v.useParams)(),G=(0,v.usePathname)(),[R,V]=(0,g.useState)("email"),W=["e","E","+","-","."],[Y,M]=(0,g.useState)({active:!1,socialType:"",socialId:""}),[H,Q]=(0,g.useState)({isActive:!1,message:"",auth_code_token:"",email:""}),[z,X]=(0,g.useState)({firstName:{value:"",error_type:"",error_message:"",validations:["required"]},lastName:{value:"",error_type:"",error_message:"",validations:[""]},phone:{value:"",error_type:"",error_message:"",validations:["phone"]},email:{value:"",error_type:"",error_message:"",validations:["email"]},emailOrPhone:{value:"",error_type:"",error_message:"",validations:["required","emailOrPhone"]},marketing:{value:!1,error_type:"",error_message:"",validations:[]}});async function $(e,a){X({...z,[e]:h.Z.getValueWithValidation(e,a,z)})}async function ee(){await n.Z.loadFacebookSDK(),n.Z.initFacebook("")}let ea=(0,p.Nq)({onSuccess:async e=>{J((0,_.Z6)(!0));let r=await w.Z.loginWithSocial({socialType:"google",accessToken:e.access_token,businessId:a.id});(null==r?void 0:r.status)==201?es(r):J((0,_.Z6)(!1)),(0,c.yv)(m.Z.getErrorSuccessObject(r))},onError:e=>console.log(e)}),er=(0,p.Nq)({onSuccess:async e=>{try{let t=await w.Z.getGoogleUserData(e.access_token);if((null==t?void 0:t.status)==200){var a,r,l,o,s;M({active:!0,socialType:"google",socialId:null===(a=t.data)||void 0===a?void 0:a.sub});let e={firstName:null===(r=t.data)||void 0===r?void 0:r.given_name,lastName:null===(l=t.data)||void 0===l?void 0:l.family_name,email:null===(o=t.data)||void 0===o?void 0:o.email,emailOrPhone:null===(s=t.data)||void 0===s?void 0:s.email};for(let a in e)await $(a,e[a])}}catch(e){}},onError:e=>console.log(e)});async function el(e){e.preventDefault();let l=await h.Z.validateFormFields(z,["emailOrPhone","firstName","lastName"]);if(!1==l.error){var o,s,t,i,u,p,v,x,y,g,f,b,N,w,k;let e={firstName:null===(o=z.firstName)||void 0===o?void 0:o.value,lastName:null===(s=z.lastName)||void 0===s?void 0:s.value,marketing:z.marketing.value,businessId:null==a?void 0:a.id,registeredFrom:K.get("source")?K.get("source"):"gr8"};"email"==R?(e.email=z.emailOrPhone.value.trim(),e.phone=z.phone.value?z.phone.value.trim():null):"phone"==R&&(e.email=z.email.value?z.email.value.trim():null,e.phone=z.emailOrPhone.value.trim()),Y.active&&(e.socialType=Y.socialType,e.socialId=Y.socialId),e.redirectUrl=m.Z.refineParams(["token","verify_email","verify_phone","source","signup_token","signup"],G),e.locationSlug=null==r?void 0:r.slug,e.businessSlug=null==a?void 0:a.slug,U.signup_token&&(e.guest_token=U.signup_token),U.referral_key&&(e.referralKey=U.referral_key),J((0,_.Z6)(!0));let l=await j.Z.signup(e);201==l.status&&(Y.active?await es(l):(n.Z.vbout_push_user_and_flag({business:a,user:l.data.payload}),(null===(t=l.data.payload)||void 0===t?void 0:t.userLoyalty)&&((null===(u=l.data.payload)||void 0===u?void 0:null===(i=u.userLoyalty)||void 0===i?void 0:i.referralBonus)&&(null===(v=l.data.payload)||void 0===v?void 0:null===(p=v.userLoyalty)||void 0===p?void 0:p.referralBonus)>0&&(0,d.setCookie)("_confetti_referral",JSON.stringify({type:"referral",active:!0,data:{points_earned:null===(N=l.data.payload)||void 0===N?void 0:null===(b=N.userLoyalty)||void 0===b?void 0:b.referralBonus}})),(null===(y=l.data.payload)||void 0===y?void 0:null===(x=y.userLoyalty)||void 0===x?void 0:x.welcomeBonus)&&
1(null===(f=l.data.payload)||void 0===f?void 0:null===(g=f.userLoyalty)||void 0===g?void 0:g.welcomeBonus)>0&&(0,d.setCookie)("_confetti_welcome",JSON.stringify({type:"signup",active:!0,data:{points_earned:null===(k=l.data.payload)||void 0===k?void 0:null===(w=k.userLoyalty)||void 0===w?void 0:w.welcomeBonus}}))),eo())),J((0,_.Z6)(!1)),(0,c.yv)(m.Z.getErrorSuccessObject(l))}else X({...l.data})}async function eo(e){let r={businessId:a.id};"email"==R?r.email=z.emailOrPhone.value.trim():r.phone=parseInt(z.emailOrPhone.value),J((0,_.Z6)(!0));let l=await w.Z.loginViaEmailOrPhone(r,"signup=true&primary="+R);J((0,_.Z6)(!1)),(null==l?void 0:l.status)==200||(null==l?void 0:l.status)==201?Q({isActive:!0,message:l.data.message,authCodeToken:l.data.payload.authCodeToken,email:z.emailOrPhone.value}):(0,c.yv)(m.Z.getErrorSuccessObject(l),{variant:"error"})}async function es(e){var l,o,s,t,i,c,u,m,p,v,h,x;J((0,N.YO)(e.data.payload)),(0,d.setCookie)("authUserToken",e.data.payload.token,JSON.parse('{"sameSite":"none","secure":true,"maxAge":1735707600}')),(0,d.setCookie)("authUserId",e.data.payload.id,JSON.parse('{"sameSite":"none","secure":true,"maxAge":1735707600}')),(null===(l=e.data.payload)||void 0===l?void 0:l.welcomeBonus)&&(0,d.setCookie)("_confetti_welcome",JSON.stringify({type:"signup",active:!0,data:{points_earned:null===(m=e.data.payload)||void 0===m?void 0:m.welcomeBonus}})),(null===(s=e.data.payload)||void 0===s?void 0:null===(o=s.userLoyalty)||void 0===o?void 0:o.welcomeBonus)&&(0,d.setCookie)("_confetti_welcome",JSON.stringify({type:"signup",active:!0,data:{points_earned:null===(v=e.data.payload)||void 0===v?void 0:null===(p=v.userLoyalty)||void 0===p?void 0:p.welcomeBonus}})),(null===(i=e.data.payload)||void 0===i?void 0:null===(t=i.userLoyalty)||void 0===t?void 0:t.referralBonus)&&(null===(u=e.data.payload)||void 0===u?void 0:null===(c=u.userLoyalty)||void 0===c?void 0:c.referralBonus)>0&&(0,d.setCookie)("_confetti_referral",JSON.stringify({type:"referral",active:!0,data:{points_earned:null===(x=e.data.payload)||void 0===x?void 0:null===(h=x.userLoyalty)||void 0===h?void 0:h.referralBonus}}));let y=n.Z.if_business_loyalty_active_subscribe_user({user:e.data.payload,business:a,location:r,router:{path:G,params:U,query:K}}),g=n.Z.fetch_user_cart_or_merge_to_guest({user:e.data.payload,business:a,location:r,guestCart:L,platformId:F,userToken:e.data.payload.token});await Promise.all([y,g]),await n.Z.vbout_push_user_and_flag_sync_cart({user:e.data.payload,business:a,location:r,cartDetail:L,router:{path:G,params:U,query:K}});let f=window.location.protocol+"//"+window.location.host+G;D.publish({channel:"gr8-"+a.id+"-platform-"+F,message:{declaration:"signin",redirect:f}}),window.location.reload(),T({activeTab:"ordertype"})}return(0,g.useEffect)(()=>{V(z.emailOrPhone.value?isNaN(z.emailOrPhone.value)?"email":"phone":"email")},[z]),(0,g.useEffect)(()=>{ee(),q()},[]),(0,l.jsxs)("section",{id:"reward_tab",children:["reward"==C.activeTab?(0,l.jsx)("div",{className:"border-2 border-theme-border-color bg-white rounded-lg flex flex-row justify-between items-center px-[20px] py-[16px]",children:(0,l.jsxs)("div",{className:"flex large:flex-row small:flex-col w-full",children:[(0,l.jsx)("h3",{className:"small:border-b small:w-full large:border-r border-theme-border-color small:mb-3 small:pb-3 large:mr-3 text-[18px] font-bold w-[130px]",children:"Reward"}),(0,l.jsxs)("div",{className:"large:pl-[20px] w-full",children:[I?(0,l.jsx)("div",{children:!b()(S)&&(null==S?void 0:S.points_earned)>0?(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsx)("p",{className:"font-semibold mb-1 text-[18px]",children:"Great News!"}),(0,l.jsxs)("p",{className:"mb10 has-text-weight-semibold",children:["You're moments away from earning"," ",(0,l.jsxs)("strong",{children:[(null==S?void 0:S.points_earned)?new Intl.NumberFormat().format(null==S?void 0:S.points_earned):0," ","points"]})," ","on this purchase when you sign up below!"]})]}):(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-semibold mb-1 text-[18px]",children:"Oh No!"}),(0,l.jsx)("div",{className:"font-semibold mb-[10px]",children:"It looks like you aren't going to earn points this purchase, but you can still sign-up and earn points in the future!"}),(0,l.jsxs)("div",{className:"text-base",children:[(0,l.jsx)("strong",{children:null==f?void 0:f.name})," provides rich rewards for those who earn points by visiting stores, referring friends, and other simple actions!"]})]})}):(0,l.jsx)(P,{customClass:"min-h-60px"}),(0,l.jsxs)("div",{className:"text-center my-[10px] font-semibold text-base",children:[E?"Join with":"Sign in with",":"]}
1),(0,l.jsx)("div",{className:"",children:(0,l.jsx)("div",{className:"flex flex-row gap-4 justify-center",children:(0,l.jsx)(s.default,{width:"45",height:"45",src:o,title:"google",className:"border secondary-border rounded-full p-[8px] hover:opacity-60 cursor-pointer",alt:"google login",onClick:()=>E?er():ea()})})}),E?(0,l.jsxs)("form",{children:[(0,l.jsxs)("div",{className:"my-[25px]",children:[(0,l.jsx)("div",{className:"border-t relative top-[12px] border-theme-border-color"}),(0,l.jsx)("span",{className:"relative bg-white px-7 left-[45%] text-base text-center",children:"Or"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("input",{className:"w-full border border-theme-border-color rounded px-[20px] py-[10px] focus:outline-0",name:"firstName",onChange:e=>{$("firstName",e.currentTarget.value)},type:"text",placeholder:"First Name*",value:z.firstName.value}),(0,l.jsx)("p",{className:"text-theme-red text-xs",children:z.firstName.error_message})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("input",{className:"w-full border border-theme-border-color rounded px-[20px] py-[10px] focus:outline-0",name:"lastName",onChange:e=>{$("lastName",e.currentTarget.value)},type:"text",placeholder:"Last Name",value:z.lastName.value}),(0,l.jsx)("p",{className:"text-theme-red text-xs",children:z.lastName.error_message})]}),(0,l.jsx)("div",{children:Y.active?(0,l.jsxs)("div",{className:"mt-2",children:["Email: ",z.emailOrPhone.value]}):(0,l.jsxs)("div",{children:[(0,l.jsx)("input",{className:"w-full border border-theme-border-color rounded px-[20px] py-[10px] focus:outline-0",name:"emailOrPhone",onChange:e=>{$("emailOrPhone",e.currentTarget.value.trim())},onKeyDown:e=>{"Space"==e.code&&e.preventDefault()},type:"text",placeholder:"Email or Phone Number *"}),(0,l.jsx)("p",{className:"text-theme-red text-xs",children:z.emailOrPhone.error_message})]})}),"email"==R?(0,l.jsxs)("div",{children:[(0,l.jsx)("input",{className:"w-full border border-theme-border-color rounded px-[20px] py-[10px] focus:outline-0",name:"phone",onChange:e=>{$("phone",e.currentTarget.value)},type:"number",min:"0",maxLength:"10",onKeyDown:e=>W.includes(e.key)&&e.preventDefault(),placeholder:"Phone Number (Optional)"}),(0,l.jsx)("p",{className:"text-theme-red text-xs",children:z.phone.error_message})]}):(0,l.jsxs)("div",{children:[(0,l.jsx)("input",{className:"w-full border border-theme-border-color rounded px-[20px] py-[10px] focus:outline-0",name:"email",onChange:e=>{$("email",e.currentTarget.value)},type:"email",placeholder:"Email (Optional)"}),(0,l.jsx)("p",{className:"text-theme-red text-xs",children:z.email.error_message})]})]}),(0,l.jsx)("div",{className:"flex flex-row items-center gap-2 mt-[20px]",children:(0,l.jsx)("div",{className:"checkbox-wrapper-33 pt-2",children:(0,l.jsxs)("label",{htmlFor:"signupOptIn",className:"checkbox rounded-[8px] cursor-pointer",children:[(0,l.jsx)("input",{className:"checkbox__trigger visuallyhidden",type:"checkbox",value:"1",id:"signupOptIn",checked:z.marketing.value,onChange:e=>{$("marketing",!z.marketing.value)}}),(0,l.jsx)("span",{className:"checkbox__symbol",children:(0,l.jsx)("svg",{"aria-hidden":"true",className:"icon-checkbox",width:"28px",height:"28px",viewBox:"0 0 28 28",version:"1",xmlns:"http://www.w3.org/2000/svg",children:(0,l.jsx)("path",{d:"M4 14l8 7L24 7"})})}),(0,l.jsx)("p",{className:"pl-1 cursor-pointer",children:"Sign up for new offers and discounts"})]})})}),(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 mt-[10px]",children:[(0,l.jsxs)("div",{className:"text-[14px]",children:["By signing up, you agree to the CheQmate"," ",(0,l.jsx)(y.default,{prefetch:!1,title:"terms",target:"_blank",className:"underline text-[14px] hover:opacity-60",href:"/terms-conditions",children:"Terms of Use"})," ","and"," ",(0,l.jsx)(y.default,{prefetch:!1,target:"_blank",title:"privacy policy",className:"underline text-[14px] hover:opacity-60",href:"/privacy",children:"Privacy Policy"})]}),(0,l.jsxs)("div",{className:"flex flex-row items-center gap-5 justify-end",children:[(0,l.jsx)(y.default,{prefetch:!1,href:"#",title:"skip",onClick:e=>void(B(!1),X({firstName:{value:"",error_type:"",error_message:"",validations:["required"]},lastName:{value:"",error_type:"",error_message:"",validations:["required"]},phone:{value:"",error_type:"",error_message:"",validations:["phone"]},email:{value:"",error_type:"",error_message:"",validations:["required","email"]},emailOrPhone:{value:"",error_type:"",error_message:"",validations:["required","emailOrPhone"]},marketing:{value:!1,error_type:"",error_message:"",validations:[]}}),M({active:!1,socialType:"",socialId:""}),T({activeTab:"ordertype"})),className:"hover:opacity-60",children:"SKIP"}),(0,l.jsx)("button",{type:"submit",onClick:e=>el(e),className:"bg-secondary text-white rounded h-[36px] w-[200px]",children:"JOIN"})]})]})]}):(0,l.jsxs)("div",{className:"flex flex-row justify-between items-center mt-2",children:[(0,l.jsx)("span",{href:"#",onClick:e=>{e.preventDefault(),T({activeTab:"ordertype"})},className:"cursor-pointer hover:opacity-60",children:"SKIP"}),(0,l.jsx)("button",{onClick:()=>B(!0),className:"secondary-bg text-white hover:opacity-60 rounded w-[200px] h-[36px]",children:"JOIN MANUALLY"})]})]})]})}):(0,l.jsxs)("div",{className:" border-2 border-theme-border-color bg-white rounded-lg flex justify-between items-center px-4 py-3 h-[45px]",children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)("h4",{className:"mr-3 text-[18px] font-bold",children:"Reward"}),"reward"!=C.activeTab?(0,l.jsx)("div",{className:"",children:(0,l.jsx)(t.G,{icon:i.LEp,className:"h-[25px] text-[#27AE60]"})}):null]}),"reward"!=C.activeTab?(0,l.jsx)("button",{onClick:()=>T({activeTab:"reward"}),className:"secondary-text text-[15px] font-medium tracking-tight hover:opacity-60 uppercase",children:"Edit"}):null]}
1),H.isActive?(0,l.jsx)(O.Z,{business:a,location:r,cartDetail:L,confirmation:H,setPopup:()=>void 0,backAction:function(){Q({isActive:!1,message:"",authCodeToken:"",email:""})},hideAction:!0}):null]})}}}]);
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.