1"use strict";(self.webpackChunklamaco=self.webpackChunklamaco||[]).push([[195],{11645:(e,t,n)=>{n.d(t,{A:()=>r});const r=n(30227).A},30227:(e,t,n)=>{n.d(t,{A:()=>f});var r=n(65043),o=n(98139),i=n.n(o),s=n(35296),c=n(95150),a=n(56055),l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};function d(e){return"number"===typeof e?"".concat(e," ").concat(e," auto"):/^\d+(\.\d+)?(px|em|rem|%)$/.test(e)?"0 0 ".concat(e):e}const u=["xs","sm","md","lg","xl","xxl"];const f=r.forwardRef((e,t)=>{const{getPrefixCls:n,direction:o}=r.useContext(s.QO),{gutter:f,wrap:m}=r.useContext(c.A),{prefixCls:h,span:v,order:p,offset:g,push:x,pull:y,className:j,children:b,flex:w,style:A}=e,_=l(e,["prefixCls","span","order","offset","push","pull","className","children","flex","style"]),E=n("col",h),[S,N,C]=(0,a.xV)(E),I={};let O={};u.forEach(t=>{let n={};const r=e[t];"number"===typeof r?n.span=r:"object"===typeof r&&(n=r||{}),delete _[t],O=Object.assign(Object.assign({},O),{["".concat(E,"-").concat(t,"-").concat(n.span)]:void 0!==n.span,["".concat(E,"-").concat(t,"-order-").concat(n.order)]:n.order||0===n.order,["".concat(E,"-").concat(t,"-offset-").concat(n.offset)]:n.offset||0===n.offset,["".concat(E,"-").concat(t,"-push-").concat(n.push)]:n.push||0===n.push,["".concat(E,"-").concat(t,"-pull-").concat(n.pull)]:n.pull||0===n.pull,["".concat(E,"-rtl")]:"rtl"===o}),n.flex&&(O["".concat(E,"-").concat(t,"-flex")]=!0,I["--".concat(E,"-").concat(t,"-flex")]=d(n.flex))});const z=i()(E,{["".concat(E,"-").concat(v)]:void 0!==v,["".concat(E,"-order-").concat(p)]:p,["".concat(E,"-offset-").concat(g)]:g,["".concat(E,"-push-").concat(x)]:x,["".concat(E,"-pull-").concat(y)]:y},j,O,N,C),k={};if(f&&f[0]>0){const e=f[0]/2;k.paddingLeft=e,k.paddingRight=e}return w&&(k.flex=d(w),!1!==m||k.minWidth||(k.minWidth=0)),S(r.createElement("div",Object.assign({},_,{style:Object.assign(Object.assign(Object.assign({},k),A),I),className:z,ref:t}),b))})},33385:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(73216),o=n(70579);const i=e=>{const t=(0,r.Zp)();return(0,o.jsx)("img",{src:"/img/logo-paage-500.png",alt:"paage logo",onClick:e.disableClick?void 0:()=>t("/home"),style:{cursor:"pointer",width:e.width,height:e.height}})}},44210:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(65043);function o(){const[,e]=r.useReducer(e=>e+1,0);return e}},44320:(e,t,n)=>{n.d(t,{Ay:()=>c,ye:()=>s});var r=n(65043),o=n(80167),i=n(77340);const s=["xxl","xl","lg","md","sm","xs"],c=()=>{const[,e]=(0,o.Ay)(),t=(e=>({xs:"(max-width: ".concat(e.screenXSMax,"px)"),sm:"(min-width: ".concat(e.screenSM,"px)"),md:"(min-width: ".concat(e.screenMD,"px)"),lg:"(min-width: ".concat(e.screenLG,"px)"),xl:"(min-width: ".concat(e.screenXL,"px)"),xxl:"(min-width: ".concat(e.screenXXL,"px)")}))((e=>{const t=e,n=[].concat(s).reverse();return n.forEach((e,r)=>{const o=e.toUpperCase(),i="screen".concat(o,"Min"),s="screen".concat(o);if(!(t[i]<=t[s]))throw new Error("".concat(i,"<=").concat(s," fails : !(").concat(t[i],"<=").concat(t[s],")"));if(r<n.length-1){const e="screen".concat(o,"Max");if(!(t[s]<=t[e]))throw new Error("".concat(s,"<=").concat(e," fails : !(").concat(t[s],"<=").concat(t[e],")"));const i=n[r+1].toUpperCase(),c="screen".concat(i,"Min");if(!(t[e]<=t[c]))throw new Error("".concat(e,"<=").concat(c," fails : !(").concat(t[e],"<=").concat(t[c],")"))}}),e})(e));return r.useMemo(()=>{const e=new Map;let n=-1,r={};return{responsiveMap:t,matchHandlers:{},dispatch:t=>(r=t,e.forEach(e=>e(r)),e.size>=1),subscribe(t){return e.size||this.register(),n+=1,e.set(n,t),t(r),n},unsubscribe(t){e.delete(t),e.size||this.unregister()},register(){Object.entries(t).forEach(e=>{let[t,n]=e;const o=e=>{let{matches:n}=e;this.dispatch(Object.assign(Object.assign({},r),{[t]:n}))},s=window.matchMedia(n);(0,i.e)(s,o),this.matchHandlers[n]={mql:s,listener:o},o(s)})}
1,unregister(){Object.values(t).forEach(e=>{const t=this.matchHandlers[e];(0,i.p)(null===t||void 0===t?void 0:t.mql,null===t||void 0===t?void 0:t.listener)}),e.clear()}}},[e])}},47419:(e,t,n)=>{n.d(t,{A:()=>r});const r=n(74647).A},59806:(e,t,n)=>{n.d(t,{h:()=>h});var r=n(89379),o=n(80045),i=n(57528),s=n(63935),c=n(2826),a=n(70579);const l=["size","withBorder","overlay","radius","badge"];var d,u;const f=c.Ay.img(d||(d=(0,i.A)(["\n min-width: ","px;\n min-height: ","px;\n max-width: ","px;\n max-height: ","px;\n border-radius: ","px;\n border: 1px solid ",";\n"])),e=>{let{size:t}=e;return t},e=>{let{size:t}=e;return t},e=>{let{size:t}=e;return t},e=>{let{size:t}=e;return t},e=>{let{radius:t}=e;return t||8},s.Ug),m=c.Ay.div(u||(u=(0,i.A)(["\n border-radius: 40px;\n width: 20px;\n height: 20px;\n background-color: ",";\n display: inline-flex;\n align-items: center;\n justify-content: center;\n transform: translate(8px, -8px);\n"])),s.f),h=e=>{const{size:t=60,withBorder:n,overlay:i,radius:s,badge:c}=e,d=(0,o.A)(e,l);return(0,a.jsxs)("div",{className:"position-relative",children:[i&&(0,a.jsx)("div",{className:"position-absolute top-0 left-0 w-100 h-100",style:{zIndex:2},children:i}),c&&(0,a.jsx)("div",{className:"position-absolute top-0 right-0",style:{zIndex:3},children:(0,a.jsx)(m,{children:(0,a.jsx)("div",{className:"text-xs-medium text-white",children:c})})}),(0,a.jsx)(f,(0,r.A)((0,r.A)({style:{filter:i?"brightness(0.6)":"none",objectFit:"cover"}},d),{},{size:t,withBorder:n,radius:s}))]})}},60195:(e,t,n)=>{n.r(t),n.d(t,{default:()=>P});var r=n(89379),o=n(65043),i=n(31023),s=n(43801),c=n(16569),a=n(47419),l=n(11645),d=n(89073),u=n(1210),f=n(8354),m=n(9540),h=n(59781),v=n(12836),p=n(96444);var g=n(91646),x=n(67298),y=n(26449),j=n(59806),b=n(98734),w=n(33385),A=n(67361),_=n.n(A),E=n(4686),S=n(87790),N=n(70579);const{Text:C,Title:I}=i.A,O=()=>{var e,t;return null===(e=window.webkit)||void 0===e||null===(t=e.messageHandlers)||void 0===t?void 0:t.laddition},z=e=>{var t;null===(t=O())||void 0===t||t.postMessage(e)};function k(e){var t,n,r;const o=null!==(t=null!==(n=null!==(r=e.laddition_customer_id)&&void 0!==r?r:e.integration_account_id)&&void 0!==n?n:e.customerId)&&void 0!==t?t:e.customer_id;if("string"===typeof o&&o.trim())return o.trim();if("number"===typeof o&&Number.isFinite(o))return String(o);const i=e.customer;if(i&&"object"===typeof i&&null!==i){const e=i.id;if(null!=e&&String(e).trim())return String(e)}}const P=()=>{var e,t;const[n]=s.A.useForm(),[i,A]=(0,o.useState)(null),[P,R]=(0,o.useState)(!1),[L,M]=(0,o.useState)(!1),[F,D]=(0,o.useState)(!1),[T,G]=(0,o.useState)(null),[Q,U]=(0,o.useState)(null),[W,B]=(0,o.useState)(!1),[H,Z]=(0,o.useState)(!0),[V,q]=(0,o.useState)(!1),[K,Y]=(0,o.useState)([]),[J,X]=(0,o.useState)(null),[$,ee]=(0,o.useState)(""),te=(0,o.useRef)(null),ne=(0,o.useRef)(null),re=(0,o.useRef)(null),oe=(0,o.useRef)(null),ie=(0,o.useRef)(null),se=(0,o.useRef)(!1),ce=(0,o.useRef)({log:console.log,error:console.error,warn:console.warn}),ae=!1,le=(0,o.useMemo)(()=>/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,[]),de=o.useCallback(function(e){const t=(new Date).toLocaleTimeString();for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];const i=r.map(e=>"object"===typeof e?JSON.stringify(e,null,2):String(e)).join(" ");Y(n=>[...n,{time:t,type:e,message:i}]),"error"===e?ce.current.error(...r):"warn"===e?ce.current.warn(...r):ce.current.log(...r)},[]);(0,o.useEffect)(()=>(console.log=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return de("log",...t)},console.error=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return de("error",...t)},console.warn=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return de("warn",...t)},()=>{console.log=ce.current.log,console.error=ce.current.error,console.warn=ce.current.warn}),[de]),(0,o.useEffect)(()=>{V&&oe.current&&oe.current.scrollIntoView({behavior:"smooth"})},[K,V]);const ue=o.useCallback(e=>{var t;O()?(z({webview:{close:"dismiss"===e.event},type:"loyalty",data:(0,r.A)({event:e.event,version:e.version},null!==(t=e.data)&&void 0!==t?t:{})}),console.log("L'Addition POS message:",e)):console.log("No L'Addition WebKit bridge for \"".concat(e.event,'"'),e)},[ae]);(0,o.useEffect)(()=>{let e,t,n=!1,r=!1;const o=o=>{n||r||(r=!0,clearInterval(e),clearTimeout(t),Z(!1),B(o))};return e=setInterval(()=>{O()&&o(!0)},100),t=setTimeout(()=>{o(Boolean(O()))},3e3),()=>{n=!0,clearInterval(e),clearTimeout(t)}},[ae]),(0,o.useEffect)(()=>{ie.current=function(){const e=new URLSearchParams(window.location.search).get("paage_identifier");return e&&e.trim()?e.trim():null}()},[]),(0,o.useEffect)(()=>
1{if(!W)return;const e=function(e){const t=new URLSearchParams(e.startsWith("?")?e.slice(1):e),n=t.get("laddition_order_id"),r=t.get("order_total"),o=t.get("laddition_customer_id");if(!n&&!r&&!o)return null;const i={};if(o&&(i.laddition_customer_id=o),n&&(i.orderId=n),null!==r&&""!==r){const e=Number(r);Number.isNaN(e)||(i.price={final_amount_inc_tax:e,discounts:[]})}const s=t.get("laddition_table_id"),c=t.get("laddition_table_name");(s||c)&&(i.table={id:null!==s&&void 0!==s?s:"",name:null!==c&&void 0!==c?c:""});const a=t.get("laddition_shift_id");return a&&(i.shift={id:a}),i}(window.location.search);return e&&U(t=>(0,r.A)((0,r.A)({},t),e)),window.receiveFromIpad=(e,t)=>{if("order"!==e){if("identifier"===e||"client"===e)try{const e=k(JSON.parse(t));e&&U(t=>(0,r.A)((0,r.A)({},t),{},{laddition_customer_id:e,integration_account_id:e}))}catch(n){const e=null===t||void 0===t?void 0:t.trim();e&&U(t=>(0,r.A)((0,r.A)({},t),{},{laddition_customer_id:e,integration_account_id:e}))}}else try{const e=JSON.parse(t);U(t=>function(e,t){var n;const o=t.order&&"object"===typeof t.order&&null!==t.order?t.order:null,i="number"===typeof(null===o||void 0===o?void 0:o.orderedAmount)?o.orderedAmount:"number"===typeof t.orderedAmount?t.orderedAmount:void 0,s=t.price&&"object"===typeof t.price&&null!==t.price&&"final_amount_inc_tax"in t.price?t.price:void 0!==i?{final_amount_inc_tax:Math.round(100*Number(i)),discounts:[]}:void 0,c=null!==(n=k(t))&&void 0!==n?n:o?k(o):void 0,a="string"===typeof t.orderId&&t.orderId||"string"===typeof t.order_id&&t.order_id||(o&&"string"===typeof o.id?o.id:void 0)||(null===e||void 0===e?void 0:e.orderId);return(0,r.A)((0,r.A)((0,r.A)({},e),t),{},{orderId:a,laddition_customer_id:null!==c&&void 0!==c?c:null===e||void 0===e?void 0:e.laddition_customer_id,price:null!==s&&void 0!==s?s:null===e||void 0===e?void 0:e.price})}(t,e))}catch(o){console.error("Invalid order payload from L'Addition POS",o)}},()=>{delete window.receiveFromIpad}},[W,ae]),(0,o.useEffect)(()=>{if(!W)return;const e=ie.current;e&&!se.current&&(null!==Q&&void 0!==Q&&Q.laddition_customer_id||O()&&(se.current=!0,function(e){z({webview:{close:!(arguments.length>1&&void 0!==arguments[1])||arguments[1]},type:"identifier",data:{identifier:e}})}(e),console.log("L'Addition: sent identifier request to POS")))},[W,ae,null===Q||void 0===Q?void 0:Q.laddition_customer_id]);const{mutateAsync:fe,isLoading:me}=(0,v.n)({mutationKey:["laddition-gift-card-by-code"],mutationFn:async e=>(0,p.default)("/store/laddition/redeem/".concat(e.code),{method:"GET"})}),{mutateAsync:he,isLoading:ve}=(0,v.n)({mutationKey:["laddition-gift-card-by-order-id"],mutationFn:async e=>(0,p.default)("/store/laddition/redeem-with-order/".concat(e.id),{method:"GET"})}),{mutateAsync:pe}=(()=>{const e=(0,h.jE)();return(0,v.n)({mutationKey:["create-laddition-redemption"],mutationFn:async e=>(0,p.default)("/store/laddition/voucher-redemptions",{method:"POST",data:e}),onSuccess:()=>{e.invalidateQueries({queryKey:["laddition-gift-card-by-code"]}),e.invalidateQueries({queryKey:["laddition-gift-card-by-order-id"]})}})})(),ge=(0,o.useMemo)(()=>{if(null===i||void 0===i||!i.ends_at)return!1;const e=new Date(i.ends_at);return e.setDate(e.getDate()+1),e<new Date},[null===i||void 0===i?void 0:i.ends_at]),xe=(0,o.useMemo)(()=>i?i.is_disabled&&i.balance>0?{text:"Disabled",type:"danger"}:0===i.balance?{text:"Fully redeemed",type:"success"}:i.is_disabled?{text:"Disabled",type:"danger"}:{text:"Active",type:"success"}:null,[i]),ye=async()=>{if(i)if(Q){R(!0),M(!1);try{var e,t,r;const o=String(null!==(e=null!==(t=null===Q||void 0===Q?void 0:Q.laddition_customer_id)&&void 0!==t?t:null===Q||void 0===Q?void 0:Q.integration_account_id)&&void 0!==e?e:"");if(!o)return c.Ay.error("Missing L'Addition customer id (from POS order)"),void R(!1);const s=null===Q||void 0===Q||null===(r=Q.price)||void 0===r?void 0:r.final_amount_inc_tax,a=null!==J&&void 0!==J?J:s?Math.min(s,i.balance):i.balance;await pe({amount:a,method:"laddition",gift_card_id:i.id,laddition_customer_id:o}),ue({event:"add_transaction",version:1,data:{id_transaction_method:1,amount:parseInt(String(a),10)}}),c.Ay.success("Gift card redeemed successfully!"),R(!1),ue({event:"dismiss",version:1}),A(null),n.resetFields()}catch(o){console.error("Error in redeem process:",o),c.Ay.error("Error completing redemption"),R(!1)}}else c.Ay.error("No order selected");else c.Ay.error("No gift card selected")},je=()=>{if(console.log("Stopping camera..."),re.current&&(clearInterval(re.current),re.current=null),te.current)try{te.current.pause(),te.current.srcObject=null,te.current.removeAttribute("src")}catch(e){console.error("Error clearing video element:",e)}
1if(T){try{T.getTracks().forEach(e=>{e.stop()})}catch(e){console.error("Error stopping tracks:",e)}G(null)}D(!1),console.log("Camera stopped successfully")},be=()=>{re.current&&clearInterval(re.current),re.current=setInterval(()=>{try{if(te.current&&ne.current&&te.current.readyState===te.current.HAVE_ENOUGH_DATA&&te.current.videoWidth>0&&te.current.videoHeight>0){const e=ne.current,t=e.getContext("2d");if(!t)return;const{videoWidth:n,videoHeight:r}=te.current;if(n<=0||r<=0)return;e.width=n,e.height=r,t.drawImage(te.current,0,0,n,r);const o=t.getImageData(0,0,n,r);if(!o||!o.data||0===o.data.length)return;const i=_()(o.data,o.width,o.height);i&&i.data&&(console.log("QR Code detected:",i.data),we(i.data))}}catch(e){console.error("Error during QR scanning:",e)}},200)},we=async e=>{try{if(console.log("\ud83d\udd0d QR Code scanned:",e),!e||e.trim().length<3)return void console.warn("Invalid QR data detected, ignoring:",e);const u=e.match(/\/redeem-voucher\/(order_[A-Z0-9]+)/i),f=e.match(/\/redeem-voucher\/order_[A-Z0-9]+\?code=([A-Za-z0-9-]+)/i);console.log("\ud83d\udccb Pattern matches:",{orderIdMatch:null===u||void 0===u?void 0:u[1],queryCodeMatch:null===f||void 0===f?void 0:f[1]});const m=e.match(/(?:bonkdo\.com|mybeezbox\.com).*\/mygift\/([A-Za-z0-9]+)/i),h=e.match(/([A-Z0-9]{4}-[A-Z0-9]{4})/),v=e.match(/^[A-Z0-9]{6,8}$/),p=e.match(/^[a-z0-9]{8,12}$/);if(!u&&!f&&!m&&!h&&!v&&!p)return void console.warn("QR data doesn't match expected patterns, ignoring:",e);if(je(),u){const e=u[1],i=null===f||void 0===f?void 0:f[1];console.log("\ud83c\udfab Processing order URL:",{orderId:e,code:i});try{if(A(null),i){console.log("\u2705 Using code from query parameter:",i);const e=await fe({code:i});A(e.data),n.setFieldValue("voucherId",i)}else{console.log("\ud83d\udd04 Fetching by order ID:",e);const t=await he({id:e});A(t.data),t.data.code&&n.setFieldValue("voucherId",t.data.code)}c.Ay.success("Gift card found via QR scan!")}catch(d){var t,r,o;console.error("\u274c Error retrieving gift card:",d),console.error("Error details:",null===(t=d.response)||void 0===t?void 0:t.data),A(null),404===(null===(r=d.response)||void 0===r?void 0:r.status)?c.Ay.error("Gift card not found"):400===(null===(o=d.response)||void 0===o?void 0:o.status)?c.Ay.error("Gift card is not active"):c.Ay.error("Error retrieving gift card")}}else if(m){const e=m[1];try{A(null);const t=await fe({code:e});A(t.data),n.setFieldValue("voucherId",e),c.Ay.success("Gift card found via QR scan!")}catch(d){var i,s;console.error("Error retrieving gift card:",d),A(null),404===(null===(i=d.response)||void 0===i?void 0:i.status)?c.Ay.error("Gift card not found"):400===(null===(s=d.response)||void 0===s?void 0:s.status)?c.Ay.error("Gift card is not active"):c.Ay.error("Error retrieving gift card")}}else{let t=e;if(p)t=p[0];else{const n=e.match(/([A-Z0-9]{4}-[A-Z0-9]{4})/);n&&(t=n[1]);let r=t.replace(/[^A-Za-z0-9]/g,"").toUpperCase();r.length>8&&(r=r.substring(0,8)),r.length>4&&(r=r.substring(0,4)+"-"+r.substring(4)),t=r}if(t.length<3)return void c.Ay.error("Invalid QR code format");n.setFieldValue("voucherId",t);try{A(null);const e=await fe({code:t});A(e.data),c.Ay.success("Gift card found via QR scan!")}catch(d){var a,l;console.error("Error retrieving gift card:",d),A(null),404===(null===(a=d.response)||void 0===a?void 0:a.status)?c.Ay.error("Gift card not found"):400===(null===(l=d.response)||void 0===l?void 0:l.status)?c.Ay.error("Gift card is not active"):c.Ay.error("Error retrieving gift card")}}}catch(d){console.error("Error processing QR code:",d),je(),c.Ay.error("Error processing QR code")}};(0,o.useEffect)(()=>{F&&T&&te.current&&!te.current.srcObject&&(console.log("Setting up video stream in effect..."),te.current.srcObject=T,te.current.setAttribute("playsinline",""),te.current.setAttribute("webkit-playsinline",""),te.current.setAttribute("x-webkit-airplay","deny"),te.current.muted=!0,te.current.defaultMuted=!0,te.current.play().catch(e=>{console.error("Error playing video in effect:",e)}))},[F,T]),(0,o.useEffect)(()=>{!F&&T&&(T.getTracks().forEach(e=>e.stop()),G(null),re.current&&(clearInterval(re.current),re.current=null),te.current&&(te.current.srcObject=null))},[F,T]),(0,o.useEffect)(()=>{const e=()=>{document.hidden&&F?(console.log("Page hidden, pausing camera..."),te.current&&te.current.pause()):!document.hidden&&F&&T&&te.current&&(console.log("Page visible, resuming camera..."),te.current.play().catch(e=>{console.error("Error resuming video:",e)}))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[F,T]),(0,o.useEffect)(()=>()=>{je()},[]),(0,o.useEffect)(()=>
1{if(i&&Q){var e,t;const n=null!==(e=null===Q||void 0===Q||null===(t=Q.price)||void 0===t?void 0:t.final_amount_inc_tax)&&void 0!==e?e:0;n>0&&n<i.balance?(X(n),ee((n/100).toFixed(2))):(X(null),ee(""))}else X(null),ee("")},[i,Q]);const Ae=()=>{var e,t;if(!i||!Q)return;const n=null!==(e=null===Q||void 0===Q||null===(t=Q.price)||void 0===t?void 0:t.final_amount_inc_tax)&&void 0!==e?e:0,r=parseFloat($);if(isNaN(r))return void ee(((null!==J&&void 0!==J?J:n)/100).toFixed(2));const o=Math.round(100*r),s=Math.max(n,Math.min(o,i.balance));X(s),ee((s/100).toFixed(2))},_e=e=>{var t,n;if(!i||!Q)return;const r=null!==(t=null===Q||void 0===Q||null===(n=Q.price)||void 0===n?void 0:n.final_amount_inc_tax)&&void 0!==t?t:0,o=100*Math.ceil(r/100);let s;e<=(r+o)/2?s=r:(s=100*Math.round(e/100),s=Math.max(s,o)),s=Math.min(s,i.balance),X(s),ee((s/100).toFixed(2))};return H?(0,N.jsx)(a.A,{className:"vh-100 w-100 p-0",children:(0,N.jsxs)(l.A,{className:"d-flex flex-column align-items-center justify-content-center",span:24,children:[(0,N.jsx)("div",{className:"text-center mb-5",children:(0,N.jsx)(w.A,{width:150,height:50})}),(0,N.jsxs)("div",{className:"text-center",children:[(0,N.jsx)("div",{className:"spinner-border text-primary mb-3",role:"status",children:(0,N.jsx)("span",{className:"sr-only",children:"Loading..."})}),(0,N.jsx)(C,{children:"Connecting to L'Addition POS\u2026"})]})]})}):W?(0,N.jsxs)(a.A,{className:"vh-100 w-100 p-0",style:{overflowY:"auto"},children:[(0,N.jsxs)(l.A,{className:"d-flex flex-column pt-2 pb-5 align-items-center justify-content-center",xs:{span:22,offset:1},sm:{span:20,offset:2},md:{span:16,offset:4},lg:{span:12,offset:6},xl:{span:10,offset:7},children:[(0,N.jsx)("div",{className:"text-center mb-5",children:(0,N.jsx)(w.A,{disableClick:!0,width:150,height:50})}),(0,N.jsxs)(s.A,{form:n,onFinish:async e=>{try{A(null);const t=await fe({code:e.voucherId});A(t.data),c.Ay.success("Gift card found!")}catch(r){var t,n;console.error("Error retrieving gift card:",r),A(null),404===(null===(t=r.response)||void 0===t?void 0:t.status)?c.Ay.error("Gift card not found"):400===(null===(n=r.response)||void 0===n?void 0:n.status)?c.Ay.error("Gift card is not active"):c.Ay.error("Error retrieving gift card")}},layout:"vertical",className:"w-100",style:{maxWidth:400},children:[(0,N.jsx)(s.A.Item,{name:"voucherId",rules:[{required:!0,message:"Please enter your voucher ID"}],children:(0,N.jsx)(S.A,{placeholder:"Enter voucher code",size:"large",style:{height:48}})}),(0,N.jsx)(s.A.Item,{className:"mb-3",children:(0,N.jsx)(E.Ay,{htmlType:"submit",size:"large",loading:me||ve,className:"w-100",children:(0,N.jsxs)("div",{className:"d-flex align-items-center justify-content-center gap-2",children:[(0,N.jsx)(x.n,{className:"mr-2",icon:y.Search01Icon,size:18}),(0,N.jsx)("span",{children:"Search"})]})})}),(0,N.jsx)(s.A.Item,{className:"mb-0",children:(0,N.jsx)(E.Ay,{type:"secondary",onClick:async()=>{try{D(!0),await new Promise(e=>setTimeout(e,100));const t={video:{facingMode:"environment",width:{ideal:1280},height:{ideal:720}}},n=await navigator.mediaDevices.getUserMedia(t);if(G(n),await new Promise(e=>setTimeout(e,100)),te.current&&n){te.current.srcObject=n,te.current.setAttribute("playsinline",""),te.current.setAttribute("webkit-playsinline",""),te.current.setAttribute("x-webkit-airplay","deny"),te.current.muted=!0,te.current.autoplay=!0,te.current.defaultMuted=!0;try{await te.current.play(),console.log("Video playing successfully")}catch(e){console.error("Error playing video:",e)}setTimeout(()=>{te.current&&n&&be()},1e3)}}catch(t){console.error("Error accessing camera:",t),c.Ay.error("Unable to access camera. Please check permissions."),D(!1)}},size:"large",loading:me||ve,className:"w-100",children:(0,N.jsxs)("div",{className:"d-flex align-items-center justify-content-center gap-2",children:[(0,N.jsx)(x.n,{className:"mr-2",icon:y.Camera01Icon,size:18}),(0,N.jsx)("span",{children:"Scan QR Code"})]})})})]}),F&&le?(0,N.jsxs)("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"#000",zIndex:9999,display:"flex",flexDirection:"column"},children:[(0,N.jsxs)("div",{style:{padding:"16px",backgroundColor:"#fff",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,N.jsx)(C,{strong:!0,children:"Scan QR Code"}),(0,N.jsx)(E.Ay,{onClick:je,icon:(0,N.jsx)(x.n,{icon:y.Cancel01Icon,size:16}),children:"Close"})]}),(0,N.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"16px"}
1,children:[(0,N.jsx)("video",{ref:te,playsInline:!0,muted:!0,autoPlay:!0,controls:!1,disablePictureInPicture:!0,style:{width:"100%",height:"auto",maxHeight:"70vh",border:"2px solid #1890ff",borderRadius:8,objectFit:"cover"}}),(0,N.jsx)("canvas",{ref:ne,style:{display:"none"}}),(0,N.jsx)("div",{style:{marginTop:16,textAlign:"center"},children:(0,N.jsx)(C,{style:{color:"#fff"},children:"Position the QR code within the camera view to scan automatically"})})]})]}):F?(0,N.jsx)(u.A,{title:"Scan QR Code",open:F,onCancel:je,footer:[(0,N.jsx)(E.Ay,{onClick:je,icon:(0,N.jsx)(x.n,{icon:y.Cancel01Icon,size:16}),children:"Close Camera"},"close")],width:600,centered:!0,style:{top:0},bodyStyle:{padding:"16px",maxHeight:"80vh",overflow:"hidden"},children:(0,N.jsxs)("div",{className:"text-center",children:[(0,N.jsx)("video",{ref:te,playsInline:!0,muted:!0,autoPlay:!0,controls:!1,disablePictureInPicture:!0,style:{width:"100%",maxWidth:500,height:"auto",maxHeight:"60vh",border:"2px solid #1890ff",borderRadius:8,objectFit:"cover"}}),(0,N.jsx)("canvas",{ref:ne,style:{display:"none"}}),(0,N.jsx)("div",{className:"mt-3",children:(0,N.jsx)(C,{type:"secondary",children:"Position the QR code within the camera view to scan automatically"})})]})}):null,i&&(0,N.jsxs)(d.A,{className:"w-100 mt-4",style:{maxWidth:400},title:"Gift Card Details",children:[(0,N.jsxs)("div",{className:"d-flex flex-column gap-2",children:[(0,N.jsxs)("div",{children:[(0,N.jsx)(C,{strong:!0,children:"Code: "}),(0,N.jsx)(C,{code:!0,children:i.code})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)(C,{strong:!0,children:"Value: "}),(0,N.jsx)(C,{children:(0,g.E1)(i.value,i.region.currency_code)})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)(C,{strong:!0,children:"Balance: "}),(0,N.jsx)(C,{children:(0,g.E1)(i.balance,i.region.currency_code)})]}),(0,N.jsxs)("div",{children:[(0,N.jsx)(C,{strong:!0,children:"Status: "}),(0,N.jsx)(C,{type:null!==(e=null===xe||void 0===xe?void 0:xe.type)&&void 0!==e?e:"success",children:null!==(t=null===xe||void 0===xe?void 0:xe.text)&&void 0!==t?t:"\u2014"})]}),i.ends_at&&(0,N.jsxs)("div",{children:[(0,N.jsx)(C,{strong:!0,children:"Expires: "}),(0,N.jsxs)(C,{type:ge?"danger":void 0,children:[new Date(i.ends_at).toLocaleDateString(),ge&&" (Expired)"]})]})]}),i.items&&i.items.length>0&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(f.A,{className:"my-3"}),(0,N.jsxs)("div",{className:"d-flex flex-column",style:{gap:12},children:[(0,N.jsx)(C,{strong:!0,children:"Items:"}),i.items.map(e=>(0,N.jsxs)(b.A,{alignItems:"center",gap:"sm",style:{marginBottom:8},children:[(0,N.jsx)(j.h,{src:e.thumbnail||"",alt:e.title,size:40}),(0,N.jsxs)(b.A,{flexDirection:"column",className:"w-100 cut-text-w-100",children:[(0,N.jsxs)("div",{className:"cut-text-w-100",children:[e.title," (x",e.quantity,")"]}),(0,N.jsx)("div",{className:"text-grey font-size-sm",children:(0,g.E1)(e.unit_price,i.region.currency_code)})]})]},e.id))]})]}),((e,t)=>{const n=null!==(e=null===Q||void 0===Q||null===(t=Q.price)||void 0===t?void 0:t.final_amount_inc_tax)&&void 0!==e?e:0,r=n>0&&n<i.balance,o=(null!==J&&void 0!==J?J:n)-n;return r?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(f.A,{className:"my-3"}),(0,N.jsxs)("div",{className:"d-flex flex-column gap-2",children:[(0,N.jsx)(C,{strong:!0,children:"Add a tip?"}),(0,N.jsx)(C,{type:"secondary",style:{fontSize:12},children:"Your gift card balance exceeds the order total. You can add a tip if you'd like."}),(0,N.jsxs)("div",{className:"mt-2",children:[(0,N.jsx)(m.A,{min:n,max:i.balance,value:null!==J&&void 0!==J?J:n,onChange:_e,tooltip:{formatter:()=>(0,g.E1)(null!==J&&void 0!==J?J:n,i.region.currency_code)}}),(0,N.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,N.jsxs)(C,{type:"secondary",style:{fontSize:12},children:["Order:"," ",(0,g.E1)(n,i.region.currency_code)]}),(0,N.jsxs)(C,{type:"secondary",style:{fontSize:12},children:["Max:"," ",(0,g.E1)(i.balance,i.region.currency_code)]})]}),(0,N.jsxs)("div",{className:"text-center mt-3",children:[(0,N.jsx)(C,{strong:!0,style:{fontSize:16},children:"Total to pay:"}),(0,N.jsxs)("div",{className:"d-flex align-items-center justify-content-center gap-2 mt-2",children:[(0,N.jsx)(S.A,{type:"text",inputMode:"decimal",value:$,onChange:e=>(e=>{const t=e.replace(/[^0-9.]/g,""),n=t.split("."),r=n.length>2?n[0]+"."+n.slice(1).join(""):t;ee(r)})(e.target.value),onBlur:Ae,onKeyDown:e=>{"Enter"===e.key&&(Ae(),e.target.blur())},style:{width:100,textAlign:"center",fontSize:18,fontWeight:600}}),(0,N.jsx)(C,{className:"ml-2",style:{fontSize:16},children:i.region.currency_code.toUpperCase()})]}),o>0&&(0,N.jsx)("div",{className:"mt-2",children:(0,N.jsxs)(C,{type:"success",style:{fontSize:14},children:["(includes"," ",(0,g.E1)(o,i.region.currency_code)," ","tip)"]})})]})]})]})]}):null})(),!i.is_disabled&&i.balance>0&&(0,N.jsx)("div",{className:"mt-3",children:(0,N.jsx)(E.Ay,{size:"large",className:"w-100",loading:P,onClick:()=>
1{i&&(ge?M(!0):ye())},style:{backgroundColor:"#52c41a",borderColor:"#52c41a"},children:"Use for payment"})})]}),(0,N.jsx)(u.A,{title:"Gift Card Expired",open:L,onOk:ye,onCancel:()=>M(!1),okText:"Yes, use it anyway",centered:!0,cancelText:"Cancel",confirmLoading:P,children:(0,N.jsxs)("p",{children:["This gift card expired on"," ",(0,N.jsx)("strong",{children:(null===i||void 0===i?void 0:i.ends_at)&&new Date(i.ends_at).toLocaleDateString()}),". Are you sure you want to use it for payment?"]})})]}),(0,N.jsx)("div",{style:{position:"fixed",bottom:16,left:16,zIndex:1e3},children:(0,N.jsx)(E.Ay,{type:"secondary",size:"small",onClick:()=>q(!V),children:V?"Hide Console":"Console"})}),V&&(0,N.jsxs)("div",{style:{position:"fixed",bottom:60,left:16,right:16,maxWidth:"600px",height:"400px",backgroundColor:"#1e1e1e",color:"#d4d4d4",border:"1px solid #333",borderRadius:8,zIndex:999,display:"flex",flexDirection:"column",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[(0,N.jsxs)("div",{style:{padding:"8px 12px",backgroundColor:"#252526",borderBottom:"1px solid #333",display:"flex",justifyContent:"space-between",alignItems:"center",borderTopLeftRadius:8,borderTopRightRadius:8},children:[(0,N.jsxs)(C,{style:{color:"#fff",fontSize:12},strong:!0,children:["Console (",K.length," logs)"]}),(0,N.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,N.jsx)(E.Ay,{type:"secondary",size:"small",onClick:()=>Y([]),style:{color:"#d4d4d4",fontSize:11},children:"Clear"}),(0,N.jsx)(E.Ay,{type:"secondary",size:"small",onClick:()=>q(!1),style:{color:"#d4d4d4",fontSize:11},children:"\u2715"})]})]}),(0,N.jsxs)("div",{style:{flex:1,overflowY:"auto",padding:"8px 12px",fontSize:12,fontFamily:"monospace"},children:[0===K.length?(0,N.jsx)("div",{style:{color:"#666",fontStyle:"italic"},children:"No logs yet..."}):K.map((e,t)=>(0,N.jsxs)("div",{style:{marginBottom:8,paddingBottom:8,borderBottom:"1px solid #333"},children:[(0,N.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-start"},children:[(0,N.jsx)("span",{style:{color:"#666",fontSize:10},children:e.time}),(0,N.jsxs)("span",{style:{color:"error"===e.type?"#f48771":"warn"===e.type?"#cca700":"#4ec9b0",fontSize:10,fontWeight:600},children:["[",e.type.toUpperCase(),"]"]})]}),(0,N.jsx)("pre",{style:{margin:"4px 0 0 0",whiteSpace:"pre-wrap",wordBreak:"break-word",color:"error"===e.type?"#f48771":"#d4d4d4"},children:e.message})]},t)),(0,N.jsx)("div",{ref:oe})]})]})]}):(0,N.jsx)(a.A,{className:"vh-100 w-100 p-0",children:(0,N.jsxs)(l.A,{className:"d-flex flex-column align-items-center justify-content-center",span:24,children:[(0,N.jsx)("div",{className:"text-center mb-5",children:(0,N.jsx)(w.A,{width:150,height:50})}),(0,N.jsxs)(d.A,{className:"text-center",style:{maxWidth:400},children:[(0,N.jsx)(I,{level:4,type:"danger",children:"Access Denied"}),(0,N.jsx)(C,{children:"This page must be opened from the L'Addition POS WebView (iPad)."})]})]})})}},74647:(e,t,n)=>{n.d(t,{A:()=>m});var r=n(65043),o=n(98139),i=n.n(o),s=n(44320),c=n(35296),a=n(99598);var l=n(95150),d=n(56055),u=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};function f(e,t){const[n,o]=r.useState("string"===typeof e?e:"");return r.useEffect(()=>{(()=>{if("string"===typeof e&&o(e),"object"===typeof e)for(let n=0;n<s.ye.length;n++){const r=s.ye[n];if(!t||!t[r])continue;const i=e[r];if(void 0!==i)return void o(i)}})()},[JSON.stringify(e),t]),n}const m=r.forwardRef((e,t)=>{const{prefixCls:n,justify:o,align:m,className:h,style:v,children:p,gutter:g=0,wrap:x}=e,y=u(e,["prefixCls","justify","align","className","style","children","gutter","wrap"]),{getPrefixCls:j,direction:b}=r.useContext(c.QO),w=(0,a.A)(!0,null),A=f(m,w),_=f(o,w),E=j("row",n),[S,N,C]=(0,d.L3)(E),I=function(e,t){const n=[void 0,void 0],r=Array.isArray(e)?e:[e,void 0],o=t||{xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0};return r.forEach((e,t)=>{if("object"===typeof e&&null!==e)for(let r=0;r<s.ye.length;r++){const i=s.ye[r];if(o[i]&&void 0!==e[i]){n[t]=e[i];break}}else n[t]=e}),n}(g,w),O=i()(E,{["".concat(E,"-no-wrap")]:!1===x,["".concat(E,"-").concat(_)]:_,["".concat(E,"-").concat(A)]:A,["".concat(E,"-rtl")]:"rtl"===b},h,N,C),z={},k=null!=I[0]&&I[0]>0?I[0]/-2:void 0;k&&(z.marginLeft=k,z.marginRight=k);const[P,R]=I;z.rowGap=R;const L=r.useMemo(()=>({gutter:[P,R],wrap:x}),[P,R,x]);return S(r.createElement(l.A.Provider,{value:L},r.createElement("div",Object.assign({},y,{className:O,style:Object.assign(Object.assign({},z),v),ref:t}),p)))})},77340:(e,t,n)=>{n.d(t,{e:()=>r,p:()=>o});const r=(e,t)=>{"undefined"!==typeof(null===e||void 0===e?void 0:e.addEventListener)?e.addEventListener("change",t):"undefined"!==typeof(null===e||void 0===e?void 0:e.addListener)&&e.addListener(t)},o=(e,t)=>{"undefined"!==typeof(null===e||void 0===e?void 0:e.removeEventListener)?e.removeEventListener("change",t):"undefined"!==typeof(null===e||void 0===e?void 0:e.removeListener)&&e.removeListener(t)}},95150:(e,t,n)=>{n.d(t,{A:()=>r});const r=(0,n(65043).createContext)({})}
1,99598:(e,t,n)=>{n.d(t,{A:()=>c});var r=n(65043),o=n(52664),i=n(44210),s=n(44320);const c=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=(0,r.useRef)(t),c=(0,i.A)(),a=(0,s.Ay)();return(0,o.A)(()=>{const t=a.subscribe(t=>{n.current=t,e&&c()});return()=>a.unsubscribe(t)},[]),n.current}}}]);
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.