@fractalpay/fractalpay-next-dev 0.0.251 → 0.0.253

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@ var require_package = __commonJS({
39
39
  "package.json"(exports, module) {
40
40
  module.exports = {
41
41
  name: "@fractalpay/fractalpay-next-dev",
42
- version: "0.0.251",
42
+ version: "0.0.253",
43
43
  private: false,
44
44
  type: "module",
45
45
  scripts: {
@@ -113,8 +113,25 @@ import { useState, useEffect } from "react";
113
113
  import { jsx } from "react/jsx-runtime";
114
114
  var LoaderStyle = (props) => {
115
115
  return /* @__PURE__ */ jsx("style", { children: `
116
-
117
- .loader {
116
+
117
+ .loader-light {
118
+ position: fixed; /* Fixed position to cover the viewport */
119
+ top: 0;
120
+ left: 0;
121
+ width: 100%;
122
+ height: 100%;
123
+ display: flex;
124
+ justify-content: center;
125
+ align-items: center;
126
+ /* background: rgba(255, 255, 0, 0.01); Adjust the blur effect */
127
+ background-color: rgba(31, 29, 29, 0.52); /* Semi-transparent black background */
128
+
129
+ backdrop-filter: blur(0.5px); /* Blur effect */
130
+ z-index: 999999999999 !important; /* Ensure it's on top of other elements */
131
+ transform: translate(0%, 0%) !important
132
+ }
133
+
134
+ .loader-dark {
118
135
  position: fixed; /* Fixed position to cover the viewport */
119
136
  top: 0;
120
137
  left: 0;
@@ -126,7 +143,7 @@ var LoaderStyle = (props) => {
126
143
  /* background: rgba(255, 255, 0, 0.01); Adjust the blur effect */
127
144
  background-color: rgba(31, 29, 29, 0.52); /* Semi-transparent black background */
128
145
 
129
- backdrop-filter: blur(.5px); /* Blur effect */
146
+ backdrop-filter: blur(6.5px); /* Blur effect */
130
147
  z-index: 999999999999 !important; /* Ensure it's on top of other elements */
131
148
  transform: translate(0%, 0%) !important
132
149
  }
@@ -201,10 +218,11 @@ var LoaderStyle_default = LoaderStyle;
201
218
 
202
219
  // src/app/components/Loader/Loader.tsx
203
220
  import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
204
- var Loader = (props) => {
221
+ var Loader = (_a) => {
222
+ var _b = _a, { intensity = "light" } = _b, props = __objRest(_b, ["intensity"]);
205
223
  return /* @__PURE__ */ jsxs(Fragment, { children: [
206
224
  /* @__PURE__ */ jsx2(LoaderStyle_default, {}),
207
- (props == null ? void 0 : props.loading) && /* @__PURE__ */ jsx2("div", { className: "loader", children: /* @__PURE__ */ jsxs("div", { className: "lds-ellipsis", children: [
225
+ (props == null ? void 0 : props.loading) && /* @__PURE__ */ jsx2("div", { className: `loader-${intensity}`, children: /* @__PURE__ */ jsxs("div", { className: "lds-ellipsis", children: [
208
226
  /* @__PURE__ */ jsx2("div", {}),
209
227
  /* @__PURE__ */ jsx2("div", {}),
210
228
  /* @__PURE__ */ jsx2("div", {}),
@@ -218,41 +236,65 @@ var Loader_default = Loader;
218
236
  var { name } = require_package();
219
237
  var S3Url = "https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/";
220
238
  if (name === "@fractalpay/fractalpay-next-dev") {
221
- baseUrl = "http://localhost:8082/";
222
- masterBaseUrl = "http://localhost:8081/";
239
+ masterBaseUrl = "https://dev-sky-node.fractalpay.com/";
240
+ baseUrl = "https://dev-widget.fractalpay.com/";
223
241
  fractalGatewayUrl = "https://api-dev.merchant-trends.com/";
224
242
  datacapUrl = "https://token-cert.dcap.com/v1/client";
225
243
  threedsSecurePublicKey = "pk_test_51RH5Wc2SlJvyNZ80hpUDy88r4rVdpijfKbNaWaUyQEE6rOrPmG2JQyAj7G5amBD5z5daC56WaeT4jfNhrrPcGOEP00UyKu6AOw";
244
+ applePayMerchantId = "fractal";
245
+ googlePayMerchantId = "12345678901234567890";
246
+ googlePayEnvironment = "TEST";
247
+ googlePayGatewayMerchantId = "fractal";
226
248
  } else if (name === "@fractalpay/fractalpay-next-test") {
227
249
  masterBaseUrl = "https://testapi.fractalpay.com/";
228
250
  baseUrl = "https://staging-widget.fractalpay.com/";
229
251
  fractalGatewayUrl = "https://api-dev.merchant-trends.com/";
230
252
  datacapUrl = "https://token-cert.dcap.com/v1/client";
231
253
  threedsSecurePublicKey = "pk_test_51RH5Wc2SlJvyNZ80hpUDy88r4rVdpijfKbNaWaUyQEE6rOrPmG2JQyAj7G5amBD5z5daC56WaeT4jfNhrrPcGOEP00UyKu6AOw";
254
+ applePayMerchantId = "fractal";
255
+ googlePayMerchantId = "12345678901234567890";
256
+ googlePayEnvironment = "TEST";
257
+ googlePayGatewayMerchantId = "fractal";
232
258
  } else if (name === "@fractalpay/fractalpay-next-testprod") {
233
259
  masterBaseUrl = "https://sky-node-prod.fractalpay.com/";
234
260
  baseUrl = "https://widget-prod.fractalpay.com/";
235
261
  fractalGatewayUrl = "https://api.merchant-trends.com/";
236
262
  datacapUrl = "https://token.dcap.com/v1/client";
237
263
  threedsSecurePublicKey = "pk_live_51RH5WXCZ90rBGeaYwqmjWqgUmudTgxL6uKOE1keu617jvRx9OvW2ke6zGf6SKgv4ixsBLcIPQ4sQIEhp8MgBX39500CqULxOPB";
264
+ applePayMerchantId = "fractal";
265
+ googlePayMerchantId = "BCR2DN4T6OC2TCQH";
266
+ googlePayEnvironment = "PRODUCTION";
267
+ googlePayGatewayMerchantId = "fractal";
238
268
  } else if (name === "@fractalpay/fractalpay-next") {
239
269
  masterBaseUrl = "https://api.fractalpay.com/";
240
270
  baseUrl = "https://widget.fractalpay.com/";
241
271
  fractalGatewayUrl = "https://api.merchant-trends.com/";
242
272
  datacapUrl = "https://token.dcap.com/v1/client";
243
273
  threedsSecurePublicKey = "pk_live_51RH5WXCZ90rBGeaYwqmjWqgUmudTgxL6uKOE1keu617jvRx9OvW2ke6zGf6SKgv4ixsBLcIPQ4sQIEhp8MgBX39500CqULxOPB";
274
+ applePayMerchantId = "fractal";
275
+ googlePayMerchantId = "BCR2DN4T6OC2TCQH";
276
+ googlePayEnvironment = "PRODUCTION";
277
+ googlePayGatewayMerchantId = "fractal";
244
278
  } else {
245
279
  baseUrl = "http://localhost:8082/";
246
280
  masterBaseUrl = "http://localhost:8081/";
247
281
  fractalGatewayUrl = "https://api-dev.merchant-trends.com/";
248
282
  datacapUrl = "https://token-cert.dcap.com/v1/client";
249
283
  threedsSecurePublicKey = "pk_test_51RH5Wc2SlJvyNZ80hpUDy88r4rVdpijfKbNaWaUyQEE6rOrPmG2JQyAj7G5amBD5z5daC56WaeT4jfNhrrPcGOEP00UyKu6AOw";
284
+ applePayMerchantId = "fractal";
285
+ googlePayMerchantId = "12345678901234567890";
286
+ googlePayEnvironment = "TEST";
287
+ googlePayGatewayMerchantId = "fractal";
250
288
  }
251
289
  var masterBaseUrl;
252
290
  var baseUrl;
253
291
  var fractalGatewayUrl;
254
292
  var datacapUrl;
255
293
  var threedsSecurePublicKey;
294
+ var applePayMerchantId;
295
+ var googlePayMerchantId;
296
+ var googlePayEnvironment;
297
+ var googlePayGatewayMerchantId;
256
298
 
257
299
  // src/app/components/Errortext.ts
258
300
  var ErrorText = {
@@ -1016,10 +1058,9 @@ function RequestPayment(props) {
1016
1058
  let cash_discount = CalculateCashDiscount(props == null ? void 0 : props.amount, props == null ? void 0 : props.surcharge);
1017
1059
  setCashDiscount(cash_discount);
1018
1060
  }
1019
- }, [props == null ? void 0 : props.pass_fee, show]);
1061
+ }, [props == null ? void 0 : props.pass_fee]);
1020
1062
  const handleClose = () => {
1021
1063
  setShow(false);
1022
- setCashDiscount(0);
1023
1064
  setErrors({});
1024
1065
  };
1025
1066
  const handleShow = () => setShow(true);
@@ -2417,19 +2458,6 @@ position:relative;
2417
2458
  border: 0;
2418
2459
  border-right: 1px solid #dee2e6;
2419
2460
  }
2420
-
2421
- .frac-fee-text{
2422
- display: block;
2423
- padding: 10px 0 4px;
2424
- font-family: 'IBM Plex Mono', monospace !important;
2425
- color: #727272 !important;
2426
- font-size: 12px;
2427
- line-height: 1.4;
2428
- }
2429
- .frac-fee-amount{
2430
- color: #c62828 !important;
2431
- }
2432
-
2433
2461
  ` });
2434
2462
  }
2435
2463
 
@@ -2922,7 +2950,7 @@ function ErrorCardMszStyle() {
2922
2950
 
2923
2951
  // src/app/components/ErrorCardMessage/ErrorCardMessage.tsx
2924
2952
  import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
2925
- var ErrorCardMessage = ({ onClose, error }) => {
2953
+ var ErrorCardMessage = ({ onClose, error, autoTrigger = false }) => {
2926
2954
  return /* @__PURE__ */ jsxs6(Fragment6, { children: [
2927
2955
  /* @__PURE__ */ jsx12(ErrorCardMszStyle, {}),
2928
2956
  /* @__PURE__ */ jsx12("div", { className: "card-error", children: /* @__PURE__ */ jsx12("div", { className: "payment-error-container", children: /* @__PURE__ */ jsxs6("div", { className: "error-icon", children: [
@@ -2931,7 +2959,7 @@ var ErrorCardMessage = ({ onClose, error }) => {
2931
2959
  /* @__PURE__ */ jsx12("div", { className: "payment-error-text", children: error }),
2932
2960
  /* @__PURE__ */ jsx12("div", { className: "thank-you-text", children: "Try again later " })
2933
2961
  ] }),
2934
- /* @__PURE__ */ jsx12("div", { className: "error-btn-div", children: /* @__PURE__ */ jsx12("button", { onClick: onClose, children: "OK" }) })
2962
+ !autoTrigger && /* @__PURE__ */ jsx12("div", { className: "error-btn-div", children: /* @__PURE__ */ jsx12("button", { onClick: onClose, children: "OK" }) })
2935
2963
  ] }) }) })
2936
2964
  ] });
2937
2965
  };
@@ -2948,14 +2976,28 @@ var socketClient_default = socket;
2948
2976
 
2949
2977
  // src/app/components/Atoms/CardBankRadio/CardBankRadio.tsx
2950
2978
  import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
2951
- var CardBankRadio = (props) => {
2952
- return /* @__PURE__ */ jsx13(Fragment7, { children: /* @__PURE__ */ jsxs7(
2979
+ var CardBankRadio = (_a) => {
2980
+ var _b = _a, { skydesign = false, savingsText } = _b, props = __objRest(_b, ["skydesign", "savingsText"]);
2981
+ const savingsBadgeClass = `frac-saving-badge ${skydesign ? "frac-saving-badge-corner" : "frac-saving-badge-corner frac-saving-badge-with-radio"}`;
2982
+ return /* @__PURE__ */ jsx13(Fragment7, { children: /* @__PURE__ */ jsx13(
2953
2983
  "div",
2954
2984
  {
2955
2985
  className: `frac-card-bank-radio ${props.activetab === props.value ? "frac-active" : ""}`,
2956
2986
  onClick: () => props.onChange(props.value),
2957
2987
  role: "radio",
2958
- children: [
2988
+ children: skydesign ? /* @__PURE__ */ jsxs7(Fragment7, { children: [
2989
+ /* @__PURE__ */ jsxs7("div", { className: "frac-card-title-main", children: [
2990
+ /* @__PURE__ */ jsxs7("div", { className: "box-inner-card-text", children: [
2991
+ /* @__PURE__ */ jsx13("img", { src: props.label.toLowerCase() === "card" ? defaultcard : props.label.toLowerCase() === "reader" ? pax : bankNew, className: "frac-payment-type-logo", alt: "" }),
2992
+ /* @__PURE__ */ jsx13("div", { className: "frac-card-label-text", children: props.label })
2993
+ ] }),
2994
+ /* @__PURE__ */ jsx13("div", { className: "frac-card-label", children: /* @__PURE__ */ jsx13("div", { className: "frac-card-label-amount", children: formatUSD(props.amount) }) })
2995
+ ] }),
2996
+ savingsText ? /* @__PURE__ */ jsx13("button", { type: "button", className: savingsBadgeClass, children: savingsText }) : null,
2997
+ /* @__PURE__ */ jsx13("div", { children: /* @__PURE__ */ jsx13("input", { name: "paymenttype", checked: props.activetab === props.value, type: "hidden", value: props.value, onChange: (e) => {
2998
+ props.onChange(e.target.value);
2999
+ } }) })
3000
+ ] }) : /* @__PURE__ */ jsxs7(Fragment7, { children: [
2959
3001
  /* @__PURE__ */ jsxs7("div", { className: "frac-card-title-main", children: [
2960
3002
  /* @__PURE__ */ jsx13("img", { src: props.label.toLowerCase() === "card" ? defaultcard : props.label.toLowerCase() === "reader" ? pax : bankNew, className: "frac-payment-type-logo", alt: "" }),
2961
3003
  /* @__PURE__ */ jsxs7("div", { className: "frac-card-label", children: [
@@ -2963,10 +3005,11 @@ var CardBankRadio = (props) => {
2963
3005
  /* @__PURE__ */ jsx13("div", { className: "frac-card-label-amount", children: formatUSD(props.amount) })
2964
3006
  ] })
2965
3007
  ] }),
3008
+ savingsText ? /* @__PURE__ */ jsx13("button", { type: "button", className: savingsBadgeClass, children: savingsText }) : null,
2966
3009
  /* @__PURE__ */ jsx13("div", { children: /* @__PURE__ */ jsx13("input", { name: "paymenttype", checked: props.activetab === props.value, type: "radio", value: props.value, onChange: (e) => {
2967
3010
  props.onChange(e.target.value);
2968
3011
  } }) })
2969
- ]
3012
+ ] })
2970
3013
  }
2971
3014
  ) });
2972
3015
  };
@@ -2991,6 +3034,7 @@ function CardBankRadioStyles({}) {
2991
3034
  justify-content: space-between;
2992
3035
  align-items: center;
2993
3036
  align-self: stretch;
3037
+ position: relative;
2994
3038
  }
2995
3039
 
2996
3040
  input[type="radio"] {
@@ -3048,6 +3092,28 @@ function CardBankRadioStyles({}) {
3048
3092
  .frac-card-bank-radio.frac-active {
3049
3093
  background: #F6F6F7;
3050
3094
  }
3095
+
3096
+ .frac-saving-badge {
3097
+ padding: 1px 7px !important;
3098
+ border: 1px solid #9ad7ab;
3099
+ border-radius: 999px;
3100
+ background: #e8f8ec;
3101
+ color: #1e6a34;
3102
+ font-size: 10px;
3103
+ font-weight: 600;
3104
+ line-height: 15px;
3105
+ pointer-events: none;
3106
+ }
3107
+
3108
+ .frac-saving-badge-corner {
3109
+ position: absolute;
3110
+ top: 8px;
3111
+ right: 10px;
3112
+ }
3113
+
3114
+ .frac-saving-badge-with-radio {
3115
+ right: 34px;
3116
+ }
3051
3117
  ` });
3052
3118
  }
3053
3119
 
@@ -3225,7 +3291,7 @@ var FractalFields = ({ fractalStyles, tokenizerRef, isAddCard = false, isSky = f
3225
3291
  {
3226
3292
  id: "card_number",
3227
3293
  className: "form-control card-number-new",
3228
- style: { height: `${isSky ? "36px" : "46px"}`, display: "inline-block" }
3294
+ style: { height: `${isSky ? "36px" : "46px"}` }
3229
3295
  }
3230
3296
  ),
3231
3297
  /* @__PURE__ */ jsx17("div", { className: "card-crdi card-expiry-new", children: /* @__PURE__ */ jsxs10("div", { className: "exp-date-year-container", children: [
@@ -3234,7 +3300,7 @@ var FractalFields = ({ fractalStyles, tokenizerRef, isAddCard = false, isSky = f
3234
3300
  {
3235
3301
  id: "exp_month",
3236
3302
  className: "form-control required card-cvv-in",
3237
- style: { height: "36px", display: "inline-block" }
3303
+ style: { height: "36px", display: "block", minHeight: "36px" }
3238
3304
  }
3239
3305
  ) }),
3240
3306
  /* @__PURE__ */ jsx17("div", { className: "exp-year form-group input-main-wrap-frac", children: /* @__PURE__ */ jsx17(
@@ -3242,7 +3308,7 @@ var FractalFields = ({ fractalStyles, tokenizerRef, isAddCard = false, isSky = f
3242
3308
  {
3243
3309
  id: "exp_year",
3244
3310
  className: "form-control required card-cvv-in",
3245
- style: { height: "36px", display: "inline-block" }
3311
+ style: { height: "36px", display: "block", minHeight: "36px" }
3246
3312
  }
3247
3313
  ) }),
3248
3314
  /* @__PURE__ */ jsx17("div", { className: "security-digit form-group input-main-wrap-frac", children: /* @__PURE__ */ jsx17(
@@ -3250,7 +3316,7 @@ var FractalFields = ({ fractalStyles, tokenizerRef, isAddCard = false, isSky = f
3250
3316
  {
3251
3317
  id: "cvv",
3252
3318
  className: "form-control card-cvv-in required",
3253
- style: { height: "36px", display: "inline-block" }
3319
+ style: { height: "36px", display: "block", minHeight: "36px" }
3254
3320
  }
3255
3321
  ) })
3256
3322
  ] }) })
@@ -3373,7 +3439,8 @@ var DataCapFields = ({
3373
3439
  isOpen,
3374
3440
  tokenKey,
3375
3441
  setLoader,
3376
- isAddCard
3442
+ isAddCard,
3443
+ isEmbedded
3377
3444
  }) => {
3378
3445
  const iframeId = "datacap-iframe";
3379
3446
  const resolverRef = useRef2(null);
@@ -3399,6 +3466,20 @@ var DataCapFields = ({
3399
3466
 
3400
3467
  `;
3401
3468
  }
3469
+ if (isEmbedded) {
3470
+ customCSS += `
3471
+
3472
+ input {
3473
+ background-color: #F6F6F7;
3474
+ box-shadow: 1px 1px 2px inset rgba(0, 0, 0, 0.1;
3475
+ }
3476
+
3477
+ select {
3478
+ background-color: #F6F6F7;
3479
+ box-shadow: 1px 1px 2px inset rgba(0, 0, 0, 0.1);
3480
+ }
3481
+ `;
3482
+ }
3402
3483
  const initialize = async () => {
3403
3484
  setLoader == null ? void 0 : setLoader(true);
3404
3485
  setIframeReady(false);
@@ -3430,13 +3511,18 @@ var DataCapFields = ({
3430
3511
  };
3431
3512
  initialize();
3432
3513
  }, [isOpen, tokenKey]);
3433
- window.requestDcToken = () => {
3434
- return new Promise((resolve, reject) => {
3435
- setLoader == null ? void 0 : setLoader(true);
3436
- resolverRef.current = { resolve, reject };
3437
- window.DatacapHostedWebToken.requestToken();
3438
- });
3439
- };
3514
+ useEffect7(() => {
3515
+ window.requestDcToken = () => {
3516
+ return new Promise((resolve, reject) => {
3517
+ setLoader == null ? void 0 : setLoader(true);
3518
+ resolverRef.current = { resolve, reject };
3519
+ });
3520
+ };
3521
+ return () => {
3522
+ delete window.requestDcToken;
3523
+ };
3524
+ }, []);
3525
+ console.log(setLoader, "loadingIframe");
3440
3526
  return /* @__PURE__ */ jsx18(
3441
3527
  "iframe",
3442
3528
  {
@@ -3497,8 +3583,6 @@ function GetPaymentPage(props) {
3497
3583
  const [selectedCard, setSelectedCard] = useState4();
3498
3584
  const [selectedReader, setSelectedReader] = useState4(void 0);
3499
3585
  const [cashDiscount, setCashDiscount] = useState4(Number(props == null ? void 0 : props.amount));
3500
- const [bankAmount, setBankAmount] = useState4(Number(props == null ? void 0 : props.amount));
3501
- const [bankFeeAmount, setBankFeeAmount] = useState4(0);
3502
3586
  const [paymentData, setPaymentData] = useState4();
3503
3587
  let [tranId, setTranId] = useState4("");
3504
3588
  const tokenizerRef = useRef3(null);
@@ -3533,25 +3617,7 @@ function GetPaymentPage(props) {
3533
3617
  useEffect8(() => {
3534
3618
  if (show) {
3535
3619
  let cash_discount = CalculateCashDiscount(props == null ? void 0 : props.amount, (props == null ? void 0 : props.surcharge) || 0);
3536
- let bankAmount2 = cash_discount;
3537
- if ((props == null ? void 0 : props.bankFeeAmount) && Number(props == null ? void 0 : props.bankFeeAmount) > 0) {
3538
- bankAmount2 = Number(cash_discount) + Number(props == null ? void 0 : props.bankFeeAmount);
3539
- }
3540
- setBankAmount(bankAmount2);
3541
3620
  setCashDiscount(cash_discount);
3542
- const cardFeeAmount = Number((Number(props == null ? void 0 : props.amount) - Number(cash_discount || 0)).toFixed(2));
3543
- const bankFeeAmount2 = Number((props == null ? void 0 : props.bankFeeAmount) || 0);
3544
- const bankSavingsAmount = Math.max(bankFeeAmount2 > 0 ? cardFeeAmount - bankFeeAmount2 : cardFeeAmount, 0);
3545
- const bankSavingsText = bankSavingsAmount > 0 ? `Save ${formatUSD(bankSavingsAmount.toFixed(2))}` : "";
3546
- setBankFeeAmount(bankFeeAmount2);
3547
- console.log({
3548
- cash_discount,
3549
- bankAmount: bankAmount2,
3550
- cardFeeAmount,
3551
- bankFeeAmount: bankFeeAmount2,
3552
- bankSavingsAmount,
3553
- bankSavingsText
3554
- });
3555
3621
  }
3556
3622
  }, [show, props == null ? void 0 : props.pass_fee, props == null ? void 0 : props.amount, props == null ? void 0 : props.surcharge]);
3557
3623
  const handleClose = () => {
@@ -3718,7 +3784,7 @@ function GetPaymentPage(props) {
3718
3784
  }
3719
3785
  }
3720
3786
  if (!isBankConsentChecked) {
3721
- setErrorBankConsent("Above consent is required");
3787
+ setErrorBankConsent("Above consent is requied");
3722
3788
  }
3723
3789
  setAchError(errors);
3724
3790
  return Object.keys(errors).length > 0 || !isBankConsentChecked;
@@ -3891,7 +3957,7 @@ function GetPaymentPage(props) {
3891
3957
  routing_number: achData == null ? void 0 : achData.routingNumber,
3892
3958
  bank_name: achData == null ? void 0 : achData.bankName,
3893
3959
  account_type: achData == null ? void 0 : achData.accountType,
3894
- amount: String(bankAmount || 0),
3960
+ amount: String(cashDiscount || 0),
3895
3961
  isSaveAch: saveACHinfo,
3896
3962
  customer_id: props == null ? void 0 : props.customerId,
3897
3963
  order_id: props == null ? void 0 : props.orderID,
@@ -3973,11 +4039,11 @@ function GetPaymentPage(props) {
3973
4039
  let amount = String(props == null ? void 0 : props.amount);
3974
4040
  let card_id = selectedCard == null ? void 0 : selectedCard.id;
3975
4041
  let card_type = selectedCard == null ? void 0 : selectedCard.card_type;
3976
- if (fractalpayPublicKey && order_id && amount && bankAmount) {
4042
+ if (fractalpayPublicKey && order_id && amount && cashDiscount) {
3977
4043
  if (customer_id) {
3978
4044
  if (card_id) {
3979
4045
  let chargeobj = __spreadValues({
3980
- amount: card_type === "Bank" ? `${bankAmount}` : amount,
4046
+ amount: card_type === "Bank" ? `${cashDiscount}` : amount,
3981
4047
  order_id,
3982
4048
  customer_id,
3983
4049
  card_id,
@@ -4216,21 +4282,22 @@ function GetPaymentPage(props) {
4216
4282
  /* @__PURE__ */ jsx19("div", { className: "pay-amount-conatiner", children: /* @__PURE__ */ jsx19("small", { className: "pay-payment-amount", children: "Select paymet type" }) }),
4217
4283
  /* @__PURE__ */ jsxs11("div", { className: "frac-card-bank-radio-main", children: [
4218
4284
  /* @__PURE__ */ jsx19(CardBankRadio, { label: "Card", amount: (_a = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _a.toFixed(2), value: "card", onChange: handletabchange, activetab }),
4219
- (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && /* @__PURE__ */ jsx19(CardBankRadio, { label: "Bank", amount: (_b = Number(bankAmount)) == null ? void 0 : _b.toFixed(2), value: "ach", onChange: handletabchange, activetab }),
4285
+ (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && /* @__PURE__ */ jsx19(CardBankRadio, { label: "Bank", amount: (_b = Number(cashDiscount)) == null ? void 0 : _b.toFixed(2), value: "ach", onChange: handletabchange, activetab }),
4220
4286
  (props == null ? void 0 : props.isReader) && (paymentData == null ? void 0 : paymentData.paymentDeviceList) && ((_c = paymentData == null ? void 0 : paymentData.paymentDeviceList) == null ? void 0 : _c.length) > 0 && /* @__PURE__ */ jsx19(CardBankRadio, { label: "Reader", amount: (_d = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _d.toFixed(2), value: "reader", onChange: handletabchange, activetab })
4221
4287
  ] }),
4222
- !loading && /* @__PURE__ */ jsxs11("div", { className: "", children: [
4223
- activetab == "ach" && bankFeeAmount > 0 && /* @__PURE__ */ jsxs11("small", { className: "frac-fee-text", children: [
4224
- "There is a processing fee of ",
4225
- /* @__PURE__ */ jsx19("span", { className: "frac-fee-amount", children: formatUSD(bankFeeAmount.toFixed(2)) }),
4226
- "."
4288
+ !loading && (numberToBoolean(paymentData == null ? void 0 : paymentData.showSurcharge) ? cashDiscount && cashDiscount > 0 && (props == null ? void 0 : props.pass_fee) ? /* @__PURE__ */ jsxs11("div", { className: "frac-cash-discount-fee", children: [
4289
+ /* @__PURE__ */ jsxs11("small", { children: [
4290
+ activetab === "card" || activetab === "reader" ? "Cash Discount" : "Cash Discount Savings",
4291
+ " "
4227
4292
  ] }),
4228
- (activetab === "card" || activetab === "reader") && (props == null ? void 0 : props.pass_fee) && cashDiscount && cashDiscount > 0 && /* @__PURE__ */ jsxs11("small", { className: "frac-fee-text", children: [
4229
- "Credit cards include a fee amount of ",
4230
- /* @__PURE__ */ jsx19("span", { className: "frac-fee-amount", children: formatUSD((Number(props.amount) - cashDiscount).toFixed(2)) }),
4231
- "."
4232
- ] })
4233
- ] })
4293
+ /* @__PURE__ */ jsx19("p", { children: formatUSD((Number(props.amount) - cashDiscount).toFixed(2)) })
4294
+ ] }) : null : cashDiscount && cashDiscount > 0 && (props == null ? void 0 : props.pass_fee) && (activetab === "card" || activetab === "reader") ? /* @__PURE__ */ jsxs11("div", { className: "frac-cash-discount-fee", children: [
4295
+ /* @__PURE__ */ jsxs11("small", { children: [
4296
+ activetab === "card" || activetab === "reader" ? "Surcharge" : null,
4297
+ " "
4298
+ ] }),
4299
+ /* @__PURE__ */ jsx19("p", { children: formatUSD((Number(props.amount) - cashDiscount).toFixed(2)) })
4300
+ ] }) : null)
4234
4301
  ] })
4235
4302
  ] }),
4236
4303
  /* @__PURE__ */ jsxs11("div", { className: "pay-conatiner-one-last", children: [
@@ -4535,7 +4602,7 @@ function GetPaymentPage(props) {
4535
4602
  /* @__PURE__ */ jsx19(CardList, { listHeading: "Banks", paymentGateway: paymentData == null ? void 0 : paymentData.paymentGateway, ListItems: bankList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Bank", otherButtonAction: () => {
4536
4603
  setActiveinBank("form");
4537
4604
  } }),
4538
- /* @__PURE__ */ jsx19("div", { className: "form-group", style: { padding: "0" }, children: /* @__PURE__ */ jsx19("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlepayment, children: formatUSD((_n = Number(bankAmount)) == null ? void 0 : _n.toFixed(2)) }) })
4605
+ /* @__PURE__ */ jsx19("div", { className: "form-group", style: { padding: "0" }, children: /* @__PURE__ */ jsx19("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlepayment, children: formatUSD((_n = Number(cashDiscount)) == null ? void 0 : _n.toFixed(2)) }) })
4539
4606
  ] }) : /* @__PURE__ */ jsxs11("form", { id: "ACHPaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc, autoComplete: "off", onKeyDown: (e) => {
4540
4607
  if (e.key === "Enter" && loading2) {
4541
4608
  e.preventDefault();
@@ -4663,7 +4730,7 @@ function GetPaymentPage(props) {
4663
4730
  " to have my permission to charge this bank account for agreed upon purchases in the future."
4664
4731
  ] }) })
4665
4732
  ] }),
4666
- /* @__PURE__ */ jsx19("div", { className: "form-group ", children: /* @__PURE__ */ jsx19("button", { className: "pay-button", style: { margin: "20px 0 0" }, type: "submit", children: formatUSD((_v = Number(bankAmount)) == null ? void 0 : _v.toFixed(2)) }) })
4733
+ /* @__PURE__ */ jsx19("div", { className: "form-group ", children: /* @__PURE__ */ jsx19("button", { className: "pay-button", style: { margin: "20px 0 0" }, type: "submit", children: formatUSD((_v = Number(cashDiscount)) == null ? void 0 : _v.toFixed(2)) }) })
4667
4734
  ] })
4668
4735
  ] }),
4669
4736
  /* @__PURE__ */ jsxs11("div", { id: "reader", style: { display: activetab === "reader" ? "block" : "none" }, className: "tabcontent", children: [
@@ -7371,7 +7438,7 @@ import { IoArrowBack as IoArrowBack3 } from "react-icons/io5";
7371
7438
  import { NumericFormat } from "react-number-format";
7372
7439
  import { Fragment as Fragment17, jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
7373
7440
  function PartialPayment(props) {
7374
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
7441
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
7375
7442
  const buttonRef = useRef8(null);
7376
7443
  useEffect13(() => {
7377
7444
  if (props.onTriggerPay) {
@@ -7633,7 +7700,7 @@ function PartialPayment(props) {
7633
7700
  }
7634
7701
  }
7635
7702
  if (!isBankConsentChecked) {
7636
- setErrorBankConsent("Above consent is required");
7703
+ setErrorBankConsent("Above consent is requied");
7637
7704
  }
7638
7705
  setAchError(errors);
7639
7706
  return Object.keys(errors).length > 0 || !isBankConsentChecked;
@@ -8157,7 +8224,10 @@ function PartialPayment(props) {
8157
8224
  ] }),
8158
8225
  /* @__PURE__ */ jsxs17("div", { className: "amt-pay-con", children: [
8159
8226
  /* @__PURE__ */ jsx28("div", { className: "pay-amount-conatiner", children: /* @__PURE__ */ jsx28("small", { className: "pay-payment-amount", children: "Select payment type" }) }),
8160
- /* @__PURE__ */ jsx28("div", { className: "frac-card-bank-radio-main", children: /* @__PURE__ */ jsx28(CardBankRadio, { label: "Card", amount: (_a = Number(aftertaxAmount)) == null ? void 0 : _a.toFixed(2), value: "card", onChange: handletabchange, activetab }) }),
8227
+ /* @__PURE__ */ jsxs17("div", { className: "frac-card-bank-radio-main", children: [
8228
+ /* @__PURE__ */ jsx28(CardBankRadio, { label: "Card", amount: (_a = Number(aftertaxAmount)) == null ? void 0 : _a.toFixed(2), value: "card", onChange: handletabchange, activetab }),
8229
+ (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && /* @__PURE__ */ jsx28(CardBankRadio, { label: "Bank", amount: (_b = Number(cashDiscount)) == null ? void 0 : _b.toFixed(2), value: "ach", onChange: handletabchange, activetab })
8230
+ ] }),
8161
8231
  numberToBoolean(paymentData == null ? void 0 : paymentData.showSurcharge) ? cashDiscount && cashDiscount > 0 && (props == null ? void 0 : props.pass_fee) ? /* @__PURE__ */ jsxs17("div", { className: "frac-cash-discount-fee", children: [
8162
8232
  /* @__PURE__ */ jsxs17("small", { children: [
8163
8233
  activetab === "card" ? "Cash Discount" : "Cash Discount Savings",
@@ -8226,7 +8296,7 @@ function PartialPayment(props) {
8226
8296
  /* @__PURE__ */ jsx28("small", { className: "pay-payment-amount", children: "Payment Amount" }),
8227
8297
  /* @__PURE__ */ jsxs17("strong", { className: "pay-amount", children: [
8228
8298
  "$",
8229
- (_b = Number(aftertaxAmount)) == null ? void 0 : _b.toFixed(2)
8299
+ (_c = Number(aftertaxAmount)) == null ? void 0 : _c.toFixed(2)
8230
8300
  ] })
8231
8301
  ] }),
8232
8302
  activetab != "ach" && /* @__PURE__ */ jsxs17("div", { children: [
@@ -8268,7 +8338,7 @@ function PartialPayment(props) {
8268
8338
  /* @__PURE__ */ jsx28("small", { className: "pay-payment-amount", children: "Payment Amount" }),
8269
8339
  /* @__PURE__ */ jsxs17("strong", { className: "pay-amount", children: [
8270
8340
  "$",
8271
- (_c = Number(aftertaxAmount)) == null ? void 0 : _c.toFixed(2)
8341
+ (_d = Number(aftertaxAmount)) == null ? void 0 : _d.toFixed(2)
8272
8342
  ] })
8273
8343
  ] }),
8274
8344
  /* @__PURE__ */ jsxs17("div", { children: [
@@ -8303,7 +8373,7 @@ function PartialPayment(props) {
8303
8373
  /* @__PURE__ */ jsx28(CardList, { listHeading: "Cards", paymentGateway: paymentData == null ? void 0 : paymentData.paymentGateway, ListItems: cardList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Card", otherButtonAction: () => {
8304
8374
  setActiveinCard("form");
8305
8375
  } }),
8306
- /* @__PURE__ */ jsx28("div", { className: "form-group", style: { padding: "0" }, children: /* @__PURE__ */ jsx28("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlepayment, children: partialAmount && !partialError ? formatUSD((_d = Number(partialAmount)) == null ? void 0 : _d.toFixed(2)) : formatUSD((_e = Number(aftertaxAmount)) == null ? void 0 : _e.toFixed(2)) }) })
8376
+ /* @__PURE__ */ jsx28("div", { className: "form-group", style: { padding: "0" }, children: /* @__PURE__ */ jsx28("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlepayment, children: partialAmount && !partialError ? formatUSD((_e = Number(partialAmount)) == null ? void 0 : _e.toFixed(2)) : formatUSD((_f = Number(aftertaxAmount)) == null ? void 0 : _f.toFixed(2)) }) })
8307
8377
  ] }) : (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 ? /* @__PURE__ */ jsxs17(
8308
8378
  "form",
8309
8379
  {
@@ -8347,14 +8417,14 @@ function PartialPayment(props) {
8347
8417
  maxLength: 100,
8348
8418
  placeholder: "Order Id",
8349
8419
  disabled: true,
8350
- value: (_f = props == null ? void 0 : props.orderID) != null ? _f : "",
8420
+ value: (_g = props == null ? void 0 : props.orderID) != null ? _g : "",
8351
8421
  style: { background: "#F6F6F7", color: "#727272" }
8352
8422
  }
8353
8423
  )
8354
8424
  ] }),
8355
8425
  /* @__PURE__ */ jsxs17("div", { className: "form-group", children: [
8356
8426
  /* @__PURE__ */ jsx28("label", { htmlFor: "zip", children: "ZIP" }),
8357
- /* @__PURE__ */ jsx28("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "000000", value: (_g = cardData == null ? void 0 : cardData.zipCode) != null ? _g : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }),
8427
+ /* @__PURE__ */ jsx28("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) }),
8358
8428
  (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx28("span", { className: "error-span", children: cardError == null ? void 0 : cardError.zipCode })
8359
8429
  ] }),
8360
8430
  (props == null ? void 0 : props.customerId) && /* @__PURE__ */ jsx28("div", { className: "form-group", children: /* @__PURE__ */ jsxs17("div", { style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" }, children: [
@@ -8381,8 +8451,8 @@ function PartialPayment(props) {
8381
8451
  ] }) })
8382
8452
  ] }),
8383
8453
  /* @__PURE__ */ jsxs17("div", { className: "form-group", style: { marginTop: "20px", padding: "0" }, children: [
8384
- (paymentData == null ? void 0 : paymentData.paymentDeviceList) && ((_h = paymentData == null ? void 0 : paymentData.paymentDeviceList) == null ? void 0 : _h.length) > 0 && /* @__PURE__ */ jsx28("button", { type: "button", style: { marginBottom: "10px" }, className: "pay-button", onClick: () => setActiveForm(!activeForm), children: activeForm ? "Pay With Reader" : "Pay With Card" }),
8385
- /* @__PURE__ */ jsx28("button", { type: "submit", style: { margin: 0 }, className: "pay-button", children: partialAmount && !partialError ? formatUSD((_i = Number(partialAmount)) == null ? void 0 : _i.toFixed(2)) : formatUSD((_j = Number(aftertaxAmount)) == null ? void 0 : _j.toFixed(2)) })
8454
+ (paymentData == null ? void 0 : paymentData.paymentDeviceList) && ((_i = paymentData == null ? void 0 : paymentData.paymentDeviceList) == null ? void 0 : _i.length) > 0 && /* @__PURE__ */ jsx28("button", { type: "button", style: { marginBottom: "10px" }, className: "pay-button", onClick: () => setActiveForm(!activeForm), children: activeForm ? "Pay With Reader" : "Pay With Card" }),
8455
+ /* @__PURE__ */ jsx28("button", { type: "submit", style: { margin: 0 }, className: "pay-button", children: partialAmount && !partialError ? formatUSD((_j = Number(partialAmount)) == null ? void 0 : _j.toFixed(2)) : formatUSD((_k = Number(aftertaxAmount)) == null ? void 0 : _k.toFixed(2)) })
8386
8456
  ] })
8387
8457
  ]
8388
8458
  }
@@ -8421,14 +8491,14 @@ function PartialPayment(props) {
8421
8491
  maxLength: 100,
8422
8492
  placeholder: "Order Id",
8423
8493
  disabled: true,
8424
- value: (_k = props == null ? void 0 : props.orderID) != null ? _k : "",
8494
+ value: (_l = props == null ? void 0 : props.orderID) != null ? _l : "",
8425
8495
  style: { background: "#F6F6F7", color: "#727272" }
8426
8496
  }
8427
8497
  )
8428
8498
  ] }),
8429
8499
  /* @__PURE__ */ jsxs17("div", { className: "form-group", children: [
8430
8500
  /* @__PURE__ */ jsx28("label", { htmlFor: "zip", children: "ZIP" }),
8431
- /* @__PURE__ */ jsx28("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "000000", value: (_l = cardData == null ? void 0 : cardData.zipCode) != null ? _l : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }),
8501
+ /* @__PURE__ */ jsx28("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "000000", value: (_m = cardData == null ? void 0 : cardData.zipCode) != null ? _m : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }),
8432
8502
  (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx28("span", { className: "error-span", children: cardError == null ? void 0 : cardError.zipCode })
8433
8503
  ] }),
8434
8504
  (props == null ? void 0 : props.customerId) && /* @__PURE__ */ jsx28("div", { className: "form-group", children: /* @__PURE__ */ jsxs17("div", { style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" }, children: [
@@ -8455,8 +8525,8 @@ function PartialPayment(props) {
8455
8525
  ] }) })
8456
8526
  ] }),
8457
8527
  /* @__PURE__ */ jsxs17("div", { className: "form-group", style: { marginTop: "20px", padding: "0" }, children: [
8458
- (paymentData == null ? void 0 : paymentData.paymentDeviceList) && ((_m = paymentData == null ? void 0 : paymentData.paymentDeviceList) == null ? void 0 : _m.length) > 0 && /* @__PURE__ */ jsx28("button", { type: "button", style: { marginBottom: "10px" }, className: "pay-button", onClick: () => setActiveForm(!activeForm), children: activeForm ? "Pay With Reader" : "Pay With Card" }),
8459
- /* @__PURE__ */ jsx28("button", { type: "submit", style: { margin: 0 }, className: "pay-button", children: partialAmount && !partialError ? formatUSD((_n = Number(partialAmount)) == null ? void 0 : _n.toFixed(2)) : formatUSD((_o = Number(aftertaxAmount)) == null ? void 0 : _o.toFixed(2)) })
8528
+ (paymentData == null ? void 0 : paymentData.paymentDeviceList) && ((_n = paymentData == null ? void 0 : paymentData.paymentDeviceList) == null ? void 0 : _n.length) > 0 && /* @__PURE__ */ jsx28("button", { type: "button", style: { marginBottom: "10px" }, className: "pay-button", onClick: () => setActiveForm(!activeForm), children: activeForm ? "Pay With Reader" : "Pay With Card" }),
8529
+ /* @__PURE__ */ jsx28("button", { type: "submit", style: { margin: 0 }, className: "pay-button", children: partialAmount && !partialError ? formatUSD((_o = Number(partialAmount)) == null ? void 0 : _o.toFixed(2)) : formatUSD((_p = Number(aftertaxAmount)) == null ? void 0 : _p.toFixed(2)) })
8460
8530
  ] })
8461
8531
  ] })
8462
8532
  ] }),
@@ -8472,7 +8542,7 @@ function PartialPayment(props) {
8472
8542
  /* @__PURE__ */ jsx28(CardList, { listHeading: "Banks", paymentGateway: paymentData == null ? void 0 : paymentData.paymentGateway, ListItems: bankList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Bank", otherButtonAction: () => {
8473
8543
  setActiveinBank("form");
8474
8544
  } }),
8475
- /* @__PURE__ */ jsx28("div", { className: "form-group", style: { padding: "0" }, children: /* @__PURE__ */ jsx28("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlepayment, children: partialAmount && !partialError ? formatUSD((_p = Number(partialAmount)) == null ? void 0 : _p.toFixed(2)) : formatUSD((_q = Number(cashDiscount)) == null ? void 0 : _q.toFixed(2)) }) })
8545
+ /* @__PURE__ */ jsx28("div", { className: "form-group", style: { padding: "0" }, children: /* @__PURE__ */ jsx28("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlepayment, children: partialAmount && !partialError ? formatUSD((_q = Number(partialAmount)) == null ? void 0 : _q.toFixed(2)) : formatUSD((_r = Number(cashDiscount)) == null ? void 0 : _r.toFixed(2)) }) })
8476
8546
  ] }) : /* @__PURE__ */ jsxs17("form", { id: "ACHPaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc, autoComplete: "off", onKeyDown: (e) => {
8477
8547
  if (e.key === "Enter" && loading2) {
8478
8548
  e.preventDefault();
@@ -8485,7 +8555,7 @@ function PartialPayment(props) {
8485
8555
  }, children: [
8486
8556
  /* @__PURE__ */ jsxs17("div", { className: "form-group mb-4", children: [
8487
8557
  /* @__PURE__ */ jsx28("label", { htmlFor: "nameonaccount", children: "Name on account" }),
8488
- /* @__PURE__ */ jsx28("input", { type: "text", id: "nameonaccount", className: "form-control", maxLength: 100, placeholder: "John Doe", name: "name", value: (_r = achData == null ? void 0 : achData.name) != null ? _r : "", onChange: handleChangeAch }),
8558
+ /* @__PURE__ */ jsx28("input", { type: "text", id: "nameonaccount", className: "form-control", maxLength: 100, placeholder: "John Doe", name: "name", value: (_s = achData == null ? void 0 : achData.name) != null ? _s : "", onChange: handleChangeAch }),
8489
8559
  (achError == null ? void 0 : achError.name) && /* @__PURE__ */ jsx28("span", { className: "error-span", children: achError == null ? void 0 : achError.name })
8490
8560
  ] }),
8491
8561
  /* @__PURE__ */ jsxs17("div", { className: "form-group mb-4", children: [
@@ -8499,7 +8569,7 @@ function PartialPayment(props) {
8499
8569
  maxLength: 9,
8500
8570
  placeholder: "000000000",
8501
8571
  name: "routingNumber",
8502
- value: (_s = achData == null ? void 0 : achData.routingNumber) != null ? _s : "",
8572
+ value: (_t = achData == null ? void 0 : achData.routingNumber) != null ? _t : "",
8503
8573
  onChange: handleChangeAch
8504
8574
  }
8505
8575
  ),
@@ -8516,7 +8586,7 @@ function PartialPayment(props) {
8516
8586
  maxLength: 16,
8517
8587
  placeholder: "0000000000",
8518
8588
  name: "accountNumber",
8519
- value: (_t = achData == null ? void 0 : achData.accountNumber) != null ? _t : "",
8589
+ value: (_u = achData == null ? void 0 : achData.accountNumber) != null ? _u : "",
8520
8590
  onChange: handleChangeAch
8521
8591
  }
8522
8592
  ),
@@ -8533,7 +8603,7 @@ function PartialPayment(props) {
8533
8603
  maxLength: 16,
8534
8604
  placeholder: "0000000000",
8535
8605
  name: "confirmAccountNumber",
8536
- value: (_u = achData == null ? void 0 : achData.confirmAccountNumber) != null ? _u : "",
8606
+ value: (_v = achData == null ? void 0 : achData.confirmAccountNumber) != null ? _v : "",
8537
8607
  onChange: handleChangeAch
8538
8608
  }
8539
8609
  ),
@@ -8550,7 +8620,7 @@ function PartialPayment(props) {
8550
8620
  maxLength: 100,
8551
8621
  placeholder: "My Bank",
8552
8622
  name: "bankName",
8553
- value: (_v = achData == null ? void 0 : achData.bankName) != null ? _v : "",
8623
+ value: (_w = achData == null ? void 0 : achData.bankName) != null ? _w : "",
8554
8624
  onChange: handleChangeAch
8555
8625
  }
8556
8626
  ),
@@ -8567,7 +8637,7 @@ function PartialPayment(props) {
8567
8637
  maxLength: 100,
8568
8638
  placeholder: "My Company",
8569
8639
  name: "companyName",
8570
- value: (_w = achData == null ? void 0 : achData.companyName) != null ? _w : "",
8640
+ value: (_x = achData == null ? void 0 : achData.companyName) != null ? _x : "",
8571
8641
  onChange: handleChangeAch
8572
8642
  }
8573
8643
  ),
@@ -8575,7 +8645,7 @@ function PartialPayment(props) {
8575
8645
  ] }),
8576
8646
  /* @__PURE__ */ jsxs17("div", { className: "form-group mb-4", children: [
8577
8647
  /* @__PURE__ */ jsx28("label", { htmlFor: "accounttype", children: "Select account type" }),
8578
- /* @__PURE__ */ jsxs17("select", { name: "accountType", id: "accounttype", className: "form-control", value: (_x = achData == null ? void 0 : achData.accountType) != null ? _x : "", onChange: handleChangeAch, children: [
8648
+ /* @__PURE__ */ jsxs17("select", { name: "accountType", id: "accounttype", className: "form-control", value: (_y = achData == null ? void 0 : achData.accountType) != null ? _y : "", onChange: handleChangeAch, children: [
8579
8649
  /* @__PURE__ */ jsx28("option", { value: "", children: "Select account" }),
8580
8650
  accountTypes.map((type) => /* @__PURE__ */ jsx28("option", { value: type.value, children: type.label }, type.value))
8581
8651
  ] })
@@ -8609,7 +8679,7 @@ function PartialPayment(props) {
8609
8679
  " to have my permission to charge this bank account for agreed upon purchases in the future."
8610
8680
  ] }) })
8611
8681
  ] }),
8612
- /* @__PURE__ */ jsx28("div", { className: "form-group ", children: /* @__PURE__ */ jsx28("button", { className: "pay-button", style: { margin: "20px 0 0" }, type: "submit", children: partialAmount && !partialError ? formatUSD((_y = Number(partialAmount)) == null ? void 0 : _y.toFixed(2)) : formatUSD((_z = Number(cashDiscount)) == null ? void 0 : _z.toFixed(2)) }) })
8682
+ /* @__PURE__ */ jsx28("div", { className: "form-group ", children: /* @__PURE__ */ jsx28("button", { className: "pay-button", style: { margin: "20px 0 0" }, type: "submit", children: partialAmount && !partialError ? formatUSD((_z = Number(partialAmount)) == null ? void 0 : _z.toFixed(2)) : formatUSD((_A = Number(cashDiscount)) == null ? void 0 : _A.toFixed(2)) }) })
8613
8683
  ] })
8614
8684
  ] })
8615
8685
  ] }) }) })
@@ -8624,7 +8694,7 @@ function PartialPayment(props) {
8624
8694
  }
8625
8695
 
8626
8696
  // src/app/components/Skysystemz/PayButtonWithForm.tsx
8627
- import { useEffect as useEffect16, useState as useState11, useMemo } from "react";
8697
+ import { useEffect as useEffect19, useState as useState12, useMemo } from "react";
8628
8698
 
8629
8699
  // src/app/components/Skysystemz/SkyChargewidgetstyles.tsx
8630
8700
  import { jsx as jsx29 } from "react/jsx-runtime";
@@ -8860,6 +8930,17 @@ function SkyChargewidgetstyles() {
8860
8930
  text-align : left !important;
8861
8931
  text-transform: uppercase !important;
8862
8932
  }
8933
+ .frac-form .frac-fee-text{
8934
+ display: block;
8935
+ padding: 10px 0 4px;
8936
+ font-family: 'IBM Plex Mono', monospace !important;
8937
+ color: #727272 !important;
8938
+ font-size: 12px;
8939
+ line-height: 1.4;
8940
+ }
8941
+ .frac-form .frac-fee-amount{
8942
+ color: #c62828 !important;
8943
+ }
8863
8944
  .form-control-frac{
8864
8945
  display: block;
8865
8946
  width: 100%;
@@ -8894,7 +8975,7 @@ function SkyChargewidgetstyles() {
8894
8975
  }
8895
8976
  .exp-date-year-container .form-group {
8896
8977
  flex: 1;
8897
- padding-left:.75rem;
8978
+ padding-left:.75rem !important;
8898
8979
  }
8899
8980
  .card-crdi {
8900
8981
  display: flex;
@@ -8911,7 +8992,7 @@ function SkyChargewidgetstyles() {
8911
8992
  }
8912
8993
  .exp-date-year-container .form-group-frac{
8913
8994
  flex:1;
8914
- padding: 0px !important
8995
+ // padding: 0px !important
8915
8996
 
8916
8997
  }
8917
8998
 
@@ -9412,13 +9493,54 @@ margin:0px !important;
9412
9493
  padding:0px !important;
9413
9494
  }
9414
9495
 
9415
-
9496
+
9497
+ .toggle-num-wrapper-new div#card_number {
9498
+ display: block !important;
9499
+ }
9500
+ .toggle-num-wrapper-new .input-main-wrap-frac {
9501
+ height: 36px;
9502
+ }
9503
+ .toggle-num-wrapper-new:focus {
9504
+ border: 1px solid #004eab !important;
9505
+ }
9506
+ .frac-or {
9507
+ position: relative;
9508
+ margin: 15px 0;
9509
+ text-align: center;
9510
+ }
9511
+ .frac-or:before {
9512
+ position: absolute;
9513
+ left: 0;
9514
+ transform: translateY(-50%);
9515
+ top: 50%;
9516
+ height: 1px;
9517
+ width: 100%;
9518
+ background: #E0DFE2;
9519
+ content: '';
9520
+ z-index: 1;
9521
+ }
9522
+ .frac-or span {
9523
+ background: transparent;
9524
+ font-size: 13px;
9525
+ margin: 0 auto;
9526
+ width: 15px;
9527
+ font-weight: 500;
9528
+ text-transform: uppercase;
9529
+ color: #727272;
9530
+ padding: 3px;
9531
+ position: relative;
9532
+ z-index: 3;
9533
+ }
9534
+ button#gpay-button-online-api-id{
9535
+ width: 100%;
9536
+ }
9537
+
9416
9538
 
9417
9539
  ` });
9418
9540
  }
9419
9541
 
9420
9542
  // src/app/components/Atoms/ModelContentSky/ModelContentSky.tsx
9421
- import { useCallback, useEffect as useEffect15, useRef as useRef10, useState as useState10 } from "react";
9543
+ import { useCallback, useEffect as useEffect18, useRef as useRef12, useState as useState11 } from "react";
9422
9544
  import axios9 from "axios";
9423
9545
  import Swal5 from "sweetalert2";
9424
9546
 
@@ -9559,1413 +9681,2566 @@ function CheckoutWrapper({ clientSecret, onSuccess, showLoader, setError, sessio
9559
9681
  // src/app/components/Atoms/ModelContentSky/ModelContentSky.tsx
9560
9682
  import { IoArrowBack as IoArrowBack4 } from "react-icons/io5";
9561
9683
  import { NumericFormat as NumericFormat2 } from "react-number-format";
9562
- import { Fragment as Fragment18, jsx as jsx32, jsxs as jsxs19 } from "react/jsx-runtime";
9563
- var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_token, customerId, callback, merchantName = "merchant", isPreAuth, surcharge = "0", submitBtnClass, submitBtnIcon, isRequest, pass_fee, pass_fee_amount, require3ds = false, autoTrigger = false, show, setShow, setHandleCloseRef, isPartial, bankSurcharge, partialRef, loadingPrev = false, orderGuid: ordGuid, remainingAmount: remAmount }) => {
9564
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
9565
- const hasRunRef = useRef10(false);
9566
- const cardListRunRef = useRef10(false);
9567
- const threeDSContainerRef = useRef10(null);
9568
- const [activetab, setActive] = useState10("card");
9569
- const [activeList, setActiveList] = useState10("card");
9570
- const [cardData, setCardData] = useState10();
9571
- const [cardError, setCardError] = useState10({});
9572
- const [achData, setAchData] = useState10();
9573
- const [achError, setAchError] = useState10({});
9574
- const [saveACHinfo, setSaveACHinfo] = useState10(false);
9575
- const [saveCardInfo, setSaveCardInfo] = useState10(false);
9576
- const [error, setError] = useState10("");
9577
- const [errorIframe, setErrorIframe] = useState10("");
9578
- const [success, setSuccess] = useState10(false);
9579
- let [tranId, setTranId] = useState10("");
9580
- const [loading, setLoading] = useState10(false);
9581
- const [loading2, setLoading2] = useState10(false);
9582
- const [loadingIframe, setLoadingIframe] = useState10(false);
9583
- const [cardList, setCardList] = useState10([]);
9584
- const [bankList, setBankList] = useState10([]);
9585
- const [selectedCard, setSelectedCard] = useState10();
9586
- const [cashDiscount, setCashDiscount] = useState10(Number(amount));
9587
- const [activeinCard, setActiveinCard] = useState10("form");
9588
- const [activeinBank, setActiveinBank] = useState10("form");
9589
- const [isBankActive, setIsBankActive] = useState10(false);
9590
- const [processingFee, setProcessingFee] = useState10(0);
9591
- const [clientSecret, setClientSecret] = useState10("");
9592
- const [errorMessage, setErrorMessage] = useState10(null);
9593
- const [initialLoader, setInitialLoader] = useState10(false);
9594
- const [is3DSEnable, setIs3DSEnable] = useState10(false);
9595
- const [stripeResponse, setStripeResponse] = useState10(null);
9596
- const [orderLoader, setOrderLoader] = useState10(false);
9597
- const [orderGuid, setOrderGuid] = useState10(ordGuid || null);
9598
- const [partialAmount, setPartialAmount] = useState10("");
9599
- const [partialError, setPartialError] = useState10("");
9600
- const [remainingAmount, setRemainingAmount] = useState10("");
9601
- const [paymentGateway, setPaymentGateway] = useState10();
9602
- const [dcToken, setDCToken] = useState10();
9603
- const [isBankConsentChecked, setIsBankConsentChecked] = useState10(false);
9604
- const [errorBankConsent, setErrorBankConsent] = useState10("");
9605
- let mastercard2 = S3Url + "widget/mc-img.svg";
9606
- let visa2 = S3Url + "widget/visa-img.svg";
9607
- let americanexp2 = S3Url + "widget/ae-img.svg";
9608
- let discover2 = S3Url + "widget/discover-img.svg";
9609
- let defaultcard2 = S3Url + "widget/card.svg";
9610
- let trash2 = S3Url + "widget/Trash.svg";
9611
- let bank2 = S3Url + "widget/bank.svg";
9612
- let secure2 = S3Url + "widget/secure-img.png";
9613
- let pov2 = S3Url + "widget/pov-by.png";
9614
- let pax2 = S3Url + "widget/pax.svg";
9615
- let cardicon = S3Url + "widget/cardicon.svg";
9616
- let bankicon = S3Url + "widget/bankicon.svg";
9617
- const showLoader = () => setLoading(true);
9618
- const hideLoader = () => setLoading(false);
9619
- const CalculateCashDiscount = (amount2, surcharge2) => {
9620
- const surchargeVal = (parseFloat(surcharge2) || 0) / 100;
9621
- const originalAmount = amount2 / (1 + surchargeVal);
9622
- return Math.round(originalAmount * 100) / 100;
9623
- };
9624
- const tokenizerRef = useRef10(null);
9625
- const fractalStyles = {
9626
- input: {
9627
- "font-family": "'Inter', sans-serif",
9628
- "font-size": "16px",
9629
- "color": "#212529",
9630
- "background-color": "transparent",
9631
- "padding": "0px",
9632
- "appearance": "none",
9633
- "outline": "none",
9634
- "border": "none",
9635
- "box-shadow": "none"
9636
- },
9637
- ":focus": {
9638
- "color": "#212529",
9639
- "outline": "none",
9640
- "border": "none"
9641
- },
9642
- "::placeholder": {
9643
- "color": "#212529"
9644
- }
9645
- };
9646
- const handleCharge = async (data) => {
9647
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
9648
- try {
9649
- let dataObj = __spreadValues({
9650
- pass_fee_amount: Number(amount) - cashDiscount,
9651
- pass_fee,
9652
- Token: data == null ? void 0 : data.Token,
9653
- amount: partialAmount ? partialAmount : amount,
9654
- postal_code: data == null ? void 0 : data.postalCode,
9655
- require3ds,
9656
- isPartial,
9657
- orderGuid: orderGuid || ordGuid
9658
- }, saveCardInfo ? {
9659
- card: {
9660
- postal_code: cardData == null ? void 0 : cardData.zipCode,
9661
- customer_id: customerId,
9662
- gateway_token: (data == null ? void 0 : data.Token) || (data == null ? void 0 : data.gateway_token),
9663
- name: cardData == null ? void 0 : cardData.cardName
9684
+
9685
+ // src/app/components/ErrorCardMessage/ErrorCardOverlaystyle.tsx
9686
+ import { jsx as jsx32 } from "react/jsx-runtime";
9687
+ function ErrorCardOverlayStyle() {
9688
+ return /* @__PURE__ */ jsx32("style", { children: `
9689
+ .card-error-overlay .logo-container {
9690
+ display: flex;
9691
+ justify-content: center;
9692
+ align-items: center;
9693
+ margin-bottom: -50px; /* Adjust this to overlap the content */
9694
+ z-index: 10;
9664
9695
  }
9665
- } : null);
9666
- if (require3ds && (data == null ? void 0 : data.stripe_3ds_auth_id)) {
9667
- dataObj.stripe_3ds_auth_id = data == null ? void 0 : data.stripe_3ds_auth_id;
9668
- }
9669
- const chargeResponse = await axios9.post(`${masterBaseUrl}api/v1/gateway/charge/${session_token}`, dataObj);
9670
- if ((_a2 = chargeResponse == null ? void 0 : chargeResponse.data) == null ? void 0 : _a2.result) {
9671
- let callbackdata = {
9672
- // cardDetails: { ...addCard, ...data },
9673
- callback: __spreadProps(__spreadValues({}, (_b2 = chargeResponse == null ? void 0 : chargeResponse.data) == null ? void 0 : _b2.data), { name: cardData == null ? void 0 : cardData.cardName, isPreAuth })
9674
- };
9675
- callback(callbackdata);
9676
- hideLoader();
9677
- handleClose();
9678
- }
9679
- } catch (error2) {
9680
- setError(((_d2 = (_c2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!");
9681
- callback({
9682
- error: ((_f2 = (_e2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.message) || "Something went wrong!",
9683
- result: (_h2 = (_g2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.result,
9684
- statusCode: (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.status
9685
- });
9686
- hideLoader();
9687
- }
9688
- };
9689
- const handlePreAuth = async (data) => {
9690
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
9691
- try {
9692
- let dataObj = __spreadValues({
9693
- Token: data == null ? void 0 : data.Token,
9694
- amount,
9695
- postal_code: data == null ? void 0 : data.postalCode
9696
- }, saveCardInfo ? {
9697
- card: {
9698
- postal_code: cardData == null ? void 0 : cardData.zipCode,
9699
- customer_id: customerId,
9700
- gateway_token: (data == null ? void 0 : data.Token) || (data == null ? void 0 : data.gateway_token),
9701
- name: cardData == null ? void 0 : cardData.cardName
9696
+
9697
+ .card-error-overlay .client-logo {
9698
+ max-width: 100px;
9699
+ height: auto;
9700
+ object-fit: contain;
9701
+ display: block;
9702
9702
  }
9703
- } : null);
9704
- const preAuthResponse = await axios9.post(`${masterBaseUrl}api/v1/gateway/preauth/${session_token}`, dataObj);
9705
- if ((_a2 = preAuthResponse == null ? void 0 : preAuthResponse.data) == null ? void 0 : _a2.result) {
9706
- let addCard;
9707
- let callbackdata = {
9708
- // cardDetails: { ...addCard, ...data },
9709
- callback: __spreadProps(__spreadValues({}, (_b2 = preAuthResponse == null ? void 0 : preAuthResponse.data) == null ? void 0 : _b2.data), { name: cardData == null ? void 0 : cardData.cardName, isPreAuth })
9710
- };
9711
- callback(callbackdata);
9712
- hideLoader();
9713
- handleClose();
9714
- }
9715
- } catch (error2) {
9716
- setError(((_d2 = (_c2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!");
9717
- callback({
9718
- error: ((_f2 = (_e2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.message) || "Something went wrong!",
9719
- result: (_h2 = (_g2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.result,
9720
- statusCode: (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.status
9721
- });
9722
- hideLoader();
9723
- }
9724
- };
9725
- const handleTokenCallback = async (token) => {
9726
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
9727
- if (token.Error) {
9728
- setError(token.Error);
9729
- callback({
9730
- error: token.Error || "Something went wrong!"
9731
- });
9732
- hideLoader();
9733
- } else {
9734
- let data = {
9735
- token: token.Token,
9736
- resp: token
9737
- };
9738
- try {
9739
- const updateToken = await axios9.post(`${masterBaseUrl}api/v1/gateway/update/token/${session_token}`, data);
9740
- if ((updateToken == null ? void 0 : updateToken.status) == 200) {
9741
- let respData = {
9742
- Token: (_b2 = (_a2 = updateToken == null ? void 0 : updateToken.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.gateway_token,
9743
- Brand: token.Brand,
9744
- ExpirationMonth: token.ExpirationMonth,
9745
- ExpirationYear: token.ExpirationYear,
9746
- Last4: token.Last4,
9747
- Bin: token.Bin,
9748
- CVV: token.CVV,
9749
- postalCode: cardData == null ? void 0 : cardData.zipCode
9750
- };
9751
- let addCard;
9752
- if (isPreAuth) {
9753
- handlePreAuth(respData);
9754
- } else {
9755
- handleCharge(respData);
9756
- }
9703
+
9704
+
9705
+ .card-error-overlay .error-icon-overlay {
9706
+ display: flex;
9707
+ flex-direction: column;
9708
+ align-items: center;
9709
+ gap: 12px;
9710
+ min-height: 116px;
9711
+ z-index: 2;
9757
9712
  }
9758
- } catch (error2) {
9759
- console.log(error2, "error");
9760
- hideLoader();
9761
- setError(((_d2 = (_c2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!");
9762
- callback({
9763
- error: ((_f2 = (_e2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.message) || "Something went wrong!",
9764
- result: (_h2 = (_g2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.result,
9765
- statusCode: (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.status
9766
- });
9767
- }
9713
+
9714
+ .card-error-overlay .circle {
9715
+ width: 50px;
9716
+ height: 50px;
9717
+ border: 1px solid red;
9718
+ border-radius: 50%;
9719
+ display: flex;
9720
+ justify-content: center;
9721
+ align-items: center;
9722
+ margin-bottom:20px
9723
+ }
9724
+
9725
+ .card-error-overlay .circle .fa-times {
9726
+ font-size: 30px;
9727
+ color: red;
9728
+ }
9729
+
9730
+ .card-error-overlay .error-text-overlay {
9731
+ display: flex;
9732
+ flex-direction: column;
9733
+ justify-content: center;
9734
+ align-items: center;
9735
+ gap: 4px;
9736
+ // width: 227px;
9737
+ }
9738
+
9739
+ .card-error-overlay .payment-error-text-overlay {
9740
+ font-family: 'Inter', sans-serif;
9741
+ font-weight: 500;
9742
+ font-size: 18px;
9743
+ line-height: 21px;
9744
+ text-align: center;
9745
+ letter-spacing: -0.02em;
9746
+ color: #161616;
9747
+ }
9748
+
9749
+ .card-error-overlay .thank-you-text-overlay {
9750
+ font-family: 'Inter', sans-serif;
9751
+ font-weight: 500;
9752
+ font-size: 16px;
9753
+ line-height: 18px;
9754
+ text-align: center;
9755
+ letter-spacing: -0.02em;
9756
+ color: #161616 !important;
9757
+ opacity: 0.5;
9758
+ padding-top:10px
9759
+ }
9760
+
9761
+ .card-error-overlay .error-btn-div-overlay{
9762
+ padding-top:20px;
9763
+ width: 100%;
9764
+
9765
+ }
9766
+ .card-error-overlay .error-btn-div-overlay button{
9767
+ outline: 0;
9768
+ height: 46px;
9769
+ font-size: 16px;
9770
+ background: #727272;
9771
+ border: none;
9772
+ display: block;
9773
+ color: #fff;
9774
+ width: 100%;
9775
+ border-radius: 180px;
9776
+ margin: 10px 0;
9777
+ text-decoration: none;
9778
+ }
9779
+ .card-error-overlay .error-btn-div-overlay button:hover, .card-error-overlay .error-btn-div-overlay button:focus {
9780
+ background: #222;
9781
+ color: #fff;
9782
+ cursor: pointer;
9783
+ }
9784
+ .payment-error-container-overlay {
9785
+ width: fit-content;
9786
+ position: relative;
9787
+ top: 50%;
9788
+ left: 50%;
9789
+ transform: translate(-50%, -50%);
9790
+ background: rgba(255, 255, 255, 0.15);
9791
+ backdrop-filter: blur(12px);
9792
+ -webkit-backdrop-filter: blur(12px);
9793
+ border-radius: 12px;
9794
+ z-index: 11111;
9795
+ max-width: 240px;
9796
+ min-width: 224px;
9797
+ padding: 20px;
9798
+ margin-left: 17px !important;
9799
+ }
9800
+ .card-error-overlay {
9801
+ position: absolute;
9802
+ top: 0;
9803
+ left: 0;
9804
+ width: 100%;
9805
+ height: 100%;
9806
+ background: rgb(87 87 87 / 15%);
9807
+ backdrop-filter: blur(2px);
9808
+ -webkit-backdrop-filter: blur(12px);
9809
+ z-index: 1111;
9810
+ }
9811
+ ` });
9812
+ }
9813
+
9814
+ // src/app/components/ErrorCardMessage/ErrorCardOverlay.tsx
9815
+ import { Fragment as Fragment18, jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
9816
+ var ErrorCardOverlay = ({ onClose, error, autoTrigger = false }) => {
9817
+ return /* @__PURE__ */ jsxs19(Fragment18, { children: [
9818
+ /* @__PURE__ */ jsx33(ErrorCardOverlayStyle, {}),
9819
+ /* @__PURE__ */ jsx33("div", { className: "card-error-overlay", children: /* @__PURE__ */ jsx33("div", { className: "payment-error-container-overlay", children: /* @__PURE__ */ jsxs19("div", { className: "error-icon-overlay", children: [
9820
+ /* @__PURE__ */ jsx33("div", { className: "circle", children: /* @__PURE__ */ jsx33("i", { className: "fa fa-times", "aria-hidden": "true" }) }),
9821
+ /* @__PURE__ */ jsxs19("div", { className: "error-text-overlay", children: [
9822
+ /* @__PURE__ */ jsx33("div", { className: "payment-error-text-overlay", children: error }),
9823
+ /* @__PURE__ */ jsx33("div", { className: "thank-you-text-overlay", children: "Try again later " })
9824
+ ] }),
9825
+ !autoTrigger && /* @__PURE__ */ jsx33("div", { className: "error-btn-div-overlay", children: /* @__PURE__ */ jsx33("button", { onClick: onClose, children: "OK" }) })
9826
+ ] }) }) })
9827
+ ] });
9828
+ };
9829
+ var ErrorCardOverlay_default = ErrorCardOverlay;
9830
+
9831
+ // src/app/components/Atoms/Googlepay/Googlepay.tsx
9832
+ import { useRef as useRef10 } from "react";
9833
+
9834
+ // src/app/components/Atoms/Googlepay/GooglePayScriptLoader.tsx
9835
+ import { useEffect as useEffect15 } from "react";
9836
+ var googlePayScriptLoaded = false;
9837
+ var GooglePayScriptLoader = ({
9838
+ onLoad
9839
+ }) => {
9840
+ useEffect15(() => {
9841
+ if (googlePayScriptLoaded) {
9842
+ onLoad == null ? void 0 : onLoad();
9843
+ return;
9844
+ }
9845
+ const existingScript = document.querySelector(
9846
+ `script[src="https://pay.google.com/gp/p/js/pay.js"]`
9847
+ );
9848
+ if (!existingScript) {
9849
+ const script2 = document.createElement("script");
9850
+ script2.src = "https://pay.google.com/gp/p/js/pay.js";
9851
+ script2.async = true;
9852
+ script2.onload = () => {
9853
+ console.log("\u2705 Google Pay script loaded");
9854
+ googlePayScriptLoaded = true;
9855
+ console.log("google:", window.google);
9856
+ onLoad == null ? void 0 : onLoad();
9857
+ };
9858
+ script2.onerror = (err) => {
9859
+ console.error("\u274C Google Pay script failed", err);
9860
+ };
9861
+ document.head.appendChild(script2);
9862
+ } else {
9863
+ googlePayScriptLoaded = true;
9864
+ onLoad == null ? void 0 : onLoad();
9768
9865
  }
9866
+ }, []);
9867
+ return null;
9868
+ };
9869
+
9870
+ // src/app/components/Atoms/Googlepay/Googlepay.tsx
9871
+ import { Fragment as Fragment19, jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
9872
+ function GooglePayComponent({
9873
+ amount,
9874
+ googlePayEnvironment: googlePayEnvironment2,
9875
+ googlePayGatewayMerchantId: googlePayGatewayMerchantId2,
9876
+ googlePayMerchantId: googlePayMerchantId2,
9877
+ googlePayMerchantName,
9878
+ require3ds = false,
9879
+ completeFractalFlow,
9880
+ setLoading
9881
+ }) {
9882
+ const containerRef = useRef10(null);
9883
+ const paymentsClientRef = useRef10(null);
9884
+ const baseRequest = {
9885
+ apiVersion: 2,
9886
+ apiVersionMinor: 0
9769
9887
  };
9770
- const handletabchange = (id) => {
9771
- setActive(id);
9888
+ const allowedCardNetworks = ["AMEX", "DISCOVER", "MASTERCARD", "VISA"];
9889
+ const allowedCardAuthMethods = require3ds ? ["CRYPTOGRAM_3DS"] : ["PAN_ONLY", "CRYPTOGRAM_3DS"];
9890
+ const baseCardPaymentMethod = {
9891
+ type: "CARD",
9892
+ parameters: {
9893
+ allowedAuthMethods: allowedCardAuthMethods,
9894
+ allowedCardNetworks
9895
+ }
9772
9896
  };
9773
- const validateAchData = () => {
9774
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
9775
- const errors = {};
9776
- const data = achData;
9777
- if (!((_a2 = data == null ? void 0 : data.name) == null ? void 0 : _a2.trim())) errors.name = "Name is required";
9778
- if (!((_b2 = data == null ? void 0 : data.accountNumber) == null ? void 0 : _b2.trim())) errors.accountNumber = "Account number is required";
9779
- 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";
9780
- if (!((_f2 = data == null ? void 0 : data.bankName) == null ? void 0 : _f2.trim())) errors.bankName = "Bank name is required";
9781
- if (!((_g2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _g2.trim())) errors.routingNumber = "Routing Number is required";
9782
- 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";
9783
- if ((data == null ? void 0 : data.accountType) === "business saving" || (data == null ? void 0 : data.accountType) === "business checking") {
9784
- if (!(data == null ? void 0 : data.companyName) || (data == null ? void 0 : data.companyName) === "") {
9785
- errors.companyName = "Company Name is required for business accounts";
9897
+ const cardPaymentMethod = __spreadProps(__spreadValues({}, baseCardPaymentMethod), {
9898
+ tokenizationSpecification: {
9899
+ type: "PAYMENT_GATEWAY",
9900
+ parameters: {
9901
+ gateway: googlePayGatewayMerchantId2,
9902
+ gatewayMerchantId: googlePayGatewayMerchantId2
9786
9903
  }
9787
9904
  }
9788
- if (!isBankConsentChecked) {
9789
- setErrorBankConsent("Above consent is required");
9905
+ });
9906
+ const handlePaymentAuthorization = async (paymentData) => {
9907
+ var _a, _b;
9908
+ try {
9909
+ const token = (_b = (_a = paymentData == null ? void 0 : paymentData.paymentMethodData) == null ? void 0 : _a.tokenizationData) == null ? void 0 : _b.token;
9910
+ if (!token) throw new Error("Missing token");
9911
+ const parsed = JSON.parse(token);
9912
+ console.log(parsed, "parsed token");
9913
+ setLoading(true);
9914
+ completeFractalFlow(parsed, null, "google_pay");
9915
+ return {
9916
+ transactionState: "SUCCESS"
9917
+ // ✅ CLOSES GOOGLE PAY POPUP
9918
+ };
9919
+ } catch (err) {
9920
+ console.error("Payment failed:", err);
9921
+ return {
9922
+ transactionState: "ERROR",
9923
+ // ❌ CLOSES WITH ERROR UI
9924
+ error: {
9925
+ intent: "PAYMENT_AUTHORIZATION",
9926
+ message: "Payment failed",
9927
+ reason: "PAYMENT_DATA_INVALID"
9928
+ }
9929
+ };
9790
9930
  }
9791
- setAchError(errors);
9792
- return Object.keys(errors).length > 0 || !isBankConsentChecked;
9793
9931
  };
9794
- const completeFractalFlow = async (tokenizeData, intentid) => {
9795
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
9796
- try {
9797
- let token = tokenizeData;
9798
- let verifyandsaveresp = await axios9.post(`${masterBaseUrl}api/v1/gateway/verify-and-save/${session_token}`, {
9799
- token,
9800
- require3ds,
9801
- pass_fee
9802
- });
9803
- if ((verifyandsaveresp == null ? void 0 : verifyandsaveresp.status) == 200) {
9804
- let responsetemp = (_a2 = verifyandsaveresp == null ? void 0 : verifyandsaveresp.data) == null ? void 0 : _a2.data;
9805
- let respData = {
9806
- Token: responsetemp.gateway_token,
9807
- Brand: responsetemp.card_data.brand,
9808
- ExpirationMonth: responsetemp.card_data.expire_mm,
9809
- ExpirationYear: responsetemp.card_data.expire_yy,
9810
- Last4: responsetemp.card_data.last4,
9811
- Bin: responsetemp.card_data.bin,
9812
- postalCode: cardData == null ? void 0 : cardData.zipCode,
9813
- stripe_3ds_auth_id: intentid
9814
- };
9815
- if (isPreAuth) {
9816
- handlePreAuth(respData);
9817
- } else {
9818
- handleCharge(respData);
9932
+ const getPaymentsClient = () => {
9933
+ if (!paymentsClientRef.current && typeof window !== "undefined") {
9934
+ const google = window.google;
9935
+ if (!google) return null;
9936
+ paymentsClientRef.current = new google.payments.api.PaymentsClient({
9937
+ environment: googlePayEnvironment2,
9938
+ // ✅ ADD THIS
9939
+ paymentDataCallbacks: {
9940
+ onPaymentAuthorized: handlePaymentAuthorization
9819
9941
  }
9820
- }
9821
- } catch (error2) {
9822
- console.log(error2, "error");
9823
- setError(((_c2 = (_b2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _b2.data) == null ? void 0 : _c2.message) || "Something went wrong!");
9824
- callback({
9825
- error: ((_e2 = (_d2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _d2.data) == null ? void 0 : _e2.message) || "Something went wrong!",
9826
- result: (_g2 = (_f2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _f2.data) == null ? void 0 : _g2.result,
9827
- statusCode: (_h2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _h2.status
9828
9942
  });
9829
- hideLoader();
9830
9943
  }
9944
+ return paymentsClientRef.current;
9831
9945
  };
9832
- const handleFractalTokenFlow = async () => {
9833
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t, _u, _v, _w;
9946
+ const getIsReadyToPayRequest = () => __spreadProps(__spreadValues({}, baseRequest), {
9947
+ allowedPaymentMethods: [baseCardPaymentMethod]
9948
+ });
9949
+ const getTransactionInfo = () => ({
9950
+ countryCode: "US",
9951
+ currencyCode: "USD",
9952
+ totalPriceStatus: "FINAL",
9953
+ totalPrice: amount,
9954
+ checkoutOption: "COMPLETE_IMMEDIATE_PURCHASE"
9955
+ });
9956
+ const getPaymentDataRequest = () => __spreadProps(__spreadValues({}, baseRequest), {
9957
+ allowedPaymentMethods: [cardPaymentMethod],
9958
+ transactionInfo: getTransactionInfo(),
9959
+ merchantInfo: {
9960
+ merchantId: googlePayMerchantId2,
9961
+ merchantName: googlePayMerchantName
9962
+ },
9963
+ // ✅ ADD THIS
9964
+ callbackIntents: ["PAYMENT_AUTHORIZATION"]
9965
+ });
9966
+ const initializeGooglePay = async () => {
9834
9967
  try {
9835
- const requestOptions = {
9836
- method: "POST",
9837
- redirect: "follow"
9838
- };
9839
- let sesionResult = await axios9.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
9840
- let objtokenize = {
9841
- public_key_pem: ((_b2 = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.publicKeyPem) || ((_d2 = (_c2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.public_key_pem),
9842
- session_key: (_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key
9843
- };
9844
- let three_ds_data = null;
9845
- if (require3ds) {
9846
- if (typeof window !== "undefined" && typeof navigator !== "undefined") {
9847
- const languages = (_g2 = navigator.languages) != null ? _g2 : [navigator.language];
9848
- const language = Array.isArray(languages) ? languages[0] : languages;
9849
- three_ds_data = {
9850
- amount: partialAmount ? Math.round(parseFloat(partialAmount) * 100) : Math.round(parseFloat(amount) * 100),
9851
- // convert dollars → cents
9852
- currency: "usd",
9853
- channel: {
9854
- type: "browser",
9855
- browser: {
9856
- language: typeof language === "string" ? language : null,
9857
- color_depth: (_i2 = (_h2 = window.screen) == null ? void 0 : _h2.colorDepth) != null ? _i2 : null,
9858
- java_enabled: typeof navigator.javaEnabled === "function" ? navigator.javaEnabled() : false,
9859
- screen_height: (_k2 = (_j2 = window.screen) == null ? void 0 : _j2.height) != null ? _k2 : null,
9860
- screen_width: (_m2 = (_l2 = window.screen) == null ? void 0 : _l2.width) != null ? _m2 : null,
9861
- timezoneOffset: (/* @__PURE__ */ new Date()).getTimezoneOffset()
9862
- }
9863
- }
9864
- };
9968
+ const client = getPaymentsClient();
9969
+ if (!client) {
9970
+ console.error("Google Pay client not ready");
9971
+ return;
9972
+ }
9973
+ const response = await client.isReadyToPay(
9974
+ getIsReadyToPayRequest()
9975
+ );
9976
+ if (response.result && containerRef.current) {
9977
+ const button = client.createButton({
9978
+ onClick: onGooglePayClick,
9979
+ allowedPaymentMethods: [baseCardPaymentMethod],
9980
+ buttonType: "pay",
9981
+ buttonColor: "black",
9982
+ buttonRadius: 8
9983
+ });
9984
+ if (containerRef.current) {
9985
+ containerRef.current.innerHTML = "";
9865
9986
  }
9987
+ containerRef.current.appendChild(button);
9866
9988
  }
9867
- let tokenizeData;
9868
- try {
9869
- tokenizeData = await tokenizerRef.current.createToken(
9870
- objtokenize,
9871
- three_ds_data
9872
- );
9873
- } catch (error2) {
9874
- setErrorIframe(error2);
9875
- hideLoader();
9989
+ } catch (err) {
9990
+ console.error("Google Pay init error:", err);
9991
+ }
9992
+ };
9993
+ const onGooglePayClick = async () => {
9994
+ const client = getPaymentsClient();
9995
+ if (!client) {
9996
+ console.error("Google Pay client not ready");
9997
+ return;
9998
+ }
9999
+ try {
10000
+ await client.loadPaymentData(getPaymentDataRequest());
10001
+ } catch (err) {
10002
+ if ((err == null ? void 0 : err.statusCode) !== "CANCELED") {
10003
+ console.error(err);
9876
10004
  }
9877
- if (tokenizeData == null ? void 0 : tokenizeData.token) {
9878
- let ThreedsData = tokenizeData == null ? void 0 : tokenizeData.stripe_three_ds_response;
9879
- if (require3ds && !ThreedsData && (ThreedsData == null ? void 0 : ThreedsData.status) === "200 OK" && ((_n2 = ThreedsData == null ? void 0 : ThreedsData.data) == null ? void 0 : _n2.challenge_url)) {
9880
- setError("Something went wrong. Please try again later.");
9881
- }
9882
- if (require3ds) {
9883
- if (!((_o2 = ThreedsData == null ? void 0 : ThreedsData.data) == null ? void 0 : _o2.challenge_url)) {
9884
- completeFractalFlow(tokenizeData == null ? void 0 : tokenizeData.token, (_p2 = ThreedsData == null ? void 0 : ThreedsData.data) == null ? void 0 : _p2.id);
9885
- } else {
9886
- hideLoader();
9887
- setStripeResponse(__spreadProps(__spreadValues({}, ThreedsData == null ? void 0 : ThreedsData.data), {
9888
- fractalToken: tokenizeData == null ? void 0 : tokenizeData.token
9889
- }));
9890
- }
9891
- } else {
9892
- completeFractalFlow(tokenizeData == null ? void 0 : tokenizeData.token, null);
10005
+ }
10006
+ };
10007
+ const onScriptLoad = () => {
10008
+ if (!googlePayEnvironment2 || !googlePayGatewayMerchantId2 || !amount || !googlePayMerchantId2) {
10009
+ console.error("Missing Google Pay config");
10010
+ return;
10011
+ }
10012
+ setTimeout(() => {
10013
+ initializeGooglePay();
10014
+ }, 0);
10015
+ };
10016
+ return /* @__PURE__ */ jsxs20(Fragment19, { children: [
10017
+ /* @__PURE__ */ jsx34("div", { ref: containerRef, className: "text-center" }),
10018
+ /* @__PURE__ */ jsx34(GooglePayScriptLoader, { onLoad: onScriptLoad })
10019
+ ] });
10020
+ }
10021
+
10022
+ // src/app/components/Atoms/Applepay/ApplePayButton.tsx
10023
+ import { useEffect as useEffect17, useRef as useRef11 } from "react";
10024
+ import { jsx as jsx35 } from "react/jsx-runtime";
10025
+ function ApplePayButton({
10026
+ applePayMerchantId: applePayMerchantId2,
10027
+ applePayAmount,
10028
+ applePayMerchantName,
10029
+ showLoader,
10030
+ completeFractalFlow
10031
+ }) {
10032
+ const applePayRef = useRef11(null);
10033
+ const paymentRequestMethods = [
10034
+ {
10035
+ supportedMethods: "https://apple.com/apple-pay",
10036
+ data: {
10037
+ version: 3,
10038
+ merchantIdentifier: applePayMerchantId2,
10039
+ // ✅ FIXED
10040
+ merchantCapabilities: ["supports3DS"],
10041
+ supportedNetworks: ["amex", "discover", "mastercard", "visa"],
10042
+ // ✅ FIXED
10043
+ countryCode: "US"
10044
+ }
10045
+ }
10046
+ ];
10047
+ const paymentRequestOptions = {
10048
+ requestPayerName: false,
10049
+ requestPayerEmail: false,
10050
+ requestPayerPhone: false,
10051
+ requestShipping: false
10052
+ };
10053
+ function buildPaymentDetails() {
10054
+ return {
10055
+ total: {
10056
+ label: applePayMerchantName,
10057
+ amount: {
10058
+ currency: "USD",
10059
+ value: applePayAmount
9893
10060
  }
9894
10061
  }
9895
- } catch (error2) {
9896
- hideLoader();
9897
- console.log(error2, "error");
9898
- let readableMessage = "Something went wrong!";
9899
- try {
9900
- const rawError = ((_q2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _q2.data) || (error2 == null ? void 0 : error2.message) || "";
9901
- const errorText = typeof rawError === "string" ? rawError : JSON.stringify(rawError);
9902
- const lines = ((_s2 = (_r2 = errorText.split) == null ? void 0 : _r2.call(errorText, "\n")) == null ? void 0 : _s2.filter(Boolean)) || [];
9903
- const lastLine = lines.at(-1) || "";
9904
- const parts = (_t = lastLine.split) == null ? void 0 : _t.call(lastLine, ": ");
9905
- readableMessage = (parts == null ? void 0 : parts.length) > 1 ? parts.pop().trim() : lastLine.trim() || readableMessage;
9906
- } catch (e) {
9907
- readableMessage = "Something went wrong!";
10062
+ };
10063
+ }
10064
+ async function validateMerchant(event) {
10065
+ console.log("\u{1F7E1} STEP 1: Merchant validation started");
10066
+ try {
10067
+ console.log("Validation URL:", event.validationURL);
10068
+ console.log("Domain:", window.location.hostname);
10069
+ const res = await fetch(
10070
+ `${masterBaseUrl}api/v1/widget/generate-apple-pay-session`,
10071
+ {
10072
+ method: "POST",
10073
+ headers: {
10074
+ "Content-Type": "application/json"
10075
+ },
10076
+ body: JSON.stringify({
10077
+ validationUrl: event.validationURL,
10078
+ applePayMerchantId: applePayMerchantId2,
10079
+ applepayDisplayName: applePayMerchantName,
10080
+ requestDomain: window.location.hostname
10081
+ // ✅ IMPORTANT
10082
+ })
10083
+ }
10084
+ );
10085
+ console.log("\u{1F7E1} STEP 2: Response status:", res.status);
10086
+ const data = await res.json();
10087
+ console.log("\u{1F7E2} STEP 3: Session response:", data);
10088
+ if (!data) {
10089
+ console.log("\u274C Invalid session data");
10090
+ event.complete(null);
10091
+ return;
9908
10092
  }
9909
- setError(readableMessage);
9910
- callback({
9911
- error: readableMessage,
9912
- result: (_v = (_u = error2 == null ? void 0 : error2.response) == null ? void 0 : _u.data) == null ? void 0 : _v.result,
9913
- statusCode: (_w = error2 == null ? void 0 : error2.response) == null ? void 0 : _w.status
9914
- });
10093
+ console.log("\u{1F7E2} STEP 4: Completing merchant validation");
10094
+ event.complete(data);
10095
+ } catch (err) {
10096
+ console.log("\u274C Merchant validation failed:", err == null ? void 0 : err.message);
10097
+ event.complete(null);
9915
10098
  }
9916
- };
9917
- const validateCardData = () => {
9918
- var _a2, _b2;
9919
- const errors = {};
9920
- const data = cardData;
9921
- if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
9922
- if (!((_b2 = data == null ? void 0 : data.zipCode) == null ? void 0 : _b2.trim())) errors.zipCode = "ZIP code is required";
9923
- setCardError(errors);
9924
- return Object.keys(errors).length > 0;
9925
- };
9926
- const validateCardInputs = () => {
9927
- let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
9928
- let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
9929
- let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
9930
- let errors = {};
9931
- if (!validCard) errors.cardNumber = "Invalid card Number";
9932
- if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
9933
- if (!validCVV) errors.cvv = "Invalid CVV";
9934
- setCardError(errors);
9935
- return validCard && validCVV && validExpirationDate;
9936
- };
9937
- const submitFunc = async (e) => {
9938
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
9939
- e.preventDefault();
9940
- const el = document.activeElement;
9941
- if (el instanceof HTMLElement) {
9942
- el.blur();
10099
+ }
10100
+ async function authorizePayment(paymentResponse) {
10101
+ console.log("\u{1F7E1} STEP 5: Authorizing payment");
10102
+ try {
10103
+ const token = paymentResponse.details.token.paymentData;
10104
+ console.log("\u{1F7E2} STEP 6: Got token");
10105
+ await completeFractalFlow(token, null, "apple_pay");
10106
+ await paymentResponse.complete("success");
10107
+ console.log("\u2705 Payment completed successfully");
10108
+ } catch (err) {
10109
+ console.log("\u274C Authorization failed:", err == null ? void 0 : err.message);
10110
+ await paymentResponse.complete("fail");
9943
10111
  }
9944
- if (loading) return;
9945
- if (partialError) {
9946
- return;
10112
+ }
10113
+ async function handleApplePayClick() {
10114
+ console.log("\u{1F7E1} STEP A: Click detected");
10115
+ try {
10116
+ const request = new PaymentRequest(
10117
+ paymentRequestMethods,
10118
+ buildPaymentDetails(),
10119
+ paymentRequestOptions
10120
+ );
10121
+ request.onmerchantvalidation = validateMerchant;
10122
+ console.log("\u{1F7E1} STEP B: Calling show()");
10123
+ const response = await request.show();
10124
+ console.log("\u{1F7E2} STEP C: Payment sheet opened");
10125
+ await authorizePayment(response);
10126
+ } catch (err) {
10127
+ console.log("\u274C Apple Pay flow failed:", err == null ? void 0 : err.message);
9947
10128
  }
9948
- if (activetab !== "ach") {
9949
- const hasError = validateCardData();
9950
- if (hasError) return;
9951
- let isValid = true;
9952
- if (!isValid) return;
10129
+ }
10130
+ useEffect17(() => {
10131
+ if (window.ApplePaySession && window.ApplePaySession.canMakePayments()) {
10132
+ console.log("\u2705 Apple Pay is available");
9953
10133
  } else {
9954
- const hasError = validateAchData();
9955
- if (hasError) return;
10134
+ console.log("\u274C Apple Pay NOT available");
10135
+ }
10136
+ }, []);
10137
+ useEffect17(() => {
10138
+ const btn = applePayRef.current;
10139
+ if (!btn) return;
10140
+ const handleClick = () => handleApplePayClick();
10141
+ btn.addEventListener("click", handleClick);
10142
+ return () => {
10143
+ btn.removeEventListener("click", handleClick);
10144
+ };
10145
+ }, []);
10146
+ return /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(
10147
+ "apple-pay-button",
10148
+ {
10149
+ ref: applePayRef,
10150
+ buttonstyle: "black",
10151
+ type: "pay",
10152
+ locale: "en-US"
10153
+ }
10154
+ ) });
10155
+ }
10156
+
10157
+ // src/app/components/Atoms/ModelContentSky/ModelContentSky.tsx
10158
+ import { Fragment as Fragment20, jsx as jsx36, jsxs as jsxs21 } from "react/jsx-runtime";
10159
+ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_token, customerId, callback, merchantName = "merchant", isPreAuth, surcharge = "0", submitBtnClass, submitBtnIcon, isRequest, pass_fee, pass_fee_amount, require3ds = false, autoTrigger = false, show, setShow, setHandleCloseRef, isPartial, bankSurcharge, partialRef, loadingPrev = false, orderGuid: ordGuid, remainingAmount: remAmount, onSubmit, onLoad = true }) => {
10160
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
10161
+ const hasRunRef = useRef12(false);
10162
+ const cardFormRef = useRef12(null);
10163
+ const bankFormRef = useRef12(null);
10164
+ const expiryYearRef = useRef12(null);
10165
+ const expiryMonthRef = useRef12(null);
10166
+ const cardListRunRef = useRef12(false);
10167
+ const threeDSContainerRef = useRef12(null);
10168
+ const [activetab, setActive] = useState11("card");
10169
+ const [activeList, setActiveList] = useState11("card");
10170
+ const [cardData, setCardData] = useState11();
10171
+ const [cardError, setCardError] = useState11({});
10172
+ const [achData, setAchData] = useState11();
10173
+ const [achError, setAchError] = useState11({});
10174
+ const [saveACHinfo, setSaveACHinfo] = useState11(false);
10175
+ const [saveCardInfo, setSaveCardInfo] = useState11(false);
10176
+ const [error, setError] = useState11("");
10177
+ const [errorIframe, setErrorIframe] = useState11("");
10178
+ const [success, setSuccess] = useState11(false);
10179
+ let [tranId, setTranId] = useState11("");
10180
+ const [loading, setLoading] = useState11(false);
10181
+ const [loading2, setLoading2] = useState11(false);
10182
+ const [loadingIframe, setLoadingIframe] = useState11(false);
10183
+ const [cardList, setCardList] = useState11([]);
10184
+ const [bankList, setBankList] = useState11([]);
10185
+ const [selectedCard, setSelectedCard] = useState11();
10186
+ const [cashDiscount, setCashDiscount] = useState11(Number(amount));
10187
+ const [activeinCard, setActiveinCard] = useState11("form");
10188
+ const [activeinBank, setActiveinBank] = useState11("form");
10189
+ const [isBankActive, setIsBankActive] = useState11(false);
10190
+ const [processingFee, setProcessingFee] = useState11(0);
10191
+ const [clientSecret, setClientSecret] = useState11("");
10192
+ const [errorMessage, setErrorMessage] = useState11(null);
10193
+ const [initialLoader, setInitialLoader] = useState11(false);
10194
+ const [is3DSEnable, setIs3DSEnable] = useState11(false);
10195
+ const [stripeResponse, setStripeResponse] = useState11(null);
10196
+ const [orderLoader, setOrderLoader] = useState11(false);
10197
+ const [orderGuid, setOrderGuid] = useState11(ordGuid || null);
10198
+ const [partialAmount, setPartialAmount] = useState11("");
10199
+ const [partialError, setPartialError] = useState11("");
10200
+ const [remainingAmount, setRemainingAmount] = useState11("");
10201
+ const [paymentGateway, setPaymentGateway] = useState11();
10202
+ const [dcToken, setDCToken] = useState11();
10203
+ const [isBankConsentChecked, setIsBankConsentChecked] = useState11(false);
10204
+ const [errorBankConsent, setErrorBankConsent] = useState11("");
10205
+ let mastercard2 = S3Url + "widget/mc-img.svg";
10206
+ let visa2 = S3Url + "widget/visa-img.svg";
10207
+ let americanexp2 = S3Url + "widget/ae-img.svg";
10208
+ let discover2 = S3Url + "widget/discover-img.svg";
10209
+ let defaultcard2 = S3Url + "widget/card.svg";
10210
+ let trash2 = S3Url + "widget/Trash.svg";
10211
+ let bank2 = S3Url + "widget/bank.svg";
10212
+ let secure2 = S3Url + "widget/secure-img.png";
10213
+ let pov2 = S3Url + "widget/pov-by.png";
10214
+ let pax2 = S3Url + "widget/pax.svg";
10215
+ let cardicon = S3Url + "widget/cardicon.svg";
10216
+ let bankicon = S3Url + "widget/bankicon.svg";
10217
+ let defualtcardborder = S3Url + "widget/defualtcardborder.svg";
10218
+ let unionicon = S3Url + "widget/unionpay.svg";
10219
+ let dinersicon = S3Url + "widget/diners.svg";
10220
+ let jcbicon = S3Url + "widget/jcb.svg";
10221
+ const showLoader = () => setLoading(true);
10222
+ const hideLoader = () => setLoading(false);
10223
+ const CalculateCashDiscount = (amount2, surcharge2) => {
10224
+ const surchargeVal = (parseFloat(surcharge2) || 0) / 100;
10225
+ const originalAmount = amount2 / (1 + surchargeVal);
10226
+ return Math.round(originalAmount * 100) / 100;
10227
+ };
10228
+ const cardFeeAmount = Number(pass_fee_amount || 0);
10229
+ const bankFeeAmount = Number(bankSurcharge || 0);
10230
+ const bankSavingsAmount = Math.max(bankFeeAmount > 0 ? cardFeeAmount - bankFeeAmount : cardFeeAmount, 0);
10231
+ const bankSavingsText = bankSavingsAmount > 0 ? `Save ${formatUSD(bankSavingsAmount.toFixed(2))}` : "";
10232
+ const tokenizerRef = useRef12(null);
10233
+ const fractalStyles = {
10234
+ input: {
10235
+ "font-family": "'Inter', sans-serif",
10236
+ "font-size": "16px",
10237
+ "color": "#212529",
10238
+ "background-color": "transparent",
10239
+ "padding": "0px",
10240
+ "appearance": "none",
10241
+ "outline": "none",
10242
+ "border": "none",
10243
+ "box-shadow": "none"
10244
+ },
10245
+ ":focus": {
10246
+ "color": "#212529",
10247
+ "outline": "none",
10248
+ "border": "none"
10249
+ },
10250
+ "::placeholder": {
10251
+ "color": "#212529"
9956
10252
  }
10253
+ };
10254
+ const handleCharge = async (data) => {
10255
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
9957
10256
  try {
9958
- showLoader();
9959
- const result = await axios9.get(`${masterBaseUrl}api/v1/gateway/token/${session_token}`, {
9960
- params: {
9961
- require3ds,
9962
- pass_fee
9963
- }
9964
- });
9965
- if ((result == null ? void 0 : result.status) == 200) {
9966
- let gatewayToken = (_b2 = (_a2 = result == null ? void 0 : result.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.gateway_token;
9967
- let paymentGateway2 = (_d2 = (_c2 = result == null ? void 0 : result.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.paymentGateway;
9968
- if (activetab !== "ach") {
9969
- if (paymentGateway2 == ((_e2 = PaymentMethodKeys) == null ? void 0 : _e2.FRACTALKEY)) {
9970
- await handleFractalTokenFlow();
9971
- } else {
9972
- try {
9973
- const result2 = await window.requestDcToken();
9974
- ;
9975
- console.log("Token:", result2.Token);
9976
- if (result2.Token) {
9977
- handleTokenCallback(result2);
9978
- }
9979
- } catch (err) {
9980
- console.log(err, "Error while tokenizing");
9981
- setErrorIframe(err);
9982
- setLoading(false);
9983
- }
9984
- }
9985
- } else {
9986
- let callbackdata;
9987
- try {
9988
- const payByBank = await axios9.post(`${masterBaseUrl}api/v1/gateway/bank-charge/${session_token}`, __spreadValues({
9989
- label: achData == null ? void 0 : achData.name,
9990
- account_number: achData == null ? void 0 : achData.accountNumber,
9991
- routing_number: achData == null ? void 0 : achData.routingNumber,
9992
- bank_name: achData == null ? void 0 : achData.bankName,
9993
- account_type: achData == null ? void 0 : achData.accountType,
9994
- amount: `${bankAmount}`,
9995
- customer_id: null,
9996
- isSaveAch: false,
9997
- tax: "0.00",
9998
- discount: "0.00",
9999
- surcharge: "0.00",
10000
- order_id: "",
10001
- company_name: (achData == null ? void 0 : achData.companyName) || ""
10002
- }, saveACHinfo ? {
10003
- bank: {
10004
- name: achData == null ? void 0 : achData.name,
10005
- account_number: achData == null ? void 0 : achData.accountNumber,
10006
- routing_number: achData == null ? void 0 : achData.routingNumber,
10007
- bank_name: achData == null ? void 0 : achData.bankName,
10008
- account_type: achData == null ? void 0 : achData.accountType,
10009
- customer_id: customerId || "",
10010
- company_name: (achData == null ? void 0 : achData.companyName) || ""
10011
- }
10012
- } : null));
10013
- if ((_f2 = payByBank == null ? void 0 : payByBank.data) == null ? void 0 : _f2.result) {
10014
- callbackdata = __spreadProps(__spreadValues({}, callbackdata), {
10015
- callback: __spreadProps(__spreadValues({}, (_g2 = payByBank == null ? void 0 : payByBank.data) == null ? void 0 : _g2.data), { name: achData == null ? void 0 : achData.name, isPreAuth })
10016
- });
10017
- callback(callbackdata);
10018
- handleClose();
10019
- hideLoader();
10020
- }
10021
- } catch (error2) {
10022
- console.log(error2, "errororor");
10023
- let data = (_h2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _h2.data;
10024
- if (typeof (data == null ? void 0 : data.message) == "object") {
10025
- Object.values(data == null ? void 0 : data.message).forEach((message) => {
10026
- var _a3;
10027
- setError(message || "Something went wrong");
10028
- callback({
10029
- error: message || "Something went wrong!",
10030
- result: (data == null ? void 0 : data.result) || false,
10031
- statusCode: (_a3 = error2 == null ? void 0 : error2.response) == null ? void 0 : _a3.status
10032
- });
10033
- });
10034
- } else {
10035
- setError((data == null ? void 0 : data.message) || "Something went wrong");
10036
- callback({
10037
- error: (data == null ? void 0 : data.message) || "Something went wrong!",
10038
- result: (data == null ? void 0 : data.result) || false,
10039
- statusCode: (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.status
10040
- });
10041
- }
10042
- hideLoader();
10043
- }
10257
+ let dataObj = __spreadValues(__spreadValues({
10258
+ pass_fee_amount: Number(amount) - cashDiscount,
10259
+ pass_fee,
10260
+ Token: data == null ? void 0 : data.Token,
10261
+ amount: partialAmount ? partialAmount : amount,
10262
+ postal_code: data == null ? void 0 : data.postalCode,
10263
+ require3ds,
10264
+ isPartial,
10265
+ orderGuid: orderGuid || ordGuid
10266
+ }, saveCardInfo ? {
10267
+ card: {
10268
+ postal_code: cardData == null ? void 0 : cardData.zipCode,
10269
+ customer_id: customerId,
10270
+ gateway_token: (data == null ? void 0 : data.Token) || (data == null ? void 0 : data.gateway_token),
10271
+ name: cardData == null ? void 0 : cardData.cardName
10044
10272
  }
10273
+ } : null), (data == null ? void 0 : data.typeoftoken) ? {
10274
+ typeoftoken: data == null ? void 0 : data.typeoftoken
10275
+ } : null);
10276
+ if (require3ds && (data == null ? void 0 : data.stripe_3ds_auth_id)) {
10277
+ dataObj.stripe_3ds_auth_id = data == null ? void 0 : data.stripe_3ds_auth_id;
10278
+ }
10279
+ const chargeResponse = await axios9.post(`${masterBaseUrl}api/v1/gateway/charge/${session_token}`, dataObj);
10280
+ if ((_a2 = chargeResponse == null ? void 0 : chargeResponse.data) == null ? void 0 : _a2.result) {
10281
+ let callbackdata = {
10282
+ // cardDetails: { ...addCard, ...data },
10283
+ callback: __spreadProps(__spreadValues({}, (_b2 = chargeResponse == null ? void 0 : chargeResponse.data) == null ? void 0 : _b2.data), { name: cardData == null ? void 0 : cardData.cardName, isPreAuth })
10284
+ };
10285
+ callback(callbackdata);
10286
+ hideLoader();
10287
+ handleClose();
10045
10288
  }
10046
10289
  } catch (error2) {
10047
- hideLoader();
10290
+ setError(((_d2 = (_c2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!");
10048
10291
  callback({
10049
- error: ((_k2 = (_j2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _j2.data) == null ? void 0 : _k2.message) || "Something went wrong!",
10050
- result: (_m2 = (_l2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _l2.data) == null ? void 0 : _m2.result,
10051
- statusCode: (_n2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _n2.status
10292
+ error: ((_f2 = (_e2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.message) || "Something went wrong!",
10293
+ result: (_h2 = (_g2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.result,
10294
+ statusCode: (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.status
10052
10295
  });
10053
- setError(((_p2 = (_o2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _o2.data) == null ? void 0 : _p2.message) || "Something went wrong!");
10296
+ hideLoader();
10054
10297
  }
10055
10298
  };
10056
- const handleCardChange = (field, value) => {
10057
- const name2 = field;
10058
- const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
10059
- if (numericFields.includes(name2)) {
10060
- if (value === "" || /^[0-9]+$/.test(value)) {
10061
- setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
10062
- [name2]: ""
10063
- }));
10064
- setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
10065
- [name2]: value
10066
- }));
10299
+ const handlePreAuth = async (data) => {
10300
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
10301
+ try {
10302
+ let dataObj = __spreadValues({
10303
+ Token: data == null ? void 0 : data.Token,
10304
+ amount,
10305
+ postal_code: data == null ? void 0 : data.postalCode
10306
+ }, saveCardInfo ? {
10307
+ card: {
10308
+ postal_code: cardData == null ? void 0 : cardData.zipCode,
10309
+ customer_id: customerId,
10310
+ gateway_token: (data == null ? void 0 : data.Token) || (data == null ? void 0 : data.gateway_token),
10311
+ name: cardData == null ? void 0 : cardData.cardName
10312
+ }
10313
+ } : null);
10314
+ const preAuthResponse = await axios9.post(`${masterBaseUrl}api/v1/gateway/preauth/${session_token}`, dataObj);
10315
+ if ((_a2 = preAuthResponse == null ? void 0 : preAuthResponse.data) == null ? void 0 : _a2.result) {
10316
+ let addCard;
10317
+ let callbackdata = {
10318
+ // cardDetails: { ...addCard, ...data },
10319
+ callback: __spreadProps(__spreadValues({}, (_b2 = preAuthResponse == null ? void 0 : preAuthResponse.data) == null ? void 0 : _b2.data), { name: cardData == null ? void 0 : cardData.cardName, isPreAuth })
10320
+ };
10321
+ callback(callbackdata);
10322
+ hideLoader();
10323
+ handleClose();
10067
10324
  }
10068
- return;
10325
+ } catch (error2) {
10326
+ setError(((_d2 = (_c2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!");
10327
+ callback({
10328
+ error: ((_f2 = (_e2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.message) || "Something went wrong!",
10329
+ result: (_h2 = (_g2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.result,
10330
+ statusCode: (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.status
10331
+ });
10332
+ hideLoader();
10069
10333
  }
10070
- setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
10071
- [name2]: ""
10072
- }));
10073
- setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
10074
- [name2]: value
10075
- }));
10076
- };
10077
- const handleCardNumberChange = (e) => {
10078
- var _a2;
10079
- const input = e.target;
10080
- const rawValue = input.value.replace(/\D/g, "");
10081
- const { formatted, cursor } = formatCardNumberWithCursor(
10082
- input.value,
10083
- (_a2 = input.selectionStart) != null ? _a2 : 0
10084
- );
10085
- setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
10086
- cardNumber: ""
10087
- }));
10088
- setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
10089
- cardNumber: formatted
10090
- }));
10091
- requestAnimationFrame(() => {
10092
- input.setSelectionRange(cursor, cursor);
10093
- });
10094
10334
  };
10095
- const handleChangeAch = (e) => {
10096
- const { name: name2, value } = e.target;
10097
- const numericFields = ["routingNumber", "accountNumber", "confirmAccountNumber"];
10098
- if (name2 == "name") {
10099
- if (/^[a-zA-Z\s]*$/.test(value)) {
10100
- setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
10101
- [name2]: ""
10102
- }));
10103
- setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
10104
- [name2]: value
10105
- }));
10335
+ const handleTokenCallback = async (token) => {
10336
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
10337
+ if (token.Error) {
10338
+ setError(token.Error);
10339
+ callback({
10340
+ error: token.Error || "Something went wrong!"
10341
+ });
10342
+ hideLoader();
10343
+ } else {
10344
+ let data = {
10345
+ token: token.Token,
10346
+ resp: token
10347
+ };
10348
+ try {
10349
+ const updateToken = await axios9.post(`${masterBaseUrl}api/v1/gateway/update/token/${session_token}`, data);
10350
+ if ((updateToken == null ? void 0 : updateToken.status) == 200) {
10351
+ let respData = {
10352
+ Token: (_b2 = (_a2 = updateToken == null ? void 0 : updateToken.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.gateway_token,
10353
+ Brand: token.Brand,
10354
+ ExpirationMonth: token.ExpirationMonth,
10355
+ ExpirationYear: token.ExpirationYear,
10356
+ Last4: token.Last4,
10357
+ Bin: token.Bin,
10358
+ CVV: token.CVV,
10359
+ postalCode: cardData == null ? void 0 : cardData.zipCode
10360
+ };
10361
+ let addCard;
10362
+ if (isPreAuth) {
10363
+ handlePreAuth(respData);
10364
+ } else {
10365
+ handleCharge(respData);
10366
+ }
10367
+ }
10368
+ } catch (error2) {
10369
+ console.log(error2, "error");
10370
+ hideLoader();
10371
+ setError(((_d2 = (_c2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!");
10372
+ callback({
10373
+ error: ((_f2 = (_e2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.message) || "Something went wrong!",
10374
+ result: (_h2 = (_g2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.result,
10375
+ statusCode: (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.status
10376
+ });
10106
10377
  }
10107
- return;
10108
10378
  }
10109
- if (numericFields.includes(name2)) {
10110
- if (value === "" || /^[0-9]+$/.test(value)) {
10111
- setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
10112
- [name2]: ""
10113
- }));
10114
- setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
10115
- [name2]: value
10116
- }));
10379
+ };
10380
+ const handletabchange = (id) => {
10381
+ setActive(id);
10382
+ };
10383
+ const validateAchData = () => {
10384
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
10385
+ const errors = {};
10386
+ const data = achData;
10387
+ if (!((_a2 = data == null ? void 0 : data.name) == null ? void 0 : _a2.trim())) errors.name = "Name is required";
10388
+ if (!((_b2 = data == null ? void 0 : data.accountNumber) == null ? void 0 : _b2.trim())) errors.accountNumber = "Account number is required";
10389
+ 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";
10390
+ if (!((_f2 = data == null ? void 0 : data.bankName) == null ? void 0 : _f2.trim())) errors.bankName = "Bank name is required";
10391
+ if (!((_g2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _g2.trim())) errors.routingNumber = "Routing Number is required";
10392
+ 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";
10393
+ if ((data == null ? void 0 : data.accountType) === "business saving" || (data == null ? void 0 : data.accountType) === "business checking") {
10394
+ if (!(data == null ? void 0 : data.companyName) || (data == null ? void 0 : data.companyName) === "") {
10395
+ errors.companyName = "Company Name is required for business accounts";
10117
10396
  }
10118
- return;
10119
10397
  }
10120
- setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
10121
- [name2]: ""
10122
- }));
10123
- setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
10124
- [name2]: value
10125
- }));
10126
- };
10127
- const handleClose = () => {
10128
- setShow(false);
10129
- setActive("card");
10130
- setError("");
10131
- setSuccess(false);
10132
- setTranId("");
10133
- setAchData({
10134
- name: "",
10135
- routingNumber: "",
10136
- accountNumber: "",
10137
- confirmAccountNumber: "",
10138
- bankName: "",
10139
- accountType: ""
10140
- });
10141
- setAchError({
10142
- name: "",
10143
- routingNumber: "",
10144
- accountNumber: "",
10145
- confirmAccountNumber: "",
10146
- bankName: "",
10147
- accountType: ""
10148
- });
10149
- setCardData({
10150
- cardName: "",
10151
- cardNumber: "",
10152
- expiryMonth: "",
10153
- expiryYear: "",
10154
- cvv: "",
10155
- orderId: "",
10156
- zipCode: ""
10157
- });
10158
- setCardError({
10159
- cardName: "",
10160
- cardNumber: "",
10161
- expiryMonth: "",
10162
- expiryYear: "",
10163
- cvv: "",
10164
- orderId: "",
10165
- zipCode: ""
10166
- });
10167
- setSaveACHinfo(false);
10168
- setSaveCardInfo(false);
10169
- setActiveinBank("form");
10170
- setActiveinCard("form");
10171
- setIsBankActive(false);
10172
- setProcessingFee(0);
10173
- setCashDiscount(0);
10174
- setCardList([]);
10175
- setErrorMessage(null);
10176
- setClientSecret(null);
10177
- setInitialLoader(false);
10178
- setIs3DSEnable(false);
10179
- setStripeResponse(null);
10180
- setOrderGuid(null);
10181
- setPartialAmount("");
10182
- setPartialError("");
10183
- setRemainingAmount("");
10184
- setIsBankConsentChecked(false);
10185
- setErrorBankConsent("");
10398
+ if (!isBankConsentChecked) {
10399
+ setErrorBankConsent("Above consent is requied");
10400
+ }
10401
+ setAchError(errors);
10402
+ return Object.keys(errors).length > 0 || !isBankConsentChecked;
10186
10403
  };
10187
- const getCardList = async () => {
10188
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
10189
- showLoader();
10404
+ const completeFractalFlow = async (tokenizeData, intentid, typeoftoken) => {
10405
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
10190
10406
  try {
10191
- const data = {
10192
- isPreAuth,
10193
- "customerId": customerId
10194
- };
10195
- let cardListData = await axios9.post(`${masterBaseUrl}api/v1/gateway/card-list/${session_token}`, data);
10196
- let savedpaymentsList = ((_b2 = (_a2 = cardListData == null ? void 0 : cardListData.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.cardList) || [];
10197
- let banklists = savedpaymentsList == null ? void 0 : savedpaymentsList.filter((card) => (card == null ? void 0 : card.card_type) == "Bank");
10198
- let cardlists = savedpaymentsList == null ? void 0 : savedpaymentsList.filter((card) => (card == null ? void 0 : card.card_type) !== "Bank");
10199
- if (cardlists && (cardlists == null ? void 0 : cardlists.length) > 0) {
10200
- setActive("card");
10201
- setActiveinCard("list");
10202
- setCardList(cardlists);
10203
- setLoadingIframe(false);
10204
- } else {
10205
- setActive("card");
10206
- setCardList([]);
10207
- }
10208
- if (banklists && (banklists == null ? void 0 : banklists.length) > 0) {
10209
- setActiveinBank("list");
10210
- setBankList(banklists);
10211
- } else {
10212
- setBankList([]);
10407
+ if (typeoftoken == "google_pay") {
10408
+ handleCharge({
10409
+ Token: tokenizeData,
10410
+ postalCode: cardData == null ? void 0 : cardData.zipCode,
10411
+ typeoftoken
10412
+ });
10413
+ return;
10213
10414
  }
10214
- hideLoader();
10215
- } catch (err) {
10216
- console.log(err);
10217
- hideLoader();
10218
- callback({
10219
- error: ((_d2 = (_c2 = err == null ? void 0 : err.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!",
10220
- result: (_f2 = (_e2 = err == null ? void 0 : err.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.result,
10221
- statusCode: (_g2 = err == null ? void 0 : err.response) == null ? void 0 : _g2.status
10415
+ let token = tokenizeData;
10416
+ let verifyandsaveresp = await axios9.post(`${masterBaseUrl}api/v1/gateway/verify-and-save/${session_token}`, {
10417
+ token,
10418
+ require3ds,
10419
+ pass_fee,
10420
+ typeoftoken
10222
10421
  });
10223
- setError(((_i2 = (_h2 = err == null ? void 0 : err.response) == null ? void 0 : _h2.data) == null ? void 0 : _i2.message) || (err == null ? void 0 : err.message) || "Something went wrong");
10224
- }
10225
- };
10226
- const getCardType2 = (card) => {
10227
- let card_type = card == null ? void 0 : card.toLowerCase();
10228
- switch (card_type) {
10229
- case "visa":
10230
- return visa2;
10231
- case "mastercard":
10232
- case "mc":
10233
- case "m/c":
10234
- return mastercard2;
10235
- case "amex":
10236
- case "american express":
10237
- case "ae":
10238
- return americanexp2;
10239
- case "discover":
10240
- case "dcvr":
10241
- return discover2;
10242
- case "bank":
10243
- return bank2;
10244
- default:
10245
- return card;
10422
+ if ((verifyandsaveresp == null ? void 0 : verifyandsaveresp.status) == 200) {
10423
+ let responsetemp = (_a2 = verifyandsaveresp == null ? void 0 : verifyandsaveresp.data) == null ? void 0 : _a2.data;
10424
+ let respData = {
10425
+ Token: responsetemp.gateway_token,
10426
+ Brand: responsetemp.card_data.brand,
10427
+ ExpirationMonth: responsetemp.card_data.expire_mm,
10428
+ ExpirationYear: responsetemp.card_data.expire_yy,
10429
+ Last4: responsetemp.card_data.last4,
10430
+ Bin: responsetemp.card_data.bin,
10431
+ postalCode: cardData == null ? void 0 : cardData.zipCode,
10432
+ stripe_3ds_auth_id: intentid
10433
+ };
10434
+ if (isPreAuth) {
10435
+ handlePreAuth(respData);
10436
+ } else {
10437
+ handleCharge(respData);
10438
+ }
10439
+ }
10440
+ } catch (error2) {
10441
+ console.log(error2, "error");
10442
+ setError(((_c2 = (_b2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _b2.data) == null ? void 0 : _c2.message) || "Something went wrong!");
10443
+ callback({
10444
+ error: ((_e2 = (_d2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _d2.data) == null ? void 0 : _e2.message) || "Something went wrong!",
10445
+ result: (_g2 = (_f2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _f2.data) == null ? void 0 : _g2.result,
10446
+ statusCode: (_h2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _h2.status
10447
+ });
10448
+ hideLoader();
10246
10449
  }
10247
10450
  };
10248
- const handleDeleteCard = async (cardId) => {
10249
- Swal5.fire({
10250
- icon: "warning",
10251
- text: "Do you want to delete the card?",
10252
- showCancelButton: true,
10253
- confirmButtonText: "Yes",
10254
- cancelButtonText: "No",
10255
- reverseButtons: true,
10256
- buttonsStyling: false,
10257
- customClass: {
10258
- confirmButton: "swal2-confirm btn btn-dark",
10259
- cancelButton: "swal2-cancel btn btn-dark",
10260
- popup: "custom-swal-popup",
10261
- icon: "custom-swal-icon"
10262
- }
10263
- }).then(async (result) => {
10264
- var _a2, _b2;
10265
- if (result.isConfirmed) {
10266
- setLoading2(true);
10267
- try {
10268
- let obj = {
10269
- card_id: cardId,
10270
- customer_id: customerId
10271
- };
10272
- const res = await axios9.patch(`${masterBaseUrl}api/v1/gateway/delete-card/${session_token}`, obj);
10273
- if ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.result) {
10274
- setLoading2(false);
10275
- getCardList();
10276
- Swal5.fire({
10277
- icon: "success",
10278
- title: "Deleted!",
10279
- text: ((_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.message) || "Card deleted.",
10280
- confirmButtonText: "OK",
10281
- showConfirmButton: true,
10282
- timer: 1e3,
10283
- // auto-close after 1 second
10284
- timerProgressBar: true,
10285
- customClass: {
10286
- confirmButton: "btn btn-dark"
10287
- }
10288
- });
10289
- } else {
10290
- setLoading2(false);
10291
- Swal5.fire({
10292
- icon: "error",
10293
- title: "Failure!",
10294
- text: "Card not deleted.",
10295
- timer: 1e3,
10296
- // auto-close after 1 second
10297
- timerProgressBar: true,
10298
- customClass: {
10299
- confirmButton: "btn btn-dark"
10451
+ const handleFractalTokenFlow = async () => {
10452
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v, _w, _x, _y, _z, _A;
10453
+ try {
10454
+ const requestOptions = {
10455
+ method: "POST",
10456
+ redirect: "follow"
10457
+ };
10458
+ let sesionResult = await axios9.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
10459
+ let objtokenize = {
10460
+ public_key_pem: ((_b2 = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.publicKeyPem) || ((_d2 = (_c2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.public_key_pem),
10461
+ session_key: (_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key
10462
+ };
10463
+ let three_ds_data = null;
10464
+ if (require3ds) {
10465
+ if (typeof window !== "undefined" && typeof navigator !== "undefined") {
10466
+ const languages = (_g2 = navigator.languages) != null ? _g2 : [navigator.language];
10467
+ const language = Array.isArray(languages) ? languages[0] : languages;
10468
+ three_ds_data = {
10469
+ amount: partialAmount ? Math.round(parseFloat(partialAmount) * 100) : Math.round(parseFloat(amount) * 100),
10470
+ // convert dollars → cents
10471
+ currency: "usd",
10472
+ channel: {
10473
+ type: "browser",
10474
+ browser: {
10475
+ language: typeof language === "string" ? language : null,
10476
+ color_depth: (_i2 = (_h2 = window.screen) == null ? void 0 : _h2.colorDepth) != null ? _i2 : null,
10477
+ java_enabled: typeof navigator.javaEnabled === "function" ? navigator.javaEnabled() : false,
10478
+ screen_height: (_k2 = (_j2 = window.screen) == null ? void 0 : _j2.height) != null ? _k2 : null,
10479
+ screen_width: (_m2 = (_l2 = window.screen) == null ? void 0 : _l2.width) != null ? _m2 : null,
10480
+ timezoneOffset: (/* @__PURE__ */ new Date()).getTimezoneOffset()
10300
10481
  }
10301
- });
10302
- }
10303
- } catch (err) {
10304
- setLoading2(false);
10305
- Swal5.fire({
10306
- icon: "error",
10307
- title: "Error!",
10308
- text: "Failed to delete the card.",
10309
- confirmButtonText: "OK",
10310
- customClass: {
10311
- confirmButton: "btn btn-dark"
10312
10482
  }
10313
- });
10483
+ };
10314
10484
  }
10315
- } else if (result.dismiss === Swal5.DismissReason.cancel) {
10316
- Swal5.fire({
10317
- icon: "info",
10318
- text: "Card not deleted",
10319
- confirmButtonText: "OK",
10320
- buttonsStyling: false,
10321
- customClass: {
10322
- confirmButton: "btn btn-dark float-end",
10323
- actions: "swal2-actions-end"
10324
- }
10325
- });
10326
10485
  }
10327
- });
10328
- };
10329
- const handlechargeCustomer = async (e) => {
10330
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
10331
- e.currentTarget.blur();
10332
- if (loading) return;
10333
- let customer_id = customerId;
10334
- let card_id = selectedCard == null ? void 0 : selectedCard.id;
10335
- let card_type = selectedCard == null ? void 0 : selectedCard.card_type;
10336
- if (partialError) {
10337
- return;
10338
- }
10339
- if (amount) {
10340
- if (customer_id) {
10341
- if (card_id) {
10342
- let chargeobj = {
10343
- amount: (card_type == null ? void 0 : card_type.toLowerCase()) === "bank" ? `${bankAmount}` : partialAmount ? partialAmount : amount,
10344
- customer_id,
10345
- card_id,
10346
- pass_fee,
10347
- pass_fee_amount: Number(amount) - cashDiscount
10348
- };
10349
- if (isPartial) {
10350
- chargeobj.orderGuid = orderGuid || ordGuid;
10351
- if (partialAmount) {
10352
- chargeobj.ispartialPayment = true;
10353
- }
10354
- }
10355
- if (isPreAuth) {
10356
- chargeobj.isPreauth = true;
10357
- }
10358
- let chargeurl = masterBaseUrl + "api/v1/gateway/charge-by-saved-details/" + session_token;
10359
- const headers = {
10360
- "Content-Type": "application/json"
10361
- };
10362
- try {
10363
- showLoader();
10364
- const response = await axios9.post(chargeurl, chargeobj);
10365
- if ((_a2 = response == null ? void 0 : response.data) == null ? void 0 : _a2.result) {
10366
- callback({ callback: __spreadProps(__spreadValues({}, (_b2 = response == null ? void 0 : response.data) == null ? void 0 : _b2.data), { isPreAuth }) });
10367
- hideLoader();
10368
- handleClose();
10369
- }
10370
- } catch (error2) {
10371
- console.log(error2 == null ? void 0 : error2.response, "error by saved details");
10372
- callback({
10373
- error: ((_d2 = (_c2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!",
10374
- result: (_f2 = (_e2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.result,
10375
- statusCode: (_g2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _g2.status
10376
- });
10486
+ let tokenizeData;
10487
+ try {
10488
+ tokenizeData = await tokenizerRef.current.createToken(
10489
+ objtokenize,
10490
+ three_ds_data
10491
+ );
10492
+ } catch (error2) {
10493
+ console.log(error2, "error in tokenization");
10494
+ let readableMessage = "Something went wrong!";
10495
+ try {
10496
+ const rawError = ((_n2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _n2.data) || (error2 == null ? void 0 : error2.message) || "";
10497
+ const errorText = typeof rawError === "string" ? rawError : JSON.stringify(rawError);
10498
+ const lines = ((_p2 = (_o2 = errorText.split) == null ? void 0 : _o2.call(errorText, "\n")) == null ? void 0 : _p2.filter(Boolean)) || [];
10499
+ const lastLine = lines.at(-1) || "";
10500
+ const parts = (_q2 = lastLine.split) == null ? void 0 : _q2.call(lastLine, ": ");
10501
+ readableMessage = (parts == null ? void 0 : parts.length) > 1 ? parts.pop().trim() : lastLine.trim() || readableMessage;
10502
+ } catch (e) {
10503
+ readableMessage = "Something went wrong!";
10504
+ }
10505
+ setErrorIframe(readableMessage);
10506
+ hideLoader();
10507
+ }
10508
+ if (tokenizeData == null ? void 0 : tokenizeData.token) {
10509
+ let ThreedsData = tokenizeData == null ? void 0 : tokenizeData.stripe_three_ds_response;
10510
+ if (require3ds && !ThreedsData && (ThreedsData == null ? void 0 : ThreedsData.status) === "200 OK" && ((_r2 = ThreedsData == null ? void 0 : ThreedsData.data) == null ? void 0 : _r2.challenge_url)) {
10511
+ setError("Something went wrong. Please try again later.");
10512
+ }
10513
+ if (require3ds) {
10514
+ if (!((_s2 = ThreedsData == null ? void 0 : ThreedsData.data) == null ? void 0 : _s2.challenge_url)) {
10515
+ completeFractalFlow(tokenizeData == null ? void 0 : tokenizeData.token, (_t2 = ThreedsData == null ? void 0 : ThreedsData.data) == null ? void 0 : _t2.id);
10516
+ } else {
10377
10517
  hideLoader();
10378
- setError(((_i2 = (_h2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _h2.data) == null ? void 0 : _i2.message) || "Something went wrong!");
10518
+ setStripeResponse(__spreadProps(__spreadValues({}, ThreedsData == null ? void 0 : ThreedsData.data), {
10519
+ fractalToken: tokenizeData == null ? void 0 : tokenizeData.token
10520
+ }));
10379
10521
  }
10380
10522
  } else {
10381
- setError("Please Select A Card/Bank");
10382
- callback({
10383
- error: "Please Select A Card/Bank"
10384
- });
10523
+ completeFractalFlow(tokenizeData == null ? void 0 : tokenizeData.token, null);
10385
10524
  }
10386
- } else {
10387
- setError("Please Select Customer");
10388
- callback({
10389
- error: "Please Select Customer"
10390
- });
10391
10525
  }
10392
- } else {
10393
- setError("Something went wrong.");
10526
+ } catch (error2) {
10527
+ hideLoader();
10528
+ console.log(error2, "error");
10529
+ let readableMessage = "Something went wrong!";
10530
+ try {
10531
+ const rawError = ((_u2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _u2.data) || (error2 == null ? void 0 : error2.message) || "";
10532
+ const errorText = typeof rawError === "string" ? rawError : JSON.stringify(rawError);
10533
+ const lines = ((_w = (_v = errorText.split) == null ? void 0 : _v.call(errorText, "\n")) == null ? void 0 : _w.filter(Boolean)) || [];
10534
+ const lastLine = lines.at(-1) || "";
10535
+ const parts = (_x = lastLine.split) == null ? void 0 : _x.call(lastLine, ": ");
10536
+ readableMessage = (parts == null ? void 0 : parts.length) > 1 ? parts.pop().trim() : lastLine.trim() || readableMessage;
10537
+ } catch (e) {
10538
+ readableMessage = "Something went wrong!";
10539
+ }
10540
+ setError(readableMessage);
10394
10541
  callback({
10395
- error: "Something went wrong."
10542
+ error: readableMessage,
10543
+ result: (_z = (_y = error2 == null ? void 0 : error2.response) == null ? void 0 : _y.data) == null ? void 0 : _z.result,
10544
+ statusCode: (_A = error2 == null ? void 0 : error2.response) == null ? void 0 : _A.status
10396
10545
  });
10397
10546
  }
10398
10547
  };
10399
- const getPaymentDetails = async () => {
10400
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2;
10401
- try {
10402
- showLoader();
10403
- const res = await axios9.get(`${masterBaseUrl}api/v1/gateway/get-payment-details/${session_token}`, {
10404
- params: {
10405
- require3ds,
10548
+ const validateCardData = () => {
10549
+ var _a2, _b2;
10550
+ const errors = {};
10551
+ const data = cardData;
10552
+ if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
10553
+ if (!((_b2 = data == null ? void 0 : data.zipCode) == null ? void 0 : _b2.trim())) errors.zipCode = "ZIP code is required";
10554
+ setCardError(errors);
10555
+ return Object.keys(errors).length > 0;
10556
+ };
10557
+ const validateCardInputs = () => {
10558
+ let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
10559
+ let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
10560
+ let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
10561
+ let errors = {};
10562
+ if (!validCard) errors.cardNumber = "Invalid card Number";
10563
+ if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
10564
+ if (!validCVV) errors.cvv = "Invalid CVV";
10565
+ setCardError(errors);
10566
+ return validCard && validCVV && validExpirationDate;
10567
+ };
10568
+ const submitFunc = async (e) => {
10569
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
10570
+ e.preventDefault();
10571
+ const el = document.activeElement;
10572
+ if (el instanceof HTMLElement) {
10573
+ el.blur();
10574
+ }
10575
+ if (loading) return;
10576
+ if (partialError) {
10577
+ return;
10578
+ }
10579
+ if (activetab !== "ach") {
10580
+ const hasError = validateCardData();
10581
+ if (hasError) return;
10582
+ let isValid = true;
10583
+ if (!isValid) return;
10584
+ } else {
10585
+ const hasError = validateAchData();
10586
+ if (hasError) return;
10587
+ }
10588
+ try {
10589
+ showLoader();
10590
+ const result = await axios9.get(`${masterBaseUrl}api/v1/gateway/token/${session_token}`, {
10591
+ params: {
10592
+ require3ds,
10406
10593
  pass_fee
10407
10594
  }
10408
10595
  });
10409
- if ((res == null ? void 0 : res.status) == 200) {
10410
- setIsBankActive((_b2 = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.isBankActive);
10411
- setProcessingFee(Number((_d2 = (_c2 = res == null ? void 0 : res.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.fee) || 0);
10412
- setPaymentGateway((_f2 = (_e2 = res == null ? void 0 : res.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.paymentGateway);
10413
- setDCToken((_h2 = (_g2 = res == null ? void 0 : res.data) == null ? void 0 : _g2.data) == null ? void 0 : _h2.dctoken);
10414
- hideLoader();
10596
+ if ((result == null ? void 0 : result.status) == 200) {
10597
+ let gatewayToken = (_b2 = (_a2 = result == null ? void 0 : result.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.gateway_token;
10598
+ let paymentGateway2 = (_d2 = (_c2 = result == null ? void 0 : result.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.paymentGateway;
10599
+ if (activetab !== "ach") {
10600
+ if (paymentGateway2 == ((_e2 = PaymentMethodKeys) == null ? void 0 : _e2.FRACTALKEY)) {
10601
+ await handleFractalTokenFlow();
10602
+ } else {
10603
+ try {
10604
+ const result2 = await window.requestDcToken();
10605
+ ;
10606
+ console.log("Token:", result2.Token);
10607
+ if (result2.Token) {
10608
+ handleTokenCallback(result2);
10609
+ }
10610
+ } catch (err) {
10611
+ console.log(err, "Error while tokenizing");
10612
+ setErrorIframe(err);
10613
+ setLoading(false);
10614
+ }
10615
+ }
10616
+ } else {
10617
+ let callbackdata;
10618
+ try {
10619
+ const payByBank = await axios9.post(`${masterBaseUrl}api/v1/gateway/bank-charge/${session_token}`, __spreadValues({
10620
+ label: achData == null ? void 0 : achData.name,
10621
+ account_number: achData == null ? void 0 : achData.accountNumber,
10622
+ routing_number: achData == null ? void 0 : achData.routingNumber,
10623
+ bank_name: achData == null ? void 0 : achData.bankName,
10624
+ account_type: achData == null ? void 0 : achData.accountType,
10625
+ amount: `${bankAmount}`,
10626
+ customer_id: null,
10627
+ isSaveAch: false,
10628
+ tax: "0.00",
10629
+ discount: "0.00",
10630
+ surcharge: "0.00",
10631
+ order_id: "",
10632
+ company_name: (achData == null ? void 0 : achData.companyName) || ""
10633
+ }, saveACHinfo ? {
10634
+ bank: {
10635
+ name: achData == null ? void 0 : achData.name,
10636
+ account_number: achData == null ? void 0 : achData.accountNumber,
10637
+ routing_number: achData == null ? void 0 : achData.routingNumber,
10638
+ bank_name: achData == null ? void 0 : achData.bankName,
10639
+ account_type: achData == null ? void 0 : achData.accountType,
10640
+ customer_id: customerId || "",
10641
+ company_name: (achData == null ? void 0 : achData.companyName) || ""
10642
+ }
10643
+ } : null));
10644
+ if ((_f2 = payByBank == null ? void 0 : payByBank.data) == null ? void 0 : _f2.result) {
10645
+ callbackdata = __spreadProps(__spreadValues({}, callbackdata), {
10646
+ callback: __spreadProps(__spreadValues({}, (_g2 = payByBank == null ? void 0 : payByBank.data) == null ? void 0 : _g2.data), { name: achData == null ? void 0 : achData.name, isPreAuth })
10647
+ });
10648
+ callback(callbackdata);
10649
+ handleClose();
10650
+ hideLoader();
10651
+ }
10652
+ } catch (error2) {
10653
+ console.log(error2, "errororor");
10654
+ let data = (_h2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _h2.data;
10655
+ if (typeof (data == null ? void 0 : data.message) == "object") {
10656
+ Object.values(data == null ? void 0 : data.message).forEach((message) => {
10657
+ var _a3;
10658
+ setError(message || "Something went wrong");
10659
+ callback({
10660
+ error: message || "Something went wrong!",
10661
+ result: (data == null ? void 0 : data.result) || false,
10662
+ statusCode: (_a3 = error2 == null ? void 0 : error2.response) == null ? void 0 : _a3.status
10663
+ });
10664
+ });
10665
+ } else {
10666
+ setError((data == null ? void 0 : data.message) || "Something went wrong");
10667
+ callback({
10668
+ error: (data == null ? void 0 : data.message) || "Something went wrong!",
10669
+ result: (data == null ? void 0 : data.result) || false,
10670
+ statusCode: (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.status
10671
+ });
10672
+ }
10673
+ hideLoader();
10674
+ }
10675
+ }
10415
10676
  }
10416
10677
  } catch (error2) {
10417
- console.log((_j2 = (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.data) == null ? void 0 : _j2.result, "error while getting payment details");
10678
+ hideLoader();
10418
10679
  callback({
10419
- error: ((_l2 = (_k2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _k2.data) == null ? void 0 : _l2.message) || "Something went wrong!",
10420
- result: (_n2 = (_m2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _m2.data) == null ? void 0 : _n2.result,
10421
- statusCode: (_o2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _o2.status
10680
+ error: ((_k2 = (_j2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _j2.data) == null ? void 0 : _k2.message) || "Something went wrong!",
10681
+ result: (_m2 = (_l2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _l2.data) == null ? void 0 : _m2.result,
10682
+ statusCode: (_n2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _n2.status
10422
10683
  });
10423
- setError(((_q2 = (_p2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _p2.data) == null ? void 0 : _q2.message) || (error2 == null ? void 0 : error2.message) || "Something went wrong");
10424
- hideLoader();
10684
+ setError(((_p2 = (_o2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _o2.data) == null ? void 0 : _p2.message) || "Something went wrong!");
10425
10685
  }
10426
10686
  };
10427
- const crateOrderFrac = async () => {
10428
- var _a2, _b2, _c2, _d2, _e2;
10429
- if (orderLoader) return;
10430
- setOrderLoader(true);
10431
- try {
10432
- const res = await axios9.post(`${masterBaseUrl}api/v1/gateway/create-pay-order/${session_token}`, {
10433
- amount,
10434
- cashDiscount,
10435
- bankAmount,
10436
- bankSurcharge,
10437
- customerId,
10438
- passFee: pass_fee,
10439
- passFeeAmount: pass_fee_amount ? pass_fee_amount : Number(amount) - cashDiscount,
10440
- require3ds,
10441
- isPartial
10442
- });
10443
- if ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.result) {
10444
- setOrderLoader(false);
10445
- setOrderGuid((_c2 = (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.orderGuid);
10446
- setRemainingAmount((_e2 = (_d2 = res == null ? void 0 : res.data) == null ? void 0 : _d2.data) == null ? void 0 : _e2.remainingAmount);
10447
- hasRunRef.current = true;
10687
+ const handleCardChange = (field, value) => {
10688
+ const name2 = field;
10689
+ const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
10690
+ if (numericFields.includes(name2)) {
10691
+ if (value === "" || /^[0-9]+$/.test(value)) {
10692
+ setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
10693
+ [name2]: ""
10694
+ }));
10695
+ setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
10696
+ [name2]: value
10697
+ }));
10448
10698
  }
10449
- } catch (error2) {
10450
- console.log("error in creating order", error2);
10451
- setOrderLoader(false);
10699
+ return;
10452
10700
  }
10701
+ setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
10702
+ [name2]: ""
10703
+ }));
10704
+ setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
10705
+ [name2]: value
10706
+ }));
10453
10707
  };
10454
- useEffect15(() => {
10455
- if (!show && !autoTrigger) {
10456
- hasRunRef.current = false;
10457
- cardListRunRef.current = false;
10458
- }
10459
- }, [show, autoTrigger]);
10460
- useEffect15(() => {
10461
- if (!hasRunRef.current && (show || autoTrigger)) {
10462
- getPaymentDetails();
10463
- if (isPartial && !partialRef) {
10464
- crateOrderFrac();
10708
+ const handleCardNumberChange = (e) => {
10709
+ var _a2;
10710
+ const input = e.target;
10711
+ const rawValue = input.value.replace(/\D/g, "");
10712
+ const { formatted, cursor } = formatCardNumberWithCursor(
10713
+ input.value,
10714
+ (_a2 = input.selectionStart) != null ? _a2 : 0
10715
+ );
10716
+ setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
10717
+ cardNumber: ""
10718
+ }));
10719
+ setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
10720
+ cardNumber: formatted
10721
+ }));
10722
+ requestAnimationFrame(() => {
10723
+ input.setSelectionRange(cursor, cursor);
10724
+ });
10725
+ };
10726
+ const handleChangeAch = (e) => {
10727
+ const { name: name2, value } = e.target;
10728
+ const numericFields = ["routingNumber", "accountNumber", "confirmAccountNumber"];
10729
+ if (name2 == "name") {
10730
+ if (/^[a-zA-Z\s]*$/.test(value)) {
10731
+ setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
10732
+ [name2]: ""
10733
+ }));
10734
+ setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
10735
+ [name2]: value
10736
+ }));
10465
10737
  }
10738
+ return;
10466
10739
  }
10467
- }, [show, autoTrigger, isPartial]);
10468
- useEffect15(() => {
10469
- if ((show || autoTrigger) && pass_fee_amount) {
10470
- let cashdisc = Number(amount) - Number(pass_fee_amount);
10471
- if (cashdisc && !isNaN(cashdisc)) {
10472
- setCashDiscount(cashdisc);
10473
- }
10474
- } else if ((show || autoTrigger) && pass_fee && processingFee) {
10475
- let cashdisc = CalculateCashDiscount(amount, processingFee);
10476
- if (cashdisc && !isNaN(cashdisc)) {
10477
- setCashDiscount(cashdisc);
10740
+ if (numericFields.includes(name2)) {
10741
+ if (value === "" || /^[0-9]+$/.test(value)) {
10742
+ setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
10743
+ [name2]: ""
10744
+ }));
10745
+ setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
10746
+ [name2]: value
10747
+ }));
10478
10748
  }
10479
- } else {
10480
- setCashDiscount(Number(amount));
10481
- }
10482
- if (!cardListRunRef.current && customerId && (show || autoTrigger) && !isRequest) {
10483
- cardListRunRef.current = true;
10484
- getCardList();
10485
- }
10486
- }, [customerId, show, amount, processingFee, autoTrigger]);
10487
- const getHeading = () => {
10488
- if (isPreAuth) {
10489
- return "Cards";
10490
- } else {
10491
- return "Cards/Bank";
10749
+ return;
10492
10750
  }
10751
+ setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
10752
+ [name2]: ""
10753
+ }));
10754
+ setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
10755
+ [name2]: value
10756
+ }));
10493
10757
  };
10494
- const fetchClientSecret = useCallback(async () => {
10758
+ const handleClose = () => {
10759
+ setShow(false);
10760
+ setActive("card");
10761
+ setError("");
10762
+ setSuccess(false);
10763
+ setTranId("");
10764
+ setAchData({
10765
+ name: "",
10766
+ routingNumber: "",
10767
+ accountNumber: "",
10768
+ confirmAccountNumber: "",
10769
+ bankName: "",
10770
+ accountType: ""
10771
+ });
10772
+ setAchError({
10773
+ name: "",
10774
+ routingNumber: "",
10775
+ accountNumber: "",
10776
+ confirmAccountNumber: "",
10777
+ bankName: "",
10778
+ accountType: ""
10779
+ });
10780
+ setCardData({
10781
+ cardName: "",
10782
+ cardNumber: "",
10783
+ expiryMonth: "",
10784
+ expiryYear: "",
10785
+ cvv: "",
10786
+ orderId: "",
10787
+ zipCode: ""
10788
+ });
10789
+ setCardError({
10790
+ cardName: "",
10791
+ cardNumber: "",
10792
+ expiryMonth: "",
10793
+ expiryYear: "",
10794
+ cvv: "",
10795
+ orderId: "",
10796
+ zipCode: ""
10797
+ });
10798
+ setSaveACHinfo(false);
10799
+ setSaveCardInfo(false);
10800
+ setActiveinBank("form");
10801
+ setActiveinCard("form");
10802
+ setIsBankActive(false);
10803
+ setProcessingFee(0);
10804
+ setCashDiscount(0);
10805
+ setCardList([]);
10806
+ setErrorMessage(null);
10807
+ setClientSecret(null);
10808
+ setInitialLoader(false);
10809
+ setIs3DSEnable(false);
10810
+ setStripeResponse(null);
10811
+ setOrderGuid(null);
10812
+ setPartialAmount("");
10813
+ setPartialError("");
10814
+ setRemainingAmount("");
10815
+ setIsBankConsentChecked(false);
10816
+ setErrorBankConsent("");
10817
+ };
10818
+ const getCardList = async () => {
10819
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
10820
+ showLoader();
10495
10821
  try {
10496
- setInitialLoader(true);
10497
- const res = await fetch(`${masterBaseUrl}api/v1/gateway/create-payment-intent/${session_token}`, {
10498
- method: "POST",
10499
- headers: { "Content-Type": "application/json" },
10500
- body: JSON.stringify({ amount, require3ds, pass_fee })
10501
- });
10502
- const data = await res.json();
10503
- if (data.is3dEnable) {
10504
- setInitialLoader(false);
10505
- setClientSecret(data.clientSecret);
10506
- setIs3DSEnable(data.is3dEnable);
10822
+ const data = {
10823
+ isPreAuth,
10824
+ "customerId": customerId
10825
+ };
10826
+ let cardListData = await axios9.post(`${masterBaseUrl}api/v1/gateway/card-list/${session_token}`, data);
10827
+ let savedpaymentsList = ((_b2 = (_a2 = cardListData == null ? void 0 : cardListData.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.cardList) || [];
10828
+ let banklists = savedpaymentsList == null ? void 0 : savedpaymentsList.filter((card) => (card == null ? void 0 : card.card_type) == "Bank");
10829
+ let cardlists = savedpaymentsList == null ? void 0 : savedpaymentsList.filter((card) => (card == null ? void 0 : card.card_type) !== "Bank");
10830
+ if (cardlists && (cardlists == null ? void 0 : cardlists.length) > 0) {
10831
+ setActive("card");
10832
+ setActiveinCard("list");
10833
+ setCardList(cardlists);
10834
+ setLoadingIframe(false);
10507
10835
  } else {
10508
- setInitialLoader(false);
10509
- setIs3DSEnable(data.is3dEnable);
10836
+ setActive("card");
10837
+ setCardList([]);
10510
10838
  }
10511
- if (!data.result) {
10512
- setError(data.error || (data == null ? void 0 : data.message) || "Failed to get client secret");
10839
+ if (banklists && (banklists == null ? void 0 : banklists.length) > 0) {
10840
+ setActiveinBank("list");
10841
+ setBankList(banklists);
10842
+ } else {
10843
+ setBankList([]);
10513
10844
  }
10845
+ hideLoader();
10514
10846
  } catch (err) {
10515
- console.log(err.response, "err.response");
10516
- setError(err.message);
10847
+ console.log(err);
10848
+ hideLoader();
10849
+ callback({
10850
+ error: ((_d2 = (_c2 = err == null ? void 0 : err.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!",
10851
+ result: (_f2 = (_e2 = err == null ? void 0 : err.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.result,
10852
+ statusCode: (_g2 = err == null ? void 0 : err.response) == null ? void 0 : _g2.status
10853
+ });
10854
+ setError(((_i2 = (_h2 = err == null ? void 0 : err.response) == null ? void 0 : _h2.data) == null ? void 0 : _i2.message) || (err == null ? void 0 : err.message) || "Something went wrong");
10855
+ }
10856
+ };
10857
+ const getCardType2 = (card) => {
10858
+ let card_type = card == null ? void 0 : card.toLowerCase();
10859
+ switch (card_type) {
10860
+ case "visa":
10861
+ return visa2;
10862
+ case "mastercard":
10863
+ case "mc":
10864
+ case "m/c":
10865
+ return mastercard2;
10866
+ case "amex":
10867
+ case "american express":
10868
+ case "ae":
10869
+ return americanexp2;
10870
+ case "discover":
10871
+ case "dcvr":
10872
+ return discover2;
10873
+ case "bank":
10874
+ return bank2;
10875
+ default:
10876
+ return card;
10877
+ }
10878
+ };
10879
+ const handleDeleteCard = async (cardId) => {
10880
+ Swal5.fire({
10881
+ icon: "warning",
10882
+ text: "Do you want to delete the card?",
10883
+ showCancelButton: true,
10884
+ confirmButtonText: "Yes",
10885
+ cancelButtonText: "No",
10886
+ reverseButtons: true,
10887
+ buttonsStyling: false,
10888
+ customClass: {
10889
+ confirmButton: "swal2-confirm btn btn-dark",
10890
+ cancelButton: "swal2-cancel btn btn-dark",
10891
+ popup: "custom-swal-popup",
10892
+ icon: "custom-swal-icon"
10893
+ }
10894
+ }).then(async (result) => {
10895
+ var _a2, _b2;
10896
+ if (result.isConfirmed) {
10897
+ setLoading2(true);
10898
+ try {
10899
+ let obj = {
10900
+ card_id: cardId,
10901
+ customer_id: customerId
10902
+ };
10903
+ const res = await axios9.patch(`${masterBaseUrl}api/v1/gateway/delete-card/${session_token}`, obj);
10904
+ if ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.result) {
10905
+ setLoading2(false);
10906
+ getCardList();
10907
+ Swal5.fire({
10908
+ icon: "success",
10909
+ title: "Deleted!",
10910
+ text: ((_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.message) || "Card deleted.",
10911
+ confirmButtonText: "OK",
10912
+ showConfirmButton: true,
10913
+ timer: 1e3,
10914
+ // auto-close after 1 second
10915
+ timerProgressBar: true,
10916
+ customClass: {
10917
+ confirmButton: "btn btn-dark"
10918
+ }
10919
+ });
10920
+ } else {
10921
+ setLoading2(false);
10922
+ Swal5.fire({
10923
+ icon: "error",
10924
+ title: "Failure!",
10925
+ text: "Card not deleted.",
10926
+ timer: 1e3,
10927
+ // auto-close after 1 second
10928
+ timerProgressBar: true,
10929
+ customClass: {
10930
+ confirmButton: "btn btn-dark"
10931
+ }
10932
+ });
10933
+ }
10934
+ } catch (err) {
10935
+ setLoading2(false);
10936
+ Swal5.fire({
10937
+ icon: "error",
10938
+ title: "Error!",
10939
+ text: "Failed to delete the card.",
10940
+ confirmButtonText: "OK",
10941
+ customClass: {
10942
+ confirmButton: "btn btn-dark"
10943
+ }
10944
+ });
10945
+ }
10946
+ } else if (result.dismiss === Swal5.DismissReason.cancel) {
10947
+ Swal5.fire({
10948
+ icon: "info",
10949
+ text: "Card not deleted",
10950
+ confirmButtonText: "OK",
10951
+ buttonsStyling: false,
10952
+ customClass: {
10953
+ confirmButton: "btn btn-dark float-end",
10954
+ actions: "swal2-actions-end"
10955
+ }
10956
+ });
10957
+ }
10958
+ });
10959
+ };
10960
+ const handlechargeCustomer = async (e) => {
10961
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
10962
+ e == null ? void 0 : e.currentTarget.blur();
10963
+ if (loading) return;
10964
+ let customer_id = customerId;
10965
+ let card_id = selectedCard == null ? void 0 : selectedCard.id;
10966
+ let card_type = selectedCard == null ? void 0 : selectedCard.card_type;
10967
+ if (partialError) {
10968
+ return;
10969
+ }
10970
+ if (amount) {
10971
+ if (customer_id) {
10972
+ if (card_id) {
10973
+ let chargeobj = {
10974
+ amount: (card_type == null ? void 0 : card_type.toLowerCase()) === "bank" ? `${bankAmount}` : partialAmount ? partialAmount : amount,
10975
+ customer_id,
10976
+ card_id,
10977
+ pass_fee,
10978
+ pass_fee_amount: Number(amount) - cashDiscount
10979
+ };
10980
+ if (isPartial) {
10981
+ chargeobj.orderGuid = orderGuid || ordGuid;
10982
+ if (partialAmount) {
10983
+ chargeobj.ispartialPayment = true;
10984
+ }
10985
+ }
10986
+ if (isPreAuth) {
10987
+ chargeobj.isPreauth = true;
10988
+ }
10989
+ let chargeurl = masterBaseUrl + "api/v1/gateway/charge-by-saved-details/" + session_token;
10990
+ const headers = {
10991
+ "Content-Type": "application/json"
10992
+ };
10993
+ try {
10994
+ showLoader();
10995
+ const response = await axios9.post(chargeurl, chargeobj);
10996
+ if ((_a2 = response == null ? void 0 : response.data) == null ? void 0 : _a2.result) {
10997
+ callback({ callback: __spreadProps(__spreadValues({}, (_b2 = response == null ? void 0 : response.data) == null ? void 0 : _b2.data), { isPreAuth }) });
10998
+ hideLoader();
10999
+ handleClose();
11000
+ }
11001
+ } catch (error2) {
11002
+ console.log(error2 == null ? void 0 : error2.response, "error by saved details");
11003
+ callback({
11004
+ error: ((_d2 = (_c2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!",
11005
+ result: (_f2 = (_e2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.result,
11006
+ statusCode: (_g2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _g2.status
11007
+ });
11008
+ hideLoader();
11009
+ }
11010
+ } else {
11011
+ setError("Please Select A Card/Bank");
11012
+ callback({
11013
+ error: "Please Select A Card/Bank"
11014
+ });
11015
+ }
11016
+ } else {
11017
+ setError("Please Select Customer");
11018
+ callback({
11019
+ error: "Please Select Customer"
11020
+ });
11021
+ }
11022
+ } else {
11023
+ setError("Something went wrong.");
11024
+ callback({
11025
+ error: "Something went wrong."
11026
+ });
11027
+ }
11028
+ };
11029
+ const getPaymentDetails = async () => {
11030
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2;
11031
+ try {
11032
+ showLoader();
11033
+ const res = await axios9.get(`${masterBaseUrl}api/v1/gateway/get-payment-details/${session_token}`, {
11034
+ params: {
11035
+ require3ds,
11036
+ pass_fee
11037
+ }
11038
+ });
11039
+ if ((res == null ? void 0 : res.status) == 200) {
11040
+ setIsBankActive((_b2 = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.isBankActive);
11041
+ setProcessingFee(Number((_d2 = (_c2 = res == null ? void 0 : res.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.fee) || 0);
11042
+ setPaymentGateway((_f2 = (_e2 = res == null ? void 0 : res.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.paymentGateway);
11043
+ setDCToken((_h2 = (_g2 = res == null ? void 0 : res.data) == null ? void 0 : _g2.data) == null ? void 0 : _h2.dctoken);
11044
+ hideLoader();
11045
+ }
11046
+ } catch (error2) {
11047
+ console.log((_j2 = (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.data) == null ? void 0 : _j2.result, "error while getting payment details");
11048
+ callback({
11049
+ error: ((_l2 = (_k2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _k2.data) == null ? void 0 : _l2.message) || "Something went wrong!",
11050
+ result: (_n2 = (_m2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _m2.data) == null ? void 0 : _n2.result,
11051
+ statusCode: (_o2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _o2.status
11052
+ });
11053
+ setError(((_q2 = (_p2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _p2.data) == null ? void 0 : _q2.message) || (error2 == null ? void 0 : error2.message) || "Something went wrong");
11054
+ hideLoader();
11055
+ }
11056
+ };
11057
+ const crateOrderFrac = async () => {
11058
+ var _a2, _b2, _c2, _d2, _e2;
11059
+ if (orderLoader) return;
11060
+ setOrderLoader(true);
11061
+ try {
11062
+ const res = await axios9.post(`${masterBaseUrl}api/v1/gateway/create-pay-order/${session_token}`, {
11063
+ amount,
11064
+ cashDiscount,
11065
+ bankAmount,
11066
+ bankSurcharge,
11067
+ customerId,
11068
+ passFee: pass_fee,
11069
+ passFeeAmount: pass_fee_amount ? pass_fee_amount : Number(amount) - cashDiscount,
11070
+ require3ds,
11071
+ isPartial
11072
+ });
11073
+ if ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.result) {
11074
+ setOrderLoader(false);
11075
+ setOrderGuid((_c2 = (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.orderGuid);
11076
+ setRemainingAmount((_e2 = (_d2 = res == null ? void 0 : res.data) == null ? void 0 : _d2.data) == null ? void 0 : _e2.remainingAmount);
11077
+ hasRunRef.current = true;
11078
+ }
11079
+ } catch (error2) {
11080
+ console.log("error in creating order", error2);
11081
+ setOrderLoader(false);
11082
+ }
11083
+ };
11084
+ useEffect18(() => {
11085
+ if (!show && !autoTrigger) {
11086
+ hasRunRef.current = false;
11087
+ cardListRunRef.current = false;
11088
+ }
11089
+ }, [show, autoTrigger]);
11090
+ useEffect18(() => {
11091
+ if (!hasRunRef.current && (show || autoTrigger) && onLoad) {
11092
+ getPaymentDetails();
11093
+ if (isPartial && !partialRef) {
11094
+ crateOrderFrac();
11095
+ }
11096
+ }
11097
+ }, [show, autoTrigger, isPartial, onLoad]);
11098
+ useEffect18(() => {
11099
+ if ((show || autoTrigger) && pass_fee_amount) {
11100
+ let cashdisc = Number(amount) - Number(pass_fee_amount);
11101
+ if (cashdisc && !isNaN(cashdisc)) {
11102
+ setCashDiscount(cashdisc);
11103
+ }
11104
+ } else if ((show || autoTrigger) && pass_fee && processingFee) {
11105
+ let cashdisc = CalculateCashDiscount(amount, processingFee);
11106
+ if (cashdisc && !isNaN(cashdisc)) {
11107
+ setCashDiscount(cashdisc);
11108
+ }
11109
+ } else {
11110
+ setCashDiscount(Number(amount));
11111
+ }
11112
+ if (!cardListRunRef.current && customerId && (show || autoTrigger) && !isRequest) {
11113
+ cardListRunRef.current = true;
11114
+ getCardList();
11115
+ }
11116
+ }, [customerId, show, amount, processingFee, autoTrigger]);
11117
+ const getHeading = () => {
11118
+ if (isPreAuth) {
11119
+ return "Cards";
11120
+ } else {
11121
+ return "Cards/Bank";
11122
+ }
11123
+ };
11124
+ const fetchClientSecret = useCallback(async () => {
11125
+ try {
11126
+ setInitialLoader(true);
11127
+ const res = await fetch(`${masterBaseUrl}api/v1/gateway/create-payment-intent/${session_token}`, {
11128
+ method: "POST",
11129
+ headers: { "Content-Type": "application/json" },
11130
+ body: JSON.stringify({ amount, require3ds, pass_fee })
11131
+ });
11132
+ const data = await res.json();
11133
+ if (data.is3dEnable) {
11134
+ setInitialLoader(false);
11135
+ setClientSecret(data.clientSecret);
11136
+ setIs3DSEnable(data.is3dEnable);
11137
+ } else {
11138
+ setInitialLoader(false);
11139
+ setIs3DSEnable(data.is3dEnable);
11140
+ }
11141
+ if (!data.result) {
11142
+ setError(data.error || (data == null ? void 0 : data.message) || "Failed to get client secret");
11143
+ }
11144
+ } catch (err) {
11145
+ console.log(err.response, "err.response");
11146
+ setError(err.message);
11147
+ }
11148
+ }, [amount]);
11149
+ const onSuccess = () => {
11150
+ };
11151
+ const handleSuccess = (token, intentId) => {
11152
+ showLoader();
11153
+ completeFractalFlow(token, intentId);
11154
+ setStripeResponse(null);
11155
+ };
11156
+ const handleError = (status) => {
11157
+ console.error("3DS Auth failed \u274C", status);
11158
+ setError(`3DS Authentication ${status}`);
11159
+ };
11160
+ useEffect18(() => {
11161
+ if (setHandleCloseRef) {
11162
+ setHandleCloseRef(() => handleClose);
11163
+ }
11164
+ }, []);
11165
+ const handlePartialChange = (values) => {
11166
+ var _a2, _b2;
11167
+ if (((_a2 = Number(remainingAmount || remAmount)) == null ? void 0 : _a2.toFixed(2)) < (values == null ? void 0 : values.floatValue) || (values == null ? void 0 : values.floatValue) < 0) {
11168
+ setPartialAmount(values == null ? void 0 : values.value);
11169
+ setPartialError(`Partial amount cannot exceed ${formatUSD((_b2 = Number(remainingAmount || remAmount)) == null ? void 0 : _b2.toFixed(2))}`);
11170
+ } else if ((values == null ? void 0 : values.floatValue) == 0) {
11171
+ setPartialAmount(values == null ? void 0 : values.value);
11172
+ setPartialError("Partial amount must be greater than 0");
11173
+ } else {
11174
+ setPartialAmount(values == null ? void 0 : values.value);
11175
+ setPartialError("");
11176
+ }
11177
+ };
11178
+ useEffect18(() => {
11179
+ if (typeof FractalTokenizer === "undefined") return;
11180
+ const tokenizer = new FractalTokenizer({
11181
+ styles: {}
11182
+ });
11183
+ }, []);
11184
+ const stateRef = useRef12({
11185
+ activeinBank,
11186
+ activeinCard,
11187
+ activetab
11188
+ });
11189
+ useEffect18(() => {
11190
+ stateRef.current = {
11191
+ activeinBank,
11192
+ activeinCard,
11193
+ activetab
11194
+ };
11195
+ }, [activeinBank, activeinCard, activetab]);
11196
+ const submit = useCallback(() => {
11197
+ var _a2, _b2;
11198
+ const { activeinBank: activeinBank2, activeinCard: activeinCard2, activetab: activetab2 } = stateRef.current;
11199
+ if (activetab2 === "card") {
11200
+ if (activeinCard2 === "form") {
11201
+ (_a2 = cardFormRef.current) == null ? void 0 : _a2.requestSubmit();
11202
+ } else if (activeinCard2 === "list") {
11203
+ handlechargeCustomer();
11204
+ }
11205
+ } else if (activetab2 === "ach") {
11206
+ if (activeinBank2 === "form") {
11207
+ (_b2 = bankFormRef.current) == null ? void 0 : _b2.requestSubmit();
11208
+ } else if (activeinBank2 === "list") {
11209
+ handlechargeCustomer();
11210
+ }
11211
+ }
11212
+ }, []);
11213
+ useEffect18(() => {
11214
+ onSubmit == null ? void 0 : onSubmit(submit);
11215
+ }, [onSubmit, submit]);
11216
+ function detectCardType(cardinput) {
11217
+ if (!cardinput) return null;
11218
+ const number = cardinput.replace(/\D/g, "");
11219
+ const patterns = {
11220
+ visa: /^4/,
11221
+ mastercard: /^(5[1-5]|2[2-7][0-9]{2})/,
11222
+ amex: /^3[47]/,
11223
+ discover: /^(6011|65|64[4-9])/,
11224
+ diners: /^(30[0-5]|36|38)/,
11225
+ jcb: /^(35[2-8][0-9])/,
11226
+ unionpay: /^62/
11227
+ };
11228
+ for (const [type, regex] of Object.entries(patterns)) {
11229
+ if (regex.test(number)) {
11230
+ return type;
11231
+ }
11232
+ }
11233
+ return "unknown";
11234
+ }
11235
+ function getCardImage(cardInput) {
11236
+ const cardType = detectCardType(cardInput);
11237
+ switch (cardType) {
11238
+ case "visa":
11239
+ return /* @__PURE__ */ jsx36("img", { src: visa2, alt: "visa", width: 33 });
11240
+ case "mastercard":
11241
+ return /* @__PURE__ */ jsx36("img", { src: mastercard2, width: 33, alt: "mastercard" });
11242
+ case "amex":
11243
+ return /* @__PURE__ */ jsx36("img", { src: americanexp2, alt: "amex", width: 33 });
11244
+ case "discover":
11245
+ return /* @__PURE__ */ jsx36("img", { src: discover2, width: 33, alt: "discover" });
11246
+ case "diners":
11247
+ return /* @__PURE__ */ jsx36("img", { src: dinersicon, alt: "Diners Club" });
11248
+ case "jcb":
11249
+ return /* @__PURE__ */ jsx36("img", { src: jcbicon, alt: "JCB" });
11250
+ case "unionpay":
11251
+ return /* @__PURE__ */ jsx36("img", { src: unionicon, alt: "UnionPay" });
11252
+ default:
11253
+ return /* @__PURE__ */ jsx36("img", { src: defualtcardborder, alt: "card" });
11254
+ }
11255
+ }
11256
+ return /* @__PURE__ */ jsxs21(Fragment20, { children: [
11257
+ (initialLoader || !onLoad) && /* @__PURE__ */ jsx36(Loader_default, { intensity: "dark", loading: initialLoader || !onLoad }),
11258
+ error && /* @__PURE__ */ jsx36("div", { children: /* @__PURE__ */ jsx36(ErrorCardOverlay_default, { error, onClose: handleClose, autoTrigger }) }),
11259
+ errorIframe && /* @__PURE__ */ jsx36("div", { children: /* @__PURE__ */ jsx36(ErrorCardOverlay_default, { error: errorIframe, onClose: () => {
11260
+ setErrorIframe("");
11261
+ }, autoTrigger: onSubmit ? !onSubmit : autoTrigger }) }),
11262
+ /* @__PURE__ */ jsxs21(Fragment20, { children: [
11263
+ (loading || loading2 || loadingIframe) && /* @__PURE__ */ jsx36(Loader_default, { intensity: "light", loading: loading || loading2 || loadingPrev || orderLoader || loadingIframe }),
11264
+ /* @__PURE__ */ jsxs21("div", { className: "frac-card-payment-page frac-form frac-new-form", children: [
11265
+ /* @__PURE__ */ jsx36("div", { ref: threeDSContainerRef, style: { width: "100%", height: "100%" } }),
11266
+ (stripeResponse == null ? void 0 : stripeResponse.challenge_url) ? /* @__PURE__ */ jsx36(
11267
+ ThreeDSChallenge,
11268
+ {
11269
+ containerRef: threeDSContainerRef,
11270
+ challengeUrl: stripeResponse.challenge_url,
11271
+ fractalToken: stripeResponse.fractalToken,
11272
+ stripeIntentId: stripeResponse.id,
11273
+ onSuccess: handleSuccess,
11274
+ onError: handleError
11275
+ }
11276
+ ) : /* @__PURE__ */ jsxs21("div", { className: "parent-pay-container", children: [
11277
+ /* @__PURE__ */ jsx36("span", { style: { display: autoTrigger ? "none" : "block" }, className: "request-payment-close-popup", onClick: handleClose, children: /* @__PURE__ */ jsxs21("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
11278
+ /* @__PURE__ */ jsx36("g", { clipPath: "url(#clip0_12425_52336)", children: /* @__PURE__ */ jsx36("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" }) }),
11279
+ /* @__PURE__ */ jsx36("defs", { children: /* @__PURE__ */ jsx36("clipPath", { id: "clip0_12425_52336", children: /* @__PURE__ */ jsx36("rect", { width: "16", height: "16", fill: "white" }) }) })
11280
+ ] }) }),
11281
+ /* @__PURE__ */ jsx36("div", { className: "pay-main-logo-res" }),
11282
+ /* @__PURE__ */ jsxs21("div", { className: onSubmit ? "pay-container frac-pay-container " : "pay-container", children: [
11283
+ !onSubmit && /* @__PURE__ */ jsxs21("div", { className: "pay-header pay-conatiner-one", children: [
11284
+ /* @__PURE__ */ jsxs21("div", { className: "pay-conatiner-one-first", children: [
11285
+ /* @__PURE__ */ jsxs21("div", { className: "pay-logo-container", children: [
11286
+ /* @__PURE__ */ jsx36("div", { className: "pay-main-logo" }),
11287
+ /* @__PURE__ */ jsx36("h1", { className: "pay-heading", children: "Pay" }),
11288
+ (cardList == null ? void 0 : cardList.length) > 0 && activetab !== "cardList" && /* @__PURE__ */ jsxs21("button", { className: "res-charge-payment-back-btn ", onClick: () => setActive("cardList"), children: [
11289
+ " ",
11290
+ /* @__PURE__ */ jsx36(IoArrowBack4, {}),
11291
+ " Back"
11292
+ ] })
11293
+ ] }),
11294
+ /* @__PURE__ */ jsx36("div", { className: "amt-pay-con", children: /* @__PURE__ */ jsxs21("div", { className: "pay-amount-conatiner", children: [
11295
+ /* @__PURE__ */ jsx36("small", { className: "pay-payment-amount", children: "Select payment type" }),
11296
+ /* @__PURE__ */ jsxs21("div", { className: "frac-card-bank-radio-main", children: [
11297
+ /* @__PURE__ */ jsx36(CardBankRadio, { label: "Card", amount: (_a = Number(amount)) == null ? void 0 : _a.toFixed(2), value: "card", onChange: handletabchange, activetab }),
11298
+ !isPreAuth && isBankActive && !isPartial && /* @__PURE__ */ jsx36(CardBankRadio, { label: "Bank", amount: (_b = Number(bankAmount)) == null ? void 0 : _b.toFixed(2), value: "ach", onChange: handletabchange, activetab, savingsText: bankSavingsText })
11299
+ ] }),
11300
+ isPartial && /* @__PURE__ */ jsxs21("div", { className: "frac-partial-payment-input", children: [
11301
+ /* @__PURE__ */ jsx36("label", { htmlFor: "partialpayment", children: "Partial Payment" }),
11302
+ /* @__PURE__ */ jsx36(
11303
+ NumericFormat2,
11304
+ {
11305
+ prefix: "$",
11306
+ className: "form-control-frac",
11307
+ value: partialAmount,
11308
+ onValueChange: (values) => {
11309
+ handlePartialChange(values);
11310
+ },
11311
+ thousandSeparator: true,
11312
+ placeholder: "Enter partial amount",
11313
+ allowNegative: false,
11314
+ allowLeadingZeros: false,
11315
+ decimalScale: 2,
11316
+ fixedDecimalScale: true,
11317
+ isAllowed: (values) => {
11318
+ const { floatValue = 0, value } = values;
11319
+ if (value === "") return true;
11320
+ if (value === "0" || value.startsWith("0.")) return true;
11321
+ if (floatValue === 0) return false;
11322
+ return floatValue > 0;
11323
+ }
11324
+ }
11325
+ ),
11326
+ partialError && /* @__PURE__ */ jsx36("span", { className: "error-span", children: partialError })
11327
+ ] })
11328
+ ] }) })
11329
+ ] }),
11330
+ /* @__PURE__ */ jsxs21("div", { className: "pay-conatiner-one-last", children: [
11331
+ /* @__PURE__ */ jsx36("img", { src: secure2, alt: "" }),
11332
+ /* @__PURE__ */ jsx36("img", { src: pov2, alt: "" }),
11333
+ "Secure payments powered by Fractal"
11334
+ ] })
11335
+ ] }),
11336
+ /* @__PURE__ */ jsx36("div", { className: "pay-tab pay-conatiner-two", children: /* @__PURE__ */ jsx36("div", { className: "col-md-12", children: /* @__PURE__ */ jsxs21("div", { id: "payment-form-div ", className: onSubmit ? "frac-payment-form-div" : "", children: [
11337
+ onSubmit && /* @__PURE__ */ jsx36("div", { className: "amt-pay-con", children: /* @__PURE__ */ jsxs21("div", { className: "pay-amount-conatiner", children: [
11338
+ /* @__PURE__ */ jsxs21("div", { className: "frac-card-bank-radio-main", children: [
11339
+ /* @__PURE__ */ jsx36(CardBankRadio, { skydesign: true, label: "Card", amount: (_c = Number(amount)) == null ? void 0 : _c.toFixed(2), value: "card", onChange: handletabchange, activetab }),
11340
+ !isPreAuth && isBankActive && !isPartial && /* @__PURE__ */ jsx36(CardBankRadio, { skydesign: true, label: "Bank", amount: (_d = Number(bankAmount)) == null ? void 0 : _d.toFixed(2), value: "ach", onChange: handletabchange, activetab, savingsText: bankSavingsText })
11341
+ ] }),
11342
+ isPartial && /* @__PURE__ */ jsxs21("div", { className: "frac-partial-payment-input", children: [
11343
+ /* @__PURE__ */ jsx36("label", { htmlFor: "partialpayment", children: "Partial Payment" }),
11344
+ /* @__PURE__ */ jsx36(
11345
+ NumericFormat2,
11346
+ {
11347
+ prefix: "$",
11348
+ className: "form-control-frac",
11349
+ value: partialAmount,
11350
+ onValueChange: (values) => {
11351
+ handlePartialChange(values);
11352
+ },
11353
+ thousandSeparator: true,
11354
+ placeholder: "Enter partial amount",
11355
+ allowNegative: false,
11356
+ allowLeadingZeros: false,
11357
+ decimalScale: 2,
11358
+ fixedDecimalScale: true
11359
+ }
11360
+ ),
11361
+ partialError && /* @__PURE__ */ jsx36("span", { className: "error-span", children: partialError })
11362
+ ] })
11363
+ ] }) }),
11364
+ is3DSEnable ? clientSecret && /* @__PURE__ */ jsx36(CheckoutWrapper, { onSuccess, clientSecret, amount, showLoader, hideLoader, callback, session_token, handleClose, setError, isPreAuth }) : /* @__PURE__ */ jsxs21(Fragment20, { children: [
11365
+ /* @__PURE__ */ jsxs21("div", { id: "ach", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent", children: [
11366
+ !onSubmit && /* @__PURE__ */ jsxs21(Fragment20, { children: [
11367
+ /* @__PURE__ */ jsxs21("div", { className: "frac-heading-card-wrap", children: [
11368
+ /* @__PURE__ */ jsx36("div", { className: "frac-backarrow", children: (cardList == null ? void 0 : cardList.length) > 0 && activeinCard === "form" && /* @__PURE__ */ jsxs21("button", { className: "charge-payment-back-btn ", onClick: () => setActiveinCard("list"), children: [
11369
+ " ",
11370
+ /* @__PURE__ */ jsx36(IoArrowBack4, {})
11371
+ ] }) }),
11372
+ /* @__PURE__ */ jsx36("h6", { className: "frac-card-payment-heading", children: "Card Payment" })
11373
+ ] }),
11374
+ /* @__PURE__ */ jsxs21("div", { style: { display: "flex", gap: "8px", margin: "8px 0px 19px 0px" }, children: [
11375
+ /* @__PURE__ */ jsx36("img", { src: visa2, alt: "", width: 33 }),
11376
+ /* @__PURE__ */ jsx36("img", { src: mastercard2, width: 33, alt: "" }),
11377
+ /* @__PURE__ */ jsx36("img", { src: americanexp2, alt: "", width: 33 }),
11378
+ /* @__PURE__ */ jsx36("img", { src: discover2, width: 33, alt: "" })
11379
+ ] })
11380
+ ] }),
11381
+ activeinCard === "list" && (cardList == null ? void 0 : cardList.length) > 0 ? /* @__PURE__ */ jsxs21(Fragment20, { children: [
11382
+ /* @__PURE__ */ jsx36(CardList, { headingClass: "card-ach-heading-frac", listHeading: "Card", ListItems: cardList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Card", otherButtonAction: () => {
11383
+ setActiveinCard("form");
11384
+ } }),
11385
+ /* @__PURE__ */ jsx36("div", { className: "form-group-frac", style: { padding: "0", display: onSubmit ? "none" : "block" }, children: /* @__PURE__ */ jsx36("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer, children: partialAmount ? formatUSD((_e = Number(partialAmount)) == null ? void 0 : _e.toFixed(2)) : formatUSD((_f = Number(amount)) == null ? void 0 : _f.toFixed(2)) }) })
11386
+ ] }) : paymentGateway == 32 ? /* @__PURE__ */ jsxs21(Fragment20, { children: [
11387
+ /* @__PURE__ */ jsx36(
11388
+ ApplePayButton,
11389
+ {
11390
+ applePayAmount: partialAmount ? partialAmount : amount,
11391
+ applePayMerchantId,
11392
+ applePayMerchantName: merchantName,
11393
+ completeFractalFlow,
11394
+ showLoader
11395
+ }
11396
+ ),
11397
+ /* @__PURE__ */ jsx36(
11398
+ GooglePayComponent,
11399
+ {
11400
+ amount: partialAmount ? partialAmount : amount,
11401
+ googlePayEnvironment,
11402
+ googlePayGatewayMerchantId,
11403
+ googlePayMerchantId,
11404
+ googlePayMerchantName: merchantName,
11405
+ completeFractalFlow,
11406
+ setLoading
11407
+ }
11408
+ ),
11409
+ /* @__PURE__ */ jsx36("div", { id: "digital-wallet-or", className: "frac-or", children: /* @__PURE__ */ jsx36("span", { children: "or" }) }),
11410
+ /* @__PURE__ */ jsxs21("form", { id: "paymentForm", style: { textAlign: "start" }, ref: cardFormRef, onSubmit: submitFunc, onKeyDown: (e) => {
11411
+ if (e.key === "Enter" && loading) {
11412
+ e.preventDefault();
11413
+ e.stopPropagation();
11414
+ }
11415
+ }, children: [
11416
+ /* @__PURE__ */ jsxs21("div", { className: "ach-scrl", style: { minHeight: "398px", maxHeight: "398px", overflow: "auto", marginRight: "5px" }, children: [
11417
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11418
+ /* @__PURE__ */ jsx36("label", { htmlFor: "cardHolderName", children: "NAME ON CARD " }),
11419
+ /* @__PURE__ */ jsx36("input", { type: "text", className: "form-control-frac", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
11420
+ const value = e.target.value;
11421
+ if (/^[a-zA-Z\s]*$/.test(value)) {
11422
+ handleCardChange("cardName", value);
11423
+ }
11424
+ } }),
11425
+ (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardName })
11426
+ ] }),
11427
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11428
+ /* @__PURE__ */ jsx36("label", { htmlFor: "cardNumber", children: "CARD NUMBER" }),
11429
+ /* @__PURE__ */ jsx36("div", { className: "toggle-num-wrapper toggle-num-wrapper-new", children: (show || autoTrigger) && paymentGateway === 32 && /* @__PURE__ */ jsx36(
11430
+ FractalFields_default,
11431
+ {
11432
+ fractalStyles,
11433
+ tokenizerRef,
11434
+ isSky: true
11435
+ }
11436
+ ) })
11437
+ ] }),
11438
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11439
+ /* @__PURE__ */ jsx36("label", { htmlFor: "zip", children: "ZIP" }),
11440
+ /* @__PURE__ */ jsx36("input", { type: "text", className: "form-control-frac", maxLength: 100, placeholder: "000000", value: (_g = cardData == null ? void 0 : cardData.zipCode) != null ? _g : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }),
11441
+ (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: cardError == null ? void 0 : cardError.zipCode }),
11442
+ pass_fee && cardFeeAmount > 0 && /* @__PURE__ */ jsxs21("small", { className: "frac-fee-text", children: [
11443
+ "Credit cards include a fee amount of ",
11444
+ /* @__PURE__ */ jsx36("span", { className: "frac-fee-amount", children: formatUSD(cardFeeAmount.toFixed(2)) }),
11445
+ "."
11446
+ ] })
11447
+ ] }),
11448
+ customerId && /* @__PURE__ */ jsx36("div", { className: "form-group-frac", children: /* @__PURE__ */ jsxs21("div", { className: "frac-tooltip-mn", style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" }, children: [
11449
+ /* @__PURE__ */ jsx36(
11450
+ "input",
11451
+ {
11452
+ type: "checkbox",
11453
+ id: "save_card",
11454
+ className: "toggle-checkbox",
11455
+ checked: saveCardInfo,
11456
+ onChange: (e) => setSaveCardInfo(e.target.checked)
11457
+ }
11458
+ ),
11459
+ /* @__PURE__ */ jsx36("label", { htmlFor: "save_card", className: "toggle-label" }),
11460
+ /* @__PURE__ */ jsx36("label", { htmlFor: "save_card", children: "Save card for future payments " }),
11461
+ /* @__PURE__ */ jsxs21("div", { className: "frac-tooltip-wrapper", children: [
11462
+ /* @__PURE__ */ jsx36("div", { className: "frac-tooltip-icon", children: /* @__PURE__ */ jsxs21(
11463
+ "svg",
11464
+ {
11465
+ xmlns: "http://www.w3.org/2000/svg",
11466
+ width: "20",
11467
+ height: "20",
11468
+ viewBox: "0 0 20 20",
11469
+ fill: "none",
11470
+ children: [
11471
+ /* @__PURE__ */ jsx36("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }),
11472
+ /* @__PURE__ */ jsx36(
11473
+ "path",
11474
+ {
11475
+ 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",
11476
+ fill: "#161616"
11477
+ }
11478
+ )
11479
+ ]
11480
+ }
11481
+ ) }),
11482
+ /* @__PURE__ */ jsx36("div", { className: "frac-tooltip-text", children: /* @__PURE__ */ jsxs21("p", { children: [
11483
+ "If checked, I agree to give the ",
11484
+ /* @__PURE__ */ jsx36("b", { children: merchantName || "merchant" }),
11485
+ " permission to charge this credit card for agreed-upon purchases in the future."
11486
+ ] }) })
11487
+ ] })
11488
+ ] }) })
11489
+ ] }),
11490
+ /* @__PURE__ */ jsx36("div", { className: "form-group-frac", style: { marginTop: "20px", padding: "0" }, children: /* @__PURE__ */ jsx36("button", { type: "submit", style: { margin: 0, display: onSubmit ? "none" : "block" }, className: "pay-button", children: partialAmount ? formatUSD((_h = Number(partialAmount)) == null ? void 0 : _h.toFixed(2)) : formatUSD((_i = Number(amount)) == null ? void 0 : _i.toFixed(2)) }) })
11491
+ ] })
11492
+ ] }) : /* @__PURE__ */ jsxs21("form", { id: "PaymentForm", style: { textAlign: "start" }, ref: cardFormRef, onSubmit: submitFunc, onKeyDown: (e) => {
11493
+ if (e.key === "Enter" && loading) {
11494
+ e.preventDefault();
11495
+ e.stopPropagation();
11496
+ }
11497
+ }, children: [
11498
+ /* @__PURE__ */ jsxs21("div", { className: "ach-scrl", style: { minHeight: "398px", maxHeight: "398px", overflow: "auto", marginRight: "5px" }, children: [
11499
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11500
+ /* @__PURE__ */ jsx36("label", { htmlFor: "cardHolderName", children: "NAME ON CARD " }),
11501
+ /* @__PURE__ */ jsx36("input", { type: "text", className: "form-control-frac", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
11502
+ const value = e.target.value;
11503
+ if (/^[a-zA-Z\s]*$/.test(value)) {
11504
+ handleCardChange("cardName", value);
11505
+ }
11506
+ } }),
11507
+ (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardName })
11508
+ ] }),
11509
+ /* @__PURE__ */ jsx36("div", { className: "form-group-frac", children: /* @__PURE__ */ jsx36(
11510
+ DataCapFields,
11511
+ {
11512
+ isOpen: show || autoTrigger,
11513
+ tokenKey: dcToken,
11514
+ setLoader: activeinCard === "form" ? setLoadingIframe : null,
11515
+ isEmbedded: onSubmit ? true : false
11516
+ }
11517
+ ) }),
11518
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11519
+ /* @__PURE__ */ jsx36("label", { htmlFor: "zip", children: "ZIP" }),
11520
+ /* @__PURE__ */ jsx36("input", { type: "text", className: "form-control-frac", maxLength: 100, placeholder: "000000", value: (_j = cardData == null ? void 0 : cardData.zipCode) != null ? _j : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }),
11521
+ (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: cardError == null ? void 0 : cardError.zipCode }),
11522
+ pass_fee && cardFeeAmount > 0 && /* @__PURE__ */ jsxs21("small", { className: "frac-fee-text", children: [
11523
+ "Credit cards include a fee amount of ",
11524
+ /* @__PURE__ */ jsx36("span", { className: "frac-fee-amount", children: formatUSD(cardFeeAmount.toFixed(2)) }),
11525
+ "."
11526
+ ] })
11527
+ ] }),
11528
+ customerId && /* @__PURE__ */ jsx36("div", { className: "form-group-frac", children: /* @__PURE__ */ jsxs21("div", { className: "frac-tooltip-mn", style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" }, children: [
11529
+ /* @__PURE__ */ jsx36(
11530
+ "input",
11531
+ {
11532
+ type: "checkbox",
11533
+ id: "save_card",
11534
+ className: "toggle-checkbox",
11535
+ checked: saveCardInfo,
11536
+ onChange: (e) => setSaveCardInfo(e.target.checked)
11537
+ }
11538
+ ),
11539
+ /* @__PURE__ */ jsx36("label", { htmlFor: "save_card", className: "toggle-label" }),
11540
+ /* @__PURE__ */ jsx36("label", { htmlFor: "save_card", children: "Save card for future payments " }),
11541
+ /* @__PURE__ */ jsxs21("div", { className: "frac-tooltip-wrapper", children: [
11542
+ /* @__PURE__ */ jsx36("div", { className: "frac-tooltip-icon", children: /* @__PURE__ */ jsxs21(
11543
+ "svg",
11544
+ {
11545
+ xmlns: "http://www.w3.org/2000/svg",
11546
+ width: "20",
11547
+ height: "20",
11548
+ viewBox: "0 0 20 20",
11549
+ fill: "none",
11550
+ children: [
11551
+ /* @__PURE__ */ jsx36("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }),
11552
+ /* @__PURE__ */ jsx36(
11553
+ "path",
11554
+ {
11555
+ 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",
11556
+ fill: "#161616"
11557
+ }
11558
+ )
11559
+ ]
11560
+ }
11561
+ ) }),
11562
+ /* @__PURE__ */ jsx36("div", { className: "frac-tooltip-text", children: /* @__PURE__ */ jsxs21("p", { children: [
11563
+ "If checked, I agree to give the ",
11564
+ /* @__PURE__ */ jsx36("b", { children: merchantName || "merchant" }),
11565
+ " permission to charge this credit card for agreed-upon purchases in the future."
11566
+ ] }) })
11567
+ ] })
11568
+ ] }) })
11569
+ ] }),
11570
+ /* @__PURE__ */ jsx36("div", { className: "form-group-frac", style: { marginTop: "20px", padding: "0" }, children: /* @__PURE__ */ jsx36("button", { type: "submit", style: { margin: 0, display: onSubmit ? "none" : "block" }, className: "pay-button", children: partialAmount ? formatUSD((_k = Number(partialAmount)) == null ? void 0 : _k.toFixed(2)) : formatUSD((_l = Number(amount)) == null ? void 0 : _l.toFixed(2)) }) })
11571
+ ] })
11572
+ ] }),
11573
+ /* @__PURE__ */ jsx36("div", { id: "ach", style: { display: activetab === "ach" ? "block" : "none" }, className: "tabcontent", children: /* @__PURE__ */ jsxs21(Fragment20, { children: [
11574
+ !onSubmit && /* @__PURE__ */ jsxs21("div", { className: "frac-heading-card-wrap", children: [
11575
+ /* @__PURE__ */ jsx36("div", { className: "frac-backarrow", children: (bankList == null ? void 0 : bankList.length) > 0 && activeinBank === "form" && /* @__PURE__ */ jsxs21("button", { className: "charge-payment-back-btn ", onClick: () => setActiveinBank("list"), children: [
11576
+ " ",
11577
+ /* @__PURE__ */ jsx36(IoArrowBack4, {})
11578
+ ] }) }),
11579
+ /* @__PURE__ */ jsx36("h6", { className: "frac-card-payment-heading", children: "Bank Payment" })
11580
+ ] }),
11581
+ activeinBank === "list" && (bankList == null ? void 0 : bankList.length) > 0 ? /* @__PURE__ */ jsxs21(Fragment20, { children: [
11582
+ /* @__PURE__ */ jsx36(CardList, { headingClass: "card-ach-heading-frac", listHeading: "Banks", ListItems: bankList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Bank", otherButtonAction: () => {
11583
+ setActiveinBank("form");
11584
+ } }),
11585
+ /* @__PURE__ */ jsx36("div", { className: "form-group-frac", style: { padding: "0", display: onSubmit ? "none" : "block" }, children: /* @__PURE__ */ jsx36("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer, children: formatUSD((_m = Number(bankAmount)) == null ? void 0 : _m.toFixed(2)) }) })
11586
+ ] }) : /* @__PURE__ */ jsxs21("form", { id: "ACHPaymentForm", style: { textAlign: "start" }, ref: bankFormRef, onSubmit: submitFunc, autoComplete: "off", onKeyDown: (e) => {
11587
+ if (e.key === "Enter" && loading) {
11588
+ e.preventDefault();
11589
+ e.stopPropagation();
11590
+ }
11591
+ }, children: [
11592
+ /* @__PURE__ */ jsxs21("div", { className: "ach-scrl", style: {
11593
+ minHeight: "444px",
11594
+ maxHeight: "444px"
11595
+ }, children: [
11596
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11597
+ /* @__PURE__ */ jsx36("label", { htmlFor: "nameonaccount", children: "Name on account" }),
11598
+ /* @__PURE__ */ jsx36("input", { type: "text", id: "nameonaccount", className: "form-control-frac", maxLength: 100, placeholder: "John Doe", name: "name", value: (_n = achData == null ? void 0 : achData.name) != null ? _n : "", onChange: handleChangeAch }),
11599
+ (achError == null ? void 0 : achError.name) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: achError == null ? void 0 : achError.name })
11600
+ ] }),
11601
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11602
+ /* @__PURE__ */ jsx36("label", { htmlFor: "routingnumber", children: "Routing number" }),
11603
+ /* @__PURE__ */ jsx36(
11604
+ "input",
11605
+ {
11606
+ type: "text",
11607
+ id: "routingnumber",
11608
+ className: "form-control-frac",
11609
+ maxLength: 9,
11610
+ placeholder: "000000000",
11611
+ name: "routingNumber",
11612
+ value: (_o = achData == null ? void 0 : achData.routingNumber) != null ? _o : "",
11613
+ onChange: handleChangeAch
11614
+ }
11615
+ ),
11616
+ (achError == null ? void 0 : achError.routingNumber) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: achError == null ? void 0 : achError.routingNumber })
11617
+ ] }),
11618
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11619
+ /* @__PURE__ */ jsx36("label", { htmlFor: "accountnumber", children: "Account number" }),
11620
+ /* @__PURE__ */ jsx36(
11621
+ "input",
11622
+ {
11623
+ type: "text",
11624
+ id: "accountnumber",
11625
+ className: "form-control-frac",
11626
+ maxLength: 16,
11627
+ placeholder: "0000000000",
11628
+ name: "accountNumber",
11629
+ value: (_p = achData == null ? void 0 : achData.accountNumber) != null ? _p : "",
11630
+ onChange: handleChangeAch
11631
+ }
11632
+ ),
11633
+ (achError == null ? void 0 : achError.accountNumber) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: achError == null ? void 0 : achError.accountNumber })
11634
+ ] }),
11635
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11636
+ /* @__PURE__ */ jsx36("label", { htmlFor: "confirmaccountnumber", children: "Confirm account number" }),
11637
+ /* @__PURE__ */ jsx36(
11638
+ "input",
11639
+ {
11640
+ type: "text",
11641
+ id: "confirmaccountnumber",
11642
+ className: "form-control-frac",
11643
+ maxLength: 16,
11644
+ placeholder: "0000000000",
11645
+ name: "confirmAccountNumber",
11646
+ value: (_q = achData == null ? void 0 : achData.confirmAccountNumber) != null ? _q : "",
11647
+ onChange: handleChangeAch
11648
+ }
11649
+ ),
11650
+ (achError == null ? void 0 : achError.confirmAccountNumber) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: achError == null ? void 0 : achError.confirmAccountNumber })
11651
+ ] }),
11652
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11653
+ /* @__PURE__ */ jsx36("label", { htmlFor: "bankname", children: "Bank name" }),
11654
+ /* @__PURE__ */ jsx36(
11655
+ "input",
11656
+ {
11657
+ type: "text",
11658
+ id: "bankname",
11659
+ className: "form-control-frac",
11660
+ maxLength: 100,
11661
+ placeholder: "My Bank",
11662
+ name: "bankName",
11663
+ value: (_r = achData == null ? void 0 : achData.bankName) != null ? _r : "",
11664
+ onChange: handleChangeAch
11665
+ }
11666
+ ),
11667
+ (achError == null ? void 0 : achError.bankName) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: achError == null ? void 0 : achError.bankName })
11668
+ ] }),
11669
+ ((achData == null ? void 0 : achData.accountType) === "business saving" || (achData == null ? void 0 : achData.accountType) === "business checking") && /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11670
+ /* @__PURE__ */ jsx36("label", { htmlFor: "companyName", children: "Company name" }),
11671
+ /* @__PURE__ */ jsx36(
11672
+ "input",
11673
+ {
11674
+ type: "text",
11675
+ id: "companyName",
11676
+ className: "form-control-frac",
11677
+ maxLength: 100,
11678
+ placeholder: "My Company",
11679
+ name: "companyName",
11680
+ value: (_s = achData == null ? void 0 : achData.companyName) != null ? _s : "",
11681
+ onChange: handleChangeAch
11682
+ }
11683
+ ),
11684
+ (achError == null ? void 0 : achError.companyName) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: achError == null ? void 0 : achError.companyName })
11685
+ ] }),
11686
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11687
+ /* @__PURE__ */ jsx36("label", { htmlFor: "accounttype", children: "Select account type" }),
11688
+ /* @__PURE__ */ jsxs21("select", { name: "accountType", id: "accounttype", className: "form-control-frac", value: (_t = achData == null ? void 0 : achData.accountType) != null ? _t : "", onChange: handleChangeAch, children: [
11689
+ /* @__PURE__ */ jsx36("option", { value: "", children: "Select account" }),
11690
+ accountTypes.map((type) => /* @__PURE__ */ jsx36("option", { value: type.value, children: type.label }, type.value))
11691
+ ] }),
11692
+ bankFeeAmount > 0 && /* @__PURE__ */ jsxs21("small", { className: "frac-fee-text", children: [
11693
+ "There is a processing fee of ",
11694
+ /* @__PURE__ */ jsx36("span", { className: "frac-fee-amount", children: formatUSD(bankFeeAmount.toFixed(2)) }),
11695
+ "."
11696
+ ] }),
11697
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
11698
+ /* @__PURE__ */ jsx36("input", { type: "checkbox", id: "achconsent", className: "", checked: isBankConsentChecked, onChange: (e) => {
11699
+ setIsBankConsentChecked(e.target.checked);
11700
+ if (e.target.checked) {
11701
+ setErrorBankConsent("");
11702
+ }
11703
+ } }),
11704
+ /* @__PURE__ */ jsx36("label", { className: "saveachlabel", htmlFor: "achconsent", children: `By selecting this box, I authorize SkyFi, on behalf of ${merchantName || "merchant"}, to initiate a one-time electronic ACH debit from my bank account for the total amount displayed on this screen, including any applicable processing fee. I confirm that I am authorized to use this account and that the bank account information I provided is correct.` })
11705
+ ] }),
11706
+ errorBankConsent && /* @__PURE__ */ jsx36("span", { className: "error-span", children: errorBankConsent }),
11707
+ customerId && /* @__PURE__ */ jsxs21("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
11708
+ /* @__PURE__ */ jsx36("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }),
11709
+ /* @__PURE__ */ jsx36("label", { className: "saveachlabel", htmlFor: "saveACH", children: "Save Bank" })
11710
+ ] }),
11711
+ saveACHinfo && /* @__PURE__ */ jsx36("div", { className: "form-group-frac saveachtext", children: /* @__PURE__ */ jsxs21("p", { children: [
11712
+ "If checked, I agree to give the ",
11713
+ /* @__PURE__ */ jsx36("b", { children: merchantName || "merchant" }),
11714
+ " permission to charge this bank account for agreed-upon purchases in the future."
11715
+ ] }) })
11716
+ ] })
11717
+ ] }),
11718
+ /* @__PURE__ */ jsx36("div", { className: "form-group-frac ", children: /* @__PURE__ */ jsx36("button", { className: "pay-button", style: { margin: "20px 0 0", display: onSubmit ? "none" : "block" }, type: "submit", children: formatUSD((_u = Number(bankAmount)) == null ? void 0 : _u.toFixed(2)) }) })
11719
+ ] })
11720
+ ] }) })
11721
+ ] })
11722
+ ] }) }) })
11723
+ ] })
11724
+ ] })
11725
+ ] })
11726
+ ] })
11727
+ ] });
11728
+ };
11729
+ var ModelContentSky_default = ModelContentSky;
11730
+
11731
+ // src/app/components/Skysystemz/PayButtonWithForm.tsx
11732
+ import axios10 from "axios";
11733
+ import { Fragment as Fragment21, jsx as jsx37, jsxs as jsxs22 } from "react/jsx-runtime";
11734
+ var PaymentWidget = ({
11735
+ amount,
11736
+ bankAmount,
11737
+ submitBtnText = "Pay",
11738
+ session_token,
11739
+ customerId,
11740
+ callback,
11741
+ merchantName = "merchant",
11742
+ isPreAuth,
11743
+ surcharge = "0",
11744
+ submitBtnClass,
11745
+ submitBtnIcon,
11746
+ isRequest,
11747
+ pass_fee,
11748
+ pass_fee_amount,
11749
+ require3ds = false,
11750
+ autoTrigger = false,
11751
+ isPartial,
11752
+ bankSurcharge,
11753
+ partialRef
11754
+ }) => {
11755
+ const [show, setShow] = useState12(autoTrigger || false);
11756
+ const [loading, setLoading] = useState12(false);
11757
+ const [childHandleClose, setChildHandleClose] = useState12(() => () => {
11758
+ });
11759
+ const [orderGuid, setOrderGuid] = useState12(null);
11760
+ const [remainingAmount, setRemainingAmount] = useState12(null);
11761
+ const initialCommonProps = useMemo(
11762
+ () => ({
11763
+ amount,
11764
+ bankAmount,
11765
+ submitBtnText,
11766
+ session_token,
11767
+ customerId,
11768
+ callback,
11769
+ merchantName,
11770
+ isPreAuth,
11771
+ surcharge,
11772
+ submitBtnClass,
11773
+ submitBtnIcon,
11774
+ isRequest,
11775
+ pass_fee,
11776
+ pass_fee_amount,
11777
+ require3ds,
11778
+ autoTrigger,
11779
+ setShow,
11780
+ setHandleCloseRef: setChildHandleClose,
11781
+ isPartial,
11782
+ bankSurcharge,
11783
+ partialRef
11784
+ }),
11785
+ [
11786
+ amount,
11787
+ bankAmount,
11788
+ submitBtnText,
11789
+ session_token,
11790
+ customerId,
11791
+ callback,
11792
+ merchantName,
11793
+ isPreAuth,
11794
+ surcharge,
11795
+ submitBtnClass,
11796
+ submitBtnIcon,
11797
+ isRequest,
11798
+ pass_fee,
11799
+ pass_fee_amount,
11800
+ require3ds,
11801
+ autoTrigger,
11802
+ isPartial,
11803
+ bankSurcharge,
11804
+ partialRef
11805
+ ]
11806
+ );
11807
+ const [commonProps, setCommonProps] = useState12(initialCommonProps);
11808
+ useEffect19(() => {
11809
+ if (show) {
11810
+ setCommonProps(initialCommonProps);
11811
+ }
11812
+ }, [show, initialCommonProps]);
11813
+ const getskyosOrderDetails = async () => {
11814
+ var _a;
11815
+ setLoading(true);
11816
+ try {
11817
+ const res = await axios10.get(
11818
+ `${masterBaseUrl}api/v1/gateway/get-order-details/${session_token}`,
11819
+ { params: { isPartial, partialRef } }
11820
+ );
11821
+ if ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.result) {
11822
+ const data = res.data.data;
11823
+ if (data == null ? void 0 : data.orderGuid) {
11824
+ setOrderGuid(data == null ? void 0 : data.orderGuid);
11825
+ setRemainingAmount(data == null ? void 0 : data.remainingAmount);
11826
+ }
11827
+ setCommonProps((prev) => __spreadProps(__spreadValues({}, prev), {
11828
+ amount: data.amount,
11829
+ pass_fee_amount: data.pass_fee_amount,
11830
+ pass_fee: data.pass_fee
11831
+ }));
11832
+ }
11833
+ } catch (error) {
11834
+ console.log("error while getting skyosorderdeatils", error);
11835
+ } finally {
11836
+ setLoading(false);
11837
+ }
11838
+ };
11839
+ useEffect19(() => {
11840
+ if (show && isPartial && partialRef) {
11841
+ getskyosOrderDetails();
11842
+ }
11843
+ }, [show, isPartial, partialRef]);
11844
+ return /* @__PURE__ */ jsxs22(Fragment21, { children: [
11845
+ /* @__PURE__ */ jsx37("link", { href: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" }),
11846
+ /* @__PURE__ */ jsx37(DataScript, {}),
11847
+ /* @__PURE__ */ jsx37(FractalTokenizerScript, {}),
11848
+ /* @__PURE__ */ jsx37(SkyChargewidgetstyles, {}),
11849
+ /* @__PURE__ */ jsx37(CardBankRadioStyles, {}),
11850
+ /* @__PURE__ */ jsx37(CustomModal2styles_default, {}),
11851
+ /* @__PURE__ */ jsx37(DataCapScriptLoader, {}),
11852
+ !autoTrigger && /* @__PURE__ */ jsxs22("button", { className: submitBtnClass || "paymentBtn", onClick: () => setShow(true), children: [
11853
+ submitBtnText,
11854
+ submitBtnIcon
11855
+ ] }),
11856
+ !autoTrigger ? /* @__PURE__ */ jsx37(CustomModal2_default, { open: show, onClose: childHandleClose, children: /* @__PURE__ */ jsx37(ModelContentSky_default, __spreadProps(__spreadValues({ show, loadingPrev: loading }, commonProps), { orderGuid, remainingAmount })) }) : /* @__PURE__ */ jsx37(ModelContentSky_default, __spreadProps(__spreadValues({ show, loadingPrev: loading }, commonProps), { orderGuid, remainingAmount }))
11857
+ ] });
11858
+ };
11859
+
11860
+ // src/app/components/Skysystemz/EmbeddedCheckout.tsx
11861
+ import { useEffect as useEffect21, useState as useState13, useMemo as useMemo2 } from "react";
11862
+ import axios11 from "axios";
11863
+
11864
+ // src/app/components/Skysystemz/EmbeddedCheckoutStyles.tsx
11865
+ import { jsx as jsx38 } from "react/jsx-runtime";
11866
+ function EmbeddedCheckoutStyles({ extraCustomCSS }) {
11867
+ return /* @__PURE__ */ jsx38("style", { children: `
11868
+
11869
+ .pay-amount-conatiner{
11870
+ margin-top: 20px !important;
11871
+ margin-bottom: 20px !important ;
11872
+ }
11873
+
11874
+ .frac-pay-container.pay-container {
11875
+ grid-template-columns:1fr;
11876
+ }
11877
+
11878
+
11879
+ /* Card */
11880
+ .plan-card {
11881
+ width: 100%;
11882
+ font-family: Inter, sans-serif;
11883
+ background: #fff;
11884
+ }
11885
+
11886
+ /* Header */
11887
+ .card-header {
11888
+ padding: 12px 0 0 0;
11889
+ }
11890
+
11891
+ /* Button */
11892
+ .collapse-btn {
11893
+ width: 100%;
11894
+ background: none;
11895
+ border: none;
11896
+ display: flex;
11897
+ justify-content: space-between;
11898
+ align-items: center;
11899
+ cursor: pointer;
11900
+ font-size: 15px;
11901
+ padding: 0;
11902
+ }
11903
+
11904
+ /* Arrow */
11905
+ .arrow {
11906
+ transition: transform 0.3s ease;
11907
+ height: 8px;
11908
+ }
11909
+
11910
+ /* Open State */
11911
+ .collapse-btn.open .arrow {
11912
+ transform: rotate(180deg); /* Down */
11913
+ }
11914
+
11915
+ /* Body */
11916
+ .card-body {
11917
+ padding: 0;
11918
+ }
11919
+
11920
+ /* Plan Header */
11921
+ .plan-header {
11922
+ font-size: 15px;
11923
+ font-weight: 600;
11924
+ }
11925
+
11926
+ /* Scrollable List */
11927
+ .plan-list {
11928
+ max-height: 200px;
11929
+ overflow-y: auto;
11930
+ padding-right: 6px;
11931
+ }
11932
+
11933
+ /* Items */
11934
+ .plan-item {
11935
+ display: flex;
11936
+ justify-content: space-between;
11937
+ padding: 6px 0;
11938
+ font-size: 14px;
11939
+ }
11940
+
11941
+ /* Badges */
11942
+ .badge {
11943
+ padding: 4px 10px;
11944
+ border-radius: 12px;
11945
+ font-size: 12px;
11946
+ font-weight: 500;
11947
+ }
11948
+
11949
+ .badge-included {
11950
+ background: #f1f3f5;
11951
+ color: #495057;
11952
+ }
11953
+
11954
+ .badge-available {
11955
+ background: #f8f9fa;
11956
+ color: #212529;
11957
+ }
11958
+
11959
+ /* Helpers */
11960
+ .row-between {
11961
+ display: flex;
11962
+ justify-content: space-between;
11963
+ }
11964
+
11965
+ .text-end {
11966
+ text-align: right;
11967
+ }
11968
+
11969
+ .text-muted {
11970
+ color: #6c757d;
11971
+ font-size: 12px;
11972
+ }
11973
+
11974
+ .fw-semibold {
11975
+ font-weight: 600;
11976
+ }
11977
+
11978
+ .mb-2 {
11979
+ margin-bottom: 8px;
11980
+ }
11981
+
11982
+ /* Divider */
11983
+ .divider {
11984
+ height: 1px;
11985
+ background: #e5e7eb;
11986
+ margin: 8px 0;
11987
+ }
11988
+
11989
+ /* Collapse Animation */
11990
+ .collapse {
11991
+ max-height: 0;
11992
+ overflow: hidden;
11993
+ transition: max-height 0.3s ease;
11994
+ }
11995
+
11996
+ .collapse.show {
11997
+ max-height: 1000px;
11998
+ }
11999
+ .frac-pay-container.pay-container {
12000
+ grid-template-columns:1fr;
12001
+ }
12002
+ .frac-payment-form-div .amt-pay-con {
12003
+ padding-right: 0px;
12004
+ }
12005
+ .frac-payment-form-div .ach-scrl {
12006
+ padding-right: 0px;
12007
+ gap: 10px;
12008
+ max-height: fit-content !important;
12009
+ min-height: fit-content !important;
12010
+ overflow: hidden !important;
12011
+ }
12012
+ .frac-payment-form-div .frac-card-bank-radio-main {
12013
+ display: flex;
12014
+ flex-direction: row;
12015
+ align-items: flex-start;
12016
+ align-self: stretch;
12017
+ border-radius: 14px;
12018
+ border: none;
12019
+ overflow: visible;
12020
+ gap: 10px;
12021
+ }
12022
+ .frac-payment-form-div .frac-card-bank-radio {
12023
+ display: flex;
12024
+ padding: 12px 16px;
12025
+ justify-content: space-between;
12026
+ align-items: center;
12027
+ align-self: stretch;
12028
+ width: 50%;
12029
+ border: 1px solid #E0DFE2;
12030
+ border-radius: 10px;
12031
+ box-shadow: rgba(149, 157, 165, 0.2) 0px 1px 4px;
12032
+ }
12033
+ .frac-payment-form-div .frac-card-bank-radio.frac-active {
12034
+ background: #fff;
12035
+ border: 2px solid #004eab !important;
12036
+ }
12037
+
12038
+ .frac-payment-form-div .form-control-frac {
12039
+ border: 1px solid #dee2e6 !important;
12040
+ border-radius: 0.375rem !important;
12041
+ background-color: #F6F6F7;
12042
+ box-shadow: 1px 1px 2px inset rgba(0, 0, 0, 0.1);
12043
+ }
12044
+ .frac-payment-form-div .form-control-frac:focus {
12045
+ border: 1px solid #004eab !important;
12046
+ }
12047
+ .frac-payment-form-div .card-expiry-new {
12048
+ border: none;
12049
+ gap: 10px;
12050
+ }
12051
+ .frac-payment-form-div .exp-date-year-container {
12052
+ gap: 10px;
12053
+ width: 100%;
12054
+ }
12055
+ .frac-payment-form-div .card-type-logo-wrap{
12056
+ position: absolute;
12057
+ right: 10px;
12058
+ max-width: 30px;
12059
+ }
12060
+ .detials-wrap.detials-wrap-1 {
12061
+ display: flex;
12062
+ flex-wrap: wrap;
12063
+ }
12064
+ @media screen and (max-width: 1280px) {
12065
+ .frac-pay-container.pay-container {
12066
+ grid-template-columns: 1fr;
12067
+ border: none;
12068
+ }
12069
+ }
12070
+ @media screen and (max-width: 899px) {
12071
+ .detials-wrap {
12072
+ grid-template-columns: 1fr !important;
12073
+ }
12074
+ .frac-payment-form-div .exp-date-year-container{
12075
+ width: 100%;}
12076
+
12077
+ }
12078
+ @media screen and (max-width: 575px) {
12079
+ .frac-payment-form-div .card-type-logo-wrap{
12080
+ max-width: 30px;
12081
+ }
12082
+ form#ACHPaymentForm .ach-scrl {
12083
+ grid-template-columns: 1fr !important;
12084
+ }
12085
+ @media screen and (max-width: 375px) {
12086
+ .frac-payment-form-div .exp-date-year-container {
12087
+ flex-direction: column;
12088
+ }
12089
+ .parent-pay-container {
12090
+ padding: 10px;
10517
12091
  }
10518
- }, [amount]);
10519
- const onSuccess = () => {
10520
- };
10521
- const handleSuccess = (token, intentId) => {
10522
- showLoader();
10523
- completeFractalFlow(token, intentId);
10524
- setStripeResponse(null);
10525
- };
10526
- const handleError = (status) => {
10527
- console.error("3DS Auth failed \u274C", status);
10528
- setError(`3DS Authentication ${status}`);
10529
- };
10530
- useEffect15(() => {
10531
- if (setHandleCloseRef) {
10532
- setHandleCloseRef(() => handleClose);
10533
12092
  }
10534
- }, []);
10535
- const handlePartialChange = (values) => {
10536
- var _a2, _b2;
10537
- if (((_a2 = Number(remainingAmount || remAmount)) == null ? void 0 : _a2.toFixed(2)) < (values == null ? void 0 : values.floatValue) || (values == null ? void 0 : values.floatValue) < 0) {
10538
- setPartialAmount(values == null ? void 0 : values.value);
10539
- setPartialError(`Partial amount cannot exceed ${formatUSD((_b2 = Number(remainingAmount || remAmount)) == null ? void 0 : _b2.toFixed(2))}`);
10540
- } else if ((values == null ? void 0 : values.floatValue) == 0) {
10541
- setPartialAmount(values == null ? void 0 : values.value);
10542
- setPartialError("Partial amount must be greater than 0");
12093
+ }
12094
+ .box-inner-card-text{
12095
+ display: flex;
12096
+ gap: 0px;
12097
+ flex-direction: column;
12098
+ }
12099
+ .box-inner-card-text .frac-payment-type-logo {
12100
+ width: 17px;
12101
+ height: 17px;
12102
+ aspect-ratio: 1/1;
12103
+ }
12104
+ .exp-date-year-wrap.form-control-frac input {
12105
+ background: transparent;
12106
+ border: none;
12107
+ outline: none;
12108
+ font-size: 1rem;
12109
+ font-weight: 400;
12110
+ }
12111
+ .exp-date-year-wrap.form-control-frac {
12112
+ display: flex;
12113
+ gap: 2px;
12114
+ }
12115
+ .exp-date-year-wrap input.exp-month {
12116
+ width: 32px;
12117
+ }
12118
+ .detials-wrap {
12119
+ display: grid;
12120
+ grid-template-columns: 1fr 1fr;
12121
+ gap: 10px;
12122
+ }
12123
+ .detials-wrap.detials-wrap-2{
12124
+ grid-template-columns: 1fr 1fr;
12125
+ }
12126
+ form#ACHPaymentForm .ach-scrl {
12127
+ display: grid;
12128
+ grid-gap: 0px 10px;
12129
+ grid-template-columns: 1fr;
12130
+ }
12131
+ .plan-list {
12132
+ max-height: 130px;
12133
+ min-height: 130px;
12134
+ overflow-y: auto;
12135
+ padding-right: 6px;
12136
+ }
12137
+ .plan-list::-webkit-scrollbar {
12138
+ width: 3px;
12139
+ background-color: #F5F5F5;
12140
+ }
12141
+ .plan-list::-webkit-scrollbar-thumb {
12142
+ background-color: #35254D;
12143
+ }
12144
+ div#cvv {
12145
+ border-top-left-radius: 0;
12146
+ border-bottom-left-radius: 0;
12147
+ border-top: 0;
12148
+ border-bottom: 0;
12149
+ border-right: 0;
12150
+ }
12151
+ div#exp_year {
12152
+ height: 36px;
12153
+ width: calc(100% + 1px);
12154
+ border-radius: 0;
12155
+ border-top: 0;
12156
+ border-bottom: 0;
12157
+ border-right: 1px solid #dee2e6;
12158
+ }
12159
+ div#exp_month {
12160
+ width: calc(100% + 1px);
12161
+ border-top-right-radius: 0;
12162
+ border-bottom-right-radius: 0;
12163
+ border: 0;
12164
+ border-right: 1px solid #dee2e6;
12165
+ }
12166
+ .exp-date-year-container .form-group {
12167
+ flex: 1;
12168
+ }
12169
+ .input-main-wrap-frac{
12170
+ margin:0px !important;
12171
+ padding:0px !important;
12172
+ }
12173
+ .toggle-num-wrapper.toggle-num-wrapper-new {
12174
+ border: 1px solid #dee2e6 !important;
12175
+ border-radius: 0.375rem !important;
12176
+ background-color: #F6F6F7;
12177
+ box-shadow: 1px 1px 2px inset rgba(0, 0, 0, 0.1);
12178
+ }
12179
+ .toggle-num-wrapper-new div#card_number {
12180
+ padding: 0px 10px;
12181
+ border: none;
12182
+ border-bottom: 1px solid #dee2e6;
12183
+ }
12184
+ .toggle-num-wrapper-new .card-crdi.card-expiry-new {
12185
+ padding: 0px 10px;
12186
+ }
12187
+ .toggle-num-wrapper-new .input-main-wrap-frac {
12188
+ height: 36px;
12189
+ }
12190
+ .toggle-num-wrapper-new:focus {
12191
+ border: 1px solid #004eab !important;
12192
+ }
12193
+ .frac-card-title-main {
12194
+ display: flex;
12195
+ align-items: start;
12196
+ gap: 4px;
12197
+ flex-direction: column;
12198
+ }
12199
+ .parent-pay-container {
12200
+ padding: 24px;
12201
+ background-color: #ffffff !important;
12202
+ border-radius: 15px;
12203
+ min-width: 300px;
12204
+ }
12205
+
12206
+
12207
+ ${extraCustomCSS}
12208
+
12209
+ ` });
12210
+ }
12211
+
12212
+ // src/app/components/Atoms/Applepay/ApplePayScriptLoader.tsx
12213
+ import { useEffect as useEffect20 } from "react";
12214
+ var applePayScriptLoaded = false;
12215
+ var ApplePayScriptLoader = () => {
12216
+ useEffect20(() => {
12217
+ if (applePayScriptLoaded) return;
12218
+ const existingScript = document.querySelector(
12219
+ `script[src="https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js"]`
12220
+ );
12221
+ if (!existingScript) {
12222
+ const script2 = document.createElement("script");
12223
+ script2.src = "https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js";
12224
+ script2.async = true;
12225
+ script2.onload = () => {
12226
+ console.log("\u2705 Apple Pay script loaded");
12227
+ applePayScriptLoaded = true;
12228
+ console.log("ApplePaySession:", window.ApplePaySession);
12229
+ };
12230
+ script2.onerror = (err) => {
12231
+ console.error("\u274C Apple Pay script failed", err);
12232
+ };
12233
+ document.head.appendChild(script2);
10543
12234
  } else {
10544
- setPartialAmount(values == null ? void 0 : values.value);
10545
- setPartialError("");
12235
+ applePayScriptLoaded = true;
10546
12236
  }
10547
- };
10548
- useEffect15(() => {
10549
- if (typeof FractalTokenizer === "undefined") return;
10550
- const tokenizer = new FractalTokenizer({
10551
- styles: {}
10552
- });
10553
12237
  }, []);
10554
- console.log(activeinCard === "list", "activeinCard", activeList);
10555
- return /* @__PURE__ */ jsxs19(Fragment18, { children: [
10556
- initialLoader && /* @__PURE__ */ jsx32(Loader_default, { loading: initialLoader }),
10557
- error && /* @__PURE__ */ jsx32("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx32(ErrorCardMessage_default, { error, onClose: handleClose }) }),
10558
- errorIframe && /* @__PURE__ */ jsx32("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx32(ErrorCardMessage_default, { error: errorIframe, onClose: () => {
10559
- setErrorIframe("");
10560
- } }) }),
10561
- !error && !errorIframe && /* @__PURE__ */ jsxs19(Fragment18, { children: [
10562
- (loading || loading2 || loadingIframe) && /* @__PURE__ */ jsx32(Loader_default, { loading: loading || loading2 || loadingPrev || orderLoader || loadingIframe }),
10563
- /* @__PURE__ */ jsxs19("div", { className: "frac-card-payment-page frac-form frac-new-form", children: [
10564
- /* @__PURE__ */ jsx32("div", { ref: threeDSContainerRef, style: { width: "100%", height: "100%" } }),
10565
- (stripeResponse == null ? void 0 : stripeResponse.challenge_url) ? /* @__PURE__ */ jsx32(
10566
- ThreeDSChallenge,
10567
- {
10568
- containerRef: threeDSContainerRef,
10569
- challengeUrl: stripeResponse.challenge_url,
10570
- fractalToken: stripeResponse.fractalToken,
10571
- stripeIntentId: stripeResponse.id,
10572
- onSuccess: handleSuccess,
10573
- onError: handleError
10574
- }
10575
- ) : /* @__PURE__ */ jsxs19("div", { className: "parent-pay-container", children: [
10576
- /* @__PURE__ */ jsx32("span", { style: { display: autoTrigger ? "none" : "block" }, className: "request-payment-close-popup", onClick: handleClose, children: /* @__PURE__ */ jsxs19("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
10577
- /* @__PURE__ */ jsx32("g", { clipPath: "url(#clip0_12425_52336)", children: /* @__PURE__ */ jsx32("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" }) }),
10578
- /* @__PURE__ */ jsx32("defs", { children: /* @__PURE__ */ jsx32("clipPath", { id: "clip0_12425_52336", children: /* @__PURE__ */ jsx32("rect", { width: "16", height: "16", fill: "white" }) }) })
10579
- ] }) }),
10580
- /* @__PURE__ */ jsx32("div", { className: "pay-main-logo-res" }),
10581
- /* @__PURE__ */ jsxs19("div", { className: "pay-container", children: [
10582
- /* @__PURE__ */ jsxs19("div", { className: "pay-header pay-conatiner-one", children: [
10583
- /* @__PURE__ */ jsxs19("div", { className: "pay-conatiner-one-first", children: [
10584
- /* @__PURE__ */ jsxs19("div", { className: "pay-logo-container", children: [
10585
- /* @__PURE__ */ jsx32("div", { className: "pay-main-logo" }),
10586
- /* @__PURE__ */ jsx32("h1", { className: "pay-heading", children: "Pay" }),
10587
- (cardList == null ? void 0 : cardList.length) > 0 && activetab !== "cardList" && /* @__PURE__ */ jsxs19("button", { className: "res-charge-payment-back-btn ", onClick: () => setActive("cardList"), children: [
10588
- " ",
10589
- /* @__PURE__ */ jsx32(IoArrowBack4, {}),
10590
- " Back"
10591
- ] })
10592
- ] }),
10593
- /* @__PURE__ */ jsx32("div", { className: "amt-pay-con", children: /* @__PURE__ */ jsxs19("div", { className: "pay-amount-conatiner", children: [
10594
- /* @__PURE__ */ jsx32("small", { className: "pay-payment-amount", children: "Select payment type" }),
10595
- /* @__PURE__ */ jsxs19("div", { className: "frac-card-bank-radio-main", children: [
10596
- /* @__PURE__ */ jsx32(CardBankRadio, { label: "Card", amount: (_a = Number(amount)) == null ? void 0 : _a.toFixed(2), value: "card", onChange: handletabchange, activetab }),
10597
- !isPreAuth && isBankActive && !isPartial && /* @__PURE__ */ jsx32(CardBankRadio, { label: "Bank", amount: (_b = Number(bankAmount)) == null ? void 0 : _b.toFixed(2), value: "ach", onChange: handletabchange, activetab })
10598
- ] }),
10599
- pass_fee && activetab === "card" && cashDiscount && Number(amount) - Number(cashDiscount) > 0 ? /* @__PURE__ */ jsxs19("div", { className: "frac-cash-discount-fee", children: [
10600
- /* @__PURE__ */ jsxs19("small", { children: [
10601
- activetab === "card" ? "Cash Discount" : "Cash Discount Savings",
10602
- " "
10603
- ] }),
10604
- /* @__PURE__ */ jsx32("p", { children: formatUSD((Number(amount) - Number(cashDiscount)).toFixed(2)) })
10605
- ] }) : null,
10606
- isPartial && /* @__PURE__ */ jsxs19("div", { className: "frac-partial-payment-input", children: [
10607
- /* @__PURE__ */ jsx32("label", { htmlFor: "partialpayment", children: "Partial Payment" }),
10608
- /* @__PURE__ */ jsx32(
10609
- NumericFormat2,
10610
- {
10611
- prefix: "$",
10612
- className: "form-control-frac",
10613
- value: partialAmount,
10614
- onValueChange: (values) => {
10615
- handlePartialChange(values);
10616
- },
10617
- thousandSeparator: true,
10618
- placeholder: "Enter partial amount",
10619
- allowNegative: false,
10620
- allowLeadingZeros: false,
10621
- decimalScale: 2,
10622
- fixedDecimalScale: true,
10623
- isAllowed: (values) => {
10624
- const { floatValue = 0, value } = values;
10625
- if (value === "") return true;
10626
- if (value === "0" || value.startsWith("0.")) return true;
10627
- if (floatValue === 0) return false;
10628
- return floatValue > 0;
10629
- }
10630
- }
10631
- ),
10632
- partialError && /* @__PURE__ */ jsx32("span", { className: "error-span", children: partialError })
10633
- ] })
10634
- ] }) })
10635
- ] }),
10636
- /* @__PURE__ */ jsxs19("div", { className: "pay-conatiner-one-last", children: [
10637
- /* @__PURE__ */ jsx32("img", { src: secure2, alt: "" }),
10638
- /* @__PURE__ */ jsx32("img", { src: pov2, alt: "" }),
10639
- "Secure payments powered by Fractal"
10640
- ] })
10641
- ] }),
10642
- /* @__PURE__ */ jsx32("div", { className: "pay-tab pay-conatiner-two", children: /* @__PURE__ */ jsx32("div", { className: "col-md-12", children: /* @__PURE__ */ jsx32("div", { id: "payment-form-div", children: is3DSEnable ? clientSecret && /* @__PURE__ */ jsx32(CheckoutWrapper, { onSuccess, clientSecret, amount, showLoader, hideLoader, callback, session_token, handleClose, setError, isPreAuth }) : /* @__PURE__ */ jsxs19(Fragment18, { children: [
10643
- /* @__PURE__ */ jsxs19("div", { id: "ach", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent", children: [
10644
- /* @__PURE__ */ jsxs19("div", { className: "frac-heading-card-wrap", children: [
10645
- /* @__PURE__ */ jsx32("div", { className: "frac-backarrow", children: (cardList == null ? void 0 : cardList.length) > 0 && activeinCard === "form" && /* @__PURE__ */ jsxs19("button", { className: "charge-payment-back-btn ", onClick: () => setActiveinCard("list"), children: [
10646
- " ",
10647
- /* @__PURE__ */ jsx32(IoArrowBack4, {})
10648
- ] }) }),
10649
- /* @__PURE__ */ jsx32("h6", { className: "frac-card-payment-heading", children: "Card Payment" })
10650
- ] }),
10651
- /* @__PURE__ */ jsxs19("div", { style: { display: "flex", gap: "8px", margin: "8px 0px 19px 0px" }, children: [
10652
- /* @__PURE__ */ jsx32("img", { src: visa2, alt: "", width: 33 }),
10653
- /* @__PURE__ */ jsx32("img", { src: mastercard2, width: 33, alt: "" }),
10654
- /* @__PURE__ */ jsx32("img", { src: americanexp2, alt: "", width: 33 }),
10655
- /* @__PURE__ */ jsx32("img", { src: discover2, width: 33, alt: "" })
10656
- ] }),
10657
- activeinCard === "list" && (cardList == null ? void 0 : cardList.length) > 0 ? /* @__PURE__ */ jsxs19(Fragment18, { children: [
10658
- /* @__PURE__ */ jsx32(CardList, { headingClass: "card-ach-heading-frac", listHeading: "Card", ListItems: cardList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Card", otherButtonAction: () => {
10659
- setActiveinCard("form");
10660
- } }),
10661
- /* @__PURE__ */ jsx32("div", { className: "form-group-frac", style: { padding: "0" }, children: /* @__PURE__ */ jsx32("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer, children: partialAmount ? formatUSD((_c = Number(partialAmount)) == null ? void 0 : _c.toFixed(2)) : formatUSD((_d = Number(amount)) == null ? void 0 : _d.toFixed(2)) }) })
10662
- ] }) : paymentGateway == 32 ? /* @__PURE__ */ jsxs19("form", { id: "paymentForm", style: { textAlign: "start" }, onSubmit: submitFunc, onKeyDown: (e) => {
10663
- if (e.key === "Enter" && loading) {
10664
- e.preventDefault();
10665
- e.stopPropagation();
10666
- }
10667
- }, children: [
10668
- /* @__PURE__ */ jsxs19("div", { className: "ach-scrl", style: { minHeight: "398px", maxHeight: "398px", overflow: "auto", marginRight: "5px" }, children: [
10669
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10670
- /* @__PURE__ */ jsx32("label", { htmlFor: "cardHolderName", children: "NAME ON CARD " }),
10671
- /* @__PURE__ */ jsx32("input", { type: "text", className: "form-control-frac", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
10672
- const value = e.target.value;
10673
- if (/^[a-zA-Z\s]*$/.test(value)) {
10674
- handleCardChange("cardName", value);
10675
- }
10676
- } }),
10677
- (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardName })
10678
- ] }),
10679
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10680
- /* @__PURE__ */ jsx32("label", { htmlFor: "cardNumber", children: "CARD NUMBER" }),
10681
- /* @__PURE__ */ jsx32("div", { className: "toggle-num-wrapper", children: (show || autoTrigger) && paymentGateway === 32 && /* @__PURE__ */ jsx32(
10682
- FractalFields_default,
10683
- {
10684
- fractalStyles,
10685
- tokenizerRef,
10686
- isSky: true
10687
- }
10688
- ) })
10689
- ] }),
10690
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10691
- /* @__PURE__ */ jsx32("label", { htmlFor: "zip", children: "ZIP" }),
10692
- /* @__PURE__ */ jsx32("input", { type: "text", className: "form-control-frac", maxLength: 100, placeholder: "000000", value: (_e = cardData == null ? void 0 : cardData.zipCode) != null ? _e : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }),
10693
- (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: cardError == null ? void 0 : cardError.zipCode })
10694
- ] }),
10695
- customerId && /* @__PURE__ */ jsx32("div", { className: "form-group-frac", children: /* @__PURE__ */ jsxs19("div", { className: "frac-tooltip-mn", style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" }, children: [
10696
- /* @__PURE__ */ jsx32(
10697
- "input",
10698
- {
10699
- type: "checkbox",
10700
- id: "save_card",
10701
- className: "toggle-checkbox",
10702
- checked: saveCardInfo,
10703
- onChange: (e) => setSaveCardInfo(e.target.checked)
10704
- }
10705
- ),
10706
- /* @__PURE__ */ jsx32("label", { htmlFor: "save_card", className: "toggle-label" }),
10707
- /* @__PURE__ */ jsx32("label", { htmlFor: "save_card", children: "Save card for future payments " }),
10708
- /* @__PURE__ */ jsxs19("div", { className: "frac-tooltip-wrapper", children: [
10709
- /* @__PURE__ */ jsx32("div", { className: "frac-tooltip-icon", children: /* @__PURE__ */ jsxs19(
10710
- "svg",
10711
- {
10712
- xmlns: "http://www.w3.org/2000/svg",
10713
- width: "20",
10714
- height: "20",
10715
- viewBox: "0 0 20 20",
10716
- fill: "none",
10717
- children: [
10718
- /* @__PURE__ */ jsx32("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }),
10719
- /* @__PURE__ */ jsx32(
10720
- "path",
10721
- {
10722
- 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",
10723
- fill: "#161616"
10724
- }
10725
- )
10726
- ]
10727
- }
10728
- ) }),
10729
- /* @__PURE__ */ jsx32("div", { className: "frac-tooltip-text", children: /* @__PURE__ */ jsxs19("p", { children: [
10730
- "If checked, I agree to give the ",
10731
- /* @__PURE__ */ jsx32("b", { children: merchantName || "merchant" }),
10732
- " permission to charge this credit card for agreed-upon purchases in the future."
10733
- ] }) })
10734
- ] })
10735
- ] }) })
10736
- ] }),
10737
- /* @__PURE__ */ jsx32("div", { className: "form-group-frac", style: { marginTop: "20px", padding: "0" }, children: /* @__PURE__ */ jsx32("button", { type: "submit", style: { margin: 0 }, className: "pay-button", children: partialAmount ? formatUSD((_f = Number(partialAmount)) == null ? void 0 : _f.toFixed(2)) : formatUSD((_g = Number(amount)) == null ? void 0 : _g.toFixed(2)) }) })
10738
- ] }) : /* @__PURE__ */ jsxs19("form", { id: "PaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc, onKeyDown: (e) => {
10739
- if (e.key === "Enter" && loading) {
10740
- e.preventDefault();
10741
- e.stopPropagation();
10742
- }
10743
- }, children: [
10744
- /* @__PURE__ */ jsxs19("div", { className: "ach-scrl", style: { minHeight: "398px", maxHeight: "398px", overflow: "auto", marginRight: "5px" }, children: [
10745
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10746
- /* @__PURE__ */ jsx32("label", { htmlFor: "cardHolderName", children: "NAME ON CARD " }),
10747
- /* @__PURE__ */ jsx32("input", { type: "text", className: "form-control-frac", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
10748
- const value = e.target.value;
10749
- if (/^[a-zA-Z\s]*$/.test(value)) {
10750
- handleCardChange("cardName", value);
10751
- }
10752
- } }),
10753
- (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardName })
10754
- ] }),
10755
- /* @__PURE__ */ jsx32("div", { className: "form-group-frac", children: /* @__PURE__ */ jsx32(
10756
- DataCapFields,
10757
- {
10758
- isOpen: show || autoTrigger,
10759
- tokenKey: dcToken,
10760
- setLoader: activeinCard === "form" ? setLoadingIframe : null
10761
- }
10762
- ) }),
10763
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10764
- /* @__PURE__ */ jsx32("label", { htmlFor: "zip", children: "ZIP" }),
10765
- /* @__PURE__ */ jsx32("input", { type: "text", className: "form-control-frac", maxLength: 100, placeholder: "000000", value: (_h = cardData == null ? void 0 : cardData.zipCode) != null ? _h : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }),
10766
- (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: cardError == null ? void 0 : cardError.zipCode })
10767
- ] }),
10768
- customerId && /* @__PURE__ */ jsx32("div", { className: "form-group-frac", children: /* @__PURE__ */ jsxs19("div", { className: "frac-tooltip-mn", style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" }, children: [
10769
- /* @__PURE__ */ jsx32(
10770
- "input",
10771
- {
10772
- type: "checkbox",
10773
- id: "save_card",
10774
- className: "toggle-checkbox",
10775
- checked: saveCardInfo,
10776
- onChange: (e) => setSaveCardInfo(e.target.checked)
10777
- }
10778
- ),
10779
- /* @__PURE__ */ jsx32("label", { htmlFor: "save_card", className: "toggle-label" }),
10780
- /* @__PURE__ */ jsx32("label", { htmlFor: "save_card", children: "Save card for future payments " }),
10781
- /* @__PURE__ */ jsxs19("div", { className: "frac-tooltip-wrapper", children: [
10782
- /* @__PURE__ */ jsx32("div", { className: "frac-tooltip-icon", children: /* @__PURE__ */ jsxs19(
10783
- "svg",
10784
- {
10785
- xmlns: "http://www.w3.org/2000/svg",
10786
- width: "20",
10787
- height: "20",
10788
- viewBox: "0 0 20 20",
10789
- fill: "none",
10790
- children: [
10791
- /* @__PURE__ */ jsx32("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }),
10792
- /* @__PURE__ */ jsx32(
10793
- "path",
10794
- {
10795
- 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",
10796
- fill: "#161616"
10797
- }
10798
- )
10799
- ]
10800
- }
10801
- ) }),
10802
- /* @__PURE__ */ jsx32("div", { className: "frac-tooltip-text", children: /* @__PURE__ */ jsxs19("p", { children: [
10803
- "If checked, I agree to give the ",
10804
- /* @__PURE__ */ jsx32("b", { children: merchantName || "merchant" }),
10805
- " permission to charge this credit card for agreed-upon purchases in the future."
10806
- ] }) })
10807
- ] })
10808
- ] }) })
10809
- ] }),
10810
- /* @__PURE__ */ jsx32("div", { className: "form-group-frac", style: { marginTop: "20px", padding: "0" }, children: /* @__PURE__ */ jsx32("button", { type: "submit", style: { margin: 0 }, className: "pay-button", children: partialAmount ? formatUSD((_i = Number(partialAmount)) == null ? void 0 : _i.toFixed(2)) : formatUSD((_j = Number(amount)) == null ? void 0 : _j.toFixed(2)) }) })
10811
- ] })
10812
- ] }),
10813
- /* @__PURE__ */ jsx32("div", { id: "ach", style: { display: activetab === "ach" ? "block" : "none" }, className: "tabcontent", children: /* @__PURE__ */ jsxs19(Fragment18, { children: [
10814
- /* @__PURE__ */ jsxs19("div", { className: "frac-heading-card-wrap", children: [
10815
- /* @__PURE__ */ jsx32("div", { className: "frac-backarrow", children: (bankList == null ? void 0 : bankList.length) > 0 && activeinBank === "form" && /* @__PURE__ */ jsxs19("button", { className: "charge-payment-back-btn ", onClick: () => setActiveinBank("list"), children: [
10816
- " ",
10817
- /* @__PURE__ */ jsx32(IoArrowBack4, {})
10818
- ] }) }),
10819
- /* @__PURE__ */ jsx32("h6", { className: "frac-card-payment-heading", children: "Bank Payment" })
10820
- ] }),
10821
- activeinBank === "list" && (bankList == null ? void 0 : bankList.length) > 0 ? /* @__PURE__ */ jsxs19(Fragment18, { children: [
10822
- /* @__PURE__ */ jsx32(CardList, { headingClass: "card-ach-heading-frac", listHeading: "Banks", ListItems: bankList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Bank", otherButtonAction: () => {
10823
- setActiveinBank("form");
10824
- } }),
10825
- /* @__PURE__ */ jsx32("div", { className: "form-group-frac", style: { padding: "0" }, children: /* @__PURE__ */ jsx32("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer, children: formatUSD((_k = Number(bankAmount)) == null ? void 0 : _k.toFixed(2)) }) })
10826
- ] }) : /* @__PURE__ */ jsxs19("form", { id: "ACHPaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc, autoComplete: "off", onKeyDown: (e) => {
10827
- if (e.key === "Enter" && loading) {
10828
- e.preventDefault();
10829
- e.stopPropagation();
10830
- }
10831
- }, children: [
10832
- /* @__PURE__ */ jsxs19("div", { className: "ach-scrl", style: {
10833
- minHeight: "444px",
10834
- maxHeight: "444px"
10835
- }, children: [
10836
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10837
- /* @__PURE__ */ jsx32("label", { htmlFor: "nameonaccount", children: "Name on account" }),
10838
- /* @__PURE__ */ jsx32("input", { type: "text", id: "nameonaccount", className: "form-control-frac", maxLength: 100, placeholder: "John Doe", name: "name", value: (_l = achData == null ? void 0 : achData.name) != null ? _l : "", onChange: handleChangeAch }),
10839
- (achError == null ? void 0 : achError.name) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: achError == null ? void 0 : achError.name })
10840
- ] }),
10841
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10842
- /* @__PURE__ */ jsx32("label", { htmlFor: "routingnumber", children: "Routing number" }),
10843
- /* @__PURE__ */ jsx32(
10844
- "input",
10845
- {
10846
- type: "text",
10847
- id: "routingnumber",
10848
- className: "form-control-frac",
10849
- maxLength: 9,
10850
- placeholder: "000000000",
10851
- name: "routingNumber",
10852
- value: (_m = achData == null ? void 0 : achData.routingNumber) != null ? _m : "",
10853
- onChange: handleChangeAch
10854
- }
10855
- ),
10856
- (achError == null ? void 0 : achError.routingNumber) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: achError == null ? void 0 : achError.routingNumber })
10857
- ] }),
10858
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10859
- /* @__PURE__ */ jsx32("label", { htmlFor: "accountnumber", children: "Account number" }),
10860
- /* @__PURE__ */ jsx32(
10861
- "input",
10862
- {
10863
- type: "text",
10864
- id: "accountnumber",
10865
- className: "form-control-frac",
10866
- maxLength: 16,
10867
- placeholder: "0000000000",
10868
- name: "accountNumber",
10869
- value: (_n = achData == null ? void 0 : achData.accountNumber) != null ? _n : "",
10870
- onChange: handleChangeAch
10871
- }
10872
- ),
10873
- (achError == null ? void 0 : achError.accountNumber) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: achError == null ? void 0 : achError.accountNumber })
10874
- ] }),
10875
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10876
- /* @__PURE__ */ jsx32("label", { htmlFor: "confirmaccountnumber", children: "Confirm account number" }),
10877
- /* @__PURE__ */ jsx32(
10878
- "input",
10879
- {
10880
- type: "text",
10881
- id: "confirmaccountnumber",
10882
- className: "form-control-frac",
10883
- maxLength: 16,
10884
- placeholder: "0000000000",
10885
- name: "confirmAccountNumber",
10886
- value: (_o = achData == null ? void 0 : achData.confirmAccountNumber) != null ? _o : "",
10887
- onChange: handleChangeAch
10888
- }
10889
- ),
10890
- (achError == null ? void 0 : achError.confirmAccountNumber) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: achError == null ? void 0 : achError.confirmAccountNumber })
10891
- ] }),
10892
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10893
- /* @__PURE__ */ jsx32("label", { htmlFor: "bankname", children: "Bank name" }),
10894
- /* @__PURE__ */ jsx32(
10895
- "input",
10896
- {
10897
- type: "text",
10898
- id: "bankname",
10899
- className: "form-control-frac",
10900
- maxLength: 100,
10901
- placeholder: "My Bank",
10902
- name: "bankName",
10903
- value: (_p = achData == null ? void 0 : achData.bankName) != null ? _p : "",
10904
- onChange: handleChangeAch
10905
- }
10906
- ),
10907
- (achError == null ? void 0 : achError.bankName) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: achError == null ? void 0 : achError.bankName })
10908
- ] }),
10909
- ((achData == null ? void 0 : achData.accountType) === "business saving" || (achData == null ? void 0 : achData.accountType) === "business checking") && /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10910
- /* @__PURE__ */ jsx32("label", { htmlFor: "companyName", children: "Company name" }),
10911
- /* @__PURE__ */ jsx32(
10912
- "input",
10913
- {
10914
- type: "text",
10915
- id: "companyName",
10916
- className: "form-control-frac",
10917
- maxLength: 100,
10918
- placeholder: "My Company",
10919
- name: "companyName",
10920
- value: (_q = achData == null ? void 0 : achData.companyName) != null ? _q : "",
10921
- onChange: handleChangeAch
10922
- }
10923
- ),
10924
- (achError == null ? void 0 : achError.companyName) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: achError == null ? void 0 : achError.companyName })
10925
- ] }),
10926
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10927
- /* @__PURE__ */ jsx32("label", { htmlFor: "accounttype", children: "Select account type" }),
10928
- /* @__PURE__ */ jsxs19("select", { name: "accountType", id: "accounttype", className: "form-control-frac", value: (_r = achData == null ? void 0 : achData.accountType) != null ? _r : "", onChange: handleChangeAch, children: [
10929
- /* @__PURE__ */ jsx32("option", { value: "", children: "Select account" }),
10930
- accountTypes.map((type) => /* @__PURE__ */ jsx32("option", { value: type.value, children: type.label }, type.value))
10931
- ] })
10932
- ] }),
10933
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
10934
- /* @__PURE__ */ jsx32("input", { type: "checkbox", id: "achconsent", className: "", checked: isBankConsentChecked, onChange: (e) => {
10935
- setIsBankConsentChecked(e.target.checked);
10936
- if (e.target.checked) {
10937
- setErrorBankConsent("");
10938
- }
10939
- } }),
10940
- /* @__PURE__ */ jsx32("label", { className: "saveachlabel", htmlFor: "achconsent", children: `By selecting this box, I authorize SkyFi, on behalf of ${merchantName || "merchant"}, to initiate a one-time electronic ACH debit from my bank account for the total amount displayed on this screen, including any applicable processing fee. I confirm that I am authorized to use this account and that the bank account information I provided is correct.` })
10941
- ] }),
10942
- errorBankConsent && /* @__PURE__ */ jsx32("span", { className: "error-span", children: errorBankConsent }),
10943
- customerId && /* @__PURE__ */ jsxs19("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
10944
- /* @__PURE__ */ jsx32("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }),
10945
- /* @__PURE__ */ jsx32("label", { className: "saveachlabel", htmlFor: "saveACH", children: "Save Bank" })
10946
- ] }),
10947
- saveACHinfo && /* @__PURE__ */ jsx32("div", { className: "form-group-frac saveachtext", children: /* @__PURE__ */ jsxs19("p", { children: [
10948
- "If checked, I agree to give the ",
10949
- /* @__PURE__ */ jsx32("b", { children: merchantName || "merchant" }),
10950
- " permission to charge this bank account for agreed-upon purchases in the future."
10951
- ] }) })
10952
- ] }),
10953
- /* @__PURE__ */ jsx32("div", { className: "form-group-frac ", children: /* @__PURE__ */ jsx32("button", { className: "pay-button", style: { margin: "20px 0 0" }, type: "submit", children: formatUSD((_s = Number(bankAmount)) == null ? void 0 : _s.toFixed(2)) }) })
10954
- ] })
10955
- ] }) })
10956
- ] }) }) }) })
10957
- ] })
10958
- ] })
10959
- ] })
10960
- ] })
10961
- ] });
12238
+ return null;
10962
12239
  };
10963
- var ModelContentSky_default = ModelContentSky;
10964
12240
 
10965
- // src/app/components/Skysystemz/PayButtonWithForm.tsx
10966
- import axios10 from "axios";
10967
- import { Fragment as Fragment19, jsx as jsx33, jsxs as jsxs20 } from "react/jsx-runtime";
10968
- var PaymentWidget = ({
12241
+ // src/app/components/Skysystemz/EmbeddedCheckout.tsx
12242
+ import { Fragment as Fragment22, jsx as jsx39, jsxs as jsxs23 } from "react/jsx-runtime";
12243
+ var EmbeddedCheckout = ({
10969
12244
  amount,
10970
12245
  bankAmount,
10971
12246
  submitBtnText = "Pay",
@@ -10984,15 +12259,18 @@ var PaymentWidget = ({
10984
12259
  autoTrigger = false,
10985
12260
  isPartial,
10986
12261
  bankSurcharge,
10987
- partialRef
12262
+ partialRef,
12263
+ onSubmit,
12264
+ onLoad,
12265
+ customCSS: customCSS2
10988
12266
  }) => {
10989
- const [show, setShow] = useState11(autoTrigger || false);
10990
- const [loading, setLoading] = useState11(false);
10991
- const [childHandleClose, setChildHandleClose] = useState11(() => () => {
12267
+ const [show, setShow] = useState13(false);
12268
+ const [loading, setLoading] = useState13(false);
12269
+ const [childHandleClose, setChildHandleClose] = useState13(() => () => {
10992
12270
  });
10993
- const [orderGuid, setOrderGuid] = useState11(null);
10994
- const [remainingAmount, setRemainingAmount] = useState11(null);
10995
- const initialCommonProps = useMemo(
12271
+ const [orderGuid, setOrderGuid] = useState13(null);
12272
+ const [remainingAmount, setRemainingAmount] = useState13(null);
12273
+ const initialCommonProps = useMemo2(
10996
12274
  () => ({
10997
12275
  amount,
10998
12276
  bankAmount,
@@ -11038,8 +12316,8 @@ var PaymentWidget = ({
11038
12316
  partialRef
11039
12317
  ]
11040
12318
  );
11041
- const [commonProps, setCommonProps] = useState11(initialCommonProps);
11042
- useEffect16(() => {
12319
+ const [commonProps, setCommonProps] = useState13(initialCommonProps);
12320
+ useEffect21(() => {
11043
12321
  if (show) {
11044
12322
  setCommonProps(initialCommonProps);
11045
12323
  }
@@ -11048,7 +12326,7 @@ var PaymentWidget = ({
11048
12326
  var _a;
11049
12327
  setLoading(true);
11050
12328
  try {
11051
- const res = await axios10.get(
12329
+ const res = await axios11.get(
11052
12330
  `${masterBaseUrl}api/v1/gateway/get-order-details/${session_token}`,
11053
12331
  { params: { isPartial, partialRef } }
11054
12332
  );
@@ -11070,29 +12348,44 @@ var PaymentWidget = ({
11070
12348
  setLoading(false);
11071
12349
  }
11072
12350
  };
11073
- useEffect16(() => {
12351
+ useEffect21(() => {
11074
12352
  if (show && isPartial && partialRef) {
11075
12353
  getskyosOrderDetails();
11076
12354
  }
11077
12355
  }, [show, isPartial, partialRef]);
11078
- return /* @__PURE__ */ jsxs20(Fragment19, { children: [
11079
- /* @__PURE__ */ jsx33("link", { href: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" }),
11080
- /* @__PURE__ */ jsx33(DataScript, {}),
11081
- /* @__PURE__ */ jsx33(FractalTokenizerScript, {}),
11082
- /* @__PURE__ */ jsx33(SkyChargewidgetstyles, {}),
11083
- /* @__PURE__ */ jsx33(CardBankRadioStyles, {}),
11084
- /* @__PURE__ */ jsx33(CustomModal2styles_default, {}),
11085
- /* @__PURE__ */ jsx33(DataCapScriptLoader, {}),
11086
- !autoTrigger && /* @__PURE__ */ jsxs20("button", { className: submitBtnClass || "paymentBtn", onClick: () => setShow(true), children: [
12356
+ console.log(onLoad, "onLoad");
12357
+ useEffect21(() => {
12358
+ const supported = !!window.ApplePaySession;
12359
+ let canPay = false;
12360
+ if (supported) {
12361
+ try {
12362
+ canPay = window.ApplePaySession.canMakePayments();
12363
+ } catch (e) {
12364
+ }
12365
+ }
12366
+ console.log(`ApplePaySession: ${supported}, canMakePayments: ${canPay}`);
12367
+ }, []);
12368
+ return /* @__PURE__ */ jsxs23(Fragment22, { children: [
12369
+ /* @__PURE__ */ jsx39("link", { href: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" }),
12370
+ /* @__PURE__ */ jsx39(DataScript, {}),
12371
+ /* @__PURE__ */ jsx39(FractalTokenizerScript, {}),
12372
+ /* @__PURE__ */ jsx39(SkyChargewidgetstyles, {}),
12373
+ /* @__PURE__ */ jsx39(CardBankRadioStyles, {}),
12374
+ /* @__PURE__ */ jsx39(CustomModal2styles_default, {}),
12375
+ /* @__PURE__ */ jsx39(DataCapScriptLoader, {}),
12376
+ /* @__PURE__ */ jsx39(ApplePayScriptLoader, {}),
12377
+ /* @__PURE__ */ jsx39(EmbeddedCheckoutStyles, { extraCustomCSS: customCSS2 }),
12378
+ !autoTrigger && /* @__PURE__ */ jsxs23("button", { className: submitBtnClass || "paymentBtn", onClick: () => setShow(true), children: [
11087
12379
  submitBtnText,
11088
12380
  submitBtnIcon
11089
12381
  ] }),
11090
- !autoTrigger ? /* @__PURE__ */ jsx33(CustomModal2_default, { open: show, onClose: childHandleClose, children: /* @__PURE__ */ jsx33(ModelContentSky_default, __spreadProps(__spreadValues({ show, loadingPrev: loading }, commonProps), { orderGuid, remainingAmount })) }) : /* @__PURE__ */ jsx33(ModelContentSky_default, __spreadProps(__spreadValues({ show, loadingPrev: loading }, commonProps), { orderGuid, remainingAmount }))
12382
+ !autoTrigger ? /* @__PURE__ */ jsx39(CustomModal2_default, { open: show, onClose: childHandleClose, children: /* @__PURE__ */ jsx39(ModelContentSky_default, __spreadProps(__spreadValues({ onLoad, onSubmit, show, loadingPrev: loading }, commonProps), { orderGuid, remainingAmount })) }) : /* @__PURE__ */ jsx39(ModelContentSky_default, __spreadProps(__spreadValues({ onLoad, onSubmit, show, loadingPrev: loading }, commonProps), { orderGuid, remainingAmount }))
11091
12383
  ] });
11092
12384
  };
11093
12385
  export {
11094
12386
  AddCardEasyPay as AddCard,
11095
12387
  CardOnFile,
12388
+ EmbeddedCheckout,
11096
12389
  GetPaymentPage,
11097
12390
  PartialPayment,
11098
12391
  PaymentWidget,