1"use strict";(self.webpackChunklamaco=self.webpackChunklamaco||[]).push([[8240],{11645:(e,t,n)=>{n.d(t,{A:()=>r});const r=n(30227).A},30227:(e,t,n)=>{n.d(t,{A:()=>h});var r=n(65043),o=n(98139),s=n.n(o),i=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 h=r.forwardRef((e,t)=>{const{getPrefixCls:n,direction:o}=r.useContext(i.QO),{gutter:h,wrap:f}=r.useContext(c.A),{prefixCls:m,span:y,order:g,offset:p,push:x,pull:v,className:j,children:b,flex:w,style:A}=e,S=l(e,["prefixCls","span","order","offset","push","pull","className","children","flex","style"]),E=n("col",m),[C,z,N]=(0,a.xV)(E),O={};let _={};u.forEach(t=>{let n={};const r=e[t];"number"===typeof r?n.span=r:"object"===typeof r&&(n=r||{}),delete S[t],_=Object.assign(Object.assign({},_),{["".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&&(_["".concat(E,"-").concat(t,"-flex")]=!0,O["--".concat(E,"-").concat(t,"-flex")]=d(n.flex))});const I=s()(E,{["".concat(E,"-").concat(y)]:void 0!==y,["".concat(E,"-order-").concat(g)]:g,["".concat(E,"-offset-").concat(p)]:p,["".concat(E,"-push-").concat(x)]:x,["".concat(E,"-pull-").concat(v)]:v},j,_,z,N),k={};if(h&&h[0]>0){const e=h[0]/2;k.paddingLeft=e,k.paddingRight=e}return w&&(k.flex=d(w),!1!==f||k.minWidth||(k.minWidth=0)),C(r.createElement("div",Object.assign({},S,{style:Object.assign(Object.assign(Object.assign({},k),A),O),className:I,ref:t}),b))})},33385:(e,t,n)=>{n.d(t,{A:()=>s});var r=n(73216),o=n(70579);const s=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:()=>i});var r=n(65043),o=n(80167),s=n(77340);const i=["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(i).reverse();return n.forEach((e,r)=>{const o=e.toUpperCase(),s="screen".concat(o,"Min"),i="screen".concat(o);if(!(t[s]<=t[i]))throw new Error("".concat(s,"<=").concat(i," fails : !(").concat(t[s],"<=").concat(t[i],")"));if(r<n.length-1){const e="screen".concat(o,"Max");if(!(t[i]<=t[e]))throw new Error("".concat(i,"<=").concat(e," fails : !(").concat(t[i],"<=").concat(t[e],")"));const s=n[r+1].toUpperCase(),c="screen".concat(s,"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}))},i=window.matchMedia(n);(0,s.e)(i,o),this.matchHandlers[n]={mql:i,listener:o},o(i)})}
1,unregister(){Object.values(t).forEach(e=>{const t=this.matchHandlers[e];(0,s.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},48240:(e,t,n)=>{n.r(t),n.d(t,{default:()=>_});var r=n(65043),o=n(31023),s=n(43801),i=n(16569),c=n(47419),a=n(11645),l=n(89073),d=n(1210),u=n(8354),h=n(9540),f=n(65425),m=n(59781),y=n(12836),g=n(96444);var p=n(91646),x=n(67298),v=n(26449),j=n(59806),b=n(98734),w=n(33385),A=n(67361),S=n.n(A),E=n(4686),C=n(87790),z=n(70579);const{Text:N,Title:O}=o.A,_=()=>{const[e]=s.A.useForm(),[t,n]=(0,r.useState)(null),[o,A]=(0,r.useState)(!1),[_,I]=(0,r.useState)(!1),[k,P]=(0,r.useState)(!1),[R,M]=(0,r.useState)(null),[T,L]=(0,r.useState)(null),[F,Q]=(0,r.useState)(!1),[D,G]=(0,r.useState)(!0),[Z,H]=(0,r.useState)(null),[K,q]=(0,r.useState)(null),[B,U]=(0,r.useState)(!1),[V,W]=(0,r.useState)([]),[J,Y]=(0,r.useState)(null),[X,$]=(0,r.useState)(""),ee=(0,r.useRef)(null),te=(0,r.useRef)(null),ne=(0,r.useRef)(null),re=(0,r.useRef)(null),oe=(0,r.useRef)({log:console.log,error:console.error,warn:console.warn}),se=!1,ie=(0,r.useMemo)(()=>/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,[]),ce=r.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 s=r.map(e=>"object"===typeof e?JSON.stringify(e,null,2):String(e)).join(" ");W(n=>[...n,{time:t,type:e,message:s}]),"error"===e?oe.current.error(...r):"warn"===e?oe.current.warn(...r):oe.current.log(...r)},[]);(0,r.useEffect)(()=>(console.log=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ce("log",...t)},console.error=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ce("error",...t)},console.warn=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ce("warn",...t)},()=>{console.log=oe.current.log,console.error=oe.current.error,console.warn=oe.current.warn}),[ce]),(0,r.useEffect)(()=>{B&&re.current&&re.current.scrollIntoView({behavior:"smooth"})},[V,B]);const ae=r.useCallback(e=>{var t,n,r,o,s;null!==(t=window.webkit)&&void 0!==t&&null!==(n=t.messageHandlers)&&void 0!==n&&n.zeltyLoyaltyHandler?(null===(r=window.webkit)||void 0===r||null===(o=r.messageHandlers)||void 0===o||null===(s=o.zeltyLoyaltyHandler)||void 0===s||s.postMessage(e),console.log("Function called:",e)):console.log('Try to call function "'.concat(e.event,'" but no Webkit detected'),e)},[]);(0,r.useEffect)(()=>{let e;window.zeltySetVersion=t=>{Q(!0),G(!1),clearTimeout(e)};try{ae({event:"get_version",version:1})}catch(t){console.error("Failed to communicate with Zelty:",t),G(!1)}return e=setTimeout(()=>{console.warn("Zelty validation timeout - not a Zelty POS"),G(!1),Q(!1)},3e3),()=>{clearTimeout(e),window.zeltySetVersion=void 0}},[ae]),(0,r.useEffect)(()=>{if(F)return window.zeltySetOrder=(e,t)=>{console.log("Received order from Zelty:",{version:e,order:t}),L(t);const n=document.getElementById("responseOrder");n&&(n.innerText=JSON.stringify(t,null,2))},ae({event:"get_order",version:1}),()=>{window.zeltySetOrder=void 0}},[F,se,ae]);const{mutateAsync:le,isLoading:de}=(0,f.QT)(),{mutateAsync:ue,isLoading:he}=(0,f.OJ)(),{mutateAsync:fe,isLoading:me}=(()=>{const e=(0,m.jE)();return(0,y.n)({mutationKey:["create-zelty-redemption"],mutationFn:async e=>(0,g.default)("/store/zelty/voucher-redemptions",{method:"POST",data:e}),onSuccess:()=>{e.invalidateQueries({queryKey:["get-gift-card-by-code"]}),e.invalidateQueries({queryKey:["get-gift-card-by-order-id"]})}})})(),{mutateAsync:ye,isLoading:ge}=(0,y.n)({mutationKey:["get-zelty-transaction-methods"],mutationFn:async e=>(0,g.default)("/store/zelty/transaction-methods",{method:"POST",data:e})}),pe=(0,r.useMemo)(()=>{if(null===t||void 0===t||!t.ends_at)return!1;const e=new Date(t.ends_at);return e.setDate(e.getDate()+1),e<new Date},[null===t||void 0===t?void 0:t.ends_at]),xe=async()=>{if(t)if(T){A(!0),I(!1);try{var r,o;const s=String(null===T||void 0===T?void 0:T.brand_id),c=String(null===T||void 0===T?void 0:T.restaurant_id),a=await ye({zelty_brand_id:s});console.log("transactionMethods",a),H(a.data);const l="Paage",d=null===(r=a.data)||void 0===r?void 0:r.transaction_methods.find(e=>e.name.trim().toLowerCase()===l.trim().toLowerCase());console.log("paageTransactionMethod",d),q(d);const u=null===T||void 0===T||null===(o=T.price)||void 0===o?void 0:o.final_amount_inc_tax,h=null!==J&&void 0!==J?J:u?Math.min(u,t.balance):t.balance;
1await fe({amount:h,method:"zelty",gift_card_id:t.id,zelty_brand_id:s,zelty_restaurant_id:c}),ae({event:"add_transaction",version:1,data:{id_transaction_method:parseInt(String(null===d||void 0===d?void 0:d.id),10),amount:parseInt(String(h),10)}}),i.Ay.success("Gift card redeemed successfully!"),A(!1),ae({event:"dismiss",version:1}),n(null),e.resetFields()}catch(s){console.error("Error in redeem process:",s),i.Ay.error("Error completing redemption"),A(!1)}}else i.Ay.error("No order selected");else i.Ay.error("No gift card selected")},ve=()=>{if(console.log("Stopping camera..."),ne.current&&(clearInterval(ne.current),ne.current=null),ee.current)try{ee.current.pause(),ee.current.srcObject=null,ee.current.removeAttribute("src")}catch(e){console.error("Error clearing video element:",e)}if(R){try{R.getTracks().forEach(e=>{e.stop()})}catch(e){console.error("Error stopping tracks:",e)}M(null)}P(!1),console.log("Camera stopped successfully")},je=()=>{ne.current&&clearInterval(ne.current),ne.current=setInterval(()=>{try{if(ee.current&&te.current&&ee.current.readyState===ee.current.HAVE_ENOUGH_DATA&&ee.current.videoWidth>0&&ee.current.videoHeight>0){const e=te.current,t=e.getContext("2d");if(!t)return;const{videoWidth:n,videoHeight:r}=ee.current;if(n<=0||r<=0)return;e.width=n,e.height=r,t.drawImage(ee.current,0,0,n,r);const o=t.getImageData(0,0,n,r);if(!o||!o.data||0===o.data.length)return;const s=S()(o.data,o.width,o.height);s&&s.data&&(console.log("QR Code detected:",s.data),be(s.data))}}catch(e){console.error("Error during QR scanning:",e)}},200)},be=async t=>{try{if(console.log("\ud83d\udd0d QR Code scanned:",t),!t||t.trim().length<3)return void console.warn("Invalid QR data detected, ignoring:",t);const h=t.match(/\/redeem-voucher\/(order_[A-Z0-9]+)/i),f=t.match(/\/redeem-voucher\/order_[A-Z0-9]+\?code=([A-Za-z0-9-]+)/i);console.log("\ud83d\udccb Pattern matches:",{orderIdMatch:null===h||void 0===h?void 0:h[1],queryCodeMatch:null===f||void 0===f?void 0:f[1]});const m=t.match(/(?:bonkdo\.com|mybeezbox\.com).*\/mygift\/([A-Za-z0-9]+)/i),y=t.match(/([A-Z0-9]{4}-[A-Z0-9]{4})/),g=t.match(/^[A-Z0-9]{6,8}$/),p=t.match(/^[a-z0-9]{8,12}$/);if(!h&&!f&&!m&&!y&&!g&&!p)return void console.warn("QR data doesn't match expected patterns, ignoring:",t);if(ve(),h){const t=h[1],c=null===f||void 0===f?void 0:f[1];console.log("\ud83c\udfab Processing order URL:",{orderId:t,code:c});try{if(n(null),c){console.log("\u2705 Using code from query parameter:",c);const t=await le({code:c});n(t.data),e.setFieldValue("voucherId",c)}else{console.log("\ud83d\udd04 Fetching by order ID:",t);const r=await ue({id:t});n(r.data),r.data.code&&e.setFieldValue("voucherId",r.data.code)}i.Ay.success("Gift card found via QR scan!")}catch(u){var r,o,s;console.error("\u274c Error retrieving gift card:",u),console.error("Error details:",null===(r=u.response)||void 0===r?void 0:r.data),n(null),404===(null===(o=u.response)||void 0===o?void 0:o.status)?i.Ay.error("Gift card not found"):400===(null===(s=u.response)||void 0===s?void 0:s.status)?i.Ay.error("Gift card is not active"):i.Ay.error("Error retrieving gift card")}}else if(m){const t=m[1];try{n(null);const r=await le({code:t});n(r.data),e.setFieldValue("voucherId",t),i.Ay.success("Gift card found via QR scan!")}catch(u){var c,a;console.error("Error retrieving gift card:",u),n(null),404===(null===(c=u.response)||void 0===c?void 0:c.status)?i.Ay.error("Gift card not found"):400===(null===(a=u.response)||void 0===a?void 0:a.status)?i.Ay.error("Gift card is not active"):i.Ay.error("Error retrieving gift card")}}else{let r=t;if(p)r=p[0];else{const e=t.match(/([A-Z0-9]{4}-[A-Z0-9]{4})/);e&&(r=e[1]);let n=r.replace(/[^A-Za-z0-9]/g,"").toUpperCase();n.length>8&&(n=n.substring(0,8)),n.length>4&&(n=n.substring(0,4)+"-"+n.substring(4)),r=n}if(r.length<3)return void i.Ay.error("Invalid QR code format");e.setFieldValue("voucherId",r);try{n(null);const e=await le({code:r});n(e.data),i.Ay.success("Gift card found via QR scan!")}catch(u){var l,d;console.error("Error retrieving gift card:",u),n(null),404===(null===(l=u.response)||void 0===l?void 0:l.status)?i.Ay.error("Gift card not found"):400===(null===(d=u.response)||void 0===d?void 0:d.status)?i.Ay.error("Gift card
1is not active"):i.Ay.error("Error retrieving gift card")}}}catch(u){console.error("Error processing QR code:",u),ve(),i.Ay.error("Error processing QR code")}};(0,r.useEffect)(()=>{k&&R&&ee.current&&!ee.current.srcObject&&(console.log("Setting up video stream in effect..."),ee.current.srcObject=R,ee.current.setAttribute("playsinline",""),ee.current.setAttribute("webkit-playsinline",""),ee.current.setAttribute("x-webkit-airplay","deny"),ee.current.muted=!0,ee.current.defaultMuted=!0,ee.current.play().catch(e=>{console.error("Error playing video in effect:",e)}))},[k,R]),(0,r.useEffect)(()=>{!k&&R&&(R.getTracks().forEach(e=>e.stop()),M(null),ne.current&&(clearInterval(ne.current),ne.current=null),ee.current&&(ee.current.srcObject=null))},[k,R]),(0,r.useEffect)(()=>{const e=()=>{document.hidden&&k?(console.log("Page hidden, pausing camera..."),ee.current&&ee.current.pause()):!document.hidden&&k&&R&&ee.current&&(console.log("Page visible, resuming camera..."),ee.current.play().catch(e=>{console.error("Error resuming video:",e)}))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[k,R]),(0,r.useEffect)(()=>()=>{ve()},[]),(0,r.useEffect)(()=>{if(t&&T){var e,n;const r=null!==(e=null===T||void 0===T||null===(n=T.price)||void 0===n?void 0:n.final_amount_inc_tax)&&void 0!==e?e:0;r>0&&r<t.balance?(Y(r),$((r/100).toFixed(2))):(Y(null),$(""))}else Y(null),$("")},[t,T]);const we=()=>{var e,n;if(!t||!T)return;const r=null!==(e=null===T||void 0===T||null===(n=T.price)||void 0===n?void 0:n.final_amount_inc_tax)&&void 0!==e?e:0,o=parseFloat(X);if(isNaN(o))return void $(((null!==J&&void 0!==J?J:r)/100).toFixed(2));const s=Math.round(100*o),i=Math.max(r,Math.min(s,t.balance));Y(i),$((i/100).toFixed(2))},Ae=e=>{var n,r;if(!t||!T)return;const o=null!==(n=null===T||void 0===T||null===(r=T.price)||void 0===r?void 0:r.final_amount_inc_tax)&&void 0!==n?n:0,s=100*Math.ceil(o/100);let i;e<=(o+s)/2?i=o:(i=100*Math.round(e/100),i=Math.max(i,s)),i=Math.min(i,t.balance),Y(i),$((i/100).toFixed(2))};return D?(0,z.jsx)(c.A,{className:"vh-100 w-100 p-0",children:(0,z.jsxs)(a.A,{className:"d-flex flex-column align-items-center justify-content-center",span:24,children:[(0,z.jsx)("div",{className:"text-center mb-5",children:(0,z.jsx)(w.A,{width:150,height:50})}),(0,z.jsxs)("div",{className:"text-center",children:[(0,z.jsx)("div",{className:"spinner-border text-primary mb-3",role:"status",children:(0,z.jsx)("span",{className:"sr-only",children:"Loading..."})}),(0,z.jsx)(N,{children:"Validating Zelty POS..."})]})]})}):F?(0,z.jsxs)(c.A,{className:"vh-100 w-100 p-0",style:{overflowY:"auto"},children:[(0,z.jsxs)(a.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,z.jsx)("div",{className:"text-center mb-5",children:(0,z.jsx)(w.A,{disableClick:!0,width:150,height:50})}),(0,z.jsxs)(s.A,{form:e,onFinish:async e=>{try{n(null);const t=await le({code:e.voucherId});n(t.data),i.Ay.success("Gift card found!")}catch(o){var t,r;console.error("Error retrieving gift card:",o),n(null),404===(null===(t=o.response)||void 0===t?void 0:t.status)?i.Ay.error("Gift card not found"):400===(null===(r=o.response)||void 0===r?void 0:r.status)?i.Ay.error("Gift card is not active"):i.Ay.error("Error retrieving gift card")}},layout:"vertical",className:"w-100",style:{maxWidth:400},children:[(0,z.jsx)(s.A.Item,{name:"voucherId",rules:[{required:!0,message:"Please enter your voucher ID"}],children:(0,z.jsx)(C.A,{placeholder:"Enter voucher code",size:"large",style:{height:48}})}),(0,z.jsx)(s.A.Item,{className:"mb-3",children:(0,z.jsx)(E.Ay,{htmlType:"submit",size:"large",loading:de||he,className:"w-100",children:(0,z.jsxs)("div",{className:"d-flex align-items-center justify-content-center gap-2",children:[(0,z.jsx)(x.n,{className:"mr-2",icon:v.Search01Icon,size:18}),(0,z.jsx)("span",{children:"Search"})]})})}),(0,z.jsx)(s.A.Item,{className:"mb-0",children:(0,z.jsx)(E.Ay,{type:"secondary",onClick:async()=>{try{P(!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(M(n),await new Promise(e=>setTimeout(e,100)),ee.current&&n){ee.current.srcObject=n,ee.current.setAttribute("playsinline",""),ee.current.setAttribute("webkit-playsinline",""),ee.current.setAttribute("x-webkit-airplay","deny"),ee.current.muted=!0,ee.current.autoplay=!0,ee.current.defaultMuted=!0;try{await ee.current.play(),console.log("Video playing successfully")}catch(e){console.error("Error playing video:",e)}setTimeout(()=>{ee.current&&n&&je()},1e3)}}catch(t){console.error("Error accessing camera:",t),i.Ay.error("Unable to access camera. Please check permissions."),P(!1)}},size:"large",loading:de||he,className:"w-100",children:(0,z.jsxs)("div",{className:"d-flex align-items-center justify-content-center gap-2",children:[(0,z.jsx)(x.n,{className:"mr-2",icon:v.Camera01Icon,size:18}),(0,z.jsx)("span",{children:"Scan QR Code"})]})})})]}),k&&ie?(0,z.jsxs)("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"#000",zIndex:9999,display:"flex",flexDirection:"column"},children:[(0,z.jsxs)("div",{style:{padding:"16px",backgroundColor:"#fff",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,z.jsx)(N,{strong:!0,children:"Scan QR Code"}),(0,z.jsx)(E.Ay,{onClick:ve,icon:(0,z.jsx)(x.n,{icon:v.Cancel01Icon,size:16}),children:"Close"})]}),(0,z.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"16px"}
1,children:[(0,z.jsx)("video",{ref:ee,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,z.jsx)("canvas",{ref:te,style:{display:"none"}}),(0,z.jsx)("div",{style:{marginTop:16,textAlign:"center"},children:(0,z.jsx)(N,{style:{color:"#fff"},children:"Position the QR code within the camera view to scan automatically"})})]})]}):k?(0,z.jsx)(d.A,{title:"Scan QR Code",open:k,onCancel:ve,footer:[(0,z.jsx)(E.Ay,{onClick:ve,icon:(0,z.jsx)(x.n,{icon:v.Cancel01Icon,size:16}),children:"Close Camera"},"close")],width:600,centered:!0,style:{top:0},bodyStyle:{padding:"16px",maxHeight:"80vh",overflow:"hidden"},children:(0,z.jsxs)("div",{className:"text-center",children:[(0,z.jsx)("video",{ref:ee,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,z.jsx)("canvas",{ref:te,style:{display:"none"}}),(0,z.jsx)("div",{className:"mt-3",children:(0,z.jsx)(N,{type:"secondary",children:"Position the QR code within the camera view to scan automatically"})})]})}):null,t&&(0,z.jsxs)(l.A,{className:"w-100 mt-4",style:{maxWidth:400},title:"Gift Card Details",children:[(0,z.jsxs)("div",{className:"d-flex flex-column gap-2",children:[(0,z.jsxs)("div",{children:[(0,z.jsx)(N,{strong:!0,children:"Code: "}),(0,z.jsx)(N,{code:!0,children:t.code})]}),(0,z.jsxs)("div",{children:[(0,z.jsx)(N,{strong:!0,children:"Value: "}),(0,z.jsx)(N,{children:(0,p.E1)(t.value,t.region.currency_code)})]}),(0,z.jsxs)("div",{children:[(0,z.jsx)(N,{strong:!0,children:"Balance: "}),(0,z.jsx)(N,{children:(0,p.E1)(t.balance,t.region.currency_code)})]}),(0,z.jsxs)("div",{children:[(0,z.jsx)(N,{strong:!0,children:"Status: "}),(0,z.jsx)(N,{type:t.is_disabled?"danger":"success",children:t.is_disabled?"Disabled":"Active"})]}),t.ends_at&&(0,z.jsxs)("div",{children:[(0,z.jsx)(N,{strong:!0,children:"Expires: "}),(0,z.jsxs)(N,{type:pe?"danger":void 0,children:[new Date(t.ends_at).toLocaleDateString(),pe&&" (Expired)"]})]})]}),t.items&&t.items.length>0&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(u.A,{className:"my-3"}),(0,z.jsxs)("div",{className:"d-flex flex-column",style:{gap:12},children:[(0,z.jsx)(N,{strong:!0,children:"Items:"}),t.items.map(e=>(0,z.jsxs)(b.A,{alignItems:"center",gap:"sm",style:{marginBottom:8},children:[(0,z.jsx)(j.h,{src:e.thumbnail||"",alt:e.title,size:40}),(0,z.jsxs)(b.A,{flexDirection:"column",className:"w-100 cut-text-w-100",children:[(0,z.jsxs)("div",{className:"cut-text-w-100",children:[e.title," (x",e.quantity,")"]}),(0,z.jsx)("div",{className:"text-grey font-size-sm",children:(0,p.E1)(e.unit_price,t.region.currency_code)})]})]},e.id))]})]}),((e,n)=>{const r=null!==(e=null===T||void 0===T||null===(n=T.price)||void 0===n?void 0:n.final_amount_inc_tax)&&void 0!==e?e:0,o=r>0&&r<t.balance,s=(null!==J&&void 0!==J?J:r)-r;return o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(u.A,{className:"my-3"}),(0,z.jsxs)("div",{className:"d-flex flex-column gap-2",children:[(0,z.jsx)(N,{strong:!0,children:"Add a tip?"}),(0,z.jsx)(N,{type:"secondary",style:{fontSize:12},children:"Your gift card balance exceeds the order total. You can add a tip if you'd like."}),(0,z.jsxs)("div",{className:"mt-2",children:[(0,z.jsx)(h.A,{min:r,max:t.balance,value:null!==J&&void 0!==J?J:r,onChange:Ae,tooltip:{formatter:()=>(0,p.E1)(null!==J&&void 0!==J?J:r,t.region.currency_code)}}),(0,z.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,z.jsxs)(N,{type:"secondary",style:{fontSize:12},children:["Order:"," ",(0,p.E1)(r,t.region.currency_code)]}),(0,z.jsxs)(N,{type:"secondary",style:{fontSize:12},children:["Max:"," ",(0,p.E1)(t.balance,t.region.currency_code)]})]}),(0,z.jsxs)("div",{className:"text-center mt-3",children:[(0,z.jsx)(N,{strong:!0,style:{fontSize:16},children:"Total to pay:"}),(0,z.jsxs)("div",{className:"d-flex align-items-center justify-content-center gap-2 mt-2",children:[(0,z.jsx)(C.A,{type:"text",inputMode:"decimal",value:X,onChange:e=>(e=>{const t=e.replace(/[^0-9.]/g,""),n=t.split("."),r=n.length>2?n[0]+"."+n.slice(1).join(""):t;$(r)})(e.target.value),onBlur:we,onKeyDown:e=>{"Enter"===e.key&&(we(),e.target.blur())},style:{width:100,textAlign:"center",fontSize:18,fontWeight:600}}),(0,z.jsx)(N,{className:"ml-2",style:{fontSize:16}
1,children:t.region.currency_code.toUpperCase()})]}),s>0&&(0,z.jsx)("div",{className:"mt-2",children:(0,z.jsxs)(N,{type:"success",style:{fontSize:14},children:["(includes"," ",(0,p.E1)(s,t.region.currency_code)," ","tip)"]})})]})]})]})]}):null})(),!t.is_disabled&&t.balance>0&&(0,z.jsx)("div",{className:"mt-3",children:(0,z.jsx)(E.Ay,{size:"large",className:"w-100",loading:o,onClick:()=>{t&&(pe?I(!0):xe())},style:{backgroundColor:"#52c41a",borderColor:"#52c41a"},children:"Use for payment"})})]}),(0,z.jsx)(d.A,{title:"Gift Card Expired",open:_,onOk:xe,onCancel:()=>I(!1),okText:"Yes, use it anyway",centered:!0,cancelText:"Cancel",confirmLoading:o,children:(0,z.jsxs)("p",{children:["This gift card expired on"," ",(0,z.jsx)("strong",{children:(null===t||void 0===t?void 0:t.ends_at)&&new Date(t.ends_at).toLocaleDateString()}),". Are you sure you want to use it for payment?"]})})]}),(0,z.jsx)("div",{style:{position:"fixed",bottom:16,left:16,zIndex:1e3},children:(0,z.jsx)(E.Ay,{type:"secondary",size:"small",onClick:()=>U(!B),children:B?"Hide Console":"Console"})}),B&&(0,z.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,z.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,z.jsxs)(N,{style:{color:"#fff",fontSize:12},strong:!0,children:["Console (",V.length," logs)"]}),(0,z.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,z.jsx)(E.Ay,{type:"secondary",size:"small",onClick:()=>W([]),style:{color:"#d4d4d4",fontSize:11},children:"Clear"}),(0,z.jsx)(E.Ay,{type:"secondary",size:"small",onClick:()=>U(!1),style:{color:"#d4d4d4",fontSize:11},children:"\u2715"})]})]}),(0,z.jsxs)("div",{style:{flex:1,overflowY:"auto",padding:"8px 12px",fontSize:12,fontFamily:"monospace"},children:[0===V.length?(0,z.jsx)("div",{style:{color:"#666",fontStyle:"italic"},children:"No logs yet..."}):V.map((e,t)=>(0,z.jsxs)("div",{style:{marginBottom:8,paddingBottom:8,borderBottom:"1px solid #333"},children:[(0,z.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-start"},children:[(0,z.jsx)("span",{style:{color:"#666",fontSize:10},children:e.time}),(0,z.jsxs)("span",{style:{color:"error"===e.type?"#f48771":"warn"===e.type?"#cca700":"#4ec9b0",fontSize:10,fontWeight:600},children:["[",e.type.toUpperCase(),"]"]})]}),(0,z.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,z.jsx)("div",{ref:re})]})]})]}):(0,z.jsx)(c.A,{className:"vh-100 w-100 p-0",children:(0,z.jsxs)(a.A,{className:"d-flex flex-column align-items-center justify-content-center",span:24,children:[(0,z.jsx)("div",{className:"text-center mb-5",children:(0,z.jsx)(w.A,{width:150,height:50})}),(0,z.jsxs)(l.A,{className:"text-center",style:{maxWidth:400},children:[(0,z.jsx)(O,{level:4,type:"danger",children:"Access Denied"}),(0,z.jsx)(N,{children:"This page can only be accessed from a Zelty POS system."})]})]})})}},59806:(e,t,n)=>{n.d(t,{h:()=>m});var r=n(89379),o=n(80045),s=n(57528),i=n(63935),c=n(2826),a=n(70579);const l=["size","withBorder","overlay","radius","badge"];var d,u;const h=c.Ay.img(d||(d=(0,s.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},i.Ug),f=c.Ay.div(u||(u=(0,s.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"])),i.f),m=e=>{const{size:t=60,withBorder:n,overlay:s,radius:i,badge:c}=e,d=(0,o.A)(e,l);return(0,a.jsxs)("div",{className:"position-relative",children:[s&&(0,a.jsx)("div",{className:"position-absolute top-0 left-0 w-100 h-100",style:{zIndex:2},children:s}),c&&(0,a.jsx)("div",{className:"position-absolute top-0 right-0",style:{zIndex:3},children:(0,a.jsx)(f,{children:(0,a.jsx)("div",{className:"text-xs-medium text-white",children:c})})}),(0,a.jsx)(h,(0,r.A)((0,r.A)({style:{filter:s?"brightness(0.6)":"none",objectFit:"cover"}},d),{},{size:t,withBorder:n,radius:i}
1))]})}},65425:(e,t,n)=>{n.d(t,{Jy:()=>l,OJ:()=>a,QT:()=>c,RY:()=>d});var r=n(59781),o=n(12836),s=n(96444),i=n(68262);const c=()=>{const e=(0,r.jE)();return(0,o.n)({mutationKey:["get-gift-card-by-code"],mutationFn:async e=>(0,s.default)("/store/lightspeed/redeem/".concat(e.code),{method:"GET"}),onSuccess:async()=>{e.invalidateQueries({queryKey:["get-gift-card-by-code"]})}})},a=()=>{const e=(0,r.jE)();return(0,o.n)({mutationKey:["get-gift-card-by-order-id"],mutationFn:async e=>(0,s.default)("/store/lightspeed/redeem-with-order/".concat(e.id),{method:"GET"}),onSuccess:async()=>{e.invalidateQueries({queryKey:["get-gift-card-by-order-id"]})}})},l=()=>{const e=(0,r.jE)();return(0,o.n)({mutationKey:["connect-lightspeed"],mutationFn:async()=>(0,s.default)("/admin/store-integrations/lightspeed/connect",{method:"POST"}),onSuccess:async()=>{e.invalidateQueries(i.fdI.all)}})},d=()=>{const e=(0,r.jE)();return(0,o.n)({mutationKey:["create-lightspeed-redemption"],mutationFn:async e=>(0,s.default)("/store/lightspeed/voucher-redemptions",{method:"POST",data:e}),onSuccess:()=>{e.invalidateQueries({queryKey:["get-gift-card-by-code"]}),e.invalidateQueries({queryKey:["get-gift-card-by-order-id"]})}})}},74647:(e,t,n)=>{n.d(t,{A:()=>f});var r=n(65043),o=n(98139),s=n.n(o),i=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 h(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<i.ye.length;n++){const r=i.ye[n];if(!t||!t[r])continue;const s=e[r];if(void 0!==s)return void o(s)}})()},[JSON.stringify(e),t]),n}const f=r.forwardRef((e,t)=>{const{prefixCls:n,justify:o,align:f,className:m,style:y,children:g,gutter:p=0,wrap:x}=e,v=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=h(f,w),S=h(o,w),E=j("row",n),[C,z,N]=(0,d.L3)(E),O=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<i.ye.length;r++){const s=i.ye[r];if(o[s]&&void 0!==e[s]){n[t]=e[s];break}}else n[t]=e}),n}(p,w),_=s()(E,{["".concat(E,"-no-wrap")]:!1===x,["".concat(E,"-").concat(S)]:S,["".concat(E,"-").concat(A)]:A,["".concat(E,"-rtl")]:"rtl"===b},m,z,N),I={},k=null!=O[0]&&O[0]>0?O[0]/-2:void 0;k&&(I.marginLeft=k,I.marginRight=k);const[P,R]=O;I.rowGap=R;const M=r.useMemo(()=>({gutter:[P,R],wrap:x}),[P,R,x]);return C(r.createElement(l.A.Provider,{value:M},r.createElement("div",Object.assign({},v,{className:_,style:Object.assign(Object.assign({},I),y),ref:t}),g)))})},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)({})},99598:(e,t,n)=>{n.d(t,{A:()=>c});var r=n(65043),o=n(52664),s=n(44210),i=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,s.A)(),a=(0,i.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.