1import{F as j,r as l,I as h,j as e,av as f,aw as S,ax as y,ay as N,M as c,L as w}from"./index-Ra6VjJ-9.js";import{S as v}from"./SEO-QS61Zyui.js";import{B as C}from"./badge-CjqAsro2.js";import{s as d,c as A}from"./shoplineOnboardingConsentStorage-DOOZNINQ.js";import{S as R}from"./ShoplineApplyShell-2t5PWFAg.js";import{C as k}from"./clock-D6Br2ppR.js";import{T as E}from"./triangle-alert-l7jpZO-l.js";import{R as x}from"./refresh-cw-CcmaCvr1.js";import{E as O}from"./external-link-oDVWEL5A.js";import"./Helmet-9YOMzIf9.js";const L=a=>a==="rejected",B=a=>{let t=!1;return async()=>{if(t)return!1;t=!0;try{if((await a.logout())?.LoggedOut!==!0)throw new Error("ç¡æ³æ¸
é¤èç³è«ç»å
¥çæ
");a.clearConsent();const r=await a.startOAuth("/shopline/apply/consent");if(!r?.AuthorizeUrl)throw new Error("ç¼ºå° Shopline ç»å
¥ç¶²å");return a.redirect(r.AuthorizeUrl),!0}catch(n){throw t=!1,n}}},F={not_submitted:{label:"å°æªéåº",className:"border-gray-300 text-gray-700"},pending:{label:"å¾
å¯©æ ¸",className:"border-amber-300 bg-amber-50 text-amber-700"},approved:{label:"å·²æ ¸å",className:"border-emerald-300 bg-emerald-50 text-emerald-700"},rejected:{label:"å·²æçµ",className:"border-red-300 bg-red-50 text-red-700"}},G=()=>{const a=j(),[t,n]=l.useState(null),[r,p]=l.useState(!0),[o,m]=l.useState(!1),g=l.useMemo(()=>B({logout:()=>d.logout(),clearConsent:A,startOAuth:s=>d.startOAuth(s),redirect:s=>window.location.assign(s)}),[]),i=l.useCallback(async()=>{p(!0);try{const s=await d.getStatus();n(s||null)}catch(s){console.error("æ¥è©¢ Shopline ç³è«çæ
失æ:",s),h.error("è«å
宿 Shopline ææ¬"),a("/shopline/apply",{replace:!0})}finally{p(!1)}},[a]);l.useEffect(()=>{i()},[i]);const b=async()=>{if(!o){m(!0);try{await g()}catch(s){console.error("éæ°éå§ Shopline åå®¶ç³è«å¤±æ:",s),h.error("ç¡æ³éæ°éå§ç³è«ï¼è«ç¨å¾å試"),m(!1)}}},u=F[t?.Status||""]||{label:t?.Status||"æªç¥",className:"border-gray-300 text-gray-700"};return e.jsxs(R,{children:[e.jsx(v,{title:"Shopline åå®¶ç³è«çæ
ï½CashBack è¿å¤å¤",description:"æ¥è©¢ Shopline åå®¶ç³è«å¯©æ ¸çæ
",url:"/shopline/apply/status",type:"website"}),e.jsx("div",{className:"container mx-auto max-w-3xl px-4 py-16",children:e.jsxs(f,{children:[e.jsx(S,{children:e.jsxs(y,{className:"flex items-center gap-2 text-2xl",children:[e.jsx(k,{className:"h-6 w-6 text-gray-700"}),"ç³è«çæ
"]})}),e.jsxs(N,{className:"space-y-6",children:[r?e.jsx("p",{className:"text-gray-600",children:"æ¥è©¢ä¸..."}):t?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rounded-md border bg-gray-50 p-4",children:[e.jsx("div",{className:"text-sm text-gray-500",children:"å¯©æ ¸çæ
"}),e.jsx(C,{variant:"outline",className:`mt-2 ${u.className}`,children:u.label})]}),t.ApplicationID&&e.jsxs("div",{className:"rounded-md border bg-gray-50 p-4",children:[e.jsx("div",{className:"text-sm text-gray-500",children:"ç³è«ç·¨è"}),e.jsx("div",{className:"mt-1 font-mono text-gray-950",children:t.ApplicationID})]}),t.RejectionReason&&e.jsxs("div",{className:"flex gap-3 rounded-md border border-red-200 bg-red-50 p-4 text-red-800",children:[e.jsx(E,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsx("div",{children:t.RejectionReason})]})]}):null,e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs(c,{onClick:i,disabled:r||o,variant:"outline",children:[e.jsx(x,{className:`h-4 w-4 ${r?"animate-spin":""}`}),"éæ°æ¥è©¢"]}),L(t?.Status)&&e.jsxs(c,{onClick:b,disabled:r||o,children:[o?e.jsx(x,{className:"h-4 w-4 animate-spin"}):e.jsx(O,{className:"h-4 w-4"}),o?"æ£å¨åå¾ Shopline...":"éæ°ç»å
¥ Shopline 並ç³è«"]}),t?.Status==="not_submitted"&&e.jsx(c,{asChild:!0,children:e.jsx(w,{to:"/shopline/apply/form",children:"åå°ç³è«è¡¨"})})]})]})]})})]})};export{G 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.