PageSourceSearch

https://www.stamford-eats.co.uk/_next/static/chunks/pages/user-profile-3c88919d63436e83.js

js stamford-eats.co.uk collected 2026-09-24 14:29:20 UTC 102,107 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5542],{14430:function(e,r,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/user-profile",function(){return l(32046)}])},6609:function(e,r,l){"use strict";l.d(r,{e:function(){return i},v:function(){return s}});var t=l(53686),n=l(32351),a=l(66340);let i="GET_CUSTOMER_WALLET",s=e=>{let{data:r,isLoading:l,isSuccess:s}=(0,n.z)({queryKey:[i,e],queryFn:()=>(0,t.te)(e),enabled:!!e,...a.lb});return{data:r,isLoading:l,isSuccess:s}}},99519:function(e,r,l){"use strict";l.d(r,{A:function(){return y}});var t=l(67294),n=l(67936),a=l(11949),i=l(99e3),s=l(69166),o=l(53656),d=l(83846),c=l(86900),u=l(66340),m=l(30381),p=l.n(m);let h=/^(\d{4}-\d{2}-\d{2})(.*)$/;function y(){let{t:e}=(0,a.q)(),{getCompanyCountry:r}=(0,n.f)(),l=(0,t.useCallback)((r,l,t,n,a)=>{let i=(0,d.K9)(l),o=l===s.m["EAT-IN"];switch(r){case s.Z.AUTO_CONFIRMED:return e("label.order.accepted");case s.Z.COMPLETED:return e("label.order.completed");case s.Z.ON_ITS_WAY:return e("label.order.on.the.way");case s.Z.PENDING:return e("label.order.pending");case s.Z.ACCEPTED:if(o&&n)return e("label.order.prepared");if(!i)return e("label.order.accepted");if(t)return e("label.order.preorder.confirmed");return e("label.order.prepared");default:if(i){if(t)return e("label.order.preorder.confirmed");return i?e("label.order.ready.to.pickup.counter"):e("label.order.prepared")}if(l===s.m["EAT-IN"]&&!n&&a)return e("label.order.ready.to.pickup.counter");return e("label.order.ready.to.pickup")}},[e]),m=(0,t.useCallback)((r,l)=>{switch(r){case o.$.DRIVER_EN_ROUTE_TO_PICKUP:return e("label.order.driver.en.route");case o.$.DRIVER_DEPART_PICKUP:case o.$.DRIVER_AT_PICKUP:return e("label.order.driver.arrived");case o.$.DRIVER_AT_DROP_OFF:if(l&&""!==l.trim())return e("label.order.driver.at.drop.off",[l]);return e("label.order.driver.at.drop.off.no.name");case o.$.FAILED:return e("label.order.driver.failed");default:return""}},[]),y=(0,t.useCallback)((e,r)=>{let l=(0,d.K9)(r),t=r===s.m["EAT-IN"];switch(e){case s.Z.ACCEPTED:case s.Z.AUTO_CONFIRMED:return i.eD;case s.Z.ON_ITS_WAY:case s.Z.READY_TO_PICKUP:if(!l||t)return i.eD;return i.tM;case s.Z.PENDING:return i.TE;case s.Z.COMPLETED:if(l)return i.tv;if(t)return i.l;return i.wZ;case s.Z.DRIVER_AT_DROP_OFF:return i.wT;case s.Z.REJECTED:case s.Z.FAILED:case s.Z.CANCELLED:}return c.Z},[]),v=(0,t.useCallback)(l=>{let t=r();switch(l){case s.m.CATERING:return{from:e("label.order.catering.from"),to:e("label.order.catering.to")};case s.m.COLLECTION:return"GB"===t?{from:e("label.order.collection.from"),to:e("label.order.collection.location")}:{from:e("label.order.pickup.from"),to:e("label.order.pickup.location")};case s.m["CURB-SIDE"]:return{from:e("label.order.curbside.from"),to:e("label.order.curbside.location")};case s.m.DELIVERY:return{from:e("label.order.delivery.from"),to:e("label.order.delivery.to")};case s.m["EAT-IN"]:return{from:e("label.order.eat.in.at"),to:""};default:return{from:"",to:""}}},[r,e]);return{getExpectedAt:(0,t.useCallback)(r=>{if(!r)return"";let{deliveryJob:l,orderType:t,orderConfirmationStatus:n,orderTime:a,preOrdered:i,orderTimeMins:c}=r,m=(0,d.XJ)(t);if(l&&!m&&n===s.Z.ON_ITS_WAY){let{eta:r,deliveryStatus:t,vendor:n}=l;if(t===o.$.IN_TRANSIT&&(null==r?void 0:r.dropoff)&&(null==n?void 0:n.toLowerCase())==="vromo")return r.dropoff;if(t===o.$.DRIVER_AT_DROP_OFF)return e("label.arriving.now")}return i?function(e){if(!e)return"";let r=e.match(h);if(!r)return e;let[,l,t]=r,n=p()(l,"YYYY-MM-DD",!0);if(!n.isValid())return e;let a=n.format(u.lv.SHORT_DATE);return"".concat(a).concat(t)}(a):e("asap.minutes",[c])},[e]),getStatusMessage:l,mapTrackingMsg:m,getOrderConfirmationStatusIcon:y,getOrderTypeLabels:v}}},67190:function(e,r,l){"use strict";l.d(r,{H:function(){return q}});var t=l(85893),n=l(69289),a=l(11949),i=l(2516),s=l(87672),o=l(67294),d=l(29208),c=l.n(d),u=l(31468),m=l.n(u);let p=(e,r,l)=>{c()(e,r)||m()(e,r,l)},h=(e,r)=>e?e.map(e=>{let l={},t={},n=1,a=(e,r,t,n,a,i)=>{p(l,"".concat(r),{...e.parentOption,options:{}}),p(l,"".concat(r,".options.").concat(t),{...i,options:{}}),p(l,"".concat(r,".options.").concat(t,".options.").concat(n),{...a})},i=(e,r,a,i)=>{m()(t,"".concat(n),{...e.parentOptionGroup,options:{}});let s=c()(l,a);s?m()(t,"".concat(n,".options"),{...s}):m()(t,"".concat(n,".options"),{...i}),n++};
1return e.orderItemOptions.forEach(e=>{let r=c()(e,"parentOptionGroup.id",null),l=c()(e,"parentOption.id",null),t=c()(e,"option.id",null),n=c()(e,"option",null),i=c()(e,"parentOption",null),s=c()(e,"parentOptionGroup",null);null!==i&&a(e,l,r,t,n,s)}),e.orderItemOptions.forEach(e=>{let r=c()(e,"parentOptionGroup.id",null),l=c()(e,"option.id",null),t=c()(e,"option",null);null===c()(e,"parentOption",null)&&i(e,r,l,t)}),{parent:{...e.product,purchaseSubTotal:e.purchaseSubTotal,currencyCode:r,quantity:e.quantity,instructions:e.instructions,productPhotoUrl:e.product.productPhotoUrl},children:t}}):[];var y=l(65139),v=l(4982),x=l(5695),f=l(93411),_=l(22453),g=l(18446),j=l.n(g),b=l(81763),I=l.n(b),E=l(88104),N=l.n(E);function w(e){var r,l,n,o;let{item:d}=e,{t:c}=(0,a.q)(),{isDesktop:u}=(0,f.p)(),{formatCurrencyByCurrencyCode:m}=(0,v.U)(),{formatPromotionName:p,getFilteredPromotions:h}=(0,x.f)(),g=!["DELIVERY","CATERING"].includes(null!==(r=null==d?void 0:d.orderType)&&void 0!==r?r:""),b=h(null==d?void 0:d.discounts);return(0,t.jsxs)(i.Z,{className:N().container,vertical:!0,gap:u?16:8,children:[b&&b.length>0&&b.map(e=>(0,t.jsx)(y.w,{label:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_.Z,{style:{width:18,height:18,paddingRight:4}}),p(e)]}),value:"-".concat(m(e.discountAmount,null==d?void 0:d.currencyCode))},e.promotionId)),!!(null==d?void 0:d.amount)&&(0,t.jsx)(y.w,{label:c("label.subtotal"),value:m(null!==(l=null==d?void 0:d.amount)&&void 0!==l?l:0,null==d?void 0:d.currencyCode),priceAfterDiscount:I()(null==d?void 0:d.subTotalAfterDiscount)&&!j()(d.subTotalAfterDiscount,null==d?void 0:d.amount)?m(null==d?void 0:d.subTotalAfterDiscount,null==d?void 0:d.currencyCode):void 0}),!!(null==d?void 0:d.serviceFee)&&(0,t.jsx)(y.w,{label:c("label.service.fee"),value:m(null!==(n=null==d?void 0:d.serviceFee)&&void 0!==n?n:0,null==d?void 0:d.currencyCode)}),!!(null==d?void 0:d.orderDiscount)&&I()(null==d?void 0:d.orderDiscount)&&(0,t.jsx)(y.w,{label:c("label.discount"),value:m(null!==(o=null==d?void 0:d.orderDiscount)&&void 0!==o?o:-0,null==d?void 0:d.currencyCode)}),!!(null==d?void 0:d.promoCodeDiscount)&&I()(null==d?void 0:d.promoCodeDiscount)&&(0,t.jsx)(y.w,{label:c("label.promocodediscount")+" (".concat(d.promoCode,")"),value:m(-1*d.promoCodeDiscount,d.currencyCode)}),!!(null==d?void 0:d.surCharge)&&(0,t.jsx)(y.w,{label:"Card Fee",value:m(d.surCharge,d.currencyCode)}),!!(null==d?void 0:d.deliveryCharge)&&(0,t.jsx)(y.w,{label:c("label.delivery.fee"),value:m(d.deliveryCharge,d.currencyCode)}),!!(null==d?void 0:d.customerOrderTaxes)&&d.customerOrderTaxes.map(e=>(0,t.jsx)(y.w,{label:e.taxLabel,value:m(e.taxAmount,d.currencyCode)},e.id)),g&&!!(null==d?void 0:d.tip)&&(0,t.jsx)(y.w,{label:c("order.details.tip"),value:m(d.tip,d.currencyCode)}),!!(null==d?void 0:d.driverTip)&&(0,t.jsx)(y.w,{label:c("label.drivertip"),value:m(d.driverTip,d.currencyCode)}),(0,t.jsx)(s.Z,{className:"dash"}),I()(null==d?void 0:d.subTotal)&&(null==d?void 0:d.subTotal)>=0&&(0,t.jsx)(y.w,{isBold:!0,isPrimary:!0,label:c("label.total").toUpperCase(),value:m(d.subTotal,d.currencyCode)})]})}var S=l(43644),T=l(31394),R=l(82057),C=l(83663),Z=l(23240),D=l(22177),P=l(52232),A=l.n(P);let O=e=>{let{quantity:r,itemName:l,price:n,imageUrl:a,quantityStyle:s="button"}=e;return(0,t.jsxs)(i.Z,{className:A().content,justify:"space-between",align:"center",children:[(0,t.jsxs)(i.Z,{gap:12,style:{width:"100%"},children:[(0,t.jsx)(D.J,{quantity:r,quantityStyle:s}),(0,t.jsxs)(i.Z,{gap:4,vertical:!0,style:{width:"100%"},children:[(0,t.jsx)(C.F,{level:5,children:l}),(0,t.jsx)(R._,{children:n})]})]}),(0,t.jsx)(Z.I,{imageUrl:a})]})},L=e=>{let{description:r,price:l,children:n,icon:a}=e;return(0,t.jsxs)(i.Z,{vertical:!0,justify:"space-between",style:{width:"100%",paddingLeft:4},gap:4,children:[(0,t.jsxs)(i.Z,{justify:"space-between",gap:6,children:[r&&(0,t.jsxs)(i.Z,{gap:6,children:[(0,t.jsx)(R._,{children:a}),(0,t.jsx)(R._,{children:r})]}),l&&(0,t.jsx)(R._,{children:l})]}),(0,t.jsx)(i.Z,{vertical:!0,gap:4,children:n})]})};function k(e){var r,l;let{item:n,quantityStyle:s="button"}=e,{t:o}=(0,a.q)(),{formatCurrencyByCurrencyCode:d}=(0,v.U)();return(0,t.jsxs)(i.Z,{className:A().container,vertical:!0,children:[(0,t.jsx)(O,{quantity:n.parent.quantity,itemName:n.parent.name1,price:d(n.parent.purchaseSubTotal,n.parent.currencyCode),imageUrl:null!==(r=n.parent.productPhotoUrl)&&void 0!==r?r:void 0,quantityStyle:s}),n.children&&Object.keys(n.children).length>0&&(0,t.jsxs)(i.Z,{className:A().additional,vertical:!0,gap:8,children:[(0,t.jsx)(R._,{children:o("label.additional")}),(0,t.jsx)(i.Z,{vertical:!0,children:(l=n.children)?Object.keys(l).map((e,r)=>{let n=c()(l,e+".options",null);return(0,t.jsx)(L,{icon:"+",children:n&&function e(r,l){var n;if(!r)return(0,t.jsx)(t.Fragment,{});let a="OPTION_OPTIONGROUP"!==r.optionGroupType?null==r?void 0:r.name:"",i=Object.keys(null!==(n=r.options)&&void 0!==n?n:{}).map((n,a)=>{var i;let s=c()(r.options,n,null);return(0,t.jsx)(L,{description:null===(i=r[n])||void 0===i?void 0:i.name,icon:l,children:s&&e(s,"+")},"option-".concat(r.id,"-").concat(n,"-").concat(a))});return(0,t.jsx)(L,{description:a,icon:l,children:i})}(n,"-")},"option-group-".concat(l.id,"-").concat(e,"-").concat(r))}):(0,t.jsx)(t.Fragment,{})}),(0,t.jsx)(T.v,{description:n.parent.instructions})]})]})}var F=l(93797),M=l.n(F);function q(e){var r;let{item:l,quantityStyle:d="button"}=e,{t:c}=(0,a.q)(),u=function(e){let{orderItems:r,currencyCode:l}=e;return(0,o.useMemo)(()=>h(r,l),[r,l])}({orderItems:null==l?void 0:l.orderItems,currencyCode:null==l?void 0:l.currencyCode}),m=(null==l?void 0:l.discounts)||[],p=null!==(r=null==l?void 0:l.lineItems)&&void 0!==r?r:[],y=p.length>0;return(0,t.jsxs)(i.Z,{className:M().summary,vertical:!0,children:[(0,t.jsx)(S.B,{title:c("page.title.ordersummary")}
1),(0,t.jsx)(i.Z,{className:M().content,vertical:!0,gap:12,children:y?p.map(e=>(0,t.jsx)(n.D,{shoppingCartItem:e,quantityStyle:d,discounts:m},e.entityId)):u.map((e,r)=>(0,t.jsx)(k,{item:e,quantityStyle:d},"".concat(e.parent.id,"-").concat(r)))}),(0,t.jsx)(s.Z,{className:"dash"}),(0,t.jsx)(w,{item:l})]})}},74108:function(e,r,l){"use strict";l.d(r,{b:function(){return l$},A:function(){return l0}});var t,n,a,i,s=l(85893),o=l(67294),d=l(5579),c=l(39332),u=l(54887);let m=()=>{let e=(0,o.useMemo)(()=>()=>window.location.hash.replace(/^#!?/,""),[]),r=(0,c.useRouter)(),l=(0,c.useParams)(),[t,n]=(0,o.useState)(e());(0,o.useEffect)(()=>{n(e())},[l]);let a=()=>{n(e())};return(0,o.useEffect)(()=>(window.addEventListener("hashchange",a),()=>{window.removeEventListener("hashchange",a)}),[]),[t,e=>{let l=window.location.href;l=u.Z.stringifyUrl({url:l.split("#")[0],fragmentIdentifier:e}),n(e),r.replace(l)}]};var p=l(11949),h=l(99e3),y=l(52675),v=l(89204),x=l(66340),f=l(55772),_=l(42630),g=l(50561),j=l(82057),b=l(71973),I=l(37378),E=l(8348),N=l(2516),w=l(54981),S=l(97845),T=l(6609),R=l(71242),C=l(50820),Z=l(30202),D=l(14640),P=l(53686),A=l(35186),O=l(70751),L=l(32351);let k=e=>{let{data:r,isLoading:l,isSuccess:t}=(0,L.z)({queryKey:["GET_BRANCH_LIST",e],queryFn:()=>(0,O.wk)({companyID:e,excludeFields:"All"}),enabled:!!e,...x.lb});return{data:r,isLoading:l,isSuccess:t}},F="GET_LOYALTY_PROGRAM_BY_BRANCH",M=(e,r)=>{let{data:l,isLoading:t,isSuccess:n}=(0,L.z)({queryKey:[F,e],queryFn:()=>(0,P.wp)(e),enabled:!!r&&!!e,select:e=>Array.isArray(e)?e:[],...x.lb});return{data:l,isLoading:t,isSuccess:n}};var q=l(86830);let U="GET_LOYALTY_PROMOTIONS",H=(e,r)=>{let{data:l,isLoading:t,isSuccess:n}=(0,L.z)({queryKey:[U,e],queryFn:()=>(0,q.sA)(e,{apiVersion:"v2"}),enabled:!!r&&e.storeIds>0,select:e=>Array.isArray(e)?e:[],...x.lb});return{data:l,isLoading:t,isSuccess:n}};var G=l(55065),z=l(83663),V=l(10042),B=l(78786),Y=l(23721),K=l(85551),W=l(34360),Q=l.n(W);function X(e){let{isEnrolling:r,onEnrol:l}=e,{t}=(0,p.q)(),{colorPrimary:n}=(0,V.F)();return(0,s.jsx)(Y.Z,{className:Q().container,children:(0,s.jsxs)("div",{className:Q().inner,children:[(0,s.jsx)(B._,{style:{color:n,fontSize:56}}),(0,s.jsx)(z.F,{level:4,style:{margin:0},children:t("loyalty.join.title")}),(0,s.jsx)(j._,{type:"secondary",className:Q().description,children:t("loyalty.join.description")}),(0,s.jsx)(K.ZP,{type:"primary",loading:r,onClick:l,className:Q().button,children:t("loyalty.enrol")})]})})}var J=l(24726),$=l(84678),ee=l(25675),er=l.n(ee),el=l(31430),et=l(87076),en=l(54172),ea=l.n(en);function ei(e){var r,l;let{open:t,onClose:n,rewardType:a,loyaltyDescription:i,promotions:o}=e,{t:d}=(0,p.q)(),{colorPrimary:c}=(0,V.F)(),u=a===I.J.STAMPS,m=d(u?"loyalty.stamps":"loyalty.points"),y=u?null!==(l=null===(r=o[0])||void 0===r?void 0:r.description)&&void 0!==l?l:"":d("loyalty.how.earn.points.description");return(0,s.jsx)(et.Z,{open:t,onCancel:n,footer:null,styles:{header:{padding:0,marginBottom:0}},title:(0,s.jsx)("div",{className:ea().header,style:{backgroundColor:c},children:(0,s.jsx)(z.F,{level:4,style:{color:"#fff",margin:0,fontWeight:700},children:d("loyalty.how.title",[m])})}),closeIcon:(0,s.jsx)(el.Z,{style:{color:"#FFFFFF",fontSize:24,backgroundColor:"rgba(0, 0, 0, 0.5)",borderRadius:"50%",boxShadow:"0 0 2px rgba(0,0,0,0.6)",height:24},onClick:n}),children:(0,s.jsxs)("div",{className:ea().body,children:[(0,s.jsxs)("div",{className:ea().row,children:[(0,s.jsxs)("div",{className:ea().rowText,children:[(0,s.jsx)(j._,{strong:!0,children:d("loyalty.how.earn.title",[(0,s.jsx)(j._,{style:{color:c},children:m},"rewardLabel")])}),(0,s.jsx)(j._,{children:y}),(0,s.jsx)(j._,{children:i})]}),(0,s.jsx)(h.h7,{})]}),(0,s.jsxs)("div",{className:ea().row,children:[(0,s.jsx)(h.lI,{}),(0,s.jsxs)("div",{className:ea().rowText,children:[(0,s.jsx)(j._,{strong:!0,children:d("loyalty.how.deals.title")}),(0,s.jsxs)(j._,{children:[d("loyalty.how.deals.description.prefix")," ",(0,s.jsx)("span",{className:ea().link,style:{color:c},children:d("loyalty.how.deals.link2")}),d("loyalty.how.deals.description.suffix")]})]})]}),(0,s.jsxs)("div",{className:ea().row,children:[(0,s.jsxs)("div",{className:ea().rowText,children:[(0,s.jsx)(j._,{strong:!0,children:d("loyalty.how.redeem.title",[(0,s.jsx)(j._,{style:{color:c},children:d("loyalty.how.redeem.link2")},"redeemLink2")])}),(0,s.jsx)(j._,{children:d("loyalty.how.redeem.description",[m,(0,s.jsx)(j._,{strong:!0,style:{color:c},children:d("loyalty.how.redeem.link1")},"redeemLink1")])})]}),(0,s.jsx)(h.uT,{})]})]})})}var es=l(64723),eo=l.n(es);function ed(e){let{availablePoints:r,thresholds:l}=e;if(!l.length)return null;let t=100/l.length,n=function(e,r){if(e<=0)return 0;let l=r.length,t=100/l;if(e<r[0])return e/r[0]*t;if(e>=r[l-1])return 100;for(let n=0;n<l-1;n++){let l=r[n],a=r[n+1];if(e>
1=l&&e<a){let r=(n+1)*t;return r+(e-l)/(a-l)*((n+2)*t-r)}}return 100}(r,l);return(0,s.jsx)("div",{className:eo().wrapper,children:(0,s.jsxs)("div",{className:eo().track,children:[(0,s.jsx)("div",{className:eo().fill,style:{width:"".concat(n,"%"),backgroundColor:"var(--ant-color-success)"}}),(0,s.jsx)("div",{className:eo().dotWrapper,style:{left:"0%"},children:(0,s.jsx)(j._,{className:eo().labelBelow,children:"0"})}),l.map((e,l)=>{let n=r>=e;return(0,s.jsxs)("div",{className:eo().dotWrapper,style:{left:"".concat((l+1)*t,"%")},children:[(0,s.jsx)("div",{className:eo().dot,style:{backgroundColor:n?"var(--ant-color-success)":"#EEEEEE",border:"2px solid ".concat(n?"var(--ant-color-success)":"#EEEEEE")}}),(0,s.jsx)(j._,{className:l%2==0?eo().labelAbove:eo().labelBelow,children:e.toLocaleString()})]},e)})]})})}var ec=l(43562),eu=l(23367),em=l(51285),ep=l.n(em);function eh(e){let{availableStamps:r,totalSlots:l}=e;return 0===l?null:(0,s.jsx)(N.Z,{wrap:"wrap",gap:8,className:ep().container,children:Array.from({length:l}).map((e,l)=>l<r?(0,s.jsx)(ec.d,{style:{fontSize:28}},l):(0,s.jsx)(eu.b,{style:{fontSize:28}},l))})}var ey=l(62314),ev=l.n(ey);function ex(e){var r;let{loyaltyProgram:l,availablePoints:t,availableStamps:n,thresholds:a,promotions:i,viewRewardsAndOffers:d}=e,{t:c}=(0,p.q)(),[u,m]=(0,o.useState)(!1),y=(0,C.Z)(e=>e.company),v=(0,J.Z)(e=>e.website),x=(null==v?void 0:v.logoUrl)||(null==y?void 0:y.locationWebLogoUrl),f=l.rewardType===I.J.STAMPS,_=c(f?"loyalty.stamps":"loyalty.points"),g=f?n:t,b=f&&a.length?a[a.length-1]:0,E=null!==(r=l.description)&&void 0!==r?r:"",w=l.backgroundImageUrl?{backgroundImage:"url(".concat(l.backgroundImageUrl,")"),backgroundSize:"cover",backgroundPosition:"center"}:{};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(Y.Z,{className:ev().card,style:w,children:[(0,s.jsxs)("div",{className:ev().header,children:[x&&(0,s.jsx)(er(),{src:x,alt:"company logo",width:0,height:0,sizes:"100vw",className:ev().logo}),(0,s.jsx)(j._,{type:"secondary",children:c("loyalty.card.title")})]}),(0,s.jsxs)("div",{className:ev().counts,children:[(0,s.jsxs)(N.Z,{vertical:!0,gap:8,children:[(0,s.jsx)(z.F,{level:2,style:{margin:0},children:f?"".concat(n,"/").concat(b):g.toLocaleString()}),(0,s.jsx)(j._,{type:"secondary",style:{fontSize:13},children:c("loyalty.available",[_])})]}),E?(0,s.jsx)(j._,{type:"secondary",className:ev().earningRule,children:E}):null]}),f?(0,s.jsx)(eh,{availableStamps:n,totalSlots:b}):(0,s.jsx)(ed,{availablePoints:t,thresholds:a}),(0,s.jsxs)("div",{className:ev().actions,children:[(0,s.jsx)(K.ZP,{type:"primary",onClick:d,children:c("loyalty.view.rewards")}),(0,s.jsx)(K.ZP,{type:"text",onClick:()=>m(!0),children:c("loyalty.how.it.works")})]}),l.endDate&&(0,s.jsxs)("div",{className:ev().expiry,children:[(0,s.jsxs)(j._,{type:"secondary",children:[c("loyalty.expiry")," ",(0,$.WU)(new Date(l.endDate),"dd/MM/yyyy")]}),(0,s.jsx)(h.dV,{style:{width:64,height:64}})]})]}),(0,s.jsx)(ei,{open:u,onClose:()=>m(!1),rewardType:l.rewardType,loyaltyDescription:l.description,promotions:i})]})}var ef=l(69588),e_=l(33200),eg=l(37781),ej=l(63804),eb=l(51906);function eI(e){return"".concat(e.promotionId,"-").concat(e.conditionGroupId)}var eE=l(53380);let eN=e=>{let{data:r,isFetching:l,isLoading:t}=(0,L.z)({queryKey:["GET_SHOPPING_CART",e],queryFn:()=>(0,eE.mH)(e),enabled:!!e});return{data:r,isFetching:l,isLoading:t}};var ew=l(20357),eS=l(1073),eT=l(84976),eR=l(83406),eC=l(73888),eZ=l(81719),eD=l(70309),eP=l(44961);let eA=e=>{let{data:r,isLoading:l,isSuccess:t}=(0,L.z)({queryKey:["GET_PROMOTION_BY_ID",e],queryFn:()=>(0,q.cc)(e),enabled:!!e,...x.lb});return{data:r,isLoading:l,isSuccess:t}},eO=()=>{let{mutate:e,mutateAsync:r,status:l,error:t,data:n,isPending:a}=(0,A.b)({mutationFn:e=>(0,q.TI)(e),onError:e=>{console.log("usePostCustomerAuthenticate",e)}});return{mutate:e,mutateAsync:r,status:l,error:t,data:n,isPending:a}};var eL=l(1237),ek=l(14007),eF=l(52506),eM=l(76174),eq=l(1103),eU=l.n(eq);function eH(e){let{booster:r,rewardType:l}=e,{colorPrimary:t}=(0,V.F)(),{t:n}=(0,p.q)(),{name:a,description:i,multiplier:o,imageUrl:d}=r,c=n(l===I.J.POINTS?"loyalty.points":"loyalty.stamps"),u="".concat(o,"x ").concat(c);return(0,s.jsx)(Y.Z,{className:eU().card,children:(0,s.jsxs)(N.Z,{align:"center",gap:12,children:[(0,s.jsx)("div",{className:eU().thumbnail,children:d?(0,s.jsx)(er(),{src:d,alt:a,fill:!0,sizes:"64px",className:eU().image}):(0,s.jsx)(eM.Z,{style:{fontSize:32,color:t}})}),(0,s.jsxs)(N.Z,{vertical:!0,gap:4,className:eU().content,children:[(0,s.jsxs)(N.Z,{align:"center",justify:"space-between",gap:8,children:[(0,s.jsx)(z.F,{level:5,style:{margin:0},children:a}),(0,s.jsx)(z.F,{level:5,style:{margin:0,whiteSpace:"nowrap"},children:u})]}),(0,s.jsx)(j._,{type:"secondary",children:i})]})]})})}function eG(e){let{boosters:r,rewardType:l}=e;return(0,s.jsx)("div",{children:r.map(e=>(0,s.jsx)(eH,{booster:e,rewardType:l},e.id))})}var ez=l(54975),eV=l(31557),eB=l(35577),eY=l(60141),eK=l(64055),eW=l(21550),eQ=l(6793
16),eX=l(45243),eJ=l(37228),e$=l(72168),e0=l(73484),e1=l(76260),e2=l(82506),e4=l.n(e2);function e6(e){let{group:r,item:l,isApplied:t,isMaxReached:n,isRemoving:a,onSelectDeal:i,onRemoveDeal:o}=e,{t:d}=(0,p.q)(),{formatCompanyCurrency:c}=(0,eQ.f)(),u=!t&&(r.isLocked||n),m=null!==l.discountPercentage?"-".concat(l.discountPercentage,"%"):"-".concat(c(l.discountAmount));return(0,s.jsx)("div",{className:e4().wrapper,children:(0,s.jsx)(e0.Z.Ribbon,{text:m,color:"red",children:(0,s.jsx)(Y.Z,{className:"".concat(e4().card," ").concat(u?e4().locked:""),styles:{body:{padding:12}},cover:(0,s.jsxs)("div",{className:e4().imageWrapper,children:[(0,s.jsx)(er(),{src:l.imageUrl||x.TL.NONE,alt:l.name,fill:!0,sizes:"176px",className:e4().image}),t&&(0,s.jsxs)(N.Z,{vertical:!0,align:"center",justify:"center",gap:4,className:e4().appliedOverlay,children:[(0,s.jsx)(eX.Z,{className:e4().appliedIcon}),(0,s.jsx)(j._,{className:e4().appliedText,children:d("loyalty.featured.deals.added.to.cart")})]})]}),children:(0,s.jsxs)(N.Z,{vertical:!0,gap:12,children:[(0,s.jsx)(j._,{strong:!0,ellipsis:!0,title:l.name,children:l.name}),t?(0,s.jsx)(e1.Z,{title:d("loyalty.featured.deals.remove.confirm.title"),description:d("loyalty.featured.deals.remove.confirm.description"),icon:(0,s.jsx)(eJ.Z,{}),okText:d("label.yes"),cancelText:d("label.no"),onConfirm:()=>o(r.promotionId,l.menuItemId),children:(0,s.jsx)(K.ZP,{danger:!0,block:!0,loading:a,children:d("loyalty.featured.deals.remove")})}):(0,s.jsx)(K.ZP,{type:"primary",block:!0,disabled:u,icon:u?(0,s.jsx)(e$.Z,{}):void 0,onClick:()=>i(r,l),children:d("loyalty.featured.deals.select")})]})})})})}var e8=l(15612),e5=l.n(e8);function e3(e){var r;let{group:l,rewardType:t,appliedUnits:n,remainingUnits:a,removingItemId:i,isItemApplied:o,onSelectDeal:d,onRemoveDeal:c,onOpenDealDetail:u}=e,{t:m}=(0,p.q)(),{scrollRef:h,canScrollLeft:y,canScrollRight:v,showScrollButtons:x,scroll:f}=(0,ez.m)({scrollAmount:190,dependencies:[l.items.length]}),_=m(t===I.J.STAMPS?"loyalty.featured.deals.stamps.required":"loyalty.featured.deals.points.required",[l.requiredValue]),g=0===a;return(0,s.jsxs)(Y.Z,{className:"".concat(e5().group," ").concat(l.isLocked?e5().locked:""),styles:{body:{padding:16}},children:[(0,s.jsxs)(N.Z,{align:"center",gap:8,wrap:!0,className:e5().header,children:[l.isLocked?(0,s.jsx)(eV.Z,{}):(0,s.jsx)(eB.Z,{}),(0,s.jsx)(j._,{strong:!0,children:l.promotionName}),(0,s.jsx)(eY.Z,{role:"button",tabIndex:0,"aria-label":m("loyalty.featured.deals.view.terms"),title:m("loyalty.featured.deals.view.terms"),className:e5().infoIcon,onClick:()=>u(l.promotionId),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),u(l.promotionId))}}),(0,s.jsxs)(N.Z,{align:"center",gap:6,className:e5().requirement,children:[l.isLocked?(0,s.jsx)(eu.b,{style:{fontSize:18}}):(0,s.jsx)(ec.d,{style:{fontSize:18}}),(0,s.jsx)(j._,{strong:!0,children:_})]}),0!==l.maxQuantity&&(0,s.jsx)(eW.Z,{className:"".concat(e5().counter," ").concat(g?e5().counterComplete:""),children:m("loyalty.featured.deals.applied.count",[n,null!==(r=l.maxQuantity)&&void 0!==r?r:1])})]}),(0,s.jsxs)("div",{className:e5().rowWrapper,children:[x&&y&&(0,s.jsx)(K.ZP,{type:"text",variant:"outlined",color:"primary",shape:"circle",icon:(0,s.jsx)(ek.Z,{}),"aria-label":m("loyalty.featured.deals.scroll.left"),className:"".concat(e5().arrow," ").concat(e5().arrowLeft),onClick:()=>f("left")}),(0,s.jsx)("div",{ref:h,className:e5().row,children:l.items.map(e=>(0,s.jsx)(e6,{group:l,item:e,isApplied:o(l.promotionId,e.menuItemId),isMaxReached:g,isRemoving:i===e.menuItemId,onSelectDeal:d,onRemoveDeal:c},e.menuItemId))}),x&&v&&(0,s.jsx)(K.ZP,{type:"text",variant:"outlined",color:"primary",shape:"circle",icon:(0,s.jsx)(eK.Z,{}),"aria-label":m("loyalty.featured.deals.scroll.right"),className:"".concat(e5().arrow," ").concat(e5().arrowRight),onClick:()=>f("right")})]})]})}function e7(e){let{rewardType:r,groups:l,removingItemId:t,getAppliedUnits:n,getRemainingForGroup:a,isItemApplied:i,onSelectDeal:o,onRemoveDeal:d,onOpenDealDetail:c}=e,{t:u}=(0,p.q)();return l.length?(0,s.jsxs)(N.Z,{vertical:!0,className:"mb-4",children:[(0,s.jsx)(z.F,{level:5,style:{margin:0},children:u("loyalty.featured.deals.title")}),(0,s.jsx)(j._,{type:"secondary",className:"!mb-4",children:u("loyalty.featured.deals.subtitle")}),l.map(e=>(0,s.jsx)(e3,{group:e,rewardType:r,appliedUnits:n(e.promotionId),remainingUnits:a(e),remov
1ingItemId:t,isItemApplied:i,onSelectDeal:o,onRemoveDeal:d,onOpenDealDetail:c},"".concat(e.promotionId,"-").concat(e.conditionGroupId)))]}):null}var e9=l(87536),re=l(83847),rr=l(5942),rl=l(31658),rt=l(81120),rn=l(88923),ra=l(78013),ri=l(39544),rs=l(29620),ro=l(10227),rd=l(78021),rc=l(14179),ru=l.n(rc);function rm(e){let{branchId:r,group:l,item:t,product:n,isProductLoading:a,remainingUnits:i,resolveCartForRedeem:d,onRedeemed:c,onClose:u}=e,{t:m}=(0,p.q)(),{formatCompanyCurrency:h}=(0,eQ.f)(),{methods:y,control:x,quantity:f,maxQuantity:_,originalTotal:g,discountedTotal:j,hasDiscount:b,discount:I,isRedeeming:E,activeCompositions:w,optionGroupOffset:S,actionLabel:T,onChangeQuantity:R,onSubmit:Z}=function(e){var r,l,t,n,a,i;let{branchId:s,group:d,item:c,product:u,remainingUnits:m,resolveCartForRedeem:h,onRedeemed:y,onClose:x}=e,{t:f}=(0,p.q)(),_=(0,C.Z)(e=>e.company),g=(0,v.Z)(e=>e.customer),j=(0,e9.cI)(),{control:b,handleSubmit:I,setValue:E,watch:N}=j,w=null!==(t=N("quantity"))&&void 0!==t?t:1,S=null!==(n=N("price"))&&void 0!==n?n:0,T=null!==(a=N("subItems"))&&void 0!==a?a:[],R=(0,o.useMemo)(()=>{var e,r;return null!==(r=null==u?void 0:null===(e=u.productCompositions)||void 0===e?void 0:e.filter(e=>e.active))&&void 0!==r?r:[]},[null==u?void 0:u.productCompositions]),Z=null!==(i=null==u?void 0:null===(l=u.optionGroups)||void 0===l?void 0:null===(r=l.filter(e=>!!e.active))||void 0===r?void 0:r.length)&&void 0!==i?i:0,D=(0,o.useMemo)(()=>{var e;let r={};return null==u||null===(e=u.optionGroups)||void 0===e||e.forEach(e=>{e.freeOptionsQuantity>0&&(r[e.id]=e.freeOptionsQuantity)}),r},[null==u?void 0:u.optionGroups]),P=(0,o.useMemo)(()=>{var e;let r=new Map;return null==u||null===(e=u.optionGroups)||void 0===e||e.forEach(e=>{var l;null===(l=e.options)||void 0===l||l.forEach(e=>{null!=e.id&&r.set(e.id,e)})}),r},[null==u?void 0:u.optionGroups]),A=(0,o.useMemo)(()=>(function(e,r){let l=null!==r.discountPercentage,t=l?r.discountPercentage:r.discountAmount;return{promotionId:e.promotionId,promotionName:e.promotionName,discountValue:t,minQuantity:1,percentage:l,priceAfterDiscount:r.priceAfterDiscount}})(d,c),[d,c]),O=S+(0,eS.K_)(T,{freeQuantityMap:D,optionMap:P}),L=w*O,k=(0,ra.ud)(A,O),F=(0,ra.cJ)(O,w,A),{mutateAsync:M,isPending:q}=eO(),U=(0,o.useCallback)(e=>{E("quantity",null!=e?e:1)},[E]),H=I(async e=>{var r,l;if(!_||!g)return;let{proceed:t,cartId:n}=await h();if(!t)return;let a=(0,eS.Tj)(e),i=function e(r){return(null==r?void 0:r.length)?r.map(r=>({entityId:r.entityId,entityType:r.entityType,...r.entityType===eb.py.MODIFIER&&{quantity:r.quantity},subItems:e(r.subItems)})):[]}(null==a?void 0:a.subItems),o={promotionId:d.promotionId,companyId:_.id,customerId:null!==(r=g.id)&&void 0!==r?r:0,channel:eT.$.WEB,flow:eb.Zw.MENU,menuItemId:c.menuItemId,quantity:null!==(l=e.quantity)&&void 0!==l?l:1,...void 0!==n&&{shoppingCartId:n},...i.length>0&&{subItems:i}};await M({branchId:s,redeemPayload:o},{onSuccess:e=>{y(e.shoppingCart),x()}})});return(0,o.useEffect)(()=>{u&&(E("entityId",u.id),E("entityType","product"),E("quantity",1),E("price",u.price))},[u,E]),{methods:j,control:b,quantity:w,maxQuantity:void 0===m?void 0:Math.max(1,m),originalTotal:L,discountedTotal:F,hasDiscount:k,discount:A,isRedeeming:q,activeCompositions:R,optionGroupOffset:Z,actionLabel:f("loyalty.featured.deals.redeem"),onChangeQuantity:U,onSubmit:H}}({branchId:r,group:l,item:t,product:n,remainingUnits:i,resolveCartForRedeem:d,onRedeemed:c,onClose:u}),D=rs.default.useBreakpoint().xl?420:330,P=!!(null==n?void 0:n.productPhotoUrl);return(0,s.jsx)(et.Z,{open:!0,className:ru().modal,footer:null,onCancel:u,width:{xs:"100%",sm:"100%",md:640,lg:640,xl:640,xxl:640},height:634,closeIcon:!1,styles:{content:{padding:0,borderRadius:16},body:{width:"100%",borderRadius:16}},children:(0,s.jsx)(e9.RV,{...y,children:(0,s.jsxs)("form",{onSubmit:Z,children:[(0,s.jsx)(rt.x,{isBundleComponentMode:!1,onClose:u,product:n,imageHeight:D,hasProductImage:P}),(0,s.jsxs)(N.Z,{vertical:!0,className:ru().content,children:[(0,s.jsxs)(ro.Z,{children:[P&&(0,s.jsx)(rd.Z,{xs:24,lg:24,children:(0,s.jsx)(N.Z,{className:ru().img,children:(0,s.jsx)(re.r,{product:n})})}),(0,s.jsx)(rd.Z,{xs:24,lg:24,children:(0,s.jsxs)(N.Z,{className:ru().contentInner,vertical:!0,gap:16,children:[(0,s.jsx)(rr.x,{product:n,hasDiscount:b,discount:I}),(0,s.jsx)(rl.f,{isLoading:a,product:n,isBundleComponentMode:!1,activeCompositions:w,optionGroupOffset:S,componentProducts:[],control:x,onCustomizeComponent:()=>void 0,t:m,showInstructions:!1})]})})]}),(0,s.jsxs)(N.Z,{className:ru().stickyFooter,gap:16,children:[(0,s.jsx)(ri.l,{value:f,onChange:R,isLoading:a,min:1,max:_}),(0,s.jsx)(rn.M,{isCartLoading:E,actionLabel:T,isBundleComponentMode:!1,total:j,hasDiscount:b,originalTotal:g,discount:I,formatCompanyCurrency:h,isPriceLoading:a})]})]})]})})})}var rp=l(57446),rh=l(33301),ry=l.n(rh);function rv(e){let{imageUrl:r,name:l,discountTypes:t}=e;return r?(0,s.jsx)(er(),{src:r,alt:l,fill:!0,sizes:"96px",className:ry().image}):t[0]===R.a1.ORDER?(0,s.jsx)(N.Z,{align:"center",justify:"center",style:{height:"100%"},children:(0,s.jsx)(h.oO,{style:{width:64,height:64}})}):t[0]===R.a1.DELIVERY?(0,s.jsx)(N.Z,{align:"center",justify:"center",style:{height:"100%"},children:(0,s.jsx)(h.cy,{style:{width:64,height:64}})}):(0,s.jsx)(er(),{src:x.TL.NONE,alt:l,fill:!0,sizes:"96px",className:ry().image})}function rx(e){let{item:r,isLocked:l,onOpenRewardDetail:t,selectedRewardIds:n,unredeemingPromoId:a,onRemoveFromOrder:i}=e,{t:o}=(0,p.q)(),{name:d,description:c,imageUrl:u,discountTypes:m}=r,h=n.includes(r.id),y=a===r.id;return(0,s.jsx)(Y.Z,{className:"".concat(ry().card," ").concat(l?ry().locked:""),styles:{body:{padding:12}},onClick:()=>!l&&t(r.id),children:(0,s.jsxs)(N.Z,{align:"center",gap:12,justify:"space-between",children:[(0,s.jsxs)(N.Z,{align:"center",gap:12,children:[(0,s.jsx)("div",{className:ry().imageWrapper,children:(0,s.jsx)(rv,{imageUrl:u,name:d,discountTypes:m})}),(0,s.jsxs)(N.Z,{vertical:!0,gap:4,children:[(0,s.jsx)(z.F,{level:5,style:{margin:0},children:d}),(0,s.jsx)(j._,{type:"secondary",children:c})]})]}),h&&(0,s.jsx)(e1.Z,{title:o("loyalty.reward.remove.title"),description:o("loyalty.reward.remove.description"),icon:(0,s.jsx)(eJ.Z,{}),okText:o("label.yes"),cancelText:o("label.no"),onConfirm:e=>{null==e||e.stopPropagation(),i(r.id)},onCancel:e=>null==e?void 0:e.stopPropagation(),children:(0,s.jsx)(K.ZP,{icon:(0,s.jsx)(rp.Z,{}),size:"small",onClick:e=>e.stopPropagation(),loading:y,block:!0,style:{maxWidth:60,height:50}})})]})})}var rf=l(13103),r_=l.n(rf);function rg(e){let{item:r,onOpenRewardDetail:l,selectedRewardIds:t,unredeemingPromoId:n,onRemoveFromOrder:a}=e,{requiredValue:i,isLocked:o,promotions:d}=r;return(0,s.jsxs)(Y.Z,{className:r_().group,styles:{body:{padding:0}},children:[(0,s.jsxs)(N.Z,{align:"center",gap:10,className:r_().header,children:[o?(0,s.jsx)(eV.Z,{className:r_().lockIcon}):(0,s.jsx)(eB.Z,{className:r_().lockIcon}),o?(0,s.jsx)(eu.b,{style:{fontSize:28}}):(0,s.jsx)(ec.d,{style:{fontSize:28}}),(0,s.jsx)(j._,{strong:!0,style:{flex:1},children:i})]}),(0,s.jsx)("div",{className:r_().items,children:d.map(e=>(0,s.jsx)(rx,{item:e,isLocked:o,onOpenRewardDetail:l,selectedRewardIds:t,unredeemingPromoId:n,onRemoveFromOrder:a},e.id))})]})}function rj(e){let{rewardGroups:r,onOpenRewardDetail:l,selectedRewardIds:t,unredeemingPromoId:n,onRemoveFromOrder:a}=e;return(0,s.jsx)("div",{children:r.map(e=>(0,s.jsx)(rg,{item:e,onOpenRewardDetail:l,selectedRewardIds:t,unredeemingPromoId:n,onRemoveFromOrder:a},e.requiredValue))})}var rb=l(87464),rI=l(85668);function rE(e){let{onClose:r,promotion:l,onAddToOrder:t,onRemoveFromOrder:n,isRedeeming:a,isUnredeeming:i,selectedRewardIds:o,hideActions:d=!1}=e,{t:c}=(0,p.q)(),{expiryDate:u,termItems:m}=function(e){var r,l;let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{t:n}=(0,p.q)(),{formatDate:a}=(0,rb.a)(),{formatDay:i}=(0,rI.kt)(),{formatCompanyCurrency:s}=(0,eQ.f)();if(!e)return{expiryDate:null,termItems:[]};let o=e.endDate,d=a(e.endDate)||null,c=e.conditionGroups.flatMap(e=>e.conditions),u=c.find(e=>e.type===R.Ex.ORDER_AMOUNT),m=null==u?void 0:u.minimumPurchaseAmount,h=null==u?void 0:u.maximumDiscountAmount,y=c.some(e=>e.type===R.Ex.PROMOTION_CODE&&!0===e.promoCodeOnePerUser),v=c.find(e=>e.type===R.Ex.PLATFORM),x=null==v?void 0:v.platforms,f=c.filter(e=>e.type===R.Ex.DELIVERY_OPTION).flatMap(e=>e.deliveryTypes||[]).join(", "),_=null===(l=c.find(e=>e.type===R.Ex.PAYMENT_METHOD))||void 0===l?void 0:null===(r=l.paymentMethods)||void 0===r?void 0:r.join(", "),g=c.filter(e=>e.type===R.Ex.TIME_PERIOD&&null!=e.dayOfWeek).map(e=>Number(e.dayOfWeek)).sort((e,r)=>(1===e?8:e)-(1===r?8:r)).map(e=>i(e)).join(", "),j=[];return null!=m&&j.push(n("loyalty.reward.terms.minimum.spend",[s(m)])),null!=h&&j.push(n("loyalty.reward.terms.maximum.discount",[s(h)])),o&&j.push(n("loyalty.reward.terms.limited.time")),y&&j.push(n("loyalty.reward.terms.one.time.use")),t||(j.push(n("loyalty.reward.terms.cannot.combine")),(null==x?void 0:x.length)?j.push(n("loyalty.reward.terms.platform.specific",[x.join(", ")
1])):j.push(n("loyalty.reward.terms.available.all.channels"))),f&&j.push(n("loyalty.reward.terms.order.types",[f])),_&&j.push(n("loyalty.reward.terms.payment.methods",[_])),g&&j.push(n("loyalty.reward.terms.time.period",[g])),{expiryDate:d,termItems:j}}(l,!0),h=o.includes(l.id);return(0,s.jsx)(et.Z,{open:!0,onCancel:r,footer:null,title:(0,s.jsx)(z.F,{level:3,style:{margin:0,textAlign:"center"},children:l.name}),children:(0,s.jsxs)(N.Z,{vertical:!0,gap:16,children:[l.imageUrl&&(0,s.jsx)("div",{style:{position:"relative",width:"100%",minHeight:180,borderRadius:8,overflow:"hidden"},children:(0,s.jsx)(er(),{src:l.imageUrl,alt:l.name,fill:!0,sizes:"100%",style:{objectFit:"contain"}})}),(0,s.jsxs)(N.Z,{vertical:!0,gap:4,children:[(0,s.jsx)(z.F,{level:4,style:{margin:0},children:l.name}),(0,s.jsx)(z.F,{level:5,style:{margin:0},className:"text-description text-normal",children:l.description})]}),(0,s.jsxs)(N.Z,{vertical:!0,children:[m.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(z.F,{level:5,className:"!m-0 !mb-1",children:c("loyalty.reward.terms.title")}),m.map((e,r)=>(0,s.jsxs)(j._,{type:"secondary",className:"!ml-2",children:["• ",e]},r))]}),u&&(0,s.jsx)(eW.Z,{color:"default",className:"!w-fit !mt-1",children:(0,s.jsx)(j._,{type:"secondary",children:c("loyalty.reward.valid.until",[u])})})]}),d?null:l.applyAutomatically?(0,s.jsx)(K.ZP,{type:"primary",block:!0,size:"large",disabled:!0,children:c("loyalty.reward.applied.automatically")}):h?(0,s.jsx)(K.ZP,{danger:!0,block:!0,size:"large",onClick:()=>n(l.id),loading:i,children:c("loyalty.reward.remove.from.order")}):(0,s.jsx)(K.ZP,{type:"primary",block:!0,size:"large",onClick:t,loading:a,children:c("loyalty.reward.add.to.order")})]})})}var rN=l(51281),rw=l.n(rN);function rS(e){var r;let{onBack:l,promotions:t,availablePoints:n,availableStamps:a,conditionType:i,branchId:d,branchUrlPath:c,loyaltyProgram:u}=e,{t:m}=(0,p.q)(),{rewardGroups:h,selectedPromo:y,isLoading:x,isRedeeming:f,isUnredeeming:_,rewardType:g,selectedRewardIds:j,unredeemingPromoId:b,contextHolder:I,onOpenRewardDetail:E,onCloseRewardDetail:w,onOpenDealDetail:S,isDetailReadOnly:T,onAddToOrder:Z,onRemoveFromOrder:P,cart:A,existingCartId:O,updateCartWithSummary:L,resolveCartForRedeem:k,available:F}=function(e){var r;let{branchId:l,branchUrlPath:t,promotions:n,availablePoints:a,availableStamps:i,conditionType:s,loyaltyProgram:d}=e,{t:c}=(0,p.q)(),{showSuccess:u}=(0,eg.p)(),m=(0,v.Z)(e=>e.customer),h=(0,C.Z)(e=>e.company),{setCartSummary:y}=(0,eR.Z)(e=>e),x=(0,eC.Z)(e=>e.setShoppingCart),[f,_]=et.Z.useModal(),[g,j]=(0,o.useState)(null),[b,I]=(0,o.useState)(!1),[E,N]=(0,o.useState)(null),[w,S]=(0,o.useState)(()=>(function(e){var r,l;let t=parseInt(null!==(r=localStorage.getItem(ew.z.cartId))&&void 0!==r?r:""),n=parseInt(null!==(l=localStorage.getItem(ew.z.branchId))&&void 0!==l?l:"");return isNaN(t)||n!==e?void 0:t})(l)),[T,Z]=(0,o.useState)(void 0),D=(0,o.useMemo)(()=>{var e,r;return null!==(r=null==T?void 0:null===(e=T.loyaltyRedemption)||void 0===e?void 0:e.promotionIds)&&void 0!==r?r:[]},[null==T?void 0:null===(r=T.loyaltyRedemption)||void 0===r?void 0:r.promotionIds]),P=d.rewardType,A=s===R.Ex.POINTS_THRESHOLD?null!=a?a:0:null!=i?i:0,O=(0,o.useMemo)(()=>(function(e,r,l){let t=r===R.Ex.POINTS_THRESHOLD,n=new Map;for(let s of e)for(let e of s.conditionGroups)if(!e.discounts.some(e=>{var r;return e.type===R.a1.MENU_ITEM&&(null===(r=e.menuItems)||void 0===r?void 0:r.length)>0}))for(let o of e.conditions){var a,i;if(o.type!==r)continue;let d=t?null!==(a=o.requiredPoints)&&void 0!==a?a:0:null!==(i=o.requiredStamps)&&void 0!==i?i:0;n.has(d)||n.set(d,{requiredValue:d,isLocked:l<d,promotions:[]}),n.get(d).promotions.push({id:s.id,name:s.name,description:s.description,imageUrl:s.imageUrl,endDate:s.endDate,discountTypes:e.discounts.map(e=>e.type)})}return Array.from(n.values()).sort((e,r)=>e.requiredValue-r.requiredValue)})(function(e){let r=new Date;return e.filter(e=>!(!e.active||(0,eZ.R)(r,(0,eD.D)(e.startDate))||e.endDate&&(0,eP.A)(r,(0,eD.D)(e.endDate))))}(n),s,A),[n,s,A]),{data:L,isLoading:k}=eA(null!=g?g:void 0),{mutateAsync:F,isPending:M}=eO(),{mutateAsync:q,isPending:U}=(0,e_.Mc)(),{mutate:H}
1=(0,e_.Lk)(),{data:G,isFetching:z}=eN(w),V=(0,o.useCallback)(e=>{var r,n;Z(e),S(e.id),x(e),(0,eS.XH)(e.id,l,null!==(r=e.customerId)&&void 0!==r?r:void 0);let a=e.items.reduce((e,r)=>e+r.quantity,0),i=e.branchId===l&&null!=t?t:"";y({cartId:null!==(n=e.id)&&void 0!==n?n:0,branchUrl:i,cartTotal:a})},[l,t,y,x]),B=(0,o.useCallback)(e=>{I(!1),j(e)},[]),Y=(0,o.useCallback)(e=>{I(!0),j(e)},[]),K=(0,o.useCallback)(()=>{j(null),I(!1)},[]),W=(0,o.useCallback)(async()=>{var e,r;let t=parseInt(null!==(e=localStorage.getItem(ew.z.branchId))&&void 0!==e?e:""),n=parseInt(null!==(r=localStorage.getItem(ew.z.cartId))&&void 0!==r?r:"");return isNaN(t)||isNaN(n)||t===l?{proceed:!0,cartId:w}:await f.confirm({title:c("loyalty.reward.different.branch.title"),content:c("loyalty.reward.different.branch.content"),okText:c("label.button.confirm"),cancelText:c("label.button.cancel"),centered:!0})?(H(n),{proceed:!0,cartId:void 0}):{proceed:!1}},[l,w,f,H,c]),Q=(0,o.useCallback)(async()=>{var e;if(!m||!h||!L)return;let{proceed:r,cartId:t}=await W();if(!r)return;let n={promotionId:L.id,companyId:h.id,customerId:null!==(e=m.id)&&void 0!==e?e:0,channel:eT.$.WEB,flow:eb.Zw.MENU,...void 0!==t&&{shoppingCartId:t}};await F({branchId:l,redeemPayload:n},{onSuccess:e=>{V(e.shoppingCart),e.message&&u(c("label.success"),e.message),K()}})},[l,L,h,m,K,F,W,V,u,c]),X=(0,o.useCallback)(async e=>{w&&(N(e),await q({cartId:w,promotionId:e},{onSuccess:e=>{V(e.shoppingCart),e.message&&u(c("label.success"),e.message),K()},onError:()=>{N(null)}}),N(null))},[w,q,V,K,u,c]);return(0,o.useEffect)(()=>{G&&Z(G)},[G]),{rewardGroups:O,selectedPromo:L,isRedeeming:M,isUnredeeming:U,isFetchingCart:z,isLoading:k,rewardType:P,selectedRewardIds:D,unredeemingPromoId:E,contextHolder:_,onOpenRewardDetail:B,onOpenDealDetail:Y,isDetailReadOnly:b,onCloseRewardDetail:K,onAddToOrder:Q,onRemoveFromOrder:X,cart:T,existingCartId:w,updateCartWithSummary:V,resolveCartForRedeem:W,available:A}}({branchId:d,branchUrlPath:c,promotions:t,availablePoints:n,availableStamps:a,conditionType:i,loyaltyProgram:u}),{groups:M,selectedDeal:q,selectedProduct:U,isProductLoading:H,removingItemId:V,getAppliedUnits:B,getRemainingForGroup:Y,isItemApplied:W,onSelectDeal:Q,onCloseRedeemModal:X,onRemoveDeal:J}=function(e){let{promotions:r,conditionType:l,availableValue:t,cart:n,shoppingCartId:a,onCartUpdated:i}=e,{t:s}=(0,p.q)(),{showSuccess:d}=(0,eg.p)(),c=(0,D.useLocale)(),[u,m]=(0,o.useState)(null),[h,y]=(0,o.useState)(null),v=(0,o.useMemo)(()=>(function(e,r,l){let t=r===R.Ex.POINTS_THRESHOLD,n=[];return e.forEach(e=>{e.conditionGroups.forEach(a=>{var i,s;let o=a.conditions.find(e=>e.type===r);if(!o)return;let d=a.discounts.find(e=>{var r;return e.type===R.a1.MENU_ITEM&&(null===(r=e.menuItems)||void 0===r?void 0:r.length)>0});if(!d)return;let c=t?null!==(i=o.requiredPoints)&&void 0!==i?i:0:null!==(s=o.requiredStamps)&&void 0!==s?s:0,u=d.menuItems.map(e=>({menuItemId:e.id,name:e.name,imageUrl:e.image||null,price:e.price,priceAfterDiscount:e.priceAfterDiscount,discountAmount:e.discountAmount,discountPercentage:d.percentage?d.amount:null}));n.push({promotionId:e.id,conditionGroupId:a.id,promotionName:e.name,requiredValue:c,isLocked:l<c,maxQuantity:d.maxQuantity,items:u})})}),n.sort((e,r)=>e.requiredValue-r.requiredValue)})(r,l,t),[r,l,t]),x=(0,o.useMemo)(()=>(function(e){var r,l;let t=new Map;if(!(null==e?void 0:null===(r=e.discounts)||void 0===r?void 0:r.length))return t;let n=new Map;return null===(l=e.items)||void 0===l||l.forEach(e=>n.set(e.id,e.quantity)),e.discounts.forEach(e=>{var r;null===(r=e.appliedPromotions)||void 0===r||r.forEach(e=>{var r,l;if(e.discountType!==ej.L.MENU_ITEM||null==e.lineItemId)return;let a=null!==(r=n.get(e.lineItemId))&&void 0!==r?r:0,i=null!==(l=t.get(e.promotionId))&&void 0!==l?l:0;t.set(e.promotionId,i+a)})}),t})(n),[n]),f=(0,o.useMemo)(()=>(function(e){var r;let l=new Map;return(null==e?void 0:null===(r=e.discounts)||void 0===r?void 0:r.length)&&e.discounts.forEach(e=>{var r;null===(r=e.appliedPromotions)||void 0===r||r.forEach(e=>{var r,t;if(e.discountType!==ej.L.MENU_ITEM)return;let n=null!==(t=l.get(e.promotionId))&&void 0!==t?t:new Set;
1null===(r=e.menuItemIds)||void 0===r||r.forEach(e=>n.add(e)),l.set(e.promotionId,n)})}),l})(n),[n]),_=(0,o.useMemo)(()=>({includePromotions:!0,lang:c,active:!0}),[c]),g=u?Number(u.item.menuItemId):void 0,j=(0,o.useMemo)(()=>{let e=new Map;return v.forEach(r=>{var l;let t=null!==(l=x.get(r.promotionId))&&void 0!==l?l:0;e.set(eI(r),function(e,r){if(0!==e)return Math.max(0,(null!=e?e:1)-r)}(r.maxQuantity,t))}),e},[v,x]),{data:b,isFetching:I}=(0,ef.l$)(g,_),{mutateAsync:E}=(0,e_.Mc)(),N=(0,o.useCallback)(e=>{var r;return null!==(r=x.get(e))&&void 0!==r?r:0},[x]),w=(0,o.useCallback)((e,r)=>{var l,t;return null!==(t=null===(l=f.get(e))||void 0===l?void 0:l.has(r))&&void 0!==t&&t},[f]),S=(0,o.useCallback)(e=>j.get(eI(e)),[j]);return{groups:v,selectedDeal:u,selectedProduct:b,isProductLoading:I,removingItemId:h,getAppliedUnits:N,getRemainingForGroup:S,isItemApplied:w,onSelectDeal:(0,o.useCallback)((e,r)=>{m({group:e,item:r})},[]),onCloseRedeemModal:(0,o.useCallback)(()=>{m(null)},[]),onRemoveDeal:(0,o.useCallback)(async(e,r)=>{a&&(y(r),await E({cartId:a,promotionId:e,menuItemId:r},{onSuccess:e=>{i(e.shoppingCart),e.message&&d(s("label.success"),e.message)}}),y(null))},[a,E,i,d,s])}}({promotions:t,conditionType:i,availableValue:F,cart:A,shoppingCartId:O,onCartUpdated:L}),$="STAMPS"===g,ee=m("loyalty.".concat($?"stamp":"point",".boosts.tab")),er=m("loyalty.your.".concat($?"stamps":"points")),el=$?null!=a?a:0:null!=n?n:0,en=[{key:"REWARDS",label:m("loyalty.rewards.tab"),children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(e7,{rewardType:g,groups:M,removingItemId:V,getAppliedUnits:B,getRemainingForGroup:Y,isItemApplied:W,onSelectDeal:Q,onRemoveDeal:J,onOpenDealDetail:S}),(0,s.jsx)(rj,{rewardGroups:h,onOpenRewardDetail:E,selectedRewardIds:j,unredeemingPromoId:b,onRemoveFromOrder:P})]})},{key:"OFFERS",label:ee,children:(0,s.jsx)(eG,{boosters:null!==(r=u.boosters)&&void 0!==r?r:[],rewardType:g})}];return(0,s.jsxs)(eL.b,{spinning:x,children:[I,(0,s.jsxs)(G.v,{title:m("loyalty.rewards.and.offers.title"),leftIcon:(0,s.jsx)(K.ZP,{icon:(0,s.jsx)(ek.Z,{}),type:"text",style:{marginRight:8},onClick:()=>l()}),children:[(0,s.jsx)(N.Z,{align:"center",justify:"space-between",className:rw().headerBar,children:(0,s.jsxs)(N.Z,{align:"center",gap:8,children:[(0,s.jsx)(z.F,{level:5,children:er}),(0,s.jsx)(ec.d,{style:{fontSize:28}}),(0,s.jsx)(z.F,{level:5,children:el})]})}),q&&(0,s.jsx)(rm,{branchId:d,group:q.group,item:q.item,product:U,isProductLoading:H,remainingUnits:Y(q.group),resolveCartForRedeem:k,onRedeemed:L,onClose:X}),y&&(0,s.jsx)(rE,{isRedeeming:f,isUnredeeming:_,promotion:y,onAddToOrder:Z,onRemoveFromOrder:P,onClose:w,selectedRewardIds:j,hideActions:T}),(0,s.jsx)(eF.Z,{defaultActiveKey:"REWARDS",items:en,tabBarStyle:{width:"100%",paddingTop:16},className:rw().tabs})]})]})}var rT=l(63201),rR=l.n(rT);function rC(e){let{tierProgram:r,rewardType:l,currentTierName:t}=e,{t:n}=(0,p.q)(),{colorPrimary:a}=(0,V.F)(),{getCompanyCurrencySymbol:i}=(0,eQ.f)(),o=i(),d=l===I.J.STAMPS?n("loyalty.stamps"):n("loyalty.points");return(0,s.jsxs)("div",{className:rR().wrapper,children:[(0,s.jsx)(j._,{strong:!0,className:rR().sectionTitle,children:n("loyalty.tier.section.title",[d])}),r.tiers.map(e=>{let l=e.name===t;return(0,s.jsx)(Y.Z,{style:{border:l?"2px solid ".concat(a):void 0,backgroundColor:l?"".concat(a,"10"):void 0},children:(0,s.jsxs)("div",{className:rR().tierCard,children:[e.logoUrl&&(0,s.jsx)(er(),{src:e.logoUrl,alt:e.name,width:40,height:40,style:{objectFit:"contain"}}),(0,s.jsxs)("div",{className:rR().tierInfo,children:[(0,s.jsxs)("div",{className:rR().tierHeader,children:[(0,s.jsx)(z.F,{level:5,children:e.name}),e.multiplier>1&&(0,s.jsxs)(eW.Z,{color:a,children:[e.multiplier,"x ",d]})]}),(0,s.jsx)(j._,{type:"secondary",children:function(e){switch(r.thresholdType){case I.r.TOTAL_POINTS_EARNED:return n("loyalty.tier.total.points",[e.name,e.thresholdValue]);case I.r.TOTAL_STAMPS_EARNED:return n("loyalty.tier.total.stamps",[e.name,e.thresholdValue]);case I.r.ORDERS_COUNT:return n("loyalty.tier.orders",[e.name,e.thresholdValue]);
1case I.r.TOTAL_SPENDING:return n("loyalty.tier.spending",[e.name,o,e.thresholdValue]);default:return""}}(e)})]})]})},e.id)})]})}function rZ(){var e;let{t:r}=(0,p.q)(),{isLoggedIn:l,branches:t,isBranchesLoading:n,selectedBranchId:a,handleBranchChange:i,loyaltyProgram:d,hasNoLoyaltyProgram:c,isEnrolled:u,isEnrolling:m,handleEnroll:h,availablePoints:y,availableStamps:x,thresholds:f,promotions:_,conditionType:g,currentTierName:O,isLoading:L,isShowViewRewardsAndOffers:q,viewRewardsAndOffers:z,onBackToLoyaltyPrograms:V,selectedBranch:B}=function(){var e,r,l,t,n;let a=(0,D.useLocale)(),i=(0,Z.NL)(),s=(0,C.Z)(e=>e.company),d=(0,v.Z)(e=>e.customer),c=null==s?void 0:s.id,u=null==d?void 0:d.id,m=null==d?void 0:d.branchId,p="".concat(null==d?void 0:d.firstName," ").concat(null==d?void 0:null===(e=d.lastName)||void 0===e?void 0:e.charAt(0).toUpperCase(),"."),[h,y]=(0,o.useState)(!1),[x,f]=(0,o.useState)(null!=m?m:void 0),{data:_,isLoading:g}=k(c),{data:j,isLoading:b,isSuccess:E}=M(x,u),N=null==j?void 0:j[0],{data:w,isLoading:S}=(0,T.v)(u),O=(null==N?void 0:N.rewardType)===I.J.STAMPS?R.Ex.STAMPS_THRESHOLD:R.Ex.POINTS_THRESHOLD,{data:L,isLoading:q}=H({storeIds:null!=x?x:0,conditionTypes:O,lang:a},N?u:void 0),{mutate:G,isPending:z}=function(){let{mutate:e,isPending:r}=(0,A.b)({mutationFn:e=>(0,P.re)(e.customerId,e.loyaltyProgramId)});return{mutate:e,isPending:r}}(),V=null==w?void 0:null===(r=w.enrolledPrograms)||void 0===r?void 0:r.find(e=>{var r;return e.programId===(null==N?void 0:N.id)&&(null===(r=e.storeIds)||void 0===r?void 0:r.includes(null!=x?x:0))}),B=null!==(l=null==V?void 0:V.availablePoints)&&void 0!==l?l:0,Y=null!==(t=null==V?void 0:V.availableStamps)&&void 0!==t?t:0,K=(null==L?void 0:L.length)?(null==N?void 0:N.rewardType)===I.J.STAMPS?[...new Set(L.flatMap(e=>e.conditionGroups.flatMap(e=>e.conditions.filter(e=>e.type===R.Ex.STAMPS_THRESHOLD&&null!=e.requiredStamps).map(e=>e.requiredStamps))))].sort((e,r)=>e-r):[...new Set(L.flatMap(e=>e.conditionGroups.flatMap(e=>e.conditions.filter(e=>e.type===R.Ex.POINTS_THRESHOLD&&null!=e.requiredPoints).map(e=>e.requiredPoints))))].sort((e,r)=>e-r):[],W=(0,o.useMemo)(()=>null==_?void 0:_.find(e=>e.id===x),[_,x]),Q=(0,o.useCallback)(()=>{x&&y(!0)},[x]),X=(0,o.useCallback)(()=>{y(!1)},[]);return{isLoggedIn:!!u,branches:null!=_?_:[],isBranchesLoading:g,selectedBranchId:x,handleBranchChange:function(e){f(e)},loyaltyProgram:N,hasNoLoyaltyProgram:E&&!N,isEnrolled:!!V,isEnrolling:z,handleEnroll:function(){u&&N&&G({customerId:u,loyaltyProgramId:N.id},{onSuccess:()=>{i.invalidateQueries({queryKey:[T.e,u]}),i.invalidateQueries({queryKey:[F,x]}),i.invalidateQueries({queryKey:[U]})}})},availablePoints:B,availableStamps:Y,thresholds:K,promotions:null!=L?L:[],conditionType:O,customerFirstName:p,currentTierName:null!==(n=null==V?void 0:V.currentTierName)&&void 0!==n?n:void 0,isLoading:g||b||S||q,isShowViewRewardsAndOffers:h,viewRewardsAndOffers:Q,onBackToLoyaltyPrograms:X,selectedBranch:W}}();return q&&d&&a?(0,s.jsx)(rS,{branchId:a,branchUrlPath:null==B?void 0:B.urlPath,onBack:V,promotions:_,availablePoints:y,availableStamps:x,conditionType:g,loyaltyProgram:d}):(0,s.jsxs)(G.v,{title:r("label.link.loyalty"),children:[!l&&(0,s.jsx)(E.Z,{description:r("loyalty.not.logged.in")}),l&&(0,s.jsxs)(N.Z,{vertical:!0,gap:16,children:[(0,s.jsx)(w.default,{loading:n,value:a,onChange:i,placeholder:r("loyalty.choose.store"),style:{width:"100%",height:56},optionLabelProp:"label",labelRender:e=>{let{label:l}=e;return(0,s.jsxs)(N.Z,{align:"center",gap:10,style:{height:"100%"},children:[(0,s.jsx)(b.V,{style:{fontSize:20,color:"var(--ant-color-text-base)"}}),(0,s.jsxs)(N.Z,{vertical:!0,gap:0,children:[(0,s.jsx)(j._,{style:{fontSize:11,color:"var(--ant-color-text-secondary)",lineHeight:1.2},children:r("loyalty.choose.store")}),(0,s.jsx)(j._,{strong:!0,style:{fontSize:14,lineHeight:1.3},children:l})]})]})},options:t.map(e=>({value:e.id,label:e.name}))}),L&&!c&&!d&&(0,s.jsx)(S.Z,{active:!0,paragraph:{rows:6}}),c&&(0,s.jsx)(E.Z,{description:r("loyalty.no.program")}),d&&!d.automaticEnrollment&&!u&&(0,s.jsx)(X,{isEnrolling:m,onEnrol:h}),d&&(d.automaticEnrollment||u)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ex,{loyaltyProgram:d,availablePoints:y,availableStamps:x,thresholds:f,promotions:_,viewRewardsAndOffers:z}),d.tierProgram&&(0,s.jsx)(rC,{tierProgram:d.tierProgram,rewardType:null!==(e=d.rewardType)&&void 0!==e?e:I.J.POINTS,currentTierName:O})]})]})]})}var rD=l(82220),rP=l(53901),rA=l(2199),rO=l(74873);
1let rL={promotionEmail:!1,promotionSms:!1,receivePushNotification:!1},rk=[{field:"promotionEmail",labelKey:"label.marketing.email"},{field:"promotionSms",labelKey:"label.marketing.sms"},{field:"receivePushNotification",labelKey:"label.marketing.push"}];function rF(){let{t:e}=(0,p.q)(),{preferences:r,hasCustomer:l,isLoading:t,isSaving:n,savingField:a,onPreferenceChange:i}=function(){let e=(0,v.Z)(e=>e.customer),r=(0,v.Z)(e=>e.setCustomer),[l,t]=(0,o.useState)(rL),[n,a]=(0,o.useState)(),{data:i,isLoading:s}=(0,rA._)(null==e?void 0:e.id),{mutate:d,isPending:c}=(0,rO.B)({silentSuccess:!0}),u=(0,o.useCallback)(e=>({promotionEmail:!!e.promotionEmail,promotionSms:!!e.promotionSms,receivePushNotification:!!e.receivePushNotification}),[]),m=(0,o.useCallback)((e,n)=>{if(!i)return;let s={...l,[e]:n};t(s),a(e),d(s,{onSuccess:e=>{t(u(e)),r(e)},onError:()=>{t(l)},onSettled:()=>{a(void 0)}})},[i,l,d,r,u]);return(0,o.useEffect)(()=>{i&&t(u(i))},[i,u]),{preferences:l,hasCustomer:!!i,isLoading:s,isSaving:c,savingField:n,onPreferenceChange:m}}();return(0,s.jsx)(G.v,{title:e("page.title.marketing.preferences"),isLoading:t,children:l&&(0,s.jsx)(rD.Z,{header:(0,s.jsx)(j._,{type:"secondary",children:e("label.marketing.preferences.description")}),dataSource:rk,renderItem:l=>{let{field:t,labelKey:o}=l;return(0,s.jsx)(rD.Z.Item,{actions:[(0,s.jsx)(rP.Z,{checked:r[t],loading:a===t,disabled:n,onChange:e=>i(t,e)},t)],children:(0,s.jsx)(j._,{children:e(o)})})}})})}var rM=l(13754),rq=l(83846),rU=l(6350);let rH=e=>{let r=(0,D.useLocale)(),{data:l,error:t,isFetching:n,refetch:a}=(0,L.z)({queryKey:["GET_ORDER_BY_ID",e,r],queryFn:()=>(0,rU.co)(null!=e?e:0,r),enabled:!!e,staleTime:0});return{data:l,error:t,isFetching:n,refetch:a}};var rG=l(99673),rz=l(97454),rV=l(69166),rB=l(8201);let rY=e=>{let{data:r,error:l,isFetching:t,refetch:n}=(0,L.z)({queryKey:["GET_ORDER_HISTORY_LIST",e],queryFn:()=>(0,rU.Fw)(e),enabled:!!e,staleTime:0});return{data:r,error:l,isFetching:t,refetch:n}};var rK=l(56728);let rW=()=>{let{mutate:e,mutateAsync:r,status:l,error:t,isPending:n,data:a,isSuccess:i}=(0,A.b)({mutationFn:e=>(0,rK.Zu)(e)});return{mutate:e,mutateAsync:r,status:l,error:t,isPending:n,data:a,isSuccess:i}},rQ=(e,r)=>{let{data:l,error:t,isFetching:n,refetch:a}=(0,L.z)({queryKey:["GET_ORDER_HISTORY_COUNT",e,r],queryFn:()=>(0,rU.ZN)({customerID:e,orderConfirmationStatus:r,orderStatus:x.ED}),enabled:!!e,staleTime:0});return{data:l,error:t,isFetching:n,refetch:a}},rX=(e,r)=>{let l=(0,rG.h)({queries:e.map(e=>({queryKey:["GET_ORDER_HISTORY_COUNT_BY_STATUS",e],queryFn:()=>(0,rU.ZN)({customerID:r,orderConfirmationStatus:e,orderStatus:x.ED}),select:r=>({status:e,count:r}),enabled:!!e&&!!r,staleTime:1/0}))}),t=l.some(e=>e.isFetching);return{isFetching:t,isError:l.some(e=>e.isError),data:l.map(e=>e.data),refetchAll:(0,o.useCallback)(()=>{l.forEach(e=>e.refetch())},[l])}},rJ=[rV.Z.COMPLETED,rV.Z.REJECTED,rV.Z.PENDING];var r$=l(99519),r0=l(67190),r1=l(31394),r2=l(44784),r4=l(99638),r6=l(55493),r8=l(83582),r5=l(87672),r3=l(96773);function r7(e){let{title:r,description:l,imageUrl:t}=e;return(0,s.jsxs)(N.Z,{gap:16,children:[(0,s.jsx)(er(),{width:60,height:60,style:{borderRadius:12,objectFit:"contain"},src:t||"/default-img.png",alt:r,blurDataURL:t||"/default-img.png",priority:!0}),(0,s.jsxs)(N.Z,{vertical:!0,align:"start",children:[(0,s.jsx)(z.F,{level:5,children:r}),(0,s.jsx)(j._,{type:"secondary",style:{textAlign:"left"},children:l})]})]})}var r9=l(52764),le=l.n(r9);function lr(e){let{open:r,onCancel:l,isPostReviewPending:t,handleSubmitReview:n,orderSelectedItem:a}=e,{t:i}=(0,p.q)(),[d]=r6.Z.useForm(),{formatDate:c}=(0,rb.a)(),u=(0,o.useCallback)(async e=>{await n(e),l()},[n,l]);return(0,s.jsx)(et.Z,{footer:null,title:(0,s.jsx)(z.F,{level:4,children:i("label.reviews.review")}),open:r,onCancel:l,className:"ot-modal",children:(0,s.jsxs)(r6.Z,{form:d,onFinish:u,layout:"inline",initialValues:{valueForMoney:5,deliveryService:5,foodQuality:5,comment:""},children:[(0,s.jsx)(Y.Z,{size:"small",style:{marginTop:"24px"},styles:{header:{textAlign:"left"}},title:(0,s.jsxs)(j._,{strong:!0,children:["Order #",null==a?void 0:a.id]}),extra:(0,s.jsx)(j._,{strong:!0,children:c(null==a?void 0:a.orderDate)}),children:(0,s.jsx)(r7,{description:(null==a?void 0:a.locationAddress)||"",title:(null==a?void 0:a.location)||"",imageUrl:(null==a?void 0:a.locationLogoURL)||""})}),(0,s.jsx)(N.Z,{justify:"center",style:{padding:"24px 0"},children:(0,s.jsxs)(z.F,{level:4,children:[i("label.reviews.how.was.your.order.with")," ",null==a?void 0:a.location,"?"]})}),(0,s.jsx)(r6.Z.Item,{layout:"horizontal",name:"valueForMoney",label:(0,s.jsx)(z.F,{level:5,children:i("label.reviews.ordervalueforMoney")}),className:le().rate,children:(0,s.jsx)(r8.Z,{})}),(0,s.jsx)(r5.Z,{className:"no-margin"}),(0,s.jsx)(r6.Z.Item,{name:"deliveryService",label:(0,s.jsx)(z.F,{level:5,className:"no-margin",children:i("label.reviews.orderdeliveryservice")}),className:le().rate,children:(0,s.jsx)(r8.Z,{})}),(0,s.jsx)(r5.Z,{className:"no-margin"}),(0,s.jsx)(r6.Z.Item,{name:"foodQuality",label:(0,s.jsx)(z.F,{level:5,className:"no-margin",children:i("label.reviews.orderfoodquality")}
1),className:le().rate,children:(0,s.jsx)(r8.Z,{})}),(0,s.jsx)(r5.Z,{className:"no-margin"}),(0,s.jsx)(N.Z,{vertical:!0,style:{padding:"24px 0",width:"100%"},children:(0,s.jsx)(r6.Z.Item,{name:"comment",label:i("label.reviews.leavereview"),layout:"vertical",style:{margin:0},children:(0,s.jsx)(r3.Z,{rows:4,placeholder:i("label.reviews.enter.your.review")})})}),(0,s.jsxs)(N.Z,{gap:16,justify:"end",style:{paddingTop:24,width:"100%"},children:[(0,s.jsx)(K.ZP,{size:"large",onClick:l,disabled:t,children:i("label.button.cancel")}),(0,s.jsx)(K.ZP,{type:"primary",size:"large",htmlType:"submit",disabled:t,children:i("label.button.submit")})]})]})})}var ll=l(76822),lt=l(22825),ln=l(54164),la=l(13293);function li(e){let{label:r,phoneNumber:l,children:t}=e;return(0,s.jsxs)(N.Z,{vertical:!0,gap:8,children:[(0,s.jsx)(j._,{children:r}),(0,s.jsxs)(j._,{strong:!0,children:[t,l&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("br",{}),(0,s.jsx)(j._,{strong:!0,className:"blue-netural",children:l})]})]})]})}var ls=l(26035),lo=l.n(ls);function ld(e){var r;let{orderSelectedItem:l,isLoading:t,isPostReviewPending:n,handleSubmitReview:a}=e,{isModalOpen:i,handleOpenModal:o,handleCloseModal:d}=(0,lt.X)(),{t:c}=(0,p.q)(),u=(0,ll.bn)(),{formatDate:m}=(0,rb.a)(),{getExpectedAt:h}=(0,r$.A)(),{fromLabel:y,toLabel:v,fromContent:f,toContent:_,toPhoneNumber:g,isEatIn:j,tableNumberLabel:b,tableNumberContent:I,pickupPointLabel:E,pickupPointContent:w}=(0,ln.p)({order:l}),S=null==l?void 0:l.servedAtTable,T=h(l),R=(null==l?void 0:l.orderConfirmationStatus)===rV.Z.COMPLETED,C=!(null==l?void 0:l.review),Z=!!(null==l?void 0:null===(r=l.branch)||void 0===r?void 0:r.hasReviews),D=j&&S&&b&&I,P=j&&!S,A=(0,s.jsx)(K.ZP,{type:"primary",size:"large",icon:(0,s.jsx)(la.Z,{}),onClick:()=>{(null==l?void 0:l.id)&&(null==u||u.viewOrder(l.id))},children:c("label.button.trackorder")});return(0,s.jsxs)(eL.b,{spinning:!!t,children:[u?A:(0,s.jsx)(r2.r,{href:"order-confirmation/".concat(null==l?void 0:l.id),children:A}),(0,s.jsxs)(ro.Z,{children:[(0,s.jsx)(rd.Z,{xs:24,md:12,className:lo().col,children:(0,s.jsx)(N.Z,{vertical:!0,gap:8,children:(0,s.jsx)(li,{label:c("label.order.placeat"),children:m(null==l?void 0:l.orderDate,x.lv.SHORT_DATE_TIME)})})}),(0,s.jsx)(rd.Z,{xs:24,md:12,className:lo().col,children:(0,s.jsx)(N.Z,{vertical:!0,gap:8,children:(0,s.jsx)(li,{label:c("label.order.expectedat"),children:T})})}),(0,s.jsx)(rd.Z,{xs:24,md:12,className:lo().col,children:(0,s.jsx)(N.Z,{vertical:!0,gap:8,children:(0,s.jsx)(li,{label:y,phoneNumber:null==l?void 0:l.locationPhone,children:f})})}),(0,s.jsx)(rd.Z,{xs:24,md:12,className:lo().col,children:(0,s.jsxs)(N.Z,{vertical:!0,gap:8,children:[D&&(0,s.jsx)(li,{label:b,children:I}),P&&(0,s.jsx)(li,{label:E,children:w}),!P&&!D&&v&&_&&(0,s.jsx)(li,{label:v,phoneNumber:g,children:_})]})})]}),!!(null==l?void 0:l.specialInstructions)&&(0,s.jsx)(ro.Z,{className:lo().col,children:(0,s.jsx)(rd.Z,{span:24,children:(0,s.jsx)(r1.v,{description:null==l?void 0:l.specialInstructions})})}),(0,s.jsx)(r0.H,{item:l,quantityStyle:"text"}),(0,s.jsx)(r4.X,{paymentType:null==l?void 0:l.paymentType}),R&&C&&Z&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N.Z,{gap:16,justify:"end",style:{paddingTop:24},children:(0,s.jsx)(K.ZP,{type:"primary",size:"large",block:!0,onClick:o,children:c("label.reviews.button.revieworder")})}),(0,s.jsx)(lr,{open:i,onCancel:d,orderSelectedItem:l,isPostReviewPending:n,handleSubmitReview:a})]})]})}var lc=l(23209),lu=l(4982);let lm={CASH:"CASH",CARD:"CARD",CARDTERMINAL:"CARDTERMINAL",PAYPAL:"PAYPAL"},lp=()=>{let{t:e}=(0,p.q)(),r=(0,o.useCallback)(r=>lm[r]?e(lm[r]):r,[e]);return{paymentTypes:lm,formatPaymentType:r,formatPaymentTypeWithAnd:(0,o.useCallback)(e=>{if(0===e.length)return"";let[r,...l]=e.reverse();return e.length<=1?r:"".concat(l.reverse().join(", ")," & ").concat(r)},[])}};var lh=l(93411),ly=l(57224),lv=l.n(ly);function lx(e){let{item:r,onSelectedId:l}=e,{t}=(0,p.q)(),{isMobile:n}=(0,lh.p)(),{getOrderTagColor:a}=(0,rM.i)(),{formatPaymentType:i}=lp(),{formatCurrencyByCurrencyCode:o}=(0,lu.U)(),{formatDate:d}=(0,rb.a)();
1return(0,s.jsxs)(Y.Z,{size:"default",className:lv().card,title:(0,s.jsx)(j._,{className:lv().title,children:d(r.orderDate,x.lv.SHORT_DATE_TIME)}),extra:(0,s.jsx)(eW.Z,{color:a(r.orderConfirmationStatus),children:(0,rq.fm)(t("orders.statuses.".concat(r.orderConfirmationStatus.toLowerCase())).toLowerCase())}),children:[(0,s.jsxs)(ro.Z,{className:lv().content,children:[(0,s.jsx)(rd.Z,{xs:24,md:16,children:(0,s.jsx)(r7,{title:r.location,description:r.locationAddress,imageUrl:r.locationLogoURL})}),(0,s.jsx)(rd.Z,{xs:12,md:5,children:(0,s.jsxs)(N.Z,{vertical:!0,justify:"center",className:lv().col,children:[(0,s.jsx)(j._,{children:t("label.paymenttype")}),(0,s.jsx)(j._,{children:t("label.total.order")})]})}),(0,s.jsx)(rd.Z,{xs:12,md:3,children:(0,s.jsxs)(N.Z,{vertical:!0,justify:"center",align:"end",className:lv().col,children:[(0,s.jsx)(j._,{strong:!0,children:i(r.paymentType)}),(0,s.jsx)(j._,{strong:!0,children:o(r.subTotal,r.currencyCode)})]})})]}),(0,s.jsxs)(ro.Z,{className:lv().action,children:[(0,s.jsx)(rd.Z,{xs:24,md:12,children:(0,s.jsxs)(N.Z,{gap:4,justify:n?"center":"start",children:[(0,s.jsxs)(j._,{children:[t("label.orderreference"),": "]}),(0,s.jsxs)(j._,{children:["#",r.id]})]})}),(0,s.jsx)(rd.Z,{xs:24,md:12,children:(0,s.jsx)(N.Z,{gap:24,justify:n?"center":"end",children:(0,s.jsx)(K.ZP,{type:"primary",size:"large",block:n,onClick:()=>l(r.id),children:t("label.view.detail")})})})]})]})}function lf(e){var r,l;let{dataSource:t,orderSummary:n,isLoading:a,pagination:i,onPageChange:o,onPageShowSizeChange:d,onsetFilterStatusSelected:c,filterStatus:u,onSelectedId:m}=e,{t:h}=(0,p.q)();return(0,s.jsxs)(N.Z,{vertical:!0,children:[(0,s.jsxs)(N.Z,{gap:12,style:{overflow:"auto"},children:[(0,s.jsxs)(K.ZP,{type:void 0===u?"primary":"default",size:"large",loading:n.isLoading,onClick:()=>c(void 0),children:[h("label.locationresults.all")," (",n.totalItems,")"]}),n.isLoading?[]:n.statusCountList.map(e=>(0,s.jsxs)(K.ZP,{type:u===e.status?"primary":"default",size:"large",loading:n.isLoading,onClick:()=>c(e.status),children:[(0,rq.fm)(h("orders.statuses.".concat(e.status.toLowerCase())).toLowerCase())," (",e.count,")"]},e.status))]}),(0,s.jsxs)(eL.b,{spinning:!!a,children:[(0,s.jsx)(rD.Z,{style:{marginTop:16},split:!1,dataSource:t,itemLayout:"horizontal",size:"small",locale:{emptyText:h("label.no.data")},renderItem:(e,r)=>(0,s.jsx)(rD.Z.Item,{style:{paddingLeft:0,paddingRight:0},children:(0,s.jsx)(lx,{item:e,onSelectedId:m})},r)}),(0,s.jsx)("br",{}),(0,s.jsx)(lc.Z,{align:"end",defaultCurrent:1,current:i.pageIndex,pageSize:i.pageSize,total:void 0===u?n.totalItems:null!==(l=null===(r=n.statusCountList.find(e=>e.status===u))||void 0===r?void 0:r.count)&&void 0!==l?l:0,onChange:o,onShowSizeChange:d})]})]})}function l_(){let{t:e}=(0,p.q)(),{getOrderTagColor:r}=(0,rM.i)(),{dataSource:l,orderSummary:t,pagination:n,filterStatus:a,isLoading:i,orderSelectedItem:d,selectedId:c,isPostReviewPending:u,handleSubmitReview:m,onPageChange:h,onPageShowSizeChange:y,onsetFilterStatusSelected:f,onSelectedId:_,onBack:g}=function(){let[e,r]=(0,o.useState)(void 0),[l,t]=(0,o.useState)(rB._),[n,a]=(0,o.useState)(void 0),{showSuccess:i,showError:s}=(0,eg.p)(),{t:d}=(0,p.q)(),{getBranchAddress:c,getBranchServedAtTable:u}=(0,rz.v)(),m=(0,v.Z)(e=>e.customer),h=function(e,r){let{data:l,isFetching:t}=rQ(r),{data:n,isFetching:a}=rX(e,r);return{totalItems:null!=l?l:0,statusCountList:n,isLoading:t||a}}(rJ,null==m?void 0:m.id),{mutateAsync:y,isPending:f}=rW(),{data:_,isFetching:g}=rY({companyID:null==m?void 0:m.companyId,customerID:null==m?void 0:m.id,excludeFields:"All",limit:l.pageSize,offset:(l.pageIndex-1)*l.pageSize,orderConfirmationStatus:n,orderStatus:x.ED}),{data:j,isFetching:b,refetch:I}=rH(e),E=(0,o.useMemo)(()=>{var e;return null!==(e=null==_?void 0:_.map(e=>e.branchId))&&void 0!==e?e:[]},[_]),{data:N,isLoading:w}=function(e){let r=(0,rG.h)({queries:e.map(e=>({queryKey:["GET_BRANCH_STATUS_LIST_BY_ID",e],queryFn:()=>(0,O.wp)(e),enabled:!!e,...x.lb}))});return{isLoading:r.some(e=>e.isLoading),isError:r.some(e=>e.isError),data:r.map((r,l)=>({branchId:e[l],statusList:r.data}))}}(null!=E?E:[]),S=(0,o.useMemo)(()=>_&&N?_.map(e=>{let r=N.find(r=>(null==r?void 0:r.branchId)===e.branchId),l=u(null==r?void 0:r.statusList);return{...e,servedAtTable:l}}):[],[_,N,c,u]),T=(0,o.useMemo)(()=>
1{if(!j||!N)return;let e=N.find(e=>(null==e?void 0:e.branchId)===j.branchId);return{...j,servedAtTable:u(null==e?void 0:e.statusList),branch:e}},[j,N,c,u]),R=(0,o.useCallback)(e=>{a(e),t(rB._)},[a]),C=(0,o.useCallback)((e,r)=>{t({pageSize:r,pageIndex:e})},[t]),Z=(0,o.useCallback)((e,r)=>{t({pageSize:r,pageIndex:e})},[t]);return{isLoading:g||w||b,dataSource:S,orderSelectedItem:T,orderSummary:h,pagination:l,filterStatus:n,selectedId:e,isPostReviewPending:f,handleSubmitReview:(0,o.useCallback)(async e=>{var r,l,t,n,a;let{valueForMoney:o,deliveryService:c,foodQuality:u,comment:p}=e,h={valueForMoney:o,deliveryService:c,foodQuality:u,comment:p,customerOrderId:null!==(r=null==j?void 0:j.id)&&void 0!==r?r:0,customerId:null!==(l=null==m?void 0:m.id)&&void 0!==l?l:0,companyId:null!==(t=null==m?void 0:m.companyId)&&void 0!==t?t:0,branchId:null!==(n=null==j?void 0:j.branchId)&&void 0!==n?n:0,customerFirstName:null!==(a=null==m?void 0:m.firstName)&&void 0!==a?a:"",status:"DISABLED",createdDate:new Date().toISOString()};await y(h,{onSuccess:()=>{i(d("label.success.saved"),d("label.review.message.success")),I()},onError:e=>{s(d("label.review.message.error"),e.message)}})},[m,j,d,y,i,s,I]),onPageChange:C,onPageShowSizeChange:Z,onsetFilterStatusSelected:R,onSelectedId:e=>{r(e)},onBack:()=>{r(void 0)}}}();return c?(0,s.jsx)(()=>{var l;return(0,s.jsx)(G.v,{title:"".concat((0,rq.fm)(e("header.order.detail").toLowerCase())," #").concat(null!==(l=null==d?void 0:d.id)&&void 0!==l?l:""),leftIcon:(0,s.jsx)(K.ZP,{icon:(0,s.jsx)(ek.Z,{}),type:"text",style:{marginRight:8},onClick:()=>g()}),extra:(null==d?void 0:d.orderConfirmationStatus)&&(0,s.jsx)("div",{children:(0,s.jsx)(eW.Z,{color:r(null==d?void 0:d.orderConfirmationStatus),children:e("orders.statuses.".concat(null==d?void 0:d.orderConfirmationStatus.toLowerCase())).toUpperCase()})}),children:(0,s.jsx)(ld,{orderSelectedItem:d,isLoading:i,isPostReviewPending:u,handleSubmitReview:m})})},{}):(0,s.jsx)(()=>(0,s.jsx)(G.v,{title:e("label.link.order.history"),children:(0,s.jsx)(lf,{dataSource:null!=l?l:[],orderSummary:t,pagination:n,onPageChange:h,onPageShowSizeChange:y,onsetFilterStatusSelected:f,filterStatus:a,onSelectedId:_,isLoading:i})}),{})}var lg=l(22056),lj=l(6955);function lb(){let{t:e}=(0,p.q)(),{formData:r,isLoading:l,onSubmit:t,dataUpdatedAt:n}=function(){let{customer:e,setCustomer:r}=(0,v.Z)(e=>e),{data:l,isLoading:t,refetch:n,dataUpdatedAt:a}=(0,rA._)(null==e?void 0:e.id),{mutate:i,isPending:s}=(0,rO.B)(),d=(0,o.useCallback)(e=>{n(),r(e)},[n,r]);return{formData:l,isLoading:t||s,onSubmit:(0,o.useCallback)(e=>{let{phone:r,...l}=e,t=(0,rq.un)(r);i({...l,phone:t},{onSuccess:e=>{d(e)}})},[i,d]),dataUpdatedAt:a}}();return(0,s.jsx)(G.v,{title:e("label.link.personal.info"),isLoading:l,children:r&&(0,s.jsxs)(r6.Z,{layout:"vertical",onFinish:t,initialValues:{firstName:null==r?void 0:r.firstName,lastName:null==r?void 0:r.lastName,phone:null==r?void 0:r.phone,email:null==r?void 0:r.email},children:[(0,s.jsxs)(ro.Z,{gutter:24,children:[(0,s.jsx)(rd.Z,{xs:24,md:12,children:(0,s.jsx)(r6.Z.Item,{name:"firstName",label:e("label.firstname"),rules:[{required:!0,message:e("firstname.required")},{type:"string",max:60}],children:(0,s.jsx)(lg.Z,{size:"large",placeholder:e("label.firstname")})})}),(0,s.jsx)(rd.Z,{xs:24,md:12,children:(0,s.jsx)(r6.Z.Item,{name:"lastName",label:e("label.lastname"),rules:[{required:!0,message:e("lastname.required")},{type:"string",max:60}],children:(0,s.jsx)(lg.Z,{size:"large",placeholder:e("label.lastname")})})})]}),(0,s.jsxs)(ro.Z,{gutter:24,children:[(0,s.jsx)(rd.Z,{xs:24,md:12,children:(0,s.jsx)(r6.Z.Item,{name:"email",label:e("label.email"),rules:[{required:!0,message:e("email.required")},{type:"email"}],children:(0,s.jsx)(lg.Z,{size:"large",placeholder:e("label.email"),disabled:!0})})}),(0,s.jsx)(rd.Z,{xs:24,md:12,children:(0,s.jsx)(r6.Z.Item,{name:"phone",label:e("label.phoneno"),rules:[{required:!0},{validator:rq.tH}],children:(0,s.jsx)(lj.Z,{enableSearch:!0,size:"large",disableParentheses:!0})})})]}),(0,s.jsx)(ro.Z,{gutter:24,justify:"end",children:(0,s.jsx)(rd.Z,{children:(0,s.jsx)(K.ZP,{type:"primary",size:"large",htmlType:"submit",loading:l,children:e("label.button.update")})})})]},n)})}var lI=l(69963);(t=a||(a={})).PENDING="PENDING",t.EARNED="EARNED",t.ISSUED="ISSUED",t.FAILED="FAILED",t.CANCELLED="CANCELLED",(n=i||(i={})).PENDING="PENDING",n.COMPLETED="COMPLETED",n.EXPIRED="EXPIRED",n.CANCELLED="CANCELLED",n.FRAUDULENT="FRA
1UDULENT";var lE=l(73683),lN=l(88092);let lw=e=>{let{data:r,isLoading:l,isSuccess:t}=(0,L.z)({queryKey:["GET_REFERRAL_HUB",e],queryFn:()=>(0,lN.iv)(),enabled:!!e,...x.lb});return{data:r,isLoading:l,isSuccess:t}},lS=(e,r)=>{let{data:l,isLoading:t,isSuccess:n}=(0,L.z)({queryKey:["GET_REFERRAL_INVITEES",e],queryFn:()=>(0,lN.y4)(),enabled:!!e&&r,select:e=>Array.isArray(e)?e:[],...x.lb});return{data:l,isLoading:t,isSuccess:n}},lT=(e,r)=>{let{data:l,isLoading:t,isSuccess:n}=(0,L.z)({queryKey:["GET_REFERRAL_REWARDS",e],queryFn:()=>(0,lN.ED)(),enabled:!!e&&r,select:e=>Array.isArray(e)?e:[],...x.lb});return{data:l,isLoading:t,isSuccess:n}};var lR=l(88390);function lC(e){let{description:r}=e;return(0,s.jsx)(E.Z,{image:null,description:(0,s.jsx)(j._,{className:"text-pretty",type:"secondary",children:r})})}var lZ=l(84914),lD=l.n(lZ);let lP={[a.PENDING]:lD().tagPending,[a.EARNED]:lD().tagEarned,[a.FAILED]:lD().tagEarned,[a.ISSUED]:lD().tagIssued,[a.CANCELLED]:lD().tagCancelled},lA={[a.PENDING]:"referral.status.pending",[a.EARNED]:"referral.status.earned",[a.FAILED]:"referral.status.earned",[a.ISSUED]:"referral.status.issued",[a.CANCELLED]:"referral.status.cancelled"},lO=new Set([i.CANCELLED,i.FRAUDULENT]);function lL(e){let{invitees:r}=e,{t:l}=(0,p.q)();return(0,s.jsxs)(Y.Z,{children:[(0,s.jsx)(z.F,{level:5,className:"mb-2",children:l("referral.invitees.title")}),0===r.length?(0,s.jsx)(lC,{description:l("referral.invitees.empty")}):(0,s.jsx)(rD.Z,{dataSource:r,pagination:{pageSize:5,hideOnSinglePage:!0,size:"small"},renderItem:e=>{let r=null;return e.status===i.COMPLETED?r=l("referral.friend.completed"):e.isExpired?r=l("referral.friend.expired"):lO.has(e.status)?r=l("referral.friend.cancelled"):1===e.daysLeft?r=l("referral.friend.day.left"):null!==e.daysLeft?r=l("referral.friend.days.left",[e.daysLeft]):e.invitedAtLabel&&(r=l("referral.invited.at",[e.invitedAtLabel])),(0,s.jsx)(rD.Z.Item,{children:(0,s.jsxs)("div",{className:lD().listRow,children:[(0,s.jsxs)(N.Z,{align:"center",gap:12,className:"min-w-0",children:[(0,s.jsx)(lR.Z,{size:36,children:e.firstName.charAt(0)}),(0,s.jsxs)(N.Z,{vertical:!0,className:"min-w-0",children:[(0,s.jsx)(j._,{strong:!0,children:e.firstName}),r&&(0,s.jsx)(j._,{type:"secondary",children:r})]})]}),(0,s.jsx)("div",{className:lD().pills,children:e.steps.map(e=>{var r;let t=lA[e.status],n=null!==(r=lP[e.status])&&void 0!==r?r:"",i=e.status===a.CANCELLED?"".concat(lD().chipAmount," ").concat(lD().chipAmountStruck):lD().chipAmount;return(0,s.jsxs)(eW.Z,{className:"".concat(n," ").concat(lD().statusChip),children:[(0,s.jsx)("span",{className:lD().chipDot}),(0,s.jsxs)(N.Z,{vertical:!0,justify:"start",children:[e.rewardLabel&&(0,s.jsx)("span",{className:i,children:e.rewardLabel}),(0,s.jsxs)("span",{className:"".concat(lD().chipLabel," text-pretty"),children:[e.title,t?" \xb7 ".concat(l(t)):""]})]})]},e.code)})})]})},e.referralId)}})]})}function lk(e){let{label:r,value:l}=e;return(0,s.jsx)(Y.Z,{size:"small",className:lD().cellCard,children:(0,s.jsxs)(N.Z,{vertical:!0,gap:4,className:lD().cell,children:[(0,s.jsx)(j._,{type:"secondary",children:r}),(0,s.jsx)(j._,{className:lD().statValue,children:l})]})})}function lF(e){let{program:r,refereeRewardLabel:l}=e,{t}=(0,p.q)(),n=null!==r.daysRemaining&&void 0!==r.daysRemaining;return(0,s.jsxs)(Y.Z,{children:[(0,s.jsxs)("div",{className:lD().headerRow,children:[(0,s.jsxs)("div",{className:lD().headerMain,children:[(0,s.jsx)(j._,{type:"secondary",className:lD().eyebrow,children:t("referral.eyebrow")}),(0,s.jsx)(z.F,{level:4,children:r.headline}),r.description&&(0,s.jsx)(j._,{type:"secondary",className:"text-pretty",children:r.description})]}),(0,s.jsxs)("div",{className:lD().headerStats,children:[r.earnPerFriendLabel&&(0,s.jsx)(lk,{label:t("referral.you.get"),value:r.earnPerFriendLabel}),l&&(0,s.jsx)(lk,{label:t("referral.they.get"),value:l})]})]}),n&&(0,s.jsx)(N.Z,{className:"mt-4",children:(0,s.jsx)(eW.Z,{bordered:!1,children:t("referral.ends.in",[r.daysRemaining])})})]})}function lM(e){let{rewards:r}=e,{t:l}=(0,p.q)();return(0,s.jsxs)(Y.Z,{children:[(0,s.jsx)(z.F,{level:5,className:"mb-2",children:l("referral.rewards.title")}),0===r.length?(0,s.jsx)(lC,{description:l("referral.rewards.empty")}):(0,s.jsx)(rD.Z,{dataSource:r,pagination:{pageSize:5,hideOnSinglePage:!0,size:"small"},renderItem:e=>{var r;let t=lA[e.status],n=null!==(r=lP[e.status])&&void 0!==r?r:"",i=e.status===a.CANCELLED?"".concat(lD().chipAmount," ").concat(lD().chipAmountStruck):lD().chipAmount;return(0,s.jsx)(rD.Z.Item,{children:(0,s.jsxs)("div",{className:lD().listRow,children:[(0,s.jsxs)(N.Z,{vertical:!0,className:"min-w-0",children:[(0,s.jsx)(j._,{strong:!0,className:"text-pretty",children:e.stepTitle}),e.issuedAtLabel&&(0,s.jsx)(j._,{type:"secondary",children:e.issuedAtLabel})]}),e.rewardLabel&&(0,s.jsxs)(eW.Z,{className:"".concat(n," ").concat(lD().statusChip),children:[(0,s.jsx)("span",{className:lD().chipDot}),(0,s.jsxs)(N.Z,{vertical:!0,justify:"start",children:[(0,s.jsx)("span",{className:i,children:e.rewardLabel}),t&&(0,s.jsx)("span",{className:"".concat(lD().chipLabel," text-pretty"),children:l(t)})]})]})]})},e.id)}})]})}var lq=l(67150),lU=l(64484),lH=l(52155);function lG(e){let{value:r,onCopy:l,ariaLabel:t}=e,{t:n}=(0,p.q)(),[a,i]=(0,o.useState)(!1);(0,o.useEffect)(()=>
1{if(!a)return;let e=setTimeout(()=>i(!1),2e3);return()=>clearTimeout(e)},[a]);let d=async()=>{await l()&&i(!0)};return(0,s.jsx)(lg.Z,{size:"large",readOnly:!0,value:r,suffix:(0,s.jsx)(lH.Z,{title:n(a?"referral.copied":"referral.copy"),open:a||void 0,children:(0,s.jsx)(K.ZP,{type:"text",size:"small","aria-label":t,icon:a?(0,s.jsx)(lq.Z,{}):(0,s.jsx)(lU.Z,{}),onClick:d})})})}function lz(e){let{share:r,rewardsRemaining:l,onCopyCode:t,onCopyLink:n,onShare:a}=e,{t:i}=(0,p.q)();return(0,s.jsx)(Y.Z,{children:(0,s.jsxs)(N.Z,{vertical:!0,gap:16,children:[(0,s.jsxs)(N.Z,{vertical:!0,gap:4,children:[(0,s.jsx)(z.F,{level:5,children:i("referral.share.title")}),(0,s.jsx)(j._,{type:"secondary",children:r.cardMessage||i("referral.share.subtitle")})]}),(0,s.jsxs)("div",{className:lD().shareGrid,children:[(0,s.jsxs)(N.Z,{vertical:!0,gap:8,className:"min-w-0",children:[(0,s.jsx)(j._,{strong:!0,children:i("referral.your.code")}),(0,s.jsx)(lG,{value:r.code,onCopy:t,ariaLabel:i("referral.your.code")})]}),r.link&&(0,s.jsxs)(N.Z,{vertical:!0,gap:8,className:"min-w-0",children:[(0,s.jsx)(j._,{strong:!0,children:i("referral.your.link")}),(0,s.jsx)(lG,{value:r.link,onCopy:n,ariaLabel:i("referral.your.link")})]})]}),(0,s.jsxs)(N.Z,{wrap:!0,align:"center",gap:12,children:[r.message&&(0,s.jsx)(K.ZP,{type:"primary",size:"large",onClick:a,children:i("referral.share.button")}),null!=l&&(0,s.jsx)(j._,{type:"secondary",children:i("referral.rewards.left",[l])})]})]})})}function lV(e){let{summary:r}=e,{t:l}=(0,p.q)(),t=[{key:"invited",label:l("referral.summary.invited"),value:r.invited},{key:"signedUp",label:l("referral.summary.signedup"),value:r.signedUp},{key:"completed",label:l("referral.summary.completed"),value:r.completed},{key:"earned",label:l("referral.summary.earned"),value:r.totalEarnedLabel},{key:"pending",label:l("referral.summary.pending"),value:r.pendingLabel},{key:"remaining",label:l("referral.summary.remaining"),value:r.rewardsRemaining}].filter(e=>null!==e.value&&void 0!==e.value);return(0,s.jsxs)(Y.Z,{children:[(0,s.jsx)(z.F,{level:5,className:"mb-4",children:l("referral.summary.title")}),(0,s.jsx)("div",{className:lD().statsGrid,children:t.map(e=>(0,s.jsx)(Y.Z,{size:"small",className:lD().cellCard,children:(0,s.jsxs)(N.Z,{vertical:!0,gap:4,className:lD().cell,children:[(0,s.jsx)(j._,{type:"secondary",className:"text-pretty",children:e.label}),(0,s.jsx)(j._,{className:lD().statValue,children:e.value})]})},e.key))})]})}function lB(e){let{steps:r}=e,{t:l}=(0,p.q)();return 0===r.length?null:(0,s.jsxs)(Y.Z,{children:[(0,s.jsx)(z.F,{level:5,className:"!mb-4",children:l("referral.how.it.works")}),(0,s.jsx)("div",{className:lD().autoGrid,children:r.map((e,r)=>(0,s.jsx)(Y.Z,{size:"small",className:lD().cellCard,children:(0,s.jsxs)(N.Z,{vertical:!0,gap:12,children:[(0,s.jsxs)("div",{className:lD().stepHead,children:[(0,s.jsx)(lR.Z,{size:24,children:r+1}),(0,s.jsx)(j._,{strong:!0,className:"text-pretty",children:e.title})]}),e.rewardLabel&&(0,s.jsxs)(N.Z,{vertical:!0,gap:2,children:[(0,s.jsx)(j._,{type:"secondary",children:l("referral.step.you")}),(0,s.jsx)(j._,{className:lD().statValue,children:e.rewardLabel})]}),e.subtitle&&(0,s.jsx)(j._,{type:"secondary",className:"text-pretty",children:e.subt
1itle})]})},e.code))})]})}let{Link:lY}=lI.default;function lK(e){let{title:r,body:l}=e;return(0,s.jsx)(Y.Z,{children:(0,s.jsxs)(N.Z,{vertical:!0,align:"flex-start",gap:8,children:[(0,s.jsx)(z.F,{level:5,children:r}),(0,s.jsx)(j._,{type:"secondary",className:"text-pretty",children:l})]})})}function lW(){var e;let{t:r}=(0,p.q)(),{isLoggedIn:l,isLoading:t,isEnrolled:n,program:a,share:d,summary:c,steps:u,refereeRewardLabel:m,invitees:h,isInviteesLoading:y,rewards:x,isRewardsLoading:f,handleCopyCode:_,handleCopyLink:g,handleShareMessage:j}=function(){var e,r,l,t;let{t:n}=(0,p.q)(),a=(0,v.Z)(e=>e.customer),s=null==a?void 0:a.id,d=!!s,{data:c,isLoading:u}=lw(s),m=!!(null==c?void 0:c.enrolled),{data:h,isLoading:y}=lS(s,m),{data:x,isLoading:f}=lT(s,m),_=null!==(e=null==c?void 0:c.program)&&void 0!==e?e:null,g=null!==(r=null==c?void 0:c.share)&&void 0!==r?r:null,j=null!==(l=null==c?void 0:c.summary)&&void 0!==l?l:null,b=null!==(t=null==c?void 0:c.refereeRewardLabel)&&void 0!==t?t:null,I=(0,o.useMemo)(()=>{var e;return[...null!==(e=null==c?void 0:c.steps)&&void 0!==e?e:[]].sort((e,r)=>e.sortOrder-r.sortOrder)},[null==c?void 0:c.steps]),E=e=>{if(!e)return null;let r=new Date(e);return Number.isNaN(r.getTime())?null:r.toLocaleDateString()},N=(e,r)=>{let l=e?new Date(e).getTime():0;return(r?new Date(r).getTime():0)-l},w=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),S=e=>{if(!e)return null;let r=new Date(e);if(Number.isNaN(r.getTime()))return null;let l=Math.round((w(r).getTime()-w(new Date).getTime())/864e5);return l>0?l:null},T=e=>{if(!e)return!1;let r=new Date(e);return!Number.isNaN(r.getTime())&&w(r).getTime()<w(new Date).getTime()},R=(0,o.useMemo)(()=>(null!=h?h:[]).map(e=>({...e,invitedAtLabel:E(e.invitedAt),daysLeft:S(e.expiresAt),isExpired:e.status===i.EXPIRED||e.status===i.PENDING&&T(e.expiresAt)})).sort((e,r)=>N(e.invitedAt,r.invitedAt)),[h]),C=(0,o.useMemo)(()=>(null!=x?x:[]).map(e=>({...e,issuedAtLabel:E(e.issuedAt)})).sort((e,r)=>N(e.issuedAt,r.issuedAt)),[x]),Z=(0,o.useCallback)(async e=>{try{return await navigator.clipboard.writeText(e),!0}catch(e){return lE.ZP.error(n("referral.copy.failed")),!1}},[n]),D=(0,o.useCallback)(async()=>null!=g&&!!g.code&&Z(g.code),[null==g?void 0:g.code,Z]),P=(0,o.useCallback)(async()=>null!=g&&!!g.link&&Z(g.link),[null==g?void 0:g.link,Z]),A=(0,o.useCallback)(async()=>{let e=null==g?void 0:g.message;if(e){if("undefined"!=typeof navigator&&navigator.share){try{await navigator.share({text:e})}catch(e){}return}await Z(e)&&lE.ZP.success(n("referral.copied"))}},[null==g?void 0:g.message,Z,n]);return{isLoggedIn:d,isLoading:u,isEnrolled:m,program:_,share:g,summary:j,steps:I,refereeRewardLabel:b,invitees:R,isInviteesLoading:y,rewards:C,isRewardsLoading:f,handleCopyCode:D,handleCopyLink:P,handleShareMessage:A}}();return(0,s.jsxs)(G.v,{title:r("label.link.referrals"),children:[!l&&(0,s.jsx)(lK,{title:r("referral.signedout.title"),body:r("referral.not.logged.in")}),l&&t&&(0,s.jsx)(S.Z,{active:!0,paragraph:{rows:6}}),l&&!t&&!n&&(0,s.jsx)(lK,{title:r("referral.noprogram.title"),body:r("referral.no.program")}),l&&!t&&n&&(0,s.jsxs)("div",{className:lD().wrapper,children:[a&&(0,s.jsx)(lF,{program:a,refereeRewardLabel:m}),d&&(0,s.jsx)(lz,{share:d,rewardsRemaining:null!==(e=null==c?void 0:c.rewardsRemaining)&&void 0!==e?e:null,onCopyCode:_,onCopyLink:g,onShare:j}),(0,s.jsx)(lB,{steps:u}),c&&(0,s.jsx)(lV,{summary:c}),y?(0,s.jsx)(S.Z,{active:!0,paragraph:{rows:2}}):(0,s.jsx)(lL,{invitees:h}),f?(0,s.jsx)(S.Z,{active:!0,paragraph:{rows:2}}):(0,s.jsx)(lM,{rewards:x}),((null==a?void 0:a.termsUrl)||(null==a?void 0:a.helpUrl))&&(0,s.jsxs)("div",{className:lD().links,children:[(null==a?void 0:a.termsUrl)&&(0,s.jsx)(lY,{href:a.termsUrl,target:"_blank",rel:"noreferrer",children:r("referral.terms")}),(null==a?void 0:a.helpUrl)&&(0,s.jsx)(lY,{href:a.helpUrl,target:"_blank",rel:"noreferrer",children:r("referral.help")})]})]})]})}var lQ=l(22971),lX=l(77825);function lJ(){let{t:e}=(0,p.q)(),{isLoading:r,isSuccess:l,onSubmit:t}=function(){let{mutate:e,isPending:r,isSuccess:l}=function(){let{t:e}=(0,p.q)(),{showSuccess:r,showError:l}=(0,eg.p)(),{mutate:t,status:n,error:a,isPending:i,data:s,isSuccess:o}=(0,A.b)({mutationKey:["UPDATE_PASSWROD"],mutationFn:e=>(0,lX.AC)(e),onSuccess:t=>{t?r(e("label.success.saved"),e("updatepassword.submit.success")):l(e("label.error.saved"),e("updatepassword.submit.error"))},onError:()=>{l(e("label.error.saved"),e("updatepassword.submit.error"))}});return{mutate:t,status:n,error:a,isPending:i,data:s,isSuccess:o}}();return{isLoading:r,isSuccess:l,onSubmit:(0,o.useCallback)(r=>{e(r.newPassword)},[e])}}(),[n]=(0,lQ.Z)();return(0,o.useEffect)(()=>{l&&n.resetFields()},[l,n]),(0,s.jsx)(G.v,{title:e("page.title.updatepassword"),children:(0,s.jsxs)(r6.Z,{layout:"vertical",form:n,onFinish:t,children:[(0,s.jsx)(ro.Z,{gutter:24,children:(0,s.jsx)(rd.Z,{xs:24,md:24,lg:12,children:(0,s.jsx)(r6.Z.Item,{name:"newPassword",label:e("label.newpassword"),rules:[{required:!0,message:e("newpassword.required")}],children:(0,s.jsx)(lg.Z.Password,{size:"large",placeholder:e("label.newpassword"),disabled:r})})})}),(0,s.jsx)(ro.Z,{gutter:24,children:(0,s.jsx)(rd.Z,{xs:24,md:24,lg:12,children:(0,s.jsx)(r6.Z.Item,{name:"confirmPassword",label:e("label.newpassword.confirm"),dependencies:["newPassword"],rules:[{required:!0,message:e("password.confirm.required")},r=>{let{getFieldValue:l}=r;return{validator:(r,t)=>t&&l("newPassword")!==t?Promise.reject(Error(e("newpassword.confirmpassword.invalid"))):Promise.resolve()}}],children:(0,s.jsx)(lg.Z.Password,{size:"large",placeholder:e("label.newpassword.confirm"),disabled:r})})})}),(0,s.jsx)(ro.Z,{gutter:24,children:(0,s.jsx)(rd.Z,{xs:24,md:24,lg:12,children:(0,s.jsx)(N.Z,{justify:"end",children:(0,s.jsx)(K.ZP,{type:"primary",size:"large",htmlType:"submit",loading:r,children:e("label.button.update")})})})})]})})}function l$(){let{t:e}=(0,p.q)();return(0,o.useMemo)(()=>({[x.DH.PERSONAL_INFO]:{icon:(0,s.jsx)(h.vo,{}
1),label:e("label.link.personal.info"),component:lb,hash:"personal-info"},[x.DH.ADDRESS_BOOK]:{icon:(0,s.jsx)(h.MP,{}),label:e("page.title.addressbook"),component:g.o,hash:"address-book"},[x.DH.ORDERS_HISTORY]:{icon:(0,s.jsx)(h.si,{}),label:e("page.title.orderhistory"),component:l_,hash:"orders-history"},[x.DH.LOYALTY_PROGRAMS]:{icon:(0,s.jsx)(f.Z,{style:{fontSize:"24px"}}),label:e("label.link.loyalty"),component:rZ,hash:"loyalty-programs"},[x.DH.REFERRALS]:{icon:(0,s.jsx)(_.Z,{style:{fontSize:"24px"}}),label:e("label.link.referrals"),component:lW,hash:"referrals"},[x.DH.UPDATE_PASSWORD]:{icon:(0,s.jsx)(h.sM,{}),label:e("page.title.updatepassword"),component:lJ,hash:"update-password"},[x.DH.MARKETING_PREFERENCES]:{icon:(0,s.jsx)(h.sc,{}),label:e("label.link.marketing.preferences"),component:rF,hash:"marketing-preferences"}}),[e])}function l0(){var e;let{t:r}=(0,p.q)(),[l,t]=m(),n=l$(),a=(0,o.useMemo)(()=>({"personal-info":x.DH.PERSONAL_INFO,"address-book":x.DH.ADDRESS_BOOK,"orders-history":x.DH.ORDERS_HISTORY,"update-password":x.DH.UPDATE_PASSWORD,"loyalty-programs":x.DH.LOYALTY_PROGRAMS,referrals:x.DH.REFERRALS,"marketing-preferences":x.DH.MARKETING_PREFERENCES}),[]),[i,s]=(0,o.useState)(x.DH.PERSONAL_INFO),c=(0,v.Z)(e=>e.customer),u=(0,y.Z)(e=>e.setBranch),{data:h}=(0,d.i)(null==c?void 0:c.branchId),f=[{title:r("page.title.user.profile")},{title:n[i].label}],_=Object.keys(n).map(e=>({key:e,icon:n[e].icon,label:n[e].label})),g=null===(e=n[i])||void 0===e?void 0:e.component;return(0,o.useEffect)(()=>{s(a[l]||x.DH.PERSONAL_INFO)},[l,s,a]),(0,o.useEffect)(()=>{h&&u(h)},[h]),{siderMenus:_,onSiderMenuItemClick:e=>{var r;let{key:l}=e,a=null===(r=n[l])||void 0===r?void 0:r.hash;a&&t(a),s(l)},currentSetting:i,breadCrumbItems:f,renderComponent:g}}},32046:function(e,r,l){"use strict";l.r(r),l.d(r,{__N_SSP:function(){return _},default:function(){return g}});var t=l(85893);l(67294);var n=l(64972),a=l(83663),i=l(10042),s=l(11949),o=l(65765),d=l(2516),c=l(22276),u=l(28025),m=l(74108),p=l(17185),h=l.n(p);function y(){let{t:e}=(0,s.q)(),{breadCrumbItems:r,siderMenus:l,onSiderMenuItemClick:p,currentSetting:y,renderComponent:v}=(0,m.A)(),{borderRadiusLG:x}=(0,i.F)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Z.Content,{className:h().layout,children:[(0,t.jsxs)(d.Z,{className:h().header,vertical:!0,children:[(0,t.jsx)(a.F,{className:h().title,level:3,children:e("page.title.user.profile")}),(0,t.jsx)(c.Z,{className:h().breadcrumb,items:r})]}),(0,t.jsxs)(o.Z,{className:h().container,children:[(0,t.jsx)(o.Z.Sider,{width:200,className:h().sider,breakpoint:"xl",children:(0,t.jsx)(u.Z,{mode:"inline",defaultSelectedKeys:[y],defaultOpenKeys:[y],selectedKeys:[y],items:l,onClick:p})}),(0,t.jsx)(o.Z.Content,{className:h().content,children:(0,t.jsx)("div",{className:h().container,style:{padding:24,borderRadius:x},children:(0,t.jsx)(v,{})})})]})]}),(0,t.jsx)(n.$,{})]})}var v=l(60902),x=l(9008),f=l.n(x),_=!0;function g(e){let{website:r,company:l,theme:n}=e;return(0,v.P)({website:r,company:l,theme:n}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f(),{children:(0,t.jsx)("title",{children:"".concat(null==l?void 0:l.name," - User Profile")})}),(0,t.jsx)(y,{})]})}},53686:function(e,r,l){"use strict";l.d(r,{re:function(){return i},te:function(){return a},wp:function(){return n}});var t=l(40048);let n=(e,r)=>(0,t.U2)("loyalty-programs/store/".concat(e),{apiVersion:"v1",...r}),a=(e,r)=>(0,t.U2)("customer-wallet/".concat(e),{apiVersion:"v1",...r}),i=(e,r,l)=>(0,t.v_)("customer-loyalty/enroll?customerId=".concat(e,"&loyaltyProgramId=").concat(r),{},{apiVersion:"v1",...l})},86830:function(e,r,l){"use strict";l.d(r,{TI:function(){return s},cc:function(){return i},sA:function(){return a}});var t=l(40048),n=l(54887);let a=(e,r)=>(0,t.U2)("promotions/stores?".concat(n.Z.stringify(e)),{apiVersion:"v1",...r}),i=(e,r)=>(0,t.U2)("promotions/".concat(e),{apiVersion:"v1",...r}),s=(e,r)=>(0,t.gz)("promotions/store/".concat(e.branchId,"/redeem"),e.redeemPayload,{apiVersion:"v1",...r})},56728:function(e,r,l){"use strict";l.d(r,{Zu:function(){return s},t_:function(){return a},xb:function(){return i}});var t=l(40048),n=l(54887);let a=(e,r)=>(0,t.U2)("reviews?".concat(n.Z.stringify(e)),r),i=async(e,r,l)=>{var a,i,s;let o=await (0,t.U2)("branches/search/".concat(e,"?").concat(n.Z.stringify(r)),l),d=null==o?void 0:null===(a=o.branches)||void 0===a?void 0:a[0];return{averageReviewScore:null!==(i=null==d?void 0:d.averageReviewScore)&&void 0!==i?i:0,reviewCount:null!==(s=null==d?void 0:d.reviewCount)&&void 0!==s?s:0}},s=(e,r)=>(0,t.v_)("reviews",e,r)},8213:function(e,r,l){"use strict";l.d(r,{P:function(){return i}});var t=l(85893);l(67294);var n=l(84035),a=l(37054);function i(e){let{children:r,...l}=e,{isLoaded:i}=(0,n.t)();return i?(0,t.jsx)(a.b6,{...l,children:r}):(0,t.jsx)(t.Fragment,{})}},64972:function(e,r,l){"use strict";l.d(r,{$:function(){return p}});var t=l(85893),n=l(11949),a=l(47529),i=l(50820),s=l(2516),o=l(25675),d=l.n(o),c=l(82057),u=l(74322),m=l.n(u);function p(e){let{className:r}=e,{t:l}=(0,n.q)(),o=(0,i.Z)(e=>e.company),u=(0,a.Vf)(null==o?void 0:o.salesCompanyName),p=(null==o?void 0:o.salesCompanyWebsite)?o.salesCompanyWebsite.startsWith("http")?o.salesCompanyWebsite:"https://".concat(o.salesCompanyWebsite):void 0,h=null==o?void 0:o.salesCompanyName,y=(0,a.k2)(h,"terms-and-conditions"),v=(0,a.k2)(h,"privacy-policy"),x=(0,a.k2)(h,"cookie-policy");return(0,t.jsx)(s.Z,{className:r,children:(0,t.jsx)("footer",{id:"footer",className:m().footer,children:(0,t.jsxs)(s.Z,{vertical:!0,align:"center",children:[u&&(0,t.jsx)("a",{href:p,target:"_blank",rel:"noopener",children:(0,t.jsx)(d(),{src:u,alt:"footer logo",width:0,height:0,sizes:"100vw",priority:!0,style:{width:"100px",height:"auto",maxHeight:"48px",objectFit:"contain"}})}),(0,t.jsxs)(s.Z,{className:m().copyright,children:[(0,t.jsxs)(c._,{type:"secondary",children:[l("label.copyright")," \xa9 ",new Date().getFullYear()," ",null==o?void 0:o.salesCompanyName]}),(y||v)&&(0,t.jsx)("span",{className:m().dash,children:"|"}),(0,t.jsxs)(s.Z,{gap:8,children:[y&&(0,t.jsx)("a",{href:(0,a.Qh)(
1h,"terms-and-conditions"),children:l("label.terms.and.conditions")}),y&&v&&(0,t.jsx)("span",{children:"|"}),v&&(0,t.jsx)("a",{href:(0,a.Qh)(h,"privacy-policy"),children:l("label.link.privacy.policy")})]}),x&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:m().dash,children:"|"}),(0,t.jsx)("a",{href:(0,a.Qh)(h,"cookie-policy"),children:l("label.link.cookie.policy")})]})]})]})})})}},99638:function(e,r,l){"use strict";l.d(r,{X:function(){return h}});var t=l(85893),n=l(67294),a=l(83846),i=l(99e3),s=l(11949),o=l(2516),d=l(87672),c=l(23721),u=l(83663),m=l(35859),p=l.n(m);function h(e){let{paymentType:r}=e,{t:l}=(0,s.q)(),{formatPaymentMethod:m}=function(){let{t:e}=(0,s.q)(),r=(0,n.useMemo)(()=>({CASH:{title:(0,a.fm)(e("CASH").toLocaleLowerCase()),icon:(0,t.jsx)(i.E9,{style:{height:36,color:"var(--ant-color-text-base)"}})},CARD:{title:(0,a.fm)(e("CARD").toLocaleLowerCase()),icon:(0,t.jsx)(i.ON,{style:{height:36,color:"var(--ant-color-text-base)"}})},CARDTERMINAL:{title:(0,a.fm)(e("CARDTERMINAL").toLocaleLowerCase()),icon:(0,t.jsx)(i.U5,{style:{height:36,color:"var(--ant-color-text-base)"}})}}),[e]),l=(0,n.useCallback)(e=>{var l;return null!==(l=r[e])&&void 0!==l?l:r.CASH},[]);return{paymentTypes:r,formatPaymentMethod:l}}(),{icon:h,title:y}=m(r);return(0,t.jsxs)(o.Z,{className:p().payment,vertical:!0,children:[(0,t.jsx)(u.F,{level:5,children:l("label.paymentmethod")}),(0,t.jsx)(d.Z,{className:"dash"}),(0,t.jsx)(c.Z,{className:p().content,styles:{body:{padding:0,margin:0}},children:(0,t.jsxs)(o.Z,{justify:"space-between",align:"center",children:[(0,t.jsx)(u.F,{level:5,children:y}),h]})})]})}},87464:function(e,r,l){"use strict";l.d(r,{a:function(){return s}});var t=l(67294),n=l(66340),a=l(30381),i=l.n(a);let s=()=>({formatDate:(0,t.useCallback)(function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.lv.SHORT_DATE;return e?i()(e).format(r):""},[]),formatUTCTime:(0,t.useCallback)((e,r)=>e?i().utc(e).format(r):"",[])})},85668:function(e,r,l){"use strict";l.d(r,{kt:function(){return d}});var t=l(67294),n=l(11949);let a={1:"label.sunday",2:"label.monday",3:"label.tuesday",4:"label.wednesday",5:"label.thursday",6:"label.friday",7:"label.saturday"},i={sunday:"label.sunday",monday:"label.monday",tuesday:"label.tuesday",wednesday:"label.wednesday",thursday:"label.thursday",friday:"label.friday",saturday:"label.saturday"},s={1:"label.sun",2:"label.mon",3:"label.tue",4:"label.wed",5:"label.thu",6:"label.fri",7:"label.sat"},o={sun:"label.sun",mon:"label.mon",tue:"label.tue",wed:"label.wed",thu:"label.thu",fri:"label.fri",sat:"label.sat"},d=()=>{let{t:e}=(0,n.q)(),r=(0,t.useCallback)(r=>a[r+=""]?e(a[r]):r,[e]),l=(0,t.useCallback)(r=>i[r]?e(i[r]):r,[e]);return{days:a,formatDay:r,formatDayOfWeek:l,formatSortDay:(0,t.useCallback)(r=>s[r+=""]?e(s[r]):r,[e]),formatSortDayOfWeek:(0,t.useCallback)(r=>o[r]?e(o[r]):r,[e]),mergeOvernightSlots:(0,t.useCallback)(e=>{let r=e.map(e=>e.day),l=e.map(e=>({...e,dayTimeSlots:e.dayTimeSlots.map(e=>({...e}))}));l.sort((e,r)=>e.day-r.day);for(let e=0;e<l.length;e++){let r=l[e];if(0===r.dayTimeSlots.length)continue;let t=7===r.day?1:r.day+1,n=l.findIndex(e=>e.day===t);if(-1===n)continue;let a=l[n];if(0===a.dayTimeSlots.length)continue;let i=a.dayTimeSlots.findIndex(e=>0===e.startHour&&0===e.startMinute&&(e.closingHour<5||5===e.closingHour&&0===e.closingMinute));if(-1===i)continue;let s=a.dayTimeSlots[i],o=r.dayTimeSlots[r.dayTimeSlots.length-1];o.closingHour=s.closingHour,o.closingMinute=s.closingMinute,a.dayTimeSlots.splice(i,1)}return l.sort((e,l)=>r.indexOf(e.day)-r.indexOf(l.day)),l},[])}}},54975:function(e,r,l){"use strict";l.d(r,{m:function(){return a}});var t=l(67294),n=l(93411);function a(){let{scrollAmount:e=200,scrollThreshold:r=60,dependencies:l=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{isMobile:a}=(0,n.p)(),i=(0,t.useRef)(null),[s,o]=(0,t.useState)(!1),[d,c]=(0,t.useState)(!1),u=(0,t.useCallback)(()=>{if(i.current){let{scrollLeft:e,scrollWidth:l,clientWidth:t}=i.current;o(e>0),c(e<l-t-r)}},[r]);(0,t.useEffect)(()=>{u();let e=i.current;if(e)return e.addEventListener("scroll",u),window.addEventListener("resize",u),()=>{e.removeEventListener("scroll",u),window.removeEventListener("resize",u)}},[...l,u]);let m=(0,t.useCallback)(r=>{i.current&&i.current.scrollBy({left:"left"===r?-e:e,behavior:"smooth"})},[e]);return{scrollRef:i,canScrollLeft:s,canScrollRight:d,showScrollButtons:(s||d)&&!a,scroll:m}}},54164:function(e,r,l){"use strict";l.d(r,{p:function(){return u}});var t=l(85893),n=l(67294),a=l(99519),i=l(60486),s=l(83846),o=l(69166),d=l(11949),c=l(93411);let u=e=>{let{order:r}=e,{t:l}=(0,d.q)(),{getOrderTypeLabels:u}=(0,a.A)(),{isDesktop:m}=(0,c.p)();return(0,n.useMemo)(()=>{var e;if(!r)return{fromLabel:"",toLabel:"",fromContent:"",toContent:"",toPhoneNumber:"",tableNumberLabel:"",tableNumberContent:"",pickupPointLabel:"",pickupPointContent:"",isEatIn:!1};let n=(0,s.K9)(null==r?void 0:r.orderType),a=(null==r?void 0:r.orderType)===o.m["EAT-IN"],d=u(null==r?void 0:r.orderType),c=d.from,p=d.to,h=m?null==r?void 0:r.locationAddress:"",y=m?(0,i.Mh)(null==r?void 0:null===(e=r.customerOrderAddress)||void 0===e?void 0:e.customerOrderAddressFields):"",v=n?(0,t.jsxs)(t.Fragment,{children:[null==r?void 0:r.location," ",(0,t.jsx)("br",{}),h]}):(0,t.jsx)(t.Fragment,{children:null==r?void 0:r.location}),x=n?(0,t.jsxs)(t.Fragment,{children:[null==r?void 0:r.customerFirstName," ",null==r?void 0:r.customerLastName,(0,t.jsx)("br",{}),y]}):(0,t.jsx)(t.Fragment,{children:null==r?void 0:r.locationAddress}),f=a?l("label.table.number"):void 0,_=a?null==r?void 0:r.tableNumber:void 0,g=l("label.pickup.point"),j=l("label.pickup.at.counter");return{fromLabel:c,toLabel:p,fromContent:v,toContent:x,toPhoneNumber:n?null==r?void 0:r.customerPhone:"",tableNumberLabel:f,tableNumberContent:_,pickupPointLabel:g,pickupPointContent:j,isEatIn:a}},[r,u,m,l])}},53656:function(e,r,l){"use strict";var t,n;l.d(r,{$:function(){return t}}),(n=t||(t={})).PENDING="PENDING",n.LOOKING_FOR_DRIVER="LOOKING_FOR_DRIVER",n.DRIVER_DEPART_PICKUP="DRIVER_DEPART_PICKUP",n.DRIVER_EN_ROUTE_TO_PICKUP="DRIVER_EN_ROUTE_TO_PICKUP",n.DRIVER_UNASSIGNED="DRIVER_UNASSIGNED",n.DRIVER_ASSIGNED="DRIVER_ASSIGNED",n.DRIVER_AT_PICKUP="DRIVER_AT_PICKUP",n.IN_TRANSIT="IN_TRANSIT",n.DRIVER_AT_DROP_OFF="DRIVER_AT_DROPOFF",n.SUCCESS="SUCCESS",n.FAILED="FAILED",n.CANCELLED="CANCELLED"},37378:function(e,r,l){"use strict";var t,n,a,i;l.d(r,{J:function(){return t},r:function(){return n}}),(a=t||(t={})).STAMPS="STAMPS",a.POINTS="POINTS",(i=n||(n={})).TOTAL_POINTS_EARNED="TOTAL_POINTS_EARNED",i.TOTAL_STAMPS_EARNED="TOTAL_STAMPS_EARNED",i.ORDERS_COUNT="ORDERS_COUNT",i.TOTAL_SPENDING="TOTAL_SPENDING"},71242:function(e,r,l){"use strict";var t,n,a,i,s,o;l.d(r,{Ex:function(){return t},a1:function(){return n},hr:function(){return a}}),(i=t||(t={})).POINTS_THRESHOLD="POINTS_THRESHOLD",i.STAMPS_THRESHOLD="STAMPS_THRESHOLD",i.ORDER_DISCOUNT="ORDER_DISCOUNT",i.MENU_ITEM_PURCHASE="MENU_ITEM_PURCHASE",i.PROMOTION_CODE="PROMOTION_CODE",i.ORDER_AMOUNT="ORDER_AMOUNT",i.DELIVERY_OPTION="DELIVERY_OPTION",i.PAYMENT_METHOD="PAYMENT_METHOD",i.TIME_PERIOD="TIME_PERIOD",i.PLATFORM="PLATFORM",(s=n||(n={})).ORDER="ORDER",s.DELIVERY="DELIVERY",s.MENU_ITEM="MENU_ITEM",(o=a||(a={})).PUBLIC="PUBLIC",o.PRIVATE="PRIVATE",o.TARGETED="TARGETED"},8201:function(e,r,l){"use strict";l.d(r,{C:function(){return n},_:function(){return t}});let t={pageSize:10,pageIndex:1},n={pageSize:50,pageIndex:1}},93797:function(e){e.exports={summary:"OrderSummary_summary__uWlrE",content:"OrderSummary_content__1Fg4J"}},88104:function(e){e.exports={container:"OrderSummaryPrice_container__hWJi6",item:"OrderSummaryPrice_item__GboAx",title:"OrderSummaryPrice_title__OEjlw"}},52232:function(e){e.exports={container:"OrderSummaryViewItem_container__THKkG",content:"OrderSummaryViewItem_content__ROMrG",count:"OrderSummaryViewItem_count__13ZOo",label:"OrderSummaryViewItem_label___q5zm",price:"OrderSummaryViewItem_price__LxtDY",additional:"OrderSummaryViewItem_additional__SJjIG"}}
1,1103:function(e){e.exports={card:"BoostItem_card__uQWVC",thumbnail:"BoostItem_thumbnail__I03p2",image:"BoostItem_image__8M22b",content:"BoostItem_content__acRkx"}},34360:function(e){e.exports={container:"EnrolmentPrompt_container__BryVo",inner:"EnrolmentPrompt_inner__bZsK4",description:"EnrolmentPrompt_description__7rGjw",button:"EnrolmentPrompt_button__as7_G"}},82506:function(e){e.exports={wrapper:"DealCard_wrapper___Zq0a",card:"DealCard_card__XFSeN",locked:"DealCard_locked__jYlmg",imageWrapper:"DealCard_imageWrapper__Vm7p4",image:"DealCard_image__8wQZB",appliedOverlay:"DealCard_appliedOverlay__rSUyj",appliedIcon:"DealCard_appliedIcon__aYtOA",appliedText:"DealCard_appliedText__XjN57"}},15612:function(e){e.exports={group:"DealGroup_group__N5c0t",locked:"DealGroup_locked__iCVuI",header:"DealGroup_header__ZeVuN",infoIcon:"DealGroup_infoIcon__R9LiH",requirement:"DealGroup_requirement__zT5jI",counter:"DealGroup_counter__je4pP",counterComplete:"DealGroup_counterComplete__IZwZX",rowWrapper:"DealGroup_rowWrapper__qPDlo",row:"DealGroup_row__G_83s",arrow:"DealGroup_arrow__cEbNP",arrowLeft:"DealGroup_arrowLeft__wATs2",arrowRight:"DealGroup_arrowRight__4hMcG"}},14179:function(e){e.exports={modal:"RedeemProductModal_modal__7YkgU",img:"RedeemProductModal_img__kPPY4",content:"RedeemProductModal_content__FOzuB",contentInner:"RedeemProductModal_contentInner__3K6TG",stickyFooter:"RedeemProductModal_stickyFooter__4Ib6q"}},54172:function(e){e.exports={header:"HowItWorksModal_header__VVUYi",body:"HowItWorksModal_body__FQkyB",row:"HowItWorksModal_row__vCopU",rowText:"HowItWorksModal_rowText__uvfpS",link:"HowItWorksModal_link__gBmU5"}},62314:function(e){e.exports={card:"LoyaltyCard_card__6WO0a",header:"LoyaltyCard_header__jjusM",logo:"LoyaltyCard_logo__ZZkov",counts:"LoyaltyCard_counts__GlZXw",earningRule:"LoyaltyCard_earningRule__F_I4a",actions:"LoyaltyCard_actions__YcM_Y",expiry:"LoyaltyCard_expiry___kxq9"}},64723:function(e){e.exports={wrapper:"PointsProgressBar_wrapper__emcnL",track:"PointsProgressBar_track__Rn0u4",fill:"PointsProgressBar_fill__NBB2c",dotWrapper:"PointsProgressBar_dotWrapper__025vE",dot:"PointsProgressBar_dot__Qzek5",labelAbove:"PointsProgressBar_labelAbove__DLuvv",labelBelow:"PointsProgressBar_labelBelow__Xqt_V"}},13103:function(e){e.exports={group:"RewardGroup_group__NVAhV",header:"RewardGroup_header__YV8MT",lockIcon:"RewardGroup_lockIcon__8ssMe",items:"RewardGroup_items__ukI3Z"}},33301:function(e){e.exports={card:"RewardItem_card__YLOiL",locked:"RewardItem_locked__tIrQ4",imageWrapper:"RewardItem_imageWrapper__eQ_E4",image:"RewardItem_image__bytfa"}},51281:function(e){e.exports={headerBar:"RewardsAndOffers_headerBar__8pXfX",tabs:"RewardsAndOffers_tabs__Pfqsb"}},51285:function(e){e.exports={container:"StampsGrid_container__XEznc"}},63201:function(e){e.exports={wrapper:"TierSection_wrapper__W6Smd",sectionTitle:"TierSection_sectionTitle__Nufgd",tierCard:"TierSection_tierCard__zhHhT",tierInfo:"TierSection_tierInfo__7qxCb",tierHeader:"TierSection_tierHeader__QrDp_"}},26035:function(e){e.exports={col:"OrderHistoryDetail_col__e75sw",icon:"OrderHistoryDetail_icon__QD7a6",summary:"OrderHistoryDetail_summary__a13uW",dash:"OrderHistoryDetail_dash__qYHIw"}},57224:function(e){e.exports={card:"OrderHistoryItem_card__iYPPr",title:"OrderHistoryItem_title__9yKm1",content:"OrderHistoryItem_content__vL5NH",img:"OrderHistoryItem_img__9scXC",name:"OrderHistoryItem_name__niDMD",col:"OrderHistoryItem_col__UGN2k",action:"OrderHistoryItem_action__TGXBL"}},84914:function(e){e.exports={wrapper:"Referrals_wrapper__OHF6s",headerRow:"Referrals_headerRow__PKh4s",headerMain:"Referrals_headerMain__pspdj",eyebrow:"Referrals_eyebrow__2YLdv",headerStats:"Referrals_headerStats__YHVD9",statValue:"Referrals_statValue__RVAZJ",autoGrid:"Referrals_autoGrid__cg_F8",statsGrid:"Referrals_statsGrid__lDM14",cellCard:"Referrals_cellCard__bzFMS",cell:"Referrals_cell__BpmLi",stepHead:"Referrals_stepHead__wuYHf",shareGrid:"Referrals_shareGrid___SqUw",listRow:"Referrals_listRow__Sut_B",pills:"Referrals_pills__HxOdZ",statusChip:"Referrals_statusChip__Yqs_y",chipDot:"Referrals_chipDot__SOgAr",chipLabel:"Referrals_chipLabel__G4XXs",chipAmount:"Referrals_chipAmount__HGpDe",chipAmountStruck:"Referrals_chipAmountStruck__mkp_C",links:"Referrals_links__o9txa",tagPending:"Referrals_tagPending__s0QeC",tagEarned:"Referrals_tagEarned__4shi_",tagIssued:"Referrals_tagIssued__EgbV5",tagCancelled:"Referrals_tagCancelled__U1SfM"}},17185:function(e){e.exports={layout:"page_layout__cFf7p",header:"page_header__n8U4b",title:"page_title__UIWyR",breadcrumb:"page_breadcrumb__sOP7v",container:"page_container__BSpfB",sider:"page_sider__IcbeQ",content:"page_content__Q2TmZ"}},74322:function(e){e.exports={footer:"Footer_footer__ddZ2A",copyright:"Footer_copyright__CP_2u",dash:"Footer_dash__Tb_Dk"}},35859:function(e){e.exports={payment:"PaymentMethod_payment__0WufV",content:"PaymentMethod_content__fIb5E"}},52764:function(e){e.exports={rate:"ReviewOrder_rate__Oa1dK"}}},function(e){e.O(0,[4204,1089,8446,1663,2706,1986,9537,8589,2220,6244,6387,2512,5891,3379,2466,4382,2888,9774,179],function(){return e(e.s=14430)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.