PageSourceSearch

https://customerappbeta.web.app/static/js/9578.a8f76dc7.chunk.js

js customerappbeta.web.app collected 2026-10-03 12:21:21 UTC 74,881 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkmagilhub=self.webpackChunkmagilhub||[]).push([[9578],{83353(e,l,i){i.d(l,{h:()=>d});var o,n=i(65043);const t=["title","titleId"];function a(){return a=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var i=arguments[l];for(var o in i)({}).hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},a.apply(null,arguments)}function r(e,l){let i=e.title,r=e.titleId,d=function(e,l){if(null==e)return{};var i,o,n=function(e,l){if(null==e)return{};var i={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==l.indexOf(o))continue;i[o]=e[o]}return i}(e,l);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(o=0;o<t.length;o++)i=t[o],-1===l.indexOf(i)&&{}.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}(e,t);return n.createElement("svg",a({width:14,height:16,viewBox:"0 0 14 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:l,"aria-labelledby":r},d),i?n.createElement("title",{id:r},i):null,o||(o=n.createElement("path",{d:"M5.07704 -0.0101318C5.11116 -0.0106555 5.14528 -0.0111792 5.18044 -0.0117188C5.36751 0.00916652 5.48765 0.100252 5.62197 0.226196C5.649 0.251212 5.67603 0.276228 5.70387 0.302002C5.74261 0.337955 5.74261 0.337955 5.78212 0.374634C5.82298 0.410626 5.86398 0.446448 5.90517 0.482056C6.03624 0.596177 6.16434 0.713467 6.29274 0.830566C6.38151 0.910996 6.47124 0.990113 6.56215 1.06812C6.61096 1.1114 6.65841 1.15622 6.70522 1.20166C6.73253 1.2278 6.75984 1.25395 6.78798 1.28088C6.81292 1.30538 6.83785 1.32987 6.86354 1.3551C6.93346 1.4117 6.93346 1.4117 7.01161 1.41101C7.13868 1.35533 7.22507 1.2641 7.32314 1.1676C7.3651 1.12733 7.4071 1.08709 7.44911 1.04688C7.46901 1.02768 7.48891 1.00848 7.50942 0.988693C7.58885 0.91279 7.67146 0.840985 7.75466 0.769287C7.8258 0.707607 7.89576 0.644697 7.96572 0.581665C7.9919 0.558099 8.01808 0.534534 8.04506 0.510254C8.09978 0.460743 8.1543 0.411013 8.20864 0.361084C8.47777 0.11498 8.64767 -0.0142316 9.02358 -0.00842285C9.30112 0.0134359 9.46782 0.199248 9.66091 0.382935C9.73195 0.450413 9.80366 0.515749 9.87782 0.579712C9.97751 0.666134 10.0753 0.75447 10.1727 0.843384C10.293 0.953008 10.4137 1.06194 10.537 1.16809C10.5768 1.20279 10.6158 1.23834 10.6542 1.27454C10.6732 1.2921 10.6922 1.30966 10.7118 1.32776C10.7284 1.34355 10.745 1.35934 10.7621 1.37561C10.8124 1.41201 10.8124 1.41201 10.8756 1.40063C10.9462 1.37137 10.9879 1.33878 11.0438 1.28674C11.1611 1.18018 11.2805 1.07682 11.4013 0.974243C11.5695 0.830912 11.7334 0.683976 11.8945 0.532715C12.0905 0.364777 12.2541 0.331477 12.5066 0.334839C12.7232 0.355864 12.8583 0.465262 12.9938 0.628418C13.0904 0.77639 13.1037 0.912263 13.1027 1.08544C13.1028 1.10971 13.1029 1.13398 13.103 1.15898C13.1033 1.24061 13.1031 1.32222 13.103 1.40385C13.1031 1.46284 13.1032 1.52183 13.1034 1.58083C13.1038 1.74318 13.1038 1.90553 13.1037 2.06788C13.1037 2.24288 13.104 2.41787 13.1043 2.59287C13.1049 2.93582 13.105 3.27877 13.1051 3.62171C13.1051 3.90042 13.1052 4.17912 13.1054 4.45783C13.1059 5.11909 13.1063 5.78035 13.1062 6.44162C13.1062 6.47334 13.1062 6.47334 13.1062 6.50571C13.1062 6.61291 13.1062 6.72011 13.1062 6.82732C13.1062 6.84861 13.1062 6.8699 13.1062 6.89183C13.1062 6.93489 13.1062 6.97794 13.1062 7.021C13.1062 7.69088 13.1066 8.36076 13.1075 9.03065C13.1084 9.78316 13.109 10.5357 13.1089 11.2882C13.1089 11.6867 13.1091 12.0851 13.1097 12.4836C13.1103 12.8229 13.1105 13.1621 13.11 13.5014C13.1098 13.6745 13.1098 13.8476 13.1104 14.0208C13.1109 14.1792 13.1108 14.3377 13.1102 14.4962C13.1101 14.5535 13.1102 14.6109 13.1106 14.6682C13.111 14.7462 13.1107 14.8241 13.1102 14.902C13.1106 14.9354 13.1106 14.9354 13.1111 14.9695C13.1084 15.164 13.0412 15.323 12.9151 15.4691C12.8976 15.4831 12.8802 15.497 12.8622 15.5114C12.8448 15.5258 12.8275 15.5402 12.8096 15.5551C12.6147 15.6823 12.4053 15.6865 12.1814 15.6421C11.9395 15.5557 11.761 15.3466 11.5807 15.1715C11.4846 15.0789 11.3835 14.9925 11.2821 14.9059C11.2508 14.878 11.2195 14.8501 11.1881 14.8223C11.1544 14.7928 11.1206 14.7634 11.0868 14.734C11.063 14.7125 11.063 14.7125 11.0387 14.6906C10.9527 14.6154 10.9527 14.6154 10.8446 14.5902C10.7515 14.6415 10.6784 14.7116 10.6024 14.7848C10.5688 14.8164 10.5352 14.848 10.5016 14.8795C10.4772 14.9025 10.4772 14.9025 10.4524 14.926C10.3955 14.9793 10.3371 15.0307 10.2782 15.0817C10.1862 15.1615 10.0953 15.2423 10.0048 15.3239C9.97851 15.3475 9.95225 15.3711 9.92519 15.3955C9.87132 15.4442 9.8176 15.4931 9.76406 15.5422C9.25341 16.0082 9.25341 16.0082 8.9247 16.0094C8.89058 16.0099 8.85646 16.0104 8.82131 16.011C8.63424 15.9901 8.51409 15.899 8.37978 15.7731C8.35275 15.7481 8.32572 15.723 8.29787 15.6973C8.27205 15.6733 8.24623 15.6493 8.21962 15.6246C8.17877 15.5886 8.13776 15.5528 8.09657 15.5172C7.96551 15.4031 7.8374 15.2858 7.709 15.1687C7.62023 15.0883 7.5305 15.0092 7.43959 14.9312C7.39079 14.8879 7.34333 14.843 7.29653 14.7976C7.26921 14.7715 7.2419 14.7453 7.21376 14.7184C7.18883 14.6939 7.16389 14.6694 7.1382 14.6442C7.06828 14.5876 7.06828 14.5876 6.99013 14.5883C6.86307 14.6439 6.77668 14.7352 6.67861 14.8317C6.6366 14.872 6.59457 14.9123 6.55251 14.9525C6.5326 14.9717 6.5127 14.9909 6.49219 15.0107C6.43147 15.0687 6.36921 15.1245 6.30556 15.1793C6.20765 15.2636 6.11193 15.35 6.0165 15.4371C5.38279 16.0139 5.38279 16.0139 4.97817 16.0077C4.70063 15.9858 4.53392 15.8 4.34084 15.6163C4.26979 15.5489 4.19808 15.4835 4.12392 15.4196C4.02423 15.3331 3.92647 15.2448 3.829 15.1559C3.70874 15.0463 3.58808 14.9373 3.46474 14.8312C3.42498 14.7965 3.38595 14.7609 3.34755 14.7247C3.32854 14.7072 3.30952 14.6896 3.28993 14.6715C3.26504 14.6478 3.26504 14.6478 3.23964 14.6237C3.18929 14.5873 3.18929 14.5873 3.12612 14.5986C3.05551 14.6279 3.01386 14.6605 2.9579 14.7125C2.84064 14.8191 2.72122 14.9225 2.60048 15.025C2.46103 15.1436 2.32552 15.2648 2.19228 15.3903C1.9666 15.5946 1.80781 15.6798 1.4977 15.6677C1.27906 15.6391 1.1463 15.5374 1.00795 15.3708C0.911354 15.2229 0.898093 15.087 0.899082 14.9138C0.898973 14.8896 0.898863 14.8653 0.89875 14.8403C0.898458 14.7587 0.898613 14.677 0.898765 14.5954C0.898648 14.5364 0.898504 14.4774 0.898335 14.4184C0.897952 14.2561 0.897961 14.0937 0.898035 13.9314C0.898048 13.7564 0.897703 13.5814 0.897407 13.4064C0.896887 13.0634 0.896716 12.7205 0.896681 12.3776C0.896651 12.0989 0.896523 11.8201 0.896325 11.5414C0.895864 10.8802 0.895479 
110.2189 0.895512 9.55765C0.895513 9.5365 0.895514 9.51535 0.895515 9.49356C0.89552 9.38635 0.895526 9.27915 0.895533 9.17195C0.895534 9.15066 0.895535 9.12937 0.895536 9.10744C0.895539 9.06438 0.895541 9.02133 0.895544 8.97827C0.895582 8.30839 0.895113 7.6385 0.894258 6.96862C0.893299 6.21611 0.892762 5.4636 0.892819 4.71109C0.89284 4.31261 0.892667 3.91413 0.891995 3.51566C0.891427 3.17641 0.89129 2.83716 0.891715 2.49791C0.891919 2.32477 0.891921 2.15165 0.89138 1.97852C0.89089 1.82005 0.890976 1.66158 0.891522 1.50311C0.891619 1.44577 0.891504 1.38842 0.891156 1.33107C0.890715 1.25311 0.891046 1.17519 0.891566 1.09723C0.891256 1.07497 0.890945 1.05271 0.890625 1.02978C0.893371 0.835219 0.960577 0.676292 1.08669 0.530151C1.10413 0.516213 1.12157 0.502275 1.13954 0.487915C1.16559 0.466283 1.16559 0.466283 1.19216 0.444214C1.38709 0.316959 1.59649 0.312724 1.82033 0.357178C2.06223 0.443539 2.24074 0.652642 2.42102 0.827789C2.5171 0.920394 2.61823 1.00672 2.71962 1.09338C2.75096 1.12125 2.78229 1.14912 2.81362 1.177C2.84737 1.20644 2.88114 1.23586 2.91493 1.26526C2.93081 1.27959 2.94669 1.29392 2.96305 1.30868C3.04904 1.38387 3.04904 1.38387 3.15712 1.40906C3.25026 1.35776 3.3233 1.28769 3.39931 1.21448C3.4329 1.18288 3.46651 1.15131 3.50014 1.11975C3.51638 1.1044 3.53263 1.08906 3.54936 1.07324C3.60626 1.01999 3.6646 0.968593 3.72353 0.917603C3.81551 0.837779 3.90647 0.756922 3.99697 0.675415C4.02323 0.651769 4.04949 0.628123 4.07656 0.60376C4.13043 0.555029 4.18414 0.506118 4.23769 0.457031C4.74833 -0.00897032 4.74833 -0.00897031 5.07704 -0.0101318ZM3.16103 5.60315C3.11602 5.71067 3.12186 5.76415 3.15712 5.87463C3.23335 5.97189 3.28753 6.00877 3.40712 6.03088C3.45957 6.03373 3.51212 6.03496 3.56465 6.03506C3.6123 6.03526 3.6123 6.03526 3.6609 6.03547C3.69556 6.03545 3.73023 6.03544 3.76594 6.03542C3.80259 6.03553 3.83924 6.03563 3.87699 6.03574C3.97739 6.03599 4.07779 6.03609 4.17819 6.03611C4.24095 6.03613 4.3037 6.0362 4.36646 6.03628C4.58547 6.03657 4.80448 6.0367 5.02349 6.03667C5.22753 6.03666 5.43155 6.03699 5.63559 6.03748C5.81088 6.03789 5.98618 6.03806 6.16147 6.03804C6.26612 6.03803 6.37076 6.03812 6.4754 6.03845C6.59211 6.03875 6.7088 6.03866 6.82551 6.03848C6.87741 6.03874 6.87741 6.03874 6.93036 6.03901C6.96221 6.03888 6.99406 6.03874 7.02687 6.03861C7.05445 6.03863 7.08203 6.03864 7.11044 6.03866C7.21993 6.02773 7.30847 5.99291 7.39931 5.93127C7.46041 5.84267 7.46405 5.76184 7.46962 5.65588C7.44568 5.5601 7.41569 5.53667 7.33379 5.48135C7.17105 5.41832 7.02105 5.42407 6.84797 5.425C6.8107 5.42484 6.77344 5.42467 6.73504 5.42451C6.63322 5.42416 6.53141 5.42424 6.42959 5.42454C6.32285 5.42478 6.21612 5.42456 6.10938 5.42441C5.93019 5.42424 5.75102 5.42446 5.57183 5.42491C5.36485 5.42542 5.15788 5.42526 4.95089 5.42474C4.77294 5.42431 4.59499 5.42425 4.41704 5.4245C4.31086 5.42465 4.20469 5.42467 4.09851 5.42436C3.98016 5.42412 3.86183 5.42448 3.74348 5.425C3.70839 5.42481 3.67331 5.42462 3.63716 5.42443C3.58873 5.42482 3.58873 5.42482 3.53932 5.42523C3.51137 5.42526 3.48341 5.4253 3.4546 5.42534C3.32466 5.44481 3.24278 5.50232 3.16103 5.60315ZM3.15712 7.87463C3.11899 7.98902 3.11485 8.03789 3.16493 8.14807C3.22425 8.22433 3.2731 8.27544 3.37212 8.28883C3.39441 8.28889 3.41669 8.28895 3.43965 8.28901C3.46543 8.28923 3.49121 8.28945 3.51777 8.28968C3.56025 8.28957 3.56025 8.28957 3.60358 8.28945C3.63366 8.28961 3.66375 8.28978 3.69475 8.28995C3.79601 8.29042 3.89727 8.29044 3.99854 8.29046C4.07096 8.2907 4.14338 8.29096 4.2158 8.29125C4.41285 8.29193 4.6099 8.29221 4.80696 8.29237C4.92998 8.29248 5.053 8.29268 5.17602 8.2929C5.51659 8.29351 5.85715 8.29402 6.19772 8.29411C6.21951 8.29412 6.24131 8.29412 6.26377 8.29413C6.30796 8.29414 6.35214 8.29415 6.39633 8.29416C6.41827 8.29417 6.4402 8.29418 6.4628 8.29418C6.49574 8.29419 6.49574 8.29419 6.52935 8.2942C6.88531 8.29431 7.24125 8.29515 7.59721 8.29632C7.96259 8.29751 8.32798 8.2981 8.69337 8.29813C8.89855 8.29815 9.10372 8.29843 9.3089 8.29931C9.50184 8.30013 9.69476 8.3002 9.8877 8.2997C9.95859 8.29964 10.0295 8.29986 10.1004 8.30035C10.197 8.30099 10.2936 8.30066 10.3902 8.30009C10.4184 8.30051 10.4466 8.30092 10.4756 8.30134C10.6138 8.29948 10.6706 8.29463 10.7832 8.20742C10.8546 8.11123 10.8759 8.05681 10.8759 7.93713C10.8257 7.82685 10.7902 7.78627 10.6884 7.71838C10.6283 7.70896 10.6283 7.70896 10.5621 7.71026C10.5363 7.71004 10.5105 7.70982 10.484 7.70959C10.4415 7.7097 10.4415 7.7097 10.3982 7.70982C10.3681 7.70965 10.338 7.70949 10.307 7.70932C10.2057 7.70885 10.1045 7.70883 10.0032 7.70881C9.93079 7.70857 9.85837 7.70831 9.78595 7.70802C9.58889 7.70733 9.39184 7.70706 9.19478 7.7069C9.07176 7.70679 8.94874 7.70659 8.82572 7.70637C8.48515 7.70576 8.14459 7.70525 7.80403 7.70515C7.78223 7.70515 7.76043 7.70514 7.73798 7.70514C7.69379 7.70513 7.6496 7.70511 7.60541 7.7051C7.58348 7.7051 7.56154 7.70509 7.53894 7.70
1509C7.506 7.70508 7.506 7.70508 7.47239 7.70507C7.11644 7.70496 6.76049 7.70411 6.40454 7.70295C6.03915 7.70176 5.67377 7.70116 5.30838 7.70114C5.1032 7.70112 4.89803 7.70084 4.69285 7.69995C4.49991 7.69914 4.30698 7.69906 4.11404 7.69957C4.04315 7.69962 3.97227 7.69941 3.90138 7.69892C3.80474 7.69828 3.70815 7.69861 3.61151 7.69917C3.58334 7.69876 3.55516 7.69835 3.52613 7.69792C3.34997 7.7003 3.26774 7.72559 3.15712 7.87463ZM3.19618 10.0699C3.13843 10.1508 3.12982 10.2134 3.12587 10.3121C3.1812 10.4443 3.2473 10.5024 3.37587 10.5621C3.47356 10.5757 3.57034 10.5748 3.66885 10.574C3.69848 10.5742 3.72811 10.5743 3.75863 10.5745C3.85798 10.5749 3.95731 10.5746 4.05666 10.5743C4.12786 10.5744 4.19905 10.5746 4.27025 10.5748C4.46369 10.5752 4.65712 10.575 4.85055 10.5747C5.05284 10.5745 5.25513 10.5747 5.45742 10.5749C5.81892 10.575 6.18042 10.5747 6.54192 10.5743C6.86966 10.5739 7.19739 10.5739 7.52513 10.5744C7.90577 10.5749 8.2864 10.575 8.66704 10.5748C8.86851 10.5746 9.06998 10.5746 9.27146 10.5749C9.46086 10.5752 9.65025 10.575 9.83965 10.5745C9.90922 10.5743 9.9788 10.5744 10.0484 10.5746C10.1432 10.5748 10.2381 10.5745 10.3329 10.574C10.3744 10.5744 10.3744 10.5744 10.4167 10.5747C10.5644 10.5733 10.6621 10.5642 10.7821 10.4684C10.8555 10.3779 10.8763 10.3336 10.8739 10.2164C10.8402 10.1109 10.8068 10.0669 10.7196 9.99963C10.6341 9.9725 10.5568 9.96445 10.4674 9.96436C10.4422 9.96426 10.417 9.96416 10.3911 9.96406C10.3499 9.96413 10.3499 9.96413 10.3078 9.9642C10.2638 9.9641 10.2638 9.9641 10.2188 9.96399C10.1203 9.96379 10.0217 9.96382 9.92312 9.96384C9.85254 9.96375 9.78197 9.96364 9.71139 9.96353C9.5195 9.96325 9.32761 9.96318 9.13573 9.96316C8.97567 9.96313 8.8156 9.96301 8.65554 9.9629C8.29958 9.96266 7.94362 9.96257 7.58766 9.96259C7.56631 9.96259 7.54495 9.96259 7.52294 9.96259C7.49087 9.96259 7.49087 9.96259 7.45815 9.9626C7.11149 9.96261 6.76484 9.96231 6.41818 9.96187C6.06226 9.96142 5.70634 9.96121 5.35041 9.96123C5.15058 9.96124 4.95075 9.96115 4.75092 9.96082C4.56303 9.96052 4.37515 9.96052 4.18727 9.96074C4.11825 9.96078 4.04922 9.9607 3.9802 9.96051C3.88611 9.96027 3.79203 9.96042 3.69794 9.96066C3.67051 9.9605 3.64308 9.96034 3.61483 9.96017C3.45415 9.96108 3.33076 9.97382 3.19618 10.0699Z",fill:"currentColor"})))}const d=n.forwardRef(r);i.p},21219(e,l,i){i.r(l),i.d(l,{default:()=>K});var o=i(89379),n=i(5544),t=i(65043),a=i(36322),r=i(83003),d=i(47077),s=i(49367);var c=i(51003),u=i(82227),v=i(61697),m=i(98187),p=i(48888),h=i(4310),y=i(95577),C=i(62501),N=i(81799),x=i(87791),f=i(41918),g=i(57156),b=i(85310),j=i(40761),w=(i(55097),i(52843)),S=i(95566),k=i(90722),A=i(5484),T=i(2599),I=i(5062),P=i(19977),_=i(95193),F=i(70579);const O={visa:T.A,mastercard:I.A,"m/c":I.A,amex:P.A,discover:_.A},D=e=>{let l=e.onSubmit,i=e.loading,a=e.currency,r=e.total,d=e.recaptchaSiteKey;const s=(0,t.useState)(""),c=(0,n.A)(s,2),u=c[0],v=c[1],m=(0,t.useState)(""),p=(0,n.A)(m,2),h=p[0],y=p[1],C=(0,t.useState)(""),N=(0,n.A)(C,2),x=N[0],f=N[1],g=(0,t.useState)(""),b=(0,n.A)(g,2),j=b[0],w=b[1],S=(0,t.useState)(""),T=(0,n.A)(S,2),I=T[0],P=T[1],_=(0,t.useState)(""),D=(0,n.A)(_,2),E=D[0],R=D[1],M=(0,t.useState)({}),L=(0,n.A)(M,2),U=L[0],q=L[1];return(0,F.jsxs)("form",{className:"paylink-card-form",onSubmit:e=>{if(e.preventDefault(),!(()=>{const e={},l=u.replace(/\s/g,"");(l.length<13||l.length>16)&&(e.cardNumber="Enter a valid card number");const i=h.split("/");if(2!==i.length||!/^\d{2}$/.test(i[0])||!/^\d{2}$/.test(i[1])||Number(i[0])<1||Number(i[0])>12)e.expiry="Enter valid MM/YY";else{const l=Number(i[0]),o=Number(i[1]),n=new Date,t=n.getFullYear()%100,a=n.getMonth()+1;(o<t||o===t&&l<a)&&(e.expiry="Card has expired.")}return x.length<3&&(e.cvv="Enter CVV"),j.length<5&&(e.zip="Enter ZIP code"),I.trim()||(e.streetCode="Enter Street Number"),d&&!E&&(e.recaptcha="Please complete reCAPTCHA"),q(e),0===Object.keys(e).length})())return;const i=h.split("/");l({cardNumber:u.replace(/\s/g,""),expiryMonth:i[0],expiryYear:i[1],cvv:x,zip:j,streetCode:I.trim().slice(0,6),recaptchaToken:E})},children:[(0,F.jsxs)("div",{className:"form-field",children:[(0,F.jsx)("label",{children:"Card Number"}),(0,F.jsxs)("div",{className:"card-number-input-wrapper",children:[(0,F.jsx)("input",{type:"text",inputMode:"numeric",placeholder:"1234 5678 9012 3456",value:u,onChange:e=>{v(e.target.value.replace(/\D/g,"").slice(0,16).replace(/(.{4})/g,"$1 ").trim())},autoComplete:"cc-number"}),O[(0,A.Fs)(u)]&&(0,F.jsx)("img",{src:O[(0,A.Fs)(u)],alt:"card type",className:"card-type-icon"})]}),U.cardNumber&&(0,F.jsx)("span",{className:"field-error",children:U.cardNumber})]}),(0,F.jsxs)("div",{className:"form-row",children:[(0,F.jsxs)("div",{className:"form-field",children:[(0,F.jsx)("label",{children:"Expiry"}),(0,F.jsx)("input",{type:"text",inputMode:"numeric",placeholder:"MM/YY",value:h,onChange:e=>{y((e=>{const l=e.replace(/\D/g,"").slice(0,4);return l.length>=3?l.slice(0,2)+"/"+l.slice(2):l})(e.target.value))},autoComplete:"cc-exp"}),U.expiry&&(0,F.jsx)("span",{className:"field-error",children:U.expiry})]}),(0,F.jsxs)("div",{className:"form-field",children:[(0,F.jsx)("label",{children:"CVV"}),(0,F.jsx)("input",{type:"password",inputMode:"numeric",placeholder:"***",value:x,onChange:e=>{f(e.target.value.replace(/\D/g,"").slice(0,4))},autoComplete:"cc-csc"}),U.cvv&&(0,F.jsx)("span",{className:"field-error",children:U.cvv})]}),(0,F.jsxs)("div",{className:"form-field",children:[(0,F.jsx)("label",{children:"Street Number"}),(0,F.jsx)("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",placeholder:"1234",value:I,onChange:e=>{P(e.target.value.replace(/\D/g,"").slice(0,6))},autoComplete:"address-line1"}),U.streetCode&&(0,F.jsx)("span",{className:"field-error",children:U.streetCode})]}),(0,F.jsxs)("div",{className:"form-field",children:[(0,F.jsx)("label",{children:"ZIP"}),(0,F.jsx)("input",{type:"text",inputMode:"numeric",placeholder:"08540",value:j,onChange:e=>{w(e.target.value.replace(/\D/g,"").slice(0,5))},autoComplete:"postal-code"}),U.zip&&(0,F.jsx)("span",{className:"field-error",children:U.zip})]})]}),d&&(0,F.jsxs)("div",{className:"form-field",children:[(0,F.jsx)(k.A,{sitekey:d,onChange:e=>{R(e||""),e&&q(e=>(0,o.A)((0,o.A)({},e),{},{recaptcha:""}))},onExpired:()=>R("")}),U.recaptcha&&(0,F.jsx)("span",{className:"field-error",children:U.recaptcha})]}),(0,F.jsx)("button",{type:"submit",className:"paylink-pay-btn card-submit-btn",disabled:i,children:i?"Processing...":"Pay ".concat(a," ").concat(Number(r).toFixed(2))})]})};const E=i.p+"static/media/PaymentSuccessIcon.4ecc7bd7eeb6c47e9839380c35fe4875.svg";var R=i(83353),M=i(65144),L=i(64070),U=i(93633),q=i(70289);const B=e=>{var l,i,d,s,c,u,v,m,p,h,y,x,g,b,j,w,S,k,A,T,I,P,_,O,D,B,G;let V=e.logoUrl,Y=e.restaurantName,z=e.orderId,K=e.amountPaid,Z=e.currencySymbol,J=e.paymentMethodLabel,$=e.onViewReceipt,Q=e.tableId,W=e.orderNo,H=e.orderData,X=e.merchantType,ee=e.merchantSlug,le=e.restaurantDetails,ie=e.loyaltyOrderData;const oe=String((null===H||void 0===H?void 0:H.localOrderTime)||(null===H||void 0===H||null===(l=H.order)||void 0===l?void 0:l.localOrderTime)||"").trim(),ne=oe?oe.split("-")[0].trim():"\u2014",te=null===H||void 0===H?void 0:H.orderType,ae=String((null===H||void 0===H?void 0:H.orderTypeId)||(null===H||void 0===H||null===(i=H.orderType)||void 0===i?void 0:i.id)||("string"===typeof te?te:"")||""),re=null===le||void 0===le||null===(d=le.orderTypes)||void 0===d?void 0:d.find(e=>String(null===e||void 0===e?void 0:e.id)===ae),de=String((null===H||void 0===H||null===(s=H.orderType)||void 0===s?void 0:s.typeGroup)||(null===H||void 0===H?void 0:H.orderTypeGroup)||("string"===typeof te&&/^[dps]$/i.test(te)?te:"")||(null===re||void 0===re?void 0:re.typeGroup)||"").toUpperCase(),se=String((null===H||void 0===H||null===(c=H.orderType)||void 0===c?void 0:c.typeName)||(null===H||void 0===H?void 0:H.orderTypeName)||(null===re||void 0===re?void 0:re.typeName)||("string"===typeof te?te:"")||""),ce="D"===de||/dine[\s_-]*in/i.test(se)?"Thank You for Dining with us":"Order has been placed and paid.",ue=(null===ie||void 0===ie?void 0:ie.loyaltyReceiptData)||(null===ie||void 0===ie?void 0:ie.loyalty_receipt_data)||(null===ie||void 0===ie?void 0:ie.loyaltyReceipt)||(null===ie||void 0===ie||null===(u=ie.loyalty)||void 0===u?void 0:u.receiptData)||(null===ie||void 0===ie?void 0:ie.loyalty)||(null===ie||void 0===ie||null===(v=ie.order)||void 0===v?void 0:v.loyaltyReceiptData)||(null===ie||void 0===ie||null===(m=ie.order)||void 0===m?void 0:m.loyalty),ve=(null===ue||void 0===ue?void 0:ue.program)||(null===ie||void 0===ie?void 0:ie.loyaltyProgram)||(null===ie||void 0===ie||null===(p=ie.order)||void 0===p?void 0:p.loyaltyProgram),me=(null===ie||void 0===ie?void 0:ie.loyaltyPointsPreview)||(null===ie||void 0===ie||null===(h=ie.order)||void 0===h?void 0:h.loyaltyPointsPreview),pe=null!==(y=null!==(x=null!==(g=null!==(b=null!==(j=null===ue||void 0===ue?void 0:ue.points_earned)&&void 0!==j?j:null===ie||void 0===ie?void 0:ie.points_earned)&&void 0!==b?b:null===ie||void 0===ie?void 0:ie.loyaltyPointsEarned)&&void 0!==g?g:null===ie||void 0===ie||null===(w=ie.accrualResponse)||void 0===w?void 0:w.total_points_earned)&&void 0!==x?x:null===ie||void 0===ie||null===(S=ie.order)||void 0===S||null===(k=S.accrualResponse)||void 0===k?void 0:k.total_points_earned)&&void 0!==y?y:null===me||void 0===me?void 0:me.total_points,he="object"===typeof pe?null===pe||void 0===pe?void 0:pe.total_points:pe,ye=null!==(A=null!==(T=null!==(I=null!==(P=null!==(_=null===ue||void 0===ue?void 0:ue.balance_after)&&void 0!==_?_:null===ie||void 0===ie?void 0:ie.balance_after)&&void 0!==P?P:null===ie||void 0===ie?void 0:ie.loyaltyBalance)&&void 0!==I?I:null===ie||void 0===ie||null===(O=ie.accrualResponse)||void 0===O?void 0:O.new_balance)&&void 0!==T?T:null===ie||void 0===ie||null===(D=ie.order)||void 0===D||null===(B=D.accrualResponse)||void 0===B?void 0:B.new_balance)&&void 0!==A?A:null===me||void 0===me?void 0:me.projected_balance,Ce=(null===ve||void 0===ve?void 0:ve.points_name)||(null===ie||void 0===ie?void 0:ie.pointsName)||"Points",Ne=!(!0===(null===ve||void 0===ve?void 0:ve.is_paused))&&(null!=he||null!=ye),xe=((0,C.Ri)(N.ir),(0,a.Zp)()),fe=(()=>{try{const e=localStorage.getItem("restaurant");return e?JSON.parse(e):{}}catch(e){return{}}})(),ge=X||(null===fe||void 0===fe?void 0:fe.merchantType)||"restaurant",be=ee||(null===H||void 0===H||null===(G=H.restaurantInfo)||void 0===G?void 0:G.locationSlug)||(null===H||void 0===H?void 0:H.merchantSlug)||(null===H||void 0===H?void 0:H.restaurantSlug)||(null===H||void 0===H?void 0:H.locationSlug)||(null===fe||void 0===fe?void 0:fe.location)||"",je=(0,t.useState)(!1),we=(0,n.A)(je,2),Se=we[0],ke=we[1],Ae=(0,r.wA)(),Te=(0,r.d4)(e=>{var l;return null===e||void 0===e||null===(l=e.navigation)||void 0===l?void 0:l.showSignupPopup}),Ie=be;return(0,t.useEffect)(()=>
1{if(!Ie)return;const e="/".concat(ge,"/").concat(Ie,"/menu/Pickup");window.history.pushState(null,"",window.location.href);const l=l=>{l.stopImmediatePropagation(),xe(e,{replace:!0})};return window.addEventListener("popstate",l,!0),()=>{window.removeEventListener("popstate",l,!0)}},[Ie,xe,ge]),(0,t.useEffect)(()=>{if(!H||!be)return;let e={};try{const l=(e=>{try{return localStorage.getItem(e)}catch(l){return null}})("restaurant");e=l?JSON.parse(l):{}}catch(l){e={}}((e,l)=>{try{localStorage.setItem(e,l)}catch(i){}})("restaurant",JSON.stringify((0,o.A)((0,o.A)({},e),{},{merchantType:ge,location:be,menuType:"Pickup"})))},[H,be,ge]),(0,F.jsxs)("div",{className:"paylink-success-page",children:[(0,F.jsx)("div",{className:"success-header",children:(0,F.jsxs)("div",{className:"success-header-restaurant",children:[V&&(0,F.jsx)("img",{src:V,alt:Y||"",className:"success-restaurant-logo"}),Y&&(0,F.jsx)("span",{className:"success-restaurant-name",children:Y})]})}),(0,F.jsx)("img",{src:E,alt:""}),(0,F.jsx)("h2",{className:"success-title",children:"Payment Successful"}),(0,F.jsx)("p",{className:"success-subtitle",children:ce}),(0,F.jsxs)("div",{className:"success-details-card",children:[(0,F.jsxs)("div",{className:"success-details-row",children:[(0,F.jsxs)("div",{className:"success-detail",children:[(0,F.jsx)("span",{className:"detail-label",children:"Order ID"}),(0,F.jsxs)("span",{className:"detail-value",children:["#",W]})]}),(0,F.jsxs)("div",{className:"success-detail detail-right",children:[(0,F.jsx)("span",{className:"detail-label",children:"Amount Paid"}),(0,F.jsxs)("span",{className:"detail-value",children:[Z,K.toFixed(2)]})]})]}),(0,F.jsx)("hr",{className:"success-details-divider"}),(0,F.jsxs)("div",{className:"success-details-row",children:[(0,F.jsxs)("div",{className:"success-detail",children:[(0,F.jsx)("span",{className:"detail-label",children:"Payment Method"}),(0,F.jsx)("span",{className:"detail-value payment-method-value",children:J||"\u2014"})]}),(0,F.jsxs)("div",{className:"success-detail detail-right",children:[(0,F.jsx)("span",{className:"detail-label",children:"Date"}),(0,F.jsx)("span",{className:"detail-value",children:ne})]})]})]}),Ne&&(0,F.jsxs)("div",{className:"paylink-loyalty-earned-banner",children:[(0,F.jsxs)("div",{className:"paylink-loyalty-earned-banner__copy",children:[null!=he&&(0,F.jsxs)("p",{className:"paylink-loyalty-earned-banner__title",children:["You have earned"," ",(0,F.jsxs)("span",{className:"paylink-loyalty-earned-banner__title-pts",children:[he," ",Ce]})," ","on this order"]}),null!=ye&&(0,F.jsxs)("p",{className:"paylink-loyalty-earned-banner__balance",children:["New Balance:"," ",(0,F.jsx)("span",{className:"paylink-loyalty-earned-banner__balance-num",children:ye})," ",Ce]})]}),(0,F.jsx)("img",{src:U.A,alt:"coins",className:"paylink-loyalty-earned-banner__coin"})]}),(0,F.jsxs)("div",{className:"paylink-success-actions",children:[!Q&&(0,F.jsx)("div",{className:"receipt-bottom-container-tracking-url",children:(0,F.jsx)("button",{type:"button",className:"paylink-track-order-button",onClick:()=>{z&&be&&((0,q.CC)(),xe("/".concat(ge,"/").concat(be,"/tracker/").concat(z),{state:{fromPayLink:!0}}))},disabled:!z||!be,children:"Track your order"})}),(0,F.jsx)("div",{className:"receipt-bottom-container",children:(0,F.jsxs)("button",{type:"button",className:"orderTracking-view-receipt-button-mobile-new",onClick:$,children:[(0,F.jsx)(R.h,{}),(0,F.jsx)("span",{children:"View Receipt"})]})})]}),Se&&!Te&&(0,F.jsx)(M.A,{isOpen:Se,onClose:()=>{ke(!1),Ae((0,L.$Q)(!1)),Ae((0,f.oR)(!1))}})]})},G=e=>{var l,i,a,s,c,u,v,h,k;let A=e.orderData,T=e.restaurantDetails,I=e.currency,P=e.total,_=e.subTotal,O=e.tax,E=e.existingTip,R=void 0===E?0:E,M=e.normalizedItems,L=e.shortUrlKey,U=e.orderTypeId,q=e.existingOrderId,G=void 0===q?"":q,V=e.logoUrl,Y=e.restaurantName,z=e.onViewReceipt,K=e.onPaymentSuccess,Z=e.onValidateBeforePayment,J=e.onRefreshExistingOrderAfterTip,$=e.onClose,Q=e.tableId;e.tableName;const W=(0,r.wA)(),H=(0,t.useState)("tip"),X=(0,n.A)(H,2),ee=X[0],le=X[1],ie=(0,t.useState)(""),oe=(0,n.A)(ie,2),ne=oe[0],te=oe[1],ae=(0,t.useState)(G),re=(0,n.A)(ae,2),de=re[0],se=re[1],ce=(0,t.useState)(()=>{var e;return String((null===A||void 0===A?void 0:A.orderNo)||(null===A||void 0===A||null===(e=A.order)||void 0===e?void 0:e.orderNo)||"")}),ue=(0,n.A)(ce,2),ve=ue[0],me=ue[1],pe=(0,t.useState)(P),he=(0,n.A)(pe,2),ye=he[0],Ce=he[1],Ne=(0,t.useState)(!1),xe=(0,n.A)(Ne,2),fe=xe[0],ge=xe[1],be=(0,t.useState)(!1),je=(0,n.A)(be,2),we=(je[0],je[1],(0,t.useState)(!1)),Se=(0,n.A)(we,2),ke=(Se[0],Se[1],(0,t.useState)(null)),Ae=(0,n.A)(ke,2),Te=Ae[0],Ie=Ae[1],Pe=(0,t.useState)(""),_e=(0,n.A)(Pe,2),Fe=_e[0],Oe=_e[1],De=(0,t.useState)(!1),Ee=(0,n.A)(De,2),Re=Ee[0],Me=Ee[1],Le=(0,t.useState)(!1),Ue=(0,n.A)(Le,2),qe=Ue[0],Be=Ue[1],Ge=(0,t.useState)(""),Ve=(0,n.A)(Ge,2),Ye=Ve[0],ze=Ve[1],Ke=(0,t.useState)(null),Ze=(0,n.A)(Ke,2),Je=Ze[0],$e=Ze[1],Qe=(0,t.useState)(0),We=(0,n.A)(Qe,2),He=We[0],Xe=We[1],el=(0,t.useState)(null),ll=(0,n.A)(el,2),il=ll[0],ol=ll[1],nl=(0,t.useState)(null),tl=(0,n.A)(nl,2),al=tl[0],rl=tl[1],dl=(0,t.useRef)(G),sl=(0,t.useRef)(String((null===A||void 0===A?void 0:A.orderNo)||(null===A||void 0===A||null===(l=A.order)||void 0===l?void 0:l.orderNo)||"")),cl=(0,t.useRef)(P),ul=(0,t.useRef)(null),vl=(0,t.useRef)(!1),ml=(0,t.useRef)(!1),pl=(0,t.useRef)(!1),hl=(0,t.useRef)(!1),yl=(0,t.useRef)(!1);(0,t.useEffect)(()=>{cl.current=ye},[ye]);const Cl=(null===T||void 0===T?void 0:T.country)||(null===A||void 0===A?void 0:A.country)||"US",Nl="IN"===Cl,xl=Nl?b.IA.INR:b.IA.USD,fl=(null===A||void 0===A?void 0:A.tableId)||(null===A||void 0===A||null===(i=A.table)||void 0===i?void 0:i.id)||(null===A||void 0===A||null===(a=A.tableInfo)||void 0===a?void 0:a.id)||(null===A||void 0===A?void 0:A.tableRefId)||null,gl=null===T||void 0===T||null===(s=T.orderTypes)||void 0===s?void 0:s.find(e=>{var l;return String(null===e||void 0===e?void 0:e.id)===String((null===A||void 0===A?void 0:A.orderTypeId)||(null===A||void 0===A||null===(l=A.orderType)||void 0===l?void 0:l.id)||"")}),bl=String((null===A||void 0===A?void 0:A.orderTypeGroup)||(null===A||void 0===A||null===(c=A.orderType)||void 0===c?void 0:c.typeGroup)||(null===gl||void 0===gl?void 0:gl.typeGroup)||"").toUpperCase(),jl=!G||"D"===bl,wl=(null===A||void 0===A?void 0:A.customerId)||"",Sl=!0,kl=(e=>{const l=null===T||void 0===T||null===(e=T.paymentProvider)||void 0===e?void 0:e.classData;if("string"!==typeof l)return l||{};try{return JSON.parse(l)}catch(i){return{}}}
1)(),Al=(null===kl||void 0===kl?void 0:kl.onClickCheckoutAPIKey)||"",Tl=(null===kl||void 0===kl?void 0:kl.oneClickCheckoutMerchantId)||"",Il=(null===T||void 0===T?void 0:T.branchName)||"Maghil",Pl=((e=>{const l=null===(e=window)||void 0===e?void 0:e.ApplePaySession;if(!l||"function"!==typeof(null===l||void 0===l?void 0:l.canMakePayments))return!1;try{return Boolean(l.canMakePayments())}catch(i){return!1}})(),Boolean(Al&&Tl),"US"===Cl&&Boolean(null===T||void 0===T?void 0:T.oneClickCheckout)),_l=Nl?"\u20b9":"$",Fl=(e=>{const l=null===T||void 0===T||null===(e=T.uiFeatureFlags)||void 0===e?void 0:e.tipPercentageConfig,i=Array.isArray(l)?l:"string"===typeof l?l.split(","):[],o=[...new Set(i.map(e=>Number(e)).filter(e=>Number.isFinite(e)&&e>0))];return o.length>0?o.map(e=>({percentage:e,amount:0})):N.SO})(),Ol=qe?0:Re&&Fe?parseFloat(Fe)||0:null!==Te?Nl?Te:Number((_*Te/100).toFixed(2)):0,Dl=Re||Nl?"FLATFEE":"PERCENT",El=Re||Nl?Ol:Te||0,Rl=Math.max(0,Number(R)||0),Ml=Number(Math.max(0,P-Rl).toFixed(2)),Ll=Number(null!==(u=null!==(v=null!==(h=null!==(k=null===T||void 0===T?void 0:T.defaultPickUpETA)&&void 0!==k?k:null===T||void 0===T?void 0:T.defaultPickupETA)&&void 0!==h?h:null===A||void 0===A?void 0:A.defaultPickUpETA)&&void 0!==v?v:null===A||void 0===A?void 0:A.defaultPickupETA)&&void 0!==u?u:0),Ul=e=>{if(null===e||void 0===e)return"";const l=String(e).trim();return l&&"null"!==l.toLowerCase()&&"undefined"!==l.toLowerCase()?l:""},ql=e=>{const l=Ul(e);if(!l)return{date:"",time:""};const i=l.includes("T")?l:l.replace(" ","T"),o=new Date(i);if(Number.isNaN(o.getTime()))return{date:"",time:""};const n=o.toISOString();return{date:(0,w.sq)(n),time:(0,w.Dm)(n)}};(0,t.useEffect)(()=>()=>{W((0,g.l0)())},[W]);const Bl=(e,l)=>{const i={callSid:(null===A||void 0===A?void 0:A.callSid)||"",shortUrlKey:L,paymentStatus:"success",magilhubOrderId:e,orderNo:sl.current,amountPaid:l,paidAt:(new Date).toISOString()};console.log("[PayLink] calling /api/payment/callback with:",i),d.A.post("".concat("https://magil-backend-681142215919.us-east1.run.app","/api/payment/callback"),i).then(e=>{console.log("[PayLink] /api/payment/callback response:",e.status,e.data)}).catch(e=>{console.warn("[PayLink] /api/payment/callback failed:",e)})},Gl=async e=>{if(e)try{var l,i;const o=await(0,m.f1)({orderId:e});if(200!==(null===o||void 0===o?void 0:o.status))return;const n=null!==(l=o.data)&&void 0!==l&&l.encryptedText?(0,p.Gk)(o.data.encryptedText):(null===(i=o.data)||void 0===i?void 0:i.data)||o.data;n&&"object"===typeof n&&rl(n)}catch(o){}},Vl=()=>{Me(!0),Ie(null),Be(!1)},Yl=()=>{Be(!0),Ie(null),Me(!1),Oe("")},zl=(e,l,i)=>{var n,t,a,r;const d=(()=>{const e=Number.isFinite(Ll)?Ll:0,l=(0,y.z)(new Date,e).toISOString();return{date:(0,w.sq)(l),time:(0,w.Dm)(l)}})(),s=[ql(null===A||void 0===A?void 0:A.timeIn),ql(null===A||void 0===A?void 0:A.orderDate),ql(null===A||void 0===A?void 0:A.createdOn),ql(null===A||void 0===A?void 0:A.createdAt)].find(e=>e.date||e.time)||{date:"",time:""},c=Ul(null===A||void 0===A?void 0:A.etaDate)||Ul(null===A||void 0===A?void 0:A.pickUpDate)||s.date||d.date,u=Ul(null===A||void 0===A?void 0:A.etaTime)||Ul(null===A||void 0===A?void 0:A.pickUpTime)||s.time||d.time,v=Ul(null===A||void 0===A?void 0:A.deliveryDate)||c,m=Ul(null===A||void 0===A?void 0:A.deliveryTime)||u,p=(0,C.Ri)(N.lB)||{},h=wl,x=Ul((null===A||void 0===A?void 0:A.customerName)||(null===A||void 0===A?void 0:A.fullName)||(null===A||void 0===A?void 0:A.name)||""),f=Ul((null===A||void 0===A?void 0:A.customerNo)||(null===A||void 0===A?void 0:A.callerPhone)||(null===A||void 0===A?void 0:A.phone)||(null===A||void 0===A?void 0:A.mobileNumber)||""),g=Ul((null===A||void 0===A?void 0:A.comment)||""),b=Ul((null===A||void 0===A?void 0:A.orderSource)||"P"),S=!0===(null===A||void 0===A?void 0:A.isScheduleOrder)||"true"===String(null===A||void 0===A?void 0:A.isScheduleOrder).toLowerCase(),k=parseFloat((null===e||void 0===e||null===(n=e.orderTotals)||void 0===n||null===(t=n.find(e=>"5"===e.code||"5.0"===e.code))||void 0===t?void 0:t.value)||""),I=[{code:"1",title:"Subtotal",value:String(_),sortOrder:"1"},{code:"2",title:"Tax",value:String(O),sortOrder:"2"},{code:"3",title:"Tip",value:String(l),sortOrder:"3"},{code:"5",title:"Total",value:String(i||P),sortOrder:"99"}],F=Number.isFinite(k)&&k>0?e.orderTotals:I,D=(null===(a=F.find(e=>"5"===e.code||"5.0"===e.code))||void 0===a?void 0:a.value)||String(P);return(0,o.A)((0,o.A)({locationId:(null===T||void 0===T?void 0:T.id)||(null===A||void 0===A?void 0:A.locationId),customerId:h,deviceId:"",staffId:Ul((null===A||void 0===A?void 0:A.staffId)||""),fullName:x||"".concat((null===p||void 0===p?void 0:p.firstName)||""," ").concat((null===p||void 0===p?void 0:p.lastName)||"").trim(),email:Ul((null===A||void 0===A?void 0:A.email)||(null===p||void 0===p?void 0:p.email)||""),phone:f||(null===p||void 0===p?void 0:p.mobilePhone)||"",totalItems:String(M.length),comment:g,offerId:"",couponCode:"",orderTypeId:(null===A||void 0===A?void 0:A.orderTypeId)||U||"",orderTotal:D,isScheduleOrder:S,items:M,totals:F,etaDate:c,etaTime:u,pickUpDate:c,pickUpTime:u,deliveryDate:v,deliveryTime:m,locationDetail
1s:j.z,addressLine1:"",addressLine2:"",addressLine3:"",deliveryDistance:0,tableId:fl,callWaiter:"",orderSource:b,guestCount:Math.max(Number((null===A||void 0===A?void 0:A.guestCount)||1),1),isReceiveTransMsg:1,sortOrder:0,isUtcConversionRequired:!0,isCustomerOrder:!1,isVoiceOrder:!0===(null===A||void 0===A?void 0:A.isVoiceOrder),isQSROrder:Boolean(null===A||void 0===A?void 0:A.isQSROrder),isTaxRemoved:Number(null!==(r=null===A||void 0===A?void 0:A.isTaxRemoved)&&void 0!==r?r:0)},G?{}:{shortUrlRedisKey:L}),!G&&null!==A&&void 0!==A&&A.callSid?{callSid:A.callSid}:{})},Kl=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return G?(dl.current=G,se(G),Promise.resolve(G)):dl.current?Promise.resolve(dl.current):ul.current?vl.current?Promise.reject(new Error("Order is being created. Please wait.")):(e||le("placing_order"),vl.current=!0,new Promise((e,l)=>{W((0,f.wH)((0,o.A)((0,o.A)({},ul.current),{},{sagaCallBack:(i,o)=>{if(vl.current=!1,i&&null!==o&&void 0!==o&&o.orderId){var n;dl.current=o.orderId,se(o.orderId),ol(o
1);const l=(null===o||void 0===o?void 0:o.orderNo)||(null===o||void 0===o||null===(n=o.order)||void 0===n?void 0:n.orderNo);if(l){const e=String(l);sl.current=e,me(e)}e(o.orderId)}else{const e=(null===o||void 0===o?void 0:o.message)||"Failed to create order. Please try again.";l(new Error(e))}}}),{},{},"DINE_IN"))})):Promise.reject(new Error("Unable to prepare order details. Please try again."))},Zl=async(e,l,i)=>{le("computing_totals"),te("");const o=null!==e&&void 0!==e?e:Ol,n=null!==l&&void 0!==l?l:El,t=null!==i&&void 0!==i?i:Dl;try{if(G&&(o>0||Number(R)>0)){const e=await(async(e,l)=>{if(!G||!J)throw new Error("Unable to update the tip for this order.");const i=await S.Ay.put("/api/v2/orders/dine-in/tip",{data:(0,p.ui)({orderId:G,staffId:"",toAdd:!0,tipType:e,tipAmount:l,splitId:""})});var o;if((null===i||void 0===i?void 0:i.status)<200||(null===i||void 0===i?void 0:i.status)>=300)throw new Error((null===i||void 0===i||null===(o=i.data)||void 0===o?void 0:o.message)||"Unable to add the tip.");return J()})(t,Number(n)),l=Number(e.toFixed(2));return Ce(l),cl.current=l,void le("select_payment")}const e={discount:0,discountType:"FLATFEE",orderItems:M,orderTypeId:(null===A||void 0===A?void 0:A.orderTypeId)||U||"",locationId:(null===T||void 0===T?void 0:T.id)||(null===A||void 0===A?void 0:A.locationId),tip:n,tipType:t,deliveryFee:0,customerId:wl,offerCaptureRequests:null===A||void 0===A?void 0:A.offerCaptureRequests,redeemPayload:null===A||void 0===A?void 0:A.redeemPayload};let l=null,i=P+o;if(!G){var a;try{l=await(0,x._5)(e,W)}catch(r){console.warn("Totals API failed, proceeding with fallback:",r)}if(null!==(a=l)&&void 0!==a&&a.orderTotals){const e=l.orderTotals.find(e=>"5"===e.code||"5.0"===e.code);if(e){const l=parseFloat(e.value);Number.isFinite(l)&&l>0&&(i=l)}}}i=Number(i.toFixed(2)),Ce(i),cl.current=i,ul.current=zl(l,o,i),le("select_payment")}catch(d){console.error("Checkout flow error:",d),le("error"),te((null===d||void 0===d?void 0:d.message)||"Something went wrong. Please try again.")}},Jl=()=>{Zl(Ol,El,Dl)},$l=()=>{Be(!0),Ie(null),Me(!1),Oe(""),Zl(0,0,"FLATFEE")},Ql=()=>{ml.current=!1,pl.current=!1,le("tip")},Wl=async e=>{ge(!0),te("");try{var l;if(Z){if(!await Z())return void ge(!1)}const i=await Kl(),o=cl.current||P,n=(0,C.Ri)(N.lB)||{},t=(null===A||void 0===A?void 0:A.customerNo)||(null===A||void 0===A?void 0:A.callerPhone)||(null===A||void 0===A?void 0:A.phone)||"";le("processing_payment");const a={customerId:wl,locationId:(null===T||void 0===T?void 0:T.id)||(null===A||void 0===A?void 0:A.locationId),orderId:i,shortUrl:L,tableId:fl||void 0,totalPaymentAmount:String(o),paymentCurrency:xl,accountNumber:e.cardNumber.replace(/\s/g,""),tenderType:b.Aj.CNP,postalCode:e.zip,streetCode:(null===(l=e.streetCode)||void 0===l?void 0:l.length)>6?e.streetCode.slice(0,6):e.streetCode,cvv:e.cvv,expiryMonth:e.expiryMonth,expiryYear:e.expiryYear,needToUpdateOrderStatus:jl,paymentProviderId:"DATACAP_AGGREGATOR",forceV2TransactionApi:Sl,channel:"online",recaptchaToken:e.recaptchaToken||"",email:(null===n||void 0===n?void 0:n.email)||(null===A||void 0===A?void 0:A.email)||"",mobileNumber:t||(null===n||void 0===n?void 0:n.mobilePhone)||"",sagaCallBack:async e=>{ge(!1),e?(ze("Card"),$e(new Date),Xe(o),await Gl(i),le("success"),Bl(i,o),null===K||void 0===K||K()):(le("error"),te("Payment failed. Please try again."))}};W((0,g.ND)(a))}catch(i){ge(!1),le("error"),te((null===i||void 0===i?void 0:i.message)||"Failed to create order. Please try again.")}},Hl=e=>new Promise((l,i)=>{if(document.querySelector('script[src="'.concat(e,'"]')))return void l();const o=document.createElement("script");o.src=e,o.async=!0,o.onload=()=>l(),o.onerror=()=>i(),document.body.appendChild(o)});(0,t.useEffect)(()=>{"select_payment"===ee&&Pl&&Xl()},[ee,Pl]);const Xl=async()=>{if(!hl.current&&Pl)try{await Hl("https://wallet.dcap.com/v1/client/applepay");const e=window.DatacapApplePay;if(!e)return void console.error("DatacapApplePay not found on window");if(!Al||!Tl)return void console.error("Apple Pay merchant config missing for location");const l=e=>{const l=String((null===e||void 0===e?void 0:e.message)||(null===e||void 0===e?void 0:e.Error)||e||"").toLowerCase();return l.includes("cancel")||l.includes("aborted")||l.includes("abort")||l.includes("dism
1iss")||l.includes("closed")},i=async e=>{if(null!==e&&void 0!==e&&e.Error)return l(e)?(le("select_payment"),te(""),Promise.reject(e.Error)):(yl.current&&(le("error"),te("Apple Pay failed. Please try again.")),yl.current=!1,Promise.reject(e.Error));let i=dl.current;if(!i)try{i=await Kl()}catch(r){return le("error"),te((null===r||void 0===r?void 0:r.message)||"Failed to create order. Please try again."),Promise.reject(r)}le("processing_payment");const o=(0,C.Ri)(N.lB)||{},n={locationId:(null===T||void 0===T?void 0:T.id)||(null===A||void 0===A?void 0:A.locationId),orderId:i,shortUrl:L,tableId:fl||void 0,totalPaymentAmount:String(cl.current||P),paymentCurrency:xl,tenderType:"APPLE_PAY",needToUpdateOrderStatus:jl,paymentProviderId:"DATACAP_AGGREGATOR",channel:"online",paymentToken:null===e||void 0===e?void 0:e.Token,expiryMonth:null===e||void 0===e?void 0:e.ExpirationMonth,expiryYear:null===e||void 0===e?void 0:e.ExpirationYear,customerId:wl,email:(null===o||void 0===o?void 0:o.email)||"",mobileNumber:(null===A||void 0===A?void 0:A.customerNo)||(null===A||void 0===A?void 0:A.callerPhone)||(null===A||void 0===A?void 0:A.phone)||(null===o||void 0===o?void 0:o.mobilePhone)||""},t={data:(0,p.ui)(n)},a=(0,C.Ri)(N.Xh);return new Promise((e,o)=>{fetch("".concat("https://apis.magilhub.com/magilhub-data-services","/api/customers/payment/start-transaction/v2"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(a),"X-source":"CA"},body:JSON.stringify(t)}).then(e=>e.json()).then(async l=>{var n;const t=null!==l&&void 0!==l&&l.encryptedText?(0,p.Gk)(l.encryptedText):null===l||void 0===l?void 0:l.data,a=(null===t||void 0===t?void 0:t.responseMessage)||(null===t||void 0===t?void 0:t.message)||"Payment failed";if(!Boolean(null!==(n=null===t||void 0===t?void 0:t.isPaymentCompleted)&&void 0!==n?n:null===t||void 0===t?void 0:t.paymentCompleted))return W((0,g.OW)(a)),le("error"),te(a),void o(a);W((0,g.FC)()),ze("Apple Pay"),$e(new Date),Xe(cl.current||P),await Gl(i),le("success"),Bl(i,cl.current||P),null===K||void 0===K||K(),e("Approved")}).catch(e=>{if(l(e))return le("select_payment"),te(""),void o(e);W((0,g.OW)("Payment failed")),le("error"),te("Payment failed. Please try again."),o(e)})})};e.init(i,Al,Il,Tl,String(cl.current||P)),hl.current=!0}catch(e){console.error("Apple Pay init error:",e)}},ei=async()=>{if(Z){if(!await Z())return}$()};if("tip"===ee){const e=e=>Nl?e:_*e/100,l=qe||null!==Te||Re&&parseFloat(Fe)>0;return(0,F.jsx)("div",{className:"paylink-checkout",children:(0,F.jsxs)("div",{className:"paylink-tip-section",children:[(0,F.jsx)("h3",{className:"checkout-heading",children:Number(R)>0?"Change Tip":"Add a Tip"}),(0,F.jsx)("p",{className:"tip-subtitle",children:"Show your appreciation for the staff"}),(0,F.jsxs)("div",{className:"tip-order-total",children:["Order Total: ",_l,Ml.toFixed(2)]}),(0,F.jsxs)("div",{className:"tip-grid",children:[Fl.map(l=>(0,F.jsxs)("button",{className:"tip-button ".concat(Te!==l.percentage||Re||qe?"":"selected"),onClick:()=>{return e=l.percentage,Ie(e),Me(!1),Be(!1),void Oe("");var e},children:[(0,F.jsx)("span",{className:"tip-percent",children:Nl?"\u20b9".concat(l.percentage):"".concat(l.percentage,"%")}),!Nl&&(0,F.jsxs)("span",{className:"tip-amount",children:[_l,e(l.percentage).toFixed(2)]})]},l.percentage)),(0,F.jsx)("button",{className:"tip-button ".concat(qe?"selected no-tip":""),onClick:Yl,children:(0,F.jsx)("span",{className:"tip-percent",children:"No Tip"})}),(0,F.jsx)("button",{className:"tip-button ".concat(Re?"selected":""),onClick:Vl,children:(0,F.jsx)("span",{className:"tip-percent",children:"Custom"})})]}),Re&&(0,F.jsxs)("div",{className:"custom-tip-input",children:[(0,F.jsx)("span",{className:"currency-prefix",children:_l}),(0,F.jsx)("input",{type:"text",inputMode:"decimal",placeholder:"Enter tip amount",value:Fe,autoFocus:!0,onKeyDown:e=>{/[\d.]/.test(e.key)||["Backspace","Tab","ArrowLeft","ArrowRight","Delete"].includes(e.key)||e.preventDefault(),"."===e.key&&Fe.includes(".")&&e.preventDefault()},onChange:e=>{let l=e.target.value;if(!/^\d*\.?\d*$/.test(l))return;const i=l.split("."),o=(0,n.A)(i,2),t=o[0],a=o[1];t.length>4||a&&a.length>2||Oe(l)}})]}),Ol>0&&(0,F.jsxs)("div",{className:"tip-summary",children:[(0,F.jsx)("span",{children:"Tip"}),(0,F.jsxs)("span",{children:[_l,Ol.toFixed(2)]})]}),(0,F.jsx)("button",{className:"tip-continue-btn",onClick:Jl,disabled:!l,children:Ol>0?"Continue  \xb7  ".concat(_l).concat((Ml+Ol).toFixed(2)):qe?"Continue without Tip":"Select a Tip to Continue"}),(0,F.jsx)("button",{className:"checkout-skip-btn",onClick:$l,children:"Skip & Pay without Tip"})]})})}if("computing_totals"===ee)return(0,F.jsx)("div",{className:"paylink-checkout",children:(0,F.jsxs)("div",{className:"checkout-status",children:[(0,F.jsx)("div",{className:"checkout-spinner"}),(0,F.jsx)("p",{children:"Computing totals..."})]})});if("placing_order"===ee)return(0,F.jsx)("div",{className:"paylink-checkout",children:(0,F.jsxs)("div",{className:"checkout-status",children:[(0,F.jsx)("div",{className:"checkout-spinner"}),(0,F.jsx)("p",{children:"Creating your order..."})]})});if("select_payment"===ee)return(0,F.jsxs)("div",{className:"paylink-checkout",children:[(0,F.jsxs)("div",{className:"payment-heading-row",children:[(0,F.jsx)("h3",{className:"checkout-heading",children:"Payment"}),(0,F.jsx)("button",{type:"button",className:"change-tip-button",onClick:Ql,children:Ol>0?"Change Tip":"Add Tip"})]}),Ol>0&&(0,F.jsxs)("div",{className:"payment-total-summary",children:[(0,F.jsxs)("div",{className:"summary-row",children:[(0,F.jsx)("span",{children:"Order Total"}),(0,F.jsxs)("span",{children:[_l," ",(ye-Ol).toFixed(2)]})]}),(0,F.jsxs)("div",{className:"summary-row",children:[(0,F.jsx)("span",{children:"Tip"}),(0,F.jsxs)("span",{children:[_l," ",Ol.toFixed(2)]})]}),(0,F.jsxs)("div",{className:"summary-row total-row",children:[(0,F.jsx)("span",{children:"Total"}),(0,F.jsxs)("span",{children:[_l," ",ye.toFixed(2)]})]})]}),Pl&&(0,F.jsx)("div",{className:"payment-option",children:(0,F.jsx)("div",{id:"apple-pay-button",style:{width:"100%",minHeight:52}})}),(0,F.jsxs)("div",{className:"payment-option",children:[(0,F.jsx)("div",{className:"card-section-label",children:Pl?"Or pay with card":"Pay with card"}),(0,F.jsx)(D,{onSubmit:Wl,loading:fe,currency:I,total:ye||P,recaptchaSiteKey:"6Les8R4pAAAAAMZeDVR3xWC-vTk6lv9MGxhokMjj"})]}),(0,F.jsx)("button",{className:"checkout-back-btn",onClick:$,children:"\u2190 Back to Order"})]});if("processing_payment"===ee)return(0,F.jsx)("div",{className:"paylink-checkout",children:(0,F.jsxs)("div",{className:"checkout-status",children:[(0,F.jsx)("div",{className:"checkout-spinner"}),(0,F.jsx)("p",{children:"Processing payment..."})]})});if("success"===ee){var li;const e=ve||dl.current||de;return(0,F.jsx)(B,{logoUrl:V,restaurantName:Y,orderId:de,orderNo:e,amountPaid:He,currencySymbol:_l,paymentMethodLabel:Ye,paidAt:Je,onViewReceipt:()=>null===z||void 0===z?void 0:z(dl.current||de),tableId:Q,orderData:il||A,loyaltyOrderData:al,merchantType:(null===A||void 0===A?void 0:A.merchantType)||"restaurant",restaurantDetails:T,merchantSlug:(null===A||void 0===A||null===(li=A.restaurantInfo)||void 0===li?void 0:li.locationSlug)||(null===A||void 0===A?void 0:A.merchantSlug)||(null===A||void 0===A?void 0:A.restaurantSlug)||(null===A||void 0===A?void 0:A.locationSlug)||(null===T||void 0===T?void 0:T.locationSlug)||(null===T||void 0===T?void 0:T.merchantSlug)})}return"error"===ee?(0,F.jsx)("div",{className:"paylink-checkout",children:(0,F.jsxs)("div",{className:"checkout-result error",children:[(0,F.jsx)("div",{className:"result-icon error-icon",children:"\u2715"}),(0,F.jsx)("h3",{children:"Payment Failed"}),(0,F.jsx)("p",{children:ne||"Something went wrong."}),(0,F.jsx)("button",{className:"checkout-retry-btn",onClick:ei,children:"Try Again"}),(0,F.jsx)("button",{className:"checkout-back-btn",onClick:$,children:"\u2190 Back to Order"})]})}):null},V="https://kds-devbeta.magilhub.com",Y=e=>{var l,i,o;const n=null===e||void 0===e||null===(l=e.totals)||void 0===l?void 0:l.find(e=>["TOTAL","5","5.0"].includes(String(null===e||void 0===e?void 0:e.code))),t=null!==(i=null!==(o=null===n||void 0===n?void 0:n.value)&&void 0!==o?o:null===e||void 0===e?void 0:e.total)&&void 0!==i?i:null===e||void 0===e?void 0:e.orderTotal;if(void 0===t||null===t||""===t)return null;const a=Number(t);return Number.isFinite(a)?a:null},z=e=>{const l=null!==e&&void 0!==e&&e.encryptedText?(0,p.Gk)(e.encryptedText):(null===e||void 0===e?void 0:e.data)||e;if(!l||"object"!==typeof l||!l.orderId)throw new Error("Unable to load order receipt");const i=(0,p.A7)(String(l.orderId));if(!i)throw new Error("Unable to decrypt order ID");return{receipt:l,paymentOrderId:i}},K=()=>{var e,l,i,y,C,N,x,f,g,b,j,w,S,k,A,T,I,P,_,O,D,E,R,M;const L=(0,a.g)().shortUrlKey,U=(0,r.wA)(),q=(0,r.d4)(e=>{var l;return null===e||void 0===e||null===(l=e.navigation)||void 0===l?void 0:l.isMobile}),B=(0,t.useState)(null),K=(0,n.A)(B,2),Z=K[0],J=K[1],$=(0,t.useState)(!0),Q=(0,n.A)($,2),W=Q[0],H=Q[1],X=(0,t.useState)(null),ee=(0,n.A)(X,2),le=ee[0],ie=ee[1],oe=(0,t.useState)(!1),ne=(0,n.A)(oe,2),te=ne[0],ae=ne[1],re=(0,t.useState)(""),de=(0,n.A)(re,2),se=de[0],ce=de[1],ue=(0,t.useState)(!1),ve=(0,n.A)(ue,2),me=ve[0],pe=ve[1],he=(0,t.useState)(""),ye=(0,n.A)(he,2),Ce=ye[0],Ne=ye[1],xe=(0,r.d4)(e=>e.restaurant.currentRestaurantDetail),fe=t.useRef(!1);(0,t.useEffect)(()=>
1{if(!L)return ie("Invalid link"),void H(!1);if(fe.current)return;fe.current=!0;(async()=>{try{const e=await d.A.get("".concat(V,"/short-url/").concat(L),{params:{_t:Date.now()},headers:{"Cache-Control":"no-cache",Pragma:"no-cache"}});if(200===e.status&&e.data){const l=e.data,i=null===l||void 0===l?void 0:l.orderId,n=null===l||void 0===l?void 0:l.locationId;if(Boolean(i)){const e=await(0,m.f1)({orderId:String(i)});if(200!==(null===e||void 0===e?void 0:e.status))throw new Error("Unable to load order receipt");const l=z(e.data),t=l.receipt,a=l.paymentOrderId;J((0,o.A)((0,o.A)({},t),{},{orderId:a,locationId:n||t.locationId})),Ne(a)}else Ne(""),J(l)}else ie("Order not found")}catch(l){var e;404===(null===l||void 0===l||null===(e=l.response)||void 0===e?void 0:e.status)?ie("This pay link has expired or is invalid."):ie("Unable to load order details. Please try again.")}finally{H(!1)}})()},[L]);const ge=(0,t.useMemo)(()=>{var e,l;const i=(null===xe||void 0===xe||null===(e=xe.theme)||void 0===e?void 0:e.primaryColor)||(null===xe||void 0===xe||null===(l=xe.themeColor)||void 0===l?void 0:l.primaryColor);if(i&&String(i).trim())return String(i).trim();try{var o,n;const e=JSON.parse(localStorage.getItem("restaurant")||"{}"),l=(null===e||void 0===e||null===(o=e.theme)||void 0===o?void 0:o.primaryColor)||(null===e||void 0===e||null===(n=e.themeColor)||void 0===n?void 0:n.primaryColor);if(l&&String(l).trim())return String(l).trim()}catch(t){}return"#0073bb"},[xe]),be=(0,t.useMemo)(()=>({"--primary-color":ge}),[ge]);(0,t.useEffect)(()=>{null!==Z&&void 0!==Z&&Z.locationId&&U((0,v.JE)({locationId:Z.locationId,merchantType:"restaurant"}))},[null===Z||void 0===Z?void 0:Z.locationId,U]);const je=!(null===Z||void 0===Z||!Z.locationId||(null===xe||void 0===xe?void 0:xe.id)!==Z.locationId||!(null!==xe&&void 0!==xe&&xe.branchName||null!==xe&&void 0!==xe&&xe.theme||null!==xe&&void 0!==xe&&xe.themeColor)),we=!W&&!!Z&&(!(null!==Z&&void 0!==Z&&Z.locationId)||je),Se=(0,t.useCallback)(()=>{var e;if(null===xe||void 0===xe||null===(e=xe.media)||void 0===e||!e.length)return"";const l=xe.media.find(e=>"LOGO"===e.entityType);if(null===l||void 0===l||!l.mimeType)return"";const i=l.mimeType.split("/"),o=(0,n.A)(i,2)[1],t=void 0===o?"png":o;return"https://storage.googleapis.com/mhp-media/img/"+l.id+"."+t},[xe]),ke=(0,t.useMemo)(()=>"IN"===((null===xe||void 0===xe?void 0:xe.country)||(null===Z||void 0===Z?void 0:Z.country))?"\u20b9":"$",[Z,xe]),Ae=(null===xe||void 0===xe?void 0:xe.branchName)||(null===Z||void 0===Z?void 0:Z.locationName)||(null===Z||void 0===Z?void 0:Z.restaurantName)||"",Te=(0,t.useMemo)(()=>{const e=String((null===xe||void 0===xe?void 0:xe.branchName)||""),l=(null===xe||void 0===xe?void 0:xe.state)||"";if(e.includes(",")){var i;const o=null===(i=e.split(",")[1])||void 0===i?void 0:i.trim();if(o)return l?"".concat(o,", ").concat(l):o}return l?"".concat(e,", ").concat(l):e||Ae},[xe,Ae]),Ie=(null===xe||void 0===xe?void 0:xe.phoneNumber)||(null===Z||void 0===Z?void 0:Z.locationPhone)||(null===Z||void 0===Z?void 0:Z.phone)||"",Pe=(null===xe||void 0===xe?void 0:xe.address)||(null===Z||void 0===Z?void 0:Z.locationAddress)||(null===Z||void 0===Z?void 0:Z.address)||"";console.log({orderData:Z});const _e=(null===Z||void 0===Z?void 0:Z.orderNo)||(null===Z||void 0===Z?void 0:Z.orderId)||"",Fe=(null===Z||void 0===Z?void 0:Z.orderDate)||(null===Z||void 0===Z?void 0:Z.timeIn)||"",Oe=(0,t.useMemo)(()=>{if(!Fe)return"";const e=new Date(Fe);if(Number.isNaN(e.getTime()))return String(Fe);const l=new Intl.DateTimeFormat("en-US",{month:"2-digit",day:"2-digit",year:"numeric",timeZone:"UTC"}).formatToParts(e),i=e=>{var i;return(null===(i=l.find(l=>l.type===e))||void 0===i?void 0:i.value)||""};return"".concat(i("month"),"/").concat(i("day"),"/").concat(i("year"))},[Fe]),De=(null===Z||void 0===Z?void 0:Z.orderType)||"",Ee=(null===Z||void 0===Z?void 0:Z.tableNo)||(null===Z||void 0===Z?void 0:Z.tableName)||"",Re=(null===Z||void 0===Z?void 0:Z.items)||[],Me=(null===Z||void 0===Z?void 0:Z.voidedItems)||[],Le=(null===Z||void 0===Z?void 0:Z.refundItems)||[],Ue=null!==Z&&void 0!==Z&&Z.refundedAmount&&Number(Z.refundedAmount)>0?parseFloat(Z.refundedAmount).toFixed(2):"0.00",qe=Me.length>0&&!(null!==xe&&void 0!==xe&&null!==(e=xe.uiFeatureFlags)&&void 0!==e&&e.disableVoidItemsPrint),Be=Le.length>0&&!(null!==xe&&void 0!==xe&&null!==(l=xe.uiFeatureFlags)&&void 0!==l&&l.disableRefundItemsPrint),Ge=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const l=new Map;
1return e.forEach(e=>{const i=null!==e&&void 0!==e&&e.modifierOptionId?String(e.modifierOptionId):"".concat(String((null===e||void 0===e?void 0:e.optionName)||""),"__").concat(String((null===e||void 0===e?void 0:e.price)||"")),n=Math.max(0,Math.floor(Number.isFinite(Number(null===e||void 0===e?void 0:e.quantity))?Number(e.quantity):1));if(n<=0)return;const t=l.get(i);if(t){const e=Number(null===t||void 0===t?void 0:t.quantity),a=Number.isFinite(e)&&e>0?e:1;return void l.set(i,(0,o.A)((0,o.A)({},t),{},{quantity:String(a+n)}))}l.set(i,(0,o.A)((0,o.A)({},e),{},{quantity:String(n)}))}),Array.from(l.values())},Ve=(e,l,i)=>{var o,n,t,a,r,d;const s=e.name||e.itemName||"",c=Number(null!==(o=null!==(n=e.qty)&&void 0!==n?n:e.quantity)&&void 0!==o?o:1),u=Number(null!==(t=null!==(a=null!==(r=null!==(d=e.price)&&void 0!==d?d:e.unitPrice)&&void 0!==r?r:e.itemPrice)&&void 0!==a?a:e.subTotal)&&void 0!==t?t:0);return(0,F.jsxs)("div",{children:[(0,F.jsxs)("div",{className:"paylink-item-row",children:[(0,F.jsx)("span",{className:"item-name",children:s}),(0,F.jsx)("span",{className:"item-qty",children:c}),(0,F.jsxs)("span",{className:"item-price",children:[ke," ",(u*c).toFixed(2)]})]}),Ge(e.options).map((e,o)=>{const n=Number(e.quantity||1),t=Number(e.price||0);return(0,F.jsxs)("div",{className:"paylink-item-row paylink-modifier",children:[(0,F.jsxs)("span",{className:"item-name modifier-name",children:["\xa0\xa0+ ",e.optionName]}),(0,F.jsx)("span",{className:"item-qty",children:n}),(0,F.jsxs)("span",{className:"item-price",children:[ke," ",(t*n*c).toFixed(2)]})]},"".concat(i,"-").concat(l,"-opt-").concat(o))})]},"".concat(i,"-").concat(l))},Ye=(null===Z||void 0===Z?void 0:Z.customerName)||(null===Z||void 0===Z?void 0:Z.fullName)||"",ze=null===Z||void 0===Z||null===(i=Z.totals)||void 0===i||null===(y=i.find(e=>["SUBTOTAL","1","1.0"].includes(String(e.code))))||void 0===y?void 0:y.value,Ke=null===Z||void 0===Z||null===(C=Z.totals)||void 0===C||null===(N=C.find(e=>["TAX","2","2.0"].includes(String(e.code))))||void 0===N?void 0:N.value,Ze=null===Z||void 0===Z||null===(x=Z.totals)||void 0===x||null===(f=x.find(e=>["TOTAL","5","5.0"].includes(String(e.code))))||void 0===f?void 0:f.value,Je=Re.reduce((e,l)=>{var i,o,n,t,a;const r=Number(null!==(i=null!==(o=l.qty)&&void 0!==o?o:l.quantity)&&void 0!==i?i:1);return e+Number(null!==(n=null!==(t=null!==(a=l.price)&&void 0!==a?a:l.unitPrice)&&void 0!==t?t:l.itemPrice)&&void 0!==n?n:0)*r+(l.options||[]).reduce((e,l)=>{var i,o;const n=Number(null!==(i=l.quantity)&&void 0!==i?i:1);return e+Number(null!==(o=l.price)&&void 0!==o?o:0)*n},0)*r},0),$e=e=>{var l,i;const o=null===Z||void 0===Z||null===(l=Z.charges)||void 0===l?void 0:l.find(l=>String((null===l||void 0===l?void 0:l.title)||"").toLowerCase()===e.toLowerCase());if(o)return parseFloat(o.value)||0;const n=null===Z||void 0===Z||null===(i=Z.totals)||void 0===i?void 0:i.find(l=>String((null===l||void 0===l?void 0:l.title)||"").toLowerCase()===e.toLowerCase());return n&&parseFloat(n.value)||0},Qe=parseFloat(ze||"")||Je||(null===Z||void 0===Z?void 0:Z.subTotal)||0,We=parseFloat(Ke||"")||$e("Tax")||(null===Z||void 0===Z?void 0:Z.taxAmt)||(null===Z||void 0===Z?void 0:Z.tax)||(null===Z||void 0===Z?void 0:Z.taxAmount)||0,He=$e("Tip"),Xe=(null===Z||void 0===Z||null===(g=Z.totals)||void 0===g?void 0:g.find(e=>["8","8.0"].includes(String((null===e||void 0===e?void 0:e.code)||""))||"gratuity"===String((null===e||void 0===e?void 0:e.title)||"").toLowerCase()))||(null===Z||void 0===Z||null===(b=Z.charges)||void 0===b?void 0:b.find(e=>["8","8.0"].includes(String((null===e||void 0===e?void 0:e.code)||""))||"gratuity"===String((null===e||void 0===e?void 0:e.title)||"").toLowerCase())),el=Number(null===Xe||void 0===Xe?void 0:Xe.value)||0,ll=(null===Z||void 0===Z||null===(j=Z.totals)||void 0===j?void 0:j.length)>0?Z.totals:(null===Z||void 0===Z?void 0:Z.charges)||[],il=e=>{const l=Number(e);return Number.isFinite(l)?Math.abs(l):0},ol=ll.filter(e=>{const l=String((null===e||void 0===e?void 0:e.title)||"").toLowerCase(),i=l.includes("item level discount");return(["6","6.0"].includes(String((null===e||void 0===e?void 0:e.code)||""))||l.includes("discount"))&&!i&&il(null===e||void 0===e?void 0:e.value)>0}),nl=Array.isArray(null===Z||void 0===Z?void 0:Z.offerDetails)?Z.offerDetails:Array.isArray(null===Z||void 0===Z?void 0:Z.appliedOffers)?Z.appliedOffers:Array.isArray(null===Z||void 0===Z?void 0:Z.offers)?Z.offers:[],tl=nl.some(e=>!1===(null===e||void 0===e?void 0:e.isItemLevel)),al=(nl.length>0?ol.filter(e=>!tl&&"discount"===String((null===e||void 0===e?void 0:e.title)||"").toLowerCase()):ol).map(e=>({label:nl.length>0?"Custom discount":(null===e||void 0===e?void 0:e.title)||"Discount",amount:il(null===e||void 0===e?void 0:e.value)})),rl=(null===Z||void 0===Z?void 0:Z.loyaltyReceiptData)||(null===Z||void 0===Z?void 0:Z.loyalty_receipt_data)||(null===Z||void 0===Z?void 0:Z.loyaltyReceipt)||(null===Z||void 0===Z||null===(w=Z.loyalty)||void 0===w?void 0:w.receiptData)||(null===Z||void 0===Z?void 0:Z.loyalty),dl=(null===Z||void 0===Z?void 0:Z.loyaltyPointsPreview)||(null===Z||void 0===Z||null===(S=Z.order)||void 0===S?void 0:S.loyaltyPointsPreview),sl=(null===rl||void 0===rl?void 0:rl.program)||(null===Z||void 0===Z?void 0:Z.loyaltyProgram),cl=(null===sl||void 0===sl?void 0:sl.points_name)||(null===Z||void 0===Z?void 0:Z.pointsName)||"Points",ul=null!==(k=null!==(A=null!==(T=null!==(I=null===rl||void 0===rl?void 0:rl.points_earned)&&void 0!==I?I:null===Z||void 0===Z?void 0:Z.points_earned)&&void 0!==T?T:null===Z||void 0===Z?void 0:Z.loyaltyPointsEarned)&&void 0!==A?A:null===Z||void 0===Z||null===(P=Z.accrualResponse)||void 0===P?void 0:P.total_points_earned)&&void 0!==k?k:null===dl||void 0===dl?void 0:dl.total_points,vl="object"===typeof ul?null===ul||void 0===ul?void 0:ul.total_points:ul,ml=null!==(_=null!==(O=null!==(D=null===rl||void 0===rl?void 0:rl.balance_after)&&void 0!==D?D:null===Z||void 0===Z?void 0:Z.balance_after)&&void 0!==O?O:null===Z||void 0===Z?void 0:Z.loyaltyBalance)&&void 0!==_?_:null===dl||void 0===dl?void 0:dl.projected_balance,pl=e=>{const l=Number(e);return Number.isFinite(l)?Number.isInteger(l)?String(l):l.toFixed(2):""},hl=ll.filter(e=>["10","10.0"].includes(String((null===e||void 0===e?void 0:e.code)||""))&&il(null===e||void 0===e?void 0:e.value)>0).map(e=>({label:(null===e||void 0===e?void 0:e.title)||"Points Redeemed",amount:il(null===e||void 0===e?void 0:e.value)})),yl=Array.isArray(null===rl||void 0===rl?void 0:rl.redemptions_applied)?rl.redemptions_applied:[],Cl=hl.length>0?hl:yl.map(e=>{const l=pl(null===e||void 0===e?void 0:e.points_spent);return{label:"Redeemed".concat(l?" ".concat(l," ").concat(cl):"").concat(null!==e&&void 0!==e&&e.reward_name?" - ".concat(e.reward_name):""),amount:il(null===e||void 0===e?void 0:e.discount_amount)}}).filter(e=>e.amount>0),Nl=(null===sl||void 0===sl?void 0:sl.name)||(null===Z||void 0===Z?void 0:Z.loyaltyProgramName)||"",xl=Boolean(Nl)||null!=vl||null!=ml,fl=(e=>{var l,i;const o=null===Z||void 0===Z||null===(l=Z.charges)||void 0===l?void 0:l.find(l=>String((null===l||void 0===l?void 0:l.code)||"")===e||String((null===l||void 0===l?void 0:l.code)||"")==="".concat(e,".0"));return o||(null===Z||void 0===Z||null===(i=Z.totals)||void 0===i?void 0:i.find(l=>String((null===l||void 0===l?void 0:l.code)||"")===e||String((null===l||void 0===l?void 0:l.code)||"")==="".concat(e,".0")))})("7"),gl=parseFloat(String(null!==(E=null===fl||void 0===fl?void 0:fl.value)&&void 0!==E?E:""))||$e("Convenience Fee"),bl=(null===fl||void 0===fl?void 0:fl.title)||"CF",jl=parseFloat(Ze||"")||parseFloat(String(null!==(R=null!==(M=null===Z||void 0===Z?void 0:Z.total)&&void 0!==M?M:null===Z||void 0===Z?void 0:Z.orderTotal)&&void 0!==R?R:""))||Qe+We,wl=(0,t.useCallback)(async()=>
1{if(!L)return!0;try{var e;const l=await d.A.get("".concat(V,"/short-url/").concat(L),{params:{_t:Date.now()},headers:{"Cache-Control":"no-cache",Pragma:"no-cache"}});if(200!==l.status||!l.data)return!0;if(!Ce)return!0;const i=await(0,m.f1)({orderId:Ce});if(200!==(null===i||void 0===i?void 0:i.status))throw new Error("Unable to verify the current order amount.");const n=z(i.data),t=n.receipt,a=n.paymentOrderId,r=Y(t),s=null!==(e=Y(Z))&&void 0!==e?e:jl;return null===r||Math.round(100*r)===Math.round(100*s)||(J((0,o.A)((0,o.A)({},t),{},{orderId:a,locationId:(null===Z||void 0===Z?void 0:Z.locationId)||t.locationId})),Ne(a),ae(!1),ce("'Order total has changed, please verify the amount before proceeding to pay"),!1)}catch(i){var l;return 404===(null===i||void 0===i||null===(l=i.response)||void 0===l?void 0:l.status)?(ae(!1),J(null),ie("This pay link has expired."),!1):!Ce||(ae(!1),ce("Unable to verify the current order amount. Please refresh and try again."),!1)}},[L,Ce,Z,jl]),Sl=(0,t.useCallback)(async()=>{if(!Ce)throw new Error("Unable to refresh the order.");const e=await(0,m.f1)({orderId:Ce});if(200!==(null===e||void 0===e?void 0:e.status))throw new Error("Unable to refresh the order after adding the tip.");const l=z(e.data),i=l.receipt,n=l.paymentOrderId,t=Y(i);if(null===t)throw new Error("Unable to load the updated order total.");return J((0,o.A)((0,o.A)({},i),{},{orderId:n,locationId:(null===Z||void 0===Z?void 0:Z.locationId)||i.locationId})),Ne(n),t},[Ce,null===Z||void 0===Z?void 0:Z.locationId]),kl=(null===Z||void 0===Z?void 0:Z.isPaid)||"PAID"===(null===Z||void 0===Z?void 0:Z.paidStatus),Al=(0,t.useMemo)(()=>((null===Z||void 0===Z?void 0:Z.items)||[]).map(e=>{var l,i,n,t,a,r,d,s;const c=Number(null!==(l=null!==(i=e.qty)&&void 0!==i?i:e.quantity)&&void 0!==l?l:1),u=Number(null!==(n=null!==(t=null!==(a=e.price)&&void 0!==a?a:e.unitPrice)&&void 0!==t?t:e.itemPrice)&&void 0!==n?n:0),v=(e.options||[]).reduce((e,l)=>{var i,o;const n=Number(null!==(i=l.quantity)&&void 0!==i?i:1);return e+Number(null!==(o=l.price)&&void 0!==o?o:0)*n},0),m=Number(null!==(r=e.subTotal)&&void 0!==r?r:u*c+v);return(0,o.A)((0,o.A)({},e),{},{itemId:e.itemId||e.id||"",itemName:e.itemName||e.name||"",itemAltName:e.itemAltName||e.altName||"",quantity:String(c),price:u.toFixed(2),subTotal:m.toFixed(2),comment:e.comment||"",tax:e.tax||[],offer_amount:null!==(d=e.offer_amount)&&void 0!==d?d:0,offer_data:e.offer_data||null,is_discount_applied:null!==(s=e.is_discount_applied)&&void 0!==s&&s,availability:e.availability||null,options:(e.options||[]).map(e=>{var l,i;return(0,o.A)((0,o.A)({},e),{},{typeId:e.typeId||e.modifierId||"",modifierOptionId:e.modifierOptionId||e.id||"",modifier:e.modifier||e.modifierName||"",optionName:e.optionName||e.name||"",quantity:String(null!==(l=e.quantity)&&void 0!==l?l:1),price:Number(null!==(i=e.price)&&void 0!==i?i:0).toFixed(2)})})})}),[null===Z||void 0===Z?void 0:Z.items]),Tl=(0,t.useMemo)(()=>{const e=(null===xe||void 0===xe?void 0:xe.orderTypes)||[],l=String((null===Z||void 0===Z?void 0:Z.orderType)||"").toLowerCase(),i=e.find(e=>{var l;return"D"===(null===e||void 0===e?void 0:e.typeGroup)||(null===e||void 0===e||null===(l=e.typeName)||void 0===l?void 0:l.toLowerCase().includes("dine"))}),o=e.find(e=>{var l,i;return"pickup"===(null===e||void 0===e||null===(l=e.typeName)||void 0===l?void 0:l.toLowerCase())||"pick up"===(null===e||void 0===e||null===(i=e.typeName)||void 0===i?void 0:i.toLowerCase())});return l.includes("pickup")||l.includes("take")?o||i||null:i||o||null},[xe,null===Z||void 0===Z?void 0:Z.orderType]);if(W)return(0,F.jsx)("div",{className:"paylink-loading",children:(0,F.jsx)(c.A,{})});if(!le&&Z&&!we)return(0,F.jsx)("div",{className:"paylink-container",children:(0,F.jsx)("div",{className:"paylink-card",children:(0,F.jsxs)("div",{className:"paylink-shimmer",children:[(0,F.jsx)("div",{className:"shimmer-block shimmer-logo"}),(0,F.jsx)("div",{className:"shimmer-block shimmer-line shimmer-w-60"}),(0,F.jsx)("div",{className:"shimmer-block shimmer-line shimmer-w-40"}),(0,F.jsx)("div",{className:"shimmer-block shimmer-line shimmer-w-50"}),(0,F.jsx)("div",{className:"shimmer-divider"}),[1,2,3].map(e=>(0,F.jsxs)("div",{className:"shimmer-row",children:[(0,F.jsx)("div",{className:"shimmer-block shimmer-line shimmer-w-60"}),(0,F.jsx)("div",{className:"shimmer-block shimmer-line shimmer-w-15"})]},e)),(0,F.jsx)("div",{className:"shimmer-divider"}),(0,F.jsxs)("div",{className:"shimmer-row",children:[(0,F.jsx)("div",{className:"shimmer-block shimmer-line shimmer-w-30"}),(0,F.jsx)("div",{className:"shimmer-block shimmer-line shimmer-w-20"})]}),(0,F.jsxs)("div",{className:"shimmer-row",children:[(0,F.jsx)("div",{className:"shimmer-block shimmer-line shimmer-w-30"}),(0,F.jsx)("div",{className:"shimmer-block shimmer-line shimmer-w-20"})]}),(0,F.jsx)("div",{className:"shimmer-block shimmer-button"})]})})});if(le||!Z)return(0,F.jsxs)("div",{className:"paylink-error",children:[(0,F.jsx)("div",{className:"error-title",children:"Link Expired"}),(0,F.jsxs)("div",{className:"error-message",children:["This payment link is no longer available or has already been processed",(0,F.jsx)("br",{})," ",(0,F.jsx)("br",{}),"For further assistance, please check with your server or visit the front desk"]})]});const Il=Se();return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(s.mg,{children:(0,F.jsx)("title",{children:null!==xe&&void 0!==xe&&xe.branchName?"Brisque - ".concat(xe.branchName):"Brisque"})}),(0,F.jsx)("div",{className:"paylink-container",style:be,children:(0,F.jsxs)("div",{className:"paylink-card",style:{boxShadow:q?"":"0px 0px 3.84px 0px #00000040"},children:[!me&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("div",{className:"paylink-restaurant-header",children:[Il&&(0,F.jsx)("img",{src:Il,alt:Ae,className:"restaurant-logo"}),Ae&&(0,F.jsx)("h2",{className:"restaurant-name",children:Ae}),Ie&&(0,F.jsx)("p",{className:"restaurant-phone",children:Ie}),Pe&&(0,F.jsx)("p",{className:"restaurant-address",children:Pe})]}),De&&(0,F.jsx)("div",{className:"paylink-order-type",children:(0,F.jsxs)("div",{className:"order-type-badge",children:[(0,F.jsx)("span",{className:"type-label",children:De}),Ee&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{children:"\u2022"}),(0,F.jsxs)("span",{className:"table-label",children:["TABLE - ",Ee]})]})]})}),(_e||Fe)&&(0,F.jsxs)("div",{className:"paylink-order-info",children:[_e&&(0,F.jsxs)("span",{children:["Order No : #",_e]}),Oe&&(0,F.jsx)("span",{children:Oe})]}),(0,F.jsx)("hr",{className:"paylink-divider"}),Re.length>0&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("div",{className:"paylink-items-header",children:[(0,F.jsx)("span",{className:"items-col",children:"ITEMS"}),(0,F.jsx)("span",{className:"qty-col",children:"QTY"}),(0,F.jsx)("span",{className:"price-col",children:"PRICE"})]}),Re.map((e,l)=>{var i,o,n,t,a,r,d;
1const s=e.name||e.itemName||"",c=Number(null!==(i=null!==(o=e.qty)&&void 0!==o?o:e.quantity)&&void 0!==i?i:1),u=Number(null!==(n=null!==(t=null!==(a=null!==(r=e.price)&&void 0!==r?r:e.unitPrice)&&void 0!==a?a:e.itemPrice)&&void 0!==t?t:e.subTotal)&&void 0!==n?n:0);return(0,F.jsxs)("div",{children:[(0,F.jsxs)("div",{className:"paylink-item-row",children:[(0,F.jsx)("span",{className:"item-name",children:s}),(0,F.jsx)("span",{className:"item-qty",children:c}),(0,F.jsxs)("span",{className:"item-price",children:[ke," ",(u*c).toFixed(2)]})]}),null===(d=e.options)||void 0===d?void 0:d.map((e,l)=>{const i=Number(e.quantity||1),o=Number(e.price||0);return(0,F.jsxs)("div",{className:"paylink-item-row paylink-modifier",children:[(0,F.jsxs)("span",{className:"item-name modifier-name",children:["\xa0\xa0+ ",e.optionName]}),(0,F.jsx)("span",{className:"item-qty",children:i}),(0,F.jsxs)("span",{className:"item-price",children:[ke," ",(o*i*c).toFixed(2)]})]},l)})]},l)})]}),qe&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("div",{className:"paylink-refund-header",children:"------CANCELLED ITEMS------"}),(0,F.jsx)("div",{children:Me.map((e,l)=>Ve(e,l,"voided"))})]}),Be&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("div",{className:"paylink-refund-header",children:"------REFUNDED ITEMS------"}),(0,F.jsxs)("div",{children:[Le.map((e,l)=>Ve(e,l,"refunded")),Number(Ue)>0&&(0,F.jsxs)("div",{className:"paylink-item-row",children:[(0,F.jsx)("span",{className:"item-name",children:"REFUND TOTAL"}),(0,F.jsx)("span",{className:"item-qty"}),(0,F.jsxs)("span",{className:"item-price",children:[ke," ",Ue]})]})]})]}),(0,F.jsx)("hr",{className:"paylink-divider"}),(0,F.jsxs)("div",{className:"paylink-totals",children:[Qe>0&&(0,F.jsxs)("div",{className:"totals-row",children:[(0,F.jsx)("span",{className:"totals-label",children:"Sub Total"}),(0,F.jsxs)("span",{className:"totals-value",children:[ke," ",Number(Qe).toFixed(2)]})]}),We>0&&(0,F.jsxs)("div",{className:"totals-row",children:[(0,F.jsx)("span",{className:"totals-label",children:"Tax"}),(0,F.jsxs)("span",{className:"totals-value",children:[ke," ",Number(We).toFixed(2)]})]}),He>0&&(0,F.jsxs)("div",{className:"totals-row",children:[(0,F.jsx)("span",{className:"totals-label",children:"Tip"}),(0,F.jsxs)("span",{className:"totals-value",children:[ke," ",Number(He).toFixed(2)]})]}),al.length>0&&al.map((e,l)=>(0,F.jsxs)("div",{className:"totals-row paylink-split-discount",children:[(0,F.jsx)("span",{className:"totals-label",children:nl.length>0?"(".concat(e.label,")"):e.label}),(0,F.jsxs)("span",{className:"totals-value",children:[ke," ",Number(e.amount).toFixed(2)]})]},"".concat(e.label,"-").concat(l))),gl>0&&(0,F.jsxs)("div",{className:"totals-row",children:[(0,F.jsx)("span",{className:"totals-label",children:bl}),(0,F.jsxs)("span",{className:"totals-value",children:[ke," ",Number(gl).toFixed(2)]})]}),el>0&&(0,F.jsxs)("div",{className:"totals-row",children:[(0,F.jsx)("span",{className:"totals-label",children:"Gratuity"}),(0,F.jsxs)("span",{className:"totals-value",children:[ke," ",Number(el).toFixed(2)]})]}),Cl.map((e,l)=>(0,F.jsxs)("div",{className:"totals-row paylink-loyalty-redemption",children:[(0,F.jsx)("span",{className:"totals-label",children:e.label}),(0,F.jsxs)("span",{className:"totals-value",children:["(",ke," ",Number(e.amount).toFixed(2),")"]})]},"".concat(e.label,"-").concat(l)))]}),jl>0&&(0,F.jsxs)("div",{className:"paylink-grand-total",children:[(0,F.jsx)("span",{className:"total-label",children:"Total"}),(0,F.jsxs)("span",{className:"total-value",children:[ke," ",Number(jl).toFixed(2)]})]}),xl&&(0,F.jsxs)("div",{className:"paylink-loyalty-summary",children:[Nl&&(0,F.jsx)("div",{className:"paylink-loyalty-summary__heading",children:Nl}),null!=vl&&(0,F.jsxs)("div",{className:"paylink-loyalty-summary__row",children:[(0,F.jsxs)("span",{children:[cl," earned this Order"]}),(0,F.jsxs)("span",{children:[pl(vl)," ",cl]})]}),null!=ml&&(0,F.jsxs)("div",{className:"paylink-loyalty-summary__row",children:[(0,F.jsx)("span",{children:"Your balance"}),(0,F.jsxs)("span",{children:[pl(ml)," ",cl]})]})]}),(Ye||(null===Z||void 0===Z?void 0:Z.customerNo)||(null===Z||void 0===Z?void 0:Z.callerPhone)||(null===Z||void 0===Z?void 0:Z.phone))&&(0,F.jsxs)("div",{className:"paylink-customer-info",children:[Ye&&(0,F.jsx)("span",{className:"customer-name",children:Ye}),((null===Z||void 0===Z?void 0:Z.customerNo)||(null===Z||void 0===Z?void 0:Z.callerPhone)||(null===Z||void 0===Z?void 0:Z.phone))&&(0,F.jsx)("span",{className:"customer-phone",children:(null===Z||void 0===Z?void 0:Z.customerNo)||(null===Z||void 0===Z?void 0:Z.callerPhone)||(null===Z||void 0===Z?void 0:Z.phone)})]})]}),se&&(0,F.jsx)("div",{className:"paylink-payment-notice",role:"alert",children:se}),kl?(0,F.jsx)("div",{className:"paylink-paid-badge",children:(0,F.jsx)("span",{className:"paid-text",children:"PAID"})}):te?(0,F.jsx)(G,{orderData:Z,restaurantDetails:xe,currency:ke,total:jl,subTotal:Qe,tax:We,existingTip:He,normalizedItems:Al,shortUrlKey:L||"",orderTypeId:(null===Z||void 0===Z?void 0:Z.orderTypeId)||(null===Tl||void 0===Tl?void 0:Tl.id)||"",existingOrderId:Ce,logoUrl:Il,restaurantName:Te,onViewReceipt:e=>{var l,i;if(!e)return;let o={};try{o=JSON.parse(localStorage.getItem("restaurant")||"{}")}catch(r){o={}}const n=(null===Z||void 0===Z?void 0:Z.merchantType)||(null===(l=o)||void 0===l?void 0:l.merchantType)||"restaurant",t=(null===Z||void 0===Z?void 0:Z.merchantSlug)||(null===Z||void 0===Z?void 0:Z.restaurantSlug)||(null===Z||void 0===Z?void 0:Z.locationSlug)||(null===xe||void 0===xe?void 0:xe.locationSlug)||(null===xe||void 0===xe?void 0:xe.merchantSlug)||(null===(i=o)||void 0===i?void 0:i.location);sessionStorage.setItem("payLinkTracker","true");const a=t?(0,h.ye)(n,t,e):"/order/".concat((0,p.EK)(e),"/orderSummary");window.location.replace(a)},onPaymentSuccess:()=>pe(!0),onValidateBeforePayment:wl,onRefreshExistingOrderAfterTip:Sl,onClose:()=>ae(!1),tableId:null===Z||void 0===Z?void 0:Z.tableId,tableName:null===Z||void 0===Z?void 0:Z.tableName}):(0,F.jsx)("div",{className:"paylink-pay-section",children:(0,F.jsx)("button",{className:"paylink-pay-btn",onClick:()=>
1{if(!Z||!xe)return;ce("");const e=(null===Z||void 0===Z?void 0:Z.orderTypeId)||(null===Tl||void 0===Tl?void 0:Tl.id);if(e){var l;const i=null===xe||void 0===xe||null===(l=xe.orderTypes)||void 0===l?void 0:l.find(l=>(null===l||void 0===l?void 0:l.id)===e);i&&U((0,v.hP)({id:i.id,typeName:i.typeName}))}ae(!0)},disabled:jl<=0,children:"Pay ".concat(ke," ").concat(Number(jl).toFixed(2))})}),!me&&(0,F.jsx)("div",{className:"paylink-powered-by",children:(0,F.jsx)("img",{src:u.A,alt:"Powered by Maghil"})})]})})]})}},84524(e,l,i){i.d(l,{Cg:()=>t,_P:()=>d,_m:()=>r,my:()=>o,s0:()=>a,w4:()=>n});Math.pow(10,8);const o=6048e5,n=864e5,t=6e4,a=36e5,r=1e3,d=Symbol.for("constructDateFrom")},12440(e,l,i){i.d(l,{w:()=>n});var o=i(84524);function n(e,l){return"function"===typeof e?e(l):e&&"object"===typeof e&&o._P in e?e[o._P](l):e instanceof Date?new e.constructor(l):new Date(l)}},62316(e,l,i){i.d(l,{a:()=>n});var o=i(12440);function n(e,l){return(0,o.w)(l||e,e)}}}]);
2//# sourceMappingURL=9578.a8f76dc7.chunk.js.map

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.