@pinerohit11/testwidget 0.2.95 → 0.2.98

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
@@ -2547,7 +2547,7 @@ function GetPaymentPage(props) {
2547
2547
  }
2548
2548
  };
2549
2549
  const getPaymentDetails = async () => {
2550
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
2550
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k;
2551
2551
  showLoader();
2552
2552
  try {
2553
2553
  const data = {
@@ -2559,6 +2559,10 @@ function GetPaymentPage(props) {
2559
2559
  if (((_c2 = (_b2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.card_list) && ((_f2 = (_e2 = (_d2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d2.data) == null ? void 0 : _e2.card_list) == null ? void 0 : _f2.length) > 0) {
2560
2560
  setCardList((_h2 = (_g2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _g2.data) == null ? void 0 : _h2.card_list);
2561
2561
  setActive("cardList");
2562
+ let primary_card = (_k = (_j2 = (_i2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _i2.data) == null ? void 0 : _j2.card_list) == null ? void 0 : _k.filter((card) => (card == null ? void 0 : card.primary_card) == 1);
2563
+ if (primary_card == null ? void 0 : primary_card[0]) {
2564
+ setSelectedCard(primary_card[0]);
2565
+ }
2562
2566
  } else {
2563
2567
  setActive("card");
2564
2568
  }
@@ -2720,7 +2724,7 @@ function GetPaymentPage(props) {
2720
2724
  checked: selectedCard === card,
2721
2725
  onChange: (e) => setSelectedCard(card)
2722
2726
  }
2723
- ), /* @__PURE__ */ import_react12.default.createElement("label", { htmlFor: "", className: "card-number-last-four" }, "**** ", card == null ? void 0 : card.cardlastfourdigit), /* @__PURE__ */ import_react12.default.createElement("h6", { className: "card-expiry-date" }, card == null ? void 0 : card.expmonth, "/", card == null ? void 0 : card.expyear)), /* @__PURE__ */ import_react12.default.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "visa-card" }, /* @__PURE__ */ import_react12.default.createElement("img", { src: (card == null ? void 0 : card.card_type) != "Bank" ? "https://dev-widget.fractalpay.com/images/visa-img.svg" : "https://dev-widget.fractalpay.com/images/bank.svg", alt: "" })), /* @__PURE__ */ import_react12.default.createElement("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id) }, /* @__PURE__ */ import_react12.default.createElement("img", { src: "https://dev-widget.fractalpay.com/images/Trash.svg", alt: "" }))))))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "pay-with-other-card ", onClick: () => setActive("card") }, "Pay With Other Card", /* @__PURE__ */ import_react12.default.createElement("img", { src: "https://dev-widget.fractalpay.com/images/card.svg", alt: "" }))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "form-group", style: { padding: "0" } }, /* @__PURE__ */ import_react12.default.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer }, "$", props == null ? void 0 : props.amount))), /* @__PURE__ */ import_react12.default.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ import_react12.default.createElement("form", { id: "PaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ach-scrl", style: { minHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "398px" : (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) == 0 ? "436px" : (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px", overflow: "auto", marginRight: "5px" } }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react12.default.createElement("label", { htmlFor: "cardHolderName" }, "NAME ON CARD "), /* @__PURE__ */ import_react12.default.createElement("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
2727
+ ), /* @__PURE__ */ import_react12.default.createElement("label", { htmlFor: "", className: "card-number-last-four" }, "**** ", card == null ? void 0 : card.cardlastfourdigit), /* @__PURE__ */ import_react12.default.createElement("h6", { className: "card-expiry-date" }, card == null ? void 0 : card.expmonth, "/", card == null ? void 0 : card.expyear)), /* @__PURE__ */ import_react12.default.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "visa-card" }, /* @__PURE__ */ import_react12.default.createElement("img", { src: (card == null ? void 0 : card.card_type) != "Bank" ? "https://dev-widget.fractalpay.com/images/visa-img.svg" : "https://dev-widget.fractalpay.com/images/bank.svg", alt: "" })), /* @__PURE__ */ import_react12.default.createElement("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id) }, /* @__PURE__ */ import_react12.default.createElement("img", { src: "https://dev-widget.fractalpay.com/images/Trash.svg", alt: "" }))))))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "pay-with-other-card ", onClick: () => setActive("card") }, "Pay With Other Card", /* @__PURE__ */ import_react12.default.createElement("img", { src: "https://dev-widget.fractalpay.com/images/card.svg", alt: "" }))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "form-group", style: { padding: "0" } }, /* @__PURE__ */ import_react12.default.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer }, "$", props == null ? void 0 : props.amount))), /* @__PURE__ */ import_react12.default.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ import_react12.default.createElement("form", { id: "PaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "ach-scrl", style: { minHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "398px" : (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) == 0 ? "456px" : (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px", overflow: "auto", marginRight: "5px" } }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react12.default.createElement("label", { htmlFor: "cardHolderName" }, "NAME ON CARD "), /* @__PURE__ */ import_react12.default.createElement("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
2724
2728
  const value = e.target.value;
2725
2729
  if (/^[a-zA-Z\s]*$/.test(value)) {
2726
2730
  handleCardChange("cardName", value);
@@ -3004,7 +3008,7 @@ function PreAuthPayment(props) {
3004
3008
  showLoader();
3005
3009
  try {
3006
3010
  let tokenCallback = async function(response) {
3007
- var _a3, _b3, _c3;
3011
+ var _a3, _b3, _c3, _d3;
3008
3012
  if (response.Error) {
3009
3013
  showError(response.Error);
3010
3014
  hideLoader();
@@ -3032,13 +3036,14 @@ function PreAuthPayment(props) {
3032
3036
  orderId: "",
3033
3037
  zipCode: ""
3034
3038
  });
3039
+ console.log(apiResponse, "+++++++++++++++");
3035
3040
  setSuccess(true);
3036
- setTranId((_a3 = apiResponse == null ? void 0 : apiResponse.data) == null ? void 0 : _a3.transactionId);
3041
+ setTranId((_b3 = (_a3 = apiResponse == null ? void 0 : apiResponse.data) == null ? void 0 : _a3.data) == null ? void 0 : _b3.transaction_id);
3037
3042
  hideLoader();
3038
3043
  } catch (err) {
3039
3044
  console.log(err);
3040
3045
  hideLoader();
3041
- showError(((_c3 = (_b3 = err == null ? void 0 : err.response) == null ? void 0 : _b3.data) == null ? void 0 : _c3.message) || (err == null ? void 0 : err.message) || "Something went wrong..");
3046
+ showError(((_d3 = (_c3 = err == null ? void 0 : err.response) == null ? void 0 : _c3.data) == null ? void 0 : _d3.message) || (err == null ? void 0 : err.message) || "Something went wrong..");
3042
3047
  }
3043
3048
  }
3044
3049
  };
@@ -3105,6 +3110,7 @@ function PreAuthPayment(props) {
3105
3110
  headers: myHeaders2
3106
3111
  }
3107
3112
  );
3113
+ console.log(paymentRes);
3108
3114
  if ((_n = paymentRes == null ? void 0 : paymentRes.data) == null ? void 0 : _n.result) {
3109
3115
  setTranId((_p = (_o = paymentRes == null ? void 0 : paymentRes.data) == null ? void 0 : _o.data) == null ? void 0 : _p.transaction_id);
3110
3116
  setSuccess(true);
@@ -3135,7 +3141,7 @@ function PreAuthPayment(props) {
3135
3141
  }
3136
3142
  };
3137
3143
  const getPaymentDetails = async () => {
3138
- var _a2, _b2, _c2, _d2, _e, _f, _g, _h;
3144
+ var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k;
3139
3145
  showLoader();
3140
3146
  try {
3141
3147
  const data = {
@@ -3148,6 +3154,10 @@ function PreAuthPayment(props) {
3148
3154
  if (((_c2 = (_b2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.card_list) && ((_f = (_e = (_d2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d2.data) == null ? void 0 : _e.card_list) == null ? void 0 : _f.length) > 0) {
3149
3155
  setCardList((_h = (_g = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _g.data) == null ? void 0 : _h.card_list);
3150
3156
  setActive("cardList");
3157
+ let primary_card = (_k = (_j = (_i = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _i.data) == null ? void 0 : _j.card_list) == null ? void 0 : _k.filter((card) => (card == null ? void 0 : card.primary_card) == 1);
3158
+ if (primary_card == null ? void 0 : primary_card[0]) {
3159
+ setSelectedCard(primary_card[0]);
3160
+ }
3151
3161
  } else {
3152
3162
  setActive("card");
3153
3163
  }
@@ -3292,7 +3302,7 @@ function PreAuthPayment(props) {
3292
3302
  checked: selectedCard === card,
3293
3303
  onChange: (e) => setSelectedCard(card)
3294
3304
  }
3295
- ), /* @__PURE__ */ import_react13.default.createElement("label", { htmlFor: "", className: "card-number-last-four" }, "**** ", card == null ? void 0 : card.cardlastfourdigit), /* @__PURE__ */ import_react13.default.createElement("h6", { className: "card-expiry-date" }, card == null ? void 0 : card.expmonth, "/", card == null ? void 0 : card.expyear)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ import_react13.default.createElement("span", { className: "visa-card" }, /* @__PURE__ */ import_react13.default.createElement("img", { src: (card == null ? void 0 : card.card_type) != "Bank" ? "https://dev-widget.fractalpay.com/images/visa-img.svg" : "https://dev-widget.fractalpay.com/images/bank.svg", alt: "" })), /* @__PURE__ */ import_react13.default.createElement("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id) }, /* @__PURE__ */ import_react13.default.createElement("img", { src: "https://dev-widget.fractalpay.com/images/Trash.svg", alt: "" }))))))), /* @__PURE__ */ import_react13.default.createElement("div", { className: "pay-with-other-card ", onClick: () => setActive("card") }, "Authorize With Other Card", /* @__PURE__ */ import_react13.default.createElement("img", { src: "https://dev-widget.fractalpay.com/images/card.svg", alt: "" }))), /* @__PURE__ */ import_react13.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react13.default.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer }, "$", props == null ? void 0 : props.amount))), /* @__PURE__ */ import_react13.default.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ import_react13.default.createElement("form", { id: "PaymentForm", onSubmit: submitFunc }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "ach-scrl", style: { minHeight: (cardList == null ? void 0 : cardList.length) > 0 ? "442px" : "500px", overflow: "auto", marginRight: "5px" } }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react13.default.createElement("label", { htmlFor: "cardHolderName" }, "Name on Card"), /* @__PURE__ */ import_react13.default.createElement(
3305
+ ), /* @__PURE__ */ import_react13.default.createElement("label", { htmlFor: "", className: "card-number-last-four" }, "**** ", card == null ? void 0 : card.cardlastfourdigit), /* @__PURE__ */ import_react13.default.createElement("h6", { className: "card-expiry-date" }, card == null ? void 0 : card.expmonth, "/", card == null ? void 0 : card.expyear)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ import_react13.default.createElement("span", { className: "visa-card" }, /* @__PURE__ */ import_react13.default.createElement("img", { src: (card == null ? void 0 : card.card_type) != "Bank" ? "https://dev-widget.fractalpay.com/images/visa-img.svg" : "https://dev-widget.fractalpay.com/images/bank.svg", alt: "" })), /* @__PURE__ */ import_react13.default.createElement("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id) }, /* @__PURE__ */ import_react13.default.createElement("img", { src: "https://dev-widget.fractalpay.com/images/Trash.svg", alt: "" }))))))), /* @__PURE__ */ import_react13.default.createElement("div", { className: "pay-with-other-card ", onClick: () => setActive("card") }, "Authorize With Other Card", /* @__PURE__ */ import_react13.default.createElement("img", { src: "https://dev-widget.fractalpay.com/images/card.svg", alt: "" }))), /* @__PURE__ */ import_react13.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react13.default.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer }, "$", props == null ? void 0 : props.amount))), /* @__PURE__ */ import_react13.default.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ import_react13.default.createElement("form", { id: "PaymentForm", onSubmit: submitFunc }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "ach-scrl", style: { minHeight: (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px", overflow: "auto", marginRight: "5px" } }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react13.default.createElement("label", { htmlFor: "cardHolderName" }, "Name on Card"), /* @__PURE__ */ import_react13.default.createElement(
3296
3306
  "input",
3297
3307
  {
3298
3308
  type: "text",
@@ -3904,6 +3914,7 @@ function AddCard(props) {
3904
3914
  }, [props == null ? void 0 : props.fractalpayClientKey, show]);
3905
3915
  const addCardFunc = async (e) => {
3906
3916
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
3917
+ console.log("called");
3907
3918
  e.preventDefault();
3908
3919
  const hasError = validateCardData();
3909
3920
  if (hasError) return;
@@ -4058,10 +4069,10 @@ function AddCard(props) {
4058
4069
  success ? /* @__PURE__ */ import_react18.default.createElement(SuccessCardMsz_default, { onClose: handleClose }) : /* @__PURE__ */ import_react18.default.createElement(
4059
4070
  "div",
4060
4071
  {
4061
- className: "container-creditcard add-card modal-content frac-form",
4072
+ className: "container-creditcard add-card modal-content ",
4062
4073
  id: "add-credit-card-panel"
4063
4074
  },
4064
- /* @__PURE__ */ import_react18.default.createElement("form", { id: "creditCardForm", onSubmit: addCardFunc }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ import_react18.default.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ import_react18.default.createElement(
4075
+ /* @__PURE__ */ import_react18.default.createElement("form", { id: "creditCardForm", onSubmit: addCardFunc }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ import_react18.default.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ import_react18.default.createElement(
4065
4076
  "input",
4066
4077
  {
4067
4078
  type: "text",
@@ -4072,7 +4083,7 @@ function AddCard(props) {
4072
4083
  value: (cardData == null ? void 0 : cardData.cardNumber) || "",
4073
4084
  onChange: (e) => handleCardNumberChange(e)
4074
4085
  }
4075
- ), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ import_react18.default.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardNumber), /* @__PURE__ */ import_react18.default.createElement("br", null)), /* @__PURE__ */ import_react18.default.createElement("div", { className: "card-dtl" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "exp-cvc-container" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react18.default.createElement("label", { htmlFor: "expMonth" }, "MM"), /* @__PURE__ */ import_react18.default.createElement(
4086
+ ), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ import_react18.default.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardNumber)), /* @__PURE__ */ import_react18.default.createElement("div", { className: "card-dtl" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "exp-cvc-container" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ import_react18.default.createElement("label", { htmlFor: "expMonth" }, "MM"), /* @__PURE__ */ import_react18.default.createElement(
4076
4087
  "input",
4077
4088
  {
4078
4089
  "data-token": "exp_month",
@@ -4083,7 +4094,7 @@ function AddCard(props) {
4083
4094
  value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
4084
4095
  onChange: (e) => handleCardChange("expiryMonth", e.target.value)
4085
4096
  }
4086
- ), (cardError == null ? void 0 : cardError.expiryMonth) && /* @__PURE__ */ import_react18.default.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryMonth)), /* @__PURE__ */ import_react18.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react18.default.createElement("label", { htmlFor: "expYear" }, "YYYY"), /* @__PURE__ */ import_react18.default.createElement(
4097
+ ), (cardError == null ? void 0 : cardError.expiryMonth) && /* @__PURE__ */ import_react18.default.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryMonth)), /* @__PURE__ */ import_react18.default.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ import_react18.default.createElement("label", { htmlFor: "expYear" }, "YYYY"), /* @__PURE__ */ import_react18.default.createElement(
4087
4098
  "input",
4088
4099
  {
4089
4100
  "data-token": "exp_year",
@@ -4094,7 +4105,7 @@ function AddCard(props) {
4094
4105
  value: (cardData == null ? void 0 : cardData.expiryYear) || "",
4095
4106
  onChange: (e) => handleCardChange("expiryYear", e.target.value)
4096
4107
  }
4097
- ), (cardError == null ? void 0 : cardError.expiryYear) && /* @__PURE__ */ import_react18.default.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryYear)), /* @__PURE__ */ import_react18.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react18.default.createElement("label", { htmlFor: "cvc" }, "CVC"), /* @__PURE__ */ import_react18.default.createElement(
4108
+ ), (cardError == null ? void 0 : cardError.expiryYear) && /* @__PURE__ */ import_react18.default.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryYear)), /* @__PURE__ */ import_react18.default.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ import_react18.default.createElement("label", { htmlFor: "cvc" }, "CVC"), /* @__PURE__ */ import_react18.default.createElement(
4098
4109
  "input",
4099
4110
  {
4100
4111
  "data-token": "cvv",
@@ -4105,7 +4116,7 @@ function AddCard(props) {
4105
4116
  value: (cardData == null ? void 0 : cardData.cvv) || "",
4106
4117
  onChange: (e) => handleCardChange("cvv", e.target.value)
4107
4118
  }
4108
- ), (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ import_react18.default.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ import_react18.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react18.default.createElement("label", { htmlFor: "cardholderName" }, "Name on card"), /* @__PURE__ */ import_react18.default.createElement(
4119
+ ), (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ import_react18.default.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ import_react18.default.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ import_react18.default.createElement("label", { htmlFor: "cardholderName" }, "Name on card"), /* @__PURE__ */ import_react18.default.createElement(
4109
4120
  "input",
4110
4121
  {
4111
4122
  type: "text",
package/dist/index.mjs CHANGED
@@ -2509,7 +2509,7 @@ function GetPaymentPage(props) {
2509
2509
  }
2510
2510
  };
2511
2511
  const getPaymentDetails = async () => {
2512
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
2512
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k;
2513
2513
  showLoader();
2514
2514
  try {
2515
2515
  const data = {
@@ -2521,6 +2521,10 @@ function GetPaymentPage(props) {
2521
2521
  if (((_c2 = (_b2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.card_list) && ((_f2 = (_e2 = (_d2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d2.data) == null ? void 0 : _e2.card_list) == null ? void 0 : _f2.length) > 0) {
2522
2522
  setCardList((_h2 = (_g2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _g2.data) == null ? void 0 : _h2.card_list);
2523
2523
  setActive("cardList");
2524
+ let primary_card = (_k = (_j2 = (_i2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _i2.data) == null ? void 0 : _j2.card_list) == null ? void 0 : _k.filter((card) => (card == null ? void 0 : card.primary_card) == 1);
2525
+ if (primary_card == null ? void 0 : primary_card[0]) {
2526
+ setSelectedCard(primary_card[0]);
2527
+ }
2524
2528
  } else {
2525
2529
  setActive("card");
2526
2530
  }
@@ -2682,7 +2686,7 @@ function GetPaymentPage(props) {
2682
2686
  checked: selectedCard === card,
2683
2687
  onChange: (e) => setSelectedCard(card)
2684
2688
  }
2685
- ), /* @__PURE__ */ React11.createElement("label", { htmlFor: "", className: "card-number-last-four" }, "**** ", card == null ? void 0 : card.cardlastfourdigit), /* @__PURE__ */ React11.createElement("h6", { className: "card-expiry-date" }, card == null ? void 0 : card.expmonth, "/", card == null ? void 0 : card.expyear)), /* @__PURE__ */ React11.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React11.createElement("span", { className: "visa-card" }, /* @__PURE__ */ React11.createElement("img", { src: (card == null ? void 0 : card.card_type) != "Bank" ? "https://dev-widget.fractalpay.com/images/visa-img.svg" : "https://dev-widget.fractalpay.com/images/bank.svg", alt: "" })), /* @__PURE__ */ React11.createElement("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id) }, /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/Trash.svg", alt: "" }))))))), /* @__PURE__ */ React11.createElement("div", { className: "pay-with-other-card ", onClick: () => setActive("card") }, "Pay With Other Card", /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/card.svg", alt: "" }))), /* @__PURE__ */ React11.createElement("div", { className: "form-group", style: { padding: "0" } }, /* @__PURE__ */ React11.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer }, "$", props == null ? void 0 : props.amount))), /* @__PURE__ */ React11.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React11.createElement("form", { id: "PaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc }, /* @__PURE__ */ React11.createElement("div", { className: "ach-scrl", style: { minHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "398px" : (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) == 0 ? "436px" : (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px", overflow: "auto", marginRight: "5px" } }, /* @__PURE__ */ React11.createElement("div", { className: "form-group" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "cardHolderName" }, "NAME ON CARD "), /* @__PURE__ */ React11.createElement("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
2689
+ ), /* @__PURE__ */ React11.createElement("label", { htmlFor: "", className: "card-number-last-four" }, "**** ", card == null ? void 0 : card.cardlastfourdigit), /* @__PURE__ */ React11.createElement("h6", { className: "card-expiry-date" }, card == null ? void 0 : card.expmonth, "/", card == null ? void 0 : card.expyear)), /* @__PURE__ */ React11.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React11.createElement("span", { className: "visa-card" }, /* @__PURE__ */ React11.createElement("img", { src: (card == null ? void 0 : card.card_type) != "Bank" ? "https://dev-widget.fractalpay.com/images/visa-img.svg" : "https://dev-widget.fractalpay.com/images/bank.svg", alt: "" })), /* @__PURE__ */ React11.createElement("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id) }, /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/Trash.svg", alt: "" }))))))), /* @__PURE__ */ React11.createElement("div", { className: "pay-with-other-card ", onClick: () => setActive("card") }, "Pay With Other Card", /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/card.svg", alt: "" }))), /* @__PURE__ */ React11.createElement("div", { className: "form-group", style: { padding: "0" } }, /* @__PURE__ */ React11.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer }, "$", props == null ? void 0 : props.amount))), /* @__PURE__ */ React11.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React11.createElement("form", { id: "PaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc }, /* @__PURE__ */ React11.createElement("div", { className: "ach-scrl", style: { minHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "398px" : (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) == 0 ? "456px" : (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px", overflow: "auto", marginRight: "5px" } }, /* @__PURE__ */ React11.createElement("div", { className: "form-group" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "cardHolderName" }, "NAME ON CARD "), /* @__PURE__ */ React11.createElement("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
2686
2690
  const value = e.target.value;
2687
2691
  if (/^[a-zA-Z\s]*$/.test(value)) {
2688
2692
  handleCardChange("cardName", value);
@@ -2966,7 +2970,7 @@ function PreAuthPayment(props) {
2966
2970
  showLoader();
2967
2971
  try {
2968
2972
  let tokenCallback = async function(response) {
2969
- var _a3, _b3, _c3;
2973
+ var _a3, _b3, _c3, _d3;
2970
2974
  if (response.Error) {
2971
2975
  showError(response.Error);
2972
2976
  hideLoader();
@@ -2994,13 +2998,14 @@ function PreAuthPayment(props) {
2994
2998
  orderId: "",
2995
2999
  zipCode: ""
2996
3000
  });
3001
+ console.log(apiResponse, "+++++++++++++++");
2997
3002
  setSuccess(true);
2998
- setTranId((_a3 = apiResponse == null ? void 0 : apiResponse.data) == null ? void 0 : _a3.transactionId);
3003
+ setTranId((_b3 = (_a3 = apiResponse == null ? void 0 : apiResponse.data) == null ? void 0 : _a3.data) == null ? void 0 : _b3.transaction_id);
2999
3004
  hideLoader();
3000
3005
  } catch (err) {
3001
3006
  console.log(err);
3002
3007
  hideLoader();
3003
- showError(((_c3 = (_b3 = err == null ? void 0 : err.response) == null ? void 0 : _b3.data) == null ? void 0 : _c3.message) || (err == null ? void 0 : err.message) || "Something went wrong..");
3008
+ showError(((_d3 = (_c3 = err == null ? void 0 : err.response) == null ? void 0 : _c3.data) == null ? void 0 : _d3.message) || (err == null ? void 0 : err.message) || "Something went wrong..");
3004
3009
  }
3005
3010
  }
3006
3011
  };
@@ -3067,6 +3072,7 @@ function PreAuthPayment(props) {
3067
3072
  headers: myHeaders2
3068
3073
  }
3069
3074
  );
3075
+ console.log(paymentRes);
3070
3076
  if ((_n = paymentRes == null ? void 0 : paymentRes.data) == null ? void 0 : _n.result) {
3071
3077
  setTranId((_p = (_o = paymentRes == null ? void 0 : paymentRes.data) == null ? void 0 : _o.data) == null ? void 0 : _p.transaction_id);
3072
3078
  setSuccess(true);
@@ -3097,7 +3103,7 @@ function PreAuthPayment(props) {
3097
3103
  }
3098
3104
  };
3099
3105
  const getPaymentDetails = async () => {
3100
- var _a2, _b2, _c2, _d2, _e, _f, _g, _h;
3106
+ var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k;
3101
3107
  showLoader();
3102
3108
  try {
3103
3109
  const data = {
@@ -3110,6 +3116,10 @@ function PreAuthPayment(props) {
3110
3116
  if (((_c2 = (_b2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.card_list) && ((_f = (_e = (_d2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d2.data) == null ? void 0 : _e.card_list) == null ? void 0 : _f.length) > 0) {
3111
3117
  setCardList((_h = (_g = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _g.data) == null ? void 0 : _h.card_list);
3112
3118
  setActive("cardList");
3119
+ let primary_card = (_k = (_j = (_i = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _i.data) == null ? void 0 : _j.card_list) == null ? void 0 : _k.filter((card) => (card == null ? void 0 : card.primary_card) == 1);
3120
+ if (primary_card == null ? void 0 : primary_card[0]) {
3121
+ setSelectedCard(primary_card[0]);
3122
+ }
3113
3123
  } else {
3114
3124
  setActive("card");
3115
3125
  }
@@ -3254,7 +3264,7 @@ function PreAuthPayment(props) {
3254
3264
  checked: selectedCard === card,
3255
3265
  onChange: (e) => setSelectedCard(card)
3256
3266
  }
3257
- ), /* @__PURE__ */ React12.createElement("label", { htmlFor: "", className: "card-number-last-four" }, "**** ", card == null ? void 0 : card.cardlastfourdigit), /* @__PURE__ */ React12.createElement("h6", { className: "card-expiry-date" }, card == null ? void 0 : card.expmonth, "/", card == null ? void 0 : card.expyear)), /* @__PURE__ */ React12.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React12.createElement("span", { className: "visa-card" }, /* @__PURE__ */ React12.createElement("img", { src: (card == null ? void 0 : card.card_type) != "Bank" ? "https://dev-widget.fractalpay.com/images/visa-img.svg" : "https://dev-widget.fractalpay.com/images/bank.svg", alt: "" })), /* @__PURE__ */ React12.createElement("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id) }, /* @__PURE__ */ React12.createElement("img", { src: "https://dev-widget.fractalpay.com/images/Trash.svg", alt: "" }))))))), /* @__PURE__ */ React12.createElement("div", { className: "pay-with-other-card ", onClick: () => setActive("card") }, "Authorize With Other Card", /* @__PURE__ */ React12.createElement("img", { src: "https://dev-widget.fractalpay.com/images/card.svg", alt: "" }))), /* @__PURE__ */ React12.createElement("div", { className: "form-group" }, /* @__PURE__ */ React12.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer }, "$", props == null ? void 0 : props.amount))), /* @__PURE__ */ React12.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React12.createElement("form", { id: "PaymentForm", onSubmit: submitFunc }, /* @__PURE__ */ React12.createElement("div", { className: "ach-scrl", style: { minHeight: (cardList == null ? void 0 : cardList.length) > 0 ? "442px" : "500px", overflow: "auto", marginRight: "5px" } }, /* @__PURE__ */ React12.createElement("div", { className: "form-group" }, /* @__PURE__ */ React12.createElement("label", { htmlFor: "cardHolderName" }, "Name on Card"), /* @__PURE__ */ React12.createElement(
3267
+ ), /* @__PURE__ */ React12.createElement("label", { htmlFor: "", className: "card-number-last-four" }, "**** ", card == null ? void 0 : card.cardlastfourdigit), /* @__PURE__ */ React12.createElement("h6", { className: "card-expiry-date" }, card == null ? void 0 : card.expmonth, "/", card == null ? void 0 : card.expyear)), /* @__PURE__ */ React12.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React12.createElement("span", { className: "visa-card" }, /* @__PURE__ */ React12.createElement("img", { src: (card == null ? void 0 : card.card_type) != "Bank" ? "https://dev-widget.fractalpay.com/images/visa-img.svg" : "https://dev-widget.fractalpay.com/images/bank.svg", alt: "" })), /* @__PURE__ */ React12.createElement("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id) }, /* @__PURE__ */ React12.createElement("img", { src: "https://dev-widget.fractalpay.com/images/Trash.svg", alt: "" }))))))), /* @__PURE__ */ React12.createElement("div", { className: "pay-with-other-card ", onClick: () => setActive("card") }, "Authorize With Other Card", /* @__PURE__ */ React12.createElement("img", { src: "https://dev-widget.fractalpay.com/images/card.svg", alt: "" }))), /* @__PURE__ */ React12.createElement("div", { className: "form-group" }, /* @__PURE__ */ React12.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer }, "$", props == null ? void 0 : props.amount))), /* @__PURE__ */ React12.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React12.createElement("form", { id: "PaymentForm", onSubmit: submitFunc }, /* @__PURE__ */ React12.createElement("div", { className: "ach-scrl", style: { minHeight: (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px", overflow: "auto", marginRight: "5px" } }, /* @__PURE__ */ React12.createElement("div", { className: "form-group" }, /* @__PURE__ */ React12.createElement("label", { htmlFor: "cardHolderName" }, "Name on Card"), /* @__PURE__ */ React12.createElement(
3258
3268
  "input",
3259
3269
  {
3260
3270
  type: "text",
@@ -3866,6 +3876,7 @@ function AddCard(props) {
3866
3876
  }, [props == null ? void 0 : props.fractalpayClientKey, show]);
3867
3877
  const addCardFunc = async (e) => {
3868
3878
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
3879
+ console.log("called");
3869
3880
  e.preventDefault();
3870
3881
  const hasError = validateCardData();
3871
3882
  if (hasError) return;
@@ -4020,10 +4031,10 @@ function AddCard(props) {
4020
4031
  success ? /* @__PURE__ */ React17.createElement(SuccessCardMsz_default, { onClose: handleClose }) : /* @__PURE__ */ React17.createElement(
4021
4032
  "div",
4022
4033
  {
4023
- className: "container-creditcard add-card modal-content frac-form",
4034
+ className: "container-creditcard add-card modal-content ",
4024
4035
  id: "add-credit-card-panel"
4025
4036
  },
4026
- /* @__PURE__ */ React17.createElement("form", { id: "creditCardForm", onSubmit: addCardFunc }, /* @__PURE__ */ React17.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React17.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ React17.createElement(
4037
+ /* @__PURE__ */ React17.createElement("form", { id: "creditCardForm", onSubmit: addCardFunc }, /* @__PURE__ */ React17.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React17.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ React17.createElement(
4027
4038
  "input",
4028
4039
  {
4029
4040
  type: "text",
@@ -4034,7 +4045,7 @@ function AddCard(props) {
4034
4045
  value: (cardData == null ? void 0 : cardData.cardNumber) || "",
4035
4046
  onChange: (e) => handleCardNumberChange(e)
4036
4047
  }
4037
- ), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ React17.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardNumber), /* @__PURE__ */ React17.createElement("br", null)), /* @__PURE__ */ React17.createElement("div", { className: "card-dtl" }, /* @__PURE__ */ React17.createElement("div", { className: "exp-cvc-container" }, /* @__PURE__ */ React17.createElement("div", { className: "form-group" }, /* @__PURE__ */ React17.createElement("label", { htmlFor: "expMonth" }, "MM"), /* @__PURE__ */ React17.createElement(
4048
+ ), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ React17.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardNumber)), /* @__PURE__ */ React17.createElement("div", { className: "card-dtl" }, /* @__PURE__ */ React17.createElement("div", { className: "exp-cvc-container" }, /* @__PURE__ */ React17.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React17.createElement("label", { htmlFor: "expMonth" }, "MM"), /* @__PURE__ */ React17.createElement(
4038
4049
  "input",
4039
4050
  {
4040
4051
  "data-token": "exp_month",
@@ -4045,7 +4056,7 @@ function AddCard(props) {
4045
4056
  value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
4046
4057
  onChange: (e) => handleCardChange("expiryMonth", e.target.value)
4047
4058
  }
4048
- ), (cardError == null ? void 0 : cardError.expiryMonth) && /* @__PURE__ */ React17.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryMonth)), /* @__PURE__ */ React17.createElement("div", { className: "form-group" }, /* @__PURE__ */ React17.createElement("label", { htmlFor: "expYear" }, "YYYY"), /* @__PURE__ */ React17.createElement(
4059
+ ), (cardError == null ? void 0 : cardError.expiryMonth) && /* @__PURE__ */ React17.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryMonth)), /* @__PURE__ */ React17.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React17.createElement("label", { htmlFor: "expYear" }, "YYYY"), /* @__PURE__ */ React17.createElement(
4049
4060
  "input",
4050
4061
  {
4051
4062
  "data-token": "exp_year",
@@ -4056,7 +4067,7 @@ function AddCard(props) {
4056
4067
  value: (cardData == null ? void 0 : cardData.expiryYear) || "",
4057
4068
  onChange: (e) => handleCardChange("expiryYear", e.target.value)
4058
4069
  }
4059
- ), (cardError == null ? void 0 : cardError.expiryYear) && /* @__PURE__ */ React17.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryYear)), /* @__PURE__ */ React17.createElement("div", { className: "form-group" }, /* @__PURE__ */ React17.createElement("label", { htmlFor: "cvc" }, "CVC"), /* @__PURE__ */ React17.createElement(
4070
+ ), (cardError == null ? void 0 : cardError.expiryYear) && /* @__PURE__ */ React17.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryYear)), /* @__PURE__ */ React17.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React17.createElement("label", { htmlFor: "cvc" }, "CVC"), /* @__PURE__ */ React17.createElement(
4060
4071
  "input",
4061
4072
  {
4062
4073
  "data-token": "cvv",
@@ -4067,7 +4078,7 @@ function AddCard(props) {
4067
4078
  value: (cardData == null ? void 0 : cardData.cvv) || "",
4068
4079
  onChange: (e) => handleCardChange("cvv", e.target.value)
4069
4080
  }
4070
- ), (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ React17.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ React17.createElement("div", { className: "form-group" }, /* @__PURE__ */ React17.createElement("label", { htmlFor: "cardholderName" }, "Name on card"), /* @__PURE__ */ React17.createElement(
4081
+ ), (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ React17.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ React17.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React17.createElement("label", { htmlFor: "cardholderName" }, "Name on card"), /* @__PURE__ */ React17.createElement(
4071
4082
  "input",
4072
4083
  {
4073
4084
  type: "text",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinerohit11/testwidget",
3
- "version": "0.2.95",
3
+ "version": "0.2.98",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "next dev -p 4001",