@restaround/react 1.0.47 → 1.0.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.
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"),i=require("@sorocraft/ui/icons");function n(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 i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(a[r[i]]=e[r[i]])}return a}function o(e,t,a,r){return new(a||(a=Promise))((function(i,n){function o(e){try{l(r.next(e))}catch(e){n(e)}}function s(e){try{l(r.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(o,s)}l((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var s="PublicMenu-module_container__QLN6U",l="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 i=t.isEmpty(r)?{}:r;return i.currency||i.currency,i.language||i.language,e.jsx(f.Provider,{value:t.isEmpty(r)?{}:r,children:a})},j=()=>a.useContext(f),y="digital_menu",b=`${y}_category_select`,C=`${y}_category_scroll`,I=`${y}_product_details`,P=`${y}_product_add_cart`,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 A="Header-module_container__tenlF",N="Header-module_cover__BAWZK",k="Header-module_content__Gx4Al",O="Header-module_logo__4MTCm",S="Header-module_info__IchYA",L="Header-module_name__30wyw",T="Header-module_address__WOxXc",D="Header-module_addressText__lUszI",R="Header-module_social__AoP0z",z="Header-module_links__EeQxg",E="Header-module_wifiPassword__VWBTa",W="Header-module_wifiPasswordIcon__Ukn3D";const M=t=>{const a=n(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:(i=235,o=59,s=90,`data:image/gif;base64,R0lGODlhAQABAPAA${g(0,i,o)+g(s,255,255)}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`)}))}var i,o,s;return e.jsx("img",Object.assign({},a))};var Q={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 F=()=>{var t;const{language:i,languages:n,onLanguageSelect:o}=j(),[s,l]=a.useState(!1),d=(null==n?void 0:n.length)>1,c=(null===(t=null==n?void 0:n.filter)||void 0===t?void 0:t.call(n,(({code:e})=>e!==i)))||[],u=e=>`https://images.restaround.co/languages/${e}.svg`;return d?e.jsx("div",{className:Q.container,onClick:()=>l(!s),children:e.jsxs(r.Row,{alignItems:"center",gap:0,children:[e.jsx(r.Row,{alignItems:"center",className:r.classNames(Q,{options:!0,isOpen:s}),children:c.map((({code:t})=>e.jsx("img",{src:u(t),className:Q.option,onClick:()=>(e=>{o&&o(e)})(t),alt:t},t)))}),e.jsx("img",{src:u(i),alt:i||"",className:Q.currentLanguage})]})}):null},q=({branch:a,coverImage:n,logoImage:o,name:s,instagram:l,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:A,children:[e.jsx(M,{src:n,alt:s,className:N,width:1024,height:400,priority:!0,sizes:"100vw",fetchPriority:"high",loading:"eager"}),e.jsx("div",{className:k,children:f?e.jsx((()=>e.jsxs(r.Column,{fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",children:[e.jsx(M,{src:o,alt:s,className:O,width:96,height:96}),e.jsx("div",{className:S,children:e.jsx("h1",{className:L,children:s})})]})),{}):e.jsx((()=>e.jsxs(r.Flex,{direction:"row",gap:1,alignItems:"center",children:[e.jsx(r.Flex.Item,{children:e.jsx(M,{src:o,alt:s,className:O,width:96,height:96})}),e.jsx(r.Flex.Item,{shrink:!0,children:e.jsx("div",{className:S,children:e.jsxs(r.Column,{gap:.25,children:[e.jsx("h1",{className:L,children:s}),e.jsx("a",{className:T,href:x,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(r.Row,{alignItems:"center",gap:.5,children:[e.jsx(r.SVGIcon,{icon:i.MarkerPin,theme:"dark"}),e.jsx("span",{className:D,children:_})]})})]})})})]})),{})}),e.jsx(F,{}),!f&&e.jsx("div",{className:R,children:e.jsx("div",{className:z,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:i.Phone,href:`tel:+${p}`,size:"sm",shape:"circle",theme:"light"}),!!c&&e.jsx(r.IconLink,{icon:i.Whatsapp,href:`https://wa.me/${c}`,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!l&&e.jsx(r.IconLink,{icon:i.Instagram,href:l,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!u&&e.jsx(r.IconLink,{icon:i.Telegram,href:u,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!m&&e.jsx(r.IconLink,{icon:i.Tiktok,href:m,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!d&&e.jsx(r.IconLink,{icon:i.Facebook,href:d,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!v&&e.jsx(r.Tooltip,{hint:v,children:e.jsx("div",{className:E,children:e.jsx(r.SVGIcon,{icon:i.Wifi,size:"sm",className:W})})})]})})})})]})},B=({categoryProductMap:i=[],language:n,selectedCategoryId:o,onSelectCategory:s})=>{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:l,children:e.jsx(r.Carousel,{gap:1,onGetRef:e=>{(null==e?void 0:e.current)&&(c.current=e.current)},children:(i||[]).map((({id:a,translations:i})=>{const{name:l}=i.find((e=>e.language===n))||{};return e.jsx(r.CarouselItem,{children:e.jsx(r.Chip,{onClick:()=>((e,a)=>{e!==o&&(t.trackEvent(b,{name:a}),s(e))})(a,l),type:r.UIElementType.BORDERED_PRIMARY,active:a===o,children:e.jsx("div",{ref:e=>d.current[a]=e,children:l})})},a)}))})})};var H="Products-module_container__bF2LF",Y="Products-module_products__AoDrY",U="Products-module_category__Sp7dE",V="Products-module_list__LH4v5";const $=(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)))||{}},G=(e,t,a=0)=>e*t*(1+a/100),Z=(e,a,r,i=1)=>{const{price:n,vat:o}=e||{},s=G(n,i,o);return{totalPrice:s,formattedTotalPrice:t.priceFormatter(s,a,r)}},K=a.createContext({cart:{},isCartOpen:!1,addProduct:()=>{},updateProduct:()=>{},setIsCartOpen:()=>{}}),X=({children:r})=>{const[i,o]=a.useState({}),[s,l]=a.useState(!1),d=(e,a,r)=>{if(t.isEmpty(e)||a<0)return;const{id:i,price:s,vat:l=0}=e;o((e=>{const t=e[i],o=r?((null==t?void 0:t.quantity)||0)+a:a;if(o<=0){const t=e,a=i;t[a];return n(t,["symbol"==typeof a?a:a+""])}return Object.assign(Object.assign({},e),{[i]:{productId:i,price:s,quantity:o,vat:l}})}))},c=(e,t=1)=>d(e,t,!0),u=(e,t=1)=>d(e,t,!1),m=a.useMemo((()=>({cart:i,isCartOpen:s,addProduct:c,updateProduct:u,setIsCartOpen:l})),[i,s]);return e.jsx(K.Provider,{value:m,children:r})},J=()=>a.useContext(K);var ee={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 te=({product:n,currency:o,language:s,onClick:l})=>{const{addProduct:d}=J(),{image160:c,volume:m}=n||{},{name:_,description:h}=a.useMemo((()=>$(n,s)),[n,s]),{formattedTotalPrice:g}=a.useMemo((()=>Z(n,o,s)),[n,o,s]);return e.jsxs("div",{className:t.classNames(ee,{container:!0,isClickable:!!l}),onClick:l,children:[e.jsxs(r.Row,{justifyContent:"space-between",gap:0,children:[e.jsx("div",{className:ee.data,children:e.jsxs(r.Column,{gap:.25,children:[e.jsx("h3",{className:ee.name,children:e.jsxs(r.Row,{gap:.5,fullWidth:!0,children:[e.jsx("span",{children:_}),!!m&&e.jsxs("span",{children:["(",m,")"]})]})}),e.jsx("div",{className:ee.description,children:h}),e.jsx("div",{className:ee.price,children:g})]})}),c&&e.jsx(M,{src:u(c),alt:_||"menu",className:ee.image,loading:"lazy",width:160,height:90})]}),e.jsx("div",{className:ee.addToCart,children:e.jsx(r.IconButton,{onClick:e=>{e.preventDefault(),e.stopPropagation(),d(n),t.trackEvent(P,{name:_,quantity:1})},icon:i.Plus,type:r.UIElementType.DEFAULT})})]})};var ae={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",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 re={en:{viewOrder:"View order",removeFromOrder:"Remove from order",updateOrder:"Update order",addToOrder:"Add to order"},az:{viewOrder:"Şifarişi göstər",removeFromOrder:"Sifarişdən sil",updateOrder:"Sifarişi yenilə",addToOrder:"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"},tr:{viewOrder:"Siparişi Görüntüle",removeFromOrder:"Siparişten Kaldır",updateOrder:"Siparişi Güncelle",addToOrder:"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"},nl:{viewOrder:"Bestelling bekijken",removeFromOrder:"Uit bestelling verwijderen",updateOrder:"Bestelling bijwerken",addToOrder:"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"},et:{viewOrder:"Vaata tellimust",removeFromOrder:"Eemalda tellimusest",updateOrder:"Uuenda tellimust",addToOrder:"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"},pl:{viewOrder:"Zobacz zamówienie",removeFromOrder:"Usuń z zamówienia",updateOrder:"Zaktualizuj zamówienie",addToOrder:"Dodaj do zamówienia","Your order":"Twoje zamówienie","Empty order":"Puste zamówienie","You don't have any items in your order":"Nie masz żadnych pozycji w zamówieniu","Add items":"Dodaj przedmioty",Subtotal:"Suma"},ru:{viewOrder:"Посмотреть заказ",removeFromOrder:"Удалить из заказа",updateOrder:"Обновить заказ",addToOrder:"Добавить в заказ","Your order":"Ваш заказ","Empty order":"Пустой заказ","You don't have any items in your order":"В вашем заказе нет товаров","Add items":"Добавить товары",Subtotal:"Итого"}},ie=()=>{const{language:e}=j();return{t:t=>{var a;return(null===(a=re[e])||void 0===a?void 0:a[t])||t}}},ne=()=>{const{cart:e}=J();return Object.values(e||{}).reduce(((e,t)=>e+t.quantity),0)};var oe={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 se=({isDecreaseDisabled:a=!1,quantity:n=1,size:o="md",onIncrease:s,onDecrease:l})=>e.jsxs(r.Row,{className:t.classNames(oe,{container:!0},[oe[o]]),justifyContent:"space-between",gap:0,children:[e.jsx("div",{className:t.classNames(oe,{quantityAction:!0,isDisabled:a}),onClick:l,children:e.jsx(r.SVGIcon,{icon:i.Minus})}),e.jsx("div",{className:oe.quantityValue,children:n}),e.jsx("div",{className:oe.quantityAction,onClick:s,children:e.jsx(r.SVGIcon,{icon:i.Plus})})]}),le=({product:n,onClose:o})=>{const{language:s,currency:l}=j(),{addProduct:d,updateProduct:c}=J(),[m,_]=a.useState(1),[h,g]=a.useState(!1),p=a.useRef(),{t:v}=ie(),f=(e=>{var a;const{cart:r}=J();return t.isEmpty(r)||!e?0:(null===(a=r[e])||void 0===a?void 0:a.quantity)||0})(null==n?void 0:n.id),{name:x,description:y}=a.useMemo((()=>$(n,s)),[n,s]),{totalPrice:b,formattedTotalPrice:C}=a.useMemo((()=>Z(n,l,s)),[n,l,s]),I=a.useMemo((()=>m*b),[m,b]),w=a.useMemo((()=>t.priceFormatter(I,l,s)),[I,l,s]),A=h?0===m:1===m,N=a.useMemo((()=>v(h?0===m?"removeFromOrder":"updateOrder":"addToOrder")),[h,m]);a.useEffect((()=>{_(f>0?f:1),g(f>0)}),[f,n]);const k=e=>{-1===e&&A||_((t=>Math.max(0,t+e)))};if(t.isEmpty(n))return null;const{image1024:O,volume:S}=n;return e.jsx("div",{className:ae.container,onClick:e=>{var t,a;(null===(a=null===(t=null==p?void 0:p.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:p,noBodyPadding:!0,size:"small",content:e.jsxs("div",{className:ae.content,children:[e.jsxs(r.Column,{gap:0,children:[O&&e.jsx(M,{src:u(O),width:1024,height:400,alt:x||"product",className:ae.image}),e.jsxs(r.Column,{className:ae.details,gap:1,children:[e.jsx("h2",{className:ae.name,children:x}),e.jsxs(r.Row,{justifyContent:"space-between",children:[e.jsx("div",{className:ae.price,children:C}),e.jsx("div",{className:ae.volume,children:S})]}),e.jsx("div",{className:ae.description,children:y})]})]}),e.jsx("div",{className:ae.close,children:e.jsx(r.IconButton,{onClick:o,icon:i.Close})})]}),footer:e.jsxs(r.Row,{className:ae.addToCart,gap:.5,children:[e.jsx(se,{isDecreaseDisabled:A,onDecrease:()=>k(-1),onIncrease:()=>k(1),quantity:m}),e.jsx(r.Button,{className:ae.addAction,label:e.jsxs(r.Row,{fullWidth:!0,justifyContent:"space-between",children:[e.jsx("span",{className:ae.actionTitle,children:N}),e.jsx("span",{children:w})]}),onClick:()=>{h?c(n,m):(d(n,m),t.trackEvent(P,{name:x,quantity:m})),o&&o()},size:"xl",fullWidth:!0})]})})})};var de="Cart-module_container__3KQtx",ce="Cart-module_content__rkiZa",ue={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 me=({actionText:a,onClick:i})=>{const n=ne(),{formattedTotalPrice:o}=(()=>{const{cart:e}=J(),{currency:a,language:r}=j(),i=Object.values(e||{}).reduce(((e,{price:t,quantity:a,vat:r})=>e+G(t,a,r)),0);return{totalPrice:i,formattedTotalPrice:t.priceFormatter(i,a,r)}})();return e.jsxs(r.Flex,{className:t.classNames(ue,{container:!0,isClickable:!!i}),justifyContent:"space-between",alignItems:"center",onClick:i,children:[e.jsx(r.Flex.Item,{flex:1,children:e.jsxs(r.Row,{alignItems:"center",children:[e.jsx("div",{className:ue.count,children:n}),e.jsx("div",{className:ue.actionText,children:a})]})}),e.jsx(r.Flex.Item,{className:ue.totalPrice,flex:1,children:o})]})},_e=()=>{const{setIsCartOpen:t}=J(),{t:a}=ie();return ne()<=0?null:e.jsx("div",{className:de,children:e.jsx("div",{className:ce,children:e.jsx(me,{onClick:()=>t(!0),actionText:a("viewOrder")})})})};var he={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"},ge="CartItem-module_container__At7lj",pe="CartItem-module_image__D-zzG",ve="CartItem-module_data__Lo3Fb",fe="CartItem-module_name__EksZu",xe="CartItem-module_price__yJxl6";const je=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)))||{}},ye=({productId:t,min:a=1,size:r="md"})=>{const i=(e=>{const{cart:t}=J(),a=t[e];return(null==a?void 0:a.quantity)||1})(t),n=je(t),{updateProduct:o}=J(),s=i===a;return e.jsx(se,{isDecreaseDisabled:s,onDecrease:()=>o(n,i-1),onIncrease:()=>o(n,i+1),quantity:i,size:r})},be=({item:t})=>{const{productId:i,quantity:n}=t||{},o=je(i),{language:s,currency:l}=j(),{image160:d}=o,{name:c}=a.useMemo((()=>$(o,s)),[o,s]),{formattedTotalPrice:m}=a.useMemo((()=>Z(o,l,s,n)),[o,l,s,n]);return e.jsxs(r.Row,{className:ge,gap:1,alignItems:"center",children:[d&&e.jsx(M,{src:u(d),alt:c||"menu",className:pe,loading:"lazy",width:80,height:45}),e.jsxs("div",{className:ve,children:[e.jsx("div",{className:fe,children:c}),e.jsx("div",{className:xe,children:m})]}),e.jsx(ye,{productId:i,size:"sm",min:0})]})},Ce=()=>{const{isCartOpen:i,cart:n,setIsCartOpen:o}=J(),s=a.useRef(),{t:l}=ie(),d=t.isEmpty(n),c=()=>o(!1);return i?e.jsx("div",{className:he.container,onClick:e=>{var t,a;(null===(a=null===(t=null==s?void 0:s.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:s,onClose:c,isOpen:i,title:l("Your order"),content:e.jsx("div",{className:he.content,children:d?e.jsx((()=>e.jsxs(r.Column,{className:he.noItems,fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",gap:0,children:[e.jsx(r.Text,{variant:"h2",children:l("Empty order")}),e.jsx(r.Description,{text:l("You don't have any items in your order")})]})),{}):e.jsx("div",{className:he.items,children:Object.keys(n||{}).map((t=>e.jsx(be,{item:n[t]},t)))})}),footer:d?e.jsx(r.Button,{label:l("Add items"),onClick:c,type:r.UIElementType.PRIMARY,size:"xl",fullWidth:!0}):e.jsx(me,{actionText:l("Subtotal")})})}):null},Ie=a.memo((({categoryProductMap:i=[],currency:n,language:o,productBlocksRef:s,containerRef:l,onCategoryInView:d})=>{const[c,u]=a.useState(null);return a.useEffect((()=>{const e=new IntersectionObserver((e=>{var t;const a=((null===(t=null==l?void 0:l.current)||void 0===t?void 0:t.clientHeight)||1e3)/2;let r=null,i=1/0;e.forEach((e=>{if(e.isIntersecting){const t=e.boundingClientRect,n=t.top+t.height/2,o=Math.abs(n-a);o<i&&(i=o,r=e.target.getAttribute("data-category-id"))}})),r&&d(Number(r))}),{threshold:.5});return Object.entries(s.current||{}).forEach((([t,a])=>{a&&(a.setAttribute("data-category-id",t),e.observe(a))})),()=>{e.disconnect()}}),[s,l]),e.jsx(X,{children:e.jsxs("div",{className:H,children:[e.jsx(r.Column,{children:(i||[]).map((a=>{const{name:i}=w(a,o),{id:l,products:d}=a;return e.jsxs("div",{className:Y,ref:e=>s.current[l]=e,"data-category-id":l,children:[e.jsx("h2",{className:U,children:i}),e.jsx("div",{className:V,children:e.jsx(r.Column,{gap:0,children:(d||[]).map((a=>e.jsx(te,{product:a,currency:n,language:o,onClick:()=>(e=>{const{name:a}=$(e,o);t.trackEvent(I,{name:a}),u(e)})(a)},a.id)))})})]},l)}))}),e.jsx(le,{product:c,onClose:()=>u(null)}),e.jsx(_e,{}),e.jsx(Ce,{})]})})}),((e,t)=>e.categoryProductMap===t.categoryProductMap&&e.currency===t.currency&&e.language===t.language));var Pe="Branches-module_branches__sOuoV",we="Branches-module_list__vYoT2",Ae="Branches-module_name__K0Z-4";const Ne=({branches:t=[],rootPath:a="",onBranchSelect:i})=>{const n=({children:t,id:r})=>i?e.jsx("div",{onClick:()=>i(r),children:t}):e.jsx("a",{href:`${a}/${r}`,children:t});return e.jsx("div",{className:Pe,children:e.jsx(r.Container,{className:we,children:t.map((({id:t,name:a})=>e.jsx(n,{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:Ae,children:a})})})},t)))})})},ke=({data:r})=>{var i;const{name:n,coverImage:l,logoImage:c,branches:u=[],branchId:h,language:g,categories:f,products:x,currency:j,instagram:y,facebook:b,whatsapp:I,telegram:P,tiktok:A,rootPath:N,hostname:k,onBranchSelect:O}=r||{},S=u.length<=1,L=((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),T=(()=>{var e;return S?(null===(e=null==u?void 0:u[0])||void 0===e?void 0:e.id)?u[0]:{}:u.find((e=>e.id===Number(h)))})(),D=S||!(null==T?void 0:T.name)?n:(null==T?void 0:T.name)||"",[R,z]=a.useState(null===(i=null==f?void 0:f[0])||void 0===i?void 0:i.id),E=a.useRef({}),W=a.useRef(null),M=a.useRef(!0),{url:Q,domain:F}=((e,t)=>{const a=v.includes(e)?e:p;return{url:`https://${a}/${t||"en"}`,domain:a}})(k,g);return e.jsxs("div",{className:s,ref:W,children:[e.jsx(q,{branch:T,name:D,coverImage:_(l),logoImage:m(c),instagram:y,facebook:b,whatsapp:I,telegram:P,tiktok:A}),S||h?e.jsxs(e.Fragment,{children:[e.jsx(B,{categoryProductMap:L,language:g,selectedCategoryId:R,onSelectCategory:e=>o(void 0,void 0,void 0,(function*(){M.current=!1,z(e),(e=>{var t;const a=null===(t=null==E?void 0:E.current)||void 0===t?void 0:t[e];a&&(setTimeout((()=>{a.scrollIntoView({behavior:"smooth",block:"start"})}),100),setTimeout((()=>{M.current=!0}),1e3))})(e)}))}),e.jsx(Ie,{currency:j,language:g,productBlocksRef:E,containerRef:W,categoryProductMap:L,onCategoryInView:e=>{if(!(null==M?void 0:M.current))return;const a=((e,a,r)=>{var i;const n=null===(i=null==a?void 0:a.find)||void 0===i?void 0:i.call(a,(({id:t})=>t===e));if(t.isEmpty(n))return"";const{name:o}=w(n,r);return o})(e,f,g);t.trackEvent(C,{name:a}),z(e)}})]}):e.jsx(Ne,{branches:u,onBranchSelect:O,rootPath:N}),!!k&&e.jsx("a",{rel:"noopener",target:"_blank",href:Q,className:d,children:F})]})};exports.PublicMenu=({data:t})=>e.jsx(x,{value:t,children:e.jsx(ke,{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{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(o,s)}l((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var s="PublicMenu-module_container__QLN6U",l="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,n.language||n.language,e.jsx(f.Provider,{value:t.isEmpty(r)?{}:r,children:a})},j=()=>a.useContext(f),y="digital_menu",b=`${y}_category_select`,C=`${y}_category_scroll`,I=`${y}_product_details`,P=`${y}_product_add_cart`,w=[b,C,I,P],A=(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 N="Header-module_container__tenlF",k="Header-module_cover__BAWZK",O="Header-module_content__Gx4Al",S="Header-module_logo__4MTCm",L="Header-module_info__IchYA",D="Header-module_name__30wyw",T="Header-module_address__WOxXc",R="Header-module_addressText__lUszI",E="Header-module_social__AoP0z",z="Header-module_links__EeQxg",M="Header-module_wifiPassword__VWBTa",W="Header-module_wifiPasswordIcon__Ukn3D";const Q=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,s=90,`data:image/gif;base64,R0lGODlhAQABAPAA${g(0,n,o)+g(s,255,255)}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`)}))}var n,o,s;return e.jsx("img",Object.assign({},a))};var q={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 B=()=>{var t;const{language:n,languages:i,onLanguageSelect:o}=j(),[s,l]=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:q.container,onClick:()=>l(!s),children:e.jsxs(r.Row,{alignItems:"center",gap:0,children:[e.jsx(r.Row,{alignItems:"center",className:r.classNames(q,{options:!0,isOpen:s}),children:c.map((({code:t})=>e.jsx("img",{src:u(t),className:q.option,onClick:()=>(e=>{o&&o(e)})(t),alt:t},t)))}),e.jsx("img",{src:u(n),alt:n||"",className:q.currentLanguage})]})}):null},F=({branch:a,coverImage:i,logoImage:o,name:s,instagram:l,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:N,children:[e.jsx(Q,{src:i,alt:s,className:k,width:1024,height:400,priority:!0,sizes:"100vw",fetchPriority:"high",loading:"eager"}),e.jsx("div",{className:O,children:f?e.jsx((()=>e.jsxs(r.Column,{fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",children:[e.jsx(Q,{src:o,alt:s,className:S,width:96,height:96}),e.jsx("div",{className:L,children:e.jsx("h1",{className:D,children:s})})]})),{}):e.jsx((()=>e.jsxs(r.Flex,{direction:"row",gap:1,alignItems:"center",children:[e.jsx(r.Flex.Item,{children:e.jsx(Q,{src:o,alt:s,className:S,width:96,height:96})}),e.jsx(r.Flex.Item,{shrink:!0,children:e.jsx("div",{className:L,children:e.jsxs(r.Column,{gap:.25,children:[e.jsx("h1",{className:D,children:s}),e.jsx("a",{className:T,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:R,children:_})]})})]})})})]})),{})}),e.jsx(B,{}),!f&&e.jsx("div",{className:E,children:e.jsx("div",{className:z,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"}),!!l&&e.jsx(r.IconLink,{icon:n.Instagram,href:l,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:M,children:e.jsx(r.SVGIcon,{icon:n.Wifi,size:"sm",className:W})})})]})})})})]})},H=({categoryProductMap:n=[],language:i,selectedCategoryId:o,onSelectCategory:s})=>{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:l,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:l}=n.find((e=>e.language===i))||{};return e.jsx(r.CarouselItem,{children:e.jsx(r.Chip,{onClick:()=>((e,a)=>{e!==o&&(t.trackEvent(b,{name:a}),s(e))})(a,l),type:r.UIElementType.BORDERED_PRIMARY,active:a===o,children:e.jsx("div",{ref:e=>d.current[a]=e,children:l})})},a)}))})})};var Y="Products-module_container__bF2LF",G="Products-module_products__AoDrY",U="Products-module_category__Sp7dE",V="Products-module_list__LH4v5";const $=(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)))||{}},K=(e,t,a=0)=>e*t*(1+a/100),Z=(e,a,r,n=1)=>{const{price:i,vat:o}=e||{},s=K(i,n,o);return{totalPrice:s,formattedTotalPrice:t.priceFormatter(s,a,r)}},X=a.createContext({cart:{},isCartOpen:!1,addProduct:()=>{},updateProduct:()=>{},setIsCartOpen:()=>{}}),J=({children:r})=>{const[n,o]=a.useState({}),[s,l]=a.useState(!1),d=(e,a,r)=>{if(t.isEmpty(e)||a<0)return;const{id:n,price:s,vat:l=0}=e;o((e=>{const t=e[n],o=r?((null==t?void 0:t.quantity)||0)+a:a;if(o<=0){const t=e,a=n;t[a];return i(t,["symbol"==typeof a?a:a+""])}return Object.assign(Object.assign({},e),{[n]:{productId:n,price:s,quantity:o,vat:l}})}))},c=(e,t=1)=>d(e,t,!0),u=(e,t=1)=>d(e,t,!1),m=a.useMemo((()=>({cart:n,isCartOpen:s,addProduct:c,updateProduct:u,setIsCartOpen:l})),[n,s]);return e.jsx(X.Provider,{value:m,children:r})},ee=()=>a.useContext(X);var te={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 ae=({product:i,currency:o,language:s,onClick:l})=>{const{addProduct:d}=ee(),{image160:c,volume:m}=i||{},{name:_,description:h}=a.useMemo((()=>$(i,s)),[i,s]),{formattedTotalPrice:g}=a.useMemo((()=>Z(i,o,s)),[i,o,s]);return e.jsxs("div",{className:t.classNames(te,{container:!0,isClickable:!!l}),onClick:l,children:[e.jsxs(r.Row,{justifyContent:"space-between",gap:0,children:[e.jsx("div",{className:te.data,children:e.jsxs(r.Column,{gap:.25,children:[e.jsx("h3",{className:te.name,children:_}),e.jsx("p",{className:te.description,children:h}),e.jsxs(r.Row,{className:te.price,gap:.5,fullWidth:!0,justifyContent:"space-between",children:[e.jsx("span",{children:g}),!!m&&e.jsx(r.Text,{color:"muted",children:m})]})]})}),c&&e.jsx(Q,{src:u(c),alt:_||"menu",className:te.image,loading:"lazy",width:160,height:90})]}),e.jsx("div",{className:te.addToCart,children:e.jsx(r.IconButton,{onClick:e=>{e.preventDefault(),e.stopPropagation(),d(i),t.trackEvent(P,{name:_,quantity:1})},icon:n.Plus,type:r.UIElementType.DEFAULT})})]})};var re={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",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 ne={en:{viewOrder:"View order",removeFromOrder:"Remove from order",updateOrder:"Update order",addToOrder:"Add to order"},az:{viewOrder:"Şifarişi göstər",removeFromOrder:"Sifarişdən sil",updateOrder:"Sifarişi yenilə",addToOrder:"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"},tr:{viewOrder:"Siparişi Görüntüle",removeFromOrder:"Siparişten Kaldır",updateOrder:"Siparişi Güncelle",addToOrder:"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"},nl:{viewOrder:"Bestelling bekijken",removeFromOrder:"Uit bestelling verwijderen",updateOrder:"Bestelling bijwerken",addToOrder:"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"},et:{viewOrder:"Vaata tellimust",removeFromOrder:"Eemalda tellimusest",updateOrder:"Uuenda tellimust",addToOrder:"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"},pl:{viewOrder:"Zobacz zamówienie",removeFromOrder:"Usuń z zamówienia",updateOrder:"Zaktualizuj zamówienie",addToOrder:"Dodaj do zamówienia","Your order":"Twoje zamówienie","Empty order":"Puste zamówienie","You don't have any items in your order":"Nie masz żadnych pozycji w zamówieniu","Add items":"Dodaj przedmioty",Subtotal:"Suma",Events:"Wydarzenia"},ru:{viewOrder:"Посмотреть заказ",removeFromOrder:"Удалить из заказа",updateOrder:"Обновить заказ",addToOrder:"Добавить в заказ","Your order":"Ваш заказ","Empty order":"Пустой заказ","You don't have any items in your order":"В вашем заказе нет товаров","Add items":"Добавить товары",Subtotal:"Итого",Events:"События"}},ie=e=>{const{language:t}=j(),a=e||t;return{t:e=>{var t;return(null===(t=ne[a])||void 0===t?void 0:t[e])||e}}},oe=()=>{const{cart:e}=ee();return Object.values(e||{}).reduce(((e,t)=>e+t.quantity),0)};var se={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 le=({isDecreaseDisabled:a=!1,quantity:i=1,size:o="md",onIncrease:s,onDecrease:l})=>e.jsxs(r.Row,{className:t.classNames(se,{container:!0},[se[o]]),justifyContent:"space-between",gap:0,children:[e.jsx("div",{className:t.classNames(se,{quantityAction:!0,isDisabled:a}),onClick:l,children:e.jsx(r.SVGIcon,{icon:n.Minus})}),e.jsx("div",{className:se.quantityValue,children:i}),e.jsx("div",{className:se.quantityAction,onClick:s,children:e.jsx(r.SVGIcon,{icon:n.Plus})})]}),de=({product:i,onClose:o})=>{const{language:s,currency:l}=j(),{addProduct:d,updateProduct:c}=ee(),[m,_]=a.useState(1),[h,g]=a.useState(!1),p=a.useRef(),{t:v}=ie(),f=(e=>{var a;const{cart:r}=ee();return t.isEmpty(r)||!e?0:(null===(a=r[e])||void 0===a?void 0:a.quantity)||0})(null==i?void 0:i.id),{name:x,description:y}=a.useMemo((()=>$(i,s)),[i,s]),{totalPrice:b,formattedTotalPrice:C}=a.useMemo((()=>Z(i,l,s)),[i,l,s]),I=a.useMemo((()=>m*b),[m,b]),w=a.useMemo((()=>t.priceFormatter(I,l,s)),[I,l,s]),A=h?0===m:1===m,N=a.useMemo((()=>v(h?0===m?"removeFromOrder":"updateOrder":"addToOrder")),[h,m]);a.useEffect((()=>{_(f>0?f:1),g(f>0)}),[f,i]);const k=e=>{-1===e&&A||_((t=>Math.max(0,t+e)))};if(t.isEmpty(i))return null;const{image1024:O,volume:S}=i;return e.jsx("div",{className:re.container,onClick:e=>{var t,a;(null===(a=null===(t=null==p?void 0:p.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:p,noBodyPadding:!0,size:"small",content:e.jsxs("div",{className:re.content,children:[e.jsxs(r.Column,{gap:0,children:[O&&e.jsx(Q,{src:u(O),width:1024,height:400,alt:x||"product",className:re.image}),e.jsxs(r.Column,{className:re.details,gap:1,children:[e.jsx("h2",{className:re.name,children:x}),e.jsxs(r.Row,{justifyContent:"space-between",children:[e.jsx("div",{className:re.price,children:C}),e.jsx("div",{className:re.volume,children:S})]}),e.jsx("div",{className:re.description,children:y})]})]}),e.jsx("div",{className:re.close,children:e.jsx(r.IconButton,{onClick:o,icon:n.Close})})]}),footer:e.jsxs(r.Row,{className:re.addToCart,gap:.5,children:[e.jsx(le,{isDecreaseDisabled:A,onDecrease:()=>k(-1),onIncrease:()=>k(1),quantity:m}),e.jsx(r.Button,{className:re.addAction,label:e.jsxs(r.Row,{fullWidth:!0,justifyContent:"space-between",children:[e.jsx("span",{className:re.actionTitle,children:N}),e.jsx("span",{children:w})]}),onClick:()=>{h?c(i,m):(d(i,m),t.trackEvent(P,{name:x,quantity:m})),o&&o()},size:"xl",fullWidth:!0})]})})})};var ce="Cart-module_container__3KQtx",ue="Cart-module_content__rkiZa",me={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 _e=({actionText:a,onClick:n})=>{const i=oe(),{formattedTotalPrice:o}=(()=>{const{cart:e}=ee(),{currency:a,language:r}=j(),n=Object.values(e||{}).reduce(((e,{price:t,quantity:a,vat:r})=>e+K(t,a,r)),0);return{totalPrice:n,formattedTotalPrice:t.priceFormatter(n,a,r)}})();return e.jsxs(r.Flex,{className:t.classNames(me,{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:me.count,children:i}),e.jsx("div",{className:me.actionText,children:a})]})}),e.jsx(r.Flex.Item,{className:me.totalPrice,flex:1,children:o})]})},he=()=>{const{setIsCartOpen:t}=ee(),{t:a}=ie();return oe()<=0?null:e.jsx("div",{className:ce,children:e.jsx("div",{className:ue,children:e.jsx(_e,{onClick:()=>t(!0),actionText:a("viewOrder")})})})};var ge={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"},pe="CartItem-module_container__At7lj",ve="CartItem-module_image__D-zzG",fe="CartItem-module_data__Lo3Fb",xe="CartItem-module_name__EksZu",je="CartItem-module_price__yJxl6";const ye=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)))||{}},be=({productId:t,min:a=1,size:r="md"})=>{const n=(e=>{const{cart:t}=ee(),a=t[e];return(null==a?void 0:a.quantity)||1})(t),i=ye(t),{updateProduct:o}=ee(),s=n===a;return e.jsx(le,{isDecreaseDisabled:s,onDecrease:()=>o(i,n-1),onIncrease:()=>o(i,n+1),quantity:n,size:r})},Ce=({item:t})=>{const{productId:n,quantity:i}=t||{},o=ye(n),{language:s,currency:l}=j(),{image160:d}=o,{name:c}=a.useMemo((()=>$(o,s)),[o,s]),{formattedTotalPrice:m}=a.useMemo((()=>Z(o,l,s,i)),[o,l,s,i]);return e.jsxs(r.Row,{className:pe,gap:1,alignItems:"center",children:[d&&e.jsx(Q,{src:u(d),alt:c||"menu",className:ve,loading:"lazy",width:80,height:45}),e.jsxs("div",{className:fe,children:[e.jsx("div",{className:xe,children:c}),e.jsx("div",{className:je,children:m})]}),e.jsx(be,{productId:n,size:"sm",min:0})]})},Ie=()=>{const{isCartOpen:n,cart:i,setIsCartOpen:o}=ee(),s=a.useRef(),{t:l}=ie(),d=t.isEmpty(i),c=()=>o(!1);return n?e.jsx("div",{className:ge.container,onClick:e=>{var t,a;(null===(a=null===(t=null==s?void 0:s.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:s,onClose:c,isOpen:n,title:l("Your order"),content:e.jsx("div",{className:ge.content,children:d?e.jsx((()=>e.jsxs(r.Column,{className:ge.noItems,fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",gap:0,children:[e.jsx(r.Text,{variant:"h2",children:l("Empty order")}),e.jsx(r.Description,{text:l("You don't have any items in your order")})]})),{}):e.jsx("div",{className:ge.items,children:Object.keys(i||{}).map((t=>e.jsx(Ce,{item:i[t]},t)))})}),footer:d?e.jsx(r.Button,{label:l("Add items"),onClick:c,type:r.UIElementType.PRIMARY,size:"xl",fullWidth:!0}):e.jsx(_e,{actionText:l("Subtotal")})})}):null},Pe=a.memo((({categoryProductMap:n=[],currency:i,language:o,productBlocksRef:s,containerRef:l,onCategoryInView:d})=>{const[c,u]=a.useState(null);return a.useEffect((()=>{const e=new IntersectionObserver((e=>{var t;const a=((null===(t=null==l?void 0:l.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&&d(Number(r))}),{threshold:.5});return Object.entries(s.current||{}).forEach((([t,a])=>{a&&(a.setAttribute("data-category-id",t),e.observe(a))})),()=>{e.disconnect()}}),[s,l]),e.jsx(J,{children:e.jsxs("div",{className:Y,children:[e.jsx(r.Column,{children:(n||[]).map((a=>{const{name:n}=A(a,o),{id:l,products:d}=a;return e.jsxs("div",{className:G,ref:e=>s.current[l]=e,"data-category-id":l,children:[e.jsx("h2",{className:U,children:n}),e.jsx("div",{className:V,children:e.jsx(r.Column,{gap:0,children:(d||[]).map((a=>e.jsx(ae,{product:a,currency:i,language:o,onClick:()=>(e=>{const{name:a}=$(e,o);t.trackEvent(I,{name:a}),u(e)})(a)},a.id)))})})]},l)}))}),e.jsx(de,{product:c,onClose:()=>u(null)}),e.jsx(he,{}),e.jsx(Ie,{})]})})}),((e,t)=>e.categoryProductMap===t.categoryProductMap&&e.currency===t.currency&&e.language===t.language));var we="Branches-module_branches__sOuoV",Ae="Branches-module_list__vYoT2",Ne="Branches-module_name__K0Z-4";const ke=({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:we,children:e.jsx(r.Container,{className:Ae,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:Ne,children:a})})})},t)))})})},Oe=({data:r})=>{var n;const{name:i,coverImage:l,logoImage:c,branches:u=[],branchId:h,language:g,categories:f,products:x,currency:j,instagram:y,facebook:b,whatsapp:I,telegram:P,tiktok:w,rootPath:N,hostname:k,onBranchSelect:O}=r||{},S=u.length<=1,L=((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),D=(()=>{var e;return S?(null===(e=null==u?void 0:u[0])||void 0===e?void 0:e.id)?u[0]:{}:u.find((e=>e.id===Number(h)))})(),T=S||!(null==D?void 0:D.name)?i:(null==D?void 0:D.name)||"",[R,E]=a.useState(null===(n=null==f?void 0:f[0])||void 0===n?void 0:n.id),z=a.useRef({}),M=a.useRef(null),W=a.useRef(!0),{url:Q,domain:q}=((e,t)=>{const a=v.includes(e)?e:p;return{url:`https://${a}/${t||"en"}`,domain:a}})(k,g);return e.jsxs("div",{className:s,ref:M,children:[e.jsx(F,{branch:D,name:T,coverImage:_(l),logoImage:m(c),instagram:y,facebook:b,whatsapp:I,telegram:P,tiktok:w}),S||h?e.jsxs(e.Fragment,{children:[e.jsx(H,{categoryProductMap:L,language:g,selectedCategoryId:R,onSelectCategory:e=>o(void 0,void 0,void 0,(function*(){W.current=!1,E(e),(e=>{var t;const a=null===(t=null==z?void 0:z.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(Pe,{currency:j,language:g,productBlocksRef:z,containerRef:M,categoryProductMap:L,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}=A(i,r);return o})(e,f,g);t.trackEvent(C,{name:a}),E(e)}})]}):e.jsx(ke,{branches:u,onBranchSelect:O,rootPath:N}),!!k&&e.jsx("a",{rel:"noopener",target:"_blank",href:Q,className:d,children:q})]})};var Se={};const Le=({currentGoal:t,language:n,setGoal:i})=>{const{t:o}=ie(n),s=a.useRef({}),l=e=>{switch(e){case C:return o("Scrolled to Category");case b:return o("Category Selected");case I:return o("Product Details");case P:return o("Product Added to Cart");default:return""}},d=a.useCallback((e=>{var t,a;i(e),null===(a=null===(t=null==s?void 0:s.current)||void 0===t?void 0:t.close)||void 0===a||a.call(t)}),[i]);return e.jsx(r.DropDown,{action:l(t),actionSize:"large",type:r.UIElementType.BORDERED_PRIMARY,closeRef:s,menu:e.jsx("div",{className:Se.toolbarMenu,children:w.map((t=>e.jsx(r.DropDownMenuItem,{onClick:()=>d(t),children:l(t)},t)))})})};exports.Events=({data:t,isLoading:a=!1,loadingImage:n,language:i,goal:o,setGoal:s})=>{const{t:l}=ie(i);return e.jsx(r.Card,{title:l("Events"),toolbar:e.jsx(Le,{language:i,currentGoal:o,setGoal:s}),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(Oe,{data:t})});
2
2
  //# sourceMappingURL=index.js.map