@pinerohit11/testwidget 0.1.72 → 0.1.73

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 CHANGED
@@ -19,6 +19,7 @@ var __spreadValues = (a, b) => {
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
 
21
21
  // src/app/components/RequestPayment/RequestPayment.tsx
22
+ import "bootstrap/dist/js/bootstrap.bundle.min.js";
22
23
  import React6, { useState, useEffect } from "react";
23
24
 
24
25
  // src/app/components/Loader/Loader.tsx
@@ -178,48 +179,67 @@ var CustomModal2styles = (props) => {
178
179
  font-family: cursive;
179
180
  }
180
181
 
181
- .fractal-popup {
182
- position: fixed;
183
- z-index: 9999;
184
- top: 0;
185
- right: 0;
186
- bottom: 0;
187
- left: 0;
188
-
189
- width: 100%;
190
- height: 100%;
191
- background-color: rgba(0, 0, 0, 0.5);
192
- transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
193
- display: flex;
194
- justify-content: center;
195
- align-items: center;
196
- }
182
+ // .fractal-popup {
183
+ // position: fixed;
184
+ // z-index: 9999;
185
+ // top: 0;
186
+ // right: 0;
187
+ // bottom: 0;
188
+ // left: 0;
189
+ // width: 100%;
190
+ // // max-width:810px;
191
+ // height: 100%;
192
+ // background-color: rgba(0, 0, 0, 0.5);
193
+ // transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
194
+ // display: flex;
195
+ // justify-content: center;
196
+ // align-items: center;
197
+ // overflow:auto;
198
+ // }
199
+
200
+ .fractal-popup {
201
+ position: fixed;
202
+ z-index: 5555;
203
+ left: 0;
204
+ top: 0;
205
+ width: 100%;
206
+ height: 100%;
207
+ overflow: auto;
208
+ background-color: rgba(0, 0, 0, 0.8);
209
+ // padding:20px
210
+ }
197
211
 
198
212
  .fractal-popup-content {
213
+ margin:20px auto !important;
214
+ transform :none;
199
215
  background-color: white;
200
216
  padding:20px;
201
217
  border-radius: 0.5rem;
202
218
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
203
219
  box-sizing: border-box;
204
220
  position: relative;
221
+ // min-height : 585px;
222
+ max-width:810px;
223
+ width:90vw
224
+
205
225
  }
206
-
207
- @media only screen and (min-width: 600px){
208
- .fractal-popup-content {
209
- width: 500px;
210
-
211
- }
212
- }
213
- @media only screen and (max-width: 600px){
214
- .fractal-popup-content {
215
- width: 350px;
216
- }
217
- }
218
- @media only screen and (max-width: 450px){
219
- .fractal-popup-content {
220
- width: 300px;
221
- }
222
- }
226
+
227
+
228
+ // @media only screen and (min-width: 600px){
229
+ // .fractal-popup-content {
230
+ // max-width:810px;
231
+ // }
232
+ // }
233
+ // @media only screen and (max-width: 600px){
234
+ // .fractal-popup-content {
235
+ // width: 350px;
236
+ // }
237
+ // }
238
+ // @media only screen and (max-width: 450px){
239
+ // .fractal-popup-content {
240
+ // width: 300px;
241
+ // }
242
+ // }
223
243
  .close-popup {
224
244
  max-height:25px;
225
245
  width:25px;
@@ -306,7 +326,7 @@ var CustomModal2styles = (props) => {
306
326
  outline: 0;
307
327
  height: 46px;
308
328
  font-size: 16px;
309
- background: #ddd;
329
+ background: #727272;
310
330
  border: none;
311
331
  display: block;
312
332
  color: #fff;
@@ -314,9 +334,11 @@ var CustomModal2styles = (props) => {
314
334
  border-radius: 180px;
315
335
  margin: 10px 0;
316
336
  text-decoration: none;
337
+ cursor:pointer,
338
+ font-family:
317
339
  }
318
340
 
319
- .pay-button:hover, .pay-button:focus {background: #333; color: #fff;}
341
+ .pay-button:hover, .pay-button:focus {background: #222; color: #fff; cursor:pointer}
320
342
 
321
343
  .fractal-powerd-by {
322
344
  display: flex;
@@ -704,6 +726,7 @@ function RequestPayment(props) {
704
726
  window.parent.postMessage(message, "*");
705
727
  }
706
728
  const sendRequestPayment = async () => {
729
+ debugger;
707
730
  if (Object.keys(errors).length > 0) {
708
731
  return;
709
732
  }
@@ -732,8 +755,7 @@ function RequestPayment(props) {
732
755
  surcharge,
733
756
  tax
734
757
  };
735
- const response = await axios.post("/api/payment-request", formData);
736
- console.log(response, "response");
758
+ let response = await axios.post(`${baseUrl}create-widget-order`, formData);
737
759
  if ((response == null ? void 0 : response.status) === 200) {
738
760
  setShowConfirmationModal(true);
739
761
  setShow(false);
@@ -1122,7 +1144,656 @@ function RequestPreAuthPayment(props) {
1122
1144
  /* @__PURE__ */ React7.createElement("div", { className: "fractal-popup-content", style: { padding: "0px" } }, /* @__PURE__ */ React7.createElement("div", { className: "request-payment-success-container" }, /* @__PURE__ */ React7.createElement("span", { className: "request-payment-close-popup", onClick: handleCloseConfirmationModal }, /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React7.createElement("g", { "clip-path": "url(#clip0_12425_52336)" }, /* @__PURE__ */ React7.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" })), /* @__PURE__ */ React7.createElement("defs", null, /* @__PURE__ */ React7.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React7.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React7.createElement("div", { className: "request-payment-success-tick-div" }, /* @__PURE__ */ React7.createElement("div", { className: "request-payment-success-tick" }, /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React7.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" })))), /* @__PURE__ */ React7.createElement("h6", { className: "request-payment-success-text" }, "The request ", /* @__PURE__ */ React7.createElement("br", null), "was sent"), /* @__PURE__ */ React7.createElement("h6", { className: "request-payment-success-subtext" }, "Please wait for the customer to pay"), /* @__PURE__ */ React7.createElement("div", { className: "request-payment-success-btn-div" }, /* @__PURE__ */ React7.createElement("button", { onClick: handleCloseConfirmationModal, className: "request-payment-success-btn2" }, "Close"))))
1123
1145
  )));
1124
1146
  }
1147
+
1148
+ // src/app/components/Charge/GetPaymentPage.tsx
1149
+ import React9, { useState as useState3 } from "react";
1150
+
1151
+ // src/app/components/Charge/Chargewidgetstyles.tsx
1152
+ import React8 from "react";
1153
+ function Chargewidgetstyles() {
1154
+ const primarycolor = "#000";
1155
+ const primarybgcolor = "#fff";
1156
+ const primarybodycolor = "#212529";
1157
+ const primarybordercolor = "#dee2e6";
1158
+ return /* @__PURE__ */ React8.createElement("style", null, `
1159
+ @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
1160
+ body
1161
+ {
1162
+ font-family: 'Inter', sans-serif !important;
1163
+ }
1164
+ input
1165
+ {
1166
+ font-family: 'Inter', sans-serif !important;
1167
+ }
1168
+
1169
+ .paymentBtn {
1170
+ background-color: black;
1171
+ border: none;
1172
+ color: white;
1173
+ padding: 15px 32px;
1174
+ text-align: center;
1175
+ text-decoration: none;
1176
+ display: inline-block;
1177
+ font-size: 16px;
1178
+ margin: 4px 2px;
1179
+ cursor: pointer;
1180
+ border-radius: 180px;
1181
+ /* width: auto; */
1182
+ }
1183
+
1184
+ .main-logo {
1185
+ text-align: center;
1186
+ margin-bottom: 20px;
1187
+ }
1188
+
1189
+ .main-logo img {
1190
+ max-width: 180px;
1191
+ }
1192
+
1193
+ .pay-main-box {
1194
+ width: 365px !important;
1195
+ height: 93%;
1196
+ background: 0 0 #ffffff;
1197
+ border-radius: 12px;
1198
+
1199
+
1200
+ border: 1px solid #E0DFE2;
1201
+ margin: 0 auto;
1202
+ display: block;
1203
+ padding: 0px 26px !important
1204
+ }
1205
+ .pay-main-box .pay-header {
1206
+ display: flex;
1207
+ justify-content: center;
1208
+ align-items: center;
1209
+ text-align: center;
1210
+ }
1211
+
1212
+ .pay-main-box .pay-header button {
1213
+ border: 0;
1214
+ background: none;
1215
+ padding: 0;
1216
+ box-shadow: 0;
1217
+ outline: inherit;
1218
+ }
1219
+
1220
+ .pay-main-box h1 {
1221
+ margin: 0;
1222
+ flex: 1;
1223
+ padding: 10px 0;
1224
+ font-size: 23px;
1225
+ font-weight: 500;
1226
+ color: #35254D;
1227
+ align-items: start;
1228
+ display: flex;
1229
+ }
1230
+ .tab {
1231
+ overflow: hidden;
1232
+ background-color: #E0DFE2;
1233
+ padding: 5px;
1234
+ border-radius: 8px;
1235
+ display: flex;
1236
+ justify-content: space-around;
1237
+ }
1238
+
1239
+ /* Style the buttons inside the tab */
1240
+ .tab button {
1241
+ float: left;
1242
+ border: none;
1243
+ outline: none;
1244
+ cursor: pointer;
1245
+ padding: 11px 16px;
1246
+ transition: 0.3s;
1247
+ font-size: 16px;
1248
+ width: 100%;
1249
+ border-radius: 5px;
1250
+ box-shadow: inherit;
1251
+ outline: none;
1252
+ color: ${primarycolor};
1253
+ }
1254
+
1255
+ /* Change background color of buttons on hover */
1256
+ .tab button:hover {
1257
+ background-color: #ddd;
1258
+ }
1259
+
1260
+ /* Create an active/current tablink class */
1261
+ .tab button.active {
1262
+ background-color: #ccc;
1263
+ }
1264
+
1265
+ /* Style the tab content */
1266
+ .tabcontent {
1267
+ padding: 8px 0;
1268
+ }
1269
+
1270
+ .pay-container{
1271
+ display: grid;
1272
+ grid-template-columns: 2fr 3fr;
1273
+ padding: 50px 10% 20px ;
1274
+ }
1275
+ .pay-conatiner-one{
1276
+ border-right: 1px solid #E0DFE2;
1277
+ }
1278
+ .pay-conatiner-two{
1279
+ padding: 0 10% 20px;
1280
+ }
1281
+ .pay-logo-container{
1282
+ border-bottom: 1px solid #E0DFE2
1283
+ }
1284
+ .pay-heading{
1285
+ margin: 0;
1286
+ flex: 1;
1287
+ padding: 10px 0;
1288
+ font-size: 23px;
1289
+ font-weight: 500;
1290
+ color: #35254D;
1291
+ align-items: start;
1292
+ display: flex;
1293
+ }
1294
+ .pay-main-logo > img{
1295
+ width: 50%;
1296
+ }
1297
+ .pay-payment-amount{
1298
+ display: block;
1299
+ font-size: 12px;
1300
+ color: #727272;
1301
+ margin-bottom: 8px;
1302
+ }
1303
+ .pay-amount-conatiner{
1304
+ margin-top: 6%;
1305
+ }
1306
+ .pay-amount{
1307
+ color: #000000;
1308
+ font-size: 38px;
1309
+ display: block;
1310
+ line-height: 110%;
1311
+ letter-spacing: -1px;
1312
+ }
1313
+ label{
1314
+ font-family: 'IBM Plex Mono', monospace;
1315
+ color: #727272;
1316
+ margin-bottom: 2px;
1317
+ font-weight: 600;
1318
+ font-size: 12px;
1319
+ display:inline-block
1320
+ }
1321
+ .form-control{
1322
+ display: block;
1323
+ width: 100%;
1324
+ padding: .375rem .75rem;
1325
+ font-size: 1rem;
1326
+ font-weight: 400;
1327
+ line-height: 1.5;
1328
+ color: ${primarybodycolor};
1329
+ -webkit-appearance: none;
1330
+ -moz-appearance: none;
1331
+ appearance: none;
1332
+ background-color: ${primarybgcolor};
1333
+ background-clip: padding-box;
1334
+ border: 1px solid ${primarybordercolor};
1335
+ border-radius: 0.375rem;
1336
+ transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
1337
+ }
1338
+ .form-control:focus{
1339
+ border-color: #86b7fe;
1340
+ outline: 0;
1341
+ }
1342
+ .toggle-num-wrapper {
1343
+ position: relative;
1344
+ }
1345
+ .card-number-new{
1346
+ border-bottom: none;
1347
+ border-bottom-left-radius: 0px;
1348
+ border-bottom-right-radius: 0px;
1349
+ }
1350
+ .card-crdi {
1351
+ display: flex;
1352
+ border: 1px solid ${primarybordercolor};
1353
+ border-radius: 0.375rem;
1354
+ }
1355
+ .card-expiry-new{
1356
+ border-top-left-radius: 0px;
1357
+ border-top-right-radius: 0px;
1358
+ }
1359
+ .exp-date-year-container{
1360
+ display: flex;
1361
+ flex-wrap: wrap;
1362
+ }
1363
+ .exp-date-year-container .form-group{
1364
+ flex:1;
1365
+
1366
+ }
1367
+
1368
+ .exp-date {
1369
+ float: left;
1370
+ // width: 30%
1371
+ }
1372
+
1373
+ .exp-date input {
1374
+ width: calc(100% + 1px);
1375
+ border-top-right-radius: 0;
1376
+ border-bottom-right-radius: 0;
1377
+ border: 0;
1378
+ border-right: 1px solid ${primarybordercolor};
1379
+ }
1380
+
1381
+
1382
+ .exp-year {
1383
+ float: left;
1384
+ // width: 30%
1385
+ }
1386
+
1387
+ .exp-year input {
1388
+ width: calc(100% + 1px);
1389
+ border-radius: 0;
1390
+ border-top: 0;
1391
+ border-bottom: 0;
1392
+ border-right: 1px solid ${primarybordercolor};
1393
+ }
1394
+
1395
+ .exp-date input:focus {
1396
+ position: relative;
1397
+ z-index: 10;
1398
+ }
1399
+
1400
+ .security-digit {
1401
+ float: right;
1402
+ // width: 40%;
1403
+ position: relative;
1404
+ }
1405
+
1406
+ .security-digit input {
1407
+ border-top-left-radius: 0;
1408
+ border-bottom-left-radius: 0;
1409
+ border-top: 0;
1410
+ border-bottom: 0;
1411
+ border-right:0;
1412
+ }
1413
+ .card-expiry-new{
1414
+ border-top-left-radius: 0px;
1415
+ border-top-right-radius: 0px;
1416
+ }
1417
+ .form-control{box-sizing: border-box ;}
1418
+ #PaymentForm .form-group{
1419
+ padding:5px 0
1420
+ }
1421
+
1422
+ .toggle-label {
1423
+ position: relative;
1424
+ display: inline-block;
1425
+ width: 40px;
1426
+ height: 24px;
1427
+ background-color: #ccc;
1428
+ border-radius: 12px;
1429
+ cursor: pointer;
1430
+ transition: background-color 0.3s;
1431
+ }
1432
+
1433
+ .toggle-label::before {
1434
+ content: "";
1435
+ position: absolute;
1436
+ top: 2px;
1437
+ left: 2px;
1438
+ width: 20px;
1439
+ height: 20px;
1440
+ background: #ffffff;
1441
+ border-radius: 50%;
1442
+ transition: left 300ms linear;
1443
+ }
1444
+
1445
+ .toggle-checkbox {
1446
+ display: none;
1447
+ }
1448
+
1449
+ .toggle-checkbox:checked + .toggle-label {
1450
+ background-color: #4caf50;
1451
+ }
1452
+
1453
+ .toggle-checkbox:checked + .toggle-label::before {
1454
+ left: 18px;
1455
+ }
1456
+ .ach-scrl {
1457
+ max-height: 379px;
1458
+ overflow-y: auto;
1459
+ padding-right: 6px;
1460
+ }
1461
+ .mb-4{
1462
+ margin-bottom:4px
1463
+ }
1464
+ .ach-scrl::-webkit-scrollbar {
1465
+ width: 3px;
1466
+ background-color: #F5F5F5;
1467
+ }
1468
+ .ach-scrl::-webkit-scrollbar-thumb {
1469
+ background-color: #35254D;
1470
+ }
1471
+
1472
+ .error-span{
1473
+ color:red;
1474
+ font-size:12px
1475
+ }
1476
+
1477
+
1478
+
1479
+ @media (max-width: 768px) {
1480
+ .pay-container {
1481
+ grid-template-columns: 1fr;
1482
+ padding: 20px 5%;
1483
+ }
1484
+ }
1485
+
1486
+
1487
+
1488
+ `);
1489
+ }
1490
+
1491
+ // src/app/components/Charge/GetPaymentPage.tsx
1492
+ function GetPaymentPage({}) {
1493
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1494
+ const [show, setShow] = useState3(false);
1495
+ const [activetab, setActive] = useState3("card");
1496
+ const [saveCardInfo, setSaveCardInfo] = useState3(false);
1497
+ const [saveACHinfo, setSaveACHinfo] = useState3(false);
1498
+ const [cardData, setCardData] = useState3();
1499
+ const [cardError, setCardError] = useState3({});
1500
+ const [achData, setAchData] = useState3();
1501
+ const [achError, setAchError] = useState3({});
1502
+ const handleClose = () => {
1503
+ setShow(false);
1504
+ };
1505
+ const handleShow = () => setShow(true);
1506
+ const handletabchange = (id) => {
1507
+ setActive(id);
1508
+ };
1509
+ const handleCardChange = (e) => {
1510
+ const { name, value } = e.target;
1511
+ const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
1512
+ if (numericFields.includes(name)) {
1513
+ if (value === "" || /^[0-9]+$/.test(value)) {
1514
+ setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
1515
+ [name]: ""
1516
+ }));
1517
+ setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
1518
+ [name]: value
1519
+ }));
1520
+ }
1521
+ return;
1522
+ }
1523
+ setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
1524
+ [name]: ""
1525
+ }));
1526
+ console.log(value, name);
1527
+ setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
1528
+ [name]: value
1529
+ }));
1530
+ };
1531
+ const handleCardNumberChange = (e) => {
1532
+ const input = e.target;
1533
+ const rawValue = input.value.replace(/\D/g, "");
1534
+ let formatted = "";
1535
+ if (/^3[47]/.test(rawValue)) {
1536
+ const trimmed = rawValue.slice(0, 15);
1537
+ formatted = trimmed.replace(
1538
+ /^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,
1539
+ (_, g1, g2, g3) => [g1, g2, g3].filter(Boolean).join(" ")
1540
+ );
1541
+ } else {
1542
+ const trimmed = rawValue.slice(0, 16);
1543
+ formatted = trimmed.replace(
1544
+ /^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,
1545
+ (_, g1, g2, g3, g4) => [g1, g2, g3, g4].filter(Boolean).join(" ")
1546
+ );
1547
+ }
1548
+ setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
1549
+ cardNumber: ""
1550
+ }));
1551
+ setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
1552
+ cardNumber: formatted
1553
+ }));
1554
+ };
1555
+ const handleChangeAch = (e) => {
1556
+ const { name, value } = e.target;
1557
+ const numericFields = ["routingNumber", "accountNumber", "confirmAccountNumber"];
1558
+ if (numericFields.includes(name)) {
1559
+ if (value === "" || /^[0-9]+$/.test(value)) {
1560
+ setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
1561
+ [name]: ""
1562
+ }));
1563
+ setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
1564
+ [name]: value
1565
+ }));
1566
+ }
1567
+ return;
1568
+ }
1569
+ setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
1570
+ [name]: ""
1571
+ }));
1572
+ console.log(value, name);
1573
+ setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
1574
+ [name]: value
1575
+ }));
1576
+ };
1577
+ const validateCardData = () => {
1578
+ var _a2, _b2, _c2, _d2, _e2, _f2;
1579
+ const errors = {};
1580
+ const data = cardData;
1581
+ const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
1582
+ const year = (data == null ? void 0 : data.expiryYear) || "";
1583
+ if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
1584
+ if (!((_b2 = data == null ? void 0 : data.cardNumber) == null ? void 0 : _b2.trim())) errors.cardNumber = "Card number is required";
1585
+ if (!((_c2 = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _c2.trim()) || !((_d2 = data == null ? void 0 : data.expiryYear) == null ? void 0 : _d2.trim())) {
1586
+ errors.expiryMonth = "Invalid Expiration Date.";
1587
+ } else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
1588
+ errors.expiryMonth = "Invalid Expiration Date.";
1589
+ }
1590
+ if (!((_e2 = data == null ? void 0 : data.cvv) == null ? void 0 : _e2.trim())) errors.cvv = "CVV is required";
1591
+ if (!((_f2 = data == null ? void 0 : data.zipCode) == null ? void 0 : _f2.trim())) errors.zipCode = "ZIP code is required";
1592
+ if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
1593
+ const month2 = parseInt(data.expiryMonth, 10);
1594
+ const year2 = parseInt(data.expiryYear, 10);
1595
+ const now = /* @__PURE__ */ new Date();
1596
+ const currentMonth = now.getMonth() + 1;
1597
+ const currentYear = now.getFullYear();
1598
+ if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
1599
+ errors.expiryMonth = "Card is expired";
1600
+ }
1601
+ }
1602
+ setCardError(errors);
1603
+ console.log(errors);
1604
+ return Object.keys(errors).length > 0;
1605
+ };
1606
+ const validateAchData = () => {
1607
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
1608
+ const errors = {};
1609
+ const data = achData;
1610
+ if (!((_a2 = data == null ? void 0 : data.name) == null ? void 0 : _a2.trim())) errors.name = "Name is required";
1611
+ if (!((_b2 = data == null ? void 0 : data.accountNumber) == null ? void 0 : _b2.trim())) errors.accountNumber = "account number is required";
1612
+ if (((_c2 = data == null ? void 0 : data.accountNumber) == null ? void 0 : _c2.trim()) && ((_d2 = data == null ? void 0 : data.accountNumber) == null ? void 0 : _d2.trim()) !== ((_e2 = data == null ? void 0 : data.confirmAccountNumber) == null ? void 0 : _e2.trim())) errors.confirmAccountNumber = "Account numbers must match";
1613
+ if (!((_f2 = data == null ? void 0 : data.bankName) == null ? void 0 : _f2.trim())) errors.bankName = "Bank name is required";
1614
+ if (!((_g2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _g2.trim())) errors.routingNumber = "Routing Number is required";
1615
+ if ((data == null ? void 0 : data.routingNumber) && ((_h2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _h2.length) !== 9) errors.routingNumber = "Routing number must be 9 digits";
1616
+ if ((data == null ? void 0 : data.routingNumber.length) == 9) {
1617
+ let routingNumber = data == null ? void 0 : data.routingNumber;
1618
+ const weights = [3, 7, 1];
1619
+ let sum = 0;
1620
+ for (let i = 0; i < routingNumber.length; i++) {
1621
+ sum += parseInt(routingNumber[i], 10) * weights[i % 3];
1622
+ }
1623
+ if (sum % 10 !== 0) {
1624
+ errors.routingNumber = "Invalid routing number";
1625
+ }
1626
+ }
1627
+ setAchError(errors);
1628
+ console.log(errors);
1629
+ return Object.keys(errors).length > 0;
1630
+ };
1631
+ const submitFunc = (e) => {
1632
+ e.preventDefault();
1633
+ if (activetab !== "ach") {
1634
+ const hasError = validateCardData();
1635
+ if (hasError) return;
1636
+ else {
1637
+ let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
1638
+ let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
1639
+ let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
1640
+ console.log(cardData, validCard, validExpirationDate, validCVV);
1641
+ let errors = {};
1642
+ if (!validCard) errors.cardNumber = "Invalid card Number";
1643
+ if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
1644
+ if (!validCVV) errors.cvv = "Invalid CVV";
1645
+ setCardError(errors);
1646
+ }
1647
+ } else {
1648
+ console.log(achData);
1649
+ const hasError = validateAchData();
1650
+ if (hasError) return;
1651
+ else {
1652
+ console.log(achData);
1653
+ }
1654
+ }
1655
+ };
1656
+ return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(Chargewidgetstyles, null), /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
1657
+ "button",
1658
+ {
1659
+ className: "paymentBtn",
1660
+ onClick: handleShow
1661
+ },
1662
+ "Pay"
1663
+ ), /* @__PURE__ */ React9.createElement(
1664
+ CustomModal2_default,
1665
+ {
1666
+ open: show,
1667
+ onClose: handleClose
1668
+ },
1669
+ /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement("div", { className: "pay-container" }, /* @__PURE__ */ React9.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React9.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React9.createElement("g", { "clip-path": "url(#clip0_12425_52336)" }, /* @__PURE__ */ React9.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" })), /* @__PURE__ */ React9.createElement("defs", null, /* @__PURE__ */ React9.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React9.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React9.createElement("div", { className: "pay-header pay-conatiner-one" }, /* @__PURE__ */ React9.createElement("div", { className: "pay-logo-container" }, /* @__PURE__ */ React9.createElement("div", { className: "pay-main-logo" }, /* @__PURE__ */ React9.createElement("img", { src: "https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/uploaded/merchant_logo/20250311131124_merchant_logo.png", id: "pay-logos" })), /* @__PURE__ */ React9.createElement("h1", { className: "pay-heading" }, "Pay")), /* @__PURE__ */ React9.createElement("div", { className: "pay-amount-conatiner" }, /* @__PURE__ */ React9.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React9.createElement("strong", { className: "pay-amount" }, "$1.35")), activetab == "card" && /* @__PURE__ */ React9.createElement("div", { style: { display: "flex", gap: "8px", margin: "8px 0" } }, /* @__PURE__ */ React9.createElement("img", { src: "/assests/visa.svg", alt: "", width: 33 }), /* @__PURE__ */ React9.createElement("img", { src: "/assests/mastercard.svg", width: 33, alt: "" }), /* @__PURE__ */ React9.createElement("img", { src: "/assests/amex.svg", alt: "", width: 33 }), /* @__PURE__ */ React9.createElement("img", { src: "/assests/discover.svg", width: 33, alt: "" }))), /* @__PURE__ */ React9.createElement("div", { className: "pay-tab pay-conatiner-two" }, /* @__PURE__ */ React9.createElement("div", { className: "col-md-12" }, /* @__PURE__ */ React9.createElement("div", { id: "payment-form-div" }, /* @__PURE__ */ React9.createElement("div", { className: "tab" }, /* @__PURE__ */ React9.createElement("button", { className: "tablinks", onClick: (e) => {
1670
+ handletabchange("card");
1671
+ }, style: { backgroundColor: activetab === "card" ? "#fff" : "inherit" } }, "Card"), /* @__PURE__ */ React9.createElement("button", { className: "tablinks", onClick: (e) => {
1672
+ handletabchange("ach");
1673
+ }, style: { backgroundColor: activetab === "ach" ? "#fff" : "inherit" } }, "ACH")), /* @__PURE__ */ React9.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React9.createElement("form", { id: "PaymentForm", onSubmit: submitFunc }, /* @__PURE__ */ React9.createElement("div", { className: "form-group" }, /* @__PURE__ */ React9.createElement("label", { htmlFor: "nameoncard" }, "Name on Card"), /* @__PURE__ */ React9.createElement("input", { type: "text", id: "nameoncard", className: "form-control", maxLength: 100, placeholder: "John Doe", name: "cardName", value: cardData == null ? void 0 : cardData.cardName, onChange: handleCardChange }), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ React9.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ React9.createElement("div", { className: "form-group" }, /* @__PURE__ */ React9.createElement("label", { htmlFor: "card_number" }, "Card Number"), /* @__PURE__ */ React9.createElement("div", { className: "toggle-num-wrapper" }, /* @__PURE__ */ React9.createElement(
1674
+ "input",
1675
+ {
1676
+ className: "form-control card-number-new",
1677
+ type: "text",
1678
+ maxLength: 19,
1679
+ inputMode: "numeric",
1680
+ placeholder: "0000 0000 0000 0000",
1681
+ name: "cardNumber",
1682
+ value: (cardData == null ? void 0 : cardData.cardNumber) || "",
1683
+ onChange: handleCardNumberChange
1684
+ }
1685
+ ), /* @__PURE__ */ React9.createElement("div", { className: "card-crdi card-expiry-new" }, /* @__PURE__ */ React9.createElement("div", { className: "exp-date-year-container" }, /* @__PURE__ */ React9.createElement("div", { className: "exp-date form-group" }, /* @__PURE__ */ React9.createElement(
1686
+ "input",
1687
+ {
1688
+ "data-token": "exp_month",
1689
+ className: "form-control required",
1690
+ type: "text",
1691
+ placeholder: "MM",
1692
+ maxLength: 2,
1693
+ name: "expiryMonth",
1694
+ value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
1695
+ onInput: handleCardChange
1696
+ }
1697
+ )), /* @__PURE__ */ React9.createElement("div", { className: "exp-year form-group" }, /* @__PURE__ */ React9.createElement(
1698
+ "input",
1699
+ {
1700
+ "data-token": "exp_year",
1701
+ className: "form-control required",
1702
+ type: "text",
1703
+ placeholder: "YYYY",
1704
+ maxLength: 4,
1705
+ name: "expiryYear",
1706
+ value: (cardData == null ? void 0 : cardData.expiryYear) || "",
1707
+ onChange: handleCardChange
1708
+ }
1709
+ )), /* @__PURE__ */ React9.createElement("div", { className: "security-digit form-group" }, /* @__PURE__ */ React9.createElement(
1710
+ "input",
1711
+ {
1712
+ "data-token": "cvv",
1713
+ className: "form-control required",
1714
+ type: "text",
1715
+ maxLength: 4,
1716
+ placeholder: "CVC",
1717
+ name: "cvv",
1718
+ value: (cardData == null ? void 0 : cardData.cvv) || "",
1719
+ onChange: handleCardChange
1720
+ }
1721
+ )))), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ React9.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardNumber), /* @__PURE__ */ React9.createElement("p", { style: { margin: "0" } }, (cardError == null ? void 0 : cardError.expiryMonth) || (cardError == null ? void 0 : cardError.expiryYear) ? /* @__PURE__ */ React9.createElement("span", { className: "error-span", style: { paddingRight: "4px" } }, cardError == null ? void 0 : cardError.expiryMonth) : "", (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ React9.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ React9.createElement("div", { className: "form-group" }, /* @__PURE__ */ React9.createElement("label", { htmlFor: "OrderId" }, "Order ID / Description"), /* @__PURE__ */ React9.createElement(
1722
+ "input",
1723
+ {
1724
+ type: "text",
1725
+ id: "OrderId",
1726
+ className: "form-control",
1727
+ maxLength: 100,
1728
+ placeholder: "OID123456",
1729
+ name: "orderId",
1730
+ disabled: true,
1731
+ value: (_a = cardData == null ? void 0 : cardData.orderId) != null ? _a : "OID123456",
1732
+ onChange: handleCardChange,
1733
+ style: { background: "#F6F6F7", color: "#727272" }
1734
+ }
1735
+ )), /* @__PURE__ */ React9.createElement("div", { className: "form-group" }, /* @__PURE__ */ React9.createElement("label", { htmlFor: "ZIPCode" }, "ZIP"), /* @__PURE__ */ React9.createElement("input", { type: "text", id: "ZIPCode", className: "form-control", maxLength: 100, placeholder: "000000", name: "zipCode", value: (_b = cardData == null ? void 0 : cardData.zipCode) != null ? _b : "", onChange: handleCardChange }), (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ React9.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.zipCode)), /* @__PURE__ */ React9.createElement("div", { className: "form-group" }, /* @__PURE__ */ React9.createElement("div", { style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" } }, /* @__PURE__ */ React9.createElement(
1736
+ "input",
1737
+ {
1738
+ type: "checkbox",
1739
+ id: "save_card",
1740
+ className: "toggle-checkbox",
1741
+ checked: saveCardInfo,
1742
+ onChange: (e) => setSaveCardInfo(e.target.checked)
1743
+ }
1744
+ ), /* @__PURE__ */ React9.createElement("label", { htmlFor: "save_card", className: "toggle-label" }), /* @__PURE__ */ React9.createElement("label", { htmlFor: "save_card" }, "Save card for future payments"))), /* @__PURE__ */ React9.createElement("div", { className: "form-group", style: { marginTop: "20px" } }, /* @__PURE__ */ React9.createElement("button", { type: "submit", className: "pay-button" }, "$1.35")))), /* @__PURE__ */ React9.createElement("div", { id: "ach", style: { display: activetab === "ach" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React9.createElement("form", { id: "ACHPaymentForm", onSubmit: submitFunc }, /* @__PURE__ */ React9.createElement("div", { className: "ach-scrl" }, /* @__PURE__ */ React9.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React9.createElement("label", { htmlFor: "nameonaccount" }, "Name on account"), /* @__PURE__ */ React9.createElement("input", { type: "text", id: "nameonaccount", className: "form-control", maxLength: 100, placeholder: "John Doe", name: "name", value: (_c = achData == null ? void 0 : achData.name) != null ? _c : "", onChange: handleChangeAch }), (achError == null ? void 0 : achError.name) && /* @__PURE__ */ React9.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.name)), /* @__PURE__ */ React9.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React9.createElement("label", { htmlFor: "routingnumber" }, "Routing number"), /* @__PURE__ */ React9.createElement(
1745
+ "input",
1746
+ {
1747
+ type: "text",
1748
+ id: "routingnumber",
1749
+ className: "form-control",
1750
+ maxLength: 9,
1751
+ placeholder: "000000000",
1752
+ name: "routingNumber",
1753
+ value: (_d = achData == null ? void 0 : achData.routingNumber) != null ? _d : "",
1754
+ onChange: handleChangeAch
1755
+ }
1756
+ ), (achError == null ? void 0 : achError.routingNumber) && /* @__PURE__ */ React9.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.routingNumber)), /* @__PURE__ */ React9.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React9.createElement("label", { htmlFor: "accountnumber" }, "Account number"), /* @__PURE__ */ React9.createElement(
1757
+ "input",
1758
+ {
1759
+ type: "text",
1760
+ id: "accountnumber",
1761
+ className: "form-control",
1762
+ maxLength: 16,
1763
+ placeholder: "0000000000",
1764
+ name: "accountNumber",
1765
+ value: (_e = achData == null ? void 0 : achData.accountNumber) != null ? _e : "",
1766
+ onChange: handleChangeAch
1767
+ }
1768
+ ), (achError == null ? void 0 : achError.accountNumber) && /* @__PURE__ */ React9.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.accountNumber)), /* @__PURE__ */ React9.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React9.createElement("label", { htmlFor: "confirmaccountnumber" }, "Confirm account number"), /* @__PURE__ */ React9.createElement(
1769
+ "input",
1770
+ {
1771
+ type: "text",
1772
+ id: "confirmaccountnumber",
1773
+ className: "form-control",
1774
+ maxLength: 16,
1775
+ placeholder: "0000000000",
1776
+ name: "confirmAccountNumber",
1777
+ value: (_f = achData == null ? void 0 : achData.confirmAccountNumber) != null ? _f : "",
1778
+ onChange: handleChangeAch
1779
+ }
1780
+ ), (achError == null ? void 0 : achError.confirmAccountNumber) && /* @__PURE__ */ React9.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.confirmAccountNumber)), /* @__PURE__ */ React9.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React9.createElement("label", { htmlFor: "bankname" }, "Bank name"), /* @__PURE__ */ React9.createElement(
1781
+ "input",
1782
+ {
1783
+ type: "text",
1784
+ id: "bankname",
1785
+ className: "form-control",
1786
+ maxLength: 100,
1787
+ placeholder: "My Bank",
1788
+ name: "bankName",
1789
+ value: (_g = achData == null ? void 0 : achData.bankName) != null ? _g : "",
1790
+ onChange: handleChangeAch
1791
+ }
1792
+ ), (achError == null ? void 0 : achError.bankName) && /* @__PURE__ */ React9.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.bankName)), /* @__PURE__ */ React9.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React9.createElement("label", { htmlFor: "accounttype" }, "Select account type"), /* @__PURE__ */ React9.createElement("select", { name: "accounttype", id: "accounttype", className: "form-control", value: (_h = achData == null ? void 0 : achData.accountType) != null ? _h : "", onChange: handleChangeAch }, /* @__PURE__ */ React9.createElement("option", { value: "" }, "Select account"), /* @__PURE__ */ React9.createElement("option", { value: "Personal Saving" }, "Personal Saving"), /* @__PURE__ */ React9.createElement("option", { value: "Business Saving" }, "Business Saving"), /* @__PURE__ */ React9.createElement("option", { value: "Personal Checking" }, "Personal Checking"), /* @__PURE__ */ React9.createElement("option", { value: "Business Checking" }, "Business Checking"))), /* @__PURE__ */ React9.createElement("div", { className: "form-group mb-4", style: { paddingTop: "5px" } }, /* @__PURE__ */ React9.createElement("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }), /* @__PURE__ */ React9.createElement("label", { htmlFor: "saveACH" }, "Save ACH")), saveACHinfo && /* @__PURE__ */ React9.createElement("div", { className: "form-group mb-4", style: { fontSize: "12px", color: "#727272" } }, /* @__PURE__ */ React9.createElement("p", null, "If checked, I agree for ", /* @__PURE__ */ React9.createElement("b", null, "ecommerce"), " to have my permission to charge this credit card for agreed upon purchases in the future."))), /* @__PURE__ */ React9.createElement("div", { className: "form-group", style: { marginTop: "30px" } }, /* @__PURE__ */ React9.createElement("button", { className: "pay-button", type: "submit" }, "$1.35"))))))))))
1793
+ )));
1794
+ }
1125
1795
  export {
1796
+ GetPaymentPage,
1126
1797
  RequestPayment,
1127
1798
  RequestPreAuthPayment
1128
1799
  };