1import{b as N,e as S,d as w,r as m,g as C,k,j as e,P as v,L as i,B as l,z as u,p as g}from"./index-BIdkve2-.js";import{S as P}from"./shopping-bag-B64lIAYH.js";const o="shopify_pending_claim";function E(){var x;const[r]=N(),f=S(),{isAuthenticated:p,isLoading:y}=w(),[s,j]=m.useState("");m.useEffect(()=>{const t=r.get("claim"),a=t||localStorage.getItem(o)||"";t&&localStorage.setItem(o,t),j(a)},[r]);const n=C({queryKey:["shopify-claim",s],queryFn:async()=>(await g.getShopifyClaim(s)).data,enabled:!!s,retry:!1}),c=k({mutationFn:async()=>(await g.claimShopifyInstall(s)).data,onSuccess:t=>{localStorage.removeItem(o),u.success(`${t.shop} connected.`),f("/publishing?shopify=connected")},onError:t=>{var a,h;return u.error(((h=(a=t.response)==null?void 0:a.data)==null?void 0:h.detail)||"Could not connect the store. Please try again.")}});if(y)return e.jsx(v,{});const d=(x=n.data)==null?void 0:x.shop,b=!s||n.isError;return e.jsx("div",{className:"min-h-screen bg-claude-bg flex items-center justify-center p-6",children:e.jsxs("div",{className:"w-full max-w-md bg-claude-surface border border-claude-border rounded-2xl shadow-soft p-8",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-5",children:[e.jsx("div",{className:"w-9 h-9 rounded-xl flex items-center justify-center",style:{backgroundColor:"#95BF47"},children:e.jsx(P,{className:"w-5 h-5 text-white"})}),e.jsxs("span",{className:"font-semibold text-claude-text",children:["hey",e.jsx("span",{className:"text-claude-accent",children:"filo"})]})]}),b?e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-claude-text mb-2",children:"This link has expired"}),e.jsx("p",{className:"text-sm text-claude-text-secondary mb-6",children:"The connection link is no longer valid. Please install heyfilo again from your Shopify admin to reconnect your store."}),e.jsx(i,{to:"/publishing",children:e.jsx(l,{className:"w-full",children:"Go to heyfilo"})})]}):n.isLoading?e.jsx("p",{className:"text-sm text-claude-text-secondary",children:"Checking your storeâ¦"}):p?e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-claude-text mb-2",children:"Connect your store"}),e.jsxs("p",{className:"text-sm text-claude-text-secondary mb-6",children:["Add ",e.jsx("strong",{className:"text-claude-text",children:d})," to your current heyfilo workspace so you can publish articles to its blog."]}),e.jsx(l,{className:"w-full",onClick:()=>c.mutate(),disabled:c.isPending,children:c.isPending?"Connectingâ¦":"Connect store"}),e.jsx("p",{className:"text-xs text-claude-text-tertiary mt-3 text-center",children:"To use a different workspace, switch it in heyfilo first, then reload this page."})]}):e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-claude-text mb-2",children:"Almost there"}),e.jsxs("p",{className:"text-sm text-claude-text-secondary mb-6",children:["Sign in to heyfilo to finish connecting ",e.jsx("strong",{className:"text-claude-text",children:d}),". We'll bring you right back."]}),e.jsx(i,{to:"/login",children:e.jsx(l,{className:"w-full",children:"Sign in to heyfilo"})}),e.jsxs("p",{className:"text-xs text-claude-text-tertiary mt-3 text-center",children:["Don't have an account?"," ",e.jsx(i,{to:"/register",className:"text-claude-accent hover:underline",children:"Create one"})]})]})]})})}export{o as SHOPIFY_CLAIM_KEY,E as ShopifyConnectPage};
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.