@restaround/react 1.0.56 → 1.0.59
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/components/PublicMenu/CartItem/OptionsInfo/OptionsInfo.d.ts +9 -0
- package/dist/components/PublicMenu/CartItem/OptionsInfo/index.d.ts +1 -0
- package/dist/components/PublicMenu/ProductAddons/ProductAddons.d.ts +14 -0
- package/dist/components/PublicMenu/ProductAddons/index.d.ts +1 -0
- package/dist/components/PublicMenu/ProductDetails/ProductDetails.d.ts +1 -1
- package/dist/components/PublicMenu/ProductQuantity/ProductQuantity.d.ts +3 -1
- package/dist/components/PublicMenu/ProductVariants/ProductVariants.d.ts +9 -0
- package/dist/components/PublicMenu/ProductVariants/index.d.ts +1 -0
- package/dist/hooks/cart.d.ts +6 -1
- package/dist/hooks/product.d.ts +7 -2
- 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/models/addon.d.ts +30 -0
- package/dist/models/index.esm.js.map +1 -1
- package/dist/models/index.js.map +1 -1
- package/dist/models/order.d.ts +3 -0
- package/dist/models/product.d.ts +2 -0
- package/dist/store/cart.d.ts +5 -3
- package/dist/styles/ui.css +1 -1
- package/dist/styles/ui.css.map +1 -1
- package/dist/utils/addon.d.ts +14 -0
- package/dist/utils/cart.d.ts +2 -0
- package/dist/utils/cart.test.d.ts +1 -0
- package/dist/utils/common.d.ts +1 -1
- package/dist/utils/index.d.ts +6 -2
- package/dist/utils/index.esm.js +1 -1
- package/dist/utils/index.esm.js.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/models/addon.d.ts +30 -0
- package/dist/utils/models/order.d.ts +3 -0
- package/dist/utils/models/product.d.ts +2 -0
- package/dist/utils/product.d.ts +19 -1
- package/dist/utils/utils/addon.d.ts +14 -0
- package/dist/utils/utils/cart.d.ts +2 -0
- package/dist/utils/utils/cart.test.d.ts +1 -0
- package/dist/utils/utils/common.d.ts +1 -1
- package/dist/utils/utils/index.d.ts +6 -2
- package/dist/utils/utils/product.d.ts +19 -1
- package/package.json +17 -11
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",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})});
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("@sorocraft/js-utils"),n=require("react"),o=require("@sorocraft/ui"),r=require("@sorocraft/ui/icons");function i(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function a(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{s(o.next(e))}catch(e){i(e)}}function l(e){try{s(o.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}s((o=o.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,n)=>h.charAt(e>>2)+h.charAt((3&e)<<4|t>>4)+h.charAt((15&t)<<2|n>>6)+h.charAt(63&n),p="restaround.co",v=[p,"restaround.az","restaround.ee","restaround.nl"],f=n.createContext({}),x=({children:n,value:o})=>{const r=t.isEmpty(o)?{}:o;return r.currency||(r.currency="AZN"),r.language||(r.language="az"),e.jsx(f.Provider,{value:t.isEmpty(o)?{}:o,children:n})},j=()=>n.useContext(f),I="digital_menu",y=`${I}_category_select`,P=`${I}_category_scroll`,C=`${I}_product_details`,A=`${I}_product_add_cart`,b=`${I}_product_view_changed`,N=[y,P,C,A],S=(e,t)=>{var n,o;return(null===(o=null===(n=null==e?void 0:e.translations)||void 0===n?void 0:n.find)||void 0===o?void 0:o.call(n,(e=>e.language===t)))||{}};var w="Header-module_container__tenlF",T="Header-module_cover__BAWZK",k="Header-module_content__Gx4Al",L="Header-module_logo__4MTCm",R="Header-module_info__IchYA",E="Header-module_name__30wyw",D="Header-module_address__WOxXc",O="Header-module_addressText__lUszI",G="Header-module_social__AoP0z",q="Header-module_links__EeQxg",V="Header-module_wifiPassword__VWBTa",W="Header-module_wifiPasswordIcon__Ukn3D";const B=t=>{const n=i(t,["priority","blurDataURL","quality","placeholder","fetchPriority"]),{imageTag:o}=j()||{};if(o){const n=o;return e.jsx(n,Object.assign({},t,{quality:t.quality||100,placeholder:"blur",blurDataURL:(r=235,a=59,l=90,`data:image/gif;base64,R0lGODlhAQABAPAA${g(0,r,a)+g(l,255,255)}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`)}))}var r,a,l;return e.jsx("img",Object.assign({},n))};var M={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 z=()=>{var t;const{language:r,languages:i,onLanguageSelect:a}=j(),[l,s]=n.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!==r)))||[],u=e=>`https://images.restaround.co/languages/${e}.svg`;return d?e.jsx("div",{className:M.container,onClick:()=>s(!l),children:e.jsxs(o.Row,{alignItems:"center",gap:0,children:[e.jsx(o.Row,{alignItems:"center",className:o.classNames(M,{options:!0,isOpen:l}),children:c.map((({code:t})=>e.jsx("img",{src:u(t),className:M.option,onClick:()=>(e=>{a&&a(e)})(t),alt:t},t)))}),e.jsx("img",{src:u(r),alt:r||"",className:M.currentLanguage})]})}):null},U=({branch:n,coverImage:i,logoImage:a,name:l,instagram:s,facebook:d,whatsapp:c,telegram:u,tiktok:m})=>{const{address:_,latitude:h,longitude:g,phone:p,wifiPassword:v}=n||{},f=t.isEmpty(n),x=`https://www.google.com/maps/place/${h},${g}`;return e.jsxs("div",{className:w,children:[e.jsx(B,{src:i,alt:l,className:T,width:1024,height:400,priority:!0,sizes:"100vw",fetchPriority:"high",loading:"eager"}),e.jsx("div",{className:k,children:f?e.jsx((()=>e.jsxs(o.Column,{fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",children:[e.jsx(B,{src:a,alt:l,className:L,width:96,height:96}),e.jsx("div",{className:R,children:e.jsx("h1",{className:E,children:l})})]})),{}):e.jsx((()=>e.jsxs(o.Flex,{direction:"row",gap:1,alignItems:"center",fullWidth:!0,children:[e.jsx(o.Flex.Item,{children:e.jsx(B,{src:a,alt:l,className:L,width:96,height:96})}),e.jsx(o.Flex.Item,{shrink:!0,className:R,children:e.jsxs(o.Column,{gap:.25,children:[e.jsx("h1",{className:E,children:l}),e.jsx("a",{className:D,href:x,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(o.Row,{alignItems:"center",gap:.5,children:[e.jsx(o.SVGIcon,{icon:r.MarkerPin,theme:"dark"}),e.jsx("span",{className:O,children:_})]})})]})})]})),{})}),e.jsx(z,{}),!f&&e.jsx("div",{className:G,children:e.jsx("div",{className:q,children:e.jsx(o.Row,{gap:2,alignItems:"center",children:e.jsxs(o.Row,{alignItems:"center",justifyContent:"center",gap:.5,children:[!!p&&e.jsx(o.IconLink,{icon:r.Phone,href:`tel:+${p}`,size:"sm",shape:"circle",theme:"light"}),!!c&&e.jsx(o.IconLink,{icon:r.Whatsapp,href:`https://wa.me/${c}`,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!s&&e.jsx(o.IconLink,{icon:r.Instagram,href:s,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!u&&e.jsx(o.IconLink,{icon:r.Telegram,href:u,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!m&&e.jsx(o.IconLink,{icon:r.Tiktok,href:m,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!d&&e.jsx(o.IconLink,{icon:r.Facebook,href:d,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!v&&e.jsx(o.Tooltip,{hint:v,children:e.jsx("div",{className:V,children:e.jsx(o.SVGIcon,{icon:r.Wifi,size:"sm",className:W})})})]})})})})]})},H=({categoryProductMap:r=[],language:i,selectedCategoryId:a,onSelectCategory:l})=>{const d=n.useRef({}),c=n.useRef(null);return n.useEffect((()=>{a&&(()=>{var e;const t=null===(e=null==d?void 0:d.current)||void 0===e?void 0:e[a];if(!t||!c.current)return;const n=c.current.clientWidth,o=t.offsetLeft-n/2+t.offsetWidth/2;c.current.scrollTo({left:o,behavior:"smooth"})})()}),[a]),e.jsx("div",{className:s,children:e.jsx(o.Carousel,{gap:1,onGetRef:e=>{(null==e?void 0:e.current)&&(c.current=e.current)},children:(r||[]).map((({id:n,translations:r})=>{const{name:s}=r.find((e=>e.language===i))||{};return e.jsx(o.CarouselItem,{children:e.jsx(o.Chip,{onClick:()=>((e,n)=>{e!==a&&(t.trackEvent(y,{name:n}),l(e))})(n,s),type:o.UIElementType.BORDERED_PRIMARY,active:n===a,children:e.jsx("div",{ref:e=>{e&&(d.current[n]=e)},children:s})})},n)}))})})};var F="Products-module_container__bF2LF",Q="Products-module_view__l857X",Y="Products-module_products__AoDrY",$="Products-module_category__Sp7dE",X="Products-module_list__LH4v5";const K=(e=0,t=1,n=0)=>e*t*(1+n/100);var Z;!function(e){e.SINGLE="SINGLE",e.MULTIPLE="MULTIPLE"}(Z||(Z={}));const J=(e,t)=>{var n,o;return(null===(o=null===(n=null==e?void 0:e.translations)||void 0===n?void 0:n.find)||void 0===o?void 0:o.call(n,(e=>e.language===t)))||{}},ee=(e,t)=>{var n,o;return(null===(o=null===(n=null==e?void 0:e.translations)||void 0===n?void 0:n.find)||void 0===o?void 0:o.call(n,(e=>e.language===t)))||{}},te=(e,t)=>{var n;return(null===(n=((null==e?void 0:e.options)||[]).find((({id:e})=>e===t)))||void 0===n?void 0:n.price)||0},ne=(e,t)=>{var n,o;return(null===(o=null===(n=null==e?void 0:e.translations)||void 0===n?void 0:n.find)||void 0===o?void 0:o.call(n,(e=>e.language===t)))||{}},oe=(e,t=1)=>{const{price:n=0,vat:o=0}=e||{};return K(n,t,o)},re=(e,n,o,r=1)=>{const i=oe(e,r);return{totalPrice:i,formattedTotalPrice:t.priceFormatter(i,n,o)}},ie=(e,t)=>{var n,o;return(null===(o=null===(n=null==e?void 0:e.variants)||void 0===n?void 0:n.find)||void 0===o?void 0:o.call(n,(e=>e.id===t)))||{}},ae=(e,t,n)=>{const o=ie(t,e),{vat:r}=t||{},{price:i}=o||{};return K(i,n,r)},le=(e,t)=>{var n,o;return(null===(o=null===(n=null==e?void 0:e.translations)||void 0===n?void 0:n.find)||void 0===o?void 0:o.call(n,(e=>e.language===t)))||{}},se=({product:e,variantId:n,quantity:o=1,selectedAddons:r,noVat:i=!1})=>{if(t.isEmpty(e))return{price:0,optionsPrice:0,total:0};const a=Object.assign(Object.assign({},e),{vat:i?0:e.vat}),l=((e,t={},n)=>((null==e?void 0:e.addons)||[]).filter((e=>Object.prototype.hasOwnProperty.call(t,e.id))).reduce(((e,n)=>{const{id:o,selectType:r}=n;if(r===Z.SINGLE){const r=t[o];return e+te(n,r)}return e+(t[o]||[]).reduce(((e,t)=>e+te(n,t)),0)}),0)*n)(a,r,o),s=n?ae(n,a,o):oe(a,o);return{price:s,optionsPrice:l,total:s+l}};var de;!function(e){e.LIST="list",e.GRID="grid"}(de||(de={}));const ce=(e,n="USD",o="en")=>{const{price:r,vat:i,quantity:a,optionsPrice:l}=e||{},s=K(r,a,i)+l*a;return{totalPrice:s,formattedTotalPrice:t.priceFormatter(s,n,o)}},ue=(e,t,n)=>{if(!e)throw new Error("Product ID is required");let o=`${e}`;t&&(o+=`-${t}`);const r=Object.entries(n||{}).map((([e,t])=>{if(!e||!t)return null;const n=Array.isArray(t)?t.filter(Boolean).join("-"):`${t}`;return n?`${e}-${n}`:null})).filter(Boolean).join("-");return r&&(o+=`-${r}`),o},me=n.createContext({cart:{},isCartOpen:!1,addProduct:()=>{},updateProduct:()=>{},setIsCartOpen:()=>{},removeAllProductVariants:()=>{}}),_e=({children:o})=>{const[r,a]=n.useState({}),[l,s]=n.useState(!1),d=({product:e,quantity:n,isAddOperation:o,variantId:r,selectedAddons:l})=>{if(t.isEmpty(e)||n<0)return;const{id:s,vat:d=0}=e,c=ue(s,r,l),{price:u,optionsPrice:m}=se({product:e,variantId:r,quantity:1,selectedAddons:l,noVat:!0});a((e=>{const t=e[c],a=o?((null==t?void 0:t.quantity)||0)+n:n;if(a<=0){const t=e,n=c;t[n];return i(t,["symbol"==typeof n?n:n+""])}return Object.assign(Object.assign({},e),{[c]:{productId:s,price:u,optionsPrice:m,quantity:a,vat:d,variantId:r,selectedAddons:l}})}))},c=({product:e,quantity:t=1,variantId:n,selectedAddons:o})=>d({product:e,quantity:t,variantId:n,selectedAddons:o,isAddOperation:!0}),u=({product:e,quantity:t=1,variantId:n,selectedAddons:o})=>d({product:e,quantity:t,variantId:n,selectedAddons:o,isAddOperation:!1}),m=e=>{if(!e||t.isEmpty(r))return;const n=Object.entries(r).reduce(((t,[n,o])=>(o.productId!==e&&(t[n]=o),t)),{});a(n)},_=n.useMemo((()=>({cart:r,isCartOpen:l,addProduct:c,updateProduct:u,setIsCartOpen:s,removeAllProductVariants:m})),[r,l]);return e.jsx(me.Provider,{value:_,children:o})},he=()=>n.useContext(me);var ge={container:"ProductsListItem-module_container__i9tFs",isClickable:"ProductsListItem-module_isClickable__iHHdI",info:"ProductsListItem-module_info__4s4j2",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",noImage:"ProductsListItem-module_noImage__G4E-a",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 pe=({product:i,currency:a,language:l,onClick:s})=>{var d,c;const{addProduct:m}=he(),{image160:_,volume:h}=i||{},{name:g,description:p}=n.useMemo((()=>ne(i,l)),[i,l]),{formattedTotalPrice:v}=n.useMemo((()=>re(i,a,l)),[i,a,l]),f=(null===(d=null==i?void 0:i.variants)||void 0===d?void 0:d.length)>0,x=(null===(c=null==i?void 0:i.addons)||void 0===c?void 0:c.length)>0,j=!!_;return e.jsxs("div",{className:t.classNames(ge,{container:!0,isClickable:!!s,noImage:!j}),onClick:s,children:[e.jsxs(o.Row,{justifyContent:"space-between",gap:0,children:[e.jsx("div",{className:ge.info,children:e.jsxs(o.Column,{gap:.25,children:[e.jsx("h3",{className:ge.name,children:g}),e.jsx("p",{className:ge.description,children:p}),e.jsxs(o.Row,{className:ge.price,gap:.5,fullWidth:!0,justifyContent:"space-between",children:[e.jsx("span",{children:v}),!!h&&e.jsx(o.Text,{color:"muted",children:h})]})]})}),j&&e.jsx(B,{src:u(_),alt:g||"menu",className:ge.image,loading:"lazy",width:160,height:90})]}),e.jsx("div",{className:ge.addToCart,children:e.jsx(o.IconButton,{onClick:e=>{if(e.preventDefault(),e.stopPropagation(),(f||x)&&s)return s();m({product:i}),t.trackEvent(A,{name:g,quantity:1})},icon:r.Plus,type:o.UIElementType.DEFAULT})})]})};var ve={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 fe=({product:i,currency:a,language:l,onClick:s})=>{var d,c;const{addProduct:m}=he(),{volume:_,image580:h,image160:g,image1024:p}=i||{},v=h||p||g,{name:f,description:x}=n.useMemo((()=>ne(i,l)),[i,l]),{formattedTotalPrice:j}=n.useMemo((()=>re(i,a,l)),[i,a,l]),I=(null===(d=null==i?void 0:i.variants)||void 0===d?void 0:d.length)>0,y=(null===(c=null==i?void 0:i.addons)||void 0===c?void 0:c.length)>0;return e.jsx("div",{className:ve.container,children:e.jsxs("div",{className:t.classNames(ve,{content:!0,isClickable:!!s,noImage:!v}),onClick:s,children:[v&&e.jsx("div",{className:ve.imageContainer,children:e.jsx(B,{src:u(v),alt:f||"menu",className:ve.image,loading:"lazy",width:580,height:326})}),e.jsx("div",{className:ve.info,children:e.jsx("div",{className:ve.data,children:e.jsxs(o.Column,{gap:.25,children:[e.jsx("h3",{className:ve.name,children:f}),e.jsx("p",{className:ve.description,children:x}),e.jsxs(o.Row,{className:ve.price,gap:.5,fullWidth:!0,justifyContent:"space-between",children:[e.jsx("span",{children:j}),!!_&&e.jsx(o.Text,{color:"white",className:ve.volume,children:_})]})]})})}),e.jsx("div",{className:ve.addToCart,children:e.jsx(o.IconButton,{onClick:e=>{if(e.preventDefault(),e.stopPropagation(),(I||y)&&s)return s();m({product:i}),t.trackEvent(A,{name:f,quantity:1})},icon:r.Plus,type:o.UIElementType.DEFAULT})})]})})};var xe={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",choices:"ProductDetails-module_choices__4tHaA",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 je={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":"В заказе"}},Ie=e=>{const{language:t}=j(),n=e||t;return{t:e=>{var t;return(null===(t=je[n])||void 0===t?void 0:t[e])||e}}},ye=()=>{const{cart:e}=he();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 Ce=({isDecreaseDisabled:n=!1,quantity:i=1,size:a="md",onIncrease:l,onDecrease:s})=>e.jsxs(o.Row,{className:t.classNames(Pe,{container:!0},[Pe[a]]),justifyContent:"space-between",gap:0,children:[e.jsx("div",{className:t.classNames(Pe,{quantityAction:!0,isDisabled:n}),onClick:s,children:e.jsx(o.SVGIcon,{icon:r.Minus})}),e.jsx("div",{className:Pe.quantityValue,children:i}),e.jsx("div",{className:Pe.quantityAction,onClick:l,children:e.jsx(o.SVGIcon,{icon:r.Plus})})]});var Ae="ProductInCart-module_container__oSrwq",be="ProductInCart-module_title__Vnc4l";const Ne=({productId:n,onModalClose:i})=>{const{setIsCartOpen:a,removeAllProductVariants:l}=he(),{t:s}=Ie(),d=(e=>{const{cart:n}=he();return t.isEmpty(n)||!e?0:Object.values(n).filter((t=>t.productId===e)).reduce(((e,t)=>e+t.quantity),0)})(n);return d<=0?null:e.jsxs(o.Flex,{className:Ae,fullWidth:!0,justifyContent:"space-between",alignItems:"center",children:[e.jsxs(o.Flex.Item,{flex:1,className:be,children:[s("In order")," (",d,")"]}),e.jsx(o.Flex.Item,{flex:0,children:e.jsxs(o.Row,{children:[e.jsx(o.IconButton,{icon:r.Trash,onClick:()=>{l(n)},type:o.UIElementType.DANGER,tooltip:s("Remove from order")}),e.jsx(o.IconButton,{icon:r.ShoppingBag,onClick:()=>{a(!0),i&&i()},type:o.UIElementType.SUCCESS,tooltip:s("View order")})]})})]})};var Se={container:"ProductVariants-module_container__r059N",variantsTitle:"ProductVariants-module_variantsTitle__G3wTr",variant:"ProductVariants-module_variant__Pk6eP",focused:"ProductVariants-module_focused__tdy2R",flexWide:"ProductVariants-module_flexWide__CQO0G",slidein:"ProductVariants-module_slidein__9xYoM",fadeInOut:"ProductVariants-module_fadeInOut__NcGdX",heightAnimation:"ProductVariants-module_heightAnimation__c7ORS",fadein:"ProductVariants-module_fadein__qqdC5",floatAnimation:"ProductVariants-module_floatAnimation__Fy-NX",bottomSheet:"ProductVariants-module_bottomSheet__JVxKH",slideRightToLeft:"ProductVariants-module_slideRightToLeft__lHsqZ"};const we=({product:r,selectedVariant:i,focusedSection:a,onSelectVariant:l})=>{const{language:s,currency:d}=j(),{t:c}=Ie(),u=n.useRef(null),{variants:m}=r||{},_="variant"===a;return n.useEffect((()=>{_&&u.current&&u.current.scrollIntoView({behavior:"smooth"})}),[a]),e.jsxs(o.Column,{className:t.classNames(Se,{container:!0,focused:_}),gap:1,fullWidth:!0,children:[e.jsx("div",{className:Se.variantsTitle,ref:u,children:c("Product choices")}),(m||[]).map((n=>{const{id:a}=n||{},{formattedTotalPrice:c}=(({variantId:e,currency:n="USD",language:o="en",product:r,quantity:i=1})=>{const a=ae(e,r,i);return{totalPrice:a,formattedTotalPrice:t.priceFormatter(a,n,o)}})({variantId:a,language:s,currency:d,product:r}),{title:u}=le(n,s);return e.jsxs(o.Row,{justifyContent:"space-between",onClick:()=>l(a),className:Se.variant,children:[e.jsx(o.Input,{label:u,name:"variant",onChange:()=>l(a),checked:i===a,type:o.InputType.RADIO,size:"small"}),e.jsx("div",{className:Se.variantPrice,children:c})]},a)}))]})};var Te={container:"ProductAddons-module_container__DRnT7",focused:"ProductAddons-module_focused__KplXf",optionsTitle:"ProductAddons-module_optionsTitle__dE0ee",flexWide:"ProductAddons-module_flexWide__kxcTh",slidein:"ProductAddons-module_slidein__C5osk",fadeInOut:"ProductAddons-module_fadeInOut__Wtu5Z",heightAnimation:"ProductAddons-module_heightAnimation__sA75y",fadein:"ProductAddons-module_fadein__ErDv9",floatAnimation:"ProductAddons-module_floatAnimation__crBUu",bottomSheet:"ProductAddons-module_bottomSheet__Irr5y",slideRightToLeft:"ProductAddons-module_slideRightToLeft__Q-PfS"};const ke=({product:n,selectedAddons:r,onOptionSelect:i})=>{const{language:a,currency:l}=j(),{addons:s}=n||{};return e.jsx(o.Column,{className:Te.container,gap:1.5,fullWidth:!0,children:(s||[]).map((n=>{const{id:s,options:d,selectType:c}=n||{},{title:u}=J(n,a);return e.jsxs(o.Column,{children:[e.jsx(o.Text,{variant:"bold",children:u}),e.jsx(o.Column,{gap:1,fullWidth:!0,children:(d||[]).map((n=>{const{id:d}=n||{},{formattedTotalPrice:u}=(({option:e,currency:n="USD",language:o="en"})=>{const{price:r}=e||{};return{totalPrice:r,formattedTotalPrice:t.priceFormatter(r,n,o)}})({option:n,language:a,currency:l}),{title:m}=ee(n,a),_=c===Z.SINGLE,h=_?r[s]===d:(r[s]||[]).includes(d);return e.jsxs(o.Row,{justifyContent:"space-between",className:Te.option,children:[e.jsx(o.Input,{label:m,name:`option-${s}`,onChange:()=>i({addonId:s,optionId:d,isSingle:_,isRemove:!_&&h}),checked:h,type:_?o.InputType.RADIO:o.InputType.CHECKBOX,size:"small"}),e.jsx("div",{className:Te.optionPrice,children:u})]},d)}))})]},s)}))})},Le=({product:i,onClose:a})=>{const{language:l,currency:s}=j(),{addProduct:d,updateProduct:c}=he(),[m,_]=n.useState(1),[h,g]=n.useState(!1),[p,v]=n.useState(null),[f,x]=n.useState(null),[I,y]=n.useState({}),P=n.useRef(null),{t:C}=Ie(),b=(({productId:e,variantId:n,selectedAddons:o})=>{var r;const{cart:i}=he();return t.isEmpty(i)||!e?0:(null===(r=i[ue(e,n,o)])||void 0===r?void 0:r.quantity)||0})({productId:null==i?void 0:i.id,variantId:p,selectedAddons:I}),{name:N,description:S}=n.useMemo((()=>ne(i,l)),[i,l]),{formattedTotalPrice:w}=n.useMemo((()=>re(i,s,l)),[i,s,l]),{formattedTotalPrice:T}=n.useMemo((()=>(({product:e,variantId:n,quantity:o=1,currency:r,language:i,selectedAddons:a,noVat:l=!1})=>{const{total:s}=se({product:e,variantId:n,quantity:o,selectedAddons:a,noVat:l});return{totalPrice:s,formattedTotalPrice:t.priceFormatter(s,r,i)}})({product:i,quantity:m,language:l,currency:s,variantId:p,selectedAddons:I})),[i,m,l,s,p,I]),k=h?0===m:1===m,L=n.useMemo((()=>C(h?0===m?"Remove from order":"Update order":"Add to order")),[h,m]);n.useEffect((()=>{_(b>0?b:1),g(b>0)}),[b,i]),n.useEffect((()=>{v(null),y({})}),[i]);const R=e=>{-1===e&&k||_((t=>Math.max(0,t+e)))};if(t.isEmpty(i))return null;const{image1024:E,volume:D,variants:O,addons:G}=i,q=(null==O?void 0:O.length)>0,V=(null==G?void 0:G.length)>0;return e.jsx("div",{className:xe.container,onClick:e=>{var t,n;(null===(n=null===(t=null==P?void 0:P.current)||void 0===t?void 0:t.contains)||void 0===n?void 0:n.call(t,null==e?void 0:e.target))||a&&a()},children:e.jsx(o.Modal,{onClose:a,ref:P,noBodyPadding:!0,size:"small",content:e.jsxs("div",{className:xe.content,children:[e.jsxs(o.Column,{gap:0,children:[E&&e.jsx(B,{src:u(E),width:1024,height:400,alt:N||"product",className:xe.image}),e.jsxs(o.Column,{className:xe.details,gap:1,children:[e.jsx("h2",{className:xe.name,children:N}),e.jsxs(o.Row,{justifyContent:"space-between",children:[e.jsx("div",{className:xe.price,children:w}),e.jsx("div",{className:xe.volume,children:D})]}),e.jsx("div",{className:xe.description,children:S})]}),(q||V)&&e.jsxs(o.Column,{gap:0,className:xe.choices,children:[q&&e.jsx(we,{product:i,selectedVariant:p,focusedSection:f,onSelectVariant:v}),V&&e.jsx(ke,{product:i,selectedAddons:I,onOptionSelect:({addonId:e,optionId:t,isSingle:n,isRemove:o=!1})=>{y((r=>{if(n)return Object.assign(Object.assign({},r),{[e]:t});const i=r[e]||[],a=o?i.filter((e=>e!==t)):[...new Set([...i,t])];return Object.assign(Object.assign({},r),{[e]:a})}))}})]})]}),e.jsx("div",{className:xe.close,children:e.jsx(o.IconButton,{onClick:a,icon:r.Close})})]}),footer:e.jsxs(o.Column,{children:[e.jsx(Ne,{productId:null==i?void 0:i.id,onModalClose:a}),e.jsxs(o.Row,{className:xe.addToCart,gap:.5,children:[e.jsx(Ce,{isDecreaseDisabled:k,onDecrease:()=>R(-1),onIncrease:()=>R(1),quantity:m}),e.jsx(o.Button,{className:xe.addAction,label:e.jsxs(o.Row,{fullWidth:!0,justifyContent:"space-between",children:[e.jsx("span",{className:xe.actionTitle,children:L}),e.jsx("span",{children:T})]}),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,selectedAddons:I}):(d({product:i,quantity:m,variantId:p,selectedAddons:I}),t.trackEvent(A,{name:N,quantity:m})),a&&a()},size:"xl",fullWidth:!0})]})]})})})};var Re="Cart-module_container__3KQtx",Ee="Cart-module_content__rkiZa",De={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 Oe=({actionText:n,onClick:r})=>{const i=ye(),{formattedTotalPrice:a}=(()=>{const{cart:e}=he(),{currency:n,language:o}=j(),r=Object.values(e||{}).reduce(((e,t)=>{const{totalPrice:n}=ce(t);return e+n}),0);return{totalPrice:r,formattedTotalPrice:t.priceFormatter(r,n,o)}})();return e.jsxs(o.Flex,{className:t.classNames(De,{container:!0,isClickable:!!r}),justifyContent:"space-between",alignItems:"center",onClick:r,children:[e.jsx(o.Flex.Item,{flex:1,children:e.jsxs(o.Row,{alignItems:"center",children:[e.jsx("div",{className:De.count,children:i}),e.jsx("div",{className:De.actionText,children:n})]})}),e.jsx(o.Flex.Item,{className:De.totalPrice,flex:1,children:a})]})},Ge=()=>{const{setIsCartOpen:t}=he(),{t:n}=Ie();return ye()<=0?null:e.jsx("div",{className:Re,children:e.jsx("div",{className:Ee,children:e.jsx(Oe,{onClick:()=>t(!0),actionText:n("View order")})})})};var qe={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"},Ve="CartItem-module_container__At7lj",We="CartItem-module_image__D-zzG",Be="CartItem-module_data__Lo3Fb",Me="CartItem-module_name__EksZu",ze="CartItem-module_price__yJxl6";const Ue=e=>{var t;const{products:n}=j();return(null===(t=null==n?void 0:n.find)||void 0===t?void 0:t.call(n,(({id:t})=>t===e)))||{}},He=({productId:t,variantId:n,min:o=1,size:r="md",selectedAddons:i})=>{const a=(({productId:e,variantId:t,selectedAddons:n})=>{const{cart:o}=he(),r=o[ue(e,t,n)];return(null==r?void 0:r.quantity)||1})({productId:t,variantId:n,selectedAddons:i}),l=Ue(t),{updateProduct:s}=he(),d=a===o;return e.jsx(Ce,{isDecreaseDisabled:d,onDecrease:()=>s({product:l,quantity:a-1,variantId:n,selectedAddons:i}),onIncrease:()=>s({product:l,quantity:a+1,variantId:n,selectedAddons:i}),quantity:a,size:r})},Fe=({item:n,product:r,language:i})=>{const{selectedAddons:a}=n||{};return e.jsx(e.Fragment,{children:Object.entries(a||{}).map((([n,a])=>{const l=((e,t)=>((null==e?void 0:e.addons)||[]).find((({id:e})=>e===t))||{})(r,Number(n));if(t.isEmpty(l)||t.isEmpty(l.options)||!Array.isArray(l.options))return null;let s="";if(Array.isArray(a)){const e=l.options.filter((({id:e})=>a.includes(e)));if(t.isEmpty(e))return null;s=e.map((e=>{const{title:t}=ee(e,i);return t})).filter(Boolean).join(", ")}else{const e=l.options.find((({id:e})=>e===a));if(t.isEmpty(e))return null;const{title:n}=ee(e,i);s=n}const{title:d}=J(l,i);return e.jsxs(o.Text,{color:"muted",variant:"small",children:[d,": ",s]},n)})).filter(Boolean)})},Qe=({item:t})=>{const{productId:r,variantId:i,selectedAddons:a}=t||{},l=Ue(r),s=ie(l,i),{language:d,currency:c}=j(),{image160:m}=l,{title:_}=le(s,d),{name:h}=n.useMemo((()=>ne(l,d)),[l,d]),{formattedTotalPrice:g}=n.useMemo((()=>ce(t,c,d)),[t,c,d]);return e.jsxs(o.Row,{className:Ve,gap:1,alignItems:"flex-start",children:[m&&e.jsx(B,{src:u(m),alt:h||"menu",className:We,loading:"lazy",width:80,height:45}),e.jsxs("div",{className:Be,children:[e.jsx("div",{className:Me,children:h}),e.jsxs(o.Column,{gap:0,children:[!!_&&e.jsx(o.Text,{color:"muted",variant:"small",children:_}),e.jsx(Fe,{item:t,product:l,language:d})]}),e.jsx("div",{className:ze,children:g})]}),e.jsx(He,{productId:r,variantId:i,selectedAddons:a,size:"sm",min:0})]})},Ye=()=>{const{isCartOpen:r,cart:i,setIsCartOpen:a}=he(),l=n.useRef(null),{t:s}=Ie(),d=t.isEmpty(i),c=()=>a(!1);return r?e.jsx("div",{className:qe.container,onClick:e=>{var t,n;(null===(n=null===(t=null==l?void 0:l.current)||void 0===t?void 0:t.contains)||void 0===n?void 0:n.call(t,null==e?void 0:e.target))||c()},children:e.jsx(o.Drawer,{ref:l,onClose:c,isOpen:r,title:s("Your order"),content:e.jsx("div",{className:qe.content,children:d?e.jsx((()=>e.jsxs(o.Column,{className:qe.noItems,fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",gap:0,children:[e.jsx(o.Text,{variant:"h2",children:s("Empty order")}),e.jsx(o.Description,{text:s("You don't have any items in your order")})]})),{}):e.jsx("div",{className:qe.items,children:Object.keys(i||{}).map((t=>e.jsx(Qe,{item:i[t]},t)))})}),footer:d?e.jsx(o.Button,{label:s("Add items"),onClick:c,type:o.UIElementType.PRIMARY,size:"xl",fullWidth:!0}):e.jsx(Oe,{actionText:s("Subtotal")})})}):null},$e=n.memo((({categoryProductMap:i=[],currency:a,language:l,productBlocksRef:s,containerRef:d,onCategoryInView:c})=>{const[u,m]=n.useState(null),[_,h]=n.useState(de.LIST),g=[{icon:r.List,type:de.LIST},{icon:r.Grid,type:de.GRID}],p=e=>{const{name:n}=ne(e,l);t.trackEvent(C,{name:n}),m(e)};return n.useEffect((()=>{const e=new IntersectionObserver((e=>{var t;const n=((null===(t=null==d?void 0:d.current)||void 0===t?void 0:t.clientHeight)||1e3)/2;let o=null,r=1/0;e.forEach((e=>{if(e.isIntersecting){const t=e.boundingClientRect,i=t.top+t.height/2,a=Math.abs(i-n);a<r&&(r=a,o=e.target.getAttribute("data-category-id"))}})),o&&c(Number(o))}),{threshold:.1});return Object.entries(s.current||{}).forEach((([t,n])=>{n&&(n.setAttribute("data-category-id",t),e.observe(n))})),()=>{e.disconnect()}}),[s,d]),e.jsx(_e,{children:e.jsxs("div",{className:F,children:[e.jsx(o.Row,{className:Q,alignItems:"center",children:g.map((({icon:n,type:r})=>e.jsx(o.IconButton,{icon:n,onClick:()=>(e=>{h(e),t.trackEvent(b,{name:e})})(r),type:r===_?o.UIElementType.PRIMARY:o.UIElementType.DEFAULT},r)))}),e.jsx(o.Column,{children:(i||[]).map((t=>{const{name:n}=S(t,l),{id:r,products:i}=t;return e.jsxs("div",{className:Y,ref:e=>{e&&(s.current[r]=e)},"data-category-id":r,children:[e.jsx("h2",{className:$,children:n}),e.jsx("div",{className:X,children:e.jsx(o.Column,{gap:0,children:(i||[]).map((t=>_===de.GRID?e.jsx(fe,{product:t,currency:a,language:l,onClick:()=>p(t)},t.id):e.jsx(pe,{product:t,currency:a,language:l,onClick:()=>p(t)},t.id)))})})]},r)}))}),e.jsx(Le,{product:u,onClose:()=>m(null)}),e.jsx(Ge,{}),e.jsx(Ye,{})]})})}),((e,t)=>e.categoryProductMap===t.categoryProductMap&&e.currency===t.currency&&e.language===t.language));$e.displayName="Products";var Xe="Branches-module_branches__sOuoV",Ke="Branches-module_list__vYoT2",Ze="Branches-module_name__K0Z-4";const Je=({branches:t=[],rootPath:n="",onBranchSelect:r})=>{const i=({children:t,id:o})=>r?e.jsx("div",{onClick:()=>r(o),children:t}):e.jsx("a",{href:`${n}/${o}`,children:t});return e.jsx("div",{className:Xe,children:e.jsx(o.Container,{className:Ke,children:t.map((({id:t,name:n})=>e.jsx(i,{id:t,children:e.jsx(o.Card,{noBottomMargin:!0,children:e.jsx(o.Flex,{justifyContent:"center",alignItems:"center",fullHeight:!0,children:e.jsx("h2",{className:Ze,children:n})})})},t)))})})},et=({data:o})=>{var r;const{name:i,coverImage:s,logoImage:c,branches:u=[],branchId:h,language:g,categories:f,products:x,currency:j,instagram:I,facebook:y,whatsapp:C,telegram:A,tiktok:b,rootPath:N,hostname:w,onBranchSelect:T}=o||{},k=u.length<=1,L=((e,t)=>{const n=t.reduce(((e,t)=>{const n=Number(t.categoryId);return e[n]||(e[n]=[]),e[n].push(t),e}),{});return e.map((e=>Object.assign(Object.assign({},e),{products:n[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 k?(null===(e=null==u?void 0:u[0])||void 0===e?void 0:e.id)?u[0]:{}:u.find((e=>e.id===Number(h)))})(),E=k||!(null==R?void 0:R.name)?i:(null==R?void 0:R.name)||"",[D,O]=n.useState(null===(r=null==f?void 0:f[0])||void 0===r?void 0:r.id),G=n.useRef({}),q=n.useRef(null),V=n.useRef(!0),{url:W,domain:B}=((e,t)=>{const n=v.includes(e)?e:p;return{url:`https://${n}/${t||"en"}`,domain:n}})(w,g);return e.jsxs("div",{className:l,ref:q,children:[e.jsx(U,{branch:R,name:E,coverImage:_(s),logoImage:m(c),instagram:I,facebook:y,whatsapp:C,telegram:A,tiktok:b}),k||h?e.jsxs(e.Fragment,{children:[e.jsx(H,{categoryProductMap:L,language:g,selectedCategoryId:D,onSelectCategory:e=>a(void 0,void 0,void 0,(function*(){V.current=!1,O(e),(e=>{var t;const n=null===(t=null==G?void 0:G.current)||void 0===t?void 0:t[e];n&&(setTimeout((()=>{n.scrollIntoView({behavior:"smooth",block:"start"})}),100),setTimeout((()=>{V.current=!0}),1e3))})(e)}))}),e.jsx($e,{currency:j,language:g,productBlocksRef:G,containerRef:q,categoryProductMap:L,onCategoryInView:e=>{if(!(null==V?void 0:V.current))return;const n=((e,n,o)=>{var r;const i=null===(r=null==n?void 0:n.find)||void 0===r?void 0:r.call(n,(({id:t})=>t===e));if(t.isEmpty(i))return"";const{name:a}=S(i,o);return a})(e,f,g);t.trackEvent(P,{name:n}),O(e)}})]}):e.jsx(Je,{branches:u,onBranchSelect:T,rootPath:N}),!!w&&e.jsx("a",{rel:"noopener noreferrer",target:"_blank",href:W,className:d,children:B})]})};var tt={};const nt=({currentGoal:t,language:r,setGoal:i})=>{const{t:a}=Ie(r),l=n.useRef({}),s=e=>{switch(e){case P:return a("Scrolled to Category");case y:return a("Category Selected");case C:return a("Product Details");case A:return a("Product Added to Cart");default:return""}},d=n.useCallback((e=>{var t,n;i(e),null===(n=null===(t=null==l?void 0:l.current)||void 0===t?void 0:t.close)||void 0===n||n.call(t)}),[i]);return e.jsx(o.DropDown,{action:s(t),actionSize:"large",type:o.UIElementType.BORDERED_PRIMARY,closeRef:l,menu:e.jsx("div",{className:tt.toolbarMenu,children:N.map((t=>e.jsx(o.DropDownMenuItem,{onClick:()=>d(t),children:s(t)},t)))})})};exports.Events=({data:t,isLoading:n=!1,loadingImage:r,language:i,goal:a,setGoal:l})=>{const{t:s}=Ie(i);return e.jsx(o.Card,{title:s("Events"),toolbar:e.jsx(nt,{language:i,currentGoal:a,setGoal:l}),children:n?e.jsx(o.Loading,{image:r}):e.jsx(o.BarChart,{data:t})})},exports.PublicMenu=({data:t})=>e.jsx(x,{value:t,children:e.jsx(et,{data:t})});
|
|
2
2
|
//# sourceMappingURL=index.js.map
|