@bigbinary/neeto-payments-frontend 3.3.31 → 3.3.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/javascript/src/translations/en.json +10 -1
- package/dist/AccountsDashboard.js +545 -0
- package/dist/AccountsDashboard.js.map +1 -0
- package/dist/AdminCancelRecurringPaymentButton.js +79 -0
- package/dist/AdminCancelRecurringPaymentButton.js.map +1 -0
- package/dist/CashPaymentButton.js +55 -0
- package/dist/CashPaymentButton.js.map +1 -0
- package/dist/ConfirmCashPaymentButton.js +104 -0
- package/dist/ConfirmCashPaymentButton.js.map +1 -0
- package/dist/ConfirmUpiPaymentButton.js +151 -0
- package/dist/ConfirmUpiPaymentButton.js.map +1 -0
- package/dist/CopyButtonWrapper-SoJkwX-d.js +27 -0
- package/dist/CopyButtonWrapper-SoJkwX-d.js.map +1 -0
- package/dist/CustomerCancelRecurringPaymentForm.js +111 -0
- package/dist/CustomerCancelRecurringPaymentForm.js.map +1 -0
- package/dist/ExportModal-BsFxUaYJ.js +131 -0
- package/dist/ExportModal-BsFxUaYJ.js.map +1 -0
- package/dist/ManualUpiPaymentConfirmButton.js +188 -0
- package/dist/ManualUpiPaymentConfirmButton.js.map +1 -0
- package/dist/PaymentKindRestrictionAlert.js +39 -0
- package/dist/PaymentKindRestrictionAlert.js.map +1 -0
- package/dist/PaymentsDashboard.js +586 -0
- package/dist/PaymentsDashboard.js.map +1 -0
- package/dist/PayoutsDashboard.js +559 -0
- package/dist/PayoutsDashboard.js.map +1 -0
- package/dist/PayoutsPage.js +162 -0
- package/dist/PayoutsPage.js.map +1 -0
- package/dist/RazorpayPaymentButton.js +145 -0
- package/dist/RazorpayPaymentButton.js.map +1 -0
- package/dist/RecurringPaymentSettings.js +132 -0
- package/dist/RecurringPaymentSettings.js.map +1 -0
- package/dist/RefundsDashboard.js +531 -0
- package/dist/RefundsDashboard.js.map +1 -0
- package/dist/SplitTransfersDashboard.js +1119 -0
- package/dist/SplitTransfersDashboard.js.map +1 -0
- package/dist/TaxesDashboard.js +411 -0
- package/dist/TaxesDashboard.js.map +1 -0
- package/dist/UpiConnect.js +171 -0
- package/dist/UpiConnect.js.map +1 -0
- package/dist/UpiPayment.js +120 -0
- package/dist/UpiPayment.js.map +1 -0
- package/dist/buildStripeTransactionLink.js +11 -0
- package/dist/buildStripeTransactionLink.js.map +1 -0
- package/dist/cjs/AccountsDashboard.js +547 -0
- package/dist/cjs/AccountsDashboard.js.map +1 -0
- package/dist/cjs/AdminCancelRecurringPaymentButton.js +81 -0
- package/dist/cjs/AdminCancelRecurringPaymentButton.js.map +1 -0
- package/dist/cjs/CashPaymentButton.js +57 -0
- package/dist/cjs/CashPaymentButton.js.map +1 -0
- package/dist/cjs/ConfirmCashPaymentButton.js +106 -0
- package/dist/cjs/ConfirmCashPaymentButton.js.map +1 -0
- package/dist/cjs/ConfirmUpiPaymentButton.js +172 -0
- package/dist/cjs/ConfirmUpiPaymentButton.js.map +1 -0
- package/dist/cjs/CopyButtonWrapper-Ds1k64E0.js +30 -0
- package/dist/cjs/CopyButtonWrapper-Ds1k64E0.js.map +1 -0
- package/dist/cjs/CustomerCancelRecurringPaymentForm.js +113 -0
- package/dist/cjs/CustomerCancelRecurringPaymentForm.js.map +1 -0
- package/dist/cjs/ExportModal-BJ2TrvE8.js +133 -0
- package/dist/cjs/ExportModal-BJ2TrvE8.js.map +1 -0
- package/dist/cjs/ManualUpiPaymentConfirmButton.js +209 -0
- package/dist/cjs/ManualUpiPaymentConfirmButton.js.map +1 -0
- package/dist/cjs/PaymentKindRestrictionAlert.js +41 -0
- package/dist/cjs/PaymentKindRestrictionAlert.js.map +1 -0
- package/dist/cjs/PaymentsDashboard.js +588 -0
- package/dist/cjs/PaymentsDashboard.js.map +1 -0
- package/dist/cjs/PayoutsDashboard.js +561 -0
- package/dist/cjs/PayoutsDashboard.js.map +1 -0
- package/dist/cjs/PayoutsPage.js +164 -0
- package/dist/cjs/PayoutsPage.js.map +1 -0
- package/dist/cjs/RazorpayPaymentButton.js +147 -0
- package/dist/cjs/RazorpayPaymentButton.js.map +1 -0
- package/dist/cjs/RecurringPaymentSettings.js +153 -0
- package/dist/cjs/RecurringPaymentSettings.js.map +1 -0
- package/dist/cjs/RefundsDashboard.js +533 -0
- package/dist/cjs/RefundsDashboard.js.map +1 -0
- package/dist/cjs/SplitTransfersDashboard.js +1140 -0
- package/dist/cjs/SplitTransfersDashboard.js.map +1 -0
- package/dist/cjs/TaxesDashboard.js +432 -0
- package/dist/cjs/TaxesDashboard.js.map +1 -0
- package/dist/cjs/UpiConnect.js +192 -0
- package/dist/cjs/UpiConnect.js.map +1 -0
- package/dist/cjs/UpiPayment.js +141 -0
- package/dist/cjs/UpiPayment.js.map +1 -0
- package/dist/cjs/buildStripeTransactionLink.js +13 -0
- package/dist/cjs/buildStripeTransactionLink.js.map +1 -0
- package/dist/cjs/constants.js +32 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/dashboard-Bjhw-y9S.js +112 -0
- package/dist/cjs/dashboard-Bjhw-y9S.js.map +1 -0
- package/dist/cjs/exportChannel-BsZ3fusx.js +24 -0
- package/dist/cjs/exportChannel-BsZ3fusx.js.map +1 -0
- package/dist/cjs/getAmountInSmallestCurrencyUnit.js +13 -0
- package/dist/cjs/getAmountInSmallestCurrencyUnit.js.map +1 -0
- package/dist/cjs/index-CihS_E6s.js +638 -0
- package/dist/cjs/index-CihS_E6s.js.map +1 -0
- package/dist/cjs/index.js +119 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/queryConstants-DGg4cX3r.js +29 -0
- package/dist/cjs/queryConstants-DGg4cX3r.js.map +1 -0
- package/dist/cjs/renderFunctions-CbgNQLUZ.js +56 -0
- package/dist/cjs/renderFunctions-CbgNQLUZ.js.map +1 -0
- package/dist/cjs/stripe.esm-CrNYjPcC.js +132 -0
- package/dist/cjs/stripe.esm-CrNYjPcC.js.map +1 -0
- package/dist/cjs/usePaymentApi-BR4z3fpQ.js +41 -0
- package/dist/cjs/usePaymentApi-BR4z3fpQ.js.map +1 -0
- package/dist/cjs/usePaymentApi-ojnHNkQj.js +39 -0
- package/dist/cjs/usePaymentApi-ojnHNkQj.js.map +1 -0
- package/dist/cjs/usePaymentsApi-DY7TZaXP.js +41 -0
- package/dist/cjs/usePaymentsApi-DY7TZaXP.js.map +1 -0
- package/dist/cjs/usePlatformApi-B65EA1Nh.js +84 -0
- package/dist/cjs/usePlatformApi-B65EA1Nh.js.map +1 -0
- package/dist/cjs/useRazorpayPayment.js +112 -0
- package/dist/cjs/useRazorpayPayment.js.map +1 -0
- package/dist/cjs/useStripePromise.js +57 -0
- package/dist/cjs/useStripePromise.js.map +1 -0
- package/dist/constants.js +7 -0
- package/dist/constants.js.map +1 -0
- package/dist/dashboard-C5diLksA.js +106 -0
- package/dist/dashboard-C5diLksA.js.map +1 -0
- package/dist/exportChannel-CViICC6x.js +22 -0
- package/dist/exportChannel-CViICC6x.js.map +1 -0
- package/dist/getAmountInSmallestCurrencyUnit.js +11 -0
- package/dist/getAmountInSmallestCurrencyUnit.js.map +1 -0
- package/dist/index-ojfe66jf.js +604 -0
- package/dist/index-ojfe66jf.js.map +1 -0
- package/dist/index.js +93 -0
- package/dist/index.js.map +1 -0
- package/dist/queryConstants-mgjK5Hgk.js +27 -0
- package/dist/queryConstants-mgjK5Hgk.js.map +1 -0
- package/dist/renderFunctions-ObVxaGJ7.js +52 -0
- package/dist/renderFunctions-ObVxaGJ7.js.map +1 -0
- package/dist/stripe.esm-DuZ_gsAa.js +130 -0
- package/dist/stripe.esm-DuZ_gsAa.js.map +1 -0
- package/dist/usePaymentApi-B8ZEA19B.js +37 -0
- package/dist/usePaymentApi-B8ZEA19B.js.map +1 -0
- package/dist/usePaymentApi-C0JTbQH1.js +38 -0
- package/dist/usePaymentApi-C0JTbQH1.js.map +1 -0
- package/dist/usePaymentsApi-DQz8xzHV.js +38 -0
- package/dist/usePaymentsApi-DQz8xzHV.js.map +1 -0
- package/dist/usePlatformApi-CFaJ_LxH.js +79 -0
- package/dist/usePlatformApi-CFaJ_LxH.js.map +1 -0
- package/dist/useRazorpayPayment.js +110 -0
- package/dist/useRazorpayPayment.js.map +1 -0
- package/dist/useStripePromise.js +55 -0
- package/dist/useStripePromise.js.map +1 -0
- package/package.json +7 -7
- package/types/CashPaymentButton.d.ts +17 -0
- package/types/ConfirmCashPaymentButton.d.ts +11 -0
- package/types.d.ts +1 -1
- package/types/StripeConnect.d.ts +0 -13
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var Button = require('@bigbinary/neetoui/Button');
|
|
6
|
+
var Alert = require('@bigbinary/neetoui/Alert');
|
|
7
|
+
var reactI18next = require('react-i18next');
|
|
8
|
+
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
9
|
+
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
10
|
+
var axios = require('axios');
|
|
11
|
+
var constants = require('./index-CihS_E6s.js');
|
|
12
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
13
|
+
require('i18next');
|
|
14
|
+
require('@bigbinary/neeto-commons-frontend/constants');
|
|
15
|
+
require('@bigbinary/neeto-cist');
|
|
16
|
+
require('@bigbinary/neeto-commons-frontend/utils');
|
|
17
|
+
require('ramda');
|
|
18
|
+
|
|
19
|
+
var update = function update(_ref) {
|
|
20
|
+
var id = _ref.id,
|
|
21
|
+
payload = _ref.payload;
|
|
22
|
+
return axios.put("".concat(constants.BASE_URL, "/api/v1/recurring_payments/").concat(id), {
|
|
23
|
+
recurring_payment: payload
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var recurringPaymentsApi = {
|
|
27
|
+
update: update
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var useUpdateRecurringPayments = function useUpdateRecurringPayments() {
|
|
31
|
+
var keysToInvalidate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
32
|
+
return reactUtils.useMutationWithInvalidation(recurringPaymentsApi.update, {
|
|
33
|
+
keysToInvalidate: _toConsumableArray(keysToInvalidate)
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var AdminCancelRecurringPaymentButton = function AdminCancelRecurringPaymentButton(_ref) {
|
|
38
|
+
var id = _ref.id,
|
|
39
|
+
_ref$style = _ref.style,
|
|
40
|
+
style = _ref$style === void 0 ? "primary" : _ref$style,
|
|
41
|
+
_ref$keysToInvalidate = _ref.keysToInvalidate,
|
|
42
|
+
keysToInvalidate = _ref$keysToInvalidate === void 0 ? [] : _ref$keysToInvalidate;
|
|
43
|
+
var _useState = react.useState(false),
|
|
44
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
45
|
+
isAlertOpen = _useState2[0],
|
|
46
|
+
setIsAlertOpen = _useState2[1];
|
|
47
|
+
var _useUpdateRecurringPa = useUpdateRecurringPayments(keysToInvalidate),
|
|
48
|
+
isPending = _useUpdateRecurringPa.isPending,
|
|
49
|
+
updateRecurringPayment = _useUpdateRecurringPa.mutate;
|
|
50
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
51
|
+
t = _useTranslation.t;
|
|
52
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
53
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
54
|
+
style: style,
|
|
55
|
+
label: t("neetoPayments.recurringPaymentCancel.buttonLabel"),
|
|
56
|
+
onClick: function onClick() {
|
|
57
|
+
return setIsAlertOpen(true);
|
|
58
|
+
}
|
|
59
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Alert, {
|
|
60
|
+
isOpen: isAlertOpen,
|
|
61
|
+
isSubmitting: isPending,
|
|
62
|
+
message: t("neetoPayments.recurringPaymentCancel.alertMessage"),
|
|
63
|
+
submitButtonLabel: t("neetoPayments.common.continue"),
|
|
64
|
+
title: t("neetoPayments.recurringPaymentCancel.alertTitle"),
|
|
65
|
+
onClose: function onClose() {
|
|
66
|
+
return setIsAlertOpen(false);
|
|
67
|
+
},
|
|
68
|
+
onSubmit: function onSubmit() {
|
|
69
|
+
return updateRecurringPayment({
|
|
70
|
+
id: id,
|
|
71
|
+
payload: {
|
|
72
|
+
status: "cancelled"
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
module.exports = AdminCancelRecurringPaymentButton;
|
|
81
|
+
//# sourceMappingURL=AdminCancelRecurringPaymentButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdminCancelRecurringPaymentButton.js","sources":["../../app/javascript/src/apis/recurring_payments.js","../../app/javascript/src/hooks/reactQuery/useRecurringPaymentsApi.js","../../app/javascript/src/components/AdminCancelRecurringPaymentButton/index.jsx"],"sourcesContent":["import axios from \"axios\";\n\nimport { BASE_URL } from \"src/constants\";\n\nconst update = ({ id, payload }) =>\n axios.put(`${BASE_URL}/api/v1/recurring_payments/${id}`, {\n recurring_payment: payload,\n });\n\nconst recurringPaymentsApi = { update };\n\nexport default recurringPaymentsApi;\n","import { useMutationWithInvalidation } from \"neetocommons/react-utils\";\n\nimport recurringPaymentsApi from \"apis/recurring_payments\";\n\nexport const useUpdateRecurringPayments = (keysToInvalidate = []) =>\n useMutationWithInvalidation(recurringPaymentsApi.update, {\n keysToInvalidate: [...keysToInvalidate],\n });\n","import { useState } from \"react\";\n\nimport { Button, Alert } from \"neetoui\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useUpdateRecurringPayments } from \"hooks/reactQuery/useRecurringPaymentsApi\";\n\nconst AdminCancelRecurringPaymentButton = ({\n id,\n style = \"primary\",\n keysToInvalidate = [],\n}) => {\n const [isAlertOpen, setIsAlertOpen] = useState(false);\n const { isPending, mutate: updateRecurringPayment } =\n useUpdateRecurringPayments(keysToInvalidate);\n\n const { t } = useTranslation();\n\n return (\n <>\n <Button\n {...{ style }}\n label={t(\"neetoPayments.recurringPaymentCancel.buttonLabel\")}\n onClick={() => setIsAlertOpen(true)}\n />\n <Alert\n isOpen={isAlertOpen}\n isSubmitting={isPending}\n message={t(\"neetoPayments.recurringPaymentCancel.alertMessage\")}\n submitButtonLabel={t(\"neetoPayments.common.continue\")}\n title={t(\"neetoPayments.recurringPaymentCancel.alertTitle\")}\n onClose={() => setIsAlertOpen(false)}\n onSubmit={() =>\n updateRecurringPayment({ id, payload: { status: \"cancelled\" } })\n }\n />\n </>\n );\n};\n\nexport default AdminCancelRecurringPaymentButton;\n"],"names":["update","_ref","id","payload","axios","put","concat","BASE_URL","recurring_payment","recurringPaymentsApi","useUpdateRecurringPayments","keysToInvalidate","arguments","length","undefined","useMutationWithInvalidation","_toConsumableArray","AdminCancelRecurringPaymentButton","_ref$style","style","_ref$keysToInvalidate","_useState","useState","_useState2","_slicedToArray","isAlertOpen","setIsAlertOpen","_useUpdateRecurringPa","isPending","updateRecurringPayment","mutate","_useTranslation","useTranslation","t","_jsxs","_Fragment","children","_jsx","Button","label","onClick","Alert","isOpen","isSubmitting","message","submitButtonLabel","title","onClose","onSubmit","status"],"mappings":";;;;;;;;;;;;;;;;;;AAIA,IAAMA,MAAM,GAAG,SAATA,MAAMA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAAMC,EAAE,GAAAD,IAAA,CAAFC,EAAE;IAAEC,OAAO,GAAAF,IAAA,CAAPE,OAAO;EAAA,OAC3BC,KAAK,CAACC,GAAG,CAAAC,EAAAA,CAAAA,MAAA,CAAIC,kBAAQ,EAAAD,6BAAAA,CAAAA,CAAAA,MAAA,CAA8BJ,EAAE,CAAI,EAAA;AACvDM,IAAAA,iBAAiB,EAAEL;AACrB,GAAC,CAAC;AAAA,CAAA;AAEJ,IAAMM,oBAAoB,GAAG;AAAET,EAAAA,MAAM,EAANA;AAAO,CAAC;;ACL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AACC,MAAM,EAAA;AACCnB,MAAAA,KAAK,EAALA,KAAK;AACXoB,MAAAA,KAAK,EAAEN,CAAC,CAAC,kDAAkD,CAAE;MAC7DO,OAAO,EAAE,SAATA,OAAOA,GAAA;QAAA,OAAQd,cAAc,CAAC,IAAI,CAAC;AAAA;AAAC,KACrC,CAAC,eACFW,cAAA,CAACI,KAAK,EAAA;AACJC,MAAAA,MAAM,EAAEjB,WAAY;AACpBkB,MAAAA,YAAY,EAAEf,SAAU;AACxBgB,MAAAA,OAAO,EAAEX,CAAC,CAAC,mDAAmD,CAAE;AAChEY,MAAAA,iBAAiB,EAAEZ,CAAC,CAAC,+BAA+B,CAAE;AACtDa,MAAAA,KAAK,EAAEb,CAAC,CAAC,iDAAiD,CAAE;MAC5Dc,OAAO,EAAE,SAATA,OAAOA,GAAA;QAAA,OAAQrB,cAAc,CAAC,KAAK,CAAC;OAAC;MACrCsB,QAAQ,EAAE,SAAVA,QAAQA,GAAA;AAAA,QAAA,OACNnB,sBAAsB,CAAC;AAAE3B,UAAAA,EAAE,EAAFA,EAAE;AAAEC,UAAAA,OAAO,EAAE;AAAE8C,YAAAA,MAAM,EAAE;AAAY;AAAE,SAAC,CAAC;AAAA;AACjE,KACF,CAAC;AAAA,GACF,CAAC;AAEP;;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var neetoCist = require('@bigbinary/neeto-cist');
|
|
4
|
+
var Button = require('@bigbinary/neetoui/Button');
|
|
5
|
+
var reactI18next = require('react-i18next');
|
|
6
|
+
var usePaymentApi = require('./usePaymentApi-BR4z3fpQ.js');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
require('@babel/runtime/helpers/defineProperty');
|
|
9
|
+
require('@tanstack/react-query');
|
|
10
|
+
require('axios');
|
|
11
|
+
require('./index-CihS_E6s.js');
|
|
12
|
+
require('i18next');
|
|
13
|
+
require('@bigbinary/neeto-commons-frontend/constants');
|
|
14
|
+
require('@bigbinary/neeto-commons-frontend/utils');
|
|
15
|
+
require('ramda');
|
|
16
|
+
|
|
17
|
+
var CashPaymentButton = function CashPaymentButton(_ref) {
|
|
18
|
+
var label = _ref.label,
|
|
19
|
+
payableId = _ref.payableId,
|
|
20
|
+
payableType = _ref.payableType,
|
|
21
|
+
discountCode = _ref.discountCode,
|
|
22
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
23
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
24
|
+
_ref$isLoading = _ref.isLoading,
|
|
25
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
26
|
+
_ref$onBeforePayment = _ref.onBeforePayment,
|
|
27
|
+
onBeforePayment = _ref$onBeforePayment === void 0 ? neetoCist.noop : _ref$onBeforePayment,
|
|
28
|
+
_ref$onFailedPayment = _ref.onFailedPayment,
|
|
29
|
+
onFailedPayment = _ref$onFailedPayment === void 0 ? neetoCist.noop : _ref$onFailedPayment,
|
|
30
|
+
_ref$onSuccessfulPaym = _ref.onSuccessfulPayment,
|
|
31
|
+
onSuccessfulPayment = _ref$onSuccessfulPaym === void 0 ? neetoCist.noop : _ref$onSuccessfulPaym;
|
|
32
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
33
|
+
t = _useTranslation.t;
|
|
34
|
+
var _useCreateCashPayment = usePaymentApi.useCreateCashPayment({
|
|
35
|
+
onSuccess: onSuccessfulPayment,
|
|
36
|
+
onError: onFailedPayment
|
|
37
|
+
}),
|
|
38
|
+
isPending = _useCreateCashPayment.isPending,
|
|
39
|
+
createCashPayment = _useCreateCashPayment.mutate;
|
|
40
|
+
var handleSubmit = function handleSubmit() {
|
|
41
|
+
onBeforePayment();
|
|
42
|
+
createCashPayment({
|
|
43
|
+
payableId: payableId,
|
|
44
|
+
payableType: payableType,
|
|
45
|
+
discountCode: discountCode
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
return /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
49
|
+
disabled: isPending || isDisabled,
|
|
50
|
+
label: label || t("neetoPayments.common.proceed"),
|
|
51
|
+
loading: isPending || isLoading,
|
|
52
|
+
onClick: handleSubmit
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
module.exports = CashPaymentButton;
|
|
57
|
+
//# sourceMappingURL=CashPaymentButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CashPaymentButton.js","sources":["../../app/javascript/src/components/CashPaymentButton.jsx"],"sourcesContent":["import { noop } from \"neetocist\";\nimport { Button } from \"neetoui\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useCreateCashPayment } from \"hooks/reactQuery/cash/usePaymentApi\";\n\nconst CashPaymentButton = ({\n label,\n payableId,\n payableType,\n discountCode,\n isDisabled = false,\n isLoading = false,\n onBeforePayment = noop,\n onFailedPayment = noop,\n onSuccessfulPayment = noop,\n}) => {\n const { t } = useTranslation();\n\n const { isPending, mutate: createCashPayment } = useCreateCashPayment({\n onSuccess: onSuccessfulPayment,\n onError: onFailedPayment,\n });\n\n const handleSubmit = () => {\n onBeforePayment();\n createCashPayment({ payableId, payableType, discountCode });\n };\n\n return (\n <Button\n disabled={isPending || isDisabled}\n label={label || t(\"neetoPayments.common.proceed\")}\n loading={isPending || isLoading}\n onClick={handleSubmit}\n />\n );\n};\n\nexport default CashPaymentButton;\n"],"names":["CashPaymentButton","_ref","label","payableId","payableType","discountCode","_ref$isDisabled","isDisabled","_ref$isLoading","isLoading","_ref$onBeforePayment","onBeforePayment","noop","_ref$onFailedPayment","onFailedPayment","_ref$onSuccessfulPaym","onSuccessfulPayment","_useTranslation","useTranslation","t","_useCreateCashPayment","useCreateCashPayment","onSuccess","onError","isPending","createCashPayment","mutate","handleSubmit","_jsx","Button","disabled","loading","onClick"],"mappings":";;;;;;;;;;;;;;;;AAMA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAU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AA,WAAW,EAAXA,WAAW;AAAEC,MAAAA,YAAY,EAAZA;AAAa,KAAC,CAAC;GAC5D;EAED,oBACEuB,cAAA,CAACC,MAAM,EAAA;IACLC,QAAQ,EAAEN,SAAS,IAAIjB,UAAW;AAClCL,IAAAA,KAAK,EAAEA,KAAK,IAAIiB,CAAC,CAAC,8BAA8B,CAAE;IAClDY,OAAO,EAAEP,SAAS,IAAIf,SAAU;AAChCuB,IAAAA,OAAO,EAAEL;AAAa,GACvB,CAAC;AAEN;;;;"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var neetoCist = require('@bigbinary/neeto-cist');
|
|
6
|
+
var Button = require('@bigbinary/neetoui/Button');
|
|
7
|
+
var Modal = require('@bigbinary/neetoui/Modal');
|
|
8
|
+
var Typography = require('@bigbinary/neetoui/Typography');
|
|
9
|
+
var Form = require('@bigbinary/neetoui/formik/Form');
|
|
10
|
+
var Textarea = require('@bigbinary/neetoui/formik/Textarea');
|
|
11
|
+
var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
|
|
12
|
+
var reactI18next = require('react-i18next');
|
|
13
|
+
var usePaymentApi = require('./usePaymentApi-BR4z3fpQ.js');
|
|
14
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
15
|
+
require('@babel/runtime/helpers/defineProperty');
|
|
16
|
+
require('@tanstack/react-query');
|
|
17
|
+
require('axios');
|
|
18
|
+
require('./index-CihS_E6s.js');
|
|
19
|
+
require('i18next');
|
|
20
|
+
require('@bigbinary/neeto-commons-frontend/constants');
|
|
21
|
+
require('@bigbinary/neeto-commons-frontend/utils');
|
|
22
|
+
require('ramda');
|
|
23
|
+
|
|
24
|
+
var ConfirmCashPaymentButton = function ConfirmCashPaymentButton(_ref) {
|
|
25
|
+
var paymentId = _ref.paymentId,
|
|
26
|
+
payableId = _ref.payableId,
|
|
27
|
+
_ref$onSuccess = _ref.onSuccess,
|
|
28
|
+
onSuccess = _ref$onSuccess === void 0 ? neetoCist.noop : _ref$onSuccess;
|
|
29
|
+
var _useState = react.useState(false),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
isModalOpen = _useState2[0],
|
|
32
|
+
setIsModalOpen = _useState2[1];
|
|
33
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
34
|
+
t = _useTranslation.t;
|
|
35
|
+
var _useUpdateCashPayment = usePaymentApi.useUpdateCashPayment(paymentId, {
|
|
36
|
+
onSuccess: onSuccess
|
|
37
|
+
}),
|
|
38
|
+
updateUpiPayment = _useUpdateCashPayment.mutate,
|
|
39
|
+
isPending = _useUpdateCashPayment.isPending;
|
|
40
|
+
var onClose = function onClose() {
|
|
41
|
+
return setIsModalOpen(false);
|
|
42
|
+
};
|
|
43
|
+
var handleSubmit = function handleSubmit(_ref2) {
|
|
44
|
+
var notes = _ref2.notes;
|
|
45
|
+
var payload = {
|
|
46
|
+
notes: notes,
|
|
47
|
+
payableId: payableId,
|
|
48
|
+
status: "successful"
|
|
49
|
+
};
|
|
50
|
+
updateUpiPayment(payload);
|
|
51
|
+
};
|
|
52
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
53
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
54
|
+
label: t("neetoPayments.common.confirmPayment"),
|
|
55
|
+
loading: isPending,
|
|
56
|
+
size: "small",
|
|
57
|
+
onClick: function onClick() {
|
|
58
|
+
return setIsModalOpen(true);
|
|
59
|
+
}
|
|
60
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(Modal, {
|
|
61
|
+
onClose: onClose,
|
|
62
|
+
isOpen: isModalOpen,
|
|
63
|
+
size: "large",
|
|
64
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Modal.Header, {
|
|
65
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
66
|
+
style: "h2",
|
|
67
|
+
children: t("neetoPayments.cash.confirmModal.title")
|
|
68
|
+
})
|
|
69
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Form, {
|
|
70
|
+
formikProps: {
|
|
71
|
+
initialValues: {
|
|
72
|
+
notes: ""
|
|
73
|
+
},
|
|
74
|
+
enableReinitialize: true,
|
|
75
|
+
onSubmit: handleSubmit
|
|
76
|
+
},
|
|
77
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
78
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Modal.Body, {
|
|
79
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Textarea, {
|
|
80
|
+
"data-cy": "confirm-booking-modal-input-textfield",
|
|
81
|
+
label: t("neetoPayments.cash.confirmModal.notes"),
|
|
82
|
+
name: "notes",
|
|
83
|
+
placeholder: t("neetoPayments.cash.confirmModal.notesPlaceholder")
|
|
84
|
+
})
|
|
85
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Modal.Footer, {
|
|
86
|
+
className: "space-x-2",
|
|
87
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ActionBlock, {
|
|
88
|
+
isSubmitting: isPending,
|
|
89
|
+
position: "right",
|
|
90
|
+
cancelButtonProps: {
|
|
91
|
+
onClick: onClose,
|
|
92
|
+
style: "tertiary"
|
|
93
|
+
},
|
|
94
|
+
submitButtonProps: {
|
|
95
|
+
label: t("neetoPayments.common.confirm")
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
})]
|
|
99
|
+
})
|
|
100
|
+
})]
|
|
101
|
+
})]
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
module.exports = ConfirmCashPaymentButton;
|
|
106
|
+
//# sourceMappingURL=ConfirmCashPaymentButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmCashPaymentButton.js","sources":["../../app/javascript/src/components/ConfirmCashPaymentButton.jsx"],"sourcesContent":["import { useState } from \"react\";\n\nimport { noop } from \"neetocist\";\nimport { Button, Modal, Typography } from \"neetoui\";\nimport { Form, Textarea, ActionBlock } from \"neetoui/formik\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useUpdateCashPayment } from \"hooks/reactQuery/cash/usePaymentApi\";\n\nconst ConfirmCashPaymentButton = ({\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 } = useUpdateCashPayment(\n paymentId,\n { onSuccess }\n );\n\n const onClose = () => setIsModalOpen(false);\n\n const handleSubmit = ({ notes }) => {\n const payload = { notes, payableId, status: \"successful\" };\n updateUpiPayment(payload);\n };\n\n return (\n <>\n <Button\n label={t(\"neetoPayments.common.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.cash.confirmModal.title\")}\n </Typography>\n </Modal.Header>\n <Form\n formikProps={{\n initialValues: { notes: \"\" },\n enableReinitialize: true,\n onSubmit: handleSubmit,\n }}\n >\n <>\n <Modal.Body>\n <Textarea\n data-cy=\"confirm-booking-modal-input-textfield\"\n label={t(\"neetoPayments.cash.confirmModal.notes\")}\n name=\"notes\"\n placeholder={t(\n \"neetoPayments.cash.confirmModal.notesPlaceholder\"\n )}\n />\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 </Form>\n </Modal>\n </>\n );\n};\n\nexport default ConfirmCashPaymentButton;\n"],"names":["ConfirmCashPaymentButton","_ref","paymentId","payableId","_ref$onSuccess","onSuccess","noop","_useState","useState","_useState2","_slicedToArray","isModalOpen","setIsModalOpen","_useTranslation","useTranslation","t","_useUpdateCashPayment","useUpdateCashPayment","updateUpiPayment","mutate","isPending","onClose","handleSubmit","_ref2","notes","payload","status","_jsxs","_Fragment","children","_jsx","Button","label","loading","size","onClick","Modal","isOpen","Header","Typography","style","Form","formikProps","initialValues","enableReinitialize","onSubmit","Body","Textarea","name","placeholder","Footer","className","ActionBlock","isSubmitting","position","cancelButtonProps","submitButtonProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AASA,IAAMA,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAAC,IAAA,EAIxB;AAAA,EAAA,IAHJC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,SAAS,GAAAF,IAAA,CAATE,SAAS;IAAAC,cAAA,GAAAH,IAAA,CACTI,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;IAAtBC,CAAC,GAAAF,eAAA,CAADE,CAAC;AAET,EAAA,IAAAC,qBAAA,GAAgDC,kCAAoB,CAClEf,SAAS,EACT;AAAEG,MAAAA,SAAS,EAATA;AAAU,KACd,CAAC;IAHea,gBAAgB,GAAAF,qBAAA,CAAxBG,MAAM;IAAoBC,SAAS,GAAAJ,qBAAA,CAATI,SAAS;AAK3C,EAAA,IAAMC,OAAO,GAAG,SAAVA,OAAOA,GAAA;IAAA,OAAST,cAAc,CAAC,KAAK,CAAC;AAAA,GAAA;AAE3C,EAAA,IAAMU,YAAY,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eACTC,cAAA,CAACiB,QAAQ,EAAA;AACP,cAAA,SAAA,EAAQ,uCAAuC;AAC/Cf,cAAAA,KAAK,EAAEjB,CAAC,CAAC,uCAAuC,CAAE;AAClDiC,cAAAA,IAAI,EAAC,OAAO;cACZC,WAAW,EAAElC,CAAC,CACZ,kDACF;aACD;AAAC,WACQ,CAAC,eACbe,cAAA,CAACM,KAAK,CAACc,MAAM,EAAA;AAACC,YAAAA,SAAS,EAAC,WAAW;YAAAtB,QAAA,eACjCC,cAAA,CAACsB,WAAW,EAAA;AACVC,cAAAA,YAAY,EAAEjC,SAAU;AACxBkC,cAAAA,QAAQ,EAAC,OAAO;AAChBC,cAAAA,iBAAiB,EAAE;AACjBpB,gBAAAA,OAAO,EAAEd,OAAO;AAChBmB,gBAAAA,KAAK,EAAE;eACP;AACFgB,cAAAA,iBAAiB,EAAE;gBACjBxB,KAAK,EAAEjB,CAAC,CAAC,8BAA8B;AACzC;aACD;AAAC,WACU,CAAC;SACf;AAAC,OACC,CAAC;AAAA,KACF,CAAC;AAAA,GACR,CAAC;AAEP;;;;"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var neetoCist = require('@bigbinary/neeto-cist');
|
|
6
|
+
var Button = require('@bigbinary/neetoui/Button');
|
|
7
|
+
var Modal = require('@bigbinary/neetoui/Modal');
|
|
8
|
+
var Typography = require('@bigbinary/neetoui/Typography');
|
|
9
|
+
var Form = require('@bigbinary/neetoui/formik/Form');
|
|
10
|
+
var Textarea = require('@bigbinary/neetoui/formik/Textarea');
|
|
11
|
+
var Select = require('@bigbinary/neetoui/formik/Select');
|
|
12
|
+
var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
|
|
13
|
+
var ramda = require('ramda');
|
|
14
|
+
var reactI18next = require('react-i18next');
|
|
15
|
+
var usePaymentsApi = require('./usePaymentsApi-DY7TZaXP.js');
|
|
16
|
+
var i18next = require('i18next');
|
|
17
|
+
var yup = require('yup');
|
|
18
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
19
|
+
require('@babel/runtime/helpers/defineProperty');
|
|
20
|
+
require('@tanstack/react-query');
|
|
21
|
+
require('axios');
|
|
22
|
+
require('./index-CihS_E6s.js');
|
|
23
|
+
require('@bigbinary/neeto-commons-frontend/constants');
|
|
24
|
+
require('@bigbinary/neeto-commons-frontend/utils');
|
|
25
|
+
|
|
26
|
+
function _interopNamespaceDefault(e) {
|
|
27
|
+
var n = Object.create(null);
|
|
28
|
+
if (e) {
|
|
29
|
+
Object.keys(e).forEach(function (k) {
|
|
30
|
+
if (k !== 'default') {
|
|
31
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
32
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () { return e[k]; }
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
n.default = e;
|
|
40
|
+
return Object.freeze(n);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var yup__namespace = /*#__PURE__*/_interopNamespaceDefault(yup);
|
|
44
|
+
|
|
45
|
+
var INITIAL_VALUE = {
|
|
46
|
+
vpaId: "",
|
|
47
|
+
notes: ""
|
|
48
|
+
};
|
|
49
|
+
var VALIDATION_SCHEMA = yup__namespace.object({
|
|
50
|
+
vpaId: yup__namespace.string().required(i18next.t("neetoPayments.upi.confirmModal.vpasIdRequired"))
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
var ConfirmUpiPaymentButton = function ConfirmUpiPaymentButton(_ref) {
|
|
54
|
+
var vpas = _ref.vpas,
|
|
55
|
+
identifier = _ref.identifier,
|
|
56
|
+
paymentId = _ref.paymentId,
|
|
57
|
+
payableId = _ref.payableId,
|
|
58
|
+
_ref$onSuccess = _ref.onSuccess,
|
|
59
|
+
onSuccess = _ref$onSuccess === void 0 ? neetoCist.noop : _ref$onSuccess;
|
|
60
|
+
var _useState = react.useState(false),
|
|
61
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
+
isModalOpen = _useState2[0],
|
|
63
|
+
setIsModalOpen = _useState2[1];
|
|
64
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
65
|
+
t = _useTranslation.t;
|
|
66
|
+
var _useUpdateUpiPayment = usePaymentsApi.useUpdateUpiPayment(paymentId, {
|
|
67
|
+
onSuccess: onSuccess
|
|
68
|
+
}),
|
|
69
|
+
updateUpiPayment = _useUpdateUpiPayment.mutate,
|
|
70
|
+
isPending = _useUpdateUpiPayment.isPending;
|
|
71
|
+
var initialValues = vpas.length === 1 ? ramda.mergeLeft({
|
|
72
|
+
vpaId: vpas[0].id
|
|
73
|
+
}, INITIAL_VALUE) : INITIAL_VALUE;
|
|
74
|
+
var onClose = function onClose() {
|
|
75
|
+
return setIsModalOpen(false);
|
|
76
|
+
};
|
|
77
|
+
var handleSubmit = function handleSubmit(_ref2) {
|
|
78
|
+
var vpaId = _ref2.vpaId,
|
|
79
|
+
notes = _ref2.notes;
|
|
80
|
+
var vpa = neetoCist.findBy({
|
|
81
|
+
id: vpaId
|
|
82
|
+
}, vpas);
|
|
83
|
+
var payload = {
|
|
84
|
+
notes: notes,
|
|
85
|
+
vpaId: vpaId,
|
|
86
|
+
payableId: payableId,
|
|
87
|
+
upiId: vpa.upiId,
|
|
88
|
+
status: "successful"
|
|
89
|
+
};
|
|
90
|
+
updateUpiPayment(payload);
|
|
91
|
+
};
|
|
92
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
93
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
94
|
+
label: t("neetoPayments.upi.payment.buttons.confirmPayment"),
|
|
95
|
+
loading: isPending,
|
|
96
|
+
size: "small",
|
|
97
|
+
onClick: function onClick() {
|
|
98
|
+
return setIsModalOpen(true);
|
|
99
|
+
}
|
|
100
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(Modal, {
|
|
101
|
+
onClose: onClose,
|
|
102
|
+
isOpen: isModalOpen,
|
|
103
|
+
size: "large",
|
|
104
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Modal.Header, {
|
|
105
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
106
|
+
style: "h2",
|
|
107
|
+
children: t("neetoPayments.upi.confirmModal.title")
|
|
108
|
+
})
|
|
109
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Form, {
|
|
110
|
+
formikProps: {
|
|
111
|
+
initialValues: initialValues,
|
|
112
|
+
enableReinitialize: true,
|
|
113
|
+
onSubmit: handleSubmit,
|
|
114
|
+
validationSchema: VALIDATION_SCHEMA
|
|
115
|
+
},
|
|
116
|
+
children: function children(_ref3) {
|
|
117
|
+
var setFieldValue = _ref3.setFieldValue;
|
|
118
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
119
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Modal.Body, {
|
|
120
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
121
|
+
className: "flex flex-col space-y-4",
|
|
122
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
123
|
+
lineHeight: "normal",
|
|
124
|
+
style: "body2",
|
|
125
|
+
children: t("neetoPayments.upi.confirmModal.upiTransactionId", {
|
|
126
|
+
identifier: identifier
|
|
127
|
+
})
|
|
128
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Select, {
|
|
129
|
+
label: t("neetoPayments.upi.confirmModal.accountIdLabel"),
|
|
130
|
+
name: "vpaId",
|
|
131
|
+
options: vpas === null || vpas === void 0 ? void 0 : vpas.map(function (_ref4) {
|
|
132
|
+
var address = _ref4.address,
|
|
133
|
+
id = _ref4.id;
|
|
134
|
+
return {
|
|
135
|
+
label: address,
|
|
136
|
+
value: id
|
|
137
|
+
};
|
|
138
|
+
}),
|
|
139
|
+
onChange: function onChange(_ref5) {
|
|
140
|
+
var value = _ref5.value;
|
|
141
|
+
return setFieldValue("vpaId", value);
|
|
142
|
+
}
|
|
143
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Textarea, {
|
|
144
|
+
"data-cy": "confirm-booking-modal-input-textfield",
|
|
145
|
+
label: t("neetoPayments.upi.confirmModal.notes"),
|
|
146
|
+
name: "notes",
|
|
147
|
+
placeholder: t("neetoPayments.upi.confirmModal.notesPlaceholder")
|
|
148
|
+
})]
|
|
149
|
+
})
|
|
150
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Modal.Footer, {
|
|
151
|
+
className: "space-x-2",
|
|
152
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ActionBlock, {
|
|
153
|
+
isSubmitting: isPending,
|
|
154
|
+
position: "right",
|
|
155
|
+
cancelButtonProps: {
|
|
156
|
+
onClick: onClose,
|
|
157
|
+
style: "tertiary"
|
|
158
|
+
},
|
|
159
|
+
submitButtonProps: {
|
|
160
|
+
label: t("neetoPayments.common.confirm")
|
|
161
|
+
}
|
|
162
|
+
})
|
|
163
|
+
})]
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
})]
|
|
167
|
+
})]
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
module.exports = ConfirmUpiPaymentButton;
|
|
172
|
+
//# sourceMappingURL=ConfirmUpiPaymentButton.js.map
|
|
@@ -0,0 +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 { 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,EAAA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E,KAAA,CAALF,KAAK;AAAA,oBAAA,OAAOV,aAAa,CAAC,OAAO,EAAEU,KAAK,CAAC;AAAA;AAAC,iBACxD,CAAC,eACF3B,cAAA,CAAC8B,QAAQ,EAAA;AACP,kBAAA,SAAA,EAAQ,uCAAuC;AAC/C5B,kBAAAA,KAAK,EAAExC,CAAC,CAAC,sCAAsC,CAAE;AACjD4D,kBAAAA,IAAI,EAAC,OAAO;kBACZS,WAAW,EAAErE,CAAC,CACZ,iDACF;AAAE,iBACH,CAAC;eACC;AAAC,aACI,CAAC,eACbsC,cAAA,CAACM,KAAK,CAAC0B,MAAM,EAAA;AAACb,cAAAA,SAAS,EAAC,WAAW;cAAApB,QAAA,eACjCC,cAAA,CAACiC,WAAW,EAAA;AACVC,gBAAAA,YAAY,EAAElD,SAAU;AACxBmD,gBAAAA,QAAQ,EAAC,OAAO;AAChBC,gBAAAA,iBAAiB,EAAE;AACjB/B,kBAAAA,OAAO,EAAEhB,OAAO;AAChBqB,kBAAAA,KAAK,EAAE;iBACP;AACF2B,gBAAAA,iBAAiB,EAAE;kBACjBnC,KAAK,EAAExC,CAAC,CAAC,8BAA8B;AACzC;eACD;AAAC,aACU,CAAC;AAAA,WACf,CAAC;AAAA;AACJ,OACG,CAAC;AAAA,KACF,CAAC;AAAA,GACR,CAAC;AAEP;;;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var neetoCist = require('@bigbinary/neeto-cist');
|
|
4
|
+
var CopyToClipboardButton = require('@bigbinary/neeto-molecules/CopyToClipboardButton');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
8
|
+
|
|
9
|
+
var css = ".ant-table-cell-row-hover .identifier-copy-button{visibility:visible!important}";
|
|
10
|
+
n(css,{});
|
|
11
|
+
|
|
12
|
+
var CopyButtonWrapper = function CopyButtonWrapper(_ref) {
|
|
13
|
+
var content = _ref.content,
|
|
14
|
+
children = _ref.children;
|
|
15
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
16
|
+
className: "flex items-center space-x-2",
|
|
17
|
+
children: [children, neetoCist.isPresent(content) && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
18
|
+
className: "identifier-copy-button invisible",
|
|
19
|
+
children: /*#__PURE__*/jsxRuntime.jsx(CopyToClipboardButton, {
|
|
20
|
+
size: "small",
|
|
21
|
+
style: "text",
|
|
22
|
+
value: content
|
|
23
|
+
})
|
|
24
|
+
})]
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.CopyButtonWrapper = CopyButtonWrapper;
|
|
29
|
+
exports.n = n;
|
|
30
|
+
//# sourceMappingURL=CopyButtonWrapper-Ds1k64E0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyButtonWrapper-Ds1k64E0.js","sources":["../../node_modules/rollup-plugin-styles/dist/runtime/inject-css.js","../../app/javascript/src/components/Common/CopyButtonWrapper.jsx"],"sourcesContent":["var e=[],t=[];function n(n,r){if(n&&\"undefined\"!=typeof document){var a,s=!0===r.prepend?\"prepend\":\"append\",d=!0===r.singleTag,i=\"string\"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName(\"head\")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c()}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n))}function c(){var e=document.createElement(\"style\");if(e.setAttribute(\"type\",\"text/css\"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a=\"prepend\"===s?\"afterbegin\":\"beforeend\";return i.insertAdjacentElement(a,e),e}}export{n as default};\n","import { isPresent } from \"neetocist\";\nimport CopyToClipboardButton from \"neetomolecules/CopyToClipboardButton\";\n\n// eslint-disable-next-line import/extensions\nimport \"stylesheets/components/_copy-button.scss\";\n\nconst CopyButtonWrapper = ({ content, children }) => (\n <div className=\"flex items-center space-x-2\">\n {children}\n {isPresent(content) && (\n <div className=\"identifier-copy-button invisible\">\n <CopyToClipboardButton size=\"small\" style=\"text\" value={content} />\n </div>\n )}\n </div>\n);\n\nexport default CopyButtonWrapper;\n"],"names":["CopyButtonWrapper","_ref","content","children","_jsxs","className","isPresent","_jsx","CopyToClipboardButton","size","style","value"],"mappings":";;;;;;AAAA,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,OAAO,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,oBAAo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CAAC,SAAS,GAAG,CAAC,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;ACMruB,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAAMC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;AAAA,EAAA,oBAC5CC,eAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,6BAA6B;IAAAF,QAAA,EAAA,CACzCA,QAAQ,EACRG,mBAAS,CAACJ,OAAO,CAAC,iBACjBK,cAAA,CAAA,KAAA,EAAA;AAAKF,MAAAA,SAAS,EAAC,kCAAkC;MAAAF,QAAA,eAC/CI,cAAA,CAACC,qBAAqB,EAAA;AAACC,QAAAA,IAAI,EAAC,OAAO;AAACC,QAAAA,KAAK,EAAC,MAAM;AAACC,QAAAA,KAAK,EAAET;OAAU;AAAC,KAChE,CACN;AAAA,GACE,CAAC;AAAA;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Typography = require('@bigbinary/neetoui/Typography');
|
|
4
|
+
var Spinner = require('@bigbinary/neetoui/Spinner');
|
|
5
|
+
var Form = require('@bigbinary/neetoui/formik/Form');
|
|
6
|
+
var Textarea = require('@bigbinary/neetoui/formik/Textarea');
|
|
7
|
+
var Button = require('@bigbinary/neetoui/formik/Button');
|
|
8
|
+
var reactI18next = require('react-i18next');
|
|
9
|
+
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
10
|
+
var axios = require('axios');
|
|
11
|
+
var constants = require('./index-CihS_E6s.js');
|
|
12
|
+
var reactQuery = require('@tanstack/react-query');
|
|
13
|
+
var ramda = require('ramda');
|
|
14
|
+
var queryConstants = require('./queryConstants-DGg4cX3r.js');
|
|
15
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
16
|
+
require('i18next');
|
|
17
|
+
require('@bigbinary/neeto-commons-frontend/constants');
|
|
18
|
+
require('@bigbinary/neeto-cist');
|
|
19
|
+
require('@bigbinary/neeto-commons-frontend/utils');
|
|
20
|
+
|
|
21
|
+
var show = function show(payableId) {
|
|
22
|
+
return axios.get("".concat(constants.BASE_URL, "/api/v1/public/recurring_payments/").concat(payableId));
|
|
23
|
+
};
|
|
24
|
+
var update = function update(_ref) {
|
|
25
|
+
var payableId = _ref.payableId,
|
|
26
|
+
payload = _ref.payload;
|
|
27
|
+
return axios.put("".concat(constants.BASE_URL, "/api/v1/public/recurring_payments/").concat(payableId), {
|
|
28
|
+
recurring_payment: payload
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
var recurringPaymentsApi = {
|
|
32
|
+
show: show,
|
|
33
|
+
update: update
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
var useFetchRecurringPayment = function useFetchRecurringPayment(payableId) {
|
|
37
|
+
return reactQuery.useQuery({
|
|
38
|
+
queryKey: [queryConstants.QUERY_KEYS.RECURRING_PAYMENT, payableId],
|
|
39
|
+
queryFn: function queryFn() {
|
|
40
|
+
return recurringPaymentsApi.show(payableId);
|
|
41
|
+
},
|
|
42
|
+
enabled: ramda.isNotNil(payableId)
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var useUpdateRecurringPayments = function useUpdateRecurringPayments(payableId) {
|
|
46
|
+
return reactUtils.useMutationWithInvalidation(recurringPaymentsApi.update, {
|
|
47
|
+
keysToInvalidate: [queryConstants.QUERY_KEYS.RECURRING_PAYMENT, payableId]
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
var CustomerCancelRecurringPaymentForm = function CustomerCancelRecurringPaymentForm(_ref) {
|
|
52
|
+
var payableId = _ref.payableId;
|
|
53
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
54
|
+
t = _useTranslation.t;
|
|
55
|
+
var _useFetchRecurringPay = useFetchRecurringPayment(payableId),
|
|
56
|
+
isLoading = _useFetchRecurringPay.isLoading,
|
|
57
|
+
_useFetchRecurringPay2 = _useFetchRecurringPay.data,
|
|
58
|
+
_useFetchRecurringPay3 = _useFetchRecurringPay2 === void 0 ? {} : _useFetchRecurringPay2,
|
|
59
|
+
recurringPayment = _useFetchRecurringPay3.recurringPayment;
|
|
60
|
+
var _useUpdateRecurringPa = useUpdateRecurringPayments(payableId),
|
|
61
|
+
isPending = _useUpdateRecurringPa.isPending,
|
|
62
|
+
updateRecurringPayment = _useUpdateRecurringPa.mutate;
|
|
63
|
+
if (isLoading) {
|
|
64
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
65
|
+
className: "flex h-full w-full items-center justify-center",
|
|
66
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Spinner, {})
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
if ((recurringPayment === null || recurringPayment === void 0 ? void 0 : recurringPayment.status) === "cancelled") {
|
|
70
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
71
|
+
className: "flex h-full w-full items-center justify-center",
|
|
72
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
73
|
+
children: t("neetoPayments.recurringPaymentCancel.message")
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
78
|
+
className: "flex h-full w-full items-center justify-center",
|
|
79
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(Form, {
|
|
80
|
+
className: "space-y-6",
|
|
81
|
+
formikProps: {
|
|
82
|
+
onSubmit: function onSubmit(_ref2) {
|
|
83
|
+
var cancelReason = _ref2.cancelReason;
|
|
84
|
+
return updateRecurringPayment({
|
|
85
|
+
payableId: payableId,
|
|
86
|
+
payload: {
|
|
87
|
+
status: "cancelled",
|
|
88
|
+
cancelReason: cancelReason
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
initialValues: {
|
|
93
|
+
cancelReason: ""
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Textarea, {
|
|
97
|
+
"data-cy": "cancel-meeting-input-textfield",
|
|
98
|
+
label: t("neetoPayments.recurringPaymentCancel.reasonLabel"),
|
|
99
|
+
name: "cancelReason",
|
|
100
|
+
placeholder: t("neetoPayments.recurringPaymentCancel.reasonPlaceholder")
|
|
101
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
102
|
+
"data-cy": "cancel-meeting-submit-button",
|
|
103
|
+
disabled: isPending,
|
|
104
|
+
label: t("neetoPayments.recurringPaymentCancel.buttonLabel"),
|
|
105
|
+
loading: isPending,
|
|
106
|
+
style: "danger"
|
|
107
|
+
})]
|
|
108
|
+
})
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
module.exports = CustomerCancelRecurringPaymentForm;
|
|
113
|
+
//# sourceMappingURL=CustomerCancelRecurringPaymentForm.js.map
|