@restaround/react 1.0.46 → 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/components/Events/Events.d.ts +11 -0
- package/dist/components/Events/EventsToolbar.d.ts +7 -0
- package/dist/components/Events/index.d.ts +1 -0
- package/dist/constants/analytics.d.ts +5 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/translations.d.ts +10 -0
- package/dist/hooks/category.d.ts +1 -0
- package/dist/hooks/translation.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles/ui.css +1 -1
- package/dist/styles/ui.css.map +1 -1
- package/dist/utils/category.d.ts +1 -0
- 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/utils/category.d.ts +1 -0
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react"),a=require("@sorocraft/js-utils"),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=t.createContext({}),x=({children:t,value:r})=>{const i=a.isEmpty(r)?{}:r;return i.currency||i.currency,i.language||i.language,e.jsx(f.Provider,{value:a.isEmpty(r)?{}:r,children:t})},j=()=>t.useContext(f);var y="Header-module_container__tenlF",b="Header-module_cover__BAWZK",C="Header-module_content__Gx4Al",I="Header-module_logo__4MTCm",P="Header-module_info__IchYA",w="Header-module_name__30wyw",A="Header-module_address__WOxXc",N="Header-module_addressText__lUszI",O="Header-module_social__AoP0z",k="Header-module_links__EeQxg",S="Header-module_wifiPassword__VWBTa",L="Header-module_wifiPasswordIcon__Ukn3D";const T=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 D={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 R=()=>{var a;const{language:i,languages:n,onLanguageSelect:o}=j(),[s,l]=t.useState(!1),d=(null==n?void 0:n.length)>1,c=(null===(a=null==n?void 0:n.filter)||void 0===a?void 0:a.call(n,(({code:e})=>e!==i)))||[],u=e=>`https://images.restaround.co/languages/${e}.svg`;return d?e.jsx("div",{className:D.container,onClick:()=>l(!s),children:e.jsxs(r.Row,{alignItems:"center",gap:0,children:[e.jsx(r.Row,{alignItems:"center",className:r.classNames(D,{options:!0,isOpen:s}),children:c.map((({code:t})=>e.jsx("img",{src:u(t),className:D.option,onClick:()=>(e=>{o&&o(e)})(t),alt:t},t)))}),e.jsx("img",{src:u(i),alt:i||"",className:D.currentLanguage})]})}):null},z=({branch:t,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}=t||{},f=a.isEmpty(t),x=`https://www.google.com/maps/place/${h},${g}`;return e.jsxs("div",{className:y,children:[e.jsx(T,{src:n,alt:s,className:b,width:1024,height:400,priority:!0,sizes:"100vw",fetchPriority:"high",loading:"eager"}),e.jsx("div",{className:C,children:f?e.jsx((()=>e.jsxs(r.Column,{fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",children:[e.jsx(T,{src:o,alt:s,className:I,width:96,height:96}),e.jsx("div",{className:P,children:e.jsx("h1",{className:w,children:s})})]})),{}):e.jsx((()=>e.jsxs(r.Flex,{direction:"row",gap:1,alignItems:"center",children:[e.jsx(r.Flex.Item,{children:e.jsx(T,{src:o,alt:s,className:I,width:96,height:96})}),e.jsx(r.Flex.Item,{shrink:!0,children:e.jsx("div",{className:P,children:e.jsxs(r.Column,{gap:.25,children:[e.jsx("h1",{className:w,children:s}),e.jsx("a",{className:A,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:N,children:_})]})})]})})})]})),{})}),e.jsx(R,{}),!f&&e.jsx("div",{className:O,children:e.jsx("div",{className:k,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:S,children:e.jsx(r.SVGIcon,{icon:i.Wifi,size:"sm",className:L})})})]})})})})]})},E=({categoryProductMap:a=[],language:i,selectedCategoryId:n,onSelectCategory:o})=>{const s=t.useRef({}),d=t.useRef(null);return t.useEffect((()=>{n&&(()=>{var e;const t=null===(e=null==s?void 0:s.current)||void 0===e?void 0:e[n];if(!t||!d.current)return;const a=d.current.clientWidth,r=t.offsetLeft-a/2+t.offsetWidth/2;d.current.scrollTo({left:r,behavior:"smooth"})})()}),[n]),e.jsx("div",{className:l,children:e.jsx(r.Carousel,{gap:1,onGetRef:e=>{(null==e?void 0:e.current)&&(d.current=e.current)},children:(a||[]).map((({id:t,translations:a})=>{const{name:l}=a.find((e=>e.language===i))||{};return e.jsx(r.CarouselItem,{children:e.jsx(r.Chip,{onClick:()=>(e=>{e!==n&&o(e)})(t),type:r.UIElementType.BORDERED_PRIMARY,active:t===n,children:e.jsx("div",{ref:e=>s.current[t]=e,children:l})})},t)}))})})};var W="Products-module_container__bF2LF",M="Products-module_products__AoDrY",Q="Products-module_category__Sp7dE",F="Products-module_list__LH4v5";const B=t.createContext({cart:{},isCartOpen:!1,addProduct:()=>{},updateProduct:()=>{},setIsCartOpen:()=>{}}),H=({children:r})=>{const[i,o]=t.useState({}),[s,l]=t.useState(!1),d=(e,t,r)=>{if(a.isEmpty(e)||t<0)return;const{id:i,price:s,vat:l=0}=e;o((e=>{const a=e[i],o=r?((null==a?void 0:a.quantity)||0)+t:t;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=t.useMemo((()=>({cart:i,isCartOpen:s,addProduct:c,updateProduct:u,setIsCartOpen:l})),[i,s]);return e.jsx(B.Provider,{value:m,children:r})},q=()=>t.useContext(B);var Y={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 U=(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)))||{}},V=(e,t,a=0)=>e*t*(1+a/100),G=(e,t,r,i=1)=>{const{price:n,vat:o}=e||{},s=V(n,i,o);return{totalPrice:s,formattedTotalPrice:a.priceFormatter(s,t,r)}},$=({product:n,currency:o,language:s,onClick:l})=>{const{addProduct:d}=q(),{image160:c,volume:m}=n||{},{name:_,description:h}=t.useMemo((()=>U(n,s)),[n,s]),{formattedTotalPrice:g}=t.useMemo((()=>G(n,o,s)),[n,o,s]);return e.jsxs("div",{className:a.classNames(Y,{container:!0,isClickable:!!l}),onClick:l,children:[e.jsxs(r.Row,{justifyContent:"space-between",gap:0,children:[e.jsx("div",{className:Y.data,children:e.jsxs(r.Column,{gap:.25,children:[e.jsx("h3",{className:Y.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:Y.description,children:h}),e.jsx("div",{className:Y.price,children:g})]})}),c&&e.jsx(T,{src:u(c),alt:_||"menu",className:Y.image,loading:"lazy",width:160,height:90})]}),e.jsx("div",{className:Y.addToCart,children:e.jsx(r.IconButton,{onClick:e=>{e.preventDefault(),e.stopPropagation(),d(n)},icon:i.Plus,type:r.UIElementType.DEFAULT})})]})};var Z={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 K={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:"Итого"}},X=()=>{const{language:e}=j();return{t:t=>{var a;return(null===(a=K[e])||void 0===a?void 0:a[t])||t}}},J=()=>{const{cart:e}=q();return Object.values(e||{}).reduce(((e,t)=>e+t.quantity),0)};var ee={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 te=({isDecreaseDisabled:t=!1,quantity:n=1,size:o="md",onIncrease:s,onDecrease:l})=>e.jsxs(r.Row,{className:a.classNames(ee,{container:!0},[ee[o]]),justifyContent:"space-between",gap:0,children:[e.jsx("div",{className:a.classNames(ee,{quantityAction:!0,isDisabled:t}),onClick:l,children:e.jsx(r.SVGIcon,{icon:i.Minus})}),e.jsx("div",{className:ee.quantityValue,children:n}),e.jsx("div",{className:ee.quantityAction,onClick:s,children:e.jsx(r.SVGIcon,{icon:i.Plus})})]}),ae=({product:n,onClose:o})=>{const{language:s,currency:l}=j(),{addProduct:d,updateProduct:c}=q(),[m,_]=t.useState(1),[h,g]=t.useState(!1),p=t.useRef(),{t:v}=X(),f=(e=>{var t;const{cart:r}=q();return a.isEmpty(r)||!e?0:(null===(t=r[e])||void 0===t?void 0:t.quantity)||0})(null==n?void 0:n.id),{name:x,description:y}=t.useMemo((()=>U(n,s)),[n,s]),{totalPrice:b,formattedTotalPrice:C}=t.useMemo((()=>G(n,l,s)),[n,l,s]),I=t.useMemo((()=>m*b),[m,b]),P=t.useMemo((()=>a.priceFormatter(I,l,s)),[I,l,s]),w=h?0===m:1===m,A=t.useMemo((()=>v(h?0===m?"removeFromOrder":"updateOrder":"addToOrder")),[h,m]);t.useEffect((()=>{_(f>0?f:1),g(f>0)}),[f,n]);const N=e=>{-1===e&&w||_((t=>Math.max(0,t+e)))};if(a.isEmpty(n))return null;const{image1024:O,volume:k}=n;return e.jsx("div",{className:Z.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:Z.content,children:[e.jsxs(r.Column,{gap:0,children:[O&&e.jsx(T,{src:u(O),width:1024,height:400,alt:x||"product",className:Z.image}),e.jsxs(r.Column,{className:Z.details,gap:1,children:[e.jsx("h2",{className:Z.name,children:x}),e.jsxs(r.Row,{justifyContent:"space-between",children:[e.jsx("div",{className:Z.price,children:C}),e.jsx("div",{className:Z.volume,children:k})]}),e.jsx("div",{className:Z.description,children:y})]})]}),e.jsx("div",{className:Z.close,children:e.jsx(r.IconButton,{onClick:o,icon:i.Close})})]}),footer:e.jsxs(r.Row,{className:Z.addToCart,gap:.5,children:[e.jsx(te,{isDecreaseDisabled:w,onDecrease:()=>N(-1),onIncrease:()=>N(1),quantity:m}),e.jsx(r.Button,{className:Z.addAction,label:e.jsxs(r.Row,{fullWidth:!0,justifyContent:"space-between",children:[e.jsx("span",{className:Z.actionTitle,children:A}),e.jsx("span",{children:P})]}),onClick:()=>{h?c(n,m):d(n,m),o&&o()},size:"xl",fullWidth:!0})]})})})};var re="Cart-module_container__3KQtx",ie="Cart-module_content__rkiZa",ne={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:t,onClick:i})=>{const n=J(),{formattedTotalPrice:o}=(()=>{const{cart:e}=q(),{currency:t,language:r}=j(),i=Object.values(e||{}).reduce(((e,{price:t,quantity:a,vat:r})=>e+V(t,a,r)),0);return{totalPrice:i,formattedTotalPrice:a.priceFormatter(i,t,r)}})();return e.jsxs(r.Flex,{className:a.classNames(ne,{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:ne.count,children:n}),e.jsx("div",{className:ne.actionText,children:t})]})}),e.jsx(r.Flex.Item,{className:ne.totalPrice,flex:1,children:o})]})},se=()=>{const{setIsCartOpen:t}=q(),{t:a}=X();return J()<=0?null:e.jsx("div",{className:re,children:e.jsx("div",{className:ie,children:e.jsx(oe,{onClick:()=>t(!0),actionText:a("viewOrder")})})})};var le={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"},de="CartItem-module_container__At7lj",ce="CartItem-module_image__D-zzG",ue="CartItem-module_data__Lo3Fb",me="CartItem-module_name__EksZu",_e="CartItem-module_price__yJxl6";const he=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)))||{}},ge=({productId:t,min:a=1,size:r="md"})=>{const i=(e=>{const{cart:t}=q(),a=t[e];return(null==a?void 0:a.quantity)||1})(t),n=he(t),{updateProduct:o}=q(),s=i===a;return e.jsx(te,{isDecreaseDisabled:s,onDecrease:()=>o(n,i-1),onIncrease:()=>o(n,i+1),quantity:i,size:r})},pe=({item:a})=>{const{productId:i,quantity:n}=a||{},o=he(i),{language:s,currency:l}=j(),{image160:d}=o,{name:c}=t.useMemo((()=>U(o,s)),[o,s]),{formattedTotalPrice:m}=t.useMemo((()=>G(o,l,s,n)),[o,l,s,n]);return e.jsxs(r.Row,{className:de,gap:1,alignItems:"center",children:[d&&e.jsx(T,{src:u(d),alt:c||"menu",className:ce,loading:"lazy",width:80,height:45}),e.jsxs("div",{className:ue,children:[e.jsx("div",{className:me,children:c}),e.jsx("div",{className:_e,children:m})]}),e.jsx(ge,{productId:i,size:"sm",min:0})]})},ve=()=>{const{isCartOpen:i,cart:n,setIsCartOpen:o}=q(),s=t.useRef(),{t:l}=X(),d=a.isEmpty(n),c=()=>o(!1);return i?e.jsx("div",{className:le.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:le.content,children:d?e.jsx((()=>e.jsxs(r.Column,{className:le.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:le.items,children:Object.keys(n||{}).map((t=>e.jsx(pe,{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(oe,{actionText:l("Subtotal")})})}):null},fe=t.memo((({categoryProductMap:a=[],currency:i,language:n,productBlocksRef:o,containerRef:s,onCategoryInView:l})=>{const[d,c]=t.useState(null);return t.useEffect((()=>{const e=new IntersectionObserver((e=>{var t;const a=((null===(t=null==s?void 0:s.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&&l(Number(r))}),{threshold:.5});return Object.entries(o.current||{}).forEach((([t,a])=>{a&&(a.setAttribute("data-category-id",t),e.observe(a))})),()=>{e.disconnect()}}),[o,s]),e.jsx(H,{children:e.jsxs("div",{className:W,children:[e.jsx(r.Column,{children:(a||[]).map((t=>{const{name: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)))||{}})(t,n),{id:s,products:l}=t;return e.jsxs("div",{className:M,ref:e=>o.current[s]=e,"data-category-id":s,children:[e.jsx("h2",{className:Q,children:a}),e.jsx("div",{className:F,children:e.jsx(r.Column,{gap:0,children:(l||[]).map((t=>e.jsx($,{product:t,currency:i,language:n,onClick:()=>c(t)},t.id)))})})]},s)}))}),e.jsx(ae,{product:d,onClose:()=>c(null)}),e.jsx(se,{}),e.jsx(ve,{})]})})}),((e,t)=>e.categoryProductMap===t.categoryProductMap&&e.currency===t.currency&&e.language===t.language));var xe="Branches-module_branches__sOuoV",je="Branches-module_list__vYoT2",ye="Branches-module_name__K0Z-4";const be=({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:xe,children:e.jsx(r.Container,{className:je,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:ye,children:a})})})},t)))})})},Ce=({data:a})=>{var r;const{name:i,coverImage:n,logoImage:l,branches:c=[],branchId:u,language:h,categories:g,products:f,currency:x,instagram:j,facebook:y,whatsapp:b,telegram:C,tiktok:I,rootPath:P,hostname:w,onBranchSelect:A}=a||{},N=c.length<=1,O=((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}))})(g,f),k=(()=>{var e;return N?(null===(e=null==c?void 0:c[0])||void 0===e?void 0:e.id)?c[0]:{}:c.find((e=>e.id===Number(u)))})(),S=N||!(null==k?void 0:k.name)?i:(null==k?void 0:k.name)||"",[L,T]=t.useState(null===(r=null==g?void 0:g[0])||void 0===r?void 0:r.id),D=t.useRef({}),R=t.useRef(null),W=t.useRef(!0),{url:M,domain:Q}=((e,t)=>{const a=v.includes(e)?e:p;return{url:`https://${a}/${t||"en"}`,domain:a}})(w,h);return e.jsxs("div",{className:s,ref:R,children:[e.jsx(z,{branch:k,name:S,coverImage:_(n),logoImage:m(l),instagram:j,facebook:y,whatsapp:b,telegram:C,tiktok:I}),N||u?e.jsxs(e.Fragment,{children:[e.jsx(E,{categoryProductMap:O,language:h,selectedCategoryId:L,onSelectCategory:e=>o(void 0,void 0,void 0,(function*(){W.current=!1,T(e),(e=>{var t;const a=null===(t=null==D?void 0:D.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(fe,{currency:x,language:h,productBlocksRef:D,containerRef:R,categoryProductMap:O,onCategoryInView:e=>{(null==W?void 0:W.current)&&T(e)}})]}):e.jsx(be,{branches:c,onBranchSelect:A,rootPath:P}),!!w&&e.jsx("a",{rel:"noopener",target:"_blank",href:M,className:d,children:Q})]})};exports.PublicMenu=({data:t})=>e.jsx(x,{value:t,children:e.jsx(Ce,{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
|