@fractalpay/fractalpay-next-dev 0.0.266 → 0.0.268

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.d.ts CHANGED
@@ -134,8 +134,9 @@ type Props$1 = {
134
134
  isPartial?: boolean;
135
135
  partialRef?: string;
136
136
  customCSS?: string;
137
+ disableSubmitBtn?: boolean;
137
138
  };
138
- declare const PaymentWidget: ({ amount, bankAmount, submitBtnText, session_token, customerId, callback, merchantName, isPreAuth, surcharge, submitBtnClass, submitBtnIcon, isRequest, pass_fee, pass_fee_amount, require3ds, autoTrigger, isPartial, bankSurcharge, partialRef, customCSS }: Props$1) => React.JSX.Element;
139
+ declare const PaymentWidget: ({ amount, bankAmount, submitBtnText, session_token, customerId, callback, merchantName, isPreAuth, surcharge, submitBtnClass, submitBtnIcon, isRequest, pass_fee, pass_fee_amount, require3ds, autoTrigger, isPartial, bankSurcharge, partialRef, customCSS, disableSubmitBtn }: Props$1) => React.JSX.Element;
139
140
 
140
141
  type Props = {
141
142
  session_token: string;
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.266",
42
+ version: "0.0.268",
43
43
  private: false,
44
44
  type: "module",
45
45
  scripts: {
@@ -3573,6 +3573,8 @@ function GetPaymentPage(props) {
3573
3573
  const [saveACHinfo, setSaveACHinfo] = useState4(false);
3574
3574
  const [isBankConsentChecked, setIsBankConsentChecked] = useState4(false);
3575
3575
  const [errorBankConsent, setErrorBankConsent] = useState4("");
3576
+ const [saveACHConsent1, setSaveACHConsent1] = useState4(false);
3577
+ const [errorBankConsentOther, setErrorBankConsentOther] = useState4("");
3576
3578
  const fractalpayClientKey = props.merchantPublicKey;
3577
3579
  let mastercard2 = S3Url + "widget/mc-img.svg";
3578
3580
  let visa2 = S3Url + "widget/visa-img.svg";
@@ -3694,6 +3696,8 @@ function GetPaymentPage(props) {
3694
3696
  setCardList([]);
3695
3697
  setIsBankConsentChecked(false);
3696
3698
  setErrorBankConsent("");
3699
+ setSaveACHConsent1(false);
3700
+ setErrorBankConsentOther("");
3697
3701
  };
3698
3702
  const handleShow = () => setShow(true);
3699
3703
  const handletabchange = (id) => {
@@ -3796,6 +3800,9 @@ function GetPaymentPage(props) {
3796
3800
  if (!isBankConsentChecked) {
3797
3801
  setErrorBankConsent("Above consent is required");
3798
3802
  }
3803
+ if (saveACHinfo && !saveACHConsent1) {
3804
+ setErrorBankConsentOther("Your consent is required to save your bank details for future use");
3805
+ }
3799
3806
  setAchError(errors);
3800
3807
  return Object.keys(errors).length > 0 || !isBankConsentChecked;
3801
3808
  };
@@ -3956,7 +3963,13 @@ function GetPaymentPage(props) {
3956
3963
  }
3957
3964
  }
3958
3965
  } else {
3959
- const hasError = validateAchData();
3966
+ let hasError = validateAchData();
3967
+ if (saveACHinfo && !saveACHConsent1) {
3968
+ hasError = true;
3969
+ }
3970
+ if (!isBankConsentChecked) {
3971
+ hasError = true;
3972
+ }
3960
3973
  if (hasError) return;
3961
3974
  else {
3962
3975
  setLoading2(true);
@@ -4731,14 +4744,31 @@ function GetPaymentPage(props) {
4731
4744
  ] }),
4732
4745
  errorBankConsent && /* @__PURE__ */ jsx19("span", { className: "error-span", children: errorBankConsent }),
4733
4746
  (props == null ? void 0 : props.customerId) && /* @__PURE__ */ jsxs11("div", { className: "form-group mb-4 save-ach-div", style: { paddingTop: "5px" }, children: [
4734
- /* @__PURE__ */ jsx19("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }),
4735
- /* @__PURE__ */ jsx19("label", { htmlFor: "saveACH", children: "Save Bank" })
4747
+ /* @__PURE__ */ jsx19("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => {
4748
+ setSaveACHinfo(e.target.checked);
4749
+ if (!e.target.checked) {
4750
+ setSaveACHConsent1(false);
4751
+ setErrorBankConsentOther("");
4752
+ }
4753
+ } }),
4754
+ /* @__PURE__ */ jsx19("label", { htmlFor: "saveACH", children: "Save for future use" })
4736
4755
  ] }),
4737
- saveACHinfo && /* @__PURE__ */ jsx19("div", { className: "form-group mb-4", style: { fontSize: "12px", color: "#727272" }, children: /* @__PURE__ */ jsxs11("p", { children: [
4738
- "If checked, I agree for ",
4739
- /* @__PURE__ */ jsx19("b", { children: (paymentData == null ? void 0 : paymentData.bname) || "merchant" }),
4740
- " to have my permission to charge this bank account for agreed upon purchases in the future."
4741
- ] }) })
4756
+ saveACHinfo && /* @__PURE__ */ jsxs11(Fragment11, { children: [
4757
+ /* @__PURE__ */ jsxs11("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
4758
+ /* @__PURE__ */ jsx19("input", { type: "checkbox", id: "saveACHConsent1", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHConsent1, onChange: (e) => {
4759
+ setSaveACHConsent1(e.target.checked);
4760
+ if (e.target.checked) {
4761
+ setErrorBankConsentOther("");
4762
+ }
4763
+ } }),
4764
+ /* @__PURE__ */ jsxs11("label", { className: "saveachlabel", htmlFor: "saveACHConsent1", children: [
4765
+ "By providing my bank account information and selecting \u2018Save for future payments\u2019, I authorize ",
4766
+ (paymentData == null ? void 0 : paymentData.bname) || "merchant",
4767
+ " to store my bank account details for future ACH payments. I understand that future payments may be initiated using this saved account in accordance with my instructions. I confirm I am authorized to use this bank account."
4768
+ ] })
4769
+ ] }),
4770
+ errorBankConsentOther && /* @__PURE__ */ jsx19("span", { className: "error-span", children: errorBankConsentOther })
4771
+ ] })
4742
4772
  ] }),
4743
4773
  /* @__PURE__ */ jsx19("div", { className: "form-group ", children: /* @__PURE__ */ jsx19("button", { className: "pay-button", style: { margin: "20px 0 0" }, type: "submit", children: formatUSD((_v = Number(cashDiscount)) == null ? void 0 : _v.toFixed(2)) }) })
4744
4774
  ] })
@@ -7498,6 +7528,8 @@ function PartialPayment(props) {
7498
7528
  const [partialError, setPartialError] = useState8("");
7499
7529
  const [isBankConsentChecked, setIsBankConsentChecked] = useState8(false);
7500
7530
  const [errorBankConsent, setErrorBankConsent] = useState8("");
7531
+ const [saveACHConsent1, setSaveACHConsent1] = useState8(false);
7532
+ const [errorBankConsentOther, setErrorBankConsentOther] = useState8("");
7501
7533
  const tokenizerRef = useRef8(null);
7502
7534
  const fractalStyles = {
7503
7535
  input: {
@@ -7611,6 +7643,8 @@ function PartialPayment(props) {
7611
7643
  setPartialError("");
7612
7644
  setIsBankConsentChecked(false);
7613
7645
  setErrorBankConsent("");
7646
+ setSaveACHConsent1(false);
7647
+ setErrorBankConsentOther("");
7614
7648
  };
7615
7649
  const handleShow = () => setShow(true);
7616
7650
  const handletabchange = (id) => {
@@ -7714,6 +7748,12 @@ function PartialPayment(props) {
7714
7748
  if (!isBankConsentChecked) {
7715
7749
  setErrorBankConsent("Above consent is required");
7716
7750
  }
7751
+ if (!isBankConsentChecked) {
7752
+ setErrorBankConsent("Above consent is required");
7753
+ }
7754
+ if (saveACHinfo && !saveACHConsent1) {
7755
+ setErrorBankConsentOther("Your consent is required to save your bank details for future use");
7756
+ }
7717
7757
  setAchError(errors);
7718
7758
  return Object.keys(errors).length > 0 || !isBankConsentChecked;
7719
7759
  };
@@ -7860,7 +7900,13 @@ function PartialPayment(props) {
7860
7900
  }
7861
7901
  }
7862
7902
  } else {
7863
- const hasError = validateAchData();
7903
+ let hasError = validateAchData();
7904
+ if (saveACHinfo && !saveACHConsent1) {
7905
+ hasError = true;
7906
+ }
7907
+ if (!isBankConsentChecked) {
7908
+ hasError = true;
7909
+ }
7864
7910
  if (hasError) return;
7865
7911
  else {
7866
7912
  setLoading2(true);
@@ -8683,13 +8729,24 @@ function PartialPayment(props) {
8683
8729
  errorBankConsent && /* @__PURE__ */ jsx28("span", { className: "error-span", children: errorBankConsent }),
8684
8730
  (props == null ? void 0 : props.customerId) && /* @__PURE__ */ jsxs17("div", { className: "form-group mb-4 save-ach-div", style: { paddingTop: "5px" }, children: [
8685
8731
  /* @__PURE__ */ jsx28("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }),
8686
- /* @__PURE__ */ jsx28("label", { htmlFor: "saveACH", children: "Save Bank" })
8732
+ /* @__PURE__ */ jsx28("label", { htmlFor: "saveACH", children: "Save for future use" })
8687
8733
  ] }),
8688
- saveACHinfo && /* @__PURE__ */ jsx28("div", { className: "form-group mb-4", style: { fontSize: "12px", color: "#727272" }, children: /* @__PURE__ */ jsxs17("p", { children: [
8689
- "If checked, I agree for ",
8690
- /* @__PURE__ */ jsx28("b", { children: (paymentData == null ? void 0 : paymentData.bname) || "merchant" }),
8691
- " to have my permission to charge this bank account for agreed upon purchases in the future."
8692
- ] }) })
8734
+ saveACHinfo && /* @__PURE__ */ jsxs17(Fragment17, { children: [
8735
+ /* @__PURE__ */ jsxs17("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
8736
+ /* @__PURE__ */ jsx28("input", { type: "checkbox", id: "saveACHConsent1", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHConsent1, onChange: (e) => {
8737
+ setSaveACHConsent1(e.target.checked);
8738
+ if (e.target.checked) {
8739
+ setErrorBankConsentOther("");
8740
+ }
8741
+ } }),
8742
+ /* @__PURE__ */ jsxs17("label", { className: "saveachlabel", htmlFor: "saveACHConsent1", children: [
8743
+ "By providing my bank account information and selecting \u2018Save for future payments\u2019, I authorize ",
8744
+ (paymentData == null ? void 0 : paymentData.bname) || "merchant",
8745
+ " to store my bank account details for future ACH payments. I understand that future payments may be initiated using this saved account in accordance with my instructions. I confirm I am authorized to use this bank account."
8746
+ ] })
8747
+ ] }),
8748
+ errorBankConsentOther && /* @__PURE__ */ jsx28("span", { className: "error-span", children: errorBankConsentOther })
8749
+ ] })
8693
8750
  ] }),
8694
8751
  /* @__PURE__ */ jsx28("div", { className: "form-group ", children: /* @__PURE__ */ jsx28("button", { className: "pay-button", style: { margin: "20px 0 0" }, type: "submit", children: partialAmount && !partialError ? formatUSD((_z = Number(partialAmount)) == null ? void 0 : _z.toFixed(2)) : formatUSD((_A = Number(cashDiscount)) == null ? void 0 : _A.toFixed(2)) }) })
8695
8752
  ] })
@@ -10187,6 +10244,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
10187
10244
  const [achData, setAchData] = useState11();
10188
10245
  const [achError, setAchError] = useState11({});
10189
10246
  const [saveACHinfo, setSaveACHinfo] = useState11(false);
10247
+ const [saveACHConsent1, setSaveACHConsent1] = useState11(false);
10190
10248
  const [saveCardInfo, setSaveCardInfo] = useState11(false);
10191
10249
  const [error, setError] = useState11("");
10192
10250
  const [errorIframe, setErrorIframe] = useState11("");
@@ -10217,6 +10275,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
10217
10275
  const [dcToken, setDCToken] = useState11();
10218
10276
  const [isBankConsentChecked, setIsBankConsentChecked] = useState11(false);
10219
10277
  const [errorBankConsent, setErrorBankConsent] = useState11("");
10278
+ const [errorBankConsentOther, setErrorBankConsentOther] = useState11("");
10220
10279
  let mastercard2 = S3Url + "widget/mc-img.svg";
10221
10280
  let visa2 = S3Url + "widget/visa-img.svg";
10222
10281
  let americanexp2 = S3Url + "widget/ae-img.svg";
@@ -10413,6 +10472,9 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
10413
10472
  if (!isBankConsentChecked) {
10414
10473
  setErrorBankConsent("Above consent is required");
10415
10474
  }
10475
+ if (saveACHinfo && !saveACHConsent1) {
10476
+ setErrorBankConsentOther("Your consent is required to save your bank details for future use");
10477
+ }
10416
10478
  setAchError(errors);
10417
10479
  return Object.keys(errors).length > 0 || !isBankConsentChecked;
10418
10480
  };
@@ -10597,7 +10659,13 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
10597
10659
  let isValid = true;
10598
10660
  if (!isValid) return;
10599
10661
  } else {
10600
- const hasError = validateAchData();
10662
+ let hasError = validateAchData();
10663
+ if (saveACHinfo && !saveACHConsent1) {
10664
+ hasError = true;
10665
+ }
10666
+ if (!isBankConsentChecked) {
10667
+ hasError = true;
10668
+ }
10601
10669
  if (hasError) return;
10602
10670
  }
10603
10671
  try {
@@ -10828,6 +10896,8 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
10828
10896
  setRemainingAmount("");
10829
10897
  setIsBankConsentChecked(false);
10830
10898
  setErrorBankConsent("");
10899
+ setSaveACHConsent1(false);
10900
+ setErrorBankConsentOther("");
10831
10901
  };
10832
10902
  const getCardList = async () => {
10833
10903
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
@@ -11722,14 +11792,31 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
11722
11792
  ] }),
11723
11793
  errorBankConsent && /* @__PURE__ */ jsx36("span", { className: "error-span", children: errorBankConsent }),
11724
11794
  customerId && /* @__PURE__ */ jsxs21("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
11725
- /* @__PURE__ */ jsx36("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }),
11726
- /* @__PURE__ */ jsx36("label", { className: "saveachlabel", htmlFor: "saveACH", children: "Save Bank" })
11795
+ /* @__PURE__ */ jsx36("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => {
11796
+ setSaveACHinfo(e.target.checked);
11797
+ if (!e.target.checked) {
11798
+ setSaveACHConsent1(false);
11799
+ setErrorBankConsentOther("");
11800
+ }
11801
+ } }),
11802
+ /* @__PURE__ */ jsx36("label", { className: "saveachlabel", htmlFor: "saveACH", children: "Save for future use" })
11727
11803
  ] }),
11728
- saveACHinfo && /* @__PURE__ */ jsx36("div", { className: "form-group-frac saveachtext", children: /* @__PURE__ */ jsxs21("p", { children: [
11729
- "If checked, I agree to give the ",
11730
- /* @__PURE__ */ jsx36("b", { children: merchantName || "merchant" }),
11731
- " permission to charge this bank account for agreed-upon purchases in the future."
11732
- ] }) })
11804
+ saveACHinfo && /* @__PURE__ */ jsxs21(Fragment20, { children: [
11805
+ /* @__PURE__ */ jsxs21("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
11806
+ /* @__PURE__ */ jsx36("input", { type: "checkbox", id: "saveACHConsent1", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHConsent1, onChange: (e) => {
11807
+ setSaveACHConsent1(e.target.checked);
11808
+ if (e.target.checked) {
11809
+ setErrorBankConsentOther("");
11810
+ }
11811
+ } }),
11812
+ /* @__PURE__ */ jsxs21("label", { className: "saveachlabel", htmlFor: "saveACHConsent1", children: [
11813
+ "By providing my bank account information and selecting \u2018Save for future payments\u2019, I authorize ",
11814
+ merchantName || "merchant",
11815
+ " to store my bank account details for future ACH payments. I understand that future payments may be initiated using this saved account in accordance with my instructions. I confirm I am authorized to use this bank account."
11816
+ ] })
11817
+ ] }),
11818
+ errorBankConsentOther && /* @__PURE__ */ jsx36("span", { className: "error-span", children: errorBankConsentOther })
11819
+ ] })
11733
11820
  ] })
11734
11821
  ] }),
11735
11822
  /* @__PURE__ */ jsx36("div", { className: "form-group-frac ", children: /* @__PURE__ */ jsx36("button", { className: "pay-button", style: { margin: "20px 0 0", display: onSubmit ? "none" : "block" }, type: "submit", children: formatUSD((_u = Number(bankAmount)) == null ? void 0 : _u.toFixed(2)) }) })
@@ -11768,7 +11855,8 @@ var PaymentWidget = ({
11768
11855
  isPartial,
11769
11856
  bankSurcharge,
11770
11857
  partialRef,
11771
- customCSS: customCSS2
11858
+ customCSS: customCSS2,
11859
+ disableSubmitBtn = false
11772
11860
  }) => {
11773
11861
  const [show, setShow] = useState12(autoTrigger || false);
11774
11862
  const [loading, setLoading] = useState12(false);
@@ -11799,7 +11887,8 @@ var PaymentWidget = ({
11799
11887
  isPartial,
11800
11888
  bankSurcharge,
11801
11889
  partialRef,
11802
- customCSS: customCSS2
11890
+ customCSS: customCSS2,
11891
+ disableSubmitBtn
11803
11892
  }),
11804
11893
  [
11805
11894
  amount,
@@ -11820,7 +11909,8 @@ var PaymentWidget = ({
11820
11909
  autoTrigger,
11821
11910
  isPartial,
11822
11911
  bankSurcharge,
11823
- partialRef
11912
+ partialRef,
11913
+ disableSubmitBtn
11824
11914
  ]
11825
11915
  );
11826
11916
  const [commonProps, setCommonProps] = useState12(initialCommonProps);
@@ -11868,7 +11958,7 @@ var PaymentWidget = ({
11868
11958
  /* @__PURE__ */ jsx37(CardBankRadioStyles, {}),
11869
11959
  /* @__PURE__ */ jsx37(CustomModal2styles_default, {}),
11870
11960
  /* @__PURE__ */ jsx37(DataCapScriptLoader, {}),
11871
- !autoTrigger && /* @__PURE__ */ jsxs22("button", { className: submitBtnClass || "paymentBtn", onClick: () => setShow(true), children: [
11961
+ !autoTrigger && /* @__PURE__ */ jsxs22("button", { className: submitBtnClass || "paymentBtn", disabled: disableSubmitBtn, onClick: () => setShow(true), children: [
11872
11962
  submitBtnText,
11873
11963
  submitBtnIcon
11874
11964
  ] }),