@fractalpay/fractalpay-next-test 0.0.36 → 0.0.38

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-test",
42
- version: "0.0.36",
42
+ version: "0.0.38",
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", {}),
@@ -223,36 +241,60 @@ if (name === "@fractalpay/fractalpay-next-dev") {
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 = {
@@ -2908,7 +2950,7 @@ function ErrorCardMszStyle() {
2908
2950
 
2909
2951
  // src/app/components/ErrorCardMessage/ErrorCardMessage.tsx
2910
2952
  import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
2911
- var ErrorCardMessage = ({ onClose, error }) => {
2953
+ var ErrorCardMessage = ({ onClose, error, autoTrigger = false }) => {
2912
2954
  return /* @__PURE__ */ jsxs6(Fragment6, { children: [
2913
2955
  /* @__PURE__ */ jsx12(ErrorCardMszStyle, {}),
2914
2956
  /* @__PURE__ */ jsx12("div", { className: "card-error", children: /* @__PURE__ */ jsx12("div", { className: "payment-error-container", children: /* @__PURE__ */ jsxs6("div", { className: "error-icon", children: [
@@ -2917,7 +2959,7 @@ var ErrorCardMessage = ({ onClose, error }) => {
2917
2959
  /* @__PURE__ */ jsx12("div", { className: "payment-error-text", children: error }),
2918
2960
  /* @__PURE__ */ jsx12("div", { className: "thank-you-text", children: "Try again later " })
2919
2961
  ] }),
2920
- /* @__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" }) })
2921
2963
  ] }) }) })
2922
2964
  ] });
2923
2965
  };
@@ -2934,14 +2976,27 @@ var socketClient_default = socket;
2934
2976
 
2935
2977
  // src/app/components/Atoms/CardBankRadio/CardBankRadio.tsx
2936
2978
  import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
2937
- var CardBankRadio = (props) => {
2938
- 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(
2939
2983
  "div",
2940
2984
  {
2941
2985
  className: `frac-card-bank-radio ${props.activetab === props.value ? "frac-active" : ""}`,
2942
2986
  onClick: () => props.onChange(props.value),
2943
2987
  role: "radio",
2944
- 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
+ /* @__PURE__ */ jsx13("div", { children: /* @__PURE__ */ jsx13("input", { name: "paymenttype", checked: props.activetab === props.value, type: "hidden", value: props.value, onChange: (e) => {
2997
+ props.onChange(e.target.value);
2998
+ } }) })
2999
+ ] }) : /* @__PURE__ */ jsxs7(Fragment7, { children: [
2945
3000
  /* @__PURE__ */ jsxs7("div", { className: "frac-card-title-main", children: [
2946
3001
  /* @__PURE__ */ jsx13("img", { src: props.label.toLowerCase() === "card" ? defaultcard : props.label.toLowerCase() === "reader" ? pax : bankNew, className: "frac-payment-type-logo", alt: "" }),
2947
3002
  /* @__PURE__ */ jsxs7("div", { className: "frac-card-label", children: [
@@ -2952,7 +3007,7 @@ var CardBankRadio = (props) => {
2952
3007
  /* @__PURE__ */ jsx13("div", { children: /* @__PURE__ */ jsx13("input", { name: "paymenttype", checked: props.activetab === props.value, type: "radio", value: props.value, onChange: (e) => {
2953
3008
  props.onChange(e.target.value);
2954
3009
  } }) })
2955
- ]
3010
+ ] })
2956
3011
  }
2957
3012
  ) });
2958
3013
  };
@@ -2977,6 +3032,7 @@ function CardBankRadioStyles({}) {
2977
3032
  justify-content: space-between;
2978
3033
  align-items: center;
2979
3034
  align-self: stretch;
3035
+ position: relative;
2980
3036
  }
2981
3037
 
2982
3038
  input[type="radio"] {
@@ -3034,6 +3090,28 @@ function CardBankRadioStyles({}) {
3034
3090
  .frac-card-bank-radio.frac-active {
3035
3091
  background: #F6F6F7;
3036
3092
  }
3093
+
3094
+ .frac-saving-badge {
3095
+ padding: 1px 7px !important;
3096
+ border: 1px solid #9ad7ab;
3097
+ border-radius: 999px;
3098
+ background: #e8f8ec;
3099
+ color: #1e6a34;
3100
+ font-size: 10px;
3101
+ font-weight: 600;
3102
+ line-height: 15px;
3103
+ pointer-events: none;
3104
+ }
3105
+
3106
+ .frac-saving-badge-corner {
3107
+ position: absolute;
3108
+ top: 8px;
3109
+ right: 10px;
3110
+ }
3111
+
3112
+ .frac-saving-badge-with-radio {
3113
+ right: 34px;
3114
+ }
3037
3115
  ` });
3038
3116
  }
3039
3117
 
@@ -3211,7 +3289,7 @@ var FractalFields = ({ fractalStyles, tokenizerRef, isAddCard = false, isSky = f
3211
3289
  {
3212
3290
  id: "card_number",
3213
3291
  className: "form-control card-number-new",
3214
- style: { height: `${isSky ? "36px" : "46px"}`, display: "inline-block" }
3292
+ style: { height: `${isSky ? "36px" : "46px"}` }
3215
3293
  }
3216
3294
  ),
3217
3295
  /* @__PURE__ */ jsx17("div", { className: "card-crdi card-expiry-new", children: /* @__PURE__ */ jsxs10("div", { className: "exp-date-year-container", children: [
@@ -3220,7 +3298,7 @@ var FractalFields = ({ fractalStyles, tokenizerRef, isAddCard = false, isSky = f
3220
3298
  {
3221
3299
  id: "exp_month",
3222
3300
  className: "form-control required card-cvv-in",
3223
- style: { height: "36px", display: "inline-block" }
3301
+ style: { height: "36px", display: "block", minHeight: "36px" }
3224
3302
  }
3225
3303
  ) }),
3226
3304
  /* @__PURE__ */ jsx17("div", { className: "exp-year form-group input-main-wrap-frac", children: /* @__PURE__ */ jsx17(
@@ -3228,7 +3306,7 @@ var FractalFields = ({ fractalStyles, tokenizerRef, isAddCard = false, isSky = f
3228
3306
  {
3229
3307
  id: "exp_year",
3230
3308
  className: "form-control required card-cvv-in",
3231
- style: { height: "36px", display: "inline-block" }
3309
+ style: { height: "36px", display: "block", minHeight: "36px" }
3232
3310
  }
3233
3311
  ) }),
3234
3312
  /* @__PURE__ */ jsx17("div", { className: "security-digit form-group input-main-wrap-frac", children: /* @__PURE__ */ jsx17(
@@ -3236,7 +3314,7 @@ var FractalFields = ({ fractalStyles, tokenizerRef, isAddCard = false, isSky = f
3236
3314
  {
3237
3315
  id: "cvv",
3238
3316
  className: "form-control card-cvv-in required",
3239
- style: { height: "36px", display: "inline-block" }
3317
+ style: { height: "36px", display: "block", minHeight: "36px" }
3240
3318
  }
3241
3319
  ) })
3242
3320
  ] }) })
@@ -3359,7 +3437,10 @@ var DataCapFields = ({
3359
3437
  isOpen,
3360
3438
  tokenKey,
3361
3439
  setLoader,
3362
- isAddCard
3440
+ isAddCard,
3441
+ isEmbedded,
3442
+ customCSS: extraCss,
3443
+ height
3363
3444
  }) => {
3364
3445
  const iframeId = "datacap-iframe";
3365
3446
  const resolverRef = useRef2(null);
@@ -3385,15 +3466,37 @@ var DataCapFields = ({
3385
3466
 
3386
3467
  `;
3387
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
+ }
3483
+ if (extraCss) {
3484
+ customCSS += extraCss;
3485
+ }
3388
3486
  const initialize = async () => {
3389
3487
  setLoader == null ? void 0 : setLoader(true);
3390
3488
  setIframeReady(false);
3391
- const waitForSDK = () => new Promise((resolve) => {
3489
+ const waitForSDK = () => new Promise((resolve, reject) => {
3490
+ let attempts = 0;
3392
3491
  const interval = setInterval(() => {
3393
3492
  if (window.DatacapHostedWebToken) {
3394
3493
  clearInterval(interval);
3395
3494
  resolve();
3396
3495
  }
3496
+ if (attempts++ > 50) {
3497
+ clearInterval(interval);
3498
+ reject("Datacap SDK not loaded");
3499
+ }
3397
3500
  }, 100);
3398
3501
  });
3399
3502
  await waitForSDK();
@@ -3416,13 +3519,20 @@ var DataCapFields = ({
3416
3519
  };
3417
3520
  initialize();
3418
3521
  }, [isOpen, tokenKey]);
3419
- window.requestDcToken = () => {
3420
- return new Promise((resolve, reject) => {
3421
- setLoader == null ? void 0 : setLoader(true);
3422
- resolverRef.current = { resolve, reject };
3423
- window.DatacapHostedWebToken.requestToken();
3424
- });
3425
- };
3522
+ useEffect7(() => {
3523
+ const uniqueId = Math.random();
3524
+ const fn = () => {
3525
+ return new Promise((resolve, reject) => {
3526
+ setLoader == null ? void 0 : setLoader(true);
3527
+ resolverRef.current = { resolve, reject };
3528
+ window.DatacapHostedWebToken.requestToken();
3529
+ });
3530
+ };
3531
+ window.requestDcToken = fn;
3532
+ return () => {
3533
+ delete window.requestDcToken;
3534
+ };
3535
+ }, []);
3426
3536
  return /* @__PURE__ */ jsx18(
3427
3537
  "iframe",
3428
3538
  {
@@ -3434,7 +3544,7 @@ var DataCapFields = ({
3434
3544
  },
3435
3545
  style: {
3436
3546
  width: "100%",
3437
- height: "250px",
3547
+ height: `${height || "250px"}`,
3438
3548
  border: "none",
3439
3549
  opacity: iframeReady ? 1 : 0,
3440
3550
  transition: "opacity 0.3s ease"
@@ -3463,6 +3573,8 @@ function GetPaymentPage(props) {
3463
3573
  const [saveACHinfo, setSaveACHinfo] = useState4(false);
3464
3574
  const [isBankConsentChecked, setIsBankConsentChecked] = useState4(false);
3465
3575
  const [errorBankConsent, setErrorBankConsent] = useState4("");
3576
+ const [saveACHConsent1, setSaveACHConsent1] = useState4(false);
3577
+ const [errorBankConsentOther, setErrorBankConsentOther] = useState4("");
3466
3578
  const fractalpayClientKey = props.merchantPublicKey;
3467
3579
  let mastercard2 = S3Url + "widget/mc-img.svg";
3468
3580
  let visa2 = S3Url + "widget/visa-img.svg";
@@ -3584,6 +3696,8 @@ function GetPaymentPage(props) {
3584
3696
  setCardList([]);
3585
3697
  setIsBankConsentChecked(false);
3586
3698
  setErrorBankConsent("");
3699
+ setSaveACHConsent1(false);
3700
+ setErrorBankConsentOther("");
3587
3701
  };
3588
3702
  const handleShow = () => setShow(true);
3589
3703
  const handletabchange = (id) => {
@@ -3683,11 +3797,14 @@ function GetPaymentPage(props) {
3683
3797
  errors.companyName = "Company Name is required for business accounts";
3684
3798
  }
3685
3799
  }
3686
- if (!isBankConsentChecked) {
3800
+ if (!saveACHinfo && !isBankConsentChecked) {
3687
3801
  setErrorBankConsent("Above consent is required");
3688
3802
  }
3803
+ if (saveACHinfo && !saveACHConsent1) {
3804
+ setErrorBankConsentOther("Your consent is required to save your bank details for future use");
3805
+ }
3689
3806
  setAchError(errors);
3690
- return Object.keys(errors).length > 0 || !isBankConsentChecked;
3807
+ return Object.keys(errors).length > 0;
3691
3808
  };
3692
3809
  const submitFunc = async (e) => {
3693
3810
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
@@ -3846,7 +3963,13 @@ function GetPaymentPage(props) {
3846
3963
  }
3847
3964
  }
3848
3965
  } else {
3849
- const hasError = validateAchData();
3966
+ let hasError = validateAchData();
3967
+ if (saveACHinfo && !saveACHConsent1) {
3968
+ hasError = true;
3969
+ }
3970
+ if (!saveACHinfo && !isBankConsentChecked) {
3971
+ hasError = true;
3972
+ }
3850
3973
  if (hasError) return;
3851
3974
  else {
3852
3975
  setLoading2(true);
@@ -4610,25 +4733,44 @@ function GetPaymentPage(props) {
4610
4733
  accountTypes.map((type) => /* @__PURE__ */ jsx19("option", { value: type.value, children: type.label }, type.value))
4611
4734
  ] })
4612
4735
  ] }),
4613
- /* @__PURE__ */ jsxs11("div", { className: "form-group mb-4 save-ach-div", style: { paddingTop: "5px" }, children: [
4614
- /* @__PURE__ */ jsx19("input", { type: "checkbox", id: "achconsent", className: "", checked: isBankConsentChecked, onChange: (e) => {
4615
- setIsBankConsentChecked(e.target.checked);
4616
- if (e.target.checked) {
4617
- setErrorBankConsent("");
4618
- }
4619
- } }),
4620
- /* @__PURE__ */ jsx19("label", { htmlFor: "achconsent", children: `By selecting this box, I authorize SkyFi, on behalf of ${(paymentData == null ? void 0 : paymentData.bname) || "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.` })
4736
+ !saveACHinfo && /* @__PURE__ */ jsxs11(Fragment11, { children: [
4737
+ /* @__PURE__ */ jsxs11("div", { className: "form-group mb-4 save-ach-div", style: { paddingTop: "5px" }, children: [
4738
+ /* @__PURE__ */ jsx19("input", { type: "checkbox", id: "achconsent", className: "", checked: isBankConsentChecked, onChange: (e) => {
4739
+ setIsBankConsentChecked(e.target.checked);
4740
+ if (e.target.checked) {
4741
+ setErrorBankConsent("");
4742
+ }
4743
+ } }),
4744
+ /* @__PURE__ */ jsx19("label", { htmlFor: "achconsent", children: `By selecting this box, I authorize SkyFi, on behalf of ${(paymentData == null ? void 0 : paymentData.bname) || "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.` })
4745
+ ] }),
4746
+ errorBankConsent && /* @__PURE__ */ jsx19("span", { className: "error-span", children: errorBankConsent })
4621
4747
  ] }),
4622
- errorBankConsent && /* @__PURE__ */ jsx19("span", { className: "error-span", children: errorBankConsent }),
4623
4748
  (props == null ? void 0 : props.customerId) && /* @__PURE__ */ jsxs11("div", { className: "form-group mb-4 save-ach-div", style: { paddingTop: "5px" }, children: [
4624
- /* @__PURE__ */ jsx19("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }),
4625
- /* @__PURE__ */ jsx19("label", { htmlFor: "saveACH", children: "Save Bank" })
4749
+ /* @__PURE__ */ jsx19("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => {
4750
+ setSaveACHinfo(e.target.checked);
4751
+ if (!e.target.checked) {
4752
+ setSaveACHConsent1(false);
4753
+ setErrorBankConsentOther("");
4754
+ }
4755
+ } }),
4756
+ /* @__PURE__ */ jsx19("label", { htmlFor: "saveACH", children: "Save for future use" })
4626
4757
  ] }),
4627
- saveACHinfo && /* @__PURE__ */ jsx19("div", { className: "form-group mb-4", style: { fontSize: "12px", color: "#727272" }, children: /* @__PURE__ */ jsxs11("p", { children: [
4628
- "If checked, I agree for ",
4629
- /* @__PURE__ */ jsx19("b", { children: (paymentData == null ? void 0 : paymentData.bname) || "merchant" }),
4630
- " to have my permission to charge this bank account for agreed upon purchases in the future."
4631
- ] }) })
4758
+ saveACHinfo && /* @__PURE__ */ jsxs11(Fragment11, { children: [
4759
+ /* @__PURE__ */ jsxs11("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
4760
+ /* @__PURE__ */ jsx19("input", { type: "checkbox", id: "saveACHConsent1", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHConsent1, onChange: (e) => {
4761
+ setSaveACHConsent1(e.target.checked);
4762
+ if (e.target.checked) {
4763
+ setErrorBankConsentOther("");
4764
+ }
4765
+ } }),
4766
+ /* @__PURE__ */ jsxs11("label", { className: "saveachlabel", htmlFor: "saveACHConsent1", children: [
4767
+ "By providing my bank account information and selecting \u2018Save for future payments\u2019, I authorize ",
4768
+ (paymentData == null ? void 0 : paymentData.bname) || "merchant",
4769
+ " to store my bank account details for future ACH payments. I understand that future payments may be initiated using this saved account in accordance with my instructions. I confirm I am authorized to use this bank account."
4770
+ ] })
4771
+ ] }),
4772
+ errorBankConsentOther && /* @__PURE__ */ jsx19("span", { className: "error-span", children: errorBankConsentOther })
4773
+ ] })
4632
4774
  ] }),
4633
4775
  /* @__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)) }) })
4634
4776
  ] })
@@ -6702,7 +6844,7 @@ var FractalFieldsAddCardSky_default = FractalFieldsAddCardSky;
6702
6844
 
6703
6845
  // src/app/components/AddCard/AddCardSky.tsx
6704
6846
  import { Fragment as Fragment16, jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
6705
- function CardOnFile({ session_token, callback, isloading, onCancel, showChecks, merchantName, signCheckbox, checkedSignCheckbox, onCheckSign, cancelbtnClass, savebtnClass, inputClass, isDual }) {
6847
+ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks, merchantName, signCheckbox, checkedSignCheckbox, onCheckSign, cancelbtnClass, savebtnClass, inputClass, isDual, customCSS: customCSS2, height }) {
6706
6848
  var _a, _b;
6707
6849
  const [loading, setLoading] = useState7(false);
6708
6850
  const [errorIframe, setErrorIframe] = useState7("");
@@ -7215,7 +7357,9 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
7215
7357
  {
7216
7358
  isOpen: true,
7217
7359
  tokenKey: dcToken,
7218
- setLoader: setLoadingIframe
7360
+ setLoader: setLoadingIframe,
7361
+ customCSS: customCSS2,
7362
+ height
7219
7363
  }
7220
7364
  ) }),
7221
7365
  /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
@@ -7386,6 +7530,8 @@ function PartialPayment(props) {
7386
7530
  const [partialError, setPartialError] = useState8("");
7387
7531
  const [isBankConsentChecked, setIsBankConsentChecked] = useState8(false);
7388
7532
  const [errorBankConsent, setErrorBankConsent] = useState8("");
7533
+ const [saveACHConsent1, setSaveACHConsent1] = useState8(false);
7534
+ const [errorBankConsentOther, setErrorBankConsentOther] = useState8("");
7389
7535
  const tokenizerRef = useRef8(null);
7390
7536
  const fractalStyles = {
7391
7537
  input: {
@@ -7499,6 +7645,8 @@ function PartialPayment(props) {
7499
7645
  setPartialError("");
7500
7646
  setIsBankConsentChecked(false);
7501
7647
  setErrorBankConsent("");
7648
+ setSaveACHConsent1(false);
7649
+ setErrorBankConsentOther("");
7502
7650
  };
7503
7651
  const handleShow = () => setShow(true);
7504
7652
  const handletabchange = (id) => {
@@ -7599,11 +7747,14 @@ function PartialPayment(props) {
7599
7747
  errors.companyName = "Company Name is required for business accounts";
7600
7748
  }
7601
7749
  }
7602
- if (!isBankConsentChecked) {
7750
+ if (!saveACHinfo && !isBankConsentChecked) {
7603
7751
  setErrorBankConsent("Above consent is required");
7604
7752
  }
7753
+ if (saveACHinfo && !saveACHConsent1) {
7754
+ setErrorBankConsentOther("Your consent is required to save your bank details for future use");
7755
+ }
7605
7756
  setAchError(errors);
7606
- return Object.keys(errors).length > 0 || !isBankConsentChecked;
7757
+ return Object.keys(errors).length > 0;
7607
7758
  };
7608
7759
  const submitFunc = async (e) => {
7609
7760
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2;
@@ -7748,7 +7899,13 @@ function PartialPayment(props) {
7748
7899
  }
7749
7900
  }
7750
7901
  } else {
7751
- const hasError = validateAchData();
7902
+ let hasError = validateAchData();
7903
+ if (saveACHinfo && !saveACHConsent1) {
7904
+ hasError = true;
7905
+ }
7906
+ if (!saveACHinfo && !isBankConsentChecked) {
7907
+ hasError = true;
7908
+ }
7752
7909
  if (hasError) return;
7753
7910
  else {
7754
7911
  setLoading2(true);
@@ -8550,34 +8707,47 @@ function PartialPayment(props) {
8550
8707
  accountTypes.map((type) => /* @__PURE__ */ jsx28("option", { value: type.value, children: type.label }, type.value))
8551
8708
  ] })
8552
8709
  ] }),
8553
- /* @__PURE__ */ jsxs17("div", { className: "form-group mb-4 save-ach-div", style: { paddingTop: "5px" }, children: [
8554
- /* @__PURE__ */ jsx28(
8555
- "input",
8556
- {
8557
- type: "checkbox",
8558
- id: "achconsent",
8559
- className: "",
8560
- checked: isBankConsentChecked,
8561
- onChange: (e) => {
8562
- setIsBankConsentChecked(e.target.checked);
8563
- if (e.target.checked) {
8564
- setErrorBankConsent("");
8710
+ !saveACHinfo && /* @__PURE__ */ jsxs17(Fragment17, { children: [
8711
+ /* @__PURE__ */ jsxs17("div", { className: "form-group mb-4 save-ach-div", style: { paddingTop: "5px" }, children: [
8712
+ /* @__PURE__ */ jsx28(
8713
+ "input",
8714
+ {
8715
+ type: "checkbox",
8716
+ id: "achconsent",
8717
+ className: "",
8718
+ checked: isBankConsentChecked,
8719
+ onChange: (e) => {
8720
+ setIsBankConsentChecked(e.target.checked);
8721
+ if (e.target.checked) {
8722
+ setErrorBankConsent("");
8723
+ }
8565
8724
  }
8566
8725
  }
8567
- }
8568
- ),
8569
- /* @__PURE__ */ jsx28("label", { htmlFor: "achconsent", children: `By selecting this box, I authorize SkyFi, on behalf of ${(paymentData == null ? void 0 : paymentData.bname) || "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.` })
8726
+ ),
8727
+ /* @__PURE__ */ jsx28("label", { htmlFor: "achconsent", children: `By selecting this box, I authorize SkyFi, on behalf of ${(paymentData == null ? void 0 : paymentData.bname) || "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.` })
8728
+ ] }),
8729
+ errorBankConsent && /* @__PURE__ */ jsx28("span", { className: "error-span", children: errorBankConsent })
8570
8730
  ] }),
8571
- errorBankConsent && /* @__PURE__ */ jsx28("span", { className: "error-span", children: errorBankConsent }),
8572
8731
  (props == null ? void 0 : props.customerId) && /* @__PURE__ */ jsxs17("div", { className: "form-group mb-4 save-ach-div", style: { paddingTop: "5px" }, children: [
8573
8732
  /* @__PURE__ */ jsx28("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }),
8574
- /* @__PURE__ */ jsx28("label", { htmlFor: "saveACH", children: "Save Bank" })
8733
+ /* @__PURE__ */ jsx28("label", { htmlFor: "saveACH", children: "Save for future use" })
8575
8734
  ] }),
8576
- saveACHinfo && /* @__PURE__ */ jsx28("div", { className: "form-group mb-4", style: { fontSize: "12px", color: "#727272" }, children: /* @__PURE__ */ jsxs17("p", { children: [
8577
- "If checked, I agree for ",
8578
- /* @__PURE__ */ jsx28("b", { children: (paymentData == null ? void 0 : paymentData.bname) || "merchant" }),
8579
- " to have my permission to charge this bank account for agreed upon purchases in the future."
8580
- ] }) })
8735
+ saveACHinfo && /* @__PURE__ */ jsxs17(Fragment17, { children: [
8736
+ /* @__PURE__ */ jsxs17("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
8737
+ /* @__PURE__ */ jsx28("input", { type: "checkbox", id: "saveACHConsent1", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHConsent1, onChange: (e) => {
8738
+ setSaveACHConsent1(e.target.checked);
8739
+ if (e.target.checked) {
8740
+ setErrorBankConsentOther("");
8741
+ }
8742
+ } }),
8743
+ /* @__PURE__ */ jsxs17("label", { className: "saveachlabel", htmlFor: "saveACHConsent1", children: [
8744
+ "By providing my bank account information and selecting \u2018Save for future payments\u2019, I authorize ",
8745
+ (paymentData == null ? void 0 : paymentData.bname) || "merchant",
8746
+ " to store my bank account details for future ACH payments. I understand that future payments may be initiated using this saved account in accordance with my instructions. I confirm I am authorized to use this bank account."
8747
+ ] })
8748
+ ] }),
8749
+ errorBankConsentOther && /* @__PURE__ */ jsx28("span", { className: "error-span", children: errorBankConsentOther })
8750
+ ] })
8581
8751
  ] }),
8582
8752
  /* @__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)) }) })
8583
8753
  ] })
@@ -8594,7 +8764,7 @@ function PartialPayment(props) {
8594
8764
  }
8595
8765
 
8596
8766
  // src/app/components/Skysystemz/PayButtonWithForm.tsx
8597
- import { useEffect as useEffect16, useState as useState11, useMemo } from "react";
8767
+ import { useEffect as useEffect19, useState as useState12, useMemo } from "react";
8598
8768
 
8599
8769
  // src/app/components/Skysystemz/SkyChargewidgetstyles.tsx
8600
8770
  import { jsx as jsx29 } from "react/jsx-runtime";
@@ -8830,6 +9000,17 @@ function SkyChargewidgetstyles() {
8830
9000
  text-align : left !important;
8831
9001
  text-transform: uppercase !important;
8832
9002
  }
9003
+ .frac-form .frac-fee-text{
9004
+ display: block;
9005
+ padding: 10px 0 4px;
9006
+ font-family: 'IBM Plex Mono', monospace !important;
9007
+ color: #727272 !important;
9008
+ font-size: 12px;
9009
+ line-height: 1.4;
9010
+ }
9011
+ .frac-form .frac-fee-amount{
9012
+ color: #c62828 !important;
9013
+ }
8833
9014
  .form-control-frac{
8834
9015
  display: block;
8835
9016
  width: 100%;
@@ -8864,7 +9045,7 @@ function SkyChargewidgetstyles() {
8864
9045
  }
8865
9046
  .exp-date-year-container .form-group {
8866
9047
  flex: 1;
8867
- padding-left:.75rem;
9048
+ padding-left:.75rem !important;
8868
9049
  }
8869
9050
  .card-crdi {
8870
9051
  display: flex;
@@ -8881,7 +9062,7 @@ function SkyChargewidgetstyles() {
8881
9062
  }
8882
9063
  .exp-date-year-container .form-group-frac{
8883
9064
  flex:1;
8884
- padding: 0px !important
9065
+ // padding: 0px !important
8885
9066
 
8886
9067
  }
8887
9068
 
@@ -9382,13 +9563,54 @@ margin:0px !important;
9382
9563
  padding:0px !important;
9383
9564
  }
9384
9565
 
9385
-
9566
+
9567
+ .toggle-num-wrapper-new div#card_number {
9568
+ display: block !important;
9569
+ }
9570
+ .toggle-num-wrapper-new .input-main-wrap-frac {
9571
+ height: 36px;
9572
+ }
9573
+ .toggle-num-wrapper-new:focus {
9574
+ border: 1px solid #004eab !important;
9575
+ }
9576
+ .frac-or {
9577
+ position: relative;
9578
+ margin: 15px 0;
9579
+ text-align: center;
9580
+ }
9581
+ .frac-or:before {
9582
+ position: absolute;
9583
+ left: 0;
9584
+ transform: translateY(-50%);
9585
+ top: 50%;
9586
+ height: 1px;
9587
+ width: 100%;
9588
+ background: #E0DFE2;
9589
+ content: '';
9590
+ z-index: 1;
9591
+ }
9592
+ .frac-or span {
9593
+ background: transparent;
9594
+ font-size: 13px;
9595
+ margin: 0 auto;
9596
+ width: 15px;
9597
+ font-weight: 500;
9598
+ text-transform: uppercase;
9599
+ color: #727272;
9600
+ padding: 3px;
9601
+ position: relative;
9602
+ z-index: 3;
9603
+ }
9604
+ button#gpay-button-online-api-id{
9605
+ width: 100%;
9606
+ }
9607
+
9386
9608
 
9387
9609
  ` });
9388
9610
  }
9389
9611
 
9390
9612
  // src/app/components/Atoms/ModelContentSky/ModelContentSky.tsx
9391
- import { useCallback, useEffect as useEffect15, useRef as useRef10, useState as useState10 } from "react";
9613
+ import { useCallback, useEffect as useEffect18, useRef as useRef12, useState as useState11 } from "react";
9392
9614
  import axios9 from "axios";
9393
9615
  import Swal5 from "sweetalert2";
9394
9616
 
@@ -9529,1412 +9751,2608 @@ function CheckoutWrapper({ clientSecret, onSuccess, showLoader, setError, sessio
9529
9751
  // src/app/components/Atoms/ModelContentSky/ModelContentSky.tsx
9530
9752
  import { IoArrowBack as IoArrowBack4 } from "react-icons/io5";
9531
9753
  import { NumericFormat as NumericFormat2 } from "react-number-format";
9532
- import { Fragment as Fragment18, jsx as jsx32, jsxs as jsxs19 } from "react/jsx-runtime";
9533
- 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 }) => {
9534
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
9535
- const hasRunRef = useRef10(false);
9536
- const cardListRunRef = useRef10(false);
9537
- const threeDSContainerRef = useRef10(null);
9538
- const [activetab, setActive] = useState10("card");
9539
- const [activeList, setActiveList] = useState10("card");
9540
- const [cardData, setCardData] = useState10();
9541
- const [cardError, setCardError] = useState10({});
9542
- const [achData, setAchData] = useState10();
9543
- const [achError, setAchError] = useState10({});
9544
- const [saveACHinfo, setSaveACHinfo] = useState10(false);
9545
- const [saveCardInfo, setSaveCardInfo] = useState10(false);
9546
- const [error, setError] = useState10("");
9547
- const [errorIframe, setErrorIframe] = useState10("");
9548
- const [success, setSuccess] = useState10(false);
9549
- let [tranId, setTranId] = useState10("");
9550
- const [loading, setLoading] = useState10(false);
9551
- const [loading2, setLoading2] = useState10(false);
9552
- const [loadingIframe, setLoadingIframe] = useState10(false);
9553
- const [cardList, setCardList] = useState10([]);
9554
- const [bankList, setBankList] = useState10([]);
9555
- const [selectedCard, setSelectedCard] = useState10();
9556
- const [cashDiscount, setCashDiscount] = useState10(Number(amount));
9557
- const [activeinCard, setActiveinCard] = useState10("form");
9558
- const [activeinBank, setActiveinBank] = useState10("form");
9559
- const [isBankActive, setIsBankActive] = useState10(false);
9560
- const [processingFee, setProcessingFee] = useState10(0);
9561
- const [clientSecret, setClientSecret] = useState10("");
9562
- const [errorMessage, setErrorMessage] = useState10(null);
9563
- const [initialLoader, setInitialLoader] = useState10(false);
9564
- const [is3DSEnable, setIs3DSEnable] = useState10(false);
9565
- const [stripeResponse, setStripeResponse] = useState10(null);
9566
- const [orderLoader, setOrderLoader] = useState10(false);
9567
- const [orderGuid, setOrderGuid] = useState10(ordGuid || null);
9568
- const [partialAmount, setPartialAmount] = useState10("");
9569
- const [partialError, setPartialError] = useState10("");
9570
- const [remainingAmount, setRemainingAmount] = useState10("");
9571
- const [paymentGateway, setPaymentGateway] = useState10();
9572
- const [dcToken, setDCToken] = useState10();
9573
- const [isBankConsentChecked, setIsBankConsentChecked] = useState10(false);
9574
- const [errorBankConsent, setErrorBankConsent] = useState10("");
9575
- let mastercard2 = S3Url + "widget/mc-img.svg";
9576
- let visa2 = S3Url + "widget/visa-img.svg";
9577
- let americanexp2 = S3Url + "widget/ae-img.svg";
9578
- let discover2 = S3Url + "widget/discover-img.svg";
9579
- let defaultcard2 = S3Url + "widget/card.svg";
9580
- let trash2 = S3Url + "widget/Trash.svg";
9581
- let bank2 = S3Url + "widget/bank.svg";
9582
- let secure2 = S3Url + "widget/secure-img.png";
9583
- let pov2 = S3Url + "widget/pov-by.png";
9584
- let pax2 = S3Url + "widget/pax.svg";
9585
- let cardicon = S3Url + "widget/cardicon.svg";
9586
- let bankicon = S3Url + "widget/bankicon.svg";
9587
- const showLoader = () => setLoading(true);
9588
- const hideLoader = () => setLoading(false);
9589
- const CalculateCashDiscount = (amount2, surcharge2) => {
9590
- const surchargeVal = (parseFloat(surcharge2) || 0) / 100;
9591
- const originalAmount = amount2 / (1 + surchargeVal);
9592
- return Math.round(originalAmount * 100) / 100;
9593
- };
9594
- const tokenizerRef = useRef10(null);
9595
- const fractalStyles = {
9596
- input: {
9597
- "font-family": "'Inter', sans-serif",
9598
- "font-size": "16px",
9599
- "color": "#212529",
9600
- "background-color": "transparent",
9601
- "padding": "0px",
9602
- "appearance": "none",
9603
- "outline": "none",
9604
- "border": "none",
9605
- "box-shadow": "none"
9606
- },
9607
- ":focus": {
9608
- "color": "#212529",
9609
- "outline": "none",
9610
- "border": "none"
9611
- },
9612
- "::placeholder": {
9613
- "color": "#212529"
9614
- }
9615
- };
9616
- const handleCharge = async (data) => {
9617
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
9618
- try {
9619
- let dataObj = __spreadValues({
9620
- pass_fee_amount: Number(amount) - cashDiscount,
9621
- pass_fee,
9622
- Token: data == null ? void 0 : data.Token,
9623
- amount: partialAmount ? partialAmount : amount,
9624
- postal_code: data == null ? void 0 : data.postalCode,
9625
- require3ds,
9626
- isPartial,
9627
- orderGuid: orderGuid || ordGuid
9628
- }, saveCardInfo ? {
9629
- card: {
9630
- postal_code: cardData == null ? void 0 : cardData.zipCode,
9631
- customer_id: customerId,
9632
- gateway_token: (data == null ? void 0 : data.Token) || (data == null ? void 0 : data.gateway_token),
9633
- name: cardData == null ? void 0 : cardData.cardName
9754
+
9755
+ // src/app/components/ErrorCardMessage/ErrorCardOverlaystyle.tsx
9756
+ import { jsx as jsx32 } from "react/jsx-runtime";
9757
+ function ErrorCardOverlayStyle() {
9758
+ return /* @__PURE__ */ jsx32("style", { children: `
9759
+ .card-error-overlay .logo-container {
9760
+ display: flex;
9761
+ justify-content: center;
9762
+ align-items: center;
9763
+ margin-bottom: -50px; /* Adjust this to overlap the content */
9764
+ z-index: 10;
9634
9765
  }
9635
- } : null);
9636
- if (require3ds && (data == null ? void 0 : data.stripe_3ds_auth_id)) {
9637
- dataObj.stripe_3ds_auth_id = data == null ? void 0 : data.stripe_3ds_auth_id;
9638
- }
9639
- const chargeResponse = await axios9.post(`${masterBaseUrl}api/v1/gateway/charge/${session_token}`, dataObj);
9640
- if ((_a2 = chargeResponse == null ? void 0 : chargeResponse.data) == null ? void 0 : _a2.result) {
9641
- let callbackdata = {
9642
- // cardDetails: { ...addCard, ...data },
9643
- callback: __spreadProps(__spreadValues({}, (_b2 = chargeResponse == null ? void 0 : chargeResponse.data) == null ? void 0 : _b2.data), { name: cardData == null ? void 0 : cardData.cardName, isPreAuth })
9644
- };
9645
- callback(callbackdata);
9646
- hideLoader();
9647
- handleClose();
9648
- }
9649
- } catch (error2) {
9650
- setError(((_d2 = (_c2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!");
9651
- callback({
9652
- error: ((_f2 = (_e2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.message) || "Something went wrong!",
9653
- result: (_h2 = (_g2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.result,
9654
- statusCode: (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.status
9655
- });
9656
- hideLoader();
9657
- }
9658
- };
9659
- const handlePreAuth = async (data) => {
9660
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
9661
- try {
9662
- let dataObj = __spreadValues({
9663
- Token: data == null ? void 0 : data.Token,
9664
- amount,
9665
- postal_code: data == null ? void 0 : data.postalCode
9666
- }, saveCardInfo ? {
9667
- card: {
9668
- postal_code: cardData == null ? void 0 : cardData.zipCode,
9669
- customer_id: customerId,
9670
- gateway_token: (data == null ? void 0 : data.Token) || (data == null ? void 0 : data.gateway_token),
9671
- name: cardData == null ? void 0 : cardData.cardName
9766
+
9767
+ .card-error-overlay .client-logo {
9768
+ max-width: 100px;
9769
+ height: auto;
9770
+ object-fit: contain;
9771
+ display: block;
9672
9772
  }
9673
- } : null);
9674
- const preAuthResponse = await axios9.post(`${masterBaseUrl}api/v1/gateway/preauth/${session_token}`, dataObj);
9675
- if ((_a2 = preAuthResponse == null ? void 0 : preAuthResponse.data) == null ? void 0 : _a2.result) {
9676
- let addCard;
9677
- let callbackdata = {
9678
- // cardDetails: { ...addCard, ...data },
9679
- callback: __spreadProps(__spreadValues({}, (_b2 = preAuthResponse == null ? void 0 : preAuthResponse.data) == null ? void 0 : _b2.data), { name: cardData == null ? void 0 : cardData.cardName, isPreAuth })
9680
- };
9681
- callback(callbackdata);
9682
- hideLoader();
9683
- handleClose();
9684
- }
9685
- } catch (error2) {
9686
- setError(((_d2 = (_c2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!");
9687
- callback({
9688
- error: ((_f2 = (_e2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.message) || "Something went wrong!",
9689
- result: (_h2 = (_g2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.result,
9690
- statusCode: (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.status
9691
- });
9692
- hideLoader();
9693
- }
9694
- };
9695
- const handleTokenCallback = async (token) => {
9696
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
9697
- if (token.Error) {
9698
- setError(token.Error);
9699
- callback({
9700
- error: token.Error || "Something went wrong!"
9701
- });
9702
- hideLoader();
9703
- } else {
9704
- let data = {
9705
- token: token.Token,
9706
- resp: token
9707
- };
9708
- try {
9709
- const updateToken = await axios9.post(`${masterBaseUrl}api/v1/gateway/update/token/${session_token}`, data);
9710
- if ((updateToken == null ? void 0 : updateToken.status) == 200) {
9711
- let respData = {
9712
- Token: (_b2 = (_a2 = updateToken == null ? void 0 : updateToken.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.gateway_token,
9713
- Brand: token.Brand,
9714
- ExpirationMonth: token.ExpirationMonth,
9715
- ExpirationYear: token.ExpirationYear,
9716
- Last4: token.Last4,
9717
- Bin: token.Bin,
9718
- CVV: token.CVV,
9719
- postalCode: cardData == null ? void 0 : cardData.zipCode
9720
- };
9721
- let addCard;
9722
- if (isPreAuth) {
9723
- handlePreAuth(respData);
9724
- } else {
9725
- handleCharge(respData);
9726
- }
9773
+
9774
+
9775
+ .card-error-overlay .error-icon-overlay {
9776
+ display: flex;
9777
+ flex-direction: column;
9778
+ align-items: center;
9779
+ gap: 12px;
9780
+ min-height: 116px;
9781
+ z-index: 2;
9727
9782
  }
9728
- } catch (error2) {
9729
- console.log(error2, "error");
9730
- hideLoader();
9731
- setError(((_d2 = (_c2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!");
9732
- callback({
9733
- error: ((_f2 = (_e2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.message) || "Something went wrong!",
9734
- result: (_h2 = (_g2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.result,
9735
- statusCode: (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.status
9736
- });
9737
- }
9783
+
9784
+ .card-error-overlay .circle {
9785
+ width: 50px;
9786
+ height: 50px;
9787
+ border: 1px solid red;
9788
+ border-radius: 50%;
9789
+ display: flex;
9790
+ justify-content: center;
9791
+ align-items: center;
9792
+ margin-bottom:20px
9793
+ }
9794
+
9795
+ .card-error-overlay .circle .fa-times {
9796
+ font-size: 30px;
9797
+ color: red;
9798
+ }
9799
+
9800
+ .card-error-overlay .error-text-overlay {
9801
+ display: flex;
9802
+ flex-direction: column;
9803
+ justify-content: center;
9804
+ align-items: center;
9805
+ gap: 4px;
9806
+ // width: 227px;
9807
+ }
9808
+
9809
+ .card-error-overlay .payment-error-text-overlay {
9810
+ font-family: 'Inter', sans-serif;
9811
+ font-weight: 500;
9812
+ font-size: 18px;
9813
+ line-height: 21px;
9814
+ text-align: center;
9815
+ letter-spacing: -0.02em;
9816
+ color: #161616;
9817
+ }
9818
+
9819
+ .card-error-overlay .thank-you-text-overlay {
9820
+ font-family: 'Inter', sans-serif;
9821
+ font-weight: 500;
9822
+ font-size: 16px;
9823
+ line-height: 18px;
9824
+ text-align: center;
9825
+ letter-spacing: -0.02em;
9826
+ color: #161616 !important;
9827
+ opacity: 0.5;
9828
+ padding-top:10px
9829
+ }
9830
+
9831
+ .card-error-overlay .error-btn-div-overlay{
9832
+ padding-top:20px;
9833
+ width: 100%;
9834
+
9835
+ }
9836
+ .card-error-overlay .error-btn-div-overlay button{
9837
+ outline: 0;
9838
+ height: 46px;
9839
+ font-size: 16px;
9840
+ background: #727272;
9841
+ border: none;
9842
+ display: block;
9843
+ color: #fff;
9844
+ width: 100%;
9845
+ border-radius: 180px;
9846
+ margin: 10px 0;
9847
+ text-decoration: none;
9848
+ }
9849
+ .card-error-overlay .error-btn-div-overlay button:hover, .card-error-overlay .error-btn-div-overlay button:focus {
9850
+ background: #222;
9851
+ color: #fff;
9852
+ cursor: pointer;
9853
+ }
9854
+ .payment-error-container-overlay {
9855
+ width: fit-content;
9856
+ position: relative;
9857
+ top: 50%;
9858
+ left: 50%;
9859
+ transform: translate(-50%, -50%);
9860
+ background: rgba(255, 255, 255, 0.15);
9861
+ backdrop-filter: blur(12px);
9862
+ -webkit-backdrop-filter: blur(12px);
9863
+ border-radius: 12px;
9864
+ z-index: 11111;
9865
+ max-width: 240px;
9866
+ min-width: 224px;
9867
+ padding: 20px;
9868
+ margin-left: 17px !important;
9869
+ }
9870
+ .card-error-overlay {
9871
+ position: absolute;
9872
+ top: 0;
9873
+ left: 0;
9874
+ width: 100%;
9875
+ height: 100%;
9876
+ background: rgb(87 87 87 / 15%);
9877
+ backdrop-filter: blur(2px);
9878
+ -webkit-backdrop-filter: blur(12px);
9879
+ z-index: 1111;
9880
+ }
9881
+ ` });
9882
+ }
9883
+
9884
+ // src/app/components/ErrorCardMessage/ErrorCardOverlay.tsx
9885
+ import { Fragment as Fragment18, jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
9886
+ var ErrorCardOverlay = ({ onClose, error, autoTrigger = false }) => {
9887
+ return /* @__PURE__ */ jsxs19(Fragment18, { children: [
9888
+ /* @__PURE__ */ jsx33(ErrorCardOverlayStyle, {}),
9889
+ /* @__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: [
9890
+ /* @__PURE__ */ jsx33("div", { className: "circle", children: /* @__PURE__ */ jsx33("i", { className: "fa fa-times", "aria-hidden": "true" }) }),
9891
+ /* @__PURE__ */ jsxs19("div", { className: "error-text-overlay", children: [
9892
+ /* @__PURE__ */ jsx33("div", { className: "payment-error-text-overlay", children: error }),
9893
+ /* @__PURE__ */ jsx33("div", { className: "thank-you-text-overlay", children: "Try again later " })
9894
+ ] }),
9895
+ !autoTrigger && /* @__PURE__ */ jsx33("div", { className: "error-btn-div-overlay", children: /* @__PURE__ */ jsx33("button", { onClick: onClose, children: "OK" }) })
9896
+ ] }) }) })
9897
+ ] });
9898
+ };
9899
+ var ErrorCardOverlay_default = ErrorCardOverlay;
9900
+
9901
+ // src/app/components/Atoms/Googlepay/Googlepay.tsx
9902
+ import { useRef as useRef10 } from "react";
9903
+
9904
+ // src/app/components/Atoms/Googlepay/GooglePayScriptLoader.tsx
9905
+ import { useEffect as useEffect15 } from "react";
9906
+ var googlePayScriptLoaded = false;
9907
+ var GooglePayScriptLoader = ({
9908
+ onLoad
9909
+ }) => {
9910
+ useEffect15(() => {
9911
+ if (googlePayScriptLoaded) {
9912
+ onLoad == null ? void 0 : onLoad();
9913
+ return;
9914
+ }
9915
+ const existingScript = document.querySelector(
9916
+ `script[src="https://pay.google.com/gp/p/js/pay.js"]`
9917
+ );
9918
+ if (!existingScript) {
9919
+ const script2 = document.createElement("script");
9920
+ script2.src = "https://pay.google.com/gp/p/js/pay.js";
9921
+ script2.async = true;
9922
+ script2.onload = () => {
9923
+ console.log("\u2705 Google Pay script loaded");
9924
+ googlePayScriptLoaded = true;
9925
+ console.log("google:", window.google);
9926
+ onLoad == null ? void 0 : onLoad();
9927
+ };
9928
+ script2.onerror = (err) => {
9929
+ console.error("\u274C Google Pay script failed", err);
9930
+ };
9931
+ document.head.appendChild(script2);
9932
+ } else {
9933
+ googlePayScriptLoaded = true;
9934
+ onLoad == null ? void 0 : onLoad();
9738
9935
  }
9936
+ }, []);
9937
+ return null;
9938
+ };
9939
+
9940
+ // src/app/components/Atoms/Googlepay/Googlepay.tsx
9941
+ import { Fragment as Fragment19, jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
9942
+ function GooglePayComponent({
9943
+ amount,
9944
+ googlePayEnvironment: googlePayEnvironment2,
9945
+ googlePayGatewayMerchantId: googlePayGatewayMerchantId2,
9946
+ googlePayMerchantId: googlePayMerchantId2,
9947
+ googlePayMerchantName,
9948
+ require3ds = false,
9949
+ completeFractalFlow,
9950
+ setLoading
9951
+ }) {
9952
+ const containerRef = useRef10(null);
9953
+ const paymentsClientRef = useRef10(null);
9954
+ const baseRequest = {
9955
+ apiVersion: 2,
9956
+ apiVersionMinor: 0
9739
9957
  };
9740
- const handletabchange = (id) => {
9741
- setActive(id);
9958
+ const allowedCardNetworks = ["AMEX", "DISCOVER", "MASTERCARD", "VISA"];
9959
+ const allowedCardAuthMethods = require3ds ? ["CRYPTOGRAM_3DS"] : ["PAN_ONLY", "CRYPTOGRAM_3DS"];
9960
+ const baseCardPaymentMethod = {
9961
+ type: "CARD",
9962
+ parameters: {
9963
+ allowedAuthMethods: allowedCardAuthMethods,
9964
+ allowedCardNetworks
9965
+ }
9742
9966
  };
9743
- const validateAchData = () => {
9744
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
9745
- const errors = {};
9746
- const data = achData;
9747
- if (!((_a2 = data == null ? void 0 : data.name) == null ? void 0 : _a2.trim())) errors.name = "Name is required";
9748
- if (!((_b2 = data == null ? void 0 : data.accountNumber) == null ? void 0 : _b2.trim())) errors.accountNumber = "Account number is required";
9749
- 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";
9750
- if (!((_f2 = data == null ? void 0 : data.bankName) == null ? void 0 : _f2.trim())) errors.bankName = "Bank name is required";
9751
- if (!((_g2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _g2.trim())) errors.routingNumber = "Routing Number is required";
9752
- 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";
9753
- if ((data == null ? void 0 : data.accountType) === "business saving" || (data == null ? void 0 : data.accountType) === "business checking") {
9754
- if (!(data == null ? void 0 : data.companyName) || (data == null ? void 0 : data.companyName) === "") {
9755
- errors.companyName = "Company Name is required for business accounts";
9967
+ const cardPaymentMethod = __spreadProps(__spreadValues({}, baseCardPaymentMethod), {
9968
+ tokenizationSpecification: {
9969
+ type: "PAYMENT_GATEWAY",
9970
+ parameters: {
9971
+ gateway: googlePayGatewayMerchantId2,
9972
+ gatewayMerchantId: googlePayGatewayMerchantId2
9756
9973
  }
9757
9974
  }
9758
- if (!isBankConsentChecked) {
9759
- setErrorBankConsent("Above consent is required");
9975
+ });
9976
+ const handlePaymentAuthorization = async (paymentData) => {
9977
+ var _a, _b;
9978
+ try {
9979
+ const token = (_b = (_a = paymentData == null ? void 0 : paymentData.paymentMethodData) == null ? void 0 : _a.tokenizationData) == null ? void 0 : _b.token;
9980
+ if (!token) throw new Error("Missing token");
9981
+ const parsed = JSON.parse(token);
9982
+ console.log(parsed, "parsed token");
9983
+ setLoading(true);
9984
+ completeFractalFlow(parsed, null, "google_pay");
9985
+ return {
9986
+ transactionState: "SUCCESS"
9987
+ // ✅ CLOSES GOOGLE PAY POPUP
9988
+ };
9989
+ } catch (err) {
9990
+ console.error("Payment failed:", err);
9991
+ return {
9992
+ transactionState: "ERROR",
9993
+ // ❌ CLOSES WITH ERROR UI
9994
+ error: {
9995
+ intent: "PAYMENT_AUTHORIZATION",
9996
+ message: "Payment failed",
9997
+ reason: "PAYMENT_DATA_INVALID"
9998
+ }
9999
+ };
9760
10000
  }
9761
- setAchError(errors);
9762
- return Object.keys(errors).length > 0 || !isBankConsentChecked;
9763
10001
  };
9764
- const completeFractalFlow = async (tokenizeData, intentid) => {
9765
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
9766
- try {
9767
- let token = tokenizeData;
9768
- let verifyandsaveresp = await axios9.post(`${masterBaseUrl}api/v1/gateway/verify-and-save/${session_token}`, {
9769
- token,
9770
- require3ds,
9771
- pass_fee
9772
- });
9773
- if ((verifyandsaveresp == null ? void 0 : verifyandsaveresp.status) == 200) {
9774
- let responsetemp = (_a2 = verifyandsaveresp == null ? void 0 : verifyandsaveresp.data) == null ? void 0 : _a2.data;
9775
- let respData = {
9776
- Token: responsetemp.gateway_token,
9777
- Brand: responsetemp.card_data.brand,
9778
- ExpirationMonth: responsetemp.card_data.expire_mm,
9779
- ExpirationYear: responsetemp.card_data.expire_yy,
9780
- Last4: responsetemp.card_data.last4,
9781
- Bin: responsetemp.card_data.bin,
9782
- postalCode: cardData == null ? void 0 : cardData.zipCode,
9783
- stripe_3ds_auth_id: intentid
9784
- };
9785
- if (isPreAuth) {
9786
- handlePreAuth(respData);
9787
- } else {
9788
- handleCharge(respData);
10002
+ const getPaymentsClient = () => {
10003
+ if (!paymentsClientRef.current && typeof window !== "undefined") {
10004
+ const google = window.google;
10005
+ if (!google) return null;
10006
+ paymentsClientRef.current = new google.payments.api.PaymentsClient({
10007
+ environment: googlePayEnvironment2,
10008
+ // ✅ ADD THIS
10009
+ paymentDataCallbacks: {
10010
+ onPaymentAuthorized: handlePaymentAuthorization
9789
10011
  }
9790
- }
9791
- } catch (error2) {
9792
- console.log(error2, "error");
9793
- setError(((_c2 = (_b2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _b2.data) == null ? void 0 : _c2.message) || "Something went wrong!");
9794
- callback({
9795
- error: ((_e2 = (_d2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _d2.data) == null ? void 0 : _e2.message) || "Something went wrong!",
9796
- result: (_g2 = (_f2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _f2.data) == null ? void 0 : _g2.result,
9797
- statusCode: (_h2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _h2.status
9798
10012
  });
9799
- hideLoader();
9800
10013
  }
10014
+ return paymentsClientRef.current;
9801
10015
  };
9802
- const handleFractalTokenFlow = async () => {
9803
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t, _u, _v, _w;
10016
+ const getIsReadyToPayRequest = () => __spreadProps(__spreadValues({}, baseRequest), {
10017
+ allowedPaymentMethods: [baseCardPaymentMethod]
10018
+ });
10019
+ const getTransactionInfo = () => ({
10020
+ countryCode: "US",
10021
+ currencyCode: "USD",
10022
+ totalPriceStatus: "FINAL",
10023
+ totalPrice: amount,
10024
+ checkoutOption: "COMPLETE_IMMEDIATE_PURCHASE"
10025
+ });
10026
+ const getPaymentDataRequest = () => __spreadProps(__spreadValues({}, baseRequest), {
10027
+ allowedPaymentMethods: [cardPaymentMethod],
10028
+ transactionInfo: getTransactionInfo(),
10029
+ merchantInfo: {
10030
+ merchantId: googlePayMerchantId2,
10031
+ merchantName: googlePayMerchantName
10032
+ },
10033
+ // ✅ ADD THIS
10034
+ callbackIntents: ["PAYMENT_AUTHORIZATION"]
10035
+ });
10036
+ const initializeGooglePay = async () => {
9804
10037
  try {
9805
- const requestOptions = {
9806
- method: "POST",
9807
- redirect: "follow"
9808
- };
9809
- let sesionResult = await axios9.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
9810
- let objtokenize = {
9811
- 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),
9812
- session_key: (_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key
9813
- };
9814
- let three_ds_data = null;
9815
- if (require3ds) {
9816
- if (typeof window !== "undefined" && typeof navigator !== "undefined") {
9817
- const languages = (_g2 = navigator.languages) != null ? _g2 : [navigator.language];
9818
- const language = Array.isArray(languages) ? languages[0] : languages;
9819
- three_ds_data = {
9820
- amount: partialAmount ? Math.round(parseFloat(partialAmount) * 100) : Math.round(parseFloat(amount) * 100),
9821
- // convert dollars → cents
9822
- currency: "usd",
9823
- channel: {
9824
- type: "browser",
9825
- browser: {
9826
- language: typeof language === "string" ? language : null,
9827
- color_depth: (_i2 = (_h2 = window.screen) == null ? void 0 : _h2.colorDepth) != null ? _i2 : null,
9828
- java_enabled: typeof navigator.javaEnabled === "function" ? navigator.javaEnabled() : false,
9829
- screen_height: (_k2 = (_j2 = window.screen) == null ? void 0 : _j2.height) != null ? _k2 : null,
9830
- screen_width: (_m2 = (_l2 = window.screen) == null ? void 0 : _l2.width) != null ? _m2 : null,
9831
- timezoneOffset: (/* @__PURE__ */ new Date()).getTimezoneOffset()
9832
- }
9833
- }
9834
- };
9835
- }
9836
- }
9837
- let tokenizeData;
9838
- try {
9839
- tokenizeData = await tokenizerRef.current.createToken(
9840
- objtokenize,
9841
- three_ds_data
9842
- );
9843
- } catch (error2) {
9844
- setErrorIframe(error2);
9845
- hideLoader();
10038
+ const client = getPaymentsClient();
10039
+ if (!client) {
10040
+ console.error("Google Pay client not ready");
10041
+ return;
9846
10042
  }
9847
- if (tokenizeData == null ? void 0 : tokenizeData.token) {
9848
- let ThreedsData = tokenizeData == null ? void 0 : tokenizeData.stripe_three_ds_response;
9849
- if (require3ds && !ThreedsData && (ThreedsData == null ? void 0 : ThreedsData.status) === "200 OK" && ((_n2 = ThreedsData == null ? void 0 : ThreedsData.data) == null ? void 0 : _n2.challenge_url)) {
9850
- setError("Something went wrong. Please try again later.");
9851
- }
9852
- if (require3ds) {
9853
- if (!((_o2 = ThreedsData == null ? void 0 : ThreedsData.data) == null ? void 0 : _o2.challenge_url)) {
9854
- completeFractalFlow(tokenizeData == null ? void 0 : tokenizeData.token, (_p2 = ThreedsData == null ? void 0 : ThreedsData.data) == null ? void 0 : _p2.id);
9855
- } else {
9856
- hideLoader();
9857
- setStripeResponse(__spreadProps(__spreadValues({}, ThreedsData == null ? void 0 : ThreedsData.data), {
9858
- fractalToken: tokenizeData == null ? void 0 : tokenizeData.token
9859
- }));
9860
- }
9861
- } else {
9862
- completeFractalFlow(tokenizeData == null ? void 0 : tokenizeData.token, null);
10043
+ const response = await client.isReadyToPay(
10044
+ getIsReadyToPayRequest()
10045
+ );
10046
+ if (response.result && containerRef.current) {
10047
+ const button = client.createButton({
10048
+ onClick: onGooglePayClick,
10049
+ allowedPaymentMethods: [baseCardPaymentMethod],
10050
+ buttonType: "pay",
10051
+ buttonColor: "black",
10052
+ buttonRadius: 8
10053
+ });
10054
+ if (containerRef.current) {
10055
+ containerRef.current.innerHTML = "";
9863
10056
  }
10057
+ containerRef.current.appendChild(button);
9864
10058
  }
9865
- } catch (error2) {
9866
- hideLoader();
9867
- console.log(error2, "error");
9868
- let readableMessage = "Something went wrong!";
9869
- try {
9870
- const rawError = ((_q2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _q2.data) || (error2 == null ? void 0 : error2.message) || "";
9871
- const errorText = typeof rawError === "string" ? rawError : JSON.stringify(rawError);
9872
- const lines = ((_s2 = (_r2 = errorText.split) == null ? void 0 : _r2.call(errorText, "\n")) == null ? void 0 : _s2.filter(Boolean)) || [];
9873
- const lastLine = lines.at(-1) || "";
9874
- const parts = (_t = lastLine.split) == null ? void 0 : _t.call(lastLine, ": ");
9875
- readableMessage = (parts == null ? void 0 : parts.length) > 1 ? parts.pop().trim() : lastLine.trim() || readableMessage;
9876
- } catch (e) {
9877
- readableMessage = "Something went wrong!";
10059
+ } catch (err) {
10060
+ console.error("Google Pay init error:", err);
10061
+ }
10062
+ };
10063
+ const onGooglePayClick = async () => {
10064
+ const client = getPaymentsClient();
10065
+ if (!client) {
10066
+ console.error("Google Pay client not ready");
10067
+ return;
10068
+ }
10069
+ try {
10070
+ await client.loadPaymentData(getPaymentDataRequest());
10071
+ } catch (err) {
10072
+ if ((err == null ? void 0 : err.statusCode) !== "CANCELED") {
10073
+ console.error(err);
9878
10074
  }
9879
- setError(readableMessage);
9880
- callback({
9881
- error: readableMessage,
9882
- result: (_v = (_u = error2 == null ? void 0 : error2.response) == null ? void 0 : _u.data) == null ? void 0 : _v.result,
9883
- statusCode: (_w = error2 == null ? void 0 : error2.response) == null ? void 0 : _w.status
9884
- });
9885
10075
  }
9886
10076
  };
9887
- const validateCardData = () => {
9888
- var _a2, _b2;
9889
- const errors = {};
9890
- const data = cardData;
9891
- if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
9892
- if (!((_b2 = data == null ? void 0 : data.zipCode) == null ? void 0 : _b2.trim())) errors.zipCode = "ZIP code is required";
9893
- setCardError(errors);
9894
- return Object.keys(errors).length > 0;
10077
+ const onScriptLoad = () => {
10078
+ if (!googlePayEnvironment2 || !googlePayGatewayMerchantId2 || !amount || !googlePayMerchantId2) {
10079
+ console.error("Missing Google Pay config");
10080
+ return;
10081
+ }
10082
+ setTimeout(() => {
10083
+ initializeGooglePay();
10084
+ }, 0);
9895
10085
  };
9896
- const validateCardInputs = () => {
9897
- let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
9898
- let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
9899
- let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
9900
- let errors = {};
9901
- if (!validCard) errors.cardNumber = "Invalid card Number";
9902
- if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
9903
- if (!validCVV) errors.cvv = "Invalid CVV";
9904
- setCardError(errors);
9905
- return validCard && validCVV && validExpirationDate;
10086
+ return /* @__PURE__ */ jsxs20(Fragment19, { children: [
10087
+ /* @__PURE__ */ jsx34("div", { ref: containerRef, className: "text-center" }),
10088
+ /* @__PURE__ */ jsx34(GooglePayScriptLoader, { onLoad: onScriptLoad })
10089
+ ] });
10090
+ }
10091
+
10092
+ // src/app/components/Atoms/Applepay/ApplePayButton.tsx
10093
+ import { useEffect as useEffect17, useRef as useRef11 } from "react";
10094
+ import { jsx as jsx35 } from "react/jsx-runtime";
10095
+ function ApplePayButton({
10096
+ applePayMerchantId: applePayMerchantId2,
10097
+ applePayAmount,
10098
+ applePayMerchantName,
10099
+ showLoader,
10100
+ completeFractalFlow
10101
+ }) {
10102
+ const applePayRef = useRef11(null);
10103
+ const paymentRequestMethods = [
10104
+ {
10105
+ supportedMethods: "https://apple.com/apple-pay",
10106
+ data: {
10107
+ version: 3,
10108
+ merchantIdentifier: applePayMerchantId2,
10109
+ // ✅ FIXED
10110
+ merchantCapabilities: ["supports3DS"],
10111
+ supportedNetworks: ["amex", "discover", "mastercard", "visa"],
10112
+ // ✅ FIXED
10113
+ countryCode: "US"
10114
+ }
10115
+ }
10116
+ ];
10117
+ const paymentRequestOptions = {
10118
+ requestPayerName: false,
10119
+ requestPayerEmail: false,
10120
+ requestPayerPhone: false,
10121
+ requestShipping: false
9906
10122
  };
9907
- const submitFunc = async (e) => {
9908
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
9909
- e.preventDefault();
9910
- const el = document.activeElement;
9911
- if (el instanceof HTMLElement) {
9912
- el.blur();
10123
+ function buildPaymentDetails() {
10124
+ return {
10125
+ total: {
10126
+ label: applePayMerchantName,
10127
+ amount: {
10128
+ currency: "USD",
10129
+ value: applePayAmount
10130
+ }
10131
+ }
10132
+ };
10133
+ }
10134
+ async function validateMerchant(event) {
10135
+ var _a;
10136
+ console.log("\u{1F7E1} STEP 1: Merchant validation started");
10137
+ try {
10138
+ console.log("Validation URL:", event.validationURL);
10139
+ console.log("Domain:", window.location.hostname);
10140
+ const res = await fetch(
10141
+ `${masterBaseUrl}api/v1/widget/generate-apple-pay-session`,
10142
+ {
10143
+ method: "POST",
10144
+ headers: {
10145
+ "Content-Type": "application/json"
10146
+ },
10147
+ body: JSON.stringify({
10148
+ validationUrl: event.validationURL,
10149
+ applePayMerchantId: applePayMerchantId2,
10150
+ applepayDisplayName: applePayMerchantName,
10151
+ requestDomain: window.location.hostname
10152
+ // ✅ IMPORTANT
10153
+ })
10154
+ }
10155
+ );
10156
+ console.log("\u{1F7E1} STEP 2: Response status:", res.status);
10157
+ const data = await res.json();
10158
+ console.log("RAW session response:", JSON.stringify(data));
10159
+ console.log("\u{1F7E2} STEP 3: Session response: data fetched");
10160
+ const merchantSession = (_a = data == null ? void 0 : data.data) != null ? _a : data;
10161
+ if (!merchantSession || typeof merchantSession !== "object") {
10162
+ console.error("\u274C Bad session shape");
10163
+ event.complete(null);
10164
+ return;
10165
+ }
10166
+ console.log("\u{1F7E2} STEP 4.1: Completing merchant validation");
10167
+ event.complete(merchantSession);
10168
+ console.log("\u{1F7E2} STEP 4.2: Completed merchant validation");
10169
+ } catch (err) {
10170
+ console.log("\u274C Merchant validation failed:", err == null ? void 0 : err.message);
10171
+ event.complete(null);
9913
10172
  }
9914
- if (loading) return;
9915
- if (partialError) {
9916
- return;
10173
+ }
10174
+ async function authorizePayment(paymentResponse) {
10175
+ console.log("\u{1F7E1} STEP 5: Authorizing payment");
10176
+ try {
10177
+ const token = paymentResponse.details.token.paymentData;
10178
+ console.log("\u{1F7E2} STEP 6: Got token");
10179
+ await completeFractalFlow(token, null, "apple_pay");
10180
+ await paymentResponse.complete("success");
10181
+ console.log("\u2705 Payment completed successfully");
10182
+ } catch (err) {
10183
+ console.log("\u274C Authorization failed:", err == null ? void 0 : err.message);
10184
+ await paymentResponse.complete("fail");
9917
10185
  }
9918
- if (activetab !== "ach") {
9919
- const hasError = validateCardData();
9920
- if (hasError) return;
9921
- let isValid = true;
9922
- if (!isValid) return;
10186
+ }
10187
+ async function handleApplePayClick() {
10188
+ console.log("\u{1F7E1} STEP A: Click detected");
10189
+ try {
10190
+ const request = new PaymentRequest(
10191
+ paymentRequestMethods,
10192
+ buildPaymentDetails(),
10193
+ paymentRequestOptions
10194
+ );
10195
+ request.onmerchantvalidation = validateMerchant;
10196
+ console.log("\u{1F7E1} STEP B: Calling show()");
10197
+ const response = await request.show();
10198
+ console.log("\u{1F7E2} STEP C: Payment sheet opened");
10199
+ await authorizePayment(response);
10200
+ } catch (err) {
10201
+ console.log("\u274C Apple Pay flow failed:", err == null ? void 0 : err.message);
10202
+ }
10203
+ }
10204
+ useEffect17(() => {
10205
+ if (window.ApplePaySession && window.ApplePaySession.canMakePayments()) {
10206
+ console.log("\u2705 Apple Pay is available");
9923
10207
  } else {
9924
- const hasError = validateAchData();
9925
- if (hasError) return;
10208
+ console.log("\u274C Apple Pay NOT available");
10209
+ }
10210
+ }, []);
10211
+ useEffect17(() => {
10212
+ const btn = applePayRef.current;
10213
+ if (!btn) return;
10214
+ const handleClick = () => handleApplePayClick();
10215
+ btn.addEventListener("click", handleClick);
10216
+ return () => btn.removeEventListener("click", handleClick);
10217
+ }, [applePayMerchantId2, applePayAmount, applePayMerchantName]);
10218
+ return /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(
10219
+ "apple-pay-button",
10220
+ {
10221
+ ref: applePayRef,
10222
+ buttonstyle: "black",
10223
+ type: "pay",
10224
+ locale: "en-US",
10225
+ style: { width: "100%" }
10226
+ }
10227
+ ) });
10228
+ }
10229
+
10230
+ // src/app/components/Atoms/ModelContentSky/ModelContentSky.tsx
10231
+ import { Fragment as Fragment20, jsx as jsx36, jsxs as jsxs21 } from "react/jsx-runtime";
10232
+ 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, customCSS: customCSS2 }) => {
10233
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
10234
+ const hasRunRef = useRef12(false);
10235
+ const cardFormRef = useRef12(null);
10236
+ const bankFormRef = useRef12(null);
10237
+ const expiryYearRef = useRef12(null);
10238
+ const expiryMonthRef = useRef12(null);
10239
+ const cardListRunRef = useRef12(false);
10240
+ const threeDSContainerRef = useRef12(null);
10241
+ const [activetab, setActive] = useState11("card");
10242
+ const [activeList, setActiveList] = useState11("card");
10243
+ const [cardData, setCardData] = useState11();
10244
+ const [cardError, setCardError] = useState11({});
10245
+ const [achData, setAchData] = useState11();
10246
+ const [achError, setAchError] = useState11({});
10247
+ const [saveACHinfo, setSaveACHinfo] = useState11(false);
10248
+ const [saveACHConsent1, setSaveACHConsent1] = useState11(false);
10249
+ const [saveCardInfo, setSaveCardInfo] = useState11(false);
10250
+ const [error, setError] = useState11("");
10251
+ const [errorIframe, setErrorIframe] = useState11("");
10252
+ const [success, setSuccess] = useState11(false);
10253
+ let [tranId, setTranId] = useState11("");
10254
+ const [loading, setLoading] = useState11(false);
10255
+ const [loading2, setLoading2] = useState11(false);
10256
+ const [loadingIframe, setLoadingIframe] = useState11(false);
10257
+ const [cardList, setCardList] = useState11([]);
10258
+ const [bankList, setBankList] = useState11([]);
10259
+ const [selectedCard, setSelectedCard] = useState11();
10260
+ const [cashDiscount, setCashDiscount] = useState11(Number(amount));
10261
+ const [activeinCard, setActiveinCard] = useState11("form");
10262
+ const [activeinBank, setActiveinBank] = useState11("form");
10263
+ const [isBankActive, setIsBankActive] = useState11(false);
10264
+ const [processingFee, setProcessingFee] = useState11(0);
10265
+ const [clientSecret, setClientSecret] = useState11("");
10266
+ const [errorMessage, setErrorMessage] = useState11(null);
10267
+ const [initialLoader, setInitialLoader] = useState11(false);
10268
+ const [is3DSEnable, setIs3DSEnable] = useState11(false);
10269
+ const [stripeResponse, setStripeResponse] = useState11(null);
10270
+ const [orderLoader, setOrderLoader] = useState11(false);
10271
+ const [orderGuid, setOrderGuid] = useState11(ordGuid || null);
10272
+ const [partialAmount, setPartialAmount] = useState11("");
10273
+ const [partialError, setPartialError] = useState11("");
10274
+ const [remainingAmount, setRemainingAmount] = useState11("");
10275
+ const [paymentGateway, setPaymentGateway] = useState11();
10276
+ const [dcToken, setDCToken] = useState11();
10277
+ const [isBankConsentChecked, setIsBankConsentChecked] = useState11(false);
10278
+ const [errorBankConsent, setErrorBankConsent] = useState11("");
10279
+ const [errorBankConsentOther, setErrorBankConsentOther] = useState11("");
10280
+ let mastercard2 = S3Url + "widget/mc-img.svg";
10281
+ let visa2 = S3Url + "widget/visa-img.svg";
10282
+ let americanexp2 = S3Url + "widget/ae-img.svg";
10283
+ let discover2 = S3Url + "widget/discover-img.svg";
10284
+ let defaultcard2 = S3Url + "widget/card.svg";
10285
+ let trash2 = S3Url + "widget/Trash.svg";
10286
+ let bank2 = S3Url + "widget/bank.svg";
10287
+ let secure2 = S3Url + "widget/secure-img.png";
10288
+ let pov2 = S3Url + "widget/pov-by.png";
10289
+ let pax2 = S3Url + "widget/pax.svg";
10290
+ let cardicon = S3Url + "widget/cardicon.svg";
10291
+ let bankicon = S3Url + "widget/bankicon.svg";
10292
+ let defualtcardborder = S3Url + "widget/defualtcardborder.svg";
10293
+ let unionicon = S3Url + "widget/unionpay.svg";
10294
+ let dinersicon = S3Url + "widget/diners.svg";
10295
+ let jcbicon = S3Url + "widget/jcb.svg";
10296
+ const showLoader = () => setLoading(true);
10297
+ const hideLoader = () => setLoading(false);
10298
+ const CalculateCashDiscount = (amount2, surcharge2) => {
10299
+ const surchargeVal = (parseFloat(surcharge2) || 0) / 100;
10300
+ const originalAmount = amount2 / (1 + surchargeVal);
10301
+ return Math.round(originalAmount * 100) / 100;
10302
+ };
10303
+ const cardFeeAmount = Number(pass_fee_amount || 0);
10304
+ const bankFeeAmount = Number(bankSurcharge || 0);
10305
+ const bankSavingsAmount = Math.max(bankFeeAmount > 0 ? cardFeeAmount - bankFeeAmount : cardFeeAmount, 0);
10306
+ const bankSavingsText = bankSavingsAmount > 0 ? `Save ${formatUSD(bankSavingsAmount.toFixed(2))}` : "";
10307
+ const tokenizerRef = useRef12(null);
10308
+ const fractalStyles = {
10309
+ input: {
10310
+ "font-family": "'Inter', sans-serif",
10311
+ "font-size": "16px",
10312
+ "color": "#212529",
10313
+ "background-color": "transparent",
10314
+ "padding": "0px",
10315
+ "appearance": "none",
10316
+ "outline": "none",
10317
+ "border": "none",
10318
+ "box-shadow": "none"
10319
+ },
10320
+ ":focus": {
10321
+ "color": "#212529",
10322
+ "outline": "none",
10323
+ "border": "none"
10324
+ },
10325
+ "::placeholder": {
10326
+ "color": "#212529"
9926
10327
  }
10328
+ };
10329
+ const handleCharge = async (data) => {
10330
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
9927
10331
  try {
9928
- showLoader();
9929
- const result = await axios9.get(`${masterBaseUrl}api/v1/gateway/token/${session_token}`, {
9930
- params: {
9931
- require3ds,
9932
- pass_fee
9933
- }
9934
- });
9935
- if ((result == null ? void 0 : result.status) == 200) {
9936
- let gatewayToken = (_b2 = (_a2 = result == null ? void 0 : result.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.gateway_token;
9937
- let paymentGateway2 = (_d2 = (_c2 = result == null ? void 0 : result.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.paymentGateway;
9938
- if (activetab !== "ach") {
9939
- if (paymentGateway2 == ((_e2 = PaymentMethodKeys) == null ? void 0 : _e2.FRACTALKEY)) {
9940
- await handleFractalTokenFlow();
9941
- } else {
9942
- try {
9943
- const result2 = await window.requestDcToken();
9944
- ;
9945
- console.log("Token:", result2.Token);
9946
- if (result2.Token) {
9947
- handleTokenCallback(result2);
9948
- }
9949
- } catch (err) {
9950
- console.log(err, "Error while tokenizing");
9951
- setErrorIframe(err);
9952
- setLoading(false);
9953
- }
9954
- }
9955
- } else {
9956
- let callbackdata;
9957
- try {
9958
- const payByBank = await axios9.post(`${masterBaseUrl}api/v1/gateway/bank-charge/${session_token}`, __spreadValues({
9959
- label: achData == null ? void 0 : achData.name,
9960
- account_number: achData == null ? void 0 : achData.accountNumber,
9961
- routing_number: achData == null ? void 0 : achData.routingNumber,
9962
- bank_name: achData == null ? void 0 : achData.bankName,
9963
- account_type: achData == null ? void 0 : achData.accountType,
9964
- amount: `${bankAmount}`,
9965
- customer_id: null,
9966
- isSaveAch: false,
9967
- tax: "0.00",
9968
- discount: "0.00",
9969
- surcharge: "0.00",
9970
- order_id: "",
9971
- company_name: (achData == null ? void 0 : achData.companyName) || ""
9972
- }, saveACHinfo ? {
9973
- bank: {
9974
- name: achData == null ? void 0 : achData.name,
9975
- account_number: achData == null ? void 0 : achData.accountNumber,
9976
- routing_number: achData == null ? void 0 : achData.routingNumber,
9977
- bank_name: achData == null ? void 0 : achData.bankName,
9978
- account_type: achData == null ? void 0 : achData.accountType,
9979
- customer_id: customerId || "",
9980
- company_name: (achData == null ? void 0 : achData.companyName) || ""
9981
- }
9982
- } : null));
9983
- if ((_f2 = payByBank == null ? void 0 : payByBank.data) == null ? void 0 : _f2.result) {
9984
- callbackdata = __spreadProps(__spreadValues({}, callbackdata), {
9985
- callback: __spreadProps(__spreadValues({}, (_g2 = payByBank == null ? void 0 : payByBank.data) == null ? void 0 : _g2.data), { name: achData == null ? void 0 : achData.name, isPreAuth })
9986
- });
9987
- callback(callbackdata);
9988
- handleClose();
9989
- hideLoader();
9990
- }
9991
- } catch (error2) {
9992
- console.log(error2, "errororor");
9993
- let data = (_h2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _h2.data;
9994
- if (typeof (data == null ? void 0 : data.message) == "object") {
9995
- Object.values(data == null ? void 0 : data.message).forEach((message) => {
9996
- var _a3;
9997
- setError(message || "Something went wrong");
9998
- callback({
9999
- error: message || "Something went wrong!",
10000
- result: (data == null ? void 0 : data.result) || false,
10001
- statusCode: (_a3 = error2 == null ? void 0 : error2.response) == null ? void 0 : _a3.status
10002
- });
10003
- });
10004
- } else {
10005
- setError((data == null ? void 0 : data.message) || "Something went wrong");
10006
- callback({
10007
- error: (data == null ? void 0 : data.message) || "Something went wrong!",
10008
- result: (data == null ? void 0 : data.result) || false,
10009
- statusCode: (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.status
10010
- });
10011
- }
10012
- hideLoader();
10013
- }
10332
+ let dataObj = __spreadValues(__spreadValues({
10333
+ pass_fee_amount: Number(amount) - cashDiscount,
10334
+ pass_fee,
10335
+ Token: data == null ? void 0 : data.Token,
10336
+ amount: partialAmount ? partialAmount : amount,
10337
+ postal_code: data == null ? void 0 : data.postalCode,
10338
+ require3ds,
10339
+ isPartial,
10340
+ orderGuid: orderGuid || ordGuid
10341
+ }, saveCardInfo ? {
10342
+ card: {
10343
+ postal_code: cardData == null ? void 0 : cardData.zipCode,
10344
+ customer_id: customerId,
10345
+ gateway_token: (data == null ? void 0 : data.Token) || (data == null ? void 0 : data.gateway_token),
10346
+ name: cardData == null ? void 0 : cardData.cardName
10014
10347
  }
10348
+ } : null), (data == null ? void 0 : data.typeoftoken) ? {
10349
+ typeoftoken: data == null ? void 0 : data.typeoftoken
10350
+ } : null);
10351
+ if (require3ds && (data == null ? void 0 : data.stripe_3ds_auth_id)) {
10352
+ dataObj.stripe_3ds_auth_id = data == null ? void 0 : data.stripe_3ds_auth_id;
10353
+ }
10354
+ const chargeResponse = await axios9.post(`${masterBaseUrl}api/v1/gateway/charge/${session_token}`, dataObj);
10355
+ if ((_a2 = chargeResponse == null ? void 0 : chargeResponse.data) == null ? void 0 : _a2.result) {
10356
+ let callbackdata = {
10357
+ // cardDetails: { ...addCard, ...data },
10358
+ callback: __spreadProps(__spreadValues({}, (_b2 = chargeResponse == null ? void 0 : chargeResponse.data) == null ? void 0 : _b2.data), { name: cardData == null ? void 0 : cardData.cardName, isPreAuth })
10359
+ };
10360
+ callback(callbackdata);
10361
+ hideLoader();
10362
+ handleClose();
10015
10363
  }
10016
10364
  } catch (error2) {
10017
- hideLoader();
10365
+ setError(((_d2 = (_c2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!");
10018
10366
  callback({
10019
- error: ((_k2 = (_j2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _j2.data) == null ? void 0 : _k2.message) || "Something went wrong!",
10020
- result: (_m2 = (_l2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _l2.data) == null ? void 0 : _m2.result,
10021
- statusCode: (_n2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _n2.status
10367
+ error: ((_f2 = (_e2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.message) || "Something went wrong!",
10368
+ result: (_h2 = (_g2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.result,
10369
+ statusCode: (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.status
10022
10370
  });
10023
- setError(((_p2 = (_o2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _o2.data) == null ? void 0 : _p2.message) || "Something went wrong!");
10371
+ hideLoader();
10024
10372
  }
10025
10373
  };
10026
- const handleCardChange = (field, value) => {
10027
- const name2 = field;
10028
- const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
10029
- if (numericFields.includes(name2)) {
10030
- if (value === "" || /^[0-9]+$/.test(value)) {
10031
- setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
10032
- [name2]: ""
10033
- }));
10034
- setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
10035
- [name2]: value
10036
- }));
10374
+ const handlePreAuth = async (data) => {
10375
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
10376
+ try {
10377
+ let dataObj = __spreadValues({
10378
+ Token: data == null ? void 0 : data.Token,
10379
+ amount,
10380
+ postal_code: data == null ? void 0 : data.postalCode
10381
+ }, saveCardInfo ? {
10382
+ card: {
10383
+ postal_code: cardData == null ? void 0 : cardData.zipCode,
10384
+ customer_id: customerId,
10385
+ gateway_token: (data == null ? void 0 : data.Token) || (data == null ? void 0 : data.gateway_token),
10386
+ name: cardData == null ? void 0 : cardData.cardName
10387
+ }
10388
+ } : null);
10389
+ const preAuthResponse = await axios9.post(`${masterBaseUrl}api/v1/gateway/preauth/${session_token}`, dataObj);
10390
+ if ((_a2 = preAuthResponse == null ? void 0 : preAuthResponse.data) == null ? void 0 : _a2.result) {
10391
+ let addCard;
10392
+ let callbackdata = {
10393
+ // cardDetails: { ...addCard, ...data },
10394
+ callback: __spreadProps(__spreadValues({}, (_b2 = preAuthResponse == null ? void 0 : preAuthResponse.data) == null ? void 0 : _b2.data), { name: cardData == null ? void 0 : cardData.cardName, isPreAuth })
10395
+ };
10396
+ callback(callbackdata);
10397
+ hideLoader();
10398
+ handleClose();
10037
10399
  }
10038
- return;
10400
+ } catch (error2) {
10401
+ setError(((_d2 = (_c2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!");
10402
+ callback({
10403
+ error: ((_f2 = (_e2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.message) || "Something went wrong!",
10404
+ result: (_h2 = (_g2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.result,
10405
+ statusCode: (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.status
10406
+ });
10407
+ hideLoader();
10039
10408
  }
10040
- setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
10041
- [name2]: ""
10042
- }));
10043
- setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
10044
- [name2]: value
10045
- }));
10046
- };
10047
- const handleCardNumberChange = (e) => {
10048
- var _a2;
10049
- const input = e.target;
10050
- const rawValue = input.value.replace(/\D/g, "");
10051
- const { formatted, cursor } = formatCardNumberWithCursor(
10052
- input.value,
10053
- (_a2 = input.selectionStart) != null ? _a2 : 0
10054
- );
10055
- setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
10056
- cardNumber: ""
10057
- }));
10058
- setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
10059
- cardNumber: formatted
10060
- }));
10061
- requestAnimationFrame(() => {
10062
- input.setSelectionRange(cursor, cursor);
10063
- });
10064
10409
  };
10065
- const handleChangeAch = (e) => {
10066
- const { name: name2, value } = e.target;
10067
- const numericFields = ["routingNumber", "accountNumber", "confirmAccountNumber"];
10068
- if (name2 == "name") {
10069
- if (/^[a-zA-Z\s]*$/.test(value)) {
10070
- setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
10071
- [name2]: ""
10072
- }));
10073
- setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
10074
- [name2]: value
10075
- }));
10410
+ const handleTokenCallback = async (token) => {
10411
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
10412
+ if (token.Error) {
10413
+ setError(token.Error);
10414
+ callback({
10415
+ error: token.Error || "Something went wrong!"
10416
+ });
10417
+ hideLoader();
10418
+ } else {
10419
+ let data = {
10420
+ token: token.Token,
10421
+ resp: token
10422
+ };
10423
+ try {
10424
+ const updateToken = await axios9.post(`${masterBaseUrl}api/v1/gateway/update/token/${session_token}`, data);
10425
+ if ((updateToken == null ? void 0 : updateToken.status) == 200) {
10426
+ let respData = {
10427
+ Token: (_b2 = (_a2 = updateToken == null ? void 0 : updateToken.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.gateway_token,
10428
+ Brand: token.Brand,
10429
+ ExpirationMonth: token.ExpirationMonth,
10430
+ ExpirationYear: token.ExpirationYear,
10431
+ Last4: token.Last4,
10432
+ Bin: token.Bin,
10433
+ CVV: token.CVV,
10434
+ postalCode: cardData == null ? void 0 : cardData.zipCode
10435
+ };
10436
+ let addCard;
10437
+ if (isPreAuth) {
10438
+ handlePreAuth(respData);
10439
+ } else {
10440
+ handleCharge(respData);
10441
+ }
10442
+ }
10443
+ } catch (error2) {
10444
+ console.log(error2, "error");
10445
+ hideLoader();
10446
+ setError(((_d2 = (_c2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!");
10447
+ callback({
10448
+ error: ((_f2 = (_e2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.message) || "Something went wrong!",
10449
+ result: (_h2 = (_g2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.result,
10450
+ statusCode: (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.status
10451
+ });
10076
10452
  }
10077
- return;
10078
10453
  }
10079
- if (numericFields.includes(name2)) {
10080
- if (value === "" || /^[0-9]+$/.test(value)) {
10081
- setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
10082
- [name2]: ""
10083
- }));
10084
- setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
10085
- [name2]: value
10086
- }));
10454
+ };
10455
+ const handletabchange = (id) => {
10456
+ setActive(id);
10457
+ };
10458
+ const validateAchData = () => {
10459
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
10460
+ const errors = {};
10461
+ const data = achData;
10462
+ if (!((_a2 = data == null ? void 0 : data.name) == null ? void 0 : _a2.trim())) errors.name = "Name is required";
10463
+ if (!((_b2 = data == null ? void 0 : data.accountNumber) == null ? void 0 : _b2.trim())) errors.accountNumber = "Account number is required";
10464
+ 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";
10465
+ if (!((_f2 = data == null ? void 0 : data.bankName) == null ? void 0 : _f2.trim())) errors.bankName = "Bank name is required";
10466
+ if (!((_g2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _g2.trim())) errors.routingNumber = "Routing Number is required";
10467
+ 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";
10468
+ if ((data == null ? void 0 : data.accountType) === "business saving" || (data == null ? void 0 : data.accountType) === "business checking") {
10469
+ if (!(data == null ? void 0 : data.companyName) || (data == null ? void 0 : data.companyName) === "") {
10470
+ errors.companyName = "Company Name is required for business accounts";
10087
10471
  }
10088
- return;
10089
10472
  }
10090
- setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
10091
- [name2]: ""
10092
- }));
10093
- setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
10094
- [name2]: value
10095
- }));
10096
- };
10097
- const handleClose = () => {
10098
- setShow(false);
10099
- setActive("card");
10100
- setError("");
10101
- setSuccess(false);
10102
- setTranId("");
10103
- setAchData({
10104
- name: "",
10105
- routingNumber: "",
10106
- accountNumber: "",
10107
- confirmAccountNumber: "",
10108
- bankName: "",
10109
- accountType: ""
10110
- });
10111
- setAchError({
10112
- name: "",
10113
- routingNumber: "",
10114
- accountNumber: "",
10115
- confirmAccountNumber: "",
10116
- bankName: "",
10117
- accountType: ""
10118
- });
10119
- setCardData({
10120
- cardName: "",
10121
- cardNumber: "",
10122
- expiryMonth: "",
10123
- expiryYear: "",
10124
- cvv: "",
10125
- orderId: "",
10126
- zipCode: ""
10127
- });
10128
- setCardError({
10129
- cardName: "",
10130
- cardNumber: "",
10131
- expiryMonth: "",
10132
- expiryYear: "",
10133
- cvv: "",
10134
- orderId: "",
10135
- zipCode: ""
10136
- });
10137
- setSaveACHinfo(false);
10138
- setSaveCardInfo(false);
10139
- setActiveinBank("form");
10140
- setActiveinCard("form");
10141
- setIsBankActive(false);
10142
- setProcessingFee(0);
10143
- setCashDiscount(0);
10144
- setCardList([]);
10145
- setErrorMessage(null);
10146
- setClientSecret(null);
10147
- setInitialLoader(false);
10148
- setIs3DSEnable(false);
10149
- setStripeResponse(null);
10150
- setOrderGuid(null);
10151
- setPartialAmount("");
10152
- setPartialError("");
10153
- setRemainingAmount("");
10154
- setIsBankConsentChecked(false);
10155
- setErrorBankConsent("");
10473
+ if (!saveACHinfo && !isBankConsentChecked) {
10474
+ setErrorBankConsent("Above consent is required");
10475
+ }
10476
+ if (saveACHinfo && !saveACHConsent1) {
10477
+ setErrorBankConsentOther("Your consent is required to save your bank details for future use");
10478
+ }
10479
+ setAchError(errors);
10480
+ return Object.keys(errors).length > 0;
10156
10481
  };
10157
- const getCardList = async () => {
10158
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
10159
- showLoader();
10482
+ const completeFractalFlow = async (tokenizeData, intentid, typeoftoken) => {
10483
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
10160
10484
  try {
10161
- const data = {
10162
- isPreAuth,
10163
- "customerId": customerId
10164
- };
10165
- let cardListData = await axios9.post(`${masterBaseUrl}api/v1/gateway/card-list/${session_token}`, data);
10166
- let savedpaymentsList = ((_b2 = (_a2 = cardListData == null ? void 0 : cardListData.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.cardList) || [];
10167
- let banklists = savedpaymentsList == null ? void 0 : savedpaymentsList.filter((card) => (card == null ? void 0 : card.card_type) == "Bank");
10168
- let cardlists = savedpaymentsList == null ? void 0 : savedpaymentsList.filter((card) => (card == null ? void 0 : card.card_type) !== "Bank");
10169
- if (cardlists && (cardlists == null ? void 0 : cardlists.length) > 0) {
10170
- setActive("card");
10171
- setActiveinCard("list");
10172
- setCardList(cardlists);
10173
- setLoadingIframe(false);
10174
- } else {
10175
- setActive("card");
10176
- setCardList([]);
10177
- }
10178
- if (banklists && (banklists == null ? void 0 : banklists.length) > 0) {
10179
- setActiveinBank("list");
10180
- setBankList(banklists);
10181
- } else {
10182
- setBankList([]);
10485
+ if (typeoftoken == "google_pay" || typeoftoken == "apple_pay") {
10486
+ handleCharge({
10487
+ Token: tokenizeData,
10488
+ postalCode: cardData == null ? void 0 : cardData.zipCode,
10489
+ typeoftoken
10490
+ });
10491
+ return;
10183
10492
  }
10184
- hideLoader();
10185
- } catch (err) {
10186
- console.log(err);
10187
- hideLoader();
10188
- callback({
10189
- error: ((_d2 = (_c2 = err == null ? void 0 : err.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!",
10190
- result: (_f2 = (_e2 = err == null ? void 0 : err.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.result,
10191
- statusCode: (_g2 = err == null ? void 0 : err.response) == null ? void 0 : _g2.status
10493
+ let token = tokenizeData;
10494
+ let verifyandsaveresp = await axios9.post(`${masterBaseUrl}api/v1/gateway/verify-and-save/${session_token}`, {
10495
+ token,
10496
+ require3ds,
10497
+ pass_fee,
10498
+ typeoftoken
10192
10499
  });
10193
- 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");
10194
- }
10195
- };
10196
- const getCardType2 = (card) => {
10197
- let card_type = card == null ? void 0 : card.toLowerCase();
10198
- switch (card_type) {
10199
- case "visa":
10200
- return visa2;
10201
- case "mastercard":
10202
- case "mc":
10203
- case "m/c":
10204
- return mastercard2;
10205
- case "amex":
10206
- case "american express":
10207
- case "ae":
10208
- return americanexp2;
10209
- case "discover":
10210
- case "dcvr":
10211
- return discover2;
10212
- case "bank":
10213
- return bank2;
10214
- default:
10215
- return card;
10500
+ if ((verifyandsaveresp == null ? void 0 : verifyandsaveresp.status) == 200) {
10501
+ let responsetemp = (_a2 = verifyandsaveresp == null ? void 0 : verifyandsaveresp.data) == null ? void 0 : _a2.data;
10502
+ let respData = {
10503
+ Token: responsetemp.gateway_token,
10504
+ Brand: responsetemp.card_data.brand,
10505
+ ExpirationMonth: responsetemp.card_data.expire_mm,
10506
+ ExpirationYear: responsetemp.card_data.expire_yy,
10507
+ Last4: responsetemp.card_data.last4,
10508
+ Bin: responsetemp.card_data.bin,
10509
+ postalCode: cardData == null ? void 0 : cardData.zipCode,
10510
+ stripe_3ds_auth_id: intentid
10511
+ };
10512
+ if (isPreAuth) {
10513
+ handlePreAuth(respData);
10514
+ } else {
10515
+ handleCharge(respData);
10516
+ }
10517
+ }
10518
+ } catch (error2) {
10519
+ console.log(error2, "error");
10520
+ setError(((_c2 = (_b2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _b2.data) == null ? void 0 : _c2.message) || "Something went wrong!");
10521
+ callback({
10522
+ error: ((_e2 = (_d2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _d2.data) == null ? void 0 : _e2.message) || "Something went wrong!",
10523
+ result: (_g2 = (_f2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _f2.data) == null ? void 0 : _g2.result,
10524
+ statusCode: (_h2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _h2.status
10525
+ });
10526
+ hideLoader();
10216
10527
  }
10217
10528
  };
10218
- const handleDeleteCard = async (cardId) => {
10219
- Swal5.fire({
10220
- icon: "warning",
10221
- text: "Do you want to delete the card?",
10222
- showCancelButton: true,
10223
- confirmButtonText: "Yes",
10224
- cancelButtonText: "No",
10225
- reverseButtons: true,
10226
- buttonsStyling: false,
10227
- customClass: {
10228
- confirmButton: "swal2-confirm btn btn-dark",
10229
- cancelButton: "swal2-cancel btn btn-dark",
10230
- popup: "custom-swal-popup",
10231
- icon: "custom-swal-icon"
10232
- }
10233
- }).then(async (result) => {
10234
- var _a2, _b2;
10235
- if (result.isConfirmed) {
10236
- setLoading2(true);
10237
- try {
10238
- let obj = {
10239
- card_id: cardId,
10240
- customer_id: customerId
10241
- };
10242
- const res = await axios9.patch(`${masterBaseUrl}api/v1/gateway/delete-card/${session_token}`, obj);
10243
- if ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.result) {
10244
- setLoading2(false);
10245
- getCardList();
10246
- Swal5.fire({
10247
- icon: "success",
10248
- title: "Deleted!",
10249
- text: ((_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.message) || "Card deleted.",
10250
- confirmButtonText: "OK",
10251
- showConfirmButton: true,
10252
- timer: 1e3,
10253
- // auto-close after 1 second
10254
- timerProgressBar: true,
10255
- customClass: {
10256
- confirmButton: "btn btn-dark"
10257
- }
10258
- });
10259
- } else {
10260
- setLoading2(false);
10261
- Swal5.fire({
10262
- icon: "error",
10263
- title: "Failure!",
10264
- text: "Card not deleted.",
10265
- timer: 1e3,
10266
- // auto-close after 1 second
10267
- timerProgressBar: true,
10268
- customClass: {
10269
- confirmButton: "btn btn-dark"
10529
+ const handleFractalTokenFlow = async () => {
10530
+ 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;
10531
+ try {
10532
+ const requestOptions = {
10533
+ method: "POST",
10534
+ redirect: "follow"
10535
+ };
10536
+ let sesionResult = await axios9.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
10537
+ let objtokenize = {
10538
+ 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),
10539
+ session_key: (_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key
10540
+ };
10541
+ let three_ds_data = null;
10542
+ if (require3ds) {
10543
+ if (typeof window !== "undefined" && typeof navigator !== "undefined") {
10544
+ const languages = (_g2 = navigator.languages) != null ? _g2 : [navigator.language];
10545
+ const language = Array.isArray(languages) ? languages[0] : languages;
10546
+ three_ds_data = {
10547
+ amount: partialAmount ? Math.round(parseFloat(partialAmount) * 100) : Math.round(parseFloat(amount) * 100),
10548
+ // convert dollars → cents
10549
+ currency: "usd",
10550
+ channel: {
10551
+ type: "browser",
10552
+ browser: {
10553
+ language: typeof language === "string" ? language : null,
10554
+ color_depth: (_i2 = (_h2 = window.screen) == null ? void 0 : _h2.colorDepth) != null ? _i2 : null,
10555
+ java_enabled: typeof navigator.javaEnabled === "function" ? navigator.javaEnabled() : false,
10556
+ screen_height: (_k2 = (_j2 = window.screen) == null ? void 0 : _j2.height) != null ? _k2 : null,
10557
+ screen_width: (_m2 = (_l2 = window.screen) == null ? void 0 : _l2.width) != null ? _m2 : null,
10558
+ timezoneOffset: (/* @__PURE__ */ new Date()).getTimezoneOffset()
10270
10559
  }
10271
- });
10272
- }
10273
- } catch (err) {
10274
- setLoading2(false);
10275
- Swal5.fire({
10276
- icon: "error",
10277
- title: "Error!",
10278
- text: "Failed to delete the card.",
10279
- confirmButtonText: "OK",
10280
- customClass: {
10281
- confirmButton: "btn btn-dark"
10282
10560
  }
10283
- });
10561
+ };
10284
10562
  }
10285
- } else if (result.dismiss === Swal5.DismissReason.cancel) {
10286
- Swal5.fire({
10287
- icon: "info",
10288
- text: "Card not deleted",
10289
- confirmButtonText: "OK",
10290
- buttonsStyling: false,
10291
- customClass: {
10292
- confirmButton: "btn btn-dark float-end",
10293
- actions: "swal2-actions-end"
10294
- }
10295
- });
10296
10563
  }
10297
- });
10298
- };
10299
- const handlechargeCustomer = async (e) => {
10300
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
10301
- e.currentTarget.blur();
10302
- if (loading) return;
10303
- let customer_id = customerId;
10304
- let card_id = selectedCard == null ? void 0 : selectedCard.id;
10305
- let card_type = selectedCard == null ? void 0 : selectedCard.card_type;
10306
- if (partialError) {
10307
- return;
10308
- }
10309
- if (amount) {
10310
- if (customer_id) {
10311
- if (card_id) {
10312
- let chargeobj = {
10313
- amount: (card_type == null ? void 0 : card_type.toLowerCase()) === "bank" ? `${bankAmount}` : partialAmount ? partialAmount : amount,
10314
- customer_id,
10315
- card_id,
10316
- pass_fee,
10317
- pass_fee_amount: Number(amount) - cashDiscount
10318
- };
10319
- if (isPartial) {
10320
- chargeobj.orderGuid = orderGuid || ordGuid;
10321
- if (partialAmount) {
10322
- chargeobj.ispartialPayment = true;
10323
- }
10324
- }
10325
- if (isPreAuth) {
10326
- chargeobj.isPreauth = true;
10327
- }
10328
- let chargeurl = masterBaseUrl + "api/v1/gateway/charge-by-saved-details/" + session_token;
10329
- const headers = {
10330
- "Content-Type": "application/json"
10331
- };
10332
- try {
10333
- showLoader();
10334
- const response = await axios9.post(chargeurl, chargeobj);
10335
- if ((_a2 = response == null ? void 0 : response.data) == null ? void 0 : _a2.result) {
10336
- callback({ callback: __spreadProps(__spreadValues({}, (_b2 = response == null ? void 0 : response.data) == null ? void 0 : _b2.data), { isPreAuth }) });
10337
- hideLoader();
10338
- handleClose();
10339
- }
10340
- } catch (error2) {
10341
- console.log(error2 == null ? void 0 : error2.response, "error by saved details");
10342
- callback({
10343
- error: ((_d2 = (_c2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!",
10344
- result: (_f2 = (_e2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.result,
10345
- statusCode: (_g2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _g2.status
10346
- });
10564
+ let tokenizeData;
10565
+ try {
10566
+ tokenizeData = await tokenizerRef.current.createToken(
10567
+ objtokenize,
10568
+ three_ds_data
10569
+ );
10570
+ } catch (error2) {
10571
+ console.log(error2, "error in tokenization");
10572
+ let readableMessage = "Something went wrong!";
10573
+ try {
10574
+ const rawError = ((_n2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _n2.data) || (error2 == null ? void 0 : error2.message) || "";
10575
+ const errorText = typeof rawError === "string" ? rawError : JSON.stringify(rawError);
10576
+ const lines = ((_p2 = (_o2 = errorText.split) == null ? void 0 : _o2.call(errorText, "\n")) == null ? void 0 : _p2.filter(Boolean)) || [];
10577
+ const lastLine = lines.at(-1) || "";
10578
+ const parts = (_q2 = lastLine.split) == null ? void 0 : _q2.call(lastLine, ": ");
10579
+ readableMessage = (parts == null ? void 0 : parts.length) > 1 ? parts.pop().trim() : lastLine.trim() || readableMessage;
10580
+ } catch (e) {
10581
+ readableMessage = "Something went wrong!";
10582
+ }
10583
+ setErrorIframe(readableMessage);
10584
+ hideLoader();
10585
+ }
10586
+ if (tokenizeData == null ? void 0 : tokenizeData.token) {
10587
+ let ThreedsData = tokenizeData == null ? void 0 : tokenizeData.stripe_three_ds_response;
10588
+ if (require3ds && !ThreedsData && (ThreedsData == null ? void 0 : ThreedsData.status) === "200 OK" && ((_r2 = ThreedsData == null ? void 0 : ThreedsData.data) == null ? void 0 : _r2.challenge_url)) {
10589
+ setError("Something went wrong. Please try again later.");
10590
+ }
10591
+ if (require3ds) {
10592
+ if (!((_s2 = ThreedsData == null ? void 0 : ThreedsData.data) == null ? void 0 : _s2.challenge_url)) {
10593
+ completeFractalFlow(tokenizeData == null ? void 0 : tokenizeData.token, (_t2 = ThreedsData == null ? void 0 : ThreedsData.data) == null ? void 0 : _t2.id);
10594
+ } else {
10347
10595
  hideLoader();
10348
- setError(((_i2 = (_h2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _h2.data) == null ? void 0 : _i2.message) || "Something went wrong!");
10596
+ setStripeResponse(__spreadProps(__spreadValues({}, ThreedsData == null ? void 0 : ThreedsData.data), {
10597
+ fractalToken: tokenizeData == null ? void 0 : tokenizeData.token
10598
+ }));
10349
10599
  }
10350
10600
  } else {
10351
- setError("Please Select A Card/Bank");
10352
- callback({
10353
- error: "Please Select A Card/Bank"
10354
- });
10601
+ completeFractalFlow(tokenizeData == null ? void 0 : tokenizeData.token, null);
10355
10602
  }
10356
- } else {
10357
- setError("Please Select Customer");
10358
- callback({
10359
- error: "Please Select Customer"
10360
- });
10361
10603
  }
10362
- } else {
10363
- setError("Something went wrong.");
10604
+ } catch (error2) {
10605
+ hideLoader();
10606
+ console.log(error2, "error");
10607
+ let readableMessage = "Something went wrong!";
10608
+ try {
10609
+ const rawError = ((_u2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _u2.data) || (error2 == null ? void 0 : error2.message) || "";
10610
+ const errorText = typeof rawError === "string" ? rawError : JSON.stringify(rawError);
10611
+ const lines = ((_w = (_v = errorText.split) == null ? void 0 : _v.call(errorText, "\n")) == null ? void 0 : _w.filter(Boolean)) || [];
10612
+ const lastLine = lines.at(-1) || "";
10613
+ const parts = (_x = lastLine.split) == null ? void 0 : _x.call(lastLine, ": ");
10614
+ readableMessage = (parts == null ? void 0 : parts.length) > 1 ? parts.pop().trim() : lastLine.trim() || readableMessage;
10615
+ } catch (e) {
10616
+ readableMessage = "Something went wrong!";
10617
+ }
10618
+ setError(readableMessage);
10364
10619
  callback({
10365
- error: "Something went wrong."
10620
+ error: readableMessage,
10621
+ result: (_z = (_y = error2 == null ? void 0 : error2.response) == null ? void 0 : _y.data) == null ? void 0 : _z.result,
10622
+ statusCode: (_A = error2 == null ? void 0 : error2.response) == null ? void 0 : _A.status
10366
10623
  });
10367
10624
  }
10368
10625
  };
10369
- const getPaymentDetails = async () => {
10370
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2;
10371
- try {
10372
- showLoader();
10373
- const res = await axios9.get(`${masterBaseUrl}api/v1/gateway/get-payment-details/${session_token}`, {
10374
- params: {
10375
- require3ds,
10376
- pass_fee
10626
+ const validateCardData = () => {
10627
+ var _a2, _b2;
10628
+ const errors = {};
10629
+ const data = cardData;
10630
+ if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
10631
+ if (!((_b2 = data == null ? void 0 : data.zipCode) == null ? void 0 : _b2.trim())) errors.zipCode = "ZIP code is required";
10632
+ setCardError(errors);
10633
+ return Object.keys(errors).length > 0;
10634
+ };
10635
+ const validateCardInputs = () => {
10636
+ let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
10637
+ let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
10638
+ let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
10639
+ let errors = {};
10640
+ if (!validCard) errors.cardNumber = "Invalid card Number";
10641
+ if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
10642
+ if (!validCVV) errors.cvv = "Invalid CVV";
10643
+ setCardError(errors);
10644
+ return validCard && validCVV && validExpirationDate;
10645
+ };
10646
+ const submitFunc = async (e) => {
10647
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
10648
+ e.preventDefault();
10649
+ const el = document.activeElement;
10650
+ if (el instanceof HTMLElement) {
10651
+ el.blur();
10652
+ }
10653
+ if (loading) return;
10654
+ if (partialError) {
10655
+ return;
10656
+ }
10657
+ if (activetab !== "ach") {
10658
+ const hasError = validateCardData();
10659
+ if (hasError) return;
10660
+ let isValid = true;
10661
+ if (!isValid) return;
10662
+ } else {
10663
+ let hasError = validateAchData();
10664
+ if (saveACHinfo && !saveACHConsent1) {
10665
+ hasError = true;
10666
+ }
10667
+ if (!saveACHinfo && !isBankConsentChecked) {
10668
+ hasError = true;
10669
+ }
10670
+ if (hasError) return;
10671
+ }
10672
+ try {
10673
+ showLoader();
10674
+ const result = await axios9.get(`${masterBaseUrl}api/v1/gateway/token/${session_token}`, {
10675
+ params: {
10676
+ require3ds,
10677
+ pass_fee
10377
10678
  }
10378
10679
  });
10379
- if ((res == null ? void 0 : res.status) == 200) {
10380
- setIsBankActive((_b2 = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.isBankActive);
10381
- setProcessingFee(Number((_d2 = (_c2 = res == null ? void 0 : res.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.fee) || 0);
10382
- setPaymentGateway((_f2 = (_e2 = res == null ? void 0 : res.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.paymentGateway);
10383
- setDCToken((_h2 = (_g2 = res == null ? void 0 : res.data) == null ? void 0 : _g2.data) == null ? void 0 : _h2.dctoken);
10384
- hideLoader();
10680
+ if ((result == null ? void 0 : result.status) == 200) {
10681
+ let gatewayToken = (_b2 = (_a2 = result == null ? void 0 : result.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.gateway_token;
10682
+ let paymentGateway2 = (_d2 = (_c2 = result == null ? void 0 : result.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.paymentGateway;
10683
+ if (activetab !== "ach") {
10684
+ if (paymentGateway2 == ((_e2 = PaymentMethodKeys) == null ? void 0 : _e2.FRACTALKEY)) {
10685
+ await handleFractalTokenFlow();
10686
+ } else {
10687
+ try {
10688
+ const result2 = await window.requestDcToken();
10689
+ console.log("Token:", result2.Token);
10690
+ if (result2.Token) {
10691
+ handleTokenCallback(result2);
10692
+ }
10693
+ } catch (err) {
10694
+ console.log(err, "Error while tokenizing");
10695
+ setErrorIframe(err);
10696
+ setLoading(false);
10697
+ }
10698
+ }
10699
+ } else {
10700
+ let callbackdata;
10701
+ try {
10702
+ const payByBank = await axios9.post(`${masterBaseUrl}api/v1/gateway/bank-charge/${session_token}`, __spreadValues({
10703
+ label: achData == null ? void 0 : achData.name,
10704
+ account_number: achData == null ? void 0 : achData.accountNumber,
10705
+ routing_number: achData == null ? void 0 : achData.routingNumber,
10706
+ bank_name: achData == null ? void 0 : achData.bankName,
10707
+ account_type: achData == null ? void 0 : achData.accountType,
10708
+ amount: `${bankAmount}`,
10709
+ customer_id: null,
10710
+ isSaveAch: false,
10711
+ tax: "0.00",
10712
+ discount: "0.00",
10713
+ surcharge: "0.00",
10714
+ order_id: "",
10715
+ company_name: (achData == null ? void 0 : achData.companyName) || ""
10716
+ }, saveACHinfo ? {
10717
+ bank: {
10718
+ name: achData == null ? void 0 : achData.name,
10719
+ account_number: achData == null ? void 0 : achData.accountNumber,
10720
+ routing_number: achData == null ? void 0 : achData.routingNumber,
10721
+ bank_name: achData == null ? void 0 : achData.bankName,
10722
+ account_type: achData == null ? void 0 : achData.accountType,
10723
+ customer_id: customerId || "",
10724
+ company_name: (achData == null ? void 0 : achData.companyName) || ""
10725
+ }
10726
+ } : null));
10727
+ if ((_f2 = payByBank == null ? void 0 : payByBank.data) == null ? void 0 : _f2.result) {
10728
+ callbackdata = __spreadProps(__spreadValues({}, callbackdata), {
10729
+ callback: __spreadProps(__spreadValues({}, (_g2 = payByBank == null ? void 0 : payByBank.data) == null ? void 0 : _g2.data), { name: achData == null ? void 0 : achData.name, isPreAuth })
10730
+ });
10731
+ callback(callbackdata);
10732
+ handleClose();
10733
+ hideLoader();
10734
+ }
10735
+ } catch (error2) {
10736
+ console.log(error2, "errororor");
10737
+ let data = (_h2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _h2.data;
10738
+ if (typeof (data == null ? void 0 : data.message) == "object") {
10739
+ Object.values(data == null ? void 0 : data.message).forEach((message) => {
10740
+ var _a3;
10741
+ setError(message || "Something went wrong");
10742
+ callback({
10743
+ error: message || "Something went wrong!",
10744
+ result: (data == null ? void 0 : data.result) || false,
10745
+ statusCode: (_a3 = error2 == null ? void 0 : error2.response) == null ? void 0 : _a3.status
10746
+ });
10747
+ });
10748
+ } else {
10749
+ setError((data == null ? void 0 : data.message) || "Something went wrong");
10750
+ callback({
10751
+ error: (data == null ? void 0 : data.message) || "Something went wrong!",
10752
+ result: (data == null ? void 0 : data.result) || false,
10753
+ statusCode: (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.status
10754
+ });
10755
+ }
10756
+ hideLoader();
10757
+ }
10758
+ }
10385
10759
  }
10386
10760
  } catch (error2) {
10387
- 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");
10761
+ hideLoader();
10388
10762
  callback({
10389
- error: ((_l2 = (_k2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _k2.data) == null ? void 0 : _l2.message) || "Something went wrong!",
10390
- result: (_n2 = (_m2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _m2.data) == null ? void 0 : _n2.result,
10391
- statusCode: (_o2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _o2.status
10763
+ error: ((_k2 = (_j2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _j2.data) == null ? void 0 : _k2.message) || "Something went wrong!",
10764
+ result: (_m2 = (_l2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _l2.data) == null ? void 0 : _m2.result,
10765
+ statusCode: (_n2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _n2.status
10392
10766
  });
10393
- hideLoader();
10767
+ setError(((_p2 = (_o2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _o2.data) == null ? void 0 : _p2.message) || "Something went wrong!");
10394
10768
  }
10395
10769
  };
10396
- const crateOrderFrac = async () => {
10397
- var _a2, _b2, _c2, _d2, _e2;
10398
- if (orderLoader) return;
10399
- setOrderLoader(true);
10400
- try {
10401
- const res = await axios9.post(`${masterBaseUrl}api/v1/gateway/create-pay-order/${session_token}`, {
10402
- amount,
10403
- cashDiscount,
10404
- bankAmount,
10405
- bankSurcharge,
10406
- customerId,
10407
- passFee: pass_fee,
10408
- passFeeAmount: pass_fee_amount ? pass_fee_amount : Number(amount) - cashDiscount,
10409
- require3ds,
10410
- isPartial
10411
- });
10412
- if ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.result) {
10413
- setOrderLoader(false);
10414
- setOrderGuid((_c2 = (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.orderGuid);
10415
- setRemainingAmount((_e2 = (_d2 = res == null ? void 0 : res.data) == null ? void 0 : _d2.data) == null ? void 0 : _e2.remainingAmount);
10416
- hasRunRef.current = true;
10770
+ const handleCardChange = (field, value) => {
10771
+ const name2 = field;
10772
+ const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
10773
+ if (numericFields.includes(name2)) {
10774
+ if (value === "" || /^[0-9]+$/.test(value)) {
10775
+ setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
10776
+ [name2]: ""
10777
+ }));
10778
+ setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
10779
+ [name2]: value
10780
+ }));
10417
10781
  }
10418
- } catch (error2) {
10419
- console.log("error in creating order", error2);
10420
- setOrderLoader(false);
10782
+ return;
10421
10783
  }
10784
+ setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
10785
+ [name2]: ""
10786
+ }));
10787
+ setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
10788
+ [name2]: value
10789
+ }));
10422
10790
  };
10423
- useEffect15(() => {
10424
- if (!show && !autoTrigger) {
10425
- hasRunRef.current = false;
10426
- cardListRunRef.current = false;
10427
- }
10428
- }, [show, autoTrigger]);
10429
- useEffect15(() => {
10430
- if (!hasRunRef.current && (show || autoTrigger)) {
10431
- getPaymentDetails();
10432
- if (isPartial && !partialRef) {
10433
- crateOrderFrac();
10791
+ const handleCardNumberChange = (e) => {
10792
+ var _a2;
10793
+ const input = e.target;
10794
+ const rawValue = input.value.replace(/\D/g, "");
10795
+ const { formatted, cursor } = formatCardNumberWithCursor(
10796
+ input.value,
10797
+ (_a2 = input.selectionStart) != null ? _a2 : 0
10798
+ );
10799
+ setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
10800
+ cardNumber: ""
10801
+ }));
10802
+ setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
10803
+ cardNumber: formatted
10804
+ }));
10805
+ requestAnimationFrame(() => {
10806
+ input.setSelectionRange(cursor, cursor);
10807
+ });
10808
+ };
10809
+ const handleChangeAch = (e) => {
10810
+ const { name: name2, value } = e.target;
10811
+ const numericFields = ["routingNumber", "accountNumber", "confirmAccountNumber"];
10812
+ if (name2 == "name") {
10813
+ if (/^[a-zA-Z\s]*$/.test(value)) {
10814
+ setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
10815
+ [name2]: ""
10816
+ }));
10817
+ setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
10818
+ [name2]: value
10819
+ }));
10434
10820
  }
10821
+ return;
10435
10822
  }
10436
- }, [show, autoTrigger, isPartial]);
10437
- useEffect15(() => {
10438
- if ((show || autoTrigger) && pass_fee_amount) {
10439
- let cashdisc = Number(amount) - Number(pass_fee_amount);
10440
- if (cashdisc && !isNaN(cashdisc)) {
10441
- setCashDiscount(cashdisc);
10442
- }
10443
- } else if ((show || autoTrigger) && pass_fee && processingFee) {
10444
- let cashdisc = CalculateCashDiscount(amount, processingFee);
10445
- if (cashdisc && !isNaN(cashdisc)) {
10446
- setCashDiscount(cashdisc);
10823
+ if (numericFields.includes(name2)) {
10824
+ if (value === "" || /^[0-9]+$/.test(value)) {
10825
+ setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
10826
+ [name2]: ""
10827
+ }));
10828
+ setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
10829
+ [name2]: value
10830
+ }));
10447
10831
  }
10448
- } else {
10449
- setCashDiscount(Number(amount));
10450
- }
10451
- if (!cardListRunRef.current && customerId && (show || autoTrigger) && !isRequest) {
10452
- cardListRunRef.current = true;
10453
- getCardList();
10454
- }
10455
- }, [customerId, show, amount, processingFee, autoTrigger]);
10456
- const getHeading = () => {
10457
- if (isPreAuth) {
10458
- return "Cards";
10459
- } else {
10460
- return "Cards/Bank";
10832
+ return;
10461
10833
  }
10834
+ setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
10835
+ [name2]: ""
10836
+ }));
10837
+ setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
10838
+ [name2]: value
10839
+ }));
10462
10840
  };
10463
- const fetchClientSecret = useCallback(async () => {
10841
+ const handleClose = () => {
10842
+ setShow(false);
10843
+ setActive("card");
10844
+ setError("");
10845
+ setSuccess(false);
10846
+ setTranId("");
10847
+ setAchData({
10848
+ name: "",
10849
+ routingNumber: "",
10850
+ accountNumber: "",
10851
+ confirmAccountNumber: "",
10852
+ bankName: "",
10853
+ accountType: ""
10854
+ });
10855
+ setAchError({
10856
+ name: "",
10857
+ routingNumber: "",
10858
+ accountNumber: "",
10859
+ confirmAccountNumber: "",
10860
+ bankName: "",
10861
+ accountType: ""
10862
+ });
10863
+ setCardData({
10864
+ cardName: "",
10865
+ cardNumber: "",
10866
+ expiryMonth: "",
10867
+ expiryYear: "",
10868
+ cvv: "",
10869
+ orderId: "",
10870
+ zipCode: ""
10871
+ });
10872
+ setCardError({
10873
+ cardName: "",
10874
+ cardNumber: "",
10875
+ expiryMonth: "",
10876
+ expiryYear: "",
10877
+ cvv: "",
10878
+ orderId: "",
10879
+ zipCode: ""
10880
+ });
10881
+ setSaveACHinfo(false);
10882
+ setSaveCardInfo(false);
10883
+ setActiveinBank("form");
10884
+ setActiveinCard("form");
10885
+ setIsBankActive(false);
10886
+ setProcessingFee(0);
10887
+ setCashDiscount(0);
10888
+ setCardList([]);
10889
+ setErrorMessage(null);
10890
+ setClientSecret(null);
10891
+ setInitialLoader(false);
10892
+ setIs3DSEnable(false);
10893
+ setStripeResponse(null);
10894
+ setOrderGuid(null);
10895
+ setPartialAmount("");
10896
+ setPartialError("");
10897
+ setRemainingAmount("");
10898
+ setIsBankConsentChecked(false);
10899
+ setErrorBankConsent("");
10900
+ setSaveACHConsent1(false);
10901
+ setErrorBankConsentOther("");
10902
+ };
10903
+ const getCardList = async () => {
10904
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
10905
+ showLoader();
10464
10906
  try {
10465
- setInitialLoader(true);
10466
- const res = await fetch(`${masterBaseUrl}api/v1/gateway/create-payment-intent/${session_token}`, {
10467
- method: "POST",
10468
- headers: { "Content-Type": "application/json" },
10469
- body: JSON.stringify({ amount, require3ds, pass_fee })
10470
- });
10471
- const data = await res.json();
10472
- if (data.is3dEnable) {
10473
- setInitialLoader(false);
10474
- setClientSecret(data.clientSecret);
10475
- setIs3DSEnable(data.is3dEnable);
10907
+ const data = {
10908
+ isPreAuth,
10909
+ "customerId": customerId
10910
+ };
10911
+ let cardListData = await axios9.post(`${masterBaseUrl}api/v1/gateway/card-list/${session_token}`, data);
10912
+ let savedpaymentsList = ((_b2 = (_a2 = cardListData == null ? void 0 : cardListData.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.cardList) || [];
10913
+ let banklists = savedpaymentsList == null ? void 0 : savedpaymentsList.filter((card) => (card == null ? void 0 : card.card_type) == "Bank");
10914
+ let cardlists = savedpaymentsList == null ? void 0 : savedpaymentsList.filter((card) => (card == null ? void 0 : card.card_type) !== "Bank");
10915
+ if (cardlists && (cardlists == null ? void 0 : cardlists.length) > 0) {
10916
+ setActive("card");
10917
+ setActiveinCard("list");
10918
+ setCardList(cardlists);
10919
+ setLoadingIframe(false);
10476
10920
  } else {
10477
- setInitialLoader(false);
10478
- setIs3DSEnable(data.is3dEnable);
10921
+ setActive("card");
10922
+ setCardList([]);
10479
10923
  }
10480
- if (!data.result) {
10481
- setError(data.error || (data == null ? void 0 : data.message) || "Failed to get client secret");
10924
+ if (banklists && (banklists == null ? void 0 : banklists.length) > 0) {
10925
+ setActiveinBank("list");
10926
+ setBankList(banklists);
10927
+ } else {
10928
+ setBankList([]);
10482
10929
  }
10930
+ hideLoader();
10483
10931
  } catch (err) {
10484
- console.log(err.response, "err.response");
10485
- setError(err.message);
10932
+ console.log(err);
10933
+ hideLoader();
10934
+ callback({
10935
+ error: ((_d2 = (_c2 = err == null ? void 0 : err.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!",
10936
+ result: (_f2 = (_e2 = err == null ? void 0 : err.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.result,
10937
+ statusCode: (_g2 = err == null ? void 0 : err.response) == null ? void 0 : _g2.status
10938
+ });
10939
+ 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");
10940
+ }
10941
+ };
10942
+ const getCardType2 = (card) => {
10943
+ let card_type = card == null ? void 0 : card.toLowerCase();
10944
+ switch (card_type) {
10945
+ case "visa":
10946
+ return visa2;
10947
+ case "mastercard":
10948
+ case "mc":
10949
+ case "m/c":
10950
+ return mastercard2;
10951
+ case "amex":
10952
+ case "american express":
10953
+ case "ae":
10954
+ return americanexp2;
10955
+ case "discover":
10956
+ case "dcvr":
10957
+ return discover2;
10958
+ case "bank":
10959
+ return bank2;
10960
+ default:
10961
+ return card;
10962
+ }
10963
+ };
10964
+ const handleDeleteCard = async (cardId) => {
10965
+ Swal5.fire({
10966
+ icon: "warning",
10967
+ text: "Do you want to delete the card?",
10968
+ showCancelButton: true,
10969
+ confirmButtonText: "Yes",
10970
+ cancelButtonText: "No",
10971
+ reverseButtons: true,
10972
+ buttonsStyling: false,
10973
+ customClass: {
10974
+ confirmButton: "swal2-confirm btn btn-dark",
10975
+ cancelButton: "swal2-cancel btn btn-dark",
10976
+ popup: "custom-swal-popup",
10977
+ icon: "custom-swal-icon"
10978
+ }
10979
+ }).then(async (result) => {
10980
+ var _a2, _b2;
10981
+ if (result.isConfirmed) {
10982
+ setLoading2(true);
10983
+ try {
10984
+ let obj = {
10985
+ card_id: cardId,
10986
+ customer_id: customerId
10987
+ };
10988
+ const res = await axios9.patch(`${masterBaseUrl}api/v1/gateway/delete-card/${session_token}`, obj);
10989
+ if ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.result) {
10990
+ setLoading2(false);
10991
+ getCardList();
10992
+ Swal5.fire({
10993
+ icon: "success",
10994
+ title: "Deleted!",
10995
+ text: ((_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.message) || "Card deleted.",
10996
+ confirmButtonText: "OK",
10997
+ showConfirmButton: true,
10998
+ timer: 1e3,
10999
+ // auto-close after 1 second
11000
+ timerProgressBar: true,
11001
+ customClass: {
11002
+ confirmButton: "btn btn-dark"
11003
+ }
11004
+ });
11005
+ } else {
11006
+ setLoading2(false);
11007
+ Swal5.fire({
11008
+ icon: "error",
11009
+ title: "Failure!",
11010
+ text: "Card not deleted.",
11011
+ timer: 1e3,
11012
+ // auto-close after 1 second
11013
+ timerProgressBar: true,
11014
+ customClass: {
11015
+ confirmButton: "btn btn-dark"
11016
+ }
11017
+ });
11018
+ }
11019
+ } catch (err) {
11020
+ setLoading2(false);
11021
+ Swal5.fire({
11022
+ icon: "error",
11023
+ title: "Error!",
11024
+ text: "Failed to delete the card.",
11025
+ confirmButtonText: "OK",
11026
+ customClass: {
11027
+ confirmButton: "btn btn-dark"
11028
+ }
11029
+ });
11030
+ }
11031
+ } else if (result.dismiss === Swal5.DismissReason.cancel) {
11032
+ Swal5.fire({
11033
+ icon: "info",
11034
+ text: "Card not deleted",
11035
+ confirmButtonText: "OK",
11036
+ buttonsStyling: false,
11037
+ customClass: {
11038
+ confirmButton: "btn btn-dark float-end",
11039
+ actions: "swal2-actions-end"
11040
+ }
11041
+ });
11042
+ }
11043
+ });
11044
+ };
11045
+ const handlechargeCustomer = async (e) => {
11046
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
11047
+ e == null ? void 0 : e.currentTarget.blur();
11048
+ if (loading) return;
11049
+ let customer_id = customerId;
11050
+ let card_id = selectedCard == null ? void 0 : selectedCard.id;
11051
+ let card_type = selectedCard == null ? void 0 : selectedCard.card_type;
11052
+ if (partialError) {
11053
+ return;
11054
+ }
11055
+ if (amount) {
11056
+ if (customer_id) {
11057
+ if (card_id) {
11058
+ let chargeobj = {
11059
+ amount: (card_type == null ? void 0 : card_type.toLowerCase()) === "bank" ? `${bankAmount}` : partialAmount ? partialAmount : amount,
11060
+ customer_id,
11061
+ card_id,
11062
+ pass_fee,
11063
+ pass_fee_amount: Number(amount) - cashDiscount
11064
+ };
11065
+ if (isPartial) {
11066
+ chargeobj.orderGuid = orderGuid || ordGuid;
11067
+ if (partialAmount) {
11068
+ chargeobj.ispartialPayment = true;
11069
+ }
11070
+ }
11071
+ if (isPreAuth) {
11072
+ chargeobj.isPreauth = true;
11073
+ }
11074
+ let chargeurl = masterBaseUrl + "api/v1/gateway/charge-by-saved-details/" + session_token;
11075
+ const headers = {
11076
+ "Content-Type": "application/json"
11077
+ };
11078
+ try {
11079
+ showLoader();
11080
+ const response = await axios9.post(chargeurl, chargeobj);
11081
+ if ((_a2 = response == null ? void 0 : response.data) == null ? void 0 : _a2.result) {
11082
+ callback({ callback: __spreadProps(__spreadValues({}, (_b2 = response == null ? void 0 : response.data) == null ? void 0 : _b2.data), { isPreAuth }) });
11083
+ hideLoader();
11084
+ handleClose();
11085
+ }
11086
+ } catch (error2) {
11087
+ console.log(error2 == null ? void 0 : error2.response, "error by saved details");
11088
+ callback({
11089
+ error: ((_d2 = (_c2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!",
11090
+ result: (_f2 = (_e2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.result,
11091
+ statusCode: (_g2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _g2.status
11092
+ });
11093
+ hideLoader();
11094
+ }
11095
+ } else {
11096
+ setError("Please Select A Card/Bank");
11097
+ callback({
11098
+ error: "Please Select A Card/Bank"
11099
+ });
11100
+ }
11101
+ } else {
11102
+ setError("Please Select Customer");
11103
+ callback({
11104
+ error: "Please Select Customer"
11105
+ });
11106
+ }
11107
+ } else {
11108
+ setError("Something went wrong.");
11109
+ callback({
11110
+ error: "Something went wrong."
11111
+ });
11112
+ }
11113
+ };
11114
+ const getPaymentDetails = async () => {
11115
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2;
11116
+ try {
11117
+ showLoader();
11118
+ const res = await axios9.get(`${masterBaseUrl}api/v1/gateway/get-payment-details/${session_token}`, {
11119
+ params: {
11120
+ require3ds,
11121
+ pass_fee
11122
+ }
11123
+ });
11124
+ if ((res == null ? void 0 : res.status) == 200) {
11125
+ setIsBankActive((_b2 = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.isBankActive);
11126
+ setProcessingFee(Number((_d2 = (_c2 = res == null ? void 0 : res.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.fee) || 0);
11127
+ setPaymentGateway((_f2 = (_e2 = res == null ? void 0 : res.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.paymentGateway);
11128
+ setDCToken((_h2 = (_g2 = res == null ? void 0 : res.data) == null ? void 0 : _g2.data) == null ? void 0 : _h2.dctoken);
11129
+ hideLoader();
11130
+ }
11131
+ } catch (error2) {
11132
+ 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");
11133
+ callback({
11134
+ error: ((_l2 = (_k2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _k2.data) == null ? void 0 : _l2.message) || "Something went wrong!",
11135
+ result: (_n2 = (_m2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _m2.data) == null ? void 0 : _n2.result,
11136
+ statusCode: (_o2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _o2.status
11137
+ });
11138
+ 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");
11139
+ hideLoader();
11140
+ }
11141
+ };
11142
+ const crateOrderFrac = async () => {
11143
+ var _a2, _b2, _c2, _d2, _e2;
11144
+ if (orderLoader) return;
11145
+ setOrderLoader(true);
11146
+ try {
11147
+ const res = await axios9.post(`${masterBaseUrl}api/v1/gateway/create-pay-order/${session_token}`, {
11148
+ amount,
11149
+ cashDiscount,
11150
+ bankAmount,
11151
+ bankSurcharge,
11152
+ customerId,
11153
+ passFee: pass_fee,
11154
+ passFeeAmount: pass_fee_amount ? pass_fee_amount : Number(amount) - cashDiscount,
11155
+ require3ds,
11156
+ isPartial
11157
+ });
11158
+ if ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.result) {
11159
+ setOrderLoader(false);
11160
+ setOrderGuid((_c2 = (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.orderGuid);
11161
+ setRemainingAmount((_e2 = (_d2 = res == null ? void 0 : res.data) == null ? void 0 : _d2.data) == null ? void 0 : _e2.remainingAmount);
11162
+ hasRunRef.current = true;
11163
+ }
11164
+ } catch (error2) {
11165
+ console.log("error in creating order", error2);
11166
+ setOrderLoader(false);
11167
+ }
11168
+ };
11169
+ useEffect18(() => {
11170
+ if (!show && !autoTrigger) {
11171
+ hasRunRef.current = false;
11172
+ cardListRunRef.current = false;
11173
+ }
11174
+ }, [show, autoTrigger]);
11175
+ useEffect18(() => {
11176
+ if (!hasRunRef.current && (show || autoTrigger) && onLoad) {
11177
+ getPaymentDetails();
11178
+ if (isPartial && !partialRef) {
11179
+ crateOrderFrac();
11180
+ }
11181
+ }
11182
+ }, [show, autoTrigger, isPartial, onLoad]);
11183
+ useEffect18(() => {
11184
+ if ((show || autoTrigger) && pass_fee_amount) {
11185
+ let cashdisc = Number(amount) - Number(pass_fee_amount);
11186
+ if (cashdisc && !isNaN(cashdisc)) {
11187
+ setCashDiscount(cashdisc);
11188
+ }
11189
+ } else if ((show || autoTrigger) && pass_fee && processingFee) {
11190
+ let cashdisc = CalculateCashDiscount(amount, processingFee);
11191
+ if (cashdisc && !isNaN(cashdisc)) {
11192
+ setCashDiscount(cashdisc);
11193
+ }
11194
+ } else {
11195
+ setCashDiscount(Number(amount));
11196
+ }
11197
+ if (!cardListRunRef.current && customerId && (show || autoTrigger) && !isRequest) {
11198
+ cardListRunRef.current = true;
11199
+ getCardList();
11200
+ }
11201
+ }, [customerId, show, amount, processingFee, autoTrigger]);
11202
+ const getHeading = () => {
11203
+ if (isPreAuth) {
11204
+ return "Cards";
11205
+ } else {
11206
+ return "Cards/Bank";
11207
+ }
11208
+ };
11209
+ const fetchClientSecret = useCallback(async () => {
11210
+ try {
11211
+ setInitialLoader(true);
11212
+ const res = await fetch(`${masterBaseUrl}api/v1/gateway/create-payment-intent/${session_token}`, {
11213
+ method: "POST",
11214
+ headers: { "Content-Type": "application/json" },
11215
+ body: JSON.stringify({ amount, require3ds, pass_fee })
11216
+ });
11217
+ const data = await res.json();
11218
+ if (data.is3dEnable) {
11219
+ setInitialLoader(false);
11220
+ setClientSecret(data.clientSecret);
11221
+ setIs3DSEnable(data.is3dEnable);
11222
+ } else {
11223
+ setInitialLoader(false);
11224
+ setIs3DSEnable(data.is3dEnable);
11225
+ }
11226
+ if (!data.result) {
11227
+ setError(data.error || (data == null ? void 0 : data.message) || "Failed to get client secret");
11228
+ }
11229
+ } catch (err) {
11230
+ console.log(err.response, "err.response");
11231
+ setError(err.message);
11232
+ }
11233
+ }, [amount]);
11234
+ const onSuccess = () => {
11235
+ };
11236
+ const handleSuccess = (token, intentId) => {
11237
+ showLoader();
11238
+ completeFractalFlow(token, intentId);
11239
+ setStripeResponse(null);
11240
+ };
11241
+ const handleError = (status) => {
11242
+ console.error("3DS Auth failed \u274C", status);
11243
+ setError(`3DS Authentication ${status}`);
11244
+ };
11245
+ useEffect18(() => {
11246
+ if (setHandleCloseRef) {
11247
+ setHandleCloseRef(() => handleClose);
11248
+ }
11249
+ }, []);
11250
+ const handlePartialChange = (values) => {
11251
+ var _a2, _b2;
11252
+ if (((_a2 = Number(remainingAmount || remAmount)) == null ? void 0 : _a2.toFixed(2)) < (values == null ? void 0 : values.floatValue) || (values == null ? void 0 : values.floatValue) < 0) {
11253
+ setPartialAmount(values == null ? void 0 : values.value);
11254
+ setPartialError(`Partial amount cannot exceed ${formatUSD((_b2 = Number(remainingAmount || remAmount)) == null ? void 0 : _b2.toFixed(2))}`);
11255
+ } else if ((values == null ? void 0 : values.floatValue) == 0) {
11256
+ setPartialAmount(values == null ? void 0 : values.value);
11257
+ setPartialError("Partial amount must be greater than 0");
11258
+ } else {
11259
+ setPartialAmount(values == null ? void 0 : values.value);
11260
+ setPartialError("");
11261
+ }
11262
+ };
11263
+ useEffect18(() => {
11264
+ if (typeof FractalTokenizer === "undefined") return;
11265
+ const tokenizer = new FractalTokenizer({
11266
+ styles: {}
11267
+ });
11268
+ }, []);
11269
+ const stateRef = useRef12({
11270
+ activeinBank,
11271
+ activeinCard,
11272
+ activetab
11273
+ });
11274
+ useEffect18(() => {
11275
+ stateRef.current = {
11276
+ activeinBank,
11277
+ activeinCard,
11278
+ activetab
11279
+ };
11280
+ }, [activeinBank, activeinCard, activetab]);
11281
+ const submit = useCallback(() => {
11282
+ var _a2, _b2;
11283
+ const { activeinBank: activeinBank2, activeinCard: activeinCard2, activetab: activetab2 } = stateRef.current;
11284
+ if (activetab2 === "card") {
11285
+ if (activeinCard2 === "form") {
11286
+ (_a2 = cardFormRef.current) == null ? void 0 : _a2.requestSubmit();
11287
+ } else if (activeinCard2 === "list") {
11288
+ handlechargeCustomer();
11289
+ }
11290
+ } else if (activetab2 === "ach") {
11291
+ if (activeinBank2 === "form") {
11292
+ (_b2 = bankFormRef.current) == null ? void 0 : _b2.requestSubmit();
11293
+ } else if (activeinBank2 === "list") {
11294
+ handlechargeCustomer();
11295
+ }
11296
+ }
11297
+ }, []);
11298
+ useEffect18(() => {
11299
+ onSubmit == null ? void 0 : onSubmit(submit);
11300
+ }, [onSubmit, submit]);
11301
+ function detectCardType(cardinput) {
11302
+ if (!cardinput) return null;
11303
+ const number = cardinput.replace(/\D/g, "");
11304
+ const patterns = {
11305
+ visa: /^4/,
11306
+ mastercard: /^(5[1-5]|2[2-7][0-9]{2})/,
11307
+ amex: /^3[47]/,
11308
+ discover: /^(6011|65|64[4-9])/,
11309
+ diners: /^(30[0-5]|36|38)/,
11310
+ jcb: /^(35[2-8][0-9])/,
11311
+ unionpay: /^62/
11312
+ };
11313
+ for (const [type, regex] of Object.entries(patterns)) {
11314
+ if (regex.test(number)) {
11315
+ return type;
11316
+ }
11317
+ }
11318
+ return "unknown";
11319
+ }
11320
+ function getCardImage(cardInput) {
11321
+ const cardType = detectCardType(cardInput);
11322
+ switch (cardType) {
11323
+ case "visa":
11324
+ return /* @__PURE__ */ jsx36("img", { src: visa2, alt: "visa", width: 33 });
11325
+ case "mastercard":
11326
+ return /* @__PURE__ */ jsx36("img", { src: mastercard2, width: 33, alt: "mastercard" });
11327
+ case "amex":
11328
+ return /* @__PURE__ */ jsx36("img", { src: americanexp2, alt: "amex", width: 33 });
11329
+ case "discover":
11330
+ return /* @__PURE__ */ jsx36("img", { src: discover2, width: 33, alt: "discover" });
11331
+ case "diners":
11332
+ return /* @__PURE__ */ jsx36("img", { src: dinersicon, alt: "Diners Club" });
11333
+ case "jcb":
11334
+ return /* @__PURE__ */ jsx36("img", { src: jcbicon, alt: "JCB" });
11335
+ case "unionpay":
11336
+ return /* @__PURE__ */ jsx36("img", { src: unionicon, alt: "UnionPay" });
11337
+ default:
11338
+ return /* @__PURE__ */ jsx36("img", { src: defualtcardborder, alt: "card" });
11339
+ }
11340
+ }
11341
+ return /* @__PURE__ */ jsxs21(Fragment20, { children: [
11342
+ (initialLoader || !onLoad) && /* @__PURE__ */ jsx36(Loader_default, { intensity: "dark", loading: initialLoader || !onLoad }),
11343
+ error && /* @__PURE__ */ jsx36("div", { children: /* @__PURE__ */ jsx36(ErrorCardOverlay_default, { error, onClose: handleClose, autoTrigger }) }),
11344
+ errorIframe && /* @__PURE__ */ jsx36("div", { children: /* @__PURE__ */ jsx36(ErrorCardOverlay_default, { error: errorIframe, onClose: () => {
11345
+ setErrorIframe("");
11346
+ }, autoTrigger: onSubmit ? !onSubmit : autoTrigger }) }),
11347
+ /* @__PURE__ */ jsxs21(Fragment20, { children: [
11348
+ (loading || loading2 || loadingIframe) && /* @__PURE__ */ jsx36(Loader_default, { intensity: "light", loading: loading || loading2 || loadingPrev || orderLoader || loadingIframe }),
11349
+ /* @__PURE__ */ jsxs21("div", { className: "frac-card-payment-page frac-form frac-new-form", children: [
11350
+ /* @__PURE__ */ jsx36("div", { ref: threeDSContainerRef, style: { width: "100%", height: "100%" } }),
11351
+ (stripeResponse == null ? void 0 : stripeResponse.challenge_url) ? /* @__PURE__ */ jsx36(
11352
+ ThreeDSChallenge,
11353
+ {
11354
+ containerRef: threeDSContainerRef,
11355
+ challengeUrl: stripeResponse.challenge_url,
11356
+ fractalToken: stripeResponse.fractalToken,
11357
+ stripeIntentId: stripeResponse.id,
11358
+ onSuccess: handleSuccess,
11359
+ onError: handleError
11360
+ }
11361
+ ) : /* @__PURE__ */ jsxs21("div", { className: "parent-pay-container", children: [
11362
+ /* @__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: [
11363
+ /* @__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" }) }),
11364
+ /* @__PURE__ */ jsx36("defs", { children: /* @__PURE__ */ jsx36("clipPath", { id: "clip0_12425_52336", children: /* @__PURE__ */ jsx36("rect", { width: "16", height: "16", fill: "white" }) }) })
11365
+ ] }) }),
11366
+ /* @__PURE__ */ jsx36("div", { className: "pay-main-logo-res" }),
11367
+ /* @__PURE__ */ jsxs21("div", { className: onSubmit ? "pay-container frac-pay-container " : "pay-container", children: [
11368
+ !onSubmit && /* @__PURE__ */ jsxs21("div", { className: "pay-header pay-conatiner-one", children: [
11369
+ /* @__PURE__ */ jsxs21("div", { className: "pay-conatiner-one-first", children: [
11370
+ /* @__PURE__ */ jsxs21("div", { className: "pay-logo-container", children: [
11371
+ /* @__PURE__ */ jsx36("div", { className: "pay-main-logo" }),
11372
+ /* @__PURE__ */ jsx36("h1", { className: "pay-heading", children: "Pay" }),
11373
+ (cardList == null ? void 0 : cardList.length) > 0 && activetab !== "cardList" && /* @__PURE__ */ jsxs21("button", { className: "res-charge-payment-back-btn ", onClick: () => setActive("cardList"), children: [
11374
+ " ",
11375
+ /* @__PURE__ */ jsx36(IoArrowBack4, {}),
11376
+ " Back"
11377
+ ] })
11378
+ ] }),
11379
+ /* @__PURE__ */ jsx36("div", { className: "amt-pay-con", children: /* @__PURE__ */ jsxs21("div", { className: "pay-amount-conatiner", children: [
11380
+ /* @__PURE__ */ jsx36("small", { className: "pay-payment-amount", children: "Select payment type" }),
11381
+ /* @__PURE__ */ jsxs21("div", { className: "frac-card-bank-radio-main", children: [
11382
+ /* @__PURE__ */ jsx36(CardBankRadio, { label: "Card", amount: (_a = Number(amount)) == null ? void 0 : _a.toFixed(2), value: "card", onChange: handletabchange, activetab }),
11383
+ !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 })
11384
+ ] }),
11385
+ isPartial && /* @__PURE__ */ jsxs21("div", { className: "frac-partial-payment-input", children: [
11386
+ /* @__PURE__ */ jsx36("label", { htmlFor: "partialpayment", children: "Partial Payment" }),
11387
+ /* @__PURE__ */ jsx36(
11388
+ NumericFormat2,
11389
+ {
11390
+ prefix: "$",
11391
+ className: "form-control-frac",
11392
+ value: partialAmount,
11393
+ onValueChange: (values) => {
11394
+ handlePartialChange(values);
11395
+ },
11396
+ thousandSeparator: true,
11397
+ placeholder: "Enter partial amount",
11398
+ allowNegative: false,
11399
+ allowLeadingZeros: false,
11400
+ decimalScale: 2,
11401
+ fixedDecimalScale: true,
11402
+ isAllowed: (values) => {
11403
+ const { floatValue = 0, value } = values;
11404
+ if (value === "") return true;
11405
+ if (value === "0" || value.startsWith("0.")) return true;
11406
+ if (floatValue === 0) return false;
11407
+ return floatValue > 0;
11408
+ }
11409
+ }
11410
+ ),
11411
+ partialError && /* @__PURE__ */ jsx36("span", { className: "error-span", children: partialError })
11412
+ ] })
11413
+ ] }) })
11414
+ ] }),
11415
+ /* @__PURE__ */ jsxs21("div", { className: "pay-conatiner-one-last", children: [
11416
+ /* @__PURE__ */ jsx36("img", { src: secure2, alt: "" }),
11417
+ /* @__PURE__ */ jsx36("img", { src: pov2, alt: "" }),
11418
+ "Secure payments powered by Fractal"
11419
+ ] })
11420
+ ] }),
11421
+ /* @__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: [
11422
+ onSubmit && /* @__PURE__ */ jsx36("div", { className: "amt-pay-con", children: /* @__PURE__ */ jsxs21("div", { className: "pay-amount-conatiner", children: [
11423
+ /* @__PURE__ */ jsxs21("div", { className: "frac-card-bank-radio-main", children: [
11424
+ /* @__PURE__ */ jsx36(CardBankRadio, { skydesign: true, label: "Card", amount: (_c = Number(amount)) == null ? void 0 : _c.toFixed(2), value: "card", onChange: handletabchange, activetab }),
11425
+ !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 })
11426
+ ] }),
11427
+ isPartial && /* @__PURE__ */ jsxs21("div", { className: "frac-partial-payment-input", children: [
11428
+ /* @__PURE__ */ jsx36("label", { htmlFor: "partialpayment", children: "Partial Payment" }),
11429
+ /* @__PURE__ */ jsx36(
11430
+ NumericFormat2,
11431
+ {
11432
+ prefix: "$",
11433
+ className: "form-control-frac",
11434
+ value: partialAmount,
11435
+ onValueChange: (values) => {
11436
+ handlePartialChange(values);
11437
+ },
11438
+ thousandSeparator: true,
11439
+ placeholder: "Enter partial amount",
11440
+ allowNegative: false,
11441
+ allowLeadingZeros: false,
11442
+ decimalScale: 2,
11443
+ fixedDecimalScale: true
11444
+ }
11445
+ ),
11446
+ partialError && /* @__PURE__ */ jsx36("span", { className: "error-span", children: partialError })
11447
+ ] })
11448
+ ] }) }),
11449
+ is3DSEnable ? clientSecret && /* @__PURE__ */ jsx36(CheckoutWrapper, { onSuccess, clientSecret, amount, showLoader, hideLoader, callback, session_token, handleClose, setError, isPreAuth }) : /* @__PURE__ */ jsxs21(Fragment20, { children: [
11450
+ /* @__PURE__ */ jsxs21("div", { id: "ach", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent", children: [
11451
+ !onSubmit && /* @__PURE__ */ jsxs21(Fragment20, { children: [
11452
+ /* @__PURE__ */ jsxs21("div", { className: "frac-heading-card-wrap", children: [
11453
+ /* @__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: [
11454
+ " ",
11455
+ /* @__PURE__ */ jsx36(IoArrowBack4, {})
11456
+ ] }) }),
11457
+ /* @__PURE__ */ jsx36("h6", { className: "frac-card-payment-heading", children: "Card Payment" })
11458
+ ] }),
11459
+ /* @__PURE__ */ jsxs21("div", { style: { display: "flex", gap: "8px", margin: "8px 0px 19px 0px" }, children: [
11460
+ /* @__PURE__ */ jsx36("img", { src: visa2, alt: "", width: 33 }),
11461
+ /* @__PURE__ */ jsx36("img", { src: mastercard2, width: 33, alt: "" }),
11462
+ /* @__PURE__ */ jsx36("img", { src: americanexp2, alt: "", width: 33 }),
11463
+ /* @__PURE__ */ jsx36("img", { src: discover2, width: 33, alt: "" })
11464
+ ] })
11465
+ ] }),
11466
+ activeinCard === "list" && (cardList == null ? void 0 : cardList.length) > 0 ? /* @__PURE__ */ jsxs21(Fragment20, { children: [
11467
+ /* @__PURE__ */ jsx36(CardList, { headingClass: "card-ach-heading-frac", listHeading: "Card", ListItems: cardList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Card", otherButtonAction: () => {
11468
+ setActiveinCard("form");
11469
+ } }),
11470
+ /* @__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)) }) })
11471
+ ] }) : paymentGateway == 32 ? /* @__PURE__ */ jsxs21(Fragment20, { children: [
11472
+ onSubmit && /* @__PURE__ */ jsxs21(Fragment20, { children: [
11473
+ /* @__PURE__ */ jsx36(
11474
+ ApplePayButton,
11475
+ {
11476
+ applePayAmount: partialAmount ? partialAmount : amount,
11477
+ applePayMerchantId,
11478
+ applePayMerchantName: merchantName,
11479
+ completeFractalFlow,
11480
+ showLoader
11481
+ }
11482
+ ),
11483
+ /* @__PURE__ */ jsx36(
11484
+ GooglePayComponent,
11485
+ {
11486
+ amount: partialAmount ? partialAmount : amount,
11487
+ googlePayEnvironment,
11488
+ googlePayGatewayMerchantId,
11489
+ googlePayMerchantId,
11490
+ googlePayMerchantName: merchantName,
11491
+ completeFractalFlow,
11492
+ setLoading
11493
+ }
11494
+ ),
11495
+ /* @__PURE__ */ jsx36("div", { id: "digital-wallet-or", className: "frac-or", children: /* @__PURE__ */ jsx36("span", { children: "or" }) })
11496
+ ] }),
11497
+ /* @__PURE__ */ jsxs21("form", { id: "paymentForm", style: { textAlign: "start" }, ref: cardFormRef, onSubmit: submitFunc, onKeyDown: (e) => {
11498
+ if (e.key === "Enter" && loading) {
11499
+ e.preventDefault();
11500
+ e.stopPropagation();
11501
+ }
11502
+ }, children: [
11503
+ /* @__PURE__ */ jsxs21("div", { className: "ach-scrl", style: { minHeight: "398px", maxHeight: "398px", overflow: "auto", marginRight: "5px" }, children: [
11504
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11505
+ /* @__PURE__ */ jsx36("label", { htmlFor: "cardHolderName", children: "NAME ON CARD " }),
11506
+ /* @__PURE__ */ jsx36("input", { type: "text", className: "form-control-frac", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
11507
+ const value = e.target.value;
11508
+ if (/^[a-zA-Z\s]*$/.test(value)) {
11509
+ handleCardChange("cardName", value);
11510
+ }
11511
+ } }),
11512
+ (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardName })
11513
+ ] }),
11514
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11515
+ /* @__PURE__ */ jsx36("label", { htmlFor: "cardNumber", children: "CARD NUMBER" }),
11516
+ /* @__PURE__ */ jsx36("div", { className: "toggle-num-wrapper toggle-num-wrapper-new", children: (show || autoTrigger) && paymentGateway === 32 && /* @__PURE__ */ jsx36(
11517
+ FractalFields_default,
11518
+ {
11519
+ fractalStyles,
11520
+ tokenizerRef,
11521
+ isSky: true
11522
+ }
11523
+ ) })
11524
+ ] }),
11525
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11526
+ /* @__PURE__ */ jsx36("label", { htmlFor: "zip", children: "ZIP" }),
11527
+ /* @__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) }),
11528
+ (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: cardError == null ? void 0 : cardError.zipCode }),
11529
+ pass_fee && cardFeeAmount > 0 && /* @__PURE__ */ jsxs21("small", { className: "frac-fee-text", children: [
11530
+ "Credit cards include a fee amount of ",
11531
+ /* @__PURE__ */ jsx36("span", { className: "frac-fee-amount", children: formatUSD(cardFeeAmount.toFixed(2)) }),
11532
+ "."
11533
+ ] })
11534
+ ] }),
11535
+ 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: [
11536
+ /* @__PURE__ */ jsx36(
11537
+ "input",
11538
+ {
11539
+ type: "checkbox",
11540
+ id: "save_card",
11541
+ className: "toggle-checkbox",
11542
+ checked: saveCardInfo,
11543
+ onChange: (e) => setSaveCardInfo(e.target.checked)
11544
+ }
11545
+ ),
11546
+ /* @__PURE__ */ jsx36("label", { htmlFor: "save_card", className: "toggle-label" }),
11547
+ /* @__PURE__ */ jsx36("label", { htmlFor: "save_card", children: "Save card for future payments " }),
11548
+ /* @__PURE__ */ jsxs21("div", { className: "frac-tooltip-wrapper", children: [
11549
+ /* @__PURE__ */ jsx36("div", { className: "frac-tooltip-icon", children: /* @__PURE__ */ jsxs21(
11550
+ "svg",
11551
+ {
11552
+ xmlns: "http://www.w3.org/2000/svg",
11553
+ width: "20",
11554
+ height: "20",
11555
+ viewBox: "0 0 20 20",
11556
+ fill: "none",
11557
+ children: [
11558
+ /* @__PURE__ */ jsx36("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }),
11559
+ /* @__PURE__ */ jsx36(
11560
+ "path",
11561
+ {
11562
+ 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",
11563
+ fill: "#161616"
11564
+ }
11565
+ )
11566
+ ]
11567
+ }
11568
+ ) }),
11569
+ /* @__PURE__ */ jsx36("div", { className: "frac-tooltip-text", children: /* @__PURE__ */ jsxs21("p", { children: [
11570
+ "If checked, I agree to give the ",
11571
+ /* @__PURE__ */ jsx36("b", { children: merchantName || "merchant" }),
11572
+ " permission to charge this credit card for agreed-upon purchases in the future."
11573
+ ] }) })
11574
+ ] })
11575
+ ] }) })
11576
+ ] }),
11577
+ /* @__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)) }) })
11578
+ ] })
11579
+ ] }) : /* @__PURE__ */ jsxs21("form", { id: "PaymentForm", style: { textAlign: "start" }, ref: cardFormRef, onSubmit: submitFunc, onKeyDown: (e) => {
11580
+ if (e.key === "Enter" && loading) {
11581
+ e.preventDefault();
11582
+ e.stopPropagation();
11583
+ }
11584
+ }, children: [
11585
+ /* @__PURE__ */ jsxs21("div", { className: "ach-scrl", style: { minHeight: "398px", maxHeight: "398px", overflow: "auto", marginRight: "5px" }, children: [
11586
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11587
+ /* @__PURE__ */ jsx36("label", { htmlFor: "cardHolderName", children: "NAME ON CARD " }),
11588
+ /* @__PURE__ */ jsx36("input", { type: "text", className: "form-control-frac", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
11589
+ const value = e.target.value;
11590
+ if (/^[a-zA-Z\s]*$/.test(value)) {
11591
+ handleCardChange("cardName", value);
11592
+ }
11593
+ } }),
11594
+ (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardName })
11595
+ ] }),
11596
+ /* @__PURE__ */ jsx36("div", { className: "form-group-frac", children: /* @__PURE__ */ jsx36(
11597
+ DataCapFields,
11598
+ {
11599
+ isOpen: show || autoTrigger,
11600
+ tokenKey: dcToken,
11601
+ setLoader: activeinCard === "form" ? setLoadingIframe : null,
11602
+ isEmbedded: onSubmit ? true : false,
11603
+ customCSS: customCSS2
11604
+ }
11605
+ ) }),
11606
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11607
+ /* @__PURE__ */ jsx36("label", { htmlFor: "zip", children: "ZIP" }),
11608
+ /* @__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) }),
11609
+ (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: cardError == null ? void 0 : cardError.zipCode }),
11610
+ pass_fee && cardFeeAmount > 0 && /* @__PURE__ */ jsxs21("small", { className: "frac-fee-text", children: [
11611
+ "Credit cards include a fee amount of ",
11612
+ /* @__PURE__ */ jsx36("span", { className: "frac-fee-amount", children: formatUSD(cardFeeAmount.toFixed(2)) }),
11613
+ "."
11614
+ ] })
11615
+ ] }),
11616
+ 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: [
11617
+ /* @__PURE__ */ jsx36(
11618
+ "input",
11619
+ {
11620
+ type: "checkbox",
11621
+ id: "save_card",
11622
+ className: "toggle-checkbox",
11623
+ checked: saveCardInfo,
11624
+ onChange: (e) => setSaveCardInfo(e.target.checked)
11625
+ }
11626
+ ),
11627
+ /* @__PURE__ */ jsx36("label", { htmlFor: "save_card", className: "toggle-label" }),
11628
+ /* @__PURE__ */ jsx36("label", { htmlFor: "save_card", children: "Save card for future payments " }),
11629
+ /* @__PURE__ */ jsxs21("div", { className: "frac-tooltip-wrapper", children: [
11630
+ /* @__PURE__ */ jsx36("div", { className: "frac-tooltip-icon", children: /* @__PURE__ */ jsxs21(
11631
+ "svg",
11632
+ {
11633
+ xmlns: "http://www.w3.org/2000/svg",
11634
+ width: "20",
11635
+ height: "20",
11636
+ viewBox: "0 0 20 20",
11637
+ fill: "none",
11638
+ children: [
11639
+ /* @__PURE__ */ jsx36("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }),
11640
+ /* @__PURE__ */ jsx36(
11641
+ "path",
11642
+ {
11643
+ 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",
11644
+ fill: "#161616"
11645
+ }
11646
+ )
11647
+ ]
11648
+ }
11649
+ ) }),
11650
+ /* @__PURE__ */ jsx36("div", { className: "frac-tooltip-text", children: /* @__PURE__ */ jsxs21("p", { children: [
11651
+ "If checked, I agree to give the ",
11652
+ /* @__PURE__ */ jsx36("b", { children: merchantName || "merchant" }),
11653
+ " permission to charge this credit card for agreed-upon purchases in the future."
11654
+ ] }) })
11655
+ ] })
11656
+ ] }) })
11657
+ ] }),
11658
+ /* @__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)) }) })
11659
+ ] })
11660
+ ] }),
11661
+ /* @__PURE__ */ jsx36("div", { id: "ach", style: { display: activetab === "ach" ? "block" : "none" }, className: "tabcontent", children: /* @__PURE__ */ jsxs21(Fragment20, { children: [
11662
+ !onSubmit && /* @__PURE__ */ jsxs21("div", { className: "frac-heading-card-wrap", children: [
11663
+ /* @__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: [
11664
+ " ",
11665
+ /* @__PURE__ */ jsx36(IoArrowBack4, {})
11666
+ ] }) }),
11667
+ /* @__PURE__ */ jsx36("h6", { className: "frac-card-payment-heading", children: "Bank Payment" })
11668
+ ] }),
11669
+ activeinBank === "list" && (bankList == null ? void 0 : bankList.length) > 0 ? /* @__PURE__ */ jsxs21(Fragment20, { children: [
11670
+ /* @__PURE__ */ jsx36(CardList, { headingClass: "card-ach-heading-frac", listHeading: "Banks", ListItems: bankList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Bank", otherButtonAction: () => {
11671
+ setActiveinBank("form");
11672
+ } }),
11673
+ /* @__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)) }) })
11674
+ ] }) : /* @__PURE__ */ jsxs21("form", { id: "ACHPaymentForm", style: { textAlign: "start" }, ref: bankFormRef, onSubmit: submitFunc, autoComplete: "off", onKeyDown: (e) => {
11675
+ if (e.key === "Enter" && loading) {
11676
+ e.preventDefault();
11677
+ e.stopPropagation();
11678
+ }
11679
+ }, children: [
11680
+ /* @__PURE__ */ jsxs21("div", { className: "ach-scrl", style: {
11681
+ minHeight: "444px",
11682
+ maxHeight: "444px"
11683
+ }, children: [
11684
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11685
+ /* @__PURE__ */ jsx36("label", { htmlFor: "nameonaccount", children: "Name on account" }),
11686
+ /* @__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 }),
11687
+ (achError == null ? void 0 : achError.name) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: achError == null ? void 0 : achError.name })
11688
+ ] }),
11689
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11690
+ /* @__PURE__ */ jsx36("label", { htmlFor: "routingnumber", children: "Routing number" }),
11691
+ /* @__PURE__ */ jsx36(
11692
+ "input",
11693
+ {
11694
+ type: "text",
11695
+ id: "routingnumber",
11696
+ className: "form-control-frac",
11697
+ maxLength: 9,
11698
+ placeholder: "000000000",
11699
+ name: "routingNumber",
11700
+ value: (_o = achData == null ? void 0 : achData.routingNumber) != null ? _o : "",
11701
+ onChange: handleChangeAch
11702
+ }
11703
+ ),
11704
+ (achError == null ? void 0 : achError.routingNumber) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: achError == null ? void 0 : achError.routingNumber })
11705
+ ] }),
11706
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11707
+ /* @__PURE__ */ jsx36("label", { htmlFor: "accountnumber", children: "Account number" }),
11708
+ /* @__PURE__ */ jsx36(
11709
+ "input",
11710
+ {
11711
+ type: "text",
11712
+ id: "accountnumber",
11713
+ className: "form-control-frac",
11714
+ maxLength: 16,
11715
+ placeholder: "0000000000",
11716
+ name: "accountNumber",
11717
+ value: (_p = achData == null ? void 0 : achData.accountNumber) != null ? _p : "",
11718
+ onChange: handleChangeAch
11719
+ }
11720
+ ),
11721
+ (achError == null ? void 0 : achError.accountNumber) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: achError == null ? void 0 : achError.accountNumber })
11722
+ ] }),
11723
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11724
+ /* @__PURE__ */ jsx36("label", { htmlFor: "confirmaccountnumber", children: "Confirm account number" }),
11725
+ /* @__PURE__ */ jsx36(
11726
+ "input",
11727
+ {
11728
+ type: "text",
11729
+ id: "confirmaccountnumber",
11730
+ className: "form-control-frac",
11731
+ maxLength: 16,
11732
+ placeholder: "0000000000",
11733
+ name: "confirmAccountNumber",
11734
+ value: (_q = achData == null ? void 0 : achData.confirmAccountNumber) != null ? _q : "",
11735
+ onChange: handleChangeAch
11736
+ }
11737
+ ),
11738
+ (achError == null ? void 0 : achError.confirmAccountNumber) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: achError == null ? void 0 : achError.confirmAccountNumber })
11739
+ ] }),
11740
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11741
+ /* @__PURE__ */ jsx36("label", { htmlFor: "bankname", children: "Bank name" }),
11742
+ /* @__PURE__ */ jsx36(
11743
+ "input",
11744
+ {
11745
+ type: "text",
11746
+ id: "bankname",
11747
+ className: "form-control-frac",
11748
+ maxLength: 100,
11749
+ placeholder: "My Bank",
11750
+ name: "bankName",
11751
+ value: (_r = achData == null ? void 0 : achData.bankName) != null ? _r : "",
11752
+ onChange: handleChangeAch
11753
+ }
11754
+ ),
11755
+ (achError == null ? void 0 : achError.bankName) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: achError == null ? void 0 : achError.bankName })
11756
+ ] }),
11757
+ ((achData == null ? void 0 : achData.accountType) === "business saving" || (achData == null ? void 0 : achData.accountType) === "business checking") && /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11758
+ /* @__PURE__ */ jsx36("label", { htmlFor: "companyName", children: "Company name" }),
11759
+ /* @__PURE__ */ jsx36(
11760
+ "input",
11761
+ {
11762
+ type: "text",
11763
+ id: "companyName",
11764
+ className: "form-control-frac",
11765
+ maxLength: 100,
11766
+ placeholder: "My Company",
11767
+ name: "companyName",
11768
+ value: (_s = achData == null ? void 0 : achData.companyName) != null ? _s : "",
11769
+ onChange: handleChangeAch
11770
+ }
11771
+ ),
11772
+ (achError == null ? void 0 : achError.companyName) && /* @__PURE__ */ jsx36("span", { className: "error-span", children: achError == null ? void 0 : achError.companyName })
11773
+ ] }),
11774
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11775
+ /* @__PURE__ */ jsx36("label", { htmlFor: "accounttype", children: "Select account type" }),
11776
+ /* @__PURE__ */ jsxs21("select", { name: "accountType", id: "accounttype", className: "form-control-frac", value: (_t = achData == null ? void 0 : achData.accountType) != null ? _t : "", onChange: handleChangeAch, children: [
11777
+ /* @__PURE__ */ jsx36("option", { value: "", children: "Select account" }),
11778
+ accountTypes.map((type) => /* @__PURE__ */ jsx36("option", { value: type.value, children: type.label }, type.value))
11779
+ ] }),
11780
+ bankFeeAmount > 0 && /* @__PURE__ */ jsxs21("small", { className: "frac-fee-text", children: [
11781
+ "There is a processing fee of ",
11782
+ /* @__PURE__ */ jsx36("span", { className: "frac-fee-amount", children: formatUSD(bankFeeAmount.toFixed(2)) }),
11783
+ "."
11784
+ ] }),
11785
+ !saveACHinfo && /* @__PURE__ */ jsxs21(Fragment20, { children: [
11786
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
11787
+ /* @__PURE__ */ jsx36("input", { type: "checkbox", id: "achconsent", className: "", checked: isBankConsentChecked, onChange: (e) => {
11788
+ setIsBankConsentChecked(e.target.checked);
11789
+ if (e.target.checked) {
11790
+ setErrorBankConsent("");
11791
+ }
11792
+ } }),
11793
+ /* @__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.` })
11794
+ ] }),
11795
+ errorBankConsent && /* @__PURE__ */ jsx36("span", { className: "error-span", children: errorBankConsent })
11796
+ ] }),
11797
+ customerId && /* @__PURE__ */ jsxs21("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
11798
+ /* @__PURE__ */ jsx36("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => {
11799
+ setSaveACHinfo(e.target.checked);
11800
+ if (!e.target.checked) {
11801
+ setSaveACHConsent1(false);
11802
+ setErrorBankConsentOther("");
11803
+ }
11804
+ } }),
11805
+ /* @__PURE__ */ jsx36("label", { className: "saveachlabel", htmlFor: "saveACH", children: "Save for future use" })
11806
+ ] }),
11807
+ saveACHinfo && /* @__PURE__ */ jsxs21(Fragment20, { children: [
11808
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
11809
+ /* @__PURE__ */ jsx36("input", { type: "checkbox", id: "saveACHConsent1", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHConsent1, onChange: (e) => {
11810
+ setSaveACHConsent1(e.target.checked);
11811
+ if (e.target.checked) {
11812
+ setErrorBankConsentOther("");
11813
+ }
11814
+ } }),
11815
+ /* @__PURE__ */ jsxs21("label", { className: "saveachlabel", htmlFor: "saveACHConsent1", children: [
11816
+ "By providing my bank account information and selecting \u2018Save for future payments\u2019, I authorize ",
11817
+ merchantName || "merchant",
11818
+ " to store my bank account details for future ACH payments. I understand that future payments may be initiated using this saved account in accordance with my instructions. I confirm I am authorized to use this bank account."
11819
+ ] })
11820
+ ] }),
11821
+ errorBankConsentOther && /* @__PURE__ */ jsx36("span", { className: "error-span", children: errorBankConsentOther })
11822
+ ] })
11823
+ ] })
11824
+ ] }),
11825
+ /* @__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)) }) })
11826
+ ] })
11827
+ ] }) })
11828
+ ] })
11829
+ ] }) }) })
11830
+ ] })
11831
+ ] })
11832
+ ] })
11833
+ ] })
11834
+ ] });
11835
+ };
11836
+ var ModelContentSky_default = ModelContentSky;
11837
+
11838
+ // src/app/components/Skysystemz/PayButtonWithForm.tsx
11839
+ import axios10 from "axios";
11840
+ import { Fragment as Fragment21, jsx as jsx37, jsxs as jsxs22 } from "react/jsx-runtime";
11841
+ var PaymentWidget = ({
11842
+ amount,
11843
+ bankAmount,
11844
+ submitBtnText = "Pay",
11845
+ session_token,
11846
+ customerId,
11847
+ callback,
11848
+ merchantName = "merchant",
11849
+ isPreAuth,
11850
+ surcharge = "0",
11851
+ submitBtnClass,
11852
+ submitBtnIcon,
11853
+ isRequest,
11854
+ pass_fee,
11855
+ pass_fee_amount,
11856
+ require3ds = false,
11857
+ autoTrigger = false,
11858
+ isPartial,
11859
+ bankSurcharge,
11860
+ partialRef,
11861
+ customCSS: customCSS2,
11862
+ disableSubmitBtn = false
11863
+ }) => {
11864
+ const [show, setShow] = useState12(autoTrigger || false);
11865
+ const [loading, setLoading] = useState12(false);
11866
+ const [childHandleClose, setChildHandleClose] = useState12(() => () => {
11867
+ });
11868
+ const [orderGuid, setOrderGuid] = useState12(null);
11869
+ const [remainingAmount, setRemainingAmount] = useState12(null);
11870
+ const initialCommonProps = useMemo(
11871
+ () => ({
11872
+ amount,
11873
+ bankAmount,
11874
+ submitBtnText,
11875
+ session_token,
11876
+ customerId,
11877
+ callback,
11878
+ merchantName,
11879
+ isPreAuth,
11880
+ surcharge,
11881
+ submitBtnClass,
11882
+ submitBtnIcon,
11883
+ isRequest,
11884
+ pass_fee,
11885
+ pass_fee_amount,
11886
+ require3ds,
11887
+ autoTrigger,
11888
+ setShow,
11889
+ setHandleCloseRef: setChildHandleClose,
11890
+ isPartial,
11891
+ bankSurcharge,
11892
+ partialRef,
11893
+ customCSS: customCSS2,
11894
+ disableSubmitBtn
11895
+ }),
11896
+ [
11897
+ amount,
11898
+ bankAmount,
11899
+ submitBtnText,
11900
+ session_token,
11901
+ customerId,
11902
+ callback,
11903
+ merchantName,
11904
+ isPreAuth,
11905
+ surcharge,
11906
+ submitBtnClass,
11907
+ submitBtnIcon,
11908
+ isRequest,
11909
+ pass_fee,
11910
+ pass_fee_amount,
11911
+ require3ds,
11912
+ autoTrigger,
11913
+ isPartial,
11914
+ bankSurcharge,
11915
+ partialRef,
11916
+ disableSubmitBtn
11917
+ ]
11918
+ );
11919
+ const [commonProps, setCommonProps] = useState12(initialCommonProps);
11920
+ useEffect19(() => {
11921
+ if (show) {
11922
+ setCommonProps(initialCommonProps);
11923
+ }
11924
+ }, [show, initialCommonProps]);
11925
+ const getskyosOrderDetails = async () => {
11926
+ var _a;
11927
+ setLoading(true);
11928
+ try {
11929
+ const res = await axios10.get(
11930
+ `${masterBaseUrl}api/v1/gateway/get-order-details/${session_token}`,
11931
+ { params: { isPartial, partialRef } }
11932
+ );
11933
+ if ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.result) {
11934
+ const data = res.data.data;
11935
+ if (data == null ? void 0 : data.orderGuid) {
11936
+ setOrderGuid(data == null ? void 0 : data.orderGuid);
11937
+ setRemainingAmount(data == null ? void 0 : data.remainingAmount);
11938
+ }
11939
+ setCommonProps((prev) => __spreadProps(__spreadValues({}, prev), {
11940
+ amount: data.amount,
11941
+ pass_fee_amount: data.pass_fee_amount,
11942
+ pass_fee: data.pass_fee
11943
+ }));
11944
+ }
11945
+ } catch (error) {
11946
+ console.log("error while getting skyosorderdeatils", error);
11947
+ } finally {
11948
+ setLoading(false);
11949
+ }
11950
+ };
11951
+ useEffect19(() => {
11952
+ if (show && isPartial && partialRef) {
11953
+ getskyosOrderDetails();
11954
+ }
11955
+ }, [show, isPartial, partialRef]);
11956
+ return /* @__PURE__ */ jsxs22(Fragment21, { children: [
11957
+ /* @__PURE__ */ jsx37("link", { href: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" }),
11958
+ /* @__PURE__ */ jsx37(DataScript, {}),
11959
+ /* @__PURE__ */ jsx37(FractalTokenizerScript, {}),
11960
+ /* @__PURE__ */ jsx37(SkyChargewidgetstyles, {}),
11961
+ /* @__PURE__ */ jsx37(CardBankRadioStyles, {}),
11962
+ /* @__PURE__ */ jsx37(CustomModal2styles_default, {}),
11963
+ /* @__PURE__ */ jsx37(DataCapScriptLoader, {}),
11964
+ !autoTrigger && /* @__PURE__ */ jsxs22("button", { className: submitBtnClass || "paymentBtn", disabled: disableSubmitBtn, onClick: () => setShow(true), children: [
11965
+ submitBtnText,
11966
+ submitBtnIcon
11967
+ ] }),
11968
+ !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 }))
11969
+ ] });
11970
+ };
11971
+
11972
+ // src/app/components/Skysystemz/EmbeddedCheckout.tsx
11973
+ import { useEffect as useEffect21, useState as useState13, useMemo as useMemo2 } from "react";
11974
+ import axios11 from "axios";
11975
+
11976
+ // src/app/components/Skysystemz/EmbeddedCheckoutStyles.tsx
11977
+ import { jsx as jsx38 } from "react/jsx-runtime";
11978
+ function EmbeddedCheckoutStyles({ extraCustomCSS }) {
11979
+ return /* @__PURE__ */ jsx38("style", { children: `
11980
+
11981
+ .pay-amount-conatiner{
11982
+ margin-top: 20px !important;
11983
+ margin-bottom: 20px !important ;
11984
+ }
11985
+
11986
+ .frac-pay-container.pay-container {
11987
+ grid-template-columns:1fr;
11988
+ }
11989
+
11990
+
11991
+ /* Card */
11992
+ .plan-card {
11993
+ width: 100%;
11994
+ font-family: Inter, sans-serif;
11995
+ background: #fff;
11996
+ }
11997
+
11998
+ /* Header */
11999
+ .card-header {
12000
+ padding: 12px 0 0 0;
12001
+ }
12002
+
12003
+ /* Button */
12004
+ .collapse-btn {
12005
+ width: 100%;
12006
+ background: none;
12007
+ border: none;
12008
+ display: flex;
12009
+ justify-content: space-between;
12010
+ align-items: center;
12011
+ cursor: pointer;
12012
+ font-size: 15px;
12013
+ padding: 0;
12014
+ }
12015
+
12016
+ /* Arrow */
12017
+ .arrow {
12018
+ transition: transform 0.3s ease;
12019
+ height: 8px;
12020
+ }
12021
+
12022
+ /* Open State */
12023
+ .collapse-btn.open .arrow {
12024
+ transform: rotate(180deg); /* Down */
12025
+ }
12026
+
12027
+ /* Body */
12028
+ .card-body {
12029
+ padding: 0;
12030
+ }
12031
+
12032
+ /* Plan Header */
12033
+ .plan-header {
12034
+ font-size: 15px;
12035
+ font-weight: 600;
12036
+ }
12037
+
12038
+ /* Scrollable List */
12039
+ .plan-list {
12040
+ max-height: 200px;
12041
+ overflow-y: auto;
12042
+ padding-right: 6px;
12043
+ }
12044
+
12045
+ /* Items */
12046
+ .plan-item {
12047
+ display: flex;
12048
+ justify-content: space-between;
12049
+ padding: 6px 0;
12050
+ font-size: 14px;
12051
+ }
12052
+
12053
+ /* Badges */
12054
+ .badge {
12055
+ padding: 4px 10px;
12056
+ border-radius: 12px;
12057
+ font-size: 12px;
12058
+ font-weight: 500;
12059
+ }
12060
+
12061
+ .badge-included {
12062
+ background: #f1f3f5;
12063
+ color: #495057;
12064
+ }
12065
+
12066
+ .badge-available {
12067
+ background: #f8f9fa;
12068
+ color: #212529;
12069
+ }
12070
+
12071
+ /* Helpers */
12072
+ .row-between {
12073
+ display: flex;
12074
+ justify-content: space-between;
12075
+ }
12076
+
12077
+ .text-end {
12078
+ text-align: right;
12079
+ }
12080
+
12081
+ .text-muted {
12082
+ color: #6c757d;
12083
+ font-size: 12px;
12084
+ }
12085
+
12086
+ .fw-semibold {
12087
+ font-weight: 600;
12088
+ }
12089
+
12090
+ .mb-2 {
12091
+ margin-bottom: 8px;
12092
+ }
12093
+
12094
+ /* Divider */
12095
+ .divider {
12096
+ height: 1px;
12097
+ background: #e5e7eb;
12098
+ margin: 8px 0;
12099
+ }
12100
+
12101
+ /* Collapse Animation */
12102
+ .collapse {
12103
+ max-height: 0;
12104
+ overflow: hidden;
12105
+ transition: max-height 0.3s ease;
12106
+ }
12107
+
12108
+ .collapse.show {
12109
+ max-height: 1000px;
12110
+ }
12111
+ .frac-pay-container.pay-container {
12112
+ grid-template-columns:1fr;
12113
+ }
12114
+ .frac-payment-form-div .amt-pay-con {
12115
+ padding-right: 0px;
12116
+ }
12117
+ .frac-payment-form-div .ach-scrl {
12118
+ padding-right: 0px;
12119
+ gap: 10px;
12120
+ max-height: fit-content !important;
12121
+ min-height: fit-content !important;
12122
+ overflow: hidden !important;
12123
+ }
12124
+ .frac-payment-form-div .frac-card-bank-radio-main {
12125
+ display: flex;
12126
+ flex-direction: row;
12127
+ align-items: flex-start;
12128
+ align-self: stretch;
12129
+ border-radius: 14px;
12130
+ border: none;
12131
+ overflow: visible;
12132
+ gap: 10px;
12133
+ }
12134
+ .frac-payment-form-div .frac-card-bank-radio {
12135
+ display: flex;
12136
+ padding: 12px 16px;
12137
+ justify-content: space-between;
12138
+ align-items: center;
12139
+ align-self: stretch;
12140
+ width: 50%;
12141
+ border: 1px solid #E0DFE2;
12142
+ border-radius: 10px;
12143
+ box-shadow: rgba(149, 157, 165, 0.2) 0px 1px 4px;
12144
+ }
12145
+ .frac-payment-form-div .frac-card-bank-radio.frac-active {
12146
+ background: #fff;
12147
+ border: 2px solid #004eab !important;
12148
+ }
12149
+
12150
+ .frac-payment-form-div .form-control-frac {
12151
+ border: 1px solid #dee2e6 !important;
12152
+ border-radius: 0.375rem !important;
12153
+ background-color: #F6F6F7;
12154
+ box-shadow: 1px 1px 2px inset rgba(0, 0, 0, 0.1);
12155
+ }
12156
+ .frac-payment-form-div .form-control-frac:focus {
12157
+ border: 1px solid #004eab !important;
12158
+ }
12159
+ .frac-payment-form-div .card-expiry-new {
12160
+ border: none;
12161
+ gap: 10px;
12162
+ }
12163
+ .frac-payment-form-div .exp-date-year-container {
12164
+ gap: 10px;
12165
+ width: 100%;
12166
+ }
12167
+ .frac-payment-form-div .card-type-logo-wrap{
12168
+ position: absolute;
12169
+ right: 10px;
12170
+ max-width: 30px;
12171
+ }
12172
+ .detials-wrap.detials-wrap-1 {
12173
+ display: flex;
12174
+ flex-wrap: wrap;
12175
+ }
12176
+ @media screen and (max-width: 1280px) {
12177
+ .frac-pay-container.pay-container {
12178
+ grid-template-columns: 1fr;
12179
+ border: none;
12180
+ }
12181
+ }
12182
+ @media screen and (max-width: 899px) {
12183
+ .detials-wrap {
12184
+ grid-template-columns: 1fr !important;
12185
+ }
12186
+ .frac-payment-form-div .exp-date-year-container{
12187
+ width: 100%;}
12188
+
12189
+ }
12190
+ @media screen and (max-width: 575px) {
12191
+ .frac-payment-form-div .card-type-logo-wrap{
12192
+ max-width: 30px;
12193
+ }
12194
+ form#ACHPaymentForm .ach-scrl {
12195
+ grid-template-columns: 1fr !important;
12196
+ }
12197
+ @media screen and (max-width: 375px) {
12198
+ .frac-payment-form-div .exp-date-year-container {
12199
+ flex-direction: column;
12200
+ }
12201
+ .parent-pay-container {
12202
+ padding: 10px;
10486
12203
  }
10487
- }, [amount]);
10488
- const onSuccess = () => {
10489
- };
10490
- const handleSuccess = (token, intentId) => {
10491
- showLoader();
10492
- completeFractalFlow(token, intentId);
10493
- setStripeResponse(null);
10494
- };
10495
- const handleError = (status) => {
10496
- console.error("3DS Auth failed \u274C", status);
10497
- setError(`3DS Authentication ${status}`);
10498
- };
10499
- useEffect15(() => {
10500
- if (setHandleCloseRef) {
10501
- setHandleCloseRef(() => handleClose);
10502
12204
  }
10503
- }, []);
10504
- const handlePartialChange = (values) => {
10505
- var _a2, _b2;
10506
- if (((_a2 = Number(remainingAmount || remAmount)) == null ? void 0 : _a2.toFixed(2)) < (values == null ? void 0 : values.floatValue) || (values == null ? void 0 : values.floatValue) < 0) {
10507
- setPartialAmount(values == null ? void 0 : values.value);
10508
- setPartialError(`Partial amount cannot exceed ${formatUSD((_b2 = Number(remainingAmount || remAmount)) == null ? void 0 : _b2.toFixed(2))}`);
10509
- } else if ((values == null ? void 0 : values.floatValue) == 0) {
10510
- setPartialAmount(values == null ? void 0 : values.value);
10511
- setPartialError("Partial amount must be greater than 0");
12205
+ }
12206
+ .box-inner-card-text{
12207
+ display: flex;
12208
+ gap: 0px;
12209
+ flex-direction: column;
12210
+ }
12211
+ .box-inner-card-text .frac-payment-type-logo {
12212
+ width: 17px;
12213
+ height: 17px;
12214
+ aspect-ratio: 1/1;
12215
+ }
12216
+ .exp-date-year-wrap.form-control-frac input {
12217
+ background: transparent;
12218
+ border: none;
12219
+ outline: none;
12220
+ font-size: 1rem;
12221
+ font-weight: 400;
12222
+ }
12223
+ .exp-date-year-wrap.form-control-frac {
12224
+ display: flex;
12225
+ gap: 2px;
12226
+ }
12227
+ .exp-date-year-wrap input.exp-month {
12228
+ width: 32px;
12229
+ }
12230
+ .detials-wrap {
12231
+ display: grid;
12232
+ grid-template-columns: 1fr 1fr;
12233
+ gap: 10px;
12234
+ }
12235
+ .detials-wrap.detials-wrap-2{
12236
+ grid-template-columns: 1fr 1fr;
12237
+ }
12238
+ form#ACHPaymentForm .ach-scrl {
12239
+ display: grid;
12240
+ grid-gap: 0px 10px;
12241
+ grid-template-columns: 1fr;
12242
+ }
12243
+ .plan-list {
12244
+ max-height: 130px;
12245
+ min-height: 130px;
12246
+ overflow-y: auto;
12247
+ padding-right: 6px;
12248
+ }
12249
+ .plan-list::-webkit-scrollbar {
12250
+ width: 3px;
12251
+ background-color: #F5F5F5;
12252
+ }
12253
+ .plan-list::-webkit-scrollbar-thumb {
12254
+ background-color: #35254D;
12255
+ }
12256
+ div#cvv {
12257
+ border-top-left-radius: 0;
12258
+ border-bottom-left-radius: 0;
12259
+ border-top: 0;
12260
+ border-bottom: 0;
12261
+ border-right: 0;
12262
+ }
12263
+ div#exp_year {
12264
+ height: 36px;
12265
+ width: calc(100% + 1px);
12266
+ border-radius: 0;
12267
+ border-top: 0;
12268
+ border-bottom: 0;
12269
+ border-right: 1px solid #dee2e6;
12270
+ }
12271
+ div#exp_month {
12272
+ width: calc(100% + 1px);
12273
+ border-top-right-radius: 0;
12274
+ border-bottom-right-radius: 0;
12275
+ border: 0;
12276
+ border-right: 1px solid #dee2e6;
12277
+ }
12278
+ .exp-date-year-container .form-group {
12279
+ flex: 1;
12280
+ }
12281
+ .input-main-wrap-frac{
12282
+ margin:0px !important;
12283
+ padding:0px !important;
12284
+ }
12285
+ .toggle-num-wrapper.toggle-num-wrapper-new {
12286
+ border: 1px solid #dee2e6 !important;
12287
+ border-radius: 0.375rem !important;
12288
+ background-color: #F6F6F7;
12289
+ box-shadow: 1px 1px 2px inset rgba(0, 0, 0, 0.1);
12290
+ }
12291
+ .toggle-num-wrapper-new div#card_number {
12292
+ padding: 0px 10px;
12293
+ border: none;
12294
+ border-bottom: 1px solid #dee2e6;
12295
+ }
12296
+ .toggle-num-wrapper-new .card-crdi.card-expiry-new {
12297
+ padding: 0px 10px;
12298
+ }
12299
+ .toggle-num-wrapper-new .input-main-wrap-frac {
12300
+ height: 36px;
12301
+ }
12302
+ .toggle-num-wrapper-new:focus {
12303
+ border: 1px solid #004eab !important;
12304
+ }
12305
+ .frac-card-title-main {
12306
+ display: flex;
12307
+ align-items: start;
12308
+ gap: 4px;
12309
+ flex-direction: column;
12310
+ }
12311
+ .parent-pay-container {
12312
+ padding: 24px;
12313
+ background-color: #ffffff !important;
12314
+ border-radius: 15px;
12315
+ min-width: 300px;
12316
+ }
12317
+
12318
+
12319
+ ${extraCustomCSS}
12320
+
12321
+ ` });
12322
+ }
12323
+
12324
+ // src/app/components/Atoms/Applepay/ApplePayScriptLoader.tsx
12325
+ import { useEffect as useEffect20 } from "react";
12326
+ var applePayScriptLoaded = false;
12327
+ var ApplePayScriptLoader = () => {
12328
+ useEffect20(() => {
12329
+ if (applePayScriptLoaded) return;
12330
+ const existingScript = document.querySelector(
12331
+ `script[src="https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js"]`
12332
+ );
12333
+ if (!existingScript) {
12334
+ const script2 = document.createElement("script");
12335
+ script2.src = "https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js";
12336
+ script2.async = true;
12337
+ script2.onload = () => {
12338
+ console.log("\u2705 Apple Pay script loaded");
12339
+ applePayScriptLoaded = true;
12340
+ console.log("ApplePaySession:", window.ApplePaySession);
12341
+ };
12342
+ script2.onerror = (err) => {
12343
+ console.error("\u274C Apple Pay script failed", err);
12344
+ };
12345
+ document.head.appendChild(script2);
10512
12346
  } else {
10513
- setPartialAmount(values == null ? void 0 : values.value);
10514
- setPartialError("");
12347
+ applePayScriptLoaded = true;
10515
12348
  }
10516
- };
10517
- useEffect15(() => {
10518
- if (typeof FractalTokenizer === "undefined") return;
10519
- const tokenizer = new FractalTokenizer({
10520
- styles: {}
10521
- });
10522
12349
  }, []);
10523
- console.log(activeinCard === "list", "activeinCard", activeList);
10524
- return /* @__PURE__ */ jsxs19(Fragment18, { children: [
10525
- initialLoader && /* @__PURE__ */ jsx32(Loader_default, { loading: initialLoader }),
10526
- error && /* @__PURE__ */ jsx32("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx32(ErrorCardMessage_default, { error, onClose: handleClose }) }),
10527
- errorIframe && /* @__PURE__ */ jsx32("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx32(ErrorCardMessage_default, { error: errorIframe, onClose: () => {
10528
- setErrorIframe("");
10529
- } }) }),
10530
- !error && !errorIframe && /* @__PURE__ */ jsxs19(Fragment18, { children: [
10531
- (loading || loading2 || loadingIframe) && /* @__PURE__ */ jsx32(Loader_default, { loading: loading || loading2 || loadingPrev || orderLoader || loadingIframe }),
10532
- /* @__PURE__ */ jsxs19("div", { className: "frac-card-payment-page frac-form frac-new-form", children: [
10533
- /* @__PURE__ */ jsx32("div", { ref: threeDSContainerRef, style: { width: "100%", height: "100%" } }),
10534
- (stripeResponse == null ? void 0 : stripeResponse.challenge_url) ? /* @__PURE__ */ jsx32(
10535
- ThreeDSChallenge,
10536
- {
10537
- containerRef: threeDSContainerRef,
10538
- challengeUrl: stripeResponse.challenge_url,
10539
- fractalToken: stripeResponse.fractalToken,
10540
- stripeIntentId: stripeResponse.id,
10541
- onSuccess: handleSuccess,
10542
- onError: handleError
10543
- }
10544
- ) : /* @__PURE__ */ jsxs19("div", { className: "parent-pay-container", children: [
10545
- /* @__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: [
10546
- /* @__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" }) }),
10547
- /* @__PURE__ */ jsx32("defs", { children: /* @__PURE__ */ jsx32("clipPath", { id: "clip0_12425_52336", children: /* @__PURE__ */ jsx32("rect", { width: "16", height: "16", fill: "white" }) }) })
10548
- ] }) }),
10549
- /* @__PURE__ */ jsx32("div", { className: "pay-main-logo-res" }),
10550
- /* @__PURE__ */ jsxs19("div", { className: "pay-container", children: [
10551
- /* @__PURE__ */ jsxs19("div", { className: "pay-header pay-conatiner-one", children: [
10552
- /* @__PURE__ */ jsxs19("div", { className: "pay-conatiner-one-first", children: [
10553
- /* @__PURE__ */ jsxs19("div", { className: "pay-logo-container", children: [
10554
- /* @__PURE__ */ jsx32("div", { className: "pay-main-logo" }),
10555
- /* @__PURE__ */ jsx32("h1", { className: "pay-heading", children: "Pay" }),
10556
- (cardList == null ? void 0 : cardList.length) > 0 && activetab !== "cardList" && /* @__PURE__ */ jsxs19("button", { className: "res-charge-payment-back-btn ", onClick: () => setActive("cardList"), children: [
10557
- " ",
10558
- /* @__PURE__ */ jsx32(IoArrowBack4, {}),
10559
- " Back"
10560
- ] })
10561
- ] }),
10562
- /* @__PURE__ */ jsx32("div", { className: "amt-pay-con", children: /* @__PURE__ */ jsxs19("div", { className: "pay-amount-conatiner", children: [
10563
- /* @__PURE__ */ jsx32("small", { className: "pay-payment-amount", children: "Select payment type" }),
10564
- /* @__PURE__ */ jsxs19("div", { className: "frac-card-bank-radio-main", children: [
10565
- /* @__PURE__ */ jsx32(CardBankRadio, { label: "Card", amount: (_a = Number(amount)) == null ? void 0 : _a.toFixed(2), value: "card", onChange: handletabchange, activetab }),
10566
- !isPreAuth && isBankActive && !isPartial && /* @__PURE__ */ jsx32(CardBankRadio, { label: "Bank", amount: (_b = Number(bankAmount)) == null ? void 0 : _b.toFixed(2), value: "ach", onChange: handletabchange, activetab })
10567
- ] }),
10568
- pass_fee && activetab === "card" && cashDiscount && Number(amount) - Number(cashDiscount) > 0 ? /* @__PURE__ */ jsxs19("div", { className: "frac-cash-discount-fee", children: [
10569
- /* @__PURE__ */ jsxs19("small", { children: [
10570
- activetab === "card" ? "Cash Discount" : "Cash Discount Savings",
10571
- " "
10572
- ] }),
10573
- /* @__PURE__ */ jsx32("p", { children: formatUSD((Number(amount) - Number(cashDiscount)).toFixed(2)) })
10574
- ] }) : null,
10575
- isPartial && /* @__PURE__ */ jsxs19("div", { className: "frac-partial-payment-input", children: [
10576
- /* @__PURE__ */ jsx32("label", { htmlFor: "partialpayment", children: "Partial Payment" }),
10577
- /* @__PURE__ */ jsx32(
10578
- NumericFormat2,
10579
- {
10580
- prefix: "$",
10581
- className: "form-control-frac",
10582
- value: partialAmount,
10583
- onValueChange: (values) => {
10584
- handlePartialChange(values);
10585
- },
10586
- thousandSeparator: true,
10587
- placeholder: "Enter partial amount",
10588
- allowNegative: false,
10589
- allowLeadingZeros: false,
10590
- decimalScale: 2,
10591
- fixedDecimalScale: true,
10592
- isAllowed: (values) => {
10593
- const { floatValue = 0, value } = values;
10594
- if (value === "") return true;
10595
- if (value === "0" || value.startsWith("0.")) return true;
10596
- if (floatValue === 0) return false;
10597
- return floatValue > 0;
10598
- }
10599
- }
10600
- ),
10601
- partialError && /* @__PURE__ */ jsx32("span", { className: "error-span", children: partialError })
10602
- ] })
10603
- ] }) })
10604
- ] }),
10605
- /* @__PURE__ */ jsxs19("div", { className: "pay-conatiner-one-last", children: [
10606
- /* @__PURE__ */ jsx32("img", { src: secure2, alt: "" }),
10607
- /* @__PURE__ */ jsx32("img", { src: pov2, alt: "" }),
10608
- "Secure payments powered by Fractal"
10609
- ] })
10610
- ] }),
10611
- /* @__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: [
10612
- /* @__PURE__ */ jsxs19("div", { id: "ach", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent", children: [
10613
- /* @__PURE__ */ jsxs19("div", { className: "frac-heading-card-wrap", children: [
10614
- /* @__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: [
10615
- " ",
10616
- /* @__PURE__ */ jsx32(IoArrowBack4, {})
10617
- ] }) }),
10618
- /* @__PURE__ */ jsx32("h6", { className: "frac-card-payment-heading", children: "Card Payment" })
10619
- ] }),
10620
- /* @__PURE__ */ jsxs19("div", { style: { display: "flex", gap: "8px", margin: "8px 0px 19px 0px" }, children: [
10621
- /* @__PURE__ */ jsx32("img", { src: visa2, alt: "", width: 33 }),
10622
- /* @__PURE__ */ jsx32("img", { src: mastercard2, width: 33, alt: "" }),
10623
- /* @__PURE__ */ jsx32("img", { src: americanexp2, alt: "", width: 33 }),
10624
- /* @__PURE__ */ jsx32("img", { src: discover2, width: 33, alt: "" })
10625
- ] }),
10626
- activeinCard === "list" && (cardList == null ? void 0 : cardList.length) > 0 ? /* @__PURE__ */ jsxs19(Fragment18, { children: [
10627
- /* @__PURE__ */ jsx32(CardList, { headingClass: "card-ach-heading-frac", listHeading: "Card", ListItems: cardList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Card", otherButtonAction: () => {
10628
- setActiveinCard("form");
10629
- } }),
10630
- /* @__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)) }) })
10631
- ] }) : paymentGateway == 32 ? /* @__PURE__ */ jsxs19("form", { id: "paymentForm", style: { textAlign: "start" }, onSubmit: submitFunc, onKeyDown: (e) => {
10632
- if (e.key === "Enter" && loading) {
10633
- e.preventDefault();
10634
- e.stopPropagation();
10635
- }
10636
- }, children: [
10637
- /* @__PURE__ */ jsxs19("div", { className: "ach-scrl", style: { minHeight: "398px", maxHeight: "398px", overflow: "auto", marginRight: "5px" }, children: [
10638
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10639
- /* @__PURE__ */ jsx32("label", { htmlFor: "cardHolderName", children: "NAME ON CARD " }),
10640
- /* @__PURE__ */ jsx32("input", { type: "text", className: "form-control-frac", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
10641
- const value = e.target.value;
10642
- if (/^[a-zA-Z\s]*$/.test(value)) {
10643
- handleCardChange("cardName", value);
10644
- }
10645
- } }),
10646
- (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardName })
10647
- ] }),
10648
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10649
- /* @__PURE__ */ jsx32("label", { htmlFor: "cardNumber", children: "CARD NUMBER" }),
10650
- /* @__PURE__ */ jsx32("div", { className: "toggle-num-wrapper", children: (show || autoTrigger) && paymentGateway === 32 && /* @__PURE__ */ jsx32(
10651
- FractalFields_default,
10652
- {
10653
- fractalStyles,
10654
- tokenizerRef,
10655
- isSky: true
10656
- }
10657
- ) })
10658
- ] }),
10659
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10660
- /* @__PURE__ */ jsx32("label", { htmlFor: "zip", children: "ZIP" }),
10661
- /* @__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) }),
10662
- (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: cardError == null ? void 0 : cardError.zipCode })
10663
- ] }),
10664
- 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: [
10665
- /* @__PURE__ */ jsx32(
10666
- "input",
10667
- {
10668
- type: "checkbox",
10669
- id: "save_card",
10670
- className: "toggle-checkbox",
10671
- checked: saveCardInfo,
10672
- onChange: (e) => setSaveCardInfo(e.target.checked)
10673
- }
10674
- ),
10675
- /* @__PURE__ */ jsx32("label", { htmlFor: "save_card", className: "toggle-label" }),
10676
- /* @__PURE__ */ jsx32("label", { htmlFor: "save_card", children: "Save card for future payments " }),
10677
- /* @__PURE__ */ jsxs19("div", { className: "frac-tooltip-wrapper", children: [
10678
- /* @__PURE__ */ jsx32("div", { className: "frac-tooltip-icon", children: /* @__PURE__ */ jsxs19(
10679
- "svg",
10680
- {
10681
- xmlns: "http://www.w3.org/2000/svg",
10682
- width: "20",
10683
- height: "20",
10684
- viewBox: "0 0 20 20",
10685
- fill: "none",
10686
- children: [
10687
- /* @__PURE__ */ jsx32("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }),
10688
- /* @__PURE__ */ jsx32(
10689
- "path",
10690
- {
10691
- 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",
10692
- fill: "#161616"
10693
- }
10694
- )
10695
- ]
10696
- }
10697
- ) }),
10698
- /* @__PURE__ */ jsx32("div", { className: "frac-tooltip-text", children: /* @__PURE__ */ jsxs19("p", { children: [
10699
- "If checked, I agree to give the ",
10700
- /* @__PURE__ */ jsx32("b", { children: merchantName || "merchant" }),
10701
- " permission to charge this credit card for agreed-upon purchases in the future."
10702
- ] }) })
10703
- ] })
10704
- ] }) })
10705
- ] }),
10706
- /* @__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)) }) })
10707
- ] }) : /* @__PURE__ */ jsxs19("form", { id: "PaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc, onKeyDown: (e) => {
10708
- if (e.key === "Enter" && loading) {
10709
- e.preventDefault();
10710
- e.stopPropagation();
10711
- }
10712
- }, children: [
10713
- /* @__PURE__ */ jsxs19("div", { className: "ach-scrl", style: { minHeight: "398px", maxHeight: "398px", overflow: "auto", marginRight: "5px" }, children: [
10714
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10715
- /* @__PURE__ */ jsx32("label", { htmlFor: "cardHolderName", children: "NAME ON CARD " }),
10716
- /* @__PURE__ */ jsx32("input", { type: "text", className: "form-control-frac", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
10717
- const value = e.target.value;
10718
- if (/^[a-zA-Z\s]*$/.test(value)) {
10719
- handleCardChange("cardName", value);
10720
- }
10721
- } }),
10722
- (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardName })
10723
- ] }),
10724
- /* @__PURE__ */ jsx32("div", { className: "form-group-frac", children: /* @__PURE__ */ jsx32(
10725
- DataCapFields,
10726
- {
10727
- isOpen: show || autoTrigger,
10728
- tokenKey: dcToken,
10729
- setLoader: activeinCard === "form" ? setLoadingIframe : null
10730
- }
10731
- ) }),
10732
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10733
- /* @__PURE__ */ jsx32("label", { htmlFor: "zip", children: "ZIP" }),
10734
- /* @__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) }),
10735
- (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: cardError == null ? void 0 : cardError.zipCode })
10736
- ] }),
10737
- 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: [
10738
- /* @__PURE__ */ jsx32(
10739
- "input",
10740
- {
10741
- type: "checkbox",
10742
- id: "save_card",
10743
- className: "toggle-checkbox",
10744
- checked: saveCardInfo,
10745
- onChange: (e) => setSaveCardInfo(e.target.checked)
10746
- }
10747
- ),
10748
- /* @__PURE__ */ jsx32("label", { htmlFor: "save_card", className: "toggle-label" }),
10749
- /* @__PURE__ */ jsx32("label", { htmlFor: "save_card", children: "Save card for future payments " }),
10750
- /* @__PURE__ */ jsxs19("div", { className: "frac-tooltip-wrapper", children: [
10751
- /* @__PURE__ */ jsx32("div", { className: "frac-tooltip-icon", children: /* @__PURE__ */ jsxs19(
10752
- "svg",
10753
- {
10754
- xmlns: "http://www.w3.org/2000/svg",
10755
- width: "20",
10756
- height: "20",
10757
- viewBox: "0 0 20 20",
10758
- fill: "none",
10759
- children: [
10760
- /* @__PURE__ */ jsx32("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }),
10761
- /* @__PURE__ */ jsx32(
10762
- "path",
10763
- {
10764
- 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",
10765
- fill: "#161616"
10766
- }
10767
- )
10768
- ]
10769
- }
10770
- ) }),
10771
- /* @__PURE__ */ jsx32("div", { className: "frac-tooltip-text", children: /* @__PURE__ */ jsxs19("p", { children: [
10772
- "If checked, I agree to give the ",
10773
- /* @__PURE__ */ jsx32("b", { children: merchantName || "merchant" }),
10774
- " permission to charge this credit card for agreed-upon purchases in the future."
10775
- ] }) })
10776
- ] })
10777
- ] }) })
10778
- ] }),
10779
- /* @__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)) }) })
10780
- ] })
10781
- ] }),
10782
- /* @__PURE__ */ jsx32("div", { id: "ach", style: { display: activetab === "ach" ? "block" : "none" }, className: "tabcontent", children: /* @__PURE__ */ jsxs19(Fragment18, { children: [
10783
- /* @__PURE__ */ jsxs19("div", { className: "frac-heading-card-wrap", children: [
10784
- /* @__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: [
10785
- " ",
10786
- /* @__PURE__ */ jsx32(IoArrowBack4, {})
10787
- ] }) }),
10788
- /* @__PURE__ */ jsx32("h6", { className: "frac-card-payment-heading", children: "Bank Payment" })
10789
- ] }),
10790
- activeinBank === "list" && (bankList == null ? void 0 : bankList.length) > 0 ? /* @__PURE__ */ jsxs19(Fragment18, { children: [
10791
- /* @__PURE__ */ jsx32(CardList, { headingClass: "card-ach-heading-frac", listHeading: "Banks", ListItems: bankList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Bank", otherButtonAction: () => {
10792
- setActiveinBank("form");
10793
- } }),
10794
- /* @__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)) }) })
10795
- ] }) : /* @__PURE__ */ jsxs19("form", { id: "ACHPaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc, autoComplete: "off", onKeyDown: (e) => {
10796
- if (e.key === "Enter" && loading) {
10797
- e.preventDefault();
10798
- e.stopPropagation();
10799
- }
10800
- }, children: [
10801
- /* @__PURE__ */ jsxs19("div", { className: "ach-scrl", style: {
10802
- minHeight: "444px",
10803
- maxHeight: "444px"
10804
- }, children: [
10805
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10806
- /* @__PURE__ */ jsx32("label", { htmlFor: "nameonaccount", children: "Name on account" }),
10807
- /* @__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 }),
10808
- (achError == null ? void 0 : achError.name) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: achError == null ? void 0 : achError.name })
10809
- ] }),
10810
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10811
- /* @__PURE__ */ jsx32("label", { htmlFor: "routingnumber", children: "Routing number" }),
10812
- /* @__PURE__ */ jsx32(
10813
- "input",
10814
- {
10815
- type: "text",
10816
- id: "routingnumber",
10817
- className: "form-control-frac",
10818
- maxLength: 9,
10819
- placeholder: "000000000",
10820
- name: "routingNumber",
10821
- value: (_m = achData == null ? void 0 : achData.routingNumber) != null ? _m : "",
10822
- onChange: handleChangeAch
10823
- }
10824
- ),
10825
- (achError == null ? void 0 : achError.routingNumber) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: achError == null ? void 0 : achError.routingNumber })
10826
- ] }),
10827
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10828
- /* @__PURE__ */ jsx32("label", { htmlFor: "accountnumber", children: "Account number" }),
10829
- /* @__PURE__ */ jsx32(
10830
- "input",
10831
- {
10832
- type: "text",
10833
- id: "accountnumber",
10834
- className: "form-control-frac",
10835
- maxLength: 16,
10836
- placeholder: "0000000000",
10837
- name: "accountNumber",
10838
- value: (_n = achData == null ? void 0 : achData.accountNumber) != null ? _n : "",
10839
- onChange: handleChangeAch
10840
- }
10841
- ),
10842
- (achError == null ? void 0 : achError.accountNumber) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: achError == null ? void 0 : achError.accountNumber })
10843
- ] }),
10844
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10845
- /* @__PURE__ */ jsx32("label", { htmlFor: "confirmaccountnumber", children: "Confirm account number" }),
10846
- /* @__PURE__ */ jsx32(
10847
- "input",
10848
- {
10849
- type: "text",
10850
- id: "confirmaccountnumber",
10851
- className: "form-control-frac",
10852
- maxLength: 16,
10853
- placeholder: "0000000000",
10854
- name: "confirmAccountNumber",
10855
- value: (_o = achData == null ? void 0 : achData.confirmAccountNumber) != null ? _o : "",
10856
- onChange: handleChangeAch
10857
- }
10858
- ),
10859
- (achError == null ? void 0 : achError.confirmAccountNumber) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: achError == null ? void 0 : achError.confirmAccountNumber })
10860
- ] }),
10861
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10862
- /* @__PURE__ */ jsx32("label", { htmlFor: "bankname", children: "Bank name" }),
10863
- /* @__PURE__ */ jsx32(
10864
- "input",
10865
- {
10866
- type: "text",
10867
- id: "bankname",
10868
- className: "form-control-frac",
10869
- maxLength: 100,
10870
- placeholder: "My Bank",
10871
- name: "bankName",
10872
- value: (_p = achData == null ? void 0 : achData.bankName) != null ? _p : "",
10873
- onChange: handleChangeAch
10874
- }
10875
- ),
10876
- (achError == null ? void 0 : achError.bankName) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: achError == null ? void 0 : achError.bankName })
10877
- ] }),
10878
- ((achData == null ? void 0 : achData.accountType) === "business saving" || (achData == null ? void 0 : achData.accountType) === "business checking") && /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10879
- /* @__PURE__ */ jsx32("label", { htmlFor: "companyName", children: "Company name" }),
10880
- /* @__PURE__ */ jsx32(
10881
- "input",
10882
- {
10883
- type: "text",
10884
- id: "companyName",
10885
- className: "form-control-frac",
10886
- maxLength: 100,
10887
- placeholder: "My Company",
10888
- name: "companyName",
10889
- value: (_q = achData == null ? void 0 : achData.companyName) != null ? _q : "",
10890
- onChange: handleChangeAch
10891
- }
10892
- ),
10893
- (achError == null ? void 0 : achError.companyName) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: achError == null ? void 0 : achError.companyName })
10894
- ] }),
10895
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
10896
- /* @__PURE__ */ jsx32("label", { htmlFor: "accounttype", children: "Select account type" }),
10897
- /* @__PURE__ */ jsxs19("select", { name: "accountType", id: "accounttype", className: "form-control-frac", value: (_r = achData == null ? void 0 : achData.accountType) != null ? _r : "", onChange: handleChangeAch, children: [
10898
- /* @__PURE__ */ jsx32("option", { value: "", children: "Select account" }),
10899
- accountTypes.map((type) => /* @__PURE__ */ jsx32("option", { value: type.value, children: type.label }, type.value))
10900
- ] })
10901
- ] }),
10902
- /* @__PURE__ */ jsxs19("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
10903
- /* @__PURE__ */ jsx32("input", { type: "checkbox", id: "achconsent", className: "", checked: isBankConsentChecked, onChange: (e) => {
10904
- setIsBankConsentChecked(e.target.checked);
10905
- if (e.target.checked) {
10906
- setErrorBankConsent("");
10907
- }
10908
- } }),
10909
- /* @__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.` })
10910
- ] }),
10911
- errorBankConsent && /* @__PURE__ */ jsx32("span", { className: "error-span", children: errorBankConsent }),
10912
- customerId && /* @__PURE__ */ jsxs19("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
10913
- /* @__PURE__ */ jsx32("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }),
10914
- /* @__PURE__ */ jsx32("label", { className: "saveachlabel", htmlFor: "saveACH", children: "Save Bank" })
10915
- ] }),
10916
- saveACHinfo && /* @__PURE__ */ jsx32("div", { className: "form-group-frac saveachtext", children: /* @__PURE__ */ jsxs19("p", { children: [
10917
- "If checked, I agree to give the ",
10918
- /* @__PURE__ */ jsx32("b", { children: merchantName || "merchant" }),
10919
- " permission to charge this bank account for agreed-upon purchases in the future."
10920
- ] }) })
10921
- ] }),
10922
- /* @__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)) }) })
10923
- ] })
10924
- ] }) })
10925
- ] }) }) }) })
10926
- ] })
10927
- ] })
10928
- ] })
10929
- ] })
10930
- ] });
12350
+ return null;
10931
12351
  };
10932
- var ModelContentSky_default = ModelContentSky;
10933
12352
 
10934
- // src/app/components/Skysystemz/PayButtonWithForm.tsx
10935
- import axios10 from "axios";
10936
- import { Fragment as Fragment19, jsx as jsx33, jsxs as jsxs20 } from "react/jsx-runtime";
10937
- var PaymentWidget = ({
12353
+ // src/app/components/Skysystemz/EmbeddedCheckout.tsx
12354
+ import { Fragment as Fragment22, jsx as jsx39, jsxs as jsxs23 } from "react/jsx-runtime";
12355
+ var EmbeddedCheckout = ({
10938
12356
  amount,
10939
12357
  bankAmount,
10940
12358
  submitBtnText = "Pay",
@@ -10953,15 +12371,18 @@ var PaymentWidget = ({
10953
12371
  autoTrigger = false,
10954
12372
  isPartial,
10955
12373
  bankSurcharge,
10956
- partialRef
12374
+ partialRef,
12375
+ onSubmit,
12376
+ onLoad,
12377
+ customCSS: customCSS2
10957
12378
  }) => {
10958
- const [show, setShow] = useState11(autoTrigger || false);
10959
- const [loading, setLoading] = useState11(false);
10960
- const [childHandleClose, setChildHandleClose] = useState11(() => () => {
12379
+ const [show, setShow] = useState13(false);
12380
+ const [loading, setLoading] = useState13(false);
12381
+ const [childHandleClose, setChildHandleClose] = useState13(() => () => {
10961
12382
  });
10962
- const [orderGuid, setOrderGuid] = useState11(null);
10963
- const [remainingAmount, setRemainingAmount] = useState11(null);
10964
- const initialCommonProps = useMemo(
12383
+ const [orderGuid, setOrderGuid] = useState13(null);
12384
+ const [remainingAmount, setRemainingAmount] = useState13(null);
12385
+ const initialCommonProps = useMemo2(
10965
12386
  () => ({
10966
12387
  amount,
10967
12388
  bankAmount,
@@ -11007,8 +12428,8 @@ var PaymentWidget = ({
11007
12428
  partialRef
11008
12429
  ]
11009
12430
  );
11010
- const [commonProps, setCommonProps] = useState11(initialCommonProps);
11011
- useEffect16(() => {
12431
+ const [commonProps, setCommonProps] = useState13(initialCommonProps);
12432
+ useEffect21(() => {
11012
12433
  if (show) {
11013
12434
  setCommonProps(initialCommonProps);
11014
12435
  }
@@ -11017,7 +12438,7 @@ var PaymentWidget = ({
11017
12438
  var _a;
11018
12439
  setLoading(true);
11019
12440
  try {
11020
- const res = await axios10.get(
12441
+ const res = await axios11.get(
11021
12442
  `${masterBaseUrl}api/v1/gateway/get-order-details/${session_token}`,
11022
12443
  { params: { isPartial, partialRef } }
11023
12444
  );
@@ -11039,29 +12460,44 @@ var PaymentWidget = ({
11039
12460
  setLoading(false);
11040
12461
  }
11041
12462
  };
11042
- useEffect16(() => {
12463
+ useEffect21(() => {
11043
12464
  if (show && isPartial && partialRef) {
11044
12465
  getskyosOrderDetails();
11045
12466
  }
11046
12467
  }, [show, isPartial, partialRef]);
11047
- return /* @__PURE__ */ jsxs20(Fragment19, { children: [
11048
- /* @__PURE__ */ jsx33("link", { href: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" }),
11049
- /* @__PURE__ */ jsx33(DataScript, {}),
11050
- /* @__PURE__ */ jsx33(FractalTokenizerScript, {}),
11051
- /* @__PURE__ */ jsx33(SkyChargewidgetstyles, {}),
11052
- /* @__PURE__ */ jsx33(CardBankRadioStyles, {}),
11053
- /* @__PURE__ */ jsx33(CustomModal2styles_default, {}),
11054
- /* @__PURE__ */ jsx33(DataCapScriptLoader, {}),
11055
- !autoTrigger && /* @__PURE__ */ jsxs20("button", { className: submitBtnClass || "paymentBtn", onClick: () => setShow(true), children: [
12468
+ console.log(onLoad, "onLoad");
12469
+ useEffect21(() => {
12470
+ const supported = !!window.ApplePaySession;
12471
+ let canPay = false;
12472
+ if (supported) {
12473
+ try {
12474
+ canPay = window.ApplePaySession.canMakePayments();
12475
+ } catch (e) {
12476
+ }
12477
+ }
12478
+ console.log(`ApplePaySession: ${supported}, canMakePayments: ${canPay}`);
12479
+ }, []);
12480
+ return /* @__PURE__ */ jsxs23(Fragment22, { children: [
12481
+ /* @__PURE__ */ jsx39("link", { href: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" }),
12482
+ /* @__PURE__ */ jsx39(DataScript, {}),
12483
+ /* @__PURE__ */ jsx39(FractalTokenizerScript, {}),
12484
+ /* @__PURE__ */ jsx39(SkyChargewidgetstyles, {}),
12485
+ /* @__PURE__ */ jsx39(CardBankRadioStyles, {}),
12486
+ /* @__PURE__ */ jsx39(CustomModal2styles_default, {}),
12487
+ /* @__PURE__ */ jsx39(DataCapScriptLoader, {}),
12488
+ /* @__PURE__ */ jsx39(ApplePayScriptLoader, {}),
12489
+ /* @__PURE__ */ jsx39(EmbeddedCheckoutStyles, { extraCustomCSS: customCSS2 }),
12490
+ !autoTrigger && /* @__PURE__ */ jsxs23("button", { className: submitBtnClass || "paymentBtn", onClick: () => setShow(true), children: [
11056
12491
  submitBtnText,
11057
12492
  submitBtnIcon
11058
12493
  ] }),
11059
- !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 }))
12494
+ !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 }))
11060
12495
  ] });
11061
12496
  };
11062
12497
  export {
11063
12498
  AddCardEasyPay as AddCard,
11064
12499
  CardOnFile,
12500
+ EmbeddedCheckout,
11065
12501
  GetPaymentPage,
11066
12502
  PartialPayment,
11067
12503
  PaymentWidget,