@restaround/react 1.0.53 → 1.0.54
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/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles/ui.css +1 -1
- package/dist/styles/ui.css.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("@sorocraft/js-utils"),a=require("react"),r=require("@sorocraft/ui"),n=require("@sorocraft/ui/icons");function i(e,t){var a={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(a[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(a[r[n]]=e[r[n]])}return a}function o(e,t,a,r){return new(a||(a=Promise))((function(n,i){function o(e){try{s(r.next(e))}catch(e){i(e)}}function l(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(o,l)}s((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var l="PublicMenu-module_container__QLN6U",s="PublicMenu-module_categories__Iy6NC",d="PublicMenu-module_footer__6G3DQ";const c="https://images.restaround.co",u=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${c}/${e}`:"",m=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${c}/${e}`:"https://images.restaround.co/no-photo-128.webp",_=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${c}/${e}`:"https://images.restaround.co/restaround-doodle.webp",h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=(e,t,a)=>h.charAt(e>>2)+h.charAt((3&e)<<4|t>>4)+h.charAt((15&t)<<2|a>>6)+h.charAt(63&a),p="restaround.co",v=[p,"restaround.az","restaround.ee","restaround.nl"],f=a.createContext({}),x=({children:a,value:r})=>{const n=t.isEmpty(r)?{}:r;return n.currency||(n.currency="AZN"),n.language||(n.language="az"),e.jsx(f.Provider,{value:t.isEmpty(r)?{}:r,children:a})},j=()=>a.useContext(f),y="digital_menu",I=`${y}_category_select`,C=`${y}_category_scroll`,P=`${y}_product_details`,b=`${y}_product_add_cart`,A=`${y}_product_view_changed`,N=[I,C,P,b],w=(e,t)=>{var a,r;return(null===(r=null===(a=null==e?void 0:e.translations)||void 0===a?void 0:a.find)||void 0===r?void 0:r.call(a,(e=>e.language===t)))||{}};var k="Header-module_container__tenlF",S="Header-module_cover__BAWZK",T="Header-module_content__Gx4Al",D="Header-module_logo__4MTCm",R="Header-module_info__IchYA",L="Header-module_name__30wyw",E="Header-module_address__WOxXc",O="Header-module_addressText__lUszI",G="Header-module_social__AoP0z",q="Header-module_links__EeQxg",W="Header-module_wifiPassword__VWBTa",M="Header-module_wifiPasswordIcon__Ukn3D";const z=t=>{const a=i(t,["priority","blurDataURL","quality","placeholder","fetchPriority"]),{imageTag:r}=j()||{};if(r){const a=r;return e.jsx(a,Object.assign({},t,{quality:t.quality||100,placeholder:"blur",blurDataURL:(n=235,o=59,l=90,`data:image/gif;base64,R0lGODlhAQABAPAA${g(0,n,o)+g(l,255,255)}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`)}))}var n,o,l;return e.jsx("img",Object.assign({},a))};var B={container:"Languages-module_container__nJeK1",currentLanguage:"Languages-module_currentLanguage__EFw6Q",options:"Languages-module_options__6jLRm",option:"Languages-module_option__QkVQd",isOpen:"Languages-module_isOpen__eUGbg",flexWide:"Languages-module_flexWide__zQ9jN",slidein:"Languages-module_slidein__C4UHU",fadeInOut:"Languages-module_fadeInOut__U-vhH",heightAnimation:"Languages-module_heightAnimation__gIQkF",fadein:"Languages-module_fadein__vPmsX",floatAnimation:"Languages-module_floatAnimation__L-kPH",bottomSheet:"Languages-module_bottomSheet__-t-q8",slideRightToLeft:"Languages-module_slideRightToLeft__y0l-f"};const Q=()=>{var t;const{language:n,languages:i,onLanguageSelect:o}=j(),[l,s]=a.useState(!1),d=(null==i?void 0:i.length)>1,c=(null===(t=null==i?void 0:i.filter)||void 0===t?void 0:t.call(i,(({code:e})=>e!==n)))||[],u=e=>`https://images.restaround.co/languages/${e}.svg`;return d?e.jsx("div",{className:B.container,onClick:()=>s(!l),children:e.jsxs(r.Row,{alignItems:"center",gap:0,children:[e.jsx(r.Row,{alignItems:"center",className:r.classNames(B,{options:!0,isOpen:l}),children:c.map((({code:t})=>e.jsx("img",{src:u(t),className:B.option,onClick:()=>(e=>{o&&o(e)})(t),alt:t},t)))}),e.jsx("img",{src:u(n),alt:n||"",className:B.currentLanguage})]})}):null},U=({branch:a,coverImage:i,logoImage:o,name:l,instagram:s,facebook:d,whatsapp:c,telegram:u,tiktok:m})=>{const{address:_,latitude:h,longitude:g,phone:p,wifiPassword:v}=a||{},f=t.isEmpty(a),x=`https://www.google.com/maps/place/${h},${g}`;return e.jsxs("div",{className:k,children:[e.jsx(z,{src:i,alt:l,className:S,width:1024,height:400,priority:!0,sizes:"100vw",fetchPriority:"high",loading:"eager"}),e.jsx("div",{className:T,children:f?e.jsx((()=>e.jsxs(r.Column,{fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",children:[e.jsx(z,{src:o,alt:l,className:D,width:96,height:96}),e.jsx("div",{className:R,children:e.jsx("h1",{className:L,children:l})})]})),{}):e.jsx((()=>e.jsxs(r.Flex,{direction:"row",gap:1,alignItems:"center",children:[e.jsx(r.Flex.Item,{children:e.jsx(z,{src:o,alt:l,className:D,width:96,height:96})}),e.jsx(r.Flex.Item,{shrink:!0,children:e.jsx("div",{className:R,children:e.jsxs(r.Column,{gap:.25,children:[e.jsx("h1",{className:L,children:l}),e.jsx("a",{className:E,href:x,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(r.Row,{alignItems:"center",gap:.5,children:[e.jsx(r.SVGIcon,{icon:n.MarkerPin,theme:"dark"}),e.jsx("span",{className:O,children:_})]})})]})})})]})),{})}),e.jsx(Q,{}),!f&&e.jsx("div",{className:G,children:e.jsx("div",{className:q,children:e.jsx(r.Row,{gap:2,alignItems:"center",children:e.jsxs(r.Row,{alignItems:"center",justifyContent:"center",gap:.5,children:[!!p&&e.jsx(r.IconLink,{icon:n.Phone,href:`tel:+${p}`,size:"sm",shape:"circle",theme:"light"}),!!c&&e.jsx(r.IconLink,{icon:n.Whatsapp,href:`https://wa.me/${c}`,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!s&&e.jsx(r.IconLink,{icon:n.Instagram,href:s,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!u&&e.jsx(r.IconLink,{icon:n.Telegram,href:u,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!m&&e.jsx(r.IconLink,{icon:n.Tiktok,href:m,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!d&&e.jsx(r.IconLink,{icon:n.Facebook,href:d,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!v&&e.jsx(r.Tooltip,{hint:v,children:e.jsx("div",{className:W,children:e.jsx(r.SVGIcon,{icon:n.Wifi,size:"sm",className:M})})})]})})})})]})},H=({categoryProductMap:n=[],language:i,selectedCategoryId:o,onSelectCategory:l})=>{const d=a.useRef({}),c=a.useRef(null);return a.useEffect((()=>{o&&(()=>{var e;const t=null===(e=null==d?void 0:d.current)||void 0===e?void 0:e[o];if(!t||!c.current)return;const a=c.current.clientWidth,r=t.offsetLeft-a/2+t.offsetWidth/2;c.current.scrollTo({left:r,behavior:"smooth"})})()}),[o]),e.jsx("div",{className:s,children:e.jsx(r.Carousel,{gap:1,onGetRef:e=>{(null==e?void 0:e.current)&&(c.current=e.current)},children:(n||[]).map((({id:a,translations:n})=>{const{name:s}=n.find((e=>e.language===i))||{};return e.jsx(r.CarouselItem,{children:e.jsx(r.Chip,{onClick:()=>((e,a)=>{e!==o&&(t.trackEvent(I,{name:a}),l(e))})(a,s),type:r.UIElementType.BORDERED_PRIMARY,active:a===o,children:e.jsx("div",{ref:e=>{e&&(d.current[a]=e)},children:s})})},a)}))})})};var F="Products-module_container__bF2LF",V="Products-module_view__l857X",$="Products-module_products__AoDrY",Y="Products-module_category__Sp7dE",K="Products-module_list__LH4v5";const X=(e,t,a=0)=>e*t*(1+a/100),Z=(e,t)=>{var a,r;return(null===(r=null===(a=null==e?void 0:e.translations)||void 0===a?void 0:a.find)||void 0===r?void 0:r.call(a,(e=>e.language===t)))||{}},J=(e,a,r,n=1)=>{const{price:i,vat:o}=e||{},l=X(i,n,o);return{totalPrice:l,formattedTotalPrice:t.priceFormatter(l,a,r)}},ee=(e,t)=>{var a,r;return(null===(r=null===(a=null==e?void 0:e.variants)||void 0===a?void 0:a.find)||void 0===r?void 0:r.call(a,(e=>e.id===t)))||{}},te=({variantId:e,currency:a="USD",language:r="en",product:n,quantity:i=1})=>{const o=ee(n,e),{vat:l}=n||{},{price:s}=o||{},d=X(s,i,l);return{totalPrice:d,formattedTotalPrice:t.priceFormatter(d,a,r)}},ae=(e,t)=>{var a,r;return(null===(r=null===(a=null==e?void 0:e.translations)||void 0===a?void 0:a.find)||void 0===r?void 0:r.call(a,(e=>e.language===t)))||{}};var re;!function(e){e.LIST="list",e.GRID="grid"}(re||(re={}));const ne=a.createContext({cart:{},isCartOpen:!1,addProduct:()=>{},updateProduct:()=>{},setIsCartOpen:()=>{},removeAllProductVariants:()=>{}}),ie=({children:r})=>{const[n,o]=a.useState({}),[l,s]=a.useState(!1),d=({product:e,quantity:a,isAddOperation:r,variantId:n})=>{var l;if(t.isEmpty(e)||a<0)return;const{id:s,price:d,vat:c=0}=e,u=n?`${s}-${n}`:`${s}`,m=n?null===(l=ee(e,n))||void 0===l?void 0:l.price:d;o((e=>{const t=e[u],o=r?((null==t?void 0:t.quantity)||0)+a:a;if(o<=0){const t=e,a=u;t[a];return i(t,["symbol"==typeof a?a:a+""])}return Object.assign(Object.assign({},e),{[u]:{productId:s,price:m,quantity:o,vat:c,variantId:n}})}))},c=({product:e,quantity:t=1,variantId:a})=>d({product:e,quantity:t,variantId:a,isAddOperation:!0}),u=({product:e,quantity:t=1,variantId:a})=>d({product:e,quantity:t,variantId:a,isAddOperation:!1}),m=e=>{if(!e||t.isEmpty(n))return;const a=Object.entries(n).reduce(((t,[a,r])=>(r.productId!==e&&(t[a]=r),t)),{});o(a)},_=a.useMemo((()=>({cart:n,isCartOpen:l,addProduct:c,updateProduct:u,setIsCartOpen:s,removeAllProductVariants:m})),[n,l]);return e.jsx(ne.Provider,{value:_,children:r})},oe=()=>a.useContext(ne);var le={container:"ProductsListItem-module_container__i9tFs",isClickable:"ProductsListItem-module_isClickable__iHHdI",data:"ProductsListItem-module_data__Mb3SF",name:"ProductsListItem-module_name__T1gyJ",description:"ProductsListItem-module_description__oL4CH",price:"ProductsListItem-module_price__V1GRM",image:"ProductsListItem-module_image__h6Wbi",addToCart:"ProductsListItem-module_addToCart__WXrQZ",flexWide:"ProductsListItem-module_flexWide__Ds6LE",slidein:"ProductsListItem-module_slidein__rEzMI",fadeInOut:"ProductsListItem-module_fadeInOut__i1FNq",heightAnimation:"ProductsListItem-module_heightAnimation__2fk7l",fadein:"ProductsListItem-module_fadein__tPTJ6",floatAnimation:"ProductsListItem-module_floatAnimation__vugAV",bottomSheet:"ProductsListItem-module_bottomSheet__-YAdd",slideRightToLeft:"ProductsListItem-module_slideRightToLeft__oXk26"};const se=({product:i,currency:o,language:l,onClick:s})=>{var d;const{addProduct:c}=oe(),{image160:m,volume:_}=i||{},{name:h,description:g}=a.useMemo((()=>Z(i,l)),[i,l]),{formattedTotalPrice:p}=a.useMemo((()=>J(i,o,l)),[i,o,l]),v=(null===(d=null==i?void 0:i.variants)||void 0===d?void 0:d.length)>0;return e.jsxs("div",{className:t.classNames(le,{container:!0,isClickable:!!s}),onClick:s,children:[e.jsxs(r.Row,{justifyContent:"space-between",gap:0,children:[e.jsx("div",{className:le.data,children:e.jsxs(r.Column,{gap:.25,children:[e.jsx("h3",{className:le.name,children:h}),e.jsx("p",{className:le.description,children:g}),e.jsxs(r.Row,{className:le.price,gap:.5,fullWidth:!0,justifyContent:"space-between",children:[e.jsx("span",{children:p}),!!_&&e.jsx(r.Text,{color:"muted",children:_})]})]})}),m&&e.jsx(z,{src:u(m),alt:h||"menu",className:le.image,loading:"lazy",width:160,height:90})]}),e.jsx("div",{className:le.addToCart,children:e.jsx(r.IconButton,{onClick:e=>{if(e.preventDefault(),e.stopPropagation(),v&&s)return s();c({product:i}),t.trackEvent(b,{name:h,quantity:1})},icon:n.Plus,type:r.UIElementType.DEFAULT})})]})};var de={container:"ProductsGridItem-module_container__DU5KG",content:"ProductsGridItem-module_content__FXs0Y",isClickable:"ProductsGridItem-module_isClickable__8zhwt",info:"ProductsGridItem-module_info__HkBG-",data:"ProductsGridItem-module_data__Z-N1X",name:"ProductsGridItem-module_name__ZrIx3",description:"ProductsGridItem-module_description__-FQPA",price:"ProductsGridItem-module_price__BFu2H",imageContainer:"ProductsGridItem-module_imageContainer__eHS4Z",image:"ProductsGridItem-module_image__alZWL",addToCart:"ProductsGridItem-module_addToCart__gYVrI",noImage:"ProductsGridItem-module_noImage__78UHW",volume:"ProductsGridItem-module_volume__oxEAr",flexWide:"ProductsGridItem-module_flexWide__qcB5X",slidein:"ProductsGridItem-module_slidein__oKaVb",fadeInOut:"ProductsGridItem-module_fadeInOut__d2zot",heightAnimation:"ProductsGridItem-module_heightAnimation__zgbh9",fadein:"ProductsGridItem-module_fadein__Z067K",floatAnimation:"ProductsGridItem-module_floatAnimation__GXjP-",bottomSheet:"ProductsGridItem-module_bottomSheet__-zrFD",slideRightToLeft:"ProductsGridItem-module_slideRightToLeft__R7hv5"};const ce=({product:i,currency:o,language:l,onClick:s})=>{var d;const{addProduct:c}=oe(),{volume:m,image580:_,image160:h,image1024:g}=i||{},p=_||g||h,{name:v,description:f}=a.useMemo((()=>Z(i,l)),[i,l]),{formattedTotalPrice:x}=a.useMemo((()=>J(i,o,l)),[i,o,l]),j=(null===(d=null==i?void 0:i.variants)||void 0===d?void 0:d.length)>0;return e.jsx("div",{className:de.container,children:e.jsxs("div",{className:t.classNames(de,{content:!0,isClickable:!!s,noImage:!p}),onClick:s,children:[p&&e.jsx("div",{className:de.imageContainer,children:e.jsx(z,{src:u(p),alt:v||"menu",className:de.image,loading:"lazy",width:580,height:326})}),e.jsx("div",{className:de.info,children:e.jsx("div",{className:de.data,children:e.jsxs(r.Column,{gap:.25,children:[e.jsx("h3",{className:de.name,children:v}),e.jsx("p",{className:de.description,children:f}),e.jsxs(r.Row,{className:de.price,gap:.5,fullWidth:!0,justifyContent:"space-between",children:[e.jsx("span",{children:x}),!!m&&e.jsx(r.Text,{color:"white",className:de.volume,children:m})]})]})})}),e.jsx("div",{className:de.addToCart,children:e.jsx(r.IconButton,{onClick:e=>{if(e.preventDefault(),e.stopPropagation(),j&&s)return s();c({product:i}),t.trackEvent(b,{name:v,quantity:1})},icon:n.Plus,type:r.UIElementType.DEFAULT})})]})})};var ue={container:"ProductDetails-module_container__oa07j",content:"ProductDetails-module_content__Db3NC",image:"ProductDetails-module_image__BlMfl",details:"ProductDetails-module_details__zfnlt",name:"ProductDetails-module_name__ganLM",price:"ProductDetails-module_price__W34k9",volume:"ProductDetails-module_volume__RWG5s",description:"ProductDetails-module_description__HBufi",variants:"ProductDetails-module_variants__zOWjJ",focused:"ProductDetails-module_focused__Nsffd",variantsTitle:"ProductDetails-module_variantsTitle__ta-cw",variant:"ProductDetails-module_variant__vQ5yD",close:"ProductDetails-module_close__4cHZ3",addAction:"ProductDetails-module_addAction__o4T5R",actionTitle:"ProductDetails-module_actionTitle__NIJGW",flexWide:"ProductDetails-module_flexWide__w06FX",slidein:"ProductDetails-module_slidein__N8f4g",fadeInOut:"ProductDetails-module_fadeInOut__hYRtK",heightAnimation:"ProductDetails-module_heightAnimation__hLQyz",fadein:"ProductDetails-module_fadein__QN4mI",floatAnimation:"ProductDetails-module_floatAnimation__dTQbc",bottomSheet:"ProductDetails-module_bottomSheet__HO2S-",slideRightToLeft:"ProductDetails-module_slideRightToLeft__hbtJg"};const me={en:{},az:{"View order":"Şifarişi göstər","Remove from order":"Sifarişdən sil","Update order":"Sifarişi yenilə","Add to order":"Sifarişə əlavə et","Your order":"Sifarişiniz",Subtotal:"Ümumi","Empty order":"Boş sifariş","You don't have any items in your order":"Sifarişinizdə heç bir məhsul yoxdur","Add items":"Məhsul əlavə et",Events:"Hərəkətlər","Scrolled to Category":"Kateqoriyaya sürüşdürdü","Category Selected":"Kateqoriya seçildi","Product Details":"Məhsul detalına baxıldı","Product Added to Cart":"Səbətə əlavə edildi","Product choices":"Seçimlər","In order":"Sifarişdə"},tr:{"View order":"Siparişi Görüntüle","Remove from order":"Siparişten Kaldır","Update order":"Siparişi Güncelle","Add to order":"Siparişe Ekle","Your order":"Siparişiniz","Empty order":"Boş sipariş","You don't have any items in your order":"Siparişinizde hiç bir ürün yok","Add items":"Ürün ekle",Subtotal:"Toplam",Events:"Olaylar","Product choices":"Seçenekler","In order":"Siparişte"},nl:{"View order":"Bestelling bekijken","Remove from order":"Uit bestelling verwijderen","Update order":"Bestelling bijwerken","Add to order":"Aan bestelling toevoegen","Your order":"Uw bestelling","Empty order":"Lege bestelling","You don't have any items in your order":"U heeft geen items in uw bestelling","Add items":"Items toevoegen",Subtotal:"Totaal",Events:"Gebeurtenissen","Product choices":"Productkeuzes","In order":"In bestelling"},et:{"View order":"Vaata tellimust","Remove from order":"Eemalda tellimusest","Update order":"Uuenda tellimust","Add to order":"Lisa tellimusele","Your order":"Teie tellimus","Empty order":"Tühi tellimus","You don't have any items in your order":"Teie tellimuses pole ühtegi eset","Add items":"Lisa esemeid",Subtotal:"Kokku",Events:"Sündmused","Product choices":"Tootevalikud","In order":"Tellimuses"},ru:{"View order":"Посмотреть заказ","Remove from order":"Удалить из заказа","Update order":"Обновить заказ","Add to order":"Добавить в заказ","Your order":"Ваш заказ","Empty order":"Пустой заказ","You don't have any items in your order":"В вашем заказе нет товаров","Add items":"Добавить товары",Subtotal:"Итого",Events:"События","Product choices":"Варианты товара","In order":"В заказе"}},_e=e=>{const{language:t}=j(),a=e||t;return{t:e=>{var t;return(null===(t=me[a])||void 0===t?void 0:t[e])||e}}},he=(e,a="USD",r="en")=>{const{price:n,vat:i,quantity:o}=e||{},l=X(n,o,i);return{totalPrice:l,formattedTotalPrice:t.priceFormatter(l,a,r)}},ge=()=>{const{cart:e}=oe();return Object.values(e||{}).reduce(((e,t)=>e+t.quantity),0)};var pe={container:"Quantity-module_container__01ySb",quantityAction:"Quantity-module_quantityAction__wRV2F",quantityValue:"Quantity-module_quantityValue__BBpyw",isDisabled:"Quantity-module_isDisabled__crQCf",sm:"Quantity-module_sm__0Hgp2",md:"Quantity-module_md__hu7a8",lg:"Quantity-module_lg__GA4jn",flexWide:"Quantity-module_flexWide__R95Jw",slidein:"Quantity-module_slidein__5yeWf",fadeInOut:"Quantity-module_fadeInOut__cllco",heightAnimation:"Quantity-module_heightAnimation__dhOgA",fadein:"Quantity-module_fadein__Cof2o",floatAnimation:"Quantity-module_floatAnimation__DSqQr",bottomSheet:"Quantity-module_bottomSheet__5-5iY",slideRightToLeft:"Quantity-module_slideRightToLeft__cjDHk"};const ve=({isDecreaseDisabled:a=!1,quantity:i=1,size:o="md",onIncrease:l,onDecrease:s})=>e.jsxs(r.Row,{className:t.classNames(pe,{container:!0},[pe[o]]),justifyContent:"space-between",gap:0,children:[e.jsx("div",{className:t.classNames(pe,{quantityAction:!0,isDisabled:a}),onClick:s,children:e.jsx(r.SVGIcon,{icon:n.Minus})}),e.jsx("div",{className:pe.quantityValue,children:i}),e.jsx("div",{className:pe.quantityAction,onClick:l,children:e.jsx(r.SVGIcon,{icon:n.Plus})})]});var fe="ProductInCart-module_container__oSrwq",xe="ProductInCart-module_title__Vnc4l";const je=({productId:a,onModalClose:i})=>{const{setIsCartOpen:o,removeAllProductVariants:l}=oe(),{t:s}=_e(),d=(e=>{const{cart:a}=oe();return t.isEmpty(a)||!e?0:Object.values(a).filter((t=>t.productId===e)).reduce(((e,t)=>e+t.quantity),0)})(a);return d<=0?null:e.jsxs(r.Flex,{className:fe,fullWidth:!0,justifyContent:"space-between",alignItems:"center",children:[e.jsxs(r.Flex.Item,{flex:1,className:xe,children:[s("In order")," (",d,")"]}),e.jsx(r.Flex.Item,{flex:0,children:e.jsxs(r.Row,{children:[e.jsx(r.IconButton,{icon:n.Trash,onClick:()=>{l(a)},type:r.UIElementType.DANGER,tooltip:s("Remove from order")}),e.jsx(r.IconButton,{icon:n.ShoppingBag,onClick:()=>{o(!0),i&&i()},type:r.UIElementType.SUCCESS,tooltip:s("View order")})]})})]})},ye=({product:i,onClose:o})=>{const{language:l,currency:s}=j(),{addProduct:d,updateProduct:c}=oe(),[m,_]=a.useState(1),[h,g]=a.useState(!1),[p,v]=a.useState(null),[f,x]=a.useState(null),y=a.useRef(null),{t:I}=_e(),C=((e,a)=>{var r;const{cart:n}=oe();return t.isEmpty(n)||!e?0:(null===(r=n[a?`${e}-${a}`:`${e}`])||void 0===r?void 0:r.quantity)||0})(null==i?void 0:i.id,p),{name:P,description:A}=a.useMemo((()=>Z(i,l)),[i,l]),{formattedTotalPrice:N}=a.useMemo((()=>J(i,s,l)),[i,s,l]),{formattedTotalPrice:w}=a.useMemo((()=>(({product:e,variantId:t,quantity:a=1,currency:r,language:n})=>t?te({variantId:t,currency:r,language:n,product:e,quantity:a}):J(e,r,n,a))({product:i,quantity:m,language:l,currency:s,variantId:p})),[i,m,l,s,p]),k=h?0===m:1===m,S=a.useMemo((()=>I(h?0===m?"Remove from order":"Update order":"Add to order")),[h,m]);a.useEffect((()=>{_(C>0?C:1),g(C>0)}),[C,i]),a.useEffect((()=>{v(null)}),[i]);const T=e=>{-1===e&&k||_((t=>Math.max(0,t+e)))};if(t.isEmpty(i))return null;const{image1024:D,volume:R,variants:L}=i;return e.jsx("div",{className:ue.container,onClick:e=>{var t,a;(null===(a=null===(t=null==y?void 0:y.current)||void 0===t?void 0:t.contains)||void 0===a?void 0:a.call(t,null==e?void 0:e.target))||o&&o()},children:e.jsx(r.Modal,{onClose:o,ref:y,noBodyPadding:!0,size:"small",content:e.jsxs("div",{className:ue.content,children:[e.jsxs(r.Column,{gap:0,children:[D&&e.jsx(z,{src:u(D),width:1024,height:400,alt:P||"product",className:ue.image}),e.jsxs(r.Column,{className:ue.details,gap:1,children:[e.jsx("h2",{className:ue.name,children:P}),e.jsxs(r.Row,{justifyContent:"space-between",children:[e.jsx("div",{className:ue.price,children:N}),e.jsx("div",{className:ue.volume,children:R})]}),e.jsx("div",{className:ue.description,children:A})]}),(null==L?void 0:L.length)>0&&e.jsxs(r.Column,{className:t.classNames(ue,{variants:!0,focused:"variant"===f}),gap:1,fullWidth:!0,children:[e.jsx("div",{className:ue.variantsTitle,children:I("Product choices")}),L.map((t=>{const{id:a}=t||{},{formattedTotalPrice:n}=te({variantId:a,language:l,currency:s,product:i}),{title:o}=ae(t,l);return e.jsxs(r.Row,{justifyContent:"space-between",onClick:()=>v(a),className:ue.variant,children:[e.jsx(r.Input,{label:o,name:"variant",onChange:()=>v(a),checked:p===a,type:r.InputType.RADIO}),e.jsx("div",{className:ue.variantPrice,children:n})]},a)}))]})]}),e.jsx("div",{className:ue.close,children:e.jsx(r.IconButton,{onClick:o,icon:n.Close})})]}),footer:e.jsxs(r.Column,{children:[e.jsx(je,{productId:null==i?void 0:i.id,onModalClose:o}),e.jsxs(r.Row,{className:ue.addToCart,gap:.5,children:[e.jsx(ve,{isDecreaseDisabled:k,onDecrease:()=>T(-1),onIncrease:()=>T(1),quantity:m}),e.jsx(r.Button,{className:ue.addAction,label:e.jsxs(r.Row,{fullWidth:!0,justifyContent:"space-between",children:[e.jsx("span",{className:ue.actionTitle,children:S}),e.jsx("span",{children:w})]}),onClick:()=>{var e;if((null===(e=null==i?void 0:i.variants)||void 0===e?void 0:e.length)>0&&!p)return x("variant"),void setTimeout((()=>{x(null)}),200);h?c({product:i,quantity:m,variantId:p}):(d({product:i,quantity:m,variantId:p}),t.trackEvent(b,{name:P,quantity:m})),o&&o()},size:"xl",fullWidth:!0})]})]})})})};var Ie="Cart-module_container__3KQtx",Ce="Cart-module_content__rkiZa",Pe={container:"CartStepper-module_container__4CF1L",count:"CartStepper-module_count__E-RBg",actionText:"CartStepper-module_actionText__-rVKA",totalPrice:"CartStepper-module_totalPrice__QboRN",isClickable:"CartStepper-module_isClickable__mDptU",flexWide:"CartStepper-module_flexWide__eXxCr",slidein:"CartStepper-module_slidein__d5JQ-",fadeInOut:"CartStepper-module_fadeInOut__pS8nn",heightAnimation:"CartStepper-module_heightAnimation__7-e5Z",fadein:"CartStepper-module_fadein__-Ba0-",floatAnimation:"CartStepper-module_floatAnimation__rq6zX",bottomSheet:"CartStepper-module_bottomSheet__1wHHD",slideRightToLeft:"CartStepper-module_slideRightToLeft__0KLAo"};const be=({actionText:a,onClick:n})=>{const i=ge(),{formattedTotalPrice:o}=(()=>{const{cart:e}=oe(),{currency:a,language:r}=j(),n=Object.values(e||{}).reduce(((e,t)=>{const{totalPrice:a}=he(t);return e+a}),0);return{totalPrice:n,formattedTotalPrice:t.priceFormatter(n,a,r)}})();return e.jsxs(r.Flex,{className:t.classNames(Pe,{container:!0,isClickable:!!n}),justifyContent:"space-between",alignItems:"center",onClick:n,children:[e.jsx(r.Flex.Item,{flex:1,children:e.jsxs(r.Row,{alignItems:"center",children:[e.jsx("div",{className:Pe.count,children:i}),e.jsx("div",{className:Pe.actionText,children:a})]})}),e.jsx(r.Flex.Item,{className:Pe.totalPrice,flex:1,children:o})]})},Ae=()=>{const{setIsCartOpen:t}=oe(),{t:a}=_e();return ge()<=0?null:e.jsx("div",{className:Ie,children:e.jsx("div",{className:Ce,children:e.jsx(be,{onClick:()=>t(!0),actionText:a("View order")})})})};var Ne={container:"CartDrawer-module_container__zvapw",content:"CartDrawer-module_content__ELSiG",flexWide:"CartDrawer-module_flexWide__ySgY-",slidein:"CartDrawer-module_slidein__XC9AW",fadeInOut:"CartDrawer-module_fadeInOut__w9h6X",heightAnimation:"CartDrawer-module_heightAnimation__tBgkj",fadein:"CartDrawer-module_fadein__QNPoQ",floatAnimation:"CartDrawer-module_floatAnimation__nZWoY",bottomSheet:"CartDrawer-module_bottomSheet__m0wy7",slideRightToLeft:"CartDrawer-module_slideRightToLeft__gpixh"},we="CartItem-module_container__At7lj",ke="CartItem-module_image__D-zzG",Se="CartItem-module_data__Lo3Fb",Te="CartItem-module_name__EksZu",De="CartItem-module_price__yJxl6";const Re=e=>{var t;const{products:a}=j();return(null===(t=null==a?void 0:a.find)||void 0===t?void 0:t.call(a,(({id:t})=>t===e)))||{}},Le=({productId:t,variantId:a,min:r=1,size:n="md"})=>{const i=((e,t)=>{const{cart:a}=oe(),r=a[t?`${e}-${t}`:`${e}`];return(null==r?void 0:r.quantity)||1})(t,a),o=Re(t),{updateProduct:l}=oe(),s=i===r;return e.jsx(ve,{isDecreaseDisabled:s,onDecrease:()=>l({product:o,quantity:i-1,variantId:a}),onIncrease:()=>l({product:o,quantity:i+1,variantId:a}),quantity:i,size:n})},Ee=({item:t})=>{const{productId:n,variantId:i}=t||{},o=Re(n),l=ee(o,i),{language:s,currency:d}=j(),{image160:c}=o,{title:m}=ae(l,s),{name:_}=a.useMemo((()=>Z(o,s)),[o,s]),{formattedTotalPrice:h}=a.useMemo((()=>he(t,d,s)),[t,d,s]);return e.jsxs(r.Row,{className:we,gap:1,alignItems:"center",children:[c&&e.jsx(z,{src:u(c),alt:_||"menu",className:ke,loading:"lazy",width:80,height:45}),e.jsxs("div",{className:Se,children:[e.jsx("div",{className:Te,children:_}),!!m&&e.jsx(r.Text,{color:"muted",variant:"small",children:m}),e.jsx("div",{className:De,children:h})]}),e.jsx(Le,{productId:n,variantId:i,size:"sm",min:0})]})},Oe=()=>{const{isCartOpen:n,cart:i,setIsCartOpen:o}=oe(),l=a.useRef(null),{t:s}=_e(),d=t.isEmpty(i),c=()=>o(!1);return n?e.jsx("div",{className:Ne.container,onClick:e=>{var t,a;(null===(a=null===(t=null==l?void 0:l.current)||void 0===t?void 0:t.contains)||void 0===a?void 0:a.call(t,null==e?void 0:e.target))||c()},children:e.jsx(r.Drawer,{ref:l,onClose:c,isOpen:n,title:s("Your order"),content:e.jsx("div",{className:Ne.content,children:d?e.jsx((()=>e.jsxs(r.Column,{className:Ne.noItems,fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",gap:0,children:[e.jsx(r.Text,{variant:"h2",children:s("Empty order")}),e.jsx(r.Description,{text:s("You don't have any items in your order")})]})),{}):e.jsx("div",{className:Ne.items,children:Object.keys(i||{}).map((t=>e.jsx(Ee,{item:i[t]},t)))})}),footer:d?e.jsx(r.Button,{label:s("Add items"),onClick:c,type:r.UIElementType.PRIMARY,size:"xl",fullWidth:!0}):e.jsx(be,{actionText:s("Subtotal")})})}):null},Ge=a.memo((({categoryProductMap:i=[],currency:o,language:l,productBlocksRef:s,containerRef:d,onCategoryInView:c})=>{const[u,m]=a.useState(null),[_,h]=a.useState(re.LIST),g=[{icon:n.List,type:re.LIST},{icon:n.Grid,type:re.GRID}],p=e=>{const{name:a}=Z(e,l);t.trackEvent(P,{name:a}),m(e)};return a.useEffect((()=>{const e=new IntersectionObserver((e=>{var t;const a=((null===(t=null==d?void 0:d.current)||void 0===t?void 0:t.clientHeight)||1e3)/2;let r=null,n=1/0;e.forEach((e=>{if(e.isIntersecting){const t=e.boundingClientRect,i=t.top+t.height/2,o=Math.abs(i-a);o<n&&(n=o,r=e.target.getAttribute("data-category-id"))}})),r&&c(Number(r))}),{threshold:.1});return Object.entries(s.current||{}).forEach((([t,a])=>{a&&(a.setAttribute("data-category-id",t),e.observe(a))})),()=>{e.disconnect()}}),[s,d]),e.jsx(ie,{children:e.jsxs("div",{className:F,children:[e.jsx(r.Row,{className:V,alignItems:"center",children:g.map((({icon:a,type:n})=>e.jsx(r.IconButton,{icon:a,onClick:()=>(e=>{h(e),t.trackEvent(A,{name:e})})(n),type:n===_?r.UIElementType.PRIMARY:r.UIElementType.DEFAULT},n)))}),e.jsx(r.Column,{children:(i||[]).map((t=>{const{name:a}=w(t,l),{id:n,products:i}=t;return e.jsxs("div",{className:$,ref:e=>{e&&(s.current[n]=e)},"data-category-id":n,children:[e.jsx("h2",{className:Y,children:a}),e.jsx("div",{className:K,children:e.jsx(r.Column,{gap:0,children:(i||[]).map((t=>_===re.GRID?e.jsx(ce,{product:t,currency:o,language:l,onClick:()=>p(t)},t.id):e.jsx(se,{product:t,currency:o,language:l,onClick:()=>p(t)},t.id)))})})]},n)}))}),e.jsx(ye,{product:u,onClose:()=>m(null)}),e.jsx(Ae,{}),e.jsx(Oe,{})]})})}),((e,t)=>e.categoryProductMap===t.categoryProductMap&&e.currency===t.currency&&e.language===t.language));Ge.displayName="Products";var qe="Branches-module_branches__sOuoV",We="Branches-module_list__vYoT2",Me="Branches-module_name__K0Z-4";const ze=({branches:t=[],rootPath:a="",onBranchSelect:n})=>{const i=({children:t,id:r})=>n?e.jsx("div",{onClick:()=>n(r),children:t}):e.jsx("a",{href:`${a}/${r}`,children:t});return e.jsx("div",{className:qe,children:e.jsx(r.Container,{className:We,children:t.map((({id:t,name:a})=>e.jsx(i,{id:t,children:e.jsx(r.Card,{noBottomMargin:!0,children:e.jsx(r.Flex,{justifyContent:"center",alignItems:"center",fullHeight:!0,children:e.jsx("h2",{className:Me,children:a})})})},t)))})})},Be=({data:r})=>{var n;const{name:i,coverImage:s,logoImage:c,branches:u=[],branchId:h,language:g,categories:f,products:x,currency:j,instagram:y,facebook:I,whatsapp:P,telegram:b,tiktok:A,rootPath:N,hostname:k,onBranchSelect:S}=r||{},T=u.length<=1,D=((e,t)=>{const a=t.reduce(((e,t)=>{const a=Number(t.categoryId);return e[a]||(e[a]=[]),e[a].push(t),e}),{});return e.map((e=>Object.assign(Object.assign({},e),{products:a[Number(e.id)]||[]}))).filter((e=>{var t;return(null===(t=null==e?void 0:e.products)||void 0===t?void 0:t.length)>0}))})(f,x),R=(()=>{var e;return T?(null===(e=null==u?void 0:u[0])||void 0===e?void 0:e.id)?u[0]:{}:u.find((e=>e.id===Number(h)))})(),L=T||!(null==R?void 0:R.name)?i:(null==R?void 0:R.name)||"",[E,O]=a.useState(null===(n=null==f?void 0:f[0])||void 0===n?void 0:n.id),G=a.useRef({}),q=a.useRef(null),W=a.useRef(!0),{url:M,domain:z}=((e,t)=>{const a=v.includes(e)?e:p;return{url:`https://${a}/${t||"en"}`,domain:a}})(k,g);return e.jsxs("div",{className:l,ref:q,children:[e.jsx(U,{branch:R,name:L,coverImage:_(s),logoImage:m(c),instagram:y,facebook:I,whatsapp:P,telegram:b,tiktok:A}),T||h?e.jsxs(e.Fragment,{children:[e.jsx(H,{categoryProductMap:D,language:g,selectedCategoryId:E,onSelectCategory:e=>o(void 0,void 0,void 0,(function*(){W.current=!1,O(e),(e=>{var t;const a=null===(t=null==G?void 0:G.current)||void 0===t?void 0:t[e];a&&(setTimeout((()=>{a.scrollIntoView({behavior:"smooth",block:"start"})}),100),setTimeout((()=>{W.current=!0}),1e3))})(e)}))}),e.jsx(Ge,{currency:j,language:g,productBlocksRef:G,containerRef:q,categoryProductMap:D,onCategoryInView:e=>{if(!(null==W?void 0:W.current))return;const a=((e,a,r)=>{var n;const i=null===(n=null==a?void 0:a.find)||void 0===n?void 0:n.call(a,(({id:t})=>t===e));if(t.isEmpty(i))return"";const{name:o}=w(i,r);return o})(e,f,g);t.trackEvent(C,{name:a}),O(e)}})]}):e.jsx(ze,{branches:u,onBranchSelect:S,rootPath:N}),!!k&&e.jsx("a",{rel:"noopener noreferrer",target:"_blank",href:M,className:d,children:z})]})};var Qe={};const Ue=({currentGoal:t,language:n,setGoal:i})=>{const{t:o}=_e(n),l=a.useRef({}),s=e=>{switch(e){case C:return o("Scrolled to Category");case I:return o("Category Selected");case P:return o("Product Details");case b:return o("Product Added to Cart");default:return""}},d=a.useCallback((e=>{var t,a;i(e),null===(a=null===(t=null==l?void 0:l.current)||void 0===t?void 0:t.close)||void 0===a||a.call(t)}),[i]);return e.jsx(r.DropDown,{action:s(t),actionSize:"large",type:r.UIElementType.BORDERED_PRIMARY,closeRef:l,menu:e.jsx("div",{className:Qe.toolbarMenu,children:N.map((t=>e.jsx(r.DropDownMenuItem,{onClick:()=>d(t),children:s(t)},t)))})})};exports.Events=({data:t,isLoading:a=!1,loadingImage:n,language:i,goal:o,setGoal:l})=>{const{t:s}=_e(i);return e.jsx(r.Card,{title:s("Events"),toolbar:e.jsx(Ue,{language:i,currentGoal:o,setGoal:l}),children:a?e.jsx(r.Loading,{image:n}):e.jsx(r.BarChart,{data:t})})},exports.PublicMenu=({data:t})=>e.jsx(x,{value:t,children:e.jsx(Be,{data:t})});
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("@sorocraft/js-utils"),a=require("react"),r=require("@sorocraft/ui"),n=require("@sorocraft/ui/icons");function i(e,t){var a={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(a[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(a[r[n]]=e[r[n]])}return a}function o(e,t,a,r){return new(a||(a=Promise))((function(n,i){function o(e){try{s(r.next(e))}catch(e){i(e)}}function l(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(o,l)}s((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var l="PublicMenu-module_container__QLN6U",s="PublicMenu-module_categories__Iy6NC",d="PublicMenu-module_footer__6G3DQ";const c="https://images.restaround.co",u=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${c}/${e}`:"",m=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${c}/${e}`:"https://images.restaround.co/no-photo-128.webp",_=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${c}/${e}`:"https://images.restaround.co/restaround-doodle.webp",h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=(e,t,a)=>h.charAt(e>>2)+h.charAt((3&e)<<4|t>>4)+h.charAt((15&t)<<2|a>>6)+h.charAt(63&a),p="restaround.co",v=[p,"restaround.az","restaround.ee","restaround.nl"],f=a.createContext({}),x=({children:a,value:r})=>{const n=t.isEmpty(r)?{}:r;return n.currency||(n.currency="AZN"),n.language||(n.language="az"),e.jsx(f.Provider,{value:t.isEmpty(r)?{}:r,children:a})},j=()=>a.useContext(f),y="digital_menu",I=`${y}_category_select`,C=`${y}_category_scroll`,P=`${y}_product_details`,b=`${y}_product_add_cart`,A=`${y}_product_view_changed`,N=[I,C,P,b],w=(e,t)=>{var a,r;return(null===(r=null===(a=null==e?void 0:e.translations)||void 0===a?void 0:a.find)||void 0===r?void 0:r.call(a,(e=>e.language===t)))||{}};var k="Header-module_container__tenlF",S="Header-module_cover__BAWZK",T="Header-module_content__Gx4Al",D="Header-module_logo__4MTCm",R="Header-module_info__IchYA",L="Header-module_name__30wyw",E="Header-module_address__WOxXc",O="Header-module_addressText__lUszI",G="Header-module_social__AoP0z",q="Header-module_links__EeQxg",W="Header-module_wifiPassword__VWBTa",M="Header-module_wifiPasswordIcon__Ukn3D";const z=t=>{const a=i(t,["priority","blurDataURL","quality","placeholder","fetchPriority"]),{imageTag:r}=j()||{};if(r){const a=r;return e.jsx(a,Object.assign({},t,{quality:t.quality||100,placeholder:"blur",blurDataURL:(n=235,o=59,l=90,`data:image/gif;base64,R0lGODlhAQABAPAA${g(0,n,o)+g(l,255,255)}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`)}))}var n,o,l;return e.jsx("img",Object.assign({},a))};var B={container:"Languages-module_container__nJeK1",currentLanguage:"Languages-module_currentLanguage__EFw6Q",options:"Languages-module_options__6jLRm",option:"Languages-module_option__QkVQd",isOpen:"Languages-module_isOpen__eUGbg",flexWide:"Languages-module_flexWide__zQ9jN",slidein:"Languages-module_slidein__C4UHU",fadeInOut:"Languages-module_fadeInOut__U-vhH",heightAnimation:"Languages-module_heightAnimation__gIQkF",fadein:"Languages-module_fadein__vPmsX",floatAnimation:"Languages-module_floatAnimation__L-kPH",bottomSheet:"Languages-module_bottomSheet__-t-q8",slideRightToLeft:"Languages-module_slideRightToLeft__y0l-f"};const Q=()=>{var t;const{language:n,languages:i,onLanguageSelect:o}=j(),[l,s]=a.useState(!1),d=(null==i?void 0:i.length)>1,c=(null===(t=null==i?void 0:i.filter)||void 0===t?void 0:t.call(i,(({code:e})=>e!==n)))||[],u=e=>`https://images.restaround.co/languages/${e}.svg`;return d?e.jsx("div",{className:B.container,onClick:()=>s(!l),children:e.jsxs(r.Row,{alignItems:"center",gap:0,children:[e.jsx(r.Row,{alignItems:"center",className:r.classNames(B,{options:!0,isOpen:l}),children:c.map((({code:t})=>e.jsx("img",{src:u(t),className:B.option,onClick:()=>(e=>{o&&o(e)})(t),alt:t},t)))}),e.jsx("img",{src:u(n),alt:n||"",className:B.currentLanguage})]})}):null},U=({branch:a,coverImage:i,logoImage:o,name:l,instagram:s,facebook:d,whatsapp:c,telegram:u,tiktok:m})=>{const{address:_,latitude:h,longitude:g,phone:p,wifiPassword:v}=a||{},f=t.isEmpty(a),x=`https://www.google.com/maps/place/${h},${g}`;return e.jsxs("div",{className:k,children:[e.jsx(z,{src:i,alt:l,className:S,width:1024,height:400,priority:!0,sizes:"100vw",fetchPriority:"high",loading:"eager"}),e.jsx("div",{className:T,children:f?e.jsx((()=>e.jsxs(r.Column,{fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",children:[e.jsx(z,{src:o,alt:l,className:D,width:96,height:96}),e.jsx("div",{className:R,children:e.jsx("h1",{className:L,children:l})})]})),{}):e.jsx((()=>e.jsxs(r.Flex,{direction:"row",gap:1,alignItems:"center",fullWidth:!0,children:[e.jsx(r.Flex.Item,{children:e.jsx(z,{src:o,alt:l,className:D,width:96,height:96})}),e.jsx(r.Flex.Item,{shrink:!0,className:R,children:e.jsxs(r.Column,{gap:.25,children:[e.jsx("h1",{className:L,children:l}),e.jsx("a",{className:E,href:x,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(r.Row,{alignItems:"center",gap:.5,children:[e.jsx(r.SVGIcon,{icon:n.MarkerPin,theme:"dark"}),e.jsx("span",{className:O,children:_})]})})]})})]})),{})}),e.jsx(Q,{}),!f&&e.jsx("div",{className:G,children:e.jsx("div",{className:q,children:e.jsx(r.Row,{gap:2,alignItems:"center",children:e.jsxs(r.Row,{alignItems:"center",justifyContent:"center",gap:.5,children:[!!p&&e.jsx(r.IconLink,{icon:n.Phone,href:`tel:+${p}`,size:"sm",shape:"circle",theme:"light"}),!!c&&e.jsx(r.IconLink,{icon:n.Whatsapp,href:`https://wa.me/${c}`,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!s&&e.jsx(r.IconLink,{icon:n.Instagram,href:s,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!u&&e.jsx(r.IconLink,{icon:n.Telegram,href:u,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!m&&e.jsx(r.IconLink,{icon:n.Tiktok,href:m,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!d&&e.jsx(r.IconLink,{icon:n.Facebook,href:d,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!v&&e.jsx(r.Tooltip,{hint:v,children:e.jsx("div",{className:W,children:e.jsx(r.SVGIcon,{icon:n.Wifi,size:"sm",className:M})})})]})})})})]})},H=({categoryProductMap:n=[],language:i,selectedCategoryId:o,onSelectCategory:l})=>{const d=a.useRef({}),c=a.useRef(null);return a.useEffect((()=>{o&&(()=>{var e;const t=null===(e=null==d?void 0:d.current)||void 0===e?void 0:e[o];if(!t||!c.current)return;const a=c.current.clientWidth,r=t.offsetLeft-a/2+t.offsetWidth/2;c.current.scrollTo({left:r,behavior:"smooth"})})()}),[o]),e.jsx("div",{className:s,children:e.jsx(r.Carousel,{gap:1,onGetRef:e=>{(null==e?void 0:e.current)&&(c.current=e.current)},children:(n||[]).map((({id:a,translations:n})=>{const{name:s}=n.find((e=>e.language===i))||{};return e.jsx(r.CarouselItem,{children:e.jsx(r.Chip,{onClick:()=>((e,a)=>{e!==o&&(t.trackEvent(I,{name:a}),l(e))})(a,s),type:r.UIElementType.BORDERED_PRIMARY,active:a===o,children:e.jsx("div",{ref:e=>{e&&(d.current[a]=e)},children:s})})},a)}))})})};var F="Products-module_container__bF2LF",V="Products-module_view__l857X",$="Products-module_products__AoDrY",Y="Products-module_category__Sp7dE",K="Products-module_list__LH4v5";const X=(e,t,a=0)=>e*t*(1+a/100),Z=(e,t)=>{var a,r;return(null===(r=null===(a=null==e?void 0:e.translations)||void 0===a?void 0:a.find)||void 0===r?void 0:r.call(a,(e=>e.language===t)))||{}},J=(e,a,r,n=1)=>{const{price:i,vat:o}=e||{},l=X(i,n,o);return{totalPrice:l,formattedTotalPrice:t.priceFormatter(l,a,r)}},ee=(e,t)=>{var a,r;return(null===(r=null===(a=null==e?void 0:e.variants)||void 0===a?void 0:a.find)||void 0===r?void 0:r.call(a,(e=>e.id===t)))||{}},te=({variantId:e,currency:a="USD",language:r="en",product:n,quantity:i=1})=>{const o=ee(n,e),{vat:l}=n||{},{price:s}=o||{},d=X(s,i,l);return{totalPrice:d,formattedTotalPrice:t.priceFormatter(d,a,r)}},ae=(e,t)=>{var a,r;return(null===(r=null===(a=null==e?void 0:e.translations)||void 0===a?void 0:a.find)||void 0===r?void 0:r.call(a,(e=>e.language===t)))||{}};var re;!function(e){e.LIST="list",e.GRID="grid"}(re||(re={}));const ne=a.createContext({cart:{},isCartOpen:!1,addProduct:()=>{},updateProduct:()=>{},setIsCartOpen:()=>{},removeAllProductVariants:()=>{}}),ie=({children:r})=>{const[n,o]=a.useState({}),[l,s]=a.useState(!1),d=({product:e,quantity:a,isAddOperation:r,variantId:n})=>{var l;if(t.isEmpty(e)||a<0)return;const{id:s,price:d,vat:c=0}=e,u=n?`${s}-${n}`:`${s}`,m=n?null===(l=ee(e,n))||void 0===l?void 0:l.price:d;o((e=>{const t=e[u],o=r?((null==t?void 0:t.quantity)||0)+a:a;if(o<=0){const t=e,a=u;t[a];return i(t,["symbol"==typeof a?a:a+""])}return Object.assign(Object.assign({},e),{[u]:{productId:s,price:m,quantity:o,vat:c,variantId:n}})}))},c=({product:e,quantity:t=1,variantId:a})=>d({product:e,quantity:t,variantId:a,isAddOperation:!0}),u=({product:e,quantity:t=1,variantId:a})=>d({product:e,quantity:t,variantId:a,isAddOperation:!1}),m=e=>{if(!e||t.isEmpty(n))return;const a=Object.entries(n).reduce(((t,[a,r])=>(r.productId!==e&&(t[a]=r),t)),{});o(a)},_=a.useMemo((()=>({cart:n,isCartOpen:l,addProduct:c,updateProduct:u,setIsCartOpen:s,removeAllProductVariants:m})),[n,l]);return e.jsx(ne.Provider,{value:_,children:r})},oe=()=>a.useContext(ne);var le={container:"ProductsListItem-module_container__i9tFs",isClickable:"ProductsListItem-module_isClickable__iHHdI",data:"ProductsListItem-module_data__Mb3SF",name:"ProductsListItem-module_name__T1gyJ",description:"ProductsListItem-module_description__oL4CH",price:"ProductsListItem-module_price__V1GRM",image:"ProductsListItem-module_image__h6Wbi",addToCart:"ProductsListItem-module_addToCart__WXrQZ",flexWide:"ProductsListItem-module_flexWide__Ds6LE",slidein:"ProductsListItem-module_slidein__rEzMI",fadeInOut:"ProductsListItem-module_fadeInOut__i1FNq",heightAnimation:"ProductsListItem-module_heightAnimation__2fk7l",fadein:"ProductsListItem-module_fadein__tPTJ6",floatAnimation:"ProductsListItem-module_floatAnimation__vugAV",bottomSheet:"ProductsListItem-module_bottomSheet__-YAdd",slideRightToLeft:"ProductsListItem-module_slideRightToLeft__oXk26"};const se=({product:i,currency:o,language:l,onClick:s})=>{var d;const{addProduct:c}=oe(),{image160:m,volume:_}=i||{},{name:h,description:g}=a.useMemo((()=>Z(i,l)),[i,l]),{formattedTotalPrice:p}=a.useMemo((()=>J(i,o,l)),[i,o,l]),v=(null===(d=null==i?void 0:i.variants)||void 0===d?void 0:d.length)>0;return e.jsxs("div",{className:t.classNames(le,{container:!0,isClickable:!!s}),onClick:s,children:[e.jsxs(r.Row,{justifyContent:"space-between",gap:0,children:[e.jsx("div",{className:le.data,children:e.jsxs(r.Column,{gap:.25,children:[e.jsx("h3",{className:le.name,children:h}),e.jsx("p",{className:le.description,children:g}),e.jsxs(r.Row,{className:le.price,gap:.5,fullWidth:!0,justifyContent:"space-between",children:[e.jsx("span",{children:p}),!!_&&e.jsx(r.Text,{color:"muted",children:_})]})]})}),m&&e.jsx(z,{src:u(m),alt:h||"menu",className:le.image,loading:"lazy",width:160,height:90})]}),e.jsx("div",{className:le.addToCart,children:e.jsx(r.IconButton,{onClick:e=>{if(e.preventDefault(),e.stopPropagation(),v&&s)return s();c({product:i}),t.trackEvent(b,{name:h,quantity:1})},icon:n.Plus,type:r.UIElementType.DEFAULT})})]})};var de={container:"ProductsGridItem-module_container__DU5KG",content:"ProductsGridItem-module_content__FXs0Y",isClickable:"ProductsGridItem-module_isClickable__8zhwt",info:"ProductsGridItem-module_info__HkBG-",data:"ProductsGridItem-module_data__Z-N1X",name:"ProductsGridItem-module_name__ZrIx3",description:"ProductsGridItem-module_description__-FQPA",price:"ProductsGridItem-module_price__BFu2H",imageContainer:"ProductsGridItem-module_imageContainer__eHS4Z",image:"ProductsGridItem-module_image__alZWL",addToCart:"ProductsGridItem-module_addToCart__gYVrI",noImage:"ProductsGridItem-module_noImage__78UHW",volume:"ProductsGridItem-module_volume__oxEAr",flexWide:"ProductsGridItem-module_flexWide__qcB5X",slidein:"ProductsGridItem-module_slidein__oKaVb",fadeInOut:"ProductsGridItem-module_fadeInOut__d2zot",heightAnimation:"ProductsGridItem-module_heightAnimation__zgbh9",fadein:"ProductsGridItem-module_fadein__Z067K",floatAnimation:"ProductsGridItem-module_floatAnimation__GXjP-",bottomSheet:"ProductsGridItem-module_bottomSheet__-zrFD",slideRightToLeft:"ProductsGridItem-module_slideRightToLeft__R7hv5"};const ce=({product:i,currency:o,language:l,onClick:s})=>{var d;const{addProduct:c}=oe(),{volume:m,image580:_,image160:h,image1024:g}=i||{},p=_||g||h,{name:v,description:f}=a.useMemo((()=>Z(i,l)),[i,l]),{formattedTotalPrice:x}=a.useMemo((()=>J(i,o,l)),[i,o,l]),j=(null===(d=null==i?void 0:i.variants)||void 0===d?void 0:d.length)>0;return e.jsx("div",{className:de.container,children:e.jsxs("div",{className:t.classNames(de,{content:!0,isClickable:!!s,noImage:!p}),onClick:s,children:[p&&e.jsx("div",{className:de.imageContainer,children:e.jsx(z,{src:u(p),alt:v||"menu",className:de.image,loading:"lazy",width:580,height:326})}),e.jsx("div",{className:de.info,children:e.jsx("div",{className:de.data,children:e.jsxs(r.Column,{gap:.25,children:[e.jsx("h3",{className:de.name,children:v}),e.jsx("p",{className:de.description,children:f}),e.jsxs(r.Row,{className:de.price,gap:.5,fullWidth:!0,justifyContent:"space-between",children:[e.jsx("span",{children:x}),!!m&&e.jsx(r.Text,{color:"white",className:de.volume,children:m})]})]})})}),e.jsx("div",{className:de.addToCart,children:e.jsx(r.IconButton,{onClick:e=>{if(e.preventDefault(),e.stopPropagation(),j&&s)return s();c({product:i}),t.trackEvent(b,{name:v,quantity:1})},icon:n.Plus,type:r.UIElementType.DEFAULT})})]})})};var ue={container:"ProductDetails-module_container__oa07j",content:"ProductDetails-module_content__Db3NC",image:"ProductDetails-module_image__BlMfl",details:"ProductDetails-module_details__zfnlt",name:"ProductDetails-module_name__ganLM",price:"ProductDetails-module_price__W34k9",volume:"ProductDetails-module_volume__RWG5s",description:"ProductDetails-module_description__HBufi",variants:"ProductDetails-module_variants__zOWjJ",focused:"ProductDetails-module_focused__Nsffd",variantsTitle:"ProductDetails-module_variantsTitle__ta-cw",variant:"ProductDetails-module_variant__vQ5yD",close:"ProductDetails-module_close__4cHZ3",addAction:"ProductDetails-module_addAction__o4T5R",actionTitle:"ProductDetails-module_actionTitle__NIJGW",flexWide:"ProductDetails-module_flexWide__w06FX",slidein:"ProductDetails-module_slidein__N8f4g",fadeInOut:"ProductDetails-module_fadeInOut__hYRtK",heightAnimation:"ProductDetails-module_heightAnimation__hLQyz",fadein:"ProductDetails-module_fadein__QN4mI",floatAnimation:"ProductDetails-module_floatAnimation__dTQbc",bottomSheet:"ProductDetails-module_bottomSheet__HO2S-",slideRightToLeft:"ProductDetails-module_slideRightToLeft__hbtJg"};const me={en:{},az:{"View order":"Şifarişi göstər","Remove from order":"Sifarişdən sil","Update order":"Sifarişi yenilə","Add to order":"Sifarişə əlavə et","Your order":"Sifarişiniz",Subtotal:"Ümumi","Empty order":"Boş sifariş","You don't have any items in your order":"Sifarişinizdə heç bir məhsul yoxdur","Add items":"Məhsul əlavə et",Events:"Hərəkətlər","Scrolled to Category":"Kateqoriyaya sürüşdürdü","Category Selected":"Kateqoriya seçildi","Product Details":"Məhsul detalına baxıldı","Product Added to Cart":"Səbətə əlavə edildi","Product choices":"Seçimlər","In order":"Sifarişdə"},tr:{"View order":"Siparişi Görüntüle","Remove from order":"Siparişten Kaldır","Update order":"Siparişi Güncelle","Add to order":"Siparişe Ekle","Your order":"Siparişiniz","Empty order":"Boş sipariş","You don't have any items in your order":"Siparişinizde hiç bir ürün yok","Add items":"Ürün ekle",Subtotal:"Toplam",Events:"Olaylar","Product choices":"Seçenekler","In order":"Siparişte"},nl:{"View order":"Bestelling bekijken","Remove from order":"Uit bestelling verwijderen","Update order":"Bestelling bijwerken","Add to order":"Aan bestelling toevoegen","Your order":"Uw bestelling","Empty order":"Lege bestelling","You don't have any items in your order":"U heeft geen items in uw bestelling","Add items":"Items toevoegen",Subtotal:"Totaal",Events:"Gebeurtenissen","Product choices":"Productkeuzes","In order":"In bestelling"},et:{"View order":"Vaata tellimust","Remove from order":"Eemalda tellimusest","Update order":"Uuenda tellimust","Add to order":"Lisa tellimusele","Your order":"Teie tellimus","Empty order":"Tühi tellimus","You don't have any items in your order":"Teie tellimuses pole ühtegi eset","Add items":"Lisa esemeid",Subtotal:"Kokku",Events:"Sündmused","Product choices":"Tootevalikud","In order":"Tellimuses"},ru:{"View order":"Посмотреть заказ","Remove from order":"Удалить из заказа","Update order":"Обновить заказ","Add to order":"Добавить в заказ","Your order":"Ваш заказ","Empty order":"Пустой заказ","You don't have any items in your order":"В вашем заказе нет товаров","Add items":"Добавить товары",Subtotal:"Итого",Events:"События","Product choices":"Варианты товара","In order":"В заказе"}},_e=e=>{const{language:t}=j(),a=e||t;return{t:e=>{var t;return(null===(t=me[a])||void 0===t?void 0:t[e])||e}}},he=(e,a="USD",r="en")=>{const{price:n,vat:i,quantity:o}=e||{},l=X(n,o,i);return{totalPrice:l,formattedTotalPrice:t.priceFormatter(l,a,r)}},ge=()=>{const{cart:e}=oe();return Object.values(e||{}).reduce(((e,t)=>e+t.quantity),0)};var pe={container:"Quantity-module_container__01ySb",quantityAction:"Quantity-module_quantityAction__wRV2F",quantityValue:"Quantity-module_quantityValue__BBpyw",isDisabled:"Quantity-module_isDisabled__crQCf",sm:"Quantity-module_sm__0Hgp2",md:"Quantity-module_md__hu7a8",lg:"Quantity-module_lg__GA4jn",flexWide:"Quantity-module_flexWide__R95Jw",slidein:"Quantity-module_slidein__5yeWf",fadeInOut:"Quantity-module_fadeInOut__cllco",heightAnimation:"Quantity-module_heightAnimation__dhOgA",fadein:"Quantity-module_fadein__Cof2o",floatAnimation:"Quantity-module_floatAnimation__DSqQr",bottomSheet:"Quantity-module_bottomSheet__5-5iY",slideRightToLeft:"Quantity-module_slideRightToLeft__cjDHk"};const ve=({isDecreaseDisabled:a=!1,quantity:i=1,size:o="md",onIncrease:l,onDecrease:s})=>e.jsxs(r.Row,{className:t.classNames(pe,{container:!0},[pe[o]]),justifyContent:"space-between",gap:0,children:[e.jsx("div",{className:t.classNames(pe,{quantityAction:!0,isDisabled:a}),onClick:s,children:e.jsx(r.SVGIcon,{icon:n.Minus})}),e.jsx("div",{className:pe.quantityValue,children:i}),e.jsx("div",{className:pe.quantityAction,onClick:l,children:e.jsx(r.SVGIcon,{icon:n.Plus})})]});var fe="ProductInCart-module_container__oSrwq",xe="ProductInCart-module_title__Vnc4l";const je=({productId:a,onModalClose:i})=>{const{setIsCartOpen:o,removeAllProductVariants:l}=oe(),{t:s}=_e(),d=(e=>{const{cart:a}=oe();return t.isEmpty(a)||!e?0:Object.values(a).filter((t=>t.productId===e)).reduce(((e,t)=>e+t.quantity),0)})(a);return d<=0?null:e.jsxs(r.Flex,{className:fe,fullWidth:!0,justifyContent:"space-between",alignItems:"center",children:[e.jsxs(r.Flex.Item,{flex:1,className:xe,children:[s("In order")," (",d,")"]}),e.jsx(r.Flex.Item,{flex:0,children:e.jsxs(r.Row,{children:[e.jsx(r.IconButton,{icon:n.Trash,onClick:()=>{l(a)},type:r.UIElementType.DANGER,tooltip:s("Remove from order")}),e.jsx(r.IconButton,{icon:n.ShoppingBag,onClick:()=>{o(!0),i&&i()},type:r.UIElementType.SUCCESS,tooltip:s("View order")})]})})]})},ye=({product:i,onClose:o})=>{const{language:l,currency:s}=j(),{addProduct:d,updateProduct:c}=oe(),[m,_]=a.useState(1),[h,g]=a.useState(!1),[p,v]=a.useState(null),[f,x]=a.useState(null),y=a.useRef(null),{t:I}=_e(),C=((e,a)=>{var r;const{cart:n}=oe();return t.isEmpty(n)||!e?0:(null===(r=n[a?`${e}-${a}`:`${e}`])||void 0===r?void 0:r.quantity)||0})(null==i?void 0:i.id,p),{name:P,description:A}=a.useMemo((()=>Z(i,l)),[i,l]),{formattedTotalPrice:N}=a.useMemo((()=>J(i,s,l)),[i,s,l]),{formattedTotalPrice:w}=a.useMemo((()=>(({product:e,variantId:t,quantity:a=1,currency:r,language:n})=>t?te({variantId:t,currency:r,language:n,product:e,quantity:a}):J(e,r,n,a))({product:i,quantity:m,language:l,currency:s,variantId:p})),[i,m,l,s,p]),k=h?0===m:1===m,S=a.useMemo((()=>I(h?0===m?"Remove from order":"Update order":"Add to order")),[h,m]);a.useEffect((()=>{_(C>0?C:1),g(C>0)}),[C,i]),a.useEffect((()=>{v(null)}),[i]);const T=e=>{-1===e&&k||_((t=>Math.max(0,t+e)))};if(t.isEmpty(i))return null;const{image1024:D,volume:R,variants:L}=i;return e.jsx("div",{className:ue.container,onClick:e=>{var t,a;(null===(a=null===(t=null==y?void 0:y.current)||void 0===t?void 0:t.contains)||void 0===a?void 0:a.call(t,null==e?void 0:e.target))||o&&o()},children:e.jsx(r.Modal,{onClose:o,ref:y,noBodyPadding:!0,size:"small",content:e.jsxs("div",{className:ue.content,children:[e.jsxs(r.Column,{gap:0,children:[D&&e.jsx(z,{src:u(D),width:1024,height:400,alt:P||"product",className:ue.image}),e.jsxs(r.Column,{className:ue.details,gap:1,children:[e.jsx("h2",{className:ue.name,children:P}),e.jsxs(r.Row,{justifyContent:"space-between",children:[e.jsx("div",{className:ue.price,children:N}),e.jsx("div",{className:ue.volume,children:R})]}),e.jsx("div",{className:ue.description,children:A})]}),(null==L?void 0:L.length)>0&&e.jsxs(r.Column,{className:t.classNames(ue,{variants:!0,focused:"variant"===f}),gap:1,fullWidth:!0,children:[e.jsx("div",{className:ue.variantsTitle,children:I("Product choices")}),L.map((t=>{const{id:a}=t||{},{formattedTotalPrice:n}=te({variantId:a,language:l,currency:s,product:i}),{title:o}=ae(t,l);return e.jsxs(r.Row,{justifyContent:"space-between",onClick:()=>v(a),className:ue.variant,children:[e.jsx(r.Input,{label:o,name:"variant",onChange:()=>v(a),checked:p===a,type:r.InputType.RADIO}),e.jsx("div",{className:ue.variantPrice,children:n})]},a)}))]})]}),e.jsx("div",{className:ue.close,children:e.jsx(r.IconButton,{onClick:o,icon:n.Close})})]}),footer:e.jsxs(r.Column,{children:[e.jsx(je,{productId:null==i?void 0:i.id,onModalClose:o}),e.jsxs(r.Row,{className:ue.addToCart,gap:.5,children:[e.jsx(ve,{isDecreaseDisabled:k,onDecrease:()=>T(-1),onIncrease:()=>T(1),quantity:m}),e.jsx(r.Button,{className:ue.addAction,label:e.jsxs(r.Row,{fullWidth:!0,justifyContent:"space-between",children:[e.jsx("span",{className:ue.actionTitle,children:S}),e.jsx("span",{children:w})]}),onClick:()=>{var e;if((null===(e=null==i?void 0:i.variants)||void 0===e?void 0:e.length)>0&&!p)return x("variant"),void setTimeout((()=>{x(null)}),200);h?c({product:i,quantity:m,variantId:p}):(d({product:i,quantity:m,variantId:p}),t.trackEvent(b,{name:P,quantity:m})),o&&o()},size:"xl",fullWidth:!0})]})]})})})};var Ie="Cart-module_container__3KQtx",Ce="Cart-module_content__rkiZa",Pe={container:"CartStepper-module_container__4CF1L",count:"CartStepper-module_count__E-RBg",actionText:"CartStepper-module_actionText__-rVKA",totalPrice:"CartStepper-module_totalPrice__QboRN",isClickable:"CartStepper-module_isClickable__mDptU",flexWide:"CartStepper-module_flexWide__eXxCr",slidein:"CartStepper-module_slidein__d5JQ-",fadeInOut:"CartStepper-module_fadeInOut__pS8nn",heightAnimation:"CartStepper-module_heightAnimation__7-e5Z",fadein:"CartStepper-module_fadein__-Ba0-",floatAnimation:"CartStepper-module_floatAnimation__rq6zX",bottomSheet:"CartStepper-module_bottomSheet__1wHHD",slideRightToLeft:"CartStepper-module_slideRightToLeft__0KLAo"};const be=({actionText:a,onClick:n})=>{const i=ge(),{formattedTotalPrice:o}=(()=>{const{cart:e}=oe(),{currency:a,language:r}=j(),n=Object.values(e||{}).reduce(((e,t)=>{const{totalPrice:a}=he(t);return e+a}),0);return{totalPrice:n,formattedTotalPrice:t.priceFormatter(n,a,r)}})();return e.jsxs(r.Flex,{className:t.classNames(Pe,{container:!0,isClickable:!!n}),justifyContent:"space-between",alignItems:"center",onClick:n,children:[e.jsx(r.Flex.Item,{flex:1,children:e.jsxs(r.Row,{alignItems:"center",children:[e.jsx("div",{className:Pe.count,children:i}),e.jsx("div",{className:Pe.actionText,children:a})]})}),e.jsx(r.Flex.Item,{className:Pe.totalPrice,flex:1,children:o})]})},Ae=()=>{const{setIsCartOpen:t}=oe(),{t:a}=_e();return ge()<=0?null:e.jsx("div",{className:Ie,children:e.jsx("div",{className:Ce,children:e.jsx(be,{onClick:()=>t(!0),actionText:a("View order")})})})};var Ne={container:"CartDrawer-module_container__zvapw",content:"CartDrawer-module_content__ELSiG",flexWide:"CartDrawer-module_flexWide__ySgY-",slidein:"CartDrawer-module_slidein__XC9AW",fadeInOut:"CartDrawer-module_fadeInOut__w9h6X",heightAnimation:"CartDrawer-module_heightAnimation__tBgkj",fadein:"CartDrawer-module_fadein__QNPoQ",floatAnimation:"CartDrawer-module_floatAnimation__nZWoY",bottomSheet:"CartDrawer-module_bottomSheet__m0wy7",slideRightToLeft:"CartDrawer-module_slideRightToLeft__gpixh"},we="CartItem-module_container__At7lj",ke="CartItem-module_image__D-zzG",Se="CartItem-module_data__Lo3Fb",Te="CartItem-module_name__EksZu",De="CartItem-module_price__yJxl6";const Re=e=>{var t;const{products:a}=j();return(null===(t=null==a?void 0:a.find)||void 0===t?void 0:t.call(a,(({id:t})=>t===e)))||{}},Le=({productId:t,variantId:a,min:r=1,size:n="md"})=>{const i=((e,t)=>{const{cart:a}=oe(),r=a[t?`${e}-${t}`:`${e}`];return(null==r?void 0:r.quantity)||1})(t,a),o=Re(t),{updateProduct:l}=oe(),s=i===r;return e.jsx(ve,{isDecreaseDisabled:s,onDecrease:()=>l({product:o,quantity:i-1,variantId:a}),onIncrease:()=>l({product:o,quantity:i+1,variantId:a}),quantity:i,size:n})},Ee=({item:t})=>{const{productId:n,variantId:i}=t||{},o=Re(n),l=ee(o,i),{language:s,currency:d}=j(),{image160:c}=o,{title:m}=ae(l,s),{name:_}=a.useMemo((()=>Z(o,s)),[o,s]),{formattedTotalPrice:h}=a.useMemo((()=>he(t,d,s)),[t,d,s]);return e.jsxs(r.Row,{className:we,gap:1,alignItems:"center",children:[c&&e.jsx(z,{src:u(c),alt:_||"menu",className:ke,loading:"lazy",width:80,height:45}),e.jsxs("div",{className:Se,children:[e.jsx("div",{className:Te,children:_}),!!m&&e.jsx(r.Text,{color:"muted",variant:"small",children:m}),e.jsx("div",{className:De,children:h})]}),e.jsx(Le,{productId:n,variantId:i,size:"sm",min:0})]})},Oe=()=>{const{isCartOpen:n,cart:i,setIsCartOpen:o}=oe(),l=a.useRef(null),{t:s}=_e(),d=t.isEmpty(i),c=()=>o(!1);return n?e.jsx("div",{className:Ne.container,onClick:e=>{var t,a;(null===(a=null===(t=null==l?void 0:l.current)||void 0===t?void 0:t.contains)||void 0===a?void 0:a.call(t,null==e?void 0:e.target))||c()},children:e.jsx(r.Drawer,{ref:l,onClose:c,isOpen:n,title:s("Your order"),content:e.jsx("div",{className:Ne.content,children:d?e.jsx((()=>e.jsxs(r.Column,{className:Ne.noItems,fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",gap:0,children:[e.jsx(r.Text,{variant:"h2",children:s("Empty order")}),e.jsx(r.Description,{text:s("You don't have any items in your order")})]})),{}):e.jsx("div",{className:Ne.items,children:Object.keys(i||{}).map((t=>e.jsx(Ee,{item:i[t]},t)))})}),footer:d?e.jsx(r.Button,{label:s("Add items"),onClick:c,type:r.UIElementType.PRIMARY,size:"xl",fullWidth:!0}):e.jsx(be,{actionText:s("Subtotal")})})}):null},Ge=a.memo((({categoryProductMap:i=[],currency:o,language:l,productBlocksRef:s,containerRef:d,onCategoryInView:c})=>{const[u,m]=a.useState(null),[_,h]=a.useState(re.LIST),g=[{icon:n.List,type:re.LIST},{icon:n.Grid,type:re.GRID}],p=e=>{const{name:a}=Z(e,l);t.trackEvent(P,{name:a}),m(e)};return a.useEffect((()=>{const e=new IntersectionObserver((e=>{var t;const a=((null===(t=null==d?void 0:d.current)||void 0===t?void 0:t.clientHeight)||1e3)/2;let r=null,n=1/0;e.forEach((e=>{if(e.isIntersecting){const t=e.boundingClientRect,i=t.top+t.height/2,o=Math.abs(i-a);o<n&&(n=o,r=e.target.getAttribute("data-category-id"))}})),r&&c(Number(r))}),{threshold:.1});return Object.entries(s.current||{}).forEach((([t,a])=>{a&&(a.setAttribute("data-category-id",t),e.observe(a))})),()=>{e.disconnect()}}),[s,d]),e.jsx(ie,{children:e.jsxs("div",{className:F,children:[e.jsx(r.Row,{className:V,alignItems:"center",children:g.map((({icon:a,type:n})=>e.jsx(r.IconButton,{icon:a,onClick:()=>(e=>{h(e),t.trackEvent(A,{name:e})})(n),type:n===_?r.UIElementType.PRIMARY:r.UIElementType.DEFAULT},n)))}),e.jsx(r.Column,{children:(i||[]).map((t=>{const{name:a}=w(t,l),{id:n,products:i}=t;return e.jsxs("div",{className:$,ref:e=>{e&&(s.current[n]=e)},"data-category-id":n,children:[e.jsx("h2",{className:Y,children:a}),e.jsx("div",{className:K,children:e.jsx(r.Column,{gap:0,children:(i||[]).map((t=>_===re.GRID?e.jsx(ce,{product:t,currency:o,language:l,onClick:()=>p(t)},t.id):e.jsx(se,{product:t,currency:o,language:l,onClick:()=>p(t)},t.id)))})})]},n)}))}),e.jsx(ye,{product:u,onClose:()=>m(null)}),e.jsx(Ae,{}),e.jsx(Oe,{})]})})}),((e,t)=>e.categoryProductMap===t.categoryProductMap&&e.currency===t.currency&&e.language===t.language));Ge.displayName="Products";var qe="Branches-module_branches__sOuoV",We="Branches-module_list__vYoT2",Me="Branches-module_name__K0Z-4";const ze=({branches:t=[],rootPath:a="",onBranchSelect:n})=>{const i=({children:t,id:r})=>n?e.jsx("div",{onClick:()=>n(r),children:t}):e.jsx("a",{href:`${a}/${r}`,children:t});return e.jsx("div",{className:qe,children:e.jsx(r.Container,{className:We,children:t.map((({id:t,name:a})=>e.jsx(i,{id:t,children:e.jsx(r.Card,{noBottomMargin:!0,children:e.jsx(r.Flex,{justifyContent:"center",alignItems:"center",fullHeight:!0,children:e.jsx("h2",{className:Me,children:a})})})},t)))})})},Be=({data:r})=>{var n;const{name:i,coverImage:s,logoImage:c,branches:u=[],branchId:h,language:g,categories:f,products:x,currency:j,instagram:y,facebook:I,whatsapp:P,telegram:b,tiktok:A,rootPath:N,hostname:k,onBranchSelect:S}=r||{},T=u.length<=1,D=((e,t)=>{const a=t.reduce(((e,t)=>{const a=Number(t.categoryId);return e[a]||(e[a]=[]),e[a].push(t),e}),{});return e.map((e=>Object.assign(Object.assign({},e),{products:a[Number(e.id)]||[]}))).filter((e=>{var t;return(null===(t=null==e?void 0:e.products)||void 0===t?void 0:t.length)>0}))})(f,x),R=(()=>{var e;return T?(null===(e=null==u?void 0:u[0])||void 0===e?void 0:e.id)?u[0]:{}:u.find((e=>e.id===Number(h)))})(),L=T||!(null==R?void 0:R.name)?i:(null==R?void 0:R.name)||"",[E,O]=a.useState(null===(n=null==f?void 0:f[0])||void 0===n?void 0:n.id),G=a.useRef({}),q=a.useRef(null),W=a.useRef(!0),{url:M,domain:z}=((e,t)=>{const a=v.includes(e)?e:p;return{url:`https://${a}/${t||"en"}`,domain:a}})(k,g);return e.jsxs("div",{className:l,ref:q,children:[e.jsx(U,{branch:R,name:L,coverImage:_(s),logoImage:m(c),instagram:y,facebook:I,whatsapp:P,telegram:b,tiktok:A}),T||h?e.jsxs(e.Fragment,{children:[e.jsx(H,{categoryProductMap:D,language:g,selectedCategoryId:E,onSelectCategory:e=>o(void 0,void 0,void 0,(function*(){W.current=!1,O(e),(e=>{var t;const a=null===(t=null==G?void 0:G.current)||void 0===t?void 0:t[e];a&&(setTimeout((()=>{a.scrollIntoView({behavior:"smooth",block:"start"})}),100),setTimeout((()=>{W.current=!0}),1e3))})(e)}))}),e.jsx(Ge,{currency:j,language:g,productBlocksRef:G,containerRef:q,categoryProductMap:D,onCategoryInView:e=>{if(!(null==W?void 0:W.current))return;const a=((e,a,r)=>{var n;const i=null===(n=null==a?void 0:a.find)||void 0===n?void 0:n.call(a,(({id:t})=>t===e));if(t.isEmpty(i))return"";const{name:o}=w(i,r);return o})(e,f,g);t.trackEvent(C,{name:a}),O(e)}})]}):e.jsx(ze,{branches:u,onBranchSelect:S,rootPath:N}),!!k&&e.jsx("a",{rel:"noopener noreferrer",target:"_blank",href:M,className:d,children:z})]})};var Qe={};const Ue=({currentGoal:t,language:n,setGoal:i})=>{const{t:o}=_e(n),l=a.useRef({}),s=e=>{switch(e){case C:return o("Scrolled to Category");case I:return o("Category Selected");case P:return o("Product Details");case b:return o("Product Added to Cart");default:return""}},d=a.useCallback((e=>{var t,a;i(e),null===(a=null===(t=null==l?void 0:l.current)||void 0===t?void 0:t.close)||void 0===a||a.call(t)}),[i]);return e.jsx(r.DropDown,{action:s(t),actionSize:"large",type:r.UIElementType.BORDERED_PRIMARY,closeRef:l,menu:e.jsx("div",{className:Qe.toolbarMenu,children:N.map((t=>e.jsx(r.DropDownMenuItem,{onClick:()=>d(t),children:s(t)},t)))})})};exports.Events=({data:t,isLoading:a=!1,loadingImage:n,language:i,goal:o,setGoal:l})=>{const{t:s}=_e(i);return e.jsx(r.Card,{title:s("Events"),toolbar:e.jsx(Ue,{language:i,currentGoal:o,setGoal:l}),children:a?e.jsx(r.Loading,{image:n}):e.jsx(r.BarChart,{data:t})})},exports.PublicMenu=({data:t})=>e.jsx(x,{value:t,children:e.jsx(Be,{data:t})});
|
|
2
2
|
//# sourceMappingURL=index.js.map
|