@debales/ai 1.1.47 → 1.1.48

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.
@@ -1579,7 +1579,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1579
1579
  gap: 8px;
1580
1580
  align-items: start;
1581
1581
  flex-direction: column;
1582
- `,jk=({message:e,botId:t,uidata:n,onSendMessage:r,loading:o,storeMetaData:a,platform:l,setShowVariantModel:d,setSelectedProduct:h})=>{const[p,y]=$k({align:"center",containScroll:"trimSnaps",dragFree:!0}),[m,b]=Z.useState(!1),[_,w]=Z.useState(!0),[A,k]=Z.useState(0),E=Z.useRef([]),R=Z.useRef(null),{addToCart:O,generateProductUrl:I,addCartAttributes:L,cart:z,setShowCartSummery:P}=$p(),G=Z.useCallback(()=>y&&y.scrollPrev(),[y]),W=Z.useCallback(()=>y&&y.scrollNext(),[y]),F=Z.useCallback(()=>{y&&(b(y.canScrollPrev()),w(y.canScrollNext()),k(y.selectedScrollSnap()))},[y]),Q=Z.useCallback(re=>{re.forEach(de=>{de.isIntersecting?E.current.forEach((te,ue)=>{te&&(ue===A?te.play():te.pause())}):E.current.forEach(te=>{te&&te.pause()})})},[A]),J=Z.useCallback(re=>{if(!re.compare_at_price||!re.price)return null;const de=parseFloat(re.compare_at_price),te=parseFloat(re.price);if(de<=te)return null;const ue=(de-te)/de*100;return ue>0?Math.round(ue):null},[]);Z.useEffect(()=>{if(y)return y.on("select",F),F(),()=>{y.off("select",F)}},[y,F]),Z.useEffect(()=>{if(!R.current)return;const re=new IntersectionObserver(Q,{root:null,rootMargin:"0px",threshold:.6}),de=R.current;return re.observe(de),()=>{re.unobserve(de)}},[Q]),Z.useEffect(()=>{if(!y)return;const re=()=>{y.reInit()};return window.addEventListener("resize",re),()=>{window.removeEventListener("resize",re)}},[y]);const oe=(re,de,te)=>{let ue=re.link;try{if(de==="GTK-Restaurant"){const he=re.name.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-");ue=new URL(`/order/want-gtk-hoboken/item-${he}_${re.product_id}`,ue.replace("www.","")).toString()}else if(de==="gtk-catering")ue=new URL(`https://${te}/catering/want-gtk-hoboken/items/add/${re.handle}`).toString();else return I(te,re);return ue}catch(he){return console.error("Error formatting product URL:",he),ue}};return!e.products||e.products.length===0?null:M.jsxs(TP,{ref:R,children:[M.jsx(RP,{ref:p,$botId:t,children:M.jsx(OP,{children:e.products.map((re,de)=>{var te;return M.jsxs(DP,{children:[!De(t)&&re.compare_at_price&&J(re)&&M.jsx(vhe,{children:M.jsxs(yhe,{children:[J(re),"% OFF"]})}),M.jsxs(dhe,{onClick:()=>{o||(t.toLowerCase().includes("gtk")||De(t)?(window.open(oe(re,t,n.shopifyShopDomain||""),"_blank"),window.DebalesChat.track(tn.VIEW_PRODUCT_CLICKED,{productName:re.name,productPrice:re.price?Ok(re.price):void 0,productLink:re.link,message:e.conversationId})):r({message:"Tell me about "+re.name+" product"}))},$disabled:o,$botId:t,children:[M.jsx(Mde,{children:(te=re==null?void 0:re.image)!=null&&te[0]&&zj(re.image[0])?M.jsx("video",{ref:ue=>{E.current[de]=ue},style:{width:"100%",height:"auto",objectFit:"cover",aspectRatio:"1/1",margin:"0"},muted:!0,loop:!0,onClick:()=>{window.DebalesChat.track(tn.PRODUCT_VIDEO_CLICKED,{product:re,message:e.conversationId})},src:re.image[0]}):M.jsx("img",{style:{width:"100%",height:"auto",objectFit:"cover",aspectRatio:"1/1",margin:"0"},onClick:()=>{window.DebalesChat.track(tn.PRODUCT_IMAGE_CLICKED,{product:re,message:e.conversationId})},src:re.image[0]==="No image available"?"https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg":re.image[0],alt:"Product Image Not Available"})}),M.jsxs(hhe,{children:[M.jsx(phe,{title:re.name,children:re.name}),re.price&&M.jsxs(xhe,{style:{flexDirection:re.price.length>5?"column":"row"},children:[De(t)?M.jsx(UP,{children:M6(re.price,n.currency||"INR",De(t))}):M.jsx(UP,{dangerouslySetInnerHTML:{__html:bP(re.price,a)}}),re.compare_at_price&&J(re)&&M.jsx(bhe,{children:De(t)?M.jsxs(M.Fragment,{children:[M.jsx(jP,{children:M6(re.compare_at_price,n.currency||"INR",!0)}),M.jsxs("span",{style:{color:"#ef4444"},children:[J(re),"% OFF"]})]}):M.jsx(jP,{dangerouslySetInnerHTML:{__html:bP(re.compare_at_price,a)}})})]}),l!==yi.DEFAULT&&l!==yi.UNKNOWN&&re.price&&M.jsx(M.Fragment,{children:M.jsx(mhe,{$botId:t,style:{backgroundColor:n.callToActionBackgroundColor||"#F48722",color:n.callToActionFontColor||"#ffffff"},onClick:ue=>{var Ee;ue.stopPropagation();const he=((Ee=re.options)==null?void 0:Ee.every(N=>N.values.length===1))||!1;l===yi.SHOPIFY||l===yi.THE_COLLECTIVE&&!he?(d(!0),h(re)):(console.log("AddToCartButton: Adding to cart",re),O(re.variantId||"",1,{productId:re.productId||""}),window.DebalesChat.track(tn.ADD_TO_CART_CLICKED,{product:re.name,price:re.price?Ok(re.price):void 0,link:re.link,message:e.conversationId,currentCart:z})),P(!0)},children:De(t)?"Add to Bag":"Add to Cart"})}),re.price&&M.jsxs(ghe,{$botId:t,$backgroundColor:n.callToActionBackgroundColor||"#F48722",title:"product-link",href:oe(re,t,n.shopifyShopDomain||""),onClick:ue=>{ue.stopPropagation(),t.toLowerCase().includes("gtk")&&(ue.preventDefault(),r({message:"Show products similar to "+re.name})),window.DebalesChat.track(t.toLowerCase().includes("gtk")?tn.SHOW_SIMILAR_CLICKED:tn.VIEW_PRODUCT_CLICKED,{productName:re.name,productPrice:re.price?Ok(re.price):void 0,productLink:re.link,message:e.conversationId}),L({dbls_method:"view_product"})},children:[M.jsx("span",{style:{marginRight:"6px"},children:t.toLowerCase().includes("gtk")?"Show Similar":"View Product"}),t.toLowerCase().includes("gtk")?M.jsx($fe,{}):M.jsx(Ife,{})]})]})]})]},de)})})}),e.products.length>1&&M.jsxs(M.Fragment,{children:[M.jsx(IP,{onClick:G,disabled:!m,children:M.jsx(oP,{uiData:n})}),M.jsx($P,{onClick:W,disabled:!_,children:M.jsx(aP,{uiData:n})})]})]})},_he=ce.div`
1582
+ `,jk=({message:e,botId:t,uidata:n,onSendMessage:r,loading:o,storeMetaData:a,platform:l,setShowVariantModel:d,setSelectedProduct:h})=>{const[p,y]=$k({align:"center",containScroll:"trimSnaps",dragFree:!0}),[m,b]=Z.useState(!1),[_,w]=Z.useState(!0),[A,k]=Z.useState(0),E=Z.useRef([]),R=Z.useRef(null),{addToCart:O,generateProductUrl:I,addCartAttributes:L,cart:z,setShowCartSummery:P}=$p(),G=Z.useCallback(()=>y&&y.scrollPrev(),[y]),W=Z.useCallback(()=>y&&y.scrollNext(),[y]),F=Z.useCallback(()=>{y&&(b(y.canScrollPrev()),w(y.canScrollNext()),k(y.selectedScrollSnap()))},[y]),Q=Z.useCallback(re=>{re.forEach(de=>{de.isIntersecting?E.current.forEach((te,ue)=>{te&&(ue===A?te.play():te.pause())}):E.current.forEach(te=>{te&&te.pause()})})},[A]),J=Z.useCallback(re=>{if(!re.compare_at_price||!re.price)return null;const de=parseFloat(re.compare_at_price),te=parseFloat(re.price);if(de<=te)return null;const ue=(de-te)/de*100;return ue>0?Math.round(ue):null},[]);Z.useEffect(()=>{if(y)return y.on("select",F),F(),()=>{y.off("select",F)}},[y,F]),Z.useEffect(()=>{if(!R.current)return;const re=new IntersectionObserver(Q,{root:null,rootMargin:"0px",threshold:.6}),de=R.current;return re.observe(de),()=>{re.unobserve(de)}},[Q]),Z.useEffect(()=>{if(!y)return;const re=()=>{y.reInit()};return window.addEventListener("resize",re),()=>{window.removeEventListener("resize",re)}},[y]);const oe=(re,de,te)=>{let ue=re.link;try{if(de==="GTK-Restaurant"){const he=re.name.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-");ue=new URL(`/order/want-gtk-hoboken/item-${he}_${re.product_id}`,ue.replace("www.","")).toString()}else if(de==="gtk-catering")ue=new URL(`https://${te}/catering/want-gtk-hoboken/items/add/${re.handle}`).toString();else return I(te,re);return ue}catch(he){return console.error("Error formatting product URL:",he),ue}};return!e.products||e.products.length===0?null:M.jsxs(TP,{ref:R,children:[M.jsx(RP,{ref:p,$botId:t,children:M.jsx(OP,{children:e.products.map((re,de)=>{var te;return M.jsxs(DP,{children:[!De(t)&&re.compare_at_price&&J(re)&&M.jsx(vhe,{children:M.jsxs(yhe,{children:[J(re),"% OFF"]})}),M.jsxs(dhe,{onClick:()=>{o||(t.toLowerCase().includes("gtk")||De(t)?(window.open(oe(re,t,n.shopifyShopDomain||""),"_blank"),window.DebalesChat.track(tn.VIEW_PRODUCT_CLICKED,{productName:re.name,productPrice:re.price?Ok(re.price):void 0,productLink:re.link,message:e.conversationId})):r({message:"Tell me about "+re.name+" product"}))},$disabled:o,$botId:t,children:[M.jsx(Mde,{children:(te=re==null?void 0:re.image)!=null&&te[0]&&zj(re.image[0])?M.jsx("video",{ref:ue=>{E.current[de]=ue},style:{width:"100%",height:"auto",objectFit:"cover",aspectRatio:"1/1",margin:"0"},muted:!0,loop:!0,onClick:()=>{window.DebalesChat.track(tn.PRODUCT_VIDEO_CLICKED,{product:re,message:e.conversationId})},src:re.image[0]}):M.jsx("img",{style:{width:"100%",height:"auto",objectFit:"cover",aspectRatio:"1/1",margin:"0"},onClick:()=>{window.DebalesChat.track(tn.PRODUCT_IMAGE_CLICKED,{product:re,message:e.conversationId})},src:re.image[0]==="No image available"?"https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg":re.image[0],alt:"Product Image Not Available"})}),M.jsxs(hhe,{children:[M.jsx(phe,{title:re.name,children:re.name}),re.price&&M.jsxs(xhe,{style:{flexDirection:re.price.length>5?"column":"row"},children:[De(t)?M.jsx(UP,{children:M6(re.price,n.currency||"INR",De(t))}):M.jsx(UP,{dangerouslySetInnerHTML:{__html:bP(re.price,a)}}),re.compare_at_price&&J(re)&&M.jsx(bhe,{children:De(t)?M.jsxs(M.Fragment,{children:[M.jsx(jP,{children:M6(re.compare_at_price,n.currency||"INR",!0)}),M.jsxs("span",{style:{color:"#ef4444"},children:[J(re),"% OFF"]})]}):M.jsx(jP,{dangerouslySetInnerHTML:{__html:bP(re.compare_at_price,a)}})})]}),l!==yi.DEFAULT&&l!==yi.UNKNOWN&&re.price&&M.jsx(M.Fragment,{children:M.jsx(mhe,{$botId:t,style:{backgroundColor:n.callToActionBackgroundColor||"#F48722",color:n.callToActionFontColor||"#ffffff"},onClick:ue=>{var Ee;ue.stopPropagation();const he=((Ee=re.options)==null?void 0:Ee.every(N=>N.values.length===1))||!1;l===yi.SHOPIFY||l===yi.THE_COLLECTIVE&&!he?(d(!0),h(re)):(console.log("AddToCartButton: Adding to cart",re),O(re.variantId||"",1,{productId:re.productId||""}),P(!0),window.DebalesChat.track(tn.ADD_TO_CART_CLICKED,{product:re.name,price:re.price?Ok(re.price):void 0,link:re.link,message:e.conversationId,currentCart:z}))},children:De(t)?"Add to Bag":"Add to Cart"})}),re.price&&M.jsxs(ghe,{$botId:t,$backgroundColor:n.callToActionBackgroundColor||"#F48722",title:"product-link",href:oe(re,t,n.shopifyShopDomain||""),onClick:ue=>{ue.stopPropagation(),t.toLowerCase().includes("gtk")&&(ue.preventDefault(),r({message:"Show products similar to "+re.name})),window.DebalesChat.track(t.toLowerCase().includes("gtk")?tn.SHOW_SIMILAR_CLICKED:tn.VIEW_PRODUCT_CLICKED,{productName:re.name,productPrice:re.price?Ok(re.price):void 0,productLink:re.link,message:e.conversationId}),L({dbls_method:"view_product"})},children:[M.jsx("span",{style:{marginRight:"6px"},children:t.toLowerCase().includes("gtk")?"Show Similar":"View Product"}),t.toLowerCase().includes("gtk")?M.jsx($fe,{}):M.jsx(Ife,{})]})]})]})]},de)})})}),e.products.length>1&&M.jsxs(M.Fragment,{children:[M.jsx(IP,{onClick:G,disabled:!m,children:M.jsx(oP,{uiData:n})}),M.jsx($P,{onClick:W,disabled:!_,children:M.jsx(aP,{uiData:n})})]})]})},_he=ce.div`
1583
1583
  display: flex;
1584
1584
  flex-direction: column;
1585
1585
  gap: 4px;
package/dist/module/ai.js CHANGED
@@ -38506,7 +38506,7 @@ const $ce = oe.p`
38506
38506
  te
38507
38507
  ), R(te.variantId || "", 1, {
38508
38508
  productId: te.productId || ""
38509
- }), window.DebalesChat.track(
38509
+ }), q(!0), window.DebalesChat.track(
38510
38510
  Qt.ADD_TO_CART_CLICKED,
38511
38511
  {
38512
38512
  product: te.name,
@@ -38515,7 +38515,7 @@ const $ce = oe.p`
38515
38515
  message: e.conversationId,
38516
38516
  currentCart: N
38517
38517
  }
38518
- )), q(!0);
38518
+ ));
38519
38519
  },
38520
38520
  children: Ee(t) ? "Add to Bag" : "Add to Cart"
38521
38521
  }
@@ -1223,7 +1223,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1223
1223
  gap: 8px;
1224
1224
  align-items: start;
1225
1225
  flex-direction: column;
1226
- `,RA=({message:e,botId:t,uidata:n,onSendMessage:r,loading:o,storeMetaData:a,platform:l,setShowVariantModel:d,setSelectedProduct:h})=>{const[p,y]=EA({align:"center",containScroll:"trimSnaps",dragFree:!0}),[m,x]=ne.useState(!1),[S,C]=ne.useState(!0),[T,k]=ne.useState(0),A=ne.useRef([]),D=ne.useRef(null),{addToCart:O,generateProductUrl:I,addCartAttributes:L,cart:N,setShowCartSummery:q}=sp(),G=ne.useCallback(()=>y&&y.scrollPrev(),[y]),Z=ne.useCallback(()=>y&&y.scrollNext(),[y]),U=ne.useCallback(()=>{y&&(x(y.canScrollPrev()),C(y.canScrollNext()),k(y.selectedScrollSnap()))},[y]),Y=ne.useCallback(re=>{re.forEach(me=>{me.isIntersecting?A.current.forEach((V,de)=>{V&&(de===T?V.play():V.pause())}):A.current.forEach(V=>{V&&V.pause()})})},[T]),X=ne.useCallback(re=>{if(!re.compare_at_price||!re.price)return null;const me=parseFloat(re.compare_at_price),V=parseFloat(re.price);if(me<=V)return null;const de=(me-V)/me*100;return de>0?Math.round(de):null},[]);ne.useEffect(()=>{if(y)return y.on("select",U),U(),()=>{y.off("select",U)}},[y,U]),ne.useEffect(()=>{if(!D.current)return;const re=new IntersectionObserver(Y,{root:null,rootMargin:"0px",threshold:.6}),me=D.current;return re.observe(me),()=>{re.unobserve(me)}},[Y]),ne.useEffect(()=>{if(!y)return;const re=()=>{y.reInit()};return window.addEventListener("resize",re),()=>{window.removeEventListener("resize",re)}},[y]);const ae=(re,me,V)=>{let de=re.link;try{if(me==="GTK-Restaurant"){const he=re.name.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-");de=new URL(`/order/want-gtk-hoboken/item-${he}_${re.product_id}`,de.replace("www.","")).toString()}else if(me==="gtk-catering")de=new URL(`https://${V}/catering/want-gtk-hoboken/items/add/${re.handle}`).toString();else return I(V,re);return de}catch(he){return console.error("Error formatting product URL:",he),de}};return!e.products||e.products.length===0?null:R.jsxs(QF,{ref:D,children:[R.jsx(KF,{ref:p,$botId:t,children:R.jsx(WF,{children:e.products.map((re,me)=>{var V;return R.jsxs(XF,{children:[!Ae(t)&&re.compare_at_price&&X(re)&&R.jsx(kue,{children:R.jsxs(Tue,{children:[X(re),"% OFF"]})}),R.jsxs(Sue,{onClick:()=>{o||(t.toLowerCase().includes("gtk")||Ae(t)?(window.open(ae(re,t,n.shopifyShopDomain||""),"_blank"),window.DebalesChat.track(Yt.VIEW_PRODUCT_CLICKED,{productName:re.name,productPrice:re.price?_A(re.price):void 0,productLink:re.link,message:e.conversationId})):r({message:"Tell me about "+re.name+" product"}))},$disabled:o,$botId:t,children:[R.jsx(Hle,{children:(V=re==null?void 0:re.image)!=null&&V[0]&&oF(re.image[0])?R.jsx("video",{ref:de=>{A.current[me]=de},style:{width:"100%",height:"auto",objectFit:"cover",aspectRatio:"1/1",margin:"0"},muted:!0,loop:!0,onClick:()=>{window.DebalesChat.track(Yt.PRODUCT_VIDEO_CLICKED,{product:re,message:e.conversationId})},src:re.image[0]}):R.jsx("img",{style:{width:"100%",height:"auto",objectFit:"cover",aspectRatio:"1/1",margin:"0"},onClick:()=>{window.DebalesChat.track(Yt.PRODUCT_IMAGE_CLICKED,{product:re,message:e.conversationId})},src:re.image[0]==="No image available"?"https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg":re.image[0],alt:"Product Image Not Available"})}),R.jsxs(wue,{children:[R.jsx(Cue,{title:re.name,children:re.name}),re.price&&R.jsxs(Due,{style:{flexDirection:re.price.length>5?"column":"row"},children:[Ae(t)?R.jsx(sU,{children:t6(re.price,n.currency||"INR",Ae(t))}):R.jsx(sU,{dangerouslySetInnerHTML:{__html:UF(re.price,a)}}),re.compare_at_price&&X(re)&&R.jsx(Oue,{children:Ae(t)?R.jsxs(R.Fragment,{children:[R.jsx(lU,{children:t6(re.compare_at_price,n.currency||"INR",!0)}),R.jsxs("span",{style:{color:"#ef4444"},children:[X(re),"% OFF"]})]}):R.jsx(lU,{dangerouslySetInnerHTML:{__html:UF(re.compare_at_price,a)}})})]}),l!==gi.DEFAULT&&l!==gi.UNKNOWN&&re.price&&R.jsx(R.Fragment,{children:R.jsx(Aue,{$botId:t,style:{backgroundColor:n.callToActionBackgroundColor||"#F48722",color:n.callToActionFontColor||"#ffffff"},onClick:de=>{var De;de.stopPropagation();const he=((De=re.options)==null?void 0:De.every(P=>P.values.length===1))||!1;l===gi.SHOPIFY||l===gi.THE_COLLECTIVE&&!he?(d(!0),h(re)):(console.log("AddToCartButton: Adding to cart",re),O(re.variantId||"",1,{productId:re.productId||""}),window.DebalesChat.track(Yt.ADD_TO_CART_CLICKED,{product:re.name,price:re.price?_A(re.price):void 0,link:re.link,message:e.conversationId,currentCart:N})),q(!0)},children:Ae(t)?"Add to Bag":"Add to Cart"})}),re.price&&R.jsxs(Eue,{$botId:t,$backgroundColor:n.callToActionBackgroundColor||"#F48722",title:"product-link",href:ae(re,t,n.shopifyShopDomain||""),onClick:de=>{de.stopPropagation(),t.toLowerCase().includes("gtk")&&(de.preventDefault(),r({message:"Show products similar to "+re.name})),window.DebalesChat.track(t.toLowerCase().includes("gtk")?Yt.SHOW_SIMILAR_CLICKED:Yt.VIEW_PRODUCT_CLICKED,{productName:re.name,productPrice:re.price?_A(re.price):void 0,productLink:re.link,message:e.conversationId}),L({dbls_method:"view_product"})},children:[R.jsx("span",{style:{marginRight:"6px"},children:t.toLowerCase().includes("gtk")?"Show Similar":"View Product"}),t.toLowerCase().includes("gtk")?R.jsx(Pse,{}):R.jsx(qse,{})]})]})]})]},me)})})}),e.products.length>1&&R.jsxs(R.Fragment,{children:[R.jsx(eU,{onClick:G,disabled:!m,children:R.jsx(AF,{uiData:n})}),R.jsx(tU,{onClick:Z,disabled:!S,children:R.jsx(kF,{uiData:n})})]})]})},Mue=ee.div`
1226
+ `,RA=({message:e,botId:t,uidata:n,onSendMessage:r,loading:o,storeMetaData:a,platform:l,setShowVariantModel:d,setSelectedProduct:h})=>{const[p,y]=EA({align:"center",containScroll:"trimSnaps",dragFree:!0}),[m,x]=ne.useState(!1),[S,C]=ne.useState(!0),[T,k]=ne.useState(0),A=ne.useRef([]),D=ne.useRef(null),{addToCart:O,generateProductUrl:I,addCartAttributes:L,cart:N,setShowCartSummery:q}=sp(),G=ne.useCallback(()=>y&&y.scrollPrev(),[y]),Z=ne.useCallback(()=>y&&y.scrollNext(),[y]),U=ne.useCallback(()=>{y&&(x(y.canScrollPrev()),C(y.canScrollNext()),k(y.selectedScrollSnap()))},[y]),Y=ne.useCallback(re=>{re.forEach(me=>{me.isIntersecting?A.current.forEach((V,de)=>{V&&(de===T?V.play():V.pause())}):A.current.forEach(V=>{V&&V.pause()})})},[T]),X=ne.useCallback(re=>{if(!re.compare_at_price||!re.price)return null;const me=parseFloat(re.compare_at_price),V=parseFloat(re.price);if(me<=V)return null;const de=(me-V)/me*100;return de>0?Math.round(de):null},[]);ne.useEffect(()=>{if(y)return y.on("select",U),U(),()=>{y.off("select",U)}},[y,U]),ne.useEffect(()=>{if(!D.current)return;const re=new IntersectionObserver(Y,{root:null,rootMargin:"0px",threshold:.6}),me=D.current;return re.observe(me),()=>{re.unobserve(me)}},[Y]),ne.useEffect(()=>{if(!y)return;const re=()=>{y.reInit()};return window.addEventListener("resize",re),()=>{window.removeEventListener("resize",re)}},[y]);const ae=(re,me,V)=>{let de=re.link;try{if(me==="GTK-Restaurant"){const he=re.name.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-");de=new URL(`/order/want-gtk-hoboken/item-${he}_${re.product_id}`,de.replace("www.","")).toString()}else if(me==="gtk-catering")de=new URL(`https://${V}/catering/want-gtk-hoboken/items/add/${re.handle}`).toString();else return I(V,re);return de}catch(he){return console.error("Error formatting product URL:",he),de}};return!e.products||e.products.length===0?null:R.jsxs(QF,{ref:D,children:[R.jsx(KF,{ref:p,$botId:t,children:R.jsx(WF,{children:e.products.map((re,me)=>{var V;return R.jsxs(XF,{children:[!Ae(t)&&re.compare_at_price&&X(re)&&R.jsx(kue,{children:R.jsxs(Tue,{children:[X(re),"% OFF"]})}),R.jsxs(Sue,{onClick:()=>{o||(t.toLowerCase().includes("gtk")||Ae(t)?(window.open(ae(re,t,n.shopifyShopDomain||""),"_blank"),window.DebalesChat.track(Yt.VIEW_PRODUCT_CLICKED,{productName:re.name,productPrice:re.price?_A(re.price):void 0,productLink:re.link,message:e.conversationId})):r({message:"Tell me about "+re.name+" product"}))},$disabled:o,$botId:t,children:[R.jsx(Hle,{children:(V=re==null?void 0:re.image)!=null&&V[0]&&oF(re.image[0])?R.jsx("video",{ref:de=>{A.current[me]=de},style:{width:"100%",height:"auto",objectFit:"cover",aspectRatio:"1/1",margin:"0"},muted:!0,loop:!0,onClick:()=>{window.DebalesChat.track(Yt.PRODUCT_VIDEO_CLICKED,{product:re,message:e.conversationId})},src:re.image[0]}):R.jsx("img",{style:{width:"100%",height:"auto",objectFit:"cover",aspectRatio:"1/1",margin:"0"},onClick:()=>{window.DebalesChat.track(Yt.PRODUCT_IMAGE_CLICKED,{product:re,message:e.conversationId})},src:re.image[0]==="No image available"?"https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg":re.image[0],alt:"Product Image Not Available"})}),R.jsxs(wue,{children:[R.jsx(Cue,{title:re.name,children:re.name}),re.price&&R.jsxs(Due,{style:{flexDirection:re.price.length>5?"column":"row"},children:[Ae(t)?R.jsx(sU,{children:t6(re.price,n.currency||"INR",Ae(t))}):R.jsx(sU,{dangerouslySetInnerHTML:{__html:UF(re.price,a)}}),re.compare_at_price&&X(re)&&R.jsx(Oue,{children:Ae(t)?R.jsxs(R.Fragment,{children:[R.jsx(lU,{children:t6(re.compare_at_price,n.currency||"INR",!0)}),R.jsxs("span",{style:{color:"#ef4444"},children:[X(re),"% OFF"]})]}):R.jsx(lU,{dangerouslySetInnerHTML:{__html:UF(re.compare_at_price,a)}})})]}),l!==gi.DEFAULT&&l!==gi.UNKNOWN&&re.price&&R.jsx(R.Fragment,{children:R.jsx(Aue,{$botId:t,style:{backgroundColor:n.callToActionBackgroundColor||"#F48722",color:n.callToActionFontColor||"#ffffff"},onClick:de=>{var De;de.stopPropagation();const he=((De=re.options)==null?void 0:De.every(P=>P.values.length===1))||!1;l===gi.SHOPIFY||l===gi.THE_COLLECTIVE&&!he?(d(!0),h(re)):(console.log("AddToCartButton: Adding to cart",re),O(re.variantId||"",1,{productId:re.productId||""}),q(!0),window.DebalesChat.track(Yt.ADD_TO_CART_CLICKED,{product:re.name,price:re.price?_A(re.price):void 0,link:re.link,message:e.conversationId,currentCart:N}))},children:Ae(t)?"Add to Bag":"Add to Cart"})}),re.price&&R.jsxs(Eue,{$botId:t,$backgroundColor:n.callToActionBackgroundColor||"#F48722",title:"product-link",href:ae(re,t,n.shopifyShopDomain||""),onClick:de=>{de.stopPropagation(),t.toLowerCase().includes("gtk")&&(de.preventDefault(),r({message:"Show products similar to "+re.name})),window.DebalesChat.track(t.toLowerCase().includes("gtk")?Yt.SHOW_SIMILAR_CLICKED:Yt.VIEW_PRODUCT_CLICKED,{productName:re.name,productPrice:re.price?_A(re.price):void 0,productLink:re.link,message:e.conversationId}),L({dbls_method:"view_product"})},children:[R.jsx("span",{style:{marginRight:"6px"},children:t.toLowerCase().includes("gtk")?"Show Similar":"View Product"}),t.toLowerCase().includes("gtk")?R.jsx(Pse,{}):R.jsx(qse,{})]})]})]})]},me)})})}),e.products.length>1&&R.jsxs(R.Fragment,{children:[R.jsx(eU,{onClick:G,disabled:!m,children:R.jsx(AF,{uiData:n})}),R.jsx(tU,{onClick:Z,disabled:!S,children:R.jsx(kF,{uiData:n})})]})]})},Mue=ee.div`
1227
1227
  display: flex;
1228
1228
  flex-direction: column;
1229
1229
  gap: 4px;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@debales/ai",
3
3
  "private": false,
4
4
  "access": "public",
5
- "version": "1.1.47",
5
+ "version": "1.1.48",
6
6
  "type": "module",
7
7
  "main": "./dist/module/ai.js",
8
8
  "types": "./dist/module/index.d.ts",
@@ -54,8 +54,8 @@
54
54
  "vite": "^6.2.0",
55
55
  "vite-plugin-dts": "^4.5.3",
56
56
  "@debales/eslint-config": "0.0.0",
57
- "@debales/shared": "0.0.1",
58
- "@debales/typescript-config": "0.0.0"
57
+ "@debales/typescript-config": "0.0.0",
58
+ "@debales/shared": "0.0.1"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "react": "^18.0.0 || ^19.0.0",