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