@pinerohit11/testwidget 0.1.64 → 0.1.66
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 +249 -260
- package/dist/index.mjs +249 -260
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -61,7 +61,7 @@ module.exports = __toCommonJS(index_exports);
|
|
61
61
|
|
62
62
|
// src/app/components/RequestPayment/RequestPayment.tsx
|
63
63
|
var import_bootstrap_bundle_min = require("bootstrap/dist/js/bootstrap.bundle.min.js");
|
64
|
-
var
|
64
|
+
var import_react6 = __toESM(require("react"));
|
65
65
|
|
66
66
|
// src/app/components/Loader/Loader.tsx
|
67
67
|
var import_react2 = __toESM(require("react"));
|
@@ -478,258 +478,15 @@ var CustomModal2_default = CustomModal2;
|
|
478
478
|
var import_axios = __toESM(require("axios"));
|
479
479
|
var import_react_number_format = require("react-number-format");
|
480
480
|
var import_styled_components = __toESM(require("styled-components"));
|
481
|
-
var Label = import_styled_components.default.label`
|
482
|
-
color: #727272;
|
483
|
-
font-family: Inter;
|
484
|
-
font-size: 12px;
|
485
|
-
font-style: normal;
|
486
|
-
font-weight: 500;
|
487
|
-
margin-bottom: 6px !important;
|
488
|
-
text-align: start !important;
|
489
|
-
width: 100% !important;
|
490
|
-
margin-bottom: 6px !important;
|
491
|
-
text-transform: uppercase;
|
492
|
-
`;
|
493
|
-
function RequestPayment(props) {
|
494
|
-
const fractalpayClientKey = props.fractalpayClientKey;
|
495
|
-
const [show, setShow] = (0, import_react5.useState)(false);
|
496
|
-
const [loading, setLoading] = (0, import_react5.useState)(false);
|
497
|
-
const [errors, setErrors] = (0, import_react5.useState)({});
|
498
|
-
const [phone, setPhone] = (0, import_react5.useState)(null);
|
499
|
-
const [requestDetails, setRequestDetails] = (0, import_react5.useState)({
|
500
|
-
email: "",
|
501
|
-
phone_number: "",
|
502
|
-
order_id: "",
|
503
|
-
name: "",
|
504
|
-
fractalpayPublicKey: fractalpayClientKey
|
505
|
-
});
|
506
|
-
const [amount, setAmount] = (0, import_react5.useState)("");
|
507
|
-
const [showConfirmationModal, setShowConfirmationModal] = (0, import_react5.useState)(false);
|
508
|
-
const [apiResponse, setApiResponse] = (0, import_react5.useState)(null);
|
509
|
-
const phoneNumberRegex = (value) => /^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(value);
|
510
|
-
const amoutRegex = /[+-]?([0-9]*[.])?[0-9]+/;
|
511
|
-
const isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
512
|
-
const isAlpha = (value) => /^[A-Za-z\s]*$/.test(value);
|
513
|
-
const handleClose = () => {
|
514
|
-
setShow(false);
|
515
|
-
setErrors({});
|
516
|
-
};
|
517
|
-
const handleShow = () => setShow(true);
|
518
|
-
const handleCloseConfirmationModal = () => {
|
519
|
-
console.log(apiResponse, "apiresponse");
|
520
|
-
handleSubmit(apiResponse);
|
521
|
-
setShowConfirmationModal(false);
|
522
|
-
};
|
523
|
-
function emptyFields() {
|
524
|
-
setRequestDetails({
|
525
|
-
email: "",
|
526
|
-
phone_number: "",
|
527
|
-
order_id: "",
|
528
|
-
name: "",
|
529
|
-
fractalpayPublicKey: fractalpayClientKey
|
530
|
-
});
|
531
|
-
setAmount("");
|
532
|
-
}
|
533
|
-
function handleSubmit(event) {
|
534
|
-
let message = {
|
535
|
-
type: "preview.compiledcheck",
|
536
|
-
other: __spreadProps(__spreadValues({}, event), { status: true })
|
537
|
-
};
|
538
|
-
window.parent.postMessage(message, "*");
|
539
|
-
}
|
540
|
-
const sendRequestPayment = async () => {
|
541
|
-
if (Object.keys(errors).length > 0) {
|
542
|
-
return;
|
543
|
-
}
|
544
|
-
setErrors({});
|
545
|
-
if (!(requestDetails == null ? void 0 : requestDetails.email) && phone && !phoneNumberRegex(phone)) {
|
546
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
547
|
-
phone: ErrorText.phonenumbervalid
|
548
|
-
}));
|
549
|
-
return;
|
550
|
-
}
|
551
|
-
if (!validateForm()) {
|
552
|
-
return;
|
553
|
-
}
|
554
|
-
try {
|
555
|
-
setLoading(true);
|
556
|
-
const formData = {
|
557
|
-
fractalpayPublicKey: fractalpayClientKey,
|
558
|
-
amount,
|
559
|
-
phone_number: phone,
|
560
|
-
order_id: requestDetails.order_id,
|
561
|
-
action: "request",
|
562
|
-
name: requestDetails.name,
|
563
|
-
email: requestDetails.email,
|
564
|
-
customer_id: (props == null ? void 0 : props.customerId) ? props == null ? void 0 : props.customerId : ""
|
565
|
-
};
|
566
|
-
let response = await import_axios.default.post(`${baseUrl}create-widget-order`, formData);
|
567
|
-
if ((response == null ? void 0 : response.status) === 200) {
|
568
|
-
setShowConfirmationModal(true);
|
569
|
-
setShow(false);
|
570
|
-
emptyFields();
|
571
|
-
setApiResponse(response == null ? void 0 : response.data);
|
572
|
-
}
|
573
|
-
setLoading(false);
|
574
|
-
} catch (error) {
|
575
|
-
console.log(error);
|
576
|
-
setLoading(false);
|
577
|
-
}
|
578
|
-
};
|
579
|
-
let favicon_logo = baseUrl + "images/logo-img.png";
|
580
|
-
const handleChange = (e) => {
|
581
|
-
const { value } = e.target;
|
582
|
-
const token = e.target.dataset.token;
|
583
|
-
setRequestDetails(__spreadProps(__spreadValues({}, requestDetails), { [token]: value }));
|
584
|
-
if (token === "name" && !isAlpha(value)) {
|
585
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
586
|
-
[token]: ErrorText.onlylettersallowed
|
587
|
-
}));
|
588
|
-
return;
|
589
|
-
}
|
590
|
-
let errorobj = errors;
|
591
|
-
if (token === "email" && !phone) {
|
592
|
-
delete errorobj.phone;
|
593
|
-
setErrors(errorobj);
|
594
|
-
}
|
595
|
-
if (value) {
|
596
|
-
delete errorobj[token];
|
597
|
-
setErrors(errorobj);
|
598
|
-
}
|
599
|
-
if (token === "email" && !value) {
|
600
|
-
delete errorobj[token];
|
601
|
-
setErrors(errorobj);
|
602
|
-
}
|
603
|
-
};
|
604
|
-
const handleAmountChange = (data) => {
|
605
|
-
const { value } = data;
|
606
|
-
if (Number(value) > 0) {
|
607
|
-
let errorobj = errors;
|
608
|
-
delete errorobj.amount;
|
609
|
-
setErrors(errorobj);
|
610
|
-
}
|
611
|
-
setAmount(value);
|
612
|
-
};
|
613
|
-
const validateForm = () => {
|
614
|
-
let newErrors = {};
|
615
|
-
if (!amount) newErrors.amount = ErrorText.amountrequired;
|
616
|
-
if (requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
617
|
-
if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.phone = ErrorText.phoneoremailrequired;
|
618
|
-
if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.phoneoremailrequired;
|
619
|
-
if (!phone && requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
620
|
-
if (props.from === "merchant" && !requestDetails.order_id) newErrors.order_id = ErrorText.orderidrequired;
|
621
|
-
setErrors(newErrors);
|
622
|
-
return Object.keys(newErrors).length === 0;
|
623
|
-
};
|
624
|
-
(0, import_react5.useEffect)(() => {
|
625
|
-
if (props) {
|
626
|
-
setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), {
|
627
|
-
order_id: props.orderID ? props.orderID : "",
|
628
|
-
name: (props == null ? void 0 : props.name) ? props == null ? void 0 : props.name : "",
|
629
|
-
email: (props == null ? void 0 : props.email) ? props == null ? void 0 : props.email : ""
|
630
|
-
}));
|
631
|
-
setAmount(props.amount ? props.amount : "");
|
632
|
-
setPhone(props.phone ? `${props.phone}` : null);
|
633
|
-
}
|
634
|
-
}, [props]);
|
635
|
-
const handlePhoneChange = (e) => {
|
636
|
-
let value = e == null ? void 0 : e.value;
|
637
|
-
if (value && (value == null ? void 0 : value.length) > 0 && (value == null ? void 0 : value.length) !== 10) {
|
638
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
639
|
-
phone: ErrorText.phonenumberlength
|
640
|
-
}));
|
641
|
-
setPhone(value);
|
642
|
-
return;
|
643
|
-
} else {
|
644
|
-
setPhone(value);
|
645
|
-
}
|
646
|
-
let errorobj = errors;
|
647
|
-
delete errorobj.phone;
|
648
|
-
if (value && !(requestDetails == null ? void 0 : requestDetails.email)) {
|
649
|
-
delete errorobj.email;
|
650
|
-
}
|
651
|
-
setErrors(errorobj);
|
652
|
-
};
|
653
|
-
function formatAmount(amount2) {
|
654
|
-
return new Intl.NumberFormat("en-US", {
|
655
|
-
style: "currency",
|
656
|
-
currency: "USD",
|
657
|
-
minimumFractionDigits: 2,
|
658
|
-
maximumFractionDigits: 2
|
659
|
-
}).format(Number(amount2));
|
660
|
-
}
|
661
|
-
return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement(Loader_default, { loading }), /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement("button", { className: "paymentBtn", onClick: handleShow }, "Request Payment"), /* @__PURE__ */ import_react5.default.createElement(
|
662
|
-
CustomModal2_default,
|
663
|
-
{
|
664
|
-
open: show,
|
665
|
-
onClose: () => setShow(false)
|
666
|
-
},
|
667
|
-
/* @__PURE__ */ import_react5.default.createElement("div", { className: "request-payment-amount-detail" }, /* @__PURE__ */ import_react5.default.createElement("p", { className: "request-payment-merchantname" }, "Pay ", props == null ? void 0 : props.webname), /* @__PURE__ */ import_react5.default.createElement("p", { className: "request-payment-amount" }, formatAmount(props == null ? void 0 : props.amount)), (props == null ? void 0 : props.from) === "merchant" && /* @__PURE__ */ import_react5.default.createElement("p", { className: "request-payment-orderid" }, requestDetails == null ? void 0 : requestDetails.order_id), /* @__PURE__ */ import_react5.default.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ import_react5.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ import_react5.default.createElement("g", { "clip-path": "url(#clip0_12425_52336)" }, /* @__PURE__ */ import_react5.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_react5.default.createElement("defs", null, /* @__PURE__ */ import_react5.default.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ import_react5.default.createElement("rect", { width: "16", height: "16", fill: "white" })))))),
|
668
|
-
/* @__PURE__ */ import_react5.default.createElement("form", { className: "request-payment-input-form" }, /* @__PURE__ */ import_react5.default.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ import_react5.default.createElement(Label, { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "FULL NAME"), /* @__PURE__ */ import_react5.default.createElement(
|
669
|
-
"input",
|
670
|
-
{
|
671
|
-
className: "request-payment-input-box",
|
672
|
-
type: "text",
|
673
|
-
placeholder: "Full Name",
|
674
|
-
"data-token": "name",
|
675
|
-
onChange: handleChange,
|
676
|
-
value: requestDetails == null ? void 0 : requestDetails.name
|
677
|
-
}
|
678
|
-
), errors.name && /* @__PURE__ */ import_react5.default.createElement("small", { className: "request-payment-error-msg" }, errors.name)), /* @__PURE__ */ import_react5.default.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ import_react5.default.createElement(Label, { htmlFor: "requestPhoneNumber", className: "request-payment-input-label" }, "Phone Number"), /* @__PURE__ */ import_react5.default.createElement(
|
679
|
-
import_react_number_format.PatternFormat,
|
680
|
-
{
|
681
|
-
className: "request-payment-input-box",
|
682
|
-
placeholder: "Mobile number",
|
683
|
-
format: "+1 (###) ###-####",
|
684
|
-
value: phone,
|
685
|
-
onValueChange: (e) => {
|
686
|
-
handlePhoneChange(e);
|
687
|
-
}
|
688
|
-
}
|
689
|
-
), errors.phone && /* @__PURE__ */ import_react5.default.createElement("small", { className: "request-payment-error-msg" }, errors.phone)), /* @__PURE__ */ import_react5.default.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ import_react5.default.createElement(Label, { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "EMAIL"), /* @__PURE__ */ import_react5.default.createElement(
|
690
|
-
"input",
|
691
|
-
{
|
692
|
-
className: "request-payment-input-box",
|
693
|
-
type: "text",
|
694
|
-
placeholder: "Email",
|
695
|
-
onChange: handleChange,
|
696
|
-
"data-token": "email",
|
697
|
-
value: requestDetails == null ? void 0 : requestDetails.email
|
698
|
-
}
|
699
|
-
), errors.email && /* @__PURE__ */ import_react5.default.createElement("small", { className: "request-payment-error-msg" }, errors.email)), /* @__PURE__ */ import_react5.default.createElement(
|
700
|
-
"button",
|
701
|
-
{
|
702
|
-
type: "button",
|
703
|
-
className: "request-payment-submit-button",
|
704
|
-
onClick: sendRequestPayment,
|
705
|
-
disabled: loading
|
706
|
-
},
|
707
|
-
loading ? "Loading..." : "Send Request"
|
708
|
-
), /* @__PURE__ */ import_react5.default.createElement("div", { className: "request-payment-fractal-powerd-by" }, /* @__PURE__ */ import_react5.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "17", height: "16", viewBox: "0 0 17 16", fill: "none" }, /* @__PURE__ */ import_react5.default.createElement("path", { d: "M15.2165 4.11839C15.1973 3.69746 15.1973 3.29567 15.1973 2.89387C15.1973 2.56861 14.9486 2.31988 14.6234 2.31988C12.2317 2.31988 10.4141 1.63109 8.90257 0.157848C8.67298 -0.0526158 8.32858 -0.0526158 8.09898 0.157848C6.58748 1.63109 4.76984 2.31988 2.37821 2.31988C2.05295 2.31988 1.80422 2.56861 1.80422 2.89387C1.80422 3.29567 1.80422 3.69746 1.78508 4.11839C1.70855 8.13632 1.59375 13.6466 8.30945 15.9617L8.50078 16L8.69211 15.9617C15.3887 13.6466 15.293 8.15546 15.2165 4.11839ZM8.04159 9.6861C7.92679 9.78176 7.79286 9.83916 7.63979 9.83916H7.62066C7.46759 9.83916 7.31453 9.76263 7.21887 9.64783L5.43949 7.67713L6.30048 6.91181L7.69719 8.46158L10.7967 5.5151L11.5812 6.35695L8.04159 9.6861Z", fill: "#727272" })), "Secure payments powered by ", /* @__PURE__ */ import_react5.default.createElement("span", null, "Fractal"), /* @__PURE__ */ import_react5.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18", fill: "none" }, /* @__PURE__ */ import_react5.default.createElement("path", { d: "M17.4999 5.49758V7.01156C17.4999 7.05924 17.4595 7.09898 17.411 7.09898H12.3516C12.9169 6.54266 13.4781 5.99032 14.0434 5.434C14.0596 5.4181 14.0838 5.41016 14.104 5.41016H17.411C17.4595 5.41016 17.4999 5.44989 17.4999 5.49758Z", fill: "#61C699" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M12.3462 10.9037V9.29836C12.3462 9.25067 12.3866 9.21094 12.435 9.21094H13.8523C13.929 9.21094 13.9694 9.30631 13.9129 9.35796C13.392 9.87455 12.8711 10.3911 12.3462 10.9037Z", fill: "#61C699" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M12.4404 9.00523H15.6949C15.7434 9.00523 15.7838 8.96549 15.7838 8.91781V7.40383C15.7838 7.35614 15.7434 7.31641 15.6949 7.31641H12.4404C12.3919 7.31641 12.3516 7.35614 12.3516 7.40383V8.91781C12.3516 8.96549 12.3919 9.00523 12.4404 9.00523Z", fill: "#61C699" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M10.1581 0.0120725L11.4906 0.77105C11.531 0.794892 11.5471 0.84655 11.5229 0.890261L8.99114 5.20173C8.78521 4.44275 8.57927 3.68775 8.37334 2.92877C8.36527 2.90493 8.3693 2.88109 8.38142 2.86122L10.0329 0.0438621C10.0612 0.000151419 10.1177 -0.0117697 10.1581 0.0120725Z", fill: "#61C699" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M12.3382 7.10006L10.9289 6.29737C10.8886 6.27353 10.8724 6.22187 10.8966 6.17816L11.6033 4.97015C11.6436 4.9026 11.7446 4.91452 11.7648 4.99002C11.9546 5.69734 12.1484 6.40068 12.3382 7.10006Z", fill: "#61C699" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M10.7107 6.0771L12.338 3.30345C12.3622 3.26372 12.346 3.20808 12.3057 3.18424L10.9732 2.42526C10.9328 2.40142 10.8763 2.41732 10.852 2.45705L9.22476 5.2307C9.20053 5.27044 9.21669 5.32607 9.25706 5.34991L10.5896 6.10889C10.634 6.13273 10.6865 6.11683 10.7107 6.0771Z", fill: "#61C699" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M1.66713 3.51237L2.99963 2.75339C3.04001 2.72955 3.09654 2.74544 3.12077 2.78518L5.65251 7.09665C4.88128 6.89399 4.11408 6.69133 3.34285 6.48867C3.31862 6.4847 3.30247 6.4688 3.29036 6.44893L1.63483 3.63158C1.6106 3.58787 1.62271 3.53621 1.66713 3.51237Z", fill: "#61C699" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M8.99793 5.20018L7.58871 5.99889C7.54833 6.02274 7.4918 6.00684 7.46757 5.9671L6.76095 4.76307C6.72057 4.69552 6.78517 4.61605 6.86189 4.63591C7.57256 4.82268 8.28726 5.00944 8.99793 5.20018Z", fill: "#61C699" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M7.27986 6.07054L5.6526 3.2969C5.62837 3.25716 5.57588 3.24127 5.53146 3.26511L4.19896 4.02409C4.15858 4.04793 4.14243 4.09959 4.16666 4.1433L5.79392 6.91694C5.81815 6.95668 5.87064 6.97257 5.91506 6.94873L7.24756 6.18975C7.28794 6.16591 7.30409 6.11425 7.27986 6.07054Z", fill: "#61C699" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M0.5 12.4998V10.9859C0.5 10.9382 0.540379 10.8984 0.588833 10.8984H5.64829C5.08299 11.4548 4.52172 12.0071 3.95642 12.5634C3.94027 12.5793 3.91604 12.5873 3.89585 12.5873H0.588833C0.540379 12.5873 0.5 12.5475 0.5 12.4998Z", fill: "#61C699" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M5.65129 7.09766V8.70303C5.65129 8.75072 5.61091 8.79045 5.56246 8.79045H4.14516C4.06844 8.79045 4.02806 8.69508 4.08459 8.64343C4.60548 8.12685 5.12637 7.61424 5.65129 7.09766Z", fill: "#61C699" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M5.55967 8.99609H2.30514C2.25669 8.99609 2.21631 9.03583 2.21631 9.08352V10.5975C2.21631 10.6452 2.25669 10.6849 2.30514 10.6849H5.55967C5.60813 10.6849 5.6485 10.6452 5.6485 10.5975V9.08352C5.6485 9.03583 5.60813 8.99609 5.55967 8.99609Z", fill: "#61C699" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M7.82638 17.9865L6.49388 17.2276C6.4535 17.2037 6.43735 17.1521 6.46158 17.1083L8.99333 12.7969C9.19926 13.5559 9.40519 14.3109 9.61112 15.0698C9.6192 15.0937 9.61516 15.1175 9.60305 15.1374L7.95155 17.9547C7.91925 17.9985 7.86676 18.0104 7.82638 17.9865Z", fill: "#61C699" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M5.64795 10.8984L7.05717 11.7011C7.09755 11.725 7.1137 11.7766 7.08947 11.8203L6.38284 13.0283C6.34246 13.0959 6.24152 13.084 6.22133 13.0085C6.02751 12.3012 5.83773 11.5978 5.64795 10.8984Z", fill: "#61C699" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M7.2739 11.9258L5.64664 14.6994C5.62241 14.7392 5.63856 14.7948 5.67894 14.8187L7.01144 15.5776C7.05182 15.6015 7.10835 15.5856 7.13258 15.5458L8.75984 12.7722C8.78407 12.7325 8.76792 12.6768 8.72754 12.653L7.39504 11.894C7.35062 11.8702 7.29813 11.8861 7.2739 11.9258Z", fill: "#61C699" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M16.3199 14.4866L14.9874 15.2456C14.947 15.2694 14.8904 15.2535 14.8662 15.2138L12.3345 10.9023C13.1057 11.105 13.8729 11.3077 14.6441 11.5103C14.6684 11.5143 14.6845 11.5302 14.6966 11.5501L16.3481 14.3674C16.3764 14.4111 16.3643 14.4628 16.3199 14.4866Z", fill: "#61C699" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M8.99121 12.7983L10.4004 11.9956C10.4408 11.9717 10.4973 11.9876 10.5216 12.0274L11.2282 13.2354C11.2686 13.3029 11.204 13.3824 11.1272 13.3625C10.4166 13.1758 9.70188 12.989 8.99121 12.7983Z", fill: "#61C699" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "M10.7077 11.9285L12.3349 14.7021C12.3592 14.7418 12.4117 14.7577 12.4561 14.7339L13.7886 13.9749C13.829 13.9511 13.8451 13.8994 13.8209 13.8557L12.1936 11.0821C12.1694 11.0423 12.1169 11.0264 12.0725 11.0503L10.74 11.8092C10.6996 11.8331 10.6834 11.8847 10.7077 11.9285Z", fill: "#61C699" }))))
|
709
|
-
), /* @__PURE__ */ import_react5.default.createElement(
|
710
|
-
CustomModal2_default,
|
711
|
-
{
|
712
|
-
open: showConfirmationModal,
|
713
|
-
onClose: handleCloseConfirmationModal
|
714
|
-
},
|
715
|
-
/* @__PURE__ */ import_react5.default.createElement("div", { className: "fractal-popup-content", style: { padding: "0px" } }, /* @__PURE__ */ import_react5.default.createElement("div", { className: "request-payment-success-container" }, /* @__PURE__ */ import_react5.default.createElement("span", { className: "request-payment-close-popup", onClick: handleCloseConfirmationModal }, /* @__PURE__ */ import_react5.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ import_react5.default.createElement("g", { "clip-path": "url(#clip0_12425_52336)" }, /* @__PURE__ */ import_react5.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_react5.default.createElement("defs", null, /* @__PURE__ */ import_react5.default.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ import_react5.default.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ import_react5.default.createElement("div", { className: "request-payment-success-tick-div" }, /* @__PURE__ */ import_react5.default.createElement("div", { className: "request-payment-success-tick" }, /* @__PURE__ */ import_react5.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ import_react5.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_react5.default.createElement("h6", { className: "request-payment-success-text" }, "The request ", /* @__PURE__ */ import_react5.default.createElement("br", null), "was sent"), /* @__PURE__ */ import_react5.default.createElement("h6", { className: "request-payment-success-subtext" }, "Please wait for the customer to pay"), /* @__PURE__ */ import_react5.default.createElement("div", { className: "request-payment-success-btn-div" }, /* @__PURE__ */ import_react5.default.createElement("button", { onClick: handleCloseConfirmationModal, className: "request-payment-success-btn2" }, "Close"))))
|
716
|
-
)));
|
717
|
-
}
|
718
|
-
|
719
|
-
// src/app/components/RequestPayment/RequestPaymentAllInput.tsx
|
720
|
-
var import_react7 = __toESM(require("react"));
|
721
|
-
var import_react_bootstrap = require("react-bootstrap");
|
722
|
-
var import_react_toastify = require("react-toastify");
|
723
|
-
var import_ReactToastify = require("react-toastify/dist/ReactToastify.css");
|
724
481
|
|
725
482
|
// src/app/components/RequestPayment/RequestPaymentstyles.tsx
|
726
|
-
var
|
483
|
+
var import_react5 = __toESM(require("react"));
|
727
484
|
var RequestPaymentstyles = (props) => {
|
728
|
-
return /* @__PURE__ */
|
485
|
+
return /* @__PURE__ */ import_react5.default.createElement("style", null, `
|
729
486
|
body {
|
730
|
-
font-family: 'Inter', sans-serif;
|
487
|
+
font-family: 'Inter', sans-serif !important;
|
731
488
|
}
|
732
|
-
|
489
|
+
|
733
490
|
.paymentBtn {
|
734
491
|
background-color: black;
|
735
492
|
border: none;
|
@@ -749,7 +506,6 @@ var RequestPaymentstyles = (props) => {
|
|
749
506
|
.request-payment-amount {
|
750
507
|
color: #161616;
|
751
508
|
text-align: center;
|
752
|
-
font-family: Inter;
|
753
509
|
font-size: 42px;
|
754
510
|
font-style: normal;
|
755
511
|
font-weight: 600;
|
@@ -760,7 +516,6 @@ var RequestPaymentstyles = (props) => {
|
|
760
516
|
.request-payment-orderid {
|
761
517
|
color: #727272;
|
762
518
|
text-align: center;
|
763
|
-
font-family: Inter;
|
764
519
|
font-size: 14px;
|
765
520
|
font-style: normal;
|
766
521
|
font-weight: 500;
|
@@ -770,7 +525,6 @@ var RequestPaymentstyles = (props) => {
|
|
770
525
|
.request-payment-pre-auth-merchantname {
|
771
526
|
color: #727272;
|
772
527
|
text-align: center;
|
773
|
-
font-family: Inter;
|
774
528
|
font-size: 14px;
|
775
529
|
font-style: normal;
|
776
530
|
font-weight: 500;
|
@@ -781,7 +535,6 @@ var RequestPaymentstyles = (props) => {
|
|
781
535
|
.request-payment-merchantname {
|
782
536
|
color: #727272;
|
783
537
|
text-align: center;
|
784
|
-
font-family: Inter;
|
785
538
|
font-size: 14px;
|
786
539
|
font-style: normal;
|
787
540
|
font-weight: 500;
|
@@ -812,7 +565,6 @@ var RequestPaymentstyles = (props) => {
|
|
812
565
|
|
813
566
|
.request-payment-input-label {
|
814
567
|
color: #727272;
|
815
|
-
font-family: Inter;
|
816
568
|
font-size: 12px;
|
817
569
|
font-style: normal;
|
818
570
|
font-weight: 500;
|
@@ -831,7 +583,6 @@ var RequestPaymentstyles = (props) => {
|
|
831
583
|
width: 100%;
|
832
584
|
color: #161616;
|
833
585
|
margin-top: 6px !important;
|
834
|
-
font-family: Inter;
|
835
586
|
font-size: 14px;
|
836
587
|
font-style: normal;
|
837
588
|
font-weight: 500;
|
@@ -850,7 +601,6 @@ var RequestPaymentstyles = (props) => {
|
|
850
601
|
color: #fff;
|
851
602
|
width: 100% !important;
|
852
603
|
border: none !important;
|
853
|
-
font-family: Inter;
|
854
604
|
font-size: 16px;
|
855
605
|
font-style: normal;
|
856
606
|
font-weight: 500;
|
@@ -863,7 +613,6 @@ var RequestPaymentstyles = (props) => {
|
|
863
613
|
|
864
614
|
.request-payment-fractal-powerd-by {
|
865
615
|
color: #727272;
|
866
|
-
font-family: Inter;
|
867
616
|
font-size: 14px;
|
868
617
|
font-style: normal;
|
869
618
|
font-weight: 500;
|
@@ -900,7 +649,6 @@ var RequestPaymentstyles = (props) => {
|
|
900
649
|
.request-payment-success-text {
|
901
650
|
color: #161616;
|
902
651
|
text-align: center;
|
903
|
-
font-family: Inter;
|
904
652
|
font-size: 32px;
|
905
653
|
font-style: normal;
|
906
654
|
font-weight: 500;
|
@@ -914,7 +662,6 @@ var RequestPaymentstyles = (props) => {
|
|
914
662
|
.request-payment-success-subtext {
|
915
663
|
color: #727272;
|
916
664
|
text-align: center;
|
917
|
-
font-family: Inter;
|
918
665
|
font-size: 14px;
|
919
666
|
font-style: normal;
|
920
667
|
font-weight: 500;
|
@@ -961,7 +708,6 @@ var RequestPaymentstyles = (props) => {
|
|
961
708
|
gap: 6px;
|
962
709
|
background-color: #161616;
|
963
710
|
color: #fff;
|
964
|
-
font-family: Inter;
|
965
711
|
font-size: 14px;
|
966
712
|
font-style: normal;
|
967
713
|
font-weight: 500;
|
@@ -969,14 +715,257 @@ var RequestPaymentstyles = (props) => {
|
|
969
715
|
|
970
716
|
.request-payment-error-msg{
|
971
717
|
color: #dc3545;
|
972
|
-
|
718
|
+
|
973
719
|
font-size: 12px;
|
974
720
|
}
|
975
721
|
`);
|
976
722
|
};
|
977
723
|
var RequestPaymentstyles_default = RequestPaymentstyles;
|
978
724
|
|
725
|
+
// src/app/components/RequestPayment/RequestPayment.tsx
|
726
|
+
var Label = import_styled_components.default.label`
|
727
|
+
color: #727272;
|
728
|
+
font-family: Inter;
|
729
|
+
font-size: 12px;
|
730
|
+
font-style: normal;
|
731
|
+
font-weight: 500;
|
732
|
+
margin-bottom: 6px !important;
|
733
|
+
text-align: start !important;
|
734
|
+
width: 100% !important;
|
735
|
+
margin-bottom: 6px !important;
|
736
|
+
text-transform: uppercase;
|
737
|
+
`;
|
738
|
+
function RequestPayment(props) {
|
739
|
+
const fractalpayClientKey = props.fractalpayClientKey;
|
740
|
+
const [show, setShow] = (0, import_react6.useState)(false);
|
741
|
+
const [loading, setLoading] = (0, import_react6.useState)(false);
|
742
|
+
const [errors, setErrors] = (0, import_react6.useState)({});
|
743
|
+
const [phone, setPhone] = (0, import_react6.useState)(null);
|
744
|
+
const [requestDetails, setRequestDetails] = (0, import_react6.useState)({
|
745
|
+
email: "",
|
746
|
+
phone_number: "",
|
747
|
+
order_id: "",
|
748
|
+
name: "",
|
749
|
+
fractalpayPublicKey: fractalpayClientKey
|
750
|
+
});
|
751
|
+
const [amount, setAmount] = (0, import_react6.useState)("");
|
752
|
+
const [showConfirmationModal, setShowConfirmationModal] = (0, import_react6.useState)(false);
|
753
|
+
const [apiResponse, setApiResponse] = (0, import_react6.useState)(null);
|
754
|
+
const phoneNumberRegex = (value) => /^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(value);
|
755
|
+
const amoutRegex = /[+-]?([0-9]*[.])?[0-9]+/;
|
756
|
+
const isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
757
|
+
const isAlpha = (value) => /^[A-Za-z\s]*$/.test(value);
|
758
|
+
const handleClose = () => {
|
759
|
+
setShow(false);
|
760
|
+
setErrors({});
|
761
|
+
};
|
762
|
+
const handleShow = () => setShow(true);
|
763
|
+
const handleCloseConfirmationModal = () => {
|
764
|
+
console.log(apiResponse, "apiresponse");
|
765
|
+
handleSubmit(apiResponse);
|
766
|
+
setShowConfirmationModal(false);
|
767
|
+
};
|
768
|
+
function emptyFields() {
|
769
|
+
setRequestDetails({
|
770
|
+
email: "",
|
771
|
+
phone_number: "",
|
772
|
+
order_id: "",
|
773
|
+
name: "",
|
774
|
+
fractalpayPublicKey: fractalpayClientKey
|
775
|
+
});
|
776
|
+
setAmount("");
|
777
|
+
}
|
778
|
+
function handleSubmit(event) {
|
779
|
+
let message = {
|
780
|
+
type: "preview.compiledcheck",
|
781
|
+
other: __spreadProps(__spreadValues({}, event), { status: true })
|
782
|
+
};
|
783
|
+
window.parent.postMessage(message, "*");
|
784
|
+
}
|
785
|
+
const sendRequestPayment = async () => {
|
786
|
+
if (Object.keys(errors).length > 0) {
|
787
|
+
return;
|
788
|
+
}
|
789
|
+
setErrors({});
|
790
|
+
if (!(requestDetails == null ? void 0 : requestDetails.email) && phone && !phoneNumberRegex(phone)) {
|
791
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
792
|
+
phone: ErrorText.phonenumbervalid
|
793
|
+
}));
|
794
|
+
return;
|
795
|
+
}
|
796
|
+
if (!validateForm()) {
|
797
|
+
return;
|
798
|
+
}
|
799
|
+
try {
|
800
|
+
setLoading(true);
|
801
|
+
const formData = {
|
802
|
+
fractalpayPublicKey: fractalpayClientKey,
|
803
|
+
amount,
|
804
|
+
phone_number: phone,
|
805
|
+
order_id: requestDetails.order_id,
|
806
|
+
action: "request",
|
807
|
+
name: requestDetails.name,
|
808
|
+
email: requestDetails.email,
|
809
|
+
customer_id: (props == null ? void 0 : props.customerId) ? props == null ? void 0 : props.customerId : ""
|
810
|
+
};
|
811
|
+
let response = await import_axios.default.post(`${baseUrl}create-widget-order`, formData);
|
812
|
+
if ((response == null ? void 0 : response.status) === 200) {
|
813
|
+
setShowConfirmationModal(true);
|
814
|
+
setShow(false);
|
815
|
+
emptyFields();
|
816
|
+
setApiResponse(response == null ? void 0 : response.data);
|
817
|
+
}
|
818
|
+
setLoading(false);
|
819
|
+
} catch (error) {
|
820
|
+
console.log(error);
|
821
|
+
setLoading(false);
|
822
|
+
}
|
823
|
+
};
|
824
|
+
let favicon_logo = baseUrl + "images/logo-img.png";
|
825
|
+
const handleChange = (e) => {
|
826
|
+
const { value } = e.target;
|
827
|
+
const token = e.target.dataset.token;
|
828
|
+
setRequestDetails(__spreadProps(__spreadValues({}, requestDetails), { [token]: value }));
|
829
|
+
if (token === "name" && !isAlpha(value)) {
|
830
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
831
|
+
[token]: ErrorText.onlylettersallowed
|
832
|
+
}));
|
833
|
+
return;
|
834
|
+
}
|
835
|
+
let errorobj = errors;
|
836
|
+
if (token === "email" && !phone) {
|
837
|
+
delete errorobj.phone;
|
838
|
+
setErrors(errorobj);
|
839
|
+
}
|
840
|
+
if (value) {
|
841
|
+
delete errorobj[token];
|
842
|
+
setErrors(errorobj);
|
843
|
+
}
|
844
|
+
if (token === "email" && !value) {
|
845
|
+
delete errorobj[token];
|
846
|
+
setErrors(errorobj);
|
847
|
+
}
|
848
|
+
};
|
849
|
+
const handleAmountChange = (data) => {
|
850
|
+
const { value } = data;
|
851
|
+
if (Number(value) > 0) {
|
852
|
+
let errorobj = errors;
|
853
|
+
delete errorobj.amount;
|
854
|
+
setErrors(errorobj);
|
855
|
+
}
|
856
|
+
setAmount(value);
|
857
|
+
};
|
858
|
+
const validateForm = () => {
|
859
|
+
let newErrors = {};
|
860
|
+
if (!amount) newErrors.amount = ErrorText.amountrequired;
|
861
|
+
if (requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
862
|
+
if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.phone = ErrorText.phoneoremailrequired;
|
863
|
+
if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.phoneoremailrequired;
|
864
|
+
if (!phone && requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
865
|
+
if (props.from === "merchant" && !requestDetails.order_id) newErrors.order_id = ErrorText.orderidrequired;
|
866
|
+
setErrors(newErrors);
|
867
|
+
return Object.keys(newErrors).length === 0;
|
868
|
+
};
|
869
|
+
(0, import_react6.useEffect)(() => {
|
870
|
+
if (props) {
|
871
|
+
setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), {
|
872
|
+
order_id: props.orderID ? props.orderID : "",
|
873
|
+
name: (props == null ? void 0 : props.name) ? props == null ? void 0 : props.name : "",
|
874
|
+
email: (props == null ? void 0 : props.email) ? props == null ? void 0 : props.email : ""
|
875
|
+
}));
|
876
|
+
setAmount(props.amount ? props.amount : "");
|
877
|
+
setPhone(props.phone ? `${props.phone}` : null);
|
878
|
+
}
|
879
|
+
}, [props]);
|
880
|
+
const handlePhoneChange = (e) => {
|
881
|
+
let value = e == null ? void 0 : e.value;
|
882
|
+
if (value && (value == null ? void 0 : value.length) > 0 && (value == null ? void 0 : value.length) !== 10) {
|
883
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
884
|
+
phone: ErrorText.phonenumberlength
|
885
|
+
}));
|
886
|
+
setPhone(value);
|
887
|
+
return;
|
888
|
+
} else {
|
889
|
+
setPhone(value);
|
890
|
+
}
|
891
|
+
let errorobj = errors;
|
892
|
+
delete errorobj.phone;
|
893
|
+
if (value && !(requestDetails == null ? void 0 : requestDetails.email)) {
|
894
|
+
delete errorobj.email;
|
895
|
+
}
|
896
|
+
setErrors(errorobj);
|
897
|
+
};
|
898
|
+
function formatAmount(amount2) {
|
899
|
+
return new Intl.NumberFormat("en-US", {
|
900
|
+
style: "currency",
|
901
|
+
currency: "USD",
|
902
|
+
minimumFractionDigits: 2,
|
903
|
+
maximumFractionDigits: 2
|
904
|
+
}).format(Number(amount2));
|
905
|
+
}
|
906
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, /* @__PURE__ */ import_react6.default.createElement(RequestPaymentstyles_default, null), /* @__PURE__ */ import_react6.default.createElement(Loader_default, { loading }), /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, /* @__PURE__ */ import_react6.default.createElement("button", { className: "paymentBtn", onClick: handleShow }, "Request Payment"), /* @__PURE__ */ import_react6.default.createElement(
|
907
|
+
CustomModal2_default,
|
908
|
+
{
|
909
|
+
open: show,
|
910
|
+
onClose: () => setShow(false)
|
911
|
+
},
|
912
|
+
/* @__PURE__ */ import_react6.default.createElement("div", { className: "request-payment-amount-detail" }, /* @__PURE__ */ import_react6.default.createElement("p", { className: "request-payment-merchantname" }, "Pay ", props == null ? void 0 : props.webname), /* @__PURE__ */ import_react6.default.createElement("p", { className: "request-payment-amount" }, formatAmount(props == null ? void 0 : props.amount)), (props == null ? void 0 : props.from) === "merchant" && /* @__PURE__ */ import_react6.default.createElement("p", { className: "request-payment-orderid" }, requestDetails == null ? void 0 : requestDetails.order_id), /* @__PURE__ */ import_react6.default.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ import_react6.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ import_react6.default.createElement("g", { "clip-path": "url(#clip0_12425_52336)" }, /* @__PURE__ */ import_react6.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_react6.default.createElement("defs", null, /* @__PURE__ */ import_react6.default.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ import_react6.default.createElement("rect", { width: "16", height: "16", fill: "white" })))))),
|
913
|
+
/* @__PURE__ */ import_react6.default.createElement("form", { className: "request-payment-input-form" }, /* @__PURE__ */ import_react6.default.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ import_react6.default.createElement(Label, { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "FULL NAME"), /* @__PURE__ */ import_react6.default.createElement(
|
914
|
+
"input",
|
915
|
+
{
|
916
|
+
className: "request-payment-input-box",
|
917
|
+
type: "text",
|
918
|
+
placeholder: "Full Name",
|
919
|
+
"data-token": "name",
|
920
|
+
onChange: handleChange,
|
921
|
+
value: requestDetails == null ? void 0 : requestDetails.name
|
922
|
+
}
|
923
|
+
), errors.name && /* @__PURE__ */ import_react6.default.createElement("small", { className: "request-payment-error-msg" }, errors.name)), /* @__PURE__ */ import_react6.default.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ import_react6.default.createElement(Label, { htmlFor: "requestPhoneNumber", className: "request-payment-input-label" }, "Phone Number"), /* @__PURE__ */ import_react6.default.createElement(
|
924
|
+
import_react_number_format.PatternFormat,
|
925
|
+
{
|
926
|
+
className: "request-payment-input-box",
|
927
|
+
placeholder: "Mobile number",
|
928
|
+
format: "+1 (###) ###-####",
|
929
|
+
value: phone,
|
930
|
+
onValueChange: (e) => {
|
931
|
+
handlePhoneChange(e);
|
932
|
+
}
|
933
|
+
}
|
934
|
+
), errors.phone && /* @__PURE__ */ import_react6.default.createElement("small", { className: "request-payment-error-msg" }, errors.phone)), /* @__PURE__ */ import_react6.default.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ import_react6.default.createElement(Label, { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "EMAIL"), /* @__PURE__ */ import_react6.default.createElement(
|
935
|
+
"input",
|
936
|
+
{
|
937
|
+
className: "request-payment-input-box",
|
938
|
+
type: "text",
|
939
|
+
placeholder: "Email",
|
940
|
+
onChange: handleChange,
|
941
|
+
"data-token": "email",
|
942
|
+
value: requestDetails == null ? void 0 : requestDetails.email
|
943
|
+
}
|
944
|
+
), errors.email && /* @__PURE__ */ import_react6.default.createElement("small", { className: "request-payment-error-msg" }, errors.email)), /* @__PURE__ */ import_react6.default.createElement(
|
945
|
+
"button",
|
946
|
+
{
|
947
|
+
type: "button",
|
948
|
+
className: "request-payment-submit-button",
|
949
|
+
onClick: sendRequestPayment,
|
950
|
+
disabled: loading
|
951
|
+
},
|
952
|
+
loading ? "Loading..." : "Send Request"
|
953
|
+
), /* @__PURE__ */ import_react6.default.createElement("div", { className: "request-payment-fractal-powerd-by" }, /* @__PURE__ */ import_react6.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "17", height: "16", viewBox: "0 0 17 16", fill: "none" }, /* @__PURE__ */ import_react6.default.createElement("path", { d: "M15.2165 4.11839C15.1973 3.69746 15.1973 3.29567 15.1973 2.89387C15.1973 2.56861 14.9486 2.31988 14.6234 2.31988C12.2317 2.31988 10.4141 1.63109 8.90257 0.157848C8.67298 -0.0526158 8.32858 -0.0526158 8.09898 0.157848C6.58748 1.63109 4.76984 2.31988 2.37821 2.31988C2.05295 2.31988 1.80422 2.56861 1.80422 2.89387C1.80422 3.29567 1.80422 3.69746 1.78508 4.11839C1.70855 8.13632 1.59375 13.6466 8.30945 15.9617L8.50078 16L8.69211 15.9617C15.3887 13.6466 15.293 8.15546 15.2165 4.11839ZM8.04159 9.6861C7.92679 9.78176 7.79286 9.83916 7.63979 9.83916H7.62066C7.46759 9.83916 7.31453 9.76263 7.21887 9.64783L5.43949 7.67713L6.30048 6.91181L7.69719 8.46158L10.7967 5.5151L11.5812 6.35695L8.04159 9.6861Z", fill: "#727272" })), "Secure payments powered by ", /* @__PURE__ */ import_react6.default.createElement("span", null, "Fractal"), /* @__PURE__ */ import_react6.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18", fill: "none" }, /* @__PURE__ */ import_react6.default.createElement("path", { d: "M17.4999 5.49758V7.01156C17.4999 7.05924 17.4595 7.09898 17.411 7.09898H12.3516C12.9169 6.54266 13.4781 5.99032 14.0434 5.434C14.0596 5.4181 14.0838 5.41016 14.104 5.41016H17.411C17.4595 5.41016 17.4999 5.44989 17.4999 5.49758Z", fill: "#61C699" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M12.3462 10.9037V9.29836C12.3462 9.25067 12.3866 9.21094 12.435 9.21094H13.8523C13.929 9.21094 13.9694 9.30631 13.9129 9.35796C13.392 9.87455 12.8711 10.3911 12.3462 10.9037Z", fill: "#61C699" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M12.4404 9.00523H15.6949C15.7434 9.00523 15.7838 8.96549 15.7838 8.91781V7.40383C15.7838 7.35614 15.7434 7.31641 15.6949 7.31641H12.4404C12.3919 7.31641 12.3516 7.35614 12.3516 7.40383V8.91781C12.3516 8.96549 12.3919 9.00523 12.4404 9.00523Z", fill: "#61C699" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M10.1581 0.0120725L11.4906 0.77105C11.531 0.794892 11.5471 0.84655 11.5229 0.890261L8.99114 5.20173C8.78521 4.44275 8.57927 3.68775 8.37334 2.92877C8.36527 2.90493 8.3693 2.88109 8.38142 2.86122L10.0329 0.0438621C10.0612 0.000151419 10.1177 -0.0117697 10.1581 0.0120725Z", fill: "#61C699" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M12.3382 7.10006L10.9289 6.29737C10.8886 6.27353 10.8724 6.22187 10.8966 6.17816L11.6033 4.97015C11.6436 4.9026 11.7446 4.91452 11.7648 4.99002C11.9546 5.69734 12.1484 6.40068 12.3382 7.10006Z", fill: "#61C699" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M10.7107 6.0771L12.338 3.30345C12.3622 3.26372 12.346 3.20808 12.3057 3.18424L10.9732 2.42526C10.9328 2.40142 10.8763 2.41732 10.852 2.45705L9.22476 5.2307C9.20053 5.27044 9.21669 5.32607 9.25706 5.34991L10.5896 6.10889C10.634 6.13273 10.6865 6.11683 10.7107 6.0771Z", fill: "#61C699" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M1.66713 3.51237L2.99963 2.75339C3.04001 2.72955 3.09654 2.74544 3.12077 2.78518L5.65251 7.09665C4.88128 6.89399 4.11408 6.69133 3.34285 6.48867C3.31862 6.4847 3.30247 6.4688 3.29036 6.44893L1.63483 3.63158C1.6106 3.58787 1.62271 3.53621 1.66713 3.51237Z", fill: "#61C699" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M8.99793 5.20018L7.58871 5.99889C7.54833 6.02274 7.4918 6.00684 7.46757 5.9671L6.76095 4.76307C6.72057 4.69552 6.78517 4.61605 6.86189 4.63591C7.57256 4.82268 8.28726 5.00944 8.99793 5.20018Z", fill: "#61C699" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M7.27986 6.07054L5.6526 3.2969C5.62837 3.25716 5.57588 3.24127 5.53146 3.26511L4.19896 4.02409C4.15858 4.04793 4.14243 4.09959 4.16666 4.1433L5.79392 6.91694C5.81815 6.95668 5.87064 6.97257 5.91506 6.94873L7.24756 6.18975C7.28794 6.16591 7.30409 6.11425 7.27986 6.07054Z", fill: "#61C699" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M0.5 12.4998V10.9859C0.5 10.9382 0.540379 10.8984 0.588833 10.8984H5.64829C5.08299 11.4548 4.52172 12.0071 3.95642 12.5634C3.94027 12.5793 3.91604 12.5873 3.89585 12.5873H0.588833C0.540379 12.5873 0.5 12.5475 0.5 12.4998Z", fill: "#61C699" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M5.65129 7.09766V8.70303C5.65129 8.75072 5.61091 8.79045 5.56246 8.79045H4.14516C4.06844 8.79045 4.02806 8.69508 4.08459 8.64343C4.60548 8.12685 5.12637 7.61424 5.65129 7.09766Z", fill: "#61C699" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M5.55967 8.99609H2.30514C2.25669 8.99609 2.21631 9.03583 2.21631 9.08352V10.5975C2.21631 10.6452 2.25669 10.6849 2.30514 10.6849H5.55967C5.60813 10.6849 5.6485 10.6452 5.6485 10.5975V9.08352C5.6485 9.03583 5.60813 8.99609 5.55967 8.99609Z", fill: "#61C699" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M7.82638 17.9865L6.49388 17.2276C6.4535 17.2037 6.43735 17.1521 6.46158 17.1083L8.99333 12.7969C9.19926 13.5559 9.40519 14.3109 9.61112 15.0698C9.6192 15.0937 9.61516 15.1175 9.60305 15.1374L7.95155 17.9547C7.91925 17.9985 7.86676 18.0104 7.82638 17.9865Z", fill: "#61C699" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M5.64795 10.8984L7.05717 11.7011C7.09755 11.725 7.1137 11.7766 7.08947 11.8203L6.38284 13.0283C6.34246 13.0959 6.24152 13.084 6.22133 13.0085C6.02751 12.3012 5.83773 11.5978 5.64795 10.8984Z", fill: "#61C699" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M7.2739 11.9258L5.64664 14.6994C5.62241 14.7392 5.63856 14.7948 5.67894 14.8187L7.01144 15.5776C7.05182 15.6015 7.10835 15.5856 7.13258 15.5458L8.75984 12.7722C8.78407 12.7325 8.76792 12.6768 8.72754 12.653L7.39504 11.894C7.35062 11.8702 7.29813 11.8861 7.2739 11.9258Z", fill: "#61C699" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M16.3199 14.4866L14.9874 15.2456C14.947 15.2694 14.8904 15.2535 14.8662 15.2138L12.3345 10.9023C13.1057 11.105 13.8729 11.3077 14.6441 11.5103C14.6684 11.5143 14.6845 11.5302 14.6966 11.5501L16.3481 14.3674C16.3764 14.4111 16.3643 14.4628 16.3199 14.4866Z", fill: "#61C699" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M8.99121 12.7983L10.4004 11.9956C10.4408 11.9717 10.4973 11.9876 10.5216 12.0274L11.2282 13.2354C11.2686 13.3029 11.204 13.3824 11.1272 13.3625C10.4166 13.1758 9.70188 12.989 8.99121 12.7983Z", fill: "#61C699" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M10.7077 11.9285L12.3349 14.7021C12.3592 14.7418 12.4117 14.7577 12.4561 14.7339L13.7886 13.9749C13.829 13.9511 13.8451 13.8994 13.8209 13.8557L12.1936 11.0821C12.1694 11.0423 12.1169 11.0264 12.0725 11.0503L10.74 11.8092C10.6996 11.8331 10.6834 11.8847 10.7077 11.9285Z", fill: "#61C699" }))))
|
954
|
+
), /* @__PURE__ */ import_react6.default.createElement(
|
955
|
+
CustomModal2_default,
|
956
|
+
{
|
957
|
+
open: showConfirmationModal,
|
958
|
+
onClose: handleCloseConfirmationModal
|
959
|
+
},
|
960
|
+
/* @__PURE__ */ import_react6.default.createElement("div", { className: "fractal-popup-content", style: { padding: "0px" } }, /* @__PURE__ */ import_react6.default.createElement("div", { className: "request-payment-success-container" }, /* @__PURE__ */ import_react6.default.createElement("span", { className: "request-payment-close-popup", onClick: handleCloseConfirmationModal }, /* @__PURE__ */ import_react6.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ import_react6.default.createElement("g", { "clip-path": "url(#clip0_12425_52336)" }, /* @__PURE__ */ import_react6.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_react6.default.createElement("defs", null, /* @__PURE__ */ import_react6.default.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ import_react6.default.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ import_react6.default.createElement("div", { className: "request-payment-success-tick-div" }, /* @__PURE__ */ import_react6.default.createElement("div", { className: "request-payment-success-tick" }, /* @__PURE__ */ import_react6.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ import_react6.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_react6.default.createElement("h6", { className: "request-payment-success-text" }, "The request ", /* @__PURE__ */ import_react6.default.createElement("br", null), "was sent"), /* @__PURE__ */ import_react6.default.createElement("h6", { className: "request-payment-success-subtext" }, "Please wait for the customer to pay"), /* @__PURE__ */ import_react6.default.createElement("div", { className: "request-payment-success-btn-div" }, /* @__PURE__ */ import_react6.default.createElement("button", { onClick: handleCloseConfirmationModal, className: "request-payment-success-btn2" }, "Close"))))
|
961
|
+
)));
|
962
|
+
}
|
963
|
+
|
979
964
|
// src/app/components/RequestPayment/RequestPaymentAllInput.tsx
|
965
|
+
var import_react7 = __toESM(require("react"));
|
966
|
+
var import_react_bootstrap = require("react-bootstrap");
|
967
|
+
var import_react_toastify = require("react-toastify");
|
968
|
+
var import_ReactToastify = require("react-toastify/dist/ReactToastify.css");
|
980
969
|
function RequestPaymentAllInput({ fractalpayClientKey }) {
|
981
970
|
const [isLoading, setIsLoading] = (0, import_react7.useState)(false);
|
982
971
|
const [show, setShow] = (0, import_react7.useState)(false);
|
package/dist/index.mjs
CHANGED
@@ -20,7 +20,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
|
21
21
|
// src/app/components/RequestPayment/RequestPayment.tsx
|
22
22
|
import "bootstrap/dist/js/bootstrap.bundle.min.js";
|
23
|
-
import
|
23
|
+
import React6, { useState, useEffect } from "react";
|
24
24
|
|
25
25
|
// src/app/components/Loader/Loader.tsx
|
26
26
|
import React2 from "react";
|
@@ -437,258 +437,15 @@ var CustomModal2_default = CustomModal2;
|
|
437
437
|
import axios from "axios";
|
438
438
|
import { PatternFormat } from "react-number-format";
|
439
439
|
import styled from "styled-components";
|
440
|
-
var Label = styled.label`
|
441
|
-
color: #727272;
|
442
|
-
font-family: Inter;
|
443
|
-
font-size: 12px;
|
444
|
-
font-style: normal;
|
445
|
-
font-weight: 500;
|
446
|
-
margin-bottom: 6px !important;
|
447
|
-
text-align: start !important;
|
448
|
-
width: 100% !important;
|
449
|
-
margin-bottom: 6px !important;
|
450
|
-
text-transform: uppercase;
|
451
|
-
`;
|
452
|
-
function RequestPayment(props) {
|
453
|
-
const fractalpayClientKey = props.fractalpayClientKey;
|
454
|
-
const [show, setShow] = useState(false);
|
455
|
-
const [loading, setLoading] = useState(false);
|
456
|
-
const [errors, setErrors] = useState({});
|
457
|
-
const [phone, setPhone] = useState(null);
|
458
|
-
const [requestDetails, setRequestDetails] = useState({
|
459
|
-
email: "",
|
460
|
-
phone_number: "",
|
461
|
-
order_id: "",
|
462
|
-
name: "",
|
463
|
-
fractalpayPublicKey: fractalpayClientKey
|
464
|
-
});
|
465
|
-
const [amount, setAmount] = useState("");
|
466
|
-
const [showConfirmationModal, setShowConfirmationModal] = useState(false);
|
467
|
-
const [apiResponse, setApiResponse] = useState(null);
|
468
|
-
const phoneNumberRegex = (value) => /^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(value);
|
469
|
-
const amoutRegex = /[+-]?([0-9]*[.])?[0-9]+/;
|
470
|
-
const isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
471
|
-
const isAlpha = (value) => /^[A-Za-z\s]*$/.test(value);
|
472
|
-
const handleClose = () => {
|
473
|
-
setShow(false);
|
474
|
-
setErrors({});
|
475
|
-
};
|
476
|
-
const handleShow = () => setShow(true);
|
477
|
-
const handleCloseConfirmationModal = () => {
|
478
|
-
console.log(apiResponse, "apiresponse");
|
479
|
-
handleSubmit(apiResponse);
|
480
|
-
setShowConfirmationModal(false);
|
481
|
-
};
|
482
|
-
function emptyFields() {
|
483
|
-
setRequestDetails({
|
484
|
-
email: "",
|
485
|
-
phone_number: "",
|
486
|
-
order_id: "",
|
487
|
-
name: "",
|
488
|
-
fractalpayPublicKey: fractalpayClientKey
|
489
|
-
});
|
490
|
-
setAmount("");
|
491
|
-
}
|
492
|
-
function handleSubmit(event) {
|
493
|
-
let message = {
|
494
|
-
type: "preview.compiledcheck",
|
495
|
-
other: __spreadProps(__spreadValues({}, event), { status: true })
|
496
|
-
};
|
497
|
-
window.parent.postMessage(message, "*");
|
498
|
-
}
|
499
|
-
const sendRequestPayment = async () => {
|
500
|
-
if (Object.keys(errors).length > 0) {
|
501
|
-
return;
|
502
|
-
}
|
503
|
-
setErrors({});
|
504
|
-
if (!(requestDetails == null ? void 0 : requestDetails.email) && phone && !phoneNumberRegex(phone)) {
|
505
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
506
|
-
phone: ErrorText.phonenumbervalid
|
507
|
-
}));
|
508
|
-
return;
|
509
|
-
}
|
510
|
-
if (!validateForm()) {
|
511
|
-
return;
|
512
|
-
}
|
513
|
-
try {
|
514
|
-
setLoading(true);
|
515
|
-
const formData = {
|
516
|
-
fractalpayPublicKey: fractalpayClientKey,
|
517
|
-
amount,
|
518
|
-
phone_number: phone,
|
519
|
-
order_id: requestDetails.order_id,
|
520
|
-
action: "request",
|
521
|
-
name: requestDetails.name,
|
522
|
-
email: requestDetails.email,
|
523
|
-
customer_id: (props == null ? void 0 : props.customerId) ? props == null ? void 0 : props.customerId : ""
|
524
|
-
};
|
525
|
-
let response = await axios.post(`${baseUrl}create-widget-order`, formData);
|
526
|
-
if ((response == null ? void 0 : response.status) === 200) {
|
527
|
-
setShowConfirmationModal(true);
|
528
|
-
setShow(false);
|
529
|
-
emptyFields();
|
530
|
-
setApiResponse(response == null ? void 0 : response.data);
|
531
|
-
}
|
532
|
-
setLoading(false);
|
533
|
-
} catch (error) {
|
534
|
-
console.log(error);
|
535
|
-
setLoading(false);
|
536
|
-
}
|
537
|
-
};
|
538
|
-
let favicon_logo = baseUrl + "images/logo-img.png";
|
539
|
-
const handleChange = (e) => {
|
540
|
-
const { value } = e.target;
|
541
|
-
const token = e.target.dataset.token;
|
542
|
-
setRequestDetails(__spreadProps(__spreadValues({}, requestDetails), { [token]: value }));
|
543
|
-
if (token === "name" && !isAlpha(value)) {
|
544
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
545
|
-
[token]: ErrorText.onlylettersallowed
|
546
|
-
}));
|
547
|
-
return;
|
548
|
-
}
|
549
|
-
let errorobj = errors;
|
550
|
-
if (token === "email" && !phone) {
|
551
|
-
delete errorobj.phone;
|
552
|
-
setErrors(errorobj);
|
553
|
-
}
|
554
|
-
if (value) {
|
555
|
-
delete errorobj[token];
|
556
|
-
setErrors(errorobj);
|
557
|
-
}
|
558
|
-
if (token === "email" && !value) {
|
559
|
-
delete errorobj[token];
|
560
|
-
setErrors(errorobj);
|
561
|
-
}
|
562
|
-
};
|
563
|
-
const handleAmountChange = (data) => {
|
564
|
-
const { value } = data;
|
565
|
-
if (Number(value) > 0) {
|
566
|
-
let errorobj = errors;
|
567
|
-
delete errorobj.amount;
|
568
|
-
setErrors(errorobj);
|
569
|
-
}
|
570
|
-
setAmount(value);
|
571
|
-
};
|
572
|
-
const validateForm = () => {
|
573
|
-
let newErrors = {};
|
574
|
-
if (!amount) newErrors.amount = ErrorText.amountrequired;
|
575
|
-
if (requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
576
|
-
if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.phone = ErrorText.phoneoremailrequired;
|
577
|
-
if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.phoneoremailrequired;
|
578
|
-
if (!phone && requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
579
|
-
if (props.from === "merchant" && !requestDetails.order_id) newErrors.order_id = ErrorText.orderidrequired;
|
580
|
-
setErrors(newErrors);
|
581
|
-
return Object.keys(newErrors).length === 0;
|
582
|
-
};
|
583
|
-
useEffect(() => {
|
584
|
-
if (props) {
|
585
|
-
setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), {
|
586
|
-
order_id: props.orderID ? props.orderID : "",
|
587
|
-
name: (props == null ? void 0 : props.name) ? props == null ? void 0 : props.name : "",
|
588
|
-
email: (props == null ? void 0 : props.email) ? props == null ? void 0 : props.email : ""
|
589
|
-
}));
|
590
|
-
setAmount(props.amount ? props.amount : "");
|
591
|
-
setPhone(props.phone ? `${props.phone}` : null);
|
592
|
-
}
|
593
|
-
}, [props]);
|
594
|
-
const handlePhoneChange = (e) => {
|
595
|
-
let value = e == null ? void 0 : e.value;
|
596
|
-
if (value && (value == null ? void 0 : value.length) > 0 && (value == null ? void 0 : value.length) !== 10) {
|
597
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
598
|
-
phone: ErrorText.phonenumberlength
|
599
|
-
}));
|
600
|
-
setPhone(value);
|
601
|
-
return;
|
602
|
-
} else {
|
603
|
-
setPhone(value);
|
604
|
-
}
|
605
|
-
let errorobj = errors;
|
606
|
-
delete errorobj.phone;
|
607
|
-
if (value && !(requestDetails == null ? void 0 : requestDetails.email)) {
|
608
|
-
delete errorobj.email;
|
609
|
-
}
|
610
|
-
setErrors(errorobj);
|
611
|
-
};
|
612
|
-
function formatAmount(amount2) {
|
613
|
-
return new Intl.NumberFormat("en-US", {
|
614
|
-
style: "currency",
|
615
|
-
currency: "USD",
|
616
|
-
minimumFractionDigits: 2,
|
617
|
-
maximumFractionDigits: 2
|
618
|
-
}).format(Number(amount2));
|
619
|
-
}
|
620
|
-
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(Loader_default, { loading }), /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("button", { className: "paymentBtn", onClick: handleShow }, "Request Payment"), /* @__PURE__ */ React5.createElement(
|
621
|
-
CustomModal2_default,
|
622
|
-
{
|
623
|
-
open: show,
|
624
|
-
onClose: () => setShow(false)
|
625
|
-
},
|
626
|
-
/* @__PURE__ */ React5.createElement("div", { className: "request-payment-amount-detail" }, /* @__PURE__ */ React5.createElement("p", { className: "request-payment-merchantname" }, "Pay ", props == null ? void 0 : props.webname), /* @__PURE__ */ React5.createElement("p", { className: "request-payment-amount" }, formatAmount(props == null ? void 0 : props.amount)), (props == null ? void 0 : props.from) === "merchant" && /* @__PURE__ */ React5.createElement("p", { className: "request-payment-orderid" }, requestDetails == null ? void 0 : requestDetails.order_id), /* @__PURE__ */ React5.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React5.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React5.createElement("g", { "clip-path": "url(#clip0_12425_52336)" }, /* @__PURE__ */ React5.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__ */ React5.createElement("defs", null, /* @__PURE__ */ React5.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React5.createElement("rect", { width: "16", height: "16", fill: "white" })))))),
|
627
|
-
/* @__PURE__ */ React5.createElement("form", { className: "request-payment-input-form" }, /* @__PURE__ */ React5.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React5.createElement(Label, { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "FULL NAME"), /* @__PURE__ */ React5.createElement(
|
628
|
-
"input",
|
629
|
-
{
|
630
|
-
className: "request-payment-input-box",
|
631
|
-
type: "text",
|
632
|
-
placeholder: "Full Name",
|
633
|
-
"data-token": "name",
|
634
|
-
onChange: handleChange,
|
635
|
-
value: requestDetails == null ? void 0 : requestDetails.name
|
636
|
-
}
|
637
|
-
), errors.name && /* @__PURE__ */ React5.createElement("small", { className: "request-payment-error-msg" }, errors.name)), /* @__PURE__ */ React5.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React5.createElement(Label, { htmlFor: "requestPhoneNumber", className: "request-payment-input-label" }, "Phone Number"), /* @__PURE__ */ React5.createElement(
|
638
|
-
PatternFormat,
|
639
|
-
{
|
640
|
-
className: "request-payment-input-box",
|
641
|
-
placeholder: "Mobile number",
|
642
|
-
format: "+1 (###) ###-####",
|
643
|
-
value: phone,
|
644
|
-
onValueChange: (e) => {
|
645
|
-
handlePhoneChange(e);
|
646
|
-
}
|
647
|
-
}
|
648
|
-
), errors.phone && /* @__PURE__ */ React5.createElement("small", { className: "request-payment-error-msg" }, errors.phone)), /* @__PURE__ */ React5.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React5.createElement(Label, { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "EMAIL"), /* @__PURE__ */ React5.createElement(
|
649
|
-
"input",
|
650
|
-
{
|
651
|
-
className: "request-payment-input-box",
|
652
|
-
type: "text",
|
653
|
-
placeholder: "Email",
|
654
|
-
onChange: handleChange,
|
655
|
-
"data-token": "email",
|
656
|
-
value: requestDetails == null ? void 0 : requestDetails.email
|
657
|
-
}
|
658
|
-
), errors.email && /* @__PURE__ */ React5.createElement("small", { className: "request-payment-error-msg" }, errors.email)), /* @__PURE__ */ React5.createElement(
|
659
|
-
"button",
|
660
|
-
{
|
661
|
-
type: "button",
|
662
|
-
className: "request-payment-submit-button",
|
663
|
-
onClick: sendRequestPayment,
|
664
|
-
disabled: loading
|
665
|
-
},
|
666
|
-
loading ? "Loading..." : "Send Request"
|
667
|
-
), /* @__PURE__ */ React5.createElement("div", { className: "request-payment-fractal-powerd-by" }, /* @__PURE__ */ React5.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "17", height: "16", viewBox: "0 0 17 16", fill: "none" }, /* @__PURE__ */ React5.createElement("path", { d: "M15.2165 4.11839C15.1973 3.69746 15.1973 3.29567 15.1973 2.89387C15.1973 2.56861 14.9486 2.31988 14.6234 2.31988C12.2317 2.31988 10.4141 1.63109 8.90257 0.157848C8.67298 -0.0526158 8.32858 -0.0526158 8.09898 0.157848C6.58748 1.63109 4.76984 2.31988 2.37821 2.31988C2.05295 2.31988 1.80422 2.56861 1.80422 2.89387C1.80422 3.29567 1.80422 3.69746 1.78508 4.11839C1.70855 8.13632 1.59375 13.6466 8.30945 15.9617L8.50078 16L8.69211 15.9617C15.3887 13.6466 15.293 8.15546 15.2165 4.11839ZM8.04159 9.6861C7.92679 9.78176 7.79286 9.83916 7.63979 9.83916H7.62066C7.46759 9.83916 7.31453 9.76263 7.21887 9.64783L5.43949 7.67713L6.30048 6.91181L7.69719 8.46158L10.7967 5.5151L11.5812 6.35695L8.04159 9.6861Z", fill: "#727272" })), "Secure payments powered by ", /* @__PURE__ */ React5.createElement("span", null, "Fractal"), /* @__PURE__ */ React5.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18", fill: "none" }, /* @__PURE__ */ React5.createElement("path", { d: "M17.4999 5.49758V7.01156C17.4999 7.05924 17.4595 7.09898 17.411 7.09898H12.3516C12.9169 6.54266 13.4781 5.99032 14.0434 5.434C14.0596 5.4181 14.0838 5.41016 14.104 5.41016H17.411C17.4595 5.41016 17.4999 5.44989 17.4999 5.49758Z", fill: "#61C699" }), /* @__PURE__ */ React5.createElement("path", { d: "M12.3462 10.9037V9.29836C12.3462 9.25067 12.3866 9.21094 12.435 9.21094H13.8523C13.929 9.21094 13.9694 9.30631 13.9129 9.35796C13.392 9.87455 12.8711 10.3911 12.3462 10.9037Z", fill: "#61C699" }), /* @__PURE__ */ React5.createElement("path", { d: "M12.4404 9.00523H15.6949C15.7434 9.00523 15.7838 8.96549 15.7838 8.91781V7.40383C15.7838 7.35614 15.7434 7.31641 15.6949 7.31641H12.4404C12.3919 7.31641 12.3516 7.35614 12.3516 7.40383V8.91781C12.3516 8.96549 12.3919 9.00523 12.4404 9.00523Z", fill: "#61C699" }), /* @__PURE__ */ React5.createElement("path", { d: "M10.1581 0.0120725L11.4906 0.77105C11.531 0.794892 11.5471 0.84655 11.5229 0.890261L8.99114 5.20173C8.78521 4.44275 8.57927 3.68775 8.37334 2.92877C8.36527 2.90493 8.3693 2.88109 8.38142 2.86122L10.0329 0.0438621C10.0612 0.000151419 10.1177 -0.0117697 10.1581 0.0120725Z", fill: "#61C699" }), /* @__PURE__ */ React5.createElement("path", { d: "M12.3382 7.10006L10.9289 6.29737C10.8886 6.27353 10.8724 6.22187 10.8966 6.17816L11.6033 4.97015C11.6436 4.9026 11.7446 4.91452 11.7648 4.99002C11.9546 5.69734 12.1484 6.40068 12.3382 7.10006Z", fill: "#61C699" }), /* @__PURE__ */ React5.createElement("path", { d: "M10.7107 6.0771L12.338 3.30345C12.3622 3.26372 12.346 3.20808 12.3057 3.18424L10.9732 2.42526C10.9328 2.40142 10.8763 2.41732 10.852 2.45705L9.22476 5.2307C9.20053 5.27044 9.21669 5.32607 9.25706 5.34991L10.5896 6.10889C10.634 6.13273 10.6865 6.11683 10.7107 6.0771Z", fill: "#61C699" }), /* @__PURE__ */ React5.createElement("path", { d: "M1.66713 3.51237L2.99963 2.75339C3.04001 2.72955 3.09654 2.74544 3.12077 2.78518L5.65251 7.09665C4.88128 6.89399 4.11408 6.69133 3.34285 6.48867C3.31862 6.4847 3.30247 6.4688 3.29036 6.44893L1.63483 3.63158C1.6106 3.58787 1.62271 3.53621 1.66713 3.51237Z", fill: "#61C699" }), /* @__PURE__ */ React5.createElement("path", { d: "M8.99793 5.20018L7.58871 5.99889C7.54833 6.02274 7.4918 6.00684 7.46757 5.9671L6.76095 4.76307C6.72057 4.69552 6.78517 4.61605 6.86189 4.63591C7.57256 4.82268 8.28726 5.00944 8.99793 5.20018Z", fill: "#61C699" }), /* @__PURE__ */ React5.createElement("path", { d: "M7.27986 6.07054L5.6526 3.2969C5.62837 3.25716 5.57588 3.24127 5.53146 3.26511L4.19896 4.02409C4.15858 4.04793 4.14243 4.09959 4.16666 4.1433L5.79392 6.91694C5.81815 6.95668 5.87064 6.97257 5.91506 6.94873L7.24756 6.18975C7.28794 6.16591 7.30409 6.11425 7.27986 6.07054Z", fill: "#61C699" }), /* @__PURE__ */ React5.createElement("path", { d: "M0.5 12.4998V10.9859C0.5 10.9382 0.540379 10.8984 0.588833 10.8984H5.64829C5.08299 11.4548 4.52172 12.0071 3.95642 12.5634C3.94027 12.5793 3.91604 12.5873 3.89585 12.5873H0.588833C0.540379 12.5873 0.5 12.5475 0.5 12.4998Z", fill: "#61C699" }), /* @__PURE__ */ React5.createElement("path", { d: "M5.65129 7.09766V8.70303C5.65129 8.75072 5.61091 8.79045 5.56246 8.79045H4.14516C4.06844 8.79045 4.02806 8.69508 4.08459 8.64343C4.60548 8.12685 5.12637 7.61424 5.65129 7.09766Z", fill: "#61C699" }), /* @__PURE__ */ React5.createElement("path", { d: "M5.55967 8.99609H2.30514C2.25669 8.99609 2.21631 9.03583 2.21631 9.08352V10.5975C2.21631 10.6452 2.25669 10.6849 2.30514 10.6849H5.55967C5.60813 10.6849 5.6485 10.6452 5.6485 10.5975V9.08352C5.6485 9.03583 5.60813 8.99609 5.55967 8.99609Z", fill: "#61C699" }), /* @__PURE__ */ React5.createElement("path", { d: "M7.82638 17.9865L6.49388 17.2276C6.4535 17.2037 6.43735 17.1521 6.46158 17.1083L8.99333 12.7969C9.19926 13.5559 9.40519 14.3109 9.61112 15.0698C9.6192 15.0937 9.61516 15.1175 9.60305 15.1374L7.95155 17.9547C7.91925 17.9985 7.86676 18.0104 7.82638 17.9865Z", fill: "#61C699" }), /* @__PURE__ */ React5.createElement("path", { d: "M5.64795 10.8984L7.05717 11.7011C7.09755 11.725 7.1137 11.7766 7.08947 11.8203L6.38284 13.0283C6.34246 13.0959 6.24152 13.084 6.22133 13.0085C6.02751 12.3012 5.83773 11.5978 5.64795 10.8984Z", fill: "#61C699" }), /* @__PURE__ */ React5.createElement("path", { d: "M7.2739 11.9258L5.64664 14.6994C5.62241 14.7392 5.63856 14.7948 5.67894 14.8187L7.01144 15.5776C7.05182 15.6015 7.10835 15.5856 7.13258 15.5458L8.75984 12.7722C8.78407 12.7325 8.76792 12.6768 8.72754 12.653L7.39504 11.894C7.35062 11.8702 7.29813 11.8861 7.2739 11.9258Z", fill: "#61C699" }), /* @__PURE__ */ React5.createElement("path", { d: "M16.3199 14.4866L14.9874 15.2456C14.947 15.2694 14.8904 15.2535 14.8662 15.2138L12.3345 10.9023C13.1057 11.105 13.8729 11.3077 14.6441 11.5103C14.6684 11.5143 14.6845 11.5302 14.6966 11.5501L16.3481 14.3674C16.3764 14.4111 16.3643 14.4628 16.3199 14.4866Z", fill: "#61C699" }), /* @__PURE__ */ React5.createElement("path", { d: "M8.99121 12.7983L10.4004 11.9956C10.4408 11.9717 10.4973 11.9876 10.5216 12.0274L11.2282 13.2354C11.2686 13.3029 11.204 13.3824 11.1272 13.3625C10.4166 13.1758 9.70188 12.989 8.99121 12.7983Z", fill: "#61C699" }), /* @__PURE__ */ React5.createElement("path", { d: "M10.7077 11.9285L12.3349 14.7021C12.3592 14.7418 12.4117 14.7577 12.4561 14.7339L13.7886 13.9749C13.829 13.9511 13.8451 13.8994 13.8209 13.8557L12.1936 11.0821C12.1694 11.0423 12.1169 11.0264 12.0725 11.0503L10.74 11.8092C10.6996 11.8331 10.6834 11.8847 10.7077 11.9285Z", fill: "#61C699" }))))
|
668
|
-
), /* @__PURE__ */ React5.createElement(
|
669
|
-
CustomModal2_default,
|
670
|
-
{
|
671
|
-
open: showConfirmationModal,
|
672
|
-
onClose: handleCloseConfirmationModal
|
673
|
-
},
|
674
|
-
/* @__PURE__ */ React5.createElement("div", { className: "fractal-popup-content", style: { padding: "0px" } }, /* @__PURE__ */ React5.createElement("div", { className: "request-payment-success-container" }, /* @__PURE__ */ React5.createElement("span", { className: "request-payment-close-popup", onClick: handleCloseConfirmationModal }, /* @__PURE__ */ React5.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React5.createElement("g", { "clip-path": "url(#clip0_12425_52336)" }, /* @__PURE__ */ React5.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__ */ React5.createElement("defs", null, /* @__PURE__ */ React5.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React5.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React5.createElement("div", { className: "request-payment-success-tick-div" }, /* @__PURE__ */ React5.createElement("div", { className: "request-payment-success-tick" }, /* @__PURE__ */ React5.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React5.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__ */ React5.createElement("h6", { className: "request-payment-success-text" }, "The request ", /* @__PURE__ */ React5.createElement("br", null), "was sent"), /* @__PURE__ */ React5.createElement("h6", { className: "request-payment-success-subtext" }, "Please wait for the customer to pay"), /* @__PURE__ */ React5.createElement("div", { className: "request-payment-success-btn-div" }, /* @__PURE__ */ React5.createElement("button", { onClick: handleCloseConfirmationModal, className: "request-payment-success-btn2" }, "Close"))))
|
675
|
-
)));
|
676
|
-
}
|
677
|
-
|
678
|
-
// src/app/components/RequestPayment/RequestPaymentAllInput.tsx
|
679
|
-
import React7, { useState as useState2 } from "react";
|
680
|
-
import { Modal } from "react-bootstrap";
|
681
|
-
import { toast, ToastContainer } from "react-toastify";
|
682
|
-
import "react-toastify/dist/ReactToastify.css";
|
683
440
|
|
684
441
|
// src/app/components/RequestPayment/RequestPaymentstyles.tsx
|
685
|
-
import
|
442
|
+
import React5 from "react";
|
686
443
|
var RequestPaymentstyles = (props) => {
|
687
|
-
return /* @__PURE__ */
|
444
|
+
return /* @__PURE__ */ React5.createElement("style", null, `
|
688
445
|
body {
|
689
|
-
font-family: 'Inter', sans-serif;
|
446
|
+
font-family: 'Inter', sans-serif !important;
|
690
447
|
}
|
691
|
-
|
448
|
+
|
692
449
|
.paymentBtn {
|
693
450
|
background-color: black;
|
694
451
|
border: none;
|
@@ -708,7 +465,6 @@ var RequestPaymentstyles = (props) => {
|
|
708
465
|
.request-payment-amount {
|
709
466
|
color: #161616;
|
710
467
|
text-align: center;
|
711
|
-
font-family: Inter;
|
712
468
|
font-size: 42px;
|
713
469
|
font-style: normal;
|
714
470
|
font-weight: 600;
|
@@ -719,7 +475,6 @@ var RequestPaymentstyles = (props) => {
|
|
719
475
|
.request-payment-orderid {
|
720
476
|
color: #727272;
|
721
477
|
text-align: center;
|
722
|
-
font-family: Inter;
|
723
478
|
font-size: 14px;
|
724
479
|
font-style: normal;
|
725
480
|
font-weight: 500;
|
@@ -729,7 +484,6 @@ var RequestPaymentstyles = (props) => {
|
|
729
484
|
.request-payment-pre-auth-merchantname {
|
730
485
|
color: #727272;
|
731
486
|
text-align: center;
|
732
|
-
font-family: Inter;
|
733
487
|
font-size: 14px;
|
734
488
|
font-style: normal;
|
735
489
|
font-weight: 500;
|
@@ -740,7 +494,6 @@ var RequestPaymentstyles = (props) => {
|
|
740
494
|
.request-payment-merchantname {
|
741
495
|
color: #727272;
|
742
496
|
text-align: center;
|
743
|
-
font-family: Inter;
|
744
497
|
font-size: 14px;
|
745
498
|
font-style: normal;
|
746
499
|
font-weight: 500;
|
@@ -771,7 +524,6 @@ var RequestPaymentstyles = (props) => {
|
|
771
524
|
|
772
525
|
.request-payment-input-label {
|
773
526
|
color: #727272;
|
774
|
-
font-family: Inter;
|
775
527
|
font-size: 12px;
|
776
528
|
font-style: normal;
|
777
529
|
font-weight: 500;
|
@@ -790,7 +542,6 @@ var RequestPaymentstyles = (props) => {
|
|
790
542
|
width: 100%;
|
791
543
|
color: #161616;
|
792
544
|
margin-top: 6px !important;
|
793
|
-
font-family: Inter;
|
794
545
|
font-size: 14px;
|
795
546
|
font-style: normal;
|
796
547
|
font-weight: 500;
|
@@ -809,7 +560,6 @@ var RequestPaymentstyles = (props) => {
|
|
809
560
|
color: #fff;
|
810
561
|
width: 100% !important;
|
811
562
|
border: none !important;
|
812
|
-
font-family: Inter;
|
813
563
|
font-size: 16px;
|
814
564
|
font-style: normal;
|
815
565
|
font-weight: 500;
|
@@ -822,7 +572,6 @@ var RequestPaymentstyles = (props) => {
|
|
822
572
|
|
823
573
|
.request-payment-fractal-powerd-by {
|
824
574
|
color: #727272;
|
825
|
-
font-family: Inter;
|
826
575
|
font-size: 14px;
|
827
576
|
font-style: normal;
|
828
577
|
font-weight: 500;
|
@@ -859,7 +608,6 @@ var RequestPaymentstyles = (props) => {
|
|
859
608
|
.request-payment-success-text {
|
860
609
|
color: #161616;
|
861
610
|
text-align: center;
|
862
|
-
font-family: Inter;
|
863
611
|
font-size: 32px;
|
864
612
|
font-style: normal;
|
865
613
|
font-weight: 500;
|
@@ -873,7 +621,6 @@ var RequestPaymentstyles = (props) => {
|
|
873
621
|
.request-payment-success-subtext {
|
874
622
|
color: #727272;
|
875
623
|
text-align: center;
|
876
|
-
font-family: Inter;
|
877
624
|
font-size: 14px;
|
878
625
|
font-style: normal;
|
879
626
|
font-weight: 500;
|
@@ -920,7 +667,6 @@ var RequestPaymentstyles = (props) => {
|
|
920
667
|
gap: 6px;
|
921
668
|
background-color: #161616;
|
922
669
|
color: #fff;
|
923
|
-
font-family: Inter;
|
924
670
|
font-size: 14px;
|
925
671
|
font-style: normal;
|
926
672
|
font-weight: 500;
|
@@ -928,14 +674,257 @@ var RequestPaymentstyles = (props) => {
|
|
928
674
|
|
929
675
|
.request-payment-error-msg{
|
930
676
|
color: #dc3545;
|
931
|
-
|
677
|
+
|
932
678
|
font-size: 12px;
|
933
679
|
}
|
934
680
|
`);
|
935
681
|
};
|
936
682
|
var RequestPaymentstyles_default = RequestPaymentstyles;
|
937
683
|
|
684
|
+
// src/app/components/RequestPayment/RequestPayment.tsx
|
685
|
+
var Label = styled.label`
|
686
|
+
color: #727272;
|
687
|
+
font-family: Inter;
|
688
|
+
font-size: 12px;
|
689
|
+
font-style: normal;
|
690
|
+
font-weight: 500;
|
691
|
+
margin-bottom: 6px !important;
|
692
|
+
text-align: start !important;
|
693
|
+
width: 100% !important;
|
694
|
+
margin-bottom: 6px !important;
|
695
|
+
text-transform: uppercase;
|
696
|
+
`;
|
697
|
+
function RequestPayment(props) {
|
698
|
+
const fractalpayClientKey = props.fractalpayClientKey;
|
699
|
+
const [show, setShow] = useState(false);
|
700
|
+
const [loading, setLoading] = useState(false);
|
701
|
+
const [errors, setErrors] = useState({});
|
702
|
+
const [phone, setPhone] = useState(null);
|
703
|
+
const [requestDetails, setRequestDetails] = useState({
|
704
|
+
email: "",
|
705
|
+
phone_number: "",
|
706
|
+
order_id: "",
|
707
|
+
name: "",
|
708
|
+
fractalpayPublicKey: fractalpayClientKey
|
709
|
+
});
|
710
|
+
const [amount, setAmount] = useState("");
|
711
|
+
const [showConfirmationModal, setShowConfirmationModal] = useState(false);
|
712
|
+
const [apiResponse, setApiResponse] = useState(null);
|
713
|
+
const phoneNumberRegex = (value) => /^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(value);
|
714
|
+
const amoutRegex = /[+-]?([0-9]*[.])?[0-9]+/;
|
715
|
+
const isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
716
|
+
const isAlpha = (value) => /^[A-Za-z\s]*$/.test(value);
|
717
|
+
const handleClose = () => {
|
718
|
+
setShow(false);
|
719
|
+
setErrors({});
|
720
|
+
};
|
721
|
+
const handleShow = () => setShow(true);
|
722
|
+
const handleCloseConfirmationModal = () => {
|
723
|
+
console.log(apiResponse, "apiresponse");
|
724
|
+
handleSubmit(apiResponse);
|
725
|
+
setShowConfirmationModal(false);
|
726
|
+
};
|
727
|
+
function emptyFields() {
|
728
|
+
setRequestDetails({
|
729
|
+
email: "",
|
730
|
+
phone_number: "",
|
731
|
+
order_id: "",
|
732
|
+
name: "",
|
733
|
+
fractalpayPublicKey: fractalpayClientKey
|
734
|
+
});
|
735
|
+
setAmount("");
|
736
|
+
}
|
737
|
+
function handleSubmit(event) {
|
738
|
+
let message = {
|
739
|
+
type: "preview.compiledcheck",
|
740
|
+
other: __spreadProps(__spreadValues({}, event), { status: true })
|
741
|
+
};
|
742
|
+
window.parent.postMessage(message, "*");
|
743
|
+
}
|
744
|
+
const sendRequestPayment = async () => {
|
745
|
+
if (Object.keys(errors).length > 0) {
|
746
|
+
return;
|
747
|
+
}
|
748
|
+
setErrors({});
|
749
|
+
if (!(requestDetails == null ? void 0 : requestDetails.email) && phone && !phoneNumberRegex(phone)) {
|
750
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
751
|
+
phone: ErrorText.phonenumbervalid
|
752
|
+
}));
|
753
|
+
return;
|
754
|
+
}
|
755
|
+
if (!validateForm()) {
|
756
|
+
return;
|
757
|
+
}
|
758
|
+
try {
|
759
|
+
setLoading(true);
|
760
|
+
const formData = {
|
761
|
+
fractalpayPublicKey: fractalpayClientKey,
|
762
|
+
amount,
|
763
|
+
phone_number: phone,
|
764
|
+
order_id: requestDetails.order_id,
|
765
|
+
action: "request",
|
766
|
+
name: requestDetails.name,
|
767
|
+
email: requestDetails.email,
|
768
|
+
customer_id: (props == null ? void 0 : props.customerId) ? props == null ? void 0 : props.customerId : ""
|
769
|
+
};
|
770
|
+
let response = await axios.post(`${baseUrl}create-widget-order`, formData);
|
771
|
+
if ((response == null ? void 0 : response.status) === 200) {
|
772
|
+
setShowConfirmationModal(true);
|
773
|
+
setShow(false);
|
774
|
+
emptyFields();
|
775
|
+
setApiResponse(response == null ? void 0 : response.data);
|
776
|
+
}
|
777
|
+
setLoading(false);
|
778
|
+
} catch (error) {
|
779
|
+
console.log(error);
|
780
|
+
setLoading(false);
|
781
|
+
}
|
782
|
+
};
|
783
|
+
let favicon_logo = baseUrl + "images/logo-img.png";
|
784
|
+
const handleChange = (e) => {
|
785
|
+
const { value } = e.target;
|
786
|
+
const token = e.target.dataset.token;
|
787
|
+
setRequestDetails(__spreadProps(__spreadValues({}, requestDetails), { [token]: value }));
|
788
|
+
if (token === "name" && !isAlpha(value)) {
|
789
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
790
|
+
[token]: ErrorText.onlylettersallowed
|
791
|
+
}));
|
792
|
+
return;
|
793
|
+
}
|
794
|
+
let errorobj = errors;
|
795
|
+
if (token === "email" && !phone) {
|
796
|
+
delete errorobj.phone;
|
797
|
+
setErrors(errorobj);
|
798
|
+
}
|
799
|
+
if (value) {
|
800
|
+
delete errorobj[token];
|
801
|
+
setErrors(errorobj);
|
802
|
+
}
|
803
|
+
if (token === "email" && !value) {
|
804
|
+
delete errorobj[token];
|
805
|
+
setErrors(errorobj);
|
806
|
+
}
|
807
|
+
};
|
808
|
+
const handleAmountChange = (data) => {
|
809
|
+
const { value } = data;
|
810
|
+
if (Number(value) > 0) {
|
811
|
+
let errorobj = errors;
|
812
|
+
delete errorobj.amount;
|
813
|
+
setErrors(errorobj);
|
814
|
+
}
|
815
|
+
setAmount(value);
|
816
|
+
};
|
817
|
+
const validateForm = () => {
|
818
|
+
let newErrors = {};
|
819
|
+
if (!amount) newErrors.amount = ErrorText.amountrequired;
|
820
|
+
if (requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
821
|
+
if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.phone = ErrorText.phoneoremailrequired;
|
822
|
+
if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.phoneoremailrequired;
|
823
|
+
if (!phone && requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
824
|
+
if (props.from === "merchant" && !requestDetails.order_id) newErrors.order_id = ErrorText.orderidrequired;
|
825
|
+
setErrors(newErrors);
|
826
|
+
return Object.keys(newErrors).length === 0;
|
827
|
+
};
|
828
|
+
useEffect(() => {
|
829
|
+
if (props) {
|
830
|
+
setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), {
|
831
|
+
order_id: props.orderID ? props.orderID : "",
|
832
|
+
name: (props == null ? void 0 : props.name) ? props == null ? void 0 : props.name : "",
|
833
|
+
email: (props == null ? void 0 : props.email) ? props == null ? void 0 : props.email : ""
|
834
|
+
}));
|
835
|
+
setAmount(props.amount ? props.amount : "");
|
836
|
+
setPhone(props.phone ? `${props.phone}` : null);
|
837
|
+
}
|
838
|
+
}, [props]);
|
839
|
+
const handlePhoneChange = (e) => {
|
840
|
+
let value = e == null ? void 0 : e.value;
|
841
|
+
if (value && (value == null ? void 0 : value.length) > 0 && (value == null ? void 0 : value.length) !== 10) {
|
842
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
843
|
+
phone: ErrorText.phonenumberlength
|
844
|
+
}));
|
845
|
+
setPhone(value);
|
846
|
+
return;
|
847
|
+
} else {
|
848
|
+
setPhone(value);
|
849
|
+
}
|
850
|
+
let errorobj = errors;
|
851
|
+
delete errorobj.phone;
|
852
|
+
if (value && !(requestDetails == null ? void 0 : requestDetails.email)) {
|
853
|
+
delete errorobj.email;
|
854
|
+
}
|
855
|
+
setErrors(errorobj);
|
856
|
+
};
|
857
|
+
function formatAmount(amount2) {
|
858
|
+
return new Intl.NumberFormat("en-US", {
|
859
|
+
style: "currency",
|
860
|
+
currency: "USD",
|
861
|
+
minimumFractionDigits: 2,
|
862
|
+
maximumFractionDigits: 2
|
863
|
+
}).format(Number(amount2));
|
864
|
+
}
|
865
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(RequestPaymentstyles_default, null), /* @__PURE__ */ React6.createElement(Loader_default, { loading }), /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement("button", { className: "paymentBtn", onClick: handleShow }, "Request Payment"), /* @__PURE__ */ React6.createElement(
|
866
|
+
CustomModal2_default,
|
867
|
+
{
|
868
|
+
open: show,
|
869
|
+
onClose: () => setShow(false)
|
870
|
+
},
|
871
|
+
/* @__PURE__ */ React6.createElement("div", { className: "request-payment-amount-detail" }, /* @__PURE__ */ React6.createElement("p", { className: "request-payment-merchantname" }, "Pay ", props == null ? void 0 : props.webname), /* @__PURE__ */ React6.createElement("p", { className: "request-payment-amount" }, formatAmount(props == null ? void 0 : props.amount)), (props == null ? void 0 : props.from) === "merchant" && /* @__PURE__ */ React6.createElement("p", { className: "request-payment-orderid" }, requestDetails == null ? void 0 : requestDetails.order_id), /* @__PURE__ */ React6.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React6.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React6.createElement("g", { "clip-path": "url(#clip0_12425_52336)" }, /* @__PURE__ */ React6.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__ */ React6.createElement("defs", null, /* @__PURE__ */ React6.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React6.createElement("rect", { width: "16", height: "16", fill: "white" })))))),
|
872
|
+
/* @__PURE__ */ React6.createElement("form", { className: "request-payment-input-form" }, /* @__PURE__ */ React6.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React6.createElement(Label, { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "FULL NAME"), /* @__PURE__ */ React6.createElement(
|
873
|
+
"input",
|
874
|
+
{
|
875
|
+
className: "request-payment-input-box",
|
876
|
+
type: "text",
|
877
|
+
placeholder: "Full Name",
|
878
|
+
"data-token": "name",
|
879
|
+
onChange: handleChange,
|
880
|
+
value: requestDetails == null ? void 0 : requestDetails.name
|
881
|
+
}
|
882
|
+
), errors.name && /* @__PURE__ */ React6.createElement("small", { className: "request-payment-error-msg" }, errors.name)), /* @__PURE__ */ React6.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React6.createElement(Label, { htmlFor: "requestPhoneNumber", className: "request-payment-input-label" }, "Phone Number"), /* @__PURE__ */ React6.createElement(
|
883
|
+
PatternFormat,
|
884
|
+
{
|
885
|
+
className: "request-payment-input-box",
|
886
|
+
placeholder: "Mobile number",
|
887
|
+
format: "+1 (###) ###-####",
|
888
|
+
value: phone,
|
889
|
+
onValueChange: (e) => {
|
890
|
+
handlePhoneChange(e);
|
891
|
+
}
|
892
|
+
}
|
893
|
+
), errors.phone && /* @__PURE__ */ React6.createElement("small", { className: "request-payment-error-msg" }, errors.phone)), /* @__PURE__ */ React6.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React6.createElement(Label, { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "EMAIL"), /* @__PURE__ */ React6.createElement(
|
894
|
+
"input",
|
895
|
+
{
|
896
|
+
className: "request-payment-input-box",
|
897
|
+
type: "text",
|
898
|
+
placeholder: "Email",
|
899
|
+
onChange: handleChange,
|
900
|
+
"data-token": "email",
|
901
|
+
value: requestDetails == null ? void 0 : requestDetails.email
|
902
|
+
}
|
903
|
+
), errors.email && /* @__PURE__ */ React6.createElement("small", { className: "request-payment-error-msg" }, errors.email)), /* @__PURE__ */ React6.createElement(
|
904
|
+
"button",
|
905
|
+
{
|
906
|
+
type: "button",
|
907
|
+
className: "request-payment-submit-button",
|
908
|
+
onClick: sendRequestPayment,
|
909
|
+
disabled: loading
|
910
|
+
},
|
911
|
+
loading ? "Loading..." : "Send Request"
|
912
|
+
), /* @__PURE__ */ React6.createElement("div", { className: "request-payment-fractal-powerd-by" }, /* @__PURE__ */ React6.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "17", height: "16", viewBox: "0 0 17 16", fill: "none" }, /* @__PURE__ */ React6.createElement("path", { d: "M15.2165 4.11839C15.1973 3.69746 15.1973 3.29567 15.1973 2.89387C15.1973 2.56861 14.9486 2.31988 14.6234 2.31988C12.2317 2.31988 10.4141 1.63109 8.90257 0.157848C8.67298 -0.0526158 8.32858 -0.0526158 8.09898 0.157848C6.58748 1.63109 4.76984 2.31988 2.37821 2.31988C2.05295 2.31988 1.80422 2.56861 1.80422 2.89387C1.80422 3.29567 1.80422 3.69746 1.78508 4.11839C1.70855 8.13632 1.59375 13.6466 8.30945 15.9617L8.50078 16L8.69211 15.9617C15.3887 13.6466 15.293 8.15546 15.2165 4.11839ZM8.04159 9.6861C7.92679 9.78176 7.79286 9.83916 7.63979 9.83916H7.62066C7.46759 9.83916 7.31453 9.76263 7.21887 9.64783L5.43949 7.67713L6.30048 6.91181L7.69719 8.46158L10.7967 5.5151L11.5812 6.35695L8.04159 9.6861Z", fill: "#727272" })), "Secure payments powered by ", /* @__PURE__ */ React6.createElement("span", null, "Fractal"), /* @__PURE__ */ React6.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18", fill: "none" }, /* @__PURE__ */ React6.createElement("path", { d: "M17.4999 5.49758V7.01156C17.4999 7.05924 17.4595 7.09898 17.411 7.09898H12.3516C12.9169 6.54266 13.4781 5.99032 14.0434 5.434C14.0596 5.4181 14.0838 5.41016 14.104 5.41016H17.411C17.4595 5.41016 17.4999 5.44989 17.4999 5.49758Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M12.3462 10.9037V9.29836C12.3462 9.25067 12.3866 9.21094 12.435 9.21094H13.8523C13.929 9.21094 13.9694 9.30631 13.9129 9.35796C13.392 9.87455 12.8711 10.3911 12.3462 10.9037Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M12.4404 9.00523H15.6949C15.7434 9.00523 15.7838 8.96549 15.7838 8.91781V7.40383C15.7838 7.35614 15.7434 7.31641 15.6949 7.31641H12.4404C12.3919 7.31641 12.3516 7.35614 12.3516 7.40383V8.91781C12.3516 8.96549 12.3919 9.00523 12.4404 9.00523Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M10.1581 0.0120725L11.4906 0.77105C11.531 0.794892 11.5471 0.84655 11.5229 0.890261L8.99114 5.20173C8.78521 4.44275 8.57927 3.68775 8.37334 2.92877C8.36527 2.90493 8.3693 2.88109 8.38142 2.86122L10.0329 0.0438621C10.0612 0.000151419 10.1177 -0.0117697 10.1581 0.0120725Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M12.3382 7.10006L10.9289 6.29737C10.8886 6.27353 10.8724 6.22187 10.8966 6.17816L11.6033 4.97015C11.6436 4.9026 11.7446 4.91452 11.7648 4.99002C11.9546 5.69734 12.1484 6.40068 12.3382 7.10006Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M10.7107 6.0771L12.338 3.30345C12.3622 3.26372 12.346 3.20808 12.3057 3.18424L10.9732 2.42526C10.9328 2.40142 10.8763 2.41732 10.852 2.45705L9.22476 5.2307C9.20053 5.27044 9.21669 5.32607 9.25706 5.34991L10.5896 6.10889C10.634 6.13273 10.6865 6.11683 10.7107 6.0771Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M1.66713 3.51237L2.99963 2.75339C3.04001 2.72955 3.09654 2.74544 3.12077 2.78518L5.65251 7.09665C4.88128 6.89399 4.11408 6.69133 3.34285 6.48867C3.31862 6.4847 3.30247 6.4688 3.29036 6.44893L1.63483 3.63158C1.6106 3.58787 1.62271 3.53621 1.66713 3.51237Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M8.99793 5.20018L7.58871 5.99889C7.54833 6.02274 7.4918 6.00684 7.46757 5.9671L6.76095 4.76307C6.72057 4.69552 6.78517 4.61605 6.86189 4.63591C7.57256 4.82268 8.28726 5.00944 8.99793 5.20018Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M7.27986 6.07054L5.6526 3.2969C5.62837 3.25716 5.57588 3.24127 5.53146 3.26511L4.19896 4.02409C4.15858 4.04793 4.14243 4.09959 4.16666 4.1433L5.79392 6.91694C5.81815 6.95668 5.87064 6.97257 5.91506 6.94873L7.24756 6.18975C7.28794 6.16591 7.30409 6.11425 7.27986 6.07054Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M0.5 12.4998V10.9859C0.5 10.9382 0.540379 10.8984 0.588833 10.8984H5.64829C5.08299 11.4548 4.52172 12.0071 3.95642 12.5634C3.94027 12.5793 3.91604 12.5873 3.89585 12.5873H0.588833C0.540379 12.5873 0.5 12.5475 0.5 12.4998Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M5.65129 7.09766V8.70303C5.65129 8.75072 5.61091 8.79045 5.56246 8.79045H4.14516C4.06844 8.79045 4.02806 8.69508 4.08459 8.64343C4.60548 8.12685 5.12637 7.61424 5.65129 7.09766Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M5.55967 8.99609H2.30514C2.25669 8.99609 2.21631 9.03583 2.21631 9.08352V10.5975C2.21631 10.6452 2.25669 10.6849 2.30514 10.6849H5.55967C5.60813 10.6849 5.6485 10.6452 5.6485 10.5975V9.08352C5.6485 9.03583 5.60813 8.99609 5.55967 8.99609Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M7.82638 17.9865L6.49388 17.2276C6.4535 17.2037 6.43735 17.1521 6.46158 17.1083L8.99333 12.7969C9.19926 13.5559 9.40519 14.3109 9.61112 15.0698C9.6192 15.0937 9.61516 15.1175 9.60305 15.1374L7.95155 17.9547C7.91925 17.9985 7.86676 18.0104 7.82638 17.9865Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M5.64795 10.8984L7.05717 11.7011C7.09755 11.725 7.1137 11.7766 7.08947 11.8203L6.38284 13.0283C6.34246 13.0959 6.24152 13.084 6.22133 13.0085C6.02751 12.3012 5.83773 11.5978 5.64795 10.8984Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M7.2739 11.9258L5.64664 14.6994C5.62241 14.7392 5.63856 14.7948 5.67894 14.8187L7.01144 15.5776C7.05182 15.6015 7.10835 15.5856 7.13258 15.5458L8.75984 12.7722C8.78407 12.7325 8.76792 12.6768 8.72754 12.653L7.39504 11.894C7.35062 11.8702 7.29813 11.8861 7.2739 11.9258Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M16.3199 14.4866L14.9874 15.2456C14.947 15.2694 14.8904 15.2535 14.8662 15.2138L12.3345 10.9023C13.1057 11.105 13.8729 11.3077 14.6441 11.5103C14.6684 11.5143 14.6845 11.5302 14.6966 11.5501L16.3481 14.3674C16.3764 14.4111 16.3643 14.4628 16.3199 14.4866Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M8.99121 12.7983L10.4004 11.9956C10.4408 11.9717 10.4973 11.9876 10.5216 12.0274L11.2282 13.2354C11.2686 13.3029 11.204 13.3824 11.1272 13.3625C10.4166 13.1758 9.70188 12.989 8.99121 12.7983Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M10.7077 11.9285L12.3349 14.7021C12.3592 14.7418 12.4117 14.7577 12.4561 14.7339L13.7886 13.9749C13.829 13.9511 13.8451 13.8994 13.8209 13.8557L12.1936 11.0821C12.1694 11.0423 12.1169 11.0264 12.0725 11.0503L10.74 11.8092C10.6996 11.8331 10.6834 11.8847 10.7077 11.9285Z", fill: "#61C699" }))))
|
913
|
+
), /* @__PURE__ */ React6.createElement(
|
914
|
+
CustomModal2_default,
|
915
|
+
{
|
916
|
+
open: showConfirmationModal,
|
917
|
+
onClose: handleCloseConfirmationModal
|
918
|
+
},
|
919
|
+
/* @__PURE__ */ React6.createElement("div", { className: "fractal-popup-content", style: { padding: "0px" } }, /* @__PURE__ */ React6.createElement("div", { className: "request-payment-success-container" }, /* @__PURE__ */ React6.createElement("span", { className: "request-payment-close-popup", onClick: handleCloseConfirmationModal }, /* @__PURE__ */ React6.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React6.createElement("g", { "clip-path": "url(#clip0_12425_52336)" }, /* @__PURE__ */ React6.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__ */ React6.createElement("defs", null, /* @__PURE__ */ React6.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React6.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React6.createElement("div", { className: "request-payment-success-tick-div" }, /* @__PURE__ */ React6.createElement("div", { className: "request-payment-success-tick" }, /* @__PURE__ */ React6.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React6.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__ */ React6.createElement("h6", { className: "request-payment-success-text" }, "The request ", /* @__PURE__ */ React6.createElement("br", null), "was sent"), /* @__PURE__ */ React6.createElement("h6", { className: "request-payment-success-subtext" }, "Please wait for the customer to pay"), /* @__PURE__ */ React6.createElement("div", { className: "request-payment-success-btn-div" }, /* @__PURE__ */ React6.createElement("button", { onClick: handleCloseConfirmationModal, className: "request-payment-success-btn2" }, "Close"))))
|
920
|
+
)));
|
921
|
+
}
|
922
|
+
|
938
923
|
// src/app/components/RequestPayment/RequestPaymentAllInput.tsx
|
924
|
+
import React7, { useState as useState2 } from "react";
|
925
|
+
import { Modal } from "react-bootstrap";
|
926
|
+
import { toast, ToastContainer } from "react-toastify";
|
927
|
+
import "react-toastify/dist/ReactToastify.css";
|
939
928
|
function RequestPaymentAllInput({ fractalpayClientKey }) {
|
940
929
|
const [isLoading, setIsLoading] = useState2(false);
|
941
930
|
const [show, setShow] = useState2(false);
|