1import{X as C,W as I,u as S,r as P,j as t,S as R,bi as v,aT as T,ci as E,x as L,b9 as N,cA as G,cW as j}from"./index.BvQk7nKY.js";import{A as M}from"./aiLimits.r21eA_M9.js";const k=5,B=1500,W=["thanh toan chua hoan tat","thanh toán chưa hoà n tất","payment is not complete","payment is not completed","payment is not confirmed"],q=["cancelled","canceled","expired","Äã há»§y","da huy","hết hạn","het han"],F=e=>new Promise(o=>setTimeout(o,e)),O=e=>String(e?.response?.data?.message||e?.response?.data?.error||e?.message||"").toLowerCase(),V=e=>{const o=O(e);if(q.some(s=>o.includes(s)))return!1;if(!e?.response)return!0;const r=Number(e.response.status);return[408,425,429].includes(r)||r>=500&&r<=599?!0:r===400&&W.some(s=>o.includes(s))};async function H({orderCode:e,activateByOrder:o,refreshUser:r,wait:s=F}){if(!e)return"error";let l=!1;for(let m=1;m<=k;m+=1)try{await o(e),l=!0;break}catch(b){if(!(m<k)||!V(b))return"error";await s(B)}if(!l)return"error";try{return await r(),"success"}catch{return"error"}}const Y="_pageWrapper_1ug9u_3",$="_bgGlow_1ug9u_14",X="_confetti_1ug9u_50",D="_confettiPiece_1ug9u_58",Q="_card_1ug9u_154",U="_iconWrapper_1ug9u_184",z="_checkIcon_1ug9u_229",J="_title_1ug9u_235",K="_subtitle_1ug9u_242",Z="_processingRow_1ug9u_250",tt="_processingText_1ug9u_261",nt="_spinIcon_1ug9u_267",et="_benefitsCard_1ug9u_282",st="_benefitsTitle_1ug9u_295",ct="_benefitsList_1ug9u_305",at="_benefitItem_1ug9u_311",ot="_benefitCheck_1ug9u_319",rt="_buttonsRow_1ug9u_326",it="_primaryBtn_1ug9u_333",ht="_secondaryBtn_1ug9u_360",n={pageWrapper:Y,bgGlow:$,confetti:X,confettiPiece:D,card:Q,iconWrapper:U,checkIcon:z,title:J,subtitle:K,processingRow:Z,processingText:tt,spinIcon:nt,benefitsCard:et,benefitsTitle:st,benefitsList:ct,benefitItem:at,benefitCheck:ot,buttonsRow:rt,primaryBtn:it,secondaryBtn:ht};function pt(){const[e]=C(),o=I(),{refreshUser:r}=S(),[s,l]=P.useState("processing"),[m,b]=P.useState(null),h=e.get("orderCode"),_=e.get("type"),f=e.get("classroomId"),i=_==="classroom",a=_==="classroom-student-pro",y=i||a;P.useEffect(()=>{(async()=>{if(!h){l("error");return}try{if(a&&f)await N.activateStudentProPayment(f,h);else if(i){let c=null,g=null;for(let d=0;d<5;d+=1)try{d>0&&await new Promise(A=>setTimeout(A,1500));const p=await N.activatePayment(h);c=p?.data?.data||p?.data||null;break}catch(p){g=p}if(!c)throw g||new Error("Payment is not confirmed yet");b(c)}else{let c=null;const g=await H({orderCode:h,activateByOrder:async d=>{const p=await G.activateByOrder(d);return c=p?.data?.data||null,p},refreshUser:r});l(g),g==="success"&&j({orderCode:h,value:c?.price,contentType:"subscription",contentName:c?.type});return}l("success"),j({orderCode:h,contentType:_||"classroom"})}catch{l("error")}})()},[f,i,y,a,h,_,r]);const w=a?["Pro Äã ÄÆ°á»£c kÃch hoạt cho há»c sinh sau khi há» thá»ng xác nháºn thanh toán.","Giáo viên có thá» quay lại danh sách thà nh viên Äá» kiá»m tra hạn Pro.","Có thá» chá»n nhiá»u há»c sinh và tạo ÄÆ¡n nâng Pro má»i khi cần."]:i?["Lá»p há»c chá» ÄÆ°á»£c tạo sau khi há» thá»ng xác nháºn thanh toán.","Mã lá»p sẵn sà ng Äá» má»i há»c sinh tham gia.","Giao bà i, theo dõi hạn ná»p và tá»ng hợp kết quả trong cùng má»t nÆ¡i."]:["Lưu trữ từ vá»±ng má» rá»ng",`AI tạo từ nhanh ${M.pro} lần/ngà y`,"Lá» trình há»c có sẵn","Há» trợ ưu tiên","Toà n bá» bà i há»c"],u=s==="error"&&!y;return t.jsxs("div",{className:n.pageWrapper,children:[t.jsx(R,{title:s==="error"?"Cần xác nháºn thanh toán - Luyá»n Từ":"Thanh toán thà nh công - Luyá»n Từ",description:"Giao dá»ch Äã hoà n tất và há» thá»ng Äang cáºp nháºt quyá»n lợi cho tà i khoản.",path:"/payment-success",noindex:!0}),t.jsx("div",{className:n.bgGlow}),t.jsx("div",{className:n.confetti,children:[...Array(10)].map((x,c)=>t.jsx("div",{className:n.confettiPiece},c))}),t.jsxs("div",{className:n.card,children:[t.jsx("div",{className:n.iconWrapper,children:s==="error"?t.jsx(v,{className:n.checkIcon}):t.jsx(T,{className:n.checkIcon})}),t.jsx("h1",{className:n.title,children:u?"Thanh toán Äã ÄÆ°á»£c ghi nháºn":s==="error"?"Cần xác nháºn lại thanh toán":a?"Äã kÃch hoạt Pro cho há»c sinh!":"Thanh toán thà nh công!"}),t.jsx("p",{className:n.subtitle,children:u?"Há» thá»ng chưa xác nháºn ÄÆ°á»£c quyá»n Pro cho tà i khoản cá»§a bạn.":a?"Giao dá»ch Äã ÄÆ°á»£c ghi nháºn. Há» thá»ng Äang cáºp nháºt quyá»n Pro cho há»c sinh Äã chá»n trong lá»p.":i?"Giao dá»ch Äã ÄÆ°á»£c ghi nháºn. Lá»p há»c sẽ ÄÆ°á»£c tạo tá»± Äá»ng ngay khi há» thá»ng xác nháºn xong.":"Cảm Æ¡n bạn Äã nâng cấp tà i khoản Pro. Các tÃnh nÄng nâng cao Äã ÄÆ°á»£c kÃch hoạt."}),s==="processing"&&t.jsxs("div",{className:n.processingRow,children:[t.jsx(v,{className:n.spinIcon}),t.jsx("span",{className:n.processingText,children:a?"Äang kÃch hoạt Pro cho há»c sinh...":i?"Äang tạo lá»p há»c...":"Äang cáºp nháºt trạng thái gói..."})]}),s==="error"&&t.jsx("div",{className:n.processingRow,children:t.jsx("span",{className:n.processingText,children:u?"Vui lòng tải lại trang Äá» thá» xác nháºn lần nữa. Nếu vẫn chưa có Pro, hãy liên há» há» trợ và gá»i mã ÄÆ¡n hà ng.":"Chưa xác nháºn ÄÆ°á»£c thanh toán. Vui lòng quay lại lá»p há»c và thá» lại sau Ãt phút."})}),!u&&t.jsxs("div",{className:n.benefitsCard,children:[t.jsxs("div",{className:n.benefitsTitle,children:[t.jsx("span",{children:"â"})," ",a?"Pro há»c sinh Äã chá»n":i?"Lá»p há»c cá»§a bạn":"Quyá»n lợi Pro cá»§a bạn"]}),t.jsx("div",{className:n.benefitsList,children:w.map((x,c)=>t.jsxs("div",{className:n.benefitItem,children:[t.jsx(T,{className:n.benefitCheck}),t.jsx("span",{children:x})]},c))})]}),t.jsxs("div",{className:n.buttonsRow,children:[t.jsxs("button",{className:n.primaryBtn,onClick:()=>
1{if(u){window.location.reload();return}o(a?`/classes/${f||""}`:i?`/classes/${m?.id||""}`:"/")},children:[u?t.jsx(v,{}):t.jsx(E,{})," ",u?"Thá» xác nháºn lại":a?"Vá» lá»p há»c":i?"Má» lá»p há»c":"Vá» trang chá»§"]}),t.jsxs("button",{className:n.secondaryBtn,onClick:()=>o(y?"/classes":"/categories"),children:[t.jsx(L,{})," ",y?"Lá»p cá»§a tôi":"Há»c ngay"]})]})]})]})}export{pt as default};
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.