@pinerohit11/testwidget 0.1.98 → 0.1.99

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.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- interface Props$4 {
3
+ interface Props$5 {
4
4
  fractalpayClientKey: string;
5
5
  customerId?: string;
6
6
  orderID?: string;
@@ -14,9 +14,9 @@ interface Props$4 {
14
14
  tax?: string;
15
15
  surcharge?: string;
16
16
  }
17
- declare function RequestPayment(props: Props$4): React.JSX.Element;
17
+ declare function RequestPayment(props: Props$5): React.JSX.Element;
18
18
 
19
- interface Props$3 {
19
+ interface Props$4 {
20
20
  fractalpayClientKey: string;
21
21
  customerId?: string;
22
22
  orderID?: string;
@@ -30,9 +30,9 @@ interface Props$3 {
30
30
  tax?: string;
31
31
  surcharge?: string;
32
32
  }
33
- declare function RequestPreAuthPayment(props: Props$3): React.JSX.Element;
33
+ declare function RequestPreAuthPayment(props: Props$4): React.JSX.Element;
34
34
 
35
- type Props$2 = {
35
+ type Props$3 = {
36
36
  fractalpayClientKey: string;
37
37
  customerId?: string;
38
38
  orderID?: string;
@@ -46,9 +46,9 @@ type Props$2 = {
46
46
  tax?: string;
47
47
  surcharge?: string;
48
48
  };
49
- declare function GetPaymentPage(props: Props$2): React.JSX.Element;
49
+ declare function GetPaymentPage(props: Props$3): React.JSX.Element;
50
50
 
51
- type Props$1 = {
51
+ type Props$2 = {
52
52
  fractalpayClientKey: string;
53
53
  customerId?: string;
54
54
  orderID?: string;
@@ -62,12 +62,21 @@ type Props$1 = {
62
62
  tax?: string;
63
63
  surcharge?: string;
64
64
  };
65
- declare function PreAuthPayment(props: Props$1): React.JSX.Element;
65
+ declare function PreAuthPayment(props: Props$2): React.JSX.Element;
66
+
67
+ type Props$1 = {
68
+ fractalpayClientKey: string;
69
+ customerId?: string;
70
+ };
71
+ declare function AddCard(props: Props$1): React.JSX.Element;
66
72
 
67
73
  type Props = {
68
74
  fractalpayClientKey: string;
69
75
  customerId?: string;
76
+ name?: string;
77
+ email?: string;
78
+ phone?: string;
70
79
  };
71
- declare function AddCard(props: Props): React.JSX.Element;
80
+ declare function AddCardEasyPay(props: Props): React.JSX.Element;
72
81
 
73
- export { AddCard, GetPaymentPage, PreAuthPayment, RequestPayment, RequestPreAuthPayment };
82
+ export { AddCard, AddCardEasyPay, GetPaymentPage, PreAuthPayment, RequestPayment, RequestPreAuthPayment };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- interface Props$4 {
3
+ interface Props$5 {
4
4
  fractalpayClientKey: string;
5
5
  customerId?: string;
6
6
  orderID?: string;
@@ -14,9 +14,9 @@ interface Props$4 {
14
14
  tax?: string;
15
15
  surcharge?: string;
16
16
  }
17
- declare function RequestPayment(props: Props$4): React.JSX.Element;
17
+ declare function RequestPayment(props: Props$5): React.JSX.Element;
18
18
 
19
- interface Props$3 {
19
+ interface Props$4 {
20
20
  fractalpayClientKey: string;
21
21
  customerId?: string;
22
22
  orderID?: string;
@@ -30,9 +30,9 @@ interface Props$3 {
30
30
  tax?: string;
31
31
  surcharge?: string;
32
32
  }
33
- declare function RequestPreAuthPayment(props: Props$3): React.JSX.Element;
33
+ declare function RequestPreAuthPayment(props: Props$4): React.JSX.Element;
34
34
 
35
- type Props$2 = {
35
+ type Props$3 = {
36
36
  fractalpayClientKey: string;
37
37
  customerId?: string;
38
38
  orderID?: string;
@@ -46,9 +46,9 @@ type Props$2 = {
46
46
  tax?: string;
47
47
  surcharge?: string;
48
48
  };
49
- declare function GetPaymentPage(props: Props$2): React.JSX.Element;
49
+ declare function GetPaymentPage(props: Props$3): React.JSX.Element;
50
50
 
51
- type Props$1 = {
51
+ type Props$2 = {
52
52
  fractalpayClientKey: string;
53
53
  customerId?: string;
54
54
  orderID?: string;
@@ -62,12 +62,21 @@ type Props$1 = {
62
62
  tax?: string;
63
63
  surcharge?: string;
64
64
  };
65
- declare function PreAuthPayment(props: Props$1): React.JSX.Element;
65
+ declare function PreAuthPayment(props: Props$2): React.JSX.Element;
66
+
67
+ type Props$1 = {
68
+ fractalpayClientKey: string;
69
+ customerId?: string;
70
+ };
71
+ declare function AddCard(props: Props$1): React.JSX.Element;
66
72
 
67
73
  type Props = {
68
74
  fractalpayClientKey: string;
69
75
  customerId?: string;
76
+ name?: string;
77
+ email?: string;
78
+ phone?: string;
70
79
  };
71
- declare function AddCard(props: Props): React.JSX.Element;
80
+ declare function AddCardEasyPay(props: Props): React.JSX.Element;
72
81
 
73
- export { AddCard, GetPaymentPage, PreAuthPayment, RequestPayment, RequestPreAuthPayment };
82
+ export { AddCard, AddCardEasyPay, GetPaymentPage, PreAuthPayment, RequestPayment, RequestPreAuthPayment };
package/dist/index.js CHANGED
@@ -60,6 +60,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
60
60
  var index_exports = {};
61
61
  __export(index_exports, {
62
62
  AddCard: () => AddCard,
63
+ AddCardEasyPay: () => AddCardEasyPay,
63
64
  GetPaymentPage: () => GetPaymentPage,
64
65
  PreAuthPayment: () => PreAuthPayment,
65
66
  RequestPayment: () => RequestPayment,
@@ -4058,9 +4059,388 @@ function AddCard(props) {
4058
4059
  )
4059
4060
  ));
4060
4061
  }
4062
+
4063
+ // src/app/components/AddCard/AddCardEasyPay.tsx
4064
+ var import_react19 = __toESM(require("react"));
4065
+ var import_sweetalert24 = __toESM(require("sweetalert2"));
4066
+ var import_axios6 = __toESM(require("axios"));
4067
+ function AddCardEasyPay(props) {
4068
+ var _a;
4069
+ const [loading, setLoading] = (0, import_react19.useState)(false);
4070
+ const [success, setSuccess] = (0, import_react19.useState)(false);
4071
+ const [show, setShow] = (0, import_react19.useState)(false);
4072
+ const [cardData, setCardData] = (0, import_react19.useState)();
4073
+ const [cardError, setCardError] = (0, import_react19.useState)({});
4074
+ const [paymentData, setPaymentData] = (0, import_react19.useState)();
4075
+ const showLoader = () => setLoading(true);
4076
+ const hideLoader = () => setLoading(false);
4077
+ const showError = (msz) => {
4078
+ import_sweetalert24.default.fire({
4079
+ icon: "error",
4080
+ text: msz
4081
+ });
4082
+ };
4083
+ const handleClose = () => {
4084
+ setShow(false);
4085
+ setSuccess(false);
4086
+ setCardData({
4087
+ cardName: "",
4088
+ cardNumber: "",
4089
+ expiryMonth: "",
4090
+ expiryYear: "",
4091
+ cvv: "",
4092
+ orderId: "",
4093
+ zipCode: ""
4094
+ });
4095
+ };
4096
+ const handleShow = () => setShow(true);
4097
+ const handleCloseSeccess = () => {
4098
+ handleClose();
4099
+ };
4100
+ const handleCardChange = (field, value) => {
4101
+ const name = field;
4102
+ const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
4103
+ if (numericFields.includes(name)) {
4104
+ if (value === "" || /^[0-9]+$/.test(value)) {
4105
+ setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
4106
+ [name]: ""
4107
+ }));
4108
+ setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
4109
+ [name]: value
4110
+ }));
4111
+ }
4112
+ return;
4113
+ }
4114
+ setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
4115
+ [name]: ""
4116
+ }));
4117
+ console.log(value, name);
4118
+ setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
4119
+ [name]: value
4120
+ }));
4121
+ };
4122
+ const handleCardNumberChange = (e) => {
4123
+ const input = e.target;
4124
+ const rawValue = input.value.replace(/\D/g, "");
4125
+ let formatted = "";
4126
+ if (/^3[47]/.test(rawValue)) {
4127
+ const trimmed = rawValue.slice(0, 15);
4128
+ formatted = trimmed.replace(
4129
+ /^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,
4130
+ (_, g1, g2, g3) => [g1, g2, g3].filter(Boolean).join(" ")
4131
+ );
4132
+ } else {
4133
+ const trimmed = rawValue.slice(0, 16);
4134
+ formatted = trimmed.replace(
4135
+ /^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,
4136
+ (_, g1, g2, g3, g4) => [g1, g2, g3, g4].filter(Boolean).join(" ")
4137
+ );
4138
+ }
4139
+ setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
4140
+ cardNumber: ""
4141
+ }));
4142
+ setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
4143
+ cardNumber: formatted
4144
+ }));
4145
+ };
4146
+ const validateCardData = () => {
4147
+ var _a2, _b, _c, _d, _e, _f, _g;
4148
+ const errors = {};
4149
+ const data = cardData;
4150
+ const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
4151
+ const year = (data == null ? void 0 : data.expiryYear) || "";
4152
+ if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
4153
+ if (!((_b = data == null ? void 0 : data.cardNumber) == null ? void 0 : _b.trim())) errors.cardNumber = "Card number is required";
4154
+ if (!((_c = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _c.trim())) {
4155
+ errors.expiryMonth = "Expiration month is required";
4156
+ } else if (Number(data == null ? void 0 : data.expiryMonth) > 12 || Number(data == null ? void 0 : data.expiryMonth) < 1) {
4157
+ errors.expiryMonth = "Invalid Expiration Month.";
4158
+ }
4159
+ if (!((_d = data == null ? void 0 : data.expiryYear) == null ? void 0 : _d.trim())) {
4160
+ errors.expiryYear = "Expiration year is required";
4161
+ } else if (((_e = data == null ? void 0 : data.expiryYear) == null ? void 0 : _e.trim().length) !== 4 || Number(data == null ? void 0 : data.expiryYear) < 2025) {
4162
+ errors.expiryYear = "Invalid Expiration Year.";
4163
+ } else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
4164
+ errors.expiryMonth = "Invalid Expiration Date.";
4165
+ }
4166
+ if (!((_f = data == null ? void 0 : data.cvv) == null ? void 0 : _f.trim())) errors.cvv = "CVC is required";
4167
+ if (!((_g = data == null ? void 0 : data.zipCode) == null ? void 0 : _g.trim())) errors.zipCode = "ZIP code is required";
4168
+ if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
4169
+ const month2 = parseInt(data.expiryMonth, 10);
4170
+ const year2 = parseInt(data.expiryYear, 10);
4171
+ const now = /* @__PURE__ */ new Date();
4172
+ const currentMonth = now.getMonth() + 1;
4173
+ const currentYear = now.getFullYear();
4174
+ if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
4175
+ errors.expiryMonth = "Card is expired";
4176
+ }
4177
+ }
4178
+ setCardError(errors);
4179
+ return Object.keys(errors).length > 0;
4180
+ };
4181
+ const getPaymentDetails = async () => {
4182
+ var _a2, _b, _c, _d, _e, _f;
4183
+ showLoader();
4184
+ try {
4185
+ const data = {
4186
+ fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
4187
+ "customer_id": props == null ? void 0 : props.customerId,
4188
+ addcard: true
4189
+ };
4190
+ let paymentData2 = await import_axios6.default.post(`${baseUrl}get-payment-details`, data);
4191
+ console.log(paymentData2);
4192
+ setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
4193
+ if (((_c = (_b = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b.data) == null ? void 0 : _c.card_list) && ((_f = (_e = (_d = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d.data) == null ? void 0 : _e.card_list) == null ? void 0 : _f.length) > 0) {
4194
+ } else {
4195
+ }
4196
+ hideLoader();
4197
+ } catch (err) {
4198
+ console.log(err);
4199
+ hideLoader();
4200
+ }
4201
+ };
4202
+ (0, import_react19.useEffect)(() => {
4203
+ if (props.fractalpayClientKey) {
4204
+ getPaymentDetails();
4205
+ }
4206
+ }, [props == null ? void 0 : props.fractalpayClientKey]);
4207
+ const addCardFunc = async (e) => {
4208
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
4209
+ e.preventDefault();
4210
+ const hasError = validateCardData();
4211
+ console.log(cardData);
4212
+ debugger;
4213
+ if (hasError) return;
4214
+ else {
4215
+ let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
4216
+ let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
4217
+ let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
4218
+ let errors = {};
4219
+ if (!validCard) errors.cardNumber = "Invalid card Number";
4220
+ if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
4221
+ if (!validCVV) errors.cvv = "Invalid CVV";
4222
+ setCardError(errors);
4223
+ if (validCard && validCVV && validExpirationDate) {
4224
+ showLoader();
4225
+ try {
4226
+ let getTokenCallback = async function(token) {
4227
+ var _a3, _b2, _c2, _d2, _e2;
4228
+ console.log(token);
4229
+ if (token.Error) {
4230
+ console.log(token == null ? void 0 : token.Error);
4231
+ showError(token.Error);
4232
+ hideLoader();
4233
+ } else {
4234
+ const reqData = {
4235
+ userId: props == null ? void 0 : props.customerId,
4236
+ cardName: cardData == null ? void 0 : cardData.cardName,
4237
+ zip: cardData == null ? void 0 : cardData.zipCode,
4238
+ fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
4239
+ token
4240
+ };
4241
+ try {
4242
+ let apiResponse = await import_axios6.default.post(`${baseUrl}add-card`, reqData);
4243
+ console.log(apiResponse);
4244
+ let formData = {
4245
+ fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
4246
+ wallet_id: "",
4247
+ card_number: cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""),
4248
+ exp_month: cardData == null ? void 0 : cardData.expiryMonth,
4249
+ exp_year: (_a3 = cardData == null ? void 0 : cardData.expiryYear) == null ? void 0 : _a3.slice(-2),
4250
+ cvv: cardData == null ? void 0 : cardData.cvv
4251
+ };
4252
+ try {
4253
+ const result = await import_axios6.default.post(`${baseUrl}link-wallet`, formData);
4254
+ console.log(result);
4255
+ setSuccess(true);
4256
+ hideLoader();
4257
+ setCardData({
4258
+ cardName: "",
4259
+ cardNumber: "",
4260
+ expiryMonth: "",
4261
+ expiryYear: "",
4262
+ cvv: "",
4263
+ orderId: "",
4264
+ zipCode: ""
4265
+ });
4266
+ } catch (err) {
4267
+ console.log(err);
4268
+ hideLoader();
4269
+ showError(((_c2 = (_b2 = err == null ? void 0 : err.response) == null ? void 0 : _b2.data) == null ? void 0 : _c2.message) || (err == null ? void 0 : err.message) || "Something went wrong..");
4270
+ }
4271
+ } catch (err) {
4272
+ console.log(err);
4273
+ hideLoader();
4274
+ showError(((_e2 = (_d2 = err == null ? void 0 : err.response) == null ? void 0 : _d2.data) == null ? void 0 : _e2.message) || (err == null ? void 0 : err.message) || "Something went wrong..");
4275
+ }
4276
+ }
4277
+ };
4278
+ if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
4279
+ const requestOptions = {
4280
+ method: "POST",
4281
+ redirect: "follow"
4282
+ };
4283
+ try {
4284
+ let sesionResult = await import_axios6.default.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
4285
+ let expYear = Number(cardData == null ? void 0 : cardData.expiryYear) % 100;
4286
+ let cardNumber = cardData == null ? void 0 : cardData.cardNumber;
4287
+ cardNumber = cardNumber == null ? void 0 : cardNumber.replace(/\s+/g, "");
4288
+ let track2_data = `${cardNumber}=${expYear}${cardData == null ? void 0 : cardData.expiryMonth} ${cardData == null ? void 0 : cardData.cvv}`;
4289
+ const publicKey = forge.pki.publicKeyFromPem((_b = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b.publicKeyPem);
4290
+ const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
4291
+ md: forge.md.sha1.create(),
4292
+ mgf1: {
4293
+ md: forge.md.sha1.create()
4294
+ }
4295
+ });
4296
+ const encryptedBase64 = forge.util.encode64(encrypted);
4297
+ const myHeaders = {
4298
+ "Content-Type": "application/json",
4299
+ "x-app-session-key": (_d = (_c = sesionResult.data) == null ? void 0 : _c.data) == null ? void 0 : _d.session_key
4300
+ };
4301
+ const raw = JSON.stringify({
4302
+ "enc_track2_data": `${encryptedBase64}`,
4303
+ "algorithm": "RSAES_OAEP_SHA_1",
4304
+ session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
4305
+ });
4306
+ try {
4307
+ const tokenizeData = await import_axios6.default.post("https://api-dev.merchant-trends.com/tokenizer/tokenize", raw, { headers: myHeaders });
4308
+ const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
4309
+ cvv: cardData == null ? void 0 : cardData.cvv,
4310
+ cardName: cardData == null ? void 0 : cardData.cardName,
4311
+ zip: cardData == null ? void 0 : cardData.zipCode,
4312
+ userId: props == null ? void 0 : props.customerId,
4313
+ fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey
4314
+ }));
4315
+ let myHeaders2 = {
4316
+ "Content-Type": "application/json"
4317
+ };
4318
+ try {
4319
+ let addCardRes = await import_axios6.default.post(
4320
+ `${baseUrl}add-card`,
4321
+ reqData,
4322
+ {
4323
+ headers: myHeaders2
4324
+ }
4325
+ );
4326
+ console.log(addCardRes);
4327
+ if ((_h = addCardRes == null ? void 0 : addCardRes.data) == null ? void 0 : _h.result) {
4328
+ setSuccess(true);
4329
+ hideLoader();
4330
+ }
4331
+ } catch (err) {
4332
+ hideLoader();
4333
+ showError(((_j = (_i = err == null ? void 0 : err.response) == null ? void 0 : _i.data) == null ? void 0 : _j.message) || (err == null ? void 0 : err.message) || "something wrong..s");
4334
+ }
4335
+ } catch (err) {
4336
+ hideLoader();
4337
+ showError(((_l = (_k = err == null ? void 0 : err.response) == null ? void 0 : _k.data) == null ? void 0 : _l.message) || (err == null ? void 0 : err.message) || "something wrong..s");
4338
+ }
4339
+ } catch (err) {
4340
+ hideLoader();
4341
+ showError(((_n = (_m = err == null ? void 0 : err.response) == null ? void 0 : _m.data) == null ? void 0 : _n.message) || (err == null ? void 0 : err.message) || "something wrong..s");
4342
+ }
4343
+ } else {
4344
+ if (typeof DatacapWebToken !== "undefined") {
4345
+ DatacapWebToken.requestToken(paymentData == null ? void 0 : paymentData.dctoken, "creditCardForm", getTokenCallback);
4346
+ }
4347
+ }
4348
+ } catch (err) {
4349
+ hideLoader();
4350
+ showError(((_p = (_o = err == null ? void 0 : err.response) == null ? void 0 : _o.data) == null ? void 0 : _p.message) || (err == null ? void 0 : err.message) || "something wrong..s");
4351
+ }
4352
+ }
4353
+ }
4354
+ };
4355
+ return /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(DataScript, null), /* @__PURE__ */ import_react19.default.createElement(AddCardStyle, null), /* @__PURE__ */ import_react19.default.createElement(Loader_default, { loading }), success ? /* @__PURE__ */ import_react19.default.createElement(SuccessCardMsz_default, { onClose: handleCloseSeccess }) : /* @__PURE__ */ import_react19.default.createElement(
4356
+ "div",
4357
+ {
4358
+ className: "container-creditcard add-card modal-content ",
4359
+ id: "add-credit-card-panel"
4360
+ },
4361
+ /* @__PURE__ */ import_react19.default.createElement("form", { id: "creditCardForm", onSubmit: addCardFunc }, /* @__PURE__ */ import_react19.default.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ import_react19.default.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ import_react19.default.createElement(
4362
+ "input",
4363
+ {
4364
+ type: "text",
4365
+ "data-token": "card_number",
4366
+ placeholder: "Enter card number",
4367
+ maxLength: 19,
4368
+ inputMode: "numeric",
4369
+ value: (cardData == null ? void 0 : cardData.cardNumber) || "",
4370
+ onChange: (e) => handleCardNumberChange(e)
4371
+ }
4372
+ ), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ import_react19.default.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardNumber), /* @__PURE__ */ import_react19.default.createElement("br", null)), /* @__PURE__ */ import_react19.default.createElement("div", { className: "card-dtl" }, /* @__PURE__ */ import_react19.default.createElement("div", { className: "exp-cvc-container" }, /* @__PURE__ */ import_react19.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react19.default.createElement("label", { htmlFor: "expMonth" }, "MM"), /* @__PURE__ */ import_react19.default.createElement(
4373
+ "input",
4374
+ {
4375
+ "data-token": "exp_month",
4376
+ className: "form-control required",
4377
+ type: "text",
4378
+ placeholder: "MM",
4379
+ maxLength: 2,
4380
+ value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
4381
+ onChange: (e) => handleCardChange("expiryMonth", e.target.value)
4382
+ }
4383
+ ), (cardError == null ? void 0 : cardError.expiryMonth) && /* @__PURE__ */ import_react19.default.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryMonth)), /* @__PURE__ */ import_react19.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react19.default.createElement("label", { htmlFor: "expYear" }, "YYYY"), /* @__PURE__ */ import_react19.default.createElement(
4384
+ "input",
4385
+ {
4386
+ "data-token": "exp_year",
4387
+ className: "form-control required",
4388
+ type: "text",
4389
+ placeholder: "YYYY",
4390
+ maxLength: 4,
4391
+ value: (cardData == null ? void 0 : cardData.expiryYear) || "",
4392
+ onChange: (e) => handleCardChange("expiryYear", e.target.value)
4393
+ }
4394
+ ), (cardError == null ? void 0 : cardError.expiryYear) && /* @__PURE__ */ import_react19.default.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryYear)), /* @__PURE__ */ import_react19.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react19.default.createElement("label", { htmlFor: "cvc" }, "CVC"), /* @__PURE__ */ import_react19.default.createElement(
4395
+ "input",
4396
+ {
4397
+ "data-token": "cvv",
4398
+ className: "form-control required",
4399
+ type: "text",
4400
+ placeholder: "CVC",
4401
+ maxLength: 4,
4402
+ value: (cardData == null ? void 0 : cardData.cvv) || "",
4403
+ onChange: (e) => handleCardChange("cvv", e.target.value)
4404
+ }
4405
+ ), (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ import_react19.default.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ import_react19.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react19.default.createElement("label", { htmlFor: "cardholderName" }, "Name on card"), /* @__PURE__ */ import_react19.default.createElement(
4406
+ "input",
4407
+ {
4408
+ type: "text",
4409
+ id: "cardholderName",
4410
+ name: "cardholderName",
4411
+ placeholder: "Name on card required",
4412
+ value: (cardData == null ? void 0 : cardData.cardName) || "",
4413
+ onChange: (e) => {
4414
+ const value = e.target.value;
4415
+ if (/^[a-zA-Z\s]*$/.test(value)) {
4416
+ handleCardChange("cardName", value);
4417
+ }
4418
+ }
4419
+ }
4420
+ ), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ import_react19.default.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ import_react19.default.createElement("div", { className: "form-group", style: { marginBottom: "20px" } }, /* @__PURE__ */ import_react19.default.createElement("label", { htmlFor: "zipcode" }, "Zip"), /* @__PURE__ */ import_react19.default.createElement(
4421
+ "input",
4422
+ {
4423
+ type: "text",
4424
+ id: "zipcode",
4425
+ name: "zipcode",
4426
+ placeholder: "Zip",
4427
+ value: (_a = cardData == null ? void 0 : cardData.zipCode) != null ? _a : "",
4428
+ onChange: (e) => handleCardChange("zipCode", e.target.value)
4429
+ }
4430
+ ), (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ import_react19.default.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.zipCode)), /* @__PURE__ */ import_react19.default.createElement(
4431
+ "input",
4432
+ {
4433
+ type: "submit",
4434
+ className: "idle-green-btn w-100",
4435
+ defaultValue: "Submit"
4436
+ }
4437
+ ))
4438
+ ));
4439
+ }
4061
4440
  // Annotate the CommonJS export names for ESM import in node:
4062
4441
  0 && (module.exports = {
4063
4442
  AddCard,
4443
+ AddCardEasyPay,
4064
4444
  GetPaymentPage,
4065
4445
  PreAuthPayment,
4066
4446
  RequestPayment,
package/dist/index.mjs CHANGED
@@ -4021,8 +4021,387 @@ function AddCard(props) {
4021
4021
  )
4022
4022
  ));
4023
4023
  }
4024
+
4025
+ // src/app/components/AddCard/AddCardEasyPay.tsx
4026
+ import React18, { useEffect as useEffect7, useState as useState6 } from "react";
4027
+ import Swal4 from "sweetalert2";
4028
+ import axios6 from "axios";
4029
+ function AddCardEasyPay(props) {
4030
+ var _a;
4031
+ const [loading, setLoading] = useState6(false);
4032
+ const [success, setSuccess] = useState6(false);
4033
+ const [show, setShow] = useState6(false);
4034
+ const [cardData, setCardData] = useState6();
4035
+ const [cardError, setCardError] = useState6({});
4036
+ const [paymentData, setPaymentData] = useState6();
4037
+ const showLoader = () => setLoading(true);
4038
+ const hideLoader = () => setLoading(false);
4039
+ const showError = (msz) => {
4040
+ Swal4.fire({
4041
+ icon: "error",
4042
+ text: msz
4043
+ });
4044
+ };
4045
+ const handleClose = () => {
4046
+ setShow(false);
4047
+ setSuccess(false);
4048
+ setCardData({
4049
+ cardName: "",
4050
+ cardNumber: "",
4051
+ expiryMonth: "",
4052
+ expiryYear: "",
4053
+ cvv: "",
4054
+ orderId: "",
4055
+ zipCode: ""
4056
+ });
4057
+ };
4058
+ const handleShow = () => setShow(true);
4059
+ const handleCloseSeccess = () => {
4060
+ handleClose();
4061
+ };
4062
+ const handleCardChange = (field, value) => {
4063
+ const name = field;
4064
+ const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
4065
+ if (numericFields.includes(name)) {
4066
+ if (value === "" || /^[0-9]+$/.test(value)) {
4067
+ setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
4068
+ [name]: ""
4069
+ }));
4070
+ setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
4071
+ [name]: value
4072
+ }));
4073
+ }
4074
+ return;
4075
+ }
4076
+ setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
4077
+ [name]: ""
4078
+ }));
4079
+ console.log(value, name);
4080
+ setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
4081
+ [name]: value
4082
+ }));
4083
+ };
4084
+ const handleCardNumberChange = (e) => {
4085
+ const input = e.target;
4086
+ const rawValue = input.value.replace(/\D/g, "");
4087
+ let formatted = "";
4088
+ if (/^3[47]/.test(rawValue)) {
4089
+ const trimmed = rawValue.slice(0, 15);
4090
+ formatted = trimmed.replace(
4091
+ /^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,
4092
+ (_, g1, g2, g3) => [g1, g2, g3].filter(Boolean).join(" ")
4093
+ );
4094
+ } else {
4095
+ const trimmed = rawValue.slice(0, 16);
4096
+ formatted = trimmed.replace(
4097
+ /^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,
4098
+ (_, g1, g2, g3, g4) => [g1, g2, g3, g4].filter(Boolean).join(" ")
4099
+ );
4100
+ }
4101
+ setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
4102
+ cardNumber: ""
4103
+ }));
4104
+ setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
4105
+ cardNumber: formatted
4106
+ }));
4107
+ };
4108
+ const validateCardData = () => {
4109
+ var _a2, _b, _c, _d, _e, _f, _g;
4110
+ const errors = {};
4111
+ const data = cardData;
4112
+ const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
4113
+ const year = (data == null ? void 0 : data.expiryYear) || "";
4114
+ if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
4115
+ if (!((_b = data == null ? void 0 : data.cardNumber) == null ? void 0 : _b.trim())) errors.cardNumber = "Card number is required";
4116
+ if (!((_c = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _c.trim())) {
4117
+ errors.expiryMonth = "Expiration month is required";
4118
+ } else if (Number(data == null ? void 0 : data.expiryMonth) > 12 || Number(data == null ? void 0 : data.expiryMonth) < 1) {
4119
+ errors.expiryMonth = "Invalid Expiration Month.";
4120
+ }
4121
+ if (!((_d = data == null ? void 0 : data.expiryYear) == null ? void 0 : _d.trim())) {
4122
+ errors.expiryYear = "Expiration year is required";
4123
+ } else if (((_e = data == null ? void 0 : data.expiryYear) == null ? void 0 : _e.trim().length) !== 4 || Number(data == null ? void 0 : data.expiryYear) < 2025) {
4124
+ errors.expiryYear = "Invalid Expiration Year.";
4125
+ } else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
4126
+ errors.expiryMonth = "Invalid Expiration Date.";
4127
+ }
4128
+ if (!((_f = data == null ? void 0 : data.cvv) == null ? void 0 : _f.trim())) errors.cvv = "CVC is required";
4129
+ if (!((_g = data == null ? void 0 : data.zipCode) == null ? void 0 : _g.trim())) errors.zipCode = "ZIP code is required";
4130
+ if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
4131
+ const month2 = parseInt(data.expiryMonth, 10);
4132
+ const year2 = parseInt(data.expiryYear, 10);
4133
+ const now = /* @__PURE__ */ new Date();
4134
+ const currentMonth = now.getMonth() + 1;
4135
+ const currentYear = now.getFullYear();
4136
+ if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
4137
+ errors.expiryMonth = "Card is expired";
4138
+ }
4139
+ }
4140
+ setCardError(errors);
4141
+ return Object.keys(errors).length > 0;
4142
+ };
4143
+ const getPaymentDetails = async () => {
4144
+ var _a2, _b, _c, _d, _e, _f;
4145
+ showLoader();
4146
+ try {
4147
+ const data = {
4148
+ fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
4149
+ "customer_id": props == null ? void 0 : props.customerId,
4150
+ addcard: true
4151
+ };
4152
+ let paymentData2 = await axios6.post(`${baseUrl}get-payment-details`, data);
4153
+ console.log(paymentData2);
4154
+ setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
4155
+ if (((_c = (_b = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b.data) == null ? void 0 : _c.card_list) && ((_f = (_e = (_d = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d.data) == null ? void 0 : _e.card_list) == null ? void 0 : _f.length) > 0) {
4156
+ } else {
4157
+ }
4158
+ hideLoader();
4159
+ } catch (err) {
4160
+ console.log(err);
4161
+ hideLoader();
4162
+ }
4163
+ };
4164
+ useEffect7(() => {
4165
+ if (props.fractalpayClientKey) {
4166
+ getPaymentDetails();
4167
+ }
4168
+ }, [props == null ? void 0 : props.fractalpayClientKey]);
4169
+ const addCardFunc = async (e) => {
4170
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
4171
+ e.preventDefault();
4172
+ const hasError = validateCardData();
4173
+ console.log(cardData);
4174
+ debugger;
4175
+ if (hasError) return;
4176
+ else {
4177
+ let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
4178
+ let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
4179
+ let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
4180
+ let errors = {};
4181
+ if (!validCard) errors.cardNumber = "Invalid card Number";
4182
+ if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
4183
+ if (!validCVV) errors.cvv = "Invalid CVV";
4184
+ setCardError(errors);
4185
+ if (validCard && validCVV && validExpirationDate) {
4186
+ showLoader();
4187
+ try {
4188
+ let getTokenCallback = async function(token) {
4189
+ var _a3, _b2, _c2, _d2, _e2;
4190
+ console.log(token);
4191
+ if (token.Error) {
4192
+ console.log(token == null ? void 0 : token.Error);
4193
+ showError(token.Error);
4194
+ hideLoader();
4195
+ } else {
4196
+ const reqData = {
4197
+ userId: props == null ? void 0 : props.customerId,
4198
+ cardName: cardData == null ? void 0 : cardData.cardName,
4199
+ zip: cardData == null ? void 0 : cardData.zipCode,
4200
+ fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
4201
+ token
4202
+ };
4203
+ try {
4204
+ let apiResponse = await axios6.post(`${baseUrl}add-card`, reqData);
4205
+ console.log(apiResponse);
4206
+ let formData = {
4207
+ fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
4208
+ wallet_id: "",
4209
+ card_number: cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""),
4210
+ exp_month: cardData == null ? void 0 : cardData.expiryMonth,
4211
+ exp_year: (_a3 = cardData == null ? void 0 : cardData.expiryYear) == null ? void 0 : _a3.slice(-2),
4212
+ cvv: cardData == null ? void 0 : cardData.cvv
4213
+ };
4214
+ try {
4215
+ const result = await axios6.post(`${baseUrl}link-wallet`, formData);
4216
+ console.log(result);
4217
+ setSuccess(true);
4218
+ hideLoader();
4219
+ setCardData({
4220
+ cardName: "",
4221
+ cardNumber: "",
4222
+ expiryMonth: "",
4223
+ expiryYear: "",
4224
+ cvv: "",
4225
+ orderId: "",
4226
+ zipCode: ""
4227
+ });
4228
+ } catch (err) {
4229
+ console.log(err);
4230
+ hideLoader();
4231
+ showError(((_c2 = (_b2 = err == null ? void 0 : err.response) == null ? void 0 : _b2.data) == null ? void 0 : _c2.message) || (err == null ? void 0 : err.message) || "Something went wrong..");
4232
+ }
4233
+ } catch (err) {
4234
+ console.log(err);
4235
+ hideLoader();
4236
+ showError(((_e2 = (_d2 = err == null ? void 0 : err.response) == null ? void 0 : _d2.data) == null ? void 0 : _e2.message) || (err == null ? void 0 : err.message) || "Something went wrong..");
4237
+ }
4238
+ }
4239
+ };
4240
+ if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
4241
+ const requestOptions = {
4242
+ method: "POST",
4243
+ redirect: "follow"
4244
+ };
4245
+ try {
4246
+ let sesionResult = await axios6.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
4247
+ let expYear = Number(cardData == null ? void 0 : cardData.expiryYear) % 100;
4248
+ let cardNumber = cardData == null ? void 0 : cardData.cardNumber;
4249
+ cardNumber = cardNumber == null ? void 0 : cardNumber.replace(/\s+/g, "");
4250
+ let track2_data = `${cardNumber}=${expYear}${cardData == null ? void 0 : cardData.expiryMonth} ${cardData == null ? void 0 : cardData.cvv}`;
4251
+ const publicKey = forge.pki.publicKeyFromPem((_b = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b.publicKeyPem);
4252
+ const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
4253
+ md: forge.md.sha1.create(),
4254
+ mgf1: {
4255
+ md: forge.md.sha1.create()
4256
+ }
4257
+ });
4258
+ const encryptedBase64 = forge.util.encode64(encrypted);
4259
+ const myHeaders = {
4260
+ "Content-Type": "application/json",
4261
+ "x-app-session-key": (_d = (_c = sesionResult.data) == null ? void 0 : _c.data) == null ? void 0 : _d.session_key
4262
+ };
4263
+ const raw = JSON.stringify({
4264
+ "enc_track2_data": `${encryptedBase64}`,
4265
+ "algorithm": "RSAES_OAEP_SHA_1",
4266
+ session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
4267
+ });
4268
+ try {
4269
+ const tokenizeData = await axios6.post("https://api-dev.merchant-trends.com/tokenizer/tokenize", raw, { headers: myHeaders });
4270
+ const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
4271
+ cvv: cardData == null ? void 0 : cardData.cvv,
4272
+ cardName: cardData == null ? void 0 : cardData.cardName,
4273
+ zip: cardData == null ? void 0 : cardData.zipCode,
4274
+ userId: props == null ? void 0 : props.customerId,
4275
+ fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey
4276
+ }));
4277
+ let myHeaders2 = {
4278
+ "Content-Type": "application/json"
4279
+ };
4280
+ try {
4281
+ let addCardRes = await axios6.post(
4282
+ `${baseUrl}add-card`,
4283
+ reqData,
4284
+ {
4285
+ headers: myHeaders2
4286
+ }
4287
+ );
4288
+ console.log(addCardRes);
4289
+ if ((_h = addCardRes == null ? void 0 : addCardRes.data) == null ? void 0 : _h.result) {
4290
+ setSuccess(true);
4291
+ hideLoader();
4292
+ }
4293
+ } catch (err) {
4294
+ hideLoader();
4295
+ showError(((_j = (_i = err == null ? void 0 : err.response) == null ? void 0 : _i.data) == null ? void 0 : _j.message) || (err == null ? void 0 : err.message) || "something wrong..s");
4296
+ }
4297
+ } catch (err) {
4298
+ hideLoader();
4299
+ showError(((_l = (_k = err == null ? void 0 : err.response) == null ? void 0 : _k.data) == null ? void 0 : _l.message) || (err == null ? void 0 : err.message) || "something wrong..s");
4300
+ }
4301
+ } catch (err) {
4302
+ hideLoader();
4303
+ showError(((_n = (_m = err == null ? void 0 : err.response) == null ? void 0 : _m.data) == null ? void 0 : _n.message) || (err == null ? void 0 : err.message) || "something wrong..s");
4304
+ }
4305
+ } else {
4306
+ if (typeof DatacapWebToken !== "undefined") {
4307
+ DatacapWebToken.requestToken(paymentData == null ? void 0 : paymentData.dctoken, "creditCardForm", getTokenCallback);
4308
+ }
4309
+ }
4310
+ } catch (err) {
4311
+ hideLoader();
4312
+ showError(((_p = (_o = err == null ? void 0 : err.response) == null ? void 0 : _o.data) == null ? void 0 : _p.message) || (err == null ? void 0 : err.message) || "something wrong..s");
4313
+ }
4314
+ }
4315
+ }
4316
+ };
4317
+ return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(DataScript, null), /* @__PURE__ */ React18.createElement(AddCardStyle, null), /* @__PURE__ */ React18.createElement(Loader_default, { loading }), success ? /* @__PURE__ */ React18.createElement(SuccessCardMsz_default, { onClose: handleCloseSeccess }) : /* @__PURE__ */ React18.createElement(
4318
+ "div",
4319
+ {
4320
+ className: "container-creditcard add-card modal-content ",
4321
+ id: "add-credit-card-panel"
4322
+ },
4323
+ /* @__PURE__ */ React18.createElement("form", { id: "creditCardForm", onSubmit: addCardFunc }, /* @__PURE__ */ React18.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ React18.createElement(
4324
+ "input",
4325
+ {
4326
+ type: "text",
4327
+ "data-token": "card_number",
4328
+ placeholder: "Enter card number",
4329
+ maxLength: 19,
4330
+ inputMode: "numeric",
4331
+ value: (cardData == null ? void 0 : cardData.cardNumber) || "",
4332
+ onChange: (e) => handleCardNumberChange(e)
4333
+ }
4334
+ ), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ React18.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardNumber), /* @__PURE__ */ React18.createElement("br", null)), /* @__PURE__ */ React18.createElement("div", { className: "card-dtl" }, /* @__PURE__ */ React18.createElement("div", { className: "exp-cvc-container" }, /* @__PURE__ */ React18.createElement("div", { className: "form-group" }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "expMonth" }, "MM"), /* @__PURE__ */ React18.createElement(
4335
+ "input",
4336
+ {
4337
+ "data-token": "exp_month",
4338
+ className: "form-control required",
4339
+ type: "text",
4340
+ placeholder: "MM",
4341
+ maxLength: 2,
4342
+ value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
4343
+ onChange: (e) => handleCardChange("expiryMonth", e.target.value)
4344
+ }
4345
+ ), (cardError == null ? void 0 : cardError.expiryMonth) && /* @__PURE__ */ React18.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryMonth)), /* @__PURE__ */ React18.createElement("div", { className: "form-group" }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "expYear" }, "YYYY"), /* @__PURE__ */ React18.createElement(
4346
+ "input",
4347
+ {
4348
+ "data-token": "exp_year",
4349
+ className: "form-control required",
4350
+ type: "text",
4351
+ placeholder: "YYYY",
4352
+ maxLength: 4,
4353
+ value: (cardData == null ? void 0 : cardData.expiryYear) || "",
4354
+ onChange: (e) => handleCardChange("expiryYear", e.target.value)
4355
+ }
4356
+ ), (cardError == null ? void 0 : cardError.expiryYear) && /* @__PURE__ */ React18.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryYear)), /* @__PURE__ */ React18.createElement("div", { className: "form-group" }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "cvc" }, "CVC"), /* @__PURE__ */ React18.createElement(
4357
+ "input",
4358
+ {
4359
+ "data-token": "cvv",
4360
+ className: "form-control required",
4361
+ type: "text",
4362
+ placeholder: "CVC",
4363
+ maxLength: 4,
4364
+ value: (cardData == null ? void 0 : cardData.cvv) || "",
4365
+ onChange: (e) => handleCardChange("cvv", e.target.value)
4366
+ }
4367
+ ), (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ React18.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ React18.createElement("div", { className: "form-group" }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "cardholderName" }, "Name on card"), /* @__PURE__ */ React18.createElement(
4368
+ "input",
4369
+ {
4370
+ type: "text",
4371
+ id: "cardholderName",
4372
+ name: "cardholderName",
4373
+ placeholder: "Name on card required",
4374
+ value: (cardData == null ? void 0 : cardData.cardName) || "",
4375
+ onChange: (e) => {
4376
+ const value = e.target.value;
4377
+ if (/^[a-zA-Z\s]*$/.test(value)) {
4378
+ handleCardChange("cardName", value);
4379
+ }
4380
+ }
4381
+ }
4382
+ ), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ React18.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ React18.createElement("div", { className: "form-group", style: { marginBottom: "20px" } }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "zipcode" }, "Zip"), /* @__PURE__ */ React18.createElement(
4383
+ "input",
4384
+ {
4385
+ type: "text",
4386
+ id: "zipcode",
4387
+ name: "zipcode",
4388
+ placeholder: "Zip",
4389
+ value: (_a = cardData == null ? void 0 : cardData.zipCode) != null ? _a : "",
4390
+ onChange: (e) => handleCardChange("zipCode", e.target.value)
4391
+ }
4392
+ ), (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ React18.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.zipCode)), /* @__PURE__ */ React18.createElement(
4393
+ "input",
4394
+ {
4395
+ type: "submit",
4396
+ className: "idle-green-btn w-100",
4397
+ defaultValue: "Submit"
4398
+ }
4399
+ ))
4400
+ ));
4401
+ }
4024
4402
  export {
4025
4403
  AddCard,
4404
+ AddCardEasyPay,
4026
4405
  GetPaymentPage,
4027
4406
  PreAuthPayment,
4028
4407
  RequestPayment,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinerohit11/testwidget",
3
- "version": "0.1.98",
3
+ "version": "0.1.99",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "next dev -p 4001",