@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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BarChartData } from "@sorocraft/ui";
|
|
2
|
+
interface Props {
|
|
3
|
+
data: BarChartData[];
|
|
4
|
+
isLoading?: boolean;
|
|
5
|
+
loadingImage?: string;
|
|
6
|
+
language?: string;
|
|
7
|
+
goal: string;
|
|
8
|
+
setGoal: (goal: string) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const Events: ({ data, isLoading, loadingImage, language, goal, setGoal }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default Events;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Events";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const CATEGORY_SELECTED = "digital_menu_category_select";
|
|
2
|
+
export declare const CATEGORY_SCROLLED = "digital_menu_category_scroll";
|
|
3
|
+
export declare const PRODUCT_DETAILS = "digital_menu_product_details";
|
|
4
|
+
export declare const PRODUCT_ADD_CART = "digital_menu_product_add_cart";
|
|
5
|
+
export declare const GOALS: string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./analytics";
|
|
@@ -15,6 +15,11 @@ export declare const translations: {
|
|
|
15
15
|
"Empty order": string;
|
|
16
16
|
"You don't have any items in your order": string;
|
|
17
17
|
"Add items": string;
|
|
18
|
+
Events: string;
|
|
19
|
+
"Scrolled to Category": string;
|
|
20
|
+
"Category Selected": string;
|
|
21
|
+
"Product Details": string;
|
|
22
|
+
"Product Added to Cart": string;
|
|
18
23
|
};
|
|
19
24
|
tr: {
|
|
20
25
|
viewOrder: string;
|
|
@@ -26,6 +31,7 @@ export declare const translations: {
|
|
|
26
31
|
"You don't have any items in your order": string;
|
|
27
32
|
"Add items": string;
|
|
28
33
|
Subtotal: string;
|
|
34
|
+
Events: string;
|
|
29
35
|
};
|
|
30
36
|
nl: {
|
|
31
37
|
viewOrder: string;
|
|
@@ -37,6 +43,7 @@ export declare const translations: {
|
|
|
37
43
|
"You don't have any items in your order": string;
|
|
38
44
|
"Add items": string;
|
|
39
45
|
Subtotal: string;
|
|
46
|
+
Events: string;
|
|
40
47
|
};
|
|
41
48
|
et: {
|
|
42
49
|
viewOrder: string;
|
|
@@ -48,6 +55,7 @@ export declare const translations: {
|
|
|
48
55
|
"You don't have any items in your order": string;
|
|
49
56
|
"Add items": string;
|
|
50
57
|
Subtotal: string;
|
|
58
|
+
Events: string;
|
|
51
59
|
};
|
|
52
60
|
pl: {
|
|
53
61
|
viewOrder: string;
|
|
@@ -59,6 +67,7 @@ export declare const translations: {
|
|
|
59
67
|
"You don't have any items in your order": string;
|
|
60
68
|
"Add items": string;
|
|
61
69
|
Subtotal: string;
|
|
70
|
+
Events: string;
|
|
62
71
|
};
|
|
63
72
|
ru: {
|
|
64
73
|
viewOrder: string;
|
|
@@ -70,5 +79,6 @@ export declare const translations: {
|
|
|
70
79
|
"You don't have any items in your order": string;
|
|
71
80
|
"Add items": string;
|
|
72
81
|
Subtotal: string;
|
|
82
|
+
Events: string;
|
|
73
83
|
};
|
|
74
84
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useCategoryNameById: (categoryId: number) => string;
|
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import{createContext as a,useContext as i,useState as n,useRef as o,useEffect as l,useMemo as d,memo as c}from"react";import{isEmpty as s,priceFormatter as u,classNames as m}from"@sorocraft/js-utils";import{Row as _,classNames as h,IconLink as g,Tooltip as p,SVGIcon as v,Flex as f,Column as y,Carousel as b,CarouselItem as C,Chip as P,UIElementType as I,IconButton as A,Modal as N,Button as w,Drawer as O,Text as k,Description as L,Container as S,Card as D}from"@sorocraft/ui";import{Phone as T,Whatsapp as z,Instagram as j,Telegram as x,Tiktok as R,Facebook as Q,Wifi as W,MarkerPin as H,Plus as B,Minus as E,Close as q}from"@sorocraft/ui/icons";function Y(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)t.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(r[a[i]]=e[a[i]])}return r}function M(e,t,r,a){return new(r||(r=Promise))((function(i,n){function o(e){try{d(a.next(e))}catch(e){n(e)}}function l(e){try{d(a.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,l)}d((a=a.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var F="PublicMenu-module_container__QLN6U",U="PublicMenu-module_categories__Iy6NC",V="PublicMenu-module_footer__6G3DQ";const $="https://images.restaround.co",G=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${$}/${e}`:"",Z=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${$}/${e}`:"https://images.restaround.co/no-photo-128.webp",K=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${$}/${e}`:"https://images.restaround.co/restaround-doodle.webp",X="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",J=(e,t,r)=>X.charAt(e>>2)+X.charAt((3&e)<<4|t>>4)+X.charAt((15&t)<<2|r>>6)+X.charAt(63&r),ee="restaround.co",te=[ee,"restaround.az","restaround.ee","restaround.nl"],re=a({}),ae=({children:t,value:r})=>{const a=s(r)?{}:r;return a.currency||a.currency,a.language||a.language,e(re.Provider,{value:s(r)?{}:r,children:t})},ie=()=>i(re);var ne="Header-module_container__tenlF",oe="Header-module_cover__BAWZK",le="Header-module_content__Gx4Al",de="Header-module_logo__4MTCm",ce="Header-module_info__IchYA",se="Header-module_name__30wyw",ue="Header-module_address__WOxXc",me="Header-module_addressText__lUszI",_e="Header-module_social__AoP0z",he="Header-module_links__EeQxg",ge="Header-module_wifiPassword__VWBTa",pe="Header-module_wifiPasswordIcon__Ukn3D";const ve=t=>{const r=Y(t,["priority","blurDataURL","quality","placeholder","fetchPriority"]),{imageTag:a}=ie()||{};if(a){return e(a,Object.assign({},t,{quality:t.quality||100,placeholder:"blur",blurDataURL:(i=235,n=59,o=90,`data:image/gif;base64,R0lGODlhAQABAPAA${J(0,i,n)+J(o,255,255)}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`)}))}var i,n,o;return e("img",Object.assign({},r))};var fe={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 ye=()=>{var r;const{language:a,languages:i,onLanguageSelect:o}=ie(),[l,d]=n(!1),c=(null==i?void 0:i.length)>1,s=(null===(r=null==i?void 0:i.filter)||void 0===r?void 0:r.call(i,(({code:e})=>e!==a)))||[],u=e=>`https://images.restaround.co/languages/${e}.svg`;return c?e("div",{className:fe.container,onClick:()=>d(!l),children:t(_,{alignItems:"center",gap:0,children:[e(_,{alignItems:"center",className:h(fe,{options:!0,isOpen:l}),children:s.map((({code:t})=>e("img",{src:u(t),className:fe.option,onClick:()=>(e=>{o&&o(e)})(t),alt:t},t)))}),e("img",{src:u(a),alt:a||"",className:fe.currentLanguage})]})}):null},be=({branch:r,coverImage:a,logoImage:i,name:n,instagram:o,facebook:l,whatsapp:d,telegram:c,tiktok:u})=>{const{address:m,latitude:h,longitude:b,phone:C,wifiPassword:P}=r||{},I=s(r),A=`https://www.google.com/maps/place/${h},${b}`;return t("div",{className:ne,children:[e(ve,{src:a,alt:n,className:oe,width:1024,height:400,priority:!0,sizes:"100vw",fetchPriority:"high",loading:"eager"}),e("div",{className:le,children:e(I?()=>t(y,{fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",children:[e(ve,{src:i,alt:n,className:de,width:96,height:96}),e("div",{className:ce,children:e("h1",{className:se,children:n})})]}):()=>t(f,{direction:"row",gap:1,alignItems:"center",children:[e(f.Item,{children:e(ve,{src:i,alt:n,className:de,width:96,height:96})}),e(f.Item,{shrink:!0,children:e("div",{className:ce,children:t(y,{gap:.25,children:[e("h1",{className:se,children:n}),e("a",{className:ue,href:A,target:"_blank",rel:"noopener noreferrer",children:t(_,{alignItems:"center",gap:.5,children:[e(v,{icon:H,theme:"dark"}),e("span",{className:me,children:m})]})})]})})})]}),{})}),e(ye,{}),!I&&e("div",{className:_e,children:e("div",{className:he,children:e(_,{gap:2,alignItems:"center",children:t(_,{alignItems:"center",justifyContent:"center",gap:.5,children:[!!C&&e(g,{icon:T,href:`tel:+${C}`,size:"sm",shape:"circle",theme:"light"}),!!d&&e(g,{icon:z,href:`https://wa.me/${d}`,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!o&&e(g,{icon:j,href:o,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!c&&e(g,{icon:x,href:c,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!u&&e(g,{icon:R,href:u,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!l&&e(g,{icon:Q,href:l,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!P&&e(p,{hint:P,children:e("div",{className:ge,children:e(v,{icon:W,size:"sm",className:pe})})})]})})})})]})},Ce=({categoryProductMap:t=[],language:r,selectedCategoryId:a,onSelectCategory:i})=>{const n=o({}),d=o(null);return l((()=>{a&&(()=>{var e;const t=null===(e=null==n?void 0:n.current)||void 0===e?void 0:e[a];if(!t||!d.current)return;const r=d.current.clientWidth,i=t.offsetLeft-r/2+t.offsetWidth/2;d.current.scrollTo({left:i,behavior:"smooth"})})()}),[a]),e("div",{className:U,children:e(b,{gap:1,onGetRef:e=>{(null==e?void 0:e.current)&&(d.current=e.current)},children:(t||[]).map((({id:t,translations:o})=>{const{name:l}=o.find((e=>e.language===r))||{};return e(C,{children:e(P,{onClick:()=>(e=>{e!==a&&i(e)})(t),type:I.BORDERED_PRIMARY,active:t===a,children:e("div",{ref:e=>n.current[t]=e,children:l})})},t)}))})})};var Pe="Products-module_container__bF2LF",Ie="Products-module_products__AoDrY",Ae="Products-module_category__Sp7dE",Ne="Products-module_list__LH4v5";const we=a({cart:{},isCartOpen:!1,addProduct:()=>{},updateProduct:()=>{},setIsCartOpen:()=>{}}),Oe=({children:t})=>{const[r,a]=n({}),[i,o]=n(!1),l=(e,t,r)=>{if(s(e)||t<0)return;const{id:i,price:n,vat:o=0}=e;a((e=>{const a=e[i],l=r?((null==a?void 0:a.quantity)||0)+t:t;if(l<=0){const t=e,r=i;t[r];return Y(t,["symbol"==typeof r?r:r+""])}return Object.assign(Object.assign({},e),{[i]:{productId:i,price:n,quantity:l,vat:o}})}))},c=(e,t=1)=>l(e,t,!0),u=(e,t=1)=>l(e,t,!1),m=d((()=>({cart:r,isCartOpen:i,addProduct:c,updateProduct:u,setIsCartOpen:o})),[r,i]);return e(we.Provider,{value:m,children:t})},ke=()=>i(we);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=(e,t)=>{var r,a;return(null===(a=null===(r=null==e?void 0:e.translations)||void 0===r?void 0:r.find)||void 0===a?void 0:a.call(r,(e=>e.language===t)))||{}},De=(e,t,r=0)=>e*t*(1+r/100),Te=(e,t,r,a=1)=>{const{price:i,vat:n}=e||{},o=De(i,a,n);return{totalPrice:o,formattedTotalPrice:u(o,t,r)}},ze=({product:r,currency:a,language:i,onClick:n})=>{const{addProduct:o}=ke(),{image160:l,volume:c}=r||{},{name:s,description:u}=d((()=>Se(r,i)),[r,i]),{formattedTotalPrice:h}=d((()=>Te(r,a,i)),[r,a,i]);return t("div",{className:m(Le,{container:!0,isClickable:!!n}),onClick:n,children:[t(_,{justifyContent:"space-between",gap:0,children:[e("div",{className:Le.data,children:t(y,{gap:.25,children:[e("h3",{className:Le.name,children:t(_,{gap:.5,fullWidth:!0,children:[e("span",{children:s}),!!c&&t("span",{children:["(",c,")"]})]})}),e("div",{className:Le.description,children:u}),e("div",{className:Le.price,children:h})]})}),l&&e(ve,{src:G(l),alt:s||"menu",className:Le.image,loading:"lazy",width:160,height:90})]}),e("div",{className:Le.addToCart,children:e(A,{onClick:e=>{e.preventDefault(),e.stopPropagation(),o(r)},icon:B,type:I.DEFAULT})})]})};var je={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 xe={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:"Итого"}},Re=()=>{const{language:e}=ie();return{t:t=>{var r;return(null===(r=xe[e])||void 0===r?void 0:r[t])||t}}},Qe=()=>{const{cart:e}=ke();return Object.values(e||{}).reduce(((e,t)=>e+t.quantity),0)};var We={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 He=({isDecreaseDisabled:r=!1,quantity:a=1,size:i="md",onIncrease:n,onDecrease:o})=>t(_,{className:m(We,{container:!0},[We[i]]),justifyContent:"space-between",gap:0,children:[e("div",{className:m(We,{quantityAction:!0,isDisabled:r}),onClick:o,children:e(v,{icon:E})}),e("div",{className:We.quantityValue,children:a}),e("div",{className:We.quantityAction,onClick:n,children:e(v,{icon:B})})]}),Be=({product:r,onClose:a})=>{const{language:i,currency:c}=ie(),{addProduct:m,updateProduct:h}=ke(),[g,p]=n(1),[v,f]=n(!1),b=o(),{t:C}=Re(),P=(e=>{var t;const{cart:r}=ke();return s(r)||!e?0:(null===(t=r[e])||void 0===t?void 0:t.quantity)||0})(null==r?void 0:r.id),{name:I,description:O}=d((()=>Se(r,i)),[r,i]),{totalPrice:k,formattedTotalPrice:L}=d((()=>Te(r,c,i)),[r,c,i]),S=d((()=>g*k),[g,k]),D=d((()=>u(S,c,i)),[S,c,i]),T=v?0===g:1===g,z=d((()=>C(v?0===g?"removeFromOrder":"updateOrder":"addToOrder")),[v,g]);l((()=>{p(P>0?P:1),f(P>0)}),[P,r]);const j=e=>{-1===e&&T||p((t=>Math.max(0,t+e)))};if(s(r))return null;const{image1024:x,volume:R}=r;return e("div",{className:je.container,onClick:e=>{var t,r;(null===(r=null===(t=null==b?void 0:b.current)||void 0===t?void 0:t.contains)||void 0===r?void 0:r.call(t,null==e?void 0:e.target))||a&&a()},children:e(N,{onClose:a,ref:b,noBodyPadding:!0,size:"small",content:t("div",{className:je.content,children:[t(y,{gap:0,children:[x&&e(ve,{src:G(x),width:1024,height:400,alt:I||"product",className:je.image}),t(y,{className:je.details,gap:1,children:[e("h2",{className:je.name,children:I}),t(_,{justifyContent:"space-between",children:[e("div",{className:je.price,children:L}),e("div",{className:je.volume,children:R})]}),e("div",{className:je.description,children:O})]})]}),e("div",{className:je.close,children:e(A,{onClick:a,icon:q})})]}),footer:t(_,{className:je.addToCart,gap:.5,children:[e(He,{isDecreaseDisabled:T,onDecrease:()=>j(-1),onIncrease:()=>j(1),quantity:g}),e(w,{className:je.addAction,label:t(_,{fullWidth:!0,justifyContent:"space-between",children:[e("span",{className:je.actionTitle,children:z}),e("span",{children:D})]}),onClick:()=>{v?h(r,g):m(r,g),a&&a()},size:"xl",fullWidth:!0})]})})})};var Ee="Cart-module_container__3KQtx",qe="Cart-module_content__rkiZa",Ye={container:"CartStepper-module_container__4CF1L",count:"CartStepper-module_count__E-RBg",actionText:"CartStepper-module_actionText__-rVKA",totalPrice:"CartStepper-module_totalPrice__QboRN",isClickable:"CartStepper-module_isClickable__mDptU",flexWide:"CartStepper-module_flexWide__eXxCr",slidein:"CartStepper-module_slidein__d5JQ-",fadeInOut:"CartStepper-module_fadeInOut__pS8nn",heightAnimation:"CartStepper-module_heightAnimation__7-e5Z",fadein:"CartStepper-module_fadein__-Ba0-",floatAnimation:"CartStepper-module_floatAnimation__rq6zX",bottomSheet:"CartStepper-module_bottomSheet__1wHHD",slideRightToLeft:"CartStepper-module_slideRightToLeft__0KLAo"};const Me=({actionText:r,onClick:a})=>{const i=Qe(),{formattedTotalPrice:n}=(()=>{const{cart:e}=ke(),{currency:t,language:r}=ie(),a=Object.values(e||{}).reduce(((e,{price:t,quantity:r,vat:a})=>e+De(t,r,a)),0);return{totalPrice:a,formattedTotalPrice:u(a,t,r)}})();return t(f,{className:m(Ye,{container:!0,isClickable:!!a}),justifyContent:"space-between",alignItems:"center",onClick:a,children:[e(f.Item,{flex:1,children:t(_,{alignItems:"center",children:[e("div",{className:Ye.count,children:i}),e("div",{className:Ye.actionText,children:r})]})}),e(f.Item,{className:Ye.totalPrice,flex:1,children:n})]})},Fe=()=>{const{setIsCartOpen:t}=ke(),{t:r}=Re();return Qe()<=0?null:e("div",{className:Ee,children:e("div",{className:qe,children:e(Me,{onClick:()=>t(!0),actionText:r("viewOrder")})})})};var Ue={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",$e="CartItem-module_image__D-zzG",Ge="CartItem-module_data__Lo3Fb",Ze="CartItem-module_name__EksZu",Ke="CartItem-module_price__yJxl6";const Xe=e=>{var t;const{products:r}=ie();return(null===(t=null==r?void 0:r.find)||void 0===t?void 0:t.call(r,(({id:t})=>t===e)))||{}},Je=({productId:t,min:r=1,size:a="md"})=>{const i=(e=>{const{cart:t}=ke(),r=t[e];return(null==r?void 0:r.quantity)||1})(t),n=Xe(t),{updateProduct:o}=ke();return e(He,{isDecreaseDisabled:i===r,onDecrease:()=>o(n,i-1),onIncrease:()=>o(n,i+1),quantity:i,size:a})},et=({item:r})=>{const{productId:a,quantity:i}=r||{},n=Xe(a),{language:o,currency:l}=ie(),{image160:c}=n,{name:s}=d((()=>Se(n,o)),[n,o]),{formattedTotalPrice:u}=d((()=>Te(n,l,o,i)),[n,l,o,i]);return t(_,{className:Ve,gap:1,alignItems:"center",children:[c&&e(ve,{src:G(c),alt:s||"menu",className:$e,loading:"lazy",width:80,height:45}),t("div",{className:Ge,children:[e("div",{className:Ze,children:s}),e("div",{className:Ke,children:u})]}),e(Je,{productId:a,size:"sm",min:0})]})},tt=()=>{const{isCartOpen:r,cart:a,setIsCartOpen:i}=ke(),n=o(),{t:l}=Re(),d=s(a),c=()=>i(!1);return r?e("div",{className:Ue.container,onClick:e=>{var t,r;(null===(r=null===(t=null==n?void 0:n.current)||void 0===t?void 0:t.contains)||void 0===r?void 0:r.call(t,null==e?void 0:e.target))||c()},children:e(O,{ref:n,onClose:c,isOpen:r,title:l("Your order"),content:e("div",{className:Ue.content,children:d?e((()=>t(y,{className:Ue.noItems,fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",gap:0,children:[e(k,{variant:"h2",children:l("Empty order")}),e(L,{text:l("You don't have any items in your order")})]})),{}):e("div",{className:Ue.items,children:Object.keys(a||{}).map((t=>e(et,{item:a[t]},t)))})}),footer:d?e(w,{label:l("Add items"),onClick:c,type:I.PRIMARY,size:"xl",fullWidth:!0}):e(Me,{actionText:l("Subtotal")})})}):null},rt=c((({categoryProductMap:r=[],currency:a,language:i,productBlocksRef:o,containerRef:d,onCategoryInView:c})=>{const[s,u]=n(null);return l((()=>{const e=new IntersectionObserver((e=>{var t;const r=((null===(t=null==d?void 0:d.current)||void 0===t?void 0:t.clientHeight)||1e3)/2;let a=null,i=1/0;e.forEach((e=>{if(e.isIntersecting){const t=e.boundingClientRect,n=t.top+t.height/2,o=Math.abs(n-r);o<i&&(i=o,a=e.target.getAttribute("data-category-id"))}})),a&&c(Number(a))}),{threshold:.5});return Object.entries(o.current||{}).forEach((([t,r])=>{r&&(r.setAttribute("data-category-id",t),e.observe(r))})),()=>{e.disconnect()}}),[o,d]),e(Oe,{children:t("div",{className:Pe,children:[e(y,{children:(r||[]).map((r=>{const{name:n}=((e,t)=>{var r,a;return(null===(a=null===(r=null==e?void 0:e.translations)||void 0===r?void 0:r.find)||void 0===a?void 0:a.call(r,(e=>e.language===t)))||{}})(r,i),{id:l,products:d}=r;return t("div",{className:Ie,ref:e=>o.current[l]=e,"data-category-id":l,children:[e("h2",{className:Ae,children:n}),e("div",{className:Ne,children:e(y,{gap:0,children:(d||[]).map((t=>e(ze,{product:t,currency:a,language:i,onClick:()=>u(t)},t.id)))})})]},l)}))}),e(Be,{product:s,onClose:()=>u(null)}),e(Fe,{}),e(tt,{})]})})}),((e,t)=>e.categoryProductMap===t.categoryProductMap&&e.currency===t.currency&&e.language===t.language));var at="Branches-module_branches__sOuoV",it="Branches-module_list__vYoT2",nt="Branches-module_name__K0Z-4";const ot=({branches:t=[],rootPath:r="",onBranchSelect:a})=>{const i=({children:t,id:i})=>a?e("div",{onClick:()=>a(i),children:t}):e("a",{href:`${r}/${i}`,children:t});return e("div",{className:at,children:e(S,{className:it,children:t.map((({id:t,name:r})=>e(i,{id:t,children:e(D,{noBottomMargin:!0,children:e(f,{justifyContent:"center",alignItems:"center",fullHeight:!0,children:e("h2",{className:nt,children:r})})})},t)))})})},lt=({data:a})=>{var i;const{name:l,coverImage:d,logoImage:c,branches:s=[],branchId:u,language:m,categories:_,products:h,currency:g,instagram:p,facebook:v,whatsapp:f,telegram:y,tiktok:b,rootPath:C,hostname:P,onBranchSelect:I}=a||{},A=s.length<=1,N=((e,t)=>{const r=t.reduce(((e,t)=>{const r=Number(t.categoryId);return e[r]||(e[r]=[]),e[r].push(t),e}),{});return e.map((e=>Object.assign(Object.assign({},e),{products:r[Number(e.id)]||[]}))).filter((e=>{var t;return(null===(t=null==e?void 0:e.products)||void 0===t?void 0:t.length)>0}))})(_,h),w=(()=>{var e;return A?(null===(e=null==s?void 0:s[0])||void 0===e?void 0:e.id)?s[0]:{}:s.find((e=>e.id===Number(u)))})(),O=A||!(null==w?void 0:w.name)?l:(null==w?void 0:w.name)||"",[k,L]=n(null===(i=null==_?void 0:_[0])||void 0===i?void 0:i.id),S=o({}),D=o(null),T=o(!0),{url:z,domain:j}=((e,t)=>{const r=te.includes(e)?e:ee;return{url:`https://${r}/${t||"en"}`,domain:r}})(P,m);return t("div",{className:F,ref:D,children:[e(be,{branch:w,name:O,coverImage:K(d),logoImage:Z(c),instagram:p,facebook:v,whatsapp:f,telegram:y,tiktok:b}),A||u?t(r,{children:[e(Ce,{categoryProductMap:N,language:m,selectedCategoryId:k,onSelectCategory:e=>M(void 0,void 0,void 0,(function*(){T.current=!1,L(e),(e=>{var t;const r=null===(t=null==S?void 0:S.current)||void 0===t?void 0:t[e];r&&(setTimeout((()=>{r.scrollIntoView({behavior:"smooth",block:"start"})}),100),setTimeout((()=>{T.current=!0}),1e3))})(e)}))}),e(rt,{currency:g,language:m,productBlocksRef:S,containerRef:D,categoryProductMap:N,onCategoryInView:e=>{(null==T?void 0:T.current)&&L(e)}})]}):e(ot,{branches:s,onBranchSelect:I,rootPath:C}),!!P&&e("a",{rel:"noopener",target:"_blank",href:z,className:V,children:j})]})},dt=({data:t})=>e(ae,{value:t,children:e(lt,{data:t})});export{dt as PublicMenu};
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{isEmpty as r,trackEvent as i,priceFormatter as n,classNames as o}from"@sorocraft/js-utils";import{createContext as l,useContext as d,useState as c,useRef as s,useEffect as u,useMemo as m,memo as _,useCallback as h}from"react";import{Row as g,classNames as p,IconLink as v,Tooltip as f,SVGIcon as y,Flex as b,Column as C,Carousel as P,CarouselItem as I,Chip as A,UIElementType as w,Text as N,IconButton as O,Modal as k,Button as S,Drawer as L,Description as D,Container as T,Card as z,DropDown as R,DropDownMenuItem as j,Loading as x,BarChart as E}from"@sorocraft/ui";import{Phone as Q,Whatsapp as W,Instagram as H,Telegram as q,Tiktok as B,Facebook as M,Wifi as Y,MarkerPin as F,Plus as G,Minus as $,Close as U}from"@sorocraft/ui/icons";function V(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 K(e,t,a,r){return new(a||(a=Promise))((function(i,n){function o(e){try{d(r.next(e))}catch(e){n(e)}}function l(e){try{d(r.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(o,l)}d((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var Z="PublicMenu-module_container__QLN6U",X="PublicMenu-module_categories__Iy6NC",J="PublicMenu-module_footer__6G3DQ";const ee="https://images.restaround.co",te=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${ee}/${e}`:"",ae=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${ee}/${e}`:"https://images.restaround.co/no-photo-128.webp",re=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${ee}/${e}`:"https://images.restaround.co/restaround-doodle.webp",ie="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ne=(e,t,a)=>ie.charAt(e>>2)+ie.charAt((3&e)<<4|t>>4)+ie.charAt((15&t)<<2|a>>6)+ie.charAt(63&a),oe="restaround.co",le=[oe,"restaround.az","restaround.ee","restaround.nl"],de=l({}),ce=({children:t,value:a})=>{const i=r(a)?{}:a;return i.currency||i.currency,i.language||i.language,e(de.Provider,{value:r(a)?{}:a,children:t})},se=()=>d(de),ue="digital_menu",me=`${ue}_category_select`,_e=`${ue}_category_scroll`,he=`${ue}_product_details`,ge=`${ue}_product_add_cart`,pe=[me,_e,he,ge],ve=(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 fe="Header-module_container__tenlF",ye="Header-module_cover__BAWZK",be="Header-module_content__Gx4Al",Ce="Header-module_logo__4MTCm",Pe="Header-module_info__IchYA",Ie="Header-module_name__30wyw",Ae="Header-module_address__WOxXc",we="Header-module_addressText__lUszI",Ne="Header-module_social__AoP0z",Oe="Header-module_links__EeQxg",ke="Header-module_wifiPassword__VWBTa",Se="Header-module_wifiPasswordIcon__Ukn3D";const Le=t=>{const a=V(t,["priority","blurDataURL","quality","placeholder","fetchPriority"]),{imageTag:r}=se()||{};if(r){return e(r,Object.assign({},t,{quality:t.quality||100,placeholder:"blur",blurDataURL:(i=235,n=59,o=90,`data:image/gif;base64,R0lGODlhAQABAPAA${ne(0,i,n)+ne(o,255,255)}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`)}))}var i,n,o;return e("img",Object.assign({},a))};var De={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 Te=()=>{var a;const{language:r,languages:i,onLanguageSelect:n}=se(),[o,l]=c(!1),d=(null==i?void 0:i.length)>1,s=(null===(a=null==i?void 0:i.filter)||void 0===a?void 0:a.call(i,(({code:e})=>e!==r)))||[],u=e=>`https://images.restaround.co/languages/${e}.svg`;return d?e("div",{className:De.container,onClick:()=>l(!o),children:t(g,{alignItems:"center",gap:0,children:[e(g,{alignItems:"center",className:p(De,{options:!0,isOpen:o}),children:s.map((({code:t})=>e("img",{src:u(t),className:De.option,onClick:()=>(e=>{n&&n(e)})(t),alt:t},t)))}),e("img",{src:u(r),alt:r||"",className:De.currentLanguage})]})}):null},ze=({branch:a,coverImage:i,logoImage:n,name:o,instagram:l,facebook:d,whatsapp:c,telegram:s,tiktok:u})=>{const{address:m,latitude:_,longitude:h,phone:p,wifiPassword:P}=a||{},I=r(a),A=`https://www.google.com/maps/place/${_},${h}`;return t("div",{className:fe,children:[e(Le,{src:i,alt:o,className:ye,width:1024,height:400,priority:!0,sizes:"100vw",fetchPriority:"high",loading:"eager"}),e("div",{className:be,children:e(I?()=>t(C,{fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",children:[e(Le,{src:n,alt:o,className:Ce,width:96,height:96}),e("div",{className:Pe,children:e("h1",{className:Ie,children:o})})]}):()=>t(b,{direction:"row",gap:1,alignItems:"center",children:[e(b.Item,{children:e(Le,{src:n,alt:o,className:Ce,width:96,height:96})}),e(b.Item,{shrink:!0,children:e("div",{className:Pe,children:t(C,{gap:.25,children:[e("h1",{className:Ie,children:o}),e("a",{className:Ae,href:A,target:"_blank",rel:"noopener noreferrer",children:t(g,{alignItems:"center",gap:.5,children:[e(y,{icon:F,theme:"dark"}),e("span",{className:we,children:m})]})})]})})})]}),{})}),e(Te,{}),!I&&e("div",{className:Ne,children:e("div",{className:Oe,children:e(g,{gap:2,alignItems:"center",children:t(g,{alignItems:"center",justifyContent:"center",gap:.5,children:[!!p&&e(v,{icon:Q,href:`tel:+${p}`,size:"sm",shape:"circle",theme:"light"}),!!c&&e(v,{icon:W,href:`https://wa.me/${c}`,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!l&&e(v,{icon:H,href:l,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!s&&e(v,{icon:q,href:s,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!u&&e(v,{icon:B,href:u,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!d&&e(v,{icon:M,href:d,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!P&&e(f,{hint:P,children:e("div",{className:ke,children:e(y,{icon:Y,size:"sm",className:Se})})})]})})})})]})},Re=({categoryProductMap:t=[],language:a,selectedCategoryId:r,onSelectCategory:n})=>{const o=s({}),l=s(null);return u((()=>{r&&(()=>{var e;const t=null===(e=null==o?void 0:o.current)||void 0===e?void 0:e[r];if(!t||!l.current)return;const a=l.current.clientWidth,i=t.offsetLeft-a/2+t.offsetWidth/2;l.current.scrollTo({left:i,behavior:"smooth"})})()}),[r]),e("div",{className:X,children:e(P,{gap:1,onGetRef:e=>{(null==e?void 0:e.current)&&(l.current=e.current)},children:(t||[]).map((({id:t,translations:l})=>{const{name:d}=l.find((e=>e.language===a))||{};return e(I,{children:e(A,{onClick:()=>((e,t)=>{e!==r&&(i(me,{name:t}),n(e))})(t,d),type:w.BORDERED_PRIMARY,active:t===r,children:e("div",{ref:e=>o.current[t]=e,children:d})})},t)}))})})};var je="Products-module_container__bF2LF",xe="Products-module_products__AoDrY",Ee="Products-module_category__Sp7dE",Qe="Products-module_list__LH4v5";const We=(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)))||{}},He=(e,t,a=0)=>e*t*(1+a/100),qe=(e,t,a,r=1)=>{const{price:i,vat:o}=e||{},l=He(i,r,o);return{totalPrice:l,formattedTotalPrice:n(l,t,a)}},Be=l({cart:{},isCartOpen:!1,addProduct:()=>{},updateProduct:()=>{},setIsCartOpen:()=>{}}),Me=({children:t})=>{const[a,i]=c({}),[n,o]=c(!1),l=(e,t,a)=>{if(r(e)||t<0)return;const{id:n,price:o,vat:l=0}=e;i((e=>{const r=e[n],i=a?((null==r?void 0:r.quantity)||0)+t:t;if(i<=0){const t=e,a=n;t[a];return V(t,["symbol"==typeof a?a:a+""])}return Object.assign(Object.assign({},e),{[n]:{productId:n,price:o,quantity:i,vat:l}})}))},d=(e,t=1)=>l(e,t,!0),s=(e,t=1)=>l(e,t,!1),u=m((()=>({cart:a,isCartOpen:n,addProduct:d,updateProduct:s,setIsCartOpen:o})),[a,n]);return e(Be.Provider,{value:u,children:t})},Ye=()=>d(Be);var Fe={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 Ge=({product:a,currency:r,language:n,onClick:l})=>{const{addProduct:d}=Ye(),{image160:c,volume:s}=a||{},{name:u,description:_}=m((()=>We(a,n)),[a,n]),{formattedTotalPrice:h}=m((()=>qe(a,r,n)),[a,r,n]);return t("div",{className:o(Fe,{container:!0,isClickable:!!l}),onClick:l,children:[t(g,{justifyContent:"space-between",gap:0,children:[e("div",{className:Fe.data,children:t(C,{gap:.25,children:[e("h3",{className:Fe.name,children:u}),e("p",{className:Fe.description,children:_}),t(g,{className:Fe.price,gap:.5,fullWidth:!0,justifyContent:"space-between",children:[e("span",{children:h}),!!s&&e(N,{color:"muted",children:s})]})]})}),c&&e(Le,{src:te(c),alt:u||"menu",className:Fe.image,loading:"lazy",width:160,height:90})]}),e("div",{className:Fe.addToCart,children:e(O,{onClick:e=>{e.preventDefault(),e.stopPropagation(),d(a),i(ge,{name:u,quantity:1})},icon:G,type:w.DEFAULT})})]})};var $e={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 Ue={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:"События"}},Ve=e=>{const{language:t}=se(),a=e||t;return{t:e=>{var t;return(null===(t=Ue[a])||void 0===t?void 0:t[e])||e}}},Ke=()=>{const{cart:e}=Ye();return Object.values(e||{}).reduce(((e,t)=>e+t.quantity),0)};var Ze={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 Xe=({isDecreaseDisabled:a=!1,quantity:r=1,size:i="md",onIncrease:n,onDecrease:l})=>t(g,{className:o(Ze,{container:!0},[Ze[i]]),justifyContent:"space-between",gap:0,children:[e("div",{className:o(Ze,{quantityAction:!0,isDisabled:a}),onClick:l,children:e(y,{icon:$})}),e("div",{className:Ze.quantityValue,children:r}),e("div",{className:Ze.quantityAction,onClick:n,children:e(y,{icon:G})})]}),Je=({product:a,onClose:o})=>{const{language:l,currency:d}=se(),{addProduct:_,updateProduct:h}=Ye(),[p,v]=c(1),[f,y]=c(!1),b=s(),{t:P}=Ve(),I=(e=>{var t;const{cart:a}=Ye();return r(a)||!e?0:(null===(t=a[e])||void 0===t?void 0:t.quantity)||0})(null==a?void 0:a.id),{name:A,description:w}=m((()=>We(a,l)),[a,l]),{totalPrice:N,formattedTotalPrice:L}=m((()=>qe(a,d,l)),[a,d,l]),D=m((()=>p*N),[p,N]),T=m((()=>n(D,d,l)),[D,d,l]),z=f?0===p:1===p,R=m((()=>P(f?0===p?"removeFromOrder":"updateOrder":"addToOrder")),[f,p]);u((()=>{v(I>0?I:1),y(I>0)}),[I,a]);const j=e=>{-1===e&&z||v((t=>Math.max(0,t+e)))};if(r(a))return null;const{image1024:x,volume:E}=a;return e("div",{className:$e.container,onClick:e=>{var t,a;(null===(a=null===(t=null==b?void 0:b.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(k,{onClose:o,ref:b,noBodyPadding:!0,size:"small",content:t("div",{className:$e.content,children:[t(C,{gap:0,children:[x&&e(Le,{src:te(x),width:1024,height:400,alt:A||"product",className:$e.image}),t(C,{className:$e.details,gap:1,children:[e("h2",{className:$e.name,children:A}),t(g,{justifyContent:"space-between",children:[e("div",{className:$e.price,children:L}),e("div",{className:$e.volume,children:E})]}),e("div",{className:$e.description,children:w})]})]}),e("div",{className:$e.close,children:e(O,{onClick:o,icon:U})})]}),footer:t(g,{className:$e.addToCart,gap:.5,children:[e(Xe,{isDecreaseDisabled:z,onDecrease:()=>j(-1),onIncrease:()=>j(1),quantity:p}),e(S,{className:$e.addAction,label:t(g,{fullWidth:!0,justifyContent:"space-between",children:[e("span",{className:$e.actionTitle,children:R}),e("span",{children:T})]}),onClick:()=>{f?h(a,p):(_(a,p),i(ge,{name:A,quantity:p})),o&&o()},size:"xl",fullWidth:!0})]})})})};var et="Cart-module_container__3KQtx",tt="Cart-module_content__rkiZa",at={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 rt=({actionText:a,onClick:r})=>{const i=Ke(),{formattedTotalPrice:l}=(()=>{const{cart:e}=Ye(),{currency:t,language:a}=se(),r=Object.values(e||{}).reduce(((e,{price:t,quantity:a,vat:r})=>e+He(t,a,r)),0);return{totalPrice:r,formattedTotalPrice:n(r,t,a)}})();return t(b,{className:o(at,{container:!0,isClickable:!!r}),justifyContent:"space-between",alignItems:"center",onClick:r,children:[e(b.Item,{flex:1,children:t(g,{alignItems:"center",children:[e("div",{className:at.count,children:i}),e("div",{className:at.actionText,children:a})]})}),e(b.Item,{className:at.totalPrice,flex:1,children:l})]})},it=()=>{const{setIsCartOpen:t}=Ye(),{t:a}=Ve();return Ke()<=0?null:e("div",{className:et,children:e("div",{className:tt,children:e(rt,{onClick:()=>t(!0),actionText:a("viewOrder")})})})};var nt={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"},ot="CartItem-module_container__At7lj",lt="CartItem-module_image__D-zzG",dt="CartItem-module_data__Lo3Fb",ct="CartItem-module_name__EksZu",st="CartItem-module_price__yJxl6";const ut=e=>{var t;const{products:a}=se();return(null===(t=null==a?void 0:a.find)||void 0===t?void 0:t.call(a,(({id:t})=>t===e)))||{}},mt=({productId:t,min:a=1,size:r="md"})=>{const i=(e=>{const{cart:t}=Ye(),a=t[e];return(null==a?void 0:a.quantity)||1})(t),n=ut(t),{updateProduct:o}=Ye();return e(Xe,{isDecreaseDisabled:i===a,onDecrease:()=>o(n,i-1),onIncrease:()=>o(n,i+1),quantity:i,size:r})},_t=({item:a})=>{const{productId:r,quantity:i}=a||{},n=ut(r),{language:o,currency:l}=se(),{image160:d}=n,{name:c}=m((()=>We(n,o)),[n,o]),{formattedTotalPrice:s}=m((()=>qe(n,l,o,i)),[n,l,o,i]);return t(g,{className:ot,gap:1,alignItems:"center",children:[d&&e(Le,{src:te(d),alt:c||"menu",className:lt,loading:"lazy",width:80,height:45}),t("div",{className:dt,children:[e("div",{className:ct,children:c}),e("div",{className:st,children:s})]}),e(mt,{productId:r,size:"sm",min:0})]})},ht=()=>{const{isCartOpen:a,cart:i,setIsCartOpen:n}=Ye(),o=s(),{t:l}=Ve(),d=r(i),c=()=>n(!1);return a?e("div",{className:nt.container,onClick:e=>{var t,a;(null===(a=null===(t=null==o?void 0:o.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(L,{ref:o,onClose:c,isOpen:a,title:l("Your order"),content:e("div",{className:nt.content,children:d?e((()=>t(C,{className:nt.noItems,fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",gap:0,children:[e(N,{variant:"h2",children:l("Empty order")}),e(D,{text:l("You don't have any items in your order")})]})),{}):e("div",{className:nt.items,children:Object.keys(i||{}).map((t=>e(_t,{item:i[t]},t)))})}),footer:d?e(S,{label:l("Add items"),onClick:c,type:w.PRIMARY,size:"xl",fullWidth:!0}):e(rt,{actionText:l("Subtotal")})})}):null},gt=_((({categoryProductMap:a=[],currency:r,language:n,productBlocksRef:o,containerRef:l,onCategoryInView:d})=>{const[s,m]=c(null);return u((()=>{const e=new IntersectionObserver((e=>{var t;const a=((null===(t=null==l?void 0:l.current)||void 0===t?void 0:t.clientHeight)||1e3)/2;let r=null,i=1/0;e.forEach((e=>{if(e.isIntersecting){const t=e.boundingClientRect,n=t.top+t.height/2,o=Math.abs(n-a);o<i&&(i=o,r=e.target.getAttribute("data-category-id"))}})),r&&d(Number(r))}),{threshold:.5});return Object.entries(o.current||{}).forEach((([t,a])=>{a&&(a.setAttribute("data-category-id",t),e.observe(a))})),()=>{e.disconnect()}}),[o,l]),e(Me,{children:t("div",{className:je,children:[e(C,{children:(a||[]).map((a=>{const{name:l}=ve(a,n),{id:d,products:c}=a;return t("div",{className:xe,ref:e=>o.current[d]=e,"data-category-id":d,children:[e("h2",{className:Ee,children:l}),e("div",{className:Qe,children:e(C,{gap:0,children:(c||[]).map((t=>e(Ge,{product:t,currency:r,language:n,onClick:()=>(e=>{const{name:t}=We(e,n);i(he,{name:t}),m(e)})(t)},t.id)))})})]},d)}))}),e(Je,{product:s,onClose:()=>m(null)}),e(it,{}),e(ht,{})]})})}),((e,t)=>e.categoryProductMap===t.categoryProductMap&&e.currency===t.currency&&e.language===t.language));var pt="Branches-module_branches__sOuoV",vt="Branches-module_list__vYoT2",ft="Branches-module_name__K0Z-4";const yt=({branches:t=[],rootPath:a="",onBranchSelect:r})=>{const i=({children:t,id:i})=>r?e("div",{onClick:()=>r(i),children:t}):e("a",{href:`${a}/${i}`,children:t});return e("div",{className:pt,children:e(T,{className:vt,children:t.map((({id:t,name:a})=>e(i,{id:t,children:e(z,{noBottomMargin:!0,children:e(b,{justifyContent:"center",alignItems:"center",fullHeight:!0,children:e("h2",{className:ft,children:a})})})},t)))})})},bt=({data:n})=>{var o;const{name:l,coverImage:d,logoImage:u,branches:m=[],branchId:_,language:h,categories:g,products:p,currency:v,instagram:f,facebook:y,whatsapp:b,telegram:C,tiktok:P,rootPath:I,hostname:A,onBranchSelect:w}=n||{},N=m.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,p),k=(()=>{var e;return N?(null===(e=null==m?void 0:m[0])||void 0===e?void 0:e.id)?m[0]:{}:m.find((e=>e.id===Number(_)))})(),S=N||!(null==k?void 0:k.name)?l:(null==k?void 0:k.name)||"",[L,D]=c(null===(o=null==g?void 0:g[0])||void 0===o?void 0:o.id),T=s({}),z=s(null),R=s(!0),{url:j,domain:x}=((e,t)=>{const a=le.includes(e)?e:oe;return{url:`https://${a}/${t||"en"}`,domain:a}})(A,h);return t("div",{className:Z,ref:z,children:[e(ze,{branch:k,name:S,coverImage:re(d),logoImage:ae(u),instagram:f,facebook:y,whatsapp:b,telegram:C,tiktok:P}),N||_?t(a,{children:[e(Re,{categoryProductMap:O,language:h,selectedCategoryId:L,onSelectCategory:e=>K(void 0,void 0,void 0,(function*(){R.current=!1,D(e),(e=>{var t;const a=null===(t=null==T?void 0:T.current)||void 0===t?void 0:t[e];a&&(setTimeout((()=>{a.scrollIntoView({behavior:"smooth",block:"start"})}),100),setTimeout((()=>{R.current=!0}),1e3))})(e)}))}),e(gt,{currency:v,language:h,productBlocksRef:T,containerRef:z,categoryProductMap:O,onCategoryInView:e=>{if(!(null==R?void 0:R.current))return;const t=((e,t,a)=>{var i;const n=null===(i=null==t?void 0:t.find)||void 0===i?void 0:i.call(t,(({id:t})=>t===e));if(r(n))return"";const{name:o}=ve(n,a);return o})(e,g,h);i(_e,{name:t}),D(e)}})]}):e(yt,{branches:m,onBranchSelect:w,rootPath:I}),!!A&&e("a",{rel:"noopener",target:"_blank",href:j,className:J,children:x})]})},Ct=({data:t})=>e(ce,{value:t,children:e(bt,{data:t})});var Pt={};const It=({currentGoal:t,language:a,setGoal:r})=>{const{t:i}=Ve(a),n=s({}),o=e=>{switch(e){case _e:return i("Scrolled to Category");case me:return i("Category Selected");case he:return i("Product Details");case ge:return i("Product Added to Cart");default:return""}},l=h((e=>{var t,a;r(e),null===(a=null===(t=null==n?void 0:n.current)||void 0===t?void 0:t.close)||void 0===a||a.call(t)}),[r]);return e(R,{action:o(t),actionSize:"large",type:w.BORDERED_PRIMARY,closeRef:n,menu:e("div",{className:Pt.toolbarMenu,children:pe.map((t=>e(j,{onClick:()=>l(t),children:o(t)},t)))})})},At=({data:t,isLoading:a=!1,loadingImage:r,language:i,goal:n,setGoal:o})=>{const{t:l}=Ve(i);return e(z,{title:l("Events"),toolbar:e(It,{language:i,currentGoal:n,setGoal:o}),children:a?e(x,{image:r}):e(E,{data:t})})};export{At as Events,Ct as PublicMenu};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|