@fractalpay/fractalpay-next-dev 0.0.211 → 0.0.213

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,3013 @@
1
+ var Fa=Object.defineProperty,Ma=Object.defineProperties;var La=Object.getOwnPropertyDescriptors;var Li=Object.getOwnPropertySymbols;var ma=Object.prototype.hasOwnProperty,ca=Object.prototype.propertyIsEnumerable;var da=(e,t,H)=>t in e?Fa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:H}):e[t]=H,C=(e,t)=>{for(var H in t||(t={}))ma.call(t,H)&&da(e,H,t[H]);if(Li)for(var H of Li(t))ca.call(t,H)&&da(e,H,t[H]);return e},L=(e,t)=>Ma(e,La(t));var Un=(e,t)=>{var H={};for(var z in e)ma.call(e,z)&&t.indexOf(z)<0&&(H[z]=e[z]);if(e!=null&&Li)for(var z of Li(e))t.indexOf(z)<0&&ca.call(e,z)&&(H[z]=e[z]);return H};var Aa=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ga=Aa((Or,Ba)=>{Ba.exports={name:"@fractalpay/fractalpay-next-dev",version:"0.0.213",private:!1,scripts:{dev:"next dev -p 4001",build:"next build",start:"next start",lint:"next lint",bundle:"tsup src/app/index.ts"},dependencies:{"@stripe/react-stripe-js":"^5.3.0","@stripe/stripe-js":"^8.3.0","@types/yup":"^0.29.14",axios:"^1.8.1",bootstrap:"^5.3.3","credit-card-type":"^10.0.1",formik:"^2.4.6","node-forge":"^1.3.1","react-bootstrap":"^2.10.5","react-bs-datatable":"^3.15.0","react-datepicker":"^7.5.0","react-icons":"^5.5.0","react-number-format":"^5.4.3","react-toastify":"^10.0.6","socket.io-client":"^4.8.1","styled-components":"^6.1.15",sweetalert2:"^11.22.0",yup:"^1.6.1"},peerdependencies:{next:"15.0.5",react:">=18.0.0 <20.0.0","react-dom":">=18.0.0 <20.0.0"},devDependencies:{"@types/estree":"^1.0.8","@types/node":"^20","@types/node-forge":"^1.3.11","@types/react":"^18","@types/react-dom":"^18",autoprefixer:"^10.4.20","credit-card-type":"^10.0.1",eslint:"^8","eslint-config-next":"15.0.3",next:"^15.0.5",react:"^18.3.1","react-bs-datatable":"^3.15.0","react-datepicker":"^7.5.0","react-dom":"^18.3.1","react-toastify":"^10.0.6",tsup:"^8.4.0",typescript:"^5"},author:"Mukul",license:"MIT",keywords:["nextjs","next","typescript","tailwindcss"],main:"dist/index.js",publishConfig:{access:"public"}}});import"bootstrap/dist/js/bootstrap.bundle.min.js";import I,{useState as $n,useEffect as ha}from"react";import On from"react";import Ta from"react";var za=e=>Ta.createElement("style",null,`
2
+
3
+ .loader {
4
+ position: fixed; /* Fixed position to cover the viewport */
5
+ top: 0;
6
+ left: 0;
7
+ width: 100%;
8
+ height: 100%;
9
+ display: flex;
10
+ justify-content: center;
11
+ align-items: center;
12
+ /* background: rgba(255, 255, 0, 0.01); Adjust the blur effect */
13
+ background-color: rgba(31, 29, 29, 0.52); /* Semi-transparent black background */
14
+
15
+ backdrop-filter: blur(.5px); /* Blur effect */
16
+ z-index: 999999999999 !important; /* Ensure it's on top of other elements */
17
+ transform: translate(0%, 0%) !important
18
+ }
19
+
20
+ .lds-ellipsis {
21
+ display: inline-block;
22
+ position: relative;
23
+ width: 80px;
24
+ height: 80px;
25
+ }
26
+
27
+ .lds-ellipsis div {
28
+ position: absolute;
29
+ top: 33px;
30
+ width: 13px;
31
+ height: 13px;
32
+ border-radius: 50%;
33
+ background: #000;
34
+ animation-timing-function: cubic-bezier(0, 1, 1, 0);
35
+ }
36
+
37
+ .lds-ellipsis div:nth-child(1) {
38
+ left: 8px;
39
+ animation: lds-ellipsis1 0.6s infinite;
40
+ }
41
+
42
+ .lds-ellipsis div:nth-child(2) {
43
+ left: 8px;
44
+ animation: lds-ellipsis2 0.6s infinite;
45
+ }
46
+
47
+ .lds-ellipsis div:nth-child(3) {
48
+ left: 32px;
49
+ animation: lds-ellipsis2 0.6s infinite;
50
+ }
51
+
52
+ .lds-ellipsis div:nth-child(4) {
53
+ left: 56px;
54
+ animation: lds-ellipsis3 0.6s infinite;
55
+ }
56
+
57
+ @keyframes lds-ellipsis1 {
58
+ 0% {
59
+ transform: scale(0);
60
+ }
61
+ 100% {
62
+ transform: scale(1);
63
+ }
64
+ }
65
+
66
+ @keyframes lds-ellipsis2 {
67
+ 0% {
68
+ transform: translate(0, 0);
69
+ }
70
+ 100% {
71
+ transform: translate(24px, 0);
72
+ }
73
+ }
74
+
75
+ @keyframes lds-ellipsis3 {
76
+ 0% {
77
+ transform: scale(1);
78
+ }
79
+ 100% {
80
+ transform: scale(0);
81
+ }
82
+ }
83
+
84
+ `),ua=za;var Ia=e=>On.createElement(On.Fragment,null,On.createElement(ua,null),(e==null?void 0:e.loading)&&On.createElement("div",{className:"loader"},On.createElement("div",{className:"lds-ellipsis"},On.createElement("div",null),On.createElement("div",null),On.createElement("div",null),On.createElement("div",null)))),an=Ia;var{name:Ai}=ga(),ne="https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/";Ai==="@fractalpay/fractalpay-next-dev"?(Qe="http://localhost:8082/",Ee="http://localhost:8081/",rn="https://api-dev.merchant-trends.com/",Jn="https://token-cert.dcap.com/v1/client",Qn="pk_test_51RH5Wc2SlJvyNZ80hpUDy88r4rVdpijfKbNaWaUyQEE6rOrPmG2JQyAj7G5amBD5z5daC56WaeT4jfNhrrPcGOEP00UyKu6AOw"):Ai==="@fractalpay/fractalpay-next-test"?(Ee="https://testapi.fractalpay.com/",Qe="https://staging-widget.fractalpay.com/",rn="https://api-dev.merchant-trends.com/",Jn="https://token-cert.dcap.com/v1/client",Qn="pk_test_51RH5Wc2SlJvyNZ80hpUDy88r4rVdpijfKbNaWaUyQEE6rOrPmG2JQyAj7G5amBD5z5daC56WaeT4jfNhrrPcGOEP00UyKu6AOw"):Ai==="@fractalpay/fractalpay-next-testprod"?(Ee="https://sky-node-prod.fractalpay.com/",Qe="https://widget-prod.fractalpay.com/",rn="https://api.merchant-trends.com/",Jn="https://token.dcap.com/v1/client",Qn="pk_live_51RH5WXCZ90rBGeaYwqmjWqgUmudTgxL6uKOE1keu617jvRx9OvW2ke6zGf6SKgv4ixsBLcIPQ4sQIEhp8MgBX39500CqULxOPB"):Ai==="@fractalpay/fractalpay-next"?(Ee="https://api.fractalpay.com/",Qe="https://widget.fractalpay.com/",rn="https://api.merchant-trends.com/",Jn="https://token.dcap.com/v1/client",Qn="pk_live_51RH5WXCZ90rBGeaYwqmjWqgUmudTgxL6uKOE1keu617jvRx9OvW2ke6zGf6SKgv4ixsBLcIPQ4sQIEhp8MgBX39500CqULxOPB"):(Qe="http://localhost:8082/",Ee="http://localhost:8081/",rn="https://api-dev.merchant-trends.com/",Jn="https://token-cert.dcap.com/v1/client",Qn="pk_test_51RH5Wc2SlJvyNZ80hpUDy88r4rVdpijfKbNaWaUyQEE6rOrPmG2JQyAj7G5amBD5z5daC56WaeT4jfNhrrPcGOEP00UyKu6AOw");var Ee,Qe,rn,Jn,Qn;var Zt={namerequired:"Full Name is required",amountrequired:"Amount is required",amountpositive:"Amount should be positive",amountzero:"Amount should not be zero",amountenter:"Please enter an amount",amountvalid:"Please enter a valid amount",phoneoremailrequired:"Phone or Email is required",invalidemail:"Please enter a valid email",invalidemailformat:"Invalid email format",onlylettersallowed:"Only letters are allowed",phonenumberlength:"Phone number should be 10 digits",phonenumberrequired:"Please enter a phone number",phonenumbervalid:"Please enter a valid phone number",phonenumbervalidnumberonly:"Please enter a valid phone number (numbers only)",orderidenter:"Please enter an order ID",orderidrequired:"Order ID is required",networkresponseerror:"Network response was not ok",anerroroccured:"An error occurred. Please try again.",montherror:"Please write month only 1 to 12",fieldrequired:"This field is required",fractalpayclientidrequired:"Fractalpay client key is missing or empty."};import yi from"react";import qa from"react";var Ha=e=>qa.createElement("style",null,`
85
+ .fractal-input::placeholder {
86
+ color: #35254D;
87
+ opacity: 1;
88
+ font-size: 15px;
89
+ }
90
+
91
+ .fractal-input::-ms-input-placeholder {
92
+ color: #35254D;
93
+ font-size: 15px;
94
+ }
95
+
96
+ .trigger{
97
+ text-align: center;
98
+ padding: 7px 13px;
99
+ background: #3e3e3e;
100
+ color: #fff;
101
+ font-size: 15px;
102
+ outline: none;
103
+ border: none;
104
+ border-radius: 5px;
105
+ font-family: cursive;
106
+ }
107
+
108
+ // .fractal-popup {
109
+ // position: fixed;
110
+ // z-index: 9999;
111
+ // top: 0;
112
+ // right: 0;
113
+ // bottom: 0;
114
+ // left: 0;
115
+ // width: 100%;
116
+ // // max-width:810px;
117
+ // height: 100%;
118
+ // background-color: rgba(0, 0, 0, 0.5);
119
+ // transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
120
+ // display: flex;
121
+ // justify-content: center;
122
+ // align-items: center;
123
+ // overflow:auto;
124
+ // }
125
+
126
+ .fractal-popup {
127
+ position: fixed;
128
+ z-index: 1050;
129
+ left: 0;
130
+ top: 0;
131
+ width: 100%;
132
+ height: 100%;
133
+ overflow: auto;
134
+ background-color: rgba(0, 0, 0, 0.8);
135
+ // padding:20px
136
+ }
137
+
138
+ .fractal-popup-content {
139
+ margin:20px auto !important;
140
+ transform :none;
141
+ background-color: white;
142
+ padding:20px;
143
+ border-radius: 0.5rem;
144
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
145
+ box-sizing: border-box;
146
+ position: relative;
147
+ // min-height : 585px;
148
+ max-width:810px;
149
+ width:90vw
150
+
151
+ }
152
+
153
+
154
+ // @media only screen and (min-width: 600px){
155
+ // .fractal-popup-content {
156
+ // max-width:810px;
157
+ // }
158
+ // }
159
+ // @media only screen and (max-width: 600px){
160
+ // .fractal-popup-content {
161
+ // width: 350px;
162
+ // }
163
+ // }
164
+ // @media only screen and (max-width: 450px){
165
+ // .fractal-popup-content {
166
+ // width: 300px;
167
+ // }
168
+ // }
169
+ .close-popup {
170
+ max-height:25px;
171
+ width:25px;
172
+ height: 25px;
173
+ color: #999;
174
+ position: absolute;
175
+ top: 2px;
176
+ right: 4px;
177
+ z-index: 7;
178
+ text-align: center;
179
+ cursor: pointer;
180
+ border-radius: 0.25rem;
181
+ font-size: 30px;
182
+ line-height: 30px;
183
+ display: flex;
184
+ align-items: center;
185
+ justify-content: center;
186
+ }
187
+
188
+ .close-popup:hover {
189
+ color: #000;
190
+ }
191
+
192
+ .fractal-inpt-list {
193
+ margin-bottom: 15px;
194
+ }
195
+
196
+ .fractal-label {
197
+ color: #727272;
198
+ margin-bottom: 3px;
199
+ font-family: "Inter", sans-serif;
200
+ font-weight: 500;
201
+ font-size: 12px;
202
+ display: block;
203
+ text-align: left;
204
+ }
205
+
206
+ .fractal-input {
207
+ display: block;
208
+ width: 100%;
209
+ padding: .320rem .75rem;
210
+ font-size: 1rem;
211
+ font-weight: 400;
212
+ line-height: 1.5;
213
+ color: #35254D;
214
+ appearance: none;
215
+ background-color:#ffffff;
216
+ background-clip: padding-box;
217
+ border:1px solid #dee2e6;
218
+ border-radius: 0.375rem;
219
+ transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
220
+ }
221
+
222
+ .fractal-input:focus {border:#86b7fe 1px solid; outline: none;}
223
+
224
+ .fractal-group {
225
+ position: relative;
226
+ display: flex;
227
+ align-items: stretch;
228
+ width: 100%;
229
+ }
230
+
231
+ .fractal-group-icons {
232
+ display: flex;
233
+ align-items: center;
234
+ padding: 0.375rem 0.75rem;
235
+ font-size: 1rem;
236
+ font-weight: 400;
237
+ line-height: 1.5;
238
+ color: #212529;
239
+ text-align: center;
240
+ white-space: nowrap;
241
+ background-color: #f8f9fa;
242
+ border:#dee2e6 1px solid;
243
+ border-radius: 0.375rem 0 0 0.375rem ;
244
+ }
245
+
246
+ .fractal-group .fractal-input{
247
+ border-radius:0 0.375rem 0.375rem 0;
248
+ }
249
+
250
+
251
+ .pay-button {
252
+ outline: 0;
253
+ height: 46px;
254
+ font-size: 16px;
255
+ background: #727272;
256
+ border: none;
257
+ display: block;
258
+ color: #fff;
259
+ width: 100%;
260
+ border-radius: 180px;
261
+ margin: 10px 0;
262
+ text-decoration: none;
263
+ cursor:pointer,
264
+ font-family:
265
+ }
266
+
267
+ .pay-button:hover, .pay-button:focus {background: #222; color: #fff; cursor:pointer}
268
+
269
+ .fractal-powerd-by {
270
+ display: flex;
271
+ font-size: 12px;
272
+ text-align: center;
273
+ align-items: center;
274
+ justify-content: center;
275
+ margin: 5px 0 20px 0;
276
+ }
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+ /* ................................................................ */
285
+
286
+ .fractal-pay-popup {
287
+ position: fixed;
288
+ z-index: 9999;
289
+ top: 0;
290
+ right: 0;
291
+ bottom: 0;
292
+ left: 0;
293
+ width: 100%;
294
+ height: 100%;
295
+ background-color: rgba(0, 0, 0, 0.5);
296
+ transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
297
+ display: flex;
298
+ justify-content: center;
299
+ align-items: center;
300
+ }
301
+
302
+ .fractal-pay-popup-content {
303
+ background-color: white;
304
+ padding:0px;
305
+ border-radius: 0.5rem;
306
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
307
+ box-sizing: border-box;
308
+ position: relative;
309
+ height: 100%;
310
+ max-height:90%;
311
+ overflow: hidden;
312
+ }
313
+ .fractal-pay-popup-content iframe{height: 100% !important; }
314
+ .fractal-pay-popup-content iframe body{overflow: hidden;}
315
+ @media only screen and (min-width: 768px){
316
+ .fractal-pay-popup-content iframe{width: 768px;}
317
+ .fractal-pay-popup-content {
318
+ width: 750px;
319
+
320
+ }
321
+ }
322
+ @media only screen and (max-width: 600px){
323
+ .fractal-pay-popup-content {
324
+ width: 350px;
325
+ }
326
+ }
327
+ @media only screen and (max-width: 450px){
328
+ .fractal-pay-popup-content {
329
+ width: 300px;
330
+ }
331
+ }
332
+
333
+ .request-payment-popup-container {
334
+ padding: 0px !important;
335
+ border-radius: 12px !important;
336
+ }
337
+ `),Ti=Ha;var Ya=({open:e,onClose:t,children:H,maxWidth:z})=>e?yi.createElement(yi.Fragment,null,yi.createElement(Ti,null),yi.createElement("div",{className:"fractal-popup"},yi.createElement("div",{className:"fractal-popup-content request-payment-popup-container",style:{maxWidth:`${z!=null?z:"auto"}`}},H))):null,yn=Ya;import Wa from"axios";import{PatternFormat as Ga}from"react-number-format";import Ea from"react";var $a=e=>Ea.createElement("style",null,`
338
+ @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
339
+ body {
340
+ font-family: 'Inter', sans-serif !important;
341
+ }
342
+ input{
343
+ font-family: 'Inter', sans-serif !important;
344
+ }
345
+
346
+ .paymentBtn {
347
+ background-color: black;
348
+ border: none;
349
+ color: white;
350
+ padding: 15px 32px;
351
+ text-align: center;
352
+ text-decoration: none;
353
+ display: inline-block;
354
+ font-size: 16px;
355
+ margin: 4px 2px;
356
+ cursor: pointer;
357
+ border-radius: 180px;
358
+ /* width: auto; */
359
+ }
360
+ /*****************************************REDESIGNING STYLES **************************************/
361
+
362
+ .request-payment-amount {
363
+ color: #161616;
364
+ text-align: center;
365
+ font-size: 42px;
366
+ font-style: normal;
367
+ font-weight: 600;
368
+ text-transform: uppercase;
369
+ margin: 8px 0px !important;
370
+ }
371
+
372
+ .request-payment-orderid {
373
+ color: #727272;
374
+ text-align: center;
375
+ font-size: 14px;
376
+ font-style: normal;
377
+ font-weight: 500;
378
+ margin: 0px;
379
+ }
380
+
381
+ .request-payment-pre-auth-merchantname {
382
+ color: #727272;
383
+ text-align: center;
384
+ font-size: 14px;
385
+ font-style: normal;
386
+ font-weight: 500;
387
+ margin-top: 10px !important;
388
+ margin-bottom: 0px !important;
389
+ }
390
+
391
+ .request-payment-merchantname {
392
+ color: #727272;
393
+ text-align: center;
394
+ font-size: 14px;
395
+ font-style: normal;
396
+ font-weight: 500;
397
+ margin-top: 20px !important;
398
+ margin-bottom: 0px !important;
399
+ }
400
+
401
+ .request-payment-close-popup {
402
+ position: absolute;
403
+ right: 20px;
404
+ top: 20px;
405
+ cursor: pointer;
406
+ }
407
+
408
+ .request-payment-amount-detail {
409
+ padding: 32px 0px;
410
+ border-bottom: 1px solid #E0DFE2;
411
+ }
412
+
413
+ .request-payment-popup-container {
414
+ padding: 0px !important;
415
+ border-radius: 12px !important;
416
+ }
417
+
418
+ .request-payment-input-form {
419
+ padding: 24px 48px 32px 48px;
420
+ }
421
+
422
+ .request-payment-input-label {
423
+ color: #727272;
424
+ font-size: 12px;
425
+ font-style: normal;
426
+ font-weight: 500;
427
+ margin-bottom: 6px !important;
428
+ text-align: start !important;
429
+ width: 100% !important;
430
+ margin-bottom: 6px !important;
431
+ text-transform: uppercase;
432
+ }
433
+
434
+ .request-payment-input-box {
435
+ border-radius: 8px;
436
+ border: 1px solid #E0DFE2;
437
+ padding: 11px;
438
+ display: block;
439
+ width: 100%;
440
+ color: #161616;
441
+ margin-top: 6px !important;
442
+ font-size: 14px;
443
+ font-style: normal;
444
+ font-weight: 500;
445
+ box-sizing: border-box;
446
+ }
447
+
448
+ .request-payment-list-div {
449
+ margin-bottom: 12px;
450
+ }
451
+
452
+ .request-payment-submit-button {
453
+ border-radius: 80px;
454
+ background: #161616;
455
+ height: 48px;
456
+ padding: 12px 24px;
457
+ margin-top: 20px;
458
+ color: #fff;
459
+ width: 100% !important;
460
+ border: none !important;
461
+ font-size: 16px;
462
+ font-style: normal;
463
+ font-weight: 500;
464
+ cursor: pointer;
465
+ }
466
+
467
+ .request-payment-submit-button:disabled {
468
+ cursor: not-allowed;
469
+ }
470
+
471
+ .request-payment-fractal-powerd-by {
472
+ color: #727272;
473
+ font-size: 14px;
474
+ font-style: normal;
475
+ font-weight: 500;
476
+ margin-top: 16px;
477
+ display: flex;
478
+ text-align: center;
479
+ align-items: center;
480
+ justify-content: center;
481
+ gap: 6px;
482
+ }
483
+
484
+ .request-payment-fractal-powerd-by span {
485
+ color: #61C699;
486
+ }
487
+
488
+ .request-payment-success-container {
489
+ display: flex;
490
+ padding: 120px 48px 32px 48px;
491
+ flex-direction: column;
492
+ justify-content: center;
493
+ align-items: center;
494
+ }
495
+
496
+ .request-payment-success-tick {
497
+ border-radius: 1000px;
498
+ background: rgba(97, 198, 153, 0.14);
499
+ display: flex;
500
+ width: 60px;
501
+ height: 60px;
502
+ justify-content: center;
503
+ align-items: center;
504
+ }
505
+
506
+ .request-payment-success-text {
507
+ color: #161616;
508
+ text-align: center;
509
+ font-size: 32px;
510
+ font-style: normal;
511
+ font-weight: 500;
512
+ line-height: 36px;
513
+ /* 112.5% */
514
+ letter-spacing: -0.64px;
515
+ margin-top: 20px;
516
+ margin-bottom: 5px !important;
517
+ }
518
+
519
+ .request-payment-success-subtext {
520
+ color: #727272;
521
+ text-align: center;
522
+ font-size: 14px;
523
+ font-style: normal;
524
+ font-weight: 500;
525
+ line-height: 18px;
526
+ letter-spacing: -0.28px;
527
+ margin-bottom: 6rem !important;
528
+ margin-top: 8px !important;
529
+ }
530
+
531
+ .request-payment-success-btn-div {
532
+ display: flex;
533
+ align-items: flex-start;
534
+ justify-content: center;
535
+ gap: 8px;
536
+ }
537
+
538
+ .request-payment-success-tick-div {
539
+ display: flex;
540
+ justify-content: center;
541
+ align-items: center;
542
+ margin-top: 32px;
543
+ }
544
+
545
+ .request-payment-success-btn1 {
546
+ cursor: pointer;
547
+ border-radius: 80px;
548
+ border: 1px solid #E0DFE2;
549
+ display: flex;
550
+ padding: 12px 32px;
551
+ justify-content: center;
552
+ align-items: center;
553
+ gap: 6px;
554
+ background-color: #fff;
555
+ }
556
+
557
+ .request-payment-success-btn2 {
558
+ border-radius: 80px;
559
+ cursor: pointer;
560
+ border: 1px solid #E0DFE2;
561
+ display: flex;
562
+ padding: 12px 32px;
563
+ justify-content: center;
564
+ align-items: center;
565
+ gap: 6px;
566
+ background-color: #161616;
567
+ color: #fff;
568
+ font-size: 14px;
569
+ font-style: normal;
570
+ font-weight: 500;
571
+ }
572
+
573
+ .request-payment-error-msg{
574
+ color: #dc3545;
575
+
576
+ font-size: 12px;
577
+ }
578
+
579
+ .frac-req-cash-discount{
580
+ justify-content: center;
581
+ gap: 8px;
582
+ align-items: center;
583
+ display: flex;
584
+ padding: 9px 14px 9px 10px;
585
+ font-family: Inter;
586
+ color: #161616;
587
+ font-style: normal;
588
+ font-weight: 500;
589
+ font-size: 14px;
590
+ }
591
+
592
+ .frac-req-cash-discount .frac-cashlabel{
593
+ color: #727272;
594
+ font-size: 12px;
595
+ font-style: normal;
596
+ font-weight: 500;
597
+ }
598
+
599
+ .partial-toggle-div {
600
+ display: flex;
601
+ align-items: center;
602
+ justify-content: center;
603
+ gap: 12px;
604
+ }
605
+
606
+ .partial-input[type="checkbox"] {
607
+ appearance: none;
608
+ -webkit-appearance: none;
609
+ width: 50px;
610
+ height: 26px;
611
+ background-color: #ccc;
612
+ border-radius: 13px;
613
+ position: relative;
614
+ cursor: pointer;
615
+ transition: background-color 0.3s ease;
616
+ border: none;
617
+ outline: none;
618
+ margin-right: 10px;
619
+ }
620
+
621
+ .partial-input[type="checkbox"]::before {
622
+ content: '';
623
+ position: absolute;
624
+ width: 22px;
625
+ height: 22px;
626
+ border-radius: 50%;
627
+ background-color: white;
628
+ top: 2px;
629
+ left: 2px;
630
+ transition: transform 0.3s ease;
631
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
632
+ }
633
+
634
+ .partial-input[type="checkbox"]:checked {
635
+ background-color: #000000;
636
+ }
637
+
638
+ .partial-input[type="checkbox"]:checked::before {
639
+ transform: translateX(24px);
640
+ }
641
+
642
+ .partial-input[type="checkbox"]:focus {
643
+ box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
644
+ }
645
+
646
+ .partial-label {
647
+ user-select: none;
648
+ font-size: 14px;
649
+ }
650
+ `),zi=$a;var ri=e=>{try{let t=JSON.parse(e);return typeof t=="object"&&t!==null}catch(t){return!1}},oi=[{value:"personal saving",label:"Personal Saving"},{value:"business saving",label:"Business Saving"},{value:"personal checking",label:"Personal Checking"},{value:"business checking",label:"Business Checking"}];function xe(e){let t=Number(e);return isNaN(t)?`$${e}`:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(t)}var ja=ne+"widget/mc-img.svg",Va=ne+"widget/visa-img.svg",Oa=ne+"widget/ae-img.svg",Ka=ne+"widget/discover-img.svg",bi=ne+"widget/card.svg",Za=ne+"widget/bank.svg",ro=ne+"widget/Trash.svg",oo=ne+"widget/secure-img.png",so=ne+"widget/pov-by.png",Ii=ne+"widget/pax.svg",pa=ne+"widget/Bank _New.svg",fa=e=>{switch(e==null?void 0:e.toLowerCase()){case"visa":return Va;case"mastercard":case"mc":case"m/c":return ja;case"amex":case"american express":case"ae":return Oa;case"discover":case"dcvr":return Ka;case"bank":return Za;default:return bi}},Pn=(e,t)=>{let H=e.replace(/\D/g,""),z=e.slice(0,t).replace(/\D/g,"").length,B="",Y="";if(/^3[47]/.test(H)?(B=H.slice(0,15),Y=B.replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(Z,A,G,se)=>[A,G,se].filter(Boolean).join(" "))):(B=H.slice(0,16),Y=B.replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(Z,A,G,se,w)=>[A,G,se,w].filter(Boolean).join(" "))),z===0)return{formatted:Y,cursor:0};let U=Y.length,ve=0;for(let Z=0;Z<Y.length;Z++)if(/\d/.test(Y[Z])&&ve++,ve===z){U=Z+1;break}return{formatted:Y,cursor:U}},In=e=>e==1?!1:(e==0,!0);function Ua(e){let t=e.merchantPublicKey,H=e==null?void 0:e.discount,z=e==null?void 0:e.tax,B=e==null?void 0:e.surcharge,[Y,K]=$n(!1),[U,ve]=$n(!1),[Z,A]=$n({}),[G,se]=$n(null),[w,v]=$n({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:t}),[ee,V]=$n(!1),[y,Se]=$n(void 0),[P,Ue]=$n(""),[Fe,ce]=$n(!1),[_e,ct]=$n(null),Ne=x=>/^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(x),Me=/[+-]?([0-9]*[.])?[0-9]+/,ue=x=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(x),qe=x=>/^[A-Za-z\s]*$/.test(x),$e=(x,f)=>{let k=(parseFloat(f)||0)/100,He=x/(1+k);return Math.round(He*100)/100};ha(()=>{if(e!=null&&e.pass_fee){let x=$e(e==null?void 0:e.amount,e==null?void 0:e.surcharge);Se(x)}},[e==null?void 0:e.pass_fee]);let mn=()=>{K(!1),A({})},Xt=()=>K(!0),h=()=>{console.log(_e,"apiresponse"),u(_e),ce(!1)};function M(){v({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:t}),Ue("")}function u(x){let f={type:"preview.compiledcheck",other:L(C({},x),{status:!0})};window.parent.postMessage(f,"*")}let ge=async x=>{if(x.currentTarget.blur(),!U&&!(Object.keys(Z).length>0)){if(A({}),!(w!=null&&w.email)&&G&&!Ne(G)){A(f=>L(C({},f),{phone:Zt.phonenumbervalid}));return}if(b())try{ve(!0);let f={fractalpayPublicKey:t,amount:P,phone_number:G,order_id:w.order_id,action:"request",name:w.name,email:w.email,customer_id:e!=null&&e.customerId?e==null?void 0:e.customerId:"",discount:H,surcharge:B,tax:z,require_3ds:e==null?void 0:e.require_3ds,pass_fee:e==null?void 0:e.pass_fee,allow_partial:ee},k=await Wa.post(`${Qe}create-widget-order`,f,{headers:C({},(e==null?void 0:e.sessionToken)&&{"X-Session-Token":e.sessionToken})});(k==null?void 0:k.status)===200&&(ce(!0),K(!1),M(),ct(k==null?void 0:k.data)),ve(!1)}catch(f){console.log(f),ve(!1)}}},o=Qe+"images/logo-img.png",r=x=>{let{value:f}=x.target,k=x.target.dataset.token;if(v(L(C({},w),{[k]:f})),k==="name"&&!qe(f)){A(dt=>L(C({},dt),{[k]:Zt.onlylettersallowed}));return}let He=Z;k==="email"&&!G&&(delete He.phone,A(He)),f&&(delete He[k],A(He)),k==="email"&&!f&&(delete He[k],A(He))},a=x=>{let{value:f}=x;if(Number(f)>0){let k=Z;delete k.amount,A(k)}Ue(f)},b=()=>{let x={};return P||(x.amount=Zt.amountrequired),w.email&&!ue(w==null?void 0:w.email)&&(x.email=Zt.invalidemail),!G&&!(w!=null&&w.email)&&(x.phone=Zt.phoneoremailrequired),!G&&!(w!=null&&w.email)&&(x.email=Zt.phoneoremailrequired),!G&&w.email&&!ue(w==null?void 0:w.email)&&(x.email=Zt.invalidemail),e.from==="merchant"&&!w.order_id&&(x.order_id=Zt.orderidrequired),A(x),Object.keys(x).length===0};ha(()=>{e&&(v(x=>L(C({},x),{order_id:e.orderID?e.orderID:"",name:e!=null&&e.name?e==null?void 0:e.name:"",email:e!=null&&e.email?e==null?void 0:e.email:""})),Ue(e.amount?e.amount:""),se(e.phone?`${e.phone}`:null))},[e]);let N=x=>{let f=x==null?void 0:x.value;if(f&&(f==null?void 0:f.length)>0&&(f==null?void 0:f.length)!==10){A(He=>L(C({},He),{phone:Zt.phonenumberlength})),se(f);return}else se(f);let k=Z;delete k.phone,f&&!(w!=null&&w.email)&&delete k.email,A(k)};function F(x){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(x))}let O=x=>{let f=x.target.checked;V(f)};return I.createElement(I.Fragment,null,I.createElement(zi,null),I.createElement(an,{loading:U}),I.createElement(I.Fragment,null,I.createElement("button",{className:"paymentBtn",onClick:Xt},"Request Payment"),I.createElement(yn,{open:Y,onClose:()=>K(!1),maxWidth:"500px"},I.createElement("div",{style:{maxWidth:"500px"}},I.createElement("div",{className:"request-payment-amount-detail frac-form"},I.createElement("p",{className:"request-payment-merchantname"},"Pay ",e==null?void 0:e.webname),I.createElement("p",{className:"request-payment-amount"},F(e==null?void 0:e.amount)),y&&y>0&&I.createElement("div",{className:"frac-req-cash-discount"},I.createElement("div",{className:"frac-cashlabel"},In(e==null?void 0:e.showSurcharge)?"Surcharge":"Cash Discount"," :"),I.createElement("div",null,xe((Number(e.amount)-y).toFixed(2)))),(e==null?void 0:e.from)==="merchant"&&I.createElement("p",{className:"request-payment-orderid"},w==null?void 0:w.order_id),I.createElement("span",{className:"request-payment-close-popup",onClick:mn},I.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},I.createElement("g",{clipPath:"url(#clip0_12425_52336)"},I.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),I.createElement("defs",null,I.createElement("clipPath",{id:"clip0_12425_52336"},I.createElement("rect",{width:"16",height:"16",fill:"white"})))))),I.createElement("form",{className:"request-payment-input-form"},I.createElement("div",{className:"request-payment-list-div"},I.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"FULL NAME"),I.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Full Name","data-token":"name",onChange:r,value:w==null?void 0:w.name}),Z.name&&I.createElement("small",{className:"request-payment-error-msg"},Z.name)),I.createElement("div",{className:"request-payment-list-div"},I.createElement("label",{htmlFor:"requestPhoneNumber",className:"request-payment-input-label"},"Phone Number"),I.createElement(Ga,{className:"request-payment-input-box",placeholder:"Mobile number",format:"+1 (###) ###-####",value:G,onValueChange:x=>{N(x)}}),Z.phone&&I.createElement("small",{className:"request-payment-error-msg"},Z.phone)),I.createElement("div",{className:"request-payment-list-div"},I.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"EMAIL"),I.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Email",onChange:r,"data-token":"email",value:w==null?void 0:w.email}),Z.email&&I.createElement("small",{className:"request-payment-error-msg"},Z.email)),I.createElement("div",{className:"partial-toggle-div"},I.createElement("input",{className:"partial-input",type:"checkbox",role:"switch",style:{cursor:"pointer"},checked:ee,onChange:x=>O(x),id:"partialSwitch"}),I.createElement("label",{className:"partial-label",htmlFor:"partialSwitch",style:{cursor:"pointer"}},"Allow Partial Payments?")),I.createElement("button",{type:"button",className:"request-payment-submit-button",onClick:ge,disabled:U},U?"Loading...":"Send Request"),I.createElement("div",{className:"request-payment-fractal-powerd-by"},I.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},I.createElement("path",{d:"M15.2165 4.11839C15.1973 3.69746 15.1973 3.29567 15.1973 2.89387C15.1973 2.56861 14.9486 2.31988 14.6234 2.31988C12.2317 2.31988 10.4141 1.63109 8.90257 0.157848C8.67298 -0.0526158 8.32858 -0.0526158 8.09898 0.157848C6.58748 1.63109 4.76984 2.31988 2.37821 2.31988C2.05295 2.31988 1.80422 2.56861 1.80422 2.89387C1.80422 3.29567 1.80422 3.69746 1.78508 4.11839C1.70855 8.13632 1.59375 13.6466 8.30945 15.9617L8.50078 16L8.69211 15.9617C15.3887 13.6466 15.293 8.15546 15.2165 4.11839ZM8.04159 9.6861C7.92679 9.78176 7.79286 9.83916 7.63979 9.83916H7.62066C7.46759 9.83916 7.31453 9.76263 7.21887 9.64783L5.43949 7.67713L6.30048 6.91181L7.69719 8.46158L10.7967 5.5151L11.5812 6.35695L8.04159 9.6861Z",fill:"#727272"})),"Secure payments powered by ",I.createElement("span",null,"Fractal"),I.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},I.createElement("path",{d:"M17.4999 5.49758V7.01156C17.4999 7.05924 17.4595 7.09898 17.411 7.09898H12.3516C12.9169 6.54266 13.4781 5.99032 14.0434 5.434C14.0596 5.4181 14.0838 5.41016 14.104 5.41016H17.411C17.4595 5.41016 17.4999 5.44989 17.4999 5.49758Z",fill:"#61C699"}),I.createElement("path",{d:"M12.3462 10.9037V9.29836C12.3462 9.25067 12.3866 9.21094 12.435 9.21094H13.8523C13.929 9.21094 13.9694 9.30631 13.9129 9.35796C13.392 9.87455 12.8711 10.3911 12.3462 10.9037Z",fill:"#61C699"}),I.createElement("path",{d:"M12.4404 9.00523H15.6949C15.7434 9.00523 15.7838 8.96549 15.7838 8.91781V7.40383C15.7838 7.35614 15.7434 7.31641 15.6949 7.31641H12.4404C12.3919 7.31641 12.3516 7.35614 12.3516 7.40383V8.91781C12.3516 8.96549 12.3919 9.00523 12.4404 9.00523Z",fill:"#61C699"}),I.createElement("path",{d:"M10.1581 0.0120725L11.4906 0.77105C11.531 0.794892 11.5471 0.84655 11.5229 0.890261L8.99114 5.20173C8.78521 4.44275 8.57927 3.68775 8.37334 2.92877C8.36527 2.90493 8.3693 2.88109 8.38142 2.86122L10.0329 0.0438621C10.0612 0.000151419 10.1177 -0.0117697 10.1581 0.0120725Z",fill:"#61C699"}),I.createElement("path",{d:"M12.3382 7.10006L10.9289 6.29737C10.8886 6.27353 10.8724 6.22187 10.8966 6.17816L11.6033 4.97015C11.6436 4.9026 11.7446 4.91452 11.7648 4.99002C11.9546 5.69734 12.1484 6.40068 12.3382 7.10006Z",fill:"#61C699"}),I.createElement("path",{d:"M10.7107 6.0771L12.338 3.30345C12.3622 3.26372 12.346 3.20808 12.3057 3.18424L10.9732 2.42526C10.9328 2.40142 10.8763 2.41732 10.852 2.45705L9.22476 5.2307C9.20053 5.27044 9.21669 5.32607 9.25706 5.34991L10.5896 6.10889C10.634 6.13273 10.6865 6.11683 10.7107 6.0771Z",fill:"#61C699"}),I.createElement("path",{d:"M1.66713 3.51237L2.99963 2.75339C3.04001 2.72955 3.09654 2.74544 3.12077 2.78518L5.65251 7.09665C4.88128 6.89399 4.11408 6.69133 3.34285 6.48867C3.31862 6.4847 3.30247 6.4688 3.29036 6.44893L1.63483 3.63158C1.6106 3.58787 1.62271 3.53621 1.66713 3.51237Z",fill:"#61C699"}),I.createElement("path",{d:"M8.99793 5.20018L7.58871 5.99889C7.54833 6.02274 7.4918 6.00684 7.46757 5.9671L6.76095 4.76307C6.72057 4.69552 6.78517 4.61605 6.86189 4.63591C7.57256 4.82268 8.28726 5.00944 8.99793 5.20018Z",fill:"#61C699"}),I.createElement("path",{d:"M7.27986 6.07054L5.6526 3.2969C5.62837 3.25716 5.57588 3.24127 5.53146 3.26511L4.19896 4.02409C4.15858 4.04793 4.14243 4.09959 4.16666 4.1433L5.79392 6.91694C5.81815 6.95668 5.87064 6.97257 5.91506 6.94873L7.24756 6.18975C7.28794 6.16591 7.30409 6.11425 7.27986 6.07054Z",fill:"#61C699"}),I.createElement("path",{d:"M0.5 12.4998V10.9859C0.5 10.9382 0.540379 10.8984 0.588833 10.8984H5.64829C5.08299 11.4548 4.52172 12.0071 3.95642 12.5634C3.94027 12.5793 3.91604 12.5873 3.89585 12.5873H0.588833C0.540379 12.5873 0.5 12.5475 0.5 12.4998Z",fill:"#61C699"}),I.createElement("path",{d:"M5.65129 7.09766V8.70303C5.65129 8.75072 5.61091 8.79045 5.56246 8.79045H4.14516C4.06844 8.79045 4.02806 8.69508 4.08459 8.64343C4.60548 8.12685 5.12637 7.61424 5.65129 7.09766Z",fill:"#61C699"}),I.createElement("path",{d:"M5.55967 8.99609H2.30514C2.25669 8.99609 2.21631 9.03583 2.21631 9.08352V10.5975C2.21631 10.6452 2.25669 10.6849 2.30514 10.6849H5.55967C5.60813 10.6849 5.6485 10.6452 5.6485 10.5975V9.08352C5.6485 9.03583 5.60813 8.99609 5.55967 8.99609Z",fill:"#61C699"}),I.createElement("path",{d:"M7.82638 17.9865L6.49388 17.2276C6.4535 17.2037 6.43735 17.1521 6.46158 17.1083L8.99333 12.7969C9.19926 13.5559 9.40519 14.3109 9.61112 15.0698C9.6192 15.0937 9.61516 15.1175 9.60305 15.1374L7.95155 17.9547C7.91925 17.9985 7.86676 18.0104 7.82638 17.9865Z",fill:"#61C699"}),I.createElement("path",{d:"M5.64795 10.8984L7.05717 11.7011C7.09755 11.725 7.1137 11.7766 7.08947 11.8203L6.38284 13.0283C6.34246 13.0959 6.24152 13.084 6.22133 13.0085C6.02751 12.3012 5.83773 11.5978 5.64795 10.8984Z",fill:"#61C699"}),I.createElement("path",{d:"M7.2739 11.9258L5.64664 14.6994C5.62241 14.7392 5.63856 14.7948 5.67894 14.8187L7.01144 15.5776C7.05182 15.6015 7.10835 15.5856 7.13258 15.5458L8.75984 12.7722C8.78407 12.7325 8.76792 12.6768 8.72754 12.653L7.39504 11.894C7.35062 11.8702 7.29813 11.8861 7.2739 11.9258Z",fill:"#61C699"}),I.createElement("path",{d:"M16.3199 14.4866L14.9874 15.2456C14.947 15.2694 14.8904 15.2535 14.8662 15.2138L12.3345 10.9023C13.1057 11.105 13.8729 11.3077 14.6441 11.5103C14.6684 11.5143 14.6845 11.5302 14.6966 11.5501L16.3481 14.3674C16.3764 14.4111 16.3643 14.4628 16.3199 14.4866Z",fill:"#61C699"}),I.createElement("path",{d:"M8.99121 12.7983L10.4004 11.9956C10.4408 11.9717 10.4973 11.9876 10.5216 12.0274L11.2282 13.2354C11.2686 13.3029 11.204 13.3824 11.1272 13.3625C10.4166 13.1758 9.70188 12.989 8.99121 12.7983Z",fill:"#61C699"}),I.createElement("path",{d:"M10.7077 11.9285L12.3349 14.7021C12.3592 14.7418 12.4117 14.7577 12.4561 14.7339L13.7886 13.9749C13.829 13.9511 13.8451 13.8994 13.8209 13.8557L12.1936 11.0821C12.1694 11.0423 12.1169 11.0264 12.0725 11.0503L10.74 11.8092C10.6996 11.8331 10.6834 11.8847 10.7077 11.9285Z",fill:"#61C699"})))))),I.createElement(yn,{open:Fe,onClose:h,maxWidth:"500px"},I.createElement("div",{className:"fractal-popup-content",style:{padding:"0px",maxWidth:"500px"}},I.createElement("div",{className:"request-payment-success-container"},I.createElement("span",{className:"request-payment-close-popup",onClick:h},I.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},I.createElement("g",{clipPath:"url(#clip0_12425_52336)"},I.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),I.createElement("defs",null,I.createElement("clipPath",{id:"clip0_12425_52336"},I.createElement("rect",{width:"16",height:"16",fill:"white"}))))),I.createElement("div",{className:"request-payment-success-tick-div"},I.createElement("div",{className:"request-payment-success-tick"},I.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},I.createElement("path",{d:"M6.12669 13.9774C5.97396 14.131 5.76558 14.2167 5.54913 14.2167C5.33267 14.2167 5.1243 14.131 4.97157 13.9774L0.359012 9.36408C-0.119671 8.8854 -0.119671 8.10919 0.359012 7.6314L0.936573 7.05369C1.4154 6.57501 2.19072 6.57501 2.6694 7.05369L5.54913 9.93357L13.3306 2.15198C13.8094 1.6733 14.5855 1.6733 15.0634 2.15198L15.641 2.72969C16.1196 3.20837 16.1196 3.98444 15.641 4.46237L6.12669 13.9774Z",fill:"#61C699"})))),I.createElement("h6",{className:"request-payment-success-text"},"The request ",I.createElement("br",null),"was sent"),I.createElement("h6",{className:"request-payment-success-subtext"},"Please wait for the customer to pay"),I.createElement("div",{className:"request-payment-success-btn-div"},I.createElement("button",{onClick:h,className:"request-payment-success-btn2"},"Close")))))))}import"bootstrap/dist/js/bootstrap.bundle.min.js";import j,{useState as Zn,useEffect as Ja}from"react";import Qa from"axios";import{PatternFormat as Xa}from"react-number-format";function Da(e){let t=e.merchantPublicKey,H=e==null?void 0:e.discount,z=e==null?void 0:e.tax,B=e==null?void 0:e.surcharge,[Y,K]=Zn(!1),[U,ve]=Zn(!1),[Z,A]=Zn({}),[G,se]=Zn(null),[w,v]=Zn({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:t}),[ee,V]=Zn(""),[y,Se]=Zn(!1),[P,Ue]=Zn(null),Fe=r=>/^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(r),ce=/[+-]?([0-9]*[.])?[0-9]+/,_e=r=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r),ct=r=>/^[A-Za-z\s]*$/.test(r),Ne=()=>{K(!1),A({})},Me=()=>K(!0),ue=()=>{$e(P),Se(!1)};function qe(){v({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:t}),V("")}function $e(r){let a={type:"preview.compiledcheck",other:L(C({},r),{status:!0})};window.parent.postMessage(a,"*")}let mn=async r=>{if(r.currentTarget.blur(),!U&&!(Object.keys(Z).length>0)){if(A({}),!(w!=null&&w.email)&&G&&!Fe(G)){A(a=>L(C({},a),{phone:Zt.phonenumbervalid}));return}if(u())try{ve(!0);let a={fractalpayPublicKey:t,amount:ee,phone_number:G,order_id:w.order_id,action:"request",name:w.name,email:w.email,customer_id:e!=null&&e.customerId?e==null?void 0:e.customerId:"",discount:H,surcharge:B,tax:z,require_3ds:e==null?void 0:e.require_3ds},b=await Qa.post(`${Qe}send-request-pre-auth-payment`,a,{headers:C({},(e==null?void 0:e.sessionToken)&&{"X-Session-Token":e.sessionToken})});(b==null?void 0:b.status)===200&&(Se(!0),K(!1),qe(),Ue(b==null?void 0:b.data)),ve(!1)}catch(a){console.log(a),ve(!1)}}},Xt=Qe+"images/logo-img.png",h=r=>{let{value:a}=r.target,b=r.target.dataset.token;if(v(L(C({},w),{[b]:a})),b==="name"&&!ct(a)){A(F=>L(C({},F),{[b]:Zt.onlylettersallowed}));return}let N=Z;b==="email"&&!G&&(delete N.phone,A(N)),a&&(delete N[b],A(N)),b==="email"&&!a&&(delete N[b],A(N))},M=r=>{let{value:a}=r;if(Number(a)>0){let b=Z;delete b.amount,A(b)}V(a)},u=()=>{let r={};return ee||(r.amount=Zt.amountrequired),w.email&&!_e(w==null?void 0:w.email)&&(r.email=Zt.invalidemail),!G&&!(w!=null&&w.email)&&(r.phone=Zt.phoneoremailrequired),!G&&!(w!=null&&w.email)&&(r.email=Zt.phoneoremailrequired),!G&&w.email&&!_e(w==null?void 0:w.email)&&(r.email=Zt.invalidemail),e.from==="merchant"&&!w.order_id&&(r.order_id=Zt.orderidrequired),A(r),Object.keys(r).length===0};Ja(()=>{e&&(v(r=>L(C({},r),{order_id:e.orderID?e.orderID:"",name:e!=null&&e.name?e==null?void 0:e.name:"",email:e!=null&&e.email?e==null?void 0:e.email:""})),V(e.amount?e.amount:""),se(e.phone?`${e.phone}`:null))},[e]);let ge=r=>{let a=r==null?void 0:r.value;if(a&&(a==null?void 0:a.length)>0&&(a==null?void 0:a.length)!==10){A(N=>L(C({},N),{phone:Zt.phonenumberlength})),se(a);return}else se(a);let b=Z;delete b.phone,a&&!(w!=null&&w.email)&&delete b.email,A(b)};function o(r){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(r))}return j.createElement(j.Fragment,null,j.createElement(zi,null),j.createElement(an,{loading:U}),j.createElement(j.Fragment,null,j.createElement("button",{className:"paymentBtn",onClick:Me},"Send Request"),j.createElement("div",{className:"frac-form"},j.createElement(yn,{open:Y,onClose:()=>K(!1),maxWidth:"500px"},j.createElement("div",{className:"request-payment-amount-detail"},j.createElement("p",{className:"request-payment-merchantname"},"Authorization Request"),j.createElement("p",{className:"request-payment-pre-auth-merchantname"},"Pay ",e==null?void 0:e.webname),j.createElement("p",{className:"request-payment-amount"},o(e==null?void 0:e.amount)),(e==null?void 0:e.from)==="merchant"&&j.createElement("p",{className:"request-payment-orderid"},w==null?void 0:w.order_id),j.createElement("span",{className:"request-payment-close-popup",onClick:Ne},j.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},j.createElement("g",{clipPath:"url(#clip0_12425_52336)"},j.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),j.createElement("defs",null,j.createElement("clipPath",{id:"clip0_12425_52336"},j.createElement("rect",{width:"16",height:"16",fill:"white"})))))),j.createElement("form",{className:"request-payment-input-form"},j.createElement("div",{className:"request-payment-list-div"},j.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"FULL NAME"),j.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Full Name","data-token":"name",onChange:h,value:w==null?void 0:w.name}),Z.name&&j.createElement("small",{className:"request-payment-error-msg"},Z.name)),j.createElement("div",{className:"request-payment-list-div"},j.createElement("label",{htmlFor:"requestPhoneNumber",className:"request-payment-input-label"},"Phone Number"),j.createElement(Xa,{className:"request-payment-input-box",placeholder:"Mobile number",format:"+1 (###) ###-####",value:G,onValueChange:r=>{ge(r)}}),Z.phone&&j.createElement("small",{className:"request-payment-error-msg"},Z.phone)),j.createElement("div",{className:"request-payment-list-div"},j.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"EMAIL"),j.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Email",onChange:h,"data-token":"email",value:w==null?void 0:w.email}),Z.email&&j.createElement("small",{className:"request-payment-error-msg"},Z.email)),j.createElement("button",{type:"button",className:"request-payment-submit-button",onClick:mn,disabled:U},U?"Loading...":"Send Request"),j.createElement("div",{className:"request-payment-fractal-powerd-by"},j.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},j.createElement("path",{d:"M15.2165 4.11839C15.1973 3.69746 15.1973 3.29567 15.1973 2.89387C15.1973 2.56861 14.9486 2.31988 14.6234 2.31988C12.2317 2.31988 10.4141 1.63109 8.90257 0.157848C8.67298 -0.0526158 8.32858 -0.0526158 8.09898 0.157848C6.58748 1.63109 4.76984 2.31988 2.37821 2.31988C2.05295 2.31988 1.80422 2.56861 1.80422 2.89387C1.80422 3.29567 1.80422 3.69746 1.78508 4.11839C1.70855 8.13632 1.59375 13.6466 8.30945 15.9617L8.50078 16L8.69211 15.9617C15.3887 13.6466 15.293 8.15546 15.2165 4.11839ZM8.04159 9.6861C7.92679 9.78176 7.79286 9.83916 7.63979 9.83916H7.62066C7.46759 9.83916 7.31453 9.76263 7.21887 9.64783L5.43949 7.67713L6.30048 6.91181L7.69719 8.46158L10.7967 5.5151L11.5812 6.35695L8.04159 9.6861Z",fill:"#727272"})),"Secure payments powered by ",j.createElement("span",null,"Fractal"),j.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},j.createElement("path",{d:"M17.4999 5.49758V7.01156C17.4999 7.05924 17.4595 7.09898 17.411 7.09898H12.3516C12.9169 6.54266 13.4781 5.99032 14.0434 5.434C14.0596 5.4181 14.0838 5.41016 14.104 5.41016H17.411C17.4595 5.41016 17.4999 5.44989 17.4999 5.49758Z",fill:"#61C699"}),j.createElement("path",{d:"M12.3462 10.9037V9.29836C12.3462 9.25067 12.3866 9.21094 12.435 9.21094H13.8523C13.929 9.21094 13.9694 9.30631 13.9129 9.35796C13.392 9.87455 12.8711 10.3911 12.3462 10.9037Z",fill:"#61C699"}),j.createElement("path",{d:"M12.4404 9.00523H15.6949C15.7434 9.00523 15.7838 8.96549 15.7838 8.91781V7.40383C15.7838 7.35614 15.7434 7.31641 15.6949 7.31641H12.4404C12.3919 7.31641 12.3516 7.35614 12.3516 7.40383V8.91781C12.3516 8.96549 12.3919 9.00523 12.4404 9.00523Z",fill:"#61C699"}),j.createElement("path",{d:"M10.1581 0.0120725L11.4906 0.77105C11.531 0.794892 11.5471 0.84655 11.5229 0.890261L8.99114 5.20173C8.78521 4.44275 8.57927 3.68775 8.37334 2.92877C8.36527 2.90493 8.3693 2.88109 8.38142 2.86122L10.0329 0.0438621C10.0612 0.000151419 10.1177 -0.0117697 10.1581 0.0120725Z",fill:"#61C699"}),j.createElement("path",{d:"M12.3382 7.10006L10.9289 6.29737C10.8886 6.27353 10.8724 6.22187 10.8966 6.17816L11.6033 4.97015C11.6436 4.9026 11.7446 4.91452 11.7648 4.99002C11.9546 5.69734 12.1484 6.40068 12.3382 7.10006Z",fill:"#61C699"}),j.createElement("path",{d:"M10.7107 6.0771L12.338 3.30345C12.3622 3.26372 12.346 3.20808 12.3057 3.18424L10.9732 2.42526C10.9328 2.40142 10.8763 2.41732 10.852 2.45705L9.22476 5.2307C9.20053 5.27044 9.21669 5.32607 9.25706 5.34991L10.5896 6.10889C10.634 6.13273 10.6865 6.11683 10.7107 6.0771Z",fill:"#61C699"}),j.createElement("path",{d:"M1.66713 3.51237L2.99963 2.75339C3.04001 2.72955 3.09654 2.74544 3.12077 2.78518L5.65251 7.09665C4.88128 6.89399 4.11408 6.69133 3.34285 6.48867C3.31862 6.4847 3.30247 6.4688 3.29036 6.44893L1.63483 3.63158C1.6106 3.58787 1.62271 3.53621 1.66713 3.51237Z",fill:"#61C699"}),j.createElement("path",{d:"M8.99793 5.20018L7.58871 5.99889C7.54833 6.02274 7.4918 6.00684 7.46757 5.9671L6.76095 4.76307C6.72057 4.69552 6.78517 4.61605 6.86189 4.63591C7.57256 4.82268 8.28726 5.00944 8.99793 5.20018Z",fill:"#61C699"}),j.createElement("path",{d:"M7.27986 6.07054L5.6526 3.2969C5.62837 3.25716 5.57588 3.24127 5.53146 3.26511L4.19896 4.02409C4.15858 4.04793 4.14243 4.09959 4.16666 4.1433L5.79392 6.91694C5.81815 6.95668 5.87064 6.97257 5.91506 6.94873L7.24756 6.18975C7.28794 6.16591 7.30409 6.11425 7.27986 6.07054Z",fill:"#61C699"}),j.createElement("path",{d:"M0.5 12.4998V10.9859C0.5 10.9382 0.540379 10.8984 0.588833 10.8984H5.64829C5.08299 11.4548 4.52172 12.0071 3.95642 12.5634C3.94027 12.5793 3.91604 12.5873 3.89585 12.5873H0.588833C0.540379 12.5873 0.5 12.5475 0.5 12.4998Z",fill:"#61C699"}),j.createElement("path",{d:"M5.65129 7.09766V8.70303C5.65129 8.75072 5.61091 8.79045 5.56246 8.79045H4.14516C4.06844 8.79045 4.02806 8.69508 4.08459 8.64343C4.60548 8.12685 5.12637 7.61424 5.65129 7.09766Z",fill:"#61C699"}),j.createElement("path",{d:"M5.55967 8.99609H2.30514C2.25669 8.99609 2.21631 9.03583 2.21631 9.08352V10.5975C2.21631 10.6452 2.25669 10.6849 2.30514 10.6849H5.55967C5.60813 10.6849 5.6485 10.6452 5.6485 10.5975V9.08352C5.6485 9.03583 5.60813 8.99609 5.55967 8.99609Z",fill:"#61C699"}),j.createElement("path",{d:"M7.82638 17.9865L6.49388 17.2276C6.4535 17.2037 6.43735 17.1521 6.46158 17.1083L8.99333 12.7969C9.19926 13.5559 9.40519 14.3109 9.61112 15.0698C9.6192 15.0937 9.61516 15.1175 9.60305 15.1374L7.95155 17.9547C7.91925 17.9985 7.86676 18.0104 7.82638 17.9865Z",fill:"#61C699"}),j.createElement("path",{d:"M5.64795 10.8984L7.05717 11.7011C7.09755 11.725 7.1137 11.7766 7.08947 11.8203L6.38284 13.0283C6.34246 13.0959 6.24152 13.084 6.22133 13.0085C6.02751 12.3012 5.83773 11.5978 5.64795 10.8984Z",fill:"#61C699"}),j.createElement("path",{d:"M7.2739 11.9258L5.64664 14.6994C5.62241 14.7392 5.63856 14.7948 5.67894 14.8187L7.01144 15.5776C7.05182 15.6015 7.10835 15.5856 7.13258 15.5458L8.75984 12.7722C8.78407 12.7325 8.76792 12.6768 8.72754 12.653L7.39504 11.894C7.35062 11.8702 7.29813 11.8861 7.2739 11.9258Z",fill:"#61C699"}),j.createElement("path",{d:"M16.3199 14.4866L14.9874 15.2456C14.947 15.2694 14.8904 15.2535 14.8662 15.2138L12.3345 10.9023C13.1057 11.105 13.8729 11.3077 14.6441 11.5103C14.6684 11.5143 14.6845 11.5302 14.6966 11.5501L16.3481 14.3674C16.3764 14.4111 16.3643 14.4628 16.3199 14.4866Z",fill:"#61C699"}),j.createElement("path",{d:"M8.99121 12.7983L10.4004 11.9956C10.4408 11.9717 10.4973 11.9876 10.5216 12.0274L11.2282 13.2354C11.2686 13.3029 11.204 13.3824 11.1272 13.3625C10.4166 13.1758 9.70188 12.989 8.99121 12.7983Z",fill:"#61C699"}),j.createElement("path",{d:"M10.7077 11.9285L12.3349 14.7021C12.3592 14.7418 12.4117 14.7577 12.4561 14.7339L13.7886 13.9749C13.829 13.9511 13.8451 13.8994 13.8209 13.8557L12.1936 11.0821C12.1694 11.0423 12.1169 11.0264 12.0725 11.0503L10.74 11.8092C10.6996 11.8331 10.6834 11.8847 10.7077 11.9285Z",fill:"#61C699"}))))),j.createElement(yn,{open:y,onClose:ue,maxWidth:"500px"},j.createElement("div",{className:"fractal-popup-content",style:{padding:"0px",maxWidth:"500px"}},j.createElement("div",{className:"request-payment-success-container"},j.createElement("span",{className:"request-payment-close-popup",onClick:ue},j.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},j.createElement("g",{clipPath:"url(#clip0_12425_52336)"},j.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),j.createElement("defs",null,j.createElement("clipPath",{id:"clip0_12425_52336"},j.createElement("rect",{width:"16",height:"16",fill:"white"}))))),j.createElement("div",{className:"request-payment-success-tick-div"},j.createElement("div",{className:"request-payment-success-tick"},j.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},j.createElement("path",{d:"M6.12669 13.9774C5.97396 14.131 5.76558 14.2167 5.54913 14.2167C5.33267 14.2167 5.1243 14.131 4.97157 13.9774L0.359012 9.36408C-0.119671 8.8854 -0.119671 8.10919 0.359012 7.6314L0.936573 7.05369C1.4154 6.57501 2.19072 6.57501 2.6694 7.05369L5.54913 9.93357L13.3306 2.15198C13.8094 1.6733 14.5855 1.6733 15.0634 2.15198L15.641 2.72969C16.1196 3.20837 16.1196 3.98444 15.641 4.46237L6.12669 13.9774Z",fill:"#61C699"})))),j.createElement("h6",{className:"request-payment-success-text"},"The request ",j.createElement("br",null),"was sent"),j.createElement("h6",{className:"request-payment-success-subtext"},"Please wait for the customer to pay"),j.createElement("div",{className:"request-payment-success-btn-div"},j.createElement("button",{onClick:ue,className:"request-payment-success-btn2"},"Close"))))))))}import i,{useEffect as ba,useState as Bt}from"react";import Ra from"react";function Xn(){let e="#000",t="#fff",H="#212529",z="#dee2e6";return Ra.createElement("style",null,`
651
+ @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
652
+ body
653
+ {
654
+ font-family: 'Inter', sans-serif !important;
655
+ }
656
+ input
657
+ {
658
+ font-family: 'Inter', sans-serif !important;
659
+ }
660
+ .frac-form .form-group{
661
+ margin:0 !important
662
+ }
663
+ .frac-form .mb-4{
664
+ margin-bottom : 10px !important
665
+ }
666
+ .frac-form .save-ach-div{
667
+ display:flex !important;
668
+ gap:5px !important;
669
+ align-items:center
670
+ }
671
+
672
+ .frac-form .card-cvv-in{
673
+ height : 36px !importantt;
674
+ }
675
+
676
+ .frac-form .pay-payment-amount{
677
+ text-align:start !important
678
+ }
679
+ .frac-form .pay-amount{
680
+ text-align:start !important
681
+ }
682
+ .frac-form .pay-main-logo{
683
+ text-align:start !important
684
+ }
685
+
686
+
687
+
688
+ .paymentBtn {
689
+ background-color: black;
690
+ border: none;
691
+ color: white;
692
+ padding: 15px 32px;
693
+ text-align: center;
694
+ text-decoration: none;
695
+ display: inline-block;
696
+ font-size: 16px;
697
+ margin: 4px 2px;
698
+ cursor: pointer;
699
+ border-radius: 180px;
700
+ /* width: auto; */
701
+ }
702
+
703
+ .main-logo {
704
+ text-align: center;
705
+ margin-bottom: 20px;
706
+ }
707
+
708
+ .main-logo img {
709
+ max-width: 180px;
710
+ }
711
+
712
+ .pay-main-box {
713
+ width: 365px !important;
714
+ height: 93%;
715
+ background: 0 0 #ffffff;
716
+ border-radius: 12px;
717
+
718
+
719
+ border: 1px solid #E0DFE2;
720
+ margin: 0 auto;
721
+ display: block;
722
+ padding: 0px 26px !important
723
+ }
724
+ .pay-main-box .pay-header {
725
+ display: flex;
726
+ justify-content: center;
727
+ align-items: center;
728
+ text-align: center;
729
+ }
730
+
731
+ .pay-main-box .pay-header button {
732
+ border: 0;
733
+ background: none;
734
+ padding: 0;
735
+ box-shadow: 0;
736
+ outline: inherit;
737
+ }
738
+
739
+ .pay-main-box h1 {
740
+ margin: 0;
741
+ flex: 1;
742
+ padding: 10px 0;
743
+ font-size: 23px;
744
+ font-weight: 500;
745
+ color: #35254D;
746
+ align-items: start;
747
+ display: flex;
748
+ }
749
+ .tab {
750
+ overflow: hidden;
751
+ padding: 5px;
752
+ border-radius: 8px;
753
+ display: flex;
754
+ justify-content: space-around;
755
+ margin-bottom:12px
756
+ }
757
+
758
+ /* Style the buttons inside the tab */
759
+ .tab button {
760
+ float: left;
761
+ border: none;
762
+ outline: none;
763
+ cursor: pointer;
764
+ background:white;
765
+ padding: 11px 16px;
766
+ transition: 0.3s;
767
+ font-size: 16px;
768
+ width: 143px;
769
+ border-radius: 5px;
770
+ box-shadow: inherit;
771
+ outline: none;
772
+ color: ${e};
773
+ }
774
+
775
+ /* Change background color of buttons on hover */
776
+ .tab button:hover {
777
+ background-color: #f0f0f0;
778
+ }
779
+
780
+ /* Create an active/current tablink class */
781
+ // .tab button.active {
782
+ // background-color: #ccc;
783
+ // }
784
+
785
+ /* Style the tab content */
786
+
787
+
788
+ .parent-pay-container{
789
+ padding: 24px;
790
+ }
791
+ .pay-container{
792
+ display: grid;
793
+ grid-template-columns: 2fr 3fr;
794
+
795
+ }
796
+ .pay-main{
797
+ padding-y: 20px}
798
+
799
+ .request-payment-close-popup {
800
+ position: absolute;
801
+ right: 20px;
802
+ top: 20px;
803
+ cursor: pointer;
804
+ }
805
+ .pay-conatiner-one{
806
+ border-right: 1px solid #E0DFE2;
807
+ }
808
+ .pay-conatiner-one-first{
809
+ min-height:530px
810
+ }
811
+ .pay-conatiner-one-last{
812
+ display:flex;
813
+ font-size:12px;
814
+ gap:5px;
815
+ max-width:250px;
816
+ align-items:center;
817
+ color:black !important
818
+ }
819
+ .pay-conatiner-one-last img{
820
+ width : 17px;
821
+ height:17px
822
+ }
823
+ .pay-conatiner-two{
824
+ padding: 0 5% 0;
825
+ }
826
+ .pay-logo-container{
827
+ border-bottom: 1px solid #E0DFE2
828
+ }
829
+ .pay-heading{
830
+ margin: 0;
831
+ flex: 1;
832
+ padding: 10px 0;
833
+ font-size: 23px;
834
+ font-weight: 500;
835
+ color: #35254D;
836
+ align-items: start;
837
+ display: flex;
838
+ }
839
+ .pay-main-logo > img{
840
+ width: 50%;
841
+ }
842
+ .pay-main-logo-res > img{
843
+ width: 50%;
844
+ display : none
845
+ }
846
+
847
+ .pay-payment-amount{
848
+ display: block;
849
+ font-size: 12px;
850
+ color: #727272;
851
+ margin-bottom: 8px;
852
+ }
853
+ .pay-amount-conatiner{
854
+ margin-top: 6%;
855
+ }
856
+ .pay-amount{
857
+ color: #000000;
858
+ font-size: 38px;
859
+ display: block;
860
+ line-height: 110%;
861
+ letter-spacing: -1px;
862
+ }
863
+ .frac-form label{
864
+ font-family: 'IBM Plex Mono', monospace !important;
865
+ color: #727272 !important;
866
+ margin-bottom: 2px !important;
867
+ font-weight: 600 !important;
868
+ font-size: 12px !important;
869
+ display:block !important;
870
+ text-align : left !important
871
+ }
872
+ .form-control{
873
+ display: block;
874
+ width: 100%;
875
+ padding: .375rem .75rem;
876
+ font-size: 1rem;
877
+ font-weight: 400;
878
+ line-height: 1.5;
879
+ color: ${H};
880
+ -webkit-appearance: none;
881
+ -moz-appearance: none;
882
+ appearance: none;
883
+ background-color: ${t};
884
+ background-clip: padding-box;
885
+ border: 1px solid ${z};
886
+ border-radius: 0.375rem;
887
+ transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
888
+ }
889
+ .form-control:focus{
890
+ border-color: #86b7fe;
891
+ outline: 0;
892
+ }
893
+ .toggle-num-wrapper {
894
+ position: relative;
895
+ }
896
+ .card-number-new{
897
+ border-bottom: none;
898
+ border-bottom-left-radius: 0px;
899
+ border-bottom-right-radius: 0px;
900
+ }
901
+ .card-crdi {
902
+ display: flex;
903
+ border: 1px solid ${z};
904
+ border-radius: 0.375rem;
905
+ }
906
+ .card-expiry-new{
907
+ border-top-left-radius: 0px;
908
+ border-top-right-radius: 0px;
909
+ }
910
+ .exp-date-year-container{
911
+ display: flex;
912
+ flex-wrap: wrap;
913
+ }
914
+ .exp-date-year-container .form-group{
915
+ flex:1;
916
+
917
+ }
918
+
919
+ .exp-date {
920
+ float: left;
921
+ // width: 30%
922
+ }
923
+
924
+ .exp-date input {
925
+ width: calc(100% + 1px);
926
+ border-top-right-radius: 0;
927
+ border-bottom-right-radius: 0;
928
+ border: 0;
929
+ border-right: 1px solid ${z};
930
+ }
931
+
932
+
933
+ .exp-year {
934
+ float: left;
935
+ // width: 30%
936
+ }
937
+
938
+ .exp-year input {
939
+ width: calc(100% + 1px);
940
+ border-radius: 0;
941
+ border-top: 0;
942
+ border-bottom: 0;
943
+ border-right: 1px solid ${z};
944
+ }
945
+
946
+ .exp-date input:focus {
947
+ position: relative;
948
+ z-index: 10;
949
+ }
950
+
951
+ .security-digit {
952
+ float: right;
953
+ // width: 40%;
954
+ position: relative;
955
+ }
956
+
957
+ .security-digit input {
958
+ border-top-left-radius: 0;
959
+ border-bottom-left-radius: 0;
960
+ border-top: 0;
961
+ border-bottom: 0;
962
+ border-right:0;
963
+ }
964
+ .card-expiry-new{
965
+ border-top-left-radius: 0px;
966
+ border-top-right-radius: 0px;
967
+ }
968
+ .form-control{box-sizing: border-box ;}
969
+ #PaymentForm .form-group{
970
+ padding:5px 0 ;
971
+ matgin: 0 !important
972
+ }
973
+
974
+ .toggle-label {
975
+ position: relative;
976
+ display: inline-block;
977
+ width: 40px;
978
+ height: 24px;
979
+ background-color: #ccc;
980
+ border-radius: 12px;
981
+ cursor: pointer;
982
+ transition: background-color 0.3s;
983
+ }
984
+
985
+ .toggle-label::before {
986
+ content: "";
987
+ position: absolute;
988
+ top: 2px;
989
+ left: 2px;
990
+ width: 20px;
991
+ height: 20px;
992
+ background: #ffffff;
993
+ border-radius: 50%;
994
+ transition: left 300ms linear;
995
+ }
996
+
997
+ .toggle-checkbox {
998
+ display: none;
999
+ }
1000
+
1001
+ .toggle-checkbox:checked + .toggle-label {
1002
+ background-color: #4caf50;
1003
+ }
1004
+
1005
+ .toggle-checkbox:checked + .toggle-label::before {
1006
+ left: 18px;
1007
+ }
1008
+ .ach-scrl {
1009
+ max-height: 380px;
1010
+ min-height: 380px;
1011
+ overflow-y: auto;
1012
+ padding-right: 6px;
1013
+ }
1014
+ .mb-4{
1015
+ margin-bottom:4px
1016
+ }
1017
+ .ach-scrl::-webkit-scrollbar {
1018
+ width: 3px;
1019
+ background-color: #F5F5F5;
1020
+ }
1021
+ .ach-scrl::-webkit-scrollbar-thumb {
1022
+ background-color: #35254D;
1023
+ }
1024
+
1025
+ .error-span{
1026
+ color:red !important;
1027
+ font-size:12px !important;
1028
+ text-align: left !important;
1029
+ width: 100% !important;
1030
+ display: block;
1031
+ }
1032
+
1033
+ .charge-customer-name{
1034
+ color: #161616;
1035
+ font-family: Inter;
1036
+ font-size: 24px;
1037
+ font-style: normal;
1038
+ font-weight: 600;
1039
+ line-height: 32px;
1040
+ letter-spacing: -0.48px;
1041
+ text-transform: capitalize;
1042
+ margin-top:0;
1043
+ margin-bottom:16px !important;
1044
+ text-align:left !important
1045
+ }
1046
+ .card-ach-heading {
1047
+ color: #727272;
1048
+ font-family: Inter;
1049
+ font-size: 12px;
1050
+ font-style: normal;
1051
+ font-weight: 500;
1052
+ line-height: 18px;
1053
+ letter-spacing: -0.24px;
1054
+ margin : 0 0 10px !important;
1055
+ text-align : left
1056
+ }
1057
+ .card-list-div{
1058
+ max-height : 190px;
1059
+ overflow-y : auto;
1060
+ border:1px solid #E0DFE2;
1061
+ border-radius : 8px
1062
+ }
1063
+
1064
+
1065
+ .card-list-div::-webkit-scrollbar{
1066
+ width:2px;
1067
+ background-color:#F5F5F5
1068
+ }
1069
+ .card-list-div::-webkit-scrollbar-thumb{
1070
+ background-color:#35254D
1071
+ }
1072
+
1073
+ .card-list-single-div{
1074
+ border-bottom: 1px solid #E0DFE2;
1075
+ padding : 8px 11px;
1076
+ display : flex ;
1077
+ align-items:center;
1078
+ justify-content : space-between;
1079
+ gap:12px
1080
+ }
1081
+ .card-list-single-div:last-child {
1082
+ border-bottom: none;
1083
+ }
1084
+ .card-lint-div-in{
1085
+ min-height:444px}
1086
+ .card-number-radio{
1087
+ display:flex;
1088
+ gap:12px;
1089
+ }
1090
+ .card-number-radio .card-number-last-four{
1091
+ color:#161616 !important;
1092
+ font-family:Inter !important;
1093
+ font-size:14px !important;
1094
+ font-weight:500 !important;
1095
+ font-style:normal !important;
1096
+ line-height : 18px !important;
1097
+ latter-spacing:-0.18px !important
1098
+ }
1099
+ .card-expiry-date{
1100
+ margin:0;
1101
+ color:#00000080;
1102
+ font-family:Inter;
1103
+ font-size:14px;
1104
+ font-weight:500;
1105
+ font-style"normal;
1106
+ line-height : 18px;
1107
+ latter-spacing:-0.18px
1108
+ }
1109
+ .pay-with-other-card {
1110
+ margin-top : 12px;
1111
+ padding:12px 32px;
1112
+ border :1px solid #E0DFE2;
1113
+ border-radius : 1000px;
1114
+ display: flex;
1115
+ justify-content : center;
1116
+ align-items:center;
1117
+ gap:10px;
1118
+ // width:100%;
1119
+ background:white;
1120
+ cursor:pointer;
1121
+ color:#161616;
1122
+ text-align:center
1123
+ font-family: Inter;
1124
+ font-size: 14px;
1125
+ font-style: normal;
1126
+ font-weight: 500;
1127
+ line-height: 24px;
1128
+ letter-spacing: -0.28px;
1129
+ // margin-bottom: 50px;
1130
+ }
1131
+ .charge-payment-back-btn {
1132
+ display: flex;
1133
+ padding: 5px 10px;
1134
+ align-items: center;
1135
+ gap: 6px;
1136
+ border-radius: 1000px;
1137
+ border: 1px solid #E0DFE2;
1138
+ background: #FFF;
1139
+ box-shadow: 0px 6px 12px 0px rgba(206, 197, 221, 0.31);
1140
+ font-size:16px;
1141
+ cursor:pointer;
1142
+ color:black
1143
+ }
1144
+ .res-charge-payment-back-btn{
1145
+ padding: 9px 16px;
1146
+ align-items: center;
1147
+ gap: 6px;
1148
+ margin-bottom: 20px;
1149
+ border-radius: 1000px;
1150
+ border: 1px solid #E0DFE2;
1151
+ background: #FFF;
1152
+ box-shadow: 0px 6px 12px 0px rgba(206, 197, 221, 0.31);
1153
+ font-size:16px;
1154
+ curso:pointer;
1155
+ color:black;
1156
+ display:none
1157
+ }
1158
+ .btn {
1159
+ padding: 11px 23px;
1160
+ background-color: black;
1161
+ color: white;
1162
+ border: none;
1163
+ border-radius: 6px;
1164
+ font-weight: bold;
1165
+ margin: 0 10px;
1166
+ cursor: pointer;
1167
+ }
1168
+
1169
+ .custom-swal-icon {
1170
+ margin: 20px auto;
1171
+ }
1172
+
1173
+ .custom-swal-popup {
1174
+ font-size: 16px;
1175
+ text-align: center;
1176
+ }
1177
+
1178
+ .frac-form .res-pay-con{
1179
+ display:none
1180
+ }
1181
+
1182
+ .frac-cash-discount{
1183
+ border-radius: 8px;
1184
+ background: #F6F6F7;
1185
+ justify-content: space-between;
1186
+ align-items: center;
1187
+ display: flex;
1188
+ padding: 9px 14px 9px 10px;
1189
+ font-family: Inter;
1190
+ color: #161616;
1191
+ font-style: normal;
1192
+ font-weight: 500;
1193
+ font-size: 14px;
1194
+ margin: 12px 0;
1195
+ }
1196
+ .frac-cash-discount .frac-cashlabel{
1197
+ color: #727272;
1198
+ font-size: 12px;
1199
+ font-style: normal;
1200
+ font-weight: 500;
1201
+ }
1202
+
1203
+ frac-tooltip-wrapper {
1204
+ position: absolute;
1205
+ right:0;
1206
+ }
1207
+
1208
+ .frac-tooltip-icon {
1209
+ cursor: pointer;
1210
+ }
1211
+ .frac-tooltip-mn{
1212
+ position:relative;
1213
+ }
1214
+ .frac-tooltip-text {
1215
+ display: none;
1216
+ position: absolute;
1217
+ top:-15px;
1218
+ right: 22px;
1219
+ background: #161616;
1220
+ color: white;
1221
+ padding: 15px;
1222
+ border-radius: 10px;
1223
+ width: 200px;
1224
+ font-size:12px;
1225
+ word-break: break-word;
1226
+ white-space: normal;
1227
+ z-index: 999;
1228
+ }
1229
+
1230
+ .frac-tooltip-wrapper:hover .frac-tooltip-text {
1231
+ display: block;
1232
+ }
1233
+
1234
+ .frac-tooltip-text p,.frac-tooltip-text b {
1235
+ font-size : 12px !important;
1236
+ line-height : 1.5 !important;
1237
+ margin-bottom : 10px !important;
1238
+ }
1239
+
1240
+ @media (max-width: 768px) {
1241
+ .parent-pay-container{
1242
+ padding: 20px 5%;
1243
+ }
1244
+ .pay-container {
1245
+ grid-template-columns: 1fr;
1246
+ padding: 10px 5%;
1247
+ border:1px solid #E0DFE2;
1248
+ border-radius : 12px;
1249
+ gap:24px;
1250
+ }
1251
+ .pay-conatiner-one{
1252
+ border-right: none;
1253
+ }
1254
+ .pay-conatiner-one-first{
1255
+ min-height:0
1256
+ }
1257
+ .pay-main-logo > img{
1258
+ display: none;
1259
+ }
1260
+ .pay-main-logo-res > img {
1261
+ display:block;
1262
+ margin:auto
1263
+ }
1264
+
1265
+ .pay-logo-container{
1266
+ border :none
1267
+ }
1268
+ // .res-charge-payment-back-btn {
1269
+ // display:flex !important
1270
+ // }
1271
+ // .charge-payment-back-btn{
1272
+ // display:none !important
1273
+ // }
1274
+ .fractal-popup-content{
1275
+ width: 90%;
1276
+ }
1277
+ // .frac-form .res-pay-con{
1278
+ // display:flex;
1279
+ // justify-content :space-between;
1280
+ // align-items:center;
1281
+ // padding-bottom : 10px
1282
+ // }
1283
+ // .frac-form .amt-pay-con{
1284
+ // display:none
1285
+ // }
1286
+ .pay-conatiner-one-last{
1287
+ display:none}
1288
+ .pay-conatiner-two{
1289
+ padding:0
1290
+ }
1291
+
1292
+
1293
+ }
1294
+ .amt-pay-con {
1295
+ padding-right: 24px;
1296
+ }
1297
+ @media (max-width : 512px){
1298
+ .tab button {
1299
+ padding: 6px 16px;
1300
+ }
1301
+ .amt-pay-con {
1302
+ padding-right: 0;
1303
+ }
1304
+ }
1305
+
1306
+
1307
+ .frac-cash-discount-fee {
1308
+ display: flex;
1309
+ padding: 11px;
1310
+ justify-content: space-between;
1311
+ align-items: center;
1312
+ align-self: stretch;
1313
+ border-radius: 8px;
1314
+ border: 1px solid #E0DFE2;
1315
+ background: #F6F6F7;
1316
+ margin-top: 24px;
1317
+ }
1318
+ .frac-cash-discount-fee small {
1319
+ color:#727272;
1320
+ font-size: 12px;
1321
+ font-weight: 500;
1322
+ }
1323
+ .frac-cash-discount-fee p{
1324
+ margin:0px;
1325
+ font-size: 14px;
1326
+ font-weight: 500;
1327
+ }
1328
+ .frac-card-payment-heading {
1329
+ font-size: 24px;
1330
+ font-style: normal;
1331
+ font-weight: 600;
1332
+ margin:0px;
1333
+ }
1334
+ .exp-date-year-container .form-group {
1335
+ padding: 0px !important;
1336
+ }
1337
+ .frac-heading-card-wrap {
1338
+ display: flex;
1339
+ align-items: center;
1340
+ margin-bottom:12px;
1341
+ }
1342
+ .frac-backarrow {
1343
+ margin-right: 10px;
1344
+ }
1345
+ .frac-charge-payment-back-btn-wrap , .frac-tab-2{
1346
+ display: none;
1347
+ }
1348
+ .frac-pay-conatiner-one{
1349
+ display: flex;
1350
+ flex-direction: column;
1351
+ justify-content: space-between;
1352
+ min-height: auto;
1353
+ }
1354
+
1355
+ .frac-partial-payment-input{
1356
+ margin-top: 12px !important;
1357
+ }
1358
+
1359
+ `)}import si from"axios";import xt from"react";import er from"react";function Vi(){return er.createElement("style",null,`
1360
+ @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
1361
+
1362
+ body{
1363
+ display: flex;
1364
+ justify-content: center;
1365
+ align-items: center;
1366
+ padding-top: 30px;
1367
+ margin: 0;
1368
+ /* background-color: #f8f9fa; */
1369
+ flex-direction: column;
1370
+ }
1371
+ .payment-msg-container{
1372
+ min-height : 550px
1373
+ }
1374
+
1375
+ .logo-container {
1376
+ display: flex;
1377
+ justify-content: center;
1378
+ align-items: center;
1379
+ margin-bottom: -50px; /* Adjust this to overlap the content */
1380
+ z-index: 10;
1381
+ }
1382
+
1383
+ .client-logo {
1384
+ max-width: 100px;
1385
+ height: auto;
1386
+ object-fit: contain;
1387
+ display: block;
1388
+ }
1389
+
1390
+ .payment-success-container {
1391
+ display: flex;
1392
+ flex-direction: column;
1393
+ align-items: center;
1394
+ padding: 18px 20px 24px;
1395
+ width: 335px;
1396
+ height: 400px; /* Fixed height */
1397
+ background: #ffffff;
1398
+ border-radius: 12px;
1399
+ position: relative;
1400
+ /* box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
1401
+ border: 1px solid #e3e3e3; */
1402
+ justify-content: center;
1403
+ text-align: center;
1404
+ margin-top: 50px; /* Adjust this to move the content down */
1405
+ }
1406
+
1407
+ .success-icon {
1408
+ display: flex;
1409
+ flex-direction: column;
1410
+ align-items: center;
1411
+ gap: 12px;
1412
+ width: 227px;
1413
+ height: 116px;
1414
+ z-index: 2;
1415
+ }
1416
+
1417
+ .circle {
1418
+ width: 40px;
1419
+ height: 40px;
1420
+ border: 1px solid #49b182;
1421
+ border-radius: 50%;
1422
+ display: flex;
1423
+ justify-content: center;
1424
+ align-items: center;
1425
+ }
1426
+
1427
+ .circle .fa-check-circle {
1428
+ font-size: 20px;
1429
+ color: #49b182;
1430
+ }
1431
+
1432
+ .success-text {
1433
+ display: flex;
1434
+ flex-direction: column;
1435
+ justify-content: center;
1436
+ align-items: center;
1437
+ gap: 4px;
1438
+ width: 227px;
1439
+ }
1440
+
1441
+ .payment-success-text {
1442
+ font-family: "Inter", sans-serif;
1443
+ font-weight: 500;
1444
+ font-size: 18px;
1445
+ line-height: 21px;
1446
+ text-align: center;
1447
+ letter-spacing: -0.02em;
1448
+ color: #161616;
1449
+ }
1450
+
1451
+ .thank-you-text {
1452
+ font-family: "Inter", sans-serif;
1453
+ font-weight: 500;
1454
+ font-size: 14px;
1455
+ line-height: 18px;
1456
+ text-align: center;
1457
+ letter-spacing: -0.02em;
1458
+ color: #161616;
1459
+ opacity: 0.5;
1460
+ }
1461
+
1462
+ .charge-payment-success-tick-div {
1463
+ display: flex;
1464
+ justify-content: center;
1465
+ align-items: center;
1466
+ margin-top: 32px;
1467
+ }
1468
+ .charge-payment-success-tick {
1469
+ border-radius: 1000px;
1470
+ background: rgba(97, 198, 153, 0.14);
1471
+ display: flex;
1472
+ width: 60px;
1473
+ height: 60px;
1474
+ justify-content: center;
1475
+ align-items: center;
1476
+ }
1477
+ .charge-payment-success-text {
1478
+ color: #161616;
1479
+ text-align: center;
1480
+ font-family: Inter;
1481
+ font-size: 32px;
1482
+ font-style: normal;
1483
+ font-weight: 500;
1484
+ line-height: 36px;
1485
+ letter-spacing: -0.64px;
1486
+ margin-top: 20px;
1487
+ margin-bottom: 5px !important;
1488
+ }
1489
+ .charge-payment-success-container {
1490
+ display: flex;
1491
+ padding: 120px 48px 32px 48px;
1492
+ flex-direction: column;
1493
+ justify-content: center;
1494
+ align-items: center;
1495
+ }
1496
+ .charge-payment-success-subtext {
1497
+ color: #727272;
1498
+ text-align: center;
1499
+ font-family: Inter;
1500
+ font-size: 14px;
1501
+ font-style: normal;
1502
+ font-weight: 500;
1503
+ line-height: 18px; /* 128.571% */
1504
+ letter-spacing: -0.28px;
1505
+ margin:14px 0 !important
1506
+
1507
+ }
1508
+ .charge-success-payment-button-div {
1509
+ display: flex;
1510
+ gap: 10px;
1511
+ align-items: baseline;
1512
+ }
1513
+ .charge-success-btn1 {
1514
+ display: flex;
1515
+ padding: 9px 16px;
1516
+ align-items: center;
1517
+ gap: 6px;
1518
+ border-radius: 1000px;
1519
+ border: 1px solid #e0dfe2;
1520
+ background: #fff;
1521
+ color: #161616;
1522
+ }
1523
+
1524
+ .charge-payment-success-btn-div {
1525
+ display: flex;
1526
+ align-items: flex-start;
1527
+ justify-content: center;
1528
+ gap: 8px;
1529
+ }
1530
+
1531
+ .charge-payment-success-btn1 {
1532
+ cursor: pointer;
1533
+ border-radius: 80px;
1534
+ border: 1px solid #e0dfe2;
1535
+ display: flex;
1536
+ padding: 12px 32px;
1537
+ justify-content: center;
1538
+ align-items: center;
1539
+ gap: 6px;
1540
+ background-color: #fff;
1541
+ }
1542
+
1543
+ .charge-payment-success-btn2 {
1544
+ border-radius: 80px;
1545
+ cursor: pointer;
1546
+ border: 1px solid #e0dfe2;
1547
+ display: flex;
1548
+ padding: 12px 32px;
1549
+ justify-content: center;
1550
+ align-items: center;
1551
+ gap: 6px;
1552
+ background-color: #161616;
1553
+ color: #fff;
1554
+ }`)}function Wn(e,t,H){e.preventDefault();let B={type:"preview.compiledcheck",other:{msg:"Payment success!",status:t==="close",data:{tran_id:H,key:t}}};console.log("message:",B),window.parent.postMessage(B,"*")}function Dn({onClose:e,tranId:t}){return xt.createElement(xt.Fragment,null,xt.createElement(Vi,null),xt.createElement("div",{className:"payment-msg-container"},xt.createElement("div",{className:"charge-payment-success-container"},xt.createElement("div",{className:"charge-payment-success-tick-div"},xt.createElement("div",{className:"charge-payment-success-tick"},xt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},xt.createElement("path",{d:"M6.12669 13.9774C5.97396 14.131 5.76558 14.2167 5.54913 14.2167C5.33267 14.2167 5.1243 14.131 4.97157 13.9774L0.359012 9.36408C-0.119671 8.8854 -0.119671 8.10919 0.359012 7.6314L0.936573 7.05369C1.4154 6.57501 2.19072 6.57501 2.6694 7.05369L5.54913 9.93357L13.3306 2.15198C13.8094 1.6733 14.5855 1.6733 15.0634 2.15198L15.641 2.72969C16.1196 3.20837 16.1196 3.98444 15.641 4.46237L6.12669 13.9774Z",fill:"#61C699"})))),xt.createElement("h6",{className:"charge-payment-success-text"},"Your charge",xt.createElement("br",null),"was successful"),xt.createElement("h6",{className:"charge-payment-success-subtext"},"We\u2019ve processed your charge"),xt.createElement("div",{className:"charge-success-payment-button-div"},xt.createElement("button",{className:"charge-success-btn1",onClick:H=>Wn(H,"print",t)},xt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},xt.createElement("path",{d:"M15.7729 8.7272C15.58 8.7272 15.395 8.80383 15.2586 8.94022C15.1222 9.07661 15.0456 9.2616 15.0456 9.45448V12.5185C15.045 13.0559 14.8313 13.5711 14.4513 13.9511C14.0713 14.3311 13.5561 14.5449 13.0187 14.5454H3.98149C3.44409 14.5449 2.92887 14.3311 2.54887 13.9511C2.16887 13.5711 1.95514 13.0559 1.95456 12.5185V9.45448C1.95456 9.2616 1.87794 9.07661 1.74154 8.94022C1.60515 8.80383 1.42017 8.7272 1.22728 8.7272C1.03439 8.7272 0.849407 8.80383 0.713015 8.94022C0.576624 9.07661 0.5 9.2616 0.5 9.45448V12.5185C0.500963 13.4416 0.86807 14.3265 1.52077 14.9792C2.17346 15.6319 3.05844 15.999 3.98149 16H13.0187C13.9417 15.999 14.8267 15.6319 15.4794 14.9792C16.1321 14.3265 16.4992 13.4416 16.5002 12.5185V9.45448C16.5002 9.2616 16.4235 9.07661 16.2871 8.94022C16.1507 8.80383 15.9658 8.7272 15.7729 8.7272Z",fill:"#161616"}),xt.createElement("path",{d:"M4.65059 6.75861L7.7728 9.88082V0.72728C7.7728 0.534394 7.84942 0.349407 7.98581 0.213015C8.1222 0.0766239 8.30719 0 8.50008 0C8.69296 0 8.87795 0.0766239 9.01434 0.213015C9.15073 0.349407 9.22736 0.534394 9.22736 0.72728V9.88082L12.3496 6.75861C12.4867 6.62613 12.6704 6.55283 12.8611 6.55448C13.0518 6.55614 13.2342 6.63263 13.3691 6.76747C13.5039 6.90231 13.5804 7.08472 13.5821 7.27541C13.5837 7.46611 13.5104 7.64982 13.3779 7.78698L9.01427 12.1507C8.87788 12.287 8.69293 12.3636 8.50008 12.3636C8.30723 12.3636 8.12228 12.287 7.98589 12.1507L3.62221 7.78698C3.48973 7.64982 3.41643 7.46611 3.41808 7.27541C3.41974 7.08472 3.49623 6.90231 3.63107 6.76747C3.76592 6.63263 3.94833 6.55614 4.13902 6.55448C4.32971 6.55283 4.51342 6.62613 4.65059 6.75861Z",fill:"#161616"})),"Print receipt"),xt.createElement("button",{className:"charge-success-btn1",onClick:H=>Wn(H,"share",t)},xt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},xt.createElement("g",{clipPath:"url(#clip0_12420_50683)"},xt.createElement("path",{d:"M9.30194 4.78664V2.31152C9.30194 2.09629 9.3862 1.88988 9.53631 1.73768C9.68634 1.5855 9.8899 1.5 10.1021 1.5C10.312 1.50089 10.5132 1.58542 10.6622 1.73534L16.2633 7.41595C16.3383 7.49142 16.3978 7.58117 16.4385 7.68001C16.4791 7.77894 16.5 7.885 16.5 7.99212C16.5 8.09924 16.4791 8.20531 16.4385 8.30423C16.3978 8.40307 16.3383 8.49283 16.2633 8.5683L10.6622 14.2489C10.5499 14.3606 10.4076 14.4362 10.2531 14.4663C10.0987 14.4964 9.93887 14.4797 9.79372 14.4182C9.64857 14.3568 9.52455 14.2532 9.43701 14.1206C9.34955 13.9881 9.30258 13.8323 9.30194 13.6727V11.157H8.62181C7.35764 11.1379 6.10443 11.3981 4.94932 11.9193C3.79422 12.4406 2.76481 13.2107 1.93249 14.1759C1.83215 14.3113 1.6926 14.4115 1.53337 14.4624C1.37406 14.5134 1.20306 14.5125 1.04431 14.4599C0.882759 14.4046 0.742811 14.2984 0.644952 14.1568C0.547092 14.0152 0.496363 13.8456 0.500203 13.6727C0.500203 6.27171 6.96548 5.00575 9.30194 4.78664ZM8.62181 9.51777C9.15695 9.51607 9.69162 9.55129 10.2221 9.62327C10.4115 9.6524 10.5844 9.74954 10.7092 9.89699C10.834 10.0444 10.9025 10.2324 10.9023 10.4267V11.717L14.567 7.99212L10.9023 4.26727V5.55758C10.9023 5.77281 10.8179 5.97922 10.6679 6.13141C10.5178 6.28359 10.3143 6.36909 10.1021 6.36909C9.37396 6.36909 3.61282 6.5314 2.36457 11.5871C4.17637 10.2324 6.3708 9.50665 8.62181 9.51777Z",fill:"#161616"})),xt.createElement("defs",null,xt.createElement("clipPath",{id:"clip0_12420_50683"},xt.createElement("rect",{width:"16",height:"16",fill:"white",transform:"translate(0.5)"})))),"Send receipt"))),xt.createElement("div",{className:"charge-payment-success-btn-div"},xt.createElement("button",{className:"charge-payment-success-btn1",onClick:H=>Wn(H,"tran",t)},"Go to Transactions"),xt.createElement("button",{className:"charge-payment-success-btn2",onClick:H=>{e(),Wn(H,"close",t)}},"Close"))))}import xi from"sweetalert2";import{IoArrowBack as qi}from"react-icons/io5";import{useEffect as ya}from"react";function Cn(){return ya(()=>{let e=Jn;if(typeof window!="undefined"&&!window.DatacapWebToken&&!document.querySelector(`script[src="${e}"]`)){let t=document.createElement("script");t.src=e,t.async=!0,t.onload=()=>{window.DatacapWebToken||console.warn("\u26A0\uFE0F Script loaded, but DatacapWebToken not found")},t.onerror=H=>{console.error("\u274C Failed to load Datacap script",H)},document.head.appendChild(t)}},[]),ya(()=>{let e="forge-cdn-script";if(!document.getElementById(e)){let t=document.createElement("script");t.src="https://cdn.jsdelivr.net/npm/node-forge@1.0.0/dist/forge.min.js",t.id=e,t.async=!0,document.head.appendChild(t)}return()=>{let t=document.getElementById(e);t&&document.head.removeChild(t)}},[]),null}import wn from"react";import tr from"react";function Oi(){return tr.createElement("style",null,`
1555
+ .card-error .logo-container {
1556
+ display: flex;
1557
+ justify-content: center;
1558
+ align-items: center;
1559
+ margin-bottom: -50px; /* Adjust this to overlap the content */
1560
+ z-index: 10;
1561
+ }
1562
+
1563
+ .card-error .client-logo {
1564
+ max-width: 100px;
1565
+ height: auto;
1566
+ object-fit: contain;
1567
+ display: block;
1568
+ }
1569
+
1570
+ .card-error .payment-error-container {
1571
+ display: flex;
1572
+ flex-direction: column;
1573
+ align-items: center;
1574
+ padding: 18px 20px 24px;
1575
+ // width: 335px;
1576
+ min-height: 250px; /* Fixed height */
1577
+ background: #FFFFFF;
1578
+ border-radius: 12px;
1579
+ position: relative;
1580
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
1581
+ border: 1px solid #e3e3e3;
1582
+ justify-content: center;
1583
+ text-align: center;
1584
+ // margin-top: 50px; /* Adjust this to move the content down */
1585
+ margin: 50px auto 0 auto !important;
1586
+ }
1587
+
1588
+ .card-error .error-icon {
1589
+ display: flex;
1590
+ flex-direction: column;
1591
+ align-items: center;
1592
+ gap: 12px;
1593
+ min-height: 116px;
1594
+ z-index: 2;
1595
+ }
1596
+
1597
+ .card-error .circle {
1598
+ width: 50px;
1599
+ height: 50px;
1600
+ border: 1px solid red;
1601
+ border-radius: 50%;
1602
+ display: flex;
1603
+ justify-content: center;
1604
+ align-items: center;
1605
+ margin-bottom:20px
1606
+ }
1607
+
1608
+ .card-error .circle .fa-times {
1609
+ font-size: 30px;
1610
+ color: red;
1611
+ }
1612
+
1613
+ .card-error .error-text {
1614
+ display: flex;
1615
+ flex-direction: column;
1616
+ justify-content: center;
1617
+ align-items: center;
1618
+ gap: 4px;
1619
+ // width: 227px;
1620
+ }
1621
+
1622
+ .card-error .payment-error-text {
1623
+ font-family: 'Inter', sans-serif;
1624
+ font-weight: 500;
1625
+ font-size: 18px;
1626
+ line-height: 21px;
1627
+ text-align: center;
1628
+ letter-spacing: -0.02em;
1629
+ color: #161616;
1630
+ }
1631
+
1632
+ .card-error .thank-you-text {
1633
+ font-family: 'Inter', sans-serif;
1634
+ font-weight: 500;
1635
+ font-size: 16px;
1636
+ line-height: 18px;
1637
+ text-align: center;
1638
+ letter-spacing: -0.02em;
1639
+ color: #161616 !important;
1640
+ opacity: 0.5;
1641
+ padding-top:10px
1642
+ }
1643
+
1644
+ .card-error .error-btn-div{
1645
+ padding-top:30px;
1646
+
1647
+ }
1648
+ .card-error .error-btn-div button{
1649
+ border-radius: 0.25em;
1650
+ border:none;
1651
+ background: initial;
1652
+ background-color: #7066e0;
1653
+ box-shadow: var(--swal2-confirm-button-box-shadow);
1654
+ color: white;
1655
+ font-size: 1em;
1656
+ padding:10px 17px;
1657
+ cursor:pointer;
1658
+ }
1659
+ `)}var nr=({onClose:e,error:t})=>wn.createElement(wn.Fragment,null,wn.createElement(Oi,null),wn.createElement("div",{className:"card-error"},wn.createElement("div",{className:"payment-error-container"},wn.createElement("div",{className:"error-icon"},wn.createElement("div",{className:"circle"},wn.createElement("i",{className:"fa fa-times","aria-hidden":"true"})),wn.createElement("div",{className:"error-text"},wn.createElement("div",{className:"payment-error-text"},t),wn.createElement("div",{className:"thank-you-text"},"Try again later ")),wn.createElement("div",{className:"error-btn-div"},wn.createElement("button",{onClick:e},"OK")))))),Fn=nr;import{io as ir}from"socket.io-client";var ar=ir(Qe,{transports:["websocket"],withCredentials:!1}),It=ar;import jn from"react";var Nn=e=>jn.createElement(jn.Fragment,null,jn.createElement("div",{className:`frac-card-bank-radio ${e.activetab===e.value?"frac-active":""}`,onClick:()=>e.onChange(e.value),role:"radio"},jn.createElement("div",{className:"frac-card-title-main"},jn.createElement("img",{src:e.label.toLowerCase()==="card"?bi:e.label.toLowerCase()==="reader"?Ii:pa,className:"frac-payment-type-logo",alt:""}),jn.createElement("div",{className:"frac-card-label"},jn.createElement("div",{className:"frac-card-label-text"},e.label),jn.createElement("div",{className:"frac-card-label-amount"},xe(e.amount)))),jn.createElement("div",null,jn.createElement("input",{name:"paymenttype",checked:e.activetab===e.value,type:"radio",value:e.value,onChange:t=>{e.onChange(t.target.value)}}))));import rr from"react";function Kn({}){return rr.createElement("style",null,`
1660
+ .frac-card-bank-radio-main{
1661
+ display: flex;
1662
+ flex-direction: column;
1663
+ align-items: flex-start;
1664
+ align-self: stretch;
1665
+ border-radius: 14px;
1666
+ border: 1px solid #E0DFE2;
1667
+ overflow: hidden;
1668
+ }
1669
+
1670
+ .frac-card-bank-radio{
1671
+ display: flex;
1672
+ padding: 12px 16px;
1673
+ justify-content: space-between;
1674
+ align-items: center;
1675
+ align-self: stretch;
1676
+ }
1677
+
1678
+ input[type="radio"] {
1679
+ accent-color: #000;
1680
+ }
1681
+
1682
+ .frac-card-title-main{
1683
+ display: flex;
1684
+ align-items: center;
1685
+ gap: 12px;
1686
+ }
1687
+
1688
+ .frac-card-label{
1689
+ display: flex;
1690
+ flex-direction: column;
1691
+ align-items: flex-start;
1692
+ gap: 2px;
1693
+ }
1694
+
1695
+ .frac-card-label-text{
1696
+ color: #727272;
1697
+ font-family: Inter;
1698
+ font-size: 12px;
1699
+ font-style: normal;
1700
+ font-weight: 500;
1701
+ line-height: 18px;
1702
+ letter-spacing: -0.24px;
1703
+ }
1704
+
1705
+ .frac-card-label-amount{
1706
+ color: #161616;
1707
+ text-align: center;
1708
+ font-family: Inter;
1709
+ font-size: 16px;
1710
+ font-style: normal;
1711
+ font-weight: 500;
1712
+ line-height: 140%;
1713
+ letter-spacing: -0.32px;
1714
+ }
1715
+
1716
+ .frac-payment-type-logo{
1717
+ width: 24px;
1718
+ height: 24px;
1719
+ aspect-ratio: 1/1;
1720
+ }
1721
+
1722
+ .frac-card-bank-radio-main .frac-card-bank-radio:nth-child(2) {
1723
+ border-top: 1px solid #E0DFE2;
1724
+ }
1725
+
1726
+ .frac-card-bank-radio-main .frac-card-bank-radio:nth-child(3) {
1727
+ border-top: 1px solid #E0DFE2;
1728
+ }
1729
+
1730
+ .frac-card-bank-radio.frac-active {
1731
+ background: #F6F6F7;
1732
+ }
1733
+ `)}import on from"react";var Bn=({listHeading:e="Card",ListItems:t,selectedCard:H,setSelectedCard:z,paymentGateway:B,handleDeleteCard:Y,otherButtonAction:K,otherButtonLabel:U,headingClass:ve})=>{let Z=ne+"widget/Trash.svg";return on.createElement(on.Fragment,null,on.createElement("h6",{className:ve||"card-ach-heading",style:{marginBottom:"10px !important"}},e),on.createElement("div",{className:"card-lint-div-in"},on.createElement("div",{className:"card-list-div"},t&&(t==null?void 0:t.length)>0&&(t==null?void 0:t.map((A,G)=>{let se=!1;return B&&(se=B!=(A==null?void 0:A.payment_method_type)&&(A==null?void 0:A.card_type)!="Bank"),on.createElement("div",{key:A==null?void 0:A.id,className:"card-list-single-div"},on.createElement("div",{className:"card-number-radio"},on.createElement("input",{disabled:se,type:"radio",className:"cardRadio",name:"selected_card",id:"",checked:(H==null?void 0:H.id)===(A==null?void 0:A.id),onChange:w=>z(A)}),on.createElement("label",{htmlFor:"",className:"card-number-last-four"},"**** ",A==null?void 0:A.cardlastfourdigit),(A==null?void 0:A.card_type)!="Bank"&&on.createElement("h6",{className:"card-expiry-date"},A==null?void 0:A.expmonth,"/",A==null?void 0:A.expyear)),on.createElement("div",{className:"card-number-radio"},on.createElement("span",{className:"visa-card"},on.createElement("img",{src:fa(A==null?void 0:A.card_type),alt:""})),on.createElement("span",{className:"visa-card",style:{cursor:"pointer"},onClick:()=>Y(A==null?void 0:A.id)},on.createElement("img",{src:Z,alt:""}))))}))),on.createElement("div",{className:"pay-with-other-card",onClick:K},U,on.createElement("img",{src:bi,alt:""}))))};import Mn from"react";var Bi=({listHeading:e="Readers",ListItems:t,selectedPax:H,setSlectedPax:z,headingClass:B})=>Mn.createElement(Mn.Fragment,null,Mn.createElement("h6",{className:B||"card-ach-heading",style:{marginBottom:"10px !important"}},e),Mn.createElement("div",{className:"card-lint-div-in"},Mn.createElement("div",{className:"card-list-div"},t&&(t==null?void 0:t.length)>0&&(t==null?void 0:t.map((Y,K)=>Mn.createElement("div",{key:Y==null?void 0:Y.id,className:"card-list-single-div"},Mn.createElement("div",{className:"card-number-radio"},Mn.createElement("input",{type:"radio",className:"cardRadio",name:"selected_reader",id:"",checked:(H==null?void 0:H.id)===(Y==null?void 0:Y.id),onChange:U=>z(Y)}),Mn.createElement("label",{htmlFor:"",className:"card-number-last-four"},Y==null?void 0:Y.device_name)),Mn.createElement("div",{className:"card-number-radio"},Mn.createElement("span",{className:"visa-card"},Mn.createElement("img",{src:Ii,alt:""})))))))));function or(e){var Je,rt,ht,qt,Mt,zt,Wt,ot,je,Yt,Ht,Dt,Rt,en,tn,nn,un,Gt,Ve,jt;let[t,H]=Bt(!1),[z,B]=Bt(!1),[Y,K]=Bt(""),[U,ve]=Bt(!1),[Z,A]=Bt(!1),[G,se]=Bt("card"),[w,v]=Bt("card"),[ee,V]=Bt("form"),[y,Se]=Bt("form"),[P,Ue]=Bt(!0),[Fe,ce]=Bt(!1),[_e,ct]=Bt(!1),Ne=e.merchantPublicKey,Me=ne+"widget/mc-img.svg",ue=ne+"widget/visa-img.svg",qe=ne+"widget/ae-img.svg",$e=ne+"widget/discover-img.svg",mn=ne+"widget/card.svg",Xt=ne+"widget/Trash.svg",h=ne+"widget/bank.svg",M=ne+"widget/secure-img.png",u=ne+"widget/pov-by.png",ge=ne+"widget/pax.svg",[o,r]=Bt(),[a,b]=Bt({}),[N,F]=Bt(),[O,x]=Bt({}),[f,k]=Bt([]),[He,dt]=Bt([]),[Be,Ft]=Bt(),[ut,Re]=Bt(void 0),[Le,pe]=Bt(Number(e==null?void 0:e.amount)),[E,Pe]=Bt(),[at,D]=Bt(""),St=()=>H(!0),Ke=()=>H(!1),_t=(_,g)=>{let le=(parseFloat(g)||0)/100,fe=_/(1+le);return Math.round(fe*100)/100};ba(()=>{if(Z){let _=_t(e==null?void 0:e.amount,(e==null?void 0:e.surcharge)||0);pe(_)}},[Z,e==null?void 0:e.pass_fee,e==null?void 0:e.amount,e==null?void 0:e.surcharge]);let S=()=>{A(!1),se("card"),K(""),ve(!1),D(""),F({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),x({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),r({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),b({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),ct(!1),ce(!1),Ft({card_type:"",cardlastfourdigit:"",expmonth:1,expyear:2025,primary_card:0,firstname:"",id:"",lastname:""}),Re(null),pe(0),v("card"),Ue(!0),Se("form"),V("form"),B(!1),H(!1),dt([]),k([])},bn=()=>A(!0),Pt=_=>{se(_)},ft=(_,g)=>{let le=_;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(le)){(g===""||/^[0-9]+$/.test(g))&&(b(te=>L(C({},te),{[le]:""})),r(te=>L(C({},te),{[le]:g})));return}b(te=>L(C({},te),{[le]:""})),r(te=>L(C({},te),{[le]:g}))},cn=_=>{var te;let g=_.target,{formatted:le,cursor:fe}=Pn(g.value,(te=g.selectionStart)!=null?te:0);b(Oe=>L(C({},Oe),{cardNumber:""})),r(Oe=>L(C({},Oe),{cardNumber:le})),requestAnimationFrame(()=>{g.setSelectionRange(fe,fe)})},vt=_=>{let{name:g,value:le}=_.target,fe=["routingNumber","accountNumber","confirmAccountNumber"];if(g=="name"){/^[a-zA-Z\s]*$/.test(le)&&(x(te=>L(C({},te),{[g]:""})),F(te=>L(C({},te),{[g]:le})));return}if(fe.includes(g)){(le===""||/^[0-9]+$/.test(le))&&(x(te=>L(C({},te),{[g]:""})),F(te=>L(C({},te),{[g]:le})));return}x(te=>L(C({},te),{[g]:""})),F(te=>L(C({},te),{[g]:le}))},Yn=()=>{var te,Oe,ye,wt,We,mt;let _={},g=o,le=parseInt((g==null?void 0:g.expiryMonth)||"",10),fe=(g==null?void 0:g.expiryYear)||"";if((te=g==null?void 0:g.cardName)!=null&&te.trim()||(_.cardName="Card name is required"),(Oe=g==null?void 0:g.cardNumber)!=null&&Oe.trim()||(_.cardNumber="Card number is required"),(!((ye=g==null?void 0:g.expiryMonth)!=null&&ye.trim())||!((wt=g==null?void 0:g.expiryYear)!=null&&wt.trim())||isNaN(le)||le<1||le>12||fe.length!==4)&&(_.expiryMonth="Invalid Expiration Date."),(We=g==null?void 0:g.cvv)!=null&&We.trim()||(_.cvv="CVV is required"),(mt=g==null?void 0:g.zipCode)!=null&&mt.trim()||(_.zipCode="ZIP code is required"),g!=null&&g.expiryMonth&&(g!=null&&g.expiryYear)&&g.expiryMonth.length<=2&&g.expiryYear.length===4){let Vt=parseInt(g.expiryMonth,10),p=parseInt(g.expiryYear,10),c=new Date,W=c.getMonth()+1,ke=c.getFullYear();(p<ke||p===ke&&Vt<W)&&(_.expiryMonth="Card is expired")}return b(_),Object.keys(_).length>0},Ln=()=>{var le,fe,te,Oe,ye,wt,We,mt;let _={},g=N;return(le=g==null?void 0:g.name)!=null&&le.trim()||(_.name="Name is required"),(fe=g==null?void 0:g.accountNumber)!=null&&fe.trim()||(_.accountNumber="Account number is required"),(te=g==null?void 0:g.accountNumber)!=null&&te.trim()&&((Oe=g==null?void 0:g.accountNumber)==null?void 0:Oe.trim())!==((ye=g==null?void 0:g.confirmAccountNumber)==null?void 0:ye.trim())&&(_.confirmAccountNumber="Account numbers must match"),(wt=g==null?void 0:g.bankName)!=null&&wt.trim()||(_.bankName="Bank name is required"),(We=g==null?void 0:g.routingNumber)!=null&&We.trim()||(_.routingNumber="Routing Number is required"),g!=null&&g.routingNumber&&((mt=g==null?void 0:g.routingNumber)==null?void 0:mt.length)!==9&&(_.routingNumber="Routing number must be 9 digits"),((g==null?void 0:g.accountType)==="business saving"||(g==null?void 0:g.accountType)==="business checking")&&(!(g!=null&&g.companyName)||(g==null?void 0:g.companyName)==="")&&(_.companyName="Company Name is required for business accounts"),x(_),Object.keys(_).length>0},Ct=async _=>{var le,fe,te,Oe,ye,wt,We,mt,Vt,p,c,W,ke,ae,et,Ce;_.preventDefault();let g=document.activeElement;if(g instanceof HTMLElement&&g.blur(),G!=="ach"){if(Yn())return;{let Ae=DatacapWebToken.validateCardNumber(o==null?void 0:o.cardNumber.replaceAll(" ","")),re=DatacapWebToken.validateExpirationDate(o==null?void 0:o.expiryMonth,o==null?void 0:o.expiryYear),nt=DatacapWebToken.validateCVV(o==null?void 0:o.cvv),gt={};if(Ae||(gt.cardNumber="Invalid card Number"),re||(gt.expiryMonth="Invalid Expiration Date."),nt||(gt.cvv="Invalid CVV"),b(gt),Ae&&nt&&re){B(!0);try{let be={amount:`${e.amount||0}`,fractalpayPublicKey:Ne,orderId:e==null?void 0:e.orderID,customer_id:e==null?void 0:e.customerId,discount:e==null?void 0:e.discount,surcharge:e==null?void 0:e.surcharge,tax:e==null?void 0:e.tax,pass_fee:e==null?void 0:e.pass_fee},oe=await si.post(`${Qe}create-widget-order`,be,{headers:C({},(e==null?void 0:e.sessionToken)&&{"X-Session-Token":e.sessionToken})}),Ot=async function(Lt){if(Lt.Error)K(Lt.Error),B(!1);else{let Ge=o==null?void 0:o.cardName,En=o==null?void 0:o.zipCode;Lt.name=Ge,Lt.postal_code=En,Lt.isCardSave=`${Fe}`,Lt.isCharge=!0,Lt.posSalesIdEncode=oe==null?void 0:oe.data.data.posSalesIdEncode,It.emit("sendMessage",Lt),It.on(oe==null?void 0:oe.data.data.posSalesIdEncode,st=>{if(ri(st==null?void 0:st.data)){let Te=JSON.parse(st.data);Te!=null&&Te.result?(r({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),ce(!1),D(Te==null?void 0:Te.transactionId),ve(!0),B(!1)):(B(!1),K((Te==null?void 0:Te.message)||"Something went wrong."))}else K("Something went wrong.")})}};if((E==null?void 0:E.paymentGateway)===32){let Lt={method:"POST",redirect:"follow"};try{let Ge=await si.post(`${Ee}api/v1/widget/generate-session`,Lt),En=Number(o==null?void 0:o.expiryYear)%100,st=o==null?void 0:o.cardNumber;st=st==null?void 0:st.replace(/\s+/g,"");let Te=`${st}=${En}${o==null?void 0:o.expiryMonth} ${o==null?void 0:o.cvv}`,xn=forge.pki.publicKeyFromPem((fe=(le=Ge==null?void 0:Ge.data)==null?void 0:le.data)==null?void 0:fe.publicKeyPem).encrypt(Te,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),gn=forge.util.encode64(xn),Nt={"Content-Type":"application/json","x-app-session-key":(Oe=(te=Ge.data)==null?void 0:te.data)==null?void 0:Oe.session_key},de=JSON.stringify({enc_track2_data:`${gn}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(wt=(ye=Ge==null?void 0:Ge.data)==null?void 0:ye.data)==null?void 0:wt.session_key}`});try{let yt=await si.post(`${rn}tokenizer/tokenize`,de,{headers:Nt}),Ut=JSON.stringify(L(C({},(We=yt==null?void 0:yt.data)==null?void 0:We.data),{isSaveCardChecked:Fe,name:o==null?void 0:o.cardName,postal_code:o==null?void 0:o.zipCode,customer_id:e==null?void 0:e.customerId})),ln=JSON.stringify({pre_sales_id:`${(Vt=(mt=oe==null?void 0:oe.data)==null?void 0:mt.data)==null?void 0:Vt.posSalesIdEncode}`,token:`${(p=yt==null?void 0:yt.data)==null?void 0:p.data.token}`,json_response:`${Ut}`}),zn={method:"POST",headers:JSON.stringify({"Content-Type":"application/json"}),body:ln,redirect:"follow",isChargeviafractal:!0};It.emit("sendMessage",zn),It.on("chargeviafractalgateway",Et=>{var Gn;if(ri(Et==null?void 0:Et.data)){let hn=JSON.parse(Et==null?void 0:Et.data);hn!=null&&hn.result?(D((Gn=hn==null?void 0:hn.data)==null?void 0:Gn.transactionId),ve(!0),B(!1)):(B(!1),K((hn==null?void 0:hn.message)||"Something went wrong."))}else K("Something went wrong.")})}catch(yt){B(!1),K(((W=(c=yt==null?void 0:yt.response)==null?void 0:c.data)==null?void 0:W.message)||(yt==null?void 0:yt.message)||"Something went wrong.")}}catch(Ge){B(!1),K(((ae=(ke=Ge==null?void 0:Ge.response)==null?void 0:ke.data)==null?void 0:ae.message)||(Ge==null?void 0:Ge.message)||"Something went wrong.")}}else typeof DatacapWebToken!="undefined"&&DatacapWebToken.requestToken(oe==null?void 0:oe.data.data.dctoken,"PaymentForm",Ot)}catch(be){B(!1),K(((Ce=(et=be==null?void 0:be.response)==null?void 0:et.data)==null?void 0:Ce.message)||(be==null?void 0:be.message)||"Something went wrong.")}}}}else{if(Ln())return;{B(!0);let Ae=C({fractalpayPublicKey:Ne,label:(N==null?void 0:N.name)||"John Doe",account_number:N==null?void 0:N.accountNumber,routing_number:N==null?void 0:N.routingNumber,bank_name:N==null?void 0:N.bankName,account_type:N==null?void 0:N.accountType,amount:String(Le||0),isSaveAch:_e,customer_id:e==null?void 0:e.customerId,order_id:e==null?void 0:e.orderID,tax:e==null?void 0:e.tax,discount:e==null?void 0:e.discount,surcharge:e==null?void 0:e.surcharge,isChargeACH:!0,company_name:(N==null?void 0:N.companyName)||""},(e==null?void 0:e.sessionToken)&&{sessionToken:e.sessionToken});It.emit("sendMessage",Ae),It.on("ach-incoming",re=>{var nt;(re==null?void 0:re.status)=="Failed"?typeof(re==null?void 0:re.message)=="object"?Object.values(re==null?void 0:re.message).forEach(gt=>{K(gt||"Something went wrong")}):K((re==null?void 0:re.message)||"Something went wrong"):(D((nt=re==null?void 0:re.data)==null?void 0:nt.transaction_id),ve(!0),B(!1))})}}},An=async()=>{var _,g,le,fe,te,Oe,ye,wt,We,mt,Vt,p,c,W,ke,ae,et,Ce,tt,Ae,re,nt,gt;St();try{let be={fractalpayPublicKey:Ne,customer_id:e==null?void 0:e.customerId,pass_fee:e==null?void 0:e.pass_fee,isReader:e==null?void 0:e.isReader},oe=await si.post(`${Qe}get-payment-details`,be);if(Pe((_=oe==null?void 0:oe.data)==null?void 0:_.data),(le=(g=oe==null?void 0:oe.data)==null?void 0:g.data)!=null&&le.paymentGateway||(S(),K("Something went wrong.")),(te=(fe=oe==null?void 0:oe.data)==null?void 0:fe.data)!=null&&te.card_list&&((wt=(ye=(Oe=oe==null?void 0:oe.data)==null?void 0:Oe.data)==null?void 0:ye.card_list)==null?void 0:wt.length)>0){let Ot=(Vt=(mt=(We=oe==null?void 0:oe.data)==null?void 0:We.data)==null?void 0:mt.card_list)==null?void 0:Vt.filter(Ge=>(Ge==null?void 0:Ge.card_type)=="Bank"),Lt=(W=(c=(p=oe==null?void 0:oe.data)==null?void 0:p.data)==null?void 0:c.card_list)==null?void 0:W.filter(Ge=>(Ge==null?void 0:Ge.card_type)!=="Bank");(Lt==null?void 0:Lt.length)>0&&V("list"),(Ot==null?void 0:Ot.length)>0&&Se("list"),k(Lt),dt(Ot)}else se("card");(ae=(ke=oe==null?void 0:oe.data)==null?void 0:ke.data)!=null&&ae.paymentDeviceList&&((tt=(Ce=(et=oe==null?void 0:oe.data)==null?void 0:et.data)==null?void 0:Ce.paymentDeviceList)==null?void 0:tt.length)>0&&Re((re=(Ae=oe==null?void 0:oe.data)==null?void 0:Ae.data)==null?void 0:re.paymentDeviceList[0]),Ke()}catch(be){console.log(be),Ke(),K(((gt=(nt=be==null?void 0:be.response)==null?void 0:nt.data)==null?void 0:gt.message)||(be==null?void 0:be.message)||"Something went wrong")}},Sn=async _=>{if(_.currentTarget.blur(),z)return;let g=e==null?void 0:e.customerId,le=String(e==null?void 0:e.discount),fe=String(e==null?void 0:e.surcharge),te=String(e==null?void 0:e.tax),Oe=e==null?void 0:e.merchantPublicKey,ye=e==null?void 0:e.orderID,wt=String(e==null?void 0:e.amount),We=Be==null?void 0:Be.id,mt=Be==null?void 0:Be.card_type;if(Oe&&ye&&wt&&Le)if(g)if(We){let p=C({amount:mt==="Bank"?`${Le}`:wt,order_id:ye,customer_id:g,card_id:We,fractalpayPublicKey:Oe,isCardSave:Fe,discount:le,surcharge:fe,tax:te,pass_fee:e==null?void 0:e.pass_fee,require3ds:!1},(e==null?void 0:e.sessionToken)&&{sessionToken:e.sessionToken}),Vt=p,{isCardSave:c,pass_fee:W,require3ds:ke}=Vt,ae=Un(Vt,["isCardSave","pass_fee","require3ds"]),Ce=Qe+(mt==="Bank"?"charge-ach":"charge-by-card"),tt={"Content-Type":"application/json"};B(!0),It.emit("sendMessage",{url:Ce,body:mt=="Bank"?ae:p,isChargebycard:!0}),It.on("charge-by-card",Ae=>{var re;(Ae==null?void 0:Ae.result)==!0||(Ae==null?void 0:Ae.status)==!0?(D((re=Ae.data)==null?void 0:re.transaction_id),ve(!0),B(!1)):K((Ae==null?void 0:Ae.message)||"Something went wrong.")})}else K("Please Select A Card/ACH");else K("Please Select Customer");else K("Something went wrong.")},_n=async _=>{var Oe,ye,wt,We,mt,Vt;if(_.currentTarget.blur(),z)return;let g=e==null?void 0:e.merchantPublicKey,le=e==null?void 0:e.orderID,fe=String(e==null?void 0:e.amount),te=e==null?void 0:e.customerId;if(!(ut!=null&&ut.device_id)){K("Please Select A Payment Device");return}if(g&&le&&fe){B(!0);let p={amount:fe,fractalpayPublicKey:g,customer_order_id:le,device_id:ut==null?void 0:ut.device_id,customer_id:te||""};try{let c=await si.post(`${Qe}charge-with-reader`,p);((Oe=c==null?void 0:c.data)==null?void 0:Oe.result)==!0?(D((wt=(ye=c==null?void 0:c.data)==null?void 0:ye.data)==null?void 0:wt.transaction_id),ve(!0),B(!1)):(K(((We=c==null?void 0:c.data)==null?void 0:We.message)||"Something went wrong."),B(!1))}catch(c){K(((Vt=(mt=c==null?void 0:c.response)==null?void 0:mt.data)==null?void 0:Vt.message)||"Something went wrong."),B(!1)}}else K("Something went wrong.")},Q=_=>{w==="card"?Sn(_):w==="reader"&&_n(_)};ba(()=>{Z&&Ne&&An()},[Ne,Z]);let $=async _=>{xi.fire({icon:"warning",text:"Do you want to delete the card?",showCancelButton:!0,confirmButtonText:"Yes",cancelButtonText:"No",reverseButtons:!0,buttonsStyling:!1,customClass:{confirmButton:"swal2-confirm btn btn-dark",cancelButton:"swal2-cancel btn btn-dark",popup:"custom-swal-popup",icon:"custom-swal-icon"}}).then(async g=>{if(g.isConfirmed){B(!0);try{let le={card_id:_,customer_id:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey},fe=await si.post(`${Qe}delete-customer-card`,le);B(!1),An(),xi.fire({icon:"success",title:"Deleted!",text:"Card deleted.",confirmButtonText:"OK",showConfirmButton:!0,timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}})}catch(le){B(!1),xi.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}else g.dismiss===xi.DismissReason.cancel&&xi.fire({icon:"info",text:"Card not deleted",confirmButtonText:"OK",buttonsStyling:!1,customClass:{confirmButton:"btn btn-dark float-end",actions:"swal2-actions-end"}})})},Ze=_=>{switch(_==null?void 0:_.toLowerCase()){case"visa":return ue;case"mastercard":case"mc":case"m/c":return Me;case"amex":case"american express":case"ae":return qe;case"discover":case"dcvr":return $e;case"bank":return h;default:return _}},Tt=()=>{let _=Le||0;return(Number(e.amount)-_).toFixed(0)};return i.createElement(i.Fragment,null,i.createElement(Cn,null),i.createElement(Xn,null),i.createElement(Kn,null),i.createElement(i.Fragment,null,i.createElement("button",{className:"paymentBtn",onClick:bn},"Pay"),i.createElement(yn,{open:Z,onClose:S},Y&&i.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},i.createElement(Fn,{error:Y,onClose:S})),U&&i.createElement(Dn,{onClose:S,tranId:at}),!Y&&!U&&i.createElement(i.Fragment,null,(t||z)&&i.createElement(an,{loading:t||z}),i.createElement("div",{className:"frac-card-payment-page frac-form"},i.createElement("div",{className:"parent-pay-container"},i.createElement("span",{className:"request-payment-close-popup",onClick:S},i.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},i.createElement("g",{clipPath:"url(#clip0_12425_52336)"},i.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),i.createElement("defs",null,i.createElement("clipPath",{id:"clip0_12425_52336"},i.createElement("rect",{width:"16",height:"16",fill:"white"}))))),i.createElement("div",{className:"pay-main-logo-res"},i.createElement("img",{src:E==null?void 0:E.logo,id:"pay-logos"})),i.createElement("div",{className:"pay-container"},i.createElement("div",{className:"pay-header pay-conatiner-one frac-pay-conatiner-one"},i.createElement("div",{className:"pay-conatiner-one-first"},i.createElement("div",{className:"pay-logo-container"},i.createElement("div",{className:"pay-main-logo"},i.createElement("img",{src:E==null?void 0:E.logo,id:"pay-logos"})),(f==null?void 0:f.length)>0&&G!=="cardList"&&i.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>se("cardList")}," ",i.createElement(qi,null)," Back")),i.createElement("div",{className:"amt-pay-con"},i.createElement("div",{className:"pay-amount-conatiner"},i.createElement("small",{className:"pay-payment-amount"},"Select paymet type")),i.createElement("div",{className:"frac-card-bank-radio-main"},i.createElement(Nn,{label:"Card",amount:(Je=Number(e==null?void 0:e.amount))==null?void 0:Je.toFixed(2),value:"card",onChange:Pt,activetab:G}),(E==null?void 0:E.isSkyFiAccount)&&i.createElement(Nn,{label:"Bank",amount:(rt=Number(Le))==null?void 0:rt.toFixed(2),value:"ach",onChange:Pt,activetab:G}),(e==null?void 0:e.isReader)&&(E==null?void 0:E.paymentDeviceList)&&((ht=E==null?void 0:E.paymentDeviceList)==null?void 0:ht.length)>0&&i.createElement(Nn,{label:"Reader",amount:(qt=Number(e==null?void 0:e.amount))==null?void 0:qt.toFixed(2),value:"reader",onChange:Pt,activetab:G})),!t&&(In(E==null?void 0:E.showSurcharge)?Le&&Le>0&&(e!=null&&e.pass_fee)?i.createElement("div",{className:"frac-cash-discount-fee"},i.createElement("small",null,G==="card"||G==="reader"?"Cash Discount":"Cash Discount Savings"," "),i.createElement("p",null,xe((Number(e.amount)-Le).toFixed(2)))):null:Le&&Le>0&&(e!=null&&e.pass_fee)&&(G==="card"||G==="reader")?i.createElement("div",{className:"frac-cash-discount-fee"},i.createElement("small",null,G==="card"||G==="reader"?"Surcharge":null," "),i.createElement("p",null,xe((Number(e.amount)-Le).toFixed(2)))):null))),i.createElement("div",{className:"pay-conatiner-one-last"},i.createElement("img",{src:M,alt:""}),i.createElement("img",{src:u,alt:""}),"Secure payments powered by Fractal")),i.createElement("div",{className:"pay-tab pay-conatiner-two"},!t&&i.createElement("div",{className:"col-md-12"},i.createElement("div",{id:"payment-form-div"},G!=="cardList"?i.createElement("div",{className:"frac-charge-payment-back-btn-wrap "},(f==null?void 0:f.length)>0&&i.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>se("cardList")}," ",i.createElement(qi,null)," Back"),(E==null?void 0:E.isSkyFiAccount)&&i.createElement("div",{className:"tab"},i.createElement("button",{className:"tablinks",onClick:_=>{Pt("card")},style:{border:G==="card"?"1px solid":""}},i.createElement("i",{className:"fas fa-credit-card me-2",style:{marginRight:"8px",fontSize:"15px"}}),"Card"),i.createElement("button",{className:"tablinks",onClick:_=>{Pt("ach")},style:{border:G==="ach"?"1px solid":""}},i.createElement("i",{className:"fas fa-university me-2",style:{marginRight:"8px",fontSize:"15px"}}),"Bank")),i.createElement("div",{className:"res-pay-con"},i.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},i.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),i.createElement("strong",{className:"pay-amount"},"$",(Mt=Number(e==null?void 0:e.amount))==null?void 0:Mt.toFixed(2))),G!="ach"&&i.createElement("div",null,i.createElement("div",null,i.createElement("img",{src:ue,alt:"",width:35,style:{paddingRight:"5px"}}),i.createElement("img",{src:Me,width:35,alt:""})),i.createElement("div",null,i.createElement("img",{src:qe,alt:"",width:35,style:{paddingRight:"5px"}}),i.createElement("img",{src:$e,width:35,alt:""}))))):i.createElement("div",null,i.createElement("h6",{className:"charge-customer-name",style:{marginBottom:"16px !important"}}," Charge ",E==null?void 0:E.customer_name),i.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}}," ",w==="card"?"Cards/Banks":"Readers"," "),i.createElement("div",{className:"res-pay-con"},i.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},i.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),i.createElement("strong",{className:"pay-amount"},"$",(zt=Number(e==null?void 0:e.amount))==null?void 0:zt.toFixed(2))),i.createElement("div",null,i.createElement("div",null,i.createElement("img",{src:ue,alt:"",width:35,style:{paddingRight:"5px"}}),i.createElement("img",{src:Me,width:35,alt:""})),i.createElement("div",null,i.createElement("img",{src:qe,alt:"",width:35,style:{paddingRight:"5px"}}),i.createElement("img",{src:$e,width:35,alt:""}))))),i.createElement("div",{id:"card",style:{display:G==="card"?"block":"none"},className:"tabcontent"},i.createElement("div",{className:"frac-card-payment"},i.createElement("div",{className:"frac-heading-card-wrap"},i.createElement("div",{className:"frac-backarrow"},(f==null?void 0:f.length)>0&&ee==="form"&&i.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>V("list")}," ",i.createElement(qi,null))),i.createElement("h6",{className:"frac-card-payment-heading"},"Card Payment")),G!="ach"&&i.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0px 19px 0px"}},i.createElement("img",{src:ue,alt:"",width:33}),i.createElement("img",{src:Me,width:33,alt:""}),i.createElement("img",{src:qe,alt:"",width:33}),i.createElement("img",{src:$e,width:33,alt:""}))),ee==="list"?i.createElement(i.Fragment,null,i.createElement(Bn,{listHeading:"Cards",paymentGateway:E==null?void 0:E.paymentGateway,ListItems:f,selectedCard:Be,setSelectedCard:Ft,handleDeleteCard:$,otherButtonLabel:"Pay With Other Card",otherButtonAction:()=>{V("form")}}),i.createElement("div",{className:"form-group",style:{padding:"0"}},i.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",disabled:z,onClick:Q},xe((Wt=Number(e==null?void 0:e.amount))==null?void 0:Wt.toFixed(2))))):i.createElement("form",{id:"PaymentForm",style:{textAlign:"start"},onSubmit:Ct,onKeyDown:_=>{_.key==="Enter"&&z&&(_.preventDefault(),_.stopPropagation())}},i.createElement("div",{className:"ach-scrl",style:{minHeight:E!=null&&E.isSkyFiAccount&&(f==null?void 0:f.length)>0?"444px":E!=null&&E.isSkyFiAccount&&(f==null?void 0:f.length)==0?"456px":(f==null?void 0:f.length)>0?"462px":"520px",overflow:"auto",marginRight:"5px"}},i.createElement("div",{className:"form-group"},i.createElement("label",{htmlFor:"cardHolderName"},"NAME ON CARD "),i.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"John Doe",value:(o==null?void 0:o.cardName)||"",onChange:_=>{let g=_.target.value;/^[a-zA-Z\s]*$/.test(g)&&ft("cardName",g)}}),(a==null?void 0:a.cardName)&&i.createElement("span",{className:"error-span"},a==null?void 0:a.cardName)),i.createElement("div",{className:"form-group"},i.createElement("label",{htmlFor:"cardNumber"},"CARD NUMBER"),i.createElement("div",{className:"toggle-num-wrapper"},i.createElement("input",{className:"form-control card-number-new",type:"text",maxLength:19,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:(o==null?void 0:o.cardNumber)||"",onChange:_=>cn(_),"data-token":"card_number"}),i.createElement("div",{className:"card-crdi card-expiry-new"},i.createElement("div",{className:"exp-date-year-container"},i.createElement("div",{className:"exp-date form-group"},i.createElement("input",{"data-token":"exp_month",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"MM",maxLength:2,value:(o==null?void 0:o.expiryMonth)||"",onChange:_=>ft("expiryMonth",_.target.value)})),i.createElement("div",{className:"exp-year form-group"},i.createElement("input",{"data-token":"exp_year",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"YYYY",maxLength:4,value:(o==null?void 0:o.expiryYear)||"",onChange:_=>ft("expiryYear",_.target.value)})),i.createElement("div",{className:"security-digit form-group"},i.createElement("input",{"data-token":"cvv",className:"form-control card-cvv-in required",type:"text",style:{maxHeight:"36px"},maxLength:4,placeholder:"CVC",value:(o==null?void 0:o.cvv)||"",onChange:_=>ft("cvv",_.target.value)})))),(a==null?void 0:a.cardNumber)&&i.createElement("span",{className:"error-span"},a==null?void 0:a.cardNumber),i.createElement("p",{style:{margin:"0"}},a!=null&&a.expiryMonth||a!=null&&a.expiryYear?i.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},a==null?void 0:a.expiryMonth):"",(a==null?void 0:a.cvv)&&i.createElement("span",{className:"error-span"},a==null?void 0:a.cvv)))),i.createElement("div",{className:"form-group"},i.createElement("label",{htmlFor:"OrderId"},"Order ID / Description"),i.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"OID123456",disabled:!0,value:(ot=e==null?void 0:e.orderID)!=null?ot:"",style:{background:"#F6F6F7",color:"#727272"}})),i.createElement("div",{className:"form-group"},i.createElement("label",{htmlFor:"zip"},"ZIP"),i.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"000000",value:(je=o==null?void 0:o.zipCode)!=null?je:"",onChange:_=>ft("zipCode",_.target.value)}),(a==null?void 0:a.zipCode)&&i.createElement("span",{className:"error-span"},a==null?void 0:a.zipCode)),(e==null?void 0:e.customerId)&&i.createElement("div",{className:"form-group"},i.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},i.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:Fe,onChange:_=>ce(_.target.checked)}),i.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),i.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),i.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},i.createElement("g",{clipPath:"url(#clip0_12420_50192)"},i.createElement("rect",{width:"20",height:"20",fill:"white"}),i.createElement("circle",{cx:"10",cy:"10",r:"10",fill:"#E0DFE2"}),i.createElement("path",{d:"M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z",fill:"#161616"})),i.createElement("defs",null,i.createElement("clipPath",{id:"clip0_12420_50192"},i.createElement("rect",{width:"20",height:"20",fill:"white"}))))))),i.createElement("div",{className:"form-group",style:{marginTop:"20px",padding:"0"}},i.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},xe((Yt=Number(e==null?void 0:e.amount))==null?void 0:Yt.toFixed(2)))))),i.createElement("div",{id:"ach",style:{display:G==="ach"?"block":"none"},className:"tabcontent"},i.createElement("div",{className:"frac-card-payment"},i.createElement("div",{className:"frac-heading-card-wrap"},i.createElement("div",{className:"frac-backarrow"},(He==null?void 0:He.length)>0&&y==="form"&&i.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>Se("list")}," ",i.createElement(qi,null))),i.createElement("h6",{className:"frac-card-payment-heading"},"Bank Payment"))),y==="list"?i.createElement(i.Fragment,null,i.createElement(Bn,{listHeading:"Banks",paymentGateway:E==null?void 0:E.paymentGateway,ListItems:He,selectedCard:Be,setSelectedCard:Ft,handleDeleteCard:$,otherButtonLabel:"Pay With Other Bank",otherButtonAction:()=>{Se("form")}}),i.createElement("div",{className:"form-group",style:{padding:"0"}},i.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:Q},xe((Ht=Number(Le))==null?void 0:Ht.toFixed(2))))):i.createElement("form",{id:"ACHPaymentForm",style:{textAlign:"start"},onSubmit:Ct,autoComplete:"off",onKeyDown:_=>{_.key==="Enter"&&z&&(_.preventDefault(),_.stopPropagation())}},i.createElement("div",{className:"ach-scrl",style:{minHeight:E!=null&&E.isSkyFiAccount&&(f==null?void 0:f.length)>0?"444px":E!=null&&E.isSkyFiAccount&&(f==null?void 0:f.length)==0?"436px":(f==null?void 0:f.length)>0?"462px":"520px",maxHeight:E!=null&&E.isSkyFiAccount&&(f==null?void 0:f.length)>0?"444px":((f==null?void 0:f.length)>0,"380px")}},i.createElement("div",{className:"form-group mb-4"},i.createElement("label",{htmlFor:"nameonaccount"},"Name on account"),i.createElement("input",{type:"text",id:"nameonaccount",className:"form-control",maxLength:100,placeholder:"John Doe",name:"name",value:(Dt=N==null?void 0:N.name)!=null?Dt:"",onChange:vt}),(O==null?void 0:O.name)&&i.createElement("span",{className:"error-span"},O==null?void 0:O.name)),i.createElement("div",{className:"form-group mb-4"},i.createElement("label",{htmlFor:"routingnumber"},"Routing number"),i.createElement("input",{type:"text",id:"routingnumber",className:"form-control",maxLength:9,placeholder:"000000000",name:"routingNumber",value:(Rt=N==null?void 0:N.routingNumber)!=null?Rt:"",onChange:vt}),(O==null?void 0:O.routingNumber)&&i.createElement("span",{className:"error-span"},O==null?void 0:O.routingNumber)),i.createElement("div",{className:"form-group mb-4"},i.createElement("label",{htmlFor:"accountnumber"},"Account number"),i.createElement("input",{type:"text",id:"accountnumber",className:"form-control",maxLength:16,placeholder:"0000000000",name:"accountNumber",value:(en=N==null?void 0:N.accountNumber)!=null?en:"",onChange:vt}),(O==null?void 0:O.accountNumber)&&i.createElement("span",{className:"error-span"},O==null?void 0:O.accountNumber)),i.createElement("div",{className:"form-group mb-4"},i.createElement("label",{htmlFor:"confirmaccountnumber"},"Confirm account number"),i.createElement("input",{type:"text",id:"confirmaccountnumber",className:"form-control",maxLength:16,placeholder:"0000000000",name:"confirmAccountNumber",value:(tn=N==null?void 0:N.confirmAccountNumber)!=null?tn:"",onChange:vt}),(O==null?void 0:O.confirmAccountNumber)&&i.createElement("span",{className:"error-span"},O==null?void 0:O.confirmAccountNumber)),i.createElement("div",{className:"form-group mb-4"},i.createElement("label",{htmlFor:"bankname"},"Bank name"),i.createElement("input",{type:"text",id:"bankname",className:"form-control",maxLength:100,placeholder:"My Bank",name:"bankName",value:(nn=N==null?void 0:N.bankName)!=null?nn:"",onChange:vt}),(O==null?void 0:O.bankName)&&i.createElement("span",{className:"error-span"},O==null?void 0:O.bankName)),((N==null?void 0:N.accountType)==="business saving"||(N==null?void 0:N.accountType)==="business checking")&&i.createElement("div",{className:"form-group mb-4"},i.createElement("label",{htmlFor:"companyName"},"Company name"),i.createElement("input",{type:"text",id:"companyName",className:"form-control",maxLength:100,placeholder:"My Company",name:"companyName",value:(un=N==null?void 0:N.companyName)!=null?un:"",onChange:vt}),(O==null?void 0:O.companyName)&&i.createElement("span",{className:"error-span"},O==null?void 0:O.companyName)),i.createElement("div",{className:"form-group mb-4"},i.createElement("label",{htmlFor:"accounttype"},"Select account type"),i.createElement("select",{name:"accountType",id:"accounttype",className:"form-control",value:(Gt=N==null?void 0:N.accountType)!=null?Gt:"",onChange:vt},i.createElement("option",{value:""},"Select account"),oi.map(_=>i.createElement("option",{key:_.value,value:_.value},_.label)))),(e==null?void 0:e.customerId)&&i.createElement("div",{className:"form-group mb-4 save-ach-div",style:{paddingTop:"5px"}},i.createElement("input",{type:"checkbox",id:"saveACH",className:"",maxLength:100,placeholder:"My Bank",checked:_e,onChange:_=>ct(_.target.checked)}),i.createElement("label",{htmlFor:"saveACH"},"Save ACH")),_e&&i.createElement("div",{className:"form-group mb-4",style:{fontSize:"12px",color:"#727272"}},i.createElement("p",null,"If checked, I agree for ",i.createElement("b",null,"ecommerce")," to have my permission to charge this credit card for agreed upon purchases in the future."))),i.createElement("div",{className:"form-group "},i.createElement("button",{className:"pay-button",style:{margin:"20px 0 0"},type:"submit"},xe((Ve=Number(Le))==null?void 0:Ve.toFixed(2)))))),i.createElement("div",{id:"reader",style:{display:G==="reader"?"block":"none"},className:"tabcontent"},i.createElement("div",{className:"frac-card-payment"},i.createElement("div",{className:"frac-heading-card-wrap"},i.createElement("div",{className:"frac-backarrow"}),i.createElement("h6",{className:"frac-card-payment-heading"},"Reader Payment"))),i.createElement(Bi,{listHeading:"Reader",ListItems:E==null?void 0:E.paymentDeviceList,selectedPax:ut,setSlectedPax:Re}),i.createElement("button",{onClick:_n,className:"pay-button"},"$",(jt=Number(e==null?void 0:e.amount))==null?void 0:jt.toFixed(2)))))))))))))}import m,{useEffect as Ki,useState as sn}from"react";import li from"axios";import Zi from"sweetalert2";import{IoArrowBack as sr}from"react-icons/io5";function lr(H){var z=H,{showButton:e=!0}=z,t=Un(z,["showButton"]);var ft,cn,vt,Yn,Ln,Ct,An,Sn,_n;let[B,Y]=sn(!1),[K,U]=sn(!1),[ve,Z]=sn(""),[A,G]=sn(!1),[se,w]=sn(!1),[v,ee]=sn("card"),[V,y]=sn(!1),[Se,P]=sn("card"),[Ue,Fe]=sn("form"),ce=t.merchantPublicKey,[_e,ct]=sn(void 0);Ki(()=>{t.onTriggerPay&&t.onTriggerPay(()=>{Le()})},[t]);let Ne=ne+"widget/mc-img.svg",Me=ne+"widget/visa-img.svg",ue=ne+"widget/ae-img.svg",qe=ne+"widget/discover-img.svg",$e=ne+"widget/card.svg",mn=ne+"widget/Trash.svg",Xt=ne+"widget/bank.svg",h=ne+"widget/secure-img.png",M=ne+"widget/pov-by.png",[u,ge]=sn(),[o,r]=sn({}),[a,b]=sn([]),[N,F]=sn(),[O,x]=sn(void 0),[f,k]=sn(),[He,dt]=sn(""),Be=(Q,$)=>{let Ze=(parseFloat($)||0)/100,Tt=Q/(1+Ze);return Math.round(Tt*100)/100};Ki(()=>{if(t!=null&&t.pass_fee){let Q=Be(t==null?void 0:t.amount,t==null?void 0:t.surcharge);x(Q)}},[t==null?void 0:t.pass_fee]);let Ft=()=>Y(!0),ut=()=>Y(!1),Re=()=>{w(!1),ee("card"),U(!1),Z(""),G(!1),dt(""),ge({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),r({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),y(!1),F({card_type:"",cardlastfourdigit:"",expmonth:1,expyear:2025,primary_card:0,firstname:"",id:"",lastname:""})},Le=()=>w(!0),pe=(Q,$)=>{let Ze=Q;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(Ze)){($===""||/^[0-9]+$/.test($))&&(r(Je=>L(C({},Je),{[Ze]:""})),ge(Je=>L(C({},Je),{[Ze]:$})));return}r(Je=>L(C({},Je),{[Ze]:""})),ge(Je=>L(C({},Je),{[Ze]:$}))},E=Q=>{var rt;let $=Q.target,Ze=$.value.replace(/\D/g,""),{formatted:Tt,cursor:Je}=Pn($.value,(rt=$.selectionStart)!=null?rt:0);r(ht=>L(C({},ht),{cardNumber:""})),ge(ht=>L(C({},ht),{cardNumber:Tt})),requestAnimationFrame(()=>{$.setSelectionRange(Je,Je)})},Pe=()=>{var Je,rt,ht,qt,Mt,zt;let Q={},$=u,Ze=parseInt(($==null?void 0:$.expiryMonth)||"",10),Tt=($==null?void 0:$.expiryYear)||"";if((Je=$==null?void 0:$.cardName)!=null&&Je.trim()||(Q.cardName="Card name is required"),(rt=$==null?void 0:$.cardNumber)!=null&&rt.trim()||(Q.cardNumber="Card number is required"),(!((ht=$==null?void 0:$.expiryMonth)!=null&&ht.trim())||!((qt=$==null?void 0:$.expiryYear)!=null&&qt.trim())||isNaN(Ze)||Ze<1||Ze>12||Tt.length!==4)&&(Q.expiryMonth="Invalid Expiration Date."),(Mt=$==null?void 0:$.cvv)!=null&&Mt.trim()||(Q.cvv="CVV is required"),(zt=$==null?void 0:$.zipCode)!=null&&zt.trim()||(Q.zipCode="ZIP code is required"),$!=null&&$.expiryMonth&&($!=null&&$.expiryYear)&&$.expiryMonth.length<=2&&$.expiryYear.length===4){let Wt=parseInt($.expiryMonth,10),ot=parseInt($.expiryYear,10),je=new Date,Yt=je.getMonth()+1,Ht=je.getFullYear();(ot<Ht||ot===Ht&&Wt<Yt)&&(Q.expiryMonth="Card is expired")}return r(Q),Object.keys(Q).length>0},at=async Q=>{var Ze,Tt,Je,rt,ht,qt,Mt,zt,Wt,ot,je,Yt,Ht,Dt,Rt,en,tn,nn,un;Q.preventDefault();let $=document.activeElement;if($ instanceof HTMLElement&&$.blur(),!K&&v=="card"){if(Pe())return;{let Ve=DatacapWebToken.validateCardNumber(u==null?void 0:u.cardNumber.replaceAll(" ","")),jt=DatacapWebToken.validateExpirationDate(u==null?void 0:u.expiryMonth,u==null?void 0:u.expiryYear),_=DatacapWebToken.validateCVV(u==null?void 0:u.cvv),g={};if(Ve||(g.cardNumber="Invalid card Number"),jt||(g.expiryMonth="Invalid Expiration Date."),_||(g.cvv="Invalid CVV"),r(g),Ve&&_&&jt){U(!0);try{let le=async function(fe){if(fe.Error)Z(fe.Error),U(!1);else{let te=u==null?void 0:u.cardName,Oe=u==null?void 0:u.zipCode;fe.name=te,fe.postal_code=Oe,fe.fractalpayPublicKey=t==null?void 0:t.merchantPublicKey,fe.amount=t==null?void 0:t.amount,fe.order_id=t==null?void 0:t.orderID,fe.preAuth_id=(t==null?void 0:t.preauthId)||"",fe.isCardSave=V,fe.customer_id=t==null?void 0:t.customerId,fe.link_token="",fe.gateway_id=f==null?void 0:f.paymentGateway,fe.discount=t==null?void 0:t.discount,fe.tax=t==null?void 0:t.tax,fe.surcharge=t==null?void 0:t.surcharge,fe.pass_fee=t==null?void 0:t.pass_fee,new Headers().append("Content-Type","application/json");let wt={method:"POST",body:JSON.stringify(fe),redirect:"follow"};It.emit("sendMessage",C(L(C({},wt),{isChargePreauth:!0}),(t==null?void 0:t.sessionToken)&&{sessionToken:t.sessionToken})),It.on("charge-preauth",We=>{var mt;(We==null?void 0:We.status)=="Failed"?(U(!1),Z((We==null?void 0:We.message)||"Something went wrong. Please try again later.")):(G(!0),dt((mt=We==null?void 0:We.data)==null?void 0:mt.transaction_id),U(!1),ge({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}))})}};if((f==null?void 0:f.paymentGateway)===32){let fe={method:"POST",redirect:"follow"};try{let te=await li.post(`${Ee}api/v1/widget/generate-session`,fe),Oe=Number(u==null?void 0:u.expiryYear)%100,ye=u==null?void 0:u.cardNumber;ye=ye==null?void 0:ye.replace(/\s+/g,"");let wt=`${ye}=${Oe}${u==null?void 0:u.expiryMonth} ${u==null?void 0:u.cvv}`,mt=forge.pki.publicKeyFromPem((Tt=(Ze=te==null?void 0:te.data)==null?void 0:Ze.data)==null?void 0:Tt.publicKeyPem).encrypt(wt,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),Vt=forge.util.encode64(mt),p={"Content-Type":"application/json","x-app-session-key":(rt=(Je=te.data)==null?void 0:Je.data)==null?void 0:rt.session_key},c=JSON.stringify({enc_track2_data:`${Vt}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(qt=(ht=te==null?void 0:te.data)==null?void 0:ht.data)==null?void 0:qt.session_key}`});try{let W=await li.post(`${rn}tokenizer/tokenize`,c,{headers:p}),ke=JSON.stringify(L(C({},(Mt=W==null?void 0:W.data)==null?void 0:Mt.data),{name:u==null?void 0:u.cardName,postal_code:u==null?void 0:u.zipCode,customer_id:t==null?void 0:t.customerId,amount:t==null?void 0:t.amount,Token:`${(Wt=(zt=W==null?void 0:W.data)==null?void 0:zt.data)==null?void 0:Wt.token}`,fractalpayPublicKey:ce,order_id:t==null?void 0:t.orderID,preAuth_id:(t==null?void 0:t.preauthId)||"",isCardSave:V,discount:t==null?void 0:t.discount,surcharge:t==null?void 0:t.surcharge,tax:t==null?void 0:t.tax,link_token:"",ExpirationYear:u==null?void 0:u.expiryYear,ExpirationMonth:u==null?void 0:u.expiryMonth,CVV:u==null?void 0:u.cvv,Last4:(je=(ot=W==null?void 0:W.data)==null?void 0:ot.data)==null?void 0:je.last4,Brand:(Ht=(Yt=W==null?void 0:W.data)==null?void 0:Yt.data)==null?void 0:Ht.brand,gateway_id:f==null?void 0:f.paymentGateway,pass_fee:t==null?void 0:t.pass_fee})),et={method:"POST",headers:{"Content-Type":"application/json"},body:ke,redirect:"follow"};It.emit("sendMessage",C(L(C({},et),{isFractalPreauth:!0}),(t==null?void 0:t.sessionToken)&&{sessionToken:t.sessionToken})),It.on("fractal-charge-preauth",Ce=>{var tt;(Ce==null?void 0:Ce.status)=="Failed"?(U(!1),Z((Ce==null?void 0:Ce.message)||"Something went wrong , Try again later")):(dt((tt=Ce==null?void 0:Ce.data)==null?void 0:tt.transaction_id),G(!0),U(!1))})}catch(W){console.log(W),U(!1),Z(((Rt=(Dt=W==null?void 0:W.response)==null?void 0:Dt.data)==null?void 0:Rt.message)||(W==null?void 0:W.message)||"Something went wrong , Try again later")}}catch(te){U(!1),Z(((tn=(en=te==null?void 0:te.response)==null?void 0:en.data)==null?void 0:tn.message)||(te==null?void 0:te.message)||"Something went wrong , Try again later")}}else DatacapWebToken.requestToken(f==null?void 0:f.dctoken,"PaymentForm",le)}catch(le){U(!1),Z(((un=(nn=le==null?void 0:le.response)==null?void 0:nn.data)==null?void 0:un.message)||(le==null?void 0:le.message)||"Something went wrong.")}}}}},D=async()=>{var Q,$,Ze,Tt,Je,rt,ht,qt,Mt,zt,Wt,ot,je,Yt,Ht,Dt,Rt,en,tn,nn,un;Ft();try{let Gt={fractalpayPublicKey:ce,customer_id:t==null?void 0:t.customerId,preauth:!0,isReader:!!(t!=null&&t.isReader)},Ve=await li.post(`${Qe}get-payment-details`,Gt);if(k((Q=Ve==null?void 0:Ve.data)==null?void 0:Q.data),(Ze=($=Ve==null?void 0:Ve.data)==null?void 0:$.data)!=null&&Ze.paymentGateway||(Re(),Z("Something went wrong.")),(Je=(Tt=Ve==null?void 0:Ve.data)==null?void 0:Tt.data)!=null&&Je.card_list&&((qt=(ht=(rt=Ve==null?void 0:Ve.data)==null?void 0:rt.data)==null?void 0:ht.card_list)==null?void 0:qt.length)>0){ee("card"),b((zt=(Mt=Ve==null?void 0:Ve.data)==null?void 0:Mt.data)==null?void 0:zt.card_list),((je=(ot=(Wt=Ve==null?void 0:Ve.data)==null?void 0:Wt.data)==null?void 0:ot.card_list)==null?void 0:je.length)>0&&Fe("list");let jt=(Dt=(Ht=(Yt=Ve==null?void 0:Ve.data)==null?void 0:Yt.data)==null?void 0:Ht.card_list)==null?void 0:Dt.filter(_=>(_==null?void 0:_.primary_card)==1);jt!=null&&jt[0]&&((Rt=jt==null?void 0:jt[0])==null?void 0:Rt.payment_method_type)==((tn=(en=Ve==null?void 0:Ve.data)==null?void 0:en.data)==null?void 0:tn.paymentGateway)&&F(jt[0])}else ee("card");ut()}catch(Gt){console.log(Gt),ut(),Z(((un=(nn=Gt==null?void 0:Gt.response)==null?void 0:nn.data)==null?void 0:un.message)||(Gt==null?void 0:Gt.message)||"Something went wrong")}},St=async Q=>{var je,Yt,Ht,Dt,Rt,en,tn;if(Q.currentTarget.blur(),K)return;let $=t==null?void 0:t.customerId,Ze=t==null?void 0:t.discount,Tt=t==null?void 0:t.surcharge,Je=t==null?void 0:t.tax,rt=t==null?void 0:t.merchantPublicKey,ht=t==null?void 0:t.orderID,qt=t==null?void 0:t.amount,Mt=N==null?void 0:N.id,zt=N==null?void 0:N.card_type,Wt=(t==null?void 0:t.preauthId)||"";if(rt&&ht&&qt)if($)if(Mt){let nn={amount:qt,order_id:ht,customer_id:$,card_id:Mt,fractalpayPublicKey:rt,isCardSave:zt!="Bank",discount:Ze,surcharge:Tt,tax:Je,preAuth_id:Wt},ot=nn,{isCardSave:un}=ot,Gt=Un(ot,["isCardSave"]),jt=Qe+"authorize-by-card",_=C({"Content-Type":"application/json"},(t==null?void 0:t.sessionToken)&&{"X-Session-Token":t.sessionToken});U(!0);try{let g=await li.post(jt,zt=="Bank"?Gt:nn,{headers:_});(je=g==null?void 0:g.data)!=null&&je.result&&(dt((Ht=(Yt=g==null?void 0:g.data)==null?void 0:Yt.data)==null?void 0:Ht.transaction_id),G(!0),U(!1))}catch(g){U(!1),console.log(g),Z(((Rt=(Dt=g==null?void 0:g.response)==null?void 0:Dt.data)==null?void 0:Rt.message)||((tn=(en=g==null?void 0:g.response)==null?void 0:en.data)==null?void 0:tn.status)||"Something went erong")}}else Z("Please Select A Card/ACH");else Z("Please Select Customer");else Z("Something went wrong.")};Ki(()=>{se&&ce&&D()},[ce,se]);let Ke=async Q=>{Zi.fire({icon:"warning",text:"Do you want to delete the card?",showCancelButton:!0,confirmButtonText:"Yes",cancelButtonText:"No",reverseButtons:!0,buttonsStyling:!1,customClass:{confirmButton:"swal2-confirm btn btn-dark",cancelButton:"swal2-cancel btn btn-dark",popup:"custom-swal-popup",icon:"custom-swal-icon"}}).then(async $=>{if($.isConfirmed){U(!0);try{let Ze={card_id:Q,customer_id:t==null?void 0:t.customerId,fractalpayPublicKey:t==null?void 0:t.merchantPublicKey},Tt=await li.post(`${Qe}delete-customer-card`,Ze);U(!1),D(),Zi.fire({icon:"success",title:"Deleted!",text:"The card has been deleted.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}catch(Ze){U(!1),Zi.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}})},_t=Q=>{switch(Q==null?void 0:Q.toLowerCase()){case"visa":return Me;case"mastercard":case"mc":case"m/c":return Ne;case"amex":case"american express":case"ae":return ue;case"discover":case"dcvr":return qe;case"bank":return Xt;default:return Q}},S=Q=>{ee(Q)},bn=async Q=>{var rt,ht,qt,Mt,zt,Wt;if(Q.currentTarget.blur(),K)return;let $=t==null?void 0:t.merchantPublicKey,Ze=t==null?void 0:t.orderID,Tt=String(t==null?void 0:t.amount),Je=t==null?void 0:t.customerId;if(!(_e!=null&&_e.device_id)){Z("Please Select A Payment Device");return}if($&&Ze&&Tt){U(!0);let ot={amount:Tt,fractalpayPublicKey:$,customer_order_id:Ze,device_id:_e==null?void 0:_e.device_id,customer_id:Je||"",is_auth:!0};try{let je=await li.post(`${Qe}charge-with-reader`,ot);((rt=je==null?void 0:je.data)==null?void 0:rt.result)==!0?(dt((qt=(ht=je==null?void 0:je.data)==null?void 0:ht.data)==null?void 0:qt.transaction_id),G(!0),U(!1)):(Z(((Mt=je==null?void 0:je.data)==null?void 0:Mt.message)||"Something went wrong."),U(!1))}catch(je){Z(((Wt=(zt=je==null?void 0:je.response)==null?void 0:zt.data)==null?void 0:Wt.message)||"Something went wrong."),U(!1)}}else Z("Something went wrong.")},Pt=Q=>{Se==="card"?St(Q):Se==="reader"&&bn(Q)};return m.createElement(m.Fragment,null,m.createElement(Cn,null),m.createElement(Xn,null),m.createElement(Kn,null),m.createElement(m.Fragment,null,e&&m.createElement("button",{className:"paymentBtn",onClick:Le},"PreAuth Payment"),m.createElement(yn,{open:se,onClose:Re},ve&&m.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},m.createElement(Fn,{error:ve,onClose:Re})),A&&m.createElement(Dn,{onClose:Re,tranId:He}),!ve&&!A&&m.createElement(m.Fragment,null,(B||K)&&m.createElement(an,{loading:B||K}),m.createElement("div",null,m.createElement("div",{className:"frac-card-payment-page frac-form"},m.createElement("div",{className:"parent-pay-container"},m.createElement("span",{className:"request-payment-close-popup",onClick:Re},m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},m.createElement("g",{clipPath:"url(#clip0_12425_52336)"},m.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),m.createElement("defs",null,m.createElement("clipPath",{id:"clip0_12425_52336"},m.createElement("rect",{width:"16",height:"16",fill:"white"}))))),m.createElement("div",{className:"pay-container"},m.createElement("div",{className:"pay-header pay-conatiner-one"},m.createElement("div",{className:"pay-conatiner-one-first"},m.createElement("div",{className:"pay-logo-container"},m.createElement("div",{className:"pay-main-logo"},m.createElement("img",{src:f==null?void 0:f.logo,id:"pay-logos"}))),m.createElement("div",{className:"amt-pay-con"},m.createElement("div",{className:"pay-amount-conatiner"},m.createElement("small",{className:"pay-payment-amount"},"Select paymet type")),m.createElement("div",{className:"frac-card-bank-radio-main"},m.createElement(Nn,{label:"Card",amount:(ft=Number(t==null?void 0:t.amount))==null?void 0:ft.toFixed(2),value:"card",onChange:S,activetab:v}),(t==null?void 0:t.isReader)&&(f==null?void 0:f.paymentDeviceList)&&((cn=f==null?void 0:f.paymentDeviceList)==null?void 0:cn.length)>0&&m.createElement(Nn,{label:"Reader",amount:(vt=Number(t==null?void 0:t.amount))==null?void 0:vt.toFixed(2),value:"reader",onChange:S,activetab:v})))),m.createElement("div",{className:"pay-conatiner-one-last"},m.createElement("img",{src:h,alt:""}),m.createElement("img",{src:M,alt:""}),"Secure payments powered by Fractal"),m.createElement("div",null)),!B&&m.createElement("div",{className:"pay-tab pay-conatiner-two"},m.createElement("div",{className:"col-md-12"},m.createElement("div",{id:"payment-form-div"},v!=="cardList"?m.createElement("div",null,m.createElement("div",{className:""},m.createElement("div",{className:"res-pay-con"},m.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},m.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),m.createElement("strong",{className:"pay-amount"},xe((Yn=Number(t==null?void 0:t.amount))==null?void 0:Yn.toFixed(2)))),m.createElement("div",null,m.createElement("div",null,m.createElement("img",{src:Me,alt:"",width:35,style:{paddingRight:"5px"}}),m.createElement("img",{src:Ne,width:35,alt:""})),m.createElement("div",null,m.createElement("img",{src:ue,alt:"",width:35,style:{paddingRight:"5px"}}),m.createElement("img",{src:qe,width:35,alt:""})))),O&&O>0&&m.createElement("div",{className:"res-pay-con frac-cash-discount"},m.createElement("div",{className:"frac-cashlabel"},In(f==null?void 0:f.showSurcharge)?"Surcharge":"Cash Discount"),m.createElement("div",null,xe(O.toFixed(2)))))):m.createElement("div",null,m.createElement("h6",{className:"charge-customer-name",style:{marginBottom:"16px !important"}}," Charge ",f==null?void 0:f.customer_name),m.createElement("div",{className:"res-pay-con"},m.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},m.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),m.createElement("strong",{className:"pay-amount"},xe((Ln=Number(t==null?void 0:t.amount))==null?void 0:Ln.toFixed(2)))),m.createElement("div",null,m.createElement("div",null,m.createElement("img",{src:Me,alt:"",width:35,style:{paddingRight:"5px"}}),m.createElement("img",{src:Ne,width:35,alt:""})),m.createElement("div",null,m.createElement("img",{src:ue,alt:"",width:35,style:{paddingRight:"5px"}}),m.createElement("img",{src:qe,width:35,alt:""})))),m.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}}," Cards")),m.createElement("div",{id:"card",style:{display:v==="card"?"block":"none"},className:"tabcontent"},m.createElement("div",{className:"frac-card-payment"},m.createElement("div",{className:"frac-heading-card-wrap"},m.createElement("div",{className:"frac-backarrow"},(a==null?void 0:a.length)>0&&Ue==="form"&&m.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>Fe("list")}," ",m.createElement(sr,null)),O&&O>0&&m.createElement("div",{className:"res-pay-con frac-cash-discount"},m.createElement("div",{className:"frac-cashlabel"},In(f==null?void 0:f.showSurcharge)?"Surcharge":"Cash Discount"),m.createElement("div",null,xe(O.toFixed(2))))),m.createElement("h6",{className:"frac-card-payment-heading"},"Card Authorization")),v!="ach"&&m.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0px 19px 0px"}},m.createElement("img",{src:Me,alt:"",width:33}),m.createElement("img",{src:Ne,width:33,alt:""}),m.createElement("img",{src:ue,alt:"",width:33}),m.createElement("img",{src:qe,width:33,alt:""}))),Ue==="list"?m.createElement(m.Fragment,null,m.createElement(Bn,{listHeading:"Cards",paymentGateway:f==null?void 0:f.paymentGateway,ListItems:a,selectedCard:N,setSelectedCard:F,handleDeleteCard:Ke,otherButtonLabel:"Pay With Other Card",otherButtonAction:()=>{Fe("form")}}),m.createElement("div",{className:"form-group",style:{padding:"0"}},m.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:Pt},xe((Ct=Number(t==null?void 0:t.amount))==null?void 0:Ct.toFixed(2))))):m.createElement("div",{id:"card",style:{display:v==="card"?"block":"none"},className:"tabcontent"},m.createElement("form",{id:"PaymentForm",onSubmit:at,onKeyDown:Q=>{Q.key==="Enter"&&K&&(Q.preventDefault(),Q.stopPropagation())}},m.createElement("div",{className:"ach-scrl",style:{minHeight:(a==null?void 0:a.length)>0?"462px":"520px",overflow:"auto",marginRight:"5px"}},m.createElement("div",{className:"form-group"},m.createElement("label",{htmlFor:"cardHolderName"},"Name on Card"),m.createElement("input",{type:"text",className:"form-control",placeholder:"John Doe",value:(u==null?void 0:u.cardName)||"",onChange:Q=>{let $=Q.target.value;/^[a-zA-Z\s]*$/.test($)&&pe("cardName",$)}}),(o==null?void 0:o.cardName)&&m.createElement("span",{className:"error-span"},o==null?void 0:o.cardName)),m.createElement("div",{className:"form-group"},m.createElement("label",{htmlFor:"cardNumber"},"Card Number"),m.createElement("div",{className:"toggle-num-wrapper"},m.createElement("input",{className:"form-control card-number-new",type:"text",maxLength:19,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:(u==null?void 0:u.cardNumber)||"",onChange:Q=>E(Q),"data-token":"card_number"}),m.createElement("div",{className:"card-crdi card-expiry-new"},m.createElement("div",{className:"exp-date-year-container"},m.createElement("div",{className:"exp-date form-group"},m.createElement("input",{"data-token":"exp_month",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"MM",maxLength:2,value:(u==null?void 0:u.expiryMonth)||"",onChange:Q=>pe("expiryMonth",Q.target.value)})),m.createElement("div",{className:"exp-year form-group"},m.createElement("input",{"data-token":"exp_year",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"YYYY",maxLength:4,value:(u==null?void 0:u.expiryYear)||"",onChange:Q=>pe("expiryYear",Q.target.value)})),m.createElement("div",{className:"security-digit form-group"},m.createElement("input",{"data-token":"cvv",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},maxLength:4,placeholder:"CVC",value:(u==null?void 0:u.cvv)||"",onChange:Q=>pe("cvv",Q.target.value)})))),(o==null?void 0:o.cardNumber)&&m.createElement("span",{className:"error-span"},o==null?void 0:o.cardNumber),m.createElement("p",{style:{margin:"0"}},o!=null&&o.expiryMonth||o!=null&&o.expiryYear?m.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},o==null?void 0:o.expiryMonth):"",(o==null?void 0:o.cvv)&&m.createElement("span",{className:"error-span"},o==null?void 0:o.cvv)))),m.createElement("div",{className:"form-group"},m.createElement("label",{htmlFor:"OrderId"},"Order ID / Description"),m.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"Enter Order id",disabled:!0,value:t==null?void 0:t.orderID,onChange:Q=>pe("orderId",Q.target.value),style:{background:"#F6F6F7",color:"#727272"}})),m.createElement("div",{className:"form-group"},m.createElement("label",{htmlFor:"zip"},"ZIP"),m.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"000000",value:(An=u==null?void 0:u.zipCode)!=null?An:"",onChange:Q=>pe("zipCode",Q.target.value)}),(o==null?void 0:o.zipCode)&&m.createElement("span",{className:"error-span"},o==null?void 0:o.zipCode)),(t==null?void 0:t.customerId)&&m.createElement("div",{className:"form-group"},m.createElement("div",{className:"frac-tooltip-mn",style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},m.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:V,onChange:Q=>y(Q.target.checked)}),m.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),m.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),m.createElement("div",{className:"frac-tooltip-wrapper"},m.createElement("div",{className:"frac-tooltip-icon"},m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},m.createElement("g",{clipPath:"url(#clip0_12420_50192)"},m.createElement("rect",{width:"20",height:"20",fill:"white"}),m.createElement("circle",{cx:"10",cy:"10",r:"10",fill:"#E0DFE2"}),m.createElement("path",{d:"M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z",fill:"#161616"})),m.createElement("defs",null,m.createElement("clipPath",{id:"clip0_12420_50192"},m.createElement("rect",{width:"20",height:"20",fill:"white"}))))),m.createElement("div",{className:"frac-tooltip-text"},m.createElement("p",null,"If checked, I agree to give the ",m.createElement("b",null,(f==null?void 0:f.bname)||"merchant")," permission to charge this credit card for agreed-upon purchases in the future.")))))),m.createElement("div",{className:"form-group",style:{marginTop:"20px",padding:0}},m.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},xe((Sn=Number(t==null?void 0:t.amount))==null?void 0:Sn.toFixed(2))))))),m.createElement("div",{id:"reader",style:{display:v==="reader"?"block":"none"},className:"tabcontent"},m.createElement("div",{className:"frac-card-payment"},m.createElement("div",{className:"frac-heading-card-wrap"},m.createElement("div",{className:"frac-backarrow"},O&&O>0&&m.createElement("div",{className:"res-pay-con frac-cash-discount"},m.createElement("div",{className:"frac-cashlabel"},In(f==null?void 0:f.showSurcharge)?"Surcharge":"Cash Discount"),m.createElement("div",null,xe(O.toFixed(2))))),m.createElement("h6",{className:"frac-card-payment-heading"},"Reader Authorization"))),m.createElement(Bi,{listHeading:"Reader",ListItems:f==null?void 0:f.paymentDeviceList,selectedPax:_e,setSlectedPax:ct}),m.createElement("button",{onClick:bn,className:"pay-button"},"$",(_n=Number(t==null?void 0:t.amount))==null?void 0:_n.toFixed(2))))))))))))))}import we,{useEffect as ur,useRef as vi,useState as Rn}from"react";import gr from"sweetalert2";import Ci from"axios";import dr from"react";function Wi(){let e="#000",t="#fff",H="#212529",z="#dee2e6";return dr.createElement("style",null,`
1734
+ .add-card {
1735
+ max-width:380px;
1736
+ padding: 0 20px
1737
+ }
1738
+ .add-card .form-group {
1739
+ margin-bottom: 5px;
1740
+ }
1741
+
1742
+ .add-card .idle-green-btn {
1743
+ color: white;
1744
+ background-color: rgba(97, 198, 153, 1);
1745
+ border-radius: 100px;
1746
+ border: none !important;
1747
+ padding: 12px 24px 12px 24px;
1748
+ width: 100%;
1749
+ cursor:pointer
1750
+ }
1751
+
1752
+ .add-card .idle-green-btn:hover {
1753
+ background-color: rgba(65, 164, 120, 1) !important;
1754
+ }
1755
+
1756
+ .add-card .idle-green-btn:focus {
1757
+ border: 2px solid rgba(90, 172, 136, 1) !important;
1758
+ background-color: rgba(97, 198, 153, 1) !important;
1759
+ padding: 10px 24px 10px 24px;
1760
+ }
1761
+
1762
+ .add-card .container-creditcard {
1763
+ width: 426px;
1764
+ padding: 24px;
1765
+ background-color: #FFFFFF;
1766
+ border-radius: 24px;
1767
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
1768
+ }
1769
+ .add-card .container-creditcard .request-payment-close-popup{
1770
+ position:absolute;
1771
+ // background:red
1772
+ }
1773
+
1774
+ .add-card h2 {
1775
+ font-size: 24px;
1776
+ line-height: 32px;
1777
+ font-weight: 500;
1778
+ color: #35254D;
1779
+ margin-bottom: 24px;
1780
+ text-align: center;
1781
+ }
1782
+ .add-card .form-group {
1783
+ margin-top: 20px;
1784
+ margin-bottom : 10px
1785
+ }
1786
+
1787
+ .add-card .credit-card {
1788
+ display: flex;
1789
+ flex-direction: column;
1790
+ justify-content: space-between;
1791
+ align-items: flex-start;
1792
+ padding: 20px;
1793
+ background-color: #35254D;
1794
+ color: #FFFFFF;
1795
+ border-radius: 15px;
1796
+ margin-bottom: 20px;
1797
+ }
1798
+
1799
+ .add-card .credit-card .chip {
1800
+ width: 50px;
1801
+ height: 30px;
1802
+ background-image: url('https://raw.githubusercontent.com/danieldasilvaa/creditcard-html-css/main/chip.png');
1803
+ background-size: cover;
1804
+ margin-bottom: 10px;
1805
+ }
1806
+
1807
+ .add-card .credit-card .card-number {
1808
+ font-size: 18px;
1809
+ letter-spacing: 2px;
1810
+ margin-bottom: 10px;
1811
+ }
1812
+
1813
+ .add-card .credit-card .card-info {
1814
+ font-size: 14px;
1815
+ margin-bottom: 5px;
1816
+ }
1817
+
1818
+ .add-card label {
1819
+ font-size: 12px;
1820
+ font-family: 'IBM Plex Mono', monospace;
1821
+ font-weight: 400;
1822
+ text-transform: uppercase;
1823
+ color: #35254D;
1824
+ margin-bottom: 6px;
1825
+ }
1826
+
1827
+ .add-card input[type="text"],
1828
+ .add-card input[type="number"],
1829
+ .add-card input[type="date"],
1830
+ .add-card input[type="email"],
1831
+ .add-card select {
1832
+ width: 100%;
1833
+ padding: 12px;
1834
+ font-size: 14px;
1835
+ font-weight: 500;
1836
+ color: #35254D;
1837
+ border: 1px solid #D4CDDF;
1838
+ border-radius: 6px;
1839
+ background-color: #FFFFFF;
1840
+ box-sizing: border-box;
1841
+ // margin-bottom: 20px;
1842
+ }
1843
+
1844
+ .add-card input[type="text"]::placeholder {
1845
+ color: #867C94;
1846
+ }
1847
+
1848
+ // .add-card input[type="submit"] {
1849
+ // width: 100%;
1850
+ // padding: 12px;
1851
+ // background-color: #161616;
1852
+ // color: #FFFFFF;
1853
+ // font-size: 14px;
1854
+ // font-weight: 500;
1855
+ // border: none;
1856
+ // border-radius: 1000px;
1857
+ // cursor: pointer;
1858
+ // text-align: center;
1859
+ // }
1860
+
1861
+ .add-card input[type="submit"]:hover {
1862
+ background-color: #000000;
1863
+ }
1864
+
1865
+ .add-card .error {
1866
+ font-size: 12px;
1867
+ color: red;
1868
+ margin-top: -15px;
1869
+ margin-bottom: 15px;
1870
+ }
1871
+
1872
+ /* Tab Styling */
1873
+ .add-card .tabs {
1874
+ display: flex;
1875
+ gap: 4px;
1876
+ margin-bottom: 24px;
1877
+ justify-content: center;
1878
+ }
1879
+
1880
+ .add-card .tab {
1881
+ display: flex;
1882
+ justify-content: center;
1883
+ align-items: center;
1884
+ padding: 6px 16px;
1885
+ font-size: 14px;
1886
+ font-weight: 500;
1887
+ border: 1px solid #D4CDDF;
1888
+ border-radius: 1000px;
1889
+ cursor: pointer;
1890
+ }
1891
+
1892
+ .add-card .tab.active {
1893
+ border-color: #35254D;
1894
+ color: #35254D;
1895
+ }
1896
+
1897
+ .add-card .tab:hover {
1898
+ border-color: #867C94;
1899
+ }
1900
+
1901
+ /* Buttons */
1902
+ .add-card .button-close {
1903
+ display: inline-block;
1904
+ background-color: #161616;
1905
+ color: #FFFFFF;
1906
+ font-size: 14px;
1907
+ font-weight: 500;
1908
+ padding: 12px 32px;
1909
+ border-radius: 1000px;
1910
+ text-align: center;
1911
+ cursor: pointer;
1912
+ width: 48%;
1913
+ box-sizing: border-box;
1914
+ }
1915
+
1916
+ .add-card .button-close:hover {
1917
+ background-color: #000000;
1918
+ }
1919
+
1920
+ .add-card .btn-add1 {
1921
+ display: inline-block;
1922
+ background-color: #61c699;
1923
+ color: #FFFFFF;
1924
+ font-size: 14px;
1925
+ font-weight: 500;
1926
+ padding: 12px 32px;
1927
+ border-radius: 1000px;
1928
+ text-align: center;
1929
+ cursor: pointer;
1930
+ width: 48%;
1931
+ box-sizing: border-box;
1932
+ }
1933
+
1934
+ .add-card .btn-add1:hover {
1935
+ background-color: #B5E1CB;
1936
+ }
1937
+
1938
+ /* Combined Expiration Date and CVC Row */
1939
+ .add-card .exp-cvc-container {
1940
+ display: flex;
1941
+ justify-content: space-between;
1942
+ gap: 16px;
1943
+ margin-bottom: 5px;
1944
+ }
1945
+
1946
+ .add-card .exp-cvc-container input {
1947
+ flex: 1;
1948
+ padding: 12px;
1949
+ font-size: 14px;
1950
+ font-weight: 500;
1951
+ color: #35254D;
1952
+ border: 1px solid #D4CDDF;
1953
+ border-radius: 6px;
1954
+ background-color: #FFFFFF;
1955
+ box-sizing: border-box;
1956
+ }
1957
+
1958
+ .add-card .exp-cvc-container input::placeholder {
1959
+ color: #867C94;
1960
+ }
1961
+
1962
+ .card-scrl {
1963
+ overflow-y: auto;
1964
+ padding-right: 6px !important;
1965
+ }
1966
+ .card-scrl::-webkit-scrollbar {
1967
+ width: 3px;
1968
+ background-color: #F5F5F5;
1969
+ }
1970
+ .card-scrl::-webkit-scrollbar-thumb {
1971
+ background-color: #35254D;
1972
+ }
1973
+
1974
+ .custom-z-index {
1975
+ z-index: 9999 !important;
1976
+ }
1977
+ #add-credit-card-panel{
1978
+ padding: auto 10px !important}
1979
+ /* Responsive Design */
1980
+ @media screen and (max-width: 768px) {
1981
+ .add-card .container-creditcard {
1982
+ width: 90%;
1983
+ padding: 20px;
1984
+ }
1985
+
1986
+ .add-card input[type="submit"] {
1987
+ font-size: 12px;
1988
+ padding: 10px;
1989
+ }
1990
+ }
1991
+
1992
+ `)}import qn from"react";import mr from"react";function Gi(){return mr.createElement("style",null,`
1993
+ .card-success .logo-container {
1994
+ display: flex;
1995
+ justify-content: center;
1996
+ align-items: center;
1997
+ margin-bottom: -50px; /* Adjust this to overlap the content */
1998
+ z-index: 10;
1999
+ }
2000
+
2001
+ .card-success .client-logo {
2002
+ max-width: 100px;
2003
+ height: auto;
2004
+ object-fit: contain;
2005
+ display: block;
2006
+ }
2007
+
2008
+ .card-success .payment-success-container {
2009
+ display: flex;
2010
+ flex-direction: column;
2011
+ align-items: center;
2012
+ padding: 18px 20px 24px;
2013
+ width: 335px;
2014
+ height: 400px; /* Fixed height */
2015
+ background: #FFFFFF;
2016
+ border-radius: 12px;
2017
+ position: relative;
2018
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
2019
+ border: 1px solid #e3e3e3;
2020
+ justify-content: center;
2021
+ text-align: center;
2022
+ // margin-top: 50px; /* Adjust this to move the content down */
2023
+ margin: 50px auto 0 auto !important;
2024
+ }
2025
+
2026
+ .card-success .success-icon {
2027
+ display: flex;
2028
+ flex-direction: column;
2029
+ align-items: center;
2030
+ gap: 12px;
2031
+ width: 227px;
2032
+ height: 116px;
2033
+ z-index: 2;
2034
+ }
2035
+
2036
+ .card-success .circle {
2037
+ width: 40px;
2038
+ height: 40px;
2039
+ border: 1px solid #49B182;
2040
+ border-radius: 50%;
2041
+ display: flex;
2042
+ justify-content: center;
2043
+ align-items: center;
2044
+ }
2045
+
2046
+ .card-success .circle .fa-check-circle {
2047
+ font-size: 20px;
2048
+ color: #49B182;
2049
+ }
2050
+
2051
+ .card-success .success-text {
2052
+ display: flex;
2053
+ flex-direction: column;
2054
+ justify-content: center;
2055
+ align-items: center;
2056
+ gap: 4px;
2057
+ width: 227px;
2058
+ }
2059
+
2060
+ .card-success .payment-success-text {
2061
+ font-family: 'Inter', sans-serif;
2062
+ font-weight: 500;
2063
+ font-size: 18px;
2064
+ line-height: 21px;
2065
+ text-align: center;
2066
+ letter-spacing: -0.02em;
2067
+ color: #161616;
2068
+ }
2069
+
2070
+ .card-success .thank-you-text {
2071
+ font-family: 'Inter', sans-serif;
2072
+ font-weight: 500;
2073
+ font-size: 14px;
2074
+ line-height: 18px;
2075
+ text-align: center;
2076
+ letter-spacing: -0.02em;
2077
+ color: #161616;
2078
+ opacity: 0.5;
2079
+ }
2080
+ `)}var cr=({onClose:e})=>qn.createElement(qn.Fragment,null,qn.createElement(Gi,null),qn.createElement("div",{className:"card-success"},qn.createElement("div",{className:"payment-success-container"},qn.createElement("div",{className:"success-icon"},qn.createElement("div",{className:"circle"},qn.createElement("i",{className:"fa fa-check-circle","aria-hidden":"true"})),qn.createElement("div",{className:"success-text"},qn.createElement("div",{className:"payment-success-text"},"Your card was added successfully."),qn.createElement("div",{className:"thank-you-text"},"Thank you ")))))),xa=cr;function pr(e){var Xt;let[t,H]=Rn(!1),[z,B]=Rn(!1),[Y,K]=Rn(""),[U,ve]=Rn(!1),Z=vi(null),A=vi(null),G=vi(null),se=vi(null),w=vi(null),[v,ee]=Rn(),[V,y]=Rn({}),[Se,P]=Rn(),Ue=()=>H(!0),Fe=()=>H(!1),ce=h=>{gr.fire({icon:"error",text:h,customClass:{popup:"custom-z-index"}})},_e=()=>{ve(!1),B(!1),K(""),ee({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""})},ct=()=>ve(!0),Ne=()=>{_e()},Me=(h,M)=>{var o,r,a;let u=h,ge=["expiryMonth","expiryYear","zipCode","cvv"];if(u==="expiryMonth"&&(M==null?void 0:M.length)===2&&((o=G==null?void 0:G.current)==null||o.focus()),u==="expiryYear"&&(M==null?void 0:M.length)===4&&((r=se==null?void 0:se.current)==null||r.focus()),u==="cvv"&&(M==null?void 0:M.length)===3&&((a=w==null?void 0:w.current)==null||a.focus()),ge.includes(u)){(M===""||/^[0-9]+$/.test(M))&&(y(b=>L(C({},b),{[u]:""})),ee(b=>L(C({},b),{[u]:M})));return}y(b=>L(C({},b),{[u]:""})),console.log(M,u),ee(b=>L(C({},b),{[u]:M}))},ue=h=>{var r,a;let M=h.target,u=M.value.replace(/\D/g,""),{formatted:ge,cursor:o}=Pn(M.value,(r=M.selectionStart)!=null?r:0);y(b=>L(C({},b),{cardNumber:""})),ee(b=>L(C({},b),{cardNumber:ge})),console.log(u==null?void 0:u.length,"length"),(u==null?void 0:u.length)===16&&((a=A==null?void 0:A.current)==null||a.focus()),requestAnimationFrame(()=>{M.setSelectionRange(o,o)})},qe=()=>{var o,r,a,b,N,F;let h={},M=v,u=parseInt((M==null?void 0:M.expiryMonth)||"",10),ge=(M==null?void 0:M.expiryYear)||"";if((o=M==null?void 0:M.cardName)!=null&&o.trim()||(h.cardName="Card name is required"),(r=M==null?void 0:M.cardNumber)!=null&&r.trim()||(h.cardNumber="Card number is required"),(a=M==null?void 0:M.expiryMonth)!=null&&a.trim()?(Number(M==null?void 0:M.expiryMonth)>12||Number(M==null?void 0:M.expiryMonth)<1)&&(h.expiryMonth="Invalid Expiration Month."):h.expiryMonth="Expiration month is required",(b=M==null?void 0:M.expiryYear)!=null&&b.trim()?((N=M==null?void 0:M.expiryYear)==null?void 0:N.trim().length)!==4||Number(M==null?void 0:M.expiryYear)<2025?h.expiryYear="Invalid Expiration Year.":(isNaN(u)||u<1||u>12||ge.length!==4)&&(h.expiryMonth="Invalid Expiration Date."):h.expiryYear="Expiration year is required",(F=M==null?void 0:M.cvv)!=null&&F.trim()||(h.cvv="CVC is required"),M!=null&&M.expiryMonth&&(M!=null&&M.expiryYear)&&M.expiryMonth.length<=2&&M.expiryYear.length===4){let O=parseInt(M.expiryMonth,10),x=parseInt(M.expiryYear,10),f=new Date,k=f.getMonth()+1,He=f.getFullYear();(x<He||x===He&&O<k)&&(h.expiryMonth="Card is expired")}return y(h),Object.keys(h).length>0},$e=async()=>{var h,M,u;Ue();try{let ge={fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,customer_id:e==null?void 0:e.customerId,addcard:!0},o=await Ci.post(`${Qe}get-payment-details`,ge);console.log(o),P((h=o==null?void 0:o.data)==null?void 0:h.data),(u=(M=o==null?void 0:o.data)==null?void 0:M.data)!=null&&u.paymentGateway||(_e(),K("Something went wrong.")),Fe()}catch(ge){console.log(ge),Fe(),_e(),K("Something went wrong.")}};return ur(()=>{e!=null&&e.merchantPublicKey&&$e()},[e==null?void 0:e.merchantPublicKey]),we.createElement(we.Fragment,null,we.createElement(Cn,null),we.createElement(Wi,null),we.createElement(an,{loading:t}),Y&&we.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},we.createElement(Fn,{error:Y,onClose:_e})),z&&we.createElement(xa,{onClose:Ne}),!Y&&!z&&we.createElement(we.Fragment,null,we.createElement("div",{className:"container-creditcard add-card modal-content",id:"add-credit-card-panel",style:{margin:"auto"}},we.createElement("form",{id:"creditCardForm",onSubmit:async h=>{var ge,o,r,a,b,N,F,O,x,f,k,He,dt,Be,Ft,ut;h.preventDefault(),h.currentTarget.blur();let M=document.activeElement;if(M instanceof HTMLElement&&M.blur(),t)return;let u=qe();if(console.log(v),!u){let Re=DatacapWebToken.validateCardNumber(v==null?void 0:v.cardNumber.replaceAll(" ","")),Le=DatacapWebToken.validateExpirationDate(v==null?void 0:v.expiryMonth,v==null?void 0:v.expiryYear),pe=DatacapWebToken.validateCVV(v==null?void 0:v.cvv),E={};if(Re||(E.cardNumber="Invalid card Number"),Le||(E.expiryMonth="Invalid Expiration Date."),pe||(E.cvv="Invalid CVV"),y(E),Re&&pe&&Le){Ue();try{let Pe=async function(at){var D,St,Ke;if(console.log(at),at.Error)console.log(at==null?void 0:at.Error),K(at.Error),Fe();else{let _t={userId:e==null?void 0:e.customerId,cardName:v==null?void 0:v.cardName,zip:v==null?void 0:v.zipCode,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,token:at};try{let S=await Ci.post(`${Qe}add-card`,_t);console.log(S),(D=S==null?void 0:S.data)!=null&&D.result&&(B(!0),Fe(),ee({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),Wn(h,"close",""))}catch(S){console.log(S),Fe(),K(((Ke=(St=S==null?void 0:S.response)==null?void 0:St.data)==null?void 0:Ke.message)||(S==null?void 0:S.message)||"Something went wrong.")}}};if((Se==null?void 0:Se.paymentGateway)===32){let at={method:"POST",redirect:"follow"};try{let D=await Ci.post(`${Ee}api/v1/widget/generate-session`,at),St=Number(v==null?void 0:v.expiryYear)%100,Ke=v==null?void 0:v.cardNumber;Ke=Ke==null?void 0:Ke.replace(/\s+/g,"");let _t=`${Ke}=${St}${v==null?void 0:v.expiryMonth} ${v==null?void 0:v.cvv}`,bn=forge.pki.publicKeyFromPem((o=(ge=D==null?void 0:D.data)==null?void 0:ge.data)==null?void 0:o.publicKeyPem).encrypt(_t,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),Pt=forge.util.encode64(bn),ft={"Content-Type":"application/json","x-app-session-key":(a=(r=D.data)==null?void 0:r.data)==null?void 0:a.session_key},cn=JSON.stringify({enc_track2_data:`${Pt}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(N=(b=D==null?void 0:D.data)==null?void 0:b.data)==null?void 0:N.session_key}`});try{let vt=await Ci.post(`${rn}tokenizer/tokenize`,cn,{headers:ft}),Yn=JSON.stringify(L(C({},(F=vt==null?void 0:vt.data)==null?void 0:F.data),{cvv:v==null?void 0:v.cvv,cardName:v==null?void 0:v.cardName,zip:v==null?void 0:v.zipCode,userId:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey})),Ln={"Content-Type":"application/json"};try{let Ct=await Ci.post(`${Qe}add-card`,Yn,{headers:Ln});console.log(Ct),(O=Ct==null?void 0:Ct.data)!=null&&O.result&&(B(!0),Fe(),Wn(h,"close",""))}catch(Ct){Fe(),K(((f=(x=Ct==null?void 0:Ct.response)==null?void 0:x.data)==null?void 0:f.message)||(Ct==null?void 0:Ct.message)||"Something went wrong.")}}catch(vt){Fe(),K(((He=(k=vt==null?void 0:vt.response)==null?void 0:k.data)==null?void 0:He.message)||(vt==null?void 0:vt.message)||"Something went wrong.")}}catch(D){Fe(),K(((Be=(dt=D==null?void 0:D.response)==null?void 0:dt.data)==null?void 0:Be.message)||(D==null?void 0:D.message)||"Something went wrong.")}}else typeof DatacapWebToken!="undefined"&&DatacapWebToken.requestToken(Se==null?void 0:Se.dctoken,"creditCardForm",Pe)}catch(Pe){Fe(),K(((ut=(Ft=Pe==null?void 0:Pe.response)==null?void 0:Ft.data)==null?void 0:ut.message)||(Pe==null?void 0:Pe.message)||"Something went wrong.")}}}},onKeyDown:h=>{h.key==="Enter"&&t&&(h.preventDefault(),h.stopPropagation())},style:{padding:"0 10px"}},we.createElement("div",{style:{maxHeight:"350px",minHeight:"0"},className:"card-scrl"},we.createElement("div",{className:"form-group",style:{marginTop:"0",marginBottom:"10px"}},we.createElement("label",{htmlFor:"cardNumber"},"Card Number"),we.createElement("input",{type:"text","data-token":"card_number",placeholder:"Enter card number",maxLength:19,inputMode:"numeric",value:(v==null?void 0:v.cardNumber)||"",onChange:h=>ue(h),ref:Z}),(V==null?void 0:V.cardNumber)&&we.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},V==null?void 0:V.cardNumber),we.createElement("br",null)),we.createElement("div",{className:"card-dtl"},we.createElement("div",{className:"exp-cvc-container",style:{margin:"0"}},we.createElement("div",{className:"form-group",style:{marginTop:"0"}},we.createElement("label",{htmlFor:"expMonth"},"MM"),we.createElement("input",{"data-token":"exp_month",className:"form-control required",type:"text",placeholder:"MM",maxLength:2,value:(v==null?void 0:v.expiryMonth)||"",onChange:h=>Me("expiryMonth",h.target.value),ref:A}),(V==null?void 0:V.expiryMonth)&&we.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},V==null?void 0:V.expiryMonth)),we.createElement("div",{className:"form-group",style:{marginTop:"0"}},we.createElement("label",{htmlFor:"expYear"},"YYYY"),we.createElement("input",{"data-token":"exp_year",className:"form-control required",type:"text",placeholder:"YYYY",maxLength:4,value:(v==null?void 0:v.expiryYear)||"",onChange:h=>Me("expiryYear",h.target.value),ref:G}),(V==null?void 0:V.expiryYear)&&we.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},V==null?void 0:V.expiryYear)),we.createElement("div",{className:"form-group",style:{marginTop:"0"}},we.createElement("label",{htmlFor:"cvc"},"CVC"),we.createElement("input",{"data-token":"cvv",className:"form-control required",type:"text",placeholder:"CVC",maxLength:4,value:(v==null?void 0:v.cvv)||"",onChange:h=>Me("cvv",h.target.value),ref:se}),(V==null?void 0:V.cvv)&&we.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},V==null?void 0:V.cvv)))),we.createElement("div",{className:"form-group",style:{marginTop:"0"}},we.createElement("label",{htmlFor:"cardholderName"},"Name on card"),we.createElement("input",{type:"text",id:"cardholderName",name:"cardholderName",placeholder:"Name on card required",value:(v==null?void 0:v.cardName)||"",onChange:h=>{let M=h.target.value;/^[a-zA-Z\s]*$/.test(M)&&Me("cardName",M)},ref:w}),(V==null?void 0:V.cardName)&&we.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},V==null?void 0:V.cardName)),we.createElement("div",{className:"form-group",style:{marginTop:"0"}},we.createElement("label",{htmlFor:"zipcode"},"Zip"),we.createElement("input",{type:"text",id:"",name:"zipcode",placeholder:"Zip",value:(Xt=v==null?void 0:v.zipCode)!=null?Xt:"",onChange:h=>Me("zipCode",h.target.value)}),(V==null?void 0:V.zipCode)&&we.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},V==null?void 0:V.zipCode))),we.createElement("input",{type:"submit",className:"idle-green-btn w-100",defaultValue:"Submit",disabled:t})))))}import q,{useState as di}from"react";import wi from"axios";var Hi={PROPAYKEY:"25",PAYARCKEY:"26",STRIPEKEYCC:"27",PAYRIXKEY:"28",SKYFIACHKEY:"29",JUSTIFIKEY:"30",INFINICEPTKEY:"31",FRACTALKEY:"32"};import fr from"react";function Ui({}){return fr.createElement("style",null,`
2081
+ @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap");
2082
+
2083
+ .creditformbox {
2084
+ // max-width: 550px;
2085
+ margin: 0 auto;
2086
+ font-family: Poppins !important;
2087
+ }
2088
+
2089
+ .name-row {
2090
+ display: grid;
2091
+ grid-gap: 10px;
2092
+ grid-template-columns:1fr 1fr;
2093
+ }
2094
+
2095
+ label {
2096
+ display: block;
2097
+ color: #383838;
2098
+ font-size: 16px;
2099
+ }
2100
+
2101
+ .form-group span.text-danger{
2102
+ color:red;
2103
+ }
2104
+ .form-group small.error{
2105
+ color:red;
2106
+ font-size:11px;
2107
+ }
2108
+ .name-row .form-group {
2109
+ display: block;
2110
+ width: 100%;
2111
+ margin-bottom: 15px;
2112
+ }
2113
+
2114
+ .creditformbox input, .creditformbox select {
2115
+ border: 1.25px solid rgba(234, 236, 239, 1);
2116
+ color: rgba(94, 94, 94, 0.75);
2117
+ border-radius: 10px;
2118
+ width: -webkit-fill-available;
2119
+ padding: 10px 12px;
2120
+ font-size: .875rem;
2121
+ min-height: 20px;
2122
+ }
2123
+
2124
+ .form-pay-row {
2125
+ display: block;
2126
+ width: 100%;
2127
+ }
2128
+
2129
+ .form-pay-row .form-group {
2130
+ display: block;
2131
+ width: 100%;
2132
+ margin-bottom: 15px;
2133
+ }
2134
+
2135
+ .card-pay-row {
2136
+ display: flex;
2137
+ width: 100%;
2138
+ gap: 10px;
2139
+ flex-wrap: wrap;
2140
+ }
2141
+
2142
+ .card-pay-row .form-group {
2143
+ flex: 1;
2144
+ margin-bottom: 15px;
2145
+ min-width: 100px;
2146
+ }
2147
+
2148
+ .creditformbox input:focus {
2149
+ color: #212529;
2150
+ background-color: #fff;
2151
+ border-color: #86b7fe;
2152
+ outline: 0;
2153
+ box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
2154
+ }
2155
+
2156
+ .checks-row{
2157
+ display:flex;
2158
+ align-items:start;
2159
+ gap:10px
2160
+ }
2161
+ .checks-row input {
2162
+ border: 1.25px solid rgba(234, 236, 239, 1);
2163
+ color: rgba(94, 94, 94, 0.75);
2164
+ border-radius: 10px;
2165
+ min-width: 16px !important;
2166
+ width:16px !important;
2167
+ padding: 10px 12px;
2168
+ font-size: .875rem;
2169
+ max-height: 16px !important;
2170
+ height: 16px !important;
2171
+ }
2172
+ // .checks-row input.is-valid:checked{
2173
+ // background-color: #198754;
2174
+ // border-color: #198754;
2175
+ // background-image: url(data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e);
2176
+ // }
2177
+ .check-error{
2178
+ color:red;
2179
+ font-size:11px;
2180
+ padding-left:25px
2181
+ }
2182
+ .button-row{
2183
+ display: flex;
2184
+ width: 100%;
2185
+ gap: 10px;
2186
+ flex-wrap: wrap;
2187
+ margin-top: 20px !important
2188
+ }
2189
+ .button-row .btn{
2190
+ flex: 1;
2191
+ margin-top:20px;
2192
+ }
2193
+
2194
+ .cancelbtn {
2195
+ font-size:15px;
2196
+ color: #000000 !important;
2197
+ background-color: transparent !important;
2198
+ background: transparent !important;
2199
+ border:1px solid #000000 !important;
2200
+ border-radius: 10px !important;
2201
+ padding: 10px 25px !important;
2202
+ cursor:pointer;
2203
+ font-size: 16px;
2204
+ }
2205
+ .cancelbtn:hover {
2206
+ background:#000000 !important;
2207
+ color:#ffffff !important;
2208
+ }
2209
+
2210
+ .savebtn {
2211
+ font-size:15px;
2212
+ color: #2979FF;
2213
+ background-color: transparent;
2214
+ background: transparent;
2215
+ border:1px solid #2979FF;
2216
+ border-radius: 10px;
2217
+ padding: 10px 25px;
2218
+ cursor:pointer;
2219
+ font-size: 16px;
2220
+ }
2221
+ .savebtn:hover {
2222
+ background:#2979FF;
2223
+ color:#ffffff;
2224
+ }
2225
+
2226
+ .toggle-label {
2227
+ position: relative;
2228
+ display: inline-block;
2229
+ width: 40px;
2230
+ height: 24px;
2231
+ background-color: #ccc;
2232
+ border-radius: 12px;
2233
+ cursor: pointer;
2234
+ transition: background-color 0.3s;
2235
+ }
2236
+
2237
+ .toggle-label::before {
2238
+ content: "";
2239
+ position: absolute;
2240
+ top: 2px;
2241
+ left: 2px;
2242
+ width: 20px;
2243
+ height: 20px;
2244
+ background: #ffffff;
2245
+ border-radius: 50%;
2246
+ transition: left 300ms linear;
2247
+ }
2248
+
2249
+ .toggle-checkbox {
2250
+ display: none;
2251
+ }
2252
+
2253
+ .toggle-checkbox:checked + .toggle-label {
2254
+ background-color: #4caf50;
2255
+ }
2256
+
2257
+ .toggle-checkbox:checked + .toggle-label::before {
2258
+ left: 18px;
2259
+ }
2260
+ .pass-fee-toggle-div {
2261
+ display: flex;
2262
+ align-items: center;
2263
+ gap: 10px;
2264
+ padding-top: 10px;
2265
+ }
2266
+ `)}function hr({session_token:e,callback:t,isloading:H,onCancel:z,showChecks:B,merchantName:Y,signCheckbox:K,checkedSignCheckbox:U,onCheckSign:ve,cancelbtnClass:Z,savebtnClass:A,inputClass:G,isDual:se}){var o;let[w,v]=di(!1),[ee,V]=di(!1),[y,Se]=di(),[P,Ue]=di({}),[Fe,ce]=di(""),_e=()=>v(!0),ct=()=>v(!1),[Ne,Me]=di(!1),ue=()=>{var F,O,x,f,k,He,dt,Be;let r={},a=y,b=parseInt((a==null?void 0:a.expiryMonth)||"",10),N=(a==null?void 0:a.expiryYear)||"";return(F=a==null?void 0:a.firstName)!=null&&F.trim()||(r.firstName="Please enter a first name."),(O=a==null?void 0:a.lastName)!=null&&O.trim()||(r.lastName="Please enter a last name."),(x=a==null?void 0:a.cardNumber)!=null&&x.trim()||(r.cardNumber="Please enter a card number."),(f=a==null?void 0:a.expiryMonth)!=null&&f.trim()?(Number(a==null?void 0:a.expiryMonth)>12||Number(a==null?void 0:a.expiryMonth)<1)&&(r.expiryMonth="Invalid Expiration Month."):r.expiryMonth="Please enter an expiry month.",(k=a==null?void 0:a.expiryYear)!=null&&k.trim()?((He=a==null?void 0:a.expiryYear)==null?void 0:He.trim().length)!==4||Number(a==null?void 0:a.expiryYear)<2025?r.expiryYear="Invalid Expiration Year.":(isNaN(b)||b<1||b>12||N.length!==4)&&(r.expiryMonth="Invalid Expiration Date."):r.expiryYear="Please enter an expiry year.",(dt=a==null?void 0:a.cvv)!=null&&dt.trim()||(r.cvv="Please enter a CVV."),(Be=a==null?void 0:a.zipCode)!=null&&Be.trim()||(r.zipCode="Please enter a zip code."),K&&!U&&(r.checkSign="You must authorize this before proceeding."),B&&!(a!=null&&a.authHold)&&(r.authHold="You must authorize this before proceeding."),B&&!(a!=null&&a.authorise)&&(r.authorise="Please confirm your authorization to continue."),Ue(r),Object.keys(r).length>0},qe=r=>{var O;let a=r.target,b=a.value.replace(/\D/g,""),{formatted:N,cursor:F}=Pn(a.value,(O=a.selectionStart)!=null?O:0);Ue(x=>L(C({},x),{cardNumber:""})),Se(x=>L(C({},x),{cardNumber:N})),requestAnimationFrame(()=>{a.setSelectionRange(F,F)})},$e=(r,a)=>{let b=r;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(b)){(a===""||/^[0-9]+$/.test(a))&&(Ue(F=>L(C({},F),{[b]:""})),Se(F=>L(C({},F),{[b]:a})));return}Ue(F=>L(C({},F),{[b]:""})),Se(F=>L(C({},F),{[b]:a}))},mn=()=>{let r=DatacapWebToken.validateCardNumber(y==null?void 0:y.cardNumber.replaceAll(" ","")),a=DatacapWebToken.validateExpirationDate(y==null?void 0:y.expiryMonth,y==null?void 0:y.expiryYear),b=DatacapWebToken.validateCVV(y==null?void 0:y.cvv),N={};return r||(N.cardNumber="Invalid card Number"),a||(N.expiryMonth="Invalid Expiration Date."),b||(N.cvv="Invalid CVV"),Ue(N),r&&b&&a},Xt=async r=>{var a,b;if(r.Error)ce(r.Error),ct();else{let N={token:r.Token,resp:r},F=await wi.post(`${Ee}api/v1/gateway/update/token/${e}`,N);if((F==null?void 0:F.status)==200){let O=C(C({Token:(b=(a=F==null?void 0:F.data)==null?void 0:a.data)==null?void 0:b.gateway_token,Brand:r.Brand,ExpirationMonth:r.ExpirationMonth,ExpirationYear:r.ExpirationYear,Last4:r.Last4,Bin:r.Bin,CVV:r.CVV,postalCode:y==null?void 0:y.zipCode},B&&{authHold:y==null?void 0:y.authHold}),B&&{authorise:y==null?void 0:y.authorise});ct(),t(O)}}},h=async()=>{var r,a,b,N,F,O,x,f,k,He,dt,Be,Ft,ut;try{let Re={method:"POST",redirect:"follow"},Le=await wi.post(`${Ee}api/v1/widget/generate-session`,Re),pe=Number(y==null?void 0:y.expiryYear)%100,Pe=`${(r=y==null?void 0:y.cardNumber)==null?void 0:r.replace(/\s+/g,"")}=${pe}${y==null?void 0:y.expiryMonth} ${y==null?void 0:y.cvv}`,D=forge.pki.publicKeyFromPem((b=(a=Le==null?void 0:Le.data)==null?void 0:a.data)==null?void 0:b.publicKeyPem).encrypt(Pe,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),St=forge.util.encode64(D),Ke={"Content-Type":"application/json","x-app-session-key":(F=(N=Le.data)==null?void 0:N.data)==null?void 0:F.session_key},_t=JSON.stringify({enc_track2_data:St,algorithm:"RSAES_OAEP_SHA_1",session_key:(x=(O=Le==null?void 0:Le.data)==null?void 0:O.data)==null?void 0:x.session_key}),S=await wi.post(`${rn}tokenizer/tokenize`,_t,{headers:Ke});if((S==null?void 0:S.status)==200){let bn=(k=(f=S==null?void 0:S.data)==null?void 0:f.data)==null?void 0:k.token;try{let Pt=await wi.post(`${Ee}api/v1/gateway/verify-and-save/${e}`,{token:bn});if((Pt==null?void 0:Pt.status)==200){let ft=(He=Pt==null?void 0:Pt.data)==null?void 0:He.data,cn={Token:ft.gateway_token,Brand:ft.card_data.brand,ExpirationMonth:ft.card_data.expire_mm,ExpirationYear:ft.card_data.expire_yy,Last4:ft.card_data.last4,Bin:ft.card_data.bin,postalCode:y==null?void 0:y.zipCode};t(cn),ct()}}catch(Pt){console.log(Pt,"error"),ct()}}}catch(Re){let Le="Something went wrong!";try{let pe=((dt=Re==null?void 0:Re.response)==null?void 0:dt.data)||(Re==null?void 0:Re.message)||"",E=typeof pe=="string"?pe:JSON.stringify(pe),at=(((Ft=(Be=E.split)==null?void 0:Be.call(E,`
2267
+ `))==null?void 0:Ft.filter(Boolean))||[]).at(-1)||"",D=(ut=at.split)==null?void 0:ut.call(at,": ");Le=(D==null?void 0:D.length)>1?D.pop().trim():at.trim()||Le}catch(pe){Le="Something went wrong!"}ct(),ce(Le)}},M=async r=>{var F,O,x,f,k,He,dt;r.preventDefault();let a=document.activeElement;if(a instanceof HTMLElement&&a.blur(),!(w||ue()||!mn())){_e();try{let Be=await wi.get(`${Ee}api/v1/gateway/token/${e}`,{params:{pass_fee:Ne}});if((Be==null?void 0:Be.status)==200){let Ft=(O=(F=Be==null?void 0:Be.data)==null?void 0:F.data)==null?void 0:O.gateway_token;((f=(x=Be==null?void 0:Be.data)==null?void 0:x.data)==null?void 0:f.paymentGateway)==((k=Hi)==null?void 0:k.FRACTALKEY)?await h():DatacapWebToken.requestToken(Ft,"creditCardForm",Xt)}}catch(Be){ct(),ce(((dt=(He=Be==null?void 0:Be.response)==null?void 0:He.data)==null?void 0:dt.message)||"Something went wrong!")}}},u=()=>{ce("")},ge=()=>{ce(""),Se({firstName:"",lastName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",zipCode:"",authHold:!1,authorise:!1,checkSign:!1}),z()};return console.log(Ne,"aoapoaa"),q.createElement(q.Fragment,null,q.createElement(Cn,null),q.createElement(Ui,null),q.createElement(an,{loading:w||H}),Fe&&q.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},q.createElement(Fn,{error:Fe,onClose:u})),!Fe&&q.createElement("div",{className:"creditformbox"},q.createElement("form",{id:"creditCardForm",onSubmit:M,onKeyDown:r=>{r.key==="Enter"&&w&&(r.preventDefault(),r.stopPropagation())}},q.createElement("div",{className:"name-row"},q.createElement("div",{className:"form-group"},q.createElement("label",null," First Name ",q.createElement("span",{className:"text-danger"},"*")),q.createElement("input",{type:"text",name:"first_name",placeholder:"First Name",value:(y==null?void 0:y.firstName)||"",onChange:r=>{let a=r.target.value;/^[a-zA-Z\s]*$/.test(a)&&$e("firstName",a)},className:G}),(P==null?void 0:P.firstName)&&q.createElement("small",{className:"error"},P==null?void 0:P.firstName)),q.createElement("div",{className:"form-group"},q.createElement("label",null," Last Name ",q.createElement("span",{className:"text-danger"},"*")),q.createElement("input",{type:"text",name:"last_name",placeholder:"Last Name",value:(y==null?void 0:y.lastName)||"",onChange:r=>{let a=r.target.value;/^[a-zA-Z\s]*$/.test(a)&&$e("lastName",a)},className:G}),(P==null?void 0:P.lastName)&&q.createElement("small",{className:"error"},P==null?void 0:P.lastName))),q.createElement("div",{className:"form-pay-row"},q.createElement("div",{className:"form-group"},q.createElement("label",null," Card Number ",q.createElement("span",{className:"text-danger"},"*")),q.createElement("input",{type:"text","data-token":"card_number",placeholder:"Card Number",maxLength:19,inputMode:"numeric",value:(y==null?void 0:y.cardNumber)||"",onChange:r=>qe(r),className:G}),(P==null?void 0:P.cardNumber)&&q.createElement("small",{className:"error"},P==null?void 0:P.cardNumber))),q.createElement("div",{className:"card-pay-row"},q.createElement("div",{className:"form-group"},q.createElement("label",null," Exp Month ",q.createElement("span",{className:"text-danger"},"*")),q.createElement("input",{type:"text","data-token":"exp_month",placeholder:"MM",maxLength:2,value:(y==null?void 0:y.expiryMonth)||"",onChange:r=>$e("expiryMonth",r.target.value),className:G}),(P==null?void 0:P.expiryMonth)&&q.createElement("small",{className:"error"},P==null?void 0:P.expiryMonth)),q.createElement("div",{className:"form-group"},q.createElement("label",null," Exp Year ",q.createElement("span",{className:"text-danger"},"*")),q.createElement("input",{type:"text","data-token":"exp_year",placeholder:"YYYY",maxLength:4,value:(y==null?void 0:y.expiryYear)||"",onChange:r=>$e("expiryYear",r.target.value),className:G}),(P==null?void 0:P.expiryYear)&&q.createElement("small",{className:"error"},P==null?void 0:P.expiryYear)),q.createElement("div",{className:"form-group"},q.createElement("label",null," CVV ",q.createElement("span",{className:"text-danger"},"*")),q.createElement("input",{type:"text","data-token":"cvv",placeholder:"CVV",maxLength:4,value:(y==null?void 0:y.cvv)||"",onChange:r=>$e("cvv",r.target.value),className:G}),(P==null?void 0:P.cvv)&&q.createElement("small",{className:"error"},P==null?void 0:P.cvv)),q.createElement("div",{className:"form-group"},q.createElement("label",null," Zip ",q.createElement("span",{className:"text-danger"},"*")),q.createElement("input",{type:"text",name:"zipcode",placeholder:"Zip Code",value:(o=y==null?void 0:y.zipCode)!=null?o:"",onChange:r=>$e("zipCode",r.target.value),className:G}),(P==null?void 0:P.zipCode)&&q.createElement("small",{className:"error"},P==null?void 0:P.zipCode))),se&&q.createElement("div",{className:"pass-fee-toggle-div"},q.createElement("input",{type:"checkbox",id:"pass_fee",className:"toggle-checkbox",checked:Ne,onChange:r=>{Me(r.target.checked)}}),q.createElement("label",{htmlFor:"pass_fee",className:"toggle-label"}),q.createElement("label",{htmlFor:"save_card"},"Cash Discount")),K&&q.createElement("div",{className:"checks-row"},q.createElement("input",{name:"discalosure",type:"checkbox",id:"disclosureCheck",checked:U,onChange:r=>ve(r.target.checked)}),q.createElement("label",{htmlFor:"disclosureCheck",className:"form-check-label"},"Please agree to the following in order to add Payment method.")),K&&(P==null?void 0:P.checkSign)&&q.createElement("small",{className:"check-error"},P==null?void 0:P.checkSign),B&&q.createElement(q.Fragment,null,q.createElement("div",{className:"checks-row"},q.createElement("input",{name:"authHold",type:"checkbox",id:"authHold",checked:!!(y!=null&&y.authHold),onChange:r=>$e("authHold",r.target.checked)}),q.createElement("label",{htmlFor:"authHold",className:"form-check-label"},"To securely save your card on file, we will place a temporary authorization hold of $1.00. This is not a charge and will be released by your card issuer shortly after verification.")),(P==null?void 0:P.authHold)&&q.createElement("small",{className:"check-error"},P==null?void 0:P.authHold),q.createElement("div",{className:"checks-row "},q.createElement("input",{name:"authorise",type:"checkbox",id:"authorise",checked:!!(y!=null&&y.authorise),onChange:r=>$e("authorise",r.target.checked)}),q.createElement("label",{htmlFor:"authorise",className:"form-check-label see-more"},ee?q.createElement(q.Fragment,null,q.createElement("span",null,"By providing your payment information, you authorize"," ",q.createElement("strong",null,Y),", a Sky Systemz merchant, to securely store your card on file for future payments. Your card information will be encrypted and stored in compliance with PCI-DSS (Payment Card Industry Data Security Standard) regulations using Sky Systemz\u2019s secure payment technology. This information will be used solely for transactions you authorize with"," ",q.createElement("strong",null,Y),". You may request the removal of your stored payment information at any time by contacting"," ",q.createElement("strong",null,Y)," directly. By signing or proceeding with this transaction, you acknowledge and agree to this card on file authorization.",q.createElement("a",{href:"#",onClick:r=>{r.preventDefault(),V(!1)}},"See less ..."))):q.createElement(q.Fragment,null,q.createElement("span",null,"By providing your payment information, you authorize ",Y,", a Sky Systemz merchant, to securely store your card on file for future pay..."," "),q.createElement("a",{href:"#",onClick:r=>{r.preventDefault(),V(!0)}},"See more ...")))),(P==null?void 0:P.authorise)&&q.createElement("small",{className:"check-error"},P==null?void 0:P.authorise)),q.createElement("div",{className:"button-row"},q.createElement("button",{className:`cancelbtn ${Z} `,type:"button",onClick:ge},"Cancel"),q.createElement("button",{className:`savebtn ${A} `,disabled:w,type:"submit"},"Save")))))}import n,{useEffect as Yi,useRef as yr,useState as kt}from"react";import Ni from"axios";import ki from"sweetalert2";import{IoArrowBack as Ei}from"react-icons/io5";import{NumericFormat as br}from"react-number-format";function xr(e){var Yt,Ht,Dt,Rt,en,tn,nn,un,Gt,Ve,jt,_,g,le,fe,te,Oe,ye,wt,We,mt,Vt;let t=yr(null);Yi(()=>{e.onTriggerPay&&e.onTriggerPay(()=>{An()})},[e]);let H=ne+"widget/mc-img.svg",z=ne+"widget/visa-img.svg",B=ne+"widget/ae-img.svg",Y=ne+"widget/discover-img.svg",K=ne+"widget/card.svg",U=ne+"widget/Trash.svg",ve=ne+"widget/bank.svg",Z=ne+"widget/secure-img.png",A=ne+"widget/pov-by.png",G=ne+"widget/pax.svg",[se,w]=kt(!1),[v,ee]=kt(!1),[V,y]=kt(""),[Se,P]=kt(!1),[Ue,Fe]=kt(!1),[ce,_e]=kt("card"),[ct,Ne]=kt("card"),[Me,ue]=kt("form"),[qe,$e]=kt("form"),[mn,Xt]=kt(!0),[h,M]=kt(!1),[u,ge]=kt(!1),o=e.merchantPublicKey,[r,a]=kt(),[b,N]=kt({}),[F,O]=kt(),[x,f]=kt({}),[k,He]=kt([]),[dt,Be]=kt([]),[Ft,ut]=kt(),[Re,Le]=kt(),[pe,E]=kt(Number(e==null?void 0:e.amount)),[Pe,at]=kt(Number(e==null?void 0:e.amount)),[D,St]=kt(""),[Ke,_t]=kt("");console.log(D,"partialAmount");let[S,bn]=kt(),[Pt,ft]=kt(""),cn=()=>w(!0),vt=()=>w(!1),Yn=(p,c)=>{let W=(parseFloat(c)||0)/100;return p-p*W},Ln=(p,c)=>{let W=(Number(c)||0)/100;return+p+ +(p*W)};Yi(()=>{Ue&&(e!=null&&e.pass_fee?(at(Number(e==null?void 0:e.amount)),E(Number(e==null?void 0:e.cashDiscount))):(at(Number(e==null?void 0:e.amount)),E(Number(e==null?void 0:e.amount))))},[Ue,e==null?void 0:e.pass_fee,e==null?void 0:e.amount,e==null?void 0:e.surcharge]);let Ct=()=>{Fe(!1),_e("card"),y(""),P(!1),ft(""),O({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),f({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),a({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),N({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),ge(!1),M(!1),ut({card_type:"",cardlastfourdigit:"",expmonth:1,expyear:2025,primary_card:0,firstname:"",id:"",lastname:""}),Le({}),E(0),Ne("card"),Xt(!0),$e("form"),ue("form"),ee(!1),w(!1),Be([]),He([]),St(""),_t("")},An=()=>Fe(!0),Sn=p=>{_e(p)},_n=(p,c)=>{let W=p;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(W)){(c===""||/^[0-9]+$/.test(c))&&(N(ae=>L(C({},ae),{[W]:""})),a(ae=>L(C({},ae),{[W]:c})));return}N(ae=>L(C({},ae),{[W]:""})),a(ae=>L(C({},ae),{[W]:c}))},Q=p=>{var et;let c=p.target,W=c.value.replace(/\D/g,""),{formatted:ke,cursor:ae}=Pn(c.value,(et=c.selectionStart)!=null?et:0);N(Ce=>L(C({},Ce),{cardNumber:""})),a(Ce=>L(C({},Ce),{cardNumber:ke})),requestAnimationFrame(()=>{c.setSelectionRange(ae,ae)})},$=p=>{let{name:c,value:W}=p.target,ke=["routingNumber","accountNumber","confirmAccountNumber"];if(c=="name"){/^[a-zA-Z\s]*$/.test(W)&&(f(ae=>L(C({},ae),{[c]:""})),O(ae=>L(C({},ae),{[c]:W})));return}if(ke.includes(c)){(W===""||/^[0-9]+$/.test(W))&&(f(ae=>L(C({},ae),{[c]:""})),O(ae=>L(C({},ae),{[c]:W})));return}f(ae=>L(C({},ae),{[c]:""})),O(ae=>L(C({},ae),{[c]:W}))},Ze=()=>{var ae,et,Ce,tt,Ae,re;let p={},c=r,W=parseInt((c==null?void 0:c.expiryMonth)||"",10),ke=(c==null?void 0:c.expiryYear)||"";if((ae=c==null?void 0:c.cardName)!=null&&ae.trim()||(p.cardName="Card name is required"),(et=c==null?void 0:c.cardNumber)!=null&&et.trim()||(p.cardNumber="Card number is required"),(!((Ce=c==null?void 0:c.expiryMonth)!=null&&Ce.trim())||!((tt=c==null?void 0:c.expiryYear)!=null&&tt.trim())||isNaN(W)||W<1||W>12||ke.length!==4)&&(p.expiryMonth="Invalid Expiration Date."),(Ae=c==null?void 0:c.cvv)!=null&&Ae.trim()||(p.cvv="CVV is required"),(re=c==null?void 0:c.zipCode)!=null&&re.trim()||(p.zipCode="ZIP code is required"),c!=null&&c.expiryMonth&&(c!=null&&c.expiryYear)&&c.expiryMonth.length<=2&&c.expiryYear.length===4){let nt=parseInt(c.expiryMonth,10),gt=parseInt(c.expiryYear,10),be=new Date,oe=be.getMonth()+1,Ot=be.getFullYear();(gt<Ot||gt===Ot&&nt<oe)&&(p.expiryMonth="Card is expired")}return N(p),Object.keys(p).length>0},Tt=()=>{var W,ke,ae,et,Ce,tt,Ae,re;let p={},c=F;return(W=c==null?void 0:c.name)!=null&&W.trim()||(p.name="Name is required"),(ke=c==null?void 0:c.accountNumber)!=null&&ke.trim()||(p.accountNumber="Account number is required"),(ae=c==null?void 0:c.accountNumber)!=null&&ae.trim()&&((et=c==null?void 0:c.accountNumber)==null?void 0:et.trim())!==((Ce=c==null?void 0:c.confirmAccountNumber)==null?void 0:Ce.trim())&&(p.confirmAccountNumber="Account numbers must match"),(tt=c==null?void 0:c.bankName)!=null&&tt.trim()||(p.bankName="Bank name is required"),(Ae=c==null?void 0:c.routingNumber)!=null&&Ae.trim()||(p.routingNumber="Routing Number is required"),c!=null&&c.routingNumber&&((re=c==null?void 0:c.routingNumber)==null?void 0:re.length)!==9&&(p.routingNumber="Routing number must be 9 digits"),((c==null?void 0:c.accountType)==="business saving"||(c==null?void 0:c.accountType)==="business checking")&&(!(c!=null&&c.companyName)||(c==null?void 0:c.companyName)==="")&&(p.companyName="Company Name is required for business accounts"),f(p),Object.keys(p).length>0},Je=async p=>{var W,ke,ae,et,Ce,tt,Ae,re,nt,gt,be,oe,Ot,Lt,Ge;p.preventDefault();let c=document.activeElement;if(c instanceof HTMLElement&&c.blur(),!v&&!Ke)if(ce!=="ach"){if(Ze())return;{let st=DatacapWebToken.validateCardNumber(r==null?void 0:r.cardNumber.replaceAll(" ","")),Te=DatacapWebToken.validateExpirationDate(r==null?void 0:r.expiryMonth,r==null?void 0:r.expiryYear),Tn=DatacapWebToken.validateCVV(r==null?void 0:r.cvv),xn={};if(st||(xn.cardNumber="Invalid card Number"),Te||(xn.expiryMonth="Invalid Expiration Date."),Tn||(xn.cvv="Invalid CVV"),N(xn),st&&Tn&&Te){ee(!0);try{let gn=async function(Nt){var de,yt;if(Nt.Error)y(Nt.Error),ee(!1);else{let Ut=r==null?void 0:r.cardName,ln=r==null?void 0:r.zipCode;Nt.name=Ut,Nt.postal_code=ln,Nt.isCardSave=`${h}`,Nt.isCharge=!0,Nt.posSalesIdEncode=(de=S==null?void 0:S.orderDetails)==null?void 0:de.orderId,Nt.partial_amount=D&&!Ke?D:Pe,It.emit("sendMessage",Nt);let ei=(yt=S==null?void 0:S.orderDetails)==null?void 0:yt.orderId;It.on(ei,zn=>{if(ri(zn==null?void 0:zn.data)){let Et=JSON.parse(zn.data);Et!=null&&Et.result?(a({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),M(!1),ft(Et==null?void 0:Et.transactionId),P(!0),ee(!1)):(ee(!1),y((Et==null?void 0:Et.message)||"Something went wrong."))}else y("Something went wrong.")})}};if((S==null?void 0:S.paymentGateway)===32){let Nt={method:"POST",redirect:"follow"};try{let de=await Ni.post(`${Ee}api/v1/widget/generate-session`,Nt),yt=Number(r==null?void 0:r.expiryYear)%100,Ut=r==null?void 0:r.cardNumber;Ut=Ut==null?void 0:Ut.replace(/\s+/g,"");let ln=`${Ut}=${yt}${r==null?void 0:r.expiryMonth} ${r==null?void 0:r.cvv}`,zn=forge.pki.publicKeyFromPem((ke=(W=de==null?void 0:de.data)==null?void 0:W.data)==null?void 0:ke.publicKeyPem).encrypt(ln,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),Et=forge.util.encode64(zn),Gn={"Content-Type":"application/json","x-app-session-key":(et=(ae=de.data)==null?void 0:ae.data)==null?void 0:et.session_key},hn=JSON.stringify({enc_track2_data:`${Et}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(tt=(Ce=de==null?void 0:de.data)==null?void 0:Ce.data)==null?void 0:tt.session_key}`});try{let dn=await Ni.post(`${rn}tokenizer/tokenize`,hn,{headers:Gn}),Si=JSON.stringify(L(C({},(Ae=dn==null?void 0:dn.data)==null?void 0:Ae.data),{isSaveCardChecked:h,name:r==null?void 0:r.cardName,postal_code:r==null?void 0:r.zipCode,customer_id:e==null?void 0:e.customerId,partial_amount:D&&!Ke?D:Pe})),_i=JSON.stringify({pre_sales_id:`${(re=S==null?void 0:S.orderDetails)==null?void 0:re.orderId}`,token:`${(nt=dn==null?void 0:dn.data)==null?void 0:nt.data.token}`,json_response:`${Si}`}),Pi={method:"POST",headers:JSON.stringify({"Content-Type":"application/json"}),body:_i,redirect:"follow",isChargeviafractal:!0};It.emit("sendMessage",Pi),It.on("chargeviafractalgateway",Vn=>{var s;if(ri(Vn==null?void 0:Vn.data)){let l=JSON.parse(Vn==null?void 0:Vn.data);l!=null&&l.result?(ft((s=l==null?void 0:l.data)==null?void 0:s.transactionId),P(!0),ee(!1)):(ee(!1),y((l==null?void 0:l.message)||"Something went wrong."))}else y("Something went wrong.")})}catch(dn){ee(!1),y(((be=(gt=dn==null?void 0:dn.response)==null?void 0:gt.data)==null?void 0:be.message)||(dn==null?void 0:dn.message)||"Something went wrong.")}}catch(de){ee(!1),y(((Ot=(oe=de==null?void 0:de.response)==null?void 0:oe.data)==null?void 0:Ot.message)||(de==null?void 0:de.message)||"Something went wrong.")}}else typeof DatacapWebToken!="undefined"&&DatacapWebToken.requestToken(S==null?void 0:S.dctoken,"PaymentForm",gn)}catch(gn){ee(!1),y(((Ge=(Lt=gn==null?void 0:gn.response)==null?void 0:Lt.data)==null?void 0:Ge.message)||(gn==null?void 0:gn.message)||"Something went wrong.")}}}}else{if(Tt())return;{ee(!0);let st={fractalpayPublicKey:o,label:(F==null?void 0:F.name)||"John Doe",account_number:F==null?void 0:F.accountNumber,routing_number:F==null?void 0:F.routingNumber,bank_name:F==null?void 0:F.bankName,account_type:F==null?void 0:F.accountType,amount:D&&!Ke?D:String(pe||0),isSaveAch:u,customer_id:e==null?void 0:e.customerId,order_id:e==null?void 0:e.orderID,tax:e==null?void 0:e.tax,discount:e==null?void 0:e.discount,surcharge:e==null?void 0:e.surcharge,isChargeACH:!0,company_name:(F==null?void 0:F.companyName)||"",orderGuid:e==null?void 0:e.orderGuid};It.emit("sendMessage",st),It.on("ach-incoming",Te=>{var Tn;(Te==null?void 0:Te.status)=="Failed"?typeof(Te==null?void 0:Te.message)=="object"?Object.values(Te==null?void 0:Te.message).forEach(xn=>{y(xn||"Something went wrong")}):y((Te==null?void 0:Te.message)||"Something went wrong"):(ft((Tn=Te==null?void 0:Te.data)==null?void 0:Tn.transaction_id),P(!0),ee(!1))})}}},rt=async()=>{var p,c,W,ke,ae,et,Ce,tt,Ae,re,nt,gt,be,oe,Ot,Lt,Ge,En,st,Te,Tn,xn,gn;cn();try{let Nt={fractalpayPublicKey:o,customer_id:e==null?void 0:e.customerId,pass_fee:e==null?void 0:e.pass_fee,orderGuid:e==null?void 0:e.orderGuid},de=await Ni.post(`${Qe}get-payment-details`,Nt);if(bn((p=de==null?void 0:de.data)==null?void 0:p.data),(W=(c=de==null?void 0:de.data)==null?void 0:c.data)!=null&&W.paymentGateway||(Ct(),y("Something went wrong.")),(ae=(ke=de==null?void 0:de.data)==null?void 0:ke.data)!=null&&ae.card_list&&((tt=(Ce=(et=de==null?void 0:de.data)==null?void 0:et.data)==null?void 0:Ce.card_list)==null?void 0:tt.length)>0){let yt=(nt=(re=(Ae=de==null?void 0:de.data)==null?void 0:Ae.data)==null?void 0:re.card_list)==null?void 0:nt.filter(ln=>(ln==null?void 0:ln.card_type)=="Bank"),Ut=(oe=(be=(gt=de==null?void 0:de.data)==null?void 0:gt.data)==null?void 0:be.card_list)==null?void 0:oe.filter(ln=>(ln==null?void 0:ln.card_type)!=="Bank");console.log(yt,"hohgohoo",Ut),(Ut==null?void 0:Ut.length)>0&&ue("list"),(yt==null?void 0:yt.length)>0&&$e("list"),He(Ut),Be(yt)}else _e("card");(Lt=(Ot=de==null?void 0:de.data)==null?void 0:Ot.data)!=null&&Lt.paymentDeviceList&&((st=(En=(Ge=de==null?void 0:de.data)==null?void 0:Ge.data)==null?void 0:En.paymentDeviceList)==null?void 0:st.length)>0&&Le((Tn=(Te=de==null?void 0:de.data)==null?void 0:Te.data)==null?void 0:Tn.paymentDeviceList[0]),vt()}catch(Nt){console.log(Nt),vt(),y(((gn=(xn=Nt==null?void 0:Nt.response)==null?void 0:xn.data)==null?void 0:gn.message)||(Nt==null?void 0:Nt.message)||"Something went wrong")}},ht=async p=>{if(p.currentTarget.blur(),v)return;let c=e==null?void 0:e.customerId,W=String(e==null?void 0:e.discount),ke=String(e==null?void 0:e.surcharge),ae=String(e==null?void 0:e.tax),et=e==null?void 0:e.merchantPublicKey,Ce=e==null?void 0:e.orderID,tt=D&&!Ke?D:String(Pe),Ae=Ft==null?void 0:Ft.id,re=Ft==null?void 0:Ft.card_type;if(!Ke)if(et&&Ce&&tt&&pe)if(c)if(Ae){let gt;D&&!Ke?gt=D:re==="Bank"?gt=pe:gt=Pe;let be={amount:gt,order_id:Ce,customer_id:c,card_id:Ae,fractalpayPublicKey:et,isCardSave:h,discount:W,surcharge:ke,tax:ae,orderGuid:e==null?void 0:e.orderGuid,pass_fee:e==null?void 0:e.pass_fee,require3ds:!1};D&&!Ke&&re!=="Bank"&&(be.ispartialPayment=!0);let nt=be,{isCardSave:oe}=nt,Ot=Un(nt,["isCardSave"]),Ge=Qe+(re==="Bank"?"charge-ach":"charge-by-card"),En={"Content-Type":"application/json"};ee(!0),It.emit("sendMessage",{url:Ge,body:re=="Bank"?Ot:be,isChargebycard:!0}),It.on("charge-by-card",st=>{var Te;(st==null?void 0:st.result)==!0||(st==null?void 0:st.status)==!0?(ft((Te=st.data)==null?void 0:Te.transaction_id),P(!0),ee(!1)):y((st==null?void 0:st.message)||"Something went wrong.")})}else y("Please Select A Card/ACH");else y("Please Select Customer");else y("Something went wrong.")},qt=async p=>{var et,Ce,tt,Ae,re,nt;if(p.currentTarget.blur(),v)return;let c=e==null?void 0:e.merchantPublicKey,W=e==null?void 0:e.orderID,ke=D&&!Ke?D:String(Pe),ae=e==null?void 0:e.customerId;if(!(Re!=null&&Re.device_id)){y("Please Select A Payment Device");return}if(c&&W&&ke){ee(!0);let gt={amount:ke,fractalpayPublicKey:c,customer_order_id:W,device_id:Re==null?void 0:Re.device_id,customer_id:ae||""};try{let be=await Ni.post(`${Qe}charge-with-reader`,gt);((et=be==null?void 0:be.data)==null?void 0:et.result)==!0?(ft((tt=(Ce=be==null?void 0:be.data)==null?void 0:Ce.data)==null?void 0:tt.transaction_id),P(!0),ee(!1)):(y(((Ae=be==null?void 0:be.data)==null?void 0:Ae.message)||"Something went wrong."),ee(!1))}catch(be){y(((nt=(re=be==null?void 0:be.response)==null?void 0:re.data)==null?void 0:nt.message)||"Something went wrong."),ee(!1)}}else y("Something went wrong.")},Mt=p=>{ct==="card"?ht(p):ct==="reader"&&qt(p)};Yi(()=>{Ue&&o&&rt()},[o,Ue]);let zt=async p=>{ki.fire({icon:"warning",text:"Do you want to delete the card?",showCancelButton:!0,confirmButtonText:"Yes",cancelButtonText:"No",reverseButtons:!0,buttonsStyling:!1,customClass:{confirmButton:"swal2-confirm btn btn-dark",cancelButton:"swal2-cancel btn btn-dark",popup:"custom-swal-popup",icon:"custom-swal-icon"}}).then(async c=>{if(c.isConfirmed){ee(!0);try{let W={card_id:p,customer_id:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey},ke=await Ni.post(`${Qe}delete-customer-card`,W);ee(!1),rt(),ki.fire({icon:"success",title:"Deleted!",text:"Card deleted.",confirmButtonText:"OK",showConfirmButton:!0,timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}})}catch(W){ee(!1),ki.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}else c.dismiss===ki.DismissReason.cancel&&ki.fire({icon:"info",text:"Card not deleted",confirmButtonText:"OK",buttonsStyling:!1,customClass:{confirmButton:"btn btn-dark float-end",actions:"swal2-actions-end"}})})},Wt=p=>{switch(p==null?void 0:p.toLowerCase()){case"visa":return z;case"mastercard":case"mc":case"m/c":return H;case"amex":case"american express":case"ae":return B;case"discover":case"dcvr":return Y;case"bank":return ve;default:return p}},ot=()=>{let p=pe||0;return(Number(Pe)-p).toFixed(0)};console.log(Me,"activeinCard","activeinBank",qe);let je=p=>{var c,W,ke,ae;console.log(p,"values"),ce==="ach"?((c=Number(pe))==null?void 0:c.toFixed(2))<(p==null?void 0:p.floatValue)||(p==null?void 0:p.floatValue)<=0?(St(p==null?void 0:p.value),_t(`Partial amount cannot exceed ${xe((W=Number(pe))==null?void 0:W.toFixed(2))}`)):(St(p==null?void 0:p.value),_t("")):((ke=Number(Pe))==null?void 0:ke.toFixed(2))<(p==null?void 0:p.floatValue)||(p==null?void 0:p.floatValue)<=0?(St(p==null?void 0:p.value),_t(`Partial amount cannot exceed ${xe((ae=Number(Pe))==null?void 0:ae.toFixed(2))}`)):(St(p==null?void 0:p.value),_t(""))};return Yi(()=>{let p=Number(ce==="ach"?pe:Pe),c=Number(D);D&&(c<=0||c>p)?_t(`Partial amount cannot exceed ${xe(p.toFixed(2))}`):_t("")},[ce,D,pe,Pe]),console.log(ce,"activetab"),n.createElement(n.Fragment,null,n.createElement(Cn,null),n.createElement(Xn,null),n.createElement(Kn,null),n.createElement(n.Fragment,null,n.createElement("button",{ref:t,style:{display:"none"},className:"paymentBtn",onClick:An},"Pay"),n.createElement(yn,{open:Ue,onClose:Ct},V&&n.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},n.createElement(Fn,{error:V,onClose:Ct})),Se&&n.createElement(Dn,{onClose:Ct,tranId:Pt}),!V&&!Se&&n.createElement(n.Fragment,null,(se||v)&&n.createElement(an,{loading:se||v}),n.createElement("div",{className:"frac-card-payment-page frac-form"},n.createElement("div",{className:"parent-pay-container"},n.createElement("span",{className:"request-payment-close-popup",onClick:Ct},n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},n.createElement("g",{clipPath:"url(#clip0_12425_52336)"},n.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),n.createElement("defs",null,n.createElement("clipPath",{id:"clip0_12425_52336"},n.createElement("rect",{width:"16",height:"16",fill:"white"}))))),n.createElement("div",{className:"pay-main-logo-res"},n.createElement("img",{src:S==null?void 0:S.logo,id:"pay-logos"})),n.createElement("div",{className:"pay-container"},n.createElement("div",{className:"pay-header pay-conatiner-one frac-pay-conatiner-one"},n.createElement("div",{className:"pay-conatiner-one-first"},n.createElement("div",{className:"pay-logo-container"},n.createElement("div",{className:"pay-main-logo"},n.createElement("img",{src:S==null?void 0:S.logo,id:"pay-logos"})),(k==null?void 0:k.length)>0&&ce!=="cardList"&&n.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>_e("cardList")}," ",n.createElement(Ei,null)," Back")),n.createElement("div",{className:"amt-pay-con"},n.createElement("div",{className:"pay-amount-conatiner"},n.createElement("small",{className:"pay-payment-amount"},"Select payment type")),n.createElement("div",{className:"frac-card-bank-radio-main"},n.createElement(Nn,{label:"Card",amount:(Yt=Number(Pe))==null?void 0:Yt.toFixed(2),value:"card",onChange:Sn,activetab:ce}),(S==null?void 0:S.isSkyFiAccount)&&n.createElement(Nn,{label:"Bank",amount:(Ht=Number(pe))==null?void 0:Ht.toFixed(2),value:"ach",onChange:Sn,activetab:ce})),In(S==null?void 0:S.showSurcharge)?pe&&pe>0&&(e!=null&&e.pass_fee)?n.createElement("div",{className:"frac-cash-discount-fee"},n.createElement("small",null,ce==="card"?"Cash Discount":"Cash Discount Savings"," "),n.createElement("p",null,xe((Number(Pe)-pe).toFixed(2)))):null:pe&&pe>0&&(e!=null&&e.pass_fee)&&ce==="card"?n.createElement("div",{className:"frac-cash-discount-fee"},n.createElement("small",null,ce==="card"?"Surcharge":null," "),n.createElement("p",null,xe((Number(Pe)-pe).toFixed(2)))):null,(e==null?void 0:e.allowPartial)&&n.createElement("div",{className:"frac-partial-payment-input"},n.createElement("label",{htmlFor:"partialpayment"},"Partial Payment"),n.createElement(br,{prefix:"$",className:"form-control",value:D,onValueChange:p=>{je(p)},thousandSeparator:!0,placeholder:"Enter partial amount",allowNegative:!1,allowLeadingZeros:!1,decimalScale:2,fixedDecimalScale:!0}),Ke&&n.createElement("span",{className:"error-span"},Ke)))),n.createElement("div",{className:"pay-conatiner-one-last"},n.createElement("img",{src:Z,alt:""}),n.createElement("img",{src:A,alt:""}),"Secure payments powered by Fractal")),n.createElement("div",{className:"pay-tab pay-conatiner-two"},!se&&n.createElement("div",{className:"col-md-12"},n.createElement("div",{id:"payment-form-div"},ce!=="cardList"?n.createElement("div",{className:"frac-charge-payment-back-btn-wrap "},(k==null?void 0:k.length)>0&&n.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>_e("cardList")}," ",n.createElement(Ei,null)," Back"),(S==null?void 0:S.isSkyFiAccount)&&n.createElement("div",{className:"tab"},n.createElement("button",{className:"tablinks",onClick:p=>{Sn("card")},style:{border:ce==="card"?"1px solid":""}},n.createElement("i",{className:"fas fa-credit-card me-2",style:{marginRight:"8px",fontSize:"15px"}}),"Card"),n.createElement("button",{className:"tablinks",onClick:p=>{Sn("ach")},style:{border:ce==="ach"?"1px solid":""}},n.createElement("i",{className:"fas fa-university me-2",style:{marginRight:"8px",fontSize:"15px"}}),"Bank")),n.createElement("div",{className:"res-pay-con"},n.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},n.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),n.createElement("strong",{className:"pay-amount"},"$",(Dt=Number(Pe))==null?void 0:Dt.toFixed(2))),ce!="ach"&&n.createElement("div",null,n.createElement("div",null,n.createElement("img",{src:z,alt:"",width:35,style:{paddingRight:"5px"}}),n.createElement("img",{src:H,width:35,alt:""})),n.createElement("div",null,n.createElement("img",{src:B,alt:"",width:35,style:{paddingRight:"5px"}}),n.createElement("img",{src:Y,width:35,alt:""})))),!se&&In(S==null?void 0:S.showSurcharge)?pe&&pe>0&&(e!=null&&e.pass_fee)?n.createElement("div",{className:"frac-cash-discount-fee"},n.createElement("small",null,ce==="card"?"Cash Discount":"Cash Discount Savings"," "),n.createElement("p",null,xe((Number(Pe)-pe).toFixed(2)))):null:pe&&pe>0&&(e!=null&&e.pass_fee)&&ce==="card"?n.createElement("div",{className:"frac-cash-discount-fee"},n.createElement("small",null,ce==="card"?"Surcharge":null," "),n.createElement("p",null,xe((Number(Pe)-pe).toFixed(2)))):null):n.createElement("div",null,n.createElement("h6",{className:"charge-customer-name",style:{marginBottom:"16px !important"}}," Charge ",S==null?void 0:S.customer_name),n.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}}," ",ct==="card"?"Cards/Banks":"Readers"," "),n.createElement("div",{className:"res-pay-con"},n.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},n.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),n.createElement("strong",{className:"pay-amount"},"$",(Rt=Number(Pe))==null?void 0:Rt.toFixed(2))),n.createElement("div",null,n.createElement("div",null,n.createElement("img",{src:z,alt:"",width:35,style:{paddingRight:"5px"}}),n.createElement("img",{src:H,width:35,alt:""})),n.createElement("div",null,n.createElement("img",{src:B,alt:"",width:35,style:{paddingRight:"5px"}}),n.createElement("img",{src:Y,width:35,alt:""}))))),n.createElement("div",{id:"card",style:{display:ce==="card"?"block":"none"},className:"tabcontent"},n.createElement("div",{className:"frac-card-payment"},n.createElement("div",{className:"frac-heading-card-wrap"},n.createElement("div",{className:"frac-backarrow"},(k==null?void 0:k.length)>0&&Me==="form"&&n.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>ue("list")}," ",n.createElement(Ei,null))),n.createElement("h6",{className:"frac-card-payment-heading"},"Card Payment")),ce!="ach"&&n.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0px 19px 0px"}},n.createElement("img",{src:z,alt:"",width:33}),n.createElement("img",{src:H,width:33,alt:""}),n.createElement("img",{src:B,alt:"",width:33}),n.createElement("img",{src:Y,width:33,alt:""}))),Me==="list"?n.createElement(n.Fragment,null,n.createElement(Bn,{listHeading:"Cards",paymentGateway:S==null?void 0:S.paymentGateway,ListItems:k,selectedCard:Ft,setSelectedCard:ut,handleDeleteCard:zt,otherButtonLabel:"Pay With Other Card",otherButtonAction:()=>{ue("form")}}),n.createElement("div",{className:"form-group",style:{padding:"0"}},n.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:Mt},D&&!Ke?xe((en=Number(D))==null?void 0:en.toFixed(2)):xe((tn=Number(Pe))==null?void 0:tn.toFixed(2))))):n.createElement("form",{id:"PaymentForm",style:{textAlign:"start"},onSubmit:Je,onKeyDown:p=>{p.key==="Enter"&&v&&(p.preventDefault(),p.stopPropagation())}},n.createElement("div",{className:"ach-scrl",style:{minHeight:S!=null&&S.isSkyFiAccount&&(k==null?void 0:k.length)>0?"444px":S!=null&&S.isSkyFiAccount&&(k==null?void 0:k.length)==0?"456px":(k==null?void 0:k.length)>0?"462px":"520px",overflow:"auto",marginRight:"5px"}},n.createElement("div",{className:"form-group"},n.createElement("label",{htmlFor:"cardHolderName"},"NAME ON CARD "),n.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"John Doe",value:(r==null?void 0:r.cardName)||"",onChange:p=>{let c=p.target.value;/^[a-zA-Z\s]*$/.test(c)&&_n("cardName",c)}}),(b==null?void 0:b.cardName)&&n.createElement("span",{className:"error-span"},b==null?void 0:b.cardName)),n.createElement("div",{className:"form-group"},n.createElement("label",{htmlFor:"cardNumber"},"CARD NUMBER"),n.createElement("div",{className:"toggle-num-wrapper"},n.createElement("input",{className:"form-control card-number-new",type:"text",maxLength:19,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:(r==null?void 0:r.cardNumber)||"",onChange:p=>Q(p),"data-token":"card_number"}),n.createElement("div",{className:"card-crdi card-expiry-new"},n.createElement("div",{className:"exp-date-year-container"},n.createElement("div",{className:"exp-date form-group"},n.createElement("input",{"data-token":"exp_month",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"MM",maxLength:2,value:(r==null?void 0:r.expiryMonth)||"",onChange:p=>_n("expiryMonth",p.target.value)})),n.createElement("div",{className:"exp-year form-group"},n.createElement("input",{"data-token":"exp_year",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"YYYY",maxLength:4,value:(r==null?void 0:r.expiryYear)||"",onChange:p=>_n("expiryYear",p.target.value)})),n.createElement("div",{className:"security-digit form-group"},n.createElement("input",{"data-token":"cvv",className:"form-control card-cvv-in required",type:"text",style:{maxHeight:"36px"},maxLength:4,placeholder:"CVC",value:(r==null?void 0:r.cvv)||"",onChange:p=>_n("cvv",p.target.value)})))),(b==null?void 0:b.cardNumber)&&n.createElement("span",{className:"error-span"},b==null?void 0:b.cardNumber),n.createElement("p",{style:{margin:"0"}},b!=null&&b.expiryMonth||b!=null&&b.expiryYear?n.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},b==null?void 0:b.expiryMonth):"",(b==null?void 0:b.cvv)&&n.createElement("span",{className:"error-span"},b==null?void 0:b.cvv)))),n.createElement("div",{className:"form-group"},n.createElement("label",{htmlFor:"OrderId"},"Order ID / Description"),n.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"Order Id",disabled:!0,value:(nn=e==null?void 0:e.orderID)!=null?nn:"",style:{background:"#F6F6F7",color:"#727272"}})),n.createElement("div",{className:"form-group"},n.createElement("label",{htmlFor:"zip"},"ZIP"),n.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"000000",value:(un=r==null?void 0:r.zipCode)!=null?un:"",onChange:p=>_n("zipCode",p.target.value)}),(b==null?void 0:b.zipCode)&&n.createElement("span",{className:"error-span"},b==null?void 0:b.zipCode)),(e==null?void 0:e.customerId)&&n.createElement("div",{className:"form-group"},n.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},n.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:h,onChange:p=>M(p.target.checked)}),n.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),n.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},n.createElement("g",{clipPath:"url(#clip0_12420_50192)"},n.createElement("rect",{width:"20",height:"20",fill:"white"}),n.createElement("circle",{cx:"10",cy:"10",r:"10",fill:"#E0DFE2"}),n.createElement("path",{d:"M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z",fill:"#161616"})),n.createElement("defs",null,n.createElement("clipPath",{id:"clip0_12420_50192"},n.createElement("rect",{width:"20",height:"20",fill:"white"}))))))),n.createElement("div",{className:"form-group",style:{marginTop:"20px",padding:"0"}},(S==null?void 0:S.paymentDeviceList)&&((Gt=S==null?void 0:S.paymentDeviceList)==null?void 0:Gt.length)>0&&n.createElement("button",{type:"button",style:{marginBottom:"10px"},className:"pay-button",onClick:()=>Xt(!mn)},mn?"Pay With Reader":"Pay With Card"),n.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},D&&!Ke?xe((Ve=Number(D))==null?void 0:Ve.toFixed(2)):xe((jt=Number(Pe))==null?void 0:jt.toFixed(2)))))),n.createElement("div",{id:"ach",style:{display:ce==="ach"?"block":"none"},className:"tabcontent"},n.createElement("div",{className:"frac-card-payment"},n.createElement("div",{className:"frac-heading-card-wrap"},n.createElement("div",{className:"frac-backarrow"},(dt==null?void 0:dt.length)>0&&qe==="form"&&n.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>$e("list")}," ",n.createElement(Ei,null))),n.createElement("h6",{className:"frac-card-payment-heading"},"Bank Payment"))),qe==="list"?n.createElement(n.Fragment,null,n.createElement(Bn,{listHeading:"Banks",paymentGateway:S==null?void 0:S.paymentGateway,ListItems:dt,selectedCard:Ft,setSelectedCard:ut,handleDeleteCard:zt,otherButtonLabel:"Pay With Other Bank",otherButtonAction:()=>{$e("form")}}),n.createElement("div",{className:"form-group",style:{padding:"0"}},n.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:Mt},D&&!Ke?xe((_=Number(D))==null?void 0:_.toFixed(2)):xe((g=Number(pe))==null?void 0:g.toFixed(2))))):n.createElement("form",{id:"ACHPaymentForm",style:{textAlign:"start"},onSubmit:Je,autoComplete:"off",onKeyDown:p=>{p.key==="Enter"&&v&&(p.preventDefault(),p.stopPropagation())}},n.createElement("div",{className:"ach-scrl",style:{minHeight:S!=null&&S.isSkyFiAccount&&(k==null?void 0:k.length)>0?"444px":S!=null&&S.isSkyFiAccount&&(k==null?void 0:k.length)==0?"436px":(k==null?void 0:k.length)>0?"462px":"520px",maxHeight:S!=null&&S.isSkyFiAccount&&(k==null?void 0:k.length)>0?"444px":((k==null?void 0:k.length)>0,"380px")}},n.createElement("div",{className:"form-group mb-4"},n.createElement("label",{htmlFor:"nameonaccount"},"Name on account"),n.createElement("input",{type:"text",id:"nameonaccount",className:"form-control",maxLength:100,placeholder:"John Doe",name:"name",value:(le=F==null?void 0:F.name)!=null?le:"",onChange:$}),(x==null?void 0:x.name)&&n.createElement("span",{className:"error-span"},x==null?void 0:x.name)),n.createElement("div",{className:"form-group mb-4"},n.createElement("label",{htmlFor:"routingnumber"},"Routing number"),n.createElement("input",{type:"text",id:"routingnumber",className:"form-control",maxLength:9,placeholder:"000000000",name:"routingNumber",value:(fe=F==null?void 0:F.routingNumber)!=null?fe:"",onChange:$}),(x==null?void 0:x.routingNumber)&&n.createElement("span",{className:"error-span"},x==null?void 0:x.routingNumber)),n.createElement("div",{className:"form-group mb-4"},n.createElement("label",{htmlFor:"accountnumber"},"Account number"),n.createElement("input",{type:"text",id:"accountnumber",className:"form-control",maxLength:16,placeholder:"0000000000",name:"accountNumber",value:(te=F==null?void 0:F.accountNumber)!=null?te:"",onChange:$}),(x==null?void 0:x.accountNumber)&&n.createElement("span",{className:"error-span"},x==null?void 0:x.accountNumber)),n.createElement("div",{className:"form-group mb-4"},n.createElement("label",{htmlFor:"confirmaccountnumber"},"Confirm account number"),n.createElement("input",{type:"text",id:"confirmaccountnumber",className:"form-control",maxLength:16,placeholder:"0000000000",name:"confirmAccountNumber",value:(Oe=F==null?void 0:F.confirmAccountNumber)!=null?Oe:"",onChange:$}),(x==null?void 0:x.confirmAccountNumber)&&n.createElement("span",{className:"error-span"},x==null?void 0:x.confirmAccountNumber)),n.createElement("div",{className:"form-group mb-4"},n.createElement("label",{htmlFor:"bankname"},"Bank name"),n.createElement("input",{type:"text",id:"bankname",className:"form-control",maxLength:100,placeholder:"My Bank",name:"bankName",value:(ye=F==null?void 0:F.bankName)!=null?ye:"",onChange:$}),(x==null?void 0:x.bankName)&&n.createElement("span",{className:"error-span"},x==null?void 0:x.bankName)),((F==null?void 0:F.accountType)==="business saving"||(F==null?void 0:F.accountType)==="business checking")&&n.createElement("div",{className:"form-group mb-4"},n.createElement("label",{htmlFor:"companyName"},"Company name"),n.createElement("input",{type:"text",id:"companyName",className:"form-control",maxLength:100,placeholder:"My Company",name:"companyName",value:(wt=F==null?void 0:F.companyName)!=null?wt:"",onChange:$}),(x==null?void 0:x.companyName)&&n.createElement("span",{className:"error-span"},x==null?void 0:x.companyName)),n.createElement("div",{className:"form-group mb-4"},n.createElement("label",{htmlFor:"accounttype"},"Select account type"),n.createElement("select",{name:"accountType",id:"accounttype",className:"form-control",value:(We=F==null?void 0:F.accountType)!=null?We:"",onChange:$},n.createElement("option",{value:""},"Select account"),oi.map(p=>n.createElement("option",{key:p.value,value:p.value},p.label)))),(e==null?void 0:e.customerId)&&n.createElement("div",{className:"form-group mb-4 save-ach-div",style:{paddingTop:"5px"}},n.createElement("input",{type:"checkbox",id:"saveACH",className:"",maxLength:100,placeholder:"My Bank",checked:u,onChange:p=>ge(p.target.checked)}),n.createElement("label",{htmlFor:"saveACH"},"Save ACH")),u&&n.createElement("div",{className:"form-group mb-4",style:{fontSize:"12px",color:"#727272"}},n.createElement("p",null,"If checked, I agree for ",n.createElement("b",null,"ecommerce")," to have my permission to charge this credit card for agreed upon purchases in the future."))),n.createElement("div",{className:"form-group "},n.createElement("button",{className:"pay-button",style:{margin:"20px 0 0"},type:"submit"},D&&!Ke?xe((mt=Number(D))==null?void 0:mt.toFixed(2)):xe((Vt=Number(pe))==null?void 0:Vt.toFixed(2))))))))))))))))}import Hn,{useEffect as ka,useState as ci,useMemo as Tr}from"react";import vr from"react";function Ji(){let e="#000",t="#fff",H="#212529",z="#dee2e6";return vr.createElement("style",null,`
2268
+ @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
2269
+ body
2270
+ {
2271
+ font-family: 'Inter', sans-serif;
2272
+ }
2273
+ input
2274
+ {
2275
+ font-family: 'Inter', sans-serif !important;
2276
+ }
2277
+ .frac-form .form-group-frac{
2278
+ margin:0 !important
2279
+ }
2280
+ .frac-form .mb-4{
2281
+ margin-bottom : 10px !important
2282
+ }
2283
+ .frac-form .save-ach-div{
2284
+ display:flex !important;
2285
+ gap:5px !important;
2286
+ align-items:center
2287
+ }
2288
+
2289
+ .frac-form .card-cvv-in{
2290
+ height : 36px !importantt;
2291
+ }
2292
+
2293
+ .frac-form .pay-payment-amount{
2294
+ text-align:start !important
2295
+ }
2296
+ .frac-form .pay-amount{
2297
+ text-align:start !important
2298
+ }
2299
+ .frac-form .pay-main-logo{
2300
+ text-align:start !important
2301
+ }
2302
+
2303
+
2304
+
2305
+ .paymentBtn {
2306
+ background-color: black;
2307
+ border: none;
2308
+ color: white;
2309
+ padding: 15px 32px;
2310
+ text-align: center;
2311
+ text-decoration: none;
2312
+ display: inline-block;
2313
+ font-size: 16px;
2314
+ margin: 4px 2px;
2315
+ cursor: pointer;
2316
+ border-radius: 180px;
2317
+ /* width: auto; */
2318
+ }
2319
+
2320
+ .main-logo {
2321
+ text-align: center;
2322
+ margin-bottom: 20px;
2323
+ }
2324
+
2325
+ .main-logo img {
2326
+ max-width: 180px;
2327
+ }
2328
+
2329
+ .pay-main-box {
2330
+ width: 365px !important;
2331
+ height: 93%;
2332
+ background: 0 0 #ffffff;
2333
+ border-radius: 12px;
2334
+
2335
+
2336
+ border: 1px solid #E0DFE2;
2337
+ margin: 0 auto;
2338
+ display: block;
2339
+ padding: 0px 26px !important
2340
+ }
2341
+ .pay-main-box .pay-header {
2342
+ display: flex;
2343
+ justify-content: center;
2344
+ align-items: center;
2345
+ text-align: center;
2346
+ }
2347
+
2348
+ .pay-main-box .pay-header button {
2349
+ border: 0;
2350
+ background: none;
2351
+ padding: 0;
2352
+ box-shadow: 0;
2353
+ outline: inherit;
2354
+ }
2355
+
2356
+ .pay-main-box h1 {
2357
+ margin: 0;
2358
+ flex: 1;
2359
+ padding: 10px 0;
2360
+ font-size: 23px;
2361
+ font-weight: 500;
2362
+ color: #35254D;
2363
+ align-items: start;
2364
+ display: flex;
2365
+ }
2366
+ .tab {
2367
+ overflow: hidden;
2368
+ padding: 5px;
2369
+ border-radius: 8px;
2370
+ display: flex;
2371
+ justify-content: space-around;
2372
+ margin-bottom:12px
2373
+ }
2374
+
2375
+ /* Style the buttons inside the tab */
2376
+ .tab button {
2377
+ float: left;
2378
+ border: none;
2379
+ outline: none;
2380
+ cursor: pointer;
2381
+ background:white;
2382
+ padding: 11px 16px;
2383
+ transition: 0.3s;
2384
+ font-size: 16px;
2385
+ width: 143px;
2386
+ border-radius: 5px;
2387
+ box-shadow: inherit;
2388
+ outline: none;
2389
+ color: ${e};
2390
+ }
2391
+
2392
+ /* Change background color of buttons on hover */
2393
+ .tab button:hover {
2394
+ background-color: #f0f0f0;
2395
+ }
2396
+
2397
+ /* Create an active/current tablink class */
2398
+ // .tab button.active {
2399
+ // background-color: #ccc;
2400
+ // }
2401
+
2402
+ /* Style the tab content */
2403
+
2404
+
2405
+ .parent-pay-container{
2406
+ padding: 24px;
2407
+ }
2408
+ .pay-container{
2409
+ display: grid;
2410
+ grid-template-columns: 2fr 3fr;
2411
+
2412
+ }
2413
+ .pay-main{
2414
+ padding-y: 20px}
2415
+
2416
+ .request-payment-close-popup {
2417
+ position: absolute;
2418
+ right: 20px;
2419
+ top: 20px;
2420
+ cursor: pointer;
2421
+ }
2422
+ .pay-conatiner-one{
2423
+ border-right: 1px solid #E0DFE2;
2424
+ display: flex;
2425
+ flex-direction: column;
2426
+ justify-content: space-between;
2427
+ }
2428
+ .pay-conatiner-one-first{
2429
+
2430
+ min-height:inherit !important;
2431
+ }
2432
+ .pay-conatiner-one-last{
2433
+ display:flex;
2434
+ font-size:12px;
2435
+ gap:5px;
2436
+ max-width:250px;
2437
+ align-items:center;
2438
+ color:black !important
2439
+ }
2440
+ .pay-conatiner-one-last img{
2441
+ width : 17px;
2442
+ height:17px
2443
+ }
2444
+ .pay-conatiner-two{
2445
+ padding: 0 5% 0;
2446
+ }
2447
+ .pay-logo-container{
2448
+ border-bottom: 1px solid #E0DFE2
2449
+ }
2450
+ .pay-heading{
2451
+ margin: 0;
2452
+ flex: 1;
2453
+ padding: 10px 0;
2454
+ font-size: 23px;
2455
+ font-weight: 500;
2456
+ color: #35254D;
2457
+ align-items: start;
2458
+ display: flex;
2459
+ }
2460
+ .pay-main-logo > img{
2461
+ width: 50%;
2462
+ }
2463
+ .pay-main-logo-res > img{
2464
+ width: 50%;
2465
+ display : none
2466
+ }
2467
+
2468
+ .pay-payment-amount{
2469
+ display: block;
2470
+ font-size: 12px;
2471
+ color: #727272;
2472
+ margin-bottom: 8px;
2473
+ }
2474
+ .pay-amount-conatiner{
2475
+ margin-top: 6%;
2476
+ }
2477
+ .pay-amount{
2478
+ color: #000000;
2479
+ font-size: 38px;
2480
+ display: block;
2481
+ line-height: 110%;
2482
+ letter-spacing: -1px;
2483
+ }
2484
+ .frac-form label{
2485
+ font-family: 'IBM Plex Mono', monospace !important;
2486
+ color: #727272 !important;
2487
+ margin-bottom: 2px !important;
2488
+ font-weight: 600 !important;
2489
+ font-size: 12px !important;
2490
+ display:block !important;
2491
+ text-align : left !important
2492
+ }
2493
+ .form-control-frac{
2494
+ display: block;
2495
+ width: 100%;
2496
+ padding: .375rem .75rem;
2497
+ font-size: 1rem;
2498
+ font-weight: 400;
2499
+ line-height: 1.5;
2500
+ color: ${H};
2501
+ -webkit-appearance: none;
2502
+ -moz-appearance: none;
2503
+ appearance: none;
2504
+ background-color: ${t};
2505
+ background-clip: padding-box;
2506
+ border: 1px solid ${z};
2507
+ border-radius: 0.375rem;
2508
+ transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
2509
+ }
2510
+ .form-control-frac:focus{
2511
+ border-color: #86b7fe;
2512
+ outline: 0;
2513
+ }
2514
+ .toggle-num-wrapper {
2515
+ position: relative;
2516
+ }
2517
+ .card-number-new{
2518
+ border-bottom: none;
2519
+ border-bottom-left-radius: 0px;
2520
+ border-bottom-right-radius: 0px;
2521
+ }
2522
+ .card-crdi {
2523
+ display: flex;
2524
+ border: 1px solid ${z};
2525
+ border-radius: 0.375rem;
2526
+ }
2527
+ .card-expiry-new{
2528
+ border-top-left-radius: 0px;
2529
+ border-top-right-radius: 0px;
2530
+ }
2531
+ .exp-date-year-container{
2532
+ display: flex;
2533
+ flex-wrap: wrap;
2534
+ }
2535
+ .exp-date-year-container .form-group-frac{
2536
+ flex:1;
2537
+ padding: 0px !important
2538
+
2539
+ }
2540
+
2541
+ .exp-date {
2542
+ float: left;
2543
+ // width: 30%
2544
+ }
2545
+
2546
+ .exp-date input {
2547
+ width: calc(100% + 1px);
2548
+ border-top-right-radius: 0;
2549
+ border-bottom-right-radius: 0;
2550
+ border: 0;
2551
+ border-right: 1px solid ${z};
2552
+ }
2553
+
2554
+
2555
+ .exp-year {
2556
+ float: left;
2557
+ // width: 30%
2558
+ }
2559
+
2560
+ .exp-year input {
2561
+ width: calc(100% + 1px);
2562
+ border-radius: 0;
2563
+ border-top: 0;
2564
+ border-bottom: 0;
2565
+ border-right: 1px solid ${z};
2566
+ }
2567
+
2568
+ .exp-date input:focus {
2569
+ position: relative;
2570
+ z-index: 10;
2571
+ }
2572
+
2573
+ .security-digit {
2574
+ float: right;
2575
+ // width: 40%;
2576
+ position: relative;
2577
+ }
2578
+
2579
+ .security-digit input {
2580
+ border-top-left-radius: 0;
2581
+ border-bottom-left-radius: 0;
2582
+ border-top: 0;
2583
+ border-bottom: 0;
2584
+ border-right:0;
2585
+ }
2586
+ .card-expiry-new{
2587
+ border-top-left-radius: 0px;
2588
+ border-top-right-radius: 0px;
2589
+ }
2590
+ .form-control-frac{box-sizing: border-box ;}
2591
+ #PaymentForm .form-group-frac{
2592
+ padding:5px 0 ;
2593
+ matgin: 0 !important
2594
+ }
2595
+
2596
+ .toggle-label {
2597
+ position: relative;
2598
+ display: inline-block;
2599
+ width: 40px;
2600
+ height: 24px;
2601
+ background-color: #ccc;
2602
+ border-radius: 12px;
2603
+ cursor: pointer;
2604
+ transition: background-color 0.3s;
2605
+ }
2606
+
2607
+ .toggle-label::before {
2608
+ content: "";
2609
+ position: absolute;
2610
+ top: 2px;
2611
+ left: 2px;
2612
+ width: 20px;
2613
+ height: 20px;
2614
+ background: #ffffff;
2615
+ border-radius: 50%;
2616
+ transition: left 300ms linear;
2617
+ }
2618
+
2619
+ .toggle-checkbox {
2620
+ display: none;
2621
+ }
2622
+
2623
+ .toggle-checkbox:checked + .toggle-label {
2624
+ background-color: #4caf50;
2625
+ }
2626
+
2627
+ .toggle-checkbox:checked + .toggle-label::before {
2628
+ left: 18px;
2629
+ }
2630
+ .ach-scrl {
2631
+ max-height: 380px;
2632
+ min-height: 380px;
2633
+ overflow-y: auto;
2634
+ padding-right: 6px;
2635
+ }
2636
+ .mb-4{
2637
+ margin-bottom:4px
2638
+ }
2639
+ .ach-scrl::-webkit-scrollbar {
2640
+ width: 3px;
2641
+ background-color: #F5F5F5;
2642
+ }
2643
+ .ach-scrl::-webkit-scrollbar-thumb {
2644
+ background-color: #35254D;
2645
+ }
2646
+
2647
+ .error-span{
2648
+ color:red !important;
2649
+ font-size:12px !important;
2650
+ text-align: left !important;
2651
+ width: 100% !important;
2652
+ display: block;
2653
+ }
2654
+
2655
+ .charge-customer-name-frac{
2656
+ color: #161616;
2657
+ font-family: Inter;
2658
+ font-size: 24px;
2659
+ font-style: normal;
2660
+ font-weight: 600;
2661
+ line-height: 32px;
2662
+ letter-spacing: -0.48px;
2663
+ text-transform: capitalize;
2664
+ margin-top:0;
2665
+ margin-bottom:16px !important;
2666
+ text-align:left !important
2667
+ }
2668
+ .card-ach-heading-frac {
2669
+ color: #727272;
2670
+ font-family: Inter;
2671
+ font-size: 12px;
2672
+ font-style: normal;
2673
+ font-weight: 500;
2674
+ line-height: 18px;
2675
+ letter-spacing: -0.24px;
2676
+ margin : 0 0 10px !important;
2677
+ text-align : left
2678
+ }
2679
+ .card-list-div{
2680
+ max-height : 190px;
2681
+ overflow-y : auto;
2682
+ border:1px solid #E0DFE2;
2683
+ border-radius : 8px
2684
+ }
2685
+
2686
+
2687
+ .card-list-div::-webkit-scrollbar{
2688
+ width:2px;
2689
+ background-color:#F5F5F5
2690
+ }
2691
+ .card-list-div::-webkit-scrollbar-thumb{
2692
+ background-color:#35254D
2693
+ }
2694
+
2695
+ .card-list-single-div{
2696
+ border-bottom: 1px solid #E0DFE2;
2697
+ padding : 8px 11px;
2698
+ display : flex ;
2699
+ align-items:center;
2700
+ justify-content : space-between;
2701
+ gap:12px
2702
+ }
2703
+ .card-list-single-div:last-child {
2704
+ border-bottom: none;
2705
+ }
2706
+ .card-lint-div-in{
2707
+ min-height:444px}
2708
+ .card-number-radio{
2709
+ display:flex;
2710
+ gap:12px;
2711
+ }
2712
+ .card-number-radio .card-number-last-four{
2713
+ color:#161616 !important;
2714
+ font-family:Inter !important;
2715
+ font-size:14px !important;
2716
+ font-weight:500 !important;
2717
+ font-style:normal !important;
2718
+ line-height : 18px !important;
2719
+ latter-spacing:-0.18px !important
2720
+ }
2721
+ .card-expiry-date{
2722
+ margin:0;
2723
+ color:#00000080;
2724
+ font-family:Inter;
2725
+ font-size:14px;
2726
+ font-weight:500;
2727
+ font-style"normal;
2728
+ line-height : 18px;
2729
+ latter-spacing:-0.18px
2730
+ }
2731
+ .pay-with-other-card {
2732
+ margin-top : 12px;
2733
+ padding:12px 32px;
2734
+ border :1px solid #E0DFE2;
2735
+ border-radius : 1000px;
2736
+ display: flex;
2737
+ justify-content : center;
2738
+ align-items:center;
2739
+ gap:10px;
2740
+ // width:100%;
2741
+ background:white;
2742
+ cursor:pointer;
2743
+ color:#161616;
2744
+ text-align:center
2745
+ font-family: Inter;
2746
+ font-size: 14px;
2747
+ font-style: normal;
2748
+ font-weight: 500;
2749
+ line-height: 24px;
2750
+ letter-spacing: -0.28px;
2751
+ // margin-bottom: 50px;
2752
+ }
2753
+ .charge-payment-back-btn {
2754
+ display: flex;
2755
+ padding: 6px 12px !important ;
2756
+ align-items: center;
2757
+ gap: 6px;
2758
+ border-radius: 1000px;
2759
+ border: 1px solid #E0DFE2;
2760
+ background: #FFF;
2761
+ box-shadow: 0px 6px 12px 0px rgba(206, 197, 221, 0.31);
2762
+ font-size:16px;
2763
+ curso:pointer;
2764
+ color:black
2765
+ }
2766
+ .res-charge-payment-back-btn{
2767
+ padding: 9px 16px;
2768
+ align-items: center;
2769
+ gap: 6px;
2770
+ margin-bottom: 20px;
2771
+ border-radius: 1000px;
2772
+ border: 1px solid #E0DFE2;
2773
+ background: #FFF;
2774
+ box-shadow: 0px 6px 12px 0px rgba(206, 197, 221, 0.31);
2775
+ font-size:16px;
2776
+ curso:pointer;
2777
+ color:black;
2778
+ display:none
2779
+ }
2780
+ .btn {
2781
+ padding: 11px 23px;
2782
+ background-color: black;
2783
+ color: white;
2784
+ border: none;
2785
+ border-radius: 6px;
2786
+ font-weight: bold;
2787
+ margin: 0 10px;
2788
+ cursor: pointer;
2789
+ }
2790
+
2791
+ .custom-swal-icon {
2792
+ margin: 20px auto;
2793
+ }
2794
+
2795
+ .custom-swal-popup {
2796
+ font-size: 16px;
2797
+ text-align: center;
2798
+ }
2799
+
2800
+ .frac-form .res-pay-con{
2801
+ display:none
2802
+ }
2803
+
2804
+ .saveachtext p, .saveachtext b {
2805
+ font-size: 12px !important;
2806
+ color: #727272 !important;
2807
+ }
2808
+
2809
+ .cardicon-img img {
2810
+ margin-top: -2px !important;
2811
+ }
2812
+
2813
+ .bankicon-img img {
2814
+ margin-top: -4px !important;
2815
+ }
2816
+
2817
+ .cardicon {
2818
+ margin-right : 8px !important;
2819
+ width : 18px !important;
2820
+ }
2821
+
2822
+ .bankicon {
2823
+ margin-right : 8px !important;
2824
+ width : 18px !important;
2825
+ }
2826
+
2827
+
2828
+ .frac-tooltip-wrapper {
2829
+ position: absolute;
2830
+ right:0;
2831
+ }
2832
+
2833
+ .frac-tooltip-icon {
2834
+ cursor: pointer;
2835
+ }
2836
+ .frac-tooltip-mn{
2837
+ position:relative;
2838
+ }
2839
+ .frac-tooltip-text {
2840
+ display: none;
2841
+ position: absolute;
2842
+ top:-15px;
2843
+ right: 22px;
2844
+ background: #161616;
2845
+ color: white;
2846
+ padding: 15px;
2847
+ border-radius: 10px;
2848
+ width: 200px;
2849
+ font-size:12px;
2850
+ word-break: break-word;
2851
+ white-space: normal;
2852
+ z-index: 999;
2853
+ }
2854
+
2855
+ .frac-tooltip-wrapper:hover .frac-tooltip-text {
2856
+ display: block;
2857
+ }
2858
+
2859
+ .frac-tooltip-text p,.frac-tooltip-text b {
2860
+ font-size : 12px !important;
2861
+ line-height : 1.5 !important;
2862
+ margin-bottom : 10px !important;
2863
+ }
2864
+
2865
+ .amt-pay-con {
2866
+ padding-right: 24px;
2867
+ }
2868
+
2869
+
2870
+
2871
+ @media (max-width: 768px) {
2872
+ .card-lint-div-in {
2873
+ min-height: auto;
2874
+ margin-bottom: 10px;
2875
+ }
2876
+ .ach-scrl {
2877
+ min-height: auto !important;
2878
+ margin-bottom: 10px;
2879
+ }
2880
+ .request-payment-close-popup {
2881
+ right: 12px !important;
2882
+ top: 12px !important;
2883
+ }
2884
+
2885
+ .parent-pay-container{
2886
+ padding:24px;
2887
+ }
2888
+ .pay-container {
2889
+ grid-template-columns: 1fr;
2890
+ padding: 10px 5%;
2891
+ border:1px solid #E0DFE2;
2892
+ border-radius : 12px
2893
+ }
2894
+ .pay-conatiner-one{
2895
+ border-right: none;
2896
+ }
2897
+ .pay-conatiner-one-first{
2898
+ min-height:0
2899
+ }
2900
+ .pay-main-logo > img{
2901
+ display: none;
2902
+ }
2903
+ .pay-main-logo-res > img {
2904
+ display:block;
2905
+ margin:auto
2906
+ }
2907
+
2908
+ .pay-logo-container{
2909
+ border :none
2910
+ }
2911
+ // .res-charge-payment-back-btn {
2912
+ // display:flex !important
2913
+ // }
2914
+ // .charge-payment-back-btn{
2915
+ // display:none !important
2916
+ // }
2917
+
2918
+ .frac-new-form .pay-amount-conatiner {
2919
+ margin-top: 0px;
2920
+ margin-bottom: 24px;
2921
+ }
2922
+ .frac-form .res-pay-con{
2923
+ display:flex;
2924
+ justify-content :space-between;
2925
+ align-items:center;
2926
+ padding-bottom : 10px
2927
+ }
2928
+ .amt-pay-con {
2929
+ padding-right: 0px;
2930
+ }
2931
+ .pay-conatiner-one-last{
2932
+ display:none}
2933
+ .pay-conatiner-two{
2934
+ padding:0
2935
+ }
2936
+
2937
+
2938
+ }
2939
+ @media (max-width : 512px){
2940
+ .tab button {
2941
+ padding: 6px 16px;
2942
+ }
2943
+
2944
+ }
2945
+
2946
+
2947
+ .frac-cash-discount-fee {
2948
+ display: flex;
2949
+ padding: 11px;
2950
+ justify-content: space-between;
2951
+ align-items: center;
2952
+ align-self: stretch;
2953
+ border-radius: 8px;
2954
+ border: 1px solid #E0DFE2;
2955
+ background: #F6F6F7;
2956
+ margin-top: 24px;
2957
+ }
2958
+ .frac-cash-discount-fee small {
2959
+ color:#727272;
2960
+ font-size: 12px;
2961
+ font-weight: 500;
2962
+ }
2963
+ .frac-cash-discount-fee p{
2964
+ margin:0px;
2965
+ font-size: 14px;
2966
+ font-weight: 500;
2967
+ }
2968
+ .frac-card-payment-heading {
2969
+ font-size: 24px;
2970
+ font-style: normal;
2971
+ font-weight: 600;
2972
+ margin:0px;
2973
+ }
2974
+
2975
+ .frac-heading-card-wrap {
2976
+ display: flex;
2977
+ align-items: center;
2978
+ margin-bottom:12px;
2979
+ }
2980
+ .frac-backarrow {
2981
+ margin-right: 10px;
2982
+ }
2983
+ .frac-charge-payment-back-btn-wrap , .frac-tab-2{
2984
+ display: none;
2985
+ }
2986
+ .frac-pay-conatiner-one{
2987
+ display: flex;
2988
+ flex-direction: column;
2989
+ justify-content: space-between;
2990
+ min-height: auto;
2991
+ }
2992
+
2993
+ .frac-form .saveachlabel {
2994
+ margin-bottom : 0px !important;
2995
+ }
2996
+
2997
+ .frac-partial-payment-input{
2998
+ margin-top: 12px !important;
2999
+ }
3000
+
3001
+ .challengeUrlclass-frac{
3002
+ height : 90vh;
3003
+ width : 100%;
3004
+ border-radius : 8px;
3005
+ border : none;
3006
+ }
3007
+
3008
+
3009
+
3010
+
3011
+
3012
+ `)}import d,{useCallback as Mr,useEffect as $i,useRef as Xi,useState as it}from"react";import kn from"axios";import mi from"sweetalert2";import{useEffect as Cr,useRef as wr}from"react";function va({challengeUrl:e,fractalToken:t,stripeIntentId:H,onSuccess:z,onError:B,containerRef:Y}){let K=wr(null);return Cr(()=>{if(!e||typeof window=="undefined")return;let U=Y.current;if(!U)return;K.current&&U.contains(K.current)&&U.removeChild(K.current);let ve=document.createElement("iframe");ve.className="challengeUrlclass-frac",ve.src=e,K.current=ve,U.appendChild(ve);let Z=A=>{var G;((G=A.data)==null?void 0:G.type)==="3ds-authentication-challenge-complete"&&(U.innerHTML="",A.data.status==="succeeded"?z(t,H):B(A.data.status))};return window.addEventListener("message",Z),()=>{window.removeEventListener("message",Z),K.current&&U.contains(K.current)&&U.removeChild(K.current)}},[e,Y,t,H,z,B]),null}import{Elements as _r}from"@stripe/react-stripe-js";import{loadStripe as Pr}from"@stripe/stripe-js";import{PaymentElement as Ca,useElements as Nr,useStripe as kr}from"@stripe/react-stripe-js";import Sr from"axios";import{useState as wa}from"react";var Na=({onSuccess:e,showLoader:t,setError:H,session_token:z,callback:B,hideLoader:Y,handleClose:K,amount:U,isPreAuth:ve})=>{var V;let Z=kr(),A=Nr(),[G,se]=wa(!1),[w,v]=wa(null);return React.createElement("form",{onSubmit:async y=>{var Se,P,Ue,Fe,ce,_e,ct;if(y.preventDefault(),!Z||!A){console.warn("stripe nopt loaded");return}console.log("Stripe:",Z),console.log("Elements:",A),console.log("PaymentElement:",A.getElement(Ca)),t(),se(!0);try{let{error:Ne,paymentIntent:Me}=await Z.confirmPayment({elements:A,confirmParams:{},redirect:"if_required"});if(se(!1),Ne)console.log(Ne,"paymentIntent error"),H(Ne.message||"Payment failed.");else if((Me==null?void 0:Me.status)==="succeeded"){if(v("\u2705 Payment successful!"),e){console.log(Me,"paymentIntent");try{let ue=await Sr.post(`${Ee}api/v1/gateway/secure-charge/${z}`,{stripe_id:Me==null?void 0:Me.id});if(console.log(ue,"chargeDetails"),(Se=ue==null?void 0:ue.data)!=null&&Se.result){let qe=(P=ue==null?void 0:ue.data)==null?void 0:P.data;console.log(qe,"callbackdata"),B(L(C({},qe),{isPreAuth:ve})),K(),Y()}console.log((Ue=ue==null?void 0:ue.data)==null?void 0:Ue.data,"chargeDetails")}catch(ue){console.log(ue==null?void 0:ue.response,"error"),H(((ce=(Fe=ue==null?void 0:ue.response)==null?void 0:Fe.data)==null?void 0:ce.message)||"Something went wrong"),Y()}}setTimeout(()=>window.close(),1500)}else v("Processing payment...")}catch(Ne){console.log(Ne==null?void 0:Ne.response,"error"),H(((ct=(_e=Ne==null?void 0:Ne.response)==null?void 0:_e.data)==null?void 0:ct.message)||"Something went wrong"),Y()}}},React.createElement(Ca,null),React.createElement("button",{className:"pay-button",disabled:G||!Z},G?"Processing...":`${xe((V=Number(U))==null?void 0:V.toFixed(2))}`))};var Fr=Pr(Qn);function Qi({clientSecret:e,onSuccess:t,showLoader:H,setError:z,session_token:B,callback:Y,hideLoader:K,handleClose:U,amount:ve,isPreAuth:Z}){return e?React.createElement(_r,{stripe:Fr,options:{clientSecret:e}},React.createElement(Na,{onSuccess:t,showLoader:H,hideLoader:K,setError:z,session_token:B,callback:Y,handleClose:U,amount:ve,isPreAuth:Z})):null}import{IoArrowBack as Di}from"react-icons/io5";import{NumericFormat as Lr}from"react-number-format";var Ar=({amount:e,bankAmount:t,submitBtnText:H="Pay",session_token:z,customerId:B,callback:Y,merchantName:K="merchant",isPreAuth:U,surcharge:ve="0",submitBtnClass:Z,submitBtnIcon:A,isRequest:G,pass_fee:se,pass_fee_amount:w,require3ds:v=!1,autoTrigger:ee=!1,show:V,setShow:y,setHandleCloseRef:Se,isPartial:P,bankSurcharge:Ue,partialRef:Fe,loadingPrev:ce=!1,orderGuid:_e,remainingAmount:ct})=>{var Nt,de,yt,Ut,ln,ei,zn,Et,Gn,hn,dn,Si,_i,ji,Pi,Vn;let Ne=Xi(!1),Me=Xi(!1),ue=Xi(null),[qe,$e]=it("card"),[mn,Xt]=it("card"),[h,M]=it(),[u,ge]=it({}),[o,r]=it(),[a,b]=it({}),[N,F]=it(!1),[O,x]=it(!1),[f,k]=it(""),[He,dt]=it(!1),[Be,Ft]=it(""),[ut,Re]=it(!1),[Le,pe]=it(!1),[E,Pe]=it([]),[at,D]=it([]),[St,Ke]=it(),[_t,S]=it(Number(e)),[bn,Pt]=it("form"),[ft,cn]=it("form"),[vt,Yn]=it(!1),[Ln,Ct]=it(0),[An,Sn]=it(""),[_n,Q]=it(null),[$,Ze]=it(!1),[Tt,Je]=it(!1),[rt,ht]=it(null),[qt,Mt]=it(!1),[zt,Wt]=it(_e||null),[ot,je]=it(""),[Yt,Ht]=it(""),[Dt,Rt]=it(""),en=ne+"widget/mc-img.svg",tn=ne+"widget/visa-img.svg",nn=ne+"widget/ae-img.svg",un=ne+"widget/discover-img.svg",Gt=ne+"widget/card.svg",Ve=ne+"widget/Trash.svg",jt=ne+"widget/bank.svg",_=ne+"widget/secure-img.png",g=ne+"widget/pov-by.png",le=ne+"widget/pax.svg",fe=ne+"widget/cardicon.svg",te=ne+"widget/bankicon.svg",Oe=()=>Re(!0),ye=()=>Re(!1),wt=(s,l)=>{let X=(parseFloat(l)||0)/100,me=s/(1+X);return Math.round(me*100)/100},We=async s=>{var l,X,me,R,ie,Ye,Xe,De,he;try{let J=C({pass_fee_amount:Number(e)-_t,pass_fee:se,Token:s==null?void 0:s.Token,amount:ot||e,postal_code:s==null?void 0:s.postalCode,require3ds:v,isPartial:P,orderGuid:zt||_e},O?{card:{postal_code:h==null?void 0:h.zipCode,customer_id:B,gateway_token:(s==null?void 0:s.Token)||(s==null?void 0:s.gateway_token),name:h==null?void 0:h.cardName}}:null);v&&(s!=null&&s.stripe_3ds_auth_id)&&(J.stripe_3ds_auth_id=s==null?void 0:s.stripe_3ds_auth_id);let T=await kn.post(`${Ee}api/v1/gateway/charge/${z}`,J);if((l=T==null?void 0:T.data)!=null&&l.result){let lt={callback:L(C({},(X=T==null?void 0:T.data)==null?void 0:X.data),{name:h==null?void 0:h.cardName,isPreAuth:U})};Y(lt),ye(),nt()}}catch(J){k(((R=(me=J==null?void 0:J.response)==null?void 0:me.data)==null?void 0:R.message)||"Something went wrong!"),Y({error:((Ye=(ie=J==null?void 0:J.response)==null?void 0:ie.data)==null?void 0:Ye.message)||"Something went wrong!",result:(De=(Xe=J==null?void 0:J.response)==null?void 0:Xe.data)==null?void 0:De.result,statusCode:(he=J==null?void 0:J.response)==null?void 0:he.status}),ye()}},mt=async s=>{var l,X,me,R,ie,Ye,Xe,De,he;try{let J=C({Token:s==null?void 0:s.Token,amount:e,postal_code:s==null?void 0:s.postalCode},O?{card:{postal_code:h==null?void 0:h.zipCode,customer_id:B,gateway_token:(s==null?void 0:s.Token)||(s==null?void 0:s.gateway_token),name:h==null?void 0:h.cardName}}:null),T=await kn.post(`${Ee}api/v1/gateway/preauth/${z}`,J);if((l=T==null?void 0:T.data)!=null&&l.result){let lt,At={callback:L(C({},(X=T==null?void 0:T.data)==null?void 0:X.data),{name:h==null?void 0:h.cardName,isPreAuth:U})};Y(At),ye(),nt()}}catch(J){k(((R=(me=J==null?void 0:J.response)==null?void 0:me.data)==null?void 0:R.message)||"Something went wrong!"),Y({error:((Ye=(ie=J==null?void 0:J.response)==null?void 0:ie.data)==null?void 0:Ye.message)||"Something went wrong!",result:(De=(Xe=J==null?void 0:J.response)==null?void 0:Xe.data)==null?void 0:De.result,statusCode:(he=J==null?void 0:J.response)==null?void 0:he.status}),ye()}},Vt=async s=>{var l,X,me,R,ie,Ye,Xe,De,he;if(s.Error)k(s.Error),Y({error:s.Error||"Something went wrong!"}),ye();else{let J={token:s.Token,resp:s};try{let T=await kn.post(`${Ee}api/v1/gateway/update/token/${z}`,J);if((T==null?void 0:T.status)==200){let lt={Token:(X=(l=T==null?void 0:T.data)==null?void 0:l.data)==null?void 0:X.gateway_token,Brand:s.Brand,ExpirationMonth:s.ExpirationMonth,ExpirationYear:s.ExpirationYear,Last4:s.Last4,Bin:s.Bin,CVV:s.CVV,postalCode:h==null?void 0:h.zipCode},At;U?mt(lt):We(lt)}}catch(T){console.log(T,"error"),ye(),k(((R=(me=T==null?void 0:T.response)==null?void 0:me.data)==null?void 0:R.message)||"Something went wrong!"),Y({error:((Ye=(ie=T==null?void 0:T.response)==null?void 0:ie.data)==null?void 0:Ye.message)||"Something went wrong!",result:(De=(Xe=T==null?void 0:T.response)==null?void 0:Xe.data)==null?void 0:De.result,statusCode:(he=T==null?void 0:T.response)==null?void 0:he.status})}}},p=s=>{$e(s)},c=()=>{var X,me,R,ie,Ye,Xe,De,he;let s={},l=o;return(X=l==null?void 0:l.name)!=null&&X.trim()||(s.name="Name is required"),(me=l==null?void 0:l.accountNumber)!=null&&me.trim()||(s.accountNumber="Account number is required"),(R=l==null?void 0:l.accountNumber)!=null&&R.trim()&&((ie=l==null?void 0:l.accountNumber)==null?void 0:ie.trim())!==((Ye=l==null?void 0:l.confirmAccountNumber)==null?void 0:Ye.trim())&&(s.confirmAccountNumber="Account numbers must match"),(Xe=l==null?void 0:l.bankName)!=null&&Xe.trim()||(s.bankName="Bank name is required"),(De=l==null?void 0:l.routingNumber)!=null&&De.trim()||(s.routingNumber="Routing Number is required"),l!=null&&l.routingNumber&&((he=l==null?void 0:l.routingNumber)==null?void 0:he.length)!==9&&(s.routingNumber="Routing number must be 9 digits"),((l==null?void 0:l.accountType)==="business saving"||(l==null?void 0:l.accountType)==="business checking")&&(!(l!=null&&l.companyName)||(l==null?void 0:l.companyName)==="")&&(s.companyName="Company Name is required for business accounts"),b(s),Object.keys(s).length>0},W=async(s,l)=>{var X,me,R,ie,Ye,Xe,De,he;try{let J=s,T=await kn.post(`${Ee}api/v1/gateway/verify-and-save/${z}`,{token:J,require3ds:v,pass_fee:se});if((T==null?void 0:T.status)==200){let lt=(X=T==null?void 0:T.data)==null?void 0:X.data,At={Token:lt.gateway_token,Brand:lt.card_data.brand,ExpirationMonth:lt.card_data.expire_mm,ExpirationYear:lt.card_data.expire_yy,Last4:lt.card_data.last4,Bin:lt.card_data.bin,postalCode:h==null?void 0:h.zipCode,stripe_3ds_auth_id:l};U?mt(At):We(At)}}catch(J){console.log(J,"error"),k(((R=(me=J==null?void 0:J.response)==null?void 0:me.data)==null?void 0:R.message)||"Something went wrong!"),Y({error:((Ye=(ie=J==null?void 0:J.response)==null?void 0:ie.data)==null?void 0:Ye.message)||"Something went wrong!",result:(De=(Xe=J==null?void 0:J.response)==null?void 0:Xe.data)==null?void 0:De.result,statusCode:(he=J==null?void 0:J.response)==null?void 0:he.status}),ye()}},ke=async()=>{var s,l,X,me,R,ie,Ye,Xe,De,he,J,T,lt,At,Jt,ti,pt,ui,bt,gi,Fi,ni,Kt,$t,pi,fi,ea,ta,na,ia,aa,ra;try{let pn={method:"POST",redirect:"follow"},vn=await kn.post(`${Ee}api/v1/widget/generate-session`,pn),ii=Number(h==null?void 0:h.expiryYear)%100,oa=`${(s=h==null?void 0:h.cardNumber)==null?void 0:s.replace(/\s+/g,"")}=${ii}${h==null?void 0:h.expiryMonth} ${h==null?void 0:h.cvv}`,ai=forge.pki.publicKeyFromPem((X=(l=vn==null?void 0:vn.data)==null?void 0:l.data)==null?void 0:X.publicKeyPem).encrypt(oa,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),Sa=forge.util.encode64(ai),_a={"Content-Type":"application/json","x-app-session-key":(R=(me=vn.data)==null?void 0:me.data)==null?void 0:R.session_key},sa={enc_track2_data:Sa,algorithm:"RSAES_OAEP_SHA_1",session_key:(Ye=(ie=vn==null?void 0:vn.data)==null?void 0:ie.data)==null?void 0:Ye.session_key};if(v&&typeof window!="undefined"&&typeof navigator!="undefined"){let Qt=(Xe=navigator.languages)!=null?Xe:[navigator.language],la=Array.isArray(Qt)?Qt[0]:Qt;sa.three_ds_data={amount:Math.round(ot?parseFloat(ot)*100:parseFloat(e)*100),currency:"usd",channel:{type:"browser",browser:{language:typeof la=="string"?la:null,color_depth:(he=(De=window.screen)==null?void 0:De.colorDepth)!=null?he:null,java_enabled:typeof navigator.javaEnabled=="function"?navigator.javaEnabled():!1,screen_height:(T=(J=window.screen)==null?void 0:J.height)!=null?T:null,screen_width:(At=(lt=window.screen)==null?void 0:lt.width)!=null?At:null,timezoneOffset:new Date().getTimezoneOffset()}}}}let Pa=JSON.stringify(sa),fn=await kn.post(`${rn}tokenizer/tokenize`,Pa,{headers:_a});if((fn==null?void 0:fn.status)==200){let Qt=(ti=(Jt=fn==null?void 0:fn.data)==null?void 0:Jt.data)==null?void 0:ti.stripe_three_ds_response;v&&!Qt&&Qt.status==="200 OK"&&((pt=Qt==null?void 0:Qt.data)!=null&&pt.challenge_url)&&k("Something went wrong. Please try again later."),v?(ui=Qt==null?void 0:Qt.data)!=null&&ui.challenge_url?(ye(),ht(L(C({},Qt==null?void 0:Qt.data),{fractalToken:(Kt=(ni=fn==null?void 0:fn.data)==null?void 0:ni.data)==null?void 0:Kt.token}))):W((gi=(bt=fn==null?void 0:fn.data)==null?void 0:bt.data)==null?void 0:gi.token,(Fi=Qt==null?void 0:Qt.data)==null?void 0:Fi.id):W((pi=($t=fn==null?void 0:fn.data)==null?void 0:$t.data)==null?void 0:pi.token,null)}}catch(pn){ye(),console.log(pn,"error");let vn="Something went wrong!";try{let ii=((fi=pn==null?void 0:pn.response)==null?void 0:fi.data)||(pn==null?void 0:pn.message)||"",Mi=typeof ii=="string"?ii:JSON.stringify(ii),hi=(((ta=(ea=Mi.split)==null?void 0:ea.call(Mi,`
3013
+ `))==null?void 0:ta.filter(Boolean))||[]).at(-1)||"",ai=(na=hi.split)==null?void 0:na.call(hi,": ");vn=(ai==null?void 0:ai.length)>1?ai.pop().trim():hi.trim()||vn}catch(ii){vn="Something went wrong!"}k(vn),Y({error:vn,result:(aa=(ia=pn==null?void 0:pn.response)==null?void 0:ia.data)==null?void 0:aa.result,statusCode:(ra=pn==null?void 0:pn.response)==null?void 0:ra.status})}},ae=()=>{var R,ie,Ye,Xe,De,he;let s={},l=h,X=parseInt((l==null?void 0:l.expiryMonth)||"",10),me=(l==null?void 0:l.expiryYear)||"";if((R=l==null?void 0:l.cardName)!=null&&R.trim()||(s.cardName="Card name is required"),(ie=l==null?void 0:l.cardNumber)!=null&&ie.trim()||(s.cardNumber="Card number is required"),(!((Ye=l==null?void 0:l.expiryMonth)!=null&&Ye.trim())||!((Xe=l==null?void 0:l.expiryYear)!=null&&Xe.trim())||isNaN(X)||X<1||X>12||me.length!==4)&&(s.expiryMonth="Invalid Expiration Date."),(De=l==null?void 0:l.cvv)!=null&&De.trim()||(s.cvv="CVV is required"),(he=l==null?void 0:l.zipCode)!=null&&he.trim()||(s.zipCode="ZIP code is required"),l!=null&&l.expiryMonth&&(l!=null&&l.expiryYear)&&l.expiryMonth.length<=2&&l.expiryYear.length===4){let J=parseInt(l.expiryMonth,10),T=parseInt(l.expiryYear,10),lt=new Date,At=lt.getMonth()+1,Jt=lt.getFullYear();(T<Jt||T===Jt&&J<At)&&(s.expiryMonth="Card is expired")}return ge(s),Object.keys(s).length>0},et=()=>{let s=DatacapWebToken.validateCardNumber(h==null?void 0:h.cardNumber.replaceAll(" ","")),l=DatacapWebToken.validateExpirationDate(h==null?void 0:h.expiryMonth,h==null?void 0:h.expiryYear),X=DatacapWebToken.validateCVV(h==null?void 0:h.cvv),me={};return s||(me.cardNumber="Invalid card Number"),l||(me.expiryMonth="Invalid Expiration Date."),X||(me.cvv="Invalid CVV"),ge(me),s&&X&&l},Ce=async s=>{var X,me,R,ie,Ye,Xe,De,he,J,T,lt,At,Jt,ti,pt,ui;s.preventDefault();let l=document.activeElement;if(l instanceof HTMLElement&&l.blur(),!ut&&!Yt){if(qe!=="ach"){if(ae()||!et())return}else if(c())return;try{Oe();let bt=await kn.get(`${Ee}api/v1/gateway/token/${z}`,{params:{require3ds:v,pass_fee:se}});if((bt==null?void 0:bt.status)==200){let gi=(me=(X=bt==null?void 0:bt.data)==null?void 0:X.data)==null?void 0:me.gateway_token,Fi=(ie=(R=bt==null?void 0:bt.data)==null?void 0:R.data)==null?void 0:ie.paymentGateway;if(qe!=="ach")Fi==((Ye=Hi)==null?void 0:Ye.FRACTALKEY)?await ke():DatacapWebToken.requestToken(gi,"PaymentForm",Vt);else{let ni;try{let Kt=await kn.post(`${Ee}api/v1/gateway/bank-charge/${z}`,C({label:o==null?void 0:o.name,account_number:o==null?void 0:o.accountNumber,routing_number:o==null?void 0:o.routingNumber,bank_name:o==null?void 0:o.bankName,account_type:o==null?void 0:o.accountType,amount:`${t}`,customer_id:null,isSaveAch:!1,tax:"0.00",discount:"0.00",surcharge:"0.00",order_id:"",company_name:(o==null?void 0:o.companyName)||""},N?{bank:{name:o==null?void 0:o.name,account_number:o==null?void 0:o.accountNumber,routing_number:o==null?void 0:o.routingNumber,bank_name:o==null?void 0:o.bankName,account_type:o==null?void 0:o.accountType,customer_id:B||"",company_name:(o==null?void 0:o.companyName)||""}}:null));(Xe=Kt==null?void 0:Kt.data)!=null&&Xe.result&&(ni=L(C({},ni),{callback:L(C({},(De=Kt==null?void 0:Kt.data)==null?void 0:De.data),{name:o==null?void 0:o.name,isPreAuth:U})}),Y(ni),nt(),ye())}catch(Kt){console.log(Kt,"errororor");let $t=(he=Kt==null?void 0:Kt.response)==null?void 0:he.data;typeof($t==null?void 0:$t.message)=="object"?Object.values($t==null?void 0:$t.message).forEach(pi=>{var fi;k(pi||"Something went wrong"),Y({error:pi||"Something went wrong!",result:($t==null?void 0:$t.result)||!1,statusCode:(fi=Kt==null?void 0:Kt.response)==null?void 0:fi.status})}):(k(($t==null?void 0:$t.message)||"Something went wrong"),Y({error:($t==null?void 0:$t.message)||"Something went wrong!",result:($t==null?void 0:$t.result)||!1,statusCode:(J=Kt==null?void 0:Kt.response)==null?void 0:J.status})),ye()}}}}catch(bt){ye(),Y({error:((lt=(T=bt==null?void 0:bt.response)==null?void 0:T.data)==null?void 0:lt.message)||"Something went wrong!",result:(Jt=(At=bt==null?void 0:bt.response)==null?void 0:At.data)==null?void 0:Jt.result,statusCode:(ti=bt==null?void 0:bt.response)==null?void 0:ti.status}),k(((ui=(pt=bt==null?void 0:bt.response)==null?void 0:pt.data)==null?void 0:ui.message)||"Something went wrong!")}}},tt=(s,l)=>{let X=s;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(X)){(l===""||/^[0-9]+$/.test(l))&&(ge(R=>L(C({},R),{[X]:""})),M(R=>L(C({},R),{[X]:l})));return}ge(R=>L(C({},R),{[X]:""})),M(R=>L(C({},R),{[X]:l}))},Ae=s=>{var ie;let l=s.target,X=l.value.replace(/\D/g,""),{formatted:me,cursor:R}=Pn(l.value,(ie=l.selectionStart)!=null?ie:0);ge(Ye=>L(C({},Ye),{cardNumber:""})),M(Ye=>L(C({},Ye),{cardNumber:me})),requestAnimationFrame(()=>{l.setSelectionRange(R,R)})},re=s=>{let{name:l,value:X}=s.target,me=["routingNumber","accountNumber","confirmAccountNumber"];if(l=="name"){/^[a-zA-Z\s]*$/.test(X)&&(b(R=>L(C({},R),{[l]:""})),r(R=>L(C({},R),{[l]:X})));return}if(me.includes(l)){(X===""||/^[0-9]+$/.test(X))&&(b(R=>L(C({},R),{[l]:""})),r(R=>L(C({},R),{[l]:X})));return}b(R=>L(C({},R),{[l]:""})),r(R=>L(C({},R),{[l]:X}))},nt=()=>{y(!1),$e("card"),k(""),dt(!1),Ft(""),r({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),b({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),M({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),ge({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),F(!1),x(!1),cn("form"),Pt("form"),Yn(!1),Ct(0),S(0),Pe([]),Q(null),Sn(null),Ze(!1),Je(!1),ht(null),Wt(null),je(""),Ht(""),Rt("")},gt=async()=>{var s,l,X,me,R,ie,Ye,Xe,De;Oe();try{let he={isPreAuth:U,customerId:B},J=await kn.post(`${Ee}api/v1/gateway/card-list/${z}`,he),T=((l=(s=J==null?void 0:J.data)==null?void 0:s.data)==null?void 0:l.cardList)||[],lt=T==null?void 0:T.filter(Jt=>(Jt==null?void 0:Jt.card_type)=="Bank"),At=T==null?void 0:T.filter(Jt=>(Jt==null?void 0:Jt.card_type)!=="Bank");At&&(At==null?void 0:At.length)>0?($e("card"),Pt("list"),Pe(At)):($e("card"),Pe([])),lt&&(lt==null?void 0:lt.length)>0?(cn("list"),D(lt)):D([]),ye()}catch(he){console.log(he),ye(),Y({error:((me=(X=he==null?void 0:he.response)==null?void 0:X.data)==null?void 0:me.message)||"Something went wrong!",result:(ie=(R=he==null?void 0:he.response)==null?void 0:R.data)==null?void 0:ie.result,statusCode:(Ye=he==null?void 0:he.response)==null?void 0:Ye.status}),k(((De=(Xe=he==null?void 0:he.response)==null?void 0:Xe.data)==null?void 0:De.message)||(he==null?void 0:he.message)||"Something went wrong")}},be=s=>{switch(s==null?void 0:s.toLowerCase()){case"visa":return tn;case"mastercard":case"mc":case"m/c":return en;case"amex":case"american express":case"ae":return nn;case"discover":case"dcvr":return un;case"bank":return jt;default:return s}},oe=async s=>{mi.fire({icon:"warning",text:"Do you want to delete the card?",showCancelButton:!0,confirmButtonText:"Yes",cancelButtonText:"No",reverseButtons:!0,buttonsStyling:!1,customClass:{confirmButton:"swal2-confirm btn btn-dark",cancelButton:"swal2-cancel btn btn-dark",popup:"custom-swal-popup",icon:"custom-swal-icon"}}).then(async l=>{var X,me;if(l.isConfirmed){pe(!0);try{let R={card_id:s,customer_id:B},ie=await kn.patch(`${Ee}api/v1/gateway/delete-card/${z}`,R);(X=ie==null?void 0:ie.data)!=null&&X.result?(pe(!1),gt(),mi.fire({icon:"success",title:"Deleted!",text:((me=ie==null?void 0:ie.data)==null?void 0:me.message)||"Card deleted.",confirmButtonText:"OK",showConfirmButton:!0,timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}})):(pe(!1),mi.fire({icon:"error",title:"Failure!",text:"Card not deleted.",timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}}))}catch(R){pe(!1),mi.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}else l.dismiss===mi.DismissReason.cancel&&mi.fire({icon:"info",text:"Card not deleted",confirmButtonText:"OK",buttonsStyling:!1,customClass:{confirmButton:"btn btn-dark float-end",actions:"swal2-actions-end"}})})},Ot=async s=>{var R,ie,Ye,Xe,De,he,J,T,lt;if(s.currentTarget.blur(),ut)return;let l=B,X=St==null?void 0:St.id,me=St==null?void 0:St.card_type;if(!Yt)if(e)if(l)if(X){let At={amount:(me==null?void 0:me.toLowerCase())==="bank"?`${t}`:ot||e,customer_id:l,card_id:X,pass_fee:se,pass_fee_amount:Number(e)-_t};P&&(At.orderGuid=zt||_e,ot&&(At.ispartialPayment=!0)),U&&(At.isPreauth=!0);let Jt=Ee+"api/v1/gateway/charge-by-saved-details/"+z,ti={"Content-Type":"application/json"};try{Oe();let pt=await kn.post(Jt,At);(R=pt==null?void 0:pt.data)!=null&&R.result&&(Y({callback:L(C({},(ie=pt==null?void 0:pt.data)==null?void 0:ie.data),{isPreAuth:U})}),ye(),nt())}catch(pt){console.log(pt==null?void 0:pt.response,"error by saved details"),Y({error:((Xe=(Ye=pt==null?void 0:pt.response)==null?void 0:Ye.data)==null?void 0:Xe.message)||"Something went wrong!",result:(he=(De=pt==null?void 0:pt.response)==null?void 0:De.data)==null?void 0:he.result,statusCode:(J=pt==null?void 0:pt.response)==null?void 0:J.status}),ye(),k(((lt=(T=pt==null?void 0:pt.response)==null?void 0:T.data)==null?void 0:lt.message)||"Something went wrong!")}}else k("Please Select A Card/Bank"),Y({error:"Please Select A Card/Bank"});else k("Please Select Customer"),Y({error:"Please Select Customer"});else k("Something went wrong."),Y({error:"Something went wrong."})},Lt=async()=>{var s,l,X,me,R,ie,Ye,Xe,De,he,J;try{Oe();let T=await kn.get(`${Ee}api/v1/gateway/get-payment-details/${z}`);(T==null?void 0:T.status)==200&&(Yn((l=(s=T==null?void 0:T.data)==null?void 0:s.data)==null?void 0:l.isBankActive),Ct(Number((me=(X=T==null?void 0:T.data)==null?void 0:X.data)==null?void 0:me.fee)||0),ye())}catch(T){console.log((ie=(R=T==null?void 0:T.response)==null?void 0:R.data)==null?void 0:ie.result,"error while getting payment details"),Y({error:((Xe=(Ye=T==null?void 0:T.response)==null?void 0:Ye.data)==null?void 0:Xe.message)||"Something went wrong!",result:(he=(De=T==null?void 0:T.response)==null?void 0:De.data)==null?void 0:he.result,statusCode:(J=T==null?void 0:T.response)==null?void 0:J.status}),ye()}},Ge=async()=>{var s,l,X,me,R;if(!qt){Mt(!0);try{let ie=await kn.post(`${Ee}api/v1/gateway/create-pay-order/${z}`,{amount:e,cashDiscount:_t,bankAmount:t,bankSurcharge:Ue,customerId:B,passFee:se,passFeeAmount:w||Number(e)-_t,require3ds:v,isPartial:P});(s=ie==null?void 0:ie.data)!=null&&s.result&&(Mt(!1),Wt((X=(l=ie==null?void 0:ie.data)==null?void 0:l.data)==null?void 0:X.orderGuid),Rt((R=(me=ie==null?void 0:ie.data)==null?void 0:me.data)==null?void 0:R.remainingAmount),Ne.current=!0)}catch(ie){console.log("error in creating order",ie),Mt(!1)}}};$i(()=>{!V&&!ee&&(Ne.current=!1,Me.current=!1)},[V,ee]),$i(()=>{!Ne.current&&(V||ee)&&(Lt(),P&&!Fe&&Ge())},[V,ee,P]),$i(()=>{if((V||ee)&&w){let s=Number(e)-Number(w);s&&!isNaN(s)&&S(s)}else if((V||ee)&&se&&Ln){let s=wt(e,Ln);s&&!isNaN(s)&&S(s)}else S(Number(e));!Me.current&&B&&(V||ee)&&!G&&(Me.current=!0,gt())},[B,V,e,Ln,ee]);let En=()=>U?"Cards":"Cards/Bank",st=Mr(async()=>{try{Ze(!0);let l=await(await fetch(`${Ee}api/v1/gateway/create-payment-intent/${z}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({amount:e,require3ds:v,pass_fee:se})})).json();l.is3dEnable?(Ze(!1),Sn(l.clientSecret),Je(l.is3dEnable)):(Ze(!1),Je(l.is3dEnable)),l.result||k(l.error||(l==null?void 0:l.message)||"Failed to get client secret")}catch(s){console.log(s.response,"err.response"),k(s.message)}},[e]),Te=()=>{},Tn=(s,l)=>{Oe(),W(s,l),ht(null)},xn=s=>{console.error("3DS Auth failed \u274C",s),k(`3DS Authentication ${s}`)};$i(()=>{Se&&Se(()=>nt)},[]);let gn=s=>{var l,X;((l=Number(Dt||ct))==null?void 0:l.toFixed(2))<(s==null?void 0:s.floatValue)||(s==null?void 0:s.floatValue)<0?(je(s==null?void 0:s.value),Ht(`Partial amount cannot exceed ${xe((X=Number(Dt||ct))==null?void 0:X.toFixed(2))}`)):(s==null?void 0:s.floatValue)==0?(je(s==null?void 0:s.value),Ht("Partial amount must be greater than 0")):(je(s==null?void 0:s.value),Ht(""))};return d.createElement(d.Fragment,null,$&&d.createElement(an,{loading:$}),f&&d.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},d.createElement(Fn,{error:f,onClose:nt})),!f&&d.createElement(d.Fragment,null,(ut||Le)&&d.createElement(an,{loading:ut||Le||ce||qt}),d.createElement("div",{className:"frac-card-payment-page frac-form frac-new-form"},d.createElement("div",{ref:ue,style:{width:"100%",height:"100%"}}),rt!=null&&rt.challenge_url?d.createElement(va,{containerRef:ue,challengeUrl:rt.challenge_url,fractalToken:rt.fractalToken,stripeIntentId:rt.id,onSuccess:Tn,onError:xn}):d.createElement("div",{className:"parent-pay-container"},d.createElement("span",{style:{display:ee?"none":"block"},className:"request-payment-close-popup",onClick:nt},d.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},d.createElement("g",{clipPath:"url(#clip0_12425_52336)"},d.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),d.createElement("defs",null,d.createElement("clipPath",{id:"clip0_12425_52336"},d.createElement("rect",{width:"16",height:"16",fill:"white"}))))),d.createElement("div",{className:"pay-main-logo-res"}),d.createElement("div",{className:"pay-container"},d.createElement("div",{className:"pay-header pay-conatiner-one"},d.createElement("div",{className:"pay-conatiner-one-first"},d.createElement("div",{className:"pay-logo-container"},d.createElement("div",{className:"pay-main-logo"}),d.createElement("h1",{className:"pay-heading"},"Pay"),(E==null?void 0:E.length)>0&&qe!=="cardList"&&d.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>$e("cardList")}," ",d.createElement(Di,null)," Back")),d.createElement("div",{className:"amt-pay-con"},d.createElement("div",{className:"pay-amount-conatiner"},d.createElement("small",{className:"pay-payment-amount"},"Select payment type"),d.createElement("div",{className:"frac-card-bank-radio-main"},d.createElement(Nn,{label:"Card",amount:(Nt=Number(e))==null?void 0:Nt.toFixed(2),value:"card",onChange:p,activetab:qe}),!U&&vt&&!P&&d.createElement(Nn,{label:"Bank",amount:(de=Number(t))==null?void 0:de.toFixed(2),value:"ach",onChange:p,activetab:qe})),se&&qe==="card"&&_t&&Number(e)-Number(_t)>0?d.createElement("div",{className:"frac-cash-discount-fee"},d.createElement("small",null,qe==="card"?"Cash Discount":"Cash Discount Savings"," "),d.createElement("p",null,xe((Number(e)-Number(_t)).toFixed(2)))):null,P&&d.createElement("div",{className:"frac-partial-payment-input"},d.createElement("label",{htmlFor:"partialpayment"},"Partial Payment"),d.createElement(Lr,{prefix:"$",className:"form-control-frac",value:ot,onValueChange:s=>{gn(s)},thousandSeparator:!0,placeholder:"Enter partial amount",allowNegative:!1,allowLeadingZeros:!1,decimalScale:2,fixedDecimalScale:!0,isAllowed:s=>{let{floatValue:l=0,value:X}=s;return X===""||X==="0"||X.startsWith("0.")?!0:l===0?!1:l>0}}),Yt&&d.createElement("span",{className:"error-span"},Yt))))),d.createElement("div",{className:"pay-conatiner-one-last"},d.createElement("img",{src:_,alt:""}),d.createElement("img",{src:g,alt:""}),"Secure payments powered by Fractal")),d.createElement("div",{className:"pay-tab pay-conatiner-two"},d.createElement("div",{className:"col-md-12"},d.createElement("div",{id:"payment-form-div"},Tt?An&&d.createElement(Qi,{onSuccess:Te,clientSecret:An,amount:e,showLoader:Oe,hideLoader:ye,callback:Y,session_token:z,handleClose:nt,setError:k,isPreAuth:U}):d.createElement(d.Fragment,null,d.createElement("div",{id:"ach",style:{display:qe==="card"?"block":"none"},className:"tabcontent"},d.createElement("div",{className:"frac-heading-card-wrap"},d.createElement("div",{className:"frac-backarrow"},(E==null?void 0:E.length)>0&&bn==="form"&&d.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>Pt("list")}," ",d.createElement(Di,null))),d.createElement("h6",{className:"frac-card-payment-heading"},"Card Payment")),d.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0px 19px 0px"}},d.createElement("img",{src:tn,alt:"",width:33}),d.createElement("img",{src:en,width:33,alt:""}),d.createElement("img",{src:nn,alt:"",width:33}),d.createElement("img",{src:un,width:33,alt:""})),bn==="list"&&(E==null?void 0:E.length)>0?d.createElement(d.Fragment,null,d.createElement(Bn,{headingClass:"card-ach-heading-frac",listHeading:"Card",ListItems:E,selectedCard:St,setSelectedCard:Ke,handleDeleteCard:oe,otherButtonLabel:"Pay With Other Card",otherButtonAction:()=>{Pt("form")}}),d.createElement("div",{className:"form-group-frac",style:{padding:"0"}},d.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:Ot},ot?xe((yt=Number(ot))==null?void 0:yt.toFixed(2)):xe((Ut=Number(e))==null?void 0:Ut.toFixed(2))))):d.createElement("form",{id:"PaymentForm",style:{textAlign:"start"},onSubmit:Ce,onKeyDown:s=>{s.key==="Enter"&&ut&&(s.preventDefault(),s.stopPropagation())}},d.createElement("div",{className:"ach-scrl",style:{minHeight:"398px",maxHeight:"398px",overflow:"auto",marginRight:"5px"}},d.createElement("div",{className:"form-group-frac"},d.createElement("label",{htmlFor:"cardHolderName"},"NAME ON CARD "),d.createElement("input",{type:"text",className:"form-control-frac",maxLength:100,placeholder:"John Doe",value:(h==null?void 0:h.cardName)||"",onChange:s=>{let l=s.target.value;/^[a-zA-Z\s]*$/.test(l)&&tt("cardName",l)}}),(u==null?void 0:u.cardName)&&d.createElement("span",{className:"error-span"},u==null?void 0:u.cardName)),d.createElement("div",{className:"form-group-frac"},d.createElement("label",{htmlFor:"cardNumber"},"CARD NUMBER"),d.createElement("div",{className:"toggle-num-wrapper"},d.createElement("input",{className:"form-control-frac card-number-new",type:"text",maxLength:19,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:(h==null?void 0:h.cardNumber)||"",onChange:s=>Ae(s),"data-token":"card_number"}),d.createElement("div",{className:"card-crdi card-expiry-new"},d.createElement("div",{className:"exp-date-year-container"},d.createElement("div",{className:"exp-date form-group-frac"},d.createElement("input",{"data-token":"exp_month",className:"form-control-frac required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"MM",maxLength:2,value:(h==null?void 0:h.expiryMonth)||"",onChange:s=>tt("expiryMonth",s.target.value)})),d.createElement("div",{className:"exp-year form-group-frac"},d.createElement("input",{"data-token":"exp_year",className:"form-control-frac required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"YYYY",maxLength:4,value:(h==null?void 0:h.expiryYear)||"",onChange:s=>tt("expiryYear",s.target.value)})),d.createElement("div",{className:"security-digit form-group-frac"},d.createElement("input",{"data-token":"cvv",className:"form-control-frac card-cvv-in required",type:"text",style:{maxHeight:"36px"},maxLength:4,placeholder:"CVC",value:(h==null?void 0:h.cvv)||"",onChange:s=>tt("cvv",s.target.value)})))),(u==null?void 0:u.cardNumber)&&d.createElement("span",{className:"error-span"},u==null?void 0:u.cardNumber),d.createElement("p",{style:{margin:"0"}},u!=null&&u.expiryMonth||u!=null&&u.expiryYear?d.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},u==null?void 0:u.expiryMonth):"",(u==null?void 0:u.cvv)&&d.createElement("span",{className:"error-span"},u==null?void 0:u.cvv)))),d.createElement("div",{className:"form-group-frac"},d.createElement("label",{htmlFor:"zip"},"ZIP"),d.createElement("input",{type:"text",className:"form-control-frac",maxLength:100,placeholder:"000000",value:(ln=h==null?void 0:h.zipCode)!=null?ln:"",onChange:s=>tt("zipCode",s.target.value)}),(u==null?void 0:u.zipCode)&&d.createElement("span",{className:"error-span"},u==null?void 0:u.zipCode)),B&&d.createElement("div",{className:"form-group-frac"},d.createElement("div",{className:"frac-tooltip-mn",style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},d.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:O,onChange:s=>x(s.target.checked)}),d.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),d.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),d.createElement("div",{className:"frac-tooltip-wrapper"},d.createElement("div",{className:"frac-tooltip-icon"},d.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},d.createElement("circle",{cx:"10",cy:"10",r:"10",fill:"#E0DFE2"}),d.createElement("path",{d:"M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z",fill:"#161616"}))),d.createElement("div",{className:"frac-tooltip-text"},d.createElement("p",null,"If checked, I agree to give the ",d.createElement("b",null,K||"merchant")," permission to charge this credit card for agreed-upon purchases in the future.")))))),d.createElement("div",{className:"form-group-frac",style:{marginTop:"20px",padding:"0"}},d.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},ot?xe((ei=Number(ot))==null?void 0:ei.toFixed(2)):xe((zn=Number(e))==null?void 0:zn.toFixed(2)))))),d.createElement("div",{id:"ach",style:{display:qe==="ach"?"block":"none"},className:"tabcontent"},d.createElement(d.Fragment,null,d.createElement("div",{className:"frac-heading-card-wrap"},d.createElement("div",{className:"frac-backarrow"},(at==null?void 0:at.length)>0&&ft==="form"&&d.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>cn("list")}," ",d.createElement(Di,null))),d.createElement("h6",{className:"frac-card-payment-heading"},"Bank Payment")),ft==="list"&&(at==null?void 0:at.length)>0?d.createElement(d.Fragment,null,d.createElement(Bn,{headingClass:"card-ach-heading-frac",listHeading:"Banks",ListItems:at,selectedCard:St,setSelectedCard:Ke,handleDeleteCard:oe,otherButtonLabel:"Pay With Other Bank",otherButtonAction:()=>{cn("form")}}),d.createElement("div",{className:"form-group-frac",style:{padding:"0"}},d.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:Ot},xe((Et=Number(t))==null?void 0:Et.toFixed(2))))):d.createElement("form",{id:"ACHPaymentForm",style:{textAlign:"start"},onSubmit:Ce,autoComplete:"off",onKeyDown:s=>{s.key==="Enter"&&ut&&(s.preventDefault(),s.stopPropagation())}},d.createElement("div",{className:"ach-scrl",style:{minHeight:"444px",maxHeight:"444px"}},d.createElement("div",{className:"form-group-frac mb-4"},d.createElement("label",{htmlFor:"nameonaccount"},"Name on account"),d.createElement("input",{type:"text",id:"nameonaccount",className:"form-control-frac",maxLength:100,placeholder:"John Doe",name:"name",value:(Gn=o==null?void 0:o.name)!=null?Gn:"",onChange:re}),(a==null?void 0:a.name)&&d.createElement("span",{className:"error-span"},a==null?void 0:a.name)),d.createElement("div",{className:"form-group-frac mb-4"},d.createElement("label",{htmlFor:"routingnumber"},"Routing number"),d.createElement("input",{type:"text",id:"routingnumber",className:"form-control-frac",maxLength:9,placeholder:"000000000",name:"routingNumber",value:(hn=o==null?void 0:o.routingNumber)!=null?hn:"",onChange:re}),(a==null?void 0:a.routingNumber)&&d.createElement("span",{className:"error-span"},a==null?void 0:a.routingNumber)),d.createElement("div",{className:"form-group-frac mb-4"},d.createElement("label",{htmlFor:"accountnumber"},"Account number"),d.createElement("input",{type:"text",id:"accountnumber",className:"form-control-frac",maxLength:16,placeholder:"0000000000",name:"accountNumber",value:(dn=o==null?void 0:o.accountNumber)!=null?dn:"",onChange:re}),(a==null?void 0:a.accountNumber)&&d.createElement("span",{className:"error-span"},a==null?void 0:a.accountNumber)),d.createElement("div",{className:"form-group-frac mb-4"},d.createElement("label",{htmlFor:"confirmaccountnumber"},"Confirm account number"),d.createElement("input",{type:"text",id:"confirmaccountnumber",className:"form-control-frac",maxLength:16,placeholder:"0000000000",name:"confirmAccountNumber",value:(Si=o==null?void 0:o.confirmAccountNumber)!=null?Si:"",onChange:re}),(a==null?void 0:a.confirmAccountNumber)&&d.createElement("span",{className:"error-span"},a==null?void 0:a.confirmAccountNumber)),d.createElement("div",{className:"form-group-frac mb-4"},d.createElement("label",{htmlFor:"bankname"},"Bank name"),d.createElement("input",{type:"text",id:"bankname",className:"form-control-frac",maxLength:100,placeholder:"My Bank",name:"bankName",value:(_i=o==null?void 0:o.bankName)!=null?_i:"",onChange:re}),(a==null?void 0:a.bankName)&&d.createElement("span",{className:"error-span"},a==null?void 0:a.bankName)),((o==null?void 0:o.accountType)==="business saving"||(o==null?void 0:o.accountType)==="business checking")&&d.createElement("div",{className:"form-group-frac mb-4"},d.createElement("label",{htmlFor:"companyName"},"Company name"),d.createElement("input",{type:"text",id:"companyName",className:"form-control-frac",maxLength:100,placeholder:"My Company",name:"companyName",value:(ji=o==null?void 0:o.companyName)!=null?ji:"",onChange:re}),(a==null?void 0:a.companyName)&&d.createElement("span",{className:"error-span"},a==null?void 0:a.companyName)),d.createElement("div",{className:"form-group-frac mb-4"},d.createElement("label",{htmlFor:"accounttype"},"Select account type"),d.createElement("select",{name:"accountType",id:"accounttype",className:"form-control-frac",value:(Pi=o==null?void 0:o.accountType)!=null?Pi:"",onChange:re},d.createElement("option",{value:""},"Select account"),oi.map(s=>d.createElement("option",{key:s.value,value:s.value},s.label)))),B&&d.createElement("div",{className:"form-group-frac mb-4 save-ach-div",style:{paddingTop:"5px"}},d.createElement("input",{type:"checkbox",id:"saveACH",className:"",maxLength:100,placeholder:"My Bank",checked:N,onChange:s=>F(s.target.checked)}),d.createElement("label",{className:"saveachlabel",htmlFor:"saveACH"},"Save ACH")),N&&d.createElement("div",{className:"form-group-frac mb-4 saveachtext"},d.createElement("p",null,"If checked, I agree to give the ",d.createElement("b",null,K||"merchant")," permission to charge this bank account for agreed-upon purchases in the future."))),d.createElement("div",{className:"form-group-frac "},d.createElement("button",{className:"pay-button",style:{margin:"20px 0 0"},type:"submit"},xe((Vn=Number(t))==null?void 0:Vn.toFixed(2))))))))))))))))},Ri=Ar;import zr from"axios";var Ir=({amount:e,bankAmount:t,submitBtnText:H="Pay",session_token:z,customerId:B,callback:Y,merchantName:K="merchant",isPreAuth:U,surcharge:ve="0",submitBtnClass:Z,submitBtnIcon:A,isRequest:G,pass_fee:se,pass_fee_amount:w,require3ds:v=!1,autoTrigger:ee=!1,isPartial:V,bankSurcharge:y,partialRef:Se})=>{let[P,Ue]=ci(!1),[Fe,ce]=ci(!1),[_e,ct]=ci(()=>()=>{}),[Ne,Me]=ci(null),[ue,qe]=ci(null),$e=Tr(()=>({amount:e,bankAmount:t,submitBtnText:H,session_token:z,customerId:B,callback:Y,merchantName:K,isPreAuth:U,surcharge:ve,submitBtnClass:Z,submitBtnIcon:A,isRequest:G,pass_fee:se,pass_fee_amount:w,require3ds:v,autoTrigger:ee,setShow:Ue,setHandleCloseRef:ct,isPartial:V,bankSurcharge:y,partialRef:Se}),[e,t,H,z,B,Y,K,U,ve,Z,A,G,se,w,v,ee,V,y,Se]),[mn,Xt]=ci($e);ka(()=>{P&&Xt($e)},[P,$e]);let h=async()=>{var M;ce(!0);try{let u=await zr.get(`${Ee}api/v1/gateway/get-order-details/${z}`,{params:{isPartial:V,partialRef:Se}});if((M=u==null?void 0:u.data)!=null&&M.result){let ge=u.data.data;ge!=null&&ge.orderGuid&&(Me(ge==null?void 0:ge.orderGuid),qe(ge==null?void 0:ge.remainingAmount)),Xt(o=>L(C({},o),{amount:ge.amount,pass_fee_amount:ge.pass_fee_amount,pass_fee:ge.pass_fee}))}}catch(u){console.log("error while getting skyosorderdeatils",u)}finally{ce(!1)}};return ka(()=>{P&&V&&Se&&h()},[P,V,Se]),Hn.createElement(Hn.Fragment,null,Hn.createElement("link",{href:"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css"}),Hn.createElement(Cn,null),Hn.createElement(Ji,null),Hn.createElement(Kn,null),Hn.createElement(Ti,null),!ee&&Hn.createElement("button",{className:Z||"paymentBtn",onClick:()=>Ue(!0)},H,A),ee?Hn.createElement(Ri,L(C({show:P,loadingPrev:Fe},mn),{orderGuid:Ne,remainingAmount:ue})):Hn.createElement(yn,{open:P,onClose:_e},Hn.createElement(Ri,L(C({show:P,loadingPrev:Fe},mn),{orderGuid:Ne,remainingAmount:ue}))))};export{pr as AddCard,hr as CardOnFile,or as GetPaymentPage,xr as PartialPayment,Ir as PaymentWidget,lr as PreAuthPayment,Ua as RequestPayment,Da as RequestPreAuthPayment};