@pinerohit11/testwidget 0.1.71 → 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
@@ -179,48 +179,67 @@ var CustomModal2styles = (props) => {
179
179
  font-family: cursive;
180
180
  }
181
181
 
182
- .fractal-popup {
183
- position: fixed;
184
- z-index: 9999;
185
- top: 0;
186
- right: 0;
187
- bottom: 0;
188
- left: 0;
189
-
190
- width: 100%;
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
- }
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
+ }
198
211
 
199
212
  .fractal-popup-content {
213
+ margin:20px auto !important;
214
+ transform :none;
200
215
  background-color: white;
201
216
  padding:20px;
202
217
  border-radius: 0.5rem;
203
218
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
204
219
  box-sizing: border-box;
205
220
  position: relative;
221
+ // min-height : 585px;
222
+ max-width:810px;
223
+ width:90vw
224
+
206
225
  }
207
-
208
- @media only screen and (min-width: 600px){
209
- .fractal-popup-content {
210
- width: 500px;
211
-
212
- }
213
- }
214
- @media only screen and (max-width: 600px){
215
- .fractal-popup-content {
216
- width: 350px;
217
- }
218
- }
219
- @media only screen and (max-width: 450px){
220
- .fractal-popup-content {
221
- width: 300px;
222
- }
223
- }
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
+ // }
224
243
  .close-popup {
225
244
  max-height:25px;
226
245
  width:25px;
@@ -307,7 +326,7 @@ var CustomModal2styles = (props) => {
307
326
  outline: 0;
308
327
  height: 46px;
309
328
  font-size: 16px;
310
- background: #ddd;
329
+ background: #727272;
311
330
  border: none;
312
331
  display: block;
313
332
  color: #fff;
@@ -315,9 +334,11 @@ var CustomModal2styles = (props) => {
315
334
  border-radius: 180px;
316
335
  margin: 10px 0;
317
336
  text-decoration: none;
337
+ cursor:pointer,
338
+ font-family:
318
339
  }
319
340
 
320
- .pay-button:hover, .pay-button:focus {background: #333; color: #fff;}
341
+ .pay-button:hover, .pay-button:focus {background: #222; color: #fff; cursor:pointer}
321
342
 
322
343
  .fractal-powerd-by {
323
344
  display: flex;
@@ -656,6 +677,9 @@ var RequestPaymentstyles_default = RequestPaymentstyles;
656
677
  // src/app/components/RequestPayment/RequestPayment.tsx
657
678
  function RequestPayment(props) {
658
679
  const fractalpayClientKey = props.fractalpayClientKey;
680
+ const discount = props == null ? void 0 : props.discount;
681
+ const tax = props == null ? void 0 : props.tax;
682
+ const surcharge = props == null ? void 0 : props.surcharge;
659
683
  const [show, setShow] = useState(false);
660
684
  const [loading, setLoading] = useState(false);
661
685
  const [errors, setErrors] = useState({});
@@ -726,7 +750,10 @@ function RequestPayment(props) {
726
750
  action: "request",
727
751
  name: requestDetails.name,
728
752
  email: requestDetails.email,
729
- customer_id: (props == null ? void 0 : props.customerId) ? props == null ? void 0 : props.customerId : ""
753
+ customer_id: (props == null ? void 0 : props.customerId) ? props == null ? void 0 : props.customerId : "",
754
+ discount,
755
+ surcharge,
756
+ tax
730
757
  };
731
758
  let response = await axios.post(`${baseUrl}create-widget-order`, formData);
732
759
  if ((response == null ? void 0 : response.status) === 200) {
@@ -888,6 +915,9 @@ import axios2 from "axios";
888
915
  import { PatternFormat as PatternFormat2 } from "react-number-format";
889
916
  function RequestPreAuthPayment(props) {
890
917
  const fractalpayClientKey = props.fractalpayClientKey;
918
+ const discount = props == null ? void 0 : props.discount;
919
+ const tax = props == null ? void 0 : props.tax;
920
+ const surcharge = props == null ? void 0 : props.surcharge;
891
921
  const [show, setShow] = useState2(false);
892
922
  const [loading, setLoading] = useState2(false);
893
923
  const [errors, setErrors] = useState2({});
@@ -957,7 +987,10 @@ function RequestPreAuthPayment(props) {
957
987
  action: "request",
958
988
  name: requestDetails.name,
959
989
  email: requestDetails.email,
960
- customer_id: (props == null ? void 0 : props.customerId) ? props == null ? void 0 : props.customerId : ""
990
+ customer_id: (props == null ? void 0 : props.customerId) ? props == null ? void 0 : props.customerId : "",
991
+ discount,
992
+ surcharge,
993
+ tax
961
994
  };
962
995
  let response = await axios2.post(`${baseUrl}send-request-pre-auth-payment`, formData);
963
996
  if ((response == null ? void 0 : response.status) === 200) {
@@ -1111,7 +1144,656 @@ function RequestPreAuthPayment(props) {
1111
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"))))
1112
1145
  )));
1113
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
+ }
1114
1795
  export {
1796
+ GetPaymentPage,
1115
1797
  RequestPayment,
1116
1798
  RequestPreAuthPayment
1117
1799
  };