PageSourceSearch

https://liefersoft.de/assets/PublicShopProduct-BJPvkNHm.js

js liefersoft.de collected 2026-10-01 15:22:06 UTC 4,908 bytes, 1 lines download raw bytes

1import{h as q,r as n,s as z,aA as G,w as U,b as $,aB as L,j as e,N as u,i as D,e as m,L as P,n as K,C as M,K as Q,B as V,F as Z}from"./index-DtAltElw.js";import{u as H}from"./usePublicCart-B1jTnXtZ.js";const W=()=>{var h,_,f,j,b,N,y,v,k;const{slug:c}=q(),[s,E]=n.useState(null),[F,g]=n.useState(!0),[x,B]=n.useState(1),A=H();if(n.useEffect(()=>{if(c)return(async()=>{var w;g(!0);const{data:i}=await z.rpc("get_public_shop_products",{p_country:null}),r=(i||[]).find(t=>t.slug===c||t.id===c)||null,a=r?{...r,articles:{name:r.article_name,description:r.article_description,selling_price:r.selling_price,article_number:r.article_number,image_urls:r.image_urls,tax_rate:r.tax_rate,manufacturer:r.manufacturer,weight_kg:r.weight_kg,ean:r.ean}}:null;if(E(a),g(!1),a){const t=a.articles,S=a.seo_meta_title||a.marketing_title||(t==null?void 0:t.name)||"Produkt",C=a.seo_meta_description||a.marketing_description||(t==null?void 0:t.description)||"",d=a.hero_image_url||((w=t==null?void 0:t.image_urls)==null?void 0:w[0])||G(a.category_label,"public_shop"),R=a.price_override??(t==null?void 0:t.selling_price)??0,I=`${U}/shop/${a.slug||a.id}`;$({title:`${S} – Liefersoft Shop`,description:C,canonical:I,image:d,type:"product"}),L({"@context":"https://schema.org","@type":"Product",name:S,description:C,sku:t==null?void 0:t.article_number,gtin13:(t==null?void 0:t.ean)||void 0,brand:{"@type":"Brand",name:(t==null?void 0:t.manufacturer)||"Liefersoft"},image:d?[d]:void 0,weight:t!=null&&t.weight_kg?{"@type":"QuantitativeValue",value:t.weight_kg,unitCode:"KGM"}:void 0,offers:{"@type":"Offer",url:I,priceCurrency:a.currency||"EUR",price:Number(R).toFixed(2),availability:"https://schema.org/InStock",priceValidUntil:new Date(Date.now()+1e3*60*60*24*90).toISOString().slice(0,10)}})}})(),()=>L(null)},[c]),F)return e.jsxs(e.Fragment,{children:[e.jsx(u,{}),e.jsx("div",{className:"min-h-screen flex items-center justify-center pt-20",children:e.jsx(D,{className:"h-8 w-8 animate-spin text-muted-foreground"})})]});if(!s)return e.jsxs(e.Fragment,{children:[e.jsx(u,{}),e.jsxs("div",{className:"min-h-screen container mx-auto px-4 pt-32 text-center",children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:"Produkt nicht gefunden."}),e.jsx(m,{asChild:!0,children:e.jsx(P,{to:"/shop",children:"Zurück zum Shop"})})]})]});const l=s.marketing_title||((h=s.articles)==null?void 0:h.name),p=s.price_override||((_=s.articles)==null?void 0:_.selling_price)||0,o=s.hero_image_url||((j=(f=s.articles)==null?void 0:f.image_urls)==null?void 0:j[0]),O=()=>{var r;const i={listing_id:s.id,article_id:s.article_id,title:l,hero_image_url:o,quantity:x,unit_price:p,tax_rate:((r=s.articles)==null?void 0:r.tax_rate)??19,currency:s.currency||"EUR",slug:s.slug};A.addItem(i)};return e.jsxs(e.Fragment,{children:[e.jsx(u,{}),e.jsx("div",{className:"min-h-screen bg-background pt-20",children:e.jsxs("div",{className:"container mx-auto px-4 py-6",children:[e.jsx(m,{asChild:!0,variant:"ghost",size:"sm",className:"mb-4",children:e.jsxs(P,{to:"/shop",children:[e.jsx(K,{className:"h-4 w-4 mr-2"}),"Zurück zum Shop"]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[e.jsx(M,{className:"aspect-square bg-muted overflow-hidden",children:o?e.jsx("img",{src:o,alt:l,className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(Q,{className:"h-16 w-16 text-muted-foreground"})})}),e.jsxs("div",{className:"flex flex-col gap-4",children:[s.category_label&&e.jsx("span",{className:"text-xs uppercase text-muted-foreground",children:s.category_label}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("h1",{className:"text-2xl font-bold flex-1",children:l}),s.badge&&e.jsx(V,{children:s.badge})]}),((b=s.articles)==null?void 0:b.manufacturer)&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hersteller: ",s.articles.manufacturer]}),e.jsxs("div",{className:"text-3xl font-bold",children:[p.toFixed(2)," ",s.currency]}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:s.marketing_description||((N=s.articles)==null?void 0:N.description)}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx("input",{type:"number",min:1,value:x,onChange:i=>B(Math.max(1,parseInt(i.target.value)||1)),className:"h-10 w-20 rounded-md border bg-background px-3 text-sm"}),e.jsx(m,{onClick:O,className:"flex-1 sm:flex-none",children:"In den Warenkorb"})]}),e.jsxs("div",{className:"mt-6 text-xs text-muted-foreground border-t pt-3 space-y-1",children:[e.jsxs("p",{children:["Art-Nr.: ",(y=s.articles)==null?void 0:y.article_number]}),((v=s.articles)==null?void 0:v.ean)&&e.jsxs("p",{children:["EAN: ",s.articles.ean]}),((k=s.articles)==null?void 0:k.weight_kg)&&e.jsxs("p",{children:["Gewicht: ",s.articles.weight_kg," kg"]})]})]})]})]})}),e.jsx(Z,{})]})};export{W 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.