@fractalpay/fractalpay-next 0.0.43 → 0.0.45

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",
42
- version: "0.0.43",
42
+ version: "0.0.45",
43
43
  private: false,
44
44
  type: "module",
45
45
  scripts: {
@@ -246,7 +246,7 @@ if (name === "@fractalpay/fractalpay-next-dev") {
246
246
  fractalGatewayUrl = "https://api-dev.merchant-trends.com/";
247
247
  datacapUrl = "https://token-cert.dcap.com/v1/client";
248
248
  threedsSecurePublicKey = "pk_test_51RH5Wc2SlJvyNZ80hpUDy88r4rVdpijfKbNaWaUyQEE6rOrPmG2JQyAj7G5amBD5z5daC56WaeT4jfNhrrPcGOEP00UyKu6AOw";
249
- applePayMerchantId = "fractal";
249
+ applePayMerchantId = "skysystemz";
250
250
  googlePayMerchantId = "12345678901234567890";
251
251
  googlePayEnvironment = "TEST";
252
252
  googlePayGatewayMerchantId = "fractal";
@@ -256,7 +256,7 @@ if (name === "@fractalpay/fractalpay-next-dev") {
256
256
  fractalGatewayUrl = "https://api-dev.merchant-trends.com/";
257
257
  datacapUrl = "https://token-cert.dcap.com/v1/client";
258
258
  threedsSecurePublicKey = "pk_test_51RH5Wc2SlJvyNZ80hpUDy88r4rVdpijfKbNaWaUyQEE6rOrPmG2JQyAj7G5amBD5z5daC56WaeT4jfNhrrPcGOEP00UyKu6AOw";
259
- applePayMerchantId = "fractal";
259
+ applePayMerchantId = "skysystemz";
260
260
  googlePayMerchantId = "12345678901234567890";
261
261
  googlePayEnvironment = "TEST";
262
262
  googlePayGatewayMerchantId = "fractal";
@@ -266,7 +266,7 @@ if (name === "@fractalpay/fractalpay-next-dev") {
266
266
  fractalGatewayUrl = "https://api.merchant-trends.com/";
267
267
  datacapUrl = "https://token.dcap.com/v1/client";
268
268
  threedsSecurePublicKey = "pk_live_51RH5WXCZ90rBGeaYwqmjWqgUmudTgxL6uKOE1keu617jvRx9OvW2ke6zGf6SKgv4ixsBLcIPQ4sQIEhp8MgBX39500CqULxOPB";
269
- applePayMerchantId = "fractal";
269
+ applePayMerchantId = "skysystemz";
270
270
  googlePayMerchantId = "BCR2DN4T6OC2TCQH";
271
271
  googlePayEnvironment = "PRODUCTION";
272
272
  googlePayGatewayMerchantId = "fractal";
@@ -276,7 +276,7 @@ if (name === "@fractalpay/fractalpay-next-dev") {
276
276
  fractalGatewayUrl = "https://api.merchant-trends.com/";
277
277
  datacapUrl = "https://token.dcap.com/v1/client";
278
278
  threedsSecurePublicKey = "pk_live_51RH5WXCZ90rBGeaYwqmjWqgUmudTgxL6uKOE1keu617jvRx9OvW2ke6zGf6SKgv4ixsBLcIPQ4sQIEhp8MgBX39500CqULxOPB";
279
- applePayMerchantId = "fractal";
279
+ applePayMerchantId = "skysystemz";
280
280
  googlePayMerchantId = "BCR2DN4T6OC2TCQH";
281
281
  googlePayEnvironment = "PRODUCTION";
282
282
  googlePayGatewayMerchantId = "fractal";
@@ -286,7 +286,7 @@ if (name === "@fractalpay/fractalpay-next-dev") {
286
286
  fractalGatewayUrl = "https://api-dev.merchant-trends.com/";
287
287
  datacapUrl = "https://token-cert.dcap.com/v1/client";
288
288
  threedsSecurePublicKey = "pk_test_51RH5Wc2SlJvyNZ80hpUDy88r4rVdpijfKbNaWaUyQEE6rOrPmG2JQyAj7G5amBD5z5daC56WaeT4jfNhrrPcGOEP00UyKu6AOw";
289
- applePayMerchantId = "fractal";
289
+ applePayMerchantId = "skysystemz";
290
290
  googlePayMerchantId = "12345678901234567890";
291
291
  googlePayEnvironment = "TEST";
292
292
  googlePayGatewayMerchantId = "fractal";
@@ -2816,25 +2816,25 @@ import { IoArrowBack } from "react-icons/io5";
2816
2816
  import { useEffect as useEffect3 } from "react";
2817
2817
  function DataScript() {
2818
2818
  useEffect3(() => {
2819
- const src2 = datacapUrl;
2819
+ const src = datacapUrl;
2820
2820
  if (typeof window === "undefined") return;
2821
2821
  if (window.DatacapWebToken) {
2822
2822
  return;
2823
2823
  }
2824
- if (!document.querySelector(`script[src="${src2}"]`)) {
2825
- const script2 = document.createElement("script");
2826
- script2.src = src2;
2827
- script2.async = true;
2828
- script2.onload = () => {
2824
+ if (!document.querySelector(`script[src="${src}"]`)) {
2825
+ const script = document.createElement("script");
2826
+ script.src = src;
2827
+ script.async = true;
2828
+ script.onload = () => {
2829
2829
  if (window.DatacapWebToken) {
2830
2830
  } else {
2831
2831
  console.warn("\u26A0\uFE0F Script loaded, but DatacapWebToken not found");
2832
2832
  }
2833
2833
  };
2834
- script2.onerror = (err) => {
2834
+ script.onerror = (err) => {
2835
2835
  console.error("\u274C Failed to load Datacap script", err);
2836
2836
  };
2837
- document.head.appendChild(script2);
2837
+ document.head.appendChild(script);
2838
2838
  } else {
2839
2839
  }
2840
2840
  }, []);
@@ -3214,21 +3214,31 @@ var PaxList = ({ listHeading = "Readers", ListItems, selectedPax, setSlectedPax,
3214
3214
 
3215
3215
  // src/app/components/FractalTokenizer.tsx
3216
3216
  import { useEffect as useEffect4 } from "react";
3217
- function FractalTokenizerScript() {
3217
+ function FractalTokenizerScript({ onLoad }) {
3218
3218
  useEffect4(() => {
3219
3219
  const src = `${fractalGatewayUrl}tokenizer/static/js/fractal_tokenizer.js`;
3220
- if (document.querySelector(`script[src="${src}"]`)) return;
3220
+ if (window.FractalTokenizer) {
3221
+ onLoad == null ? void 0 : onLoad();
3222
+ return;
3223
+ }
3224
+ const existing = document.querySelector(`script[src="${src}"]`);
3225
+ if (existing) {
3226
+ existing.addEventListener("load", () => onLoad == null ? void 0 : onLoad());
3227
+ return;
3228
+ }
3221
3229
  const script = document.createElement("script");
3222
3230
  script.src = src;
3223
3231
  script.async = true;
3224
3232
  script.onload = () => {
3225
3233
  try {
3226
- const TokenizerClass = eval("FractalTokenizer");
3227
- if (TokenizerClass) {
3228
- window.FractalTokenizer = TokenizerClass;
3234
+ if (typeof FractalTokenizer !== "undefined") {
3235
+ window.FractalTokenizer = FractalTokenizer;
3236
+ onLoad == null ? void 0 : onLoad();
3237
+ } else {
3238
+ console.error("FractalTokenizer not defined in global scope");
3229
3239
  }
3230
3240
  } catch (err) {
3231
- console.error("FractalTokenizer not accessible:", err);
3241
+ console.error(err);
3232
3242
  }
3233
3243
  };
3234
3244
  document.head.appendChild(script);
@@ -3242,8 +3252,12 @@ import { Fragment as Fragment10, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-
3242
3252
  var FractalFields = ({ fractalStyles, tokenizerRef, isAddCard = false, isSky = false }) => {
3243
3253
  const instanceRef = useRef(null);
3244
3254
  useEffect5(() => {
3245
- if (!window.FractalTokenizer) return;
3246
- const instance = new window.FractalTokenizer({
3255
+ const Tokenizer = window.FractalTokenizer;
3256
+ if (!Tokenizer) {
3257
+ console.error("Tokenizer not available");
3258
+ return;
3259
+ }
3260
+ const instance = new Tokenizer({
3247
3261
  styles: fractalStyles
3248
3262
  });
3249
3263
  instanceRef.current = instance;
@@ -3344,30 +3358,62 @@ var FractalFields_default = FractalFields;
3344
3358
 
3345
3359
  // src/app/components/Datacap-Payment/DataCapScriptLoader.tsx
3346
3360
  import { useEffect as useEffect6 } from "react";
3347
- var scriptLoaded = false;
3348
- var DataCapScriptLoader = () => {
3361
+ var DataCapScriptLoader = ({
3362
+ onReady,
3363
+ onError
3364
+ }) => {
3349
3365
  useEffect6(() => {
3350
- if (scriptLoaded) {
3366
+ const src = `${datacapUrl}/hosted`;
3367
+ if (window.__DATACAP_SCRIPT_LOADED__ && window.DatacapHostedWebToken) {
3368
+ onReady == null ? void 0 : onReady();
3351
3369
  return;
3352
3370
  }
3371
+ if (window.__DATACAP_SCRIPT_LOADING__) {
3372
+ const interval = setInterval(() => {
3373
+ if (window.DatacapHostedWebToken) {
3374
+ clearInterval(interval);
3375
+ onReady == null ? void 0 : onReady();
3376
+ }
3377
+ }, 100);
3378
+ return () => clearInterval(interval);
3379
+ }
3380
+ window.__DATACAP_SCRIPT_LOADING__ = true;
3353
3381
  const existingScript = document.querySelector(
3354
- `script[src="${datacapUrl}/hosted"]`
3382
+ `script[src="${src}"]`
3355
3383
  );
3356
- console.log("\u{1F535} existingScript found:", !!existingScript);
3357
- if (!existingScript) {
3358
- const script2 = document.createElement("script");
3359
- script2.src = `${datacapUrl}/hosted`;
3360
- script2.async = true;
3361
- script2.onload = () => {
3362
- console.log("\u2705 DataCap script loaded successfully");
3363
- scriptLoaded = true;
3364
- };
3365
- script2.onerror = (err) => {
3366
- console.error("\u274C DataCap script failed to load", err);
3367
- };
3368
- document.head.appendChild(script2);
3369
- } else {
3370
- scriptLoaded = true;
3384
+ if (existingScript) {
3385
+ waitForSDK();
3386
+ return;
3387
+ }
3388
+ const script = document.createElement("script");
3389
+ script.src = src;
3390
+ script.async = true;
3391
+ script.onload = () => {
3392
+ waitForSDK();
3393
+ };
3394
+ script.onerror = (err) => {
3395
+ console.error("Datacap script failed");
3396
+ window.__DATACAP_SCRIPT_LOADING__ = false;
3397
+ onError == null ? void 0 : onError(err);
3398
+ };
3399
+ document.head.appendChild(script);
3400
+ function waitForSDK() {
3401
+ let attempts = 0;
3402
+ const interval = setInterval(() => {
3403
+ attempts++;
3404
+ if (window.DatacapHostedWebToken) {
3405
+ clearInterval(interval);
3406
+ window.__DATACAP_SCRIPT_LOADING__ = false;
3407
+ window.__DATACAP_SCRIPT_LOADED__ = true;
3408
+ console.log("\u2705 Datacap SDK Ready");
3409
+ onReady == null ? void 0 : onReady();
3410
+ }
3411
+ if (attempts > 100) {
3412
+ clearInterval(interval);
3413
+ window.__DATACAP_SCRIPT_LOADING__ = false;
3414
+ onError == null ? void 0 : onError("SDK bootstrap timeout");
3415
+ }
3416
+ }, 100);
3371
3417
  }
3372
3418
  }, []);
3373
3419
  return null;
@@ -3376,7 +3422,7 @@ var DataCapScriptLoader = () => {
3376
3422
  // src/app/components/Datacap-Payment/DataCapFields.tsx
3377
3423
  import { useEffect as useEffect7, useRef as useRef2, useState as useState3 } from "react";
3378
3424
  import { jsx as jsx18 } from "react/jsx-runtime";
3379
- var customCSS = `
3425
+ var baseCSS = `
3380
3426
  body {
3381
3427
  margin: 0;
3382
3428
  font-family: 'IBM Plex Mono', monospace !important;
@@ -3453,6 +3499,8 @@ var customCSS = `
3453
3499
  }
3454
3500
 
3455
3501
  `;
3502
+ var datacapInitializing = false;
3503
+ var datacapInitialized = false;
3456
3504
  var DataCapFields = ({
3457
3505
  isOpen,
3458
3506
  tokenKey,
@@ -3465,6 +3513,7 @@ var DataCapFields = ({
3465
3513
  const iframeId = "datacap-iframe";
3466
3514
  const resolverRef = useRef2(null);
3467
3515
  const [iframeReady, setIframeReady] = useState3(false);
3516
+ let customCSS = baseCSS;
3468
3517
  useEffect7(() => {
3469
3518
  if (!isOpen || !tokenKey) return;
3470
3519
  if (isAddCard) {
@@ -3509,11 +3558,13 @@ var DataCapFields = ({
3509
3558
  const waitForSDK = () => new Promise((resolve, reject) => {
3510
3559
  let attempts = 0;
3511
3560
  const interval = setInterval(() => {
3561
+ attempts++;
3512
3562
  if (window.DatacapHostedWebToken) {
3513
3563
  clearInterval(interval);
3564
+ console.log("\u2705 Datacap SDK Ready");
3514
3565
  resolve();
3515
3566
  }
3516
- if (attempts++ > 50) {
3567
+ if (attempts > 100) {
3517
3568
  clearInterval(interval);
3518
3569
  reject("Datacap SDK not loaded");
3519
3570
  }
@@ -3521,10 +3572,28 @@ var DataCapFields = ({
3521
3572
  });
3522
3573
  await waitForSDK();
3523
3574
  const sdk = window.DatacapHostedWebToken;
3575
+ if (datacapInitializing || datacapInitialized) {
3576
+ console.log("\u{1F7E1} Datacap already initializing/initialized");
3577
+ return;
3578
+ }
3579
+ datacapInitializing = true;
3580
+ const initTimeout = setTimeout(() => {
3581
+ var _a, _b;
3582
+ console.error("\u274C Datacap iframe load timeout");
3583
+ datacapInitializing = false;
3584
+ setLoader == null ? void 0 : setLoader(false);
3585
+ (_b = (_a = resolverRef.current) == null ? void 0 : _a.reject) == null ? void 0 : _b.call(
3586
+ _a,
3587
+ "Unable to load payment form"
3588
+ );
3589
+ }, 15e3);
3524
3590
  sdk.init(
3525
3591
  tokenKey,
3526
3592
  iframeId,
3527
3593
  (response) => {
3594
+ clearTimeout(initTimeout);
3595
+ datacapInitializing = false;
3596
+ datacapInitialized = true;
3528
3597
  setLoader == null ? void 0 : setLoader(false);
3529
3598
  if (!resolverRef.current) return;
3530
3599
  if ((response == null ? void 0 : response.Error) || (response == null ? void 0 : response.Errors)) {
@@ -3538,6 +3607,9 @@ var DataCapFields = ({
3538
3607
  );
3539
3608
  };
3540
3609
  initialize();
3610
+ return () => {
3611
+ resolverRef.current = null;
3612
+ };
3541
3613
  }, [isOpen, tokenKey]);
3542
3614
  useEffect7(() => {
3543
3615
  const uniqueId = Math.random();
@@ -3545,7 +3617,15 @@ var DataCapFields = ({
3545
3617
  return new Promise((resolve, reject) => {
3546
3618
  setLoader == null ? void 0 : setLoader(true);
3547
3619
  resolverRef.current = { resolve, reject };
3548
- window.DatacapHostedWebToken.requestToken();
3620
+ if (!window.DatacapHostedWebToken) {
3621
+ reject("Datacap SDK unavailable");
3622
+ return;
3623
+ }
3624
+ try {
3625
+ window.DatacapHostedWebToken.requestToken();
3626
+ } catch (err) {
3627
+ reject(err);
3628
+ }
3549
3629
  });
3550
3630
  };
3551
3631
  window.requestDcToken = fn;
@@ -3553,26 +3633,71 @@ var DataCapFields = ({
3553
3633
  delete window.requestDcToken;
3554
3634
  };
3555
3635
  }, []);
3556
- return /* @__PURE__ */ jsx18(
3557
- "iframe",
3558
- {
3559
- id: iframeId,
3560
- onLoad: () => {
3561
- console.log("\u{1F7E2} Iframe visually loaded");
3562
- setIframeReady(true);
3563
- setLoader == null ? void 0 : setLoader(false);
3564
- },
3565
- style: {
3566
- width: "100%",
3567
- height: `${height || "250px"}`,
3568
- border: "none",
3569
- opacity: iframeReady ? 1 : 0,
3570
- transition: "opacity 0.3s ease"
3636
+ useEffect7(() => {
3637
+ if (!isOpen) {
3638
+ datacapInitializing = false;
3639
+ datacapInitialized = false;
3640
+ }
3641
+ }, [isOpen]);
3642
+ return (
3643
+ // <iframe
3644
+ // id={iframeId}
3645
+ // onLoad={() => {
3646
+ // console.log("🟢 Iframe visually loaded");
3647
+ // setIframeReady(true);
3648
+ // setLoader?.(false);
3649
+ // }}
3650
+ // style={{
3651
+ // width: "100%",
3652
+ // height: `${height || "250px"}`,
3653
+ // border: "none",
3654
+ // opacity: iframeReady ? 1 : 0,
3655
+ // transition: "opacity 0.3s ease",
3656
+ // }}
3657
+ // />
3658
+ /* @__PURE__ */ jsx18(
3659
+ "iframe",
3660
+ {
3661
+ id: iframeId,
3662
+ onLoad: () => {
3663
+ console.log("\u{1F7E2} Iframe visually loaded");
3664
+ setIframeReady(true);
3665
+ setLoader == null ? void 0 : setLoader(false);
3666
+ },
3667
+ onError: () => {
3668
+ var _a, _b;
3669
+ console.error("\u274C iframe failed");
3670
+ setLoader == null ? void 0 : setLoader(false);
3671
+ (_b = (_a = resolverRef.current) == null ? void 0 : _a.reject) == null ? void 0 : _b.call(
3672
+ _a,
3673
+ "Payment form failed to load"
3674
+ );
3675
+ },
3676
+ style: {
3677
+ width: "100%",
3678
+ height: `${height || "250px"}`,
3679
+ border: "none",
3680
+ opacity: iframeReady ? 1 : 0,
3681
+ transition: "opacity 0.3s ease"
3682
+ }
3571
3683
  }
3572
- }
3684
+ )
3573
3685
  );
3574
3686
  };
3575
3687
 
3688
+ // src/app/utils/Constant.js
3689
+ var PaymentMethodKeys = {
3690
+ PROPAYKEY: "25",
3691
+ PAYARCKEY: "26",
3692
+ STRIPEKEYCC: "27",
3693
+ PAYRIXKEY: "28",
3694
+ SKYFIACHKEY: "29",
3695
+ JUSTIFIKEY: "30",
3696
+ INFINICEPTKEY: "31",
3697
+ FRACTALKEY: "32"
3698
+ };
3699
+ var DcLoadingError = "Something went wrong while loading the payment form. Please try again after some time.";
3700
+
3576
3701
  // src/app/components/Charge/GetPaymentPage.tsx
3577
3702
  import { Fragment as Fragment11, jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
3578
3703
  function GetPaymentPage(props) {
@@ -3595,6 +3720,7 @@ function GetPaymentPage(props) {
3595
3720
  const [errorBankConsent, setErrorBankConsent] = useState4("");
3596
3721
  const [saveACHConsent1, setSaveACHConsent1] = useState4(false);
3597
3722
  const [errorBankConsentOther, setErrorBankConsentOther] = useState4("");
3723
+ const [isTokenizerReady, setTokenizerReady] = useState4(false);
3598
3724
  const fractalpayClientKey = props.merchantPublicKey;
3599
3725
  let mastercard2 = S3Url + "widget/mc-img.svg";
3600
3726
  let visa2 = S3Url + "widget/visa-img.svg";
@@ -3934,6 +4060,7 @@ function GetPaymentPage(props) {
3934
4060
  } catch (err) {
3935
4061
  setErrorIframe(((_h2 = (_g2 = err == null ? void 0 : err.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
3936
4062
  setLoading2(false);
4063
+ return;
3937
4064
  }
3938
4065
  console.log(tokenizeData, "tokenizeData");
3939
4066
  const reqData = JSON.stringify(__spreadProps(__spreadValues({}, tokenizeData), {
@@ -4298,8 +4425,20 @@ function GetPaymentPage(props) {
4298
4425
  }, []);
4299
4426
  return /* @__PURE__ */ jsxs11(Fragment11, { children: [
4300
4427
  /* @__PURE__ */ jsx19(DataScript, {}),
4301
- /* @__PURE__ */ jsx19(FractalTokenizerScript, {}),
4302
- /* @__PURE__ */ jsx19(DataCapScriptLoader, {}),
4428
+ (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && /* @__PURE__ */ jsx19(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
4429
+ (paymentData == null ? void 0 : paymentData.paymentGateway) === 31 && /* @__PURE__ */ jsx19(
4430
+ DataCapScriptLoader,
4431
+ {
4432
+ onReady: () => {
4433
+ console.log("SDK Ready");
4434
+ },
4435
+ onError: (err) => {
4436
+ setLoading(false);
4437
+ setLoadingIframe(false);
4438
+ setError(DcLoadingError);
4439
+ }
4440
+ }
4441
+ ),
4303
4442
  /* @__PURE__ */ jsx19(Chargewidgetstyles, {}),
4304
4443
  /* @__PURE__ */ jsx19(CardBankRadioStyles, {}),
4305
4444
  /* @__PURE__ */ jsxs11(Fragment11, { children: [
@@ -4503,7 +4642,7 @@ function GetPaymentPage(props) {
4503
4642
  ] }),
4504
4643
  /* @__PURE__ */ jsxs11("div", { className: "form-group", children: [
4505
4644
  /* @__PURE__ */ jsx19("label", { children: "CARD NUMBER" }),
4506
- /* @__PURE__ */ jsx19("div", { className: "toggle-num-wrapper", children: show && (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && /* @__PURE__ */ jsx19(
4645
+ /* @__PURE__ */ jsx19("div", { className: "toggle-num-wrapper", children: show && (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && isTokenizerReady && /* @__PURE__ */ jsx19(
4507
4646
  FractalFields_default,
4508
4647
  {
4509
4648
  fractalStyles,
@@ -4857,6 +4996,7 @@ function PreAuthPayment(_a) {
4857
4996
  const [activeinCard, setActiveinCard] = useState5("form");
4858
4997
  const fractalpayClientKey = props.merchantPublicKey;
4859
4998
  const [selectedReader, setSelectedReader] = useState5(void 0);
4999
+ const [isTokenizerReady, setTokenizerReady] = useState5(false);
4860
5000
  const tokenizerRef = useRef4(null);
4861
5001
  const fractalStyles = {
4862
5002
  input: {
@@ -5393,10 +5533,22 @@ function PreAuthPayment(_a) {
5393
5533
  }, []);
5394
5534
  return /* @__PURE__ */ jsxs12(Fragment12, { children: [
5395
5535
  /* @__PURE__ */ jsx20(DataScript, {}),
5396
- /* @__PURE__ */ jsx20(FractalTokenizerScript, {}),
5536
+ (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && /* @__PURE__ */ jsx20(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
5537
+ (paymentData == null ? void 0 : paymentData.paymentGateway) === 31 && /* @__PURE__ */ jsx20(
5538
+ DataCapScriptLoader,
5539
+ {
5540
+ onReady: () => {
5541
+ console.log("SDK Ready");
5542
+ },
5543
+ onError: (err) => {
5544
+ setLoading(false);
5545
+ setLoadingIframe(false);
5546
+ setError(DcLoadingError);
5547
+ }
5548
+ }
5549
+ ),
5397
5550
  /* @__PURE__ */ jsx20(Chargewidgetstyles, {}),
5398
5551
  /* @__PURE__ */ jsx20(CardBankRadioStyles, {}),
5399
- /* @__PURE__ */ jsx20(DataCapScriptLoader, {}),
5400
5552
  /* @__PURE__ */ jsxs12(Fragment12, { children: [
5401
5553
  showButton && /* @__PURE__ */ jsx20(
5402
5554
  "button",
@@ -5549,7 +5701,7 @@ function PreAuthPayment(_a) {
5549
5701
  ] }),
5550
5702
  /* @__PURE__ */ jsxs12("div", { className: "form-group", children: [
5551
5703
  /* @__PURE__ */ jsx20("label", { children: "CARD NUMBER" }),
5552
- /* @__PURE__ */ jsx20("div", { className: "toggle-num-wrapper", children: show && (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && /* @__PURE__ */ jsx20(
5704
+ /* @__PURE__ */ jsx20("div", { className: "toggle-num-wrapper", children: show && (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && isTokenizerReady && /* @__PURE__ */ jsx20(
5553
5705
  FractalFields_default,
5554
5706
  {
5555
5707
  fractalStyles,
@@ -6141,6 +6293,7 @@ function AddCardEasyPay(props) {
6141
6293
  const exp_year_ref = useRef5(null);
6142
6294
  const cvv_ref = useRef5(null);
6143
6295
  const name_ref = useRef5(null);
6296
+ const [isTokenizerReady, setTokenizerReady] = useState6(false);
6144
6297
  const tokenizerRef = useRef5(null);
6145
6298
  const fractalStyles = {
6146
6299
  input: {
@@ -6413,8 +6566,20 @@ function AddCardEasyPay(props) {
6413
6566
  }, []);
6414
6567
  return /* @__PURE__ */ jsxs14(Fragment14, { children: [
6415
6568
  /* @__PURE__ */ jsx24(DataScript, {}),
6416
- /* @__PURE__ */ jsx24(FractalTokenizerScript, {}),
6417
- /* @__PURE__ */ jsx24(DataCapScriptLoader, {}),
6569
+ (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && /* @__PURE__ */ jsx24(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
6570
+ (paymentData == null ? void 0 : paymentData.paymentGateway) === 31 && /* @__PURE__ */ jsx24(
6571
+ DataCapScriptLoader,
6572
+ {
6573
+ onReady: () => {
6574
+ console.log("SDK Ready");
6575
+ },
6576
+ onError: (err) => {
6577
+ setLoading(false);
6578
+ setLoadingIframe(false);
6579
+ setError(DcLoadingError);
6580
+ }
6581
+ }
6582
+ ),
6418
6583
  /* @__PURE__ */ jsx24(AddCardStyle, {}),
6419
6584
  /* @__PURE__ */ jsx24(Loader_default, { loading: loading || loadingIframe }),
6420
6585
  error && /* @__PURE__ */ jsx24("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx24(ErrorCardMessage_default, { error, onClose: handleClose }) }),
@@ -6443,7 +6608,7 @@ function AddCardEasyPay(props) {
6443
6608
  /* @__PURE__ */ jsxs14("div", { style: { maxHeight: "350px", minHeight: "0" }, className: "card-scrl", children: [
6444
6609
  /* @__PURE__ */ jsxs14("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" }, children: [
6445
6610
  /* @__PURE__ */ jsx24("label", { htmlFor: "cardNumber", children: "Card Number" }),
6446
- (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && /* @__PURE__ */ jsx24(
6611
+ (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && isTokenizerReady && /* @__PURE__ */ jsx24(
6447
6612
  FractalFields_default,
6448
6613
  {
6449
6614
  fractalStyles,
@@ -6578,18 +6743,6 @@ function AddCardEasyPay(props) {
6578
6743
  import { useEffect as useEffect12, useRef as useRef7, useState as useState7 } from "react";
6579
6744
  import axios6 from "axios";
6580
6745
 
6581
- // src/app/utils/Constant.js
6582
- var PaymentMethodKeys = {
6583
- PROPAYKEY: "25",
6584
- PAYARCKEY: "26",
6585
- STRIPEKEYCC: "27",
6586
- PAYRIXKEY: "28",
6587
- SKYFIACHKEY: "29",
6588
- JUSTIFIKEY: "30",
6589
- INFINICEPTKEY: "31",
6590
- FRACTALKEY: "32"
6591
- };
6592
-
6593
6746
  // src/app/components/AddCard/AddCardSkyStyle.tsx
6594
6747
  import { jsx as jsx25 } from "react/jsx-runtime";
6595
6748
  function AddCardSkyStyle({}) {
@@ -6797,8 +6950,12 @@ import { Fragment as Fragment15, jsx as jsx26, jsxs as jsxs15 } from "react/jsx-
6797
6950
  var FractalFieldsAddCardSky = ({ fractalStyles, tokenizerRef, extraInputs }) => {
6798
6951
  const instanceRef = useRef6(null);
6799
6952
  useEffect11(() => {
6800
- if (!window.FractalTokenizer) return;
6801
- const instance = new window.FractalTokenizer({
6953
+ const Tokenizer = window.FractalTokenizer;
6954
+ if (!Tokenizer) {
6955
+ console.error("Tokenizer not available");
6956
+ return;
6957
+ }
6958
+ const instance = new Tokenizer({
6802
6959
  styles: fractalStyles
6803
6960
  });
6804
6961
  instanceRef.current = instance;
@@ -6883,7 +7040,7 @@ var FractalFieldsAddCardSky_default = FractalFieldsAddCardSky;
6883
7040
 
6884
7041
  // src/app/components/AddCard/AddCardSky.tsx
6885
7042
  import { Fragment as Fragment16, jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
6886
- function CardOnFile({ session_token, callback, isloading, onCancel, showChecks, merchantName, signCheckbox, checkedSignCheckbox, onCheckSign, cancelbtnClass, savebtnClass, inputClass, isDual, customCSS: customCSS2, height }) {
7043
+ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks, merchantName, signCheckbox, checkedSignCheckbox, onCheckSign, cancelbtnClass, savebtnClass, inputClass, isDual, customCSS, height }) {
6887
7044
  var _a, _b;
6888
7045
  const [loading, setLoading] = useState7(false);
6889
7046
  const [errorIframe, setErrorIframe] = useState7("");
@@ -6894,10 +7051,11 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
6894
7051
  const [error, setError] = useState7("");
6895
7052
  const showLoader = () => setLoading(true);
6896
7053
  const hideLoader = () => setLoading(false);
6897
- const [passFee, setPassFee] = useState7(false);
7054
+ const [passFee, setPassFee] = useState7(null);
6898
7055
  const [paymentGateway, setPaymentGateway] = useState7();
6899
7056
  const [dcToken, setDCToken] = useState7();
6900
7057
  const tokenizerRef = useRef7(null);
7058
+ const [isTokenizerReady, setTokenizerReady] = useState7(false);
6901
7059
  const fractalStyles = {
6902
7060
  input: {
6903
7061
  "font-family": "'Inter', sans-serif",
@@ -7160,8 +7318,20 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
7160
7318
  }, []);
7161
7319
  return /* @__PURE__ */ jsxs16(Fragment16, { children: [
7162
7320
  /* @__PURE__ */ jsx27(DataScript, {}),
7163
- /* @__PURE__ */ jsx27(FractalTokenizerScript, {}),
7164
- /* @__PURE__ */ jsx27(DataCapScriptLoader, {}),
7321
+ paymentGateway == 32 && /* @__PURE__ */ jsx27(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
7322
+ paymentGateway == 31 && /* @__PURE__ */ jsx27(
7323
+ DataCapScriptLoader,
7324
+ {
7325
+ onReady: () => {
7326
+ console.log("SDK Ready");
7327
+ },
7328
+ onError: (err) => {
7329
+ setLoading(false);
7330
+ setLoadingIframe(false);
7331
+ setError(DcLoadingError);
7332
+ }
7333
+ }
7334
+ ),
7165
7335
  /* @__PURE__ */ jsx27(AddCardSkyStyle, {}),
7166
7336
  /* @__PURE__ */ jsx27(Loader_default, { loading: loading || isloading || loadingIframe }),
7167
7337
  error && /* @__PURE__ */ jsx27("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx27(ErrorCardMessage_default, { error, onClose: handleClose }) }),
@@ -7222,7 +7392,7 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
7222
7392
  (cardError == null ? void 0 : cardError.lastName) && /* @__PURE__ */ jsx27("small", { className: "error", children: cardError == null ? void 0 : cardError.lastName })
7223
7393
  ] })
7224
7394
  ] }),
7225
- /* @__PURE__ */ jsx27(
7395
+ isTokenizerReady && /* @__PURE__ */ jsx27(
7226
7396
  FractalFieldsAddCardSky_default,
7227
7397
  {
7228
7398
  fractalStyles,
@@ -7254,7 +7424,7 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
7254
7424
  type: "checkbox",
7255
7425
  id: "pass_fee",
7256
7426
  className: "toggle-checkbox",
7257
- checked: passFee,
7427
+ checked: passFee != null ? passFee : false,
7258
7428
  onChange: (e) => {
7259
7429
  setPassFee(e.target.checked);
7260
7430
  }
@@ -7397,7 +7567,7 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
7397
7567
  isOpen: true,
7398
7568
  tokenKey: dcToken,
7399
7569
  setLoader: setLoadingIframe,
7400
- customCSS: customCSS2,
7570
+ customCSS,
7401
7571
  height
7402
7572
  }
7403
7573
  ) }),
@@ -7426,7 +7596,7 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
7426
7596
  type: "checkbox",
7427
7597
  id: "pass_fee",
7428
7598
  className: "toggle-checkbox",
7429
- checked: passFee,
7599
+ checked: passFee != null ? passFee : false,
7430
7600
  onChange: (e) => {
7431
7601
  setPassFee(e.target.checked);
7432
7602
  }
@@ -7571,6 +7741,7 @@ function PartialPayment(props) {
7571
7741
  const [errorBankConsent, setErrorBankConsent] = useState8("");
7572
7742
  const [saveACHConsent1, setSaveACHConsent1] = useState8(false);
7573
7743
  const [errorBankConsentOther, setErrorBankConsentOther] = useState8("");
7744
+ const [isTokenizerReady, setTokenizerReady] = useState8(false);
7574
7745
  const tokenizerRef = useRef8(null);
7575
7746
  const fractalStyles = {
7576
7747
  input: {
@@ -8284,8 +8455,20 @@ function PartialPayment(props) {
8284
8455
  /* @__PURE__ */ jsx28(DataScript, {}),
8285
8456
  /* @__PURE__ */ jsx28(Chargewidgetstyles, {}),
8286
8457
  /* @__PURE__ */ jsx28(CardBankRadioStyles, {}),
8287
- /* @__PURE__ */ jsx28(FractalTokenizerScript, {}),
8288
- /* @__PURE__ */ jsx28(DataCapScriptLoader, {}),
8458
+ (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && /* @__PURE__ */ jsx28(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
8459
+ (paymentData == null ? void 0 : paymentData.paymentGateway) === 31 && /* @__PURE__ */ jsx28(
8460
+ DataCapScriptLoader,
8461
+ {
8462
+ onReady: () => {
8463
+ console.log("SDK Ready");
8464
+ },
8465
+ onError: (err) => {
8466
+ setLoading(false);
8467
+ setLoadingIframe(false);
8468
+ setError(DcLoadingError);
8469
+ }
8470
+ }
8471
+ ),
8289
8472
  /* @__PURE__ */ jsxs17(Fragment17, { children: [
8290
8473
  /* @__PURE__ */ jsx28("button", { ref: buttonRef, style: { display: "none" }, className: "paymentBtn", onClick: handleShow, children: "Pay" }),
8291
8474
  /* @__PURE__ */ jsxs17(
@@ -8492,7 +8675,7 @@ function PartialPayment(props) {
8492
8675
  ] }),
8493
8676
  /* @__PURE__ */ jsxs17("div", { className: "form-group", children: [
8494
8677
  /* @__PURE__ */ jsx28("label", { children: "CARD NUMBER" }),
8495
- /* @__PURE__ */ jsx28("div", { className: "toggle-num-wrapper", children: show && (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && /* @__PURE__ */ jsx28(
8678
+ /* @__PURE__ */ jsx28("div", { className: "toggle-num-wrapper", children: show && (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && isTokenizerReady && /* @__PURE__ */ jsx28(
8496
8679
  FractalFields_default,
8497
8680
  {
8498
8681
  fractalStyles,
@@ -10072,7 +10255,7 @@ function ApplePayButton({
10072
10255
 
10073
10256
  // src/app/components/Atoms/ModelContentSky/ModelContentSky.tsx
10074
10257
  import { Fragment as Fragment19, jsx as jsx35, jsxs as jsxs20 } from "react/jsx-runtime";
10075
- 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 }) => {
10258
+ 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 }) => {
10076
10259
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
10077
10260
  const hasRunRef = useRef11(false);
10078
10261
  const cardFormRef = useRef11(null);
@@ -10120,6 +10303,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
10120
10303
  const [isBankConsentChecked, setIsBankConsentChecked] = useState10(false);
10121
10304
  const [errorBankConsent, setErrorBankConsent] = useState10("");
10122
10305
  const [errorBankConsentOther, setErrorBankConsentOther] = useState10("");
10306
+ const [isTokenizerReady, setTokenizerReady] = useState10(false);
10123
10307
  let mastercard2 = S3Url + "widget/mc-img.svg";
10124
10308
  let visa2 = S3Url + "widget/visa-img.svg";
10125
10309
  let americanexp2 = S3Url + "widget/ae-img.svg";
@@ -10327,8 +10511,13 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
10327
10511
  return Object.keys(errors).length > 0;
10328
10512
  };
10329
10513
  const completeFractalFlow = async (tokenizeData, intentid, typeoftoken) => {
10330
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
10514
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
10331
10515
  try {
10516
+ console.log({
10517
+ tokenizeData,
10518
+ intentid,
10519
+ typeoftoken
10520
+ });
10332
10521
  if (typeoftoken == "google_pay" || typeoftoken == "apple_pay") {
10333
10522
  handleCharge({
10334
10523
  Token: tokenizeData,
@@ -10336,39 +10525,28 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
10336
10525
  typeoftoken
10337
10526
  });
10338
10527
  return;
10339
- }
10340
- let token = tokenizeData;
10341
- let verifyandsaveresp = await axios9.post(`${masterBaseUrl}api/v1/gateway/verify-and-save/${session_token}`, {
10342
- token,
10343
- require3ds,
10344
- pass_fee,
10345
- typeoftoken
10346
- });
10347
- if ((verifyandsaveresp == null ? void 0 : verifyandsaveresp.status) == 200) {
10348
- let responsetemp = (_a2 = verifyandsaveresp == null ? void 0 : verifyandsaveresp.data) == null ? void 0 : _a2.data;
10349
- let respData = {
10350
- Token: responsetemp.gateway_token,
10351
- Brand: responsetemp.card_data.brand,
10352
- ExpirationMonth: responsetemp.card_data.expire_mm,
10353
- ExpirationYear: responsetemp.card_data.expire_yy,
10354
- Last4: responsetemp.card_data.last4,
10355
- Bin: responsetemp.card_data.bin,
10356
- postalCode: cardData == null ? void 0 : cardData.zipCode,
10357
- stripe_3ds_auth_id: intentid
10358
- };
10528
+ } else {
10359
10529
  if (isPreAuth) {
10360
- handlePreAuth(respData);
10530
+ handlePreAuth(__spreadValues({
10531
+ Token: tokenizeData,
10532
+ postalCode: cardData == null ? void 0 : cardData.zipCode,
10533
+ typeoftoken: "token"
10534
+ }, intentid && { stripe_3ds_auth_id: intentid }));
10361
10535
  } else {
10362
- handleCharge(respData);
10536
+ handleCharge(__spreadValues({
10537
+ Token: tokenizeData,
10538
+ postalCode: cardData == null ? void 0 : cardData.zipCode,
10539
+ typeoftoken: "token"
10540
+ }, intentid && { stripe_3ds_auth_id: intentid }));
10363
10541
  }
10364
10542
  }
10365
10543
  } catch (error2) {
10366
10544
  console.log(error2, "error");
10367
- setError(((_c2 = (_b2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _b2.data) == null ? void 0 : _c2.message) || "Something went wrong!");
10545
+ setError(((_b2 = (_a2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _a2.data) == null ? void 0 : _b2.message) || "Something went wrong!");
10368
10546
  callback({
10369
- error: ((_e2 = (_d2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _d2.data) == null ? void 0 : _e2.message) || "Something went wrong!",
10370
- result: (_g2 = (_f2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _f2.data) == null ? void 0 : _g2.result,
10371
- statusCode: (_h2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _h2.status
10547
+ error: ((_d2 = (_c2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || "Something went wrong!",
10548
+ result: (_f2 = (_e2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.result,
10549
+ statusCode: (_g2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _g2.status
10372
10550
  });
10373
10551
  hideLoader();
10374
10552
  }
@@ -11187,6 +11365,20 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
11187
11365
  }
11188
11366
  return /* @__PURE__ */ jsxs20(Fragment19, { children: [
11189
11367
  (initialLoader || !onLoad) && /* @__PURE__ */ jsx35(Loader_default, { intensity: "dark", loading: initialLoader || !onLoad }),
11368
+ paymentGateway == 32 && /* @__PURE__ */ jsx35(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
11369
+ paymentGateway == 31 && /* @__PURE__ */ jsx35(
11370
+ DataCapScriptLoader,
11371
+ {
11372
+ onReady: () => {
11373
+ console.log("SDK Ready");
11374
+ },
11375
+ onError: (err) => {
11376
+ setLoading(false);
11377
+ setLoadingIframe(false);
11378
+ setError(DcLoadingError);
11379
+ }
11380
+ }
11381
+ ),
11190
11382
  error && /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(ErrorCardOverlay_default, { error, onClose: handleClose, autoTrigger }) }),
11191
11383
  errorIframe && /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(ErrorCardOverlay_default, { error: errorIframe, onClose: () => {
11192
11384
  setErrorIframe("");
@@ -11348,7 +11540,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
11348
11540
  ] }),
11349
11541
  /* @__PURE__ */ jsxs20("div", { className: "form-group-frac", children: [
11350
11542
  /* @__PURE__ */ jsx35("label", { htmlFor: "cardNumber", children: "CARD NUMBER" }),
11351
- /* @__PURE__ */ jsx35("div", { className: "toggle-num-wrapper toggle-num-wrapper-new", children: (show || autoTrigger) && paymentGateway === 32 && /* @__PURE__ */ jsx35(
11543
+ /* @__PURE__ */ jsx35("div", { className: "toggle-num-wrapper toggle-num-wrapper-new", children: (show || autoTrigger) && paymentGateway === 32 && isTokenizerReady && /* @__PURE__ */ jsx35(
11352
11544
  FractalFields_default,
11353
11545
  {
11354
11546
  fractalStyles,
@@ -11435,7 +11627,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
11435
11627
  tokenKey: dcToken,
11436
11628
  setLoader: activeinCard === "form" ? setLoadingIframe : null,
11437
11629
  isEmbedded: onSubmit ? true : false,
11438
- customCSS: customCSS2
11630
+ customCSS
11439
11631
  }
11440
11632
  ) }),
11441
11633
  /* @__PURE__ */ jsxs20("div", { className: "form-group-frac", children: [
@@ -11693,7 +11885,7 @@ var PaymentWidget = ({
11693
11885
  isPartial,
11694
11886
  bankSurcharge,
11695
11887
  partialRef,
11696
- customCSS: customCSS2,
11888
+ customCSS,
11697
11889
  disableSubmitBtn = false
11698
11890
  }) => {
11699
11891
  const [show, setShow] = useState11(autoTrigger || false);
@@ -11725,7 +11917,7 @@ var PaymentWidget = ({
11725
11917
  isPartial,
11726
11918
  bankSurcharge,
11727
11919
  partialRef,
11728
- customCSS: customCSS2,
11920
+ customCSS,
11729
11921
  disableSubmitBtn
11730
11922
  }),
11731
11923
  [
@@ -11791,11 +11983,9 @@ var PaymentWidget = ({
11791
11983
  return /* @__PURE__ */ jsxs21(Fragment20, { children: [
11792
11984
  /* @__PURE__ */ jsx36("link", { href: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" }),
11793
11985
  /* @__PURE__ */ jsx36(DataScript, {}),
11794
- /* @__PURE__ */ jsx36(FractalTokenizerScript, {}),
11795
11986
  /* @__PURE__ */ jsx36(SkyChargewidgetstyles, {}),
11796
11987
  /* @__PURE__ */ jsx36(CardBankRadioStyles, {}),
11797
11988
  /* @__PURE__ */ jsx36(CustomModal2styles_default, {}),
11798
- /* @__PURE__ */ jsx36(DataCapScriptLoader, {}),
11799
11989
  !autoTrigger && /* @__PURE__ */ jsxs21("button", { className: submitBtnClass || "paymentBtn", disabled: disableSubmitBtn, onClick: () => setShow(true), children: [
11800
11990
  submitBtnText,
11801
11991
  submitBtnIcon
@@ -12166,18 +12356,18 @@ var ApplePayScriptLoader = () => {
12166
12356
  `script[src="https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js"]`
12167
12357
  );
12168
12358
  if (!existingScript) {
12169
- const script2 = document.createElement("script");
12170
- script2.src = "https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js";
12171
- script2.async = true;
12172
- script2.onload = () => {
12359
+ const script = document.createElement("script");
12360
+ script.src = "https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js";
12361
+ script.async = true;
12362
+ script.onload = () => {
12173
12363
  console.log("\u2705 Apple Pay script loaded");
12174
12364
  applePayScriptLoaded = true;
12175
12365
  console.log("ApplePaySession:", window.ApplePaySession);
12176
12366
  };
12177
- script2.onerror = (err) => {
12367
+ script.onerror = (err) => {
12178
12368
  console.error("\u274C Apple Pay script failed", err);
12179
12369
  };
12180
- document.head.appendChild(script2);
12370
+ document.head.appendChild(script);
12181
12371
  } else {
12182
12372
  applePayScriptLoaded = true;
12183
12373
  }
@@ -12209,7 +12399,7 @@ var EmbeddedCheckout = ({
12209
12399
  partialRef,
12210
12400
  onSubmit,
12211
12401
  onLoad,
12212
- customCSS: customCSS2
12402
+ customCSS
12213
12403
  }) => {
12214
12404
  const [show, setShow] = useState12(false);
12215
12405
  const [loading, setLoading] = useState12(false);
@@ -12217,6 +12407,7 @@ var EmbeddedCheckout = ({
12217
12407
  });
12218
12408
  const [orderGuid, setOrderGuid] = useState12(null);
12219
12409
  const [remainingAmount, setRemainingAmount] = useState12(null);
12410
+ const [isTokenizerReady, setTokenizerReady] = useState12(false);
12220
12411
  const initialCommonProps = useMemo2(
12221
12412
  () => ({
12222
12413
  amount,
@@ -12296,10 +12487,10 @@ var EmbeddedCheckout = ({
12296
12487
  }
12297
12488
  };
12298
12489
  useEffect19(() => {
12299
- if (show && isPartial && partialRef) {
12490
+ if (autoTrigger && isPartial && partialRef) {
12300
12491
  getskyosOrderDetails();
12301
12492
  }
12302
- }, [show, isPartial, partialRef]);
12493
+ }, [autoTrigger, isPartial, partialRef]);
12303
12494
  console.log(onLoad, "onLoad");
12304
12495
  useEffect19(() => {
12305
12496
  const supported = !!window.ApplePaySession;
@@ -12315,13 +12506,11 @@ var EmbeddedCheckout = ({
12315
12506
  return /* @__PURE__ */ jsxs22(Fragment21, { children: [
12316
12507
  /* @__PURE__ */ jsx38("link", { href: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" }),
12317
12508
  /* @__PURE__ */ jsx38(DataScript, {}),
12318
- /* @__PURE__ */ jsx38(FractalTokenizerScript, {}),
12319
12509
  /* @__PURE__ */ jsx38(SkyChargewidgetstyles, {}),
12320
12510
  /* @__PURE__ */ jsx38(CardBankRadioStyles, {}),
12321
12511
  /* @__PURE__ */ jsx38(CustomModal2styles_default, {}),
12322
- /* @__PURE__ */ jsx38(DataCapScriptLoader, {}),
12323
12512
  /* @__PURE__ */ jsx38(ApplePayScriptLoader, {}),
12324
- /* @__PURE__ */ jsx38(EmbeddedCheckoutStyles, { extraCustomCSS: customCSS2 }),
12513
+ /* @__PURE__ */ jsx38(EmbeddedCheckoutStyles, { extraCustomCSS: customCSS }),
12325
12514
  !autoTrigger && /* @__PURE__ */ jsxs22("button", { className: submitBtnClass || "paymentBtn", onClick: () => setShow(true), children: [
12326
12515
  submitBtnText,
12327
12516
  submitBtnIcon