@bigbinary/neeto-payments-frontend 3.3.22 → 3.3.23
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.
|
@@ -8,6 +8,7 @@ import Form from '@bigbinary/neetoui/formik/Form';
|
|
|
8
8
|
import Textarea from '@bigbinary/neetoui/formik/Textarea';
|
|
9
9
|
import Select from '@bigbinary/neetoui/formik/Select';
|
|
10
10
|
import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
11
|
+
import { mergeLeft } from 'ramda';
|
|
11
12
|
import { useTranslation } from 'react-i18next';
|
|
12
13
|
import { u as useUpdateUpiPayment } from './usePaymentsApi-K6rhWzss.js';
|
|
13
14
|
import { t } from 'i18next';
|
|
@@ -19,7 +20,6 @@ import 'axios';
|
|
|
19
20
|
import './index-ER2sofJn.js';
|
|
20
21
|
import '@bigbinary/neeto-commons-frontend/constants';
|
|
21
22
|
import '@bigbinary/neeto-commons-frontend/utils';
|
|
22
|
-
import 'ramda';
|
|
23
23
|
|
|
24
24
|
var INITIAL_VALUE = {
|
|
25
25
|
vpaId: "",
|
|
@@ -47,6 +47,9 @@ var ConfirmUpiPaymentButton = function ConfirmUpiPaymentButton(_ref) {
|
|
|
47
47
|
}),
|
|
48
48
|
updateUpiPayment = _useUpdateUpiPayment.mutate,
|
|
49
49
|
isPending = _useUpdateUpiPayment.isPending;
|
|
50
|
+
var initialValues = vpas.length === 1 ? mergeLeft({
|
|
51
|
+
vpaId: vpas[0].id
|
|
52
|
+
}, INITIAL_VALUE) : INITIAL_VALUE;
|
|
50
53
|
var onClose = function onClose() {
|
|
51
54
|
return setIsModalOpen(false);
|
|
52
55
|
};
|
|
@@ -84,9 +87,9 @@ var ConfirmUpiPaymentButton = function ConfirmUpiPaymentButton(_ref) {
|
|
|
84
87
|
})
|
|
85
88
|
}), /*#__PURE__*/jsx(Form, {
|
|
86
89
|
formikProps: {
|
|
90
|
+
initialValues: initialValues,
|
|
87
91
|
enableReinitialize: true,
|
|
88
92
|
onSubmit: handleSubmit,
|
|
89
|
-
initialValues: INITIAL_VALUE,
|
|
90
93
|
validationSchema: VALIDATION_SCHEMA
|
|
91
94
|
},
|
|
92
95
|
children: function children(_ref3) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmUpiPaymentButton.js","sources":["../app/javascript/src/components/ConfirmUpiPaymentButton/constants.js","../app/javascript/src/components/ConfirmUpiPaymentButton/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport * as yup from \"yup\";\n\nexport const INITIAL_VALUE = { vpaId: \"\", notes: \"\" };\n\nexport const VALIDATION_SCHEMA = yup.object({\n vpaId: yup\n .string()\n .required(t(\"neetoPayments.upi.confirmModal.vpasIdRequired\")),\n});\n","import { useState } from \"react\";\n\nimport { findBy, noop } from \"neetocist\";\nimport { Button, Modal, Typography } from \"neetoui\";\nimport { Form, Textarea, Select, ActionBlock } from \"neetoui/formik\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useUpdateUpiPayment } from \"hooks/reactQuery/upi/usePaymentsApi\";\n\nimport { INITIAL_VALUE, VALIDATION_SCHEMA } from \"./constants\";\n\nconst ConfirmUpiPaymentButton = ({\n vpas,\n identifier,\n paymentId,\n payableId,\n onSuccess = noop,\n}) => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const { t } = useTranslation();\n\n const { mutate: updateUpiPayment, isPending } = useUpdateUpiPayment(\n paymentId,\n { onSuccess }\n );\n const onClose = () => setIsModalOpen(false);\n\n const handleSubmit = ({ vpaId, notes }) => {\n const vpa = findBy({ id: vpaId }, vpas);\n const payload = {\n notes,\n vpaId,\n payableId,\n upiId: vpa.upiId,\n status: \"successful\",\n };\n updateUpiPayment(payload);\n };\n\n return (\n <>\n <Button\n label={t(\"neetoPayments.upi.payment.buttons.confirmPayment\")}\n loading={isPending}\n size=\"small\"\n onClick={() => setIsModalOpen(true)}\n />\n <Modal {...{ onClose }} isOpen={isModalOpen} size=\"large\">\n <Modal.Header>\n <Typography style=\"h2\">\n {t(\"neetoPayments.upi.confirmModal.title\")}\n </Typography>\n </Modal.Header>\n <Form\n formikProps={{\n enableReinitialize: true,\n onSubmit: handleSubmit,\n
|
|
1
|
+
{"version":3,"file":"ConfirmUpiPaymentButton.js","sources":["../app/javascript/src/components/ConfirmUpiPaymentButton/constants.js","../app/javascript/src/components/ConfirmUpiPaymentButton/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport * as yup from \"yup\";\n\nexport const INITIAL_VALUE = { vpaId: \"\", notes: \"\" };\n\nexport const VALIDATION_SCHEMA = yup.object({\n vpaId: yup\n .string()\n .required(t(\"neetoPayments.upi.confirmModal.vpasIdRequired\")),\n});\n","import { useState } from \"react\";\n\nimport { findBy, noop } from \"neetocist\";\nimport { Button, Modal, Typography } from \"neetoui\";\nimport { Form, Textarea, Select, ActionBlock } from \"neetoui/formik\";\nimport { mergeLeft } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useUpdateUpiPayment } from \"hooks/reactQuery/upi/usePaymentsApi\";\n\nimport { INITIAL_VALUE, VALIDATION_SCHEMA } from \"./constants\";\n\nconst ConfirmUpiPaymentButton = ({\n vpas,\n identifier,\n paymentId,\n payableId,\n onSuccess = noop,\n}) => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const { t } = useTranslation();\n\n const { mutate: updateUpiPayment, isPending } = useUpdateUpiPayment(\n paymentId,\n { onSuccess }\n );\n\n const initialValues =\n vpas.length === 1\n ? mergeLeft({ vpaId: vpas[0].id }, INITIAL_VALUE)\n : INITIAL_VALUE;\n\n const onClose = () => setIsModalOpen(false);\n\n const handleSubmit = ({ vpaId, notes }) => {\n const vpa = findBy({ id: vpaId }, vpas);\n const payload = {\n notes,\n vpaId,\n payableId,\n upiId: vpa.upiId,\n status: \"successful\",\n };\n updateUpiPayment(payload);\n };\n\n return (\n <>\n <Button\n label={t(\"neetoPayments.upi.payment.buttons.confirmPayment\")}\n loading={isPending}\n size=\"small\"\n onClick={() => setIsModalOpen(true)}\n />\n <Modal {...{ onClose }} isOpen={isModalOpen} size=\"large\">\n <Modal.Header>\n <Typography style=\"h2\">\n {t(\"neetoPayments.upi.confirmModal.title\")}\n </Typography>\n </Modal.Header>\n <Form\n formikProps={{\n initialValues,\n enableReinitialize: true,\n onSubmit: handleSubmit,\n validationSchema: VALIDATION_SCHEMA,\n }}\n >\n {({ setFieldValue }) => (\n <>\n <Modal.Body>\n <div className=\"flex flex-col space-y-4\">\n <Typography lineHeight=\"normal\" style=\"body2\">\n {t(\"neetoPayments.upi.confirmModal.upiTransactionId\", {\n identifier,\n })}\n </Typography>\n <Select\n label={t(\"neetoPayments.upi.confirmModal.accountIdLabel\")}\n name=\"vpaId\"\n options={vpas?.map(({ address, id }) => ({\n label: address,\n value: id,\n }))}\n onChange={({ value }) => setFieldValue(\"vpaId\", value)}\n />\n <Textarea\n data-cy=\"confirm-booking-modal-input-textfield\"\n label={t(\"neetoPayments.upi.confirmModal.notes\")}\n name=\"notes\"\n placeholder={t(\n \"neetoPayments.upi.confirmModal.notesPlaceholder\"\n )}\n />\n </div>\n </Modal.Body>\n <Modal.Footer className=\"space-x-2\">\n <ActionBlock\n isSubmitting={isPending}\n position=\"right\"\n cancelButtonProps={{\n onClick: onClose,\n style: \"tertiary\",\n }}\n submitButtonProps={{\n label: t(\"neetoPayments.common.confirm\"),\n }}\n />\n </Modal.Footer>\n </>\n )}\n </Form>\n </Modal>\n </>\n );\n};\n\nexport default ConfirmUpiPaymentButton;\n"],"names":["INITIAL_VALUE","vpaId","notes","VALIDATION_SCHEMA","yup","object","string","required","t","ConfirmUpiPaymentButton","_ref","vpas","identifier","paymentId","payableId","_ref$onSuccess","onSuccess","noop","_useState","useState","_useState2","_slicedToArray","isModalOpen","setIsModalOpen","_useTranslation","useTranslation","_useUpdateUpiPayment","useUpdateUpiPayment","updateUpiPayment","mutate","isPending","initialValues","length","mergeLeft","id","onClose","handleSubmit","_ref2","vpa","findBy","payload","upiId","status","_jsxs","_Fragment","children","_jsx","Button","label","loading","size","onClick","Modal","isOpen","Header","Typography","style","Form","formikProps","enableReinitialize","onSubmit","validationSchema","_ref3","setFieldValue","Body","className","lineHeight","Select","name","options","map","_ref4","address","value","onChange","_ref5","Textarea","placeholder","Footer","ActionBlock","isSubmitting","position","cancelButtonProps","submitButtonProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAMA,aAAa,GAAG;AAAEC,EAAAA,KAAK,EAAE,EAAE;AAAEC,EAAAA,KAAK,EAAE;AAAG,CAAC;AAE9C,IAAMC,iBAAiB,GAAGC,GAAG,CAACC,MAAM,CAAC;AAC1CJ,EAAAA,KAAK,EAAEG,GAAG,CACPE,MAAM,EAAE,CACRC,QAAQ,CAACC,CAAC,CAAC,+CAA+C,CAAC;AAChE,CAAC,CAAC;;ACGF,IAAMC,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAAC,IAAA,EAMvB;AAAA,EAAA,IALJC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,UAAU,GAAAF,IAAA,CAAVE,UAAU;IACVC,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IAAAC,cAAA,GAAAL,IAAA,CACTM,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAGE,KAAAA,CAAAA,GAAAA,IAAI,GAAAF,cAAA;AAEhB,EAAA,IAAAG,SAAA,GAAsCC,QAAQ,CAAC,KAAK,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAA9CI,IAAAA,WAAW,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,cAAc,GAAAH,UAAA,CAAA,CAAA,CAAA;AAElC,EAAA,IAAAI,eAAA,GAAcC,cAAc,EAAE;IAAtBjB,CAAC,GAAAgB,eAAA,CAADhB,CAAC;AAET,EAAA,IAAAkB,oBAAA,GAAgDC,mBAAmB,CACjEd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;;"}
|
|
@@ -10,6 +10,7 @@ var Form = require('@bigbinary/neetoui/formik/Form');
|
|
|
10
10
|
var Textarea = require('@bigbinary/neetoui/formik/Textarea');
|
|
11
11
|
var Select = require('@bigbinary/neetoui/formik/Select');
|
|
12
12
|
var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
|
|
13
|
+
var ramda = require('ramda');
|
|
13
14
|
var reactI18next = require('react-i18next');
|
|
14
15
|
var usePaymentsApi = require('./usePaymentsApi-Dz6uXFhx.js');
|
|
15
16
|
var i18next = require('i18next');
|
|
@@ -21,7 +22,6 @@ require('axios');
|
|
|
21
22
|
require('./index-BYewZJN8.js');
|
|
22
23
|
require('@bigbinary/neeto-commons-frontend/constants');
|
|
23
24
|
require('@bigbinary/neeto-commons-frontend/utils');
|
|
24
|
-
require('ramda');
|
|
25
25
|
|
|
26
26
|
function _interopNamespaceDefault(e) {
|
|
27
27
|
var n = Object.create(null);
|
|
@@ -68,6 +68,9 @@ var ConfirmUpiPaymentButton = function ConfirmUpiPaymentButton(_ref) {
|
|
|
68
68
|
}),
|
|
69
69
|
updateUpiPayment = _useUpdateUpiPayment.mutate,
|
|
70
70
|
isPending = _useUpdateUpiPayment.isPending;
|
|
71
|
+
var initialValues = vpas.length === 1 ? ramda.mergeLeft({
|
|
72
|
+
vpaId: vpas[0].id
|
|
73
|
+
}, INITIAL_VALUE) : INITIAL_VALUE;
|
|
71
74
|
var onClose = function onClose() {
|
|
72
75
|
return setIsModalOpen(false);
|
|
73
76
|
};
|
|
@@ -105,9 +108,9 @@ var ConfirmUpiPaymentButton = function ConfirmUpiPaymentButton(_ref) {
|
|
|
105
108
|
})
|
|
106
109
|
}), /*#__PURE__*/jsxRuntime.jsx(Form, {
|
|
107
110
|
formikProps: {
|
|
111
|
+
initialValues: initialValues,
|
|
108
112
|
enableReinitialize: true,
|
|
109
113
|
onSubmit: handleSubmit,
|
|
110
|
-
initialValues: INITIAL_VALUE,
|
|
111
114
|
validationSchema: VALIDATION_SCHEMA
|
|
112
115
|
},
|
|
113
116
|
children: function children(_ref3) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmUpiPaymentButton.js","sources":["../../app/javascript/src/components/ConfirmUpiPaymentButton/constants.js","../../app/javascript/src/components/ConfirmUpiPaymentButton/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport * as yup from \"yup\";\n\nexport const INITIAL_VALUE = { vpaId: \"\", notes: \"\" };\n\nexport const VALIDATION_SCHEMA = yup.object({\n vpaId: yup\n .string()\n .required(t(\"neetoPayments.upi.confirmModal.vpasIdRequired\")),\n});\n","import { useState } from \"react\";\n\nimport { findBy, noop } from \"neetocist\";\nimport { Button, Modal, Typography } from \"neetoui\";\nimport { Form, Textarea, Select, ActionBlock } from \"neetoui/formik\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useUpdateUpiPayment } from \"hooks/reactQuery/upi/usePaymentsApi\";\n\nimport { INITIAL_VALUE, VALIDATION_SCHEMA } from \"./constants\";\n\nconst ConfirmUpiPaymentButton = ({\n vpas,\n identifier,\n paymentId,\n payableId,\n onSuccess = noop,\n}) => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const { t } = useTranslation();\n\n const { mutate: updateUpiPayment, isPending } = useUpdateUpiPayment(\n paymentId,\n { onSuccess }\n );\n const onClose = () => setIsModalOpen(false);\n\n const handleSubmit = ({ vpaId, notes }) => {\n const vpa = findBy({ id: vpaId }, vpas);\n const payload = {\n notes,\n vpaId,\n payableId,\n upiId: vpa.upiId,\n status: \"successful\",\n };\n updateUpiPayment(payload);\n };\n\n return (\n <>\n <Button\n label={t(\"neetoPayments.upi.payment.buttons.confirmPayment\")}\n loading={isPending}\n size=\"small\"\n onClick={() => setIsModalOpen(true)}\n />\n <Modal {...{ onClose }} isOpen={isModalOpen} size=\"large\">\n <Modal.Header>\n <Typography style=\"h2\">\n {t(\"neetoPayments.upi.confirmModal.title\")}\n </Typography>\n </Modal.Header>\n <Form\n formikProps={{\n enableReinitialize: true,\n onSubmit: handleSubmit,\n
|
|
1
|
+
{"version":3,"file":"ConfirmUpiPaymentButton.js","sources":["../../app/javascript/src/components/ConfirmUpiPaymentButton/constants.js","../../app/javascript/src/components/ConfirmUpiPaymentButton/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport * as yup from \"yup\";\n\nexport const INITIAL_VALUE = { vpaId: \"\", notes: \"\" };\n\nexport const VALIDATION_SCHEMA = yup.object({\n vpaId: yup\n .string()\n .required(t(\"neetoPayments.upi.confirmModal.vpasIdRequired\")),\n});\n","import { useState } from \"react\";\n\nimport { findBy, noop } from \"neetocist\";\nimport { Button, Modal, Typography } from \"neetoui\";\nimport { Form, Textarea, Select, ActionBlock } from \"neetoui/formik\";\nimport { mergeLeft } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useUpdateUpiPayment } from \"hooks/reactQuery/upi/usePaymentsApi\";\n\nimport { INITIAL_VALUE, VALIDATION_SCHEMA } from \"./constants\";\n\nconst ConfirmUpiPaymentButton = ({\n vpas,\n identifier,\n paymentId,\n payableId,\n onSuccess = noop,\n}) => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const { t } = useTranslation();\n\n const { mutate: updateUpiPayment, isPending } = useUpdateUpiPayment(\n paymentId,\n { onSuccess }\n );\n\n const initialValues =\n vpas.length === 1\n ? mergeLeft({ vpaId: vpas[0].id }, INITIAL_VALUE)\n : INITIAL_VALUE;\n\n const onClose = () => setIsModalOpen(false);\n\n const handleSubmit = ({ vpaId, notes }) => {\n const vpa = findBy({ id: vpaId }, vpas);\n const payload = {\n notes,\n vpaId,\n payableId,\n upiId: vpa.upiId,\n status: \"successful\",\n };\n updateUpiPayment(payload);\n };\n\n return (\n <>\n <Button\n label={t(\"neetoPayments.upi.payment.buttons.confirmPayment\")}\n loading={isPending}\n size=\"small\"\n onClick={() => setIsModalOpen(true)}\n />\n <Modal {...{ onClose }} isOpen={isModalOpen} size=\"large\">\n <Modal.Header>\n <Typography style=\"h2\">\n {t(\"neetoPayments.upi.confirmModal.title\")}\n </Typography>\n </Modal.Header>\n <Form\n formikProps={{\n initialValues,\n enableReinitialize: true,\n onSubmit: handleSubmit,\n validationSchema: VALIDATION_SCHEMA,\n }}\n >\n {({ setFieldValue }) => (\n <>\n <Modal.Body>\n <div className=\"flex flex-col space-y-4\">\n <Typography lineHeight=\"normal\" style=\"body2\">\n {t(\"neetoPayments.upi.confirmModal.upiTransactionId\", {\n identifier,\n })}\n </Typography>\n <Select\n label={t(\"neetoPayments.upi.confirmModal.accountIdLabel\")}\n name=\"vpaId\"\n options={vpas?.map(({ address, id }) => ({\n label: address,\n value: id,\n }))}\n onChange={({ value }) => setFieldValue(\"vpaId\", value)}\n />\n <Textarea\n data-cy=\"confirm-booking-modal-input-textfield\"\n label={t(\"neetoPayments.upi.confirmModal.notes\")}\n name=\"notes\"\n placeholder={t(\n \"neetoPayments.upi.confirmModal.notesPlaceholder\"\n )}\n />\n </div>\n </Modal.Body>\n <Modal.Footer className=\"space-x-2\">\n <ActionBlock\n isSubmitting={isPending}\n position=\"right\"\n cancelButtonProps={{\n onClick: onClose,\n style: \"tertiary\",\n }}\n submitButtonProps={{\n label: t(\"neetoPayments.common.confirm\"),\n }}\n />\n </Modal.Footer>\n </>\n )}\n </Form>\n </Modal>\n </>\n );\n};\n\nexport default ConfirmUpiPaymentButton;\n"],"names":["INITIAL_VALUE","vpaId","notes","VALIDATION_SCHEMA","yup","object","string","required","t","ConfirmUpiPaymentButton","_ref","vpas","identifier","paymentId","payableId","_ref$onSuccess","onSuccess","noop","_useState","useState","_useState2","_slicedToArray","isModalOpen","setIsModalOpen","_useTranslation","useTranslation","_useUpdateUpiPayment","useUpdateUpiPayment","updateUpiPayment","mutate","isPending","initialValues","length","mergeLeft","id","onClose","handleSubmit","_ref2","vpa","findBy","payload","upiId","status","_jsxs","_Fragment","children","_jsx","Button","label","loading","size","onClick","Modal","isOpen","Header","Typography","style","Form","formikProps","enableReinitialize","onSubmit","validationSchema","_ref3","setFieldValue","Body","className","lineHeight","Select","name","options","map","_ref4","address","value","onChange","_ref5","Textarea","placeholder","Footer","ActionBlock","isSubmitting","position","cancelButtonProps","submitButtonProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAMA,aAAa,GAAG;AAAEC,EAAAA,KAAK,EAAE,EAAE;AAAEC,EAAAA,KAAK,EAAE;AAAG,CAAC;AAE9C,IAAMC,iBAAiB,GAAGC,cAAG,CAACC,MAAM,CAAC;AAC1CJ,EAAAA,KAAK,EAAEG,cAAG,CACPE,MAAM,EAAE,CACRC,QAAQ,CAACC,SAAC,CAAC,+CAA+C,CAAC;AAChE,CAAC,CAAC;;ACGF,IAAMC,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAAC,IAAA,EAMvB;AAAA,EAAA,IALJC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,UAAU,GAAAF,IAAA,CAAVE,UAAU;IACVC,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IAAAC,cAAA,GAAAL,IAAA,CACTM,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAGE,KAAAA,CAAAA,GAAAA,cAAI,GAAAF,cAAA;AAEhB,EAAA,IAAAG,SAAA,GAAsCC,cAAQ,CAAC,KAAK,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAA9CI,IAAAA,WAAW,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,cAAc,GAAAH,UAAA,CAAA,CAAA,CAAA;AAElC,EAAA,IAAAI,eAAA,GAAcC,2BAAc,EAAE;IAAtBjB,CAAC,GAAAgB,eAAA,CAADhB,CAAC;AAET,EAAA,IAAAkB,oBAAA,GAAgDC,kCAAmB,CACjEd,SAAS,EACT;AAAEG,MAAAA,SAAS,EAATA;AAAU,KACd,CAAC;IAHeY,gBAAg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
2
2
|
"name": "@bigbinary/neeto-payments-frontend",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.23",
|
|
4
4
|
"description": "To manage payments across the neeto products.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://github.com/bigbinary/neeto-payments-nano",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@bigbinary/neeto-filters-frontend": "4.3.16",
|
|
66
66
|
"@bigbinary/neeto-icons": "1.20.31",
|
|
67
67
|
"@bigbinary/neeto-molecules": "3.16.1",
|
|
68
|
-
"@bigbinary/neetoui": "8.2.
|
|
68
|
+
"@bigbinary/neetoui": "8.2.79",
|
|
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",
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
"@bigbinary/neeto-filters-frontend": "4.3.16",
|
|
176
176
|
"@bigbinary/neeto-icons": "1.20.31",
|
|
177
177
|
"@bigbinary/neeto-molecules": "3.16.1",
|
|
178
|
-
"@bigbinary/neetoui": "8.2.
|
|
178
|
+
"@bigbinary/neetoui": "8.2.79",
|
|
179
179
|
"@honeybadger-io/js": "6.10.1",
|
|
180
180
|
"@honeybadger-io/react": "6.1.25",
|
|
181
181
|
"@tailwindcss/container-queries": "^0.1.1",
|