PageSourceSearch

https://duckmerce.lovable.app/assets/SectionPage-CMoCMqzG.js

js duckmerce.lovable.app collected 2026-10-03 03:21:52 UTC 10,517 bytes, 1 lines download raw bytes

1import{f as S,R as w,h as z,s as k,j as e,L as u,e as b,F as L,U as _,C as U,a as A}from"./index-CKitxjzp.js";import{A as r}from"./app-JTSIS_wT.js";import{g as R}from"./sectionColors-nGZS-TFr.js";const I={financials:{label:"P&L & Financials",labelAr:"الأرباح والخسائر",desc:"Build your P&L, track margins, and understand your store's financial health.",emoji:"💰"},pricing:{label:"Pricing Intelligence",labelAr:"ذكاء التسعير",desc:"Optimize pricing, model discounts, and build profitable bundles.",emoji:"🏷️"},media:{label:"Media & Campaigns",labelAr:"الميديا والحملات",desc:"Plan campaigns, allocate budget, and track ad spend ROI.",emoji:"📢"},metrics:{label:"Store Metrics",labelAr:"مقاييس المتجر",desc:"Track KPIs, conversion rates, and build performance reports.",emoji:"📊"},inventory:{label:"Inventory & SKUs",labelAr:"المخزون والمنتجات",desc:"Manage SKUs, track turnover, and optimize stock levels.",emoji:"📦"},customers:{label:"Customer Retention",labelAr:"الاحتفاظ بالعملاء",desc:"Calculate LTV, track churn, and build retention flows.",emoji:"🎯"},operations:{label:"Operations",labelAr:"العمليات",desc:"Optimize fulfillment costs, shipping, and supplier management.",emoji:"⚙️"},growth:{label:"Growth Planning",labelAr:"تخطيط النمو",desc:"Set revenue goals, plan experiments, and prepare to scale.",emoji:"🚀"}},D=r.freeModules,F={empty:{label:"Not Started",bg:"bg-stone-100",text:"text-stone-400",bar:"bg-stone-200"},in_progress:{label:"In Progress",bg:"bg-amber-50",text:"text-amber-600",bar:"bg-amber-400"},done:{label:"Done ✓",bg:"bg-emerald-50",text:"text-primary",bar:"bg-primary"}};function O({done:n,total:t}){const d=t>0?n/t*100:0,c=18,a=2*Math.PI*c,o=a-d/100*a;return e.jsxs("div",{className:"relative w-12 h-12 flex-shrink-0",children:[e.jsxs("svg",{className:"w-12 h-12 -rotate-90",viewBox:"0 0 44 44",children:[e.jsx("circle",{cx:"22",cy:"22",r:c,fill:"none",stroke:"hsl(var(--border))",strokeWidth:"3"}),e.jsx("circle",{cx:"22",cy:"22",r:c,fill:"none",stroke:"hsl(var(--primary))",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:a,strokeDashoffset:o,className:"transition-all duration-700 ease-out"})]}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("span",{className:"text-[10px] font-mono font-bold text-stone-700",children:[n,"/",t]})})]})}function K({section:n}){const t=I[n],d=R(n),{profile:c,workspace:a,subscription:o}=S(),[g,x]=w.useState(!1),[C,j]=w.useState(),P=(o==null?void 0:o.plan)??(c==null?void 0:c.plan)??"free",y=o==null?void 0:o.status,p=P!=="free"&&y!=="expired"&&y!=="suspended",$=!p&&!D.includes(n),{data:f=[],isLoading:N}=z({queryKey:["tools",n,a==null?void 0:a.id],queryFn:async()=>{const[s,m]=await Promise.all([k.from("tools").select("*").eq("section",n).order("sort_order"),a!=null&&a.id?k.from("tool_data").select("*").eq("workspace_id",a.id):Promise.resolve({data:[],error:null})]);if(s.error)throw s.error;const h=new Map((m.data??[]).map(l=>[l.tool_slug,l]));return(s.data??[]).map(l=>{const i=h.get(l.slug);return{...l,status:(i==null?void 0:i.status)??"empty",progress_pct:(i==null?void 0:i.progress_pct)??0}})}}),M=f.filter(s=>s.status==="done").length,v=f.length;return $?e.jsxs("div",{className:"p-4 sm:p-6 max-w-3xl mx-auto animate-fade-in",children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs("nav",{className:"text-xs text-stone-400 mb-3",children:[e.jsx(u,{to:"/os",className:"hover:text-stone-600",children:"Dashboard"}),e.jsx("span",{className:"mx-1.5",children:"/"}),e.jsx("span",{className:"text-stone-600",children:t.label})]}),e.jsx("h1",{className:"text-xl font-bold text-stone-900",children:t.label}),e.jsx("p",{className:"font-arabic text-[10px] text-stone-400 mt-0.5",dir:"rtl",style:{textAlign:"left"},children:t.labelAr})]}),e.jsxs("div",{className:"bg-white border-2 border-stone-200 rounded-2xl p-8 text-center shadow-card",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl bg-stone-100 flex items-center justify-center mx-auto mb-4",children:e.jsx(b,{size:22,className:"text-stone-400"})}),e.jsx("h2",{className:"font-bold text-stone-900 text-lg mb-1",children:"🔒 This module is locked"}),e.jsx("p",{className:"font-arabic text-[10px] text-stone-400 mb-3",dir:"rtl",children:"هذا القسم مقفل"}),e.jsxs("p",{className:"text-sm text-stone-500 mb-6",children:["Upgrade to get full access to ",e.jsx("strong",{children:t.label})," and all tools across every module."]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[e.jsxs("button",{onClick:()=>x(!0),className:"flex items-center justify-center gap-2 px-5 py-2.5 rounded-xl bg-primary text-primary-foreground font-semibold text-sm hover:opacity-90 transition-all",children:["Upgrade to ",r.pricing.annual.label," — $",r.pricing.annual.price,"/",r.pricing.annual.period,e.jsx("span",{className:"font-arabic text-[9px] opacity-80",dir:"rtl",children:"اشتراك سنوي"})]}),e.jsxs("button",{onClick:()=>x(!0),className:"relative flex items-center justify-center gap-2 px-5 py-2.5 rounded-xl bg-stone-900 text-white font-semibold text-sm hover:opacity-90 transition-all",children:["Get ",r.pricing.lifetime.label," — $",r.pricing.lifetime.price," once",e.jsxs("span",{className:"inline-flex items-center gap-0.5 bg-primary text-primary-foreground text-[9px] font-bold px-1.5 py-0.5 rounded-full",children:[e.jsx(L,{size:8})," Early Adopter"]})]})]})]}),g&&e.jsx(_,{onClose:()=>x(!1)})]}):e.jsxs("div",{className:"p-4 sm:p-6 max-w-3xl mx-auto animate-fade-in",children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs("nav",{className:"text-xs text-stone-400 mb-3",children:[e.jsx(u,{to:"/os",className:"hover:text-stone-600",children:"Dashboard"}),e.jsx("span",{className:"mx-1.5",children:"/"}),e.jsx("span",{className:"text-stone-600",children:t.label})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-xl ${d.bg} flex items-center justify-center text-lg flex-shrink-0`,children:t.emoji}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-stone-900",children:t.label}),e.jsx("p",{className:"font-arabic text-[10px] text-stone-400 mt-0.5",dir:"rtl",style:{textAlign:"left"},children:t.labelAr}),e.jsx("p",{className:"text-sm text-stone-500 mt-1",children:t.desc})]})]}),!N&&v>0&&e.jsx(O,{done:M,total:v})]})]}),N?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map((s,m)=>e.jsx("div",{className:"h-[72px] rounded-xl animate-shimmer"},m))}):e.jsx("div",{className:"space-y-2",children:f.map((s,m)=>{const h=!p&&!s.is_free,l=F[s.status],i=Math.min(m*50,300);return h?e.jsxs("button",{onClick:()=>{j(s.name_en),x(!0)},style:{animationDelay:`${i}ms`},className:"w-full flex items-center justify-between bg-white border border-stone-200 rounded-xl px-4 py-3.5 shadow-card group opacity-0 animate-fade-in hover:opacity-100 hover:border-stone-300 transition-all text-left",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-8 h-8 rounded-lg bg-stone-100 flex items-center justify-center text-sm grayscale flex-shrink-0",children:s.emoji}),e.jsx("p",{className:"font-semibold text-stone-700 text-sm",children:s.name_en}),e.jsxs("span",{className:"text-[9px] sm:text-[10px] font-semibold text-stone-400 bg-stone-100 border border-stone-200 px-1 sm:px-1.5 py-0.5 rounded-full flex items-center gap-1",children:[e.jsx(b,{size:8})," Pro+"]})]}),e.jsx("p",{className:"font-arabic text-[9px] text-stone-400 mt-0.5 ml-10",dir:"rtl",style:{textAlign:"left"},children:s.name_ar})]}),e.jsx(b,{size:13,className:"text-stone-300 flex-shrink-0 ml-4"})]},s.slug):e.jsxs(u,{to:`/os/${n}/${s.slug}`,style:{animationDelay:`${i}ms`},className:`flex flex-col bg-white border border-stone-200 border-l-[3px] ${d.border} rounded-xl px-4 py-3.5 hover:shadow-hover hover:-translate-y-0.5 ${d.bgHover} transition-all duration-200 shadow-card group opacity-0 animate-fade-in`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:`w-8 h-8 rounded-lg ${d.bg} flex items-center justify-center text-sm flex-shrink-0`,children:s.emoji}),e.jsx("p",{className:"font-semibold text-stone-900 text-sm",children:s.name_en}),s.is_free&&e.jsx("span",{className:"text-[10px] font-semibold text-primary bg-emerald-50 border border-emerald-100 px-1.5 py-0.5 rounded-full",children:"✦ Free"}),e.jsxs("span",{className:`text-[9px] sm:text-[10px] font-semibold px-1 sm:px-1.5 py-0.5 rounded-full ${l.bg} ${l.text}`,children:[s.status==="done"&&e.jsx(U,{size:9,className:"inline mr-0.5 -mt-px"}),l.label]})]}),e.jsx("p",{className:"font-arabic text-[9px] text-stone-400 mt-0.5 ml-10",dir:"rtl",style:{textAlign:"left"},children:s.name_ar}),s.description_en&&e.jsx("p",{className:"text-xs text-stone-500 mt-1 ml-10",children:s.description_en})]}),e.jsx(A,{size:15,className:"text-stone-300 group-hover:text-primary group-hover:translate-x-1 transition-all flex-shrink-0 ml-4 hidden sm:block"})]}),s.status!=="empty"&&e.jsx("div",{className:"mt-2.5 ml-10 h-1 rounded-full bg-stone-100 overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-700 ${l.bar}`,style:{width:`${s.progress_pct}%`}})})]},s.slug)})}),!p&&e.jsxs("div",{className:"mt-6 p-4 bg-stone-900 border border-stone-800 rounded-xl flex flex-col sm:flex-row items-start sm:items-center gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-xs font-semibold text-white",children:"Unlock all tools"}),e.jsxs("p",{className:"text-[11px] text-stone-400 mt-0.5",children:[r.pricing.annual.label," $",r.pricing.annual.price,"/yr · ",r.pricing.lifetime.label," $",r.pricing.lifetime.price," once"]})]}),e.jsxs("button",{onClick:()=>{j(void 0),x(!0)},className:"w-full sm:w-auto flex-shrink-0 flex items-center justify-center gap-1 bg-primary text-primary-foreground text-xs font-semibold px-3 py-2 sm:py-1.5 rounded-lg hover:opacity-90 transition-all min-h-[44px] sm:min-h-0",children:["Upgrade ",e.jsx(A,{size:11})]})]}),g&&e.jsx(_,{toolName:C,onClose:()=>x(!1)})]})}export{K 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.