PageSourceSearch

https://smart-photo.ai/assets/products-dJfHWwAW.js

js smart-photo.ai collected 2026-10-05 15:05:54 UTC 8,387 bytes, 1 lines download raw bytes

1import{c as y,j as e,aw as f,r as k,al as z}from"./main-Bmw7chmx.js";import{u as N}from"./useQuery-CraJ5e4a.js";import{B as p}from"./badge-CX3GSaZ2.js";import{C,a as F,b as Q,c as I,d as L}from"./card-b87ydQ_i.js";import{B as j}from"./button-BeDxX-zt.js";import{s as E,n as M,o as q}from"./product-config.server-fn-BLzwFzIy.js";import{M as S}from"./minus-PsvHo18U.js";import{P as T}from"./plus-BRqKgJb7.js";import{u as A}from"./CartContext-Bg4THXp0.js";import{P as D}from"./package-Bd02w1pu.js";import"./index-BWxGFLm8.js";const K=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],B=y("download",K);const R=[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]],_=y("printer",R),$=({product:a,quantities:o,onPresetAdd:c,onPresetRemove:t})=>{const l=N({queryKey:["templatePreview",a.previewImageKey],queryFn:()=>E({data:{key:a.previewImageKey}}),enabled:!!a.previewImageKey,staleTime:6e5}),m=l.data?`data:${l.data.contentType};base64,${l.data.base64}`:null;return e.jsxs(C,{className:"w-full overflow-hidden p-0 gap-0 h-full flex flex-col",children:[m&&e.jsx("div",{className:"w-full aspect-[4/3] overflow-hidden bg-muted",children:e.jsx("img",{src:m,alt:a.templateName,className:"w-full h-full object-cover"})}),a.previewImageKey&&!l.data&&l.isLoading&&e.jsx("div",{className:"w-full aspect-[4/3] bg-muted animate-pulse"}),e.jsxs(F,{className:"px-6 pt-4 pb-2 flex-1",children:[e.jsx(Q,{className:"text-lg",children:a.templateName}),a.templateDescription&&e.jsx(I,{className:"mt-2 line-clamp-3",children:a.templateDescription}),a.requiredPhotosCount>0&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Wymaga ",a.requiredPhotosCount," zdjęć",a.photoIncludedInPrice?" (zdjęcie w cenie)":""]})]}),e.jsx(L,{className:"px-6 pb-4 pt-2 mt-auto",children:e.jsx("div",{className:"space-y-3",children:a.presets.map(r=>{const x=o[r.id]||0;return e.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-md hover:bg-muted/30 transition-colors",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:r.name}),r.description&&e.jsx("p",{className:"text-xs text-muted-foreground",children:r.description}),e.jsxs("span",{className:"text-sm font-semibold text-primary block mt-0.5",children:[parseFloat(r.price).toFixed(2)," PLN"]})]}),e.jsxs("div",{className:"flex items-center gap-2 bg-muted/50 rounded-md p-1",children:[e.jsx(j,{variant:"ghost",size:"icon-xs",onClick:()=>t(r.id),className:"h-7 w-7",disabled:x===0,children:e.jsx(S,{className:"h-3 w-3"})}),e.jsx("span",{className:"w-6 text-center font-medium text-sm",children:x}),e.jsx(j,{variant:"ghost",size:"icon-xs",onClick:()=>c(r.id),className:"h-7 w-7",children:e.jsx(T,{className:"h-3 w-3"})})]})]},r.id)})})})]})};function g(a,o){if(a.length===0)return 0;const c=[...a].sort((l,m)=>m.minQuantity-l.minQuantity),t=c.find(l=>o>=l.minQuantity);return parseFloat(t?t.price:c[c.length-1].price)}function te(){const{sessionId:a}=f.useParams(),{groupId:o}=f.useSearch(),{addItem:c}=A(),{data:t,isLoading:l,error:m}=N({queryKey:["product-config-public",a,o??null],queryFn:()=>o?M({data:{photoSessionId:a,groupId:o}}):q({data:{photoSessionId:a}}),staleTime:300*1e3}),[r,x]=k.useState({}),b=s=>{x(i=>({...i,[s]:(i[s]||0)+1}))},v=s=>{x(i=>{const d=i[s]||0,n=Math.max(0,d-1);if(n===0){const{[s]:h,...w}=i;return w}return{...i,[s]:n}})},P=()=>{t&&(Object.entries(r).forEach(([s,i])=>{if(!(i<=0))for(const d of t.additionalProducts){const n=d.presets.find(h=>h.id===s);if(n){c({type:"product",quantity:i,pricePerUnit:parseFloat(n.price),additionalProductPresetId:n.id,productName:`${d.templateName} — ${n.name}`});break}}}),x({}))};if(l)return e.jsx("div",{className:"flex items-center justify-center min-h-[50vh]",children:e.jsx(z,{className:"h-8 w-8 animate-spin text-primary"})});if(m||!t)return e.jsx("div",{className:"flex items-center justify-center min-h-[50vh]",children:e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("h2",{className:"text-xl font-display font-bold",children:"Nie udało się załadować oferty"}),e.jsx("p",{className:"text-muted-foreground",children:"Spróbuj ponownie później."})]})});if(!(t.printsPurchaseEnabled&&t.prints.length>0||t.digitalFilePurchaseEnabled&&t.digital.length>0||t.additionalProductsPurchaseEnabled&&t.additionalProducts.length>0))return e.jsxs("div",{className:"container mx-auto py-16 px-4 text-center",children:[e.jsx("h2",{className:"text-2xl font-display font-bold",children:"Brak dostępnych produktów"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Dla tej sesji nie skonfigurowano jeszcze oferty."})]});const u=Object.values(r).reduce((s,i)=>s+i,0);return e.jsxs("div",{className:"container mx-auto py-16 px-4 space-y-16",children:[t.printsPurchaseEnabled&&t.prints.length>0&&e.jsxs("section",{children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs(p,{variant:"secondary",className:"mb-2 px-3 py-1 gap-1.5",children:[e.jsx(_,{className:"h-3.5 w-3.5"}),"Odbitki"]}),e.jsx("h2",{className:"text-3xl font-display font-bold",children:"Cennik odbitek"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Wybierz odbitki w galerii zdjęć. Poniżej widoczny jest cennik."})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:t.prints.map(s=>{const i=g(s.tiers,1);return e.jsxs("div",{className:"p-4 border rounded-lg bg-card shadow-sm",children:[e.jsx("div",{className:"font-semibold text-lg",children:s.printSizeName}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Papier: ",s.paperTypeName]}),e.jsxs("div",{className:"text-lg font-bold text-primary mt-2",children:["od ",i.toFixed(2)," PLN / szt."]}),s.tiers.length>1&&e.jsx("div",{className:"mt-2 space-y-0.5",children:[...s.tiers].sort((d,n)=>d.minQuantity-n.minQuantity).map(d=>e.jsxs("div",{className:"text-xs text-muted-foreground",children:[d.minQuantity,"+ szt. = ",parseFloat(d.price).toFixed(2)," PLN"]},d.id))})]},s.id)})})]}),t.digitalFilePurchaseEnabled&&t.digital.length>0&&e.jsxs("section",{children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs(p,{variant:"secondary",className:"mb-2 px-3 py-1 gap-1.5",children:[e.jsx(B,{className:"h-3.5 w-3.5"}),"Pliki cyfrowe"]}),e.jsx("h2",{className:"text-3xl font-display font-bold",children:"Pliki elektroniczne"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Możesz zakupić pliki cyfrowe bezpośrednio w galerii zdjęć."})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:t.digital.map(s=>{const i=g(s.tiers,1),d=s.variant==="full"?"Pełna rozdzielczość":s.variant==="thumbnail"?"Miniaturka":s.variant;return e.jsxs("div",{className:"p-6 border-2 border-dashed rounded-xl bg-card text-center",children:[e.jsx("h3",{className:"text-xl font-semibold",children:d}),e.jsxs("p",{className:"text-2xl font-bold text-primary mt-2",children:["od ",i.toFixed(2)," PLN / szt."]}),s.tiers.length>1&&e.jsx("div",{className:"mt-3 space-y-0.5",children:[...s.tiers].sort((n,h)=>n.minQuantity-h.minQuantity).map(n=>e.jsxs("div",{className:"text-xs text-muted-foreground",children:[n.minQuantity,"+ = ",parseFloat(n.price).toFixed(2)," PLN"]},n.id))})]},s.id)})})]}),t.additionalProductsPurchaseEnabled&&t.additionalProducts.length>0&&e.jsxs("section",{children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs(p,{variant:"secondary",className:"mb-2 px-3 py-1 gap-1.5",children:[e.jsx(D,{className:"h-3.5 w-3.5"}),"Produkty"]}),e.jsx("h2",{className:"text-3xl font-display font-bold",children:"Produkty i gadżety"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Zamów wyjątkowe pamiątki ze zdjęciami."})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8",children:t.additionalProducts.map(s=>e.jsx("div",{className:"h-full",children:e.jsx($,{product:s,quantities:r,onPresetAdd:b,onPresetRemove:v})},s.id))}),u>0&&e.jsx("div",{className:"flex justify-center mt-8",children:e.jsxs(j,{size:"lg",onClick:P,className:"px-8",children:["Dodaj do koszyka (",u," ",u===1?"produkt":u<5?"produkty":"produktów",")"]})})]})]})}export{te as component};

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.