PageSourceSearch

https://franchglobal.com/assets/ProductSection-CfZiIiQh.js

js franchglobal.com collected 2026-10-04 08:25:14 UTC 3,766 bytes, 1 lines download raw bytes

1import{r as l,j as e}from"./vendor-react-BPhx6NbJ.js";import{u as G,w as H,b as Z,x as L,y as B,z as D,A as J,C as x,D as K,E as M,F as V,G as W,H as X,I as Y,J as _,K as $}from"./index-bQe35_sx.js";import{u as tt}from"./useAnimation-DWHnpg5S.js";import{u as st}from"./useLocalStorageCart-ClHhzwho.js";import{T as et}from"./Toast-D8nVwrHz.js";import{P as at}from"./ProductGridCard-BLeOUR_D.js";import{g as y}from"./productDiscount-nY6a9TPt.js";/* empty css                     */import"./vendor-ui-DJb5Cx9R.js";function gt({title:b="Our Products",currentProductId:F=null}){const{user:n,isCustomerLoggedIn:h}=G(),{requireCustomerLogin:C}=H(),{products:v,loading:A}=Z(),[p,j]=l.useState([]),[I,k]=l.useState(null),[g,c]=l.useState(null),[w,m]=l.useState([]),[d,u]=l.useState([]),{addToCart:P}=st(),R=l.useCallback(t=>{t&&!p.includes(t)&&j(s=>[...s,t])},[p]);tt(p);const N={"franch-ayurveda-skin-soap":4,"franch-orthovin-thailam":2,"omega-3":1};l.useEffect(()=>{if(!n)return;if(n.isAnonymous){u(L()),m([]);return}if(!h)return;let t=!1;return(async()=>{try{const[s,r]=await Promise.all([B(),D()]);t||(u(s),m(r))}catch(s){console.error("Error loading cart/favorites:",s)}})(),()=>{t=!0}},[n,h]);const q=async t=>{if(!C()||n.isAnonymous)return;const s=w.find(a=>a.productId===t.id),r={productId:t.id,title:t.title,price:y(t),imageURL:t.imageURL||""};try{if(s){const a=await _({productId:t.id,lineId:s.id});m(a)}else{const a=await $(r);m(a)}}catch(a){c({message:a.message||"Could not update favorites",type:"error"})}},S=async t=>{if(!C())return;if(x(t.sku)){const o=K(n.isAnonymous?L():d),U=o?M((o.qty||1)+1):1,i=V(v,U);if(!i){c({message:"Franch Oil is unavailable right now.",type:"error"});return}if(n.isAnonymous)W(i);else{const E=d.filter(f=>x(f.sku))[0],O={productId:i.productId,sku:i.sku,title:i.title,price:i.price,imageURL:i.imageURL,qty:i.qty},z=d.filter(f=>!x(f.sku)).concat([{...E||{},...O}]),Q=await X(z);u(Q)}c({message:"Added to cart!",type:"success"});return}const s=N[t.sku?.toLowerCase()]||1;if(n.isAnonymous){P({productId:t.id,sku:t.sku,title:t.title,price:y(t),imageURL:t.imageURL||"",qty:s}),c({message:"Added to cart!",type:"success"});return}const r=d.find(o=>o.productId===t.id),a={productId:t.id,sku:t.sku,title:t.title,price:y(t),imageURL:t.imageURL||"",qty:r?(r.qty||0)+s:s};try{const o=await Y(a);u(o),c({message:"Added to cart!",type:"success"})}catch(o){c({message:o.message||"Could not add to cart",type:"error"})}};if(A)return e.jsx("div",{className:"text-center py-10 poppins",children:"Loading products…"});const T=v.filter(t=>!J(t)).filter(t=>t.sku?.toLowerCase()!==F?.toLowerCase());return e.jsxs("section",{className:"w-full bg-w py-20",children:[I&&e.jsx("div",{className:"franch-product-zoom-backdrop",onClick:()=>k(null),role:"dialog","aria-label":"Product image zoom",children:e.jsx("img",{src:I,alt:"Product zoom",onClick:t=>t.stopPropagation()})}),g&&e.jsx(et,{message:g.message,type:g.type,onClose:()=>c(null)}),e.jsx("div",{className:"max-w-[1200px] w-[100%] mx-auto product-section-wrapper",children:e.jsxs("div",{className:"grid grid-cols-12 items-stretch product-section-grid",children:[e.jsx("div",{className:"col-span-12 mb-10 px-4",children:e.jsx("div",{className:"product-section-heading-wrapper border-b-[5px] border-[var(--p-c)]",children:e.jsx("div",{className:"product-section-heading ruwudu p-2 px-7 pb-0 bg-p-c mb-[3px] w-max text-c-l text-[17px] rounded-t-[7px] tracking-[1px]",children:b})})}),T.map(t=>{const s=w.some(r=>r.productId===t.id);return e.jsx("div",{ref:R,"data-animation":"left",className:"product-grid-cell col-span-12 sm:col-span-6 lg:col-span-4 xl:col-span-3 px-3 sm:px-4 mb-10",children:e.jsx(at,{product:t,isFav:s,onToggleFav:q,onAddToCart:S,onZoom:k})},t.id)})]})})]})}export{gt 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.