@pinerohit11/testwidget 0.1.48 → 0.1.49
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{index.mjs → index.cjs} +574 -550
- package/dist/index.js +538 -586
- package/package.json +3 -2
- package/dist/index.css +0 -652
- /package/dist/{index.d.mts → index.d.cts} +0 -0
@@ -1,7 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __create = Object.create;
|
1
3
|
var __defProp = Object.defineProperty;
|
2
4
|
var __defProps = Object.defineProperties;
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
6
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
8
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
5
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
11
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
7
12
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
@@ -17,17 +22,54 @@ var __spreadValues = (a, b) => {
|
|
17
22
|
return a;
|
18
23
|
};
|
19
24
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
25
|
+
var __export = (target, all) => {
|
26
|
+
for (var name in all)
|
27
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
28
|
+
};
|
29
|
+
var __copyProps = (to, from, except, desc) => {
|
30
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
31
|
+
for (let key of __getOwnPropNames(from))
|
32
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
33
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
34
|
+
}
|
35
|
+
return to;
|
36
|
+
};
|
37
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
38
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
39
|
+
// file that has been converted to a CommonJS file using a Babel-
|
40
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
41
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
42
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
43
|
+
mod
|
44
|
+
));
|
45
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
46
|
+
|
47
|
+
// src/app/index.ts
|
48
|
+
var app_exports = {};
|
49
|
+
__export(app_exports, {
|
50
|
+
CompletedTransactions: () => CompletedTransactions,
|
51
|
+
GetPaymentDynamic: () => GetPaymentDynamic,
|
52
|
+
Payment: () => Payment,
|
53
|
+
RequestPayment: () => RequestPayment,
|
54
|
+
RequestPaymentAllInput: () => RequestPaymentAllInput,
|
55
|
+
RequestPaymentDynamic: () => RequestPaymentDynamic,
|
56
|
+
RequestPaymentonClick: () => RequestPaymentonClick,
|
57
|
+
RqstPaymntInputField: () => RqstPaymntInputField,
|
58
|
+
TockenizPay: () => TockenizPay
|
59
|
+
});
|
60
|
+
module.exports = __toCommonJS(app_exports);
|
20
61
|
|
21
62
|
// src/app/components/RequestPayment/RequestPayment.tsx
|
22
|
-
|
63
|
+
var import_react4 = __toESM(require("react"), 1);
|
64
|
+
var import_axios = __toESM(require("axios"), 1);
|
23
65
|
|
24
66
|
// src/app/components/Loader/Loader.tsx
|
25
|
-
|
67
|
+
var import_react2 = __toESM(require("react"), 1);
|
26
68
|
|
27
69
|
// src/app/components/Loader/LoaderStyle.tsx
|
28
|
-
|
70
|
+
var import_react = __toESM(require("react"), 1);
|
29
71
|
var LoaderStyle = (props) => {
|
30
|
-
return /* @__PURE__ */
|
72
|
+
return /* @__PURE__ */ import_react.default.createElement("style", null, `
|
31
73
|
.loader {
|
32
74
|
position: fixed;
|
33
75
|
/* Fixed position to cover the viewport */
|
@@ -146,359 +188,17 @@ var LoaderStyle_default = LoaderStyle;
|
|
146
188
|
|
147
189
|
// src/app/components/Loader/Loader.tsx
|
148
190
|
var Loader = (props) => {
|
149
|
-
return /* @__PURE__ */
|
191
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(LoaderStyle_default, null), (props == null ? void 0 : props.loading) && /* @__PURE__ */ import_react2.default.createElement("div", { className: "loader" }, /* @__PURE__ */ import_react2.default.createElement("div", { className: "lds-ellipsis" }, /* @__PURE__ */ import_react2.default.createElement("div", null), /* @__PURE__ */ import_react2.default.createElement("div", null), /* @__PURE__ */ import_react2.default.createElement("div", null), /* @__PURE__ */ import_react2.default.createElement("div", null))));
|
150
192
|
};
|
151
193
|
var Loader_default = Loader;
|
152
194
|
|
153
195
|
// src/app/components/RequestPayment/RequestPayment.tsx
|
154
|
-
|
155
|
-
|
156
|
-
// src/app/components/baseurl.ts
|
157
|
-
var baseUrl = "https://staging-widget.fractalpay.com/";
|
158
|
-
|
159
|
-
// src/app/components/Errortext.ts
|
160
|
-
var ErrorText = {
|
161
|
-
namerequired: "Full Name is required",
|
162
|
-
amountrequired: "Amount is required",
|
163
|
-
amountpositive: "Amount should be positive",
|
164
|
-
amountzero: "Amount should not be zero",
|
165
|
-
amountenter: "Please enter an amount",
|
166
|
-
amountvalid: "Please enter a valid amount",
|
167
|
-
phoneoremailrequired: "Phone or Email is required",
|
168
|
-
invalidemail: "Invalid email",
|
169
|
-
invalidemailformat: "Invalid email format",
|
170
|
-
onlylettersallowed: "Only letters are allowed",
|
171
|
-
phonenumberlength: "Phone number should be 10 digits",
|
172
|
-
phonenumberrequired: "Please enter a phone number",
|
173
|
-
phonenumbervalid: "Please enter a valid 10-digit phone number",
|
174
|
-
orderidenter: "Please enter an order ID",
|
175
|
-
networkresponseerror: "Network response was not ok",
|
176
|
-
anerroroccured: "An error occurred. Please try again.",
|
177
|
-
montherror: "Please write month only 1 to 12",
|
178
|
-
fieldrequired: "This field is required"
|
179
|
-
};
|
180
|
-
|
181
|
-
// src/app/components/RequestPayment/RequestPayment.tsx
|
182
|
-
function RequestPayment(props) {
|
183
|
-
const fractalpayClientKey = props.fractalpayClientKey;
|
184
|
-
const [show, setShow] = useState(false);
|
185
|
-
const [loading, setLoading] = useState(false);
|
186
|
-
const [errors, setErrors] = useState({});
|
187
|
-
const [requestDetails, setRequestDetails] = useState({
|
188
|
-
email: "",
|
189
|
-
amount: "",
|
190
|
-
phone_number: "",
|
191
|
-
order_id: "",
|
192
|
-
name: "",
|
193
|
-
fractalpayPublicKey: fractalpayClientKey
|
194
|
-
});
|
195
|
-
const [showConfirmationModal, setShowConfirmationModal] = useState(false);
|
196
|
-
const phoneNumberRegex = (value) => /^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(value);
|
197
|
-
const amoutRegex = /[+-]?([0-9]*[.])?[0-9]+/;
|
198
|
-
const positiveAmountRegex = /^[+]?\d+(\.\d+)?$/;
|
199
|
-
const isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
200
|
-
const isAlpha = (value) => /^[A-Za-z\s]*$/.test(value);
|
201
|
-
const handleClose = () => {
|
202
|
-
setShow(false);
|
203
|
-
emptyFields();
|
204
|
-
setErrors({});
|
205
|
-
};
|
206
|
-
const handleShow = () => setShow(true);
|
207
|
-
const handleCloseConfirmationModal = () => setShowConfirmationModal(false);
|
208
|
-
const emptyFields = () => {
|
209
|
-
setRequestDetails({
|
210
|
-
email: "",
|
211
|
-
amount: "",
|
212
|
-
phone_number: "",
|
213
|
-
order_id: "",
|
214
|
-
name: "",
|
215
|
-
fractalpayPublicKey: fractalpayClientKey
|
216
|
-
});
|
217
|
-
};
|
218
|
-
const handleSubmit = (event) => {
|
219
|
-
let message = {
|
220
|
-
type: "preview.compiledcheck",
|
221
|
-
other: __spreadProps(__spreadValues({}, event), { status: true })
|
222
|
-
};
|
223
|
-
console.log("message: ", message);
|
224
|
-
window.parent.postMessage(message, "*");
|
225
|
-
};
|
226
|
-
const sendRequestPayment = async () => {
|
227
|
-
setErrors({});
|
228
|
-
if (!(requestDetails == null ? void 0 : requestDetails.email) && requestDetails.phone_number && !phoneNumberRegex(requestDetails.phone_number)) {
|
229
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
230
|
-
phone_number: "Phone number should be 10 digits"
|
231
|
-
}));
|
232
|
-
return;
|
233
|
-
}
|
234
|
-
if (!validateForm()) {
|
235
|
-
return;
|
236
|
-
}
|
237
|
-
try {
|
238
|
-
setLoading(true);
|
239
|
-
const formData = {
|
240
|
-
fractalpayPublicKey: fractalpayClientKey,
|
241
|
-
amount: requestDetails.amount,
|
242
|
-
phone_number: requestDetails.phone_number,
|
243
|
-
order_id: requestDetails.order_id,
|
244
|
-
action: "request",
|
245
|
-
name: requestDetails.name,
|
246
|
-
email: requestDetails.email
|
247
|
-
};
|
248
|
-
let response = await fetch(`${baseUrl}create-widget-order`, {
|
249
|
-
method: "POST",
|
250
|
-
headers: {
|
251
|
-
"Content-Type": "application/json"
|
252
|
-
// Setting the header for JSON content
|
253
|
-
},
|
254
|
-
body: JSON.stringify(formData)
|
255
|
-
// Sending the formData as JSON
|
256
|
-
});
|
257
|
-
if (response.ok) {
|
258
|
-
const data = await response.json();
|
259
|
-
setShowConfirmationModal(true);
|
260
|
-
setShow(false);
|
261
|
-
emptyFields();
|
262
|
-
handleSubmit(data);
|
263
|
-
} else {
|
264
|
-
console.log(`HTTP error! Status: ${response.status}`);
|
265
|
-
}
|
266
|
-
console.log(response == null ? void 0 : response.data);
|
267
|
-
setLoading(false);
|
268
|
-
} catch (error) {
|
269
|
-
console.log(error);
|
270
|
-
setLoading(false);
|
271
|
-
}
|
272
|
-
};
|
273
|
-
const validateAmount = (amount) => amoutRegex.test(amount);
|
274
|
-
const PositiveAmount = (amount) => positiveAmountRegex.test(amount);
|
275
|
-
const handleChange = (e) => {
|
276
|
-
const { value } = e.target;
|
277
|
-
const token = e.target.dataset.token;
|
278
|
-
setRequestDetails(__spreadProps(__spreadValues({}, requestDetails), { [token]: value }));
|
279
|
-
if (token === "name" && !isAlpha(value)) {
|
280
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
281
|
-
[token]: ErrorText.onlylettersallowed
|
282
|
-
}));
|
283
|
-
return;
|
284
|
-
}
|
285
|
-
if (token === "phone_number" && !phoneNumberRegex(value)) {
|
286
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
287
|
-
[token]: ErrorText.phonenumberlength
|
288
|
-
}));
|
289
|
-
return;
|
290
|
-
}
|
291
|
-
if (token === "email" && !isValidEmail(value)) {
|
292
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
293
|
-
email: ErrorText.invalidemailformat
|
294
|
-
}));
|
295
|
-
return;
|
296
|
-
}
|
297
|
-
if (token === "amount" && !value) {
|
298
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
299
|
-
amount: ErrorText.amountrequired
|
300
|
-
}));
|
301
|
-
return;
|
302
|
-
}
|
303
|
-
if (token === "amount" && !PositiveAmount(value)) {
|
304
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
305
|
-
amount: ErrorText.amountpositive
|
306
|
-
}));
|
307
|
-
return;
|
308
|
-
}
|
309
|
-
if (token === "amount" && parseFloat(value) === 0) {
|
310
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
311
|
-
amount: ErrorText.amountzero
|
312
|
-
}));
|
313
|
-
return;
|
314
|
-
}
|
315
|
-
if (value) {
|
316
|
-
setErrors(__spreadProps(__spreadValues({}, errors), { [token]: "" }));
|
317
|
-
}
|
318
|
-
};
|
319
|
-
const handleAmountBlur = () => {
|
320
|
-
const value = requestDetails.amount;
|
321
|
-
if (value && !value.includes(".")) {
|
322
|
-
setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), {
|
323
|
-
amount: `${value}.00`
|
324
|
-
}));
|
325
|
-
}
|
326
|
-
};
|
327
|
-
const validateForm = () => {
|
328
|
-
let newErrors = {};
|
329
|
-
if (!requestDetails.name) newErrors.name = ErrorText.namerequired;
|
330
|
-
if (!requestDetails.amount) newErrors.amount = ErrorText.amountrequired;
|
331
|
-
if (!requestDetails.phone_number && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.phone_number = ErrorText.phoneoremailrequired;
|
332
|
-
if (!requestDetails.email && !requestDetails.phone_number) newErrors.email = ErrorText.phoneoremailrequired;
|
333
|
-
if (!requestDetails.phone_number && requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
334
|
-
setErrors(newErrors);
|
335
|
-
return Object.keys(newErrors).length === 0;
|
336
|
-
};
|
337
|
-
useEffect(() => {
|
338
|
-
if (props.amount) {
|
339
|
-
setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), { amount: props.amount }));
|
340
|
-
}
|
341
|
-
}, [props.amount]);
|
342
|
-
const handleKeyDown = (e) => {
|
343
|
-
if (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
344
|
-
e.preventDefault();
|
345
|
-
}
|
346
|
-
};
|
347
|
-
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(Loader_default, { loading }), /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("button", { className: "paymentBtn", onClick: handleShow }, "Request Payment"), /* @__PURE__ */ React3.createElement(
|
348
|
-
Modal,
|
349
|
-
{
|
350
|
-
show,
|
351
|
-
onHide: handleClose,
|
352
|
-
size: "lg",
|
353
|
-
backdrop: "static",
|
354
|
-
keyboard: false
|
355
|
-
},
|
356
|
-
/* @__PURE__ */ React3.createElement(Modal.Header, { closeButton: true }, /* @__PURE__ */ React3.createElement(Modal.Title, { className: "testcolor" }, "Request Payment")),
|
357
|
-
/* @__PURE__ */ React3.createElement(Modal.Body, { id: "Checkout" }, /* @__PURE__ */ React3.createElement(Form, null, /* @__PURE__ */ React3.createElement("div", { className: "mb-3" }, /* @__PURE__ */ React3.createElement("label", { htmlFor: "exampleFormControlInput2", className: "form-label" }, "FULL NAME *"), /* @__PURE__ */ React3.createElement(
|
358
|
-
"input",
|
359
|
-
{
|
360
|
-
className: "form-control",
|
361
|
-
type: "text",
|
362
|
-
placeholder: "Full Name",
|
363
|
-
"data-token": "name",
|
364
|
-
onChange: handleChange
|
365
|
-
}
|
366
|
-
), errors.name && /* @__PURE__ */ React3.createElement("small", { className: "text-danger" }, errors.name)), /* @__PURE__ */ React3.createElement("div", { className: "mb-3" }, /* @__PURE__ */ React3.createElement("label", { htmlFor: "requestPhoneNumber", className: "form-label" }, "Phone Number"), /* @__PURE__ */ React3.createElement(
|
367
|
-
"input",
|
368
|
-
{
|
369
|
-
maxLength: 10,
|
370
|
-
className: "form-control",
|
371
|
-
onChange: (e) => {
|
372
|
-
handleChange(e);
|
373
|
-
},
|
374
|
-
placeholder: "Phone Number",
|
375
|
-
type: "text",
|
376
|
-
"data-token": "phone_number"
|
377
|
-
}
|
378
|
-
), errors.phone_number && /* @__PURE__ */ React3.createElement("small", { className: "text-danger" }, errors.phone_number)), /* @__PURE__ */ React3.createElement("div", { className: "mb-3" }, /* @__PURE__ */ React3.createElement("label", { htmlFor: "exampleFormControlInput2", className: "form-label" }, "EMAIL"), /* @__PURE__ */ React3.createElement(
|
379
|
-
"input",
|
380
|
-
{
|
381
|
-
className: "form-control",
|
382
|
-
type: "text",
|
383
|
-
placeholder: "Email",
|
384
|
-
onChange: handleChange,
|
385
|
-
"data-token": "email"
|
386
|
-
}
|
387
|
-
), errors.email && /* @__PURE__ */ React3.createElement("small", { className: "text-danger" }, errors.email)), /* @__PURE__ */ React3.createElement("div", { className: "mb-3" }, /* @__PURE__ */ React3.createElement("label", { htmlFor: "exampleFormControlInput2", className: "form-label" }, "AMOUNT *"), /* @__PURE__ */ React3.createElement("div", { className: "input-group" }, /* @__PURE__ */ React3.createElement("span", { className: "input-group-text" }, "$"), /* @__PURE__ */ React3.createElement(
|
388
|
-
"input",
|
389
|
-
{
|
390
|
-
"data-token": "amount",
|
391
|
-
placeholder: "Amount",
|
392
|
-
min: 0,
|
393
|
-
type: "number",
|
394
|
-
className: "form-control",
|
395
|
-
value: requestDetails.amount,
|
396
|
-
onChange: handleChange,
|
397
|
-
onBlur: handleAmountBlur,
|
398
|
-
onKeyDown: handleKeyDown,
|
399
|
-
onFocus: (e) => e.target.addEventListener("wheel", function(e2) {
|
400
|
-
e2.preventDefault();
|
401
|
-
}, { passive: false })
|
402
|
-
}
|
403
|
-
)), errors.amount && /* @__PURE__ */ React3.createElement("small", { className: "text-danger" }, errors.amount)), /* @__PURE__ */ React3.createElement("div", { className: "mb-3" }, /* @__PURE__ */ React3.createElement("label", { htmlFor: "exampleFormControlInput2", className: "form-label" }, "ORDER ID"), /* @__PURE__ */ React3.createElement(
|
404
|
-
"input",
|
405
|
-
{
|
406
|
-
className: "form-control",
|
407
|
-
type: "text",
|
408
|
-
placeholder: "Order Id",
|
409
|
-
onChange: handleChange,
|
410
|
-
"data-token": "order_id"
|
411
|
-
}
|
412
|
-
), errors.order_id && /* @__PURE__ */ React3.createElement("small", { className: "text-danger" }, errors.order_id)), /* @__PURE__ */ React3.createElement(
|
413
|
-
Button,
|
414
|
-
{
|
415
|
-
type: "button",
|
416
|
-
className: "PayButton",
|
417
|
-
onClick: sendRequestPayment,
|
418
|
-
disabled: loading
|
419
|
-
},
|
420
|
-
loading ? "Loading..." : "Send Request"
|
421
|
-
)), /* @__PURE__ */ React3.createElement("div", { className: "powerd-by-part" }, /* @__PURE__ */ React3.createElement(
|
422
|
-
"svg",
|
423
|
-
{
|
424
|
-
xmlns: "http://www.w3.org/2000/svg",
|
425
|
-
width: "20",
|
426
|
-
height: "20",
|
427
|
-
viewBox: "0 0 26 26"
|
428
|
-
},
|
429
|
-
/* @__PURE__ */ React3.createElement(
|
430
|
-
"path",
|
431
|
-
{
|
432
|
-
fill: "currentColor",
|
433
|
-
d: "M23.633 5.028a1.074 1.074 0 0 0-.777-.366c-2.295-.06-5.199-2.514-7.119-3.477C14.551.592 13.768.201 13.18.098a1.225 1.225 0 0 0-.36.001c-.588.103-1.371.494-2.556 1.087c-1.92.962-4.824 3.416-7.119 3.476a1.08 1.08 0 0 0-.778.366a1.167 1.167 0 0 0-.291.834c.493 10.023 4.088 16.226 10.396 19.831c.164.093.346.141.527.141s.363-.048.528-.141c6.308-3.605 9.902-9.808 10.396-19.831a1.161 1.161 0 0 0-.29-.834zM18.617 8.97l-5.323 7.855c-.191.282-.491.469-.788.469c-.298 0-.629-.163-.838-.372l-3.752-3.753a.656.656 0 0 1 0-.926l.927-.929a.658.658 0 0 1 .926 0l2.44 2.44l4.239-6.257a.657.657 0 0 1 .91-.173l1.085.736a.657.657 0 0 1 .174.91z"
|
434
|
-
}
|
435
|
-
)
|
436
|
-
), "Secure payments powered by Fractal", /* @__PURE__ */ React3.createElement(
|
437
|
-
"img",
|
438
|
-
{
|
439
|
-
src: "https://ui.fractalpay.com/favicon.ico",
|
440
|
-
alt: "Fractal logo",
|
441
|
-
className: "powered-logo"
|
442
|
-
}
|
443
|
-
)))
|
444
|
-
), /* @__PURE__ */ React3.createElement(
|
445
|
-
Modal,
|
446
|
-
{
|
447
|
-
className: "payment-suc",
|
448
|
-
show: showConfirmationModal,
|
449
|
-
onHide: handleCloseConfirmationModal
|
450
|
-
},
|
451
|
-
/* @__PURE__ */ React3.createElement(Modal.Header, { closeButton: true }),
|
452
|
-
/* @__PURE__ */ React3.createElement(Modal.Body, null, /* @__PURE__ */ React3.createElement(
|
453
|
-
"svg",
|
454
|
-
{
|
455
|
-
width: "60",
|
456
|
-
height: "60",
|
457
|
-
viewBox: "0 0 60 60",
|
458
|
-
fill: "none",
|
459
|
-
xmlns: "http://www.w3.org/2000/svg"
|
460
|
-
},
|
461
|
-
/* @__PURE__ */ React3.createElement(
|
462
|
-
"rect",
|
463
|
-
{
|
464
|
-
x: "0.5",
|
465
|
-
y: "0.5",
|
466
|
-
width: "59",
|
467
|
-
height: "59",
|
468
|
-
rx: "29.5",
|
469
|
-
stroke: "#31B379"
|
470
|
-
}
|
471
|
-
),
|
472
|
-
/* @__PURE__ */ React3.createElement("g", { clipPath: "url(#clip0_2659_5018)" }, /* @__PURE__ */ React3.createElement(
|
473
|
-
"path",
|
474
|
-
{
|
475
|
-
d: "M41.1778 22.248C40.7483 21.8184 40.0518 21.8184 39.6222 22.248L26.4435 35.4268L21.3778 30.3611C20.9483 29.9315 20.2518 29.9316 19.8222 30.3611C19.3926 30.7907 19.3926 31.4871 19.8222 31.9167L25.6657 37.7601C26.0951 38.1897 26.7921 38.1894 27.2213 37.7601L41.1778 23.8036C41.6074 23.3741 41.6074 22.6776 41.1778 22.248Z",
|
476
|
-
fill: "#31B379"
|
477
|
-
}
|
478
|
-
)),
|
479
|
-
/* @__PURE__ */ React3.createElement("defs", null, /* @__PURE__ */ React3.createElement("clipPath", { id: "clip0_2659_5018" }, /* @__PURE__ */ React3.createElement(
|
480
|
-
"rect",
|
481
|
-
{
|
482
|
-
width: "22",
|
483
|
-
height: "22",
|
484
|
-
fill: "white",
|
485
|
-
transform: "translate(19.5 19.0039)"
|
486
|
-
}
|
487
|
-
)))
|
488
|
-
), /* @__PURE__ */ React3.createElement("h2", null, "Payment link has been ", /* @__PURE__ */ React3.createElement("br", null), " sent successfully"))
|
489
|
-
)));
|
490
|
-
}
|
491
|
-
|
492
|
-
// src/app/components/RequestPayment/RequestPaymentAllInput.tsx
|
493
|
-
import React5, { useState as useState2 } from "react";
|
494
|
-
import { Modal as Modal2 } from "react-bootstrap";
|
495
|
-
import { toast, ToastContainer } from "react-toastify";
|
496
|
-
import "react-toastify/dist/ReactToastify.css";
|
196
|
+
var import_react_bootstrap = require("react-bootstrap");
|
497
197
|
|
498
198
|
// src/app/components/RequestPayment/RequestPaymentstyles.tsx
|
499
|
-
|
199
|
+
var import_react3 = __toESM(require("react"), 1);
|
500
200
|
var RequestPaymentstyles = (props) => {
|
501
|
-
return /* @__PURE__ */
|
201
|
+
return /* @__PURE__ */ import_react3.default.createElement("style", null, `
|
502
202
|
.paymentBtn {
|
503
203
|
background-color: black;
|
504
204
|
border: none;
|
@@ -1320,24 +1020,353 @@ input[type="number"] {
|
|
1320
1020
|
-moz-appearance: textfield;
|
1321
1021
|
}
|
1322
1022
|
|
1323
|
-
`);
|
1324
|
-
};
|
1325
|
-
var RequestPaymentstyles_default = RequestPaymentstyles;
|
1326
|
-
|
1023
|
+
`);
|
1024
|
+
};
|
1025
|
+
var RequestPaymentstyles_default = RequestPaymentstyles;
|
1026
|
+
|
1027
|
+
// src/app/components/baseurl.ts
|
1028
|
+
var baseUrl = "https://staging-widget.fractalpay.com/";
|
1029
|
+
|
1030
|
+
// src/app/components/Errortext.ts
|
1031
|
+
var ErrorText = {
|
1032
|
+
namerequired: "Full Name is required",
|
1033
|
+
amountrequired: "Amount is required",
|
1034
|
+
amountpositive: "Amount should be positive",
|
1035
|
+
amountzero: "Amount should not be zero",
|
1036
|
+
amountenter: "Please enter an amount",
|
1037
|
+
amountvalid: "Please enter a valid amount",
|
1038
|
+
phoneoremailrequired: "Phone or Email is required",
|
1039
|
+
invalidemail: "Invalid email",
|
1040
|
+
invalidemailformat: "Invalid email format",
|
1041
|
+
onlylettersallowed: "Only letters are allowed",
|
1042
|
+
phonenumberlength: "Phone number should be 10 digits",
|
1043
|
+
phonenumberrequired: "Please enter a phone number",
|
1044
|
+
phonenumbervalid: "Please enter a valid 10-digit phone number",
|
1045
|
+
orderidenter: "Please enter an order ID",
|
1046
|
+
networkresponseerror: "Network response was not ok",
|
1047
|
+
anerroroccured: "An error occurred. Please try again.",
|
1048
|
+
montherror: "Please write month only 1 to 12",
|
1049
|
+
fieldrequired: "This field is required"
|
1050
|
+
};
|
1051
|
+
|
1052
|
+
// src/app/components/RequestPayment/RequestPayment.tsx
|
1053
|
+
function RequestPayment(props) {
|
1054
|
+
const fractalpayClientKey = props.fractalpayClientKey;
|
1055
|
+
const [show, setShow] = (0, import_react4.useState)(false);
|
1056
|
+
const [loading, setLoading] = (0, import_react4.useState)(false);
|
1057
|
+
const [errors, setErrors] = (0, import_react4.useState)({});
|
1058
|
+
const [requestDetails, setRequestDetails] = (0, import_react4.useState)({
|
1059
|
+
email: "",
|
1060
|
+
amount: "",
|
1061
|
+
phone_number: "",
|
1062
|
+
order_id: "",
|
1063
|
+
name: "",
|
1064
|
+
fractalpayPublicKey: fractalpayClientKey
|
1065
|
+
});
|
1066
|
+
const [showConfirmationModal, setShowConfirmationModal] = (0, import_react4.useState)(false);
|
1067
|
+
const phoneNumberRegex = (value) => /^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(value);
|
1068
|
+
const amoutRegex = /[+-]?([0-9]*[.])?[0-9]+/;
|
1069
|
+
const positiveAmountRegex = /^[+]?\d+(\.\d+)?$/;
|
1070
|
+
const isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
1071
|
+
const isAlpha = (value) => /^[A-Za-z\s]*$/.test(value);
|
1072
|
+
const handleClose = () => {
|
1073
|
+
setShow(false);
|
1074
|
+
emptyFields();
|
1075
|
+
setErrors({});
|
1076
|
+
};
|
1077
|
+
const handleShow = () => setShow(true);
|
1078
|
+
const handleCloseConfirmationModal = () => setShowConfirmationModal(false);
|
1079
|
+
const emptyFields = () => {
|
1080
|
+
setRequestDetails({
|
1081
|
+
email: "",
|
1082
|
+
amount: "",
|
1083
|
+
phone_number: "",
|
1084
|
+
order_id: "",
|
1085
|
+
name: "",
|
1086
|
+
fractalpayPublicKey: fractalpayClientKey
|
1087
|
+
});
|
1088
|
+
};
|
1089
|
+
const handleSubmit = (event) => {
|
1090
|
+
let message = {
|
1091
|
+
type: "preview.compiledcheck",
|
1092
|
+
other: __spreadProps(__spreadValues({}, event), { status: true })
|
1093
|
+
};
|
1094
|
+
console.log("message: ", message);
|
1095
|
+
window.parent.postMessage(message, "*");
|
1096
|
+
};
|
1097
|
+
const sendRequestPayment = async () => {
|
1098
|
+
setErrors({});
|
1099
|
+
if (!(requestDetails == null ? void 0 : requestDetails.email) && requestDetails.phone_number && !phoneNumberRegex(requestDetails.phone_number)) {
|
1100
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
1101
|
+
phone_number: "Phone number should be 10 digits"
|
1102
|
+
}));
|
1103
|
+
return;
|
1104
|
+
}
|
1105
|
+
if (!validateForm()) {
|
1106
|
+
return;
|
1107
|
+
}
|
1108
|
+
try {
|
1109
|
+
setLoading(true);
|
1110
|
+
const formData = {
|
1111
|
+
fractalpayPublicKey: fractalpayClientKey,
|
1112
|
+
amount: requestDetails.amount,
|
1113
|
+
phone_number: requestDetails.phone_number,
|
1114
|
+
order_id: requestDetails.order_id,
|
1115
|
+
action: "request",
|
1116
|
+
name: requestDetails.name,
|
1117
|
+
email: requestDetails.email
|
1118
|
+
};
|
1119
|
+
let response = await import_axios.default.post(`${baseUrl}create-widget-order`, formData);
|
1120
|
+
if ((response == null ? void 0 : response.status) === 200) {
|
1121
|
+
setShowConfirmationModal(true);
|
1122
|
+
setShow(false);
|
1123
|
+
emptyFields();
|
1124
|
+
handleSubmit(response == null ? void 0 : response.data);
|
1125
|
+
}
|
1126
|
+
console.log(response == null ? void 0 : response.data);
|
1127
|
+
setLoading(false);
|
1128
|
+
} catch (error) {
|
1129
|
+
console.log(error);
|
1130
|
+
setLoading(false);
|
1131
|
+
}
|
1132
|
+
};
|
1133
|
+
const validateAmount = (amount) => amoutRegex.test(amount);
|
1134
|
+
const PositiveAmount = (amount) => positiveAmountRegex.test(amount);
|
1135
|
+
const handleChange = (e) => {
|
1136
|
+
const { value } = e.target;
|
1137
|
+
const token = e.target.dataset.token;
|
1138
|
+
setRequestDetails(__spreadProps(__spreadValues({}, requestDetails), { [token]: value }));
|
1139
|
+
if (token === "name" && !isAlpha(value)) {
|
1140
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
1141
|
+
[token]: ErrorText.onlylettersallowed
|
1142
|
+
}));
|
1143
|
+
return;
|
1144
|
+
}
|
1145
|
+
if (token === "phone_number" && !phoneNumberRegex(value)) {
|
1146
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
1147
|
+
[token]: ErrorText.phonenumberlength
|
1148
|
+
}));
|
1149
|
+
return;
|
1150
|
+
}
|
1151
|
+
if (token === "email" && !isValidEmail(value)) {
|
1152
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
1153
|
+
email: ErrorText.invalidemailformat
|
1154
|
+
}));
|
1155
|
+
return;
|
1156
|
+
}
|
1157
|
+
if (token === "amount" && !value) {
|
1158
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
1159
|
+
amount: ErrorText.amountrequired
|
1160
|
+
}));
|
1161
|
+
return;
|
1162
|
+
}
|
1163
|
+
if (token === "amount" && !PositiveAmount(value)) {
|
1164
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
1165
|
+
amount: ErrorText.amountpositive
|
1166
|
+
}));
|
1167
|
+
return;
|
1168
|
+
}
|
1169
|
+
if (token === "amount" && parseFloat(value) === 0) {
|
1170
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
1171
|
+
amount: ErrorText.amountzero
|
1172
|
+
}));
|
1173
|
+
return;
|
1174
|
+
}
|
1175
|
+
if (value) {
|
1176
|
+
setErrors(__spreadProps(__spreadValues({}, errors), { [token]: "" }));
|
1177
|
+
}
|
1178
|
+
};
|
1179
|
+
const handleAmountBlur = () => {
|
1180
|
+
const value = requestDetails.amount;
|
1181
|
+
if (value && !value.includes(".")) {
|
1182
|
+
setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), {
|
1183
|
+
amount: `${value}.00`
|
1184
|
+
}));
|
1185
|
+
}
|
1186
|
+
};
|
1187
|
+
const validateForm = () => {
|
1188
|
+
let newErrors = {};
|
1189
|
+
if (!requestDetails.name) newErrors.name = ErrorText.namerequired;
|
1190
|
+
if (!requestDetails.amount) newErrors.amount = ErrorText.amountrequired;
|
1191
|
+
if (!requestDetails.phone_number && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.phone_number = ErrorText.phoneoremailrequired;
|
1192
|
+
if (!requestDetails.email && !requestDetails.phone_number) newErrors.email = ErrorText.phoneoremailrequired;
|
1193
|
+
if (!requestDetails.phone_number && requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
1194
|
+
setErrors(newErrors);
|
1195
|
+
return Object.keys(newErrors).length === 0;
|
1196
|
+
};
|
1197
|
+
(0, import_react4.useEffect)(() => {
|
1198
|
+
if (props.amount) {
|
1199
|
+
setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), { amount: props.amount }));
|
1200
|
+
}
|
1201
|
+
}, [props.amount]);
|
1202
|
+
const handleKeyDown = (e) => {
|
1203
|
+
if (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
1204
|
+
e.preventDefault();
|
1205
|
+
}
|
1206
|
+
};
|
1207
|
+
return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(RequestPaymentstyles_default, null), /* @__PURE__ */ import_react4.default.createElement(Loader_default, { loading }), /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement("button", { className: "paymentBtn", onClick: handleShow }, "Request Payment"), /* @__PURE__ */ import_react4.default.createElement(
|
1208
|
+
import_react_bootstrap.Modal,
|
1209
|
+
{
|
1210
|
+
show,
|
1211
|
+
onHide: handleClose,
|
1212
|
+
size: "lg",
|
1213
|
+
backdrop: "static",
|
1214
|
+
keyboard: false
|
1215
|
+
},
|
1216
|
+
/* @__PURE__ */ import_react4.default.createElement(import_react_bootstrap.Modal.Header, { closeButton: true }, /* @__PURE__ */ import_react4.default.createElement(import_react_bootstrap.Modal.Title, null, "Request Payment")),
|
1217
|
+
/* @__PURE__ */ import_react4.default.createElement(import_react_bootstrap.Modal.Body, { id: "Checkout" }, /* @__PURE__ */ import_react4.default.createElement(import_react_bootstrap.Form, null, /* @__PURE__ */ import_react4.default.createElement("div", { className: "mb-3" }, /* @__PURE__ */ import_react4.default.createElement("label", { htmlFor: "exampleFormControlInput2", className: "form-label" }, "FULL NAME *"), /* @__PURE__ */ import_react4.default.createElement(
|
1218
|
+
"input",
|
1219
|
+
{
|
1220
|
+
className: "form-control",
|
1221
|
+
type: "text",
|
1222
|
+
placeholder: "Full Name",
|
1223
|
+
"data-token": "name",
|
1224
|
+
onChange: handleChange
|
1225
|
+
}
|
1226
|
+
), errors.name && /* @__PURE__ */ import_react4.default.createElement("small", { className: "text-danger" }, errors.name)), /* @__PURE__ */ import_react4.default.createElement("div", { className: "mb-3" }, /* @__PURE__ */ import_react4.default.createElement("label", { htmlFor: "requestPhoneNumber", className: "form-label" }, "Phone Number"), /* @__PURE__ */ import_react4.default.createElement(
|
1227
|
+
"input",
|
1228
|
+
{
|
1229
|
+
maxLength: 10,
|
1230
|
+
className: "form-control",
|
1231
|
+
onChange: (e) => {
|
1232
|
+
handleChange(e);
|
1233
|
+
},
|
1234
|
+
placeholder: "Phone Number",
|
1235
|
+
type: "text",
|
1236
|
+
"data-token": "phone_number"
|
1237
|
+
}
|
1238
|
+
), errors.phone_number && /* @__PURE__ */ import_react4.default.createElement("small", { className: "text-danger" }, errors.phone_number)), /* @__PURE__ */ import_react4.default.createElement("div", { className: "mb-3" }, /* @__PURE__ */ import_react4.default.createElement("label", { htmlFor: "exampleFormControlInput2", className: "form-label" }, "EMAIL"), /* @__PURE__ */ import_react4.default.createElement(
|
1239
|
+
"input",
|
1240
|
+
{
|
1241
|
+
className: "form-control",
|
1242
|
+
type: "text",
|
1243
|
+
placeholder: "Email",
|
1244
|
+
onChange: handleChange,
|
1245
|
+
"data-token": "email"
|
1246
|
+
}
|
1247
|
+
), errors.email && /* @__PURE__ */ import_react4.default.createElement("small", { className: "text-danger" }, errors.email)), /* @__PURE__ */ import_react4.default.createElement("div", { className: "mb-3" }, /* @__PURE__ */ import_react4.default.createElement("label", { htmlFor: "exampleFormControlInput2", className: "form-label" }, "AMOUNT *"), /* @__PURE__ */ import_react4.default.createElement("div", { className: "input-group" }, /* @__PURE__ */ import_react4.default.createElement("span", { className: "input-group-text" }, "$"), /* @__PURE__ */ import_react4.default.createElement(
|
1248
|
+
"input",
|
1249
|
+
{
|
1250
|
+
"data-token": "amount",
|
1251
|
+
placeholder: "Amount",
|
1252
|
+
min: 0,
|
1253
|
+
type: "number",
|
1254
|
+
className: "form-control",
|
1255
|
+
value: requestDetails.amount,
|
1256
|
+
onChange: handleChange,
|
1257
|
+
onBlur: handleAmountBlur,
|
1258
|
+
onKeyDown: handleKeyDown,
|
1259
|
+
onFocus: (e) => e.target.addEventListener("wheel", function(e2) {
|
1260
|
+
e2.preventDefault();
|
1261
|
+
}, { passive: false })
|
1262
|
+
}
|
1263
|
+
)), errors.amount && /* @__PURE__ */ import_react4.default.createElement("small", { className: "text-danger" }, errors.amount)), /* @__PURE__ */ import_react4.default.createElement("div", { className: "mb-3" }, /* @__PURE__ */ import_react4.default.createElement("label", { htmlFor: "exampleFormControlInput2", className: "form-label" }, "ORDER ID"), /* @__PURE__ */ import_react4.default.createElement(
|
1264
|
+
"input",
|
1265
|
+
{
|
1266
|
+
className: "form-control",
|
1267
|
+
type: "text",
|
1268
|
+
placeholder: "Order Id",
|
1269
|
+
onChange: handleChange,
|
1270
|
+
"data-token": "order_id"
|
1271
|
+
}
|
1272
|
+
), errors.order_id && /* @__PURE__ */ import_react4.default.createElement("small", { className: "text-danger" }, errors.order_id)), /* @__PURE__ */ import_react4.default.createElement(
|
1273
|
+
import_react_bootstrap.Button,
|
1274
|
+
{
|
1275
|
+
type: "button",
|
1276
|
+
className: "PayButton",
|
1277
|
+
onClick: sendRequestPayment,
|
1278
|
+
disabled: loading
|
1279
|
+
},
|
1280
|
+
loading ? "Loading..." : "Send Request"
|
1281
|
+
)), /* @__PURE__ */ import_react4.default.createElement("div", { className: "powerd-by-part" }, /* @__PURE__ */ import_react4.default.createElement(
|
1282
|
+
"svg",
|
1283
|
+
{
|
1284
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1285
|
+
width: "20",
|
1286
|
+
height: "20",
|
1287
|
+
viewBox: "0 0 26 26"
|
1288
|
+
},
|
1289
|
+
/* @__PURE__ */ import_react4.default.createElement(
|
1290
|
+
"path",
|
1291
|
+
{
|
1292
|
+
fill: "currentColor",
|
1293
|
+
d: "M23.633 5.028a1.074 1.074 0 0 0-.777-.366c-2.295-.06-5.199-2.514-7.119-3.477C14.551.592 13.768.201 13.18.098a1.225 1.225 0 0 0-.36.001c-.588.103-1.371.494-2.556 1.087c-1.92.962-4.824 3.416-7.119 3.476a1.08 1.08 0 0 0-.778.366a1.167 1.167 0 0 0-.291.834c.493 10.023 4.088 16.226 10.396 19.831c.164.093.346.141.527.141s.363-.048.528-.141c6.308-3.605 9.902-9.808 10.396-19.831a1.161 1.161 0 0 0-.29-.834zM18.617 8.97l-5.323 7.855c-.191.282-.491.469-.788.469c-.298 0-.629-.163-.838-.372l-3.752-3.753a.656.656 0 0 1 0-.926l.927-.929a.658.658 0 0 1 .926 0l2.44 2.44l4.239-6.257a.657.657 0 0 1 .91-.173l1.085.736a.657.657 0 0 1 .174.91z"
|
1294
|
+
}
|
1295
|
+
)
|
1296
|
+
), "Secure payments powered by Fractal", /* @__PURE__ */ import_react4.default.createElement(
|
1297
|
+
"img",
|
1298
|
+
{
|
1299
|
+
src: "https://ui.fractalpay.com/favicon.ico",
|
1300
|
+
alt: "Fractal logo",
|
1301
|
+
className: "powered-logo"
|
1302
|
+
}
|
1303
|
+
)))
|
1304
|
+
), /* @__PURE__ */ import_react4.default.createElement(
|
1305
|
+
import_react_bootstrap.Modal,
|
1306
|
+
{
|
1307
|
+
className: "payment-suc",
|
1308
|
+
show: showConfirmationModal,
|
1309
|
+
onHide: handleCloseConfirmationModal
|
1310
|
+
},
|
1311
|
+
/* @__PURE__ */ import_react4.default.createElement(import_react_bootstrap.Modal.Header, { closeButton: true }),
|
1312
|
+
/* @__PURE__ */ import_react4.default.createElement(import_react_bootstrap.Modal.Body, null, /* @__PURE__ */ import_react4.default.createElement(
|
1313
|
+
"svg",
|
1314
|
+
{
|
1315
|
+
width: "60",
|
1316
|
+
height: "60",
|
1317
|
+
viewBox: "0 0 60 60",
|
1318
|
+
fill: "none",
|
1319
|
+
xmlns: "http://www.w3.org/2000/svg"
|
1320
|
+
},
|
1321
|
+
/* @__PURE__ */ import_react4.default.createElement(
|
1322
|
+
"rect",
|
1323
|
+
{
|
1324
|
+
x: "0.5",
|
1325
|
+
y: "0.5",
|
1326
|
+
width: "59",
|
1327
|
+
height: "59",
|
1328
|
+
rx: "29.5",
|
1329
|
+
stroke: "#31B379"
|
1330
|
+
}
|
1331
|
+
),
|
1332
|
+
/* @__PURE__ */ import_react4.default.createElement("g", { clipPath: "url(#clip0_2659_5018)" }, /* @__PURE__ */ import_react4.default.createElement(
|
1333
|
+
"path",
|
1334
|
+
{
|
1335
|
+
d: "M41.1778 22.248C40.7483 21.8184 40.0518 21.8184 39.6222 22.248L26.4435 35.4268L21.3778 30.3611C20.9483 29.9315 20.2518 29.9316 19.8222 30.3611C19.3926 30.7907 19.3926 31.4871 19.8222 31.9167L25.6657 37.7601C26.0951 38.1897 26.7921 38.1894 27.2213 37.7601L41.1778 23.8036C41.6074 23.3741 41.6074 22.6776 41.1778 22.248Z",
|
1336
|
+
fill: "#31B379"
|
1337
|
+
}
|
1338
|
+
)),
|
1339
|
+
/* @__PURE__ */ import_react4.default.createElement("defs", null, /* @__PURE__ */ import_react4.default.createElement("clipPath", { id: "clip0_2659_5018" }, /* @__PURE__ */ import_react4.default.createElement(
|
1340
|
+
"rect",
|
1341
|
+
{
|
1342
|
+
width: "22",
|
1343
|
+
height: "22",
|
1344
|
+
fill: "white",
|
1345
|
+
transform: "translate(19.5 19.0039)"
|
1346
|
+
}
|
1347
|
+
)))
|
1348
|
+
), /* @__PURE__ */ import_react4.default.createElement("h2", null, "Payment link has been ", /* @__PURE__ */ import_react4.default.createElement("br", null), " sent successfully"))
|
1349
|
+
)));
|
1350
|
+
}
|
1351
|
+
|
1327
1352
|
// src/app/components/RequestPayment/RequestPaymentAllInput.tsx
|
1353
|
+
var import_react5 = __toESM(require("react"), 1);
|
1354
|
+
var import_react_bootstrap2 = require("react-bootstrap");
|
1355
|
+
var import_react_toastify = require("react-toastify");
|
1356
|
+
var import_ReactToastify = require("react-toastify/dist/ReactToastify.css");
|
1328
1357
|
function RequestPaymentAllInput({ fractalpayClientKey }) {
|
1329
|
-
const [isLoading, setIsLoading] =
|
1330
|
-
const [show, setShow] =
|
1331
|
-
const [phoneNumber, setPhoneNumber] =
|
1332
|
-
const [amount, setAmount] =
|
1333
|
-
const [orderId, setOrderId] =
|
1334
|
-
const [isValidNumber, setIsValidNumber] =
|
1335
|
-
const [isValidAmount, setIsValidAmount] =
|
1336
|
-
const [isValidOrderId, setIsValidOrderId] =
|
1337
|
-
const [errorMessagephone, setErrorMessagephone] =
|
1338
|
-
const [errorMessageamount, setErrorMessageamount] =
|
1339
|
-
const [errorMessageorderid, setErrorMessageorderid] =
|
1340
|
-
const [submitClicked, setSubmitClicked] =
|
1358
|
+
const [isLoading, setIsLoading] = (0, import_react5.useState)(false);
|
1359
|
+
const [show, setShow] = (0, import_react5.useState)(false);
|
1360
|
+
const [phoneNumber, setPhoneNumber] = (0, import_react5.useState)("");
|
1361
|
+
const [amount, setAmount] = (0, import_react5.useState)("");
|
1362
|
+
const [orderId, setOrderId] = (0, import_react5.useState)("");
|
1363
|
+
const [isValidNumber, setIsValidNumber] = (0, import_react5.useState)(true);
|
1364
|
+
const [isValidAmount, setIsValidAmount] = (0, import_react5.useState)(true);
|
1365
|
+
const [isValidOrderId, setIsValidOrderId] = (0, import_react5.useState)(true);
|
1366
|
+
const [errorMessagephone, setErrorMessagephone] = (0, import_react5.useState)("");
|
1367
|
+
const [errorMessageamount, setErrorMessageamount] = (0, import_react5.useState)("");
|
1368
|
+
const [errorMessageorderid, setErrorMessageorderid] = (0, import_react5.useState)("");
|
1369
|
+
const [submitClicked, setSubmitClicked] = (0, import_react5.useState)(false);
|
1341
1370
|
const handleClose = () => setShow(false);
|
1342
1371
|
const handleShow = () => setShow(true);
|
1343
1372
|
const sendRequestPayment = () => {
|
@@ -1399,7 +1428,7 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1399
1428
|
}).catch((error) => {
|
1400
1429
|
setIsLoading(false);
|
1401
1430
|
console.error("Error:", error);
|
1402
|
-
toast.error(ErrorText.anerroroccured);
|
1431
|
+
import_react_toastify.toast.error(ErrorText.anerroroccured);
|
1403
1432
|
});
|
1404
1433
|
};
|
1405
1434
|
const handlePhoneNumberChange = (e) => {
|
@@ -1439,7 +1468,7 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1439
1468
|
setIsValidOrderId(false);
|
1440
1469
|
}
|
1441
1470
|
};
|
1442
|
-
return /* @__PURE__ */
|
1471
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement(RequestPaymentstyles_default, null), /* @__PURE__ */ import_react5.default.createElement("div", { className: " border-container" }, /* @__PURE__ */ import_react5.default.createElement("div", { className: "payment-column" }, /* @__PURE__ */ import_react5.default.createElement("label", null, "Enter Phone Number:"), /* @__PURE__ */ import_react5.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react5.default.createElement(
|
1443
1472
|
"input",
|
1444
1473
|
{
|
1445
1474
|
type: "text",
|
@@ -1449,7 +1478,7 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1449
1478
|
maxLength: 10,
|
1450
1479
|
className: submitClicked && (!phoneNumber || !isValidNumber) ? "error" : ""
|
1451
1480
|
}
|
1452
|
-
), errorMessagephone && /* @__PURE__ */
|
1481
|
+
), errorMessagephone && /* @__PURE__ */ import_react5.default.createElement("div", { className: "error-message text-danger" }, errorMessagephone))), /* @__PURE__ */ import_react5.default.createElement("div", { className: "payment-column" }, /* @__PURE__ */ import_react5.default.createElement("label", null, "Enter Amount:"), /* @__PURE__ */ import_react5.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react5.default.createElement(
|
1453
1482
|
"input",
|
1454
1483
|
{
|
1455
1484
|
type: "text",
|
@@ -1458,7 +1487,7 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1458
1487
|
placeholder: "Enter amount",
|
1459
1488
|
className: submitClicked && (!amount || !isValidAmount) ? "error" : ""
|
1460
1489
|
}
|
1461
|
-
), errorMessageamount && /* @__PURE__ */
|
1490
|
+
), errorMessageamount && /* @__PURE__ */ import_react5.default.createElement("div", { className: "error-message text-danger" }, errorMessageamount))), /* @__PURE__ */ import_react5.default.createElement("div", { className: "payment-column" }, /* @__PURE__ */ import_react5.default.createElement("label", null, "Enter Order ID:"), /* @__PURE__ */ import_react5.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react5.default.createElement(
|
1462
1491
|
"input",
|
1463
1492
|
{
|
1464
1493
|
type: "text",
|
@@ -1467,7 +1496,7 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1467
1496
|
placeholder: "Enter order ID",
|
1468
1497
|
className: submitClicked && (!orderId || !isValidOrderId) ? "error" : ""
|
1469
1498
|
}
|
1470
|
-
), errorMessageorderid && /* @__PURE__ */
|
1499
|
+
), errorMessageorderid && /* @__PURE__ */ import_react5.default.createElement("div", { className: "error-message text-danger" }, errorMessageorderid))), /* @__PURE__ */ import_react5.default.createElement(
|
1471
1500
|
"button",
|
1472
1501
|
{
|
1473
1502
|
onClick: sendRequestPayment,
|
@@ -1475,7 +1504,7 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1475
1504
|
className: "paymentBtn"
|
1476
1505
|
},
|
1477
1506
|
isLoading ? "Loading..." : "Request Payment"
|
1478
|
-
)), /* @__PURE__ */
|
1507
|
+
)), /* @__PURE__ */ import_react5.default.createElement(import_react_bootstrap2.Modal, { className: "payment-suc", show, onHide: handleClose }, /* @__PURE__ */ import_react5.default.createElement(import_react_bootstrap2.Modal.Header, { closeButton: true }), /* @__PURE__ */ import_react5.default.createElement(import_react_bootstrap2.Modal.Body, null, /* @__PURE__ */ import_react5.default.createElement(
|
1479
1508
|
"svg",
|
1480
1509
|
{
|
1481
1510
|
width: "60",
|
@@ -1484,7 +1513,7 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1484
1513
|
fill: "none",
|
1485
1514
|
xmlns: "http://www.w3.org/2000/svg"
|
1486
1515
|
},
|
1487
|
-
/* @__PURE__ */
|
1516
|
+
/* @__PURE__ */ import_react5.default.createElement(
|
1488
1517
|
"rect",
|
1489
1518
|
{
|
1490
1519
|
x: "0.5",
|
@@ -1495,14 +1524,14 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1495
1524
|
stroke: "#31B379"
|
1496
1525
|
}
|
1497
1526
|
),
|
1498
|
-
/* @__PURE__ */
|
1527
|
+
/* @__PURE__ */ import_react5.default.createElement("g", { clipPath: "url(#clip0_2659_5018)" }, /* @__PURE__ */ import_react5.default.createElement(
|
1499
1528
|
"path",
|
1500
1529
|
{
|
1501
1530
|
d: "M41.1778 22.248C40.7483 21.8184 40.0518 21.8184 39.6222 22.248L26.4435 35.4268L21.3778 30.3611C20.9483 29.9315 20.2518 29.9316 19.8222 30.3611C19.3926 30.7907 19.3926 31.4871 19.8222 31.9167L25.6657 37.7601C26.0951 38.1897 26.7921 38.1894 27.2213 37.7601L41.1778 23.8036C41.6074 23.3741 41.6074 22.6776 41.1778 22.248Z",
|
1502
1531
|
fill: "#31B379"
|
1503
1532
|
}
|
1504
1533
|
)),
|
1505
|
-
/* @__PURE__ */
|
1534
|
+
/* @__PURE__ */ import_react5.default.createElement("defs", null, /* @__PURE__ */ import_react5.default.createElement("clipPath", { id: "clip0_2659_5018" }, /* @__PURE__ */ import_react5.default.createElement(
|
1506
1535
|
"rect",
|
1507
1536
|
{
|
1508
1537
|
width: "22",
|
@@ -1511,12 +1540,12 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1511
1540
|
transform: "translate(19.5 19.0039)"
|
1512
1541
|
}
|
1513
1542
|
)))
|
1514
|
-
), /* @__PURE__ */
|
1543
|
+
), /* @__PURE__ */ import_react5.default.createElement("h1", null, "Success!"), /* @__PURE__ */ import_react5.default.createElement("h4", null, "Payment link created successfully.")), /* @__PURE__ */ import_react5.default.createElement(import_react_bootstrap2.Modal.Footer, null, /* @__PURE__ */ import_react5.default.createElement("button", { className: "paymentBtn", onClick: handleClose }, "Ok"))), /* @__PURE__ */ import_react5.default.createElement(import_react_toastify.ToastContainer, null));
|
1515
1544
|
}
|
1516
1545
|
|
1517
1546
|
// src/app/components/RequestPayment/RequestPaymentDynamic.tsx
|
1518
|
-
|
1519
|
-
|
1547
|
+
var import_react6 = __toESM(require("react"), 1);
|
1548
|
+
var import_react_bootstrap3 = require("react-bootstrap");
|
1520
1549
|
|
1521
1550
|
// src/app/components/Api/createWidgetOrder.ts
|
1522
1551
|
var createWidgetOrder = (formData) => {
|
@@ -1540,8 +1569,8 @@ var createWidgetOrder = (formData) => {
|
|
1540
1569
|
// src/app/components/RequestPayment/RequestPaymentDynamic.tsx
|
1541
1570
|
function RequestPaymentDynamic({ fractalpayClientKey, amount, phone_number, orderID }) {
|
1542
1571
|
console.log("props", { fractalpayClientKey, amount, phone_number, orderID });
|
1543
|
-
const [isLoading, setIsLoading] =
|
1544
|
-
const [show, setShow] =
|
1572
|
+
const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
|
1573
|
+
const [show, setShow] = (0, import_react6.useState)(false);
|
1545
1574
|
const handleClose = () => setShow(false);
|
1546
1575
|
const handleShow = () => setShow(true);
|
1547
1576
|
const sendRequestPayment = () => {
|
@@ -1564,7 +1593,7 @@ function RequestPaymentDynamic({ fractalpayClientKey, amount, phone_number, orde
|
|
1564
1593
|
console.error("Error:", error);
|
1565
1594
|
});
|
1566
1595
|
};
|
1567
|
-
return /* @__PURE__ */
|
1596
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, /* @__PURE__ */ import_react6.default.createElement(
|
1568
1597
|
"button",
|
1569
1598
|
{
|
1570
1599
|
onClick: sendRequestPayment,
|
@@ -1572,7 +1601,7 @@ function RequestPaymentDynamic({ fractalpayClientKey, amount, phone_number, orde
|
|
1572
1601
|
className: "paymentBtn"
|
1573
1602
|
},
|
1574
1603
|
isLoading ? "Loading..." : "Request Payment"
|
1575
|
-
), /* @__PURE__ */
|
1604
|
+
), /* @__PURE__ */ import_react6.default.createElement(import_react_bootstrap3.Modal, { className: "payment-suc", show, onHide: handleClose }, /* @__PURE__ */ import_react6.default.createElement(import_react_bootstrap3.Modal.Header, { closeButton: true }), /* @__PURE__ */ import_react6.default.createElement(import_react_bootstrap3.Modal.Body, null, /* @__PURE__ */ import_react6.default.createElement(
|
1576
1605
|
"svg",
|
1577
1606
|
{
|
1578
1607
|
width: "60",
|
@@ -1581,7 +1610,7 @@ function RequestPaymentDynamic({ fractalpayClientKey, amount, phone_number, orde
|
|
1581
1610
|
fill: "none",
|
1582
1611
|
xmlns: "http://www.w3.org/2000/svg"
|
1583
1612
|
},
|
1584
|
-
/* @__PURE__ */
|
1613
|
+
/* @__PURE__ */ import_react6.default.createElement(
|
1585
1614
|
"rect",
|
1586
1615
|
{
|
1587
1616
|
x: "0.5",
|
@@ -1592,14 +1621,14 @@ function RequestPaymentDynamic({ fractalpayClientKey, amount, phone_number, orde
|
|
1592
1621
|
stroke: "#31B379"
|
1593
1622
|
}
|
1594
1623
|
),
|
1595
|
-
/* @__PURE__ */
|
1624
|
+
/* @__PURE__ */ import_react6.default.createElement("g", { "clip-path": "url(#clip0_2659_5018)" }, /* @__PURE__ */ import_react6.default.createElement(
|
1596
1625
|
"path",
|
1597
1626
|
{
|
1598
1627
|
d: "M41.1778 22.248C40.7483 21.8184 40.0518 21.8184 39.6222 22.248L26.4435 35.4268L21.3778 30.3611C20.9483 29.9315 20.2518 29.9316 19.8222 30.3611C19.3926 30.7907 19.3926 31.4871 19.8222 31.9167L25.6657 37.7601C26.0951 38.1897 26.7921 38.1894 27.2213 37.7601L41.1778 23.8036C41.6074 23.3741 41.6074 22.6776 41.1778 22.248Z",
|
1599
1628
|
fill: "#31B379"
|
1600
1629
|
}
|
1601
1630
|
)),
|
1602
|
-
/* @__PURE__ */
|
1631
|
+
/* @__PURE__ */ import_react6.default.createElement("defs", null, /* @__PURE__ */ import_react6.default.createElement("clipPath", { id: "clip0_2659_5018" }, /* @__PURE__ */ import_react6.default.createElement(
|
1603
1632
|
"rect",
|
1604
1633
|
{
|
1605
1634
|
width: "22",
|
@@ -1608,15 +1637,15 @@ function RequestPaymentDynamic({ fractalpayClientKey, amount, phone_number, orde
|
|
1608
1637
|
transform: "translate(19.5 19.0039)"
|
1609
1638
|
}
|
1610
1639
|
)))
|
1611
|
-
), /* @__PURE__ */
|
1640
|
+
), /* @__PURE__ */ import_react6.default.createElement("h1", null, "Success!"), /* @__PURE__ */ import_react6.default.createElement("h4", null, "Payment link created successfully.")), /* @__PURE__ */ import_react6.default.createElement(import_react_bootstrap3.Modal.Footer, null, /* @__PURE__ */ import_react6.default.createElement("button", { className: "paymentBtn", onClick: handleClose }, "Ok"))));
|
1612
1641
|
}
|
1613
1642
|
|
1614
1643
|
// src/app/components/RequestPayment/RequestPaymentonClick.tsx
|
1615
|
-
|
1616
|
-
|
1644
|
+
var import_react7 = __toESM(require("react"), 1);
|
1645
|
+
var import_react_bootstrap4 = require("react-bootstrap");
|
1617
1646
|
function RequestPaymentonClick(props) {
|
1618
|
-
const [isLoading, setIsLoading] =
|
1619
|
-
const [show, setShow] =
|
1647
|
+
const [isLoading, setIsLoading] = (0, import_react7.useState)(false);
|
1648
|
+
const [show, setShow] = (0, import_react7.useState)(false);
|
1620
1649
|
const handleClose = () => setShow(false);
|
1621
1650
|
const handleShow = () => setShow(true);
|
1622
1651
|
const { fractalpayClientKey, amount, phone_number, orderID, onSuccess, onError } = props;
|
@@ -1650,7 +1679,7 @@ function RequestPaymentonClick(props) {
|
|
1650
1679
|
console.error("Error:", error);
|
1651
1680
|
});
|
1652
1681
|
};
|
1653
|
-
return /* @__PURE__ */
|
1682
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, /* @__PURE__ */ import_react7.default.createElement(RequestPaymentstyles_default, null), /* @__PURE__ */ import_react7.default.createElement(
|
1654
1683
|
"button",
|
1655
1684
|
{
|
1656
1685
|
onClick: sendRequestPayment,
|
@@ -1658,7 +1687,7 @@ function RequestPaymentonClick(props) {
|
|
1658
1687
|
className: "paymentBtn"
|
1659
1688
|
},
|
1660
1689
|
isLoading ? "Loading..." : "Request Payment"
|
1661
|
-
), /* @__PURE__ */
|
1690
|
+
), /* @__PURE__ */ import_react7.default.createElement(import_react_bootstrap4.Modal, { className: "payment-suc", show, onHide: handleClose }, /* @__PURE__ */ import_react7.default.createElement(import_react_bootstrap4.Modal.Header, { closeButton: true }), /* @__PURE__ */ import_react7.default.createElement(import_react_bootstrap4.Modal.Body, null, onSuccess && /* @__PURE__ */ import_react7.default.createElement(
|
1662
1691
|
"svg",
|
1663
1692
|
{
|
1664
1693
|
width: "60",
|
@@ -1667,7 +1696,7 @@ function RequestPaymentonClick(props) {
|
|
1667
1696
|
fill: "none",
|
1668
1697
|
xmlns: "http://www.w3.org/2000/svg"
|
1669
1698
|
},
|
1670
|
-
/* @__PURE__ */
|
1699
|
+
/* @__PURE__ */ import_react7.default.createElement(
|
1671
1700
|
"rect",
|
1672
1701
|
{
|
1673
1702
|
x: "0.5",
|
@@ -1678,14 +1707,14 @@ function RequestPaymentonClick(props) {
|
|
1678
1707
|
stroke: "#31B379"
|
1679
1708
|
}
|
1680
1709
|
),
|
1681
|
-
/* @__PURE__ */
|
1710
|
+
/* @__PURE__ */ import_react7.default.createElement("g", { clipPath: "url(#clip0_2659_5018)" }, /* @__PURE__ */ import_react7.default.createElement(
|
1682
1711
|
"path",
|
1683
1712
|
{
|
1684
1713
|
d: "M41.1778 22.248C40.7483 21.8184 40.0518 21.8184 39.6222 22.248L26.4435 35.4268L21.3778 30.3611C20.9483 29.9315 20.2518 29.9316 19.8222 30.3611C19.3926 30.7907 19.3926 31.4871 19.8222 31.9167L25.6657 37.7601C26.0951 38.1897 26.7921 38.1894 27.2213 37.7601L41.1778 23.8036C41.6074 23.3741 41.6074 22.6776 41.1778 22.248Z",
|
1685
1714
|
fill: "#31B379"
|
1686
1715
|
}
|
1687
1716
|
)),
|
1688
|
-
/* @__PURE__ */
|
1717
|
+
/* @__PURE__ */ import_react7.default.createElement("defs", null, /* @__PURE__ */ import_react7.default.createElement("clipPath", { id: "clip0_2659_5018" }, /* @__PURE__ */ import_react7.default.createElement(
|
1689
1718
|
"rect",
|
1690
1719
|
{
|
1691
1720
|
width: "22",
|
@@ -1694,21 +1723,21 @@ function RequestPaymentonClick(props) {
|
|
1694
1723
|
transform: "translate(19.5 19.0039)"
|
1695
1724
|
}
|
1696
1725
|
)))
|
1697
|
-
), onSuccess ? /* @__PURE__ */
|
1726
|
+
), onSuccess ? /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, /* @__PURE__ */ import_react7.default.createElement("h1", null, "Success!"), /* @__PURE__ */ import_react7.default.createElement("h4", null, onSuccess)) : /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, /* @__PURE__ */ import_react7.default.createElement("h1", null, "Error!"), /* @__PURE__ */ import_react7.default.createElement("h4", null, onError))), /* @__PURE__ */ import_react7.default.createElement(import_react_bootstrap4.Modal.Footer, null, /* @__PURE__ */ import_react7.default.createElement("button", { className: "paymentBtn", onClick: handleClose }, "Ok"))));
|
1698
1727
|
}
|
1699
1728
|
|
1700
1729
|
// src/app/components/RequestPayment/RqstPaymntInputField.tsx
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1730
|
+
var import_react8 = __toESM(require("react"), 1);
|
1731
|
+
var import_react_bootstrap5 = require("react-bootstrap");
|
1732
|
+
var import_react_toastify2 = require("react-toastify");
|
1733
|
+
var import_ReactToastify2 = require("react-toastify/dist/ReactToastify.css");
|
1705
1734
|
function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
1706
|
-
const [isLoading, setIsLoading] =
|
1707
|
-
const [show, setShow] =
|
1708
|
-
const [phoneNumber, setPhoneNumber] =
|
1709
|
-
const [isValidNumber, setIsValidNumber] =
|
1710
|
-
const [errorMessage, setErrorMessage] =
|
1711
|
-
const [submitClicked, setSubmitClicked] =
|
1735
|
+
const [isLoading, setIsLoading] = (0, import_react8.useState)(false);
|
1736
|
+
const [show, setShow] = (0, import_react8.useState)(false);
|
1737
|
+
const [phoneNumber, setPhoneNumber] = (0, import_react8.useState)("");
|
1738
|
+
const [isValidNumber, setIsValidNumber] = (0, import_react8.useState)(true);
|
1739
|
+
const [errorMessage, setErrorMessage] = (0, import_react8.useState)("");
|
1740
|
+
const [submitClicked, setSubmitClicked] = (0, import_react8.useState)(false);
|
1712
1741
|
const handleClose = () => setShow(false);
|
1713
1742
|
const handleShow = () => setShow(true);
|
1714
1743
|
const sendRequestPayment = () => {
|
@@ -1753,7 +1782,7 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1753
1782
|
}).catch((error) => {
|
1754
1783
|
setIsLoading(false);
|
1755
1784
|
console.error("Error:", error);
|
1756
|
-
|
1785
|
+
import_react_toastify2.toast.error(ErrorText.anerroroccured);
|
1757
1786
|
});
|
1758
1787
|
};
|
1759
1788
|
const handlePhoneNumberChange = (e) => {
|
@@ -1771,7 +1800,7 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1771
1800
|
setErrorMessage(ErrorText.phonenumbervalid);
|
1772
1801
|
}
|
1773
1802
|
};
|
1774
|
-
return /* @__PURE__ */
|
1803
|
+
return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, /* @__PURE__ */ import_react8.default.createElement("div", { className: "payment-container" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "input-wrapper" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react8.default.createElement(
|
1775
1804
|
"input",
|
1776
1805
|
{
|
1777
1806
|
type: "text",
|
@@ -1781,7 +1810,7 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1781
1810
|
maxLength: 10,
|
1782
1811
|
className: submitClicked && (!phoneNumber || !isValidNumber) ? "error" : ""
|
1783
1812
|
}
|
1784
|
-
), errorMessage && /* @__PURE__ */
|
1813
|
+
), errorMessage && /* @__PURE__ */ import_react8.default.createElement("div", { className: "error-message text-danger" }, errorMessage))), /* @__PURE__ */ import_react8.default.createElement("div", { className: "button-wrapper" }, /* @__PURE__ */ import_react8.default.createElement(
|
1785
1814
|
"button",
|
1786
1815
|
{
|
1787
1816
|
onClick: sendRequestPayment,
|
@@ -1789,7 +1818,7 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1789
1818
|
className: "paymentBtn"
|
1790
1819
|
},
|
1791
1820
|
isLoading ? "Loading..." : "Request Payment"
|
1792
|
-
))), /* @__PURE__ */
|
1821
|
+
))), /* @__PURE__ */ import_react8.default.createElement(import_react_bootstrap5.Modal, { className: "payment-suc", show, onHide: handleClose }, /* @__PURE__ */ import_react8.default.createElement(import_react_bootstrap5.Modal.Header, { closeButton: true }), /* @__PURE__ */ import_react8.default.createElement(import_react_bootstrap5.Modal.Body, null, /* @__PURE__ */ import_react8.default.createElement(
|
1793
1822
|
"svg",
|
1794
1823
|
{
|
1795
1824
|
width: "60",
|
@@ -1798,7 +1827,7 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1798
1827
|
fill: "none",
|
1799
1828
|
xmlns: "http://www.w3.org/2000/svg"
|
1800
1829
|
},
|
1801
|
-
/* @__PURE__ */
|
1830
|
+
/* @__PURE__ */ import_react8.default.createElement(
|
1802
1831
|
"rect",
|
1803
1832
|
{
|
1804
1833
|
x: "0.5",
|
@@ -1809,14 +1838,14 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1809
1838
|
stroke: "#31B379"
|
1810
1839
|
}
|
1811
1840
|
),
|
1812
|
-
/* @__PURE__ */
|
1841
|
+
/* @__PURE__ */ import_react8.default.createElement("g", { clipPath: "url(#clip0_2659_5018)" }, /* @__PURE__ */ import_react8.default.createElement(
|
1813
1842
|
"path",
|
1814
1843
|
{
|
1815
1844
|
d: "M41.1778 22.248C40.7483 21.8184 40.0518 21.8184 39.6222 22.248L26.4435 35.4268L21.3778 30.3611C20.9483 29.9315 20.2518 29.9316 19.8222 30.3611C19.3926 30.7907 19.3926 31.4871 19.8222 31.9167L25.6657 37.7601C26.0951 38.1897 26.7921 38.1894 27.2213 37.7601L41.1778 23.8036C41.6074 23.3741 41.6074 22.6776 41.1778 22.248Z",
|
1816
1845
|
fill: "#31B379"
|
1817
1846
|
}
|
1818
1847
|
)),
|
1819
|
-
/* @__PURE__ */
|
1848
|
+
/* @__PURE__ */ import_react8.default.createElement("defs", null, /* @__PURE__ */ import_react8.default.createElement("clipPath", { id: "clip0_2659_5018" }, /* @__PURE__ */ import_react8.default.createElement(
|
1820
1849
|
"rect",
|
1821
1850
|
{
|
1822
1851
|
width: "22",
|
@@ -1825,20 +1854,20 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1825
1854
|
transform: "translate(19.5 19.0039)"
|
1826
1855
|
}
|
1827
1856
|
)))
|
1828
|
-
), /* @__PURE__ */
|
1857
|
+
), /* @__PURE__ */ import_react8.default.createElement("h1", null, "Success!"), /* @__PURE__ */ import_react8.default.createElement("h4", null, "Payment link created successfully.")), /* @__PURE__ */ import_react8.default.createElement(import_react_bootstrap5.Modal.Footer, null, /* @__PURE__ */ import_react8.default.createElement("button", { className: "paymentBtn", onClick: handleClose }, "Ok"))), /* @__PURE__ */ import_react8.default.createElement(import_react_toastify2.ToastContainer, null));
|
1829
1858
|
}
|
1830
1859
|
|
1831
1860
|
// src/app/components/Payment/Payment.tsx
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1861
|
+
var import_react10 = __toESM(require("react"), 1);
|
1862
|
+
var import_axios2 = __toESM(require("axios"), 1);
|
1863
|
+
var import_node_forge = __toESM(require("node-forge"), 1);
|
1864
|
+
var import_react_toastify3 = require("react-toastify");
|
1865
|
+
var import_react_bootstrap6 = require("react-bootstrap");
|
1837
1866
|
|
1838
1867
|
// src/app/components/Payment/Paymentstyles.tsx
|
1839
|
-
|
1868
|
+
var import_react9 = __toESM(require("react"), 1);
|
1840
1869
|
function Paymentstyles() {
|
1841
|
-
return /* @__PURE__ */
|
1870
|
+
return /* @__PURE__ */ import_react9.default.createElement("style", null, `
|
1842
1871
|
.paymentBtn {
|
1843
1872
|
background-color: black;
|
1844
1873
|
border: none;
|
@@ -2764,7 +2793,7 @@ input {
|
|
2764
2793
|
// src/app/components/Payment/Payment.tsx
|
2765
2794
|
function Payment() {
|
2766
2795
|
var _a;
|
2767
|
-
const [state, setState] =
|
2796
|
+
const [state, setState] = (0, import_react10.useState)({
|
2768
2797
|
show: false,
|
2769
2798
|
publicKey: "",
|
2770
2799
|
sessionKey: "",
|
@@ -2775,12 +2804,12 @@ function Payment() {
|
|
2775
2804
|
zip: "",
|
2776
2805
|
amount: ""
|
2777
2806
|
});
|
2778
|
-
const [isValid, setIsValid] =
|
2779
|
-
const [isValidMonth, setIsValidMonth] =
|
2780
|
-
const [data, setData] =
|
2807
|
+
const [isValid, setIsValid] = (0, import_react10.useState)(false);
|
2808
|
+
const [isValidMonth, setIsValidMonth] = (0, import_react10.useState)(false);
|
2809
|
+
const [data, setData] = (0, import_react10.useState)(null);
|
2781
2810
|
const handlePaymentClick = async () => {
|
2782
2811
|
try {
|
2783
|
-
const response = await
|
2812
|
+
const response = await import_axios2.default.post(`${baseUrl}generate-session`, {});
|
2784
2813
|
const data2 = response.data;
|
2785
2814
|
if (data2 && (data2 == null ? void 0 : data2.result) === true) {
|
2786
2815
|
setState((prev) => {
|
@@ -2798,12 +2827,12 @@ function Payment() {
|
|
2798
2827
|
};
|
2799
2828
|
const handleSubmitPay = async () => {
|
2800
2829
|
const track2_data = `${state.cardNumber.replace(/\s+/g, "")}=${state.year}${state.month.length > 1 ? state.month : "0" + state.month} ${state.cvv}`;
|
2801
|
-
const publicKey =
|
2830
|
+
const publicKey = import_node_forge.default.pki.publicKeyFromPem(state.publicKey);
|
2802
2831
|
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
2803
|
-
md:
|
2804
|
-
mgf1: { md:
|
2832
|
+
md: import_node_forge.default.md.sha1.create(),
|
2833
|
+
mgf1: { md: import_node_forge.default.md.sha1.create() }
|
2805
2834
|
});
|
2806
|
-
const encryptedBase64 =
|
2835
|
+
const encryptedBase64 = import_node_forge.default.util.encode64(encrypted);
|
2807
2836
|
console.log(encryptedBase64);
|
2808
2837
|
const requestBody = {
|
2809
2838
|
enc_track2_data: encryptedBase64,
|
@@ -2812,14 +2841,14 @@ function Payment() {
|
|
2812
2841
|
};
|
2813
2842
|
const apiUrl = "https://m1ao5pku8b.execute-api.us-east-2.amazonaws.com/prod/tokenizer/tokenize";
|
2814
2843
|
try {
|
2815
|
-
const response = await
|
2844
|
+
const response = await import_axios2.default.post(apiUrl, requestBody, {
|
2816
2845
|
headers: {
|
2817
2846
|
"x-app-session-key": state == null ? void 0 : state.sessionKey,
|
2818
2847
|
"Content-Type": "application/json"
|
2819
2848
|
}
|
2820
2849
|
});
|
2821
2850
|
if ((response == null ? void 0 : response.status) === 200) {
|
2822
|
-
|
2851
|
+
import_react_toastify3.toast.success("Payment Successful");
|
2823
2852
|
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
2824
2853
|
show: false,
|
2825
2854
|
publicKey: "",
|
@@ -2929,7 +2958,7 @@ function Payment() {
|
|
2929
2958
|
}
|
2930
2959
|
return "";
|
2931
2960
|
}
|
2932
|
-
return /* @__PURE__ */
|
2961
|
+
return /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null, /* @__PURE__ */ import_react10.default.createElement(Paymentstyles, null), /* @__PURE__ */ import_react10.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react10.default.createElement(
|
2933
2962
|
"button",
|
2934
2963
|
{
|
2935
2964
|
className: "export-btn",
|
@@ -2937,8 +2966,8 @@ function Payment() {
|
|
2937
2966
|
onClick: () => handlePaymentClick()
|
2938
2967
|
},
|
2939
2968
|
"Payment"
|
2940
|
-
), /* @__PURE__ */
|
2941
|
-
|
2969
|
+
), /* @__PURE__ */ import_react10.default.createElement(
|
2970
|
+
import_react_bootstrap6.Modal,
|
2942
2971
|
{
|
2943
2972
|
show: state.show,
|
2944
2973
|
onHide: () => setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
@@ -2946,8 +2975,8 @@ function Payment() {
|
|
2946
2975
|
})),
|
2947
2976
|
centered: true
|
2948
2977
|
},
|
2949
|
-
/* @__PURE__ */
|
2950
|
-
/* @__PURE__ */
|
2978
|
+
/* @__PURE__ */ import_react10.default.createElement(import_react_bootstrap6.Modal.Header, { closeButton: true }),
|
2979
|
+
/* @__PURE__ */ import_react10.default.createElement(import_react_bootstrap6.Modal.Body, null, /* @__PURE__ */ import_react10.default.createElement("div", { className: "payment-popup" }, /* @__PURE__ */ import_react10.default.createElement("div", { className: "row" }, /* @__PURE__ */ import_react10.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react10.default.createElement("div", { id: "Checkout", className: "inline" }, /* @__PURE__ */ import_react10.default.createElement("div", { className: "header" }, /* @__PURE__ */ import_react10.default.createElement("h1", null, "Pay")), /* @__PURE__ */ import_react10.default.createElement("form", { id: "PaymentForm", className: "payment-form" }, /* @__PURE__ */ import_react10.default.createElement("div", { className: "form-group", style: { display: "none" } }, /* @__PURE__ */ import_react10.default.createElement("label", null, "Payment amount"), /* @__PURE__ */ import_react10.default.createElement("div", { className: "input-group" }, /* @__PURE__ */ import_react10.default.createElement("span", { className: "input-group-addon" }, "$"), /* @__PURE__ */ import_react10.default.createElement(
|
2951
2980
|
"input",
|
2952
2981
|
{
|
2953
2982
|
type: "text",
|
@@ -2956,13 +2985,13 @@ function Payment() {
|
|
2956
2985
|
className: "form-control",
|
2957
2986
|
id: ""
|
2958
2987
|
}
|
2959
|
-
)), /* @__PURE__ */
|
2988
|
+
)), /* @__PURE__ */ import_react10.default.createElement(
|
2960
2989
|
"span",
|
2961
2990
|
{
|
2962
2991
|
id: "amount-error",
|
2963
2992
|
style: { color: "red", display: "none" }
|
2964
2993
|
}
|
2965
|
-
)), /* @__PURE__ */
|
2994
|
+
)), /* @__PURE__ */ import_react10.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react10.default.createElement("label", null, "Name on card"), /* @__PURE__ */ import_react10.default.createElement(
|
2966
2995
|
"input",
|
2967
2996
|
{
|
2968
2997
|
id: "NameOnCard",
|
@@ -2971,13 +3000,13 @@ function Payment() {
|
|
2971
3000
|
maxLength: 100,
|
2972
3001
|
placeholder: "Name"
|
2973
3002
|
}
|
2974
|
-
), /* @__PURE__ */
|
3003
|
+
), /* @__PURE__ */ import_react10.default.createElement(
|
2975
3004
|
"span",
|
2976
3005
|
{
|
2977
3006
|
id: "NameOnCard-error",
|
2978
3007
|
style: { color: "red", display: "none" }
|
2979
3008
|
}
|
2980
|
-
)), /* @__PURE__ */
|
3009
|
+
)), /* @__PURE__ */ import_react10.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react10.default.createElement(
|
2981
3010
|
"input",
|
2982
3011
|
{
|
2983
3012
|
"data-token": "card_number",
|
@@ -2988,7 +3017,7 @@ function Payment() {
|
|
2988
3017
|
placeholder: "0000 0000 0000 0000",
|
2989
3018
|
onChange: handleCardNumberChange
|
2990
3019
|
}
|
2991
|
-
), state.error && /* @__PURE__ */
|
3020
|
+
), state.error && /* @__PURE__ */ import_react10.default.createElement("div", { style: { color: "red" } }, state.error)), /* @__PURE__ */ import_react10.default.createElement("div", { className: "expiry-date-group form-group" }, /* @__PURE__ */ import_react10.default.createElement(
|
2992
3021
|
"input",
|
2993
3022
|
{
|
2994
3023
|
"data-token": "exp_month",
|
@@ -2999,14 +3028,14 @@ function Payment() {
|
|
2999
3028
|
maxLength: 2,
|
3000
3029
|
onChange: (e) => handleMonthChange(e)
|
3001
3030
|
}
|
3002
|
-
), isValidMonth && /* @__PURE__ */
|
3031
|
+
), isValidMonth && /* @__PURE__ */ import_react10.default.createElement(
|
3003
3032
|
"span",
|
3004
3033
|
{
|
3005
3034
|
id: "card_number-error",
|
3006
3035
|
style: { color: "red", fontSize: "15px" }
|
3007
3036
|
},
|
3008
3037
|
(_a = ErrorText) == null ? void 0 : _a.montherror
|
3009
|
-
)), /* @__PURE__ */
|
3038
|
+
)), /* @__PURE__ */ import_react10.default.createElement("div", { className: "expiry-date-group form-group" }, /* @__PURE__ */ import_react10.default.createElement(
|
3010
3039
|
"input",
|
3011
3040
|
{
|
3012
3041
|
"data-token": "exp_year",
|
@@ -3017,7 +3046,7 @@ function Payment() {
|
|
3017
3046
|
value: state.year,
|
3018
3047
|
onChange: (e) => handleYearChange(e)
|
3019
3048
|
}
|
3020
|
-
), state.yearError && /* @__PURE__ */
|
3049
|
+
), state.yearError && /* @__PURE__ */ import_react10.default.createElement("span", { id: "exp_year-error", style: { color: "red" } }, state.yearError)), /* @__PURE__ */ import_react10.default.createElement("div", { className: "security-code-group form-group" }, /* @__PURE__ */ import_react10.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react10.default.createElement(
|
3021
3050
|
"input",
|
3022
3051
|
{
|
3023
3052
|
"data-token": "cvv",
|
@@ -3028,7 +3057,7 @@ function Payment() {
|
|
3028
3057
|
placeholder: "CVV",
|
3029
3058
|
onChange: (e) => handleCVVChange(e)
|
3030
3059
|
}
|
3031
|
-
), /* @__PURE__ */
|
3060
|
+
), /* @__PURE__ */ import_react10.default.createElement("i", { id: "cvc", className: "fa fa-question-circle" }), state.cvvError && /* @__PURE__ */ import_react10.default.createElement("span", { id: "cvv-error", style: { color: "red" } }, state.cvvError)), /* @__PURE__ */ import_react10.default.createElement("div", { className: "cvc-preview-container two-card hide" }, /* @__PURE__ */ import_react10.default.createElement("div", { className: "amex-cvc-preview" }), /* @__PURE__ */ import_react10.default.createElement("div", { className: "visa-mc-dis-cvc-preview" }))), /* @__PURE__ */ import_react10.default.createElement("div", { className: "zip-code-group form-group" }, /* @__PURE__ */ import_react10.default.createElement("label", null, "Postal code"), /* @__PURE__ */ import_react10.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react10.default.createElement(
|
3032
3061
|
"input",
|
3033
3062
|
{
|
3034
3063
|
id: "ZIPCode",
|
@@ -3040,7 +3069,7 @@ function Payment() {
|
|
3040
3069
|
value: state.zip,
|
3041
3070
|
onChange: (e) => handleZIP(e)
|
3042
3071
|
}
|
3043
|
-
), /* @__PURE__ */
|
3072
|
+
), /* @__PURE__ */ import_react10.default.createElement(
|
3044
3073
|
"a",
|
3045
3074
|
{
|
3046
3075
|
tabIndex: 0,
|
@@ -3050,15 +3079,15 @@ function Payment() {
|
|
3050
3079
|
"data-placement": "left",
|
3051
3080
|
"data-content": "Enter the ZIP/Postal code for your credit card billing address."
|
3052
3081
|
},
|
3053
|
-
/* @__PURE__ */
|
3054
|
-
), /* @__PURE__ */
|
3082
|
+
/* @__PURE__ */ import_react10.default.createElement("i", { className: "fa fa-question-circle" })
|
3083
|
+
), /* @__PURE__ */ import_react10.default.createElement(
|
3055
3084
|
"span",
|
3056
3085
|
{
|
3057
3086
|
id: "ZIPCode-error",
|
3058
3087
|
style: { color: "red", display: "none" }
|
3059
3088
|
},
|
3060
3089
|
ErrorText.fieldrequired
|
3061
|
-
))), /* @__PURE__ */
|
3090
|
+
))), /* @__PURE__ */ import_react10.default.createElement("div", { className: "form-group top-amnt" }, /* @__PURE__ */ import_react10.default.createElement("div", null, /* @__PURE__ */ import_react10.default.createElement("label", null, "Payment amount"), /* @__PURE__ */ import_react10.default.createElement("div", { className: "amount-placeholder" }, /* @__PURE__ */ import_react10.default.createElement(
|
3062
3091
|
"input",
|
3063
3092
|
{
|
3064
3093
|
id: "Amount",
|
@@ -3070,7 +3099,7 @@ function Payment() {
|
|
3070
3099
|
onChange: (e) => handleAmount(e),
|
3071
3100
|
onBlur: handleAmountBlur
|
3072
3101
|
}
|
3073
|
-
))), /* @__PURE__ */
|
3102
|
+
))), /* @__PURE__ */ import_react10.default.createElement("div", { className: "card-row" }, /* @__PURE__ */ import_react10.default.createElement("span", { className: "visa" }), /* @__PURE__ */ import_react10.default.createElement("span", { className: "mastercard" }), /* @__PURE__ */ import_react10.default.createElement("span", { className: "amex" }), /* @__PURE__ */ import_react10.default.createElement("span", { className: "discover" }))), /* @__PURE__ */ import_react10.default.createElement(
|
3074
3103
|
"button",
|
3075
3104
|
{
|
3076
3105
|
type: "button",
|
@@ -3079,7 +3108,7 @@ function Payment() {
|
|
3079
3108
|
className: "btn btn-block btn-success submit-button"
|
3080
3109
|
},
|
3081
3110
|
"Pay"
|
3082
|
-
)), /* @__PURE__ */
|
3111
|
+
)), /* @__PURE__ */ import_react10.default.createElement("div", { className: "powerd-by-part" }, /* @__PURE__ */ import_react10.default.createElement(
|
3083
3112
|
"svg",
|
3084
3113
|
{
|
3085
3114
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -3087,14 +3116,14 @@ function Payment() {
|
|
3087
3116
|
height: "20",
|
3088
3117
|
viewBox: "0 0 26 26"
|
3089
3118
|
},
|
3090
|
-
/* @__PURE__ */
|
3119
|
+
/* @__PURE__ */ import_react10.default.createElement(
|
3091
3120
|
"path",
|
3092
3121
|
{
|
3093
3122
|
fill: "currentColor",
|
3094
3123
|
d: "M23.633 5.028a1.074 1.074 0 0 0-.777-.366c-2.295-.06-5.199-2.514-7.119-3.477C14.551.592 13.768.201 13.18.098a1.225 1.225 0 0 0-.36.001c-.588.103-1.371.494-2.556 1.087c-1.92.962-4.824 3.416-7.119 3.476a1.08 1.08 0 0 0-.778.366a1.167 1.167 0 0 0-.291.834c.493 10.023 4.088 16.226 10.396 19.831c.164.093.346.141.527.141s.363-.048.528-.141c6.308-3.605 9.902-9.808 10.396-19.831a1.161 1.161 0 0 0-.29-.834zM18.617 8.97l-5.323 7.855c-.191.282-.491.469-.788.469c-.298 0-.629-.163-.838-.372l-3.752-3.753a.656.656 0 0 1 0-.926l.927-.929a.658.658 0 0 1 .926 0l2.44 2.44l4.239-6.257a.657.657 0 0 1 .91-.173l1.085.736a.657.657 0 0 1 .174.91z"
|
3095
3124
|
}
|
3096
3125
|
)
|
3097
|
-
), "Secure payments powered by Fractal", /* @__PURE__ */
|
3126
|
+
), "Secure payments powered by Fractal", /* @__PURE__ */ import_react10.default.createElement(
|
3098
3127
|
"img",
|
3099
3128
|
{
|
3100
3129
|
src: "https://ui.fractalpay.com/favicon.ico",
|
@@ -3106,28 +3135,22 @@ function Payment() {
|
|
3106
3135
|
}
|
3107
3136
|
|
3108
3137
|
// src/app/components/Transaction/CompletedTransactions.tsx
|
3109
|
-
|
3110
|
-
|
3111
|
-
|
3112
|
-
|
3113
|
-
|
3114
|
-
|
3115
|
-
TableBody,
|
3116
|
-
TableHeader
|
3117
|
-
} from "react-bs-datatable";
|
3118
|
-
import DatePicker from "react-datepicker";
|
3119
|
-
import "react-datepicker/dist/react-datepicker.css";
|
3120
|
-
import { toast as toast4 } from "react-toastify";
|
3138
|
+
var import_react12 = __toESM(require("react"), 1);
|
3139
|
+
var import_react_bootstrap7 = require("react-bootstrap");
|
3140
|
+
var import_react_bs_datatable = require("react-bs-datatable");
|
3141
|
+
var import_react_datepicker = __toESM(require("react-datepicker"), 1);
|
3142
|
+
var import_react_datepicker2 = require("react-datepicker/dist/react-datepicker.css");
|
3143
|
+
var import_react_toastify4 = require("react-toastify");
|
3121
3144
|
|
3122
3145
|
// src/app/components/Pagination/Pagination.tsx
|
3123
|
-
|
3146
|
+
var import_react11 = __toESM(require("react"), 1);
|
3124
3147
|
var PaginationPgComp = ({ totalPages, onPageChange, current }) => {
|
3125
|
-
const [currentPage, setCurrentPage] =
|
3126
|
-
const [showPages, setShowPages] =
|
3127
|
-
|
3148
|
+
const [currentPage, setCurrentPage] = (0, import_react11.useState)(current);
|
3149
|
+
const [showPages, setShowPages] = (0, import_react11.useState)(false);
|
3150
|
+
(0, import_react11.useEffect)(() => {
|
3128
3151
|
setCurrentPage(current);
|
3129
3152
|
}, [current]);
|
3130
|
-
|
3153
|
+
(0, import_react11.useEffect)(() => {
|
3131
3154
|
setTimeout(() => {
|
3132
3155
|
setShowPages(true);
|
3133
3156
|
}, 1e3);
|
@@ -3163,7 +3186,7 @@ var PaginationPgComp = ({ totalPages, onPageChange, current }) => {
|
|
3163
3186
|
if (currentPage > 3) {
|
3164
3187
|
pageNumbers.push(renderPageNumber(1));
|
3165
3188
|
if (currentPage > 4) {
|
3166
|
-
pageNumbers.push(/* @__PURE__ */
|
3189
|
+
pageNumbers.push(/* @__PURE__ */ import_react11.default.createElement("li", { key: "start-break", className: "page-item disabled" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "page-link" }, "...")));
|
3167
3190
|
}
|
3168
3191
|
}
|
3169
3192
|
const startPage = Math.max(currentPage - 1, 1);
|
@@ -3173,17 +3196,17 @@ var PaginationPgComp = ({ totalPages, onPageChange, current }) => {
|
|
3173
3196
|
}
|
3174
3197
|
if (currentPage < totalPages - 2) {
|
3175
3198
|
if (currentPage < totalPages - 3) {
|
3176
|
-
pageNumbers.push(/* @__PURE__ */
|
3199
|
+
pageNumbers.push(/* @__PURE__ */ import_react11.default.createElement("li", { key: "end-break", className: "page-item disabled" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "page-link" }, "...")));
|
3177
3200
|
}
|
3178
3201
|
pageNumbers.push(renderPageNumber(totalPages));
|
3179
3202
|
}
|
3180
3203
|
}
|
3181
3204
|
return pageNumbers;
|
3182
3205
|
};
|
3183
|
-
const renderPageNumber = (pageNumber) => /* @__PURE__ */
|
3184
|
-
return /* @__PURE__ */
|
3206
|
+
const renderPageNumber = (pageNumber) => /* @__PURE__ */ import_react11.default.createElement("li", { key: pageNumber, className: `page-item ${currentPage === pageNumber ? "active" : ""}` }, /* @__PURE__ */ import_react11.default.createElement("a", { className: "page-link cursor-pointer", onClick: (e) => handlePageClick(e, pageNumber) }, pageNumber));
|
3207
|
+
return /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement("nav", { className: "app-pagination py-2" }, /* @__PURE__ */ import_react11.default.createElement("ul", { className: "pagination justify-content-center" }, /* @__PURE__ */ import_react11.default.createElement("li", { className: `page-item ${currentPage === 1 ? "disabled" : ""}` }, /* @__PURE__ */ import_react11.default.createElement("a", { className: "page-link cursor-pointer", onClick: handlePrevious }, /* @__PURE__ */ import_react11.default.createElement("span", null, "\u2B9C"))), showPages && getPageNumbers(), /* @__PURE__ */ import_react11.default.createElement("li", { className: `page-item ${currentPage === totalPages ? "disabled" : ""}` }, /* @__PURE__ */ import_react11.default.createElement("a", { className: "page-link cursor-pointer", onClick: handleNext }, /* @__PURE__ */ import_react11.default.createElement("span", null, "\u2B9E"))))));
|
3185
3208
|
};
|
3186
|
-
var PaginationPg =
|
3209
|
+
var PaginationPg = import_react11.default.memo(PaginationPgComp);
|
3187
3210
|
|
3188
3211
|
// src/app/components/Transaction/CompletedTransactions.tsx
|
3189
3212
|
var STORY_HEADERS = [
|
@@ -3220,10 +3243,10 @@ var STORY_HEADERS = [
|
|
3220
3243
|
}
|
3221
3244
|
];
|
3222
3245
|
function CompletedTransactions(props) {
|
3223
|
-
const [dataList, setDataList] =
|
3224
|
-
const [startDate, setStartDate] =
|
3225
|
-
const [endDate, setEndDate] =
|
3226
|
-
const [state, setState] =
|
3246
|
+
const [dataList, setDataList] = (0, import_react12.useState)([]);
|
3247
|
+
const [startDate, setStartDate] = (0, import_react12.useState)(null);
|
3248
|
+
const [endDate, setEndDate] = (0, import_react12.useState)(null);
|
3249
|
+
const [state, setState] = (0, import_react12.useState)({
|
3227
3250
|
page: 1,
|
3228
3251
|
totalPage: 0,
|
3229
3252
|
data: [],
|
@@ -3311,9 +3334,9 @@ function CompletedTransactions(props) {
|
|
3311
3334
|
};
|
3312
3335
|
const handleExport = async () => {
|
3313
3336
|
if (!startDate) {
|
3314
|
-
|
3337
|
+
import_react_toastify4.toast.error("Start date required");
|
3315
3338
|
} else if (!endDate) {
|
3316
|
-
|
3339
|
+
import_react_toastify4.toast.error("End date required");
|
3317
3340
|
} else {
|
3318
3341
|
setState((prev) => __spreadProps(__spreadValues({}, prev), { csvData: true }));
|
3319
3342
|
try {
|
@@ -3346,19 +3369,19 @@ function CompletedTransactions(props) {
|
|
3346
3369
|
}
|
3347
3370
|
}
|
3348
3371
|
};
|
3349
|
-
|
3372
|
+
(0, import_react12.useEffect)(() => {
|
3350
3373
|
fetchData(state.page, startDate, endDate);
|
3351
3374
|
}, [state.page]);
|
3352
3375
|
const handlePageChange = (pageNumber) => {
|
3353
3376
|
setState((prev) => __spreadProps(__spreadValues({}, prev), { page: pageNumber }));
|
3354
3377
|
fetchData(pageNumber, startDate, endDate);
|
3355
3378
|
};
|
3356
|
-
return /* @__PURE__ */
|
3379
|
+
return /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.default.createElement("style", null, `
|
3357
3380
|
.react-datepicker-wrapper:first-child {
|
3358
3381
|
margin-right: 10px;
|
3359
3382
|
}
|
3360
|
-
`), /* @__PURE__ */
|
3361
|
-
|
3383
|
+
`), /* @__PURE__ */ import_react12.default.createElement("div", { className: "mb-5" }, /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement("div", { style: { display: "flex" } }, /* @__PURE__ */ import_react12.default.createElement("div", { style: { display: "flex", marginRight: "10px", marginTop: "25px" } }, /* @__PURE__ */ import_react12.default.createElement(
|
3384
|
+
import_react_datepicker.default,
|
3362
3385
|
{
|
3363
3386
|
selected: startDate,
|
3364
3387
|
onChange: handleStartDateChange,
|
@@ -3368,8 +3391,8 @@ function CompletedTransactions(props) {
|
|
3368
3391
|
placeholderText: "Start Date",
|
3369
3392
|
required: true
|
3370
3393
|
}
|
3371
|
-
), /* @__PURE__ */
|
3372
|
-
|
3394
|
+
), /* @__PURE__ */ import_react12.default.createElement(
|
3395
|
+
import_react_datepicker.default,
|
3373
3396
|
{
|
3374
3397
|
selected: endDate,
|
3375
3398
|
onChange: handleEndDateChange,
|
@@ -3379,8 +3402,8 @@ function CompletedTransactions(props) {
|
|
3379
3402
|
minDate: startDate,
|
3380
3403
|
placeholderText: "End Date"
|
3381
3404
|
}
|
3382
|
-
)), /* @__PURE__ */
|
3383
|
-
DatatableWrapper,
|
3405
|
+
)), /* @__PURE__ */ import_react12.default.createElement("button", { className: "export-btn1", onClick: handleExport }, "Export")), /* @__PURE__ */ import_react12.default.createElement(
|
3406
|
+
import_react_bs_datatable.DatatableWrapper,
|
3384
3407
|
{
|
3385
3408
|
body: dataList,
|
3386
3409
|
headers: STORY_HEADERS,
|
@@ -3391,21 +3414,21 @@ function CompletedTransactions(props) {
|
|
3391
3414
|
}
|
3392
3415
|
}
|
3393
3416
|
},
|
3394
|
-
/* @__PURE__ */
|
3395
|
-
/* @__PURE__ */
|
3396
|
-
/* @__PURE__ */
|
3417
|
+
/* @__PURE__ */ import_react12.default.createElement(import_react_bootstrap7.Row, { className: "mb-4 p-2" }, /* @__PURE__ */ import_react12.default.createElement(import_react_bootstrap7.Col, { xs: 12, sm: 6, lg: 4, className: "d-flex flex-col justify-content-lg-start align-items-center justify-content-sm-start mb-2 mb-sm-0" }, /* @__PURE__ */ import_react12.default.createElement(import_react_bs_datatable.PaginationOptions, null)), /* @__PURE__ */ import_react12.default.createElement(import_react_bootstrap7.Col, { xs: 12, lg: 4, className: "d-flex flex-col justify-content-end align-items-end" }), /* @__PURE__ */ import_react12.default.createElement(import_react_bootstrap7.Col, { xs: 12, sm: 6, lg: 4, className: "d-flex flex-col justify-content-end align-items-end" }, /* @__PURE__ */ import_react12.default.createElement(import_react_bs_datatable.Filter, null))),
|
3418
|
+
/* @__PURE__ */ import_react12.default.createElement(import_react_bootstrap7.Row, null, /* @__PURE__ */ import_react12.default.createElement("div", { className: "responsive-tbl" }, /* @__PURE__ */ import_react12.default.createElement(import_react_bootstrap7.Table, null, /* @__PURE__ */ import_react12.default.createElement(import_react_bs_datatable.TableHeader, null), /* @__PURE__ */ import_react12.default.createElement(import_react_bs_datatable.TableBody, null)))),
|
3419
|
+
/* @__PURE__ */ import_react12.default.createElement(PaginationPg, { totalPages: state.totalPage, onPageChange: handlePageChange, current: state.page })
|
3397
3420
|
))));
|
3398
3421
|
}
|
3399
3422
|
|
3400
3423
|
// src/app/components/Payment/TockenizPay.tsx
|
3401
|
-
|
3402
|
-
|
3403
|
-
|
3404
|
-
|
3405
|
-
|
3406
|
-
|
3424
|
+
var import_react13 = __toESM(require("react"), 1);
|
3425
|
+
var import_react_bootstrap8 = require("react-bootstrap");
|
3426
|
+
var import_react_toastify5 = require("react-toastify");
|
3427
|
+
var import_axios3 = __toESM(require("axios"), 1);
|
3428
|
+
var import_node_forge2 = __toESM(require("node-forge"), 1);
|
3429
|
+
var import_credit_card_type = __toESM(require("credit-card-type"), 1);
|
3407
3430
|
function TockenizPay() {
|
3408
|
-
const [state, setState] =
|
3431
|
+
const [state, setState] = (0, import_react13.useState)({
|
3409
3432
|
show: false,
|
3410
3433
|
publicKey: "",
|
3411
3434
|
sessionKey: "",
|
@@ -3416,13 +3439,13 @@ function TockenizPay() {
|
|
3416
3439
|
zip: "",
|
3417
3440
|
amount: ""
|
3418
3441
|
});
|
3419
|
-
const [cardTypeDetail, setCardTypeDetail] =
|
3420
|
-
const [isValid, setIsValid] =
|
3421
|
-
const [isValidMonth, setIsValidMonth] =
|
3422
|
-
const [data, setData] =
|
3442
|
+
const [cardTypeDetail, setCardTypeDetail] = (0, import_react13.useState)(null);
|
3443
|
+
const [isValid, setIsValid] = (0, import_react13.useState)(false);
|
3444
|
+
const [isValidMonth, setIsValidMonth] = (0, import_react13.useState)(false);
|
3445
|
+
const [data, setData] = (0, import_react13.useState)(null);
|
3423
3446
|
const handlePaymentClick = async () => {
|
3424
3447
|
try {
|
3425
|
-
const response = await
|
3448
|
+
const response = await import_axios3.default.post(`${baseUrl}/generate-session`, {});
|
3426
3449
|
const data2 = response.data;
|
3427
3450
|
if (data2 && (data2 == null ? void 0 : data2.result) === true) {
|
3428
3451
|
setState((prev) => {
|
@@ -3441,14 +3464,14 @@ function TockenizPay() {
|
|
3441
3464
|
const handleSubmitPay = async () => {
|
3442
3465
|
var _a, _b, _c, _d, _e;
|
3443
3466
|
let track2_data = `${(_a = state == null ? void 0 : state.cardNumber) == null ? void 0 : _a.replaceAll(" ", "")}=${state.year}${((_b = state == null ? void 0 : state.month) == null ? void 0 : _b.length) > 1 ? state == null ? void 0 : state.month : "0" + (state == null ? void 0 : state.month)} ${state.cvv}`;
|
3444
|
-
const publicKey =
|
3467
|
+
const publicKey = import_node_forge2.default.pki.publicKeyFromPem(state.publicKey);
|
3445
3468
|
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
3446
|
-
md:
|
3469
|
+
md: import_node_forge2.default.md.sha1.create(),
|
3447
3470
|
mgf1: {
|
3448
|
-
md:
|
3471
|
+
md: import_node_forge2.default.md.sha1.create()
|
3449
3472
|
}
|
3450
3473
|
});
|
3451
|
-
const encryptedBase64 =
|
3474
|
+
const encryptedBase64 = import_node_forge2.default.util.encode64(encrypted);
|
3452
3475
|
console.log(encryptedBase64);
|
3453
3476
|
const requestBody = {
|
3454
3477
|
enc_track2_data: encryptedBase64,
|
@@ -3456,7 +3479,7 @@ function TockenizPay() {
|
|
3456
3479
|
algorithm: "RSAES_OAEP_SHA_1"
|
3457
3480
|
};
|
3458
3481
|
try {
|
3459
|
-
const response = await
|
3482
|
+
const response = await import_axios3.default.post(
|
3460
3483
|
"https://m1ao5pku8b.execute-api.us-east-2.amazonaws.com/prod/tokenizer/tokenize",
|
3461
3484
|
requestBody,
|
3462
3485
|
{
|
@@ -3467,7 +3490,7 @@ function TockenizPay() {
|
|
3467
3490
|
}
|
3468
3491
|
);
|
3469
3492
|
if ((response == null ? void 0 : response.status) === 200) {
|
3470
|
-
|
3493
|
+
import_react_toastify5.toast.success("Payment Successful");
|
3471
3494
|
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
3472
3495
|
show: false,
|
3473
3496
|
publicKey: "",
|
@@ -3482,7 +3505,7 @@ function TockenizPay() {
|
|
3482
3505
|
}
|
3483
3506
|
console.log("response", response);
|
3484
3507
|
} catch (error) {
|
3485
|
-
|
3508
|
+
import_react_toastify5.toast.error((_e = (_d = (_c = error == null ? void 0 : error.response) == null ? void 0 : _c.data) == null ? void 0 : _d.data) == null ? void 0 : _e.message);
|
3486
3509
|
console.error("Error:", error);
|
3487
3510
|
}
|
3488
3511
|
};
|
@@ -3514,9 +3537,9 @@ function TockenizPay() {
|
|
3514
3537
|
e.preventDefault();
|
3515
3538
|
e.stopPropagation();
|
3516
3539
|
const { value } = e.target;
|
3517
|
-
let cardtyp =
|
3540
|
+
let cardtyp = (0, import_credit_card_type.default)(value)[0];
|
3518
3541
|
const formattedValue = formatCreditCardNumber(value, cardtyp == null ? void 0 : cardtyp.type);
|
3519
|
-
setCardTypeDetail(
|
3542
|
+
setCardTypeDetail((0, import_credit_card_type.default)(value)[0]);
|
3520
3543
|
console.log(formattedValue);
|
3521
3544
|
if (value.match(/[a-zA-Z]/)) {
|
3522
3545
|
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
@@ -3619,7 +3642,7 @@ function TockenizPay() {
|
|
3619
3642
|
return "";
|
3620
3643
|
}
|
3621
3644
|
console.log("===================cardtype===============", cardTypeDetail);
|
3622
|
-
return /* @__PURE__ */
|
3645
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", null, /* @__PURE__ */ import_react13.default.createElement(import_react_toastify5.ToastContainer, null), /* @__PURE__ */ import_react13.default.createElement(
|
3623
3646
|
"button",
|
3624
3647
|
{
|
3625
3648
|
className: "export-btn mt-4",
|
@@ -3627,8 +3650,8 @@ function TockenizPay() {
|
|
3627
3650
|
onClick: () => handlePaymentClick()
|
3628
3651
|
},
|
3629
3652
|
"TokenizePay"
|
3630
|
-
), /* @__PURE__ */
|
3631
|
-
|
3653
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
3654
|
+
import_react_bootstrap8.Modal,
|
3632
3655
|
{
|
3633
3656
|
show: state.show,
|
3634
3657
|
onHide: () => setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
@@ -3636,8 +3659,8 @@ function TockenizPay() {
|
|
3636
3659
|
})),
|
3637
3660
|
centered: true
|
3638
3661
|
},
|
3639
|
-
/* @__PURE__ */
|
3640
|
-
/* @__PURE__ */
|
3662
|
+
/* @__PURE__ */ import_react13.default.createElement(import_react_bootstrap8.Modal.Header, { closeButton: true }),
|
3663
|
+
/* @__PURE__ */ import_react13.default.createElement(import_react_bootstrap8.Modal.Body, null, /* @__PURE__ */ import_react13.default.createElement("div", { className: "payment-popup" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "row" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react13.default.createElement("div", { id: "Checkout", className: "inline" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "header" }, /* @__PURE__ */ import_react13.default.createElement("h1", null, "Pay")), /* @__PURE__ */ import_react13.default.createElement("form", { id: "PaymentForm", className: "payment-form" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react13.default.createElement("label", null, "Name on card"), /* @__PURE__ */ import_react13.default.createElement(
|
3641
3664
|
"input",
|
3642
3665
|
{
|
3643
3666
|
id: "NameOnCard",
|
@@ -3646,13 +3669,13 @@ function TockenizPay() {
|
|
3646
3669
|
maxLength: 100,
|
3647
3670
|
placeholder: "Name"
|
3648
3671
|
}
|
3649
|
-
), /* @__PURE__ */
|
3672
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
3650
3673
|
"span",
|
3651
3674
|
{
|
3652
3675
|
id: "NameOnCard-error",
|
3653
3676
|
style: { color: "red", display: "none" }
|
3654
3677
|
}
|
3655
|
-
)), /* @__PURE__ */
|
3678
|
+
)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react13.default.createElement(
|
3656
3679
|
"input",
|
3657
3680
|
{
|
3658
3681
|
"data-token": "card_number",
|
@@ -3663,7 +3686,7 @@ function TockenizPay() {
|
|
3663
3686
|
placeholder: "0000 0000 0000 0000",
|
3664
3687
|
onChange: handleCardNumberChange
|
3665
3688
|
}
|
3666
|
-
), state.error && /* @__PURE__ */
|
3689
|
+
), state.error && /* @__PURE__ */ import_react13.default.createElement("div", { style: { color: "red" } }, state.error)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "expiry-date-group form-group" }, /* @__PURE__ */ import_react13.default.createElement(
|
3667
3690
|
"input",
|
3668
3691
|
{
|
3669
3692
|
"data-token": "exp_month",
|
@@ -3674,14 +3697,14 @@ function TockenizPay() {
|
|
3674
3697
|
maxLength: 2,
|
3675
3698
|
onChange: (e) => handleMonthChange(e)
|
3676
3699
|
}
|
3677
|
-
), isValidMonth && /* @__PURE__ */
|
3700
|
+
), isValidMonth && /* @__PURE__ */ import_react13.default.createElement(
|
3678
3701
|
"span",
|
3679
3702
|
{
|
3680
3703
|
id: "card_number-error",
|
3681
3704
|
style: { color: "red", fontSize: "15px" }
|
3682
3705
|
},
|
3683
3706
|
"Please write month only 1 to 12"
|
3684
|
-
)), /* @__PURE__ */
|
3707
|
+
)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "expiry-date-group form-group" }, /* @__PURE__ */ import_react13.default.createElement(
|
3685
3708
|
"input",
|
3686
3709
|
{
|
3687
3710
|
"data-token": "exp_year",
|
@@ -3692,7 +3715,7 @@ function TockenizPay() {
|
|
3692
3715
|
value: state.year,
|
3693
3716
|
onChange: (e) => handleYearChange(e)
|
3694
3717
|
}
|
3695
|
-
), state.yearError && /* @__PURE__ */
|
3718
|
+
), state.yearError && /* @__PURE__ */ import_react13.default.createElement("span", { id: "exp_year-error", style: { color: "red" } }, state.yearError)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "security-code-group form-group" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react13.default.createElement(
|
3696
3719
|
"input",
|
3697
3720
|
{
|
3698
3721
|
"data-token": "cvv",
|
@@ -3703,7 +3726,7 @@ function TockenizPay() {
|
|
3703
3726
|
placeholder: "CVV",
|
3704
3727
|
onChange: (e) => handleCVVChange(e)
|
3705
3728
|
}
|
3706
|
-
), /* @__PURE__ */
|
3729
|
+
), /* @__PURE__ */ import_react13.default.createElement("i", { id: "cvc", className: "fa fa-question-circle" }), state.cvvError && /* @__PURE__ */ import_react13.default.createElement("span", { id: "cvv-error", style: { color: "red" } }, state.cvvError)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "cvc-preview-container two-card hide" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "amex-cvc-preview" }), /* @__PURE__ */ import_react13.default.createElement("div", { className: "visa-mc-dis-cvc-preview" }))), /* @__PURE__ */ import_react13.default.createElement("div", { className: "zip-code-group form-group" }, /* @__PURE__ */ import_react13.default.createElement("label", null, "Postal code"), /* @__PURE__ */ import_react13.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react13.default.createElement(
|
3707
3730
|
"input",
|
3708
3731
|
{
|
3709
3732
|
id: "ZIPCode",
|
@@ -3715,7 +3738,7 @@ function TockenizPay() {
|
|
3715
3738
|
value: state.zip,
|
3716
3739
|
onChange: (e) => handleZIP(e)
|
3717
3740
|
}
|
3718
|
-
), /* @__PURE__ */
|
3741
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
3719
3742
|
"a",
|
3720
3743
|
{
|
3721
3744
|
tabIndex: 0,
|
@@ -3725,15 +3748,15 @@ function TockenizPay() {
|
|
3725
3748
|
"data-placement": "left",
|
3726
3749
|
"data-content": "Enter the ZIP/Postal code for your credit card billing address."
|
3727
3750
|
},
|
3728
|
-
/* @__PURE__ */
|
3729
|
-
), /* @__PURE__ */
|
3751
|
+
/* @__PURE__ */ import_react13.default.createElement("i", { className: "fa fa-question-circle" })
|
3752
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
3730
3753
|
"span",
|
3731
3754
|
{
|
3732
3755
|
id: "ZIPCode-error",
|
3733
3756
|
style: { color: "red", display: "none" }
|
3734
3757
|
},
|
3735
3758
|
"This field is required"
|
3736
|
-
))), /* @__PURE__ */
|
3759
|
+
))), /* @__PURE__ */ import_react13.default.createElement("div", { className: "form-group top-amnt" }, /* @__PURE__ */ import_react13.default.createElement("div", null, /* @__PURE__ */ import_react13.default.createElement("label", null, "Payment amount"), /* @__PURE__ */ import_react13.default.createElement("div", { className: "amount-placeholder" }, /* @__PURE__ */ import_react13.default.createElement(
|
3737
3760
|
"input",
|
3738
3761
|
{
|
3739
3762
|
id: "Amount",
|
@@ -3745,7 +3768,7 @@ function TockenizPay() {
|
|
3745
3768
|
onChange: (e) => handleAmount(e),
|
3746
3769
|
onBlur: handleAmountBlur
|
3747
3770
|
}
|
3748
|
-
))), /* @__PURE__ */
|
3771
|
+
))), /* @__PURE__ */ import_react13.default.createElement("div", { className: "card-row" }, /* @__PURE__ */ import_react13.default.createElement("span", { className: "visa" }), /* @__PURE__ */ import_react13.default.createElement("span", { className: "mastercard" }), /* @__PURE__ */ import_react13.default.createElement("span", { className: "amex" }), /* @__PURE__ */ import_react13.default.createElement("span", { className: "discover" }))), /* @__PURE__ */ import_react13.default.createElement(
|
3749
3772
|
"button",
|
3750
3773
|
{
|
3751
3774
|
type: "button",
|
@@ -3754,7 +3777,7 @@ function TockenizPay() {
|
|
3754
3777
|
className: "btn btn-block btn-success submit-button"
|
3755
3778
|
},
|
3756
3779
|
"Submit"
|
3757
|
-
)), /* @__PURE__ */
|
3780
|
+
)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "powerd-by-part" }, /* @__PURE__ */ import_react13.default.createElement(
|
3758
3781
|
"svg",
|
3759
3782
|
{
|
3760
3783
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -3762,14 +3785,14 @@ function TockenizPay() {
|
|
3762
3785
|
height: "20",
|
3763
3786
|
viewBox: "0 0 26 26"
|
3764
3787
|
},
|
3765
|
-
/* @__PURE__ */
|
3788
|
+
/* @__PURE__ */ import_react13.default.createElement(
|
3766
3789
|
"path",
|
3767
3790
|
{
|
3768
3791
|
fill: "currentColor",
|
3769
3792
|
d: "M23.633 5.028a1.074 1.074 0 0 0-.777-.366c-2.295-.06-5.199-2.514-7.119-3.477C14.551.592 13.768.201 13.18.098a1.225 1.225 0 0 0-.36.001c-.588.103-1.371.494-2.556 1.087c-1.92.962-4.824 3.416-7.119 3.476a1.08 1.08 0 0 0-.778.366a1.167 1.167 0 0 0-.291.834c.493 10.023 4.088 16.226 10.396 19.831c.164.093.346.141.527.141s.363-.048.528-.141c6.308-3.605 9.902-9.808 10.396-19.831a1.161 1.161 0 0 0-.29-.834zM18.617 8.97l-5.323 7.855c-.191.282-.491.469-.788.469c-.298 0-.629-.163-.838-.372l-3.752-3.753a.656.656 0 0 1 0-.926l.927-.929a.658.658 0 0 1 .926 0l2.44 2.44l4.239-6.257a.657.657 0 0 1 .91-.173l1.085.736a.657.657 0 0 1 .174.91z"
|
3770
3793
|
}
|
3771
3794
|
)
|
3772
|
-
), "Secure payments powered by Fractal", /* @__PURE__ */
|
3795
|
+
), "Secure payments powered by Fractal", /* @__PURE__ */ import_react13.default.createElement(
|
3773
3796
|
"img",
|
3774
3797
|
{
|
3775
3798
|
src: "https://ui.fractalpay.com/favicon.ico",
|
@@ -3781,25 +3804,25 @@ function TockenizPay() {
|
|
3781
3804
|
}
|
3782
3805
|
|
3783
3806
|
// src/app/components/Payment/GetPaymentDynamic.tsx
|
3784
|
-
|
3785
|
-
|
3807
|
+
var import_react15 = __toESM(require("react"), 1);
|
3808
|
+
var import_react_bootstrap9 = require("react-bootstrap");
|
3786
3809
|
|
3787
3810
|
// src/app/components/Loader/MyLoadingAnimation.tsx
|
3788
|
-
|
3811
|
+
var import_react14 = __toESM(require("react"), 1);
|
3789
3812
|
function MyLoadingAnimation() {
|
3790
|
-
return /* @__PURE__ */
|
3813
|
+
return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, /* @__PURE__ */ import_react14.default.createElement(LoaderStyle_default, null), /* @__PURE__ */ import_react14.default.createElement("div", { className: "loading-animation" }, /* @__PURE__ */ import_react14.default.createElement("div", { className: "spinner" })));
|
3791
3814
|
}
|
3792
3815
|
|
3793
3816
|
// src/app/components/Payment/GetPaymentDynamic.tsx
|
3794
3817
|
function GetPaymentDynamic(props) {
|
3795
3818
|
const { amount, fractalpayClientKey, orderID } = props;
|
3796
|
-
const [loading, setLoading] =
|
3797
|
-
const [show, setShow] =
|
3798
|
-
const [iframeLoaded, setIframeLoaded] =
|
3799
|
-
const [phoneNumber, setPhoneNumber] =
|
3800
|
-
const [errorMessage, setErrorMessage] =
|
3801
|
-
const [submitClicked, setSubmitClicked] =
|
3802
|
-
const [isValidNumber, setIsValidNumber] =
|
3819
|
+
const [loading, setLoading] = (0, import_react15.useState)(false);
|
3820
|
+
const [show, setShow] = (0, import_react15.useState)(false);
|
3821
|
+
const [iframeLoaded, setIframeLoaded] = (0, import_react15.useState)(false);
|
3822
|
+
const [phoneNumber, setPhoneNumber] = (0, import_react15.useState)("");
|
3823
|
+
const [errorMessage, setErrorMessage] = (0, import_react15.useState)("");
|
3824
|
+
const [submitClicked, setSubmitClicked] = (0, import_react15.useState)(false);
|
3825
|
+
const [isValidNumber, setIsValidNumber] = (0, import_react15.useState)(true);
|
3803
3826
|
const handleClose = () => {
|
3804
3827
|
setIframeLoaded(false);
|
3805
3828
|
setTimeout(() => {
|
@@ -3814,7 +3837,7 @@ function GetPaymentDynamic(props) {
|
|
3814
3837
|
console.error("Fractalpay client key is missing or empty.");
|
3815
3838
|
}
|
3816
3839
|
};
|
3817
|
-
|
3840
|
+
(0, import_react15.useEffect)(() => {
|
3818
3841
|
if (!fractalpayClientKey) {
|
3819
3842
|
console.error("Fractalpay client key is missing or empty.");
|
3820
3843
|
}
|
@@ -3837,7 +3860,7 @@ function GetPaymentDynamic(props) {
|
|
3837
3860
|
const handleLoad = () => {
|
3838
3861
|
setLoading(false);
|
3839
3862
|
};
|
3840
|
-
|
3863
|
+
(0, import_react15.useEffect)(() => {
|
3841
3864
|
const messageListener = (event) => {
|
3842
3865
|
var _a, _b;
|
3843
3866
|
const response = (_b = (_a = event == null ? void 0 : event.data) == null ? void 0 : _a.other) == null ? void 0 : _b.data;
|
@@ -3852,7 +3875,7 @@ function GetPaymentDynamic(props) {
|
|
3852
3875
|
window.removeEventListener("message", messageListener);
|
3853
3876
|
};
|
3854
3877
|
}, []);
|
3855
|
-
return /* @__PURE__ */
|
3878
|
+
return /* @__PURE__ */ import_react15.default.createElement("div", null, /* @__PURE__ */ import_react15.default.createElement("button", { className: "paymentBtn", onClick: handleShow }, "Pay"), /* @__PURE__ */ import_react15.default.createElement(import_react_bootstrap9.Modal, { show: show && iframeLoaded, id: "modal-pay", className: "modal-lg", onHide: handleClose }, /* @__PURE__ */ import_react15.default.createElement(import_react_bootstrap9.Modal.Header, { closeButton: true }), /* @__PURE__ */ import_react15.default.createElement(import_react_bootstrap9.Modal.Body, null, loading && /* @__PURE__ */ import_react15.default.createElement(MyLoadingAnimation, null), /* @__PURE__ */ import_react15.default.createElement(
|
3856
3879
|
"iframe",
|
3857
3880
|
{
|
3858
3881
|
src: `${baseUrl}widget-form/${amount}?fractalpay_public_key=${fractalpayClientKey}&order_id=${orderID}`,
|
@@ -3863,7 +3886,8 @@ function GetPaymentDynamic(props) {
|
|
3863
3886
|
}
|
3864
3887
|
))));
|
3865
3888
|
}
|
3866
|
-
export
|
3889
|
+
// Annotate the CommonJS export names for ESM import in node:
|
3890
|
+
0 && (module.exports = {
|
3867
3891
|
CompletedTransactions,
|
3868
3892
|
GetPaymentDynamic,
|
3869
3893
|
Payment,
|
@@ -3873,4 +3897,4 @@ export {
|
|
3873
3897
|
RequestPaymentonClick,
|
3874
3898
|
RqstPaymntInputField,
|
3875
3899
|
TockenizPay
|
3876
|
-
};
|
3900
|
+
});
|