PageSourceSearch

https://appcasacor.com.br/_next/static/chunks/pages/events/[slug]/gift-card-aeffa8a6fdd35228.js

js appcasacor.com.br collected 2026-10-02 03:41:29 UTC 35,656 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9233],{76149:function(e,a,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/events/[slug]/gift-card",function(){return t(65640)}])},77872:function(e,a,t){"use strict";t.d(a,{Z:function(){return v}});var r=t(85893);t(67294);var n=t(54109),l=t(23599),i=t(94054),o=t(18360),d=t(98456),s=t(93946),c=t(56815),u=t(95537);function v(e){let{label:a,options:t,value:v="",onChange:m,className:p,error:x,errorMessage:g,multiple:f,renderValue:h,selectProps:y={},disabled:b,name:N,cleanable:D,isLoading:j}=e,C=(e,a)=>{let t=e.target.value;"string"==typeof t||"number"==typeof t?m(f?t.split(","):t):m(t)};return(0,r.jsxs)(i.Z,{fullWidth:!0,className:"basic-select "+p,disabled:b,children:[(0,r.jsx)(n.Z,{id:"basic-select",children:a}),(0,r.jsx)(o.Z,{labelId:"basic-select",id:"select",value:f?v||[]:null==v?void 0:v.toString(),label:a,name:N,onChange:C,error:x,multiple:f,renderValue:h||void 0,...y,children:j?(0,r.jsxs)(l.Z,{children:[(0,r.jsx)(d.Z,{size:20,sx:{marginRight:1}}),(0,r.jsx)("span",{children:"Carregando..."})]}):t.map(e=>"string"==typeof e||"number"==typeof e?(0,r.jsx)(l.Z,{value:e,children:e},e):(0,r.jsx)(l.Z,{value:e.value,disabled:!!e.disabled,children:e.label},e.value))}),D&&!!v&&(0,r.jsx)(s.Z,{className:"clean-btn",onClick:function(){m()},children:(0,r.jsx)(u.Z,{})}),!!g&&(0,r.jsx)(c.Z,{error:!0,children:g})]})}},96013:function(e,a,t){"use strict";var r=t(85893),n=t(67294),l=t(89755),i=t.n(l),o=t(45332);let d=e=>{let{src:a,...t}=e,[l,d]=(0,n.useState)((0,o.e6)(a));return n.useEffect(()=>{d((0,o.e6)(a))},[a]),(0,r.jsx)(i(),{src:l,alt:"",placeholder:"blur",className:"placeholder image-with-fallback",draggable:!1,objectFit:"contain",blurDataURL:o.LG,unoptimized:"/placeholder.png"===l,onError:()=>{d("/placeholder.png")},...t})};a.Z=d},32101:function(e,a,t){"use strict";var r=t(85893),n=t(50135),l=t(67294);let i=e=>{var a;let{...t}=e,i=(0,l.useRef)((null===(a=t.value)||void 0===a?void 0:a.toString())||""),o={};return t.onValueChange&&(o.onChange=e=>{e.stopPropagation(),t.onValueChange&&t.onValueChange(e.target.value)}),t.onBlur&&(o.onBlur=()=>{let e=i.current.value;e="string"==typeof e?null==e?void 0:e.trim():e,t.onValueChange&&t.onValueChange(e),t.onBlur&&t.onBlur(e)}),l.useEffect(()=>{t.defaultValue&&(i.current.value=t.defaultValue)},[t.defaultValue]),(0,r.jsx)(n.Z,{inputRef:i,className:"textfield",autoComplete:"off",...t,...o})};a.Z=i},65640:function(e,a,t){"use strict";t.r(a),t.d(a,{__N_SSP:function(){return $},default:function(){return ee}});var r=t(85893),n=t(67294),l=t(89834),i=t(34768),o=t(11163),d=t(77058),s=t(32101),c=t(98456),u=t(50480),v=t(45843),m=t(83321),p=t(68061),x=t(36872),g=t(93946),f=t(45332),h=t(39332),y=t(72132),b=t(58467),N=t(21313),D=t(69697),j=t(87168),C=t(504);function I(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.trim().replace(/\D+/g,"")}let E={INVALID_NUMBER:"N\xfamero cart\xe3o inv\xe1lido.",INVALID_SECURITY_CODE:"C\xf3digo de seguran\xe7a inv\xe1lido. Voc\xea deve passar 3, 4 d\xedgitos.",INVALID_EXPIRATION_MONTH:"Data de validade do cart\xe3o inv\xe1lida.",INVALID_EXPIRATION_YEAR:"Data de validade do cart\xe3o inv\xe1lida.",INVALID_PUBLIC_KEY:"Chave p\xfablica inv\xe1lida.",INVALID_HOLDER:"Nome impresso no cart\xe3o inv\xe1lido."};var w=t(39759),S=t(46870);let A=()=>{let e=(0,h.useSearchParams)(),a=e.get("orderId"),{toggleLoader:t}=(0,N.U2)(),[r,l]=n.useState("pix"),[i,o]=n.useState(),[d,s]=n.useState({name:"",number:"",expiry:"",cvc:"",installments:""}),[c,u]=n.useState([]),[v,m]=n.useState(""),[p,x]=n.useState({}),[g,I]=n.useState({eventId:"",type:"B2C",payerInfo:{},paymentMethod:"pix",channel:"website",encryptedCard:void 0,installments:1,recaptchaToken:"",givexGiftCardDatas:[{orderSender:"",customerName:"",orderTotal:0}],userTimezoneOffset:180}),[A,P]=n.useState("");n.useEffect(()=>{console.log("\uD83D\uDE80 ~ React.useEffect ~ orderId:",a),a&&(async()=>{try{var e,t,r,n,l,i,d,s,c,u,v,m,p,x,g,f,h,y,N;let D=await (0,b.ZP)("/givex/order-payment?orderId=".concat(a));if(console.log("\uD83D\uDE80 ~ res:",D),D.data.error)throw Error(D.data.error.message);((null==D?void 0:null===(e=D.data)||void 0===e?void 0:e.paymentStatus)==="PAID"&&(null==D?void 0:null===(t=D.data)||void 0===t?void 0:t.paymentMethod.includes("credit_card"))||(null==D?void 0:null===(r=D.data)||void 0===r?void 0:r.paymentMethod)==="pix")&&o({orderId:null==D?void 0:null===(n=D.data)||void 0===n?void 0:n.orderId,paymentMethod:null==D?void 0:null===(l=D.data)||void 0===l?void 0:l.paymentMethod,paymentStatus:null==D?void 0:null===(i=D.data)||void 0===i?void 0:i.paymentStatus,givexGiftCardDatas:null==D?void 0:null===(d=D.data)||void 0===d?void 0:d.givexGiftCardDatas,givexStatus:null==D?void 0:null===(s=D.data)||void 0===s?void 0:s.givexStatus,payerEmail:null==D?void 0:null===(c=D.data)||void 0===c?void 0:c.payerEmail,qrCode:(null==D?void 0:null===(u=D.data)||void 0===u?void 0:u.qrCode)?{id:null==D?void 0:null===(v=D.data)||void 0===v?void 0:null===(m=v.qrCode)||void 0===m?void 0:m.id,code:null==D?void 0:null===(p=D.data)||void 0===p?void 0:null===(x=p.qrCode)||void 0===x?void 0:x.text,image:null===(g=null==D?void 0:null===(f=D.data)||void 0===f?void 0:null===(h=f.qrCode)||void 0===h?void 0:h.links[0])||void 0===g?void 0:g.href,expiration:null==D?void 0:null===(y=D.data)||void 0===y?void 0:null===(N=y.qrCode)||void 0===N?void 0:N.expiration_date}:void 0})}catch(e){}})()},[a]),n.useEffect(()=>{if(r.includes("credit_card")){var e;let a=null===(e=d.number)||void 0===e?void 0:e.replace(/\D/g,""),t=null==a?void 0:a.slice(0,6),r=async()=>{try{var e,a;m("processing");let r=await (0,b.ZP)("/payment/credit-card-installments?eventId=".concat(A,"&cartTotalValue=").concat(Number((null==g?void 0:null===(e=g.givexGiftCardDatas)||void 0===e?void 0:e.reduce((e,a)=>e+a.orderTotal,0))||0),"&creditCardBin=").concat(t));if(r.data.error)throw Error(r.data.error.message);u(null===(a=r.data)||void 0===a?void 0:a.installments.installment_plans.map(e=>({label:"".concat(e.installments," x ").concat((0,C.n)(e.installment_value/100)," = ").concat((0,C.n)(e.amount.value/100)),value:JSON.stringify(e)}))),m("success")}catch(e){u([]),m("error"),y.Am.error(e.message)}};r()}},[g,r,d.number]);let T=async()=>{let e;t(!0);let a=g,n={};x(n);let{name:l,email:i,docNumber:o,address:s,celphone:c}=(null==g?void 0:g.payerInfo)||{},u="Campo obrigat\xf3rio",v="Campo inv\xe1lido";for(let e of(console.log("\uD83D\uDE80 ~ getOrderDetails ~ data:",a),(null==g?void 0:g.givexGiftCardDatas)||[])){let{orderSender:a,customerName:t,orderTotal:r}=e||{};a||(n.orderSender=u),t||(n.customerName=u),r||(n.orderTotal=u)}if(l||(n.name=u),i||(n.email=u),i&&!(0,f.oH)(i)&&(n.email=v),c||(n.celphone=u),o||(n.docNumber=u),!o||D.wn.isValid(o)||D.s3.isValid(o)||(n.docNumber=v),(null==s?void 0:s.zip)||
1(n.zip=u),null==s?void 0:s.zip){let e=await fetch("https://viacep.com.br/ws/"+s.zip+"/json/");console.log(s.zip),console.log(e);let t=await e.json();t.erro?n.zip=v:a.address={...null==a?void 0:a.payerInfo.address,street:t.logradouro,district:t.bairro,city:t.localidade,state:t.uf}}if(Object.keys(n).length){x(n),t(),y.Am.error("Formul\xe1rio incompleto!");return}if(r.includes("credit_card")){if(d.name||(n.cardName=u),d.number||(n.cardNumber=u),d.number&&!(d.number.length>=18)&&(n.cardNumber=v),d.expiry||(n.cardExpiry=u),d.expiry&&(h=d.expiry,!/^(0[1-9]|1[0-2])[/](\d{4})/.test(h))&&(n.cardExpiry=v),d.cvc||(n.cardCvc=u),d.cvc&&(N=d.cvc,!/\d{3,4}/.test(N))&&(n.cardCvc=v),d.installments||(n.cardInstallments=u),Object.keys(n).length){x(n),y.Am.error("Dados do cartāo de cr\xe9dito incompletos!");return}let[a,t]=d.expiry.split("/"),{data:r}=await b.ZP.get("/gateway-payment/active");if(console.log("\uD83D\uDE80 ~ submitCreditCardOrder ~ activeGatewayPayment:",r),"PAGSEGURO"===r.codename){var m,p,h,N,j,C,I=window.PagSeguro.encryptCard({publicKey:"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwnj1S7T31mlq4C0KSmenGAJYYl+KfB2MIeqaG97+ayTaEJGx3b37GhMnX9HhhaJB821FTNUn95i279uS5gFqc7RNQ/urmK9lGw+mr6l734A+h6d9apuJAvH3QoH/br8lUE1Z6bMCn1D371Z+/8zCrswUzTB4p+W+KfhZQg0pkmI1fRTso9Bjftwsb9PJ9O7sHGLS4AxTWWHis2iG1ZfIkVJPdxfw1s7oRDziLAUqPctui9k1rlu3Xuwf5yuEo9dFymMaGpMynXbdJoIEHLtQlJZ2MKQXbEmifMg5M+sHaspo7ORrK/VI9RS7g49/NLsr9GVSJ49Ghgefu81/doAiewIDAQAB",holder:d.name,number:d.number.toString().replace(/\s/g,""),expMonth:a,expYear:t,securityCode:d.cvc});e=I.encryptedCard;var{hasErrors:P,errors:T}=I;if(P){let e=[];
1if(T.map(a=>{e.push(E[a.code])}),e.length){x({}),y.Am.error(e.join("\n "));return}}}if("PAGARME"===r.codename){let r={type:"card",card:{number:null==d?void 0:null===(j=d.number)||void 0===j?void 0:null===(C=j.replace)||void 0===C?void 0:C.call(j,/ /g,""),holder_name:d.name,exp_month:Number(a),exp_year:Number(t),cvv:d.cvc}};console.log("\uD83D\uDE80 ~ submitCreditCardOrder ~ requestBody ~ PAGARME:",r);let{data:n}=await w.Z.post("/tokens?appId=".concat("pk_PYgL1wBcEwF4y07N"),r);console.log("\uD83D\uDE80 ~ submitCreditCardOrder ~ data ~ PAGARME:",n),e=n.id}}let G={eventId:A,type:"B2C",encryptedCard:e,recaptchaToken:"",givexGiftCardDatas:null==a?void 0:a.givexGiftCardDatas,payerInfo:{...null==a?void 0:a.payerInfo,name:l,email:i,address:null==a?void 0:a.address,docType:(null===(m=null==a?void 0:a.payerInfo.docNumber)||void 0===m?void 0:m.replace(/\D/g,"").length)===11?"CPF":"CNPJ",celphone:(0,f.un)((null==c?void 0:c.toString())||" "),docNumber:(null==a?void 0:a.payerInfo.docNumber)||""},installments:r.includes("credit_card")?Number((null==d?void 0:null===(p=d.installments)||void 0===p?void 0:p.installments)||1):1,paymentMethod:r.includes("credit_card")?"credit_card":r,channel:"website",userTimezoneOffset:(0,S.Y5)()};return console.log("\uD83D\uDE80 ~ getOrderDetails ~ order:",G),G};async function G(){try{let e=await T();if(console.log("\uD83D\uDE80 ~ submitPayment ~ orderDetails:",e),!e)return t();let a=null==window?void 0:window.grecaptcha;null==a||a.enterprise.ready(function(){a.enterprise.execute("6LdtN0orAAAAAEfpIYpKcvdS-7Y08IHLfmDo6Mmm",{action:"submit"}).then(async a=>{let n={...e,recaptchaToken:a};try{var l,i,d,s,c,u,v,m,p,x,g,f,h,N,D,C;t(!0,"Processando transa\xe7\xe3o");let e=await b.ZP.post("/givex/order-create-card",n);t();let{error:a}=e.data;if(null==a?void 0:a.message)return y.Am.error(a.message);if("string"==typeof a)return y.Am.error(a);localStorage.setItem(j.Ue,null==e?void 0:null===(l=e.data)||void 0===l?void 0:l.orderId),console.log("\uD83D\uDE80 ~ .then ~ res.data",null==e?void 0:e.data),o({orderId:null==e?void 0:null===(i=e.data)||void 0===i?void 0:i.orderId,paymentMethod:r.includes("credit_card")?"credit_card":r,paymentStatus:null==e?void 0:null===(d=e.data)||void 0===d?void 0:d.paymentStatus,givexStatus:null==e?void 0:null===(s=e.data)||void 0===s?void 0:s.givexStatus,givexGiftCardDatas:null==e?void 0:null===(c=e.data)||void 0===c?void 0:c.givexGiftCardDatas,payerEmail:null==e?void 0:null===(u=e.data)||void 0===u?void 0:u.payerEmail,qrCode:(null==e?void 0:null===(v=e.data)||void 0===v?void 0:v.qrCode)?{id:null==e?void 0:null===(m=e.data)||void 0===m?void 0:null===(p=m.qrCode)||void 0===p?void 0:p.id,code:null==e?void 0:null===(x=e.data)||void 0===x?void 0:null===(g=x.qrCode)||void 0===g?void 0:g.text,image:null===(f=null==e?void 0:null===(h=e.data)||void 0===h?void 0:null===(N=h.qrCode)||void 0===N?void 0:N.links[0])||void 0===f?void 0:f.href,expiration:null==e?void 0:null===(D=e.data)||void 0===D?void 0:null===(C=D.qrCode)||void 0===C?void 0:C.expiration_date}:void 0})}catch(e){console.log("\uD83D\uDE80 ~ submitPayment ~ err:",e),t(),y.Am.error(e.message)}})})}catch(e){console.log("\uD83D\uDE80 ~ submitPayment ~ err:",e),t(),y.Am.error(e.message)}}return{paymentMethod:r,setPaymentMethod:l,successPaymentData:i,cardData:d,setCardData:e=>s(a=>({...a,...e})),errors:p,setErrors:x,cardInstallments:c,processingCardState:v,setProcessingCardState:m,setPaymentData:I,setEventId:P,paymentData:g,submitPayment:G}};var P=t(77872),T=t(96013),G=t(46761),Z=t(95537),_=t(62026),M=t(70983),R=t(15567),O=t(801),V=t(4298),k=t.n(V);let L=e=>{let a=(0,o.useRouter)(),{orderId:t,paymentStatus:l,paymentMethod:i,pageHeaderImage:d,givexGiftCardDatas:s}=e,c=["AUTHORIZED","PAID"].includes(l);return n.useEffect(()=>{let e={...a.query,orderId:t};(null==i?void 0:i.includes("credit_card"))&&Object.assign(e,{ccredit:!0}),c&&Object.assign(e,{"success-payment":!0}),a.push({pathname:a.pathname,query:e},void 0,{shallow:!0})},[a,c,i]),(0,r.jsxs)("div",{className:"givex-giftcard",children:[(0,r.jsx)("div",{className:"header",style:{backgroundImage:"url(".concat((0,f.e6)(null==d?void 0:d.image),")")}}),(0,r.jsxs)("div",{className:"success-payment fade-in-animation",children:[(0,r.jsx)(k(),{id:"gtm",strategy:"afterInteractive",children:"\n            (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n            new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n            j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n            'https://www.googletagmanager.com/gtm.js?id='
1+i+dl;f.parentNode.insertBefore(j,f);\n            })(window,document,'script','dataLayer','GTM-P3WSWMX');\n          "}),(0,r.jsx)("noscript",{dangerouslySetInnerHTML:{__html:'<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-P3WSWMX" height="0" width="0" style="display: none; visibility: hidden;" />'}}),c?(0,r.jsx)(O.sB,{viewBox:"0 0 100 100"}):(0,r.jsx)(O.AT,{viewBox:"0 0 100 100"}),(0,r.jsx)("label",{children:c?"Compra finalizada com sucesso!":"Aguardando aprova\xe7\xe3o!"}),(0,r.jsx)("p",{children:"Pagamento confirmado, o(s) email(s) informado(s) ".concat(s.map(e=>{let{orderSender:a}=e;return a}).join(", ")," para receber o cart\xe3o de presente,\n          cada um receber\xe1 um email da GIVEX com o n\xfamero e o pin do cart\xe3o,\n          use o aplicativo CASACOR para resgatar o cart\xe3o.\n          Por favor, fique atento(a) a caixa de spam do e-mail\n          cadastrado na compra.")})]})]})};var z=t(60845);let B=(e,a)=>{let[t,r]=n.useState("WAITING_PAYMENT"),{toggleLoader:l}=(0,N.U2)(),i=()=>{navigator.clipboard.writeText(a),y.Am.success("Pix copiado!")};async function o(e){try{l(!0,"Pagando pix");let a=await b.ZP.post("/payment/simulate-pix-payment",{qrCodeId:e});l();let{error:t}=a.data;if(t)throw Error(JSON.stringify(t))}catch(e){l(),console.log(JSON.stringify(e,null,2)),y.Am.error(e.message)}}return{copyQrCode:i,onPaymentStatusChange:r,paymentStatus:t,simulatePayment:o}},X=()=>{let e=(0,h.useSearchParams)(),a=e.get("orderId"),[t,r]=(0,n.useState)({});return n.useEffect(()=>{let e=setInterval(async()=>{var t,n;let l=await (0,b.ZP)("/givex/order-payment-status?orderId=".concat(a,"&date=").concat(new Date));console.log("\uD83D\uDE80 ~ timer ~ data:",l.data),r(l.data),(null==l?void 0:null===(t=l.data)||void 0===t?void 0:t.paymentStatus)!=="WAITING_PAYMENT"&&(null==l?void 0:null===(n=l.data)||void 0===n?void 0:n.paymentStatus)!=="IN_ANALYSIS"&&clearInterval(e)},1e4);return()=>{e&&clearInterval(e)}},[a]),{paymentStatus:t.paymentStatus,amount:t.amount,orderId:a,qrCode:t.qrCode,paymentMethod:t.paymentMethod,givexGiftCardDatas:t.givexGiftCardDatas,payerEmail:t.payerEmail,transaction:t.transaction}};var q=t(83454);let U=e=>{var a;let t=(0,o.useRouter)(),{qrCode:l,orderId:i,paymentMethod:d,email:s,orderTotal:c,givexGiftCardDatas:u,pageHeaderImage:v}=e,{t:p}=(0,z.$G)("common"),{copyQrCode:x,simulatePayment:h}=B(null==l?void 0:l.id,null==l?void 0:l.code),{paymentStatus:y,amount:b,givexGiftCardDatas:N}=X(),D=c||b?(0,f.fe)(c||b):"",j=(null===(a=u||N)||void 0===a?void 0:a.length)&&"".concat((u||N).length," X Cart\xe3o Presente");return(n.useEffect(()=>{let e={...t.query,orderId:i};t.push({pathname:t.pathname,query:e},void 0,{shallow:!0})},[t,d]),"AUTHORIZED"===y||"PAID"===y)?(0,r.jsx)(L,{orderId:i,paymentMethod:"pix",paymentStatus:y,pageHeaderImage:v,givexGiftCardDatas:u||N,email:s}):(0,r.jsxs)("div",{className:"givex-giftcard",children:[(0,r.jsx)("div",{className:"header",style:{backgroundImage:"url(".concat((0,f.e6)(null==v?void 0:v.image),")")}}),(0,r.jsxs)("div",{className:"pix-payment content-wrapper",children:[(0,r.jsx)(k(),{id:"gtm",strategy:"afterInteractive",children:"\n            (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n            new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n            j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n            'https://www.googletagmanager.com/gtm.js?id='
1+i+dl;f.parentNode.insertBefore(j,f);\n            })(window,document,'script','dataLayer','GTM-P3WSWMX');\n          "}),(0,r.jsx)("noscript",{dangerouslySetInnerHTML:{__html:'<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-P3WSWMX" height="0" width="0" style="display: none; visibility: hidden;" />'}}),(0,r.jsx)("div",{className:"content",children:"DECLINED"===y||"CANCELED"===y||"PIX_EXPIRED"===y?(0,r.jsxs)("div",{className:"expired-screen",children:[(0,r.jsx)(O.AT,{viewBox:"0 0 100 100"}),(0,r.jsx)("label",{children:"PIX_EXPIRED"===y?"Tempo expirado!":"Pagamento cancelado!"}),(0,r.jsx)("p",{children:"PIX_EXPIRED"===y?"O tempo do seu c\xf3digo do PIX foi expirado. Por favor volte a etapa anterior e gere um novo c\xf3digo para finalizar a compra.":"Seu PIX foi cancelado. Por favor volte a etapa anterior e gere um novo c\xf3digo para finalizar a compra."}),(0,r.jsx)(m.Z,{className:"btn-primary",children:"Voltar para o in\xedcio"})]}):(0,r.jsxs)("div",{className:"pix-container",children:[(0,r.jsxs)("div",{className:"expire",children:[(0,r.jsx)(O.zM,{}),"Voc\xea tem 10 minutos para concluir esta compra. O c\xf3digo ser\xe1 expirado ap\xf3s este per\xedodo."]}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{className:"col",children:[(0,r.jsx)("div",{className:"title",children:"Instru\xe7\xf5es para pagamento:"}),(0,r.jsx)("div",{className:"subtitle",children:p("event.code_reading")}),(0,r.jsx)("div",{children:p("event.step-one")}),(0,r.jsx)("div",{children:p("event.step-two")}),(0,r.jsx)("div",{children:p("event.step-three")}),(0,r.jsx)("div",{className:"subtitle",children:p("event.important")}),(0,r.jsx)("div",{children:p("event.payment_not_time")}),(0,r.jsx)("div",{children:p("event.after_payment")})]}),(0,r.jsxs)("div",{className:"col",children:[(0,r.jsx)("img",{className:"qrcode",src:null==l?void 0:l.image,alt:""}),(0,r.jsxs)("div",{className:"expire-at",children:["Expira \xe0s: ",(0,S.p6)(null==l?void 0:l.expiration,"Pp")]}),(0,r.jsxs)("div",{className:"social",children:["Favorecido: CASA COR PROMOCOES E COMERCIAL LTDA",(0,r.jsxs)("div",{className:"paymentInfo",children:[(0,r.jsx)("div",{children:j}),(0,r.jsxs)("div",{children:["Total: ",(0,r.jsx)("b",{children:D})]})]})]}),(0,r.jsxs)("div",{className:"field-code",children:[(0,r.jsx)("div",{className:"code",children:null==l?void 0:l.code}),(0,r.jsx)(g.Z,{onClick:x,children:(0,r.jsx)(O.TI,{})})]}),"development"===q.env.NEXT_PUBLIC_MODE&&(0,r.jsx)(m.Z,{onClick:()=>h(l.id),className:"simulate-pix-btn",children:"Simular pagamento"})]})]})]})})]})]})};var H=t(9336);let J={pix:"PIX",credit_card:"Cart\xe3o de cr\xe9dito"},Y=[{label:"R$ 25",value:2500},{label:"R$ 50",value:5e3},{label:"R$ 100",value:1e4},{label:"R$ 200",value:2e4}],F=e=>{var a,t,h,y,b,N,D,j,C,E,w,S,O,V,k;let{event:z}=e,{errors:B,setErrors:X,successPaymentData:q,paymentMethod:F,setPaymentMethod:W,cardData:K,setCardData:Q,cardInstallments:$,processingCardState:ee,setProcessingCardState:ea,setPaymentData:et,paymentData:er,setEventId:en,submitPayment:el}=A(),ei=(0,o.useRouter)(),{t:eo}=(0,d.$)("common"),[ed,es]=n.useState(!1),[ec,eu]=n.useState(!1),{id:ev,pageHeaderImage:em,givexPageCardBanner:ep,givexPageHeaderBanner:ex,givexPageTextInfoB2C:eg,image:ef}=z||{};console.log("\uD83D\uDE80 ~ GixvexGiftCard ~ event:",z);let eh=()=>{ei.push("/")};function ey(e){et(a=>({...a,...e}))}let eb=(0,n.useCallback)(e=>{(async()=>{ey({...er,payerInfo:{...null==er?void 0:er.payerInfo,address:{zip:(0,f.Se)(e),city:"",state:"",street:"",district:""}}});let a=e.replace(/[^\d]+/g,"");if(a.length>=8){es(!0);let a=await (0,H.G)(e);X(e=>({...e,zip:"not_found"===a.street?"Endere\xe7o n\xe3o encontrado":""})),ey({...er,payerInfo:{...null==er?void 0:er.payerInfo,address:{...null==er?void 0:er.payerInfo.address,...a}}}),es(!1)}})()},[null==er?void 0:er.payerInfo]);return(n.useEffect(()=>{ev&&en(ev)},[ev]),q&&q.paymentMethod.includes("credit_card"))?(0,r.jsx)(L,{orderId:null==q?void 0:q.orderId,paymentStatus:q.paymentStatus,paymentMethod:q.paymentMethod,givexGiftCardDatas:null==q?void 0:q.givexGiftCardDatas,pageHeaderImage:ex?{image:ex}:em,email:null==q?void 0:q.payerEmail}):q&&"pix"===q.paymentMethod?(0,r.jsx)(U,{orderId:null==q?void 0:q.orderId,orderTotal:Number((null==q?void 0:null===(V=q.givexGiftCardDatas)||void 0===V?void 0:null===(k=V.reduce)||void 0===k?void 0:k.call(V,(e,a)=>e+a.orderTotal,0))||0),givexGiftCardData:null==q?void 0:q.givexGiftCardDatas,pageHeaderImage:ex?{image:ex}:em,email:null==q?void 0:q.payerEmail,qrCode:null==q?void 0:q.qrCode}):(0,r.jsxs)("div",{className:"givex-giftcard",children:[(0,r.jsx)("div",{className:"header",style:{backgroundImage:"url(".concat((0,f.e6)(ex||(null==em?void 0:em.image)),")")}}),(0,r.jsxs)("div",{className:"giftcard-payment content-wrapper",children:[(0,r.jsx)("h3",{children:"Gift Card"}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("section",{children:(0,r.jsx)("div",{className:"cover-image",children:(0,r.jsx)(T.Z,{src:(0,f.e6)(ep||ef),layout:"fill"})})}),(0,r.jsx)("section",{})]}),(0,r.jsx)("h3",{children:"Pagamento"}),(0,r.jsxs)("div",{className:"content",children:[(0,r.jsxs)("div",{className:"col",children:[(0,r.jsx)("div",{className:"label",children:"Informa\xe7\xf5es do Comprador"}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("div",{className:"title",children:"Comprador"}),(0,r.jsx)(s.Z,{sx:{mb:3},label:"Nome completo*",value:(null==er?void 0:null===(a=er.payerInfo)||void 0===a?void 0:a.name)||"",onValueChange:e=>ey({...er,payerInfo:{...null==er?void 0:er.payerInfo,name:e}}),error:B.name,helperText:B.name}),(0,r.jsx)(s.Z,{sx:{mb:3},label:"Email*",type:"email",value:(null==er?void 0:null===(t=er.payerInfo)||void 0===t?void 0:t.email)||"",onValueChange:e=>ey({...er,payerInfo:{...null==er?void 0:er.payerInfo,email:e}}),error:!!B.email,helperText:B.email}),(0,r.jsx)(s.Z,{sx:{mb:3},label:"CPF/CNPJ*",value:(null==er?void 0:null===(h=er.payerInfo)||void 0===h?void 0:h.docNumber)||"",onValueChange:e=>ey({...er,payerInfo:{...null==er?void 0:er.payerInfo,docNumber:(0,f.i6)(e)}}),error:!!B.docNumber,helperText:B.docNumber}),(0,r.jsx)(s.Z,{sx:{mb:3},label:"Celular",value:(null==er?void 0:null===(y=er.payerInfo)||void 0===y?void 0:y.celphone)||"",onValueChange:e=>ey({...er,payerInfo:{...null==er?void 0:er.payerInfo,celphone:(0,f.un)(e)}}),error:!!B.celphone,helperText:B.celphone}),(0,r.jsx)(s.Z,{sx:{mb:3},label:"CEP*",value:(null==er?void 0:null===(b=er.payerInfo)||void 0===b?void 0:null===(N=b.address)||void 0===N?void 0:N.zip)||"",onValueChange:eb,error:!!B.zip,helperText:B.zip}),ed?(0,r.jsxs)("div",{children:[(0,r.jsx)(c.Z,{size:16,sx:{mr:2}}),"Buscando endere\xe7o ..."]}):(0,r.jsx)("div",{children:(0,f.hk)(null==er?void 0:null===(D=er.payerInfo)||void 0===D?void 0:D.address)})]})]}),(0,r.jsxs)("div",{className:"col",children:[(0,r.jsx)("div",{className:"label",children:"Para quem s\xe9ra enviado o cart\xe3o presente"}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("div",{className:"title",children:"Recebedor do cart\xe3o presente"}),er.givexGiftCardDatas.length<10&&(0,r.jsx)(u.Z,{label:"O mesmo do comprador",className:"switch",control:(0,r.jsx)(v.Z,{checked:ec,onChange:e=>{var a,t,r,n,l;eu(e.target.checked),e.target.checked?ey({...er,givexGiftCardDatas:[{customerName:null==er?void 0:null===(a=er.payerInfo)||void 0===a?void 0:a.name,orderSender:null==er?void 0:null===(t=er.payerInfo)||void 0===t?void 0:t.email,orderTotal:0},...(null==er?void 0:null===(r=er.givexGiftCardDatas)||void 0===r?void 0:r.length)<=1?[]:(null==er?void 0:er.givexGiftCardDatas)||[]]}):ey({...er,givexGiftCardDatas:(null==er?void 0:null===(n=er.givexGiftCardDatas)||void 0===n?void 0:n.length)<=1?[{customerName:"",orderSender:"",orderTotal:0}]:(null==er?void 0:null===(l=er.givexGiftCardDatas)||void 0===l?void 0:l.filter(e=>{var a;let{orderSender:t}=e;return(null==er?void 0:null===(a=er.payerInfo)||void 0===a?void 0:a.email)!==t}))||[]})}})}),er.givexGiftCardDatas.filter((e,a)=>a<10).map((e,a)=>(0,r.jsxs)("div",{className:"form",children:[(0,r.jsx)(s.Z,{sx:{mb:3},label:"* "+eo("givexgiftcard.orderSendToEmail"),value:(null==e?void 0:e.orderSender)||"",onValueChange:e=>ey({...er,givexGiftCardDatas:er.givexGiftCardDatas.map((t,r)=>r===a?{...t,orderSender:e}:t)}),error:!!B.orderSender&&!(null==e?void 0:e.orderSender),helperText:(null==e?void 0:e.orderSender)?""
1:B.orderSender}),(0,r.jsx)(s.Z,{sx:{mb:3},label:"* "+eo("givexgiftcard.customerName"),value:(null==e?void 0:e.customerName)||"",onValueChange:e=>ey({...er,givexGiftCardDatas:er.givexGiftCardDatas.map((t,r)=>r===a?{...t,customerName:e}:t)}),error:!!B.customerName&&!(null==e?void 0:e.customerName),helperText:(null==e?void 0:e.customerName)?"":B.customerName}),(0,r.jsx)("div",{className:"price-container",children:Y.map(t=>(0,r.jsx)(m.Z,{className:"btn btn-primary ".concat(e.orderTotal===t.value?"active":""),onClick:()=>ey({...er,givexGiftCardDatas:er.givexGiftCardDatas.map((e,r)=>r===a?{...e,orderTotal:t.value}:e)}),children:"".concat(t.label)},t.value))}),a>0&&(0,r.jsx)("div",{className:"delete",children:(0,r.jsxs)(m.Z,{className:"btn-primary btn-delete",onClick:()=>ey({...er,givexGiftCardDatas:er.givexGiftCardDatas.filter((e,t)=>t!==a)}),children:[(0,r.jsx)(G.Z,{}),"Remover"]})})]},"givex-giftcard-data-".concat(a))),er.givexGiftCardDatas.length<10?(0,r.jsx)(m.Z,{className:"btn-primary",variant:"contained",onClick:()=>ey({...er,givexGiftCardDatas:[...null==er?void 0:er.givexGiftCardDatas,{customerName:"",orderSender:"",orderTotal:0}]}),children:(0,r.jsx)("h5",{children:"Adicionar mais Cart\xf5es"})}):(0,r.jsx)("p",{children:"Limite m\xe1ximo de 10 cart\xf5es por compra"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"label",children:"Pagamento"}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("div",{className:"title",children:"M\xe9todo de Pagamento"}),(0,r.jsx)("div",{className:"form",children:(0,r.jsx)(p.Z,{value:F,onChange:e=>W(e.target.value),style:{alignItems:"flex-start"},children:null==Object?void 0:null===(j=Object.keys)||void 0===j?void 0:null===(C=j.call(Object,J))||void 0===C?void 0:C.sort((e,a)=>e>a?-1:1).map(e=>(0,r.jsx)(u.Z,{value:e,control:(0,r.jsx)(x.Z,{}),label:J[e]},e))})}),"credit_card"===F&&(0,r.jsxs)("div",{className:"form",children:[(0,r.jsx)("div",{className:"title",children:"Informe os dados do Cart\xe3o"}),(0,r.jsx)(s.Z,{sx:{mb:3},label:"* N\xfamero cart\xe3o",className:"textfield",value:K.number,onValueChange:e=>{let a;return Q({number:(a=(a=I(e)).length>12?"".concat(a.slice(0,4)," ").concat(a.slice(4,8)," ").concat(a.slice(8,12)," ").concat(a.slice(12,16)):a.length>8?"".concat(a.slice(0,4)," ").concat(a.slice(4,8)," ").concat(a.slice(8,12)):a.length>4?"".concat(a.slice(0,4)," ").concat(a.slice(4,8)):"".concat(a.slice(0,4))).slice(0,19)})},error:!!B.cardNumber||"error"===ee,helperText:B.cardNumber,InputProps:{endAdornment:"processing"===ee?(0,r.jsx)(c.Z,{}):"error"===ee?(0,r.jsx)(g.Z,{onClick:()=>{Q({number:""}),ea("")},children:(0,r.jsx)(Z.Z,{})}):"success"===ee?(0,r.jsx)(_.Z,{}):null}}),(0,r.jsx)(s.Z,{sx:{mb:3},label:"Nome impresso no cart\xe3o",className:"textfield",value:K.name,onValueChange:e=>Q({name:e}),error:!!B.cardName,helperText:B.cardName}),(0,r.jsx)(s.Z,{sx:{mb:3},label:"Validade",className:"textfield",value:K.expiry,onValueChange:e=>{let a;return Q({expiry:((a=I(e)).length>=3&&(a="".concat(a.slice(0,2),"/").concat(a.slice(2))),a.slice(0,7))})},error:!!B.cardExpiry,helperText:B.cardExpiry,placeholder:"XX/XXXX"}),(0,r.jsx)(s.Z,{sx:{mb:3},label:"CVC",className:"textfield",value:K.cvc,onValueChange:e=>Q({cvc:function(e){let a=I(e);return a.slice(0,4)}(e)}),error:!!B.cardCvc,helperText:B.cardCvc}),(0,r.jsx)(P.Z,{label:"Parcelamento",options:$,value:K.installments||"",onChange:e=>Q({installments:e}),error:!!B.cardInstallments,errorMessage:B.cardInstallments,disabled:!$.length})]}),(0,r.jsx)("div",{children:((null==er?void 0:null===(E=er.givexGiftCardDatas)||void 0===E?void 0:null===(w=E.reduce)||void 0===w?void 0:w.call(E,(e,a)=>e+a.orderTotal,0))||0)>0&&(0,r.jsxs)("div",{className:"total",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"title",children:"Total da Compra"}),(0,r.jsx)("div",{className:"value",children:(0,f.fe)((null==er?void 0:null===(S=er.givexGiftCardDatas)||void 0===S?void 0:null===(O=S.reduce)||void 0===O?void 0:O.call(S,(e,a)=>e+a.orderTotal,0))||0)}),(0,r.jsx)("div",{className:"label",children:"".concat(er.givexGiftCardDatas.length," X Cart\xe3o Presente")})]}),(0,r.jsx)("div",{className:"button",children:(0,r.jsxs)(m.Z,{sx:{width:"100%"},className:"btn-primary",onClick:el,children:[(0,r.jsx)(M.Z,{}),"Finalizar Compra"]})})]})}),(0,r.jsx)("div",{children:(0,r.jsx)(l.D,{rehypePlugins:[i.Z],className:"description",children:eg})})]})]})]})]}),(0,r.jsxs)(m.Z,{className:"btn-go-back-home",variant:"contained",onClick:eh,children:[(0,r.jsx)(R.Z,{sx:{mr:2}}),"Voltar para o In\xedcio"]})]})};var W=t(28133),K=t(89723);let Q=e=>((0,W.Z)(),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k(),{src:"https://assets.pagseguro.com.br/checkout-sdk-js/rc/dist/browser/pagseguro.min.js",onLoad:()=>(0,K.C)("script loaded correctly")}),(0,r.jsx)(k(),{src:"https://www.google.com/recaptcha/enterprise.js?render=6LdtN0orAAAAAEfpIYpKcvdS-7Y08IHLfmDo6Mmm",async:!0,defer:!0,onLoad:()=>(0,K.C)("grecaptcha is ready!")}),(0,r.jsx)(F,{...e})]}));var $=!0,ee=Q},9336:function(e,a,t){"use strict";t.d(a,{G:function(){return s}});var r=t(9669),n=t.n(r);let l=n().create({baseURL:"https://brasilapi.com.br/api"}),i=n().create({baseURL:"https://api.brasilaberto.com/v1"}),o=n().create({baseURL:"https://viacep.com.br/ws"});var d=t(45332);async function s(e){console.log("\uD83D\uDE80 ~ searchAddress ~ value:",e);try{if(""!==e){let a=e.replace(/[^\d]+/g,"");if((0,d.Ip)(a))try{console.log("\uD83D\uDE80 ~ consultando ~ by via api ~ searchAddress ~ value:",e);let{data:a}=await o.get("/".concat(e,"/json")),{logradouro:t,bairro:r,localidade:n,uf:l}=a;if(console.log("\uD83D\uDE80 ~ consultaCep ~ by via cep ~ logradouro, bairro, localidade, uf:",t,r,n,l),a.erro)try{let{data:{result:{street:
1a,district:t,city:r,stateShortname:n}}}=await i.get("/zipcode/".concat(e));return console.log("\uD83D\uDE80 ~ consultaCep ~ by brasil aberto api ~ ~ street, district, city, stateShortname:",a,t,r,n),{zip:e,street:a,district:t,state:n,city:r}}catch(a){return console.log("\uD83D\uDE80 ~ consultaCep ~ by brasil aberto api ~ brasilAbertoApiError:",a),{zip:e,street:"not_found"}}return{zip:e,street:"".concat(t).trim()||"Endere\xe7o sem rua",district:"".concat(r).trim()||"Endere\xe7o sem bairro",state:l,city:n}}catch(a){console.log("\uD83D\uDE80 ~ consultaCep ~ by via cep api ~ viaCepError:",a);try{let{data:{result:{street:a,district:t,city:r,stateShortname:n}}}=await i.get("/zipcode/".concat(e));return{zip:e,street:"".concat(a).trim()||"Endere\xe7o sem rua",district:"".concat(t).trim()||"Endere\xe7o sem bairro",state:n,city:r}}catch(a){console.log("\uD83D\uDE80 ~ consultaCep ~ by brasil aberto api ~ brasilAbertoApiError:",a);try{console.log("\uD83D\uDE80 ~ consultando ~ by brasil api ~ searchAddress ~ value:",e);let a=await l.get("/cep/v1/".concat(e));console.log("\uD83D\uDE80 ~ searchAddress ~ res:",a);let{data:{street:t,neighborhood:r,state:n,city:i}}=a;return console.log("\uD83D\uDE80 ~ consultaCep ~ by brasil api ~ street, neighborhood, state, city:",t,r,n,i),{zip:e,street:"".concat(t).trim()||"Endere\xe7o sem rua",district:"".concat(r).trim()||"Endere\xe7o sem bairro",state:n,city:i}}catch(e){console.log("\uD83D\uDE80 ~ consultaCep ~ by brasil api ~ brasilApiError:",e)}}}}return{zip:e,street:"not_found"}}catch(a){return console.log("\uD83D\uDE80 ~ consultaCep ~ error:",a),{zip:e,street:"not_found"}}}},39759:function(e,a,t){"use strict";t.d(a,{y:function(){return i}});var r=t(9669),n=t.n(r),l=t(4250);let i=n().create({baseURL:"https://api.pagar.me/core/v5",headers:{accept:"application/json","content-type":"application/json"}});i.interceptors.response.use(e=>e,e=>{var a;let t=(0,l.j)(e);return Promise.reject(Object.assign(Error(t),{response:e.response,status:null===(a=e.response)||void 0===a?void 0:a.status}))}),a.Z=i},504:function(e,a,t){"use strict";t.d(a,{n:function(){return i}});var r=t(45332),n=t(50246);let l={pt:{locale:"pt-BR",currency:"BRL"},us:{locale:"en-US",currency:"USD"}};function i(e,a){let t=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(!(0,r.Ft)(e))return(0,n.B)({value:t?(parseInt("".concat(e))/100).toString():e.toString(),decimalScale:2,intlConfig:l[a||"pt"]})}},46870:function(e,a,t){"use strict";t.d(a,{Au:function(){return h},GT:function(){return j},MQ:function(){return g},O:function(){return v},Rg:function(){return b},U6:function(){return C},Y5:function(){return u},YR:function(){return s},j9:function(){return I},mX:function(){return m},mr:function(){return y},nv:function(){return p},oJ:function(){return N},p6:function(){return c},qb:function(){return E},tE:function(){return f},uP:function(){return x},y5:function(){return D}});var r=t(61436),n=t(32912),l=t(29081),i=t(95826),o=t(99490);let d={pt:l.Z,en:i.Z},s="America/Sao_Paulo";function c(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"PPPP",t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"pt";if(!e)return;if(!(0,r.Z)(new Date(e)))return"".concat(e);let l=(0,n.Z)(new Date(e),a,{locale:d[t]});return l}function u(){return new Date().getTimezoneOffset()}function v(e){let a=new Date(e);if(Number.isNaN(a.getTime()))return{year:NaN,month:NaN,day:NaN};if(0===a.getHours()&&0===a.getMinutes()&&0===a.getSeconds()&&0===a.getMilliseconds())return{year:a.getFullYear(),month:a.getMonth()+1,day:a.getDate()};let t=o.ou.fromJSDate(a,{zone:s});return t.isValid?{year:t.year,month:t.month,day:t.day}:{year:NaN,month:NaN,day:NaN}}function m(e){let{year:a,month:t,day:r}=v(e);return Number.isNaN(a)?"":"".concat(a,"-").concat(String(t).padStart(2,"0"),"-").concat(String(r).padStart(2,"0"))}function p(e,a){let t=m(e),r=m(a);return Boolean(t&&r&&t===r)}function x(e){let{year:a,month:t,day:r}=v(e);return Number.isNaN(a)?"NaN":new Date(Date.UTC(a,t-1,r,12)).getUTCDay().toString()}function g(e,a){let t=m(e),r=m(a);return!!t&&!!r&&t>r}function f(e){let{year:a,month:t,day:r}=v(e);return Number.isNaN(a)?new Date(NaN):new Date(a,t-1,r)}
1function h(){return o.ou.now().toJSDate()}function y(e,a){let{year:t,month:r,day:n}=v(e);if(Number.isNaN(t))return new Date(NaN);let[l="0",i="0"]=a.split(":");return o.ou.fromObject({year:t,month:r,day:n,hour:Number(l)||0,minute:Number(i)||0,second:0,millisecond:0},{zone:s}).toJSDate()}function b(e,a){let[t="00:00",r="23:00"]=(a||"").split("-");return{start:y(e,t),end:y(e,r)}}function N(e){let a=o.ou.fromJSDate(new Date(e));return!a.isValid||a.toMillis()<o.ou.now().toMillis()}function D(e,a){return new Date(e).getTime()>new Date(a).getTime()}function j(e,a){return new Date(e).getTime()<new Date(a).getTime()}function C(e,a){return(null==a?void 0:a.onlyToday)?f(h()):f(e)}function I(e,a){return(null==a?void 0:a.onlyToday)?f(h()):f(e)}function E(e){return(0,r.Z)(new Date(e))}}},function(e){e.O(0,[9809,9755,3243,135,8423,1237,246,6273,9821,9774,2888,179],function(){return e(e.s=76149)}),_N_E=e.O()}]);

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.