1import{u as I,r as i,j as e}from"./client-BfP5j8Uy.js";import{f as ee,F as se,v as de,g as ue,a9 as me}from"./editor-design-system-DLOlksdQ.js";import{F as D,a as he,u as pe,b as fe,P as ge,H as be,Z as ve,C as xe}from"./useZenfeedPageListActions-al6EevGS.js";import{l as ye,m as Ne,Z as ze,p as je,r as U}from"./zenfeedPageListUtils-D3AkoOoy.js";import{c as P}from"./createLucideIcon-BMvfDwyQ.js";import{S as ke,T as Le}from"./reviewPrompt-ClqwXn6y.js";import{E as q}from"./external-link-DVLInxbC.js";import{T as Pe}from"./main-CH-EDYm1.js";import{A as Se}from"./arrow-left-D5Un_f2d.js";import{S as we}from"./search-DPZ1pAAS.js";import"./package-49fbqLwJ.js";/** 2 * @license lucide-react v0.487.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 Ce=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],_e=P("chevron-left",Ce);/** 7 * @license lucide-react v0.487.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const Me=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]],Ee=P("circle-dollar-sign",Me);/** 12 * @license lucide-react v0.487.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const Ae=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],$e=P("clock",Ae);/** 17 * @license lucide-react v0.487.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */const Te=[["path",{d:"M19 5c-1.5 0-2.8 1.4-3 2-3.5-1.5-11-.3-11 5 0 1.8 0 3 2 4.5V20h4v-2h3v2h4v-4c1-.5 1.7-1 2-2h2v-4h-2c0-1-.5-1.5-1-2V5z",key:"1ivx2i"}],["path",{d:"M2 9v1c0 1.1.9 2 2 2h1",key:"nm575m"}],["path",{d:"M16 11h.01",key:"xkw8gn"}]],Ue=P("piggy-bank",Te);/** 22 * @license lucide-react v0.487.0 - ISC 23 * 24 * This source code is licensed under the ISC license. 25 * See the LICENSE file in the root directory of this source tree. 26 */const Ie=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Q=P("plus",Ie),te={manualHoursPerPage:8,agencyHourlyUsd:85,estimatedMonthlyRevenuePerLivePageUsd:450};function De(s={}){const t=Math.max(0,Number(s.pagesGenerated)||0),c=Math.max(0,Number(s.publishedPages)||0),{manualHoursPerPage:l,agencyHourlyUsd:o,estimatedMonthlyRevenuePerLivePageUsd:d}=te,f=t*l,m=f*o,u=c*d;return{pagesGenerated:t,publishedPages:c,hoursSaved:f,moneySavedUsd:m,estimatedRevenueUsd:u}}function Re(s){const t=Math.max(0,Number(s)||0);if(t<24)return`${Math.round(t)} hrs`;if(t<168){const o=Math.max(1,Math.round(t/8));return`${o} ${o===1?"day":"days"}`}const c=Math.max(1,Math.round(t/40));if(c<8)return`${c} ${c===1?"week":"weeks"}`;const l=Math.max(1,Math.round(c/4));return`${l} ${l===1?"month":"months"}`}function K(s,t={}){const{compact:c=!0,suffix:l=""}=t,o=Math.max(0,Number(s)||0);return o===0?`$0${l}`:c&&o>=1e3?`${new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",notation:"compact",maximumFractionDigits:o>=1e5?0:1}).format(o)}${l}`:`${new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(o)}${l}`}function He(s={}){const t=De(s);return[{key:"time-saved",value:Re(t.hoursSaved),label:"Time saved vs. agency",hint:t.pagesGenerated>0?`~${t.pagesGenerated} pages à 8 hrs each â built in ~60s with Zenfeed`:"Each page replaces ~8 hrs of design, copy, and dev",color:"teal",iconName:"Clock",hintTone:t.hoursSaved>0?"positive":"neutral"},{key:"money-saved",value:K(t.moneySavedUsd),label:"Agency fees avoided",hint:t.moneySavedUsd>0?`Based on $${te.agencyHourlyUsd}/hr freelance benchmarks`:"Skip $500â$2K+ per manual product page",color:"rose",iconName:"PiggyBank",hintTone:t.moneySavedUsd>0?"positive":"neutral"},{key:"revenue",value:K(t.estimatedRevenueUsd,{suffix:"/mo"}),label:"Est. revenue from live pages",hint:t.publishedPages>0?`${t.publishedPages} published ${t.publishedPages===1?"page":"pages"} on conversion templates`:"Publish pages to unlock storefront revenue",color:"gold",iconName:"CircleDollarSign",hintTone:t.estimatedRevenueUsd>0?"positive":"neutral",footnote:"Est."}]}const We={FileText:D,Clock:$e,PiggyBank:Ue,CircleDollarSign:Ee};function Be({card:s}){const{iconName:t,value:c,label:l,hint:o,color:d,hintTone:f,footnote:m}=s,u=We[t]||D;return e.jsxs("article",{className:`zf-home-metric-card zf-home-metric-card--${d}`,children:[m?e.jsx("span",{className:"zf-home-metric-footnote",children:m}):null,e.jsx("div",{className:`zf-home-metric-well zf-home-metric-well--${d}`,children:e.jsx(u,{className:`zf-home-metric-svg zf-home-metric-svg--${d}`,strokeWidth:2})}),e.jsxs("div",{className:"zf-home-metric-text",children:[e.jsx("p",{className:`zf-home-metric-value zf-home-metric-value--${d}`,children:c}),e.jsx("p",{className:"zf-home-metric-label",children:l}),e.jsx("p",{className:["zf-home-metric-hint",f==="positive"?"zf-home-metric-hint--positive":""].filter(
26Boolean).join(" "),children:o})]})]})}function Fe(){return e.jsxs("article",{className:"zf-home-metric-card zf-home-metric-card--skeleton","aria-hidden":"true",children:[e.jsxs("div",{className:"zf-home-skel-metric-copy",children:[e.jsx("div",{className:"zf-home-skel-line zf-home-skel-line--value"}),e.jsx("div",{className:"zf-home-skel-line zf-home-skel-line--label"}),e.jsx("div",{className:"zf-home-skel-line zf-home-skel-line--hint"})]}),e.jsx("div",{className:"zf-home-skel-well"})]})}function Oe(){const{t:s}=I(),t=ee(),c=se(),l=i.useRef(t),o=i.useRef(!1),[d,f]=i.useState(null);return l.current=t,i.useEffect(()=>{let m=!1;return(async()=>{const{data:u}=await ye((S,w)=>l.current(S,w));if(m)return;const A=Number(u==null?void 0:u.allPageCount)||0;f(He(Ne((u==null?void 0:u.metrics)??{},(u==null?void 0:u.shopStats)??{},A)))})(),()=>{m=!0}},[]),i.useEffect(()=>{!d||o.current||(o.current=!0,c("dashboard_viewed",{source:"all_pages"}))},[d,c]),e.jsxs("section",{className:"zf-home-impact zf-pages-impact","aria-label":s("dashboard.impactSectionAriaLabel"),"aria-busy":d==null,children:[e.jsxs("div",{className:"zf-home-impact-head",children:[e.jsx("h3",{children:s("dashboard.impactHeading")}),e.jsx("p",{children:s("dashboard.impactSubheading")})]}),e.jsx("div",{className:"zf-home-metrics-grid zf-home-metrics-grid--impact",children:d?d.map(m=>e.jsx(Be,{card:m},m.key)):[0,1,2].map(m=>e.jsx(Fe,{},m))})]})}function Y(s){window.open(s,"_blank","noopener,noreferrer")}function Ve({source:s="unknown"}){const{t}=I(),c=se(),l=()=>{c("rate_us_clicked",{target:"shopify_app_store",source:s}),Y(ke)},o=()=>{c("rate_us_clicked",{target:"trustpilot",source:s}),Y(Le)};return e.jsxs("div",{className:"zf-rate-shortcuts",role:"group","aria-label":t("rateUs.shortcutsAriaLabel"),children:[e.jsx("span",{className:"zf-rate-shortcuts__label",children:t("rateUs.shortcutsLabel")}),e.jsxs("button",{type:"button",className:"zf-rate-shortcuts__btn",onClick:l,children:[t("rateUs.shopifyCta"),e.jsx(q,{className:"zf-rate-shortcuts__icon",strokeWidth:2,"aria-hidden":"true"})]}),e.jsxs("button",{type:"button",className:"zf-rate-shortcuts__btn",onClick:o,children:[t("rateUs.trustpilotCta"),e.jsx(q,{className:"zf-rate-shortcuts__icon",strokeWidth:2,"aria-hidden":"true"})]})]})}const X=450;function as(){const{t:s}=I(),t=de(),c=ue(),l=ee(),o=he(),{showWarning:d,warningTitle:f,warningCopy:m,upgradeBusy:u,onUpgrade:A}=pe({source:"zenfeed_pages"}),[S,w]=i.useState(!0),[$,R]=i.useState(null),[x,H]=i.useState(null),[C,ae]=i.useState(""),[N,T]=i.useState("all"),[j,ne]=i.useState("latest"),[re,k]=i.useState(1),{openPageView:ie,openPageEdit:W}=fe(t,l,c,{returnPath:"/zenfeed-pages"}),g=i.useCallback(async({silent:a=!1}={})=>{const h=Date.now();a||w(!0),R(null);try{const r=new AbortController,n=window.setTimeout(()=>r.abort(),ze),v=await l("/api/zenfeed-pages",{signal:r.signal}).finally(()=>{window.clearTimeout(n)}),p=await v.json().catch(()=>({}));if(!v.ok){const y=typeof p.error=="string"&&p.error?p.error:s("pagesList.errors.couldNotLoadPages");throw new Error(y)}H(Array.isArray(p.pages)?p.pages:[])}catch(r){const n=r&&typeof r=="object"&&r.name==="AbortError";R(n?s("pagesList.errors.couldNotLoadPagesTimeout"):r instanceof Error?r.message:s("pagesList.errors.couldNotLoadPages")),a||H(null)}finally{if(!a){const r=Date.now()-h;r<X&&await new Promise(n=>window.setTimeout(n,X-r))}w(!1)}},[l]);i.useEffect(()=>{g()},[g]),i.useEffect(()=>me(()=>{g({silent:!0})}),[g]),i.useEffect(()=>{let a=0;const h=()=>{if(document.visibilityState!=="visible")return;const r=Date.now();r-a<2e3||(a=r,g({silent:!0}))};return document.addEventListener("visibilitychange",h),window.addEventListener("focus",h),()=>{document.removeEventListener("visibilitychange",h),window.removeEventListener("focus",h)}},[g]);const _=o.length,B=i.useRef(_);i.useEffect(()=>{const a=B.current;B.current=_,a>0&&_===0&&g({silent:!0})},[_,g]);const F=i.useMemo(()=>{const a=Array.isArray(x)?[...x]:[],h=C.trim().toLowerCase(),r=a.filter(n=>{const v=String((n==null?void 0:n.productName)||"").toLowerCase(),p=!h||v.includes(h);let y=!0;return N==="published"?y=String((n==null?void 0:n.status)||"").toLowerCase()==="published":N==="draft"&&(y=!!(n!=null&&n.isZenfeedDraft)||Str
26ing((n==null?void 0:n.status)||"").toLowerCase()==="draft"||je(n)),p&&y});return r.sort((n,v)=>{if(j==="name")return String((n==null?void 0:n.productName)||"").localeCompare(String((v==null?void 0:v.productName)||""));const p=new Date(U(n)||0).getTime(),y=new Date(U(v)||0).getTime();return j==="oldest"?p-y:y-p}),r},[x,C,N,j]);i.useEffect(()=>{k(1)},[C,N,j]);const M=10,b=F.length,z=b===0?1:Math.max(1,Math.ceil(b/M));i.useEffect(()=>{k(a=>Math.min(Math.max(1,a),z))},[z]);const L=Math.min(re,z),E=(L-1)*M,oe=F.slice(E,E+M),O=5,V=Math.max(1,Math.min(L-2,z-O+1)),ce=Math.min(z,V+O-1),Z=[];for(let a=V;a<=ce;a++)Z.push(a);const G=!S&&!$&&x!==null,J=Array.isArray(x)&&x.length>0,le=b===0?s("pagesList.paginationEmpty"):s("pagesList.paginationShowing",{start:E+1,end:Math.min(E+M,b),total:b});return e.jsxs(e.Fragment,{children:[e.jsx(Pe,{title:s("pagesList.titleBar")}),e.jsx("div",{className:"zf-pages-shell",children:e.jsxs("div",{className:"zf-pages-inner",children:[d?e.jsx(ge,{source:"zenfeed_pages",onUpgrade:A,upgradeBusy:u,title:f,copy:m}):null,e.jsx("div",{className:"zf-pages-intro",children:e.jsxs("div",{className:"zf-pages-hero-row",children:[e.jsxs("button",{type:"button",className:"zf-pages-backlink",onClick:()=>t("/"),children:[e.jsx(Se,{className:"zf-pages-backlink-icon",strokeWidth:2}),s("errors.backToHome")]}),e.jsxs("div",{className:"zf-pages-hero-actions",children:[e.jsx(Ve,{source:"zenfeed_pages"}),e.jsxs("button",{type:"button",className:"zf-pages-create-btn",onClick:()=>t("/product-page-builder"),children:[e.jsx(Q,{className:"zf-pages-create-icon",strokeWidth:2}),s("pagesList.createNewPage")]})]})]})}),e.jsx(be,{returnPath:"/zenfeed-pages",onOpenDraft:({draftSnapshotId:a})=>{const h=(Array.isArray(x)?x.find(r=>(r==null?void 0:r.draftSnapshotId)===a):null)||(a?{id:`draft:${a}`,draftSnapshotId:a,status:"draft",productName:s("pagesList.statusDraft")}:null);h&&W(h)}}),e.jsx(Oe,{}),S?e.jsxs("div",{className:"zf-pages-card zf-pages-card--loading",role:"status","aria-live":"polite",children:[e.jsx("span",{className:"zf-pages-spinner","aria-hidden":"true"}),e.jsx("span",{children:s("pagesList.loadingPages")})]}):null,$?e.jsxs("div",{className:"zf-pages-card zf-pages-card--error",role:"alert",children:[e.jsx("p",{className:"zf-pages-error-text",children:$}),e.jsx("button",{type:"button",className:"zf-pages-retry",onClick:()=>g(),children:s("errors.tryAgain")})]}):null,G&&!J?e.jsxs("div",{className:"zf-pages-card zf-pages-empty-card",children:[e.jsx("div",{className:"zf-pages-empty-icon-wrap",children:e.jsx(D,{className:"zf-pages-empty-icon",strokeWidth:2})}),e.jsx("h3",{className:"zf-pages-empty-title",children:s("pagesList.emptyHeading")}),e.jsx("p",{className:"zf-pages-empty-body",children:s("pagesList.emptySubheading")}),e.jsxs("button",{type:"button",className:"zf-pages-create-btn",onClick:()=>t("/product-page-builder"),children:[e.jsx(Q,{className:"zf-pages-create-icon",strokeWidth:2}),s("pagesList.createNewPage")]})]}):null,G&&J?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"zf-pages-card zf-pages-toolbar-card",children:e.jsxs("div",{className:"zf-pages-toolbar-row",children:[e.jsxs("div",{className:"zf-pages-search-wrap",children:[e.jsx(we,{className:"zf-pages-search-icon",strokeWidth:2}),e.jsx("input",{type:"text",placeholder:s("pagesList.searchPlaceholder"),value:C,onChange:a=>ae(a.target.value),className:"zf-pages-search-input"})]}),e.jsxs("div",{className:"zf-pages-controls",children:[e.jsxs("div",{className:"zf-pages-filter-pills",role:"group","aria-label":s("pagesList.filterGroupAriaLabel"),children:[e.jsx("button",{type:"button",className:`zf-pages-pill ${N==="all"?"is-active":""}`,onClick:()=>T("all"),children:s("pagesList.filterAll")}),e.jsx("button",{type:"button",className:`zf-pages-pill ${N==="published"?"is-active":""}`,onClick:()=>T("published"),children:s("pagesList.filterPublished")}),e.jsx("button",{type:"button",className:`zf-pages-pill ${N==="draft"?"is-active":""}`,onClick:()=>T("draft"),children:s("pagesList.filterDraft")})]}),e.jsxs("select",{value:j,onChange:a=>ne(a.target.value),className:"zf-pages-sort","aria-label":s("pagesList.sortAriaLabel"),children:[e.jsx("option",{value:"latest",children:s("pagesList.sortLatest")}),e.jsx("option",{value:"oldest",children:s("pagesList.sortOldest")}),e.jsx("option",{value:"name",children:s("pagesList.sortName")})]})]})]})}),e.jsxs("div",{className:"zf-pages-card zf-pages-data-card",children:[e.jsx(ve,{pages:oe,dateColumnHeader:s("pagesList.dateColumnHeader"),getDateIso:U,onView:ie,onEdit:W,activePublishJobs:o,tableEmptyMessage:b===0?s("pagesList.tableEmptyFiltered"):void 0}),e.jsxs("div",{className:"zf-pages-pagination-bar",children:[e.jsx("p",{className:"zf-pages-pagination-label",children:le}),e.jsxs("div",{className:"zf-pages-pagination-controls",children:[e.jsx("button",{type:"button",className:"zf-pages-page-btn zf-pages-page-btn--icon",onClick:()=>k(a=>Math.max(1,a-1)),disabled:L<=1||b===0,"aria-label":s("pagesList.previousPageAriaLabel"),children:e.jsx(_e,{className:"zf-pages-chevron",strokeWidth:2})}),Z.map(a=>e.jsx("button",{type:"button",className:`zf-pages-page-btn ${L===a?"is-active":""}`,onClick:()=>k(a),disabled:b===0,children:a},a)),e.jsx("button",{type:"button",className:"zf-pages-page-btn zf-pages-page-btn--icon",onClick:()=>k(a=>Math.min(z,a+1)),disabled:L>=z||b===0,"aria-label":s("pagesList.nextPageAriaLabel"),children:e.jsx(xe,{className:"zf-pages-chevron",strokeWidth:2})})]})]})]})]}):null]})})]})}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.