@fractalpay/fractalpay-next-dev 0.0.287 → 0.0.288

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@ var require_package = __commonJS({
39
39
  "package.json"(exports, module) {
40
40
  module.exports = {
41
41
  name: "@fractalpay/fractalpay-next-dev",
42
- version: "0.0.287",
42
+ version: "0.0.288",
43
43
  private: false,
44
44
  type: "module",
45
45
  scripts: {
@@ -212,21 +212,6 @@ var LoaderStyle = (props) => {
212
212
  }
213
213
  }
214
214
 
215
-
216
- .loader-text {
217
- margin-top: 8px;
218
- color: #1A1226;
219
- text-transform: uppercase;
220
- font-weight: 600;
221
- font-family: 'IBM Plex Mono', monospace;
222
- }
223
-
224
- .loader-content {
225
- display: flex;
226
- flex-direction: column;
227
- align-items: center;
228
- }
229
-
230
215
  ` });
231
216
  };
232
217
  var LoaderStyle_default = LoaderStyle;
@@ -234,17 +219,14 @@ var LoaderStyle_default = LoaderStyle;
234
219
  // src/app/components/Loader/Loader.tsx
235
220
  import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
236
221
  var Loader = (_a) => {
237
- var _b = _a, { intensity = "light", loaderText } = _b, props = __objRest(_b, ["intensity", "loaderText"]);
222
+ var _b = _a, { intensity = "light" } = _b, props = __objRest(_b, ["intensity"]);
238
223
  return /* @__PURE__ */ jsxs(Fragment, { children: [
239
224
  /* @__PURE__ */ jsx2(LoaderStyle_default, {}),
240
- (props == null ? void 0 : props.loading) && /* @__PURE__ */ jsx2("div", { className: `loader-${intensity}`, children: /* @__PURE__ */ jsxs("div", { className: "loader-content", children: [
241
- /* @__PURE__ */ jsxs("div", { className: "lds-ellipsis", children: [
242
- /* @__PURE__ */ jsx2("div", {}),
243
- /* @__PURE__ */ jsx2("div", {}),
244
- /* @__PURE__ */ jsx2("div", {}),
245
- /* @__PURE__ */ jsx2("div", {})
246
- ] }),
247
- loaderText && /* @__PURE__ */ jsx2("div", { className: "loader-text", children: loaderText })
225
+ (props == null ? void 0 : props.loading) && /* @__PURE__ */ jsx2("div", { className: `loader-${intensity}`, children: /* @__PURE__ */ jsxs("div", { className: "lds-ellipsis", children: [
226
+ /* @__PURE__ */ jsx2("div", {}),
227
+ /* @__PURE__ */ jsx2("div", {}),
228
+ /* @__PURE__ */ jsx2("div", {}),
229
+ /* @__PURE__ */ jsx2("div", {})
248
230
  ] }) })
249
231
  ] });
250
232
  };
@@ -254,8 +236,8 @@ var Loader_default = Loader;
254
236
  var { name } = require_package();
255
237
  var S3Url = "https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/";
256
238
  if (name === "@fractalpay/fractalpay-next-dev") {
257
- baseUrl = "http://localhost:8082/";
258
- masterBaseUrl = "http://localhost:8081/";
239
+ masterBaseUrl = "https://api.dev.fractalpay.com/";
240
+ baseUrl = "https://widget.dev.fractalpay.com/";
259
241
  fractalGatewayUrl = "https://api-dev.merchant-trends.com/";
260
242
  datacapUrl = "https://token-cert.dcap.com/v1/client";
261
243
  threedsSecurePublicKey = "pk_test_51RH5Wc2SlJvyNZ80hpUDy88r4rVdpijfKbNaWaUyQEE6rOrPmG2JQyAj7G5amBD5z5daC56WaeT4jfNhrrPcGOEP00UyKu6AOw";
@@ -2491,22 +2473,6 @@ position:relative;
2491
2473
  color: #c62828 !important;
2492
2474
  }
2493
2475
 
2494
- .surcharge-program-notice-text{
2495
- margin: 10px 0 4px;
2496
- padding: 8px 12px;
2497
- background: #f6f6f7;
2498
- border-radius: 8px;
2499
- font-family: 'Inter', sans-serif;
2500
- font-size: 12px;
2501
- color: #727272;
2502
- line-height: 1.5;
2503
- }
2504
-
2505
- .surcharge-program-notice-text-att {
2506
- font-weight: 700;
2507
- color: #161616;
2508
- }
2509
-
2510
2476
  ` });
2511
2477
  }
2512
2478
 
@@ -2711,17 +2677,7 @@ function SuccessMszStyle() {
2711
2677
  gap: 6px;
2712
2678
  background-color: #161616;
2713
2679
  color: #fff;
2714
- }
2715
-
2716
-
2717
- #receipt-debit-note {
2718
- font-family: 'Inter', sans-serif;
2719
- font-size: 11px;
2720
- color: #49B182;
2721
- margin-top: 2px;
2722
- }
2723
-
2724
- ` });
2680
+ }` });
2725
2681
  }
2726
2682
 
2727
2683
  // src/app/components/SuccessMessage/HandleSubmit.tsx
@@ -2745,7 +2701,7 @@ function HandleSubmit(event, key, tranId) {
2745
2701
 
2746
2702
  // src/app/components/SuccessMessage/SuccessMsz.tsx
2747
2703
  import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
2748
- function SuccessMsz({ onClose, tranId, isDebitAdjusted = false }) {
2704
+ function SuccessMsz({ onClose, tranId }) {
2749
2705
  return /* @__PURE__ */ jsxs5(Fragment5, { children: [
2750
2706
  /* @__PURE__ */ jsx10(SuccessMszStyle, {}),
2751
2707
  /* @__PURE__ */ jsxs5("div", { className: "payment-msg-container", children: [
@@ -2772,20 +2728,7 @@ function SuccessMsz({ onClose, tranId, isDebitAdjusted = false }) {
2772
2728
  /* @__PURE__ */ jsx10("br", {}),
2773
2729
  "was successful"
2774
2730
  ] }),
2775
- /* @__PURE__ */ jsxs5("h6", { className: "charge-payment-success-subtext", children: [
2776
- "We\u2019ve processed your charge",
2777
- isDebitAdjusted && /* @__PURE__ */ jsxs5(Fragment5, { children: [
2778
- /* @__PURE__ */ jsx10("br", {}),
2779
- /* @__PURE__ */ jsx10(
2780
- "span",
2781
- {
2782
- id: "receipt-debit-note",
2783
- className: "charge-payment-success-subtext",
2784
- children: "No surcharge \u2014 debit card"
2785
- }
2786
- )
2787
- ] })
2788
- ] }),
2731
+ /* @__PURE__ */ jsx10("h6", { className: "charge-payment-success-subtext", children: "We\u2019ve processed your charge" }),
2789
2732
  /* @__PURE__ */ jsxs5("div", { className: "charge-success-payment-button-div", children: [
2790
2733
  /* @__PURE__ */ jsxs5("button", { className: "charge-success-btn1", onClick: (e) => HandleSubmit(e, "print", tranId), children: [
2791
2734
  /* @__PURE__ */ jsxs5(
@@ -2868,25 +2811,25 @@ import { IoArrowBack } from "react-icons/io5";
2868
2811
  import { useEffect as useEffect3 } from "react";
2869
2812
  function DataScript() {
2870
2813
  useEffect3(() => {
2871
- const src2 = datacapUrl;
2814
+ const src = datacapUrl;
2872
2815
  if (typeof window === "undefined") return;
2873
2816
  if (window.DatacapWebToken) {
2874
2817
  return;
2875
2818
  }
2876
- if (!document.querySelector(`script[src="${src2}"]`)) {
2877
- const script2 = document.createElement("script");
2878
- script2.src = src2;
2879
- script2.async = true;
2880
- script2.onload = () => {
2819
+ if (!document.querySelector(`script[src="${src}"]`)) {
2820
+ const script = document.createElement("script");
2821
+ script.src = src;
2822
+ script.async = true;
2823
+ script.onload = () => {
2881
2824
  if (window.DatacapWebToken) {
2882
2825
  } else {
2883
2826
  console.warn("\u26A0\uFE0F Script loaded, but DatacapWebToken not found");
2884
2827
  }
2885
2828
  };
2886
- script2.onerror = (err) => {
2829
+ script.onerror = (err) => {
2887
2830
  console.error("\u274C Failed to load Datacap script", err);
2888
2831
  };
2889
- document.head.appendChild(script2);
2832
+ document.head.appendChild(script);
2890
2833
  } else {
2891
2834
  }
2892
2835
  }, []);
@@ -3266,21 +3209,31 @@ var PaxList = ({ listHeading = "Readers", ListItems, selectedPax, setSlectedPax,
3266
3209
 
3267
3210
  // src/app/components/FractalTokenizer.tsx
3268
3211
  import { useEffect as useEffect4 } from "react";
3269
- function FractalTokenizerScript() {
3212
+ function FractalTokenizerScript({ onLoad }) {
3270
3213
  useEffect4(() => {
3271
3214
  const src = `${fractalGatewayUrl}tokenizer/static/js/fractal_tokenizer.js`;
3272
- if (document.querySelector(`script[src="${src}"]`)) return;
3215
+ if (window.FractalTokenizer) {
3216
+ onLoad == null ? void 0 : onLoad();
3217
+ return;
3218
+ }
3219
+ const existing = document.querySelector(`script[src="${src}"]`);
3220
+ if (existing) {
3221
+ existing.addEventListener("load", () => onLoad == null ? void 0 : onLoad());
3222
+ return;
3223
+ }
3273
3224
  const script = document.createElement("script");
3274
3225
  script.src = src;
3275
3226
  script.async = true;
3276
3227
  script.onload = () => {
3277
3228
  try {
3278
- const TokenizerClass = eval("FractalTokenizer");
3279
- if (TokenizerClass) {
3280
- window.FractalTokenizer = TokenizerClass;
3229
+ if (typeof FractalTokenizer !== "undefined") {
3230
+ window.FractalTokenizer = FractalTokenizer;
3231
+ onLoad == null ? void 0 : onLoad();
3232
+ } else {
3233
+ console.error("FractalTokenizer not defined in global scope");
3281
3234
  }
3282
3235
  } catch (err) {
3283
- console.error("FractalTokenizer not accessible:", err);
3236
+ console.error(err);
3284
3237
  }
3285
3238
  };
3286
3239
  document.head.appendChild(script);
@@ -3294,8 +3247,12 @@ import { Fragment as Fragment10, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-
3294
3247
  var FractalFields = ({ fractalStyles, tokenizerRef, isAddCard = false, isSky = false }) => {
3295
3248
  const instanceRef = useRef(null);
3296
3249
  useEffect5(() => {
3297
- if (!window.FractalTokenizer) return;
3298
- const instance = new window.FractalTokenizer({
3250
+ const Tokenizer = window.FractalTokenizer;
3251
+ if (!Tokenizer) {
3252
+ console.error("Tokenizer not available");
3253
+ return;
3254
+ }
3255
+ const instance = new Tokenizer({
3299
3256
  styles: fractalStyles
3300
3257
  });
3301
3258
  instanceRef.current = instance;
@@ -3407,17 +3364,17 @@ var DataCapScriptLoader = () => {
3407
3364
  );
3408
3365
  console.log("\u{1F535} existingScript found:", !!existingScript);
3409
3366
  if (!existingScript) {
3410
- const script2 = document.createElement("script");
3411
- script2.src = `${datacapUrl}/hosted`;
3412
- script2.async = true;
3413
- script2.onload = () => {
3367
+ const script = document.createElement("script");
3368
+ script.src = `${datacapUrl}/hosted`;
3369
+ script.async = true;
3370
+ script.onload = () => {
3414
3371
  console.log("\u2705 DataCap script loaded successfully");
3415
3372
  scriptLoaded = true;
3416
3373
  };
3417
- script2.onerror = (err) => {
3374
+ script.onerror = (err) => {
3418
3375
  console.error("\u274C DataCap script failed to load", err);
3419
3376
  };
3420
- document.head.appendChild(script2);
3377
+ document.head.appendChild(script);
3421
3378
  } else {
3422
3379
  scriptLoaded = true;
3423
3380
  }
@@ -3647,7 +3604,7 @@ function GetPaymentPage(props) {
3647
3604
  const [errorBankConsent, setErrorBankConsent] = useState4("");
3648
3605
  const [saveACHConsent1, setSaveACHConsent1] = useState4(false);
3649
3606
  const [errorBankConsentOther, setErrorBankConsentOther] = useState4("");
3650
- const [loaderText, setLoderText] = useState4("");
3607
+ const [isTokenizerReady, setTokenizerReady] = useState4(false);
3651
3608
  const fractalpayClientKey = props.merchantPublicKey;
3652
3609
  let mastercard2 = S3Url + "widget/mc-img.svg";
3653
3610
  let visa2 = S3Url + "widget/visa-img.svg";
@@ -3672,7 +3629,6 @@ function GetPaymentPage(props) {
3672
3629
  const [bankFeeAmount, setBankFeeAmount] = useState4(0);
3673
3630
  const [paymentData, setPaymentData] = useState4();
3674
3631
  let [tranId, setTranId] = useState4("");
3675
- let [isDebitAdjusted, setIsDebitAdjusted] = useState4(false);
3676
3632
  const tokenizerRef = useRef3(null);
3677
3633
  const fractalStyles = {
3678
3634
  input: {
@@ -3792,8 +3748,6 @@ function GetPaymentPage(props) {
3792
3748
  setErrorBankConsent("");
3793
3749
  setSaveACHConsent1(false);
3794
3750
  setErrorBankConsentOther("");
3795
- setLoderText("");
3796
- setIsDebitAdjusted(false);
3797
3751
  };
3798
3752
  const handleShow = () => setShow(true);
3799
3753
  const handletabchange = (id) => {
@@ -3903,7 +3857,7 @@ function GetPaymentPage(props) {
3903
3857
  return Object.keys(errors).length > 0;
3904
3858
  };
3905
3859
  const submitFunc = async (e) => {
3906
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2;
3860
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
3907
3861
  e.preventDefault();
3908
3862
  const el = document.activeElement;
3909
3863
  if (el instanceof HTMLElement) {
@@ -3991,20 +3945,15 @@ function GetPaymentPage(props) {
3991
3945
  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.");
3992
3946
  setLoading2(false);
3993
3947
  }
3994
- const card_issue_type = ((_i2 = tokenizeData == null ? void 0 : tokenizeData.bin_lookup_result) == null ? void 0 : _i2.card_issue_type) || null;
3995
- if (card_issue_type === "Debit" && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
3996
- setLoderText("Processing Debit card without fee");
3997
- }
3998
3948
  console.log(tokenizeData, "tokenizeData");
3999
3949
  const reqData = JSON.stringify(__spreadProps(__spreadValues({}, tokenizeData), {
4000
3950
  isSaveCardChecked: saveCardInfo,
4001
3951
  name: cardData == null ? void 0 : cardData.cardName,
4002
3952
  postal_code: cardData == null ? void 0 : cardData.zipCode,
4003
- customer_id: props == null ? void 0 : props.customerId,
4004
- card_issue_type
3953
+ customer_id: props == null ? void 0 : props.customerId
4005
3954
  }));
4006
3955
  const reqData2 = JSON.stringify({
4007
- "pre_sales_id": `${(_k2 = (_j2 = result == null ? void 0 : result.data) == null ? void 0 : _j2.data) == null ? void 0 : _k2.posSalesIdEncode}`,
3956
+ "pre_sales_id": `${(_j2 = (_i2 = result == null ? void 0 : result.data) == null ? void 0 : _i2.data) == null ? void 0 : _j2.posSalesIdEncode}`,
4008
3957
  "token": `${tokenizeData == null ? void 0 : tokenizeData.token}`,
4009
3958
  "json_response": `${reqData}`
4010
3959
  });
@@ -4020,13 +3969,11 @@ function GetPaymentPage(props) {
4020
3969
  };
4021
3970
  socketClient_default.emit("sendMessage", requestOptions2);
4022
3971
  socketClient_default.on("chargeviafractalgateway", (data) => {
4023
- var _a3, _b3;
3972
+ var _a3;
4024
3973
  if (isValidJson(data == null ? void 0 : data.data)) {
4025
3974
  let paymentRes = JSON.parse(data == null ? void 0 : data.data);
4026
- console.log(paymentRes, "paymentRes");
4027
3975
  if (paymentRes == null ? void 0 : paymentRes.result) {
4028
3976
  setTranId((_a3 = paymentRes == null ? void 0 : paymentRes.data) == null ? void 0 : _a3.transactionId);
4029
- setIsDebitAdjusted((_b3 = paymentRes == null ? void 0 : paymentRes.data) == null ? void 0 : _b3.is_debit_adjusted);
4030
3977
  setSuccess(true);
4031
3978
  setLoading2(false);
4032
3979
  } else {
@@ -4039,11 +3986,11 @@ function GetPaymentPage(props) {
4039
3986
  });
4040
3987
  } catch (err) {
4041
3988
  setLoading2(false);
4042
- setError(((_m2 = (_l2 = err == null ? void 0 : err.response) == null ? void 0 : _l2.data) == null ? void 0 : _m2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
3989
+ setError(((_l2 = (_k2 = err == null ? void 0 : err.response) == null ? void 0 : _k2.data) == null ? void 0 : _l2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
4043
3990
  }
4044
3991
  } catch (err) {
4045
3992
  setLoading2(false);
4046
- setError(((_o2 = (_n2 = err == null ? void 0 : err.response) == null ? void 0 : _n2.data) == null ? void 0 : _o2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
3993
+ setError(((_n2 = (_m2 = err == null ? void 0 : err.response) == null ? void 0 : _m2.data) == null ? void 0 : _n2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
4047
3994
  }
4048
3995
  } else {
4049
3996
  try {
@@ -4061,7 +4008,7 @@ function GetPaymentPage(props) {
4061
4008
  }
4062
4009
  } catch (err) {
4063
4010
  setLoading2(false);
4064
- setError(((_q2 = (_p2 = err == null ? void 0 : err.response) == null ? void 0 : _p2.data) == null ? void 0 : _q2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
4011
+ setError(((_p2 = (_o2 = err == null ? void 0 : err.response) == null ? void 0 : _o2.data) == null ? void 0 : _p2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
4065
4012
  }
4066
4013
  }
4067
4014
  }
@@ -4154,7 +4101,6 @@ function GetPaymentPage(props) {
4154
4101
  }
4155
4102
  };
4156
4103
  const handlechargeCustomer = async (e) => {
4157
- var _a2, _b2;
4158
4104
  e.currentTarget.blur();
4159
4105
  if (loading2) return;
4160
4106
  let customer_id = props == null ? void 0 : props.customerId;
@@ -4166,32 +4112,10 @@ function GetPaymentPage(props) {
4166
4112
  let amount = String(props == null ? void 0 : props.amount);
4167
4113
  let card_id = selectedCard == null ? void 0 : selectedCard.id;
4168
4114
  let card_type = selectedCard == null ? void 0 : selectedCard.card_type;
4169
- let card_issue_type = selectedCard == null ? void 0 : selectedCard.card_issue_type;
4170
4115
  if (fractalpayPublicKey && order_id && amount && bankAmount) {
4171
4116
  if (customer_id) {
4172
4117
  if (card_id) {
4173
- setLoading2(true);
4174
- if (card_issue_type == "Debit" && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
4175
- setLoderText("Processing Debit card without fee");
4176
- }
4177
- let resultofOrderCreate;
4178
- if (!(card_type === "Bank")) {
4179
- const formData = {
4180
- amount: `${props.amount || 0}`,
4181
- fractalpayPublicKey: fractalpayClientKey,
4182
- orderId: props == null ? void 0 : props.orderID,
4183
- customer_id: props == null ? void 0 : props.customerId,
4184
- discount: props == null ? void 0 : props.discount,
4185
- surcharge: props == null ? void 0 : props.surcharge,
4186
- tax: props == null ? void 0 : props.tax,
4187
- pass_fee: props == null ? void 0 : props.pass_fee
4188
- };
4189
- resultofOrderCreate = await axios3.post(`${baseUrl}create-widget-order`, formData, {
4190
- headers: __spreadValues({}, (props == null ? void 0 : props.sessionToken) && { "X-Session-Token": props.sessionToken })
4191
- });
4192
- console.log(resultofOrderCreate, "vfndsjkfvhg", resultofOrderCreate == null ? void 0 : resultofOrderCreate.data.data.posSalesIdEncode);
4193
- }
4194
- let chargeobj = __spreadValues(__spreadValues({
4118
+ let chargeobj = __spreadValues({
4195
4119
  amount: card_type === "Bank" ? `${bankAmount}` : amount,
4196
4120
  order_id,
4197
4121
  customer_id,
@@ -4203,19 +4127,19 @@ function GetPaymentPage(props) {
4203
4127
  tax,
4204
4128
  pass_fee: props == null ? void 0 : props.pass_fee,
4205
4129
  require3ds: false
4206
- }, (props == null ? void 0 : props.sessionToken) && { sessionToken: props.sessionToken }), ((_b2 = (_a2 = resultofOrderCreate == null ? void 0 : resultofOrderCreate.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.posSalesIdEncode) && { enOrderId: resultofOrderCreate == null ? void 0 : resultofOrderCreate.data.data.posSalesIdEncode });
4207
- let _c2 = chargeobj, { isCardSave, pass_fee, require3ds } = _c2, rest = __objRest(_c2, ["isCardSave", "pass_fee", "require3ds"]);
4130
+ }, (props == null ? void 0 : props.sessionToken) && { sessionToken: props.sessionToken });
4131
+ let _a2 = chargeobj, { isCardSave, pass_fee, require3ds } = _a2, rest = __objRest(_a2, ["isCardSave", "pass_fee", "require3ds"]);
4208
4132
  let endpoint = card_type === "Bank" ? "charge-ach" : "charge-by-card";
4209
4133
  let chargeurl = baseUrl + endpoint;
4210
4134
  const headers = {
4211
4135
  "Content-Type": "application/json"
4212
4136
  };
4137
+ setLoading2(true);
4213
4138
  socketClient_default.emit("sendMessage", { url: chargeurl, body: card_type == "Bank" ? rest : chargeobj, isChargebycard: true });
4214
4139
  socketClient_default.on("charge-by-card", (response) => {
4215
- var _a3, _b3;
4140
+ var _a3;
4216
4141
  if ((response == null ? void 0 : response.result) == true || (response == null ? void 0 : response.status) == true) {
4217
- setIsDebitAdjusted((_a3 = response.data) == null ? void 0 : _a3.adjustedForDebit);
4218
- setTranId((_b3 = response.data) == null ? void 0 : _b3.transaction_id);
4142
+ setTranId((_a3 = response.data) == null ? void 0 : _a3.transaction_id);
4219
4143
  setSuccess(true);
4220
4144
  setLoading2(false);
4221
4145
  } else {
@@ -4384,7 +4308,7 @@ function GetPaymentPage(props) {
4384
4308
  }, []);
4385
4309
  return /* @__PURE__ */ jsxs11(Fragment11, { children: [
4386
4310
  /* @__PURE__ */ jsx19(DataScript, {}),
4387
- /* @__PURE__ */ jsx19(FractalTokenizerScript, {}),
4311
+ /* @__PURE__ */ jsx19(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
4388
4312
  /* @__PURE__ */ jsx19(DataCapScriptLoader, {}),
4389
4313
  /* @__PURE__ */ jsx19(Chargewidgetstyles, {}),
4390
4314
  /* @__PURE__ */ jsx19(CardBankRadioStyles, {}),
@@ -4407,9 +4331,9 @@ function GetPaymentPage(props) {
4407
4331
  errorIframe && /* @__PURE__ */ jsx19("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx19(ErrorCardMessage_default, { error: errorIframe, onClose: () => {
4408
4332
  setErrorIframe("");
4409
4333
  } }) }),
4410
- success && /* @__PURE__ */ jsx19(SuccessMsz, { onClose: handleClose, tranId, isDebitAdjusted }),
4334
+ success && /* @__PURE__ */ jsx19(SuccessMsz, { onClose: handleClose, tranId }),
4411
4335
  !error && !errorIframe && !success && /* @__PURE__ */ jsxs11(Fragment11, { children: [
4412
- (loading || loading2 || loadingIframe) && /* @__PURE__ */ jsx19(Loader_default, { loading: loading || loading2 || loadingIframe, loaderText }),
4336
+ (loading || loading2 || loadingIframe) && /* @__PURE__ */ jsx19(Loader_default, { loading: loading || loading2 || loadingIframe }),
4413
4337
  /* @__PURE__ */ jsx19("div", { className: "frac-card-payment-page frac-form", children: /* @__PURE__ */ jsxs11("div", { className: "parent-pay-container", children: [
4414
4338
  /* @__PURE__ */ jsx19("span", { className: "request-payment-close-popup", onClick: handleClose, children: /* @__PURE__ */ jsxs11("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
4415
4339
  /* @__PURE__ */ jsx19("g", { clipPath: "url(#clip0_12425_52336)", children: /* @__PURE__ */ jsx19("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" }) }),
@@ -4428,44 +4352,23 @@ function GetPaymentPage(props) {
4428
4352
  ] })
4429
4353
  ] }),
4430
4354
  /* @__PURE__ */ jsxs11("div", { className: "amt-pay-con", children: [
4431
- /* @__PURE__ */ jsx19("div", { className: "pay-amount-conatiner", children: /* @__PURE__ */ jsx19("small", { className: "pay-payment-amount", children: "Select payment type" }) }),
4355
+ /* @__PURE__ */ jsx19("div", { className: "pay-amount-conatiner", children: /* @__PURE__ */ jsx19("small", { className: "pay-payment-amount", children: "Select paymet type" }) }),
4432
4356
  /* @__PURE__ */ jsxs11("div", { className: "frac-card-bank-radio-main", children: [
4433
4357
  /* @__PURE__ */ jsx19(CardBankRadio, { label: "Card", amount: (_a = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _a.toFixed(2), value: "card", onChange: handletabchange, activetab }),
4434
4358
  (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && /* @__PURE__ */ jsx19(CardBankRadio, { label: "Bank", amount: (_b = Number(bankAmount)) == null ? void 0 : _b.toFixed(2), value: "ach", onChange: handletabchange, activetab }),
4435
4359
  (props == null ? void 0 : props.isReader) && (paymentData == null ? void 0 : paymentData.paymentDeviceList) && ((_c = paymentData == null ? void 0 : paymentData.paymentDeviceList) == null ? void 0 : _c.length) > 0 && /* @__PURE__ */ jsx19(CardBankRadio, { label: "Reader", amount: (_d = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _d.toFixed(2), value: "reader", onChange: handletabchange, activetab })
4436
4360
  ] }),
4437
- !loading && (activetab === "card" || activetab === "reader") && (props == null ? void 0 : props.pass_fee) && cashDiscount && cashDiscount > 0 && /* @__PURE__ */ jsxs11("div", { className: "frac-cash-discount-fee", children: [
4438
- /* @__PURE__ */ jsx19("small", { children: (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1 ? "Surcharge" : (paymentData == null ? void 0 : paymentData.showSurcharge) ? "3% Card Fee" : "Cash Discount" }),
4439
- /* @__PURE__ */ jsx19("p", { children: formatUSD((Number(props.amount) - cashDiscount).toFixed(2)) })
4440
- ] }),
4441
- !loading && activetab === "ach" && (props == null ? void 0 : props.pass_fee) && cashDiscount && cashDiscount > 0 && /* @__PURE__ */ jsxs11("div", { className: "frac-cash-discount-fee", children: [
4442
- /* @__PURE__ */ jsx19("small", { children: (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1 ? "Savings" : "Cash Discount Savings" }),
4443
- /* @__PURE__ */ jsx19("p", { children: formatUSD((Number(props.amount) - cashDiscount).toFixed(2)) })
4444
- ] }),
4445
- !loading && (props == null ? void 0 : props.pass_fee) && /* @__PURE__ */ jsxs11("div", { className: "", children: [
4361
+ !loading && /* @__PURE__ */ jsxs11("div", { className: "", children: [
4446
4362
  activetab == "ach" && bankFeeAmount > 0 && /* @__PURE__ */ jsxs11("small", { className: "frac-fee-text", children: [
4447
4363
  "There is a processing fee of ",
4448
4364
  /* @__PURE__ */ jsx19("span", { className: "frac-fee-amount", children: formatUSD(bankFeeAmount.toFixed(2)) }),
4449
4365
  "."
4450
4366
  ] }),
4451
- (activetab === "card" || activetab === "reader") && (props == null ? void 0 : props.pass_fee) && cashDiscount && cashDiscount > 0 && /* @__PURE__ */ jsxs11(
4452
- "div",
4453
- {
4454
- id: "surcharge-program-notice",
4455
- className: "surcharge-program-notice-text",
4456
- children: [
4457
- "A 3% processing surcharge is applied to all credit card transactions. Debit card payments are processed for",
4458
- " ",
4459
- /* @__PURE__ */ jsxs11("span", { className: "surcharge-program-notice-text-att", children: [
4460
- "$",
4461
- Number(cashDiscount).toLocaleString("en-US", {
4462
- minimumFractionDigits: 2,
4463
- maximumFractionDigits: 2
4464
- })
4465
- ] })
4466
- ]
4467
- }
4468
- )
4367
+ (activetab === "card" || activetab === "reader") && (props == null ? void 0 : props.pass_fee) && cashDiscount && cashDiscount > 0 && /* @__PURE__ */ jsxs11("small", { className: "frac-fee-text", children: [
4368
+ "Cards include a fee amount of ",
4369
+ /* @__PURE__ */ jsx19("span", { className: "frac-fee-amount", children: formatUSD((Number(props.amount) - cashDiscount).toFixed(2)) }),
4370
+ "."
4371
+ ] })
4469
4372
  ] })
4470
4373
  ] })
4471
4374
  ] }),
@@ -4610,7 +4513,7 @@ function GetPaymentPage(props) {
4610
4513
  ] }),
4611
4514
  /* @__PURE__ */ jsxs11("div", { className: "form-group", children: [
4612
4515
  /* @__PURE__ */ jsx19("label", { children: "CARD NUMBER" }),
4613
- /* @__PURE__ */ jsx19("div", { className: "toggle-num-wrapper", children: show && (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && /* @__PURE__ */ jsx19(
4516
+ /* @__PURE__ */ jsx19("div", { className: "toggle-num-wrapper", children: show && (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && isTokenizerReady && /* @__PURE__ */ jsx19(
4614
4517
  FractalFields_default,
4615
4518
  {
4616
4519
  fractalStyles,
@@ -4964,6 +4867,7 @@ function PreAuthPayment(_a) {
4964
4867
  const [activeinCard, setActiveinCard] = useState5("form");
4965
4868
  const fractalpayClientKey = props.merchantPublicKey;
4966
4869
  const [selectedReader, setSelectedReader] = useState5(void 0);
4870
+ const [isTokenizerReady, setTokenizerReady] = useState5(false);
4967
4871
  const tokenizerRef = useRef4(null);
4968
4872
  const fractalStyles = {
4969
4873
  input: {
@@ -5500,7 +5404,7 @@ function PreAuthPayment(_a) {
5500
5404
  }, []);
5501
5405
  return /* @__PURE__ */ jsxs12(Fragment12, { children: [
5502
5406
  /* @__PURE__ */ jsx20(DataScript, {}),
5503
- /* @__PURE__ */ jsx20(FractalTokenizerScript, {}),
5407
+ /* @__PURE__ */ jsx20(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
5504
5408
  /* @__PURE__ */ jsx20(Chargewidgetstyles, {}),
5505
5409
  /* @__PURE__ */ jsx20(CardBankRadioStyles, {}),
5506
5410
  /* @__PURE__ */ jsx20(DataCapScriptLoader, {}),
@@ -5536,7 +5440,7 @@ function PreAuthPayment(_a) {
5536
5440
  /* @__PURE__ */ jsxs12("div", { className: "pay-conatiner-one-first", children: [
5537
5441
  /* @__PURE__ */ jsx20("div", { className: "pay-logo-container", children: /* @__PURE__ */ jsx20("div", { className: "pay-main-logo", children: /* @__PURE__ */ jsx20("img", { src: paymentData == null ? void 0 : paymentData.logo, id: "pay-logos" }) }) }),
5538
5442
  /* @__PURE__ */ jsxs12("div", { className: "amt-pay-con", children: [
5539
- /* @__PURE__ */ jsx20("div", { className: "pay-amount-conatiner", children: /* @__PURE__ */ jsx20("small", { className: "pay-payment-amount", children: "Select payment type" }) }),
5443
+ /* @__PURE__ */ jsx20("div", { className: "pay-amount-conatiner", children: /* @__PURE__ */ jsx20("small", { className: "pay-payment-amount", children: "Select paymet type" }) }),
5540
5444
  /* @__PURE__ */ jsxs12("div", { className: "frac-card-bank-radio-main", children: [
5541
5445
  /* @__PURE__ */ jsx20(CardBankRadio, { label: "Card", amount: (_a2 = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _a2.toFixed(2), value: "card", onChange: handletabchange, activetab }),
5542
5446
  (props == null ? void 0 : props.isReader) && (paymentData == null ? void 0 : paymentData.paymentDeviceList) && ((_b2 = paymentData == null ? void 0 : paymentData.paymentDeviceList) == null ? void 0 : _b2.length) > 0 && /* @__PURE__ */ jsx20(CardBankRadio, { label: "Reader", amount: (_c = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _c.toFixed(2), value: "reader", onChange: handletabchange, activetab })
@@ -5656,7 +5560,7 @@ function PreAuthPayment(_a) {
5656
5560
  ] }),
5657
5561
  /* @__PURE__ */ jsxs12("div", { className: "form-group", children: [
5658
5562
  /* @__PURE__ */ jsx20("label", { children: "CARD NUMBER" }),
5659
- /* @__PURE__ */ jsx20("div", { className: "toggle-num-wrapper", children: show && (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && /* @__PURE__ */ jsx20(
5563
+ /* @__PURE__ */ jsx20("div", { className: "toggle-num-wrapper", children: show && (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && isTokenizerReady && /* @__PURE__ */ jsx20(
5660
5564
  FractalFields_default,
5661
5565
  {
5662
5566
  fractalStyles,
@@ -6248,6 +6152,7 @@ function AddCardEasyPay(props) {
6248
6152
  const exp_year_ref = useRef5(null);
6249
6153
  const cvv_ref = useRef5(null);
6250
6154
  const name_ref = useRef5(null);
6155
+ const [isTokenizerReady, setTokenizerReady] = useState6(false);
6251
6156
  const tokenizerRef = useRef5(null);
6252
6157
  const fractalStyles = {
6253
6158
  input: {
@@ -6520,7 +6425,7 @@ function AddCardEasyPay(props) {
6520
6425
  }, []);
6521
6426
  return /* @__PURE__ */ jsxs14(Fragment14, { children: [
6522
6427
  /* @__PURE__ */ jsx24(DataScript, {}),
6523
- /* @__PURE__ */ jsx24(FractalTokenizerScript, {}),
6428
+ /* @__PURE__ */ jsx24(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
6524
6429
  /* @__PURE__ */ jsx24(DataCapScriptLoader, {}),
6525
6430
  /* @__PURE__ */ jsx24(AddCardStyle, {}),
6526
6431
  /* @__PURE__ */ jsx24(Loader_default, { loading: loading || loadingIframe }),
@@ -6550,7 +6455,7 @@ function AddCardEasyPay(props) {
6550
6455
  /* @__PURE__ */ jsxs14("div", { style: { maxHeight: "350px", minHeight: "0" }, className: "card-scrl", children: [
6551
6456
  /* @__PURE__ */ jsxs14("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" }, children: [
6552
6457
  /* @__PURE__ */ jsx24("label", { htmlFor: "cardNumber", children: "Card Number" }),
6553
- (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && /* @__PURE__ */ jsx24(
6458
+ (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && isTokenizerReady && /* @__PURE__ */ jsx24(
6554
6459
  FractalFields_default,
6555
6460
  {
6556
6461
  fractalStyles,
@@ -6904,8 +6809,12 @@ import { Fragment as Fragment15, jsx as jsx26, jsxs as jsxs15 } from "react/jsx-
6904
6809
  var FractalFieldsAddCardSky = ({ fractalStyles, tokenizerRef, extraInputs }) => {
6905
6810
  const instanceRef = useRef6(null);
6906
6811
  useEffect11(() => {
6907
- if (!window.FractalTokenizer) return;
6908
- const instance = new window.FractalTokenizer({
6812
+ const Tokenizer = window.FractalTokenizer;
6813
+ if (!Tokenizer) {
6814
+ console.error("Tokenizer not available");
6815
+ return;
6816
+ }
6817
+ const instance = new Tokenizer({
6909
6818
  styles: fractalStyles
6910
6819
  });
6911
6820
  instanceRef.current = instance;
@@ -7005,6 +6914,7 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
7005
6914
  const [paymentGateway, setPaymentGateway] = useState7();
7006
6915
  const [dcToken, setDCToken] = useState7();
7007
6916
  const tokenizerRef = useRef7(null);
6917
+ const [isTokenizerReady, setTokenizerReady] = useState7(false);
7008
6918
  const fractalStyles = {
7009
6919
  input: {
7010
6920
  "font-family": "'Inter', sans-serif",
@@ -7267,7 +7177,7 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
7267
7177
  }, []);
7268
7178
  return /* @__PURE__ */ jsxs16(Fragment16, { children: [
7269
7179
  /* @__PURE__ */ jsx27(DataScript, {}),
7270
- /* @__PURE__ */ jsx27(FractalTokenizerScript, {}),
7180
+ /* @__PURE__ */ jsx27(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
7271
7181
  /* @__PURE__ */ jsx27(DataCapScriptLoader, {}),
7272
7182
  /* @__PURE__ */ jsx27(AddCardSkyStyle, {}),
7273
7183
  /* @__PURE__ */ jsx27(Loader_default, { loading: loading || isloading || loadingIframe }),
@@ -7329,7 +7239,7 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
7329
7239
  (cardError == null ? void 0 : cardError.lastName) && /* @__PURE__ */ jsx27("small", { className: "error", children: cardError == null ? void 0 : cardError.lastName })
7330
7240
  ] })
7331
7241
  ] }),
7332
- /* @__PURE__ */ jsx27(
7242
+ isTokenizerReady && /* @__PURE__ */ jsx27(
7333
7243
  FractalFieldsAddCardSky_default,
7334
7244
  {
7335
7245
  fractalStyles,
@@ -7678,8 +7588,7 @@ function PartialPayment(props) {
7678
7588
  const [errorBankConsent, setErrorBankConsent] = useState8("");
7679
7589
  const [saveACHConsent1, setSaveACHConsent1] = useState8(false);
7680
7590
  const [errorBankConsentOther, setErrorBankConsentOther] = useState8("");
7681
- const [loaderText, setLoderText] = useState8("");
7682
- let [isDebitAdjusted, setIsDebitAdjusted] = useState8(false);
7591
+ const [isTokenizerReady, setTokenizerReady] = useState8(false);
7683
7592
  const tokenizerRef = useRef8(null);
7684
7593
  const fractalStyles = {
7685
7594
  input: {
@@ -7795,7 +7704,6 @@ function PartialPayment(props) {
7795
7704
  setErrorBankConsent("");
7796
7705
  setSaveACHConsent1(false);
7797
7706
  setErrorBankConsentOther("");
7798
- setLoderText("");
7799
7707
  };
7800
7708
  const handleShow = () => setShow(true);
7801
7709
  const handletabchange = (id) => {
@@ -7906,7 +7814,7 @@ function PartialPayment(props) {
7906
7814
  return Object.keys(errors).length > 0;
7907
7815
  };
7908
7816
  const submitFunc = async (e) => {
7909
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
7817
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2;
7910
7818
  e.preventDefault();
7911
7819
  const el = document.activeElement;
7912
7820
  if (el instanceof HTMLElement) {
@@ -7981,20 +7889,15 @@ function PartialPayment(props) {
7981
7889
  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),
7982
7890
  session_key: (_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key
7983
7891
  });
7984
- const card_issue_type = ((_g2 = tokenizeData == null ? void 0 : tokenizeData.bin_lookup_result) == null ? void 0 : _g2.card_issue_type) || null;
7985
- if (card_issue_type === "Debit" && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
7986
- setLoderText("Processing Debit card without fee");
7987
- }
7988
7892
  const reqData = JSON.stringify(__spreadProps(__spreadValues({}, tokenizeData), {
7989
7893
  isSaveCardChecked: saveCardInfo,
7990
7894
  name: cardData == null ? void 0 : cardData.cardName,
7991
7895
  postal_code: cardData == null ? void 0 : cardData.zipCode,
7992
7896
  customer_id: props == null ? void 0 : props.customerId,
7993
- partial_amount: partialAmount && !partialError ? partialAmount : aftertaxAmount,
7994
- card_issue_type
7897
+ partial_amount: partialAmount && !partialError ? partialAmount : aftertaxAmount
7995
7898
  }));
7996
7899
  const reqData2 = JSON.stringify({
7997
- "pre_sales_id": `${(_h2 = paymentData == null ? void 0 : paymentData.orderDetails) == null ? void 0 : _h2.orderId}`,
7900
+ "pre_sales_id": `${(_g2 = paymentData == null ? void 0 : paymentData.orderDetails) == null ? void 0 : _g2.orderId}`,
7998
7901
  "token": `${tokenizeData == null ? void 0 : tokenizeData.token}`,
7999
7902
  "json_response": `${reqData}`
8000
7903
  });
@@ -8027,11 +7930,11 @@ function PartialPayment(props) {
8027
7930
  });
8028
7931
  } catch (err) {
8029
7932
  setLoading2(false);
8030
- setError(((_j2 = (_i2 = err == null ? void 0 : err.response) == null ? void 0 : _i2.data) == null ? void 0 : _j2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
7933
+ 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.");
8031
7934
  }
8032
7935
  } catch (err) {
8033
7936
  setLoading2(false);
8034
- setError(((_l2 = (_k2 = err == null ? void 0 : err.response) == null ? void 0 : _k2.data) == null ? void 0 : _l2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
7937
+ setError(((_k2 = (_j2 = err == null ? void 0 : err.response) == null ? void 0 : _j2.data) == null ? void 0 : _k2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
8035
7938
  }
8036
7939
  } else {
8037
7940
  try {
@@ -8048,7 +7951,7 @@ function PartialPayment(props) {
8048
7951
  }
8049
7952
  } catch (err) {
8050
7953
  setLoading2(false);
8051
- setError(((_n2 = (_m2 = err == null ? void 0 : err.response) == null ? void 0 : _m2.data) == null ? void 0 : _n2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
7954
+ setError(((_m2 = (_l2 = err == null ? void 0 : err.response) == null ? void 0 : _l2.data) == null ? void 0 : _m2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
8052
7955
  }
8053
7956
  }
8054
7957
  }
@@ -8153,7 +8056,6 @@ function PartialPayment(props) {
8153
8056
  let amount = partialAmount && !partialError ? partialAmount : String(aftertaxAmount);
8154
8057
  let card_id = selectedCard == null ? void 0 : selectedCard.id;
8155
8058
  let card_type = selectedCard == null ? void 0 : selectedCard.card_type;
8156
- let card_issue_type = selectedCard == null ? void 0 : selectedCard.card_issue_type;
8157
8059
  if (partialError) {
8158
8060
  return;
8159
8061
  }
@@ -8192,15 +8094,11 @@ function PartialPayment(props) {
8192
8094
  "Content-Type": "application/json"
8193
8095
  };
8194
8096
  setLoading2(true);
8195
- if (card_issue_type == "Debit" && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
8196
- setLoderText("Processing Debit card without fee");
8197
- }
8198
8097
  socketClient_default.emit("sendMessage", { url: chargeurl, body: card_type == "Bank" ? rest : chargeobj, isChargebycard: true });
8199
8098
  socketClient_default.on("charge-by-card", (response) => {
8200
- var _a3, _b2;
8099
+ var _a3;
8201
8100
  if ((response == null ? void 0 : response.result) == true || (response == null ? void 0 : response.status) == true) {
8202
- setIsDebitAdjusted((_a3 = response.data) == null ? void 0 : _a3.adjustedForDebit);
8203
- setTranId((_b2 = response.data) == null ? void 0 : _b2.transaction_id);
8101
+ setTranId((_a3 = response.data) == null ? void 0 : _a3.transaction_id);
8204
8102
  setSuccess(true);
8205
8103
  setLoading2(false);
8206
8104
  } else {
@@ -8404,7 +8302,7 @@ function PartialPayment(props) {
8404
8302
  /* @__PURE__ */ jsx28(DataScript, {}),
8405
8303
  /* @__PURE__ */ jsx28(Chargewidgetstyles, {}),
8406
8304
  /* @__PURE__ */ jsx28(CardBankRadioStyles, {}),
8407
- /* @__PURE__ */ jsx28(FractalTokenizerScript, {}),
8305
+ /* @__PURE__ */ jsx28(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
8408
8306
  /* @__PURE__ */ jsx28(DataCapScriptLoader, {}),
8409
8307
  /* @__PURE__ */ jsxs17(Fragment17, { children: [
8410
8308
  /* @__PURE__ */ jsx28("button", { ref: buttonRef, style: { display: "none" }, className: "paymentBtn", onClick: handleShow, children: "Pay" }),
@@ -8418,9 +8316,9 @@ function PartialPayment(props) {
8418
8316
  errorIframe && /* @__PURE__ */ jsx28("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx28(ErrorCardMessage_default, { error: errorIframe, onClose: () => {
8419
8317
  setErrorIframe("");
8420
8318
  } }) }),
8421
- success && /* @__PURE__ */ jsx28(SuccessMsz, { onClose: handleClose, tranId, isDebitAdjusted }),
8319
+ success && /* @__PURE__ */ jsx28(SuccessMsz, { onClose: handleClose, tranId }),
8422
8320
  !error && !success && !errorIframe && /* @__PURE__ */ jsxs17(Fragment17, { children: [
8423
- (loading || loading2 || loadingIframe) && /* @__PURE__ */ jsx28(Loader_default, { loading: loading || loading2 || loadingIframe, loaderText }),
8321
+ (loading || loading2 || loadingIframe) && /* @__PURE__ */ jsx28(Loader_default, { loading: loading || loading2 || loadingIframe }),
8424
8322
  /* @__PURE__ */ jsx28("div", { className: "frac-card-payment-page frac-form", children: /* @__PURE__ */ jsxs17("div", { className: "parent-pay-container", children: [
8425
8323
  /* @__PURE__ */ jsx28("span", { className: "request-payment-close-popup", onClick: handleClose, children: /* @__PURE__ */ jsxs17("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
8426
8324
  /* @__PURE__ */ jsx28("g", { clipPath: "url(#clip0_12425_52336)", children: /* @__PURE__ */ jsx28("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" }) }),
@@ -8441,28 +8339,19 @@ function PartialPayment(props) {
8441
8339
  /* @__PURE__ */ jsxs17("div", { className: "amt-pay-con", children: [
8442
8340
  /* @__PURE__ */ jsx28("div", { className: "pay-amount-conatiner", children: /* @__PURE__ */ jsx28("small", { className: "pay-payment-amount", children: "Select payment type" }) }),
8443
8341
  /* @__PURE__ */ jsx28("div", { className: "frac-card-bank-radio-main", children: /* @__PURE__ */ jsx28(CardBankRadio, { label: "Card", amount: (_a = Number(aftertaxAmount)) == null ? void 0 : _a.toFixed(2), value: "card", onChange: handletabchange, activetab }) }),
8444
- !loading && (activetab === "card" || activetab === "reader") && (props == null ? void 0 : props.pass_fee) && cashDiscount && cashDiscount > 0 && /* @__PURE__ */ jsxs17("div", { className: "frac-cash-discount-fee", children: [
8445
- /* @__PURE__ */ jsx28("small", { children: (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1 ? "Surcharge" : (paymentData == null ? void 0 : paymentData.showSurcharge) ? "3% Card Fee" : "Cash Discount" }),
8446
- /* @__PURE__ */ jsx28("p", { children: formatUSD((Number(props.amount) - cashDiscount).toFixed(2)) })
8447
- ] }),
8448
- !loading && (props == null ? void 0 : props.pass_fee) && /* @__PURE__ */ jsx28("div", { className: "", children: (activetab === "card" || activetab === "reader") && (props == null ? void 0 : props.pass_fee) && cashDiscount && cashDiscount > 0 && /* @__PURE__ */ jsxs17(
8449
- "div",
8450
- {
8451
- id: "surcharge-program-notice",
8452
- className: "surcharge-program-notice-text",
8453
- children: [
8454
- "A 3% processing surcharge is applied to all credit card transactions. Debit card payments are processed for",
8455
- " ",
8456
- /* @__PURE__ */ jsxs17("span", { className: "surcharge-program-notice-text-att", children: [
8457
- "$",
8458
- Number(cashDiscount).toLocaleString("en-US", {
8459
- minimumFractionDigits: 2,
8460
- maximumFractionDigits: 2
8461
- })
8462
- ] })
8463
- ]
8464
- }
8465
- ) }),
8342
+ numberToBoolean(paymentData == null ? void 0 : paymentData.showSurcharge) ? cashDiscount && cashDiscount > 0 && (props == null ? void 0 : props.pass_fee) ? /* @__PURE__ */ jsxs17("div", { className: "frac-cash-discount-fee", children: [
8343
+ /* @__PURE__ */ jsxs17("small", { children: [
8344
+ activetab === "card" ? "Cash Discount" : "Cash Discount Savings",
8345
+ " "
8346
+ ] }),
8347
+ /* @__PURE__ */ jsx28("p", { children: formatUSD((Number(aftertaxAmount) - cashDiscount).toFixed(2)) })
8348
+ ] }) : null : cashDiscount && cashDiscount > 0 && (props == null ? void 0 : props.pass_fee) && activetab === "card" ? /* @__PURE__ */ jsxs17("div", { className: "frac-cash-discount-fee", children: [
8349
+ /* @__PURE__ */ jsxs17("small", { children: [
8350
+ activetab === "card" ? "Surcharge" : null,
8351
+ " "
8352
+ ] }),
8353
+ /* @__PURE__ */ jsx28("p", { children: formatUSD((Number(aftertaxAmount) - cashDiscount).toFixed(2)) })
8354
+ ] }) : null,
8466
8355
  (props == null ? void 0 : props.allowPartial) && /* @__PURE__ */ jsxs17("div", { className: "frac-partial-payment-input", children: [
8467
8356
  /* @__PURE__ */ jsx28("label", { htmlFor: "partialpayment", children: "Partial Payment" }),
8468
8357
  /* @__PURE__ */ jsx28(
@@ -8621,7 +8510,7 @@ function PartialPayment(props) {
8621
8510
  ] }),
8622
8511
  /* @__PURE__ */ jsxs17("div", { className: "form-group", children: [
8623
8512
  /* @__PURE__ */ jsx28("label", { children: "CARD NUMBER" }),
8624
- /* @__PURE__ */ jsx28("div", { className: "toggle-num-wrapper", children: show && (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && /* @__PURE__ */ jsx28(
8513
+ /* @__PURE__ */ jsx28("div", { className: "toggle-num-wrapper", children: show && (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && isTokenizerReady && /* @__PURE__ */ jsx28(
8625
8514
  FractalFields_default,
8626
8515
  {
8627
8516
  fractalStyles,
@@ -10079,19 +9968,19 @@ var GooglePayScriptLoader = ({
10079
9968
  `script[src="https://pay.google.com/gp/p/js/pay.js"]`
10080
9969
  );
10081
9970
  if (!existingScript) {
10082
- const script2 = document.createElement("script");
10083
- script2.src = "https://pay.google.com/gp/p/js/pay.js";
10084
- script2.async = true;
10085
- script2.onload = () => {
9971
+ const script = document.createElement("script");
9972
+ script.src = "https://pay.google.com/gp/p/js/pay.js";
9973
+ script.async = true;
9974
+ script.onload = () => {
10086
9975
  console.log("\u2705 Google Pay script loaded");
10087
9976
  googlePayScriptLoaded = true;
10088
9977
  console.log("google:", window.google);
10089
9978
  onLoad == null ? void 0 : onLoad();
10090
9979
  };
10091
- script2.onerror = (err) => {
9980
+ script.onerror = (err) => {
10092
9981
  console.error("\u274C Google Pay script failed", err);
10093
9982
  };
10094
- document.head.appendChild(script2);
9983
+ document.head.appendChild(script);
10095
9984
  } else {
10096
9985
  googlePayScriptLoaded = true;
10097
9986
  onLoad == null ? void 0 : onLoad();
@@ -10392,7 +10281,7 @@ function ApplePayButton({
10392
10281
 
10393
10282
  // src/app/components/Atoms/ModelContentSky/ModelContentSky.tsx
10394
10283
  import { Fragment as Fragment20, jsx as jsx36, jsxs as jsxs21 } from "react/jsx-runtime";
10395
- 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 }) => {
10284
+ 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, isTokenizerReady }) => {
10396
10285
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
10397
10286
  const hasRunRef = useRef12(false);
10398
10287
  const cardFormRef = useRef12(null);
@@ -11679,7 +11568,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
11679
11568
  ] }),
11680
11569
  /* @__PURE__ */ jsxs21("div", { className: "form-group-frac", children: [
11681
11570
  /* @__PURE__ */ jsx36("label", { htmlFor: "cardNumber", children: "CARD NUMBER" }),
11682
- /* @__PURE__ */ jsx36("div", { className: "toggle-num-wrapper toggle-num-wrapper-new", children: (show || autoTrigger) && paymentGateway === 32 && /* @__PURE__ */ jsx36(
11571
+ /* @__PURE__ */ jsx36("div", { className: "toggle-num-wrapper toggle-num-wrapper-new", children: (show || autoTrigger) && paymentGateway === 32 && isTokenizerReady && /* @__PURE__ */ jsx36(
11683
11572
  FractalFields_default,
11684
11573
  {
11685
11574
  fractalStyles,
@@ -12033,6 +11922,7 @@ var PaymentWidget = ({
12033
11922
  });
12034
11923
  const [orderGuid, setOrderGuid] = useState12(null);
12035
11924
  const [remainingAmount, setRemainingAmount] = useState12(null);
11925
+ const [isTokenizerReady, setTokenizerReady] = useState12(false);
12036
11926
  const initialCommonProps = useMemo(
12037
11927
  () => ({
12038
11928
  amount,
@@ -12119,10 +12009,11 @@ var PaymentWidget = ({
12119
12009
  getskyosOrderDetails();
12120
12010
  }
12121
12011
  }, [show, isPartial, partialRef]);
12012
+ console.log("isTokenizerReady", isTokenizerReady);
12122
12013
  return /* @__PURE__ */ jsxs22(Fragment21, { children: [
12123
12014
  /* @__PURE__ */ jsx37("link", { href: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" }),
12124
12015
  /* @__PURE__ */ jsx37(DataScript, {}),
12125
- /* @__PURE__ */ jsx37(FractalTokenizerScript, {}),
12016
+ /* @__PURE__ */ jsx37(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
12126
12017
  /* @__PURE__ */ jsx37(SkyChargewidgetstyles, {}),
12127
12018
  /* @__PURE__ */ jsx37(CardBankRadioStyles, {}),
12128
12019
  /* @__PURE__ */ jsx37(CustomModal2styles_default, {}),
@@ -12131,7 +12022,7 @@ var PaymentWidget = ({
12131
12022
  submitBtnText,
12132
12023
  submitBtnIcon
12133
12024
  ] }),
12134
- !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 }))
12025
+ !autoTrigger ? /* @__PURE__ */ jsx37(CustomModal2_default, { open: show, onClose: childHandleClose, children: /* @__PURE__ */ jsx37(ModelContentSky_default, __spreadProps(__spreadValues({ isTokenizerReady, show, loadingPrev: loading }, commonProps), { orderGuid, remainingAmount })) }) : /* @__PURE__ */ jsx37(ModelContentSky_default, __spreadProps(__spreadValues({ isTokenizerReady, show, loadingPrev: loading }, commonProps), { orderGuid, remainingAmount }))
12135
12026
  ] });
12136
12027
  };
12137
12028
 
@@ -12497,18 +12388,18 @@ var ApplePayScriptLoader = () => {
12497
12388
  `script[src="https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js"]`
12498
12389
  );
12499
12390
  if (!existingScript) {
12500
- const script2 = document.createElement("script");
12501
- script2.src = "https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js";
12502
- script2.async = true;
12503
- script2.onload = () => {
12391
+ const script = document.createElement("script");
12392
+ script.src = "https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js";
12393
+ script.async = true;
12394
+ script.onload = () => {
12504
12395
  console.log("\u2705 Apple Pay script loaded");
12505
12396
  applePayScriptLoaded = true;
12506
12397
  console.log("ApplePaySession:", window.ApplePaySession);
12507
12398
  };
12508
- script2.onerror = (err) => {
12399
+ script.onerror = (err) => {
12509
12400
  console.error("\u274C Apple Pay script failed", err);
12510
12401
  };
12511
- document.head.appendChild(script2);
12402
+ document.head.appendChild(script);
12512
12403
  } else {
12513
12404
  applePayScriptLoaded = true;
12514
12405
  }
@@ -12548,6 +12439,7 @@ var EmbeddedCheckout = ({
12548
12439
  });
12549
12440
  const [orderGuid, setOrderGuid] = useState13(null);
12550
12441
  const [remainingAmount, setRemainingAmount] = useState13(null);
12442
+ const [isTokenizerReady, setTokenizerReady] = useState13(false);
12551
12443
  const initialCommonProps = useMemo2(
12552
12444
  () => ({
12553
12445
  amount,
@@ -12646,7 +12538,7 @@ var EmbeddedCheckout = ({
12646
12538
  return /* @__PURE__ */ jsxs23(Fragment22, { children: [
12647
12539
  /* @__PURE__ */ jsx39("link", { href: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" }),
12648
12540
  /* @__PURE__ */ jsx39(DataScript, {}),
12649
- /* @__PURE__ */ jsx39(FractalTokenizerScript, {}),
12541
+ /* @__PURE__ */ jsx39(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
12650
12542
  /* @__PURE__ */ jsx39(SkyChargewidgetstyles, {}),
12651
12543
  /* @__PURE__ */ jsx39(CardBankRadioStyles, {}),
12652
12544
  /* @__PURE__ */ jsx39(CustomModal2styles_default, {}),
@@ -12657,7 +12549,7 @@ var EmbeddedCheckout = ({
12657
12549
  submitBtnText,
12658
12550
  submitBtnIcon
12659
12551
  ] }),
12660
- !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 }))
12552
+ !autoTrigger ? /* @__PURE__ */ jsx39(CustomModal2_default, { open: show, onClose: childHandleClose, children: /* @__PURE__ */ jsx39(ModelContentSky_default, __spreadProps(__spreadValues({ isTokenizerReady, onLoad, onSubmit, show, loadingPrev: loading }, commonProps), { orderGuid, remainingAmount })) }) : /* @__PURE__ */ jsx39(ModelContentSky_default, __spreadProps(__spreadValues({ isTokenizerReady, onLoad, onSubmit, show, loadingPrev: loading }, commonProps), { orderGuid, remainingAmount }))
12661
12553
  ] });
12662
12554
  };
12663
12555
  export {