@fractalpay/fractalpay-next-test 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,46 +1,4 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
-
33
- // src/app/components/RequestPayment/RequestPayment.tsx
34
- import "bootstrap/dist/js/bootstrap.bundle.min.js";
35
- import React6, { useState, useEffect } from "react";
36
-
37
- // src/app/components/Loader/Loader.tsx
38
- import React2 from "react";
39
-
40
- // src/app/components/Loader/LoaderStyle.tsx
41
- import React from "react";
42
- var LoaderStyle = (props) => {
43
- return /* @__PURE__ */ React.createElement("style", null, `
1
+ var ii=Object.defineProperty,ai=Object.defineProperties;var oi=Object.getOwnPropertyDescriptors;var Nn=Object.getOwnPropertySymbols;var En=Object.prototype.hasOwnProperty,On=Object.prototype.propertyIsEnumerable;var Kn=(e,y,T)=>y in e?ii(e,y,{enumerable:!0,configurable:!0,writable:!0,value:T}):e[y]=T,k=(e,y)=>{for(var T in y||(y={}))En.call(y,T)&&Kn(e,T,y[T]);if(Nn)for(var T of Nn(y))On.call(y,T)&&Kn(e,T,y[T]);return e},z=(e,y)=>ai(e,oi(y));var kn=(e,y)=>{var T={};for(var O in e)En.call(e,O)&&y.indexOf(O)<0&&(T[O]=e[O]);if(e!=null&&Nn)for(var O of Nn(e))y.indexOf(O)<0&&On.call(e,O)&&(T[O]=e[O]);return T};var ri=(e,y)=>()=>(y||e((y={exports:{}}).exports,y),y.exports);var Wn=ri((ia,mi)=>{mi.exports={name:"@fractalpay/fractalpay-next-test",version:"0.0.5",private:!1,scripts:{dev:"next dev -p 4001",build:"next build",start:"next start",lint:"next lint",bundle:"tsup src/app/index.ts"},dependencies:{"@types/yup":"^0.29.14",axios:"^1.8.1",bootstrap:"^5.3.3","credit-card-type":"^10.0.1",formik:"^2.4.6","node-forge":"^1.3.1","react-bootstrap":"^2.10.5","react-bs-datatable":"^3.15.0","react-datepicker":"^7.5.0","react-icons":"^5.5.0","react-number-format":"^5.4.3","react-toastify":"^10.0.6","socket.io-client":"^4.8.1","styled-components":"^6.1.15",sweetalert2:"^11.22.0",yup:"^1.6.1"},peerdependencies:{next:"15.0.3",react:">=18.0.0 <20.0.0","react-dom":">=18.0.0 <20.0.0"},devDependencies:{"@types/estree":"^1.0.8","@types/node":"^20","@types/node-forge":"^1.3.11","@types/react":"^18","@types/react-dom":"^18",autoprefixer:"^10.4.20","credit-card-type":"^10.0.1",eslint:"^8","eslint-config-next":"15.0.3",next:"^15.0.3",react:"^18.3.1","react-bs-datatable":"^3.15.0","react-datepicker":"^7.5.0","react-dom":"^18.3.1","react-toastify":"^10.0.6",tsup:"^8.4.0",typescript:"^5"},author:"Mukul",license:"MIT",keywords:["nextjs","next","typescript","tailwindcss"],main:"dist/index.js",publishConfig:{access:"public"}}});import"bootstrap/dist/js/bootstrap.bundle.min.js";import _,{useState as Xt,useEffect as Gn}from"react";import Jt from"react";import si from"react";var li=e=>si.createElement("style",null,`
44
2
 
45
3
  .loader {
46
4
  position: fixed; /* Fixed position to cover the viewport */
@@ -55,7 +13,8 @@ var LoaderStyle = (props) => {
55
13
  background-color: rgba(31, 29, 29, 0.52); /* Semi-transparent black background */
56
14
 
57
15
  backdrop-filter: blur(.5px); /* Blur effect */
58
- z-index: 999999999999; /* Ensure it's on top of other elements */
16
+ z-index: 999999999999 !important; /* Ensure it's on top of other elements */
17
+ transform: translate(0%, 0%) !important
59
18
  }
60
19
 
61
20
  .lds-ellipsis {
@@ -122,54 +81,7 @@ var LoaderStyle = (props) => {
122
81
  }
123
82
  }
124
83
 
125
- `);
126
- };
127
- var LoaderStyle_default = LoaderStyle;
128
-
129
- // src/app/components/Loader/Loader.tsx
130
- var Loader = (props) => {
131
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(LoaderStyle_default, null), (props == null ? void 0 : props.loading) && /* @__PURE__ */ React2.createElement("div", { className: "loader" }, /* @__PURE__ */ React2.createElement("div", { className: "lds-ellipsis" }, /* @__PURE__ */ React2.createElement("div", null), /* @__PURE__ */ React2.createElement("div", null), /* @__PURE__ */ React2.createElement("div", null), /* @__PURE__ */ React2.createElement("div", null))));
132
- };
133
- var Loader_default = Loader;
134
-
135
- // src/app/components/baseurl.ts
136
- var fractalGatewayUrl = "https://api-dev.merchant-trends.com/";
137
- var masterBaseUrl = "https://testapi.fractalpay.com/";
138
- var baseUrl = "https://staging-widget.fractalpay.com/";
139
-
140
- // src/app/components/Errortext.ts
141
- var ErrorText = {
142
- namerequired: "Full Name is required",
143
- amountrequired: "Amount is required",
144
- amountpositive: "Amount should be positive",
145
- amountzero: "Amount should not be zero",
146
- amountenter: "Please enter an amount",
147
- amountvalid: "Please enter a valid amount",
148
- phoneoremailrequired: "Phone or Email is required",
149
- invalidemail: "Please enter a valid email",
150
- invalidemailformat: "Invalid email format",
151
- onlylettersallowed: "Only letters are allowed",
152
- phonenumberlength: "Phone number should be 10 digits",
153
- phonenumberrequired: "Please enter a phone number",
154
- // phonenumbervalid:'Please enter a valid 10-digit phone number',
155
- phonenumbervalid: "Please enter a valid phone number",
156
- phonenumbervalidnumberonly: "Please enter a valid phone number (numbers only)",
157
- orderidenter: "Please enter an order ID",
158
- orderidrequired: "Order ID is required",
159
- networkresponseerror: "Network response was not ok",
160
- anerroroccured: "An error occurred. Please try again.",
161
- montherror: "Please write month only 1 to 12",
162
- fieldrequired: "This field is required",
163
- fractalpayclientidrequired: "Fractalpay client key is missing or empty."
164
- };
165
-
166
- // src/app/components/CustomModal/CustomModal2.tsx
167
- import React4 from "react";
168
-
169
- // src/app/components/CustomModal/CustomModal2styles.tsx
170
- import React3 from "react";
171
- var CustomModal2styles = (props) => {
172
- return /* @__PURE__ */ React3.createElement("style", null, `
84
+ `),Zn=li;var di=e=>Jt.createElement(Jt.Fragment,null,Jt.createElement(Zn,null),(e==null?void 0:e.loading)&&Jt.createElement("div",{className:"loader"},Jt.createElement("div",{className:"lds-ellipsis"},Jt.createElement("div",null),Jt.createElement("div",null),Jt.createElement("div",null),Jt.createElement("div",null)))),Nt=di;var{name:pn}=Wn();console.log(pn,"dgijiisdfhg");var R="https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/";pn==="@fractalpay/fractalpay-next-dev"?(Ne="https://dev-sky-node.fractalpay.com/",ze="https://dev-widget.fractalpay.com/",yt="https://api-dev.merchant-trends.com/"):pn==="@fractalpay/fractalpay-next-test"?(Ne="https://testapi.fractalpay.com/",ze="https://staging-widget.fractalpay.com/",yt="https://api-dev.merchant-trends.com/"):pn==="@fractalpay/fractalpay-next-testprod"?(Ne="https://sky-node-prod.fractalpay.com/",ze="https://widget-prod.fractalpay.com/",yt="https://api.merchant-trends.com/"):pn==="@fractalpay/fractalpay-next"?(Ne="https://api.fractalpay.com/",ze="https://widget.fractalpay.com/",yt="https://api.merchant-trends.com/"):(ze="http://localhost:8082/",Ne="http://localhost:8081/",yt="https://api-dev.merchant-trends.com/");var Ne,ze,yt;var Qe={namerequired:"Full Name is required",amountrequired:"Amount is required",amountpositive:"Amount should be positive",amountzero:"Amount should not be zero",amountenter:"Please enter an amount",amountvalid:"Please enter a valid amount",phoneoremailrequired:"Phone or Email is required",invalidemail:"Please enter a valid email",invalidemailformat:"Invalid email format",onlylettersallowed:"Only letters are allowed",phonenumberlength:"Phone number should be 10 digits",phonenumberrequired:"Please enter a phone number",phonenumbervalid:"Please enter a valid phone number",phonenumbervalidnumberonly:"Please enter a valid phone number (numbers only)",orderidenter:"Please enter an order ID",orderidrequired:"Order ID is required",networkresponseerror:"Network response was not ok",anerroroccured:"An error occurred. Please try again.",montherror:"Please write month only 1 to 12",fieldrequired:"This field is required",fractalpayclientidrequired:"Fractalpay client key is missing or empty."};import un from"react";import ci from"react";var pi=e=>ci.createElement("style",null,`
173
85
  .fractal-input::placeholder {
174
86
  color: #35254D;
175
87
  opacity: 1;
@@ -422,30 +334,7 @@ var CustomModal2styles = (props) => {
422
334
  padding: 0px !important;
423
335
  border-radius: 12px !important;
424
336
  }
425
- `);
426
- };
427
- var CustomModal2styles_default = CustomModal2styles;
428
-
429
- // src/app/components/CustomModal/CustomModal2.tsx
430
- var CustomModal2 = ({
431
- open,
432
- onClose,
433
- children,
434
- maxWidth
435
- }) => {
436
- if (!open) return null;
437
- return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(CustomModal2styles_default, null), /* @__PURE__ */ React4.createElement("div", { className: "fractal-popup" }, /* @__PURE__ */ React4.createElement("div", { className: "fractal-popup-content request-payment-popup-container", style: { maxWidth: `${maxWidth != null ? maxWidth : "auto"}` } }, children)));
438
- };
439
- var CustomModal2_default = CustomModal2;
440
-
441
- // src/app/components/RequestPayment/RequestPayment.tsx
442
- import axios from "axios";
443
- import { PatternFormat } from "react-number-format";
444
-
445
- // src/app/components/RequestPayment/RequestPaymentstyles.tsx
446
- import React5 from "react";
447
- var RequestPaymentstyles = (props) => {
448
- return /* @__PURE__ */ React5.createElement("style", null, `
337
+ `),Un=pi;var ui=({open:e,onClose:y,children:T,maxWidth:O})=>e?un.createElement(un.Fragment,null,un.createElement(Un,null),un.createElement("div",{className:"fractal-popup"},un.createElement("div",{className:"fractal-popup-content request-payment-popup-container",style:{maxWidth:`${O!=null?O:"auto"}`}},T))):null,$t=ui;import hi from"axios";import{PatternFormat as yi}from"react-number-format";import gi from"react";var fi=e=>gi.createElement("style",null,`
449
338
  @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
450
339
  body {
451
340
  font-family: 'Inter', sans-serif !important;
@@ -686,496 +575,27 @@ var RequestPaymentstyles = (props) => {
686
575
 
687
576
  font-size: 12px;
688
577
  }
689
- `);
690
- };
691
- var RequestPaymentstyles_default = RequestPaymentstyles;
692
-
693
- // src/app/components/RequestPayment/RequestPayment.tsx
694
- function RequestPayment(props) {
695
- const fractalpayClientKey = props.fractalpayClientKey;
696
- const discount = props == null ? void 0 : props.discount;
697
- const tax = props == null ? void 0 : props.tax;
698
- const surcharge = props == null ? void 0 : props.surcharge;
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
- discount,
770
- surcharge,
771
- tax,
772
- require_3ds: props == null ? void 0 : props.require_3ds
773
- };
774
- let response = await axios.post(`${baseUrl}create-widget-order`, formData);
775
- if ((response == null ? void 0 : response.status) === 200) {
776
- setShowConfirmationModal(true);
777
- setShow(false);
778
- emptyFields();
779
- setApiResponse(response == null ? void 0 : response.data);
780
- }
781
- setLoading(false);
782
- } catch (error) {
783
- console.log(error);
784
- setLoading(false);
785
- }
786
- };
787
- let favicon_logo = baseUrl + "images/logo-img.png";
788
- const handleChange = (e) => {
789
- const { value } = e.target;
790
- const token = e.target.dataset.token;
791
- setRequestDetails(__spreadProps(__spreadValues({}, requestDetails), { [token]: value }));
792
- if (token === "name" && !isAlpha(value)) {
793
- setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
794
- [token]: ErrorText.onlylettersallowed
795
- }));
796
- return;
797
- }
798
- let errorobj = errors;
799
- if (token === "email" && !phone) {
800
- delete errorobj.phone;
801
- setErrors(errorobj);
802
- }
803
- if (value) {
804
- delete errorobj[token];
805
- setErrors(errorobj);
806
- }
807
- if (token === "email" && !value) {
808
- delete errorobj[token];
809
- setErrors(errorobj);
810
- }
811
- };
812
- const handleAmountChange = (data) => {
813
- const { value } = data;
814
- if (Number(value) > 0) {
815
- let errorobj = errors;
816
- delete errorobj.amount;
817
- setErrors(errorobj);
818
- }
819
- setAmount(value);
820
- };
821
- const validateForm = () => {
822
- let newErrors = {};
823
- if (!amount) newErrors.amount = ErrorText.amountrequired;
824
- if (requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
825
- if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.phone = ErrorText.phoneoremailrequired;
826
- if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.phoneoremailrequired;
827
- if (!phone && requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
828
- if (props.from === "merchant" && !requestDetails.order_id) newErrors.order_id = ErrorText.orderidrequired;
829
- setErrors(newErrors);
830
- return Object.keys(newErrors).length === 0;
831
- };
832
- useEffect(() => {
833
- if (props) {
834
- setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), {
835
- order_id: props.orderID ? props.orderID : "",
836
- name: (props == null ? void 0 : props.name) ? props == null ? void 0 : props.name : "",
837
- email: (props == null ? void 0 : props.email) ? props == null ? void 0 : props.email : ""
838
- }));
839
- setAmount(props.amount ? props.amount : "");
840
- setPhone(props.phone ? `${props.phone}` : null);
841
- }
842
- }, [props]);
843
- const handlePhoneChange = (e) => {
844
- let value = e == null ? void 0 : e.value;
845
- if (value && (value == null ? void 0 : value.length) > 0 && (value == null ? void 0 : value.length) !== 10) {
846
- setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
847
- phone: ErrorText.phonenumberlength
848
- }));
849
- setPhone(value);
850
- return;
851
- } else {
852
- setPhone(value);
853
- }
854
- let errorobj = errors;
855
- delete errorobj.phone;
856
- if (value && !(requestDetails == null ? void 0 : requestDetails.email)) {
857
- delete errorobj.email;
858
- }
859
- setErrors(errorobj);
860
- };
861
- function formatAmount(amount2) {
862
- return new Intl.NumberFormat("en-US", {
863
- style: "currency",
864
- currency: "USD",
865
- minimumFractionDigits: 2,
866
- maximumFractionDigits: 2
867
- }).format(Number(amount2));
868
- }
869
- 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(
870
- CustomModal2_default,
871
- {
872
- open: show,
873
- onClose: () => setShow(false),
874
- maxWidth: "500px"
875
- },
876
- /* @__PURE__ */ React6.createElement("div", { style: { maxWidth: "500px" } }, /* @__PURE__ */ React6.createElement("div", { className: "request-payment-amount-detail frac-form" }, /* @__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", { clipPath: "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("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(
877
- "input",
878
- {
879
- className: "request-payment-input-box",
880
- type: "text",
881
- placeholder: "Full Name",
882
- "data-token": "name",
883
- onChange: handleChange,
884
- value: requestDetails == null ? void 0 : requestDetails.name
885
- }
886
- ), 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(
887
- PatternFormat,
888
- {
889
- className: "request-payment-input-box",
890
- placeholder: "Mobile number",
891
- format: "+1 (###) ###-####",
892
- value: phone,
893
- onValueChange: (e) => {
894
- handlePhoneChange(e);
895
- }
896
- }
897
- ), 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(
898
- "input",
899
- {
900
- className: "request-payment-input-box",
901
- type: "text",
902
- placeholder: "Email",
903
- onChange: handleChange,
904
- "data-token": "email",
905
- value: requestDetails == null ? void 0 : requestDetails.email
906
- }
907
- ), errors.email && /* @__PURE__ */ React6.createElement("small", { className: "request-payment-error-msg" }, errors.email)), /* @__PURE__ */ React6.createElement(
908
- "button",
909
- {
910
- type: "button",
911
- className: "request-payment-submit-button",
912
- onClick: sendRequestPayment,
913
- disabled: loading
914
- },
915
- loading ? "Loading..." : "Send Request"
916
- ), /* @__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" })))))
917
- ), /* @__PURE__ */ React6.createElement(
918
- CustomModal2_default,
919
- {
920
- open: showConfirmationModal,
921
- onClose: handleCloseConfirmationModal,
922
- maxWidth: "500px"
923
- },
924
- /* @__PURE__ */ React6.createElement("div", { className: "fractal-popup-content", style: { padding: "0px", maxWidth: "500px" } }, /* @__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", { clipPath: "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"))))
925
- )));
926
- }
927
578
 
928
- // src/app/components/RequestPayment/RequestPreAuthPayment.tsx
929
- import "bootstrap/dist/js/bootstrap.bundle.min.js";
930
- import React7, { useState as useState2, useEffect as useEffect2 } from "react";
931
- import axios2 from "axios";
932
- import { PatternFormat as PatternFormat2 } from "react-number-format";
933
- function RequestPreAuthPayment(props) {
934
- const fractalpayClientKey = props.fractalpayClientKey;
935
- const discount = props == null ? void 0 : props.discount;
936
- const tax = props == null ? void 0 : props.tax;
937
- const surcharge = props == null ? void 0 : props.surcharge;
938
- const [show, setShow] = useState2(false);
939
- const [loading, setLoading] = useState2(false);
940
- const [errors, setErrors] = useState2({});
941
- const [phone, setPhone] = useState2(null);
942
- const [requestDetails, setRequestDetails] = useState2({
943
- email: "",
944
- phone_number: "",
945
- order_id: "",
946
- name: "",
947
- fractalpayPublicKey: fractalpayClientKey
948
- });
949
- const [amount, setAmount] = useState2("");
950
- const [showConfirmationModal, setShowConfirmationModal] = useState2(false);
951
- const [apiResponse, setApiResponse] = useState2(null);
952
- const phoneNumberRegex = (value) => /^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(value);
953
- const amoutRegex = /[+-]?([0-9]*[.])?[0-9]+/;
954
- const isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
955
- const isAlpha = (value) => /^[A-Za-z\s]*$/.test(value);
956
- const handleClose = () => {
957
- setShow(false);
958
- setErrors({});
959
- };
960
- const handleShow = () => setShow(true);
961
- const handleCloseConfirmationModal = () => {
962
- console.log(apiResponse, "apiresponse");
963
- handleSubmit(apiResponse);
964
- setShowConfirmationModal(false);
965
- };
966
- function emptyFields() {
967
- setRequestDetails({
968
- email: "",
969
- phone_number: "",
970
- order_id: "",
971
- name: "",
972
- fractalpayPublicKey: fractalpayClientKey
973
- });
974
- setAmount("");
975
- }
976
- function handleSubmit(event) {
977
- let message = {
978
- type: "preview.compiledcheck",
979
- other: __spreadProps(__spreadValues({}, event), { status: true })
980
- };
981
- window.parent.postMessage(message, "*");
982
- }
983
- const sendRequestPayment = async () => {
984
- if (Object.keys(errors).length > 0) {
985
- return;
986
- }
987
- setErrors({});
988
- if (!(requestDetails == null ? void 0 : requestDetails.email) && phone && !phoneNumberRegex(phone)) {
989
- setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
990
- phone: ErrorText.phonenumbervalid
991
- }));
992
- return;
993
- }
994
- if (!validateForm()) {
995
- return;
996
- }
997
- try {
998
- setLoading(true);
999
- const formData = {
1000
- fractalpayPublicKey: fractalpayClientKey,
1001
- amount,
1002
- phone_number: phone,
1003
- order_id: requestDetails.order_id,
1004
- action: "request",
1005
- name: requestDetails.name,
1006
- email: requestDetails.email,
1007
- customer_id: (props == null ? void 0 : props.customerId) ? props == null ? void 0 : props.customerId : "",
1008
- discount,
1009
- surcharge,
1010
- tax,
1011
- require_3ds: props == null ? void 0 : props.require_3ds
1012
- };
1013
- let response = await axios2.post(`${baseUrl}send-request-pre-auth-payment`, formData);
1014
- if ((response == null ? void 0 : response.status) === 200) {
1015
- setShowConfirmationModal(true);
1016
- setShow(false);
1017
- emptyFields();
1018
- setApiResponse(response == null ? void 0 : response.data);
1019
- }
1020
- setLoading(false);
1021
- } catch (error) {
1022
- console.log(error);
1023
- setLoading(false);
1024
- }
1025
- };
1026
- let favicon_logo = baseUrl + "images/logo-img.png";
1027
- const handleChange = (e) => {
1028
- const { value } = e.target;
1029
- const token = e.target.dataset.token;
1030
- setRequestDetails(__spreadProps(__spreadValues({}, requestDetails), { [token]: value }));
1031
- if (token === "name" && !isAlpha(value)) {
1032
- setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
1033
- [token]: ErrorText.onlylettersallowed
1034
- }));
1035
- return;
1036
- }
1037
- let errorobj = errors;
1038
- if (token === "email" && !phone) {
1039
- delete errorobj.phone;
1040
- setErrors(errorobj);
1041
- }
1042
- if (value) {
1043
- delete errorobj[token];
1044
- setErrors(errorobj);
1045
- }
1046
- if (token === "email" && !value) {
1047
- delete errorobj[token];
1048
- setErrors(errorobj);
1049
- }
1050
- };
1051
- const handleAmountChange = (data) => {
1052
- const { value } = data;
1053
- if (Number(value) > 0) {
1054
- let errorobj = errors;
1055
- delete errorobj.amount;
1056
- setErrors(errorobj);
1057
- }
1058
- setAmount(value);
1059
- };
1060
- const validateForm = () => {
1061
- let newErrors = {};
1062
- if (!amount) newErrors.amount = ErrorText.amountrequired;
1063
- if (requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
1064
- if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.phone = ErrorText.phoneoremailrequired;
1065
- if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.phoneoremailrequired;
1066
- if (!phone && requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
1067
- if (props.from === "merchant" && !requestDetails.order_id) newErrors.order_id = ErrorText.orderidrequired;
1068
- setErrors(newErrors);
1069
- return Object.keys(newErrors).length === 0;
1070
- };
1071
- useEffect2(() => {
1072
- if (props) {
1073
- setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), {
1074
- order_id: props.orderID ? props.orderID : "",
1075
- name: (props == null ? void 0 : props.name) ? props == null ? void 0 : props.name : "",
1076
- email: (props == null ? void 0 : props.email) ? props == null ? void 0 : props.email : ""
1077
- }));
1078
- setAmount(props.amount ? props.amount : "");
1079
- setPhone(props.phone ? `${props.phone}` : null);
1080
- }
1081
- }, [props]);
1082
- const handlePhoneChange = (e) => {
1083
- let value = e == null ? void 0 : e.value;
1084
- if (value && (value == null ? void 0 : value.length) > 0 && (value == null ? void 0 : value.length) !== 10) {
1085
- setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
1086
- phone: ErrorText.phonenumberlength
1087
- }));
1088
- setPhone(value);
1089
- return;
1090
- } else {
1091
- setPhone(value);
1092
- }
1093
- let errorobj = errors;
1094
- delete errorobj.phone;
1095
- if (value && !(requestDetails == null ? void 0 : requestDetails.email)) {
1096
- delete errorobj.email;
1097
- }
1098
- setErrors(errorobj);
1099
- };
1100
- function formatAmount(amount2) {
1101
- return new Intl.NumberFormat("en-US", {
1102
- style: "currency",
1103
- currency: "USD",
1104
- minimumFractionDigits: 2,
1105
- maximumFractionDigits: 2
1106
- }).format(Number(amount2));
1107
- }
1108
- return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(RequestPaymentstyles_default, null), /* @__PURE__ */ React7.createElement(Loader_default, { loading }), /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("button", { className: "paymentBtn", onClick: handleShow }, "Send Request"), /* @__PURE__ */ React7.createElement("div", { className: "frac-form" }, /* @__PURE__ */ React7.createElement(
1109
- CustomModal2_default,
1110
- {
1111
- open: show,
1112
- onClose: () => setShow(false),
1113
- maxWidth: "500px"
1114
- },
1115
- /* @__PURE__ */ React7.createElement("div", { className: "request-payment-amount-detail" }, /* @__PURE__ */ React7.createElement("p", { className: "request-payment-merchantname" }, "Authorization Request"), /* @__PURE__ */ React7.createElement("p", { className: "request-payment-pre-auth-merchantname" }, "Pay ", props == null ? void 0 : props.webname), /* @__PURE__ */ React7.createElement("p", { className: "request-payment-amount" }, formatAmount(props == null ? void 0 : props.amount)), (props == null ? void 0 : props.from) === "merchant" && /* @__PURE__ */ React7.createElement("p", { className: "request-payment-orderid" }, requestDetails == null ? void 0 : requestDetails.order_id), /* @__PURE__ */ React7.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React7.createElement("g", { clipPath: "url(#clip0_12425_52336)" }, /* @__PURE__ */ React7.createElement("path", { d: "M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z", fill: "#727272" })), /* @__PURE__ */ React7.createElement("defs", null, /* @__PURE__ */ React7.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React7.createElement("rect", { width: "16", height: "16", fill: "white" })))))),
1116
- /* @__PURE__ */ React7.createElement("form", { className: "request-payment-input-form" }, /* @__PURE__ */ React7.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React7.createElement("label", { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "FULL NAME"), /* @__PURE__ */ React7.createElement(
1117
- "input",
1118
- {
1119
- className: "request-payment-input-box",
1120
- type: "text",
1121
- placeholder: "Full Name",
1122
- "data-token": "name",
1123
- onChange: handleChange,
1124
- value: requestDetails == null ? void 0 : requestDetails.name
1125
- }
1126
- ), errors.name && /* @__PURE__ */ React7.createElement("small", { className: "request-payment-error-msg" }, errors.name)), /* @__PURE__ */ React7.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React7.createElement("label", { htmlFor: "requestPhoneNumber", className: "request-payment-input-label" }, "Phone Number"), /* @__PURE__ */ React7.createElement(
1127
- PatternFormat2,
1128
- {
1129
- className: "request-payment-input-box",
1130
- placeholder: "Mobile number",
1131
- format: "+1 (###) ###-####",
1132
- value: phone,
1133
- onValueChange: (e) => {
1134
- handlePhoneChange(e);
1135
- }
1136
- }
1137
- ), errors.phone && /* @__PURE__ */ React7.createElement("small", { className: "request-payment-error-msg" }, errors.phone)), /* @__PURE__ */ React7.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React7.createElement("label", { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "EMAIL"), /* @__PURE__ */ React7.createElement(
1138
- "input",
1139
- {
1140
- className: "request-payment-input-box",
1141
- type: "text",
1142
- placeholder: "Email",
1143
- onChange: handleChange,
1144
- "data-token": "email",
1145
- value: requestDetails == null ? void 0 : requestDetails.email
1146
- }
1147
- ), errors.email && /* @__PURE__ */ React7.createElement("small", { className: "request-payment-error-msg" }, errors.email)), /* @__PURE__ */ React7.createElement(
1148
- "button",
1149
- {
1150
- type: "button",
1151
- className: "request-payment-submit-button",
1152
- onClick: sendRequestPayment,
1153
- disabled: loading
1154
- },
1155
- loading ? "Loading..." : "Send Request"
1156
- ), /* @__PURE__ */ React7.createElement("div", { className: "request-payment-fractal-powerd-by" }, /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "17", height: "16", viewBox: "0 0 17 16", fill: "none" }, /* @__PURE__ */ React7.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__ */ React7.createElement("span", null, "Fractal"), /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18", fill: "none" }, /* @__PURE__ */ React7.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__ */ React7.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__ */ React7.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__ */ React7.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__ */ React7.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__ */ React7.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__ */ React7.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__ */ React7.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__ */ React7.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__ */ React7.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__ */ React7.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__ */ React7.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__ */ React7.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__ */ React7.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__ */ React7.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__ */ React7.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__ */ React7.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__ */ React7.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" }))))
1157
- ), /* @__PURE__ */ React7.createElement(
1158
- CustomModal2_default,
1159
- {
1160
- open: showConfirmationModal,
1161
- onClose: handleCloseConfirmationModal,
1162
- maxWidth: "500px"
1163
- },
1164
- /* @__PURE__ */ React7.createElement("div", { className: "fractal-popup-content", style: { padding: "0px", maxWidth: "500px" } }, /* @__PURE__ */ React7.createElement("div", { className: "request-payment-success-container" }, /* @__PURE__ */ React7.createElement("span", { className: "request-payment-close-popup", onClick: handleCloseConfirmationModal }, /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React7.createElement("g", { clipPath: "url(#clip0_12425_52336)" }, /* @__PURE__ */ React7.createElement("path", { d: "M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z", fill: "#727272" })), /* @__PURE__ */ React7.createElement("defs", null, /* @__PURE__ */ React7.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React7.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React7.createElement("div", { className: "request-payment-success-tick-div" }, /* @__PURE__ */ React7.createElement("div", { className: "request-payment-success-tick" }, /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React7.createElement("path", { d: "M6.12669 13.9774C5.97396 14.131 5.76558 14.2167 5.54913 14.2167C5.33267 14.2167 5.1243 14.131 4.97157 13.9774L0.359012 9.36408C-0.119671 8.8854 -0.119671 8.10919 0.359012 7.6314L0.936573 7.05369C1.4154 6.57501 2.19072 6.57501 2.6694 7.05369L5.54913 9.93357L13.3306 2.15198C13.8094 1.6733 14.5855 1.6733 15.0634 2.15198L15.641 2.72969C16.1196 3.20837 16.1196 3.98444 15.641 4.46237L6.12669 13.9774Z", fill: "#61C699" })))), /* @__PURE__ */ React7.createElement("h6", { className: "request-payment-success-text" }, "The request ", /* @__PURE__ */ React7.createElement("br", null), "was sent"), /* @__PURE__ */ React7.createElement("h6", { className: "request-payment-success-subtext" }, "Please wait for the customer to pay"), /* @__PURE__ */ React7.createElement("div", { className: "request-payment-success-btn-div" }, /* @__PURE__ */ React7.createElement("button", { onClick: handleCloseConfirmationModal, className: "request-payment-success-btn2" }, "Close"))))
1165
- ))));
579
+ .frac-req-cash-discount{
580
+ justify-content: center;
581
+ gap: 8px;
582
+ align-items: center;
583
+ display: flex;
584
+ padding: 9px 14px 9px 10px;
585
+ font-family: Inter;
586
+ color: #161616;
587
+ font-style: normal;
588
+ font-weight: 500;
589
+ font-size: 14px;
1166
590
  }
1167
591
 
1168
- // src/app/components/Charge/GetPaymentPage.tsx
1169
- import React13, { useEffect as useEffect4, useState as useState3 } from "react";
1170
-
1171
- // src/app/components/Charge/Chargewidgetstyles.tsx
1172
- import React8 from "react";
1173
- function Chargewidgetstyles() {
1174
- const primarycolor = "#000";
1175
- const primarybgcolor = "#fff";
1176
- const primarybodycolor = "#212529";
1177
- const primarybordercolor = "#dee2e6";
1178
- return /* @__PURE__ */ React8.createElement("style", null, `
592
+ .frac-req-cash-discount .frac-cashlabel{
593
+ color: #727272;
594
+ font-size: 12px;
595
+ font-style: normal;
596
+ font-weight: 500;
597
+ }
598
+ `),_n=fi;function xi(e){let y=e.merchantPublicKey,T=e==null?void 0:e.discount,O=e==null?void 0:e.tax,Y=e==null?void 0:e.surcharge,[Te,I]=Xt(!1),[Ge,Pe]=Xt(!1),[de,o]=Xt({}),[X,b]=Xt(null),[c,h]=Xt({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:y}),[Ie,Z]=Xt(void 0),[x,ke]=Xt(""),[Q,Le]=Xt(!1),[u,st]=Xt(null),W=s=>/^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(s),lt=/[+-]?([0-9]*[.])?[0-9]+/,v=s=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s),qe=s=>/^[A-Za-z\s]*$/.test(s),U=(s,V)=>{let A=(parseFloat(V)||0)/100,xe=s/(1+A);return Math.round(xe*100)/100};Gn(()=>{if(e!=null&&e.pass_fee){let s=U(e==null?void 0:e.amount,e==null?void 0:e.surcharge);Z(s)}},[e==null?void 0:e.pass_fee]);let N=()=>{I(!1),o({})},f=()=>I(!0),ge=()=>{console.log(u,"apiresponse"),p(u),Le(!1)};function ce(){h({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:y}),ke("")}function p(s){let V={type:"preview.compiledcheck",other:z(k({},s),{status:!0})};window.parent.postMessage(V,"*")}let m=async()=>{if(!(Object.keys(de).length>0)){if(o({}),!(c!=null&&c.email)&&X&&!W(X)){o(s=>z(k({},s),{phone:Qe.phonenumbervalid}));return}if(M())try{Pe(!0);let s={fractalpayPublicKey:y,amount:x,phone_number:X,order_id:c.order_id,action:"request",name:c.name,email:c.email,customer_id:e!=null&&e.customerId?e==null?void 0:e.customerId:"",discount:T,surcharge:Y,tax:O,require_3ds:e==null?void 0:e.require_3ds,pass_fee:e==null?void 0:e.pass_fee},V=await hi.post(`${ze}create-widget-order`,s);(V==null?void 0:V.status)===200&&(Le(!0),I(!1),ce(),st(V==null?void 0:V.data)),Pe(!1)}catch(s){console.log(s),Pe(!1)}}},G=ze+"images/logo-img.png",q=s=>{let{value:V}=s.target,A=s.target.dataset.token;if(h(z(k({},c),{[A]:V})),A==="name"&&!qe(V)){o(J=>z(k({},J),{[A]:Qe.onlylettersallowed}));return}let xe=de;A==="email"&&!X&&(delete xe.phone,o(xe)),V&&(delete xe[A],o(xe)),A==="email"&&!V&&(delete xe[A],o(xe))},g=s=>{let{value:V}=s;if(Number(V)>0){let A=de;delete A.amount,o(A)}ke(V)},M=()=>{let s={};return x||(s.amount=Qe.amountrequired),c.email&&!v(c==null?void 0:c.email)&&(s.email=Qe.invalidemail),!X&&!(c!=null&&c.email)&&(s.phone=Qe.phoneoremailrequired),!X&&!(c!=null&&c.email)&&(s.email=Qe.phoneoremailrequired),!X&&c.email&&!v(c==null?void 0:c.email)&&(s.email=Qe.invalidemail),e.from==="merchant"&&!c.order_id&&(s.order_id=Qe.orderidrequired),o(s),Object.keys(s).length===0};Gn(()=>{e&&(h(s=>z(k({},s),{order_id:e.orderID?e.orderID:"",name:e!=null&&e.name?e==null?void 0:e.name:"",email:e!=null&&e.email?e==null?void 0:e.email:""})),ke(e.amount?e.amount:""),b(e.phone?`${e.phone}`:null))},[e]);let d=s=>{let V=s==null?void 0:s.value;if(V&&(V==null?void 0:V.length)>0&&(V==null?void 0:V.length)!==10){o(xe=>z(k({},xe),{phone:Qe.phonenumberlength})),b(V);return}else b(V);let A=de;delete A.phone,V&&!(c!=null&&c.email)&&delete A.email,o(A)};function E(s){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(s))}return _.createElement(_.Fragment,null,_.createElement(_n,null),_.createElement(Nt,{loading:Ge}),_.createElement(_.Fragment,null,_.createElement("button",{className:"paymentBtn",onClick:f},"Request Payment"),_.createElement($t,{open:Te,onClose:()=>I(!1),maxWidth:"500px"},_.createElement("div",{style:{maxWidth:"500px"}},_.createElement("div",{className:"request-payment-amount-detail frac-form"},_.createElement("p",{className:"request-payment-merchantname"},"Pay ",e==null?void 0:e.webname),_.createElement("p",{className:"request-payment-amount"},E(e==null?void 0:e.amount)),Ie&&Ie>0&&_.createElement("div",{className:"frac-req-cash-discount"},_.createElement("div",{className:"frac-cashlabel"},"Cash Discount :"),_.createElement("div",null,"$",Ie.toFixed(2))),(e==null?void 0:e.from)==="merchant"&&_.createElement("p",{className:"request-payment-orderid"},c==null?void 0:c.order_id),_.createElement("span",{className:"request-payment-close-popup",onClick:N},_.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},_.createElement("g",{clipPath:"url(#clip0_12425_52336)"},_.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"})),_.createElement("defs",null,_.createElement("clipPath",{id:"clip0_12425_52336"},_.createElement("rect",{width:"16",height:"16",fill:"white"})))))),_.createElement("form",{className:"request-payment-input-form"},_.createElement("div",{className:"request-payment-list-div"},_.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"FULL NAME"),_.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Full Name","data-token":"name",onChange:q,value:c==null?void 0:c.name}),de.name&&_.createElement("small",{className:"request-payment-error-msg"},de.name)),_.createElement("div",{className:"request-payment-list-div"},_.createElement("label",{htmlFor:"requestPhoneNumber",className:"request-payment-input-label"},"Phone Number"),_.createElement(yi,{className:"request-payment-input-box",placeholder:"Mobile number",format:"+1 (###) ###-####",value:X,onValueChange:s=>{d(s)}}),de.phone&&_.createElement("small",{className:"request-payment-error-msg"},de.phone)),_.createElement("div",{className:"request-payment-list-div"},_.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"EMAIL"),_.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Email",onChange:q,"data-token":"email",value:c==null?void 0:c.email}),de.email&&_.createElement("small",{className:"request-payment-error-msg"},de.email)),_.createElement("button",{type:"button",className:"request-payment-submit-button",onClick:m,disabled:Ge},Ge?"Loading...":"Send Request"),_.createElement("div",{className:"request-payment-fractal-powerd-by"},_.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},_.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 ",_.createElement("span",null,"Fractal"),_.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"})))))),_.createElement($t,{open:Q,onClose:ge,maxWidth:"500px"},_.createElement("div",{className:"fractal-popup-content",style:{padding:"0px",maxWidth:"500px"}},_.createElement("div",{className:"request-payment-success-container"},_.createElement("span",{className:"request-payment-close-popup",onClick:ge},_.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},_.createElement("g",{clipPath:"url(#clip0_12425_52336)"},_.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"})),_.createElement("defs",null,_.createElement("clipPath",{id:"clip0_12425_52336"},_.createElement("rect",{width:"16",height:"16",fill:"white"}))))),_.createElement("div",{className:"request-payment-success-tick-div"},_.createElement("div",{className:"request-payment-success-tick"},_.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},_.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"})))),_.createElement("h6",{className:"request-payment-success-text"},"The request ",_.createElement("br",null),"was sent"),_.createElement("h6",{className:"request-payment-success-subtext"},"Please wait for the customer to pay"),_.createElement("div",{className:"request-payment-success-btn-div"},_.createElement("button",{onClick:ge,className:"request-payment-success-btn2"},"Close")))))))}import"bootstrap/dist/js/bootstrap.bundle.min.js";import S,{useState as en,useEffect as bi}from"react";import vi from"axios";import{PatternFormat as Ci}from"react-number-format";function wi(e){let y=e.merchantPublicKey,T=e==null?void 0:e.discount,O=e==null?void 0:e.tax,Y=e==null?void 0:e.surcharge,[Te,I]=en(!1),[Ge,Pe]=en(!1),[de,o]=en({}),[X,b]=en(null),[c,h]=en({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:y}),[Ie,Z]=en(""),[x,ke]=en(!1),[Q,Le]=en(null),u=M=>/^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(M),st=/[+-]?([0-9]*[.])?[0-9]+/,W=M=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(M),lt=M=>/^[A-Za-z\s]*$/.test(M),v=()=>{I(!1),o({})},qe=()=>I(!0),U=()=>{console.log(Q,"apiresponse"),f(Q),ke(!1)};function N(){h({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:y}),Z("")}function f(M){let d={type:"preview.compiledcheck",other:z(k({},M),{status:!0})};window.parent.postMessage(d,"*")}let ge=async()=>{if(!(Object.keys(de).length>0)){if(o({}),!(c!=null&&c.email)&&X&&!u(X)){o(M=>z(k({},M),{phone:Qe.phonenumbervalid}));return}if(G())try{Pe(!0);let M={fractalpayPublicKey:y,amount:Ie,phone_number:X,order_id:c.order_id,action:"request",name:c.name,email:c.email,customer_id:e!=null&&e.customerId?e==null?void 0:e.customerId:"",discount:T,surcharge:Y,tax:O,require_3ds:e==null?void 0:e.require_3ds},d=await vi.post(`${ze}send-request-pre-auth-payment`,M);(d==null?void 0:d.status)===200&&(ke(!0),I(!1),N(),Le(d==null?void 0:d.data)),Pe(!1)}catch(M){console.log(M),Pe(!1)}}},ce=ze+"images/logo-img.png",p=M=>{let{value:d}=M.target,E=M.target.dataset.token;if(h(z(k({},c),{[E]:d})),E==="name"&&!lt(d)){o(V=>z(k({},V),{[E]:Qe.onlylettersallowed}));return}let s=de;E==="email"&&!X&&(delete s.phone,o(s)),d&&(delete s[E],o(s)),E==="email"&&!d&&(delete s[E],o(s))},m=M=>{let{value:d}=M;if(Number(d)>0){let E=de;delete E.amount,o(E)}Z(d)},G=()=>{let M={};return Ie||(M.amount=Qe.amountrequired),c.email&&!W(c==null?void 0:c.email)&&(M.email=Qe.invalidemail),!X&&!(c!=null&&c.email)&&(M.phone=Qe.phoneoremailrequired),!X&&!(c!=null&&c.email)&&(M.email=Qe.phoneoremailrequired),!X&&c.email&&!W(c==null?void 0:c.email)&&(M.email=Qe.invalidemail),e.from==="merchant"&&!c.order_id&&(M.order_id=Qe.orderidrequired),o(M),Object.keys(M).length===0};bi(()=>{e&&(h(M=>z(k({},M),{order_id:e.orderID?e.orderID:"",name:e!=null&&e.name?e==null?void 0:e.name:"",email:e!=null&&e.email?e==null?void 0:e.email:""})),Z(e.amount?e.amount:""),b(e.phone?`${e.phone}`:null))},[e]);let q=M=>{let d=M==null?void 0:M.value;if(d&&(d==null?void 0:d.length)>0&&(d==null?void 0:d.length)!==10){o(s=>z(k({},s),{phone:Qe.phonenumberlength})),b(d);return}else b(d);let E=de;delete E.phone,d&&!(c!=null&&c.email)&&delete E.email,o(E)};function g(M){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(M))}return S.createElement(S.Fragment,null,S.createElement(_n,null),S.createElement(Nt,{loading:Ge}),S.createElement(S.Fragment,null,S.createElement("button",{className:"paymentBtn",onClick:qe},"Send Request"),S.createElement("div",{className:"frac-form"},S.createElement($t,{open:Te,onClose:()=>I(!1),maxWidth:"500px"},S.createElement("div",{className:"request-payment-amount-detail"},S.createElement("p",{className:"request-payment-merchantname"},"Authorization Request"),S.createElement("p",{className:"request-payment-pre-auth-merchantname"},"Pay ",e==null?void 0:e.webname),S.createElement("p",{className:"request-payment-amount"},g(e==null?void 0:e.amount)),(e==null?void 0:e.from)==="merchant"&&S.createElement("p",{className:"request-payment-orderid"},c==null?void 0:c.order_id),S.createElement("span",{className:"request-payment-close-popup",onClick:v},S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},S.createElement("g",{clipPath:"url(#clip0_12425_52336)"},S.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"})),S.createElement("defs",null,S.createElement("clipPath",{id:"clip0_12425_52336"},S.createElement("rect",{width:"16",height:"16",fill:"white"})))))),S.createElement("form",{className:"request-payment-input-form"},S.createElement("div",{className:"request-payment-list-div"},S.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"FULL NAME"),S.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Full Name","data-token":"name",onChange:p,value:c==null?void 0:c.name}),de.name&&S.createElement("small",{className:"request-payment-error-msg"},de.name)),S.createElement("div",{className:"request-payment-list-div"},S.createElement("label",{htmlFor:"requestPhoneNumber",className:"request-payment-input-label"},"Phone Number"),S.createElement(Ci,{className:"request-payment-input-box",placeholder:"Mobile number",format:"+1 (###) ###-####",value:X,onValueChange:M=>{q(M)}}),de.phone&&S.createElement("small",{className:"request-payment-error-msg"},de.phone)),S.createElement("div",{className:"request-payment-list-div"},S.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"EMAIL"),S.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Email",onChange:p,"data-token":"email",value:c==null?void 0:c.email}),de.email&&S.createElement("small",{className:"request-payment-error-msg"},de.email)),S.createElement("button",{type:"button",className:"request-payment-submit-button",onClick:ge,disabled:Ge},Ge?"Loading...":"Send Request"),S.createElement("div",{className:"request-payment-fractal-powerd-by"},S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},S.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 ",S.createElement("span",null,"Fractal"),S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},S.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"}),S.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"}),S.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"}),S.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"}),S.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"}),S.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"}),S.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"}),S.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"}),S.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"}),S.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"}),S.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"}),S.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"}),S.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"}),S.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"}),S.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"}),S.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"}),S.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"}),S.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"}))))),S.createElement($t,{open:x,onClose:U,maxWidth:"500px"},S.createElement("div",{className:"fractal-popup-content",style:{padding:"0px",maxWidth:"500px"}},S.createElement("div",{className:"request-payment-success-container"},S.createElement("span",{className:"request-payment-close-popup",onClick:U},S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},S.createElement("g",{clipPath:"url(#clip0_12425_52336)"},S.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"})),S.createElement("defs",null,S.createElement("clipPath",{id:"clip0_12425_52336"},S.createElement("rect",{width:"16",height:"16",fill:"white"}))))),S.createElement("div",{className:"request-payment-success-tick-div"},S.createElement("div",{className:"request-payment-success-tick"},S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},S.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"})))),S.createElement("h6",{className:"request-payment-success-text"},"The request ",S.createElement("br",null),"was sent"),S.createElement("h6",{className:"request-payment-success-subtext"},"Please wait for the customer to pay"),S.createElement("div",{className:"request-payment-success-btn-div"},S.createElement("button",{onClick:U,className:"request-payment-success-btn2"},"Close"))))))))}import t,{useEffect as Dn,useState as Ee}from"react";import Ni from"react";function gn(){let e="#000",y="#fff",T="#212529",O="#dee2e6";return Ni.createElement("style",null,`
1179
599
  @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
1180
600
  body
1181
601
  {
@@ -1297,7 +717,7 @@ function Chargewidgetstyles() {
1297
717
  border-radius: 5px;
1298
718
  box-shadow: inherit;
1299
719
  outline: none;
1300
- color: ${primarycolor};
720
+ color: ${e};
1301
721
  }
1302
722
 
1303
723
  /* Change background color of buttons on hover */
@@ -1314,7 +734,7 @@ function Chargewidgetstyles() {
1314
734
 
1315
735
 
1316
736
  .parent-pay-container{
1317
- padding: 20px 10% ;
737
+ padding: 24px;
1318
738
  }
1319
739
  .pay-container{
1320
740
  display: grid;
@@ -1404,13 +824,13 @@ function Chargewidgetstyles() {
1404
824
  font-size: 1rem;
1405
825
  font-weight: 400;
1406
826
  line-height: 1.5;
1407
- color: ${primarybodycolor};
827
+ color: ${T};
1408
828
  -webkit-appearance: none;
1409
829
  -moz-appearance: none;
1410
830
  appearance: none;
1411
- background-color: ${primarybgcolor};
831
+ background-color: ${y};
1412
832
  background-clip: padding-box;
1413
- border: 1px solid ${primarybordercolor};
833
+ border: 1px solid ${O};
1414
834
  border-radius: 0.375rem;
1415
835
  transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
1416
836
  }
@@ -1428,7 +848,7 @@ function Chargewidgetstyles() {
1428
848
  }
1429
849
  .card-crdi {
1430
850
  display: flex;
1431
- border: 1px solid ${primarybordercolor};
851
+ border: 1px solid ${O};
1432
852
  border-radius: 0.375rem;
1433
853
  }
1434
854
  .card-expiry-new{
@@ -1454,7 +874,7 @@ function Chargewidgetstyles() {
1454
874
  border-top-right-radius: 0;
1455
875
  border-bottom-right-radius: 0;
1456
876
  border: 0;
1457
- border-right: 1px solid ${primarybordercolor};
877
+ border-right: 1px solid ${O};
1458
878
  }
1459
879
 
1460
880
 
@@ -1468,7 +888,7 @@ function Chargewidgetstyles() {
1468
888
  border-radius: 0;
1469
889
  border-top: 0;
1470
890
  border-bottom: 0;
1471
- border-right: 1px solid ${primarybordercolor};
891
+ border-right: 1px solid ${O};
1472
892
  }
1473
893
 
1474
894
  .exp-date input:focus {
@@ -1654,20 +1074,19 @@ function Chargewidgetstyles() {
1654
1074
  font-weight: 500;
1655
1075
  line-height: 24px;
1656
1076
  letter-spacing: -0.28px;
1657
- margin-bottom: 50px;
1077
+ // margin-bottom: 50px;
1658
1078
  }
1659
1079
  .charge-payment-back-btn {
1660
1080
  display: flex;
1661
- padding: 9px 16px;
1081
+ padding: 5px 10px;
1662
1082
  align-items: center;
1663
1083
  gap: 6px;
1664
- margin-bottom: 20px;
1665
1084
  border-radius: 1000px;
1666
1085
  border: 1px solid #E0DFE2;
1667
1086
  background: #FFF;
1668
1087
  box-shadow: 0px 6px 12px 0px rgba(206, 197, 221, 0.31);
1669
1088
  font-size:16px;
1670
- curso:pointer;
1089
+ cursor:pointer;
1671
1090
  color:black
1672
1091
  }
1673
1092
  .res-charge-payment-back-btn{
@@ -1708,6 +1127,27 @@ function Chargewidgetstyles() {
1708
1127
  display:none
1709
1128
  }
1710
1129
 
1130
+ .frac-cash-discount{
1131
+ border-radius: 8px;
1132
+ background: #F6F6F7;
1133
+ justify-content: space-between;
1134
+ align-items: center;
1135
+ display: flex;
1136
+ padding: 9px 14px 9px 10px;
1137
+ font-family: Inter;
1138
+ color: #161616;
1139
+ font-style: normal;
1140
+ font-weight: 500;
1141
+ font-size: 14px;
1142
+ margin: 12px 0;
1143
+ }
1144
+ .frac-cash-discount .frac-cashlabel{
1145
+ color: #727272;
1146
+ font-size: 12px;
1147
+ font-style: normal;
1148
+ font-weight: 500;
1149
+ }
1150
+
1711
1151
  @media (max-width: 768px) {
1712
1152
  .parent-pay-container{
1713
1153
  padding: 20px 5%;
@@ -1716,7 +1156,8 @@ function Chargewidgetstyles() {
1716
1156
  grid-template-columns: 1fr;
1717
1157
  padding: 10px 5%;
1718
1158
  border:1px solid #E0DFE2;
1719
- border-radius : 12px
1159
+ border-radius : 12px;
1160
+ gap:24px;
1720
1161
  }
1721
1162
  .pay-conatiner-one{
1722
1163
  border-right: none;
@@ -1735,53 +1176,93 @@ function Chargewidgetstyles() {
1735
1176
  .pay-logo-container{
1736
1177
  border :none
1737
1178
  }
1738
- .res-charge-payment-back-btn {
1739
- display:flex !important
1740
- }
1741
- .charge-payment-back-btn{
1742
- display:none !important
1743
- }
1744
- .frac-form .res-pay-con{
1745
- display:flex;
1746
- justify-content :space-between;
1747
- align-items:center;
1748
- padding-bottom : 10px
1749
- }
1750
- .frac-form .amt-pay-con{
1751
- display:none
1752
- }
1179
+ // .res-charge-payment-back-btn {
1180
+ // display:flex !important
1181
+ // }
1182
+ // .charge-payment-back-btn{
1183
+ // display:none !important
1184
+ // }
1185
+ .fractal-popup-content{
1186
+ width: 90%;
1187
+ }
1188
+ // .frac-form .res-pay-con{
1189
+ // display:flex;
1190
+ // justify-content :space-between;
1191
+ // align-items:center;
1192
+ // padding-bottom : 10px
1193
+ // }
1194
+ // .frac-form .amt-pay-con{
1195
+ // display:none
1196
+ // }
1753
1197
  .pay-conatiner-one-last{
1754
1198
  display:none}
1755
1199
  .pay-conatiner-two{
1756
1200
  padding:0
1757
1201
  }
1758
-
1202
+
1759
1203
 
1204
+ }
1205
+ .amt-pay-con {
1206
+ padding-right: 24px;
1760
1207
  }
1761
1208
  @media (max-width : 512px){
1762
1209
  .tab button {
1763
1210
  padding: 6px 16px;
1764
1211
  }
1212
+ .amt-pay-con {
1213
+ padding-right: 0;
1214
+ }
1765
1215
  }
1766
-
1767
-
1768
-
1769
-
1770
-
1771
-
1772
- `);
1773
- }
1774
-
1775
- // src/app/components/Charge/GetPaymentPage.tsx
1776
- import axios3 from "axios";
1777
-
1778
- // src/app/components/SuccessMessage/SuccessMsz.tsx
1779
- import React10 from "react";
1780
-
1781
- // src/app/components/SuccessMessage/SuccessMszStyle.tsx
1782
- import React9 from "react";
1783
- function SuccessMszStyle() {
1784
- return /* @__PURE__ */ React9.createElement("style", null, `
1216
+
1217
+
1218
+ .frac-cash-discount-fee {
1219
+ display: flex;
1220
+ padding: 11px;
1221
+ justify-content: space-between;
1222
+ align-items: center;
1223
+ align-self: stretch;
1224
+ border-radius: 8px;
1225
+ border: 1px solid #E0DFE2;
1226
+ background: #F6F6F7;
1227
+ margin-top: 24px;
1228
+ }
1229
+ .frac-cash-discount-fee small {
1230
+ color:#727272;
1231
+ font-size: 12px;
1232
+ font-weight: 500;
1233
+ }
1234
+ .frac-cash-discount-fee p{
1235
+ margin:0px;
1236
+ font-size: 14px;
1237
+ font-weight: 500;
1238
+ }
1239
+ .frac-card-payment-heading {
1240
+ font-size: 24px;
1241
+ font-style: normal;
1242
+ font-weight: 600;
1243
+ margin:0px;
1244
+ }
1245
+ .exp-date-year-container .form-group {
1246
+ padding: 0px !important;
1247
+ }
1248
+ .frac-heading-card-wrap {
1249
+ display: flex;
1250
+ align-items: center;
1251
+ margin-bottom:12px;
1252
+ }
1253
+ .frac-backarrow {
1254
+ margin-right: 10px;
1255
+ }
1256
+ .frac-charge-payment-back-btn-wrap , .frac-tab-2{
1257
+ display: none;
1258
+ }
1259
+ .frac-pay-conatiner-one{
1260
+ display: flex;
1261
+ flex-direction: column;
1262
+ justify-content: space-between;
1263
+ min-height: auto;
1264
+ }
1265
+ `)}import dn from"axios";import Ae from"react";import ki from"react";function zn(){return ki.createElement("style",null,`
1785
1266
  @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
1786
1267
 
1787
1268
  body{
@@ -1976,160 +1457,7 @@ function SuccessMszStyle() {
1976
1457
  gap: 6px;
1977
1458
  background-color: #161616;
1978
1459
  color: #fff;
1979
- }`);
1980
- }
1981
-
1982
- // src/app/components/SuccessMessage/HandleSubmit.tsx
1983
- function HandleSubmit(event, key, tranId) {
1984
- event.preventDefault();
1985
- const status = key === "close";
1986
- const message = {
1987
- type: "preview.compiledcheck",
1988
- other: {
1989
- msg: "Payment success!",
1990
- status,
1991
- data: {
1992
- tran_id: tranId,
1993
- key
1994
- }
1995
- }
1996
- };
1997
- console.log("message:", message);
1998
- window.parent.postMessage(message, "*");
1999
- }
2000
-
2001
- // src/app/components/SuccessMessage/SuccessMsz.tsx
2002
- function SuccessMsz({ onClose, tranId }) {
2003
- return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(SuccessMszStyle, null), /* @__PURE__ */ React10.createElement("div", { className: "payment-msg-container" }, /* @__PURE__ */ React10.createElement("div", { className: "charge-payment-success-container" }, /* @__PURE__ */ React10.createElement("div", { className: "charge-payment-success-tick-div" }, /* @__PURE__ */ React10.createElement("div", { className: "charge-payment-success-tick" }, /* @__PURE__ */ React10.createElement(
2004
- "svg",
2005
- {
2006
- xmlns: "http://www.w3.org/2000/svg",
2007
- width: "16",
2008
- height: "16",
2009
- viewBox: "0 0 16 16",
2010
- fill: "none"
2011
- },
2012
- /* @__PURE__ */ React10.createElement(
2013
- "path",
2014
- {
2015
- 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",
2016
- fill: "#61C699"
2017
- }
2018
- )
2019
- ))), /* @__PURE__ */ React10.createElement("h6", { className: "charge-payment-success-text" }, "Your charge", /* @__PURE__ */ React10.createElement("br", null), "was successful"), /* @__PURE__ */ React10.createElement("h6", { className: "charge-payment-success-subtext" }, "We\u2019ve processed your charge"), /* @__PURE__ */ React10.createElement("div", { className: "charge-success-payment-button-div" }, /* @__PURE__ */ React10.createElement("button", { className: "charge-success-btn1", onClick: (e) => HandleSubmit(e, "print", tranId) }, /* @__PURE__ */ React10.createElement(
2020
- "svg",
2021
- {
2022
- xmlns: "http://www.w3.org/2000/svg",
2023
- width: "17",
2024
- height: "16",
2025
- viewBox: "0 0 17 16",
2026
- fill: "none"
2027
- },
2028
- /* @__PURE__ */ React10.createElement(
2029
- "path",
2030
- {
2031
- d: "M15.7729 8.7272C15.58 8.7272 15.395 8.80383 15.2586 8.94022C15.1222 9.07661 15.0456 9.2616 15.0456 9.45448V12.5185C15.045 13.0559 14.8313 13.5711 14.4513 13.9511C14.0713 14.3311 13.5561 14.5449 13.0187 14.5454H3.98149C3.44409 14.5449 2.92887 14.3311 2.54887 13.9511C2.16887 13.5711 1.95514 13.0559 1.95456 12.5185V9.45448C1.95456 9.2616 1.87794 9.07661 1.74154 8.94022C1.60515 8.80383 1.42017 8.7272 1.22728 8.7272C1.03439 8.7272 0.849407 8.80383 0.713015 8.94022C0.576624 9.07661 0.5 9.2616 0.5 9.45448V12.5185C0.500963 13.4416 0.86807 14.3265 1.52077 14.9792C2.17346 15.6319 3.05844 15.999 3.98149 16H13.0187C13.9417 15.999 14.8267 15.6319 15.4794 14.9792C16.1321 14.3265 16.4992 13.4416 16.5002 12.5185V9.45448C16.5002 9.2616 16.4235 9.07661 16.2871 8.94022C16.1507 8.80383 15.9658 8.7272 15.7729 8.7272Z",
2032
- fill: "#161616"
2033
- }
2034
- ),
2035
- /* @__PURE__ */ React10.createElement(
2036
- "path",
2037
- {
2038
- d: "M4.65059 6.75861L7.7728 9.88082V0.72728C7.7728 0.534394 7.84942 0.349407 7.98581 0.213015C8.1222 0.0766239 8.30719 0 8.50008 0C8.69296 0 8.87795 0.0766239 9.01434 0.213015C9.15073 0.349407 9.22736 0.534394 9.22736 0.72728V9.88082L12.3496 6.75861C12.4867 6.62613 12.6704 6.55283 12.8611 6.55448C13.0518 6.55614 13.2342 6.63263 13.3691 6.76747C13.5039 6.90231 13.5804 7.08472 13.5821 7.27541C13.5837 7.46611 13.5104 7.64982 13.3779 7.78698L9.01427 12.1507C8.87788 12.287 8.69293 12.3636 8.50008 12.3636C8.30723 12.3636 8.12228 12.287 7.98589 12.1507L3.62221 7.78698C3.48973 7.64982 3.41643 7.46611 3.41808 7.27541C3.41974 7.08472 3.49623 6.90231 3.63107 6.76747C3.76592 6.63263 3.94833 6.55614 4.13902 6.55448C4.32971 6.55283 4.51342 6.62613 4.65059 6.75861Z",
2039
- fill: "#161616"
2040
- }
2041
- )
2042
- ), "Print receipt"), /* @__PURE__ */ React10.createElement("button", { className: "charge-success-btn1", onClick: (e) => HandleSubmit(e, "share", tranId) }, /* @__PURE__ */ React10.createElement(
2043
- "svg",
2044
- {
2045
- xmlns: "http://www.w3.org/2000/svg",
2046
- width: "17",
2047
- height: "16",
2048
- viewBox: "0 0 17 16",
2049
- fill: "none"
2050
- },
2051
- /* @__PURE__ */ React10.createElement("g", { clipPath: "url(#clip0_12420_50683)" }, /* @__PURE__ */ React10.createElement(
2052
- "path",
2053
- {
2054
- d: "M9.30194 4.78664V2.31152C9.30194 2.09629 9.3862 1.88988 9.53631 1.73768C9.68634 1.5855 9.8899 1.5 10.1021 1.5C10.312 1.50089 10.5132 1.58542 10.6622 1.73534L16.2633 7.41595C16.3383 7.49142 16.3978 7.58117 16.4385 7.68001C16.4791 7.77894 16.5 7.885 16.5 7.99212C16.5 8.09924 16.4791 8.20531 16.4385 8.30423C16.3978 8.40307 16.3383 8.49283 16.2633 8.5683L10.6622 14.2489C10.5499 14.3606 10.4076 14.4362 10.2531 14.4663C10.0987 14.4964 9.93887 14.4797 9.79372 14.4182C9.64857 14.3568 9.52455 14.2532 9.43701 14.1206C9.34955 13.9881 9.30258 13.8323 9.30194 13.6727V11.157H8.62181C7.35764 11.1379 6.10443 11.3981 4.94932 11.9193C3.79422 12.4406 2.76481 13.2107 1.93249 14.1759C1.83215 14.3113 1.6926 14.4115 1.53337 14.4624C1.37406 14.5134 1.20306 14.5125 1.04431 14.4599C0.882759 14.4046 0.742811 14.2984 0.644952 14.1568C0.547092 14.0152 0.496363 13.8456 0.500203 13.6727C0.500203 6.27171 6.96548 5.00575 9.30194 4.78664ZM8.62181 9.51777C9.15695 9.51607 9.69162 9.55129 10.2221 9.62327C10.4115 9.6524 10.5844 9.74954 10.7092 9.89699C10.834 10.0444 10.9025 10.2324 10.9023 10.4267V11.717L14.567 7.99212L10.9023 4.26727V5.55758C10.9023 5.77281 10.8179 5.97922 10.6679 6.13141C10.5178 6.28359 10.3143 6.36909 10.1021 6.36909C9.37396 6.36909 3.61282 6.5314 2.36457 11.5871C4.17637 10.2324 6.3708 9.50665 8.62181 9.51777Z",
2055
- fill: "#161616"
2056
- }
2057
- )),
2058
- /* @__PURE__ */ React10.createElement("defs", null, /* @__PURE__ */ React10.createElement("clipPath", { id: "clip0_12420_50683" }, /* @__PURE__ */ React10.createElement(
2059
- "rect",
2060
- {
2061
- width: "16",
2062
- height: "16",
2063
- fill: "white",
2064
- transform: "translate(0.5)"
2065
- }
2066
- )))
2067
- ), "Send receipt"))), /* @__PURE__ */ React10.createElement("div", { className: "charge-payment-success-btn-div" }, /* @__PURE__ */ React10.createElement("button", { className: "charge-payment-success-btn1", onClick: (e) => HandleSubmit(e, "tran", tranId) }, "Go to Transactions"), /* @__PURE__ */ React10.createElement("button", { className: "charge-payment-success-btn2", onClick: (e) => {
2068
- onClose();
2069
- HandleSubmit(e, "close", tranId);
2070
- } }, "Close"))));
2071
- }
2072
-
2073
- // src/app/components/Charge/GetPaymentPage.tsx
2074
- import Swal from "sweetalert2";
2075
- import { IoArrowBack } from "react-icons/io5";
2076
-
2077
- // src/app/components/Datascript.tsx
2078
- import { useEffect as useEffect3 } from "react";
2079
- function DataScript() {
2080
- useEffect3(() => {
2081
- const src = "https://token-cert.dcap.com/v1/client";
2082
- if (typeof window === "undefined") return;
2083
- if (window.DatacapWebToken) {
2084
- console.log("\u2705 Datacap already available");
2085
- return;
2086
- }
2087
- if (!document.querySelector(`script[src="${src}"]`)) {
2088
- const script = document.createElement("script");
2089
- script.src = src;
2090
- script.async = true;
2091
- script.onload = () => {
2092
- console.log("\u2705 Datacap script loaded");
2093
- if (window.DatacapWebToken) {
2094
- console.log("\u2705 DatacapWebToken is ready:", window.DatacapWebToken);
2095
- } else {
2096
- console.warn("\u26A0\uFE0F Script loaded, but DatacapWebToken not found");
2097
- }
2098
- };
2099
- script.onerror = (err) => {
2100
- console.error("\u274C Failed to load Datacap script", err);
2101
- };
2102
- document.head.appendChild(script);
2103
- } else {
2104
- console.log("\u2139\uFE0F Script already in DOM, waiting for Datacap...");
2105
- }
2106
- }, []);
2107
- useEffect3(() => {
2108
- const scriptId = "forge-cdn-script";
2109
- if (!document.getElementById(scriptId)) {
2110
- const forgeScript = document.createElement("script");
2111
- forgeScript.src = "https://cdn.jsdelivr.net/npm/node-forge@1.0.0/dist/forge.min.js";
2112
- forgeScript.id = scriptId;
2113
- forgeScript.async = true;
2114
- document.head.appendChild(forgeScript);
2115
- }
2116
- return () => {
2117
- const existingScript = document.getElementById(scriptId);
2118
- if (existingScript) {
2119
- document.head.removeChild(existingScript);
2120
- }
2121
- };
2122
- }, []);
2123
- return null;
2124
- }
2125
-
2126
- // src/app/components/ErrorCardMessage/ErrorCardMessage.tsx
2127
- import React12 from "react";
2128
-
2129
- // src/app/components/ErrorCardMessage/ErrorCardMessageStyle.tsx
2130
- import React11 from "react";
2131
- function ErrorCardMszStyle() {
2132
- return /* @__PURE__ */ React11.createElement("style", null, `
1460
+ }`)}function tn(e,y,T){e.preventDefault();let Y={type:"preview.compiledcheck",other:{msg:"Payment success!",status:y==="close",data:{tran_id:T,key:y}}};console.log("message:",Y),window.parent.postMessage(Y,"*")}function fn({onClose:e,tranId:y}){return Ae.createElement(Ae.Fragment,null,Ae.createElement(zn,null),Ae.createElement("div",{className:"payment-msg-container"},Ae.createElement("div",{className:"charge-payment-success-container"},Ae.createElement("div",{className:"charge-payment-success-tick-div"},Ae.createElement("div",{className:"charge-payment-success-tick"},Ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},Ae.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"})))),Ae.createElement("h6",{className:"charge-payment-success-text"},"Your charge",Ae.createElement("br",null),"was successful"),Ae.createElement("h6",{className:"charge-payment-success-subtext"},"We\u2019ve processed your charge"),Ae.createElement("div",{className:"charge-success-payment-button-div"},Ae.createElement("button",{className:"charge-success-btn1",onClick:T=>tn(T,"print",y)},Ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},Ae.createElement("path",{d:"M15.7729 8.7272C15.58 8.7272 15.395 8.80383 15.2586 8.94022C15.1222 9.07661 15.0456 9.2616 15.0456 9.45448V12.5185C15.045 13.0559 14.8313 13.5711 14.4513 13.9511C14.0713 14.3311 13.5561 14.5449 13.0187 14.5454H3.98149C3.44409 14.5449 2.92887 14.3311 2.54887 13.9511C2.16887 13.5711 1.95514 13.0559 1.95456 12.5185V9.45448C1.95456 9.2616 1.87794 9.07661 1.74154 8.94022C1.60515 8.80383 1.42017 8.7272 1.22728 8.7272C1.03439 8.7272 0.849407 8.80383 0.713015 8.94022C0.576624 9.07661 0.5 9.2616 0.5 9.45448V12.5185C0.500963 13.4416 0.86807 14.3265 1.52077 14.9792C2.17346 15.6319 3.05844 15.999 3.98149 16H13.0187C13.9417 15.999 14.8267 15.6319 15.4794 14.9792C16.1321 14.3265 16.4992 13.4416 16.5002 12.5185V9.45448C16.5002 9.2616 16.4235 9.07661 16.2871 8.94022C16.1507 8.80383 15.9658 8.7272 15.7729 8.7272Z",fill:"#161616"}),Ae.createElement("path",{d:"M4.65059 6.75861L7.7728 9.88082V0.72728C7.7728 0.534394 7.84942 0.349407 7.98581 0.213015C8.1222 0.0766239 8.30719 0 8.50008 0C8.69296 0 8.87795 0.0766239 9.01434 0.213015C9.15073 0.349407 9.22736 0.534394 9.22736 0.72728V9.88082L12.3496 6.75861C12.4867 6.62613 12.6704 6.55283 12.8611 6.55448C13.0518 6.55614 13.2342 6.63263 13.3691 6.76747C13.5039 6.90231 13.5804 7.08472 13.5821 7.27541C13.5837 7.46611 13.5104 7.64982 13.3779 7.78698L9.01427 12.1507C8.87788 12.287 8.69293 12.3636 8.50008 12.3636C8.30723 12.3636 8.12228 12.287 7.98589 12.1507L3.62221 7.78698C3.48973 7.64982 3.41643 7.46611 3.41808 7.27541C3.41974 7.08472 3.49623 6.90231 3.63107 6.76747C3.76592 6.63263 3.94833 6.55614 4.13902 6.55448C4.32971 6.55283 4.51342 6.62613 4.65059 6.75861Z",fill:"#161616"})),"Print receipt"),Ae.createElement("button",{className:"charge-success-btn1",onClick:T=>tn(T,"share",y)},Ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},Ae.createElement("g",{clipPath:"url(#clip0_12420_50683)"},Ae.createElement("path",{d:"M9.30194 4.78664V2.31152C9.30194 2.09629 9.3862 1.88988 9.53631 1.73768C9.68634 1.5855 9.8899 1.5 10.1021 1.5C10.312 1.50089 10.5132 1.58542 10.6622 1.73534L16.2633 7.41595C16.3383 7.49142 16.3978 7.58117 16.4385 7.68001C16.4791 7.77894 16.5 7.885 16.5 7.99212C16.5 8.09924 16.4791 8.20531 16.4385 8.30423C16.3978 8.40307 16.3383 8.49283 16.2633 8.5683L10.6622 14.2489C10.5499 14.3606 10.4076 14.4362 10.2531 14.4663C10.0987 14.4964 9.93887 14.4797 9.79372 14.4182C9.64857 14.3568 9.52455 14.2532 9.43701 14.1206C9.34955 13.9881 9.30258 13.8323 9.30194 13.6727V11.157H8.62181C7.35764 11.1379 6.10443 11.3981 4.94932 11.9193C3.79422 12.4406 2.76481 13.2107 1.93249 14.1759C1.83215 14.3113 1.6926 14.4115 1.53337 14.4624C1.37406 14.5134 1.20306 14.5125 1.04431 14.4599C0.882759 14.4046 0.742811 14.2984 0.644952 14.1568C0.547092 14.0152 0.496363 13.8456 0.500203 13.6727C0.500203 6.27171 6.96548 5.00575 9.30194 4.78664ZM8.62181 9.51777C9.15695 9.51607 9.69162 9.55129 10.2221 9.62327C10.4115 9.6524 10.5844 9.74954 10.7092 9.89699C10.834 10.0444 10.9025 10.2324 10.9023 10.4267V11.717L14.567 7.99212L10.9023 4.26727V5.55758C10.9023 5.77281 10.8179 5.97922 10.6679 6.13141C10.5178 6.28359 10.3143 6.36909 10.1021 6.36909C9.37396 6.36909 3.61282 6.5314 2.36457 11.5871C4.17637 10.2324 6.3708 9.50665 8.62181 9.51777Z",fill:"#161616"})),Ae.createElement("defs",null,Ae.createElement("clipPath",{id:"clip0_12420_50683"},Ae.createElement("rect",{width:"16",height:"16",fill:"white",transform:"translate(0.5)"})))),"Send receipt"))),Ae.createElement("div",{className:"charge-payment-success-btn-div"},Ae.createElement("button",{className:"charge-payment-success-btn1",onClick:T=>tn(T,"tran",y)},"Go to Transactions"),Ae.createElement("button",{className:"charge-payment-success-btn2",onClick:T=>{e(),tn(T,"close",y)}},"Close"))))}import xn from"sweetalert2";import{IoArrowBack as Sn}from"react-icons/io5";import{useEffect as Jn}from"react";function Yt(){return Jn(()=>{let e="https://token-cert.dcap.com/v1/client";if(typeof window!="undefined"){if(window.DatacapWebToken){console.log("\u2705 Datacap already available");return}if(document.querySelector(`script[src="${e}"]`))console.log("\u2139\uFE0F Script already in DOM, waiting for Datacap...");else{let y=document.createElement("script");y.src=e,y.async=!0,y.onload=()=>{console.log("\u2705 Datacap script loaded"),window.DatacapWebToken?console.log("\u2705 DatacapWebToken is ready:",window.DatacapWebToken):console.warn("\u26A0\uFE0F Script loaded, but DatacapWebToken not found")},y.onerror=T=>{console.error("\u274C Failed to load Datacap script",T)},document.head.appendChild(y)}}},[]),Jn(()=>{let e="forge-cdn-script";if(!document.getElementById(e)){let y=document.createElement("script");y.src="https://cdn.jsdelivr.net/npm/node-forge@1.0.0/dist/forge.min.js",y.id=e,y.async=!0,document.head.appendChild(y)}return()=>{let y=document.getElementById(e);y&&document.head.removeChild(y)}},[]),null}import It from"react";import _i from"react";function In(){return _i.createElement("style",null,`
2133
1461
  .card-error .logo-container {
2134
1462
  display: flex;
2135
1463
  justify-content: center;
@@ -2234,1324 +1562,77 @@ function ErrorCardMszStyle() {
2234
1562
  padding:10px 17px;
2235
1563
  cursor:pointer;
2236
1564
  }
2237
- `);
2238
- }
2239
-
2240
- // src/app/components/ErrorCardMessage/ErrorCardMessage.tsx
2241
- var ErrorCardMessage = ({ onClose, error }) => {
2242
- return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(ErrorCardMszStyle, null), /* @__PURE__ */ React12.createElement("div", { className: "card-error" }, /* @__PURE__ */ React12.createElement("div", { className: "payment-error-container" }, /* @__PURE__ */ React12.createElement("div", { className: "error-icon" }, /* @__PURE__ */ React12.createElement("div", { className: "circle" }, /* @__PURE__ */ React12.createElement("i", { className: "fa fa-times", "aria-hidden": "true" })), /* @__PURE__ */ React12.createElement("div", { className: "error-text" }, /* @__PURE__ */ React12.createElement("div", { className: "payment-error-text" }, error), /* @__PURE__ */ React12.createElement("div", { className: "thank-you-text" }, "Try again later ")), /* @__PURE__ */ React12.createElement("div", { className: "error-btn-div" }, /* @__PURE__ */ React12.createElement("button", { onClick: onClose }, "OK"))))));
2243
- };
2244
- var ErrorCardMessage_default = ErrorCardMessage;
2245
-
2246
- // src/app/components/socketClient.js
2247
- import { io } from "socket.io-client";
2248
- var socket = io(baseUrl, {
2249
- transports: ["websocket"],
2250
- // Optional: force WebSocket
2251
- withCredentials: false
2252
- });
2253
- var socketClient_default = socket;
2254
-
2255
- // src/app/utils/Common.js
2256
- var isValidJson = (jsonString) => {
2257
- try {
2258
- const parsed = JSON.parse(jsonString);
2259
- return typeof parsed === "object" && parsed !== null;
2260
- } catch (e) {
2261
- return false;
2262
- }
2263
- };
2264
-
2265
- // src/app/components/Charge/GetPaymentPage.tsx
2266
- function GetPaymentPage(props) {
2267
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
2268
- const [loading, setLoading] = useState3(false);
2269
- const [loading2, setLoading2] = useState3(false);
2270
- const [error, setError] = useState3("");
2271
- const [success, setSuccess] = useState3(false);
2272
- const [show, setShow] = useState3(false);
2273
- const [activetab, setActive] = useState3("card");
2274
- const [saveCardInfo, setSaveCardInfo] = useState3(false);
2275
- const [saveACHinfo, setSaveACHinfo] = useState3(false);
2276
- const fractalpayClientKey = props.fractalpayClientKey;
2277
- const [cardData, setCardData] = useState3();
2278
- const [cardError, setCardError] = useState3({});
2279
- const [achData, setAchData] = useState3();
2280
- const [achError, setAchError] = useState3({});
2281
- const [cardList, setCardList] = useState3([]);
2282
- const [selectedCard, setSelectedCard] = useState3();
2283
- const [paymentData, setPaymentData] = useState3();
2284
- let [tranId, setTranId] = useState3("");
2285
- const showLoader = () => setLoading(true);
2286
- const hideLoader = () => setLoading(false);
2287
- const handleClose = () => {
2288
- setShow(false);
2289
- setActive("card");
2290
- setError("");
2291
- setSuccess(false);
2292
- setTranId("");
2293
- setAchData({
2294
- name: "",
2295
- routingNumber: "",
2296
- accountNumber: "",
2297
- confirmAccountNumber: "",
2298
- bankName: "",
2299
- accountType: ""
2300
- });
2301
- setAchError({
2302
- name: "",
2303
- routingNumber: "",
2304
- accountNumber: "",
2305
- confirmAccountNumber: "",
2306
- bankName: "",
2307
- accountType: ""
2308
- });
2309
- setCardData({
2310
- cardName: "",
2311
- cardNumber: "",
2312
- expiryMonth: "",
2313
- expiryYear: "",
2314
- cvv: "",
2315
- orderId: "",
2316
- zipCode: ""
2317
- });
2318
- setCardError({
2319
- cardName: "",
2320
- cardNumber: "",
2321
- expiryMonth: "",
2322
- expiryYear: "",
2323
- cvv: "",
2324
- orderId: "",
2325
- zipCode: ""
2326
- });
2327
- setSaveACHinfo(false);
2328
- setSaveCardInfo(false);
2329
- setSelectedCard({
2330
- card_type: "",
2331
- cardlastfourdigit: "",
2332
- expmonth: 1,
2333
- expyear: 2025,
2334
- primary_card: 0,
2335
- firstname: "",
2336
- id: "",
2337
- lastname: ""
2338
- });
2339
- };
2340
- const handleShow = () => setShow(true);
2341
- const handletabchange = (id) => {
2342
- setActive(id);
2343
- };
2344
- const handleCardChange = (field, value) => {
2345
- const name = field;
2346
- const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
2347
- if (numericFields.includes(name)) {
2348
- if (value === "" || /^[0-9]+$/.test(value)) {
2349
- setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
2350
- [name]: ""
2351
- }));
2352
- setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
2353
- [name]: value
2354
- }));
2355
- }
2356
- return;
2357
- }
2358
- setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
2359
- [name]: ""
2360
- }));
2361
- setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
2362
- [name]: value
2363
- }));
2364
- };
2365
- const handleCardNumberChange = (e) => {
2366
- const input = e.target;
2367
- const rawValue = input.value.replace(/\D/g, "");
2368
- let formatted = "";
2369
- if (/^3[47]/.test(rawValue)) {
2370
- const trimmed = rawValue.slice(0, 15);
2371
- formatted = trimmed.replace(
2372
- /^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,
2373
- (_, g1, g2, g3) => [g1, g2, g3].filter(Boolean).join(" ")
2374
- );
2375
- } else {
2376
- const trimmed = rawValue.slice(0, 16);
2377
- formatted = trimmed.replace(
2378
- /^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,
2379
- (_, g1, g2, g3, g4) => [g1, g2, g3, g4].filter(Boolean).join(" ")
2380
- );
2381
- }
2382
- setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
2383
- cardNumber: ""
2384
- }));
2385
- setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
2386
- cardNumber: formatted
2387
- }));
2388
- };
2389
- const handleChangeAch = (e) => {
2390
- const { name, value } = e.target;
2391
- const numericFields = ["routingNumber", "accountNumber", "confirmAccountNumber"];
2392
- if (name == "name") {
2393
- if (/^[a-zA-Z\s]*$/.test(value)) {
2394
- setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
2395
- [name]: ""
2396
- }));
2397
- setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
2398
- [name]: value
2399
- }));
2400
- }
2401
- return;
2402
- }
2403
- if (numericFields.includes(name)) {
2404
- if (value === "" || /^[0-9]+$/.test(value)) {
2405
- setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
2406
- [name]: ""
2407
- }));
2408
- setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
2409
- [name]: value
2410
- }));
2411
- }
2412
- return;
2413
- }
2414
- setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
2415
- [name]: ""
2416
- }));
2417
- setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
2418
- [name]: value
2419
- }));
2420
- };
2421
- const validateCardData = () => {
2422
- var _a2, _b2, _c2, _d2, _e2, _f2;
2423
- const errors = {};
2424
- const data = cardData;
2425
- const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
2426
- const year = (data == null ? void 0 : data.expiryYear) || "";
2427
- if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
2428
- if (!((_b2 = data == null ? void 0 : data.cardNumber) == null ? void 0 : _b2.trim())) errors.cardNumber = "Card number is required";
2429
- if (!((_c2 = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _c2.trim()) || !((_d2 = data == null ? void 0 : data.expiryYear) == null ? void 0 : _d2.trim())) {
2430
- errors.expiryMonth = "Invalid Expiration Date.";
2431
- } else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
2432
- errors.expiryMonth = "Invalid Expiration Date.";
2433
- }
2434
- if (!((_e2 = data == null ? void 0 : data.cvv) == null ? void 0 : _e2.trim())) errors.cvv = "CVV is required";
2435
- if (!((_f2 = data == null ? void 0 : data.zipCode) == null ? void 0 : _f2.trim())) errors.zipCode = "ZIP code is required";
2436
- if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
2437
- const month2 = parseInt(data.expiryMonth, 10);
2438
- const year2 = parseInt(data.expiryYear, 10);
2439
- const now = /* @__PURE__ */ new Date();
2440
- const currentMonth = now.getMonth() + 1;
2441
- const currentYear = now.getFullYear();
2442
- if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
2443
- errors.expiryMonth = "Card is expired";
2444
- }
2445
- }
2446
- setCardError(errors);
2447
- return Object.keys(errors).length > 0;
2448
- };
2449
- const validateAchData = () => {
2450
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
2451
- const errors = {};
2452
- const data = achData;
2453
- if (!((_a2 = data == null ? void 0 : data.name) == null ? void 0 : _a2.trim())) errors.name = "Name is required";
2454
- if (!((_b2 = data == null ? void 0 : data.accountNumber) == null ? void 0 : _b2.trim())) errors.accountNumber = "account number is required";
2455
- if (((_c2 = data == null ? void 0 : data.accountNumber) == null ? void 0 : _c2.trim()) && ((_d2 = data == null ? void 0 : data.accountNumber) == null ? void 0 : _d2.trim()) !== ((_e2 = data == null ? void 0 : data.confirmAccountNumber) == null ? void 0 : _e2.trim())) errors.confirmAccountNumber = "Account numbers must match";
2456
- if (!((_f2 = data == null ? void 0 : data.bankName) == null ? void 0 : _f2.trim())) errors.bankName = "Bank name is required";
2457
- if (!((_g2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _g2.trim())) errors.routingNumber = "Routing Number is required";
2458
- if ((data == null ? void 0 : data.routingNumber) && ((_h2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _h2.length) !== 9) errors.routingNumber = "Routing number must be 9 digits";
2459
- if (((_i2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _i2.length) == 9) {
2460
- let routingNumber = data == null ? void 0 : data.routingNumber;
2461
- const weights = [3, 7, 1];
2462
- let sum = 0;
2463
- for (let i = 0; i < routingNumber.length; i++) {
2464
- sum += parseInt(routingNumber[i], 10) * weights[i % 3];
2465
- }
2466
- if (sum % 10 !== 0) {
2467
- errors.routingNumber = "Invalid routing number";
2468
- }
2469
- }
2470
- setAchError(errors);
2471
- return Object.keys(errors).length > 0;
2472
- };
2473
- const submitFunc = async (e) => {
2474
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
2475
- e.preventDefault();
2476
- if (activetab !== "ach") {
2477
- const hasError = validateCardData();
2478
- if (hasError) return;
2479
- else {
2480
- let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
2481
- let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
2482
- let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
2483
- let errors = {};
2484
- if (!validCard) errors.cardNumber = "Invalid card Number";
2485
- if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
2486
- if (!validCVV) errors.cvv = "Invalid CVV";
2487
- setCardError(errors);
2488
- if (validCard && validCVV && validExpirationDate) {
2489
- setLoading2(true);
2490
- try {
2491
- const formData = __spreadProps(__spreadValues({}, cardData), {
2492
- amount: `${props.amount || 0}`,
2493
- fractalpayPublicKey: fractalpayClientKey,
2494
- orderId: props == null ? void 0 : props.orderID,
2495
- customer_id: props == null ? void 0 : props.customerId,
2496
- discount: props == null ? void 0 : props.discount,
2497
- surcharge: props == null ? void 0 : props.surcharge,
2498
- tax: props == null ? void 0 : props.tax
2499
- });
2500
- const result = await axios3.post(`${baseUrl}create-widget-order`, formData);
2501
- let tokenCallback = async function(response) {
2502
- if (response.Error) {
2503
- setError(response.Error);
2504
- setLoading2(false);
2505
- } else {
2506
- let name = cardData == null ? void 0 : cardData.cardName;
2507
- let postal_code = cardData == null ? void 0 : cardData.zipCode;
2508
- response.name = name;
2509
- response.postal_code = postal_code;
2510
- response.isCardSave = `${saveCardInfo}`;
2511
- response.isCharge = true;
2512
- response.posSalesIdEncode = result == null ? void 0 : result.data.data.posSalesIdEncode;
2513
- console.log(response, "resppp");
2514
- console.log(result == null ? void 0 : result.data.data.posSalesIdEncode, "fkjdashgfuh");
2515
- socketClient_default.emit("sendMessage", response);
2516
- socketClient_default.on(result == null ? void 0 : result.data.data.posSalesIdEncode, (data) => {
2517
- console.log(data, "socket data");
2518
- if (isValidJson(data == null ? void 0 : data.data)) {
2519
- let apiResponse = JSON.parse(data.data);
2520
- console.log("return data : ", apiResponse);
2521
- if (apiResponse == null ? void 0 : apiResponse.result) {
2522
- setCardData({
2523
- cardName: "",
2524
- cardNumber: "",
2525
- expiryMonth: "",
2526
- expiryYear: "",
2527
- cvv: "",
2528
- orderId: "",
2529
- zipCode: ""
2530
- });
2531
- setSaveCardInfo(false);
2532
- setTranId(apiResponse == null ? void 0 : apiResponse.transactionId);
2533
- setSuccess(true);
2534
- setLoading2(false);
2535
- } else {
2536
- setLoading2(false);
2537
- setError((apiResponse == null ? void 0 : apiResponse.message) || "Something went wrong.");
2538
- }
2539
- } else {
2540
- setError("Something went wrong.");
2541
- }
2542
- });
2543
- }
2544
- };
2545
- if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
2546
- const requestOptions = {
2547
- method: "POST",
2548
- redirect: "follow"
2549
- };
2550
- try {
2551
- let sesionResult = await axios3.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
2552
- let expYear = Number(cardData == null ? void 0 : cardData.expiryYear) % 100;
2553
- let cardNumber = cardData == null ? void 0 : cardData.cardNumber;
2554
- cardNumber = cardNumber == null ? void 0 : cardNumber.replace(/\s+/g, "");
2555
- let track2_data = `${cardNumber}=${expYear}${cardData == null ? void 0 : cardData.expiryMonth} ${cardData == null ? void 0 : cardData.cvv}`;
2556
- const publicKey = forge.pki.publicKeyFromPem((_b2 = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.publicKeyPem);
2557
- const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
2558
- md: forge.md.sha1.create(),
2559
- mgf1: {
2560
- md: forge.md.sha1.create()
2561
- }
2562
- });
2563
- const encryptedBase64 = forge.util.encode64(encrypted);
2564
- const myHeaders = {
2565
- "Content-Type": "application/json",
2566
- "x-app-session-key": (_d2 = (_c2 = sesionResult.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.session_key
2567
- };
2568
- const raw = JSON.stringify({
2569
- "enc_track2_data": `${encryptedBase64}`,
2570
- "algorithm": "RSAES_OAEP_SHA_1",
2571
- session_key: `${(_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key}`
2572
- });
2573
- try {
2574
- const tokenizeData = await axios3.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
2575
- const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g2.data), {
2576
- isSaveCardChecked: saveCardInfo,
2577
- name: cardData == null ? void 0 : cardData.cardName,
2578
- postal_code: cardData == null ? void 0 : cardData.zipCode,
2579
- customer_id: props == null ? void 0 : props.customerId
2580
- }));
2581
- const reqData2 = JSON.stringify({
2582
- "pre_sales_id": `${(_i2 = (_h2 = result == null ? void 0 : result.data) == null ? void 0 : _h2.data) == null ? void 0 : _i2.posSalesIdEncode}`,
2583
- "token": `${(_j2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _j2.data.token}`,
2584
- "json_response": `${reqData}`
2585
- });
2586
- let myHeaders2 = JSON.stringify({
2587
- "Content-Type": "application/json"
2588
- });
2589
- const requestOptions2 = {
2590
- method: "POST",
2591
- headers: myHeaders2,
2592
- body: reqData2,
2593
- redirect: "follow",
2594
- isChargeviafractal: true
2595
- };
2596
- socketClient_default.emit("sendMessage", requestOptions2);
2597
- socketClient_default.on("chargeviafractalgateway", (data) => {
2598
- var _a3;
2599
- console.log(data, "socket data");
2600
- if (isValidJson(data == null ? void 0 : data.data)) {
2601
- let paymentRes = JSON.parse(data == null ? void 0 : data.data);
2602
- console.log(paymentRes, "dfuigdasuf");
2603
- if (paymentRes == null ? void 0 : paymentRes.result) {
2604
- setTranId((_a3 = paymentRes == null ? void 0 : paymentRes.data) == null ? void 0 : _a3.transactionId);
2605
- setSuccess(true);
2606
- setLoading2(false);
2607
- } else {
2608
- setLoading2(false);
2609
- setError((paymentRes == null ? void 0 : paymentRes.message) || "Something went wrong.");
2610
- }
2611
- } else {
2612
- setError("Something went wrong.");
2613
- }
2614
- });
2615
- } catch (err) {
2616
- setLoading2(false);
2617
- setError(((_l2 = (_k2 = err == null ? void 0 : err.response) == null ? void 0 : _k2.data) == null ? void 0 : _l2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
2618
- }
2619
- } catch (err) {
2620
- setLoading2(false);
2621
- setError(((_n2 = (_m2 = err == null ? void 0 : err.response) == null ? void 0 : _m2.data) == null ? void 0 : _n2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
2622
- }
2623
- } else {
2624
- if (typeof DatacapWebToken !== "undefined") {
2625
- DatacapWebToken.requestToken(result == null ? void 0 : result.data.data.dctoken, "PaymentForm", tokenCallback);
2626
- }
1565
+ `)}var Fi=({onClose:e,error:y})=>It.createElement(It.Fragment,null,It.createElement(In,null),It.createElement("div",{className:"card-error"},It.createElement("div",{className:"payment-error-container"},It.createElement("div",{className:"error-icon"},It.createElement("div",{className:"circle"},It.createElement("i",{className:"fa fa-times","aria-hidden":"true"})),It.createElement("div",{className:"error-text"},It.createElement("div",{className:"payment-error-text"},y),It.createElement("div",{className:"thank-you-text"},"Try again later ")),It.createElement("div",{className:"error-btn-div"},It.createElement("button",{onClick:e},"OK")))))),Et=Fi;import{io as Si}from"socket.io-client";var Mi=Si(ze,{transports:["websocket"],withCredentials:!1}),kt=Mi;var An=e=>{try{let y=JSON.parse(e);return typeof y=="object"&&y!==null}catch(y){return!1}},Fn=[{value:"personal saving",label:"Personal Saving"},{value:"business saving",label:"Business Saving"},{value:"personal checking",label:"Personal Checking"},{value:"business checking",label:"Business Checking"}];function an(e){let y=Number(e);return isNaN(y)?`$${e}`:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(y)}var Pi=R+"widget/mc-img.svg",Li=R+"widget/visa-img.svg",zi=R+"widget/ae-img.svg",Ii=R+"widget/discover-img.svg",hn=R+"widget/card.svg",Ai=R+"widget/bank.svg",yo=R+"widget/Trash.svg",xo=R+"widget/secure-img.png",bo=R+"widget/pov-by.png",vo=R+"widget/pax.svg",Xn=R+"widget/Bank _New.svg",Qn=e=>{switch(e==null?void 0:e.toLowerCase()){case"visa":return Li;case"mastercard":case"mc":case"m/c":return Pi;case"amex":case"american express":case"ae":return zi;case"discover":case"dcvr":return Ii;case"bank":return Ai;default:return hn}};import Ot from"react";var sn=e=>Ot.createElement(Ot.Fragment,null,Ot.createElement("div",{className:`frac-card-bank-radio ${e.activetab===e.value?"frac-active":""}`,onClick:()=>e.onChange(e.value),role:"radio"},Ot.createElement("div",{className:"frac-card-title-main"},Ot.createElement("img",{src:e.label.toLowerCase()==="card"?hn:Xn,className:"frac-payment-type-logo",alt:""}),Ot.createElement("div",{className:"frac-card-label"},Ot.createElement("div",{className:"frac-card-label-text"},e.label),Ot.createElement("div",{className:"frac-card-label-amount"},an(e.amount)))),Ot.createElement("div",null,Ot.createElement("input",{name:"paymenttype",checked:e.activetab===e.value,type:"radio",value:e.value,onChange:y=>{e.onChange(y.target.value)}}))));import Bi from"react";function yn({}){return Bi.createElement("style",null,`
1566
+ .frac-card-bank-radio-main{
1567
+ display: flex;
1568
+ flex-direction: column;
1569
+ align-items: flex-start;
1570
+ align-self: stretch;
1571
+ border-radius: 14px;
1572
+ border: 1px solid #E0DFE2;
1573
+ overflow: hidden;
2627
1574
  }
2628
- } catch (err) {
2629
- setLoading2(false);
2630
- setError(((_p2 = (_o2 = err == null ? void 0 : err.response) == null ? void 0 : _o2.data) == null ? void 0 : _p2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
2631
- }
2632
- }
2633
- }
2634
- } else {
2635
- const hasError = validateAchData();
2636
- if (hasError) return;
2637
- else {
2638
- setLoading2(true);
2639
- let dataForm = {
2640
- fractalpayPublicKey: fractalpayClientKey,
2641
- label: (achData == null ? void 0 : achData.name) || "John Doe",
2642
- account_number: achData == null ? void 0 : achData.accountNumber,
2643
- routing_number: achData == null ? void 0 : achData.routingNumber,
2644
- bank_name: achData == null ? void 0 : achData.bankName,
2645
- account_type: achData == null ? void 0 : achData.accountType,
2646
- amount: String(props.amount || 0),
2647
- isSaveAch: saveACHinfo,
2648
- customer_id: props == null ? void 0 : props.customerId,
2649
- order_id: props == null ? void 0 : props.orderID,
2650
- tax: props == null ? void 0 : props.tax,
2651
- discount: props == null ? void 0 : props.discount,
2652
- surcharge: props == null ? void 0 : props.surcharge,
2653
- isChargeACH: true
2654
- };
2655
- socketClient_default.emit("sendMessage", dataForm);
2656
- socketClient_default.on("ach-incoming", (data) => {
2657
- var _a3;
2658
- console.log(data, "sfhdwhf");
2659
- if ((data == null ? void 0 : data.status) == "Failed") {
2660
- if (typeof (data == null ? void 0 : data.message) == "object") {
2661
- Object.values(data == null ? void 0 : data.message).forEach((message) => {
2662
- setError(message || "Something went wrong");
2663
- });
2664
- } else {
2665
- setError((data == null ? void 0 : data.message) || "Something went wrong");
1575
+
1576
+ .frac-card-bank-radio{
1577
+ display: flex;
1578
+ padding: 12px 16px;
1579
+ justify-content: space-between;
1580
+ align-items: center;
1581
+ align-self: stretch;
2666
1582
  }
2667
- } else {
2668
- setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
2669
- setSuccess(true);
2670
- setLoading2(false);
2671
- }
2672
- });
2673
- }
2674
- }
2675
- };
2676
- const getPaymentDetails = async () => {
2677
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q, _r, _s;
2678
- showLoader();
2679
- try {
2680
- const data = {
2681
- fractalpayPublicKey: fractalpayClientKey,
2682
- "customer_id": props == null ? void 0 : props.customerId
2683
- };
2684
- let paymentData2 = await axios3.post(`${baseUrl}get-payment-details`, data);
2685
- setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
2686
- if (!((_c2 = (_b2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.paymentGateway)) {
2687
- handleClose();
2688
- setError("Something went wrong.");
2689
- }
2690
- if (((_e2 = (_d2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d2.data) == null ? void 0 : _e2.card_list) && ((_h2 = (_g2 = (_f2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _f2.data) == null ? void 0 : _g2.card_list) == null ? void 0 : _h2.length) > 0) {
2691
- setCardList((_j2 = (_i2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _i2.data) == null ? void 0 : _j2.card_list);
2692
- setActive("cardList");
2693
- let primary_card = (_m2 = (_l2 = (_k2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _k2.data) == null ? void 0 : _l2.card_list) == null ? void 0 : _m2.filter((card) => (card == null ? void 0 : card.primary_card) == 1);
2694
- if ((primary_card == null ? void 0 : primary_card[0]) && ((_n2 = primary_card == null ? void 0 : primary_card[0]) == null ? void 0 : _n2.payment_method_type) == ((_p2 = (_o2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _o2.data) == null ? void 0 : _p2.paymentGateway)) {
2695
- setSelectedCard(primary_card[0]);
2696
- } else if (((_q = primary_card == null ? void 0 : primary_card[0]) == null ? void 0 : _q.card_type) === "Bank") {
2697
- setSelectedCard(primary_card[0]);
2698
- }
2699
- } else {
2700
- setActive("card");
2701
- }
2702
- hideLoader();
2703
- } catch (err) {
2704
- console.log(err);
2705
- hideLoader();
2706
- setError(((_s = (_r = err == null ? void 0 : err.response) == null ? void 0 : _r.data) == null ? void 0 : _s.message) || (err == null ? void 0 : err.message) || "Something went wrong");
2707
- }
2708
- };
2709
- const handlechargeCustomer = async () => {
2710
- let customer_id = props == null ? void 0 : props.customerId;
2711
- let discount = String(props == null ? void 0 : props.discount);
2712
- let surcharge = String(props == null ? void 0 : props.surcharge);
2713
- let tax = String(props == null ? void 0 : props.tax);
2714
- let fractalpayPublicKey = props == null ? void 0 : props.fractalpayClientKey;
2715
- let order_id = props == null ? void 0 : props.orderID;
2716
- let amount = String(props == null ? void 0 : props.amount);
2717
- let card_id = selectedCard == null ? void 0 : selectedCard.id;
2718
- let card_type = selectedCard == null ? void 0 : selectedCard.card_type;
2719
- if (fractalpayPublicKey && order_id && amount) {
2720
- if (customer_id) {
2721
- if (card_id) {
2722
- let chargeobj = {
2723
- amount,
2724
- order_id,
2725
- customer_id,
2726
- card_id,
2727
- fractalpayPublicKey,
2728
- isCardSave: saveCardInfo,
2729
- discount,
2730
- surcharge,
2731
- tax
2732
- };
2733
- let _a2 = chargeobj, { isCardSave } = _a2, rest = __objRest(_a2, ["isCardSave"]);
2734
- let endpoint = card_type === "Bank" ? "charge-ach" : "charge-by-card";
2735
- let chargeurl = baseUrl + endpoint;
2736
- const headers = {
2737
- "Content-Type": "application/json"
2738
- };
2739
- setLoading2(true);
2740
- socketClient_default.emit("sendMessage", { url: chargeurl, body: card_type == "Bank" ? rest : chargeobj, isChargebycard: true });
2741
- socketClient_default.on("charge-by-card", (response) => {
2742
- var _a3;
2743
- console.log(response, "response");
2744
- if ((response == null ? void 0 : response.result) == true || (response == null ? void 0 : response.status) == true) {
2745
- setTranId((_a3 = response.data) == null ? void 0 : _a3.transaction_id);
2746
- setSuccess(true);
2747
- setLoading2(false);
2748
- } else {
2749
- setError((response == null ? void 0 : response.message) || "Something went wrong.");
1583
+
1584
+ input[type="radio"] {
1585
+ accent-color: #000;
2750
1586
  }
2751
- });
2752
- } else {
2753
- setError("Please Select A Card/ACH");
2754
- }
2755
- } else {
2756
- setError("Please Select Customer");
2757
- }
2758
- } else {
2759
- setError("Something went wrong.");
2760
- }
2761
- };
2762
- useEffect4(() => {
2763
- if (show && fractalpayClientKey) {
2764
- getPaymentDetails();
2765
- }
2766
- }, [fractalpayClientKey, show]);
2767
- const handleDeleteCard = async (cardId) => {
2768
- Swal.fire({
2769
- icon: "warning",
2770
- text: "Do you want to delete the card?",
2771
- showCancelButton: true,
2772
- confirmButtonText: "Yes",
2773
- cancelButtonText: "No",
2774
- reverseButtons: true,
2775
- buttonsStyling: false,
2776
- customClass: {
2777
- confirmButton: "swal2-confirm btn btn-dark",
2778
- cancelButton: "swal2-cancel btn btn-dark",
2779
- popup: "custom-swal-popup",
2780
- icon: "custom-swal-icon"
2781
- }
2782
- }).then(async (result) => {
2783
- if (result.isConfirmed) {
2784
- setLoading2(true);
2785
- try {
2786
- let obj = {
2787
- card_id: cardId,
2788
- customer_id: props == null ? void 0 : props.customerId,
2789
- fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey
2790
- };
2791
- const res = await axios3.post(`${baseUrl}delete-customer-card`, obj);
2792
- setLoading2(false);
2793
- getPaymentDetails();
2794
- Swal.fire({
2795
- icon: "success",
2796
- title: "Deleted!",
2797
- text: "Card deleted.",
2798
- confirmButtonText: "OK",
2799
- showConfirmButton: true,
2800
- timer: 1e3,
2801
- // auto-close after 1 second
2802
- timerProgressBar: true,
2803
- customClass: {
2804
- confirmButton: "btn btn-dark"
1587
+
1588
+ .frac-card-title-main{
1589
+ display: flex;
1590
+ align-items: center;
1591
+ gap: 12px;
2805
1592
  }
2806
- });
2807
- } catch (err) {
2808
- setLoading2(false);
2809
- Swal.fire({
2810
- icon: "error",
2811
- title: "Error!",
2812
- text: "Failed to delete the card.",
2813
- confirmButtonText: "OK",
2814
- customClass: {
2815
- confirmButton: "btn btn-dark"
1593
+
1594
+ .frac-card-label{
1595
+ display: flex;
1596
+ flex-direction: column;
1597
+ align-items: flex-start;
1598
+ gap: 2px;
2816
1599
  }
2817
- });
2818
- }
2819
- } else if (result.dismiss === Swal.DismissReason.cancel) {
2820
- Swal.fire({
2821
- icon: "info",
2822
- text: "Card not deleted",
2823
- confirmButtonText: "OK",
2824
- buttonsStyling: false,
2825
- customClass: {
2826
- confirmButton: "btn btn-dark float-end",
2827
- actions: "swal2-actions-end"
2828
- }
2829
- });
2830
- }
2831
- });
2832
- };
2833
- return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(DataScript, null), /* @__PURE__ */ React13.createElement(Chargewidgetstyles, null), /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(
2834
- "button",
2835
- {
2836
- className: "paymentBtn",
2837
- onClick: handleShow
2838
- },
2839
- "Pay"
2840
- ), /* @__PURE__ */ React13.createElement(
2841
- CustomModal2_default,
2842
- {
2843
- open: show,
2844
- onClose: handleClose
2845
- },
2846
- error && /* @__PURE__ */ React13.createElement("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" } }, /* @__PURE__ */ React13.createElement(ErrorCardMessage_default, { error, onClose: handleClose })),
2847
- success && /* @__PURE__ */ React13.createElement(SuccessMsz, { onClose: handleClose, tranId }),
2848
- !error && !success && /* @__PURE__ */ React13.createElement(React13.Fragment, null, (loading || loading2) && /* @__PURE__ */ React13.createElement(Loader_default, { loading: loading || loading2 }), /* @__PURE__ */ React13.createElement("div", { className: "frac-card-payment-page frac-form" }, /* @__PURE__ */ React13.createElement("div", { className: "parent-pay-container" }, /* @__PURE__ */ React13.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React13.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React13.createElement("g", { clipPath: "url(#clip0_12425_52336)" }, /* @__PURE__ */ React13.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__ */ React13.createElement("defs", null, /* @__PURE__ */ React13.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React13.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React13.createElement("div", { className: "pay-main-logo-res" }, /* @__PURE__ */ React13.createElement("img", { src: "https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/uploaded/merchant_logo/20250311131124_merchant_logo.png", id: "pay-logos" })), /* @__PURE__ */ React13.createElement("div", { className: "pay-container" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-header pay-conatiner-one" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-conatiner-one-first" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-logo-container" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-main-logo" }, /* @__PURE__ */ React13.createElement("img", { src: "https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/uploaded/merchant_logo/20250311131124_merchant_logo.png", id: "pay-logos" })), /* @__PURE__ */ React13.createElement("h1", { className: "pay-heading" }, "Pay"), (cardList == null ? void 0 : cardList.length) > 0 && activetab !== "cardList" && /* @__PURE__ */ React13.createElement("button", { className: "res-charge-payment-back-btn ", onClick: () => setActive("cardList") }, " ", /* @__PURE__ */ React13.createElement(IoArrowBack, null), " Back")), /* @__PURE__ */ React13.createElement("div", { className: "amt-pay-con" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-amount-conatiner" }, /* @__PURE__ */ React13.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React13.createElement("strong", { className: "pay-amount" }, "$", (_a = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _a.toFixed(2))), activetab != "ach" && /* @__PURE__ */ React13.createElement("div", { style: { display: "flex", gap: "8px", margin: "8px 0" } }, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 33, alt: "" }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 33, alt: "" })))), /* @__PURE__ */ React13.createElement("div", { className: "pay-conatiner-one-last" }, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/secure-img.png", alt: "" }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/pov-by.png", alt: "" }), "Secure payments powered by Fractal"), /* @__PURE__ */ React13.createElement("div", null)), /* @__PURE__ */ React13.createElement("div", { className: "pay-tab pay-conatiner-two" }, !loading && /* @__PURE__ */ React13.createElement("div", { className: "col-md-12" }, /* @__PURE__ */ React13.createElement("div", { id: "payment-form-div" }, activetab !== "cardList" ? /* @__PURE__ */ React13.createElement("div", null, (cardList == null ? void 0 : cardList.length) > 0 && /* @__PURE__ */ React13.createElement("button", { className: "charge-payment-back-btn ", onClick: () => setActive("cardList") }, " ", /* @__PURE__ */ React13.createElement(IoArrowBack, null), " Back"), (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && /* @__PURE__ */ React13.createElement("div", { className: "tab" }, /* @__PURE__ */ React13.createElement("button", { className: "tablinks", onClick: (e) => {
2849
- handletabchange("card");
2850
- }, style: { border: activetab === "card" ? "1px solid" : "" } }, /* @__PURE__ */ React13.createElement("i", { className: "fas fa-credit-card me-2", style: { marginRight: "8px", fontSize: "15px" } }), "Card"), /* @__PURE__ */ React13.createElement("button", { className: "tablinks", onClick: (e) => {
2851
- handletabchange("ach");
2852
- }, style: { border: activetab === "ach" ? "1px solid" : "" } }, /* @__PURE__ */ React13.createElement("i", { className: "fas fa-university me-2", style: { marginRight: "8px", fontSize: "15px" } }), "Bank")), /* @__PURE__ */ React13.createElement("div", { className: "res-pay-con" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-amount-conatiner", style: { margin: 0 } }, /* @__PURE__ */ React13.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React13.createElement("strong", { className: "pay-amount" }, "$", (_b = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _b.toFixed(2))), activetab != "ach" && /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 35, alt: "" })), /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 35, alt: "" }))))) : /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("h6", { className: "charge-customer-name", style: { marginBottom: "16px !important" } }, " Charge ", paymentData == null ? void 0 : paymentData.customer_name), /* @__PURE__ */ React13.createElement("h6", { className: "card-ach-heading", style: { marginBottom: "10px !important" } }, " Cards/ACH"), /* @__PURE__ */ React13.createElement("div", { className: "res-pay-con" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-amount-conatiner", style: { margin: 0 } }, /* @__PURE__ */ React13.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React13.createElement("strong", { className: "pay-amount" }, "$", (_c = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _c.toFixed(2))), /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 35, alt: "" })), /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 35, alt: "" }))))), /* @__PURE__ */ React13.createElement("div", { id: "ach", style: { display: activetab === "cardList" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React13.createElement("div", { className: "card-lint-div-in" }, /* @__PURE__ */ React13.createElement("div", { className: "card-list-div" }, (paymentData == null ? void 0 : paymentData.card_list) && ((_d = paymentData == null ? void 0 : paymentData.card_list) == null ? void 0 : _d.length) > 0 && ((_e = paymentData == null ? void 0 : paymentData.card_list) == null ? void 0 : _e.map((card, index) => /* @__PURE__ */ React13.createElement("div", { className: "card-list-single-div", key: index }, /* @__PURE__ */ React13.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React13.createElement(
2853
- "input",
2854
- {
2855
- disabled: (paymentData == null ? void 0 : paymentData.paymentGateway) != (card == null ? void 0 : card.payment_method_type) && (card == null ? void 0 : card.card_type) != "Bank",
2856
- type: "radio",
2857
- className: "cardRadio",
2858
- name: "selected_card",
2859
- id: "",
2860
- checked: selectedCard === card,
2861
- onChange: (e) => setSelectedCard(card)
2862
- }
2863
- ), /* @__PURE__ */ React13.createElement("label", { htmlFor: "", className: "card-number-last-four" }, "**** ", card == null ? void 0 : card.cardlastfourdigit), (card == null ? void 0 : card.card_type) != "Bank" && /* @__PURE__ */ React13.createElement("h6", { className: "card-expiry-date" }, card == null ? void 0 : card.expmonth, "/", card == null ? void 0 : card.expyear)), /* @__PURE__ */ React13.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React13.createElement("span", { className: "visa-card" }, /* @__PURE__ */ React13.createElement("img", { src: (card == null ? void 0 : card.card_type) != "Bank" ? "https://dev-widget.fractalpay.com/images/visa-img.svg" : "https://dev-widget.fractalpay.com/images/bank.svg", alt: "" })), /* @__PURE__ */ React13.createElement("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id) }, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/Trash.svg", alt: "" }))))))), /* @__PURE__ */ React13.createElement("div", { className: "pay-with-other-card ", onClick: () => setActive("card") }, "Pay With Other Card", /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/card.svg", alt: "" }))), /* @__PURE__ */ React13.createElement("div", { className: "form-group", style: { padding: "0" } }, /* @__PURE__ */ React13.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer }, "$", (_f = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _f.toFixed(2)))), /* @__PURE__ */ React13.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React13.createElement("form", { id: "PaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc }, /* @__PURE__ */ React13.createElement("div", { className: "ach-scrl", style: { minHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "398px" : (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) == 0 ? "456px" : (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px", overflow: "auto", marginRight: "5px" } }, /* @__PURE__ */ React13.createElement("div", { className: "form-group" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "cardHolderName" }, "NAME ON CARD "), /* @__PURE__ */ React13.createElement("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
2864
- const value = e.target.value;
2865
- if (/^[a-zA-Z\s]*$/.test(value)) {
2866
- handleCardChange("cardName", value);
2867
- }
2868
- } }), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ React13.createElement("div", { className: "form-group" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "cardNumber" }, "CARD NUMBER"), /* @__PURE__ */ React13.createElement("div", { className: "toggle-num-wrapper" }, /* @__PURE__ */ React13.createElement(
2869
- "input",
2870
- {
2871
- className: "form-control card-number-new",
2872
- type: "text",
2873
- maxLength: 19,
2874
- inputMode: "numeric",
2875
- placeholder: "0000 0000 0000 0000",
2876
- value: (cardData == null ? void 0 : cardData.cardNumber) || "",
2877
- onChange: (e) => handleCardNumberChange(e),
2878
- "data-token": "card_number"
2879
- }
2880
- ), /* @__PURE__ */ React13.createElement("div", { className: "card-crdi card-expiry-new" }, /* @__PURE__ */ React13.createElement("div", { className: "exp-date-year-container" }, /* @__PURE__ */ React13.createElement("div", { className: "exp-date form-group" }, /* @__PURE__ */ React13.createElement(
2881
- "input",
2882
- {
2883
- "data-token": "exp_month",
2884
- className: "form-control required card-cvv-in",
2885
- type: "text",
2886
- style: { maxHeight: "36px" },
2887
- placeholder: "MM",
2888
- maxLength: 2,
2889
- value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
2890
- onChange: (e) => handleCardChange("expiryMonth", e.target.value)
2891
- }
2892
- )), /* @__PURE__ */ React13.createElement("div", { className: "exp-year form-group" }, /* @__PURE__ */ React13.createElement(
2893
- "input",
2894
- {
2895
- "data-token": "exp_year",
2896
- className: "form-control required card-cvv-in",
2897
- type: "text",
2898
- style: { maxHeight: "36px" },
2899
- placeholder: "YYYY",
2900
- maxLength: 4,
2901
- value: (cardData == null ? void 0 : cardData.expiryYear) || "",
2902
- onChange: (e) => handleCardChange("expiryYear", e.target.value)
2903
- }
2904
- )), /* @__PURE__ */ React13.createElement("div", { className: "security-digit form-group" }, /* @__PURE__ */ React13.createElement(
2905
- "input",
2906
- {
2907
- "data-token": "cvv",
2908
- className: "form-control card-cvv-in required",
2909
- type: "text",
2910
- style: { maxHeight: "36px" },
2911
- maxLength: 4,
2912
- placeholder: "CVC",
2913
- value: (cardData == null ? void 0 : cardData.cvv) || "",
2914
- onChange: (e) => handleCardChange("cvv", e.target.value)
2915
- }
2916
- )))), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardNumber), /* @__PURE__ */ React13.createElement("p", { style: { margin: "0" } }, (cardError == null ? void 0 : cardError.expiryMonth) || (cardError == null ? void 0 : cardError.expiryYear) ? /* @__PURE__ */ React13.createElement("span", { className: "error-span", style: { paddingRight: "4px" } }, cardError == null ? void 0 : cardError.expiryMonth) : "", (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ React13.createElement("div", { className: "form-group" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "OrderId" }, "Order ID / Description"), /* @__PURE__ */ React13.createElement(
2917
- "input",
2918
- {
2919
- type: "text",
2920
- className: "form-control",
2921
- maxLength: 100,
2922
- placeholder: "OID123456",
2923
- disabled: true,
2924
- value: (_g = props == null ? void 0 : props.orderID) != null ? _g : "",
2925
- style: { background: "#F6F6F7", color: "#727272" }
2926
- }
2927
- )), /* @__PURE__ */ React13.createElement("div", { className: "form-group" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "zip" }, "ZIP"), /* @__PURE__ */ React13.createElement("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "000000", value: (_h = cardData == null ? void 0 : cardData.zipCode) != null ? _h : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }), (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.zipCode)), (props == null ? void 0 : props.customerId) && /* @__PURE__ */ React13.createElement("div", { className: "form-group" }, /* @__PURE__ */ React13.createElement("div", { style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" } }, /* @__PURE__ */ React13.createElement(
2928
- "input",
2929
- {
2930
- type: "checkbox",
2931
- id: "save_card",
2932
- className: "toggle-checkbox",
2933
- checked: saveCardInfo,
2934
- onChange: (e) => setSaveCardInfo(e.target.checked)
2935
- }
2936
- ), /* @__PURE__ */ React13.createElement("label", { htmlFor: "save_card", className: "toggle-label" }), /* @__PURE__ */ React13.createElement("label", { htmlFor: "save_card" }, "Save card for future payments "), /* @__PURE__ */ React13.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none" }, /* @__PURE__ */ React13.createElement("g", { clipPath: "url(#clip0_12420_50192)" }, /* @__PURE__ */ React13.createElement("rect", { width: "20", height: "20", fill: "white" }), /* @__PURE__ */ React13.createElement("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }), /* @__PURE__ */ React13.createElement("path", { d: "M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z", fill: "#161616" })), /* @__PURE__ */ React13.createElement("defs", null, /* @__PURE__ */ React13.createElement("clipPath", { id: "clip0_12420_50192" }, /* @__PURE__ */ React13.createElement("rect", { width: "20", height: "20", fill: "white" }))))))), /* @__PURE__ */ React13.createElement("div", { className: "form-group", style: { marginTop: "20px", padding: "0" } }, /* @__PURE__ */ React13.createElement("button", { type: "submit", style: { margin: 0 }, className: "pay-button" }, "$", (_i = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _i.toFixed(2))))), /* @__PURE__ */ React13.createElement("div", { id: "ach", style: { display: activetab === "ach" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React13.createElement("form", { id: "ACHPaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc }, /* @__PURE__ */ React13.createElement("div", { className: "ach-scrl", style: {
2937
- minHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "378px" : (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) == 0 ? "436px" : (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px",
2938
- maxHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "358px" : (cardList == null ? void 0 : cardList.length) > 0 ? "380px" : "380px"
2939
- } }, /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "nameonaccount" }, "Name on account"), /* @__PURE__ */ React13.createElement("input", { type: "text", id: "nameonaccount", className: "form-control", maxLength: 100, placeholder: "John Doe", name: "name", value: (_j = achData == null ? void 0 : achData.name) != null ? _j : "", onChange: handleChangeAch }), (achError == null ? void 0 : achError.name) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.name)), /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "routingnumber" }, "Routing number"), /* @__PURE__ */ React13.createElement(
2940
- "input",
2941
- {
2942
- type: "text",
2943
- id: "routingnumber",
2944
- className: "form-control",
2945
- maxLength: 9,
2946
- placeholder: "000000000",
2947
- name: "routingNumber",
2948
- value: (_k = achData == null ? void 0 : achData.routingNumber) != null ? _k : "",
2949
- onChange: handleChangeAch
2950
- }
2951
- ), (achError == null ? void 0 : achError.routingNumber) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.routingNumber)), /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "accountnumber" }, "Account number"), /* @__PURE__ */ React13.createElement(
2952
- "input",
2953
- {
2954
- type: "text",
2955
- id: "accountnumber",
2956
- className: "form-control",
2957
- maxLength: 16,
2958
- placeholder: "0000000000",
2959
- name: "accountNumber",
2960
- value: (_l = achData == null ? void 0 : achData.accountNumber) != null ? _l : "",
2961
- onChange: handleChangeAch
2962
- }
2963
- ), (achError == null ? void 0 : achError.accountNumber) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.accountNumber)), /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "confirmaccountnumber" }, "Confirm account number"), /* @__PURE__ */ React13.createElement(
2964
- "input",
2965
- {
2966
- type: "text",
2967
- id: "confirmaccountnumber",
2968
- className: "form-control",
2969
- maxLength: 16,
2970
- placeholder: "0000000000",
2971
- name: "confirmAccountNumber",
2972
- value: (_m = achData == null ? void 0 : achData.confirmAccountNumber) != null ? _m : "",
2973
- onChange: handleChangeAch
2974
- }
2975
- ), (achError == null ? void 0 : achError.confirmAccountNumber) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.confirmAccountNumber)), /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "bankname" }, "Bank name"), /* @__PURE__ */ React13.createElement(
2976
- "input",
2977
- {
2978
- type: "text",
2979
- id: "bankname",
2980
- className: "form-control",
2981
- maxLength: 100,
2982
- placeholder: "My Bank",
2983
- name: "bankName",
2984
- value: (_n = achData == null ? void 0 : achData.bankName) != null ? _n : "",
2985
- onChange: handleChangeAch
2986
- }
2987
- ), (achError == null ? void 0 : achError.bankName) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.bankName)), /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "accounttype" }, "Select account type"), /* @__PURE__ */ React13.createElement("select", { name: "accountType", id: "accounttype", className: "form-control", value: (_o = achData == null ? void 0 : achData.accountType) != null ? _o : "", onChange: handleChangeAch }, /* @__PURE__ */ React13.createElement("option", { value: "" }, "Select account"), /* @__PURE__ */ React13.createElement("option", { value: "Personal Saving" }, "Personal Saving"), /* @__PURE__ */ React13.createElement("option", { value: "Business Saving" }, "Business Saving"), /* @__PURE__ */ React13.createElement("option", { value: "Personal Checking" }, "Personal Checking"), /* @__PURE__ */ React13.createElement("option", { value: "Business Checking" }, "Business Checking"))), (props == null ? void 0 : props.customerId) && /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4 save-ach-div", style: { paddingTop: "5px" } }, /* @__PURE__ */ React13.createElement("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }), /* @__PURE__ */ React13.createElement("label", { htmlFor: "saveACH" }, "Save ACH")), saveACHinfo && /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4", style: { fontSize: "12px", color: "#727272" } }, /* @__PURE__ */ React13.createElement("p", null, "If checked, I agree for ", /* @__PURE__ */ React13.createElement("b", null, "ecommerce"), " to have my permission to charge this credit card for agreed upon purchases in the future."))), /* @__PURE__ */ React13.createElement("div", { className: "form-group " }, /* @__PURE__ */ React13.createElement("button", { className: "pay-button", style: { margin: "20px 0 0" }, type: "submit" }, "$", (_p = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _p.toFixed(2))))))))))))
2988
- )));
2989
- }
2990
1600
 
2991
- // src/app/components/PreAuthCharge/PreAuthPaymentPage.tsx
2992
- import React14, { useEffect as useEffect5, useState as useState4 } from "react";
2993
- import axios4 from "axios";
2994
- import Swal2 from "sweetalert2";
2995
- import { IoArrowBack as IoArrowBack2 } from "react-icons/io5";
2996
- function PreAuthPayment(props) {
2997
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2998
- const [loading, setLoading] = useState4(false);
2999
- const [loading2, setLoading2] = useState4(false);
3000
- const [error, setError] = useState4("");
3001
- const [success, setSuccess] = useState4(false);
3002
- const [show, setShow] = useState4(false);
3003
- const [activetab, setActive] = useState4("card");
3004
- const [saveCardInfo, setSaveCardInfo] = useState4(false);
3005
- const fractalpayClientKey = props.fractalpayClientKey;
3006
- const [cardData, setCardData] = useState4();
3007
- const [cardError, setCardError] = useState4({});
3008
- const [cardList, setCardList] = useState4([]);
3009
- const [selectedCard, setSelectedCard] = useState4();
3010
- const [paymentData, setPaymentData] = useState4();
3011
- let [tranId, setTranId] = useState4("");
3012
- const showLoader = () => setLoading(true);
3013
- const hideLoader = () => setLoading(false);
3014
- const handleClose = () => {
3015
- setShow(false);
3016
- setActive("card");
3017
- setLoading2(false);
3018
- setError("");
3019
- setSuccess(false);
3020
- setTranId("");
3021
- setCardData({
3022
- cardName: "",
3023
- cardNumber: "",
3024
- expiryMonth: "",
3025
- expiryYear: "",
3026
- cvv: "",
3027
- orderId: "",
3028
- zipCode: ""
3029
- });
3030
- setCardError({
3031
- cardName: "",
3032
- cardNumber: "",
3033
- expiryMonth: "",
3034
- expiryYear: "",
3035
- cvv: "",
3036
- orderId: "",
3037
- zipCode: ""
3038
- });
3039
- setSaveCardInfo(false);
3040
- setSelectedCard({
3041
- card_type: "",
3042
- cardlastfourdigit: "",
3043
- expmonth: 1,
3044
- expyear: 2025,
3045
- primary_card: 0,
3046
- firstname: "",
3047
- id: "",
3048
- lastname: ""
3049
- });
3050
- };
3051
- const handleShow = () => setShow(true);
3052
- const handleCardChange = (field, value) => {
3053
- const name = field;
3054
- const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
3055
- if (numericFields.includes(name)) {
3056
- if (value === "" || /^[0-9]+$/.test(value)) {
3057
- setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
3058
- [name]: ""
3059
- }));
3060
- setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
3061
- [name]: value
3062
- }));
3063
- }
3064
- return;
3065
- }
3066
- setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
3067
- [name]: ""
3068
- }));
3069
- setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
3070
- [name]: value
3071
- }));
3072
- };
3073
- const handleCardNumberChange = (e) => {
3074
- const input = e.target;
3075
- const rawValue = input.value.replace(/\D/g, "");
3076
- let formatted = "";
3077
- if (/^3[47]/.test(rawValue)) {
3078
- const trimmed = rawValue.slice(0, 15);
3079
- formatted = trimmed.replace(
3080
- /^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,
3081
- (_, g1, g2, g3) => [g1, g2, g3].filter(Boolean).join(" ")
3082
- );
3083
- } else {
3084
- const trimmed = rawValue.slice(0, 16);
3085
- formatted = trimmed.replace(
3086
- /^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,
3087
- (_, g1, g2, g3, g4) => [g1, g2, g3, g4].filter(Boolean).join(" ")
3088
- );
3089
- }
3090
- setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
3091
- cardNumber: ""
3092
- }));
3093
- setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
3094
- cardNumber: formatted
3095
- }));
3096
- };
3097
- const validateCardData = () => {
3098
- var _a2, _b2, _c2, _d2, _e2, _f2;
3099
- const errors = {};
3100
- const data = cardData;
3101
- const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
3102
- const year = (data == null ? void 0 : data.expiryYear) || "";
3103
- if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
3104
- if (!((_b2 = data == null ? void 0 : data.cardNumber) == null ? void 0 : _b2.trim())) errors.cardNumber = "Card number is required";
3105
- if (!((_c2 = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _c2.trim()) || !((_d2 = data == null ? void 0 : data.expiryYear) == null ? void 0 : _d2.trim())) {
3106
- errors.expiryMonth = "Invalid Expiration Date.";
3107
- } else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
3108
- errors.expiryMonth = "Invalid Expiration Date.";
3109
- }
3110
- if (!((_e2 = data == null ? void 0 : data.cvv) == null ? void 0 : _e2.trim())) errors.cvv = "CVV is required";
3111
- if (!((_f2 = data == null ? void 0 : data.zipCode) == null ? void 0 : _f2.trim())) errors.zipCode = "ZIP code is required";
3112
- if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
3113
- const month2 = parseInt(data.expiryMonth, 10);
3114
- const year2 = parseInt(data.expiryYear, 10);
3115
- const now = /* @__PURE__ */ new Date();
3116
- const currentMonth = now.getMonth() + 1;
3117
- const currentYear = now.getFullYear();
3118
- if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
3119
- errors.expiryMonth = "Card is expired";
3120
- }
3121
- }
3122
- setCardError(errors);
3123
- return Object.keys(errors).length > 0;
3124
- };
3125
- const submitFunc = async (e) => {
3126
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
3127
- e.preventDefault();
3128
- if (activetab == "card") {
3129
- const hasError = validateCardData();
3130
- if (hasError) return;
3131
- else {
3132
- let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
3133
- let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
3134
- let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
3135
- let errors = {};
3136
- if (!validCard) errors.cardNumber = "Invalid card Number";
3137
- if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
3138
- if (!validCVV) errors.cvv = "Invalid CVV";
3139
- setCardError(errors);
3140
- if (validCard && validCVV && validExpirationDate) {
3141
- setLoading2(true);
3142
- try {
3143
- let tokenCallback = async function(response) {
3144
- if (response.Error) {
3145
- setError(response.Error);
3146
- setLoading2(false);
3147
- } else {
3148
- let name = cardData == null ? void 0 : cardData.cardName;
3149
- let postal_code = cardData == null ? void 0 : cardData.zipCode;
3150
- response.name = name;
3151
- response.postal_code = postal_code;
3152
- response.fractalpayPublicKey = props == null ? void 0 : props.fractalpayClientKey;
3153
- response.amount = props == null ? void 0 : props.amount;
3154
- response.order_id = props == null ? void 0 : props.orderID;
3155
- response.preAuth_id = "";
3156
- response.isCardSave = saveCardInfo;
3157
- response.customer_id = props == null ? void 0 : props.customerId;
3158
- response.link_token = "";
3159
- response.gateway_id = paymentData == null ? void 0 : paymentData.paymentGateway;
3160
- response.discount = props == null ? void 0 : props.discount;
3161
- response.tax = props == null ? void 0 : props.tax;
3162
- response.surcharge = props == null ? void 0 : props.surcharge;
3163
- const myHeaders = new Headers();
3164
- myHeaders.append("Content-Type", "application/json");
3165
- const requestOptions = {
3166
- method: "POST",
3167
- body: JSON.stringify(response),
3168
- redirect: "follow"
3169
- };
3170
- socketClient_default.emit("sendMessage", __spreadProps(__spreadValues({}, requestOptions), { "isChargePreauth": true }));
3171
- socketClient_default.on("charge-preauth", (data) => {
3172
- var _a3;
3173
- console.log(data, "datdata");
3174
- if ((data == null ? void 0 : data.status) == "Failed") {
3175
- setLoading2(false);
3176
- setError((data == null ? void 0 : data.message) || "Something went wrong. Please try again later.");
3177
- } else {
3178
- setSuccess(true);
3179
- setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
3180
- setLoading2(false);
3181
- setCardData({
3182
- cardName: "",
3183
- cardNumber: "",
3184
- expiryMonth: "",
3185
- expiryYear: "",
3186
- cvv: "",
3187
- orderId: "",
3188
- zipCode: ""
3189
- });
3190
- }
3191
- });
3192
- }
3193
- };
3194
- if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
3195
- const requestOptions = {
3196
- method: "POST",
3197
- redirect: "follow"
3198
- };
3199
- try {
3200
- let sesionResult = await axios4.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
3201
- let expYear = Number(cardData == null ? void 0 : cardData.expiryYear) % 100;
3202
- let cardNumber = cardData == null ? void 0 : cardData.cardNumber;
3203
- cardNumber = cardNumber == null ? void 0 : cardNumber.replace(/\s+/g, "");
3204
- let track2_data = `${cardNumber}=${expYear}${cardData == null ? void 0 : cardData.expiryMonth} ${cardData == null ? void 0 : cardData.cvv}`;
3205
- const publicKey = forge.pki.publicKeyFromPem((_b2 = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.publicKeyPem);
3206
- const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
3207
- md: forge.md.sha1.create(),
3208
- mgf1: {
3209
- md: forge.md.sha1.create()
3210
- }
3211
- });
3212
- const encryptedBase64 = forge.util.encode64(encrypted);
3213
- const myHeaders = {
3214
- "Content-Type": "application/json",
3215
- "x-app-session-key": (_d2 = (_c2 = sesionResult.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.session_key
3216
- };
3217
- const raw = JSON.stringify({
3218
- "enc_track2_data": `${encryptedBase64}`,
3219
- "algorithm": "RSAES_OAEP_SHA_1",
3220
- session_key: `${(_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key}`
3221
- });
3222
- try {
3223
- const tokenizeData = await axios4.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
3224
- const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g2.data), {
3225
- // isSaveCardChecked: saveCardInfo,
3226
- name: cardData == null ? void 0 : cardData.cardName,
3227
- postal_code: cardData == null ? void 0 : cardData.zipCode,
3228
- customer_id: props == null ? void 0 : props.customerId,
3229
- "amount": props == null ? void 0 : props.amount,
3230
- "Token": `${(_i2 = (_h2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _h2.data) == null ? void 0 : _i2.token}`,
3231
- "fractalpayPublicKey": fractalpayClientKey,
3232
- "order_id": props == null ? void 0 : props.orderID,
3233
- "preAuth_id": "",
3234
- "isCardSave": saveCardInfo,
3235
- "discount": props == null ? void 0 : props.discount,
3236
- "surcharge": props == null ? void 0 : props.surcharge,
3237
- "tax": props == null ? void 0 : props.tax,
3238
- "link_token": "",
3239
- "ExpirationYear": cardData == null ? void 0 : cardData.expiryYear,
3240
- "ExpirationMonth": cardData == null ? void 0 : cardData.expiryMonth,
3241
- "CVV": cardData == null ? void 0 : cardData.cvv,
3242
- "Last4": (_k = (_j = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _j.data) == null ? void 0 : _k.last4,
3243
- "Brand": (_m = (_l = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _l.data) == null ? void 0 : _m.brand,
3244
- "gateway_id": paymentData == null ? void 0 : paymentData.paymentGateway
3245
- }));
3246
- let myHeaders2 = {
3247
- "Content-Type": "application/json"
3248
- };
3249
- const requestOptions2 = {
3250
- method: "POST",
3251
- headers: myHeaders2,
3252
- body: reqData,
3253
- redirect: "follow"
3254
- };
3255
- socketClient_default.emit("sendMessage", __spreadProps(__spreadValues({}, requestOptions2), { "isFractalPreauth": true }));
3256
- socketClient_default.on("fractal-charge-preauth", (data) => {
3257
- var _a3;
3258
- if ((data == null ? void 0 : data.status) == "Failed") {
3259
- setLoading2(false);
3260
- setError((data == null ? void 0 : data.message) || "Something went wrong , Try again later");
3261
- } else {
3262
- setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
3263
- setSuccess(true);
3264
- setLoading2(false);
3265
- }
3266
- });
3267
- } catch (err) {
3268
- console.log(err);
3269
- setLoading2(false);
3270
- setError(((_o = (_n = err == null ? void 0 : err.response) == null ? void 0 : _n.data) == null ? void 0 : _o.message) || (err == null ? void 0 : err.message) || "Something went wrong , Try again later");
3271
- }
3272
- } catch (err) {
3273
- setLoading2(false);
3274
- setError(((_q = (_p = err == null ? void 0 : err.response) == null ? void 0 : _p.data) == null ? void 0 : _q.message) || (err == null ? void 0 : err.message) || "Something went wrong , Try again later");
3275
- }
3276
- } else {
3277
- DatacapWebToken.requestToken(paymentData == null ? void 0 : paymentData.dctoken, "PaymentForm", tokenCallback);
1601
+ .frac-card-label-text{
1602
+ color: #727272;
1603
+ font-family: Inter;
1604
+ font-size: 12px;
1605
+ font-style: normal;
1606
+ font-weight: 500;
1607
+ line-height: 18px;
1608
+ letter-spacing: -0.24px;
3278
1609
  }
3279
- } catch (err) {
3280
- setLoading2(false);
3281
- setError(((_s = (_r = err == null ? void 0 : err.response) == null ? void 0 : _r.data) == null ? void 0 : _s.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
3282
- }
3283
- }
3284
- }
3285
- }
3286
- };
3287
- const getPaymentDetails = async () => {
3288
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m, _n, _o, _p, _q, _r;
3289
- showLoader();
3290
- try {
3291
- const data = {
3292
- fractalpayPublicKey: fractalpayClientKey,
3293
- "customer_id": props == null ? void 0 : props.customerId,
3294
- preauth: true
3295
- };
3296
- let paymentData2 = await axios4.post(`${baseUrl}get-payment-details`, data);
3297
- setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
3298
- if (!((_c2 = (_b2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.paymentGateway)) {
3299
- handleClose();
3300
- setError("Something went wrong.");
3301
- }
3302
- if (((_e2 = (_d2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d2.data) == null ? void 0 : _e2.card_list) && ((_h2 = (_g2 = (_f2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _f2.data) == null ? void 0 : _g2.card_list) == null ? void 0 : _h2.length) > 0) {
3303
- setCardList((_j = (_i2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _i2.data) == null ? void 0 : _j.card_list);
3304
- setActive("cardList");
3305
- let primary_card = (_m = (_l = (_k = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _k.data) == null ? void 0 : _l.card_list) == null ? void 0 : _m.filter((card) => (card == null ? void 0 : card.primary_card) == 1);
3306
- if ((primary_card == null ? void 0 : primary_card[0]) && ((_n = primary_card == null ? void 0 : primary_card[0]) == null ? void 0 : _n.payment_method_type) == ((_p = (_o = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _o.data) == null ? void 0 : _p.paymentGateway)) {
3307
- setSelectedCard(primary_card[0]);
3308
- }
3309
- } else {
3310
- setActive("card");
3311
- }
3312
- hideLoader();
3313
- } catch (err) {
3314
- console.log(err);
3315
- hideLoader();
3316
- setError(((_r = (_q = err == null ? void 0 : err.response) == null ? void 0 : _q.data) == null ? void 0 : _r.message) || (err == null ? void 0 : err.message) || "Something went wrong");
3317
- }
3318
- };
3319
- const handlechargeCustomer = async () => {
3320
- var _b2, _c2, _d2, _e2, _f2, _g2, _h2;
3321
- let customer_id = props == null ? void 0 : props.customerId;
3322
- let discount = props == null ? void 0 : props.discount;
3323
- let surcharge = props == null ? void 0 : props.surcharge;
3324
- let tax = props == null ? void 0 : props.tax;
3325
- let fractalpayPublicKey = props == null ? void 0 : props.fractalpayClientKey;
3326
- let order_id = props == null ? void 0 : props.orderID;
3327
- let amount = props == null ? void 0 : props.amount;
3328
- let card_id = selectedCard == null ? void 0 : selectedCard.id;
3329
- let card_type = selectedCard == null ? void 0 : selectedCard.card_type;
3330
- if (fractalpayPublicKey && order_id && amount) {
3331
- if (customer_id) {
3332
- if (card_id) {
3333
- let chargeobj = {
3334
- amount,
3335
- order_id,
3336
- customer_id,
3337
- card_id,
3338
- fractalpayPublicKey,
3339
- isCardSave: card_type != "Bank",
3340
- discount,
3341
- surcharge,
3342
- tax
3343
- };
3344
- let _a2 = chargeobj, { isCardSave } = _a2, rest = __objRest(_a2, ["isCardSave"]);
3345
- let endpoint = card_type === "Bank" ? "charge-ach" : "charge-by-card";
3346
- let chargeurl = baseUrl + endpoint;
3347
- const headers = {
3348
- "Content-Type": "application/json"
3349
- };
3350
- setLoading2(true);
3351
- try {
3352
- let result = await axios4.post(chargeurl, card_type == "Bank" ? rest : chargeobj, { headers });
3353
- if ((_b2 = result == null ? void 0 : result.data) == null ? void 0 : _b2.result) {
3354
- setTranId((_d2 = (_c2 = result == null ? void 0 : result.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.transaction_id);
3355
- setSuccess(true);
3356
- setLoading2(false);
1610
+
1611
+ .frac-card-label-amount{
1612
+ color: #161616;
1613
+ text-align: center;
1614
+ font-family: Inter;
1615
+ font-size: 16px;
1616
+ font-style: normal;
1617
+ font-weight: 500;
1618
+ line-height: 140%;
1619
+ letter-spacing: -0.32px;
3357
1620
  }
3358
- } catch (err) {
3359
- setLoading2(false);
3360
- console.log(err);
3361
- setError(((_f2 = (_e2 = err == null ? void 0 : err.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.message) || ((_h2 = (_g2 = err == null ? void 0 : err.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.status) || "Something went erong");
3362
- }
3363
- } else {
3364
- setError("Please Select A Card/ACH");
3365
- }
3366
- } else {
3367
- setError("Please Select Customer");
3368
- }
3369
- } else {
3370
- setError("Something went wrong.");
3371
- }
3372
- };
3373
- useEffect5(() => {
3374
- if (show && fractalpayClientKey) {
3375
- getPaymentDetails();
3376
- }
3377
- }, [fractalpayClientKey, show]);
3378
- const handleDeleteCard = async (cardId) => {
3379
- Swal2.fire({
3380
- icon: "warning",
3381
- text: "Do you want to delete the card?",
3382
- showCancelButton: true,
3383
- confirmButtonText: "Yes",
3384
- cancelButtonText: "No",
3385
- reverseButtons: true,
3386
- buttonsStyling: false,
3387
- customClass: {
3388
- confirmButton: "swal2-confirm btn btn-dark",
3389
- cancelButton: "swal2-cancel btn btn-dark",
3390
- popup: "custom-swal-popup",
3391
- icon: "custom-swal-icon"
3392
- }
3393
- }).then(async (result) => {
3394
- if (result.isConfirmed) {
3395
- setLoading2(true);
3396
- try {
3397
- let obj = {
3398
- card_id: cardId,
3399
- customer_id: props == null ? void 0 : props.customerId,
3400
- fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey
3401
- };
3402
- const res = await axios4.post(`${baseUrl}delete-customer-card`, obj);
3403
- setLoading2(false);
3404
- getPaymentDetails();
3405
- Swal2.fire({
3406
- icon: "success",
3407
- title: "Deleted!",
3408
- text: "The card has been deleted.",
3409
- confirmButtonText: "OK",
3410
- customClass: {
3411
- confirmButton: "btn btn-dark"
1621
+
1622
+ .frac-payment-type-logo{
1623
+ width: 24px;
1624
+ height: 24px;
1625
+ aspect-ratio: 1/1;
3412
1626
  }
3413
- });
3414
- } catch (err) {
3415
- setLoading2(false);
3416
- Swal2.fire({
3417
- icon: "error",
3418
- title: "Error!",
3419
- text: "Failed to delete the card.",
3420
- confirmButtonText: "OK",
3421
- customClass: {
3422
- confirmButton: "btn btn-dark"
1627
+
1628
+ .frac-card-bank-radio-main .frac-card-bank-radio:nth-child(2){
1629
+ border-top: 1px solid #E0DFE2;
3423
1630
  }
3424
- });
3425
- }
3426
- }
3427
- });
3428
- };
3429
- return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(DataScript, null), /* @__PURE__ */ React14.createElement(Chargewidgetstyles, null), /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(
3430
- "button",
3431
- {
3432
- className: "paymentBtn",
3433
- onClick: handleShow
3434
- },
3435
- "Pre Auth Pay"
3436
- ), /* @__PURE__ */ React14.createElement(
3437
- CustomModal2_default,
3438
- {
3439
- open: show,
3440
- onClose: handleClose
3441
- },
3442
- error && /* @__PURE__ */ React14.createElement("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" } }, /* @__PURE__ */ React14.createElement(ErrorCardMessage_default, { error, onClose: handleClose })),
3443
- success && /* @__PURE__ */ React14.createElement(SuccessMsz, { onClose: handleClose, tranId }),
3444
- !error && !success && /* @__PURE__ */ React14.createElement(React14.Fragment, null, (loading || loading2) && /* @__PURE__ */ React14.createElement(Loader_default, { loading: loading || loading2 }), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("div", { className: "frac-card-payment-page frac-form" }, /* @__PURE__ */ React14.createElement("div", { className: "parent-pay-container" }, /* @__PURE__ */ React14.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React14.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React14.createElement("g", { clipPath: "url(#clip0_12425_52336)" }, /* @__PURE__ */ React14.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__ */ React14.createElement("defs", null, /* @__PURE__ */ React14.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React14.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React14.createElement("div", { className: "pay-container" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-header pay-conatiner-one" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-conatiner-one-first" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-logo-container" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-main-logo" }, /* @__PURE__ */ React14.createElement("img", { src: "https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/uploaded/merchant_logo/20250311131124_merchant_logo.png", id: "pay-logos" })), /* @__PURE__ */ React14.createElement("h1", { className: "pay-heading" }, "Pay"), (cardList == null ? void 0 : cardList.length) > 0 && activetab !== "cardList" && /* @__PURE__ */ React14.createElement("button", { className: "res-charge-payment-back-btn ", onClick: () => setActive("cardList") }, " ", /* @__PURE__ */ React14.createElement(IoArrowBack2, null), " Back")), /* @__PURE__ */ React14.createElement("div", { className: "amt-pay-con" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-amount-conatiner" }, /* @__PURE__ */ React14.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React14.createElement("strong", { className: "pay-amount" }, "$", (_a = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _a.toFixed(2))), activetab != "ach" && /* @__PURE__ */ React14.createElement("div", { style: { display: "flex", gap: "8px", margin: "8px 0" } }, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 33, alt: "" }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 33, alt: "" })))), /* @__PURE__ */ React14.createElement("div", { className: "pay-conatiner-one-last" }, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/secure-img.png", alt: "" }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/pov-by.png", alt: "" }), "Secure payments powered by Fractal"), /* @__PURE__ */ React14.createElement("div", null)), !loading && /* @__PURE__ */ React14.createElement("div", { className: "pay-tab pay-conatiner-two" }, /* @__PURE__ */ React14.createElement("div", { className: "col-md-12" }, /* @__PURE__ */ React14.createElement("div", { id: "payment-form-div" }, activetab !== "cardList" ? /* @__PURE__ */ React14.createElement("div", null, (cardList == null ? void 0 : cardList.length) > 0 && /* @__PURE__ */ React14.createElement("button", { className: "charge-payment-back-btn ", onClick: () => setActive("cardList") }, " ", /* @__PURE__ */ React14.createElement(IoArrowBack2, null), " Back"), /* @__PURE__ */ React14.createElement("div", { className: "" }, /* @__PURE__ */ React14.createElement("div", { className: "res-pay-con" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-amount-conatiner", style: { margin: 0 } }, /* @__PURE__ */ React14.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React14.createElement("strong", { className: "pay-amount" }, "$", (_b = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _b.toFixed(2))), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 35, alt: "" })), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 35, alt: "" })))))) : /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("h6", { className: "charge-customer-name", style: { marginBottom: "16px !important" } }, " Charge ", paymentData == null ? void 0 : paymentData.customer_name), /* @__PURE__ */ React14.createElement("div", { className: "res-pay-con" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-amount-conatiner", style: { margin: 0 } }, /* @__PURE__ */ React14.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React14.createElement("strong", { className: "pay-amount" }, "$", (_c = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _c.toFixed(2))), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 35, alt: "" })), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 35, alt: "" })))), /* @__PURE__ */ React14.createElement("h6", { className: "card-ach-heading", style: { marginBottom: "10px !important" } }, " Cards")), /* @__PURE__ */ React14.createElement("div", { style: { display: activetab === "cardList" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React14.createElement("div", { className: "card-lint-div-in" }, /* @__PURE__ */ React14.createElement("div", { className: "card-list-div" }, (paymentData == null ? void 0 : paymentData.card_list) && ((_d = paymentData == null ? void 0 : paymentData.card_list) == null ? void 0 : _d.length) > 0 && ((_e = paymentData == null ? void 0 : paymentData.card_list) == null ? void 0 : _e.map((card, index) => /* @__PURE__ */ React14.createElement("div", { className: "card-list-single-div", key: index }, /* @__PURE__ */ React14.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React14.createElement(
3445
- "input",
3446
- {
3447
- disabled: (paymentData == null ? void 0 : paymentData.paymentGateway) != (card == null ? void 0 : card.payment_method_type),
3448
- type: "radio",
3449
- className: "cardRadio",
3450
- name: "selected_card",
3451
- id: "",
3452
- checked: selectedCard === card,
3453
- onChange: (e) => setSelectedCard(card)
3454
- }
3455
- ), /* @__PURE__ */ React14.createElement("label", { htmlFor: "", className: "card-number-last-four" }, "**** ", card == null ? void 0 : card.cardlastfourdigit), /* @__PURE__ */ React14.createElement("h6", { className: "card-expiry-date" }, card == null ? void 0 : card.expmonth, "/", card == null ? void 0 : card.expyear)), /* @__PURE__ */ React14.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React14.createElement("span", { className: "visa-card" }, /* @__PURE__ */ React14.createElement("img", { src: (card == null ? void 0 : card.card_type) != "Bank" ? "https://dev-widget.fractalpay.com/images/visa-img.svg" : "https://dev-widget.fractalpay.com/images/bank.svg", alt: "" })), /* @__PURE__ */ React14.createElement("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id) }, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/Trash.svg", alt: "" }))))))), /* @__PURE__ */ React14.createElement("div", { className: "pay-with-other-card ", onClick: () => setActive("card") }, "Authorize With Other Card", /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/card.svg", alt: "" }))), /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer }, "$", (_f = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _f.toFixed(2)))), /* @__PURE__ */ React14.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React14.createElement("form", { id: "PaymentForm", onSubmit: submitFunc }, /* @__PURE__ */ React14.createElement("div", { className: "ach-scrl", style: { minHeight: (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px", overflow: "auto", marginRight: "5px" } }, /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("label", { htmlFor: "cardHolderName" }, "Name on Card"), /* @__PURE__ */ React14.createElement(
3456
- "input",
3457
- {
3458
- type: "text",
3459
- className: "form-control",
3460
- placeholder: "John Doe",
3461
- value: (cardData == null ? void 0 : cardData.cardName) || "",
3462
- onChange: (e) => {
3463
- const value = e.target.value;
3464
- if (/^[a-zA-Z\s]*$/.test(value)) {
3465
- handleCardChange("cardName", value);
3466
- }
3467
- }
3468
- }
3469
- ), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ React14.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ React14.createElement("div", { className: "toggle-num-wrapper" }, /* @__PURE__ */ React14.createElement(
3470
- "input",
3471
- {
3472
- className: "form-control card-number-new",
3473
- type: "text",
3474
- maxLength: 19,
3475
- inputMode: "numeric",
3476
- placeholder: "0000 0000 0000 0000",
3477
- value: (cardData == null ? void 0 : cardData.cardNumber) || "",
3478
- onChange: (e) => handleCardNumberChange(e),
3479
- "data-token": "card_number"
3480
- }
3481
- ), /* @__PURE__ */ React14.createElement("div", { className: "card-crdi card-expiry-new" }, /* @__PURE__ */ React14.createElement("div", { className: "exp-date-year-container" }, /* @__PURE__ */ React14.createElement("div", { className: "exp-date form-group" }, /* @__PURE__ */ React14.createElement(
3482
- "input",
3483
- {
3484
- "data-token": "exp_month",
3485
- className: "form-control required card-cvv-in",
3486
- type: "text",
3487
- style: { maxHeight: "36px" },
3488
- placeholder: "MM",
3489
- maxLength: 2,
3490
- value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
3491
- onChange: (e) => handleCardChange("expiryMonth", e.target.value)
3492
- }
3493
- )), /* @__PURE__ */ React14.createElement("div", { className: "exp-year form-group" }, /* @__PURE__ */ React14.createElement(
3494
- "input",
3495
- {
3496
- "data-token": "exp_year",
3497
- className: "form-control required card-cvv-in",
3498
- type: "text",
3499
- style: { maxHeight: "36px" },
3500
- placeholder: "YYYY",
3501
- maxLength: 4,
3502
- value: (cardData == null ? void 0 : cardData.expiryYear) || "",
3503
- onChange: (e) => handleCardChange("expiryYear", e.target.value)
3504
- }
3505
- )), /* @__PURE__ */ React14.createElement("div", { className: "security-digit form-group" }, /* @__PURE__ */ React14.createElement(
3506
- "input",
3507
- {
3508
- "data-token": "cvv",
3509
- className: "form-control required card-cvv-in",
3510
- type: "text",
3511
- style: { maxHeight: "36px" },
3512
- maxLength: 4,
3513
- placeholder: "CVC",
3514
- value: (cardData == null ? void 0 : cardData.cvv) || "",
3515
- onChange: (e) => handleCardChange("cvv", e.target.value)
3516
- }
3517
- )))), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ React14.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardNumber), /* @__PURE__ */ React14.createElement("p", { style: { margin: "0" } }, (cardError == null ? void 0 : cardError.expiryMonth) || (cardError == null ? void 0 : cardError.expiryYear) ? /* @__PURE__ */ React14.createElement("span", { className: "error-span", style: { paddingRight: "4px" } }, cardError == null ? void 0 : cardError.expiryMonth) : "", (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ React14.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("label", { htmlFor: "OrderId" }, "Order ID / Description"), /* @__PURE__ */ React14.createElement(
3518
- "input",
3519
- {
3520
- type: "text",
3521
- className: "form-control",
3522
- maxLength: 100,
3523
- placeholder: "OID123456",
3524
- disabled: true,
3525
- value: (_g = cardData == null ? void 0 : cardData.orderId) != null ? _g : "OID123456",
3526
- onChange: (e) => handleCardChange("orderId", e.target.value),
3527
- style: { background: "#F6F6F7", color: "#727272" }
3528
- }
3529
- )), /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("label", { htmlFor: "zip" }, "ZIP"), /* @__PURE__ */ React14.createElement("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "000000", value: (_h = cardData == null ? void 0 : cardData.zipCode) != null ? _h : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }), (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ React14.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.zipCode)), (props == null ? void 0 : props.customerId) && /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("div", { style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" } }, /* @__PURE__ */ React14.createElement(
3530
- "input",
3531
- {
3532
- type: "checkbox",
3533
- id: "save_card",
3534
- className: "toggle-checkbox",
3535
- checked: saveCardInfo,
3536
- onChange: (e) => setSaveCardInfo(e.target.checked)
3537
- }
3538
- ), /* @__PURE__ */ React14.createElement("label", { htmlFor: "save_card", className: "toggle-label" }), /* @__PURE__ */ React14.createElement("label", { htmlFor: "save_card" }, "Save card for future payments "), /* @__PURE__ */ React14.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none" }, /* @__PURE__ */ React14.createElement("g", { clipPath: "url(#clip0_12420_50192)" }, /* @__PURE__ */ React14.createElement("rect", { width: "20", height: "20", fill: "white" }), /* @__PURE__ */ React14.createElement("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }), /* @__PURE__ */ React14.createElement("path", { d: "M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z", fill: "#161616" })), /* @__PURE__ */ React14.createElement("defs", null, /* @__PURE__ */ React14.createElement("clipPath", { id: "clip0_12420_50192" }, /* @__PURE__ */ React14.createElement("rect", { width: "20", height: "20", fill: "white" }))))))), /* @__PURE__ */ React14.createElement("div", { className: "form-group", style: { marginTop: "20px", padding: 0 } }, /* @__PURE__ */ React14.createElement("button", { type: "submit", style: { margin: 0 }, className: "pay-button" }, "$", (_i = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _i.toFixed(2)))))))))))))
3539
- )));
3540
- }
3541
1631
 
3542
- // src/app/components/AddCard/AddCardEasyPay.tsx
3543
- import React18, { useEffect as useEffect6, useState as useState5 } from "react";
3544
- import Swal3 from "sweetalert2";
3545
- import axios5 from "axios";
3546
-
3547
- // src/app/components/AddCard/AddCardStyles.tsx
3548
- import React15 from "react";
3549
- function AddCardStyle() {
3550
- const primarycolor = "#000";
3551
- const primarybgcolor = "#fff";
3552
- const primarybodycolor = "#212529";
3553
- const primarybordercolor = "#dee2e6";
3554
- return /* @__PURE__ */ React15.createElement("style", null, `
1632
+ .frac-card-bank-radio.frac-active {
1633
+ background: #F6F6F7;
1634
+ }
1635
+ `)}import rt from"react";var ln=({listHeading:e="Card",ListItems:y,selectedCard:T,setSelectedCard:O,paymentGateway:Y,handleDeleteCard:Te,otherButtonAction:I,otherButtonLabel:Ge,headingClass:Pe})=>{let de=R+"widget/Trash.svg";return console.log(T,"selectedCard another",y),rt.createElement(rt.Fragment,null,rt.createElement("h6",{className:Pe||"card-ach-heading",style:{marginBottom:"10px !important"}},e),rt.createElement("div",{className:"card-lint-div-in"},rt.createElement("div",{className:"card-list-div"},y&&(y==null?void 0:y.length)>0&&(y==null?void 0:y.map((o,X)=>{let b=!1;return Y&&(b=Y!=(o==null?void 0:o.payment_method_type)&&(o==null?void 0:o.card_type)!="Bank"),rt.createElement("div",{key:o==null?void 0:o.id,className:"card-list-single-div"},rt.createElement("div",{className:"card-number-radio"},rt.createElement("input",{disabled:b,type:"radio",className:"cardRadio",name:"selected_card",id:"",checked:(T==null?void 0:T.id)===(o==null?void 0:o.id),onChange:c=>O(o)}),rt.createElement("label",{htmlFor:"",className:"card-number-last-four"},"**** ",o==null?void 0:o.cardlastfourdigit),(o==null?void 0:o.card_type)!="Bank"&&rt.createElement("h6",{className:"card-expiry-date"},o==null?void 0:o.expmonth,"/",o==null?void 0:o.expyear)),rt.createElement("div",{className:"card-number-radio"},rt.createElement("span",{className:"visa-card"},rt.createElement("img",{src:Qn(o==null?void 0:o.card_type),alt:""})),rt.createElement("span",{className:"visa-card",style:{cursor:"pointer"},onClick:()=>Te(o==null?void 0:o.id)},rt.createElement("img",{src:de,alt:""}))))}))),rt.createElement("div",{className:"pay-with-other-card",onClick:I},Ge,rt.createElement("img",{src:hn,alt:""}))))};function Ti(e){var at,Pt,Ve,ue,ft,Bt,Vt,Ke,Qt,Ct,He,Ze,Zt,Tt,Wt,ot,Kt,nn;let[y,T]=Ee(!1),[O,Y]=Ee(!1),[Te,I]=Ee(""),[Ge,Pe]=Ee(!1),[de,o]=Ee(!1),[X,b]=Ee("card"),[c,h]=Ee("card"),[Ie,Z]=Ee("form"),[x,ke]=Ee("form"),[Q,Le]=Ee(!0),[u,st]=Ee(!1),[W,lt]=Ee(!1),v=e.merchantPublicKey,qe=R+"widget/mc-img.svg",U=R+"widget/visa-img.svg",N=R+"widget/ae-img.svg",f=R+"widget/discover-img.svg",ge=R+"widget/card.svg",ce=R+"widget/Trash.svg",p=R+"widget/bank.svg",m=R+"widget/secure-img.png",G=R+"widget/pov-by.png",q=R+"widget/pax.svg",[g,M]=Ee(),[d,E]=Ee({}),[s,V]=Ee(),[A,xe]=Ee({}),[J,Je]=Ee([]),[tt,Re]=Ee([]),[je,Ft]=Ee(),[$e,nt]=Ee(),[we,St]=Ee(Number(e==null?void 0:e.amount));console.log(je,"selectedCard");let[K,it]=Ee(),[Ye,ct]=Ee(""),bt=()=>T(!0),At=()=>T(!1),jt=(F,l)=>{let H=(parseFloat(l)||0)/100,Fe=F/(1+H);return Math.round(Fe*100)/100};Dn(()=>{if(de){let F=jt(e==null?void 0:e.amount,(e==null?void 0:e.surcharge)||0);St(F)}},[de,e==null?void 0:e.pass_fee,e==null?void 0:e.amount,e==null?void 0:e.surcharge]);let w=()=>{o(!1),b("card"),I(""),Pe(!1),ct(""),V({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),xe({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),M({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),E({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),lt(!1),st(!1),Ft({card_type:"",cardlastfourdigit:"",expmonth:1,expyear:2025,primary_card:0,firstname:"",id:"",lastname:""}),nt({}),St(0),h("card"),Le(!0),ke("form"),Z("form"),Y(!1),T(!1),Re([]),Je([])},L=()=>o(!0),pe=F=>{b(F)},fe=(F,l)=>{let H=F;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(H)){(l===""||/^[0-9]+$/.test(l))&&(E(ee=>z(k({},ee),{[H]:""})),M(ee=>z(k({},ee),{[H]:l})));return}E(ee=>z(k({},ee),{[H]:""})),M(ee=>z(k({},ee),{[H]:l}))},re=F=>{let H=F.target.value.replace(/\D/g,""),Fe="";/^3[47]/.test(H)?Fe=H.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(r,i,P,j)=>[i,P,j].filter(Boolean).join(" ")):Fe=H.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(r,i,P,j,C)=>[i,P,j,C].filter(Boolean).join(" ")),E(ee=>z(k({},ee),{cardNumber:""})),M(ee=>z(k({},ee),{cardNumber:Fe}))},oe=F=>{let{name:l,value:H}=F.target,Fe=["routingNumber","accountNumber","confirmAccountNumber"];if(l=="name"){/^[a-zA-Z\s]*$/.test(H)&&(xe(ee=>z(k({},ee),{[l]:""})),V(ee=>z(k({},ee),{[l]:H})));return}if(Fe.includes(l)){(H===""||/^[0-9]+$/.test(H))&&(xe(ee=>z(k({},ee),{[l]:""})),V(ee=>z(k({},ee),{[l]:H})));return}xe(ee=>z(k({},ee),{[l]:""})),V(ee=>z(k({},ee),{[l]:H}))},Oe=()=>{var ee,r,i,P,j,C;let F={},l=g,H=parseInt((l==null?void 0:l.expiryMonth)||"",10),Fe=(l==null?void 0:l.expiryYear)||"";if((ee=l==null?void 0:l.cardName)!=null&&ee.trim()||(F.cardName="Card name is required"),(r=l==null?void 0:l.cardNumber)!=null&&r.trim()||(F.cardNumber="Card number is required"),(!((i=l==null?void 0:l.expiryMonth)!=null&&i.trim())||!((P=l==null?void 0:l.expiryYear)!=null&&P.trim())||isNaN(H)||H<1||H>12||Fe.length!==4)&&(F.expiryMonth="Invalid Expiration Date."),(j=l==null?void 0:l.cvv)!=null&&j.trim()||(F.cvv="CVV is required"),(C=l==null?void 0:l.zipCode)!=null&&C.trim()||(F.zipCode="ZIP code is required"),l!=null&&l.expiryMonth&&(l!=null&&l.expiryYear)&&l.expiryMonth.length<=2&&l.expiryYear.length===4){let D=parseInt(l.expiryMonth,10),$=parseInt(l.expiryYear,10),ne=new Date,me=ne.getMonth()+1,ie=ne.getFullYear();($<ie||$===ie&&D<me)&&(F.expiryMonth="Card is expired")}return E(F),Object.keys(F).length>0},be=()=>{var H,Fe,ee,r,i,P,j,C;let F={},l=s;return(H=l==null?void 0:l.name)!=null&&H.trim()||(F.name="Name is required"),(Fe=l==null?void 0:l.accountNumber)!=null&&Fe.trim()||(F.accountNumber="Account number is required"),(ee=l==null?void 0:l.accountNumber)!=null&&ee.trim()&&((r=l==null?void 0:l.accountNumber)==null?void 0:r.trim())!==((i=l==null?void 0:l.confirmAccountNumber)==null?void 0:i.trim())&&(F.confirmAccountNumber="Account numbers must match"),(P=l==null?void 0:l.bankName)!=null&&P.trim()||(F.bankName="Bank name is required"),(j=l==null?void 0:l.routingNumber)!=null&&j.trim()||(F.routingNumber="Routing Number is required"),l!=null&&l.routingNumber&&((C=l==null?void 0:l.routingNumber)==null?void 0:C.length)!==9&&(F.routingNumber="Routing number must be 9 digits"),((l==null?void 0:l.accountType)==="business saving"||(l==null?void 0:l.accountType)==="business checking")&&(!(l!=null&&l.companyName)||(l==null?void 0:l.companyName)==="")&&(F.companyName="Company Name is required for business accounts"),xe(F),Object.keys(F).length>0},Xe=async F=>{var l,H,Fe,ee,r,i,P,j,C,D,$,ne,me,ie,ae,Se;if(F.preventDefault(),X!=="ach"){if(Oe())return;{let Me=DatacapWebToken.validateCardNumber(g==null?void 0:g.cardNumber.replaceAll(" ","")),te=DatacapWebToken.validateExpirationDate(g==null?void 0:g.expiryMonth,g==null?void 0:g.expiryYear),wt=DatacapWebToken.validateCVV(g==null?void 0:g.cvv),he={};if(Me||(he.cardNumber="Invalid card Number"),te||(he.expiryMonth="Invalid Expiration Date."),wt||(he.cvv="Invalid CVV"),E(he),Me&&wt&&te){Y(!0);try{let Ue=z(k({},g),{amount:`${e.amount||0}`,fractalpayPublicKey:v,orderId:e==null?void 0:e.orderID,customer_id:e==null?void 0:e.customerId,discount:e==null?void 0:e.discount,surcharge:e==null?void 0:e.surcharge,tax:e==null?void 0:e.tax,pass_fee:e==null?void 0:e.pass_fee}),Be=await dn.post(`${ze}create-widget-order`,Ue),ye=async function(_e){if(_e.Error)I(_e.Error),Y(!1);else{let se=g==null?void 0:g.cardName,ht=g==null?void 0:g.zipCode;_e.name=se,_e.postal_code=ht,_e.isCardSave=`${u}`,_e.isCharge=!0,_e.posSalesIdEncode=Be==null?void 0:Be.data.data.posSalesIdEncode,kt.emit("sendMessage",_e),kt.on(Be==null?void 0:Be.data.data.posSalesIdEncode,qt=>{if(An(qt==null?void 0:qt.data)){let Lt=JSON.parse(qt.data);Lt!=null&&Lt.result?(M({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),st(!1),ct(Lt==null?void 0:Lt.transactionId),Pe(!0),Y(!1)):(Y(!1),I((Lt==null?void 0:Lt.message)||"Something went wrong."))}else I("Something went wrong.")})}};if((K==null?void 0:K.paymentGateway)===32){let _e={method:"POST",redirect:"follow"};try{let se=await dn.post(`${Ne}api/v1/widget/generate-session`,_e),ht=Number(g==null?void 0:g.expiryYear)%100,qt=g==null?void 0:g.cardNumber;qt=qt==null?void 0:qt.replace(/\s+/g,"");let Lt=`${qt}=${ht}${g==null?void 0:g.expiryMonth} ${g==null?void 0:g.cvv}`,Dt=forge.pki.publicKeyFromPem((H=(l=se==null?void 0:se.data)==null?void 0:l.data)==null?void 0:H.publicKeyPem).encrypt(Lt,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),Pn=forge.util.encode64(Dt),zt={"Content-Type":"application/json","x-app-session-key":(ee=(Fe=se.data)==null?void 0:Fe.data)==null?void 0:ee.session_key},Ut=JSON.stringify({enc_track2_data:`${Pn}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(i=(r=se==null?void 0:se.data)==null?void 0:r.data)==null?void 0:i.session_key}`});try{let mt=await dn.post(`${yt}tokenizer/tokenize`,Ut,{headers:zt}),Ln=JSON.stringify(z(k({},(P=mt==null?void 0:mt.data)==null?void 0:P.data),{isSaveCardChecked:u,name:g==null?void 0:g.cardName,postal_code:g==null?void 0:g.zipCode,customer_id:e==null?void 0:e.customerId})),Rt=JSON.stringify({pre_sales_id:`${(C=(j=Be==null?void 0:Be.data)==null?void 0:j.data)==null?void 0:C.posSalesIdEncode}`,token:`${(D=mt==null?void 0:mt.data)==null?void 0:D.data.token}`,json_response:`${Ln}`}),ni={method:"POST",headers:JSON.stringify({"Content-Type":"application/json"}),body:Rt,redirect:"follow",isChargeviafractal:!0};kt.emit("sendMessage",ni),kt.on("chargeviafractalgateway",rn=>{var Vn;if(An(rn==null?void 0:rn.data)){let Gt=JSON.parse(rn==null?void 0:rn.data);Gt!=null&&Gt.result?(ct((Vn=Gt==null?void 0:Gt.data)==null?void 0:Vn.transactionId),Pe(!0),Y(!1)):(Y(!1),I((Gt==null?void 0:Gt.message)||"Something went wrong."))}else I("Something went wrong.")})}catch(mt){Y(!1),I(((ne=($=mt==null?void 0:mt.response)==null?void 0:$.data)==null?void 0:ne.message)||(mt==null?void 0:mt.message)||"Something went wrong.")}}catch(se){Y(!1),I(((ie=(me=se==null?void 0:se.response)==null?void 0:me.data)==null?void 0:ie.message)||(se==null?void 0:se.message)||"Something went wrong.")}}else typeof DatacapWebToken!="undefined"&&DatacapWebToken.requestToken(Be==null?void 0:Be.data.data.dctoken,"PaymentForm",ye)}catch(Ue){Y(!1),I(((Se=(ae=Ue==null?void 0:Ue.response)==null?void 0:ae.data)==null?void 0:Se.message)||(Ue==null?void 0:Ue.message)||"Something went wrong.")}}}}else{if(be())return;{Y(!0);let Me={fractalpayPublicKey:v,label:(s==null?void 0:s.name)||"John Doe",account_number:s==null?void 0:s.accountNumber,routing_number:s==null?void 0:s.routingNumber,bank_name:s==null?void 0:s.bankName,account_type:s==null?void 0:s.accountType,amount:String(we||0),isSaveAch:W,customer_id:e==null?void 0:e.customerId,order_id:e==null?void 0:e.orderID,tax:e==null?void 0:e.tax,discount:e==null?void 0:e.discount,surcharge:e==null?void 0:e.surcharge,isChargeACH:!0,company_name:(s==null?void 0:s.companyName)||""};kt.emit("sendMessage",Me),kt.on("ach-incoming",te=>{var wt;(te==null?void 0:te.status)=="Failed"?typeof(te==null?void 0:te.message)=="object"?Object.values(te==null?void 0:te.message).forEach(he=>{I(he||"Something went wrong")}):I((te==null?void 0:te.message)||"Something went wrong"):(ct((wt=te==null?void 0:te.data)==null?void 0:wt.transaction_id),Pe(!0),Y(!1))})}}},et=async()=>{var F,l,H,Fe,ee,r,i,P,j,C,D,$,ne,me,ie,ae,Se,We,Me,te,wt,he,Ue;bt();try{let Be={fractalpayPublicKey:v,customer_id:e==null?void 0:e.customerId,pass_fee:e==null?void 0:e.pass_fee},ye=await dn.post(`${ze}get-payment-details`,Be);if(it((F=ye==null?void 0:ye.data)==null?void 0:F.data),(H=(l=ye==null?void 0:ye.data)==null?void 0:l.data)!=null&&H.paymentGateway||(w(),I("Something went wrong.")),(ee=(Fe=ye==null?void 0:ye.data)==null?void 0:Fe.data)!=null&&ee.card_list&&((P=(i=(r=ye==null?void 0:ye.data)==null?void 0:r.data)==null?void 0:i.card_list)==null?void 0:P.length)>0){let _e=(D=(C=(j=ye==null?void 0:ye.data)==null?void 0:j.data)==null?void 0:C.card_list)==null?void 0:D.filter(ht=>(ht==null?void 0:ht.card_type)=="Bank"),se=(me=(ne=($=ye==null?void 0:ye.data)==null?void 0:$.data)==null?void 0:ne.card_list)==null?void 0:me.filter(ht=>(ht==null?void 0:ht.card_type)!=="Bank");console.log(_e,"hohgohoo",se),(se==null?void 0:se.length)>0&&Z("list"),(_e==null?void 0:_e.length)>0&&ke("list"),Je(se),Re(_e)}else b("card");(ae=(ie=ye==null?void 0:ye.data)==null?void 0:ie.data)!=null&&ae.paymentDeviceList&&((Me=(We=(Se=ye==null?void 0:ye.data)==null?void 0:Se.data)==null?void 0:We.paymentDeviceList)==null?void 0:Me.length)>0&&nt((wt=(te=ye==null?void 0:ye.data)==null?void 0:te.data)==null?void 0:wt.paymentDeviceList[0]),At()}catch(Be){console.log(Be),At(),I(((Ue=(he=Be==null?void 0:Be.response)==null?void 0:he.data)==null?void 0:Ue.message)||(Be==null?void 0:Be.message)||"Something went wrong")}},pt=async()=>{let F=e==null?void 0:e.customerId,l=String(e==null?void 0:e.discount),H=String(e==null?void 0:e.surcharge),Fe=String(e==null?void 0:e.tax),ee=e==null?void 0:e.merchantPublicKey,r=e==null?void 0:e.orderID,i=String(e==null?void 0:e.amount),P=je==null?void 0:je.id,j=je==null?void 0:je.card_type;if(ee&&r&&i&&we)if(F)if(P){let D={amount:j==="Bank"?we:i,order_id:r,customer_id:F,card_id:P,fractalpayPublicKey:ee,isCardSave:u,discount:l,surcharge:H,tax:Fe},C=D,{isCardSave:$}=C,ne=kn(C,["isCardSave"]),ie=ze+(j==="Bank"?"charge-ach":"charge-by-card"),ae={"Content-Type":"application/json"};Y(!0),kt.emit("sendMessage",{url:ie,body:j=="Bank"?ne:D,isChargebycard:!0}),kt.on("charge-by-card",Se=>{var We;(Se==null?void 0:Se.result)==!0||(Se==null?void 0:Se.status)==!0?(ct((We=Se.data)==null?void 0:We.transaction_id),Pe(!0),Y(!1)):I((Se==null?void 0:Se.message)||"Something went wrong.")})}else I("Please Select A Card/ACH");else I("Please Select Customer");else I("Something went wrong.")},ut=async()=>{var ee,r,i,P,j,C;let F=e==null?void 0:e.merchantPublicKey,l=e==null?void 0:e.orderID,H=String(e==null?void 0:e.amount),Fe=e==null?void 0:e.customerId;if(!($e!=null&&$e.device_id)){I("Please Select A Payment Device");return}if(F&&l&&H){Y(!0);let D={amount:H,fractalpayPublicKey:F,customer_order_id:l,device_id:$e==null?void 0:$e.device_id,customer_id:Fe||""};try{let $=await dn.post(`${ze}charge-with-reader`,D);((ee=$==null?void 0:$.data)==null?void 0:ee.result)==!0?(ct((i=(r=$==null?void 0:$.data)==null?void 0:r.data)==null?void 0:i.transaction_id),Pe(!0),Y(!1)):(I(((P=$==null?void 0:$.data)==null?void 0:P.message)||"Something went wrong."),Y(!1))}catch($){I(((C=(j=$==null?void 0:$.response)==null?void 0:j.data)==null?void 0:C.message)||"Something went wrong."),Y(!1)}}else I("Something went wrong.")},dt=()=>{c==="card"?pt():c==="reader"&&ut()};Dn(()=>{de&&v&&et()},[v,de]);let gt=async F=>{xn.fire({icon:"warning",text:"Do you want to delete the card?",showCancelButton:!0,confirmButtonText:"Yes",cancelButtonText:"No",reverseButtons:!0,buttonsStyling:!1,customClass:{confirmButton:"swal2-confirm btn btn-dark",cancelButton:"swal2-cancel btn btn-dark",popup:"custom-swal-popup",icon:"custom-swal-icon"}}).then(async l=>{if(l.isConfirmed){Y(!0);try{let H={card_id:F,customer_id:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey},Fe=await dn.post(`${ze}delete-customer-card`,H);Y(!1),et(),xn.fire({icon:"success",title:"Deleted!",text:"Card deleted.",confirmButtonText:"OK",showConfirmButton:!0,timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}})}catch(H){Y(!1),xn.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}else l.dismiss===xn.DismissReason.cancel&&xn.fire({icon:"info",text:"Card not deleted",confirmButtonText:"OK",buttonsStyling:!1,customClass:{confirmButton:"btn btn-dark float-end",actions:"swal2-actions-end"}})})},vt=F=>{switch(F==null?void 0:F.toLowerCase()){case"visa":return U;case"mastercard":case"mc":case"m/c":return qe;case"amex":case"american express":case"ae":return N;case"discover":case"dcvr":return f;case"bank":return p;default:return F}},Mt=()=>{let F=we||0;return(Number(e.amount)-F).toFixed(0)};return console.log(Ie,"activeinCard","activeinBank",x),t.createElement(t.Fragment,null,t.createElement(Yt,null),t.createElement(gn,null),t.createElement(yn,null),t.createElement(t.Fragment,null,t.createElement("button",{className:"paymentBtn",onClick:L},"Pay"),t.createElement($t,{open:de,onClose:w},Te&&t.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},t.createElement(Et,{error:Te,onClose:w})),Ge&&t.createElement(fn,{onClose:w,tranId:Ye}),!Te&&!Ge&&t.createElement(t.Fragment,null,(y||O)&&t.createElement(Nt,{loading:y||O}),t.createElement("div",{className:"frac-card-payment-page frac-form"},t.createElement("div",{className:"parent-pay-container"},t.createElement("span",{className:"request-payment-close-popup",onClick:w},t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},t.createElement("g",{clipPath:"url(#clip0_12425_52336)"},t.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"})),t.createElement("defs",null,t.createElement("clipPath",{id:"clip0_12425_52336"},t.createElement("rect",{width:"16",height:"16",fill:"white"}))))),t.createElement("div",{className:"pay-main-logo-res"},t.createElement("img",{src:K==null?void 0:K.logo,id:"pay-logos"})),t.createElement("div",{className:"pay-container"},t.createElement("div",{className:"pay-header pay-conatiner-one frac-pay-conatiner-one"},t.createElement("div",{className:"pay-conatiner-one-first"},t.createElement("div",{className:"pay-logo-container"},t.createElement("div",{className:"pay-main-logo"},t.createElement("img",{src:K==null?void 0:K.logo,id:"pay-logos"})),(J==null?void 0:J.length)>0&&X!=="cardList"&&t.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>b("cardList")}," ",t.createElement(Sn,null)," Back")),t.createElement("div",{className:"amt-pay-con"},t.createElement("div",{className:"pay-amount-conatiner"},t.createElement("small",{className:"pay-payment-amount"},"Select paymet type")),t.createElement("div",{className:"frac-card-bank-radio-main"},t.createElement(sn,{label:"Card",amount:(at=Number(e==null?void 0:e.amount))==null?void 0:at.toFixed(2),value:"card",onChange:pe,activetab:X}),(K==null?void 0:K.isSkyFiAccount)&&t.createElement(sn,{label:"Bank",amount:(Pt=Number(we))==null?void 0:Pt.toFixed(2),value:"ach",onChange:pe,activetab:X})),we&&we>0&&(e!=null&&e.pass_fee)?t.createElement("div",{className:"frac-cash-discount-fee"},t.createElement("small",null,X==="card"?"Cash Discount":"Cash Discount Savings"," "),t.createElement("p",null,"$",(Number(e.amount)-we).toFixed(2))):null)),t.createElement("div",{className:"pay-conatiner-one-last"},t.createElement("img",{src:m,alt:""}),t.createElement("img",{src:G,alt:""}),"Secure payments powered by Fractal")),t.createElement("div",{className:"pay-tab pay-conatiner-two"},!y&&t.createElement("div",{className:"col-md-12"},t.createElement("div",{id:"payment-form-div"},X!=="cardList"?t.createElement("div",{className:"frac-charge-payment-back-btn-wrap "},(J==null?void 0:J.length)>0&&t.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>b("cardList")}," ",t.createElement(Sn,null)," Back"),(K==null?void 0:K.isSkyFiAccount)&&t.createElement("div",{className:"tab"},t.createElement("button",{className:"tablinks",onClick:F=>{pe("card")},style:{border:X==="card"?"1px solid":""}},t.createElement("i",{className:"fas fa-credit-card me-2",style:{marginRight:"8px",fontSize:"15px"}}),"Card"),t.createElement("button",{className:"tablinks",onClick:F=>{pe("ach")},style:{border:X==="ach"?"1px solid":""}},t.createElement("i",{className:"fas fa-university me-2",style:{marginRight:"8px",fontSize:"15px"}}),"Bank")),t.createElement("div",{className:"res-pay-con"},t.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},t.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),t.createElement("strong",{className:"pay-amount"},"$",(Ve=Number(e==null?void 0:e.amount))==null?void 0:Ve.toFixed(2))),X!="ach"&&t.createElement("div",null,t.createElement("div",null,t.createElement("img",{src:U,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:qe,width:35,alt:""})),t.createElement("div",null,t.createElement("img",{src:N,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:f,width:35,alt:""})))),we&&we>0&&t.createElement("div",{className:"res-pay-con frac-cash-discount"},t.createElement("div",{className:"frac-cashlabel"},"Cash Discount"),t.createElement("div",null,"$",we))):t.createElement("div",null,t.createElement("h6",{className:"charge-customer-name",style:{marginBottom:"16px !important"}}," Charge ",K==null?void 0:K.customer_name),t.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}}," ",c==="card"?"Cards/Banks":"Readers"," "),t.createElement("div",{className:"res-pay-con"},t.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},t.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),t.createElement("strong",{className:"pay-amount"},"$",(ue=Number(e==null?void 0:e.amount))==null?void 0:ue.toFixed(2))),t.createElement("div",null,t.createElement("div",null,t.createElement("img",{src:U,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:qe,width:35,alt:""})),t.createElement("div",null,t.createElement("img",{src:N,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:f,width:35,alt:""}))))),t.createElement("div",{id:"card",style:{display:X==="card"?"block":"none"},className:"tabcontent"},t.createElement("div",{className:"frac-card-payment"},t.createElement("div",{className:"frac-heading-card-wrap"},t.createElement("div",{className:"frac-backarrow"},(J==null?void 0:J.length)>0&&Ie==="form"&&t.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>Z("list")}," ",t.createElement(Sn,null)),we&&we>0&&t.createElement("div",{className:"res-pay-con frac-cash-discount"},t.createElement("div",{className:"frac-cashlabel"},"Cash Discount"),t.createElement("div",null,"$",we))),t.createElement("h6",{className:"frac-card-payment-heading"},"Card Payment")),X!="ach"&&t.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0px 19px 0px"}},t.createElement("img",{src:U,alt:"",width:33}),t.createElement("img",{src:qe,width:33,alt:""}),t.createElement("img",{src:N,alt:"",width:33}),t.createElement("img",{src:f,width:33,alt:""}))),Ie==="list"?t.createElement(t.Fragment,null,t.createElement(ln,{listHeading:"Cards",paymentGateway:K==null?void 0:K.paymentGateway,ListItems:J,selectedCard:je,setSelectedCard:Ft,handleDeleteCard:gt,otherButtonLabel:"Pay With Other Card",otherButtonAction:()=>{Z("form")}}),t.createElement("div",{className:"form-group",style:{padding:"0"}},t.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:dt},"$",(ft=Number(e==null?void 0:e.amount))==null?void 0:ft.toFixed(2)))):t.createElement("form",{id:"PaymentForm",style:{textAlign:"start"},onSubmit:Xe},t.createElement("div",{className:"ach-scrl",style:{minHeight:K!=null&&K.isSkyFiAccount&&(J==null?void 0:J.length)>0?"444px":K!=null&&K.isSkyFiAccount&&(J==null?void 0:J.length)==0?"456px":(J==null?void 0:J.length)>0?"462px":"520px",overflow:"auto",marginRight:"5px"}},t.createElement("div",{className:"form-group"},t.createElement("label",{htmlFor:"cardHolderName"},"NAME ON CARD "),t.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"John Doe",value:(g==null?void 0:g.cardName)||"",onChange:F=>{let l=F.target.value;/^[a-zA-Z\s]*$/.test(l)&&fe("cardName",l)}}),(d==null?void 0:d.cardName)&&t.createElement("span",{className:"error-span"},d==null?void 0:d.cardName)),t.createElement("div",{className:"form-group"},t.createElement("label",{htmlFor:"cardNumber"},"CARD NUMBER"),t.createElement("div",{className:"toggle-num-wrapper"},t.createElement("input",{className:"form-control card-number-new",type:"text",maxLength:19,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:(g==null?void 0:g.cardNumber)||"",onChange:F=>re(F),"data-token":"card_number"}),t.createElement("div",{className:"card-crdi card-expiry-new"},t.createElement("div",{className:"exp-date-year-container"},t.createElement("div",{className:"exp-date form-group"},t.createElement("input",{"data-token":"exp_month",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"MM",maxLength:2,value:(g==null?void 0:g.expiryMonth)||"",onChange:F=>fe("expiryMonth",F.target.value)})),t.createElement("div",{className:"exp-year form-group"},t.createElement("input",{"data-token":"exp_year",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"YYYY",maxLength:4,value:(g==null?void 0:g.expiryYear)||"",onChange:F=>fe("expiryYear",F.target.value)})),t.createElement("div",{className:"security-digit form-group"},t.createElement("input",{"data-token":"cvv",className:"form-control card-cvv-in required",type:"text",style:{maxHeight:"36px"},maxLength:4,placeholder:"CVC",value:(g==null?void 0:g.cvv)||"",onChange:F=>fe("cvv",F.target.value)})))),(d==null?void 0:d.cardNumber)&&t.createElement("span",{className:"error-span"},d==null?void 0:d.cardNumber),t.createElement("p",{style:{margin:"0"}},d!=null&&d.expiryMonth||d!=null&&d.expiryYear?t.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},d==null?void 0:d.expiryMonth):"",(d==null?void 0:d.cvv)&&t.createElement("span",{className:"error-span"},d==null?void 0:d.cvv)))),t.createElement("div",{className:"form-group"},t.createElement("label",{htmlFor:"OrderId"},"Order ID / Description"),t.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"OID123456",disabled:!0,value:(Bt=e==null?void 0:e.orderID)!=null?Bt:"",style:{background:"#F6F6F7",color:"#727272"}})),t.createElement("div",{className:"form-group"},t.createElement("label",{htmlFor:"zip"},"ZIP"),t.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"000000",value:(Vt=g==null?void 0:g.zipCode)!=null?Vt:"",onChange:F=>fe("zipCode",F.target.value)}),(d==null?void 0:d.zipCode)&&t.createElement("span",{className:"error-span"},d==null?void 0:d.zipCode)),(e==null?void 0:e.customerId)&&t.createElement("div",{className:"form-group"},t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},t.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:u,onChange:F=>st(F.target.checked)}),t.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),t.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},t.createElement("g",{clipPath:"url(#clip0_12420_50192)"},t.createElement("rect",{width:"20",height:"20",fill:"white"}),t.createElement("circle",{cx:"10",cy:"10",r:"10",fill:"#E0DFE2"}),t.createElement("path",{d:"M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z",fill:"#161616"})),t.createElement("defs",null,t.createElement("clipPath",{id:"clip0_12420_50192"},t.createElement("rect",{width:"20",height:"20",fill:"white"}))))))),t.createElement("div",{className:"form-group",style:{marginTop:"20px",padding:"0"}},(K==null?void 0:K.paymentDeviceList)&&((Ke=K==null?void 0:K.paymentDeviceList)==null?void 0:Ke.length)>0&&t.createElement("button",{type:"button",style:{marginBottom:"10px"},className:"pay-button",onClick:()=>Le(!Q)},Q?"Pay With Reader":"Pay With Card"),t.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},"$",(Qt=Number(e==null?void 0:e.amount))==null?void 0:Qt.toFixed(2))))),t.createElement("div",{id:"ach",style:{display:X==="ach"?"block":"none"},className:"tabcontent"},t.createElement("div",{className:"frac-card-payment"},t.createElement("div",{className:"frac-heading-card-wrap"},t.createElement("div",{className:"frac-backarrow"},(tt==null?void 0:tt.length)>0&&x==="form"&&t.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>ke("list")}," ",t.createElement(Sn,null)),we&&we>0&&t.createElement("div",{className:"res-pay-con frac-cash-discount"},t.createElement("div",{className:"frac-cashlabel"},"Cash Discount Savings"),t.createElement("div",null,"$",Mt()))),t.createElement("h6",{className:"frac-card-payment-heading"},"Bank Payment"))),x==="list"?t.createElement(t.Fragment,null,t.createElement(ln,{listHeading:"Banks",paymentGateway:K==null?void 0:K.paymentGateway,ListItems:tt,selectedCard:je,setSelectedCard:Ft,handleDeleteCard:gt,otherButtonLabel:"Pay With Other Bank",otherButtonAction:()=>{ke("form")}}),t.createElement("div",{className:"form-group",style:{padding:"0"}},t.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:dt},"$",(Ct=Number(we))==null?void 0:Ct.toFixed(2)))):t.createElement("form",{id:"ACHPaymentForm",style:{textAlign:"start"},onSubmit:Xe},t.createElement("div",{className:"ach-scrl",style:{minHeight:K!=null&&K.isSkyFiAccount&&(J==null?void 0:J.length)>0?"444px":K!=null&&K.isSkyFiAccount&&(J==null?void 0:J.length)==0?"436px":(J==null?void 0:J.length)>0?"462px":"520px",maxHeight:K!=null&&K.isSkyFiAccount&&(J==null?void 0:J.length)>0?"444px":((J==null?void 0:J.length)>0,"380px")}},t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"nameonaccount"},"Name on account"),t.createElement("input",{type:"text",id:"nameonaccount",className:"form-control",maxLength:100,placeholder:"John Doe",name:"name",value:(He=s==null?void 0:s.name)!=null?He:"",onChange:oe}),(A==null?void 0:A.name)&&t.createElement("span",{className:"error-span"},A==null?void 0:A.name)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"routingnumber"},"Routing number"),t.createElement("input",{type:"text",id:"routingnumber",className:"form-control",maxLength:9,placeholder:"000000000",name:"routingNumber",value:(Ze=s==null?void 0:s.routingNumber)!=null?Ze:"",onChange:oe}),(A==null?void 0:A.routingNumber)&&t.createElement("span",{className:"error-span"},A==null?void 0:A.routingNumber)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"accountnumber"},"Account number"),t.createElement("input",{type:"text",id:"accountnumber",className:"form-control",maxLength:16,placeholder:"0000000000",name:"accountNumber",value:(Zt=s==null?void 0:s.accountNumber)!=null?Zt:"",onChange:oe}),(A==null?void 0:A.accountNumber)&&t.createElement("span",{className:"error-span"},A==null?void 0:A.accountNumber)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"confirmaccountnumber"},"Confirm account number"),t.createElement("input",{type:"text",id:"confirmaccountnumber",className:"form-control",maxLength:16,placeholder:"0000000000",name:"confirmAccountNumber",value:(Tt=s==null?void 0:s.confirmAccountNumber)!=null?Tt:"",onChange:oe}),(A==null?void 0:A.confirmAccountNumber)&&t.createElement("span",{className:"error-span"},A==null?void 0:A.confirmAccountNumber)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"bankname"},"Bank name"),t.createElement("input",{type:"text",id:"bankname",className:"form-control",maxLength:100,placeholder:"My Bank",name:"bankName",value:(Wt=s==null?void 0:s.bankName)!=null?Wt:"",onChange:oe}),(A==null?void 0:A.bankName)&&t.createElement("span",{className:"error-span"},A==null?void 0:A.bankName)),((s==null?void 0:s.accountType)==="business saving"||(s==null?void 0:s.accountType)==="business checking")&&t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"companyName"},"Company name"),t.createElement("input",{type:"text",id:"companyName",className:"form-control",maxLength:100,placeholder:"My Company",name:"companyName",value:(ot=s==null?void 0:s.companyName)!=null?ot:"",onChange:oe}),(A==null?void 0:A.companyName)&&t.createElement("span",{className:"error-span"},A==null?void 0:A.companyName)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"accounttype"},"Select account type"),t.createElement("select",{name:"accountType",id:"accounttype",className:"form-control",value:(Kt=s==null?void 0:s.accountType)!=null?Kt:"",onChange:oe},t.createElement("option",{value:""},"Select account"),Fn.map(F=>t.createElement("option",{key:F.value,value:F.value},F.label)))),(e==null?void 0:e.customerId)&&t.createElement("div",{className:"form-group mb-4 save-ach-div",style:{paddingTop:"5px"}},t.createElement("input",{type:"checkbox",id:"saveACH",className:"",maxLength:100,placeholder:"My Bank",checked:W,onChange:F=>lt(F.target.checked)}),t.createElement("label",{htmlFor:"saveACH"},"Save ACH")),W&&t.createElement("div",{className:"form-group mb-4",style:{fontSize:"12px",color:"#727272"}},t.createElement("p",null,"If checked, I agree for ",t.createElement("b",null,"ecommerce")," to have my permission to charge this credit card for agreed upon purchases in the future."))),t.createElement("div",{className:"form-group "},t.createElement("button",{className:"pay-button",style:{margin:"20px 0 0"},type:"submit"},"$",(nn=Number(we))==null?void 0:nn.toFixed(2)))))))))))))))}import a,{useEffect as Rn,useState as _t}from"react";import bn from"axios";import Bn from"sweetalert2";import{IoArrowBack as ei}from"react-icons/io5";function qi(e){var we,St,K,it,Ye,ct,bt,At,jt;let[y,T]=_t(!1),[O,Y]=_t(!1),[Te,I]=_t(""),[Ge,Pe]=_t(!1),[de,o]=_t(!1),[X,b]=_t("card"),[c,h]=_t(!1),Ie=e.merchantPublicKey,Z=R+"widget/mc-img.svg",x=R+"widget/visa-img.svg",ke=R+"widget/ae-img.svg",Q=R+"widget/discover-img.svg",Le=R+"widget/card.svg",u=R+"widget/Trash.svg",st=R+"widget/bank.svg",W=R+"widget/secure-img.png",lt=R+"widget/pov-by.png",[v,qe]=_t(),[U,N]=_t({}),[f,ge]=_t([]),[ce,p]=_t(),[m,G]=_t(void 0),[q,g]=_t(),[M,d]=_t(""),E=(w,L)=>{let pe=(parseFloat(L)||0)/100,fe=w/(1+pe);return Math.round(fe*100)/100};Rn(()=>{if(e!=null&&e.pass_fee){let w=E(e==null?void 0:e.amount,e==null?void 0:e.surcharge);G(w)}},[e==null?void 0:e.pass_fee]);let s=()=>T(!0),V=()=>T(!1),A=()=>{o(!1),b("card"),Y(!1),I(""),Pe(!1),d(""),qe({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),N({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),h(!1),p({card_type:"",cardlastfourdigit:"",expmonth:1,expyear:2025,primary_card:0,firstname:"",id:"",lastname:""})},xe=()=>o(!0),J=(w,L)=>{let pe=w;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(pe)){(L===""||/^[0-9]+$/.test(L))&&(N(re=>z(k({},re),{[pe]:""})),qe(re=>z(k({},re),{[pe]:L})));return}N(re=>z(k({},re),{[pe]:""})),qe(re=>z(k({},re),{[pe]:L}))},Je=w=>{let pe=w.target.value.replace(/\D/g,""),fe="";/^3[47]/.test(pe)?fe=pe.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(oe,Oe,be,Xe)=>[Oe,be,Xe].filter(Boolean).join(" ")):fe=pe.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(oe,Oe,be,Xe,et)=>[Oe,be,Xe,et].filter(Boolean).join(" ")),N(re=>z(k({},re),{cardNumber:""})),qe(re=>z(k({},re),{cardNumber:fe}))},tt=()=>{var re,oe,Oe,be,Xe,et;let w={},L=v,pe=parseInt((L==null?void 0:L.expiryMonth)||"",10),fe=(L==null?void 0:L.expiryYear)||"";if((re=L==null?void 0:L.cardName)!=null&&re.trim()||(w.cardName="Card name is required"),(oe=L==null?void 0:L.cardNumber)!=null&&oe.trim()||(w.cardNumber="Card number is required"),(!((Oe=L==null?void 0:L.expiryMonth)!=null&&Oe.trim())||!((be=L==null?void 0:L.expiryYear)!=null&&be.trim())||isNaN(pe)||pe<1||pe>12||fe.length!==4)&&(w.expiryMonth="Invalid Expiration Date."),(Xe=L==null?void 0:L.cvv)!=null&&Xe.trim()||(w.cvv="CVV is required"),(et=L==null?void 0:L.zipCode)!=null&&et.trim()||(w.zipCode="ZIP code is required"),L!=null&&L.expiryMonth&&(L!=null&&L.expiryYear)&&L.expiryMonth.length<=2&&L.expiryYear.length===4){let pt=parseInt(L.expiryMonth,10),ut=parseInt(L.expiryYear,10),dt=new Date,gt=dt.getMonth()+1,vt=dt.getFullYear();(ut<vt||ut===vt&&pt<gt)&&(w.expiryMonth="Card is expired")}return N(w),Object.keys(w).length>0},Re=async w=>{var L,pe,fe,re,oe,Oe,be,Xe,et,pt,ut,dt,gt,vt,Mt,at,Pt,Ve,ue;if(w.preventDefault(),X=="card"){if(tt())return;{let Bt=DatacapWebToken.validateCardNumber(v==null?void 0:v.cardNumber.replaceAll(" ","")),Vt=DatacapWebToken.validateExpirationDate(v==null?void 0:v.expiryMonth,v==null?void 0:v.expiryYear),Ke=DatacapWebToken.validateCVV(v==null?void 0:v.cvv),Qt={};if(Bt||(Qt.cardNumber="Invalid card Number"),Vt||(Qt.expiryMonth="Invalid Expiration Date."),Ke||(Qt.cvv="Invalid CVV"),N(Qt),Bt&&Ke&&Vt){Y(!0);try{let Ct=async function(He){if(He.Error)I(He.Error),Y(!1);else{let Ze=v==null?void 0:v.cardName,Zt=v==null?void 0:v.zipCode;He.name=Ze,He.postal_code=Zt,He.fractalpayPublicKey=e==null?void 0:e.merchantPublicKey,He.amount=e==null?void 0:e.amount,He.order_id=e==null?void 0:e.orderID,He.preAuth_id="",He.isCardSave=c,He.customer_id=e==null?void 0:e.customerId,He.link_token="",He.gateway_id=q==null?void 0:q.paymentGateway,He.discount=e==null?void 0:e.discount,He.tax=e==null?void 0:e.tax,He.surcharge=e==null?void 0:e.surcharge,He.pass_fee=e==null?void 0:e.pass_fee,new Headers().append("Content-Type","application/json");let Wt={method:"POST",body:JSON.stringify(He),redirect:"follow"};kt.emit("sendMessage",z(k({},Wt),{isChargePreauth:!0})),kt.on("charge-preauth",ot=>{var Kt;console.log(ot,"datdata"),(ot==null?void 0:ot.status)=="Failed"?(Y(!1),I((ot==null?void 0:ot.message)||"Something went wrong. Please try again later.")):(Pe(!0),d((Kt=ot==null?void 0:ot.data)==null?void 0:Kt.transaction_id),Y(!1),qe({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}))})}};if((q==null?void 0:q.paymentGateway)===32){let He={method:"POST",redirect:"follow"};try{let Ze=await bn.post(`${Ne}api/v1/widget/generate-session`,He),Zt=Number(v==null?void 0:v.expiryYear)%100,Tt=v==null?void 0:v.cardNumber;Tt=Tt==null?void 0:Tt.replace(/\s+/g,"");let Wt=`${Tt}=${Zt}${v==null?void 0:v.expiryMonth} ${v==null?void 0:v.cvv}`,Kt=forge.pki.publicKeyFromPem((pe=(L=Ze==null?void 0:Ze.data)==null?void 0:L.data)==null?void 0:pe.publicKeyPem).encrypt(Wt,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),nn=forge.util.encode64(Kt),F={"Content-Type":"application/json","x-app-session-key":(re=(fe=Ze.data)==null?void 0:fe.data)==null?void 0:re.session_key},l=JSON.stringify({enc_track2_data:`${nn}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(Oe=(oe=Ze==null?void 0:Ze.data)==null?void 0:oe.data)==null?void 0:Oe.session_key}`});try{let H=await bn.post(`${yt}tokenizer/tokenize`,l,{headers:F}),Fe=JSON.stringify(z(k({},(be=H==null?void 0:H.data)==null?void 0:be.data),{name:v==null?void 0:v.cardName,postal_code:v==null?void 0:v.zipCode,customer_id:e==null?void 0:e.customerId,amount:e==null?void 0:e.amount,Token:`${(et=(Xe=H==null?void 0:H.data)==null?void 0:Xe.data)==null?void 0:et.token}`,fractalpayPublicKey:Ie,order_id:e==null?void 0:e.orderID,preAuth_id:"",isCardSave:c,discount:e==null?void 0:e.discount,surcharge:e==null?void 0:e.surcharge,tax:e==null?void 0:e.tax,link_token:"",ExpirationYear:v==null?void 0:v.expiryYear,ExpirationMonth:v==null?void 0:v.expiryMonth,CVV:v==null?void 0:v.cvv,Last4:(ut=(pt=H==null?void 0:H.data)==null?void 0:pt.data)==null?void 0:ut.last4,Brand:(gt=(dt=H==null?void 0:H.data)==null?void 0:dt.data)==null?void 0:gt.brand,gateway_id:q==null?void 0:q.paymentGateway,pass_fee:e==null?void 0:e.pass_fee})),r={method:"POST",headers:{"Content-Type":"application/json"},body:Fe,redirect:"follow"};kt.emit("sendMessage",z(k({},r),{isFractalPreauth:!0})),kt.on("fractal-charge-preauth",i=>{var P;(i==null?void 0:i.status)=="Failed"?(Y(!1),I((i==null?void 0:i.message)||"Something went wrong , Try again later")):(d((P=i==null?void 0:i.data)==null?void 0:P.transaction_id),Pe(!0),Y(!1))})}catch(H){console.log(H),Y(!1),I(((Mt=(vt=H==null?void 0:H.response)==null?void 0:vt.data)==null?void 0:Mt.message)||(H==null?void 0:H.message)||"Something went wrong , Try again later")}}catch(Ze){Y(!1),I(((Pt=(at=Ze==null?void 0:Ze.response)==null?void 0:at.data)==null?void 0:Pt.message)||(Ze==null?void 0:Ze.message)||"Something went wrong , Try again later")}}else DatacapWebToken.requestToken(q==null?void 0:q.dctoken,"PaymentForm",Ct)}catch(Ct){Y(!1),I(((ue=(Ve=Ct==null?void 0:Ct.response)==null?void 0:Ve.data)==null?void 0:ue.message)||(Ct==null?void 0:Ct.message)||"Something went wrong.")}}}}},je=async()=>{var w,L,pe,fe,re,oe,Oe,be,Xe,et,pt,ut,dt,gt,vt,Mt,at,Pt;s();try{let Ve={fractalpayPublicKey:Ie,customer_id:e==null?void 0:e.customerId,preauth:!0},ue=await bn.post(`${ze}get-payment-details`,Ve);if(g((w=ue==null?void 0:ue.data)==null?void 0:w.data),(pe=(L=ue==null?void 0:ue.data)==null?void 0:L.data)!=null&&pe.paymentGateway||(A(),I("Something went wrong.")),(re=(fe=ue==null?void 0:ue.data)==null?void 0:fe.data)!=null&&re.card_list&&((be=(Oe=(oe=ue==null?void 0:ue.data)==null?void 0:oe.data)==null?void 0:Oe.card_list)==null?void 0:be.length)>0){ge((et=(Xe=ue==null?void 0:ue.data)==null?void 0:Xe.data)==null?void 0:et.card_list),b("cardList");let ft=(dt=(ut=(pt=ue==null?void 0:ue.data)==null?void 0:pt.data)==null?void 0:ut.card_list)==null?void 0:dt.filter(Bt=>(Bt==null?void 0:Bt.primary_card)==1);ft!=null&&ft[0]&&((gt=ft==null?void 0:ft[0])==null?void 0:gt.payment_method_type)==((Mt=(vt=ue==null?void 0:ue.data)==null?void 0:vt.data)==null?void 0:Mt.paymentGateway)&&p(ft[0])}else b("card");V()}catch(Ve){console.log(Ve),V(),I(((Pt=(at=Ve==null?void 0:Ve.response)==null?void 0:at.data)==null?void 0:Pt.message)||(Ve==null?void 0:Ve.message)||"Something went wrong")}},Ft=async()=>{var pt,ut,dt,gt,vt,Mt,at;let w=e==null?void 0:e.customerId,L=e==null?void 0:e.discount,pe=e==null?void 0:e.surcharge,fe=e==null?void 0:e.tax,re=e==null?void 0:e.merchantPublicKey,oe=e==null?void 0:e.orderID,Oe=e==null?void 0:e.amount,be=ce==null?void 0:ce.id,Xe=ce==null?void 0:ce.card_type;if(re&&oe&&Oe)if(w)if(be){let Pt={amount:Oe,order_id:oe,customer_id:w,card_id:be,fractalpayPublicKey:re,isCardSave:Xe!="Bank",discount:L,surcharge:pe,tax:fe},et=Pt,{isCardSave:Ve}=et,ue=kn(et,["isCardSave"]),Bt=ze+"authorize-by-card",Vt={"Content-Type":"application/json"};Y(!0);try{let Ke=await bn.post(Bt,Xe=="Bank"?ue:Pt,{headers:Vt});(pt=Ke==null?void 0:Ke.data)!=null&&pt.result&&(d((dt=(ut=Ke==null?void 0:Ke.data)==null?void 0:ut.data)==null?void 0:dt.transaction_id),Pe(!0),Y(!1))}catch(Ke){Y(!1),console.log(Ke),I(((vt=(gt=Ke==null?void 0:Ke.response)==null?void 0:gt.data)==null?void 0:vt.message)||((at=(Mt=Ke==null?void 0:Ke.response)==null?void 0:Mt.data)==null?void 0:at.status)||"Something went erong")}}else I("Please Select A Card/ACH");else I("Please Select Customer");else I("Something went wrong.")};Rn(()=>{de&&Ie&&je()},[Ie,de]);let $e=async w=>{Bn.fire({icon:"warning",text:"Do you want to delete the card?",showCancelButton:!0,confirmButtonText:"Yes",cancelButtonText:"No",reverseButtons:!0,buttonsStyling:!1,customClass:{confirmButton:"swal2-confirm btn btn-dark",cancelButton:"swal2-cancel btn btn-dark",popup:"custom-swal-popup",icon:"custom-swal-icon"}}).then(async L=>{if(L.isConfirmed){Y(!0);try{let pe={card_id:w,customer_id:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey},fe=await bn.post(`${ze}delete-customer-card`,pe);Y(!1),je(),Bn.fire({icon:"success",title:"Deleted!",text:"The card has been deleted.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}catch(pe){Y(!1),Bn.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}})},nt=w=>{switch(w==null?void 0:w.toLowerCase()){case"visa":return x;case"mastercard":case"mc":case"m/c":return Z;case"amex":case"american express":case"ae":return ke;case"discover":case"dcvr":return Q;case"bank":return st;default:return w}};return a.createElement(a.Fragment,null,a.createElement(Yt,null),a.createElement(gn,null),a.createElement(a.Fragment,null,a.createElement("button",{className:"paymentBtn",onClick:xe},"PreAuth Payment"),a.createElement($t,{open:de,onClose:A},Te&&a.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},a.createElement(Et,{error:Te,onClose:A})),Ge&&a.createElement(fn,{onClose:A,tranId:M}),!Te&&!Ge&&a.createElement(a.Fragment,null,(y||O)&&a.createElement(Nt,{loading:y||O}),a.createElement("div",null,a.createElement("div",{className:"frac-card-payment-page frac-form"},a.createElement("div",{className:"parent-pay-container"},a.createElement("span",{className:"request-payment-close-popup",onClick:A},a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},a.createElement("g",{clipPath:"url(#clip0_12425_52336)"},a.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"})),a.createElement("defs",null,a.createElement("clipPath",{id:"clip0_12425_52336"},a.createElement("rect",{width:"16",height:"16",fill:"white"}))))),a.createElement("div",{className:"pay-container"},a.createElement("div",{className:"pay-header pay-conatiner-one"},a.createElement("div",{className:"pay-conatiner-one-first"},a.createElement("div",{className:"pay-logo-container"},a.createElement("div",{className:"pay-main-logo"},a.createElement("img",{src:q==null?void 0:q.logo,id:"pay-logos"})),a.createElement("h1",{className:"pay-heading"},"Pay"),(f==null?void 0:f.length)>0&&X!=="cardList"&&a.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>b("cardList")}," ",a.createElement(ei,null)," Back")),a.createElement("div",{className:"amt-pay-con"},a.createElement("div",{className:"pay-amount-conatiner"},a.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),a.createElement("strong",{className:"pay-amount"},"$",(we=Number(e==null?void 0:e.amount))==null?void 0:we.toFixed(2)),m&&m>0&&a.createElement("div",{style:{width:"80%"},className:"frac-cash-discount"},a.createElement("div",{className:"frac-cashlabel"},"Cash Discount"),a.createElement("div",null,"$",m.toFixed(2)))),X!="ach"&&a.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0"}},a.createElement("img",{src:x,alt:"",width:33}),a.createElement("img",{src:Z,width:33,alt:""}),a.createElement("img",{src:ke,alt:"",width:33}),a.createElement("img",{src:Q,width:33,alt:""})))),a.createElement("div",{className:"pay-conatiner-one-last"},a.createElement("img",{src:W,alt:""}),a.createElement("img",{src:lt,alt:""}),"Secure payments powered by Fractal"),a.createElement("div",null)),!y&&a.createElement("div",{className:"pay-tab pay-conatiner-two"},a.createElement("div",{className:"col-md-12"},a.createElement("div",{id:"payment-form-div"},X!=="cardList"?a.createElement("div",null,(f==null?void 0:f.length)>0&&a.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>b("cardList")}," ",a.createElement(ei,null)," Back"),a.createElement("div",{className:""},a.createElement("div",{className:"res-pay-con"},a.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},a.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),a.createElement("strong",{className:"pay-amount"},"$",(St=Number(e==null?void 0:e.amount))==null?void 0:St.toFixed(2))),a.createElement("div",null,a.createElement("div",null,a.createElement("img",{src:x,alt:"",width:35,style:{paddingRight:"5px"}}),a.createElement("img",{src:Z,width:35,alt:""})),a.createElement("div",null,a.createElement("img",{src:ke,alt:"",width:35,style:{paddingRight:"5px"}}),a.createElement("img",{src:Q,width:35,alt:""})))),m&&m>0&&a.createElement("div",{className:"res-pay-con frac-cash-discount"},a.createElement("div",{className:"frac-cashlabel"},"Cash Discount"),a.createElement("div",null,"$",m)))):a.createElement("div",null,a.createElement("h6",{className:"charge-customer-name",style:{marginBottom:"16px !important"}}," Charge ",q==null?void 0:q.customer_name),a.createElement("div",{className:"res-pay-con"},a.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},a.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),a.createElement("strong",{className:"pay-amount"},"$",(K=Number(e==null?void 0:e.amount))==null?void 0:K.toFixed(2))),a.createElement("div",null,a.createElement("div",null,a.createElement("img",{src:x,alt:"",width:35,style:{paddingRight:"5px"}}),a.createElement("img",{src:Z,width:35,alt:""})),a.createElement("div",null,a.createElement("img",{src:ke,alt:"",width:35,style:{paddingRight:"5px"}}),a.createElement("img",{src:Q,width:35,alt:""})))),a.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}}," Cards")),a.createElement("div",{style:{display:X==="cardList"?"block":"none"},className:"tabcontent"},a.createElement("div",{className:"card-lint-div-in"},a.createElement("div",{className:"card-list-div"},(q==null?void 0:q.card_list)&&((it=q==null?void 0:q.card_list)==null?void 0:it.length)>0&&((Ye=q==null?void 0:q.card_list)==null?void 0:Ye.map((w,L)=>a.createElement("div",{className:"card-list-single-div",key:L},a.createElement("div",{className:"card-number-radio"},a.createElement("input",{disabled:(q==null?void 0:q.paymentGateway)!=(w==null?void 0:w.payment_method_type),type:"radio",className:"cardRadio",name:"selected_card",id:"",checked:ce===w,onChange:pe=>p(w)}),a.createElement("label",{htmlFor:"",className:"card-number-last-four"},"**** ",w==null?void 0:w.cardlastfourdigit),a.createElement("h6",{className:"card-expiry-date"},w==null?void 0:w.expmonth,"/",w==null?void 0:w.expyear)),a.createElement("div",{className:"card-number-radio"},a.createElement("span",{className:"visa-card"},a.createElement("img",{src:nt(w==null?void 0:w.card_type),alt:""})),a.createElement("span",{className:"visa-card",style:{cursor:"pointer"},onClick:()=>$e(w==null?void 0:w.id)},a.createElement("img",{src:u,alt:""}))))))),a.createElement("div",{className:"pay-with-other-card ",onClick:()=>b("card")},"Authorize With Other Card",a.createElement("img",{src:Le,alt:""}))),a.createElement("div",{className:"form-group"},a.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:Ft},"$",(ct=Number(e==null?void 0:e.amount))==null?void 0:ct.toFixed(2)))),a.createElement("div",{id:"card",style:{display:X==="card"?"block":"none"},className:"tabcontent"},a.createElement("form",{id:"PaymentForm",onSubmit:Re},a.createElement("div",{className:"ach-scrl",style:{minHeight:(f==null?void 0:f.length)>0?"462px":"520px",overflow:"auto",marginRight:"5px"}},a.createElement("div",{className:"form-group"},a.createElement("label",{htmlFor:"cardHolderName"},"Name on Card"),a.createElement("input",{type:"text",className:"form-control",placeholder:"John Doe",value:(v==null?void 0:v.cardName)||"",onChange:w=>{let L=w.target.value;/^[a-zA-Z\s]*$/.test(L)&&J("cardName",L)}}),(U==null?void 0:U.cardName)&&a.createElement("span",{className:"error-span"},U==null?void 0:U.cardName)),a.createElement("div",{className:"form-group"},a.createElement("label",{htmlFor:"cardNumber"},"Card Number"),a.createElement("div",{className:"toggle-num-wrapper"},a.createElement("input",{className:"form-control card-number-new",type:"text",maxLength:19,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:(v==null?void 0:v.cardNumber)||"",onChange:w=>Je(w),"data-token":"card_number"}),a.createElement("div",{className:"card-crdi card-expiry-new"},a.createElement("div",{className:"exp-date-year-container"},a.createElement("div",{className:"exp-date form-group"},a.createElement("input",{"data-token":"exp_month",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"MM",maxLength:2,value:(v==null?void 0:v.expiryMonth)||"",onChange:w=>J("expiryMonth",w.target.value)})),a.createElement("div",{className:"exp-year form-group"},a.createElement("input",{"data-token":"exp_year",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"YYYY",maxLength:4,value:(v==null?void 0:v.expiryYear)||"",onChange:w=>J("expiryYear",w.target.value)})),a.createElement("div",{className:"security-digit form-group"},a.createElement("input",{"data-token":"cvv",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},maxLength:4,placeholder:"CVC",value:(v==null?void 0:v.cvv)||"",onChange:w=>J("cvv",w.target.value)})))),(U==null?void 0:U.cardNumber)&&a.createElement("span",{className:"error-span"},U==null?void 0:U.cardNumber),a.createElement("p",{style:{margin:"0"}},U!=null&&U.expiryMonth||U!=null&&U.expiryYear?a.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},U==null?void 0:U.expiryMonth):"",(U==null?void 0:U.cvv)&&a.createElement("span",{className:"error-span"},U==null?void 0:U.cvv)))),a.createElement("div",{className:"form-group"},a.createElement("label",{htmlFor:"OrderId"},"Order ID / Description"),a.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"OID123456",disabled:!0,value:(bt=v==null?void 0:v.orderId)!=null?bt:"OID123456",onChange:w=>J("orderId",w.target.value),style:{background:"#F6F6F7",color:"#727272"}})),a.createElement("div",{className:"form-group"},a.createElement("label",{htmlFor:"zip"},"ZIP"),a.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"000000",value:(At=v==null?void 0:v.zipCode)!=null?At:"",onChange:w=>J("zipCode",w.target.value)}),(U==null?void 0:U.zipCode)&&a.createElement("span",{className:"error-span"},U==null?void 0:U.zipCode)),(e==null?void 0:e.customerId)&&a.createElement("div",{className:"form-group"},a.createElement("div",{className:"frac-tooltip-mn",style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},a.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:c,onChange:w=>h(w.target.checked)}),a.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),a.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),a.createElement("div",{className:"frac-tooltip-wrapper"},a.createElement("div",{className:"frac-tooltip-icon"},a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},a.createElement("g",{clipPath:"url(#clip0_12420_50192)"},a.createElement("rect",{width:"20",height:"20",fill:"white"}),a.createElement("circle",{cx:"10",cy:"10",r:"10",fill:"#E0DFE2"}),a.createElement("path",{d:"M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z",fill:"#161616"})),a.createElement("defs",null,a.createElement("clipPath",{id:"clip0_12420_50192"},a.createElement("rect",{width:"20",height:"20",fill:"white"}))))),a.createElement("div",{className:"frac-tooltip-text"},a.createElement("p",null,"If checked, I agree to give the ",a.createElement("b",null,(q==null?void 0:q.bname)||"merchant")," permission to charge this credit card for agreed-upon purchases in the future.")))))),a.createElement("div",{className:"form-group",style:{marginTop:"20px",padding:0}},a.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},"$",(jt=Number(e==null?void 0:e.amount))==null?void 0:jt.toFixed(2))))))))))))))))}import le,{useEffect as ji,useRef as vn,useState as on}from"react";import Vi from"sweetalert2";import mn from"axios";import $i from"react";function Tn(){let e="#000",y="#fff",T="#212529",O="#dee2e6";return $i.createElement("style",null,`
3555
1636
  .add-card {
3556
1637
  max-width:380px;
3557
1638
  padding: 0 20px
@@ -3810,16 +1891,7 @@ function AddCardStyle() {
3810
1891
  }
3811
1892
  }
3812
1893
 
3813
- `);
3814
- }
3815
-
3816
- // src/app/components/SuccessCardMessage/SuccessCardMsz.tsx
3817
- import React17 from "react";
3818
-
3819
- // src/app/components/SuccessCardMessage/SuccessCardMszStyle.tsx
3820
- import React16 from "react";
3821
- function SuccessCardMszStyle() {
3822
- return /* @__PURE__ */ React16.createElement("style", null, `
1894
+ `)}import Ht from"react";import Yi from"react";function qn(){return Yi.createElement("style",null,`
3823
1895
  .card-success .logo-container {
3824
1896
  display: flex;
3825
1897
  justify-content: center;
@@ -3907,402 +1979,877 @@ function SuccessCardMszStyle() {
3907
1979
  color: #161616;
3908
1980
  opacity: 0.5;
3909
1981
  }
3910
- `);
3911
- }
1982
+ `)}var Hi=({onClose:e})=>Ht.createElement(Ht.Fragment,null,Ht.createElement(qn,null),Ht.createElement("div",{className:"card-success"},Ht.createElement("div",{className:"payment-success-container"},Ht.createElement("div",{className:"success-icon"},Ht.createElement("div",{className:"circle"},Ht.createElement("i",{className:"fa fa-check-circle","aria-hidden":"true"})),Ht.createElement("div",{className:"success-text"},Ht.createElement("div",{className:"payment-success-text"},"Your card was added successfully."),Ht.createElement("div",{className:"thank-you-text"},"Thank you ")))))),ti=Hi;function Ki(e){var ce;let[y,T]=on(!1),[O,Y]=on(!1),[Te,I]=on(""),[Ge,Pe]=on(!1),de=vn(null),o=vn(null),X=vn(null),b=vn(null),c=vn(null),[h,Ie]=on(),[Z,x]=on({}),[ke,Q]=on(),Le=()=>T(!0),u=()=>T(!1),st=p=>{Vi.fire({icon:"error",text:p,customClass:{popup:"custom-z-index"}})},W=()=>{Pe(!1),Y(!1),I(""),Ie({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""})},lt=()=>Pe(!0),v=()=>{W()},qe=(p,m)=>{var g,M,d;let G=p,q=["expiryMonth","expiryYear","zipCode","cvv"];if(console.log(G,m==null?void 0:m.length,"dfih",G==="expiryMonth"&&(m==null?void 0:m.length)===2),G==="expiryMonth"&&(m==null?void 0:m.length)===2&&((g=X==null?void 0:X.current)==null||g.focus()),G==="expiryYear"&&(m==null?void 0:m.length)===4&&((M=b==null?void 0:b.current)==null||M.focus()),G==="cvv"&&(m==null?void 0:m.length)===3&&((d=c==null?void 0:c.current)==null||d.focus()),q.includes(G)){(m===""||/^[0-9]+$/.test(m))&&(x(E=>z(k({},E),{[G]:""})),Ie(E=>z(k({},E),{[G]:m})));return}x(E=>z(k({},E),{[G]:""})),console.log(m,G),Ie(E=>z(k({},E),{[G]:m}))},U=p=>{var g;let G=p.target.value.replace(/\D/g,""),q="";/^3[47]/.test(G)?q=G.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(d,E,s,V)=>[E,s,V].filter(Boolean).join(" ")):q=G.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(d,E,s,V,A)=>[E,s,V,A].filter(Boolean).join(" ")),x(M=>z(k({},M),{cardNumber:""})),Ie(M=>z(k({},M),{cardNumber:q})),console.log(G==null?void 0:G.length,"length"),(G==null?void 0:G.length)===16&&((g=o==null?void 0:o.current)==null||g.focus())},N=()=>{var g,M,d,E,s,V;let p={},m=h,G=parseInt((m==null?void 0:m.expiryMonth)||"",10),q=(m==null?void 0:m.expiryYear)||"";if((g=m==null?void 0:m.cardName)!=null&&g.trim()||(p.cardName="Card name is required"),(M=m==null?void 0:m.cardNumber)!=null&&M.trim()||(p.cardNumber="Card number is required"),(d=m==null?void 0:m.expiryMonth)!=null&&d.trim()?(Number(m==null?void 0:m.expiryMonth)>12||Number(m==null?void 0:m.expiryMonth)<1)&&(p.expiryMonth="Invalid Expiration Month."):p.expiryMonth="Expiration month is required",(E=m==null?void 0:m.expiryYear)!=null&&E.trim()?((s=m==null?void 0:m.expiryYear)==null?void 0:s.trim().length)!==4||Number(m==null?void 0:m.expiryYear)<2025?p.expiryYear="Invalid Expiration Year.":(isNaN(G)||G<1||G>12||q.length!==4)&&(p.expiryMonth="Invalid Expiration Date."):p.expiryYear="Expiration year is required",(V=m==null?void 0:m.cvv)!=null&&V.trim()||(p.cvv="CVC is required"),m!=null&&m.expiryMonth&&(m!=null&&m.expiryYear)&&m.expiryMonth.length<=2&&m.expiryYear.length===4){let A=parseInt(m.expiryMonth,10),xe=parseInt(m.expiryYear,10),J=new Date,Je=J.getMonth()+1,tt=J.getFullYear();(xe<tt||xe===tt&&A<Je)&&(p.expiryMonth="Card is expired")}return x(p),Object.keys(p).length>0},f=async()=>{var p,m,G;Le();try{let q={fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,customer_id:e==null?void 0:e.customerId,addcard:!0},g=await mn.post(`${ze}get-payment-details`,q);console.log(g),Q((p=g==null?void 0:g.data)==null?void 0:p.data),(G=(m=g==null?void 0:g.data)==null?void 0:m.data)!=null&&G.paymentGateway||(W(),I("Something went wrong.")),u()}catch(q){console.log(q),u(),W(),I("Something went wrong.")}};return ji(()=>{e!=null&&e.merchantPublicKey&&f()},[e==null?void 0:e.merchantPublicKey]),le.createElement(le.Fragment,null,le.createElement(Yt,null),le.createElement(Tn,null),le.createElement(Nt,{loading:y}),Te&&le.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},le.createElement(Et,{error:Te,onClose:W})),O&&le.createElement(ti,{onClose:v}),!Te&&!O&&le.createElement(le.Fragment,null,le.createElement("div",{className:"container-creditcard add-card modal-content",id:"add-credit-card-panel",style:{margin:"auto"}},le.createElement("form",{id:"creditCardForm",onSubmit:async p=>{var G,q,g,M,d,E,s,V,A,xe,J,Je,tt,Re,je,Ft;p.preventDefault();let m=N();if(console.log(h),!m){let $e=DatacapWebToken.validateCardNumber(h==null?void 0:h.cardNumber.replaceAll(" ","")),nt=DatacapWebToken.validateExpirationDate(h==null?void 0:h.expiryMonth,h==null?void 0:h.expiryYear),we=DatacapWebToken.validateCVV(h==null?void 0:h.cvv),St={};if($e||(St.cardNumber="Invalid card Number"),nt||(St.expiryMonth="Invalid Expiration Date."),we||(St.cvv="Invalid CVV"),x(St),$e&&we&&nt){Le();try{let K=async function(it){var Ye,ct,bt,At,jt;if(console.log(it),it.Error)console.log(it==null?void 0:it.Error),I(it.Error),u();else{let w={userId:e==null?void 0:e.customerId,cardName:h==null?void 0:h.cardName,zip:h==null?void 0:h.zipCode,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,token:it};try{let L=await mn.post(`${ze}add-card`,w);console.log(L);let pe={fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,wallet_id:"",card_number:h==null?void 0:h.cardNumber.replaceAll(" ",""),exp_month:h==null?void 0:h.expiryMonth,exp_year:(Ye=h==null?void 0:h.expiryYear)==null?void 0:Ye.slice(-2),cvv:h==null?void 0:h.cvv};try{let fe=await mn.post(`${ze}link-wallet`,pe);console.log(fe),Y(!0),u(),Ie({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),tn(p,"close","")}catch(fe){console.log(fe),u(),I(((bt=(ct=fe==null?void 0:fe.response)==null?void 0:ct.data)==null?void 0:bt.message)||(fe==null?void 0:fe.message)||"Something went wrong.")}}catch(L){console.log(L),u(),I(((jt=(At=L==null?void 0:L.response)==null?void 0:At.data)==null?void 0:jt.message)||(L==null?void 0:L.message)||"Something went wrong.")}}};if((ke==null?void 0:ke.paymentGateway)===32){let it={method:"POST",redirect:"follow"};try{let Ye=await mn.post(`${Ne}api/v1/widget/generate-session`,it),ct=Number(h==null?void 0:h.expiryYear)%100,bt=h==null?void 0:h.cardNumber;bt=bt==null?void 0:bt.replace(/\s+/g,"");let At=`${bt}=${ct}${h==null?void 0:h.expiryMonth} ${h==null?void 0:h.cvv}`,w=forge.pki.publicKeyFromPem((q=(G=Ye==null?void 0:Ye.data)==null?void 0:G.data)==null?void 0:q.publicKeyPem).encrypt(At,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),L=forge.util.encode64(w),pe={"Content-Type":"application/json","x-app-session-key":(M=(g=Ye.data)==null?void 0:g.data)==null?void 0:M.session_key},fe=JSON.stringify({enc_track2_data:`${L}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(E=(d=Ye==null?void 0:Ye.data)==null?void 0:d.data)==null?void 0:E.session_key}`});try{let re=await mn.post(`${yt}tokenizer/tokenize`,fe,{headers:pe}),oe=JSON.stringify(z(k({},(s=re==null?void 0:re.data)==null?void 0:s.data),{cvv:h==null?void 0:h.cvv,cardName:h==null?void 0:h.cardName,zip:h==null?void 0:h.zipCode,userId:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey})),Oe={"Content-Type":"application/json"};try{let be=await mn.post(`${ze}add-card`,oe,{headers:Oe});console.log(be),(V=be==null?void 0:be.data)!=null&&V.result&&(Y(!0),u(),tn(p,"close",""))}catch(be){u(),I(((xe=(A=be==null?void 0:be.response)==null?void 0:A.data)==null?void 0:xe.message)||(be==null?void 0:be.message)||"Something went wrong.")}}catch(re){u(),I(((Je=(J=re==null?void 0:re.response)==null?void 0:J.data)==null?void 0:Je.message)||(re==null?void 0:re.message)||"Something went wrong.")}}catch(Ye){u(),I(((Re=(tt=Ye==null?void 0:Ye.response)==null?void 0:tt.data)==null?void 0:Re.message)||(Ye==null?void 0:Ye.message)||"Something went wrong.")}}else typeof DatacapWebToken!="undefined"&&DatacapWebToken.requestToken(ke==null?void 0:ke.dctoken,"creditCardForm",K)}catch(K){u(),I(((Ft=(je=K==null?void 0:K.response)==null?void 0:je.data)==null?void 0:Ft.message)||(K==null?void 0:K.message)||"Something went wrong.")}}}},style:{padding:"0 10px"}},le.createElement("div",{style:{maxHeight:"350px",minHeight:"0"},className:"card-scrl"},le.createElement("div",{className:"form-group",style:{marginTop:"0",marginBottom:"10px"}},le.createElement("label",{htmlFor:"cardNumber"},"Card Number"),le.createElement("input",{type:"text","data-token":"card_number",placeholder:"Enter card number",maxLength:19,inputMode:"numeric",value:(h==null?void 0:h.cardNumber)||"",onChange:p=>U(p),ref:de}),(Z==null?void 0:Z.cardNumber)&&le.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},Z==null?void 0:Z.cardNumber),le.createElement("br",null)),le.createElement("div",{className:"card-dtl"},le.createElement("div",{className:"exp-cvc-container",style:{margin:"0"}},le.createElement("div",{className:"form-group",style:{marginTop:"0"}},le.createElement("label",{htmlFor:"expMonth"},"MM"),le.createElement("input",{"data-token":"exp_month",className:"form-control required",type:"text",placeholder:"MM",maxLength:2,value:(h==null?void 0:h.expiryMonth)||"",onChange:p=>qe("expiryMonth",p.target.value),ref:o}),(Z==null?void 0:Z.expiryMonth)&&le.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},Z==null?void 0:Z.expiryMonth)),le.createElement("div",{className:"form-group",style:{marginTop:"0"}},le.createElement("label",{htmlFor:"expYear"},"YYYY"),le.createElement("input",{"data-token":"exp_year",className:"form-control required",type:"text",placeholder:"YYYY",maxLength:4,value:(h==null?void 0:h.expiryYear)||"",onChange:p=>qe("expiryYear",p.target.value),ref:X}),(Z==null?void 0:Z.expiryYear)&&le.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},Z==null?void 0:Z.expiryYear)),le.createElement("div",{className:"form-group",style:{marginTop:"0"}},le.createElement("label",{htmlFor:"cvc"},"CVC"),le.createElement("input",{"data-token":"cvv",className:"form-control required",type:"text",placeholder:"CVC",maxLength:4,value:(h==null?void 0:h.cvv)||"",onChange:p=>qe("cvv",p.target.value),ref:b}),(Z==null?void 0:Z.cvv)&&le.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},Z==null?void 0:Z.cvv)))),le.createElement("div",{className:"form-group",style:{marginTop:"0"}},le.createElement("label",{htmlFor:"cardholderName"},"Name on card"),le.createElement("input",{type:"text",id:"cardholderName",name:"cardholderName",placeholder:"Name on card required",value:(h==null?void 0:h.cardName)||"",onChange:p=>{let m=p.target.value;/^[a-zA-Z\s]*$/.test(m)&&qe("cardName",m)},ref:c}),(Z==null?void 0:Z.cardName)&&le.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},Z==null?void 0:Z.cardName)),le.createElement("div",{className:"form-group",style:{marginTop:"0"}},le.createElement("label",{htmlFor:"zipcode"},"Zip"),le.createElement("input",{type:"text",id:"",name:"zipcode",placeholder:"Zip",value:(ce=h==null?void 0:h.zipCode)!=null?ce:"",onChange:p=>qe("zipCode",p.target.value)}),(Z==null?void 0:Z.zipCode)&&le.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},Z==null?void 0:Z.zipCode))),le.createElement("input",{type:"submit",className:"idle-green-btn w-100",defaultValue:"Submit"})))))}import B,{useState as Cn}from"react";import wn from"axios";var Mn={PROPAYKEY:"25",PAYARCKEY:"26",STRIPEKEYCC:"27",PAYRIXKEY:"28",SKYFIACHKEY:"29",JUSTIFIKEY:"30",INFINICEPTKEY:"31",FRACTALKEY:"32"};import Ei from"react";function $n({}){return Ei.createElement("style",null,`
1983
+ @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap");
3912
1984
 
3913
- // src/app/components/SuccessCardMessage/SuccessCardMsz.tsx
3914
- var SuccessCardMsz = ({ onClose }) => {
3915
- return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(SuccessCardMszStyle, null), /* @__PURE__ */ React17.createElement("div", { className: "card-success" }, /* @__PURE__ */ React17.createElement("div", { className: "payment-success-container" }, /* @__PURE__ */ React17.createElement("div", { className: "success-icon" }, /* @__PURE__ */ React17.createElement("div", { className: "circle" }, /* @__PURE__ */ React17.createElement("i", { className: "fa fa-check-circle", "aria-hidden": "true" })), /* @__PURE__ */ React17.createElement("div", { className: "success-text" }, /* @__PURE__ */ React17.createElement("div", { className: "payment-success-text" }, "Your card was added successfully."), /* @__PURE__ */ React17.createElement("div", { className: "thank-you-text" }, "Thank you "))))));
3916
- };
3917
- var SuccessCardMsz_default = SuccessCardMsz;
3918
-
3919
- // src/app/components/AddCard/AddCardEasyPay.tsx
3920
- function AddCardEasyPay(props) {
3921
- var _a;
3922
- const [loading, setLoading] = useState5(false);
3923
- const [success, setSuccess] = useState5(false);
3924
- const [error, setError] = useState5("");
3925
- const [show, setShow] = useState5(false);
3926
- const [cardData, setCardData] = useState5();
3927
- const [cardError, setCardError] = useState5({});
3928
- const [paymentData, setPaymentData] = useState5();
3929
- const showLoader = () => setLoading(true);
3930
- const hideLoader = () => setLoading(false);
3931
- const showError = (msz) => {
3932
- Swal3.fire({
3933
- icon: "error",
3934
- text: msz,
3935
- customClass: {
3936
- popup: "custom-z-index"
3937
- }
3938
- });
3939
- };
3940
- const handleClose = () => {
3941
- setShow(false);
3942
- setSuccess(false);
3943
- setError("");
3944
- setCardData({
3945
- cardName: "",
3946
- cardNumber: "",
3947
- expiryMonth: "",
3948
- expiryYear: "",
3949
- cvv: "",
3950
- orderId: "",
3951
- zipCode: ""
3952
- });
3953
- };
3954
- const handleShow = () => setShow(true);
3955
- const handleCloseSeccess = () => {
3956
- handleClose();
3957
- };
3958
- const handleCardChange = (field, value) => {
3959
- const name = field;
3960
- const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
3961
- if (numericFields.includes(name)) {
3962
- if (value === "" || /^[0-9]+$/.test(value)) {
3963
- setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
3964
- [name]: ""
3965
- }));
3966
- setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
3967
- [name]: value
3968
- }));
3969
- }
3970
- return;
3971
- }
3972
- setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
3973
- [name]: ""
3974
- }));
3975
- console.log(value, name);
3976
- setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
3977
- [name]: value
3978
- }));
3979
- };
3980
- const handleCardNumberChange = (e) => {
3981
- const input = e.target;
3982
- const rawValue = input.value.replace(/\D/g, "");
3983
- let formatted = "";
3984
- if (/^3[47]/.test(rawValue)) {
3985
- const trimmed = rawValue.slice(0, 15);
3986
- formatted = trimmed.replace(
3987
- /^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,
3988
- (_, g1, g2, g3) => [g1, g2, g3].filter(Boolean).join(" ")
3989
- );
3990
- } else {
3991
- const trimmed = rawValue.slice(0, 16);
3992
- formatted = trimmed.replace(
3993
- /^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,
3994
- (_, g1, g2, g3, g4) => [g1, g2, g3, g4].filter(Boolean).join(" ")
3995
- );
3996
- }
3997
- setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
3998
- cardNumber: ""
3999
- }));
4000
- setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
4001
- cardNumber: formatted
4002
- }));
4003
- };
4004
- const validateCardData = () => {
4005
- var _a2, _b, _c, _d, _e, _f;
4006
- const errors = {};
4007
- const data = cardData;
4008
- const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
4009
- const year = (data == null ? void 0 : data.expiryYear) || "";
4010
- if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
4011
- if (!((_b = data == null ? void 0 : data.cardNumber) == null ? void 0 : _b.trim())) errors.cardNumber = "Card number is required";
4012
- if (!((_c = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _c.trim())) {
4013
- errors.expiryMonth = "Expiration month is required";
4014
- } else if (Number(data == null ? void 0 : data.expiryMonth) > 12 || Number(data == null ? void 0 : data.expiryMonth) < 1) {
4015
- errors.expiryMonth = "Invalid Expiration Month.";
4016
- }
4017
- if (!((_d = data == null ? void 0 : data.expiryYear) == null ? void 0 : _d.trim())) {
4018
- errors.expiryYear = "Expiration year is required";
4019
- } else if (((_e = data == null ? void 0 : data.expiryYear) == null ? void 0 : _e.trim().length) !== 4 || Number(data == null ? void 0 : data.expiryYear) < 2025) {
4020
- errors.expiryYear = "Invalid Expiration Year.";
4021
- } else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
4022
- errors.expiryMonth = "Invalid Expiration Date.";
4023
- }
4024
- if (!((_f = data == null ? void 0 : data.cvv) == null ? void 0 : _f.trim())) errors.cvv = "CVC is required";
4025
- if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
4026
- const month2 = parseInt(data.expiryMonth, 10);
4027
- const year2 = parseInt(data.expiryYear, 10);
4028
- const now = /* @__PURE__ */ new Date();
4029
- const currentMonth = now.getMonth() + 1;
4030
- const currentYear = now.getFullYear();
4031
- if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
4032
- errors.expiryMonth = "Card is expired";
4033
- }
4034
- }
4035
- setCardError(errors);
4036
- return Object.keys(errors).length > 0;
4037
- };
4038
- const getPaymentDetails = async () => {
4039
- var _a2, _b, _c;
4040
- showLoader();
4041
- try {
4042
- const data = {
4043
- fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
4044
- "customer_id": props == null ? void 0 : props.customerId,
4045
- addcard: true
4046
- };
4047
- let paymentData2 = await axios5.post(`${baseUrl}get-payment-details`, data);
4048
- console.log(paymentData2);
4049
- setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
4050
- if (!((_c = (_b = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b.data) == null ? void 0 : _c.paymentGateway)) {
4051
- handleClose();
4052
- setError("Something went wrong.");
4053
- }
4054
- hideLoader();
4055
- } catch (err) {
4056
- console.log(err);
4057
- hideLoader();
4058
- handleClose();
4059
- setError("Something went wrong.");
4060
- }
4061
- };
4062
- useEffect6(() => {
4063
- if (props.fractalpayClientKey) {
4064
- getPaymentDetails();
4065
- }
4066
- }, [props == null ? void 0 : props.fractalpayClientKey]);
4067
- const addCardFunc = async (e) => {
4068
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
4069
- e.preventDefault();
4070
- const hasError = validateCardData();
4071
- console.log(cardData);
4072
- if (hasError) return;
4073
- else {
4074
- let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
4075
- let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
4076
- let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
4077
- let errors = {};
4078
- if (!validCard) errors.cardNumber = "Invalid card Number";
4079
- if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
4080
- if (!validCVV) errors.cvv = "Invalid CVV";
4081
- setCardError(errors);
4082
- if (validCard && validCVV && validExpirationDate) {
4083
- showLoader();
4084
- try {
4085
- let getTokenCallback = async function(token) {
4086
- var _a3, _b2, _c2, _d2, _e2;
4087
- console.log(token);
4088
- if (token.Error) {
4089
- console.log(token == null ? void 0 : token.Error);
4090
- setError(token.Error);
4091
- hideLoader();
4092
- } else {
4093
- const reqData = {
4094
- userId: props == null ? void 0 : props.customerId,
4095
- cardName: cardData == null ? void 0 : cardData.cardName,
4096
- zip: cardData == null ? void 0 : cardData.zipCode,
4097
- fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
4098
- token
4099
- };
4100
- try {
4101
- let apiResponse = await axios5.post(`${baseUrl}add-card`, reqData);
4102
- console.log(apiResponse);
4103
- let formData = {
4104
- fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
4105
- wallet_id: "",
4106
- card_number: cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""),
4107
- exp_month: cardData == null ? void 0 : cardData.expiryMonth,
4108
- exp_year: (_a3 = cardData == null ? void 0 : cardData.expiryYear) == null ? void 0 : _a3.slice(-2),
4109
- cvv: cardData == null ? void 0 : cardData.cvv
4110
- };
4111
- try {
4112
- const result = await axios5.post(`${baseUrl}link-wallet`, formData);
4113
- console.log(result);
4114
- setSuccess(true);
4115
- hideLoader();
4116
- setCardData({
4117
- cardName: "",
4118
- cardNumber: "",
4119
- expiryMonth: "",
4120
- expiryYear: "",
4121
- cvv: "",
4122
- orderId: "",
4123
- zipCode: ""
4124
- });
4125
- HandleSubmit(e, "close", "");
4126
- } catch (err) {
4127
- console.log(err);
4128
- hideLoader();
4129
- setError(((_c2 = (_b2 = err == null ? void 0 : err.response) == null ? void 0 : _b2.data) == null ? void 0 : _c2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
4130
- }
4131
- } catch (err) {
4132
- console.log(err);
4133
- hideLoader();
4134
- setError(((_e2 = (_d2 = err == null ? void 0 : err.response) == null ? void 0 : _d2.data) == null ? void 0 : _e2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
4135
- }
4136
- }
4137
- };
4138
- if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
4139
- const requestOptions = {
4140
- method: "POST",
4141
- redirect: "follow"
4142
- };
4143
- try {
4144
- let sesionResult = await axios5.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
4145
- let expYear = Number(cardData == null ? void 0 : cardData.expiryYear) % 100;
4146
- let cardNumber = cardData == null ? void 0 : cardData.cardNumber;
4147
- cardNumber = cardNumber == null ? void 0 : cardNumber.replace(/\s+/g, "");
4148
- let track2_data = `${cardNumber}=${expYear}${cardData == null ? void 0 : cardData.expiryMonth} ${cardData == null ? void 0 : cardData.cvv}`;
4149
- const publicKey = forge.pki.publicKeyFromPem((_b = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b.publicKeyPem);
4150
- const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
4151
- md: forge.md.sha1.create(),
4152
- mgf1: {
4153
- md: forge.md.sha1.create()
4154
- }
4155
- });
4156
- const encryptedBase64 = forge.util.encode64(encrypted);
4157
- const myHeaders = {
4158
- "Content-Type": "application/json",
4159
- "x-app-session-key": (_d = (_c = sesionResult.data) == null ? void 0 : _c.data) == null ? void 0 : _d.session_key
4160
- };
4161
- const raw = JSON.stringify({
4162
- "enc_track2_data": `${encryptedBase64}`,
4163
- "algorithm": "RSAES_OAEP_SHA_1",
4164
- session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
4165
- });
4166
- try {
4167
- const tokenizeData = await axios5.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
4168
- const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
4169
- cvv: cardData == null ? void 0 : cardData.cvv,
4170
- cardName: cardData == null ? void 0 : cardData.cardName,
4171
- zip: cardData == null ? void 0 : cardData.zipCode,
4172
- userId: props == null ? void 0 : props.customerId,
4173
- fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey
4174
- }));
4175
- let myHeaders2 = {
4176
- "Content-Type": "application/json"
4177
- };
4178
- try {
4179
- let addCardRes = await axios5.post(
4180
- `${baseUrl}add-card`,
4181
- reqData,
4182
- {
4183
- headers: myHeaders2
4184
- }
4185
- );
4186
- console.log(addCardRes);
4187
- if ((_h = addCardRes == null ? void 0 : addCardRes.data) == null ? void 0 : _h.result) {
4188
- setSuccess(true);
4189
- hideLoader();
4190
- HandleSubmit(e, "close", "");
4191
- }
4192
- } catch (err) {
4193
- hideLoader();
4194
- setError(((_j = (_i = err == null ? void 0 : err.response) == null ? void 0 : _i.data) == null ? void 0 : _j.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
4195
- }
4196
- } catch (err) {
4197
- hideLoader();
4198
- setError(((_l = (_k = err == null ? void 0 : err.response) == null ? void 0 : _k.data) == null ? void 0 : _l.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
4199
- }
4200
- } catch (err) {
4201
- hideLoader();
4202
- setError(((_n = (_m = err == null ? void 0 : err.response) == null ? void 0 : _m.data) == null ? void 0 : _n.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
4203
- }
4204
- } else {
4205
- if (typeof DatacapWebToken !== "undefined") {
4206
- DatacapWebToken.requestToken(paymentData == null ? void 0 : paymentData.dctoken, "creditCardForm", getTokenCallback);
4207
- }
4208
- }
4209
- } catch (err) {
4210
- hideLoader();
4211
- setError(((_p = (_o = err == null ? void 0 : err.response) == null ? void 0 : _o.data) == null ? void 0 : _p.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
1985
+ .creditformbox {
1986
+ // max-width: 550px;
1987
+ margin: 0 auto;
1988
+ font-family: Poppins !important;
4212
1989
  }
4213
- }
4214
- }
4215
- };
4216
- return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(DataScript, null), /* @__PURE__ */ React18.createElement(AddCardStyle, null), /* @__PURE__ */ React18.createElement(Loader_default, { loading }), error && /* @__PURE__ */ React18.createElement("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" } }, /* @__PURE__ */ React18.createElement(ErrorCardMessage_default, { error, onClose: handleClose })), success && /* @__PURE__ */ React18.createElement(SuccessCardMsz_default, { onClose: handleCloseSeccess }), !error && !success && /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(
4217
- "div",
4218
- {
4219
- className: "container-creditcard add-card modal-content",
4220
- id: "add-credit-card-panel",
4221
- style: { margin: "auto" }
4222
- },
4223
- /* @__PURE__ */ React18.createElement("form", { id: "creditCardForm", onSubmit: addCardFunc, style: { padding: "0 10px" } }, /* @__PURE__ */ React18.createElement("div", { style: { maxHeight: "350px", minHeight: "0" }, className: "card-scrl" }, /* @__PURE__ */ React18.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ React18.createElement(
4224
- "input",
4225
- {
4226
- type: "text",
4227
- "data-token": "card_number",
4228
- placeholder: "Enter card number",
4229
- maxLength: 19,
4230
- inputMode: "numeric",
4231
- value: (cardData == null ? void 0 : cardData.cardNumber) || "",
4232
- onChange: (e) => handleCardNumberChange(e)
4233
- }
4234
- ), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ React18.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.cardNumber), /* @__PURE__ */ React18.createElement("br", null)), /* @__PURE__ */ React18.createElement("div", { className: "card-dtl" }, /* @__PURE__ */ React18.createElement("div", { className: "exp-cvc-container", style: { margin: "0" } }, /* @__PURE__ */ React18.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "expMonth" }, "MM"), /* @__PURE__ */ React18.createElement(
4235
- "input",
4236
- {
4237
- "data-token": "exp_month",
4238
- className: "form-control required",
4239
- type: "text",
4240
- placeholder: "MM",
4241
- maxLength: 2,
4242
- value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
4243
- onChange: (e) => handleCardChange("expiryMonth", e.target.value)
4244
- }
4245
- ), (cardError == null ? void 0 : cardError.expiryMonth) && /* @__PURE__ */ React18.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.expiryMonth)), /* @__PURE__ */ React18.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "expYear" }, "YYYY"), /* @__PURE__ */ React18.createElement(
4246
- "input",
4247
- {
4248
- "data-token": "exp_year",
4249
- className: "form-control required",
4250
- type: "text",
4251
- placeholder: "YYYY",
4252
- maxLength: 4,
4253
- value: (cardData == null ? void 0 : cardData.expiryYear) || "",
4254
- onChange: (e) => handleCardChange("expiryYear", e.target.value)
4255
- }
4256
- ), (cardError == null ? void 0 : cardError.expiryYear) && /* @__PURE__ */ React18.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.expiryYear)), /* @__PURE__ */ React18.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "cvc" }, "CVC"), /* @__PURE__ */ React18.createElement(
4257
- "input",
4258
- {
4259
- "data-token": "cvv",
4260
- className: "form-control required",
4261
- type: "text",
4262
- placeholder: "CVC",
4263
- maxLength: 4,
4264
- value: (cardData == null ? void 0 : cardData.cvv) || "",
4265
- onChange: (e) => handleCardChange("cvv", e.target.value)
4266
- }
4267
- ), (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ React18.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ React18.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "cardholderName" }, "Name on card"), /* @__PURE__ */ React18.createElement(
4268
- "input",
4269
- {
4270
- type: "text",
4271
- id: "cardholderName",
4272
- name: "cardholderName",
4273
- placeholder: "Name on card required",
4274
- value: (cardData == null ? void 0 : cardData.cardName) || "",
4275
- onChange: (e) => {
4276
- const value = e.target.value;
4277
- if (/^[a-zA-Z\s]*$/.test(value)) {
4278
- handleCardChange("cardName", value);
1990
+
1991
+ .name-row {
1992
+ display: flex;
1993
+ gap: 10px;
1994
+ }
1995
+
1996
+ label {
1997
+ display: block;
1998
+ color: #383838;
1999
+ font-size: 16px;
2000
+ }
2001
+
2002
+ .form-group span.text-danger{
2003
+ color:red;
2004
+ }
2005
+ .form-group small.error{
2006
+ color:red;
2007
+ font-size:11px;
2008
+ }
2009
+ .name-row .form-group {
2010
+ display: block;
2011
+ width: 50%;
2012
+ margin-bottom: 15px;
2013
+ }
2014
+
2015
+ .creditformbox input, .creditformbox select {
2016
+ border: 1.25px solid rgba(234, 236, 239, 1);
2017
+ color: rgba(94, 94, 94, 0.75);
2018
+ border-radius: 10px;
2019
+ width: -webkit-fill-available;
2020
+ padding: 10px 12px;
2021
+ font-size: .875rem;
2022
+ min-height: 20px;
2023
+ }
2024
+
2025
+ .form-pay-row {
2026
+ display: block;
2027
+ width: 100%;
2028
+ }
2029
+
2030
+ .form-pay-row .form-group {
2031
+ display: block;
2032
+ width: 100%;
2033
+ margin-bottom: 15px;
2034
+ }
2035
+
2036
+ .card-pay-row {
2037
+ display: flex;
2038
+ width: 100%;
2039
+ gap: 10px;
2040
+ flex-wrap: wrap;
2041
+ }
2042
+
2043
+ .card-pay-row .form-group {
2044
+ flex: 1;
2045
+ margin-bottom: 15px;
2046
+ min-width: 100px;
2047
+ }
2048
+
2049
+ .creditformbox input:focus {
2050
+ color: #212529;
2051
+ background-color: #fff;
2052
+ border-color: #86b7fe;
2053
+ outline: 0;
2054
+ box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
2055
+ }
2056
+
2057
+ .checks-row{
2058
+ display:flex;
2059
+ align-items:start;
2060
+ gap:10px
2061
+ }
2062
+ .checks-row input {
2063
+ border: 1.25px solid rgba(234, 236, 239, 1);
2064
+ color: rgba(94, 94, 94, 0.75);
2065
+ border-radius: 10px;
2066
+ min-width: 16px !important;
2067
+ width:16px !important;
2068
+ padding: 10px 12px;
2069
+ font-size: .875rem;
2070
+ max-height: 16px !important;
2071
+ height: 16px !important;
2072
+ }
2073
+ // .checks-row input.is-valid:checked{
2074
+ // background-color: #198754;
2075
+ // border-color: #198754;
2076
+ // background-image: url(data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e);
2077
+ // }
2078
+ .check-error{
2079
+ color:red;
2080
+ font-size:11px;
2081
+ padding-left:25px
2082
+ }
2083
+ .button-row{
2084
+ display: flex;
2085
+ width: 100%;
2086
+ gap: 10px;
2087
+ flex-wrap: wrap;
2088
+ margin-top: 20px !important
2089
+ }
2090
+ .button-row .btn{
2091
+ flex: 1;
2092
+ margin-top:20px;
2093
+ }
2094
+
2095
+ .cancelbtn {
2096
+ font-size:15px;
2097
+ color: #000000 !important;
2098
+ background-color: transparent !important;
2099
+ background: transparent !important;
2100
+ border:1px solid #000000 !important;
2101
+ border-radius: 10px !important;
2102
+ padding: 10px 25px !important;
2103
+ cursor:pointer;
2104
+ font-size: 16px;
2105
+ }
2106
+ .cancelbtn:hover {
2107
+ background:#000000 !important;
2108
+ color:#ffffff !important;
4279
2109
  }
2110
+
2111
+ .savebtn {
2112
+ font-size:15px;
2113
+ color: #2979FF !important;
2114
+ background-color: transparent !important;
2115
+ background: transparent !important;
2116
+ border:1px solid #2979FF !important;
2117
+ border-radius: 10px !important;
2118
+ padding: 10px 25px !important;
2119
+ cursor:pointer;
2120
+ font-size: 16px;
4280
2121
  }
4281
- }
4282
- ), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ React18.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ React18.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "zipcode" }, "Zip"), /* @__PURE__ */ React18.createElement(
4283
- "input",
4284
- {
4285
- type: "text",
4286
- id: "",
4287
- name: "zipcode",
4288
- placeholder: "Zip",
4289
- value: (_a = cardData == null ? void 0 : cardData.zipCode) != null ? _a : "",
4290
- onChange: (e) => handleCardChange("zipCode", e.target.value)
4291
- }
4292
- ), (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ React18.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.zipCode))), /* @__PURE__ */ React18.createElement(
4293
- "input",
4294
- {
4295
- type: "submit",
4296
- className: "idle-green-btn w-100",
4297
- defaultValue: "Submit"
4298
- }
4299
- ))
4300
- )));
2122
+ .savebtn:hover {
2123
+ background:#2979FF !important;
2124
+ color:#ffffff !important;
2125
+ }
2126
+
2127
+ `)}function Oi({session_token:e,callback:y,isloading:T,onCancel:O,showChecks:Y,merchantName:Te}){var U;let[I,Ge]=Cn(!1),[Pe,de]=Cn(!1),[o,X]=Cn(),[b,c]=Cn({}),[h,Ie]=Cn(""),Z=()=>Ge(!0),x=()=>Ge(!1),ke=()=>{var p,m,G,q,g,M,d,E;let N={},f=o,ge=parseInt((f==null?void 0:f.expiryMonth)||"",10),ce=(f==null?void 0:f.expiryYear)||"";return(p=f==null?void 0:f.firstName)!=null&&p.trim()||(N.firstName="Please enter a first name."),(m=f==null?void 0:f.lastName)!=null&&m.trim()||(N.lastName="Please enter a last name."),(G=f==null?void 0:f.cardNumber)!=null&&G.trim()||(N.cardNumber="Please enter a card number."),(q=f==null?void 0:f.expiryMonth)!=null&&q.trim()?(Number(f==null?void 0:f.expiryMonth)>12||Number(f==null?void 0:f.expiryMonth)<1)&&(N.expiryMonth="Invalid Expiration Month."):N.expiryMonth="Please enter an expiry month.",(g=f==null?void 0:f.expiryYear)!=null&&g.trim()?((M=f==null?void 0:f.expiryYear)==null?void 0:M.trim().length)!==4||Number(f==null?void 0:f.expiryYear)<2025?N.expiryYear="Invalid Expiration Year.":(isNaN(ge)||ge<1||ge>12||ce.length!==4)&&(N.expiryMonth="Invalid Expiration Date."):N.expiryYear="Please enter an expiry year.",(d=f==null?void 0:f.cvv)!=null&&d.trim()||(N.cvv="Please enter a CVV."),(E=f==null?void 0:f.zipCode)!=null&&E.trim()||(N.zipCode="Please enter a zip code."),Y&&!(f!=null&&f.authHold)&&(N.authHold="You must authorize this before proceeding."),Y&&!(f!=null&&f.authorise)&&(N.authorise="Please confirm your authorization to continue."),c(N),Object.keys(N).length>0},Q=N=>{let ge=N.target.value.replace(/\D/g,""),ce="";/^3[47]/.test(ge)?ce=ge.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(m,G,q,g)=>[G,q,g].filter(Boolean).join(" ")):ce=ge.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(m,G,q,g,M)=>[G,q,g,M].filter(Boolean).join(" ")),c(p=>z(k({},p),{cardNumber:""})),X(p=>z(k({},p),{cardNumber:ce}))},Le=(N,f)=>{let ge=N;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(ge)){(f===""||/^[0-9]+$/.test(f))&&(c(p=>z(k({},p),{[ge]:""})),X(p=>z(k({},p),{[ge]:f})));return}c(p=>z(k({},p),{[ge]:""})),X(p=>z(k({},p),{[ge]:f}))},u=()=>{let N=DatacapWebToken.validateCardNumber(o==null?void 0:o.cardNumber.replaceAll(" ","")),f=DatacapWebToken.validateExpirationDate(o==null?void 0:o.expiryMonth,o==null?void 0:o.expiryYear),ge=DatacapWebToken.validateCVV(o==null?void 0:o.cvv),ce={};return N||(ce.cardNumber="Invalid card Number"),f||(ce.expiryMonth="Invalid Expiration Date."),ge||(ce.cvv="Invalid CVV"),c(ce),N&&ge&&f},st=async N=>{var f,ge;if(N.Error)Ie(N.Error),x();else{let ce={token:N.Token,resp:N},p=await wn.post(`${Ne}api/v1/gateway/update/token/${e}`,ce);if((p==null?void 0:p.status)==200){let m=k(k({Token:(ge=(f=p==null?void 0:p.data)==null?void 0:f.data)==null?void 0:ge.gateway_token,Brand:N.Brand,ExpirationMonth:N.ExpirationMonth,ExpirationYear:N.ExpirationYear,Last4:N.Last4,Bin:N.Bin,CVV:N.CVV,postalCode:o==null?void 0:o.zipCode},Y&&{authHold:o==null?void 0:o.authHold}),Y&&{authorise:o==null?void 0:o.authorise});x(),y(m)}}},W=async()=>{var N,f,ge,ce,p,m,G,q,g,M;try{let d={method:"POST",redirect:"follow"},E=await wn.post(`${Ne}api/v1/widget/generate-session`,d),s=Number(o==null?void 0:o.expiryYear)%100,A=`${(N=o==null?void 0:o.cardNumber)==null?void 0:N.replace(/\s+/g,"")}=${s}${o==null?void 0:o.expiryMonth} ${o==null?void 0:o.cvv}`,J=forge.pki.publicKeyFromPem((ge=(f=E==null?void 0:E.data)==null?void 0:f.data)==null?void 0:ge.publicKeyPem).encrypt(A,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),Je=forge.util.encode64(J),tt={"Content-Type":"application/json","x-app-session-key":(p=(ce=E.data)==null?void 0:ce.data)==null?void 0:p.session_key},Re=JSON.stringify({enc_track2_data:Je,algorithm:"RSAES_OAEP_SHA_1",session_key:(G=(m=E==null?void 0:E.data)==null?void 0:m.data)==null?void 0:G.session_key}),je=await wn.post(`${yt}tokenizer/tokenize`,Re,{headers:tt});if((je==null?void 0:je.status)==200){let Ft=(g=(q=je==null?void 0:je.data)==null?void 0:q.data)==null?void 0:g.token;try{let $e=await wn.post(`${Ne}api/v1/gateway/verify-and-save/${e}`,{token:Ft});if(($e==null?void 0:$e.status)==200){let nt=(M=$e==null?void 0:$e.data)==null?void 0:M.data,we={Token:nt.gateway_token,Brand:nt.card_data.brand,ExpirationMonth:nt.card_data.expire_mm,ExpirationYear:nt.card_data.expire_yy,Last4:nt.card_data.last4,Bin:nt.card_data.bin,postalCode:o==null?void 0:o.zipCode};x(),y(we)}}catch($e){console.log($e,"error"),x()}}}catch(d){console.log(d,"eroror")}},lt=async N=>{var ce,p,m,G,q,g,M;if(N.preventDefault(),!(ke()||!u())){Z();try{let d=await wn.get(`${Ne}api/v1/gateway/token/${e}`);if((d==null?void 0:d.status)==200){let E=(p=(ce=d==null?void 0:d.data)==null?void 0:ce.data)==null?void 0:p.gateway_token;((G=(m=d==null?void 0:d.data)==null?void 0:m.data)==null?void 0:G.paymentGateway)==((q=Mn)==null?void 0:q.FRACTALKEY)?await W():DatacapWebToken.requestToken(E,"creditCardForm",st)}}catch(d){x(),Ie(((M=(g=d==null?void 0:d.response)==null?void 0:g.data)==null?void 0:M.message)||"Something went wrong!")}}},v=()=>{Ie("")},qe=()=>{Ie(""),X({firstName:"",lastName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",zipCode:"",authHold:!1,authorise:!1}),O()};return B.createElement(B.Fragment,null,B.createElement(Yt,null),B.createElement($n,null),B.createElement(Nt,{loading:I||T}),h&&B.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},B.createElement(Et,{error:h,onClose:v})),!h&&B.createElement("div",{className:"creditformbox"},B.createElement("form",{id:"creditCardForm",onSubmit:lt},B.createElement("div",{className:"name-row"},B.createElement("div",{className:"form-group"},B.createElement("label",null," First Name ",B.createElement("span",{className:"text-danger"},"*")),B.createElement("input",{type:"text",name:"first_name",placeholder:"First Name",value:(o==null?void 0:o.firstName)||"",onChange:N=>{let f=N.target.value;/^[a-zA-Z\s]*$/.test(f)&&Le("firstName",f)}}),(b==null?void 0:b.firstName)&&B.createElement("small",{className:"error"},b==null?void 0:b.firstName)),B.createElement("div",{className:"form-group"},B.createElement("label",null," Last Name ",B.createElement("span",{className:"text-danger"},"*")),B.createElement("input",{type:"text",name:"last_name",placeholder:"Last Name",value:(o==null?void 0:o.lastName)||"",onChange:N=>{let f=N.target.value;/^[a-zA-Z\s]*$/.test(f)&&Le("lastName",f)}}),(b==null?void 0:b.lastName)&&B.createElement("small",{className:"error"},b==null?void 0:b.lastName))),B.createElement("div",{className:"form-pay-row"},B.createElement("div",{className:"form-group"},B.createElement("label",null," Card Number ",B.createElement("span",{className:"text-danger"},"*")),B.createElement("input",{type:"text","data-token":"card_number",placeholder:"Card Number",maxLength:19,inputMode:"numeric",value:(o==null?void 0:o.cardNumber)||"",onChange:N=>Q(N)}),(b==null?void 0:b.cardNumber)&&B.createElement("small",{className:"error"},b==null?void 0:b.cardNumber))),B.createElement("div",{className:"card-pay-row"},B.createElement("div",{className:"form-group"},B.createElement("label",null," Exp Month ",B.createElement("span",{className:"text-danger"},"*")),B.createElement("input",{type:"text","data-token":"exp_month",placeholder:"MM",maxLength:2,value:(o==null?void 0:o.expiryMonth)||"",onChange:N=>Le("expiryMonth",N.target.value)}),(b==null?void 0:b.expiryMonth)&&B.createElement("small",{className:"error"},b==null?void 0:b.expiryMonth)),B.createElement("div",{className:"form-group"},B.createElement("label",null," Exp Year ",B.createElement("span",{className:"text-danger"},"*")),B.createElement("input",{type:"text","data-token":"exp_year",placeholder:"YYYY",maxLength:4,value:(o==null?void 0:o.expiryYear)||"",onChange:N=>Le("expiryYear",N.target.value)}),(b==null?void 0:b.expiryYear)&&B.createElement("small",{className:"error"},b==null?void 0:b.expiryYear)),B.createElement("div",{className:"form-group"},B.createElement("label",null," CVV ",B.createElement("span",{className:"text-danger"},"*")),B.createElement("input",{type:"text","data-token":"cvv",placeholder:"CVV",maxLength:4,value:(o==null?void 0:o.cvv)||"",onChange:N=>Le("cvv",N.target.value)}),(b==null?void 0:b.cvv)&&B.createElement("small",{className:"error"},b==null?void 0:b.cvv)),B.createElement("div",{className:"form-group"},B.createElement("label",null," Zip ",B.createElement("span",{className:"text-danger"},"*")),B.createElement("input",{type:"text",name:"zipcode",placeholder:"Zip Code",value:(U=o==null?void 0:o.zipCode)!=null?U:"",onChange:N=>Le("zipCode",N.target.value)}),(b==null?void 0:b.zipCode)&&B.createElement("small",{className:"error"},b==null?void 0:b.zipCode))),Y&&B.createElement(B.Fragment,null,B.createElement("div",{className:"checks-row"},B.createElement("input",{name:"authHold",type:"checkbox",id:"authHold",checked:!!(o!=null&&o.authHold),onChange:N=>Le("authHold",N.target.checked)}),B.createElement("label",{htmlFor:"authHold",className:"form-check-label"},"To securely save your card on file, we will place a temporary authorization hold of $1.00. This is not a charge and will be released by your card issuer shortly after verification.")),(b==null?void 0:b.authHold)&&B.createElement("small",{className:"check-error"},b==null?void 0:b.authHold),B.createElement("div",{className:"checks-row "},B.createElement("input",{name:"authorise",type:"checkbox",id:"authorise",checked:!!(o!=null&&o.authorise),onChange:N=>Le("authorise",N.target.checked)}),B.createElement("label",{htmlFor:"authorise",className:"form-check-label see-more"},Pe?B.createElement(B.Fragment,null,B.createElement("span",null,"By providing your payment information, you authorize"," ",B.createElement("strong",null,Te),", a Sky Systemz merchant, to securely store your card on file for future payments. Your card information will be encrypted and stored in compliance with PCI-DSS (Payment Card Industry Data Security Standard) regulations using Sky Systemz\u2019s secure payment technology. This information will be used solely for transactions you authorize with"," ",B.createElement("strong",null,Te),". You may request the removal of your stored payment information at any time by contacting"," ",B.createElement("strong",null,Te)," directly. By signing or proceeding with this transaction, you acknowledge and agree to this card on file authorization.",B.createElement("a",{href:"#",onClick:N=>{N.preventDefault(),de(!1)}},"See less ..."))):B.createElement(B.Fragment,null,B.createElement("span",null,"By providing your payment information, you authorize ",Te,", a Sky Systemz merchant, to securely store your card on file for future pay..."," "),B.createElement("a",{href:"#",onClick:N=>{N.preventDefault(),de(!0)}},"See more ...")))),(b==null?void 0:b.authorise)&&B.createElement("small",{className:"check-error"},b==null?void 0:b.authorise)),B.createElement("div",{className:"button-row"},B.createElement("button",{className:"cancelbtn",type:"button",onClick:qe},"Cancel"),B.createElement("button",{className:"savebtn",type:"submit"},"Save")))))}import n,{useEffect as Wi,useState as De}from"react";import Zi from"react";function Yn(){let e="#000",y="#fff",T="#212529",O="#dee2e6";return Zi.createElement("style",null,`
2128
+ @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
2129
+ body
2130
+ {
2131
+ font-family: 'Inter', sans-serif;
2132
+ }
2133
+ input
2134
+ {
2135
+ font-family: 'Inter', sans-serif !important;
2136
+ }
2137
+ .frac-form .form-group-frac{
2138
+ margin:0 !important
2139
+ }
2140
+ .frac-form .mb-4{
2141
+ margin-bottom : 10px !important
2142
+ }
2143
+ .frac-form .save-ach-div{
2144
+ display:flex !important;
2145
+ gap:5px !important;
2146
+ align-items:center
2147
+ }
2148
+
2149
+ .frac-form .card-cvv-in{
2150
+ height : 36px !importantt;
2151
+ }
2152
+
2153
+ .frac-form .pay-payment-amount{
2154
+ text-align:start !important
2155
+ }
2156
+ .frac-form .pay-amount{
2157
+ text-align:start !important
2158
+ }
2159
+ .frac-form .pay-main-logo{
2160
+ text-align:start !important
2161
+ }
2162
+
2163
+
2164
+
2165
+ .paymentBtn {
2166
+ background-color: black;
2167
+ border: none;
2168
+ color: white;
2169
+ padding: 15px 32px;
2170
+ text-align: center;
2171
+ text-decoration: none;
2172
+ display: inline-block;
2173
+ font-size: 16px;
2174
+ margin: 4px 2px;
2175
+ cursor: pointer;
2176
+ border-radius: 180px;
2177
+ /* width: auto; */
2178
+ }
2179
+
2180
+ .main-logo {
2181
+ text-align: center;
2182
+ margin-bottom: 20px;
2183
+ }
2184
+
2185
+ .main-logo img {
2186
+ max-width: 180px;
2187
+ }
2188
+
2189
+ .pay-main-box {
2190
+ width: 365px !important;
2191
+ height: 93%;
2192
+ background: 0 0 #ffffff;
2193
+ border-radius: 12px;
2194
+
2195
+
2196
+ border: 1px solid #E0DFE2;
2197
+ margin: 0 auto;
2198
+ display: block;
2199
+ padding: 0px 26px !important
2200
+ }
2201
+ .pay-main-box .pay-header {
2202
+ display: flex;
2203
+ justify-content: center;
2204
+ align-items: center;
2205
+ text-align: center;
2206
+ }
2207
+
2208
+ .pay-main-box .pay-header button {
2209
+ border: 0;
2210
+ background: none;
2211
+ padding: 0;
2212
+ box-shadow: 0;
2213
+ outline: inherit;
2214
+ }
2215
+
2216
+ .pay-main-box h1 {
2217
+ margin: 0;
2218
+ flex: 1;
2219
+ padding: 10px 0;
2220
+ font-size: 23px;
2221
+ font-weight: 500;
2222
+ color: #35254D;
2223
+ align-items: start;
2224
+ display: flex;
2225
+ }
2226
+ .tab {
2227
+ overflow: hidden;
2228
+ padding: 5px;
2229
+ border-radius: 8px;
2230
+ display: flex;
2231
+ justify-content: space-around;
2232
+ margin-bottom:12px
2233
+ }
2234
+
2235
+ /* Style the buttons inside the tab */
2236
+ .tab button {
2237
+ float: left;
2238
+ border: none;
2239
+ outline: none;
2240
+ cursor: pointer;
2241
+ background:white;
2242
+ padding: 11px 16px;
2243
+ transition: 0.3s;
2244
+ font-size: 16px;
2245
+ width: 143px;
2246
+ border-radius: 5px;
2247
+ box-shadow: inherit;
2248
+ outline: none;
2249
+ color: ${e};
2250
+ }
2251
+
2252
+ /* Change background color of buttons on hover */
2253
+ .tab button:hover {
2254
+ background-color: #f0f0f0;
2255
+ }
2256
+
2257
+ /* Create an active/current tablink class */
2258
+ // .tab button.active {
2259
+ // background-color: #ccc;
2260
+ // }
2261
+
2262
+ /* Style the tab content */
2263
+
2264
+
2265
+ .parent-pay-container{
2266
+ padding: 24px;
2267
+ }
2268
+ .pay-container{
2269
+ display: grid;
2270
+ grid-template-columns: 2fr 3fr;
2271
+
2272
+ }
2273
+ .pay-main{
2274
+ padding-y: 20px}
2275
+
2276
+ .request-payment-close-popup {
2277
+ position: absolute;
2278
+ right: 20px;
2279
+ top: 20px;
2280
+ cursor: pointer;
4301
2281
  }
4302
- export {
4303
- AddCardEasyPay as AddCard,
4304
- GetPaymentPage,
4305
- PreAuthPayment,
4306
- RequestPayment,
4307
- RequestPreAuthPayment
4308
- };
2282
+ .pay-conatiner-one{
2283
+ border-right: 1px solid #E0DFE2;
2284
+ display: flex;
2285
+ flex-direction: column;
2286
+ justify-content: space-between;
2287
+ }
2288
+ .pay-conatiner-one-first{
2289
+
2290
+ min-height:inherit !important;
2291
+ }
2292
+ .pay-conatiner-one-last{
2293
+ display:flex;
2294
+ font-size:12px;
2295
+ gap:5px;
2296
+ max-width:250px;
2297
+ align-items:center;
2298
+ color:black !important
2299
+ }
2300
+ .pay-conatiner-one-last img{
2301
+ width : 17px;
2302
+ height:17px
2303
+ }
2304
+ .pay-conatiner-two{
2305
+ padding: 0 5% 0;
2306
+ }
2307
+ .pay-logo-container{
2308
+ border-bottom: 1px solid #E0DFE2
2309
+ }
2310
+ .pay-heading{
2311
+ margin: 0;
2312
+ flex: 1;
2313
+ padding: 10px 0;
2314
+ font-size: 23px;
2315
+ font-weight: 500;
2316
+ color: #35254D;
2317
+ align-items: start;
2318
+ display: flex;
2319
+ }
2320
+ .pay-main-logo > img{
2321
+ width: 50%;
2322
+ }
2323
+ .pay-main-logo-res > img{
2324
+ width: 50%;
2325
+ display : none
2326
+ }
2327
+
2328
+ .pay-payment-amount{
2329
+ display: block;
2330
+ font-size: 12px;
2331
+ color: #727272;
2332
+ margin-bottom: 8px;
2333
+ }
2334
+ .pay-amount-conatiner{
2335
+ margin-top: 6%;
2336
+ }
2337
+ .pay-amount{
2338
+ color: #000000;
2339
+ font-size: 38px;
2340
+ display: block;
2341
+ line-height: 110%;
2342
+ letter-spacing: -1px;
2343
+ }
2344
+ .frac-form label{
2345
+ font-family: 'IBM Plex Mono', monospace !important;
2346
+ color: #727272 !important;
2347
+ margin-bottom: 2px !important;
2348
+ font-weight: 600 !important;
2349
+ font-size: 12px !important;
2350
+ display:block !important;
2351
+ text-align : left !important
2352
+ }
2353
+ .form-control-frac{
2354
+ display: block;
2355
+ width: 100%;
2356
+ padding: .375rem .75rem;
2357
+ font-size: 1rem;
2358
+ font-weight: 400;
2359
+ line-height: 1.5;
2360
+ color: ${T};
2361
+ -webkit-appearance: none;
2362
+ -moz-appearance: none;
2363
+ appearance: none;
2364
+ background-color: ${y};
2365
+ background-clip: padding-box;
2366
+ border: 1px solid ${O};
2367
+ border-radius: 0.375rem;
2368
+ transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
2369
+ }
2370
+ .form-control-frac:focus{
2371
+ border-color: #86b7fe;
2372
+ outline: 0;
2373
+ }
2374
+ .toggle-num-wrapper {
2375
+ position: relative;
2376
+ }
2377
+ .card-number-new{
2378
+ border-bottom: none;
2379
+ border-bottom-left-radius: 0px;
2380
+ border-bottom-right-radius: 0px;
2381
+ }
2382
+ .card-crdi {
2383
+ display: flex;
2384
+ border: 1px solid ${O};
2385
+ border-radius: 0.375rem;
2386
+ }
2387
+ .card-expiry-new{
2388
+ border-top-left-radius: 0px;
2389
+ border-top-right-radius: 0px;
2390
+ }
2391
+ .exp-date-year-container{
2392
+ display: flex;
2393
+ flex-wrap: wrap;
2394
+ }
2395
+ .exp-date-year-container .form-group-frac{
2396
+ flex:1;
2397
+ padding: 0px !important
2398
+
2399
+ }
2400
+
2401
+ .exp-date {
2402
+ float: left;
2403
+ // width: 30%
2404
+ }
2405
+
2406
+ .exp-date input {
2407
+ width: calc(100% + 1px);
2408
+ border-top-right-radius: 0;
2409
+ border-bottom-right-radius: 0;
2410
+ border: 0;
2411
+ border-right: 1px solid ${O};
2412
+ }
2413
+
2414
+
2415
+ .exp-year {
2416
+ float: left;
2417
+ // width: 30%
2418
+ }
2419
+
2420
+ .exp-year input {
2421
+ width: calc(100% + 1px);
2422
+ border-radius: 0;
2423
+ border-top: 0;
2424
+ border-bottom: 0;
2425
+ border-right: 1px solid ${O};
2426
+ }
2427
+
2428
+ .exp-date input:focus {
2429
+ position: relative;
2430
+ z-index: 10;
2431
+ }
2432
+
2433
+ .security-digit {
2434
+ float: right;
2435
+ // width: 40%;
2436
+ position: relative;
2437
+ }
2438
+
2439
+ .security-digit input {
2440
+ border-top-left-radius: 0;
2441
+ border-bottom-left-radius: 0;
2442
+ border-top: 0;
2443
+ border-bottom: 0;
2444
+ border-right:0;
2445
+ }
2446
+ .card-expiry-new{
2447
+ border-top-left-radius: 0px;
2448
+ border-top-right-radius: 0px;
2449
+ }
2450
+ .form-control-frac{box-sizing: border-box ;}
2451
+ #PaymentForm .form-group-frac{
2452
+ padding:5px 0 ;
2453
+ matgin: 0 !important
2454
+ }
2455
+
2456
+ .toggle-label {
2457
+ position: relative;
2458
+ display: inline-block;
2459
+ width: 40px;
2460
+ height: 24px;
2461
+ background-color: #ccc;
2462
+ border-radius: 12px;
2463
+ cursor: pointer;
2464
+ transition: background-color 0.3s;
2465
+ }
2466
+
2467
+ .toggle-label::before {
2468
+ content: "";
2469
+ position: absolute;
2470
+ top: 2px;
2471
+ left: 2px;
2472
+ width: 20px;
2473
+ height: 20px;
2474
+ background: #ffffff;
2475
+ border-radius: 50%;
2476
+ transition: left 300ms linear;
2477
+ }
2478
+
2479
+ .toggle-checkbox {
2480
+ display: none;
2481
+ }
2482
+
2483
+ .toggle-checkbox:checked + .toggle-label {
2484
+ background-color: #4caf50;
2485
+ }
2486
+
2487
+ .toggle-checkbox:checked + .toggle-label::before {
2488
+ left: 18px;
2489
+ }
2490
+ .ach-scrl {
2491
+ max-height: 380px;
2492
+ min-height: 380px;
2493
+ overflow-y: auto;
2494
+ padding-right: 6px;
2495
+ }
2496
+ .mb-4{
2497
+ margin-bottom:4px
2498
+ }
2499
+ .ach-scrl::-webkit-scrollbar {
2500
+ width: 3px;
2501
+ background-color: #F5F5F5;
2502
+ }
2503
+ .ach-scrl::-webkit-scrollbar-thumb {
2504
+ background-color: #35254D;
2505
+ }
2506
+
2507
+ .error-span{
2508
+ color:red !important;
2509
+ font-size:12px !important;
2510
+ text-align: left !important;
2511
+ width: 100% !important;
2512
+ display: block;
2513
+ }
2514
+
2515
+ .charge-customer-name-frac{
2516
+ color: #161616;
2517
+ font-family: Inter;
2518
+ font-size: 24px;
2519
+ font-style: normal;
2520
+ font-weight: 600;
2521
+ line-height: 32px;
2522
+ letter-spacing: -0.48px;
2523
+ text-transform: capitalize;
2524
+ margin-top:0;
2525
+ margin-bottom:16px !important;
2526
+ text-align:left !important
2527
+ }
2528
+ .card-ach-heading-frac {
2529
+ color: #727272;
2530
+ font-family: Inter;
2531
+ font-size: 12px;
2532
+ font-style: normal;
2533
+ font-weight: 500;
2534
+ line-height: 18px;
2535
+ letter-spacing: -0.24px;
2536
+ margin : 0 0 10px !important;
2537
+ text-align : left
2538
+ }
2539
+ .card-list-div{
2540
+ max-height : 190px;
2541
+ overflow-y : auto;
2542
+ border:1px solid #E0DFE2;
2543
+ border-radius : 8px
2544
+ }
2545
+
2546
+
2547
+ .card-list-div::-webkit-scrollbar{
2548
+ width:2px;
2549
+ background-color:#F5F5F5
2550
+ }
2551
+ .card-list-div::-webkit-scrollbar-thumb{
2552
+ background-color:#35254D
2553
+ }
2554
+
2555
+ .card-list-single-div{
2556
+ border-bottom: 1px solid #E0DFE2;
2557
+ padding : 8px 11px;
2558
+ display : flex ;
2559
+ align-items:center;
2560
+ justify-content : space-between;
2561
+ gap:12px
2562
+ }
2563
+ .card-list-single-div:last-child {
2564
+ border-bottom: none;
2565
+ }
2566
+ .card-lint-div-in{
2567
+ min-height:444px}
2568
+ .card-number-radio{
2569
+ display:flex;
2570
+ gap:12px;
2571
+ }
2572
+ .card-number-radio .card-number-last-four{
2573
+ color:#161616 !important;
2574
+ font-family:Inter !important;
2575
+ font-size:14px !important;
2576
+ font-weight:500 !important;
2577
+ font-style:normal !important;
2578
+ line-height : 18px !important;
2579
+ latter-spacing:-0.18px !important
2580
+ }
2581
+ .card-expiry-date{
2582
+ margin:0;
2583
+ color:#00000080;
2584
+ font-family:Inter;
2585
+ font-size:14px;
2586
+ font-weight:500;
2587
+ font-style"normal;
2588
+ line-height : 18px;
2589
+ latter-spacing:-0.18px
2590
+ }
2591
+ .pay-with-other-card {
2592
+ margin-top : 12px;
2593
+ padding:12px 32px;
2594
+ border :1px solid #E0DFE2;
2595
+ border-radius : 1000px;
2596
+ display: flex;
2597
+ justify-content : center;
2598
+ align-items:center;
2599
+ gap:10px;
2600
+ // width:100%;
2601
+ background:white;
2602
+ cursor:pointer;
2603
+ color:#161616;
2604
+ text-align:center
2605
+ font-family: Inter;
2606
+ font-size: 14px;
2607
+ font-style: normal;
2608
+ font-weight: 500;
2609
+ line-height: 24px;
2610
+ letter-spacing: -0.28px;
2611
+ // margin-bottom: 50px;
2612
+ }
2613
+ .charge-payment-back-btn {
2614
+ display: flex;
2615
+ padding: 6px 12px !important ;
2616
+ align-items: center;
2617
+ gap: 6px;
2618
+ border-radius: 1000px;
2619
+ border: 1px solid #E0DFE2;
2620
+ background: #FFF;
2621
+ box-shadow: 0px 6px 12px 0px rgba(206, 197, 221, 0.31);
2622
+ font-size:16px;
2623
+ curso:pointer;
2624
+ color:black
2625
+ }
2626
+ .res-charge-payment-back-btn{
2627
+ padding: 9px 16px;
2628
+ align-items: center;
2629
+ gap: 6px;
2630
+ margin-bottom: 20px;
2631
+ border-radius: 1000px;
2632
+ border: 1px solid #E0DFE2;
2633
+ background: #FFF;
2634
+ box-shadow: 0px 6px 12px 0px rgba(206, 197, 221, 0.31);
2635
+ font-size:16px;
2636
+ curso:pointer;
2637
+ color:black;
2638
+ display:none
2639
+ }
2640
+ .btn {
2641
+ padding: 11px 23px;
2642
+ background-color: black;
2643
+ color: white;
2644
+ border: none;
2645
+ border-radius: 6px;
2646
+ font-weight: bold;
2647
+ margin: 0 10px;
2648
+ cursor: pointer;
2649
+ }
2650
+
2651
+ .custom-swal-icon {
2652
+ margin: 20px auto;
2653
+ }
2654
+
2655
+ .custom-swal-popup {
2656
+ font-size: 16px;
2657
+ text-align: center;
2658
+ }
2659
+
2660
+ .frac-form .res-pay-con{
2661
+ display:none
2662
+ }
2663
+
2664
+ .saveachtext p, .saveachtext b {
2665
+ font-size: 12px !important;
2666
+ color: #727272 !important;
2667
+ }
2668
+
2669
+ .cardicon-img img {
2670
+ margin-top: -2px !important;
2671
+ }
2672
+
2673
+ .bankicon-img img {
2674
+ margin-top: -4px !important;
2675
+ }
2676
+
2677
+ .cardicon {
2678
+ margin-right : 8px !important;
2679
+ width : 18px !important;
2680
+ }
2681
+
2682
+ .bankicon {
2683
+ margin-right : 8px !important;
2684
+ width : 18px !important;
2685
+ }
2686
+
2687
+
2688
+ .frac-tooltip-wrapper {
2689
+ position: absolute;
2690
+ right:0;
2691
+ }
2692
+
2693
+ .frac-tooltip-icon {
2694
+ cursor: pointer;
2695
+ }
2696
+ .frac-tooltip-mn{
2697
+ position:relative;
2698
+ }
2699
+ .frac-tooltip-text {
2700
+ display: none;
2701
+ position: absolute;
2702
+ top:-15px;
2703
+ right: 22px;
2704
+ background: #161616;
2705
+ color: white;
2706
+ padding: 15px;
2707
+ border-radius: 10px;
2708
+ width: 200px;
2709
+ font-size:12px;
2710
+ word-break: break-word;
2711
+ white-space: normal;
2712
+ z-index: 999;
2713
+ }
2714
+
2715
+ .frac-tooltip-wrapper:hover .frac-tooltip-text {
2716
+ display: block;
2717
+ }
2718
+
2719
+ .frac-tooltip-text p,.frac-tooltip-text b {
2720
+ font-size : 12px !important;
2721
+ line-height : 1.5 !important;
2722
+ margin-bottom : 10px !important;
2723
+ }
2724
+
2725
+ .amt-pay-con {
2726
+ padding-right: 24px;
2727
+ }
2728
+
2729
+
2730
+
2731
+ @media (max-width: 768px) {
2732
+ .request-payment-close-popup {
2733
+ right: 12px !important;
2734
+ top: 12px !important;
2735
+ }
2736
+
2737
+ .parent-pay-container{
2738
+ padding:24px;
2739
+ }
2740
+ .pay-container {
2741
+ grid-template-columns: 1fr;
2742
+ padding: 10px 5%;
2743
+ border:1px solid #E0DFE2;
2744
+ border-radius : 12px
2745
+ }
2746
+ .pay-conatiner-one{
2747
+ border-right: none;
2748
+ }
2749
+ .pay-conatiner-one-first{
2750
+ min-height:0
2751
+ }
2752
+ .pay-main-logo > img{
2753
+ display: none;
2754
+ }
2755
+ .pay-main-logo-res > img {
2756
+ display:block;
2757
+ margin:auto
2758
+ }
2759
+
2760
+ .pay-logo-container{
2761
+ border :none
2762
+ }
2763
+ // .res-charge-payment-back-btn {
2764
+ // display:flex !important
2765
+ // }
2766
+ // .charge-payment-back-btn{
2767
+ // display:none !important
2768
+ // }
2769
+
2770
+ .frac-new-form .pay-amount-conatiner {
2771
+ margin-top: 0px;
2772
+ margin-bottom: 24px;
2773
+ }
2774
+ .frac-form .res-pay-con{
2775
+ display:flex;
2776
+ justify-content :space-between;
2777
+ align-items:center;
2778
+ padding-bottom : 10px
2779
+ }
2780
+ .amt-pay-con {
2781
+ padding-right: 0px;
2782
+ }
2783
+ .pay-conatiner-one-last{
2784
+ display:none}
2785
+ .pay-conatiner-two{
2786
+ padding:0
2787
+ }
2788
+
2789
+
2790
+ }
2791
+ @media (max-width : 512px){
2792
+ .tab button {
2793
+ padding: 6px 16px;
2794
+ }
2795
+ }
2796
+
2797
+
2798
+ .frac-cash-discount-fee {
2799
+ display: flex;
2800
+ padding: 11px;
2801
+ justify-content: space-between;
2802
+ align-items: center;
2803
+ align-self: stretch;
2804
+ border-radius: 8px;
2805
+ border: 1px solid #E0DFE2;
2806
+ background: #F6F6F7;
2807
+ margin-top: 24px;
2808
+ }
2809
+ .frac-cash-discount-fee small {
2810
+ color:#727272;
2811
+ font-size: 12px;
2812
+ font-weight: 500;
2813
+ }
2814
+ .frac-cash-discount-fee p{
2815
+ margin:0px;
2816
+ font-size: 14px;
2817
+ font-weight: 500;
2818
+ }
2819
+ .frac-card-payment-heading {
2820
+ font-size: 24px;
2821
+ font-style: normal;
2822
+ font-weight: 600;
2823
+ margin:0px;
2824
+ }
2825
+
2826
+ .frac-heading-card-wrap {
2827
+ display: flex;
2828
+ align-items: center;
2829
+ margin-bottom:12px;
2830
+ }
2831
+ .frac-backarrow {
2832
+ margin-right: 10px;
2833
+ }
2834
+ .frac-charge-payment-back-btn-wrap , .frac-tab-2{
2835
+ display: none;
2836
+ }
2837
+ .frac-pay-conatiner-one{
2838
+ display: flex;
2839
+ flex-direction: column;
2840
+ justify-content: space-between;
2841
+ min-height: auto;
2842
+ }
2843
+
2844
+ .frac-form .saveachlabel {
2845
+ margin-bottom : 0px !important;
2846
+ }
2847
+
2848
+
2849
+
2850
+
2851
+
2852
+
2853
+
2854
+
2855
+ `)}import xt from"axios";import{IoArrowBack as Hn}from"react-icons/io5";import cn from"sweetalert2";var Ui=({amount:e,submitBtnText:y="Pay",session_token:T,customerId:O,callback:Y,merchantName:Te="merchant",isPreAuth:I,surcharge:Ge="0",submitBtnClass:Pe,submitBtnIcon:de,isRequest:o,pass_fee:X,pass_fee_amount:b})=>{var Ct,He,Ze,Zt,Tt,Wt,ot,Kt,nn,F,l,H,Fe,ee;let[c,h]=De("card"),[Ie,Z]=De("card"),[x,ke]=De(),[Q,Le]=De({}),[u,st]=De(),[W,lt]=De({}),[v,qe]=De(!1),[U,N]=De(!1),[f,ge]=De(!1),[ce,p]=De(""),[m,G]=De(!1),[q,g]=De(""),[M,d]=De(!1),[E,s]=De(!1),[V,A]=De([]),[xe,J]=De([]),[Je,tt]=De(),[Re,je]=De(Number(e)),[Ft,$e]=De("form"),[nt,we]=De("form"),St=R+"widget/mc-img.svg",K=R+"widget/visa-img.svg",it=R+"widget/ae-img.svg",Ye=R+"widget/discover-img.svg",ct=R+"widget/card.svg",bt=R+"widget/Trash.svg",At=R+"widget/bank.svg",jt=R+"widget/secure-img.png",w=R+"widget/pov-by.png",L=R+"widget/pax.svg",pe=R+"widget/cardicon.svg",fe=R+"widget/bankicon.svg",re=()=>d(!0),oe=()=>d(!1),Oe=async r=>{var i,P,j,C,D,$,ne,me;console.log(r,"ndfkjhdskjfhds");try{let ie={pass_fee_amount:b,pass_fee:X,Token:r==null?void 0:r.Token,amount:e,postal_code:r==null?void 0:r.postalCode},ae=await xt.post(`${Ne}api/v1/gateway/charge/${T}`,ie);if((i=ae==null?void 0:ae.data)!=null&&i.result){let Se={};if(f&&O)try{let Me={postal_code:x==null?void 0:x.zipCode,customer_id:O,gateway_token:(r==null?void 0:r.gateway_token)||(r==null?void 0:r.Token)},te=await xt.post(`${Ne}api/v1/gateway/add-card/${T}`,Me);(P=te==null?void 0:te.data)!=null&&P.result&&(te=(j=te==null?void 0:te.data)==null?void 0:j.data)}catch(Me){console.log(Me,"error"),oe(),p(((D=(C=Me==null?void 0:Me.response)==null?void 0:C.data)==null?void 0:D.message)||"Something went wrong!")}let We={cardDetails:k(k({},Se),r),callback:z(k({},($=ae==null?void 0:ae.data)==null?void 0:$.data),{name:x==null?void 0:x.cardName,isPreAuth:I})};f||delete We.cardDetails,Y(We),oe(),ue()}}catch(ie){p(((me=(ne=ie==null?void 0:ie.response)==null?void 0:ne.data)==null?void 0:me.message)||"Something went wrong!"),oe()}},be=async r=>{var i,P,j,C,D,$,ne,me;try{let ie={Token:r==null?void 0:r.Token,amount:e,postal_code:r==null?void 0:r.postalCode},ae=await xt.post(`${Ne}api/v1/gateway/preauth/${T}`,ie);if((i=ae==null?void 0:ae.data)!=null&&i.result){let Se={};if(f&&O)try{console.log(ae,"preAuthResponse");let Me={postal_code:x==null?void 0:x.zipCode,customer_id:O,gateway_token:(r==null?void 0:r.Token)||(r==null?void 0:r.gateway_token)},te=await xt.post(`${Ne}api/v1/gateway/add-card/${T}`,Me);(P=te==null?void 0:te.data)!=null&&P.result&&(te=(j=te==null?void 0:te.data)==null?void 0:j.data)}catch(Me){console.log(Me,"error"),oe(),p(((D=(C=Me==null?void 0:Me.response)==null?void 0:C.data)==null?void 0:D.message)||"Something went wrong!")}let We={cardDetails:k(k({},Se),r),callback:z(k({},($=ae==null?void 0:ae.data)==null?void 0:$.data),{name:x==null?void 0:x.cardName,isPreAuth:I})};f||delete We.cardDetails,Y(We),oe(),ue()}}catch(ie){p(((me=(ne=ie==null?void 0:ie.response)==null?void 0:ne.data)==null?void 0:me.message)||"Something went wrong!"),oe()}},Xe=async r=>{var i,P,j,C;if(r.Error)p(r.Error),oe();else{let D={token:r.Token,resp:r};try{let $=await xt.post(`${Ne}api/v1/gateway/update/token/${T}`,D);if(($==null?void 0:$.status)==200){let ne={Token:(P=(i=$==null?void 0:$.data)==null?void 0:i.data)==null?void 0:P.gateway_token,Brand:r.Brand,ExpirationMonth:r.ExpirationMonth,ExpirationYear:r.ExpirationYear,Last4:r.Last4,Bin:r.Bin,CVV:r.CVV,postalCode:x==null?void 0:x.zipCode},me;I?be(ne):Oe(ne)}}catch($){console.log($,"error"),oe(),p(((C=(j=$==null?void 0:$.response)==null?void 0:j.data)==null?void 0:C.message)||"Something went wrong!")}}},et=()=>N(!0),pt=r=>{h(r)},ut=()=>{var P,j,C,D,$,ne,me,ie;let r={},i=u;return(P=i==null?void 0:i.name)!=null&&P.trim()||(r.name="Name is required"),(j=i==null?void 0:i.accountNumber)!=null&&j.trim()||(r.accountNumber="Account number is required"),(C=i==null?void 0:i.accountNumber)!=null&&C.trim()&&((D=i==null?void 0:i.accountNumber)==null?void 0:D.trim())!==(($=i==null?void 0:i.confirmAccountNumber)==null?void 0:$.trim())&&(r.confirmAccountNumber="Account numbers must match"),(ne=i==null?void 0:i.bankName)!=null&&ne.trim()||(r.bankName="Bank name is required"),(me=i==null?void 0:i.routingNumber)!=null&&me.trim()||(r.routingNumber="Routing Number is required"),i!=null&&i.routingNumber&&((ie=i==null?void 0:i.routingNumber)==null?void 0:ie.length)!==9&&(r.routingNumber="Routing number must be 9 digits"),((i==null?void 0:i.accountType)==="business saving"||(i==null?void 0:i.accountType)==="business checking")&&(!(i!=null&&i.companyName)||(i==null?void 0:i.companyName)==="")&&(r.companyName="Company Name is required for business accounts"),lt(r),Object.keys(r).length>0},dt=async()=>{var r,i,P,j,C,D,$,ne,me,ie,ae,Se,We,Me,te,wt;try{let he={method:"POST",redirect:"follow"},Ue=await xt.post(`${Ne}api/v1/widget/generate-session`,he),Be=Number(x==null?void 0:x.expiryYear)%100,_e=`${(r=x==null?void 0:x.cardNumber)==null?void 0:r.replace(/\s+/g,"")}=${Be}${x==null?void 0:x.expiryMonth} ${x==null?void 0:x.cvv}`,ht=forge.pki.publicKeyFromPem((P=(i=Ue==null?void 0:Ue.data)==null?void 0:i.data)==null?void 0:P.publicKeyPem).encrypt(_e,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),qt=forge.util.encode64(ht),Lt={"Content-Type":"application/json","x-app-session-key":(C=(j=Ue.data)==null?void 0:j.data)==null?void 0:C.session_key},jn=JSON.stringify({enc_track2_data:qt,algorithm:"RSAES_OAEP_SHA_1",session_key:($=(D=Ue==null?void 0:Ue.data)==null?void 0:D.data)==null?void 0:$.session_key}),Dt=await xt.post(`${yt}tokenizer/tokenize`,jn,{headers:Lt});if((Dt==null?void 0:Dt.status)==200){let Pn=(me=(ne=Dt==null?void 0:Dt.data)==null?void 0:ne.data)==null?void 0:me.token;try{let zt=await xt.post(`${Ne}api/v1/gateway/verify-and-save/${T}`,{token:Pn});if((zt==null?void 0:zt.status)==200){let Ut=(ie=zt==null?void 0:zt.data)==null?void 0:ie.data,mt={Token:Ut.gateway_token,Brand:Ut.card_data.brand,ExpirationMonth:Ut.card_data.expire_mm,ExpirationYear:Ut.card_data.expire_yy,Last4:Ut.card_data.last4,Bin:Ut.card_data.bin,postalCode:x==null?void 0:x.zipCode},Ln;if(f&&O)try{let Rt={postal_code:x==null?void 0:x.zipCode,customer_id:O,gateway_token:Ut.gateway_token};Ln=await xt.post(`${Ne}api/v1/gateway/add-card/${T}`,Rt)}catch(Rt){console.log(Rt,"error"),oe(),p(((Se=(ae=Rt==null?void 0:Rt.response)==null?void 0:ae.data)==null?void 0:Se.message)||"Something went wrong!")}I?be(mt):Oe(mt)}}catch(zt){console.log(zt,"error"),p(((Me=(We=zt==null?void 0:zt.response)==null?void 0:We.data)==null?void 0:Me.message)||"Something went wrong!"),oe()}}}catch(he){oe(),console.log(he,"error"),p(((wt=(te=he==null?void 0:he.response)==null?void 0:te.data)==null?void 0:wt.message)||"Something went wrong!")}},gt=()=>{var C,D,$,ne,me,ie;let r={},i=x,P=parseInt((i==null?void 0:i.expiryMonth)||"",10),j=(i==null?void 0:i.expiryYear)||"";if((C=i==null?void 0:i.cardName)!=null&&C.trim()||(r.cardName="Card name is required"),(D=i==null?void 0:i.cardNumber)!=null&&D.trim()||(r.cardNumber="Card number is required"),(!(($=i==null?void 0:i.expiryMonth)!=null&&$.trim())||!((ne=i==null?void 0:i.expiryYear)!=null&&ne.trim())||isNaN(P)||P<1||P>12||j.length!==4)&&(r.expiryMonth="Invalid Expiration Date."),(me=i==null?void 0:i.cvv)!=null&&me.trim()||(r.cvv="CVV is required"),(ie=i==null?void 0:i.zipCode)!=null&&ie.trim()||(r.zipCode="ZIP code is required"),i!=null&&i.expiryMonth&&(i!=null&&i.expiryYear)&&i.expiryMonth.length<=2&&i.expiryYear.length===4){let ae=parseInt(i.expiryMonth,10),Se=parseInt(i.expiryYear,10),We=new Date,Me=We.getMonth()+1,te=We.getFullYear();(Se<te||Se===te&&ae<Me)&&(r.expiryMonth="Card is expired")}return Le(r),Object.keys(r).length>0},vt=()=>{let r=DatacapWebToken.validateCardNumber(x==null?void 0:x.cardNumber.replaceAll(" ","")),i=DatacapWebToken.validateExpirationDate(x==null?void 0:x.expiryMonth,x==null?void 0:x.expiryYear),P=DatacapWebToken.validateCVV(x==null?void 0:x.cvv),j={};return r||(j.cardNumber="Invalid card Number"),i||(j.expiryMonth="Invalid Expiration Date."),P||(j.cvv="Invalid CVV"),Le(j),r&&P&&i},Mt=async r=>{var i,P,j,C,D,$,ne,me,ie,ae,Se,We,Me,te,wt;if(r.preventDefault(),c!=="ach"){if(gt()||!vt())return}else if(ut())return;try{re();let he=await xt.get(`${Ne}api/v1/gateway/token/${T}`);if((he==null?void 0:he.status)==200){let Ue=(P=(i=he==null?void 0:he.data)==null?void 0:i.data)==null?void 0:P.gateway_token,Be=(C=(j=he==null?void 0:he.data)==null?void 0:j.data)==null?void 0:C.paymentGateway;if(c!=="ach")Be==((D=Mn)==null?void 0:D.FRACTALKEY)?await dt():DatacapWebToken.requestToken(Ue,"PaymentForm",Xe);else{let ye;try{let _e=await xt.post(`${Ne}api/v1/gateway/bank-charge/${T}`,{label:u==null?void 0:u.name,account_number:u==null?void 0:u.accountNumber,routing_number:u==null?void 0:u.routingNumber,bank_name:u==null?void 0:u.bankName,account_type:u==null?void 0:u.accountType,amount:Re,customer_id:null,isSaveAch:!1,tax:"0.00",discount:"0.00",surcharge:"0.00",order_id:"",company_name:(u==null?void 0:u.companyName)||""});if(($=_e==null?void 0:_e.data)!=null&&$.result){if(v&&O)try{let se=await xt.post(`${Ne}api/v1/gateway/add-bank/${T}`,{name:u==null?void 0:u.name,account_number:u==null?void 0:u.accountNumber,routing_number:u==null?void 0:u.routingNumber,bank_name:u==null?void 0:u.bankName,account_type:u==null?void 0:u.accountType,customer_id:O||"",company_name:(u==null?void 0:u.companyName)||""});se.data.result&&(ye={bankDetails:z(k({},(ne=se==null?void 0:se.data)==null?void 0:ne.data),{account_type:u==null?void 0:u.accountType})})}catch(se){oe(),p(((ie=(me=se==null?void 0:se.response)==null?void 0:me.data)==null?void 0:ie.message)||"Something went wrong!")}ye=z(k({},ye),{callback:z(k({},(ae=_e==null?void 0:_e.data)==null?void 0:ae.data),{name:u==null?void 0:u.name,isPreAuth:I})}),Y(ye),ue(),oe()}}catch(_e){console.log(_e,"errororor");let se=(Se=_e==null?void 0:_e.response)==null?void 0:Se.data;typeof(se==null?void 0:se.message)=="object"?Object.values(se==null?void 0:se.message).forEach(ht=>{p(ht||"Something went wrong")}):p((se==null?void 0:se.message)||"Something went wrong"),oe()}}}}catch(he){oe(),Y({error:((Me=(We=he==null?void 0:he.response)==null?void 0:We.data)==null?void 0:Me.message)||"Something went wrong!"}),p(((wt=(te=he==null?void 0:he.response)==null?void 0:te.data)==null?void 0:wt.message)||"Something went wrong!")}},at=(r,i)=>{let P=r;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(P)){(i===""||/^[0-9]+$/.test(i))&&(Le(C=>z(k({},C),{[P]:""})),ke(C=>z(k({},C),{[P]:i})));return}Le(C=>z(k({},C),{[P]:""})),ke(C=>z(k({},C),{[P]:i}))},Pt=r=>{let P=r.target.value.replace(/\D/g,""),j="";/^3[47]/.test(P)?j=P.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(D,$,ne,me)=>[$,ne,me].filter(Boolean).join(" ")):j=P.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(D,$,ne,me,ie)=>[$,ne,me,ie].filter(Boolean).join(" ")),Le(C=>z(k({},C),{cardNumber:""})),ke(C=>z(k({},C),{cardNumber:j}))},Ve=r=>{let{name:i,value:P}=r.target,j=["routingNumber","accountNumber","confirmAccountNumber"];if(i=="name"){/^[a-zA-Z\s]*$/.test(P)&&(lt(C=>z(k({},C),{[i]:""})),st(C=>z(k({},C),{[i]:P})));return}if(j.includes(i)){(P===""||/^[0-9]+$/.test(P))&&(lt(C=>z(k({},C),{[i]:""})),st(C=>z(k({},C),{[i]:P})));return}lt(C=>z(k({},C),{[i]:""})),st(C=>z(k({},C),{[i]:P}))},ue=()=>{N(!1),h("card"),p(""),G(!1),g(""),st({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),lt({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),ke({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),Le({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),qe(!1),ge(!1),we("form"),$e("form"),A([])},ft=async()=>{var r,i,P,j;re();try{let C={isPreAuth:I,customerId:O},D=await xt.post(`${Ne}api/v1/gateway/card-list/${T}`,C);console.log("cardListData",D);let $=((i=(r=D==null?void 0:D.data)==null?void 0:r.data)==null?void 0:i.cardList)||[],ne=$==null?void 0:$.filter(ie=>(ie==null?void 0:ie.card_type)=="Bank"),me=$==null?void 0:$.filter(ie=>(ie==null?void 0:ie.card_type)!=="Bank");me&&(me==null?void 0:me.length)>0?(h("card"),$e("list"),A(me)):h("card"),ne&&(ne==null?void 0:ne.length)>0&&(we("list"),J(ne)),oe()}catch(C){console.log(C),oe(),p(((j=(P=C==null?void 0:C.response)==null?void 0:P.data)==null?void 0:j.message)||(C==null?void 0:C.message)||"Something went wrong")}};console.log(xe,"lists",V);let Bt=r=>{switch(r==null?void 0:r.toLowerCase()){case"visa":return K;case"mastercard":case"mc":case"m/c":return St;case"amex":case"american express":case"ae":return it;case"discover":case"dcvr":return Ye;case"bank":return At;default:return r}},Vt=async r=>{cn.fire({icon:"warning",text:"Do you want to delete the card?",showCancelButton:!0,confirmButtonText:"Yes",cancelButtonText:"No",reverseButtons:!0,buttonsStyling:!1,customClass:{confirmButton:"swal2-confirm btn btn-dark",cancelButton:"swal2-cancel btn btn-dark",popup:"custom-swal-popup",icon:"custom-swal-icon"}}).then(async i=>{var P,j;if(i.isConfirmed){s(!0);try{let C={card_id:r,customer_id:O},D=await xt.patch(`${Ne}api/v1/gateway/delete-card/${T}`,C);(P=D==null?void 0:D.data)!=null&&P.result?(s(!1),ft(),cn.fire({icon:"success",title:"Deleted!",text:((j=D==null?void 0:D.data)==null?void 0:j.message)||"Card deleted.",confirmButtonText:"OK",showConfirmButton:!0,timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}})):(s(!1),cn.fire({icon:"error",title:"Failure!",text:"Card not deleted.",timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}}))}catch(C){s(!1),cn.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}else i.dismiss===cn.DismissReason.cancel&&cn.fire({icon:"info",text:"Card not deleted",confirmButtonText:"OK",buttonsStyling:!1,customClass:{confirmButton:"btn btn-dark float-end",actions:"swal2-actions-end"}})})},Ke=async()=>{var j,C,D,$;let r=O,i=Je==null?void 0:Je.id,P=Je==null?void 0:Je.card_type;if(e)if(r)if(i){let ne={amount:(P==null?void 0:P.toLowerCase())==="bank"?Re:e,customer_id:r,card_id:i};I&&(ne.isPreauth=!0),console.log(ne,"chargeobj");let me=Ne+"api/v1/gateway/charge-by-saved-details/"+T,ie={"Content-Type":"application/json"};try{re();let ae=await xt.post(me,ne);console.log(ae,"res"),(j=ae==null?void 0:ae.data)!=null&&j.result&&(Y({callback:z(k({},(C=ae==null?void 0:ae.data)==null?void 0:C.data),{isPreAuth:I})}),oe(),ue())}catch(ae){console.log(ae==null?void 0:ae.response,"error by saved details"),oe(),p((($=(D=ae==null?void 0:ae.response)==null?void 0:D.data)==null?void 0:$.message)||"Something went wrong!")}}else p("Please Select A Card/ACH");else p("Please Select Customer");else p("Something went wrong.")};Wi(()=>{U&&je(Number(e)-Number(b)),O&&U&&!o&&ft()},[O,U]);let Qt=()=>I?"Cards":"Cards/Bank";return n.createElement(n.Fragment,null,n.createElement("link",{href:"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css"}),n.createElement(Yt,null),n.createElement(Yn,null),n.createElement(yn,null),n.createElement("button",{className:Pe||"paymentBtn",onClick:et},y,de),n.createElement($t,{open:U,onClose:ue},ce&&n.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},n.createElement(Et,{error:ce,onClose:ue})),!ce&&n.createElement(n.Fragment,null,(M||E)&&n.createElement(Nt,{loading:M||E}),n.createElement("div",{className:"frac-card-payment-page frac-form frac-new-form"},n.createElement("div",{className:"parent-pay-container"},n.createElement("span",{className:"request-payment-close-popup",onClick:ue},n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},n.createElement("g",{clipPath:"url(#clip0_12425_52336)"},n.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),n.createElement("defs",null,n.createElement("clipPath",{id:"clip0_12425_52336"},n.createElement("rect",{width:"16",height:"16",fill:"white"}))))),n.createElement("div",{className:"pay-main-logo-res"}),n.createElement("div",{className:"pay-container"},n.createElement("div",{className:"pay-header pay-conatiner-one"},n.createElement("div",{className:"pay-conatiner-one-first"},n.createElement("div",{className:"pay-logo-container"},n.createElement("div",{className:"pay-main-logo"}),n.createElement("h1",{className:"pay-heading"},"Pay"),(V==null?void 0:V.length)>0&&c!=="cardList"&&n.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>h("cardList")}," ",n.createElement(Hn,null)," Back")),n.createElement("div",{className:"amt-pay-con"},n.createElement("div",{className:"pay-amount-conatiner"},n.createElement("small",{className:"pay-payment-amount"},"Select paymet type"),n.createElement("div",{className:"frac-card-bank-radio-main"},n.createElement(sn,{label:"Card",amount:(Ct=Number(e))==null?void 0:Ct.toFixed(2),value:"card",onChange:pt,activetab:c}),!I&&n.createElement(sn,{label:"Bank",amount:(He=Number(Re))==null?void 0:He.toFixed(2),value:"ach",onChange:pt,activetab:c})),X&&Re&&Re>0?n.createElement("div",{className:"frac-cash-discount-fee"},n.createElement("small",null,c==="card"?"Cash Discount":"Cash Discount Savings"," "),n.createElement("p",null,"$",(Number(e)-Number(Re)).toFixed(2))):null))),n.createElement("div",{className:"pay-conatiner-one-last"},n.createElement("img",{src:jt,alt:""}),n.createElement("img",{src:w,alt:""}),"Secure payments powered by Fractal")),n.createElement("div",{className:"pay-tab pay-conatiner-two"},n.createElement("div",{className:"col-md-12"},n.createElement("div",{id:"payment-form-div"},n.createElement("div",{id:"ach",style:{display:c==="card"?"block":"none"},className:"tabcontent"},n.createElement("div",{className:"frac-heading-card-wrap"},n.createElement("div",{className:"frac-backarrow"},(V==null?void 0:V.length)>0&&Ft==="form"&&n.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>$e("list")}," ",n.createElement(Hn,null))),n.createElement("h6",{className:"frac-card-payment-heading"},"Card Payment")),n.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0px 19px 0px"}},n.createElement("img",{src:K,alt:"",width:33}),n.createElement("img",{src:St,width:33,alt:""}),n.createElement("img",{src:it,alt:"",width:33}),n.createElement("img",{src:Ye,width:33,alt:""})),Ft==="list"&&(V==null?void 0:V.length)>0?n.createElement(n.Fragment,null,n.createElement(ln,{headingClass:"card-ach-heading-frac",listHeading:"Card",ListItems:V,selectedCard:Je,setSelectedCard:tt,handleDeleteCard:Vt,otherButtonLabel:"Pay With Other Card",otherButtonAction:()=>{$e("form")}}),n.createElement("div",{className:"form-group-frac",style:{padding:"0"}},n.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:Ke},an((Ze=Number(e))==null?void 0:Ze.toFixed(2))))):n.createElement("form",{id:"PaymentForm",style:{textAlign:"start"},onSubmit:Mt},n.createElement("div",{className:"ach-scrl",style:{minHeight:"398px",maxHeight:"398px",overflow:"auto",marginRight:"5px"}},n.createElement("div",{className:"form-group-frac"},n.createElement("label",{htmlFor:"cardHolderName"},"NAME ON CARD "),n.createElement("input",{type:"text",className:"form-control-frac",maxLength:100,placeholder:"John Doe",value:(x==null?void 0:x.cardName)||"",onChange:r=>{let i=r.target.value;/^[a-zA-Z\s]*$/.test(i)&&at("cardName",i)}}),(Q==null?void 0:Q.cardName)&&n.createElement("span",{className:"error-span"},Q==null?void 0:Q.cardName)),n.createElement("div",{className:"form-group-frac"},n.createElement("label",{htmlFor:"cardNumber"},"CARD NUMBER"),n.createElement("div",{className:"toggle-num-wrapper"},n.createElement("input",{className:"form-control-frac card-number-new",type:"text",maxLength:19,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:(x==null?void 0:x.cardNumber)||"",onChange:r=>Pt(r),"data-token":"card_number"}),n.createElement("div",{className:"card-crdi card-expiry-new"},n.createElement("div",{className:"exp-date-year-container"},n.createElement("div",{className:"exp-date form-group-frac"},n.createElement("input",{"data-token":"exp_month",className:"form-control-frac required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"MM",maxLength:2,value:(x==null?void 0:x.expiryMonth)||"",onChange:r=>at("expiryMonth",r.target.value)})),n.createElement("div",{className:"exp-year form-group-frac"},n.createElement("input",{"data-token":"exp_year",className:"form-control-frac required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"YYYY",maxLength:4,value:(x==null?void 0:x.expiryYear)||"",onChange:r=>at("expiryYear",r.target.value)})),n.createElement("div",{className:"security-digit form-group-frac"},n.createElement("input",{"data-token":"cvv",className:"form-control-frac card-cvv-in required",type:"text",style:{maxHeight:"36px"},maxLength:4,placeholder:"CVC",value:(x==null?void 0:x.cvv)||"",onChange:r=>at("cvv",r.target.value)})))),(Q==null?void 0:Q.cardNumber)&&n.createElement("span",{className:"error-span"},Q==null?void 0:Q.cardNumber),n.createElement("p",{style:{margin:"0"}},Q!=null&&Q.expiryMonth||Q!=null&&Q.expiryYear?n.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},Q==null?void 0:Q.expiryMonth):"",(Q==null?void 0:Q.cvv)&&n.createElement("span",{className:"error-span"},Q==null?void 0:Q.cvv)))),n.createElement("div",{className:"form-group-frac"},n.createElement("label",{htmlFor:"zip"},"ZIP"),n.createElement("input",{type:"text",className:"form-control-frac",maxLength:100,placeholder:"000000",value:(Zt=x==null?void 0:x.zipCode)!=null?Zt:"",onChange:r=>at("zipCode",r.target.value)}),(Q==null?void 0:Q.zipCode)&&n.createElement("span",{className:"error-span"},Q==null?void 0:Q.zipCode)),O&&n.createElement("div",{className:"form-group-frac"},n.createElement("div",{className:"frac-tooltip-mn",style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},n.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:f,onChange:r=>ge(r.target.checked)}),n.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),n.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),n.createElement("div",{className:"frac-tooltip-wrapper"},n.createElement("div",{className:"frac-tooltip-icon"},n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},n.createElement("circle",{cx:"10",cy:"10",r:"10",fill:"#E0DFE2"}),n.createElement("path",{d:"M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z",fill:"#161616"}))),n.createElement("div",{className:"frac-tooltip-text"},n.createElement("p",null,"If checked, I agree to give the ",n.createElement("b",null,Te||"merchant")," permission to charge this credit card for agreed-upon purchases in the future.")))))),n.createElement("div",{className:"form-group-frac",style:{marginTop:"20px",padding:"0"}},n.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},an((Tt=Number(e))==null?void 0:Tt.toFixed(2)))))),n.createElement("div",{id:"ach",style:{display:c==="ach"?"block":"none"},className:"tabcontent"},n.createElement(n.Fragment,null,n.createElement("div",{className:"frac-heading-card-wrap"},n.createElement("div",{className:"frac-backarrow"},(xe==null?void 0:xe.length)>0&&nt==="form"&&n.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>we("list")}," ",n.createElement(Hn,null))),n.createElement("h6",{className:"frac-card-payment-heading"},"Bank Payment")),nt==="list"&&(xe==null?void 0:xe.length)>0?n.createElement(n.Fragment,null,n.createElement(ln,{headingClass:"card-ach-heading-frac",listHeading:"Banks",ListItems:xe,selectedCard:Je,setSelectedCard:tt,handleDeleteCard:Vt,otherButtonLabel:"Pay With Other Bank",otherButtonAction:()=>{we("form")}}),n.createElement("div",{className:"form-group-frac",style:{padding:"0"}},n.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:Ke},an((Wt=Number(Re))==null?void 0:Wt.toFixed(2))))):n.createElement("form",{id:"ACHPaymentForm",style:{textAlign:"start"},onSubmit:Mt},n.createElement("div",{className:"ach-scrl",style:{minHeight:"444px",maxHeight:"444px"}},n.createElement("div",{className:"form-group-frac mb-4"},n.createElement("label",{htmlFor:"nameonaccount"},"Name on account"),n.createElement("input",{type:"text",id:"nameonaccount",className:"form-control-frac",maxLength:100,placeholder:"John Doe",name:"name",value:(ot=u==null?void 0:u.name)!=null?ot:"",onChange:Ve}),(W==null?void 0:W.name)&&n.createElement("span",{className:"error-span"},W==null?void 0:W.name)),n.createElement("div",{className:"form-group-frac mb-4"},n.createElement("label",{htmlFor:"routingnumber"},"Routing number"),n.createElement("input",{type:"text",id:"routingnumber",className:"form-control-frac",maxLength:9,placeholder:"000000000",name:"routingNumber",value:(Kt=u==null?void 0:u.routingNumber)!=null?Kt:"",onChange:Ve}),(W==null?void 0:W.routingNumber)&&n.createElement("span",{className:"error-span"},W==null?void 0:W.routingNumber)),n.createElement("div",{className:"form-group-frac mb-4"},n.createElement("label",{htmlFor:"accountnumber"},"Account number"),n.createElement("input",{type:"text",id:"accountnumber",className:"form-control-frac",maxLength:16,placeholder:"0000000000",name:"accountNumber",value:(nn=u==null?void 0:u.accountNumber)!=null?nn:"",onChange:Ve}),(W==null?void 0:W.accountNumber)&&n.createElement("span",{className:"error-span"},W==null?void 0:W.accountNumber)),n.createElement("div",{className:"form-group-frac mb-4"},n.createElement("label",{htmlFor:"confirmaccountnumber"},"Confirm account number"),n.createElement("input",{type:"text",id:"confirmaccountnumber",className:"form-control-frac",maxLength:16,placeholder:"0000000000",name:"confirmAccountNumber",value:(F=u==null?void 0:u.confirmAccountNumber)!=null?F:"",onChange:Ve}),(W==null?void 0:W.confirmAccountNumber)&&n.createElement("span",{className:"error-span"},W==null?void 0:W.confirmAccountNumber)),n.createElement("div",{className:"form-group-frac mb-4"},n.createElement("label",{htmlFor:"bankname"},"Bank name"),n.createElement("input",{type:"text",id:"bankname",className:"form-control-frac",maxLength:100,placeholder:"My Bank",name:"bankName",value:(l=u==null?void 0:u.bankName)!=null?l:"",onChange:Ve}),(W==null?void 0:W.bankName)&&n.createElement("span",{className:"error-span"},W==null?void 0:W.bankName)),((u==null?void 0:u.accountType)==="business saving"||(u==null?void 0:u.accountType)==="business checking")&&n.createElement("div",{className:"form-group-frac mb-4"},n.createElement("label",{htmlFor:"companyName"},"Company name"),n.createElement("input",{type:"text",id:"companyName",className:"form-control",maxLength:100,placeholder:"My Company",name:"companyName",value:(H=u==null?void 0:u.companyName)!=null?H:"",onChange:Ve}),(W==null?void 0:W.companyName)&&n.createElement("span",{className:"error-span"},W==null?void 0:W.companyName)),n.createElement("div",{className:"form-group-frac mb-4"},n.createElement("label",{htmlFor:"accounttype"},"Select account type"),n.createElement("select",{name:"accountType",id:"accounttype",className:"form-control-frac",value:(Fe=u==null?void 0:u.accountType)!=null?Fe:"",onChange:Ve},n.createElement("option",{value:""},"Select account"),Fn.map(r=>n.createElement("option",{key:r.value,value:r.value},r.label)))),O&&n.createElement("div",{className:"form-group-frac mb-4 save-ach-div",style:{paddingTop:"5px"}},n.createElement("input",{type:"checkbox",id:"saveACH",className:"",maxLength:100,placeholder:"My Bank",checked:v,onChange:r=>qe(r.target.checked)}),n.createElement("label",{className:"saveachlabel",htmlFor:"saveACH"},"Save ACH")),v&&n.createElement("div",{className:"form-group-frac mb-4 saveachtext"},n.createElement("p",null,"If checked, I agree to give the ",n.createElement("b",null,Te||"merchant")," permission to charge this bank account for agreed-upon purchases in the future."))),n.createElement("div",{className:"form-group-frac "},n.createElement("button",{className:"pay-button",style:{margin:"20px 0 0"},type:"submit"},an((ee=Number(Re))==null?void 0:ee.toFixed(2))))))))))))))))};export{Ki as AddCard,Oi as CardOnFile,Ti as GetPaymentPage,Ui as PaymentWidget,qi as PreAuthPayment,xi as RequestPayment,wi as RequestPreAuthPayment};