@bigbinary/neeto-payments-frontend 3.2.2 → 3.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -401,7 +401,7 @@
|
|
|
401
401
|
},
|
|
402
402
|
"payment": {
|
|
403
403
|
"transaction": {
|
|
404
|
-
"label": "Enter the first 6 digits of your transaction ID",
|
|
404
|
+
"label": "Enter the first 6 digits of your UPI transaction ID",
|
|
405
405
|
"placeholder": "123456",
|
|
406
406
|
"required": "Transaction ID is required",
|
|
407
407
|
"sixCharacters": "Transaction ID should have 6 characters"
|
package/dist/UpiPayment.js
CHANGED
|
@@ -10,7 +10,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
10
10
|
import { a as useCreateUpiPayment } from './usePaymentsApi-1Lsm4d5C.js';
|
|
11
11
|
import { t } from 'i18next';
|
|
12
12
|
import * as yup from 'yup';
|
|
13
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
14
14
|
import '@tanstack/react-query';
|
|
15
15
|
import 'axios';
|
|
16
16
|
import './index-Cl511Juk.js';
|
|
@@ -18,7 +18,7 @@ import '@bigbinary/neeto-commons-frontend/constants';
|
|
|
18
18
|
import '@bigbinary/neeto-commons-frontend/utils';
|
|
19
19
|
|
|
20
20
|
var VALIDATION_SCHEMA = yup.object({
|
|
21
|
-
|
|
21
|
+
identifier: yup.string().required(t("neetoPayments.upi.payment.transaction.required")).min(6, t("neetoPayments.upi.payment.transaction.sixCharacters")).max(6, t("neetoPayments.upi.payment.transaction.sixCharacters"))
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
var vpaIdToQrCodeValue = function vpaIdToQrCodeValue(vpaId) {
|
|
@@ -28,73 +28,89 @@ var vpaIdToQrCodeValue = function vpaIdToQrCodeValue(vpaId) {
|
|
|
28
28
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
29
29
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
30
30
|
var UpiPayment = function UpiPayment(_ref) {
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
_ref$
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
var fee = _ref.fee,
|
|
32
|
+
payableId = _ref.payableId,
|
|
33
|
+
discountCode = _ref.discountCode,
|
|
34
|
+
handleCancel = _ref.handleCancel,
|
|
35
|
+
_ref$onBeforePayment = _ref.onBeforePayment,
|
|
36
|
+
onBeforePayment = _ref$onBeforePayment === void 0 ? noop : _ref$onBeforePayment,
|
|
37
|
+
_ref$onFailedPayment = _ref.onFailedPayment,
|
|
38
|
+
onFailedPayment = _ref$onFailedPayment === void 0 ? noop : _ref$onFailedPayment,
|
|
39
|
+
_ref$onSuccessfulPaym = _ref.onSuccessfulPayment,
|
|
40
|
+
onSuccessfulPayment = _ref$onSuccessfulPaym === void 0 ? noop : _ref$onSuccessfulPaym;
|
|
38
41
|
var _useTranslation = useTranslation(),
|
|
39
42
|
t = _useTranslation.t;
|
|
40
43
|
var vpaIds = pluck("address", fee === null || fee === void 0 ? void 0 : fee.vpas);
|
|
41
|
-
var _useCreateUpiPayment = useCreateUpiPayment({
|
|
44
|
+
var _useCreateUpiPayment = useCreateUpiPayment({
|
|
45
|
+
onSuccess: onSuccessfulPayment,
|
|
46
|
+
onError: onFailedPayment
|
|
47
|
+
}),
|
|
48
|
+
isPending = _useCreateUpiPayment.isPending,
|
|
42
49
|
createPayment = _useCreateUpiPayment.mutate;
|
|
43
50
|
var handleSubmit = function handleSubmit(values) {
|
|
51
|
+
onBeforePayment();
|
|
44
52
|
var payload = _objectSpread(_objectSpread({}, values), {}, {
|
|
45
|
-
payableId: payableId
|
|
53
|
+
payableId: payableId,
|
|
54
|
+
discountCode: discountCode
|
|
46
55
|
});
|
|
47
56
|
createPayment(payload);
|
|
48
|
-
onSubmit(values);
|
|
49
57
|
};
|
|
50
58
|
return /*#__PURE__*/jsx("div", {
|
|
51
|
-
children: /*#__PURE__*/
|
|
59
|
+
children: /*#__PURE__*/jsx(Form, {
|
|
52
60
|
className: "space-y-4",
|
|
53
61
|
formikProps: {
|
|
54
62
|
onSubmit: handleSubmit,
|
|
55
63
|
initialValues: {
|
|
56
|
-
|
|
64
|
+
identifier: ""
|
|
57
65
|
},
|
|
58
66
|
validationSchema: VALIDATION_SCHEMA
|
|
59
67
|
},
|
|
60
|
-
children:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
className: "
|
|
70
|
-
children:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
68
|
+
children: function children(_ref2) {
|
|
69
|
+
var dirty = _ref2.dirty;
|
|
70
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
71
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
72
|
+
style: "body1",
|
|
73
|
+
children: t("neetoPayments.upi.payment.vpaText", {
|
|
74
|
+
count: vpaIds.length
|
|
75
|
+
})
|
|
76
|
+
}), isPresent(vpaIds) && /*#__PURE__*/jsx("div", {
|
|
77
|
+
className: "grid grid-cols-1 gap-8 gap-y-4 sm:grid-cols-2",
|
|
78
|
+
children: vpaIds.map(function (vpaId) {
|
|
79
|
+
return /*#__PURE__*/jsxs("div", {
|
|
80
|
+
className: "flex flex-col items-center justify-center",
|
|
81
|
+
children: [/*#__PURE__*/jsx(QRCodeImage, {
|
|
82
|
+
size: 256,
|
|
83
|
+
style: {
|
|
84
|
+
width: 80,
|
|
85
|
+
height: 80
|
|
86
|
+
},
|
|
87
|
+
value: vpaIdToQrCodeValue(vpaId)
|
|
88
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
89
|
+
className: "mt-2 w-full break-words text-center",
|
|
90
|
+
style: "body2",
|
|
91
|
+
children: vpaId
|
|
92
|
+
})]
|
|
93
|
+
}, vpaId);
|
|
94
|
+
})
|
|
95
|
+
}), /*#__PURE__*/jsx(Input, {
|
|
96
|
+
required: true,
|
|
97
|
+
label: t("neetoPayments.upi.payment.transaction.label"),
|
|
98
|
+
name: "identifier",
|
|
99
|
+
placeholder: t("neetoPayments.upi.payment.transaction.placeholder")
|
|
100
|
+
}), /*#__PURE__*/jsx(ActionBlock, {
|
|
101
|
+
cancelButtonProps: {
|
|
102
|
+
label: t("neetoPayments.upi.payment.buttons.back"),
|
|
103
|
+
onClick: handleCancel,
|
|
104
|
+
disabled: isPending
|
|
105
|
+
},
|
|
106
|
+
submitButtonProps: {
|
|
107
|
+
label: t("neetoPayments.upi.payment.buttons.submit"),
|
|
108
|
+
disabled: !dirty || isPending,
|
|
109
|
+
loading: isPending
|
|
110
|
+
}
|
|
111
|
+
})]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
98
114
|
})
|
|
99
115
|
});
|
|
100
116
|
};
|
package/dist/UpiPayment.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpiPayment.js","sources":["../app/javascript/src/components/UpiPayment/constants.js","../app/javascript/src/components/UpiPayment/utils.js","../app/javascript/src/components/UpiPayment/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport * as yup from \"yup\";\n\nexport const VALIDATION_SCHEMA = yup.object({\n
|
|
1
|
+
{"version":3,"file":"UpiPayment.js","sources":["../app/javascript/src/components/UpiPayment/constants.js","../app/javascript/src/components/UpiPayment/utils.js","../app/javascript/src/components/UpiPayment/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport * as yup from \"yup\";\n\nexport const VALIDATION_SCHEMA = yup.object({\n identifier: yup\n .string()\n .required(t(\"neetoPayments.upi.payment.transaction.required\"))\n .min(6, t(\"neetoPayments.upi.payment.transaction.sixCharacters\"))\n .max(6, t(\"neetoPayments.upi.payment.transaction.sixCharacters\")),\n});\n","export const vpaIdToQrCodeValue = vpaId => `upi://pay?pa=${vpaId}`;\n","import { noop, isPresent } from \"neetocist\";\nimport { Typography } from \"neetoui\";\nimport { ActionBlock, Form, Input } from \"neetoui/formik\";\nimport QRCodeImage from \"qrcode.react\";\nimport { pluck } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateUpiPayment } from \"hooks/reactQuery/upi/usePaymentsApi\";\n\nimport { VALIDATION_SCHEMA } from \"./constants\";\nimport { vpaIdToQrCodeValue } from \"./utils\";\n\nconst UpiPayment = ({\n fee,\n payableId,\n discountCode,\n handleCancel,\n onBeforePayment = noop,\n onFailedPayment = noop,\n onSuccessfulPayment = noop,\n}) => {\n const { t } = useTranslation();\n\n const vpaIds = pluck(\"address\", fee?.vpas);\n\n const { isPending, mutate: createPayment } = useCreateUpiPayment({\n onSuccess: onSuccessfulPayment,\n onError: onFailedPayment,\n });\n\n const handleSubmit = values => {\n onBeforePayment();\n const payload = { ...values, payableId, discountCode };\n createPayment(payload);\n };\n\n return (\n <div>\n <Form\n className=\"space-y-4\"\n formikProps={{\n onSubmit: handleSubmit,\n initialValues: { identifier: \"\" },\n validationSchema: VALIDATION_SCHEMA,\n }}\n >\n {({ dirty }) => (\n <>\n <Typography style=\"body1\">\n {t(\"neetoPayments.upi.payment.vpaText\", { count: vpaIds.length })}\n </Typography>\n {isPresent(vpaIds) && (\n <div className=\"grid grid-cols-1 gap-8 gap-y-4 sm:grid-cols-2\">\n {vpaIds.map(vpaId => (\n <div\n className=\"flex flex-col items-center justify-center\"\n key={vpaId}\n >\n <QRCodeImage\n size={256}\n style={{ width: 80, height: 80 }}\n value={vpaIdToQrCodeValue(vpaId)}\n />\n <Typography\n className=\"mt-2 w-full break-words text-center\"\n style=\"body2\"\n >\n {vpaId}\n </Typography>\n </div>\n ))}\n </div>\n )}\n <Input\n required\n label={t(\"neetoPayments.upi.payment.transaction.label\")}\n name=\"identifier\"\n placeholder={t(\n \"neetoPayments.upi.payment.transaction.placeholder\"\n )}\n />\n <ActionBlock\n cancelButtonProps={{\n label: t(\"neetoPayments.upi.payment.buttons.back\"),\n onClick: handleCancel,\n disabled: isPending,\n }}\n submitButtonProps={{\n label: t(\"neetoPayments.upi.payment.buttons.submit\"),\n disabled: !dirty || isPending,\n loading: isPending,\n }}\n />\n </>\n )}\n </Form>\n </div>\n );\n};\n\nexport default UpiPayment;\n"],"names":["VALIDATION_SCHEMA","yup","object","identifier","string","required","t","min","max","vpaIdToQrCodeValue","vpaId","concat","UpiPayment","_ref","fee","payableId","discountCode","handleCancel","_ref$onBeforePayment","onBeforePayment","noop","_ref$onFailedPayment","onFailedPayment","_ref$onSuccessfulPaym","onSuccessfulPayment","_useTranslation","useTranslation","vpaIds","pluck","vpas","_useCreateUpiPayment","useCreateUpiPayment","onSuccess","onError","isPending","createPayment","mutate","handleSubmit","values","payload","_objectSpread","_jsx","children","Form","className","formikProps","onSubmit","initialValues","validationSchema","_ref2","dirty","_jsxs","_Fragment","Typography","style","count","length","isPresent","map","QRCodeImage","size","width","height","value","Input","label","name","placeholder","ActionBlock","cancelButtonPro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;AAC7BuC,cAAAA,OAAO,EAAEvC;AACX;AAAE,WACH,CAAC;AAAA,SACF,CAAC;AAAA;KAED;AAAC,GACJ,CAAC;AAEV;;;;"}
|
package/dist/cjs/UpiPayment.js
CHANGED
|
@@ -39,7 +39,7 @@ function _interopNamespaceDefault(e) {
|
|
|
39
39
|
var yup__namespace = /*#__PURE__*/_interopNamespaceDefault(yup);
|
|
40
40
|
|
|
41
41
|
var VALIDATION_SCHEMA = yup__namespace.object({
|
|
42
|
-
|
|
42
|
+
identifier: yup__namespace.string().required(i18next.t("neetoPayments.upi.payment.transaction.required")).min(6, i18next.t("neetoPayments.upi.payment.transaction.sixCharacters")).max(6, i18next.t("neetoPayments.upi.payment.transaction.sixCharacters"))
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
var vpaIdToQrCodeValue = function vpaIdToQrCodeValue(vpaId) {
|
|
@@ -49,73 +49,89 @@ var vpaIdToQrCodeValue = function vpaIdToQrCodeValue(vpaId) {
|
|
|
49
49
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
50
50
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
51
51
|
var UpiPayment = function UpiPayment(_ref) {
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
_ref$
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
var fee = _ref.fee,
|
|
53
|
+
payableId = _ref.payableId,
|
|
54
|
+
discountCode = _ref.discountCode,
|
|
55
|
+
handleCancel = _ref.handleCancel,
|
|
56
|
+
_ref$onBeforePayment = _ref.onBeforePayment,
|
|
57
|
+
onBeforePayment = _ref$onBeforePayment === void 0 ? neetoCist.noop : _ref$onBeforePayment,
|
|
58
|
+
_ref$onFailedPayment = _ref.onFailedPayment,
|
|
59
|
+
onFailedPayment = _ref$onFailedPayment === void 0 ? neetoCist.noop : _ref$onFailedPayment,
|
|
60
|
+
_ref$onSuccessfulPaym = _ref.onSuccessfulPayment,
|
|
61
|
+
onSuccessfulPayment = _ref$onSuccessfulPaym === void 0 ? neetoCist.noop : _ref$onSuccessfulPaym;
|
|
59
62
|
var _useTranslation = reactI18next.useTranslation(),
|
|
60
63
|
t = _useTranslation.t;
|
|
61
64
|
var vpaIds = ramda.pluck("address", fee === null || fee === void 0 ? void 0 : fee.vpas);
|
|
62
|
-
var _useCreateUpiPayment = usePaymentsApi.useCreateUpiPayment({
|
|
65
|
+
var _useCreateUpiPayment = usePaymentsApi.useCreateUpiPayment({
|
|
66
|
+
onSuccess: onSuccessfulPayment,
|
|
67
|
+
onError: onFailedPayment
|
|
68
|
+
}),
|
|
69
|
+
isPending = _useCreateUpiPayment.isPending,
|
|
63
70
|
createPayment = _useCreateUpiPayment.mutate;
|
|
64
71
|
var handleSubmit = function handleSubmit(values) {
|
|
72
|
+
onBeforePayment();
|
|
65
73
|
var payload = _objectSpread(_objectSpread({}, values), {}, {
|
|
66
|
-
payableId: payableId
|
|
74
|
+
payableId: payableId,
|
|
75
|
+
discountCode: discountCode
|
|
67
76
|
});
|
|
68
77
|
createPayment(payload);
|
|
69
|
-
onSubmit(values);
|
|
70
78
|
};
|
|
71
79
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
72
|
-
children: /*#__PURE__*/jsxRuntime.
|
|
80
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Form, {
|
|
73
81
|
className: "space-y-4",
|
|
74
82
|
formikProps: {
|
|
75
83
|
onSubmit: handleSubmit,
|
|
76
84
|
initialValues: {
|
|
77
|
-
|
|
85
|
+
identifier: ""
|
|
78
86
|
},
|
|
79
87
|
validationSchema: VALIDATION_SCHEMA
|
|
80
88
|
},
|
|
81
|
-
children:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
className: "
|
|
91
|
-
children:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
89
|
+
children: function children(_ref2) {
|
|
90
|
+
var dirty = _ref2.dirty;
|
|
91
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
92
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
93
|
+
style: "body1",
|
|
94
|
+
children: t("neetoPayments.upi.payment.vpaText", {
|
|
95
|
+
count: vpaIds.length
|
|
96
|
+
})
|
|
97
|
+
}), neetoCist.isPresent(vpaIds) && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
98
|
+
className: "grid grid-cols-1 gap-8 gap-y-4 sm:grid-cols-2",
|
|
99
|
+
children: vpaIds.map(function (vpaId) {
|
|
100
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
101
|
+
className: "flex flex-col items-center justify-center",
|
|
102
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(QRCodeImage, {
|
|
103
|
+
size: 256,
|
|
104
|
+
style: {
|
|
105
|
+
width: 80,
|
|
106
|
+
height: 80
|
|
107
|
+
},
|
|
108
|
+
value: vpaIdToQrCodeValue(vpaId)
|
|
109
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
110
|
+
className: "mt-2 w-full break-words text-center",
|
|
111
|
+
style: "body2",
|
|
112
|
+
children: vpaId
|
|
113
|
+
})]
|
|
114
|
+
}, vpaId);
|
|
115
|
+
})
|
|
116
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Input, {
|
|
117
|
+
required: true,
|
|
118
|
+
label: t("neetoPayments.upi.payment.transaction.label"),
|
|
119
|
+
name: "identifier",
|
|
120
|
+
placeholder: t("neetoPayments.upi.payment.transaction.placeholder")
|
|
121
|
+
}), /*#__PURE__*/jsxRuntime.jsx(ActionBlock, {
|
|
122
|
+
cancelButtonProps: {
|
|
123
|
+
label: t("neetoPayments.upi.payment.buttons.back"),
|
|
124
|
+
onClick: handleCancel,
|
|
125
|
+
disabled: isPending
|
|
126
|
+
},
|
|
127
|
+
submitButtonProps: {
|
|
128
|
+
label: t("neetoPayments.upi.payment.buttons.submit"),
|
|
129
|
+
disabled: !dirty || isPending,
|
|
130
|
+
loading: isPending
|
|
131
|
+
}
|
|
132
|
+
})]
|
|
133
|
+
});
|
|
134
|
+
}
|
|
119
135
|
})
|
|
120
136
|
});
|
|
121
137
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpiPayment.js","sources":["../../app/javascript/src/components/UpiPayment/constants.js","../../app/javascript/src/components/UpiPayment/utils.js","../../app/javascript/src/components/UpiPayment/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport * as yup from \"yup\";\n\nexport const VALIDATION_SCHEMA = yup.object({\n
|
|
1
|
+
{"version":3,"file":"UpiPayment.js","sources":["../../app/javascript/src/components/UpiPayment/constants.js","../../app/javascript/src/components/UpiPayment/utils.js","../../app/javascript/src/components/UpiPayment/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport * as yup from \"yup\";\n\nexport const VALIDATION_SCHEMA = yup.object({\n identifier: yup\n .string()\n .required(t(\"neetoPayments.upi.payment.transaction.required\"))\n .min(6, t(\"neetoPayments.upi.payment.transaction.sixCharacters\"))\n .max(6, t(\"neetoPayments.upi.payment.transaction.sixCharacters\")),\n});\n","export const vpaIdToQrCodeValue = vpaId => `upi://pay?pa=${vpaId}`;\n","import { noop, isPresent } from \"neetocist\";\nimport { Typography } from \"neetoui\";\nimport { ActionBlock, Form, Input } from \"neetoui/formik\";\nimport QRCodeImage from \"qrcode.react\";\nimport { pluck } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateUpiPayment } from \"hooks/reactQuery/upi/usePaymentsApi\";\n\nimport { VALIDATION_SCHEMA } from \"./constants\";\nimport { vpaIdToQrCodeValue } from \"./utils\";\n\nconst UpiPayment = ({\n fee,\n payableId,\n discountCode,\n handleCancel,\n onBeforePayment = noop,\n onFailedPayment = noop,\n onSuccessfulPayment = noop,\n}) => {\n const { t } = useTranslation();\n\n const vpaIds = pluck(\"address\", fee?.vpas);\n\n const { isPending, mutate: createPayment } = useCreateUpiPayment({\n onSuccess: onSuccessfulPayment,\n onError: onFailedPayment,\n });\n\n const handleSubmit = values => {\n onBeforePayment();\n const payload = { ...values, payableId, discountCode };\n createPayment(payload);\n };\n\n return (\n <div>\n <Form\n className=\"space-y-4\"\n formikProps={{\n onSubmit: handleSubmit,\n initialValues: { identifier: \"\" },\n validationSchema: VALIDATION_SCHEMA,\n }}\n >\n {({ dirty }) => (\n <>\n <Typography style=\"body1\">\n {t(\"neetoPayments.upi.payment.vpaText\", { count: vpaIds.length })}\n </Typography>\n {isPresent(vpaIds) && (\n <div className=\"grid grid-cols-1 gap-8 gap-y-4 sm:grid-cols-2\">\n {vpaIds.map(vpaId => (\n <div\n className=\"flex flex-col items-center justify-center\"\n key={vpaId}\n >\n <QRCodeImage\n size={256}\n style={{ width: 80, height: 80 }}\n value={vpaIdToQrCodeValue(vpaId)}\n />\n <Typography\n className=\"mt-2 w-full break-words text-center\"\n style=\"body2\"\n >\n {vpaId}\n </Typography>\n </div>\n ))}\n </div>\n )}\n <Input\n required\n label={t(\"neetoPayments.upi.payment.transaction.label\")}\n name=\"identifier\"\n placeholder={t(\n \"neetoPayments.upi.payment.transaction.placeholder\"\n )}\n />\n <ActionBlock\n cancelButtonProps={{\n label: t(\"neetoPayments.upi.payment.buttons.back\"),\n onClick: handleCancel,\n disabled: isPending,\n }}\n submitButtonProps={{\n label: t(\"neetoPayments.upi.payment.buttons.submit\"),\n disabled: !dirty || isPending,\n loading: isPending,\n }}\n />\n </>\n )}\n </Form>\n </div>\n );\n};\n\nexport default UpiPayment;\n"],"names":["VALIDATION_SCHEMA","yup","object","identifier","string","required","t","min","max","vpaIdToQrCodeValue","vpaId","concat","UpiPayment","_ref","fee","payableId","discountCode","handleCancel","_ref$onBeforePayment","onBeforePayment","noop","_ref$onFailedPayment","onFailedPayment","_ref$onSuccessfulPaym","onSuccessfulPayment","_useTranslation","useTranslation","vpaIds","pluck","vpas","_useCreateUpiPayment","useCreateUpiPayment","onSuccess","onError","isPending","createPayment","mutate","handleSubmit","values","payload","_objectSpread","_jsx","children","Form","className","formikProps","onSubmit","initialValues","validationSchema","_ref2","dirty","_jsxs","_Fragment","Typography","style","count","length","isPresent","map","QRCodeImage","size","width","height","value","Input","label","name","placeholder","ActionBlock","cancelButtonProps","onClick","disabled","submitButtonProps","loading"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAMA,iBAAiB,GAAGC,cAAG,CAACC,MAAM,CAAC;AAC1CC,EAAAA,UAAU,EAAEF,cAAG,CACZG,MAAM,EAAE,CACRC,QAAQ,CAACC,SAAC,CAAC,gDAAgD,CAAC,CAAC,CAC7DC,GAAG,CAAC,CAAC,EAAED,SAAC,CAAC,qDAAqD,CAAC,CAAC,CAChEE,GAAG,CAAC,CAAC,EAAEF,SAAC,CAAC,qDAAqD,CAAC;AACpE,CAAC,CAAC;;ACTK,IAAMG,kBAAkB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oBAAAA,KAAK,EAAE,EAAE;AAAEC,oBAAAA,MAAM,EAAE;mBAAK;kBACjCC,KAAK,EAAEtD,kBAAkB,CAACC,KAAK;AAAE,iBAClC,CAAC,eACF+B,cAAA,CAACY,UAAU,EAAA;AACTT,kBAAAA,SAAS,EAAC,qCAAqC;AAC/CU,kBAAAA,KAAK,EAAC,OAAO;AAAAZ,kBAAAA,QAAA,EAEZhC;AAAK,iBACI,CAAC;AAAA,eAAA,EAZRA,KAaF,CAAC;aACP;AAAC,WACC,CACN,eACD+B,cAAA,CAACuB,KAAK,EAAA;YACJ3D,QAAQ,EAAA,IAAA;AACR4D,YAAAA,KAAK,EAAE3D,CAAC,CAAC,6CAA6C,CAAE;AACxD4D,YAAAA,IAAI,EAAC,YAAY;YACjBC,WAAW,EAAE7D,CAAC,CACZ,mDACF;AAAE,WACH,CAAC,eACFmC,cAAA,CAAC2B,WAAW,EAAA;AACVC,YAAAA,iBAAiB,EAAE;AACjBJ,cAAAA,KAAK,EAAE3D,CAAC,CAAC,wCAAwC,CAAC;AAClDgE,cAAAA,OAAO,EAAErD,YAAY;AACrBsD,cAAAA,QAAQ,EAAErC;aACV;AACFsC,YAAAA,iBAAiB,EAAE;AACjBP,cAAAA,KAAK,EAAE3D,CAAC,CAAC,0CAA0C,CAAC;AACpDiE,cAAAA,QAAQ,EAAE,CAACrB,KAAK,IAAIhB,SAAS;AAC7BuC,cAAAA,OAAO,EAAEvC;AACX;AAAE,WACH,CAAC;AAAA,SACF,CAAC;AAAA;KAED;AAAC,GACJ,CAAC;AAEV;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-payments-frontend",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.3",
|
|
4
4
|
"description": "To manage payments across the neeto products.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://github.com/bigbinary/neeto-payments-nano",
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"@bigbinary/eslint-plugin-neeto": "1.5.6",
|
|
62
62
|
"@bigbinary/neeto-cist": "1.0.14",
|
|
63
63
|
"@bigbinary/neeto-commons-frontend": "4.13.14",
|
|
64
|
-
"@bigbinary/neeto-editor": "1.
|
|
64
|
+
"@bigbinary/neeto-editor": "1.45.0",
|
|
65
65
|
"@bigbinary/neeto-filters-frontend": "4.3.13",
|
|
66
|
-
"@bigbinary/neeto-icons": "1.20.
|
|
67
|
-
"@bigbinary/neeto-molecules": "3.15.
|
|
68
|
-
"@bigbinary/neetoui": "8.2.
|
|
66
|
+
"@bigbinary/neeto-icons": "1.20.23",
|
|
67
|
+
"@bigbinary/neeto-molecules": "3.15.6",
|
|
68
|
+
"@bigbinary/neetoui": "8.2.54",
|
|
69
69
|
"@emotion/is-prop-valid": "1.2.0",
|
|
70
70
|
"@faker-js/faker": "8.2.0",
|
|
71
71
|
"@honeybadger-io/js": "6.10.1",
|
|
@@ -171,11 +171,11 @@
|
|
|
171
171
|
"@babel/runtime": "7.26.0",
|
|
172
172
|
"@bigbinary/neeto-cist": "1.0.14",
|
|
173
173
|
"@bigbinary/neeto-commons-frontend": "4.13.14",
|
|
174
|
-
"@bigbinary/neeto-editor": "1.
|
|
174
|
+
"@bigbinary/neeto-editor": "1.45.0",
|
|
175
175
|
"@bigbinary/neeto-filters-frontend": "4.3.13",
|
|
176
|
-
"@bigbinary/neeto-icons": "1.20.
|
|
177
|
-
"@bigbinary/neeto-molecules": "3.15.
|
|
178
|
-
"@bigbinary/neetoui": "8.2.
|
|
176
|
+
"@bigbinary/neeto-icons": "1.20.23",
|
|
177
|
+
"@bigbinary/neeto-molecules": "3.15.6",
|
|
178
|
+
"@bigbinary/neetoui": "8.2.54",
|
|
179
179
|
"@honeybadger-io/js": "6.10.1",
|
|
180
180
|
"@honeybadger-io/react": "6.1.25",
|
|
181
181
|
"@tailwindcss/container-queries": "^0.1.1",
|