1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},s=(new e.Error).stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="be83b75b-af75-4c80-bf09-bd8a3fd09b72",e._sentryDebugIdIdentifier="sentry-dbid-be83b75b-af75-4c80-bf09-bd8a3fd09b72")}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1037],{74541:function(e,s,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/studio/short-term-purchase",function(){return t(37652)}])},37652:function(e,s,t){"use strict";t.r(s),t.d(s,{__N_SSP:function(){return A},default:function(){return Payment}});var a=t(85893),l=t(67294),n=t(41664),i=t.n(n),r=t(19572),c=t(33299),d=t(22920),o=t(55204),x=t(86355),p=t(10443),m=t(58298),u=t(98697),h=t(80006),f=t(3349),j=t(81393),y=t(11163),v=t(88767),b=t(98155),g=t(5233),N=t(83658),w=t(25603),_=t(9008),P=t.n(_),S=t(55327);let useShortTermPaymentZaloPay=e=>{let{onOpen:s}=e,t=(0,x.Z)(),{setCurrentTransIdZaloPay:a}=(0,l.useContext)(j.H);return(0,v.useMutation)({mutationFn:async e=>{let s=await t.post("".concat("https://admin.voicereplay.ai","/api/short-term-payment/zalopay-payment"),e);return s.data},onSuccess:e=>(s(),a(e.app_trans_id),e),onError:e=>{var s,t;d.Am.error((null===(t=e.response)||void 0===t?void 0:null===(s=t.data)||void 0===s?void 0:s.detail)||e.message)}})};var Z=t(5490),k=t(34614),C=t(26840),M=t(57391),O=t(70010),z=t(84059),E=t(78418),T=t(67421),L=t(65211);let useCancelShortTermZaloPay=()=>{let e=(0,x.Z)();return(0,v.useMutation)({mutationFn:async s=>{let t=await e.post("".concat("https://admin.voicereplay.ai","/api/short-term-payment/cancel-zalopay-order"),{app_trans_id:s});return t.data},onSuccess:e=>(window.location.reload(),e),onError:e=>{var s,t;d.Am.error((null===(t=e.response)||void 0===t?void 0:null===(s=t.data)||void 0===s?void 0:s.detail)||e.message)}})};function ShortTermZaloPayPayment(e){let{isOpen:s,onClose:t,qrCode:n,currentTransId:i}=e,[r,c]=l.useState(900),[d,o]=l.useState((0,L.m)(r)),{mutate:x}=useCancelShortTermZaloPay(),{t:p}=(0,T.$G)("payment");return l.useEffect(()=>{let e=setInterval(()=>{c(s=>s<=0?(clearInterval(e),0):s-1)},1e3);return()=>clearInterval(e)},[]),l.useEffect(()=>{o((0,L.m)(r))},[r]),(0,a.jsxs)(Z.u_,{closeOnOverlayClick:!1,isOpen:s,onClose:()=>{t(),x(i)},isCentered:!0,"data-sentry-element":"Modal","data-sentry-component":"ShortTermZaloPayPayment","data-sentry-source-file":"ShortTermZaloPayPayment.tsx",children:[(0,a.jsx)(k.Z,{"data-sentry-element":"ModalOverlay","data-sentry-source-file":"ShortTermZaloPayPayment.tsx"}),(0,a.jsxs)(C.h,{minWidth:{sm:"300px",md:"400px",lg:"800px"},className:"text-black","data-sentry-element":"ModalContent","data-sentry-source-file":"ShortTermZaloPayPayment.tsx",children:[(0,a.jsx)(M.x,{"data-sentry-element":"ModalHeader","data-sentry-source-file":"ShortTermZaloPayPayment.tsx",children:(0,a.jsxs)("div",{className:"w-full flex items-center justify-between border-b-[1px] pb-[5px]",children:[(0,a.jsx)("div",{className:"flex gap-[5px] items-center text-[12px] lg:text-[20px]",children:(0,a.jsx)("span",{children:p("payment-by")})}),(0,a.jsx)("div",{onClick:()=>{t(),x(i)},className:"text-[12px] lg:text-[14px] text-blue-800 cursor-pointer",children:p("change-method")})]})}),(0,a.jsx)(O.f,{"data-sentry-element":"ModalBody","data-sentry-source-file":"ShortTermZaloPayPayment.tsx",children:(0,a.jsxs)("div",{className:"flex flex-col lg:flex-row gap-[30px] text-[12px] lg:text-[16px]",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-[10px] w-full lg:w-[45%]",children:[(0,a.jsx)("div",{className:"border border-solid border-gray-300 p-[20px] flex items-center justify-center",children:(0,a.jsx)(z.ZP,{id:"qrcode",value:n,size:200,level:"H",includeMargin:!0,"data-sentry-element":"QRCode","data-sentry-source-file":"ShortTermZaloPayPayment.tsx"})}),(0,a.jsxs)("div",{className:"h-auto w-full bg-[#fff5ec] text-center p-[10px]",children:[(0,a.jsx)("div",{className:"text-green-600 font-bold",children:p("wait-for-payment")}),(0,a.jsx)("div",{children:p("time-left")}),(0,a.jsx)("div",{className:"font-bold text-blue-600",children:(0,a.jsx)("span",{children:d})})]})]}),(0,a.jsxs)("div",{className:"w-full lg:w-[54%]",children:[(0,a.jsx)("div",{className:"w-full flex items-center gap-[5px]",children:(0,a.jsx)("span",{children:p("payment-by")})}),(0,a.jsxs)("div",{className:"flex flex-col gap-[10px]",children:[(0,a.jsx)("div",{className:"font-bold",children:p("payment-guideline")}),(0,a.jsxs)("div",{className:"flex gap-[5px] items-center",children:[(0,a.jsx)("span",{className:"w-[30px] h-[30px] bg-blue-600 font-bold rounded-full text-white flex items-center justify-center",children:"1"}),(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"font-bold",children:p("open-zalopay-1")}),p("open-zalopay-2"),(0,a.jsx)("span",{className:"font-bold",children:p("open-zalopay-3")})]})]}),(0,a.jsxs)("div",{className:"flex gap-[5px] items-center",children:[(0,a.jsx)("span",{className:"w-[30px] h-[30px] bg-blue-600 font-bold rounded-full text-white flex items-center justify-center",children:"2"}),(0,a.jsxs)("span",{className:"flex gap-[5px] items-center",children:[p("pick-zalopay-1"),(0,a.jsx)("span",{className:"font-bold",children:p("pick-zalopay-2")}),(0,a.jsx)("span",{className:"text-blue-600",children:(0,a.jsx)(E.Sx,{width:18,"data-sentry-element":"IconBarcodeScanner","data-sentry-source-file":"ShortTermZaloPayPayment.tsx"})}),p("pick-zalopay-3")]})]}),(0,a.jsxs)("div",{className:"flex gap-[5px] items-center",children:[(0,a.jsx)("span",{className:"w-[30px] h-[30px] bg-blue-600 font-bold rounded-full text-white flex items-center justify-center",children:"3"}),(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"font-bold",children:p("confirm-zalopay-1")}),p("confirm-zalopay-2")]})]})]})]})]})})]})]})}var A=!0;function Payment(e){var s,t,n;let{providers:_}=e,[Z,k]=(0,l.useState)(null),{t:C}=(0,g.$G)("landing-page-topmenu"),{t:M}=(0,g.$G)("update-profile"),{t:O}=(0,g.$G)("sidebar"),{t:z,i18n:E}=(0,g.$G)("payment"),{isCloseNavbar:T,isOpenUpdateProfile:L,setIsOpenUpdateProfile:A,currentTransIdZaloPay:I}=(0,l.useContext)(j.H),{data:F}=(0,c.useSession)(),{isLoading:q,data:D}=(0,u.Z)("getUserProfile","/api/auth/profile"),{isLoading:V,data:B}=(0,S.Z)(),G=(0,y.useRouter)(),H=(0,x.Z)(),[R,$]=l.useState(b.z9.MOMO),Y=null!==(s=E.language)&&void 0!==s?s:"vi",handlePaymentMethodChange=e=>{$(e.target.value)},{planId:W}=G.query;(0,l.useEffect)(()=>{var e;if(W&&(null==B?void 0:null===(e=B.data)||void 0===e?void 0:e.length)>0){let e=B.data.filter(e=>e.id.toString()===W.toString());k(e[0])}},[W,B]);let{isOpen:Q,onClose:U,onOpen:X}=(0,N.q)(),{isLoading:J,mutate:K,data:ee}=useShortTermPaymentZaloPay({onOpen:X}),{mutate:es}=(0,w.T)(Y),et=(0,v.useMutation)({mutationFn:e=>onRedirectMomoPaymentFn(e),onSuccess:e=>{G.push(e.momoPayUrl)},onError:e=>{var s;d.Am.error(null==e?void 0:null===(s=e.response)||void 0===s?void 0:s.data.detail)}}),onRedirectMomoPaymentFn=async e=>{try{let s=await H.post("/api/short-term-payment/momo-payment",e);if(s.data)return s.data}catch(e){throw e}},createCheckoutSession=async()=>{var e,s;if(R===b.z9.MOMO){let s={plan_id:null!==(e=null==Z?void 0:Z.id)&&void 0!==e?e:0,response_language:Y};F&&et.mutate(s)}if(R===b.z9.ZALO_PAY){let e={plan_id:null!==(s=null==Z?void 0:Z.id)&&void 0!==s?s:0,bank_code:"zalopayapp"};F&&(K(e),ee&&X())}};return F&&!F.user?(0,a.jsx)(p.Z,{}):((0,l.useEffect)(()=>{let e=new WebSocket("wss://admin.voicereplay.ai/ws");return e.onopen=()=>{console.log("WebSocket connected")},e.onmessage=e=>{let s=e.data;if(s){let e=JSON.parse(s);e.return_code===b.zr.ZALO_CODE_1.value&&window.open("".concat("vi"===Y?"".concat("https://voicereplay.ai","/studio/payment/success"):"".concat("https://voicereplay.ai","/").concat(Y,"/studio/payment/success")),"_self")}},()=>{e.close()}},[]),(0,l.useEffect)(()=>
1{if(I){var e;let s={plan_id:null!==(e=null==Z?void 0:Z.id)&&void 0!==e?e:0,app_trans_id:I},t=setInterval(()=>{es(s)},6e4);return()=>clearInterval(t)}},[es,I]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(P(),{"data-sentry-element":"Head","data-sentry-source-file":"index.tsx",children:(0,a.jsx)("title",{children:"VoiceReplay.AI | Payment"})}),(0,a.jsxs)("div",{className:" bg-white h-auto w-full",children:[(0,a.jsx)(f.Z,{t:C,"data-sentry-element":"TopMenu","data-sentry-source-file":"index.tsx"}),(0,a.jsx)("section",{className:"w-full h-screen",children:(0,a.jsxs)("div",{className:"flex h-screen",children:[(0,a.jsx)(h.Z,{t:O,"data-sentry-element":"SideBarMenu","data-sentry-source-file":"index.tsx"}),(0,a.jsxs)("div",{className:"\n ".concat(T?"lg:w-[calc(100%-84px)]":"md:w-[calc(100%-270px)]","\n w-full h-full px-[10px] sm:px-[20px] flex flex-col items-center bg-white pb-[50px]"),children:[(0,a.jsxs)("div",{className:"text-black w-full flex flex-col lg:flex-row items-center",children:[(0,a.jsx)(i(),{className:"w-full lg:w-[20%]",href:"/studio/pricing","data-sentry-element":"Link","data-sentry-source-file":"index.tsx",children:(0,a.jsxs)("div",{className:"flex text-[#4B4B4B] opacity-80 hover:opacity-[100%]",children:[(0,a.jsx)(r.Z,{"data-sentry-element":"ChevronLeftIcon","data-sentry-source-file":"index.tsx"}),(0,a.jsx)("div",{className:"w-full",children:z("back-to-pricing")})]})}),(0,a.jsx)("div",{className:"w-full lg:w-[60%]",children:(0,a.jsxs)("div",{className:"flex flex-wrap relative items-center gap-[10px] justify-center xl:justify-between font-bold",children:[(0,a.jsxs)("div",{className:"flex relative flex-col items-center min-w-[100px] justify-center gap-[8px]",children:[(0,a.jsx)("span",{children:z("choose-package")}),(0,a.jsx)("div",{className:"w-[30px] h-[30px] flex items-center justify-center text-white font-bold rounded-full bg-orange-500",children:(0,a.jsx)("span",{children:"1"})})]}),(0,a.jsxs)("div",{className:"flex relative flex-col items-center min-w-[100px] justify-center gap-[8px]",children:[(0,a.jsx)("span",{className:"text-orange-500",children:z("payment-method")}),(0,a.jsx)("div",{className:"w-[30px] h-[30px] flex items-center justify-center text-white font-bold rounded-full bg-orange-500",children:(0,a.jsx)("span",{children:"2"})})]}),(0,a.jsxs)("div",{className:"flex relative flex-col items-center justify-center gap-[8px]",children:[(0,a.jsx)("span",{className:"text-[#babfc7]",children:z("completed")}),(0,a.jsx)("div",{className:"w-[30px] h-[30px] flex items-center justify-center text-white font-bold rounded-full bg-[#babfc7]",children:(0,a.jsx)("span",{children:"3"})})]})]})})]}),(0,a.jsxs)("div",{className:"flex flex-wrap w-full pt-[20px]",children:[(0,a.jsx)("div",{className:"text-black p-[20px] w-full lg:basis-[60%]",children:(0,a.jsxs)("div",{className:"w-full relative h-auto border-[2px] border-solid border-[#E9ECEF]",children:[(0,a.jsx)("span",{className:"absolute font-bold left-[11px] top-[-14px] text-[#5e5e5e] bg-white px-[4px]",children:z("choose-payment-method")}),(0,a.jsxs)("div",{className:"py-[40px] lg:py-[20px] px-[10px] flex flex-col gap-[10px]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"px-[10px] flex gap-[10px] items-center",children:[(0,a.jsx)("img",{src:"/pricing/momo_square_pinkbg.svg",alt:"MoMo Logo",className:"w-[40px] h-[40px]"}),(0,a.jsx)("span",{children:z("momo-wallet")})]}),(0,a.jsx)("input",{type:"radio",name:"payment_method",id:b.z9.MOMO,value:b.z9.MOMO,checked:R===b.z9.MOMO,onChange:handlePaymentMethodChange})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("div",{className:"px-[10px] gap-[5px] flex items-center",children:(0,a.jsxs)("div",{className:"flex flex-row gap-[5px] items-center",children:[(0,a.jsx)("span",{children:z("zalopay-wallet")}),(0,a.jsx)("img",{src:"/pricing/logo-zalopay.svg",alt:"Zalopay Logo",className:"w-[54px]"}),(0,a.jsx)("span",{className:"hidden lg:block",children:z("zalopay-qr")})]})}),(0,a.jsx)("input",{type:"radio",name:"payment_method",id:b.z9.ZALO_PAY,value:b.z9.ZALO_PAY,checked:R===b.z9.ZALO_PAY,onChange:handlePaymentMethodChange})]})]})]})}),(0,a.jsx)("div",{className:"text-black p-[20px] w-full lg:basis-[33.33%]",children:(0,a.jsxs)("div",{className:"w-full relative h-auto border-[2px] border-solid border-[#
1E9ECEF]",children:[(0,a.jsx)("span",{className:"absolute font-bold left-[11px] top-[-14px] text-[#5e5e5e] bg-white px-[4px]",children:z("your-order")}),q||V?(0,a.jsx)("div",{className:"w-full h-full flex items-center justify-center",children:(0,a.jsx)(o.g4,{height:"80",width:"80",radius:"9",color:"#4fa94d",ariaLabel:"three-dots-loading",wrapperStyle:{},visible:!0})}):(0,a.jsx)("div",{className:"py-[20px] w-full",children:(0,a.jsxs)("div",{className:"px-[20px] flex flex-col gap-[12px]",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between ",children:[(0,a.jsx)("div",{children:(0,a.jsx)("span",{children:z("full-name")})}),(0,a.jsx)("div",{className:"font-bold",children:(0,a.jsx)("span",{children:D&&"".concat(D.first_name," ").concat(D.last_name)})})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between ",children:[(0,a.jsx)("div",{children:(0,a.jsx)("span",{children:z("phone")})}),(0,a.jsx)("div",{className:"font-bold",children:(0,a.jsx)("span",{children:D&&D.phone?D.phone:"--"})})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between ",children:[(0,a.jsx)("div",{children:(0,a.jsx)("span",{})}),(0,a.jsx)("div",{onClick:()=>A(!0),className:"cursor-pointer font-bold text-orange-500",children:(0,a.jsx)("span",{children:z("change-button")})})]}),(0,a.jsx)("div",{className:"w-full h-[0.5px] bg-[#E9ECEF]"}),(0,a.jsxs)("div",{className:"flex items-center justify-between ",children:[(0,a.jsx)("div",{children:(0,a.jsx)("span",{children:z("package-name")})}),(0,a.jsx)("div",{className:"font-bold",children:(0,a.jsx)("span",{children:z("short-term-plan")})})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between ",children:[(0,a.jsx)("div",{children:(0,a.jsx)("span",{children:z("total-time")})}),(0,a.jsx)("div",{className:"font-bold",children:(0,a.jsxs)("span",{children:[(null==Z?void 0:Z.promotion_time)?Z.time_limit_seconds+Z.promotion_time:null==Z?void 0:Z.time_limit_seconds," ",z("seconds")]})})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between ",children:[(0,a.jsx)("div",{children:(0,a.jsx)("span",{children:z("price")})}),(0,a.jsx)("div",{className:"font-bold",children:(0,a.jsxs)("span",{children:[Number(null!==(t=null==Z?void 0:Z.promotion_price)&&void 0!==t?t:null==Z?void 0:Z.total_price_for_time).toLocaleString("vi-VN"),"vi"===Y?"VNÄ":"VND"]})})]}),(0,a.jsxs)("div",{className:"bg-[#e5f8ed] px-[6px] py-[10px] rounded-lg",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between ",children:[(0,a.jsx)("div",{children:(0,a.jsx)("span",{children:z("payment-sum")})}),(0,a.jsx)("div",{className:"font-bold text-[#EA5455] text-lg",children:(0,a.jsxs)("span",{children:[Number(null!==(n=null==Z?void 0:Z.promotion_price)&&void 0!==n?n:null==Z?void 0:Z.total_price_for_time).toLocaleString("vi-VN"),"vi"===Y?"VNÄ":"VND"]})})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between ",children:[(0,a.jsx)("div",{children:(0,a.jsx)("span",{})}),(0,a.jsx)("div",{className:"text-[10px] font-bold",children:(0,a.jsx)("span",{children:z("vat-include")})})]})]}),(0,a.jsx)("div",{className:"w-full",children:(0,a.jsx)("button",{onClick:createCheckoutSession,className:"w-full bg-[#fc6634] py-[10px] rounded-lg text-white font-bold hover:opacity-80",children:J&&!ee?(0,a.jsx)("div",{className:"w-full flex items-center justify-center",children:(0,a.jsx)(o.iT,{visible:!0,height:"20",width:"20",color:"#ffffff",ariaLabel:"oval-loading"})}):z(et.isLoading?"loading-state":"agree-to-pay")})})]})})]})})]})]})]})})]}),L&&(0,a.jsx)(m.Z,{t:M}),Q&&ee&&(0,a.jsx)(ShortTermZaloPayPayment,{isOpen:Q,onClose:U,qrCode:ee.qr_code,currentTransId:I})]}))}},55327:function(e,s,t){"use strict";var a=t(86355),l=t(88767);s.Z=()=>{let e=(0,a.Z)();return(0,l.useQuery)(["getAllShortTermPlans"],async()=>{let s=await e.get("".concat("https://admin.voicereplay.ai","/api/short-term-purchase/plans"));return s.data},{staleTime:6e5,cacheTime:3e5})}}},function(e){e.O(0,[4938,5204,3906,4625,8418,3349,2290,9774,2888,179],function(){return e(e.s=74541)}),_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.