bitsnap-react 1.18.1 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +21 -0
- package/README.md +45 -0
- package/dist/BitsnapCart-LHJ6KOTV.css +2 -0
- package/dist/BitsnapCart-LHJ6KOTV.css.map +1 -0
- package/dist/BitsnapCart-V4S4EXYV.js +2 -0
- package/dist/BitsnapCart-V4S4EXYV.js.map +1 -0
- package/dist/BitsnapCart-Z6JFYNH2.mjs +2 -0
- package/dist/CartProvider-5NP4WACK.js +2 -0
- package/dist/CartProvider-5NP4WACK.js.map +1 -0
- package/dist/CartProvider-G7FQUPXL.mjs +2 -0
- package/dist/PanelModelFiles-EKQRLF46.js.map +1 -1
- package/dist/analytics.js +1 -1
- package/dist/analytics.js.map +1 -1
- package/dist/analytics.mjs +1 -1
- package/dist/catalog.js +1 -1
- package/dist/catalog.js.map +1 -1
- package/dist/catalog.mjs +1 -1
- package/dist/chat.css +2 -0
- package/dist/chat.css.map +1 -0
- package/dist/chat.d.mts +173 -0
- package/dist/chat.d.ts +173 -0
- package/dist/chat.js +2 -0
- package/dist/chat.js.map +1 -0
- package/dist/chat.mjs +2 -0
- package/dist/chat.mjs.map +1 -0
- package/dist/chunk-2G46TAUX.mjs +2 -0
- package/dist/chunk-2G46TAUX.mjs.map +1 -0
- package/dist/{chunk-N3B25GTY.js → chunk-4Y233NII.js} +2 -2
- package/dist/chunk-4Y233NII.js.map +1 -0
- package/dist/chunk-5M3OUOMU.mjs +5 -0
- package/dist/chunk-5M3OUOMU.mjs.map +1 -0
- package/dist/chunk-6Q3VGPSF.js.map +1 -1
- package/dist/chunk-A2ZDFN3J.mjs +2 -0
- package/dist/{chunk-ZM5T4TQW.mjs.map → chunk-A2ZDFN3J.mjs.map} +1 -1
- package/dist/{chunk-DR7WYI37.js → chunk-AQYHQY2Y.js} +2 -2
- package/dist/chunk-AQYHQY2Y.js.map +1 -0
- package/dist/{chunk-62WDFH7K.mjs → chunk-BTERIY6N.mjs} +2 -2
- package/dist/chunk-C736F727.js +2 -0
- package/dist/chunk-C736F727.js.map +1 -0
- package/dist/chunk-EFN4OW2C.js +2 -0
- package/dist/chunk-EFN4OW2C.js.map +1 -0
- package/dist/chunk-EMR4YXNY.mjs +2 -0
- package/dist/chunk-EMR4YXNY.mjs.map +1 -0
- package/dist/chunk-GHBRR665.js +2 -0
- package/dist/chunk-GHBRR665.js.map +1 -0
- package/dist/chunk-HKRH6FI6.mjs +2 -0
- package/dist/chunk-HKRH6FI6.mjs.map +1 -0
- package/dist/chunk-HP3I6D2R.js +2 -0
- package/dist/chunk-HP3I6D2R.js.map +1 -0
- package/dist/{chunk-G4SEOVLD.js → chunk-IRZJIPUF.js} +2 -2
- package/dist/chunk-IRZJIPUF.js.map +1 -0
- package/dist/chunk-IXQCN7MR.mjs +2 -0
- package/dist/chunk-IXQCN7MR.mjs.map +1 -0
- package/dist/chunk-IXX6SUMB.mjs +2 -0
- package/dist/chunk-IXX6SUMB.mjs.map +1 -0
- package/dist/chunk-JSDGZ4NY.js.map +1 -1
- package/dist/chunk-KDL35KEI.js +2 -0
- package/dist/chunk-KDL35KEI.js.map +1 -0
- package/dist/chunk-KO7ZERN5.mjs +2 -0
- package/dist/chunk-KO7ZERN5.mjs.map +1 -0
- package/dist/chunk-KOYBZORL.js.map +1 -1
- package/dist/chunk-KZWCVKLU.js +5 -0
- package/dist/chunk-KZWCVKLU.js.map +1 -0
- package/dist/chunk-LHNTSQYO.mjs +2 -0
- package/dist/chunk-LHNTSQYO.mjs.map +1 -0
- package/dist/chunk-LHQEM3CU.mjs +2 -0
- package/dist/chunk-LHQEM3CU.mjs.map +1 -0
- package/dist/chunk-MDAFPGPA.js +2 -0
- package/dist/chunk-MDAFPGPA.js.map +1 -0
- package/dist/chunk-Q337IQNA.js.map +1 -1
- package/dist/chunk-RJPQMDIQ.js +2 -0
- package/dist/chunk-RJPQMDIQ.js.map +1 -0
- package/dist/{chunk-GKJURMDO.mjs → chunk-TW25G7XX.mjs} +2 -2
- package/dist/{chunk-GKJURMDO.mjs.map → chunk-TW25G7XX.mjs.map} +1 -1
- package/dist/{chunk-UTUPPMLK.mjs → chunk-URQBHNJK.mjs} +2 -2
- package/dist/chunk-W3RGQYPD.js.map +1 -1
- package/dist/chunk-XEXPQFKN.mjs +2 -0
- package/dist/chunk-XEXPQFKN.mjs.map +1 -0
- package/dist/chunk-YPA6MMGJ.js +2 -0
- package/dist/chunk-YPA6MMGJ.js.map +1 -0
- package/dist/chunk-Z3YOJ6NZ.js +2 -0
- package/dist/chunk-Z3YOJ6NZ.js.map +1 -0
- package/dist/consent.js.map +1 -1
- package/dist/course.d.mts +2 -14
- package/dist/course.d.ts +2 -14
- package/dist/course.js +1 -1
- package/dist/course.js.map +1 -1
- package/dist/course.mjs +1 -1
- package/dist/course.mjs.map +1 -1
- package/dist/embed/analytics.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +50 -33
- package/dist/index.d.ts +50 -33
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/methods-33CWGKNA.mjs +2 -0
- package/dist/methods-33CWGKNA.mjs.map +1 -0
- package/dist/methods-4GB652MQ.js +2 -0
- package/dist/methods-4GB652MQ.js.map +1 -0
- package/dist/model-files-client-P4PORZJ6.js.map +1 -1
- package/dist/models.js.map +1 -1
- package/dist/returns.js +1 -1
- package/dist/returns.js.map +1 -1
- package/dist/returns.mjs +1 -1
- package/dist/texts-9kfgClsA.d.mts +14 -0
- package/dist/texts-9kfgClsA.d.ts +14 -0
- package/dist/{types-D6LsoycW.d.mts → types-CjWyHunk.d.mts} +9 -1
- package/dist/{types-ClFCVzk_.d.ts → types-DfqzDP9k.d.ts} +9 -1
- package/dist/viewer3d.js.map +1 -1
- package/dist/viewer3d.mjs +2 -2
- package/dist/viewer3d.mjs.map +1 -1
- package/dist/widgets-Bsojw94g.d.ts +556 -0
- package/dist/widgets-u7xMJbsY.d.mts +556 -0
- package/package.json +16 -2
- package/dist/CartProvider-CC6YIZVS.js +0 -2
- package/dist/CartProvider-CC6YIZVS.js.map +0 -1
- package/dist/CartProvider-ZL65WZN6.mjs +0 -2
- package/dist/chunk-2XSLIZ27.js +0 -2
- package/dist/chunk-2XSLIZ27.js.map +0 -1
- package/dist/chunk-5OCGXVLC.js +0 -2
- package/dist/chunk-5OCGXVLC.js.map +0 -1
- package/dist/chunk-5YN752OV.mjs +0 -2
- package/dist/chunk-5YN752OV.mjs.map +0 -1
- package/dist/chunk-7BG22YBF.js +0 -5
- package/dist/chunk-7BG22YBF.js.map +0 -1
- package/dist/chunk-AHISXVEE.js +0 -2
- package/dist/chunk-AHISXVEE.js.map +0 -1
- package/dist/chunk-DR7WYI37.js.map +0 -1
- package/dist/chunk-EOFJAQPT.js +0 -2
- package/dist/chunk-EOFJAQPT.js.map +0 -1
- package/dist/chunk-G4SEOVLD.js.map +0 -1
- package/dist/chunk-IGQZP4YR.mjs +0 -2
- package/dist/chunk-IGQZP4YR.mjs.map +0 -1
- package/dist/chunk-N3B25GTY.js.map +0 -1
- package/dist/chunk-VWA3ZCNI.mjs +0 -2
- package/dist/chunk-VWA3ZCNI.mjs.map +0 -1
- package/dist/chunk-YGE2223J.mjs +0 -5
- package/dist/chunk-YGE2223J.mjs.map +0 -1
- package/dist/chunk-ZKT4N553.mjs +0 -2
- package/dist/chunk-ZKT4N553.mjs.map +0 -1
- package/dist/chunk-ZM5T4TQW.mjs +0 -2
- package/dist/methods-7DWKFCPK.js +0 -2
- package/dist/methods-7DWKFCPK.js.map +0 -1
- package/dist/methods-DQTADIN4.mjs +0 -2
- /package/dist/{CartProvider-ZL65WZN6.mjs.map → BitsnapCart-Z6JFYNH2.mjs.map} +0 -0
- /package/dist/{methods-DQTADIN4.mjs.map → CartProvider-G7FQUPXL.mjs.map} +0 -0
- /package/dist/{chunk-62WDFH7K.mjs.map → chunk-BTERIY6N.mjs.map} +0 -0
- /package/dist/{chunk-UTUPPMLK.mjs.map → chunk-URQBHNJK.mjs.map} +0 -0
package/dist/chunk-ZM5T4TQW.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as O,b as at,c as it,d as st,e as dt,f as U}from"./chunk-IGQZP4YR.mjs";import{a as ot,b as nt}from"./chunk-KOVKUJAW.mjs";import{a as M}from"./chunk-5R6AGO3Z.mjs";import{e as rt}from"./chunk-62WDFH7K.mjs";import{f as X,l as Z,m as J,n as Y,p as Q}from"./chunk-GKJURMDO.mjs";import{b as tt,d as et}from"./chunk-OFPRIENJ.mjs";var ht=["root","grid","card","cardLink","image","imagePlaceholder","body","name","description","price","comparePrice","badge","model3dBadge","actions","addToCartButton","selectButton","message","pagination","paginationButton","pageIndicator","emptyState","error","retryButton","skeleton"],xt={fontFamily:"--bitsnap-products-font-family",gridMinWidth:"--bitsnap-products-grid-min-width",fontSize:"--bitsnap-products-font-size",background:"--bitsnap-products-background",surface:"--bitsnap-products-surface",foreground:"--bitsnap-products-foreground",mutedForeground:"--bitsnap-products-muted-foreground",border:"--bitsnap-products-border",buttonBackground:"--bitsnap-products-button-background",buttonForeground:"--bitsnap-products-button-foreground",buttonHoverBackground:"--bitsnap-products-button-hover-background",hoverSurface:"--bitsnap-products-hover-surface",focusRing:"--bitsnap-products-focus-ring",error:"--bitsnap-products-error",badgeBackground:"--bitsnap-products-badge-background",badgeForeground:"--bitsnap-products-badge-foreground",radius:"--bitsnap-products-radius"},Tt={light:{background:"#ffffff",surface:"#f9fafb",foreground:"#18181b",mutedForeground:"#71717a",border:"#e4e4e7",buttonBackground:"#18181b",buttonForeground:"#fafafa",buttonHoverBackground:"#000000",hoverSurface:"#f4f4f5",focusRing:"#71717a",error:"#dc2626",badgeBackground:"#f4f4f5",badgeForeground:"#3f3f46",radius:"8px",gridMinWidth:"9rem"},dark:{background:"#18181b",surface:"#27272a",foreground:"#fafafa",mutedForeground:"#a1a1aa",border:"#3f3f46",buttonBackground:"#fafafa",buttonForeground:"#18181b",buttonHoverBackground:"#e4e4e7",hoverSurface:"#3f3f46",focusRing:"#a1a1aa",error:"#f87171",badgeBackground:"#3f3f46",badgeForeground:"#e4e4e7",radius:"8px",gridMinWidth:"9rem"}},Ct=[];function ct(t){let e=ot(t,{defaultTheme:"light",presets:Tt,variables:xt,shadcnVariables:Ct});return{theme:e.theme,tokens:e.tokens,elements:e.elements,boundaryClassName:e.theme,boundaryStyle:e.boundaryStyle}}function j(t,e){return nt(t.elements,e)}import{useCallback as ut,useEffect as St,useMemo as kt,useState as F}from"react";function q(t){let{projectID:e,locale:n,search:o,initialData:i}=t,[a]=F(()=>rt),d=t.host??a,c=O(t.pageSize),s=JSON.stringify([e,d,n??null,o?.trim()??null,c]),[g,l]=F({queryKey:s,page:1});g.queryKey!==s&&l({queryKey:s,page:1});let[P,C]=F(0),[m,p]=F(()=>({requestKey:i!=null?`${s}|1|0`:"",data:i,error:void 0})),f=m.data?.totalCount??0,b=at(f,c),h=g.queryKey===s?g.page:1,k=f>0?Math.min(h,b):h,S=`${s}|${k}|${P}`,T=m.requestKey===S;St(()=>{if(T)return;let y=new AbortController;return it({projectID:e,host:d,locale:n,search:o,limit:c,offset:(k-1)*c},y.signal).then(L=>{y.signal.aborted||p({requestKey:S,data:L,error:void 0})},L=>{y.signal.aborted||p(E=>({requestKey:S,data:E.data,error:L instanceof Error?L:new Error(String(L))}))}),()=>y.abort()},[S,T]);let I=ut(y=>{let L=Math.max(1,Math.floor(y));l({queryKey:s,page:f>0?Math.min(L,b):L})},[s,f,b]),A=ut(()=>C(y=>y+1),[]);return kt(()=>({products:m.data?.items??[],totalCount:f,page:k,pageCount:b,setPage:I,isLoading:!T,error:T?m.error:void 0,refetch:A}),[m,f,k,b,I,T,A])}import{createContext as gt,useCallback as K,useContext as mt,useEffect as B,useMemo as R,useRef as H,useState as It}from"react";var z=50,At=1e3;function lt(t,e=At){let n=new Set,o=new Map,i=[],a=[],d,c,s=!1;function g(){for(c!==void 0&&clearTimeout(c),c=void 0;i.length>0;){let p=i.slice(0,z),f=a.slice(0,z);i=i.slice(z),a=a.slice(z);try{t({productIds:p,positions:f})}catch{}}}function l(){g();try{X()?.flush()}catch{}}let P=()=>{typeof document<"u"&&document.visibilityState==="hidden"&&l()};function C(){s||typeof window>"u"||(s=!0,window.addEventListener("pagehide",l,!0),document.addEventListener("visibilitychange",P,!0))}function m(){if(d)return d;if(!(typeof IntersectionObserver>"u"))return d=new IntersectionObserver(p=>{for(let f of p){let b=o.get(f.target);!b||!f.isIntersecting||f.intersectionRatio<.5||(o.delete(f.target),d?.unobserve(f.target),!n.has(b.id)&&(n.add(b.id),i.push(b.id),a.push(b.position)))}i.length>0&&c===void 0&&(c=setTimeout(g,e),c.unref?.())},{threshold:[.5]}),C(),d}return{observe(p,f,b){try{if(n.has(f))return()=>{};let h=m();return h?(o.set(p,{id:f,position:b}),h.observe(p),()=>{o.delete(p),h.unobserve(p)}):()=>{}}catch{return()=>{}}},flush:g,destroy(){try{g(),d?.disconnect(),s&&(window.removeEventListener("pagehide",l,!0),document.removeEventListener("visibilitychange",P,!0),s=!1)}catch{}d=void 0,o.clear()}}}var wt={en:{addToCart:"Add to cart",addingToCart:"Adding\u2026",addedToCart:"Added to cart",addToCartError:"Could not add to the cart. Try again.",chooseOptions:"Choose",viewProduct:"View",unavailable:"Unavailable",subscription:"Subscription",model3d:"3D",model3dLabel:"3D model",priceFrom:"from {price}",originalPrice:"Original price",loading:"Loading products",empty:"There are no products to show.",error:"Could not load the products.",retry:"Try again",pagination:"Pagination",previousPage:"Previous",nextPage:"Next",pageOf:"Page {page} of {pageCount}"},pl:{addToCart:"Dodaj do koszyka",addingToCart:"Dodawanie\u2026",addedToCart:"Dodano do koszyka",addToCartError:"Nie uda\u0142o si\u0119 doda\u0107 do koszyka. Spr\xF3buj ponownie.",chooseOptions:"Wybierz",viewProduct:"Zobacz",unavailable:"Niedost\u0119pny",subscription:"Subskrypcja",model3d:"3D",model3dLabel:"Model 3D",priceFrom:"od {price}",originalPrice:"Cena przed obni\u017Ck\u0105",loading:"\u0141adowanie produkt\xF3w",empty:"Brak produkt\xF3w do wy\u015Bwietlenia.",error:"Nie uda\u0142o si\u0119 za\u0142adowa\u0107 produkt\xF3w.",retry:"Spr\xF3buj ponownie",pagination:"Paginacja",previousPage:"Poprzednia",nextPage:"Nast\u0119pna",pageOf:"Strona {page} z {pageCount}"}};function pt(t,e){return tt(wt,t,e)}function V(t,e){return t.replace(/\{(\w+)\}/g,(n,o)=>o in e?String(e[o]):n)}import{Fragment as Lt,jsx as r,jsxs as x}from"react/jsx-runtime";var ft=gt(void 0),Et={observe:()=>()=>{},clicked:()=>{}},bt=gt(Et);function D(){let t=mt(ft);if(t==null)throw new Error("ProductList parts must be rendered inside ProductList");return t}function u(t,e){let{appearance:n}=D(),o=j(n,t);return{"data-bitsnap-products-slot":t,className:M(e,o?.className),style:o?.style}}var $="inline-flex cursor-pointer items-center justify-center px-4 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50",Pt=`${$} w-full`,_t=`${Pt} no-underline`;function Nt({product:t,onAdd:e}){let{texts:n}=D(),[o,i]=It("idle"),a=u("addToCartButton",Pt),d=u("message","mt-2 text-xs");B(()=>{if(o!=="added")return;let g=setTimeout(()=>i("idle"),2e3);return()=>clearTimeout(g)},[o]);let c=K(async()=>{i("adding");try{await e(),i("added")}catch(g){console.error("bitsnap-react: could not add to the cart",g),i("error")}},[e]),s=o==="adding"?n.addingToCart:o==="added"?n.addedToCart:n.addToCart;return x(Lt,{children:[r("button",{type:"button",...a,disabled:o==="adding","aria-label":`${s}: ${t.name}`,onClick:c,children:s}),o==="error"?r("p",{...d,role:"alert",children:n.addToCartError}):null]})}function Ot({product:t,position:e,href:n,onAdd:o,renderItem:i}){let{texts:a,locale:d}=D(),c=mt(bt),s=H(null);B(()=>{if(s.current!=null)return c.observe(s.current,t.id,e)},[c,t.id,e]);let g=K(()=>c.clicked(t,e),[c,t,e]),l=u("card","relative flex flex-col overflow-hidden border transition-colors"),P=u("cardLink","flex flex-1 flex-col no-underline"),C=u("image","aspect-square w-full overflow-hidden"),m=u("imagePlaceholder","aspect-square w-full"),p=u("body","flex flex-1 flex-col gap-1 p-4"),f=u("name","text-base font-medium leading-snug"),b=u("description","line-clamp-2 text-sm"),h=u("price","mt-auto pt-2 text-base font-semibold"),k=u("comparePrice","ml-2 text-sm font-normal"),S=u("badge","absolute left-3 top-3 px-2 py-0.5 text-xs font-medium"),T=u("model3dBadge","absolute right-3 top-3 inline-flex items-center gap-1 px-2 py-0.5 text-xs font-semibold"),I=u("actions","p-4 pt-0"),A=u("selectButton",_t),y=U(t.price,t.currency,d),L=t.compareAtPrice!=null&&t.compareAtPrice>t.price?U(t.compareAtPrice,t.currency,d):null;if(i!=null)return r("li",{ref:s,...l,"data-unavailable":t.available?void 0:"",children:i(t,{href:n,price:y,compareAtPrice:L,texts:a,locale:d,addToCart:o,trackClick:g})});let E=t.image?.thumbnailUrl??t.image?.url,_=t.available?t.isRecurring?a.subscription:null:a.unavailable;return x("li",{ref:s,...l,"data-unavailable":t.available?void 0:"",children:[x("a",{...P,href:n,onClick:g,children:[E!=null?r("div",{...C,children:r("img",{src:E,alt:"",loading:"lazy",decoding:"async",className:"h-full w-full object-cover"})}):r("div",{...m,"aria-hidden":"true"}),x("div",{...p,children:[r("h3",{...f,children:t.name}),t.shortDescription?r("p",{...b,children:t.shortDescription}):null,x("p",{...h,children:[t.priceFrom?V(a.priceFrom,{price:y}):y,L!=null?x(Lt,{children:[x("span",{className:"sr-only",children:[a.originalPrice,": "]}),r("del",{...k,children:L})]}):null]})]})]}),_!=null?r("span",{...S,"data-kind":t.available?"subscription":"unavailable",children:_}):null,t.has3d===!0?x("span",{...T,title:a.model3dLabel,children:[r(Bt,{}),r("span",{"aria-hidden":"true",children:a.model3d}),r("span",{className:"sr-only",children:a.model3dLabel})]}):null,r("div",{...I,children:t.available?t.addToCart?r(Nt,{product:t,onAdd:o}):r("a",{...A,href:n,onClick:g,children:t.variantCount>1?a.chooseOptions:a.viewProduct}):r("button",{type:"button",...A,disabled:!0,children:a.unavailable})})]})}function Bt(){return x("svg",{viewBox:"0 0 24 24",width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r("path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}),r("path",{d:"m3.3 7 8.7 5 8.7-5"}),r("path",{d:"M12 22V12"})]})}var yt="m-0 grid list-none grid-cols-[repeat(auto-fill,minmax(min(100%,var(--bitsnap-products-grid-min-width,9rem)),1fr))] gap-5 p-0";function Rt({count:t,label:e}){let n=u("grid",yt),o=u("skeleton","aspect-[3/4] animate-pulse");return r("div",{...n,role:"status","aria-busy":"true","aria-label":e,children:Array.from({length:t},(i,a)=>r("div",{...o,"aria-hidden":"true"},a))})}function Dt({page:t,pageCount:e,isLoading:n,onPage:o}){let{texts:i}=D(),a=u("pagination","mt-8 flex items-center justify-center gap-4"),d=u("paginationButton",$),c=u("pageIndicator","text-sm");return x("nav",{...a,"aria-label":i.pagination,children:[r("button",{type:"button",...d,"aria-disabled":n||t<=1,onClick:()=>{!n&&t>1&&o(t-1)},children:i.previousPage}),r("span",{...c,"aria-live":"polite",children:V(i.pageOf,{page:t,pageCount:e})}),r("button",{type:"button",...d,"aria-disabled":n||t>=e,onClick:()=>{!n&&t<e&&o(t+1)},children:i.nextPage})]})}function Mt({options:t,productHref:e,renderItem:n,onAddToCart:o,showCartOnAdd:i}){let{texts:a}=D(),{products:d,page:c,pageCount:s,setPage:g,isLoading:l,error:P,refetch:C}=q(t),m=J(),p=t.search?.trim()?"search":"catalog",f=O(t.pageSize),b=H(!1);B(()=>{b.current||l||P!=null||(b.current=!0,m.track("product_list_viewed",{list_id:p,item_count:d.length}))},[m,l,P,p,d.length]);let h=R(()=>lt(({productIds:v,positions:w})=>m.track("product_impression",{list_id:p,product_ids:v,positions:w})),[m,p]);B(()=>()=>h.destroy(),[h]);let k=R(()=>({observe:h.observe,clicked:(v,w)=>m.track("product_clicked",{list_id:p,position:w},{product_id:v.id})}),[h,m,p]),S=H(null),T=H(!1),I=K(v=>{T.current=!0,g(v)},[g]);B(()=>{l||!T.current||(T.current=!1,S.current?.focus({preventScroll:!0}),S.current?.scrollIntoView({block:"start"}))},[l]);let A=u("grid",yt),y=u("emptyState","py-12 text-center text-sm"),L=u("error","flex flex-col items-center gap-3 py-12 text-center text-sm"),E=u("retryButton",$),{projectID:_,host:W}=t,vt=K((v,w)=>async()=>{if(o!=null){await Q(()=>o(v)),st(m,v);return}await dt(v,{projectID:_,host:W,showCart:i,analytics:m,url:w})},[o,_,W,i,m]),N;return l&&d.length===0?N=r(Rt,{count:Math.min(O(t.pageSize),8),label:a.loading}):P!=null?N=x("div",{...L,role:"alert",children:[r("p",{children:a.error}),r("button",{type:"button",...E,onClick:C,children:a.retry})]}):d.length===0?N=r("p",{...y,children:a.empty}):N=r("ul",{...A,"aria-busy":l||void 0,className:M(A.className,l&&"opacity-60"),children:d.map((v,w)=>{let G=e(v);return r(Ot,{product:v,position:(c-1)*f+w,href:G,onAdd:vt(v,G),renderItem:n},v.id)})}),r(bt.Provider,{value:k,children:x("div",{ref:S,tabIndex:-1,className:"p-1 outline-none scroll-mt-4",children:[N,s>1&&P==null?r(Dt,{page:c,pageCount:s,isLoading:l,onPage:I}):null]})})}var Ut=t=>`/p/${encodeURIComponent(t.uniqueSlug)}`;function Ft({productHref:t=Ut,appearance:e,texts:n,renderItem:o,onAddToCart:i,showCartOnAdd:a=!0,className:d,analytics:c,...s}){let g=Y(s.projectID,c,"catalog"),l=s.locale??et,P=R(()=>ct(e),[e]),C=R(()=>pt(l,n),[l,n]),m=R(()=>({appearance:P,texts:C,locale:l}),[P,C,l]),p=j(P,"root");return r(Z,{value:g,children:r(ft.Provider,{value:m,children:r("div",{"data-bitsnap-products":"root","data-bitsnap-products-slot":"root",className:M("bitsnap-react",P.boundaryClassName,d,p?.className),style:{...P.boundaryStyle,...p?.style},children:r(Mt,{options:s,productHref:t,renderItem:o,onAddToCart:i,showCartOnAdd:a})})})})}export{ht as a,q as b,Ft as c};
|
|
2
|
-
//# sourceMappingURL=chunk-ZM5T4TQW.mjs.map
|
package/dist/methods-7DWKFCPK.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7BG22YBFjs = require('./chunk-7BG22YBF.js');require('./chunk-AHISXVEE.js');require('./chunk-KOYBZORL.js');require('./chunk-2XSLIZ27.js');require('./chunk-5OCGXVLC.js');require('./chunk-N3B25GTY.js');require('./chunk-G4SEOVLD.js');require('./chunk-Q337IQNA.js');require('./chunk-W3RGQYPD.js');require('./chunk-JSDGZ4NY.js');exports.Bitsnap = _chunk7BG22YBFjs.x; exports.createCheckout = _chunk7BG22YBFjs.A; exports.createPaymentURL = _chunk7BG22YBFjs.z; exports.getPaymentMethodChoice = _chunk7BG22YBFjs.y; exports.getReferenceIfPossible = _chunk7BG22YBFjs.B; exports.injectReferenceToRequestIfNeeded = _chunk7BG22YBFjs.C;
|
|
2
|
-
//# sourceMappingURL=methods-7DWKFCPK.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/user/bitsnap-react-payment-release/dist/methods-7DWKFCPK.js"],"names":[],"mappings":"AAAA,+HAA0E,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,0SAA6J","file":"/home/user/bitsnap-react-payment-release/dist/methods-7DWKFCPK.js"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{A as d,B as e,C as f,x as a,y as b,z as c}from"./chunk-YGE2223J.mjs";import"./chunk-ZKT4N553.mjs";import"./chunk-KOVKUJAW.mjs";import"./chunk-5YN752OV.mjs";import"./chunk-CUPG4B5W.mjs";import"./chunk-VWA3ZCNI.mjs";import"./chunk-5R6AGO3Z.mjs";import"./chunk-62WDFH7K.mjs";import"./chunk-GKJURMDO.mjs";import"./chunk-OFPRIENJ.mjs";import"./chunk-MDCP5JNP.mjs";import"./chunk-U6FLIRIV.mjs";export{a as Bitsnap,d as createCheckout,c as createPaymentURL,b as getPaymentMethodChoice,e as getReferenceIfPossible,f as injectReferenceToRequestIfNeeded};
|
|
2
|
-
//# sourceMappingURL=methods-DQTADIN4.mjs.map
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|