@pinerohit11/testwidget 0.1.84 → 0.1.86

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
@@ -1940,7 +1940,7 @@ function GetPaymentPage(props) {
1940
1940
  return Object.keys(errors).length > 0;
1941
1941
  };
1942
1942
  const validateAchData = () => {
1943
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
1943
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i;
1944
1944
  const errors = {};
1945
1945
  const data = achData;
1946
1946
  if (!((_a2 = data == null ? void 0 : data.name) == null ? void 0 : _a2.trim())) errors.name = "Name is required";
@@ -1949,7 +1949,7 @@ function GetPaymentPage(props) {
1949
1949
  if (!((_f2 = data == null ? void 0 : data.bankName) == null ? void 0 : _f2.trim())) errors.bankName = "Bank name is required";
1950
1950
  if (!((_g2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _g2.trim())) errors.routingNumber = "Routing Number is required";
1951
1951
  if ((data == null ? void 0 : data.routingNumber) && ((_h2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _h2.length) !== 9) errors.routingNumber = "Routing number must be 9 digits";
1952
- if ((data == null ? void 0 : data.routingNumber.length) == 9) {
1952
+ if (((_i = data == null ? void 0 : data.routingNumber) == null ? void 0 : _i.length) == 9) {
1953
1953
  let routingNumber = data == null ? void 0 : data.routingNumber;
1954
1954
  const weights = [3, 7, 1];
1955
1955
  let sum = 0;
@@ -1965,6 +1965,7 @@ function GetPaymentPage(props) {
1965
1965
  return Object.keys(errors).length > 0;
1966
1966
  };
1967
1967
  const submitFunc = async (e) => {
1968
+ var _a2, _b2, _c2, _d2, _e2;
1968
1969
  e.preventDefault();
1969
1970
  if (activetab !== "ach") {
1970
1971
  const hasError = validateCardData();
@@ -2037,6 +2038,40 @@ function GetPaymentPage(props) {
2037
2038
  if (hasError) return;
2038
2039
  else {
2039
2040
  console.log(achData);
2041
+ let dataForm = {
2042
+ fractalpayPublicKey: fractalpayClientKey,
2043
+ label: (achData == null ? void 0 : achData.name) || "John Doe",
2044
+ account_number: achData == null ? void 0 : achData.accountNumber,
2045
+ routing_number: achData == null ? void 0 : achData.routingNumber,
2046
+ bank_name: achData == null ? void 0 : achData.bankName,
2047
+ account_type: achData == null ? void 0 : achData.accountType,
2048
+ amount: props.amount || 0,
2049
+ isSaveAch: saveACHinfo,
2050
+ customer_id: props == null ? void 0 : props.customerId,
2051
+ order_id: props == null ? void 0 : props.orderID,
2052
+ tax: props == null ? void 0 : props.tax,
2053
+ discount: props == null ? void 0 : props.discount,
2054
+ surcharge: props == null ? void 0 : props.surcharge
2055
+ };
2056
+ showLoader();
2057
+ try {
2058
+ let result = await import_axios3.default.post(`${baseUrl}ach-incoming`, dataForm);
2059
+ hideLoader();
2060
+ console.log(result);
2061
+ import_sweetalert2.default.fire({
2062
+ icon: "success",
2063
+ title: "Congrats...",
2064
+ text: (_a2 = result == null ? void 0 : result.data) == null ? void 0 : _a2.message
2065
+ });
2066
+ } catch (error) {
2067
+ if (import_axios3.default.isAxiosError(error)) {
2068
+ console.log(error);
2069
+ hideLoader();
2070
+ showError((_e2 = (_d2 = (_c2 = (_b2 = error.response) == null ? void 0 : _b2.data) == null ? void 0 : _c2.message) == null ? void 0 : _d2.error) != null ? _e2 : "Something went wrong");
2071
+ } else {
2072
+ console.error("Unexpected error", error);
2073
+ }
2074
+ }
2040
2075
  }
2041
2076
  }
2042
2077
  };
@@ -2172,7 +2207,7 @@ function GetPaymentPage(props) {
2172
2207
  value: (_g = achData == null ? void 0 : achData.bankName) != null ? _g : "",
2173
2208
  onChange: handleChangeAch
2174
2209
  }
2175
- ), (achError == null ? void 0 : achError.bankName) && /* @__PURE__ */ import_react11.default.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.bankName)), /* @__PURE__ */ import_react11.default.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ import_react11.default.createElement("label", { htmlFor: "accounttype" }, "Select account type"), /* @__PURE__ */ import_react11.default.createElement("select", { name: "accounttype", id: "accounttype", className: "form-control", value: (_h = achData == null ? void 0 : achData.accountType) != null ? _h : "", onChange: handleChangeAch }, /* @__PURE__ */ import_react11.default.createElement("option", { value: "" }, "Select account"), /* @__PURE__ */ import_react11.default.createElement("option", { value: "Personal Saving" }, "Personal Saving"), /* @__PURE__ */ import_react11.default.createElement("option", { value: "Business Saving" }, "Business Saving"), /* @__PURE__ */ import_react11.default.createElement("option", { value: "Personal Checking" }, "Personal Checking"), /* @__PURE__ */ import_react11.default.createElement("option", { value: "Business Checking" }, "Business Checking"))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "form-group mb-4", style: { paddingTop: "5px" } }, /* @__PURE__ */ import_react11.default.createElement("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }), /* @__PURE__ */ import_react11.default.createElement("label", { htmlFor: "saveACH" }, "Save ACH")), saveACHinfo && /* @__PURE__ */ import_react11.default.createElement("div", { className: "form-group mb-4", style: { fontSize: "12px", color: "#727272" } }, /* @__PURE__ */ import_react11.default.createElement("p", null, "If checked, I agree for ", /* @__PURE__ */ import_react11.default.createElement("b", null, "ecommerce"), " to have my permission to charge this credit card for agreed upon purchases in the future."))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "form-group", style: { marginTop: "30px" } }, /* @__PURE__ */ import_react11.default.createElement("button", { className: "pay-button", type: "submit" }, "$1.35"))))))))))
2210
+ ), (achError == null ? void 0 : achError.bankName) && /* @__PURE__ */ import_react11.default.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.bankName)), /* @__PURE__ */ import_react11.default.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ import_react11.default.createElement("label", { htmlFor: "accounttype" }, "Select account type"), /* @__PURE__ */ import_react11.default.createElement("select", { name: "accountType", id: "accounttype", className: "form-control", value: (_h = achData == null ? void 0 : achData.accountType) != null ? _h : "", onChange: handleChangeAch }, /* @__PURE__ */ import_react11.default.createElement("option", { value: "" }, "Select account"), /* @__PURE__ */ import_react11.default.createElement("option", { value: "Personal Saving" }, "Personal Saving"), /* @__PURE__ */ import_react11.default.createElement("option", { value: "Business Saving" }, "Business Saving"), /* @__PURE__ */ import_react11.default.createElement("option", { value: "Personal Checking" }, "Personal Checking"), /* @__PURE__ */ import_react11.default.createElement("option", { value: "Business Checking" }, "Business Checking"))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "form-group mb-4", style: { paddingTop: "5px" } }, /* @__PURE__ */ import_react11.default.createElement("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }), /* @__PURE__ */ import_react11.default.createElement("label", { htmlFor: "saveACH" }, "Save ACH")), saveACHinfo && /* @__PURE__ */ import_react11.default.createElement("div", { className: "form-group mb-4", style: { fontSize: "12px", color: "#727272" } }, /* @__PURE__ */ import_react11.default.createElement("p", null, "If checked, I agree for ", /* @__PURE__ */ import_react11.default.createElement("b", null, "ecommerce"), " to have my permission to charge this credit card for agreed upon purchases in the future."))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "form-group", style: { marginTop: "30px" } }, /* @__PURE__ */ import_react11.default.createElement("button", { className: "pay-button", type: "submit" }, "$1.35"))))))))))
2176
2211
  )));
2177
2212
  }
2178
2213
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -1905,7 +1905,7 @@ function GetPaymentPage(props) {
1905
1905
  return Object.keys(errors).length > 0;
1906
1906
  };
1907
1907
  const validateAchData = () => {
1908
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
1908
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i;
1909
1909
  const errors = {};
1910
1910
  const data = achData;
1911
1911
  if (!((_a2 = data == null ? void 0 : data.name) == null ? void 0 : _a2.trim())) errors.name = "Name is required";
@@ -1914,7 +1914,7 @@ function GetPaymentPage(props) {
1914
1914
  if (!((_f2 = data == null ? void 0 : data.bankName) == null ? void 0 : _f2.trim())) errors.bankName = "Bank name is required";
1915
1915
  if (!((_g2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _g2.trim())) errors.routingNumber = "Routing Number is required";
1916
1916
  if ((data == null ? void 0 : data.routingNumber) && ((_h2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _h2.length) !== 9) errors.routingNumber = "Routing number must be 9 digits";
1917
- if ((data == null ? void 0 : data.routingNumber.length) == 9) {
1917
+ if (((_i = data == null ? void 0 : data.routingNumber) == null ? void 0 : _i.length) == 9) {
1918
1918
  let routingNumber = data == null ? void 0 : data.routingNumber;
1919
1919
  const weights = [3, 7, 1];
1920
1920
  let sum = 0;
@@ -1930,6 +1930,7 @@ function GetPaymentPage(props) {
1930
1930
  return Object.keys(errors).length > 0;
1931
1931
  };
1932
1932
  const submitFunc = async (e) => {
1933
+ var _a2, _b2, _c2, _d2, _e2;
1933
1934
  e.preventDefault();
1934
1935
  if (activetab !== "ach") {
1935
1936
  const hasError = validateCardData();
@@ -2002,6 +2003,40 @@ function GetPaymentPage(props) {
2002
2003
  if (hasError) return;
2003
2004
  else {
2004
2005
  console.log(achData);
2006
+ let dataForm = {
2007
+ fractalpayPublicKey: fractalpayClientKey,
2008
+ label: (achData == null ? void 0 : achData.name) || "John Doe",
2009
+ account_number: achData == null ? void 0 : achData.accountNumber,
2010
+ routing_number: achData == null ? void 0 : achData.routingNumber,
2011
+ bank_name: achData == null ? void 0 : achData.bankName,
2012
+ account_type: achData == null ? void 0 : achData.accountType,
2013
+ amount: props.amount || 0,
2014
+ isSaveAch: saveACHinfo,
2015
+ customer_id: props == null ? void 0 : props.customerId,
2016
+ order_id: props == null ? void 0 : props.orderID,
2017
+ tax: props == null ? void 0 : props.tax,
2018
+ discount: props == null ? void 0 : props.discount,
2019
+ surcharge: props == null ? void 0 : props.surcharge
2020
+ };
2021
+ showLoader();
2022
+ try {
2023
+ let result = await axios3.post(`${baseUrl}ach-incoming`, dataForm);
2024
+ hideLoader();
2025
+ console.log(result);
2026
+ Swal.fire({
2027
+ icon: "success",
2028
+ title: "Congrats...",
2029
+ text: (_a2 = result == null ? void 0 : result.data) == null ? void 0 : _a2.message
2030
+ });
2031
+ } catch (error) {
2032
+ if (axios3.isAxiosError(error)) {
2033
+ console.log(error);
2034
+ hideLoader();
2035
+ showError((_e2 = (_d2 = (_c2 = (_b2 = error.response) == null ? void 0 : _b2.data) == null ? void 0 : _c2.message) == null ? void 0 : _d2.error) != null ? _e2 : "Something went wrong");
2036
+ } else {
2037
+ console.error("Unexpected error", error);
2038
+ }
2039
+ }
2005
2040
  }
2006
2041
  }
2007
2042
  };
@@ -2137,7 +2172,7 @@ function GetPaymentPage(props) {
2137
2172
  value: (_g = achData == null ? void 0 : achData.bankName) != null ? _g : "",
2138
2173
  onChange: handleChangeAch
2139
2174
  }
2140
- ), (achError == null ? void 0 : achError.bankName) && /* @__PURE__ */ React11.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.bankName)), /* @__PURE__ */ React11.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "accounttype" }, "Select account type"), /* @__PURE__ */ React11.createElement("select", { name: "accounttype", id: "accounttype", className: "form-control", value: (_h = achData == null ? void 0 : achData.accountType) != null ? _h : "", onChange: handleChangeAch }, /* @__PURE__ */ React11.createElement("option", { value: "" }, "Select account"), /* @__PURE__ */ React11.createElement("option", { value: "Personal Saving" }, "Personal Saving"), /* @__PURE__ */ React11.createElement("option", { value: "Business Saving" }, "Business Saving"), /* @__PURE__ */ React11.createElement("option", { value: "Personal Checking" }, "Personal Checking"), /* @__PURE__ */ React11.createElement("option", { value: "Business Checking" }, "Business Checking"))), /* @__PURE__ */ React11.createElement("div", { className: "form-group mb-4", style: { paddingTop: "5px" } }, /* @__PURE__ */ React11.createElement("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }), /* @__PURE__ */ React11.createElement("label", { htmlFor: "saveACH" }, "Save ACH")), saveACHinfo && /* @__PURE__ */ React11.createElement("div", { className: "form-group mb-4", style: { fontSize: "12px", color: "#727272" } }, /* @__PURE__ */ React11.createElement("p", null, "If checked, I agree for ", /* @__PURE__ */ React11.createElement("b", null, "ecommerce"), " to have my permission to charge this credit card for agreed upon purchases in the future."))), /* @__PURE__ */ React11.createElement("div", { className: "form-group", style: { marginTop: "30px" } }, /* @__PURE__ */ React11.createElement("button", { className: "pay-button", type: "submit" }, "$1.35"))))))))))
2175
+ ), (achError == null ? void 0 : achError.bankName) && /* @__PURE__ */ React11.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.bankName)), /* @__PURE__ */ React11.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "accounttype" }, "Select account type"), /* @__PURE__ */ React11.createElement("select", { name: "accountType", id: "accounttype", className: "form-control", value: (_h = achData == null ? void 0 : achData.accountType) != null ? _h : "", onChange: handleChangeAch }, /* @__PURE__ */ React11.createElement("option", { value: "" }, "Select account"), /* @__PURE__ */ React11.createElement("option", { value: "Personal Saving" }, "Personal Saving"), /* @__PURE__ */ React11.createElement("option", { value: "Business Saving" }, "Business Saving"), /* @__PURE__ */ React11.createElement("option", { value: "Personal Checking" }, "Personal Checking"), /* @__PURE__ */ React11.createElement("option", { value: "Business Checking" }, "Business Checking"))), /* @__PURE__ */ React11.createElement("div", { className: "form-group mb-4", style: { paddingTop: "5px" } }, /* @__PURE__ */ React11.createElement("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }), /* @__PURE__ */ React11.createElement("label", { htmlFor: "saveACH" }, "Save ACH")), saveACHinfo && /* @__PURE__ */ React11.createElement("div", { className: "form-group mb-4", style: { fontSize: "12px", color: "#727272" } }, /* @__PURE__ */ React11.createElement("p", null, "If checked, I agree for ", /* @__PURE__ */ React11.createElement("b", null, "ecommerce"), " to have my permission to charge this credit card for agreed upon purchases in the future."))), /* @__PURE__ */ React11.createElement("div", { className: "form-group", style: { marginTop: "30px" } }, /* @__PURE__ */ React11.createElement("button", { className: "pay-button", type: "submit" }, "$1.35"))))))))))
2141
2176
  )));
2142
2177
  }
2143
2178
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinerohit11/testwidget",
3
- "version": "0.1.84",
3
+ "version": "0.1.86",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "next dev -p 4001",