PageSourceSearch

https://shopscopeai.com/assets/OnboardingPage-BqtQsebV.js

js shopscopeai.com collected 2026-09-24 14:52:36 UTC 27,762 bytes, 6 lines download raw bytes

1import{g as De,u as _e,d as Ee,c as Le,h as Ce,r as o,i as ae,s as x,j as e,b as P,L as H,A as oe,k as R,l as ie,m as de,B as m,T as ce,a as Te,C as O,n as Ae,X as Me,o as $,f as p}from"./index-Coh6kqMH.js";import{A as Ie,a as Be,b as Fe,c as He,d as Oe,e as $e,f as Re,g as ze}from"./alert-dialog-BYGYPczH.js";import{P as Ye}from"./pencil-TZ93lQiw.js";import{C as qe}from"./circle-help-Br1oCegM.js";import{P as We}from"./pause-DtL7NhOJ.js";import{L as Ke}from"./link-2-BSUIF5SJ.js";import{L as Ue}from"./layout-dashboard-Cui0pzgd.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Ve=De("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]),le=["tip1","tip2","tip3","tip4","tip5"],_=[{key:"connect",label:"Connecting to Etsy",detail:"Verifying your shop's secure access token.",icon:Ke},{key:"shop",label:"Reading shop details",detail:"Fetching shop info, policies and reviews.",icon:R},{key:"listings",label:"Importing listings",detail:"Downloading active listings from your shop.",icon:Ve},{key:"analyze",label:"Analyzing SEO & tags",detail:"Scoring titles, tags, materials and images.",icon:de},{key:"dashboard",label:"Preparing your dashboard",detail:"Building insights, charts and your growth plan.",icon:Ue}];function Ge(s,g,u){return s(`onboardingPage.syncSteps.${g}.label`,u)}function Xe(s,g,u){var d,N;const h=(g||"").toLowerCase();if(/401|403|unauthor|invalid.?token|expired|refresh.?token/.test(h))return{title:s("onboardingPage.errorDiagnosis.authExpired.title"),cause:s("onboardingPage.errorDiagnosis.authExpired.cause"),steps:[s("onboardingPage.errorDiagnosis.authExpired.step1"),s("onboardingPage.errorDiagnosis.authExpired.step2")],primary:{label:s("onboardingPage.errorDiagnosis.authExpired.primaryButton"),action:"reconnect"},secondary:{label:s("onboardingPage.errorDiagnosis.authExpired.secondaryButton"),action:"settings"}};if(/429|rate.?limit|too many requests/.test(h))return{title:s("onboardingPage.errorDiagnosis.rateLimit.title"),cause:s("onboardingPage.errorDiagnosis.rateLimit.cause"),steps:[s("onboardingPage.errorDiagnosis.rateLimit.step1"),s("onboardingPage.errorDiagnosis.rateLimit.step2")],primary:{label:s("onboardingPage.errorDiagnosis.rateLimit.primaryButton"),action:"retry"},secondary:{label:s("onboardingPage.errorDiagnosis.rateLimit.secondaryButton"),action:"settings"}};if(/no shop|shop.?not.?found|missing shop/.test(h))return{title:s("onboardingPage.errorDiagnosis.noShopFound.title"),cause:s("onboardingPage.errorDiagnosis.noShopFound.cause"),steps:[s("onboardingPage.errorDiagnosis.noShopFound.step1"),s("onboardingPage.errorDiagnosis.noShopFound.step2")],primary:{label:s("onboardingPage.errorDiagnosis.noShopFound.primaryButton"),action:"reconnect"},secondary:{label:s("onboardingPage.errorDiagnosis.noShopFound.secondaryButton"),action:"etsy"}};if(/network|fetch failed|timeout|timed out|econnreset|enotfound|getaddrinfo/.test(h))return{title:s("onboardingPage.errorDiagnosis.networkHiccup.title"),cause:s("onboardingPage.errorDiagnosis.networkHiccup.cause"),steps:[s("onboardingPage.errorDiagnosis.networkHiccup.step1"),s("onboardingPage.errorDiagnosis.networkHiccup.step2")],primary:{label:s("onboardingPage.errorDiagnosis.networkHiccup.primaryButton"),action:"retry"},secondary:{label:s("onboardingPage.errorDiagnosis.networkHiccup.secondaryButton"),action:"settings"}};if(/500|502|503|504|server error|internal/.test(h))return{title:s("onboardingPage.errorDiagnosis.etsyServerError.title"),cause:s("onboardingPage.errorDiagnosis.etsyServerError.cause"),steps:[s("onboardingPage.errorDiagnosis.etsyServerError.step1"),s("onboardingPage.errorDiagnosis.etsyServerError.step2")],primary:{label:s("onboardingPage.errorDiagnosis.etsyServerError.primaryButton"),action:"retry"},secondary:{label:s("onboardingPage.errorDiagnosis.etsyServerError.secondaryButton"),action:"settings"}};const b=u!=null?Ge(s,(d=_[u])==null?void 0:d.key,(N=_[u])==null?void 0:N.label).toLowerCase():null;return{title:s("onboardingPage.errorDiagnosis.fallback.title"),cause:b?s("onboardingPage.errorDiagnosis.fallback.causeWithStep",{stepLabel:b}):s("onboardingPage.errorDiagnosis.fallback.causeGeneric"),steps:[s("onboardingPage.errorDiagnosis.fallback.step1"),s("onboardingPage.errorDiagnosis.fallback.step2")],primary:{label:s("onboardingPage.errorDiagnosis.fallback.primaryButton"),action:"retry"},secondary:{label:s("onboardingPage.errorDiagnosis.fallback.secondaryButton"),action:"settings"}}}const Je=3;function as(){const{t:s}=_e(),g=Ee(),{user:u,loading:h}=Le(),[b]=Ce(),[d,N]=o.useState(0),[E,z]=o.useState(!1),[n,L]=o.useState({progress:0,total:0,status:"pending",error:null}),[ge,S]=o.useState(!1),[me,C]=o.useState(!1),[Y,q]=o.useState(!1),[v,ue]=o.useState(0),W=[s("onboardingPage.syncing.hints.connecting","Connecting to Etsy…"),s("onboardingPage.syncing.hints.importing","Importing your listings…"),s("onboardingPage.syncing.hints.readingShop","Reading shop details and reviews…"),s("onboardingPage.syncing.hints.crunching","Crunching titles, tags and materials…"),s("onboardingPage.syncing.hints.preparingDashboard","Preparing your dashboard…")],[K,T]=o.useState(null),[A,U]=o.useState(null),[M,V]=o.useState(null),[w,xe]=o.useState(()=>Date.now()),[j,pe]=o.useState(null),[k,he]=o.useState(null),[G,be]=o.useState(0),[X,ye]=o.useState(null),[J,fe]=o.useState(!1),[Q,Z]=o.use
6State(!1),[je,I]=o.useState(!1),Ne=()=>{p.message(s("onboardingPage.syncing.pauseToast.title","Sync paused"),{description:s("onboardingPage.syncing.pauseToast.description","It will keep running in the background. You can check progress from your dashboard.")}),g("/app")},ve=()=>{I(!1),p.message(s("onboardingPage.syncing.cancelToast.title","Setup canceled"),{description:s("onboardingPage.syncing.cancelToast.description","The Etsy sync will keep running in the background. Return anytime to finish setup.")}),g("/")};o.useEffect(()=>{b.get("step")==="syncing"&&N(1)},[b]),o.useEffect(()=>{if(h||!u||b.get("step"))return;let t=!1;return(async()=>{const r=await ae();if(!(t||!r))if(r.sync_status==="complete"&&r.etsy_shop_id){const i=localStorage.getItem("pending-trial-token");i?g(`/activate-trial?token=${i}`,{replace:!0}):g("/app",{replace:!0})}else r.sync_status==="syncing"&&r.etsy_shop_id&&N(1)})(),()=>{t=!0}},[h,u,g,b]),o.useEffect(()=>{if(d!==1)return;const t=setInterval(()=>ue(i=>(i+1)%W.length),3500),r=setInterval(()=>be(i=>(i+1)%le.length),5e3);return()=>{clearInterval(t),clearInterval(r)}},[d]),o.useEffect(()=>{if(d!==1)return;const t=setInterval(()=>xe(Date.now()),1e3);return()=>clearInterval(t)},[d]),o.useEffect(()=>{if(d!==2)return;let t=!1;return(async()=>{const[{count:r},{data:i},{data:c}]=await Promise.all([x.from("etsy_listings").select("*",{count:"exact",head:!0}),x.from("listing_seo_scores").select("score, etsy_listing_id").order("score",{ascending:!0}),x.from("etsy_connections").select("etsy_shop_id").maybeSingle()]);if(t)return;if(c!=null&&c.etsy_shop_id){const{data:l}=await x.from("etsy_shops").select("shop_name").eq("etsy_shop_id",c.etsy_shop_id).maybeSingle();!t&&(l!=null&&l.shop_name)&&ye(l.shop_name)}const f=(i??[]).map(l=>l.score).filter(l=>Number.isFinite(l)),F=f.length?Math.round(f.reduce((l,D)=>l+D,0)/f.length):null;pe({listings:r??0,avgSeo:F});const a=(i??[])[0];if(a!=null&&a.etsy_listing_id){const{data:l}=await x.from("etsy_listings").select("title, etsy_listing_id").eq("etsy_listing_id",a.etsy_listing_id).maybeSingle();!t&&(l!=null&&l.title)&&he({id:l.etsy_listing_id,title:l.title,score:a.score})}})(),()=>{t=!0}},[d]),o.useEffect(()=>{if(d!==1||!u)return;let t=!1,r=-1,i=Date.now(),c=0;S(!1),C(!1),U(a=>a??Date.now());const f=async()=>{const a=await ae();if(t||!a)return;if(!a.etsy_shop_id){C(!0);return}if(a.sync_progress!==r||a.sync_status!==n.status?(r=a.sync_progress,i=Date.now(),S(!1),V(Date.now())):Date.now()-i>3e4&&a.sync_status!=="complete"&&a.sync_status!=="error"&&S(!0),L({progress:a.sync_progress,total:a.sync_total,status:a.sync_status,error:a.sync_error}),a.sync_status==="syncing"&&(a.sync_total===0&&a.sync_progress===0?c=Math.max(c,0):a.sync_total>0&&a.sync_progress<a.sync_total?c=2:a.sync_total>0&&a.sync_progress>=a.sync_total&&(c=Math.max(c,3))),a.sync_status==="complete"){T(null);const D=localStorage.getItem("pending-trial-token");if(D){g(`/activate-trial?token=${D}`,{replace:!0});return}if(b.get("trial")==="pro")try{const{error:ke}=await x.functions.invoke("start-trial");ke||p.success(s("onboardingPage.syncSuccess.trialToast"))}catch{}N(2)}else a.sync_status==="error"&&(T(c),p.error(a.sync_error||s("onboardingPage.syncError.toastFallback")))};f();const F=setInterval(f,2e3);return()=>{t=!0,clearInterval(F)}},[d,u,s,g,b,n.status]);const Pe=async()=>{q(!0);try{await x.functions.invoke("etsy-disconnect"),p.success(s("onboardingPage.missingShop.resetSuccessToast")),C(!1),L({progress:0,total:0,status:"pending",error:null}),N(0)}catch(t){p.error(t instanceof Error?t.message:s("onboardingPage.missingShop.resetErrorToast"))}finally{q(!1)}},Se=async()=>{if(!(J||Q)){Z(!0);try{const{error:t}=await x.functions.invoke("notify-sync-complete");if(t)throw t;fe(!0),p.success(s("onboardingPage.syncing.notifyMeSuccess","We'll email you when your shop is ready."))}catch(t){p.error(t instanceof Error?t.message:s("onboardingPage.syncing.notifyMeError","Couldn't set up email notification."))}finally{Z(!1)}}},B=async()=>{S(!1),T(null),U(Date.now()),V(null),L({progress:0,total:0,status:"syncing",error:null});try{await x.functions.invoke("etsy-sync-shop")}catch(t){const r=t instanceof Error?t.message:s("onboardingPage.syncError.
6startSyncFailed");p.error(r)}},ee=async()=>{z(!0);try{const{data:t,error:r}=await x.functions.invoke("etsy-oauth-start",{body:{redirect_uri:window.location.origin+"/auth/etsy/callback"}});if(r||!(t!=null&&t.url))throw new Error((r==null?void 0:r.message)||s("onboardingPage.connectShop.connectError"));window.location.href=t.url}catch(t){const r=t instanceof Error?t.message:s("onboardingPage.connectShop.genericError");p.error(r),z(!1)}},we=o.useMemo(()=>n.total>0?Math.min(100,n.progress/n.total*100):Math.min(85,v*18),[n.progress,n.total,v]),se=o.useMemo(()=>n.status==="complete"?_.length:n.status==="pending"?0:n.total===0&&n.progress===0?v<2?Math.min(1,v):1:n.total>0&&n.progress<n.total?2:n.total>0&&n.progress>=n.total?v%2===0?3:4:2,[n.status,n.progress,n.total,v]),te=o.useMemo(()=>{if(!M)return null;const t=Math.max(0,Math.floor((w-M)/1e3));if(t<5)return s("onboardingPage.syncStatus.justNow");if(t<60)return s("onboardingPage.syncStatus.secondsAgo",{diff:t});const r=Math.floor(t/60);return s("onboardingPage.syncStatus.minutesAgo",{m:r})},[M,w,s]),ne=o.useMemo(()=>{if(n.status!=="syncing")return null;if(n.total>0&&n.progress>0&&A){const t=w-A;if(t>3e3){const r=n.progress/(t/1e3),i=Math.max(0,n.total-n.progress);if(r>0){const c=Math.ceil(i/r);if(c<10)return s("onboardingPage.syncStatus.etaFewSeconds");if(c<60)return s("onboardingPage.syncStatus.etaSeconds",{remainingS:Math.ceil(c/5)*5});const f=Math.ceil(c/60);return f===1?s("onboardingPage.syncStatus.etaOneMinute"):s("onboardingPage.syncStatus.etaMinutes",{m:f})}}}return s("onboardingPage.syncStatus.etaFallback")},[n.status,n.progress,n.total,A,w,s]),y=o.useMemo(()=>n.status==="error"?Xe(s,n.error,K):null,[n.status,n.error,K,s]),re=t=>{if(t==="retry")return B();if(t==="reconnect")return ee();if(t==="settings")return g("/app/settings");t==="etsy"&&window.open("https://www.etsy.com/sell","_blank","noreferrer")};return h?e.jsx("div",{className:"min-h-dvh flex items-center justify-center",children:e.jsx(P,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"min-h-dvh bg-background flex items-center justify-center px-4 py-8 glow-bg",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsx("div",{className:"flex items-center gap-1 mb-8",children:Array.from({length:Je}).map((t,r)=>e.jsx("div",{className:`h-1 flex-1 rounded-full transition-colors ${r<=d?"bg-primary":"bg-muted"}`},r))}),e.jsxs("div",{className:"animate-in fade-in slide-in-from-right-2 duration-300",children:[d===0&&e.jsxs("div",{className:"text-center",children:[e.jsxs(H,{to:"/",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground mb-6",children:[e.jsx(oe,{className:"w-3.5 h-3.5"})," ",s("onboardingPage.connectShop.backToHomeLink")]}),e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-primary/10 flex items-center justify-center mx-auto mb-6",children:e.jsx(R,{className:"w-8 h-8 text-primary"})}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:s("onboardingPage.connectShop.title")}),e.jsx("p",{className:"text-muted-foreground mb-6",children:s("onboardingPage.connectShop.description")}),e.jsxs("div",{className:"rounded-xl border border-border bg-card text-left p-3.5 mb-6",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(ie,{className:"w-4 h-4 text-primary mt-0.5 shrink-0"}),e.jsx("div",{className:"text-sm text-foreground",children:s("onboardingPage.connectShop.trustSummary")})]}),e.jsxs("details",{className:"mt-3 group",children:[e.jsxs("summary",{className:"cursor-pointer text-xs text-primary hover:underline list-none flex items-center gap-1 select-none",children:[e.jsx("span",{className:"group-open:hidden",children:s("onboardingPage.connectShop.detailsShow")}),e.jsx("span",{className:"hidden group-open:inline",children:s("onboardingPage.connectShop.detailsHide")})]}),e.jsxs("div",{className:"mt-3 space-y-2.5 text-sm",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(de,{className:"w-4 h-4 text-success mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:s("onboardingPage.connectShop.readTitle")}),e.jsx("div",{className:"text-muted-foreground text-xs",children:s("onboardingPage.connectShop.readDetails")})]})]}),e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(Ye,{className:"w-4 h-4 text-primary mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:s("onboardingPage.connectShop.writeTitle")}),e.jsx("div",{className:"text-muted-foreground text-xs",children:s("onboardingPage.connectShop.writeDetails")})]})]}),e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(ie,{className:"w-4 h-4 text-muted-foreground mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:s("onboardingPage.connectShop.neverTitle")}),e.jsx("div",{className:"text-muted-foreground text-xs",children:s("onboardingPage.connectShop.neverDetails")})]})]})]})]})]}),e.jsxs(m,{onClick:ee,disabled:E,className:"bg-[hsl(24,100%,50%)] hover:bg-[hsl(24,100%,45%)] text-[hsl(0,0%,100%)] gap-2 w-full",children:[E?e.jsx(P,{className:"w-4 h-4 animate-spin"}):e.jsx(R,{className:"w-4 h-4"}),s(E?"onboardingPage.connectShop.redirectingButton":"onboardingPage.connectShop.connectButton")]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-4",children:[s("onboardingPage.connectShop.agreementText")," ",e.jsx("a",{href:"/privacy",className:"text-primary hover:underline",children:s("onboardingPage.connectShop.privacyPolicyLink")})," ",s("onboardingPage.connectShop.and")," ",e.jsx("a",{href:"/terms",className:"text-primary hover:underline",children:s("onboardingPage.connectShop.termsOfServiceLink")}),"."]}),e.jsxs("p",{className:"text-[11px] text-muted-foreground mt-3",children:[s("onboardingPage.connectShop.noEtsyShopText")," ",e.jsx("a",{href:"https://www.etsy.com/sell",target:"_blank",rel:"noreferrer",className:"text-primary hover:underline",children:s("onboardingPage.connectShop.openOneLink")})]}),e.jsx("p",{className:"text-[10px] italic text-muted-foreground
6/80 mt-4 leading-relaxed",children:s("onboardingPage.connectShop.etsyDisclaimer")})]}),d===1&&e.jsx("div",{children:me?e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-destructive/10 flex items-center justify-center mx-auto mb-4",children:e.jsx(ce,{className:"w-8 h-8 text-destructive"})}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:s("onboardingPage.syncing.couldntFindShopTitle")}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s("onboardingPage.syncing.couldntFindShopDescription")}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-6",children:[s("onboardingPage.syncing.noShopHelpText")," ",e.jsx("a",{href:"https://www.etsy.com/sell",target:"_blank",rel:"noreferrer",className:"text-primary hover:underline",children:s("onboardingPage.syncing.noShopHelpLink")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(m,{variant:"outline",className:"flex-1",onClick:()=>g("/app/settings"),children:s("onboardingPage.syncing.openSettingsButton")}),e.jsx(m,{className:"flex-1 bg-primary hover:bg-primary/90",onClick:Pe,disabled:Y,children:Y?e.jsx(P,{className:"w-4 h-4 animate-spin"}):s("onboardingPage.syncing.startOverButton")})]})]}):y?e.jsxs("div",{children:[e.jsxs("div",{className:"text-center mb-5",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-destructive/10 flex items-center justify-center mx-auto mb-3",children:e.jsx(ce,{className:"w-7 h-7 text-destructive"})}),e.jsx("h1",{className:"text-xl font-bold mb-1",children:y.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:y.cause})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 mb-4",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:s("onboardingPage.syncing.whatToDoNextLabel")}),e.jsx("ul",{className:"space-y-1.5 text-sm",children:y.steps.map((t,r)=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"mt-0.5 w-4 h-4 rounded-full bg-primary/10 text-primary flex items-center justify-center text-[10px] font-bold shrink-0",children:r+1}),e.jsx("span",{children:t})]},r))})]}),n.error&&e.jsxs("details",{className:"text-xs text-muted-foreground mb-4",children:[e.jsx("summary",{className:"cursor-pointer",children:s("onboardingPage.syncing.technicalDetailsLabel")}),e.jsx("code",{className:"block mt-2 p-2 rounded bg-muted text-[11px] break-all",children:n.error})]}),e.jsxs("div",{className:"flex gap-2",children:[y.secondary&&e.jsx(m,{variant:"outline",className:"flex-1",onClick:()=>re(y.secondary.action),children:y.secondary.label}),e.jsx(m,{className:"flex-1 bg-primary hover:bg-primary/90",onClick:()=>re(y.primary.action),children:y.primary.label})]}),e.jsxs("p",{className:"text-[11px] text-center text-muted-foreground mt-4 inline-flex items-center gap-1 w-full justify-center",children:[e.jsx(qe,{className:"w-3 h-3"}),e.jsx("a",{href:"/contact",className:"hover:text-foreground hover:underline",children:s("onboardingPage.syncing.getHelpLink")})]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsxs(H,{to:"/",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground mb-4",children:[e.jsx(oe,{className:"w-3.5 h-3.5"})," ",s("onboardingPage.connectShop.backToHomeLink")]}),e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("img",{src:Te,alt:"ShopScope AI",className:"w-8 h-8"}),e.jsx("span",{className:"font-bold text-lg text-foreground",children:"ShopScope AI"})]})]}),e.jsxs("div",{className:"text-center mb-5",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-primary/10 flex items-center justify-center mx-auto mb-3",children:e.jsx(P,{className:"w-7 h-7 text-primary animate-spin"})}),e.jsx("h1",{className:"text-xl font-bold mb-1",children:s("onboardingPage.syncing.syncingTitle")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:W[v]})]}),n.total>0&&e.jsxs("div",{className:"text-center mb-3",children:[e.jsxs("div",{className:"text-4xl font-bold text-foreground tabular-nums",children:[n.progress,e.jsxs("span",{className:"text-muted-foreground text-2xl font-medium",children:[" / ",n.total]})]}),e.jsx("div",{className:"text-[11px] text-muted-foreground mt-0.5",children:s("onboardingPage.syncing.listingsAnalyzedLabel","listings analyzed")})]}),e.jsx("div",{className:"mb-2 h-2 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${we}%`}})}),e.jsx("div",{className:"flex items-center justify-center gap-2 text-xs text-muted-foreground mb-4 text-center",children:n.total>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:s("onboardingPage.syncing.syncingImportedListings",{progress:n.progress,total:n.total})}),ne&&e.jsxs("span",{children:["· ",ne]})]}):e.jsx("span",{children:s("onboardingPage.syncing.durationHint")})}),e.jsxs("div",{className:"rounded-lg border border-border bg-card p-3 mb-4",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-primary mb-1",children:s("onboardingPage.syncing.didYouKnowLabel","Did you know?")}),e.jsx("p",{className:"text-sm text-foreground animate-in fade-in duration-500",children:s(`onboardingPage.syncing.didYouKnow.${le[G]}`)},G)]}),e.jsx("ul",{className:"space-y-2 mb-4",children:_.map((t,r)=>{const i=r<se?"done":r===se?"active":"pending",c=t.icon;return e.jsxs("li",{className:`flex items-start gap-2.5 rounded-lg border p-2.5 transition-colors ${i==="active"?"border-primary/40 bg-primary/5":i==="done"?"border-border bg-card":"border-border bg-card o
6pacity-60"}`,children:[e.jsx("div",{className:`mt-0.5 w-5 h-5 rounded-full flex items-center justify-center shrink-0 ${i==="done"?"bg-success/15 text-success":i==="active"?"bg-primary/15 text-primary":"bg-muted text-muted-foreground"}`,children:i==="done"?e.jsx(O,{className:"w-3 h-3"}):i==="active"?e.jsx(P,{className:"w-3 h-3 animate-spin"}):e.jsx(Ae,{className:"w-2 h-2"})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{className:`w-3.5 h-3.5 shrink-0 ${i==="active"?"text-primary":i==="done"?"text-success":"text-muted-foreground"}`}),e.jsx("span",{className:`text-sm font-medium ${i==="pending"?"text-muted-foreground":"text-foreground"}`,children:s(`onboardingPage.syncSteps.${t.key}.label`,t.label)})]})})]},t.key)})}),te&&e.jsx("p",{className:"text-[11px] text-muted-foreground text-center",children:te}),ge&&e.jsxs("div",{className:"mt-4 rounded-lg border border-warning/30 bg-warning/5 p-3 text-xs text-foreground text-center",children:[e.jsx("p",{className:"mb-2",children:s("onboardingPage.syncing.stalledMessage")}),e.jsx(m,{size:"sm",variant:"outline",onClick:B,children:s("onboardingPage.syncing.retrySyncButton")})]}),e.jsx("div",{className:"mt-4 text-center",children:J?e.jsxs("p",{className:"text-xs text-success inline-flex items-center gap-1",children:[e.jsx(O,{className:"w-3.5 h-3.5"}),s("onboardingPage.syncing.notifyMeConfirmed","We'll email you when it's ready.")]}):e.jsx("button",{type:"button",onClick:Se,disabled:Q,className:"text-xs text-muted-foreground hover:text-primary hover:underline disabled:opacity-50",children:s("onboardingPage.syncing.notifyMeLabel","Taking a while? Email me when it's ready →")})}),e.jsxs("div",{className:"mt-4 flex items-center justify-center gap-2",children:[e.jsxs(m,{size:"sm",variant:"outline",onClick:Ne,className:"gap-1.5",children:[e.jsx(We,{className:"w-3.5 h-3.5"})," Pause"]}),e.jsxs(m,{size:"sm",variant:"outline",onClick:()=>I(!0),className:"gap-1.5",children:[e.jsx(Me,{className:"w-3.5 h-3.5"})," Cancel"]})]})]})}),d===2&&e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-success/15 flex items-center justify-center mx-auto mb-4",children:e.jsx(O,{className:"w-8 h-8 text-success"})}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:X?s("onboardingPage.ready.personalizedTitle","Welcome aboard, {{shopName}}!",{shopName:X}):s("onboardingPage.ready.title")}),j&&j.listings===0?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:s("onboardingPage.ready.emptyShop.description","Your shop is connected, but we didn't find any active listings yet. Publish your first listing on Etsy, then refresh to import it.")}),e.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 mb-4 text-left",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:s("onboardingPage.ready.emptyShop.helpText","Once your listing is live on Etsy, click Refresh below.")}),e.jsx("a",{href:"https://www.etsy.com/your/shops/me/tools/listings/new",target:"_blank",rel:"noreferrer",className:"text-xs text-primary hover:underline",children:s("onboardingPage.ready.emptyShop.createListingLink","Create a listing on Etsy →")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(m,{variant:"outline",className:"flex-1",onClick:B,children:s("onboardingPage.ready.emptyShop.refreshButton","Refresh")}),e.jsxs(m,{onClick:()=>g("/app"),className:"flex-1 bg-primary hover:bg-primary/90 gap-2",children:[s("onboardingPage.ready.viewDashboardButton")," ",e.jsx($,{className:"w-4 h-4"})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:s("onboardingPage.ready.description",{listingCount:n.total||n.progress})}),e.jsxs("div",{className:"grid grid-cols-2 gap-2.5 mb-6",children:[e.jsxs("div",{className:"rounded-xl border border-border bg-card p-3.5 text-left",children:[e.jsx("div",{className:"text-2xl font-bold text-foreground",children:j?j.listings:n.total||n.progress||"—"}),e.jsx("div",{className:"text-[11px] text-muted-foreground mt-0.5",children:s("onboardingPage.ready.stats.listingsLabel")})]}),e.jsxs("div",{className:"rounded-xl border border-border bg-card p-3.5 text-left",children:[e.jsx("div",{className:"text-2xl font-bold text-foreground",children:(j==null?void 0:j.avgSeo)!=null?`${j.avgSeo}/100`:"—"}),e.jsx("div",{className:"text-[11px] text-muted-foreground mt-0.5",children:s("onboardingPage.ready.stats.avgSeoLabel")})]})]}),k&&e.jsxs(H,{to:`/app/listings/${k.id}`,className:"block rounded-xl border border-primary/30 bg-primary/5 hover:bg-primary/10 transition-colors p-3.5 mb-4 text-left group",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-primary mb-1",children:s("onboardingPage.ready.biggestOpportunityLabel","Biggest opportunity")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:k.title}),e.jsxs("div",{className:"text-[11px] text-muted-foreground",children:[s("onboardingPage.ready.seoScoreLabel","SEO score")," ",k.score,"/100"]})]}),e.jsx($,{className:"w-4 h-4 text-primary shrink-0 group-hover:translate-x-0.5 transition-transform"})]})]}),e.jsxs(m,{onClick:()=>g("/app"),className:"bg-primary hover:bg-primary/90 gap-2 w-full",children:[s("onboardingPage.ready.viewDashboardButton")," ",e.jsx($,{className:"w-4 h-4"})]})]})]})]},d)]})}),e.jsx(Ie,{open:je,onOpenChange:I,children:e.jsxs(Be,{children:[e.jsxs(Fe,{children:[e.jsx(He,{children:"Cancel setup?"}),e.jsx(Oe,{children:"Your Etsy shop sync will keep running in the background, but you'll be taken back to the main site. You can return anytime to finish setup."})]}),e.jsxs($e,{children:[e.jsx(Re,{children:"Keep syncing"}),e.jsx(ze,{onClick:ve,children:"Cancel setup"})]})]})})]})}export{as 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.