PageSourceSearch

https://podgo.io/assets/ShopProductDetail-DZfEQvY8.js

js podgo.io collected 2026-10-04 14:14:31 UTC 5,839 bytes, 2 lines download raw bytes

1import{o as I,r as i,j as e,L as w,B as l,g as u,I as V}from"./index-xdbbHqKJ.js";import{B as h}from"./badge-C93euLRk.js";import{C as E,c as Q}from"./card-DVeplWrt.js";import{L as k}from"./label-DSbGZLpF.js";import{a as A,C as T,b as F,d as O,r as U,D as $,e as z,E as D,f as C,i as L}from"./useShop-D9JenN5I.js";import{P as R}from"./package-P-Es-HyY.js";import{A as H}from"./arrow-left-BpoqxW5j.js";import{E as G}from"./external-link-3EJm366G.js";import{M as J}from"./message-square-quote-BIxsMWw9.js";import{S as K}from"./shopping-cart-WK98-nKB.js";import"./adminActivityService-t0IkZaVf.js";import"./frequency-BLxUlBku.js";function ce(){var b,v,y;const{slug:p}=I(),{data:s,isLoading:S}=A(p),{add:o}=T(),[c,M]=i.useState({}),[g,q]=i.useState(1),[m,P]=i.useState(0);F(s==null?void 0:s.id,`/marketing/${p??""}`);const r=i.useMemo(()=>((s==null?void 0:s.images)??[]).slice().sort((a,t)=>a.sort_order-t.sort_order),[s]),d=i.useMemo(()=>((s==null?void 0:s.options)??[]).slice().sort((a,t)=>a.sort_order-t.sort_order),[s]),n=i.useMemo(()=>O(s==null?void 0:s.variants,c),[s,c]);if(S)return e.jsx("div",{className:"flex justify-center py-20",children:e.jsx(w,{className:"h-6 w-6 animate-spin text-muted-foreground"})});if(!s||s.status!=="published"||s.hide_details_page)return e.jsx(E,{children:e.jsxs(Q,{className:"flex flex-col items-center gap-4 py-16 text-center",children:[e.jsx(R,{className:"h-10 w-10 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"This product isn't available."}),e.jsx(l,{asChild:!0,variant:"outline",children:e.jsx(u,{to:"/marketing",children:"Back to shop"})})]})});const f=d.length>0&&!n,x=U(s,n),j=$(n),N=z(s),_=D(s,"podcaster");return e.jsxs("div",{className:"space-y-6",children:[e.jsx(l,{variant:"ghost",size:"sm",className:"-ml-2",asChild:!0,children:e.jsxs(u,{to:"/marketing",children:[e.jsx(H,{className:"mr-2 h-4 w-4"})," Back to shop"]})}),e.jsxs("div",{className:r.length>0?"grid gap-8 lg:grid-cols-2":"grid gap-8",children:[r.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"aspect-square overflow-hidden rounded-xl border bg-muted",children:e.jsx("img",{src:(n==null?void 0:n.image_url)??(r[m]??r[0]).url,alt:(r[m]??r[0]).alt_text??s.name,className:"h-full w-full object-cover"})}),r.length>1&&e.jsx("ul",{className:"grid grid-cols-5 gap-2",children:r.map((a,t)=>e.jsx("li",{children:e.jsx("button",{type:"button","aria-label":`View image ${t+1}`,onClick:()=>P(t),className:`block w-full overflow-hidden rounded-md border ${t===m?"ring-2 ring-primary":""}`,children:e.jsx("img",{src:a.url,alt:"",className:"aspect-square w-full object-cover"})})},a.id))})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.badge_text&&e.jsx(h,{children:s.badge_text}),((b=s.category)==null?void 0:b.name)&&e.jsx(h,{variant:"outline",children:s.category.name}),_&&e.jsx(h,{variant:"secondary",children:_})]}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight sm:text-3xl",children:s.name}),((v=s.partner)==null?void 0:v.name)&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Fulfilled by ",s.partner.name]})]}),e.jsx("div",{className:"flex flex-wrap items-baseline gap-2",children:x==null?e.jsx("span",{className:"text-xl font-semibold",children:"Quote on request"}):e.jsxs(e.Fragment,{children:[s.is_starting_at&&e.jsx("span",{className:"text-muted-foreground",children:"from"}),e.jsx("span",{className:"text-2xl font-semibold",children:C(x,s.currency)}),s.compare_at_cents!=null&&s.compare_at_cents>x&&e.jsx("span",{className:"text-muted-foreground line-through",children:C(s.compare_at_cents,s.currency)}),s.pricing_basis&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["/ ",s.pricing_basis]})]})}),s.short_description&&e.jsx("p",{className:"text-muted-foreground",children:s.short_description}),d.map(a=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{children:a.name}),e.jsx("div",{className:"flex flex-wrap gap-2",children:a.values.map(t=>e.jsx(l,{size:"sm",variant:c[a.name]===t?"default":"outline",onClick:()=>M(B=>({...B,[a.name]:t})),children:t},t))})]},a.id)),s.fulfillment_mode!=="redirect"&&(s.single_per_cart?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Limited to one per request."}):e.jsxs("div",{className:"space-y-2 sm:max-w-[10rem]",children:[e.jsx(k,{htmlFor:"qty",children:"Quantity"}),e.jsx(V,{id:"qty",type:"number",min:1,value:g,onChange:a=>q(Math.max(1,Number(a.target.value)||1))})]})),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.fulfillment_mode==="redirect"?e.jsx(l,{asChild:!0,disabled:!N,className:"min-h-11",children:e.jsxs("a",{href:N??"#",target:"_blank",rel:"noreferrer",children:[e.jsx(G,{className:"mr-2 h-4 w-4"})," Continue to ",((y=s.partner)==null?void 0:y.name)??"partner"]})}):e.jsxs(l,{className:"min-h-11",disabled:f||j||o.isPending,onClick:()=>o.mutate({product:s,variant:n,quantity:g}),children:[o.isPending?e.jsx(w,{className:"mr-2 h-4 w-4 animate-spin"}):L(s.fulfillment_mode)?e.jsx(J,{className:"mr-2 h-4 w-4"}):e.jsx(K,{className:"mr-2 h-4 w-4"}),L(s.fulfillment_mode)?"Add to quote request":"Add to cart"]}),e.jsx(l,{variant:"outline",className:"min-h-11",asChild:!0,children:e.jsx(u,{to:"/marketing/cart",children:"View cart"})})]}),f&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Choose ",d.map(a=>a.name.toLowerCase()).join(" and ")," to continue."]}),j&&e.jsx("p",{className:"text-sm text-destructive",children:"That option is out of stock."}),s.description_html&&e.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none pt-2",dangerouslySetInnerHTML:{__html:s.description_html}})]})]})]})}export{ce as default};
2//# sourceMappingURL=ShopProductDetail-DZfEQvY8.js.map

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.