@bigbinary/neeto-payments-frontend 3.0.21 → 3.0.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.
Files changed (121) hide show
  1. package/app/javascript/src/translations/en.json +2 -2
  2. package/dist/AccountsDashboard.js +8 -6
  3. package/dist/AccountsDashboard.js.map +1 -1
  4. package/dist/{ExportModal-CYHlSNLI.js → ExportModal-C6-IwFlZ.js} +4 -2
  5. package/dist/ExportModal-C6-IwFlZ.js.map +1 -0
  6. package/dist/PaymentsDashboard.js +2 -2
  7. package/dist/PayoutsDashboard.js +6 -6
  8. package/dist/PayoutsPage.js +16 -51
  9. package/dist/PayoutsPage.js.map +1 -1
  10. package/dist/RazorpayPaymentButton.js +2 -3
  11. package/dist/RazorpayPaymentButton.js.map +1 -1
  12. package/dist/RefundsDashboard.js +2 -2
  13. package/dist/SplitTransfersDashboard.js +3 -3
  14. package/dist/SplitTransfersDashboard.js.map +1 -1
  15. package/dist/StripeConnect.js +2 -2
  16. package/dist/UpiMarkAsPaidButton.js +2 -2
  17. package/dist/UpiPayment.js +2 -2
  18. package/dist/buildStripeTransactionLink.js +1 -1
  19. package/dist/cjs/AccountsDashboard.js +13 -11
  20. package/dist/cjs/AccountsDashboard.js.map +1 -1
  21. package/dist/cjs/{ExportModal-DNZkMM58.js → ExportModal-DaLww9x0.js} +4 -2
  22. package/dist/cjs/ExportModal-DaLww9x0.js.map +1 -0
  23. package/dist/cjs/PaymentsDashboard.js +2 -2
  24. package/dist/cjs/PayoutsDashboard.js +11 -11
  25. package/dist/cjs/PayoutsDashboard.js.map +1 -1
  26. package/dist/cjs/PayoutsPage.js +16 -51
  27. package/dist/cjs/PayoutsPage.js.map +1 -1
  28. package/dist/cjs/RazorpayPaymentButton.js +2 -3
  29. package/dist/cjs/RazorpayPaymentButton.js.map +1 -1
  30. package/dist/cjs/RefundsDashboard.js +2 -2
  31. package/dist/cjs/SplitTransfersDashboard.js +3 -3
  32. package/dist/cjs/SplitTransfersDashboard.js.map +1 -1
  33. package/dist/cjs/StripeConnect.js +2 -2
  34. package/dist/cjs/UpiMarkAsPaidButton.js +2 -2
  35. package/dist/cjs/UpiPayment.js +2 -2
  36. package/dist/cjs/buildStripeTransactionLink.js +1 -1
  37. package/dist/cjs/constants.js +1 -1
  38. package/dist/cjs/{renderFunctions-PCwwCeDH.js → dashboard-BAIM4ZLC.js} +19 -60
  39. package/dist/cjs/dashboard-BAIM4ZLC.js.map +1 -0
  40. package/dist/cjs/{index-zFKnsfIq.js → index-Br_ibfWm.js} +1 -17
  41. package/dist/cjs/index-Br_ibfWm.js.map +1 -0
  42. package/dist/cjs/index.js +15 -27
  43. package/dist/cjs/index.js.map +1 -1
  44. package/dist/cjs/renderFunctions-DW0frqfV.js +66 -0
  45. package/dist/cjs/renderFunctions-DW0frqfV.js.map +1 -0
  46. package/dist/cjs/{useConnectApi-DK-vd1fm.js → useConnectApi-C3EpIQ0I.js} +6 -46
  47. package/dist/cjs/useConnectApi-C3EpIQ0I.js.map +1 -0
  48. package/dist/cjs/{usePaymentApi-CrN9sk9a.js → usePaymentApi-lZYye4u0.js} +3 -17
  49. package/dist/cjs/usePaymentApi-lZYye4u0.js.map +1 -0
  50. package/dist/cjs/{usePaymentsApi-QmSQQ00p.js → usePaymentsApi-CDy4nTGr.js} +2 -2
  51. package/dist/cjs/{usePaymentsApi-QmSQQ00p.js.map → usePaymentsApi-CDy4nTGr.js.map} +1 -1
  52. package/dist/cjs/usePlatformApi-BajSo0Hl.js +46 -0
  53. package/dist/cjs/usePlatformApi-BajSo0Hl.js.map +1 -0
  54. package/dist/cjs/useRazorpayPayment.js +2 -3
  55. package/dist/cjs/useRazorpayPayment.js.map +1 -1
  56. package/dist/constants.js +1 -1
  57. package/dist/{renderFunctions-grWPDbgH.js → dashboard-CzHfj-E5.js} +22 -60
  58. package/dist/dashboard-CzHfj-E5.js.map +1 -0
  59. package/dist/{index-CY-RxkbT.js → index-lD18ClWH.js} +2 -15
  60. package/dist/index-lD18ClWH.js.map +1 -0
  61. package/dist/index.js +15 -24
  62. package/dist/index.js.map +1 -1
  63. package/dist/renderFunctions-TxCky_xI.js +61 -0
  64. package/dist/renderFunctions-TxCky_xI.js.map +1 -0
  65. package/dist/{useConnectApi-DKV0_XY2.js → useConnectApi-DzvCFwAu.js} +7 -46
  66. package/dist/useConnectApi-DzvCFwAu.js.map +1 -0
  67. package/dist/{usePaymentApi-D2IDhsBx.js → usePaymentApi-4b6Udgmj.js} +5 -18
  68. package/dist/usePaymentApi-4b6Udgmj.js.map +1 -0
  69. package/dist/{usePaymentsApi-BdNGObVp.js → usePaymentsApi-CwVIUDRp.js} +2 -2
  70. package/dist/{usePaymentsApi-BdNGObVp.js.map → usePaymentsApi-CwVIUDRp.js.map} +1 -1
  71. package/dist/usePlatformApi-X-BDj5nS.js +43 -0
  72. package/dist/usePlatformApi-X-BDj5nS.js.map +1 -0
  73. package/dist/useRazorpayPayment.js +2 -3
  74. package/dist/useRazorpayPayment.js.map +1 -1
  75. package/package.json +9 -9
  76. package/dist/Dashboard.js +0 -696
  77. package/dist/Dashboard.js.map +0 -1
  78. package/dist/ExportModal-CYHlSNLI.js.map +0 -1
  79. package/dist/ExportModal-Wp5ZItOx.js +0 -694
  80. package/dist/ExportModal-Wp5ZItOx.js.map +0 -1
  81. package/dist/IdentifierButton-DdXIkdI0.js +0 -19
  82. package/dist/IdentifierButton-DdXIkdI0.js.map +0 -1
  83. package/dist/RazorpayDashboard.js +0 -265
  84. package/dist/RazorpayDashboard.js.map +0 -1
  85. package/dist/V2PaymentsDashboard.js +0 -313
  86. package/dist/V2PaymentsDashboard.js.map +0 -1
  87. package/dist/cjs/Dashboard.js +0 -698
  88. package/dist/cjs/Dashboard.js.map +0 -1
  89. package/dist/cjs/ExportModal-DNZkMM58.js.map +0 -1
  90. package/dist/cjs/ExportModal-hUc8sq24.js +0 -708
  91. package/dist/cjs/ExportModal-hUc8sq24.js.map +0 -1
  92. package/dist/cjs/IdentifierButton-C0gz-cb3.js +0 -21
  93. package/dist/cjs/IdentifierButton-C0gz-cb3.js.map +0 -1
  94. package/dist/cjs/RazorpayDashboard.js +0 -267
  95. package/dist/cjs/RazorpayDashboard.js.map +0 -1
  96. package/dist/cjs/V2PaymentsDashboard.js +0 -315
  97. package/dist/cjs/V2PaymentsDashboard.js.map +0 -1
  98. package/dist/cjs/index-BuNTaf1f.js +0 -88
  99. package/dist/cjs/index-BuNTaf1f.js.map +0 -1
  100. package/dist/cjs/index-zFKnsfIq.js.map +0 -1
  101. package/dist/cjs/renderFunctions-PCwwCeDH.js.map +0 -1
  102. package/dist/cjs/useConnectApi-DK-vd1fm.js.map +0 -1
  103. package/dist/cjs/useExportsApi-DR1OfSi9.js +0 -21
  104. package/dist/cjs/useExportsApi-DR1OfSi9.js.map +0 -1
  105. package/dist/cjs/useFiltersAndPagination-Cn3e6dKn.js +0 -308
  106. package/dist/cjs/useFiltersAndPagination-Cn3e6dKn.js.map +0 -1
  107. package/dist/cjs/usePaymentApi-CrN9sk9a.js.map +0 -1
  108. package/dist/cjs/usePlatformApi-CuXnZnd2.js +0 -145
  109. package/dist/cjs/usePlatformApi-CuXnZnd2.js.map +0 -1
  110. package/dist/index-CY-RxkbT.js.map +0 -1
  111. package/dist/index-DFxMGqOe.js +0 -80
  112. package/dist/index-DFxMGqOe.js.map +0 -1
  113. package/dist/renderFunctions-grWPDbgH.js.map +0 -1
  114. package/dist/useConnectApi-DKV0_XY2.js.map +0 -1
  115. package/dist/useExportsApi-CLBIM4c0.js +0 -19
  116. package/dist/useExportsApi-CLBIM4c0.js.map +0 -1
  117. package/dist/useFiltersAndPagination-CPG1yICV.js +0 -303
  118. package/dist/useFiltersAndPagination-CPG1yICV.js.map +0 -1
  119. package/dist/usePaymentApi-D2IDhsBx.js.map +0 -1
  120. package/dist/usePlatformApi-vWY5OcFd.js +0 -137
  121. package/dist/usePlatformApi-vWY5OcFd.js.map +0 -1
@@ -1,708 +0,0 @@
1
- 'use strict';
2
-
3
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
- var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
5
- var React = require('react');
6
- var Download = require('@bigbinary/neeto-icons/Download');
7
- var Button = require('@bigbinary/neetoui/Button');
8
- var Modal = require('@bigbinary/neetoui/Modal');
9
- var Typography = require('@bigbinary/neetoui/Typography');
10
- var reactI18next = require('react-i18next');
11
- var reactQuery = require('@tanstack/react-query');
12
- var axios = require('axios');
13
- var constants = require('./index-zFKnsfIq.js');
14
- var useExportsApi = require('./useExportsApi-DR1OfSi9.js');
15
- var exportChannel = require('./exportChannel-BsZ3fusx.js');
16
- var neetoCist = require('@bigbinary/neeto-cist');
17
- var ramda = require('ramda');
18
- var i18next = require('i18next');
19
- var Tag = require('@bigbinary/neetoui/Tag');
20
- var Tooltip = require('@bigbinary/neetoui/Tooltip');
21
- var CopyButtonWrapper = require('./CopyButtonWrapper-Ds1k64E0.js');
22
- var renderFunctions = require('./renderFunctions-PCwwCeDH.js');
23
- var IdentifierButton = require('./IdentifierButton-C0gz-cb3.js');
24
- var jsxRuntime = require('react/jsx-runtime');
25
- var index = require('./index-BuNTaf1f.js');
26
-
27
- var exportData = function exportData(payload) {
28
- return axios.post("".concat(constants.BASE_URL, "/api/v1/razorpay/exports"), payload);
29
- };
30
- var exportsApi = {
31
- exportData: exportData
32
- };
33
-
34
- var useExportRazorpayData = function useExportRazorpayData() {
35
- return reactQuery.useMutation({
36
- mutationFn: exportsApi.exportData
37
- });
38
- };
39
-
40
- var renderIdentifier = function renderIdentifier() {
41
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
42
- _ref$identifier = _ref.identifier,
43
- identifier = _ref$identifier === void 0 ? "" : _ref$identifier,
44
- _ref$live = _ref.live,
45
- isLive = _ref$live === void 0 ? false : _ref$live;
46
- return /*#__PURE__*/jsxRuntime.jsx(CopyButtonWrapper.CopyButtonWrapper, {
47
- content: identifier,
48
- children: /*#__PURE__*/jsxRuntime.jsx(IdentifierButton.IdentifierButton, {
49
- href: constants.buildStripeTransactionLink(identifier, isLive),
50
- label: identifier
51
- })
52
- });
53
- };
54
- ramda.curry(function (type, kind) {
55
- return /*#__PURE__*/jsxRuntime.jsx(Tooltip, {
56
- content: i18next.t("neetoPayments.tooltipContent.".concat(type, ".").concat(kind)),
57
- position: "top",
58
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
59
- className: "w-fit",
60
- children: /*#__PURE__*/jsxRuntime.jsx(Tag, {
61
- label: i18next.t("neetoPayments.tagLabels.".concat(type, ".").concat(kind)),
62
- style: "secondary"
63
- })
64
- })
65
- });
66
- });
67
- var renderSplitIdentifier = function renderSplitIdentifier(_ref2) {
68
- var identifier = _ref2.identifier,
69
- isLive = _ref2.live;
70
- return identifier ? /*#__PURE__*/jsxRuntime.jsx(CopyButtonWrapper.CopyButtonWrapper, {
71
- content: identifier,
72
- children: /*#__PURE__*/jsxRuntime.jsx(IdentifierButton.IdentifierButton, {
73
- href: constants.buildStripeSplitLink(identifier, isLive),
74
- label: identifier
75
- })
76
- }) : /*#__PURE__*/jsxRuntime.jsx(Tooltip, {
77
- content: i18next.t("neetoPayments.tooltipContent.identifierUnavailable"),
78
- position: "top",
79
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
80
- className: "text-center",
81
- children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
82
- style: "body2",
83
- children: i18next.t("neetoPayments.common.notAvailable")
84
- })
85
- })
86
- });
87
- };
88
- var renderTransferIdentifier = function renderTransferIdentifier() {
89
- var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
90
- _ref3$identifier = _ref3.identifier,
91
- identifier = _ref3$identifier === void 0 ? "" : _ref3$identifier,
92
- _ref3$account = _ref3.account,
93
- account = _ref3$account === void 0 ? {} : _ref3$account,
94
- _ref3$live = _ref3.live,
95
- isLive = _ref3$live === void 0 ? false : _ref3$live;
96
- return identifier ? /*#__PURE__*/jsxRuntime.jsx(CopyButtonWrapper.CopyButtonWrapper, {
97
- content: identifier,
98
- children: /*#__PURE__*/jsxRuntime.jsx(IdentifierButton.IdentifierButton, {
99
- label: identifier,
100
- href: identifier.startsWith("py") ? constants.buildStripeTransferLink(identifier, account === null || account === void 0 ? void 0 : account.identifier, isLive) : constants.buildStripeTransactionLink(identifier, isLive)
101
- })
102
- }) : /*#__PURE__*/jsxRuntime.jsx("div", {
103
- className: "text-center",
104
- children: /*#__PURE__*/jsxRuntime.jsx(Tooltip, {
105
- position: "top",
106
- content: i18next.t("neetoPayments.tooltipContent.connectedTransactionUnavailable"),
107
- children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
108
- style: "body2",
109
- children: i18next.t("neetoPayments.common.notAvailable")
110
- })
111
- })
112
- });
113
- };
114
- var renderPlatformIdentifier = ramda.curry(function (setPaneStatus, data) {
115
- return /*#__PURE__*/jsxRuntime.jsx(CopyButtonWrapper.CopyButtonWrapper, {
116
- content: data === null || data === void 0 ? void 0 : data.identifier,
117
- children: /*#__PURE__*/jsxRuntime.jsx(Button, {
118
- label: data === null || data === void 0 ? void 0 : data.identifier,
119
- size: "small",
120
- style: "link",
121
- onClick: function onClick() {
122
- return setPaneStatus({
123
- transactionId: data === null || data === void 0 ? void 0 : data.id,
124
- isOpen: true
125
- });
126
- }
127
- })
128
- });
129
- });
130
- var renderAccountIdentifier = function renderAccountIdentifier(_ref4) {
131
- var _ref4$identifier = _ref4.identifier,
132
- identifier = _ref4$identifier === void 0 ? "" : _ref4$identifier,
133
- _ref4$live = _ref4.live,
134
- isLive = _ref4$live === void 0 ? false : _ref4$live;
135
- return /*#__PURE__*/jsxRuntime.jsx(CopyButtonWrapper.CopyButtonWrapper, {
136
- content: identifier,
137
- children: /*#__PURE__*/jsxRuntime.jsx(IdentifierButton.IdentifierButton, {
138
- href: constants.buildStripeAccountLink(identifier, isLive),
139
- label: identifier
140
- })
141
- });
142
- };
143
- var renderSplitDate = function renderSplitDate(date) {
144
- return neetoCist.isPresent(date) ? renderFunctions.renderDate(date) : /*#__PURE__*/jsxRuntime.jsx(Tooltip, {
145
- content: i18next.t("neetoPayments.tooltipContent.dateUnavailable"),
146
- position: "top",
147
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
148
- className: "text-center",
149
- children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
150
- style: "body2",
151
- children: i18next.t("neetoPayments.common.notAvailable")
152
- })
153
- })
154
- });
155
- };
156
- var renderRefundIdentifier = function renderRefundIdentifier() {
157
- var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
158
- _ref5$identifier = _ref5.identifier,
159
- identifier = _ref5$identifier === void 0 ? "" : _ref5$identifier,
160
- _ref5$live = _ref5.live,
161
- isLive = _ref5$live === void 0 ? false : _ref5$live;
162
- return /*#__PURE__*/jsxRuntime.jsx(CopyButtonWrapper.CopyButtonWrapper, {
163
- content: identifier,
164
- children: /*#__PURE__*/jsxRuntime.jsx(IdentifierButton.IdentifierButton, {
165
- href: constants.buildStripeRefundLink(identifier, isLive),
166
- label: identifier
167
- })
168
- });
169
- };
170
-
171
- var generateSpecialColumns = function generateSpecialColumns(_ref) {
172
- var setPaneStatus = _ref.setPaneStatus;
173
- return [{
174
- title: i18next.t("neetoPayments.common.platformTransaction"),
175
- dataIndex: "paymentIntent",
176
- key: "paymentIntent",
177
- width: "290px",
178
- position: 9,
179
- render: renderPlatformIdentifier(setPaneStatus)
180
- }];
181
- };
182
-
183
- var COLUMNS = [{
184
- title: i18next.t("neetoPayments.common.id"),
185
- dataIndex: "id",
186
- key: "id",
187
- width: "85px",
188
- position: 0,
189
- isHidable: false
190
- }, {
191
- title: i18next.t("neetoPayments.common.identifier"),
192
- dataIndex: "identifier",
193
- key: "identifier",
194
- width: "300px",
195
- render: renderIdentifier,
196
- position: 1,
197
- isHidable: false
198
- }, {
199
- title: i18next.t("neetoPayments.common.identifier"),
200
- dataIndex: "identifier",
201
- key: "splitIdentifier",
202
- width: "300px",
203
- render: renderSplitIdentifier,
204
- position: 1,
205
- isHidable: false
206
- }, {
207
- title: i18next.t("neetoPayments.common.identifier"),
208
- dataIndex: "identifier",
209
- key: "refundIdentifier",
210
- width: "300px",
211
- render: renderRefundIdentifier,
212
- position: 1,
213
- isHidable: false
214
- }, {
215
- title: i18next.t("neetoPayments.common.identifier"),
216
- dataIndex: "identifier",
217
- key: "transferIdentifier",
218
- width: "300px",
219
- render: renderTransferIdentifier,
220
- position: 1,
221
- isHidable: false
222
- }, {
223
- title: i18next.t("neetoPayments.common.status"),
224
- dataIndex: "status",
225
- key: "status",
226
- width: "150px",
227
- render: renderFunctions.renderStatus("transaction"),
228
- sorter: true,
229
- position: 2,
230
- isHidable: false
231
- }, {
232
- title: i18next.t("neetoPayments.common.amount"),
233
- dataIndex: "amount",
234
- key: "amount",
235
- width: "150px",
236
- sorter: true,
237
- position: 3
238
- }, {
239
- title: i18next.t("neetoPayments.common.platformShare"),
240
- dataIndex: "platformShare",
241
- key: "platformShare",
242
- width: "280px",
243
- position: 3
244
- }, {
245
- title: i18next.t("neetoPayments.common.paymentTime"),
246
- dataIndex: "paymentAt",
247
- key: "paymentTime",
248
- width: "220px",
249
- render: renderFunctions.renderDate,
250
- sorter: true,
251
- position: 5
252
- }, {
253
- title: i18next.t("neetoPayments.common.refundTime"),
254
- dataIndex: "refunds",
255
- key: "refundsTime",
256
- width: "220px",
257
- render: function render() {
258
- var _refunds$;
259
- var refunds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
260
- return renderFunctions.renderDate((_refunds$ = refunds[0]) === null || _refunds$ === void 0 ? void 0 : _refunds$.updatedAt);
261
- },
262
- position: 6
263
- }, {
264
- title: i18next.t("neetoPayments.common.status"),
265
- dataIndex: "status",
266
- width: "150px",
267
- key: "refundStatus",
268
- render: renderFunctions.renderStatus("refund"),
269
- sorter: true,
270
- position: 3,
271
- isHidable: false
272
- }, {
273
- title: i18next.t("neetoPayments.common.paymentAmount"),
274
- dataIndex: "paymentAmount",
275
- key: "paymentAmount",
276
- width: "240px",
277
- sorter: true,
278
- position: 4
279
- }, {
280
- title: i18next.t("neetoPayments.common.refundAmount"),
281
- dataIndex: "amount",
282
- key: "refundAmount",
283
- width: "200px",
284
- sorter: true,
285
- position: 3
286
- }, {
287
- title: i18next.t("neetoPayments.common.refundTime"),
288
- dataIndex: "updatedAt",
289
- key: "refundTime",
290
- width: "220px",
291
- render: renderFunctions.renderDate,
292
- sorter: true,
293
- position: 9
294
- }, {
295
- title: i18next.t("neetoPayments.common.status"),
296
- dataIndex: "status",
297
- key: "splitStatus",
298
- width: "150px",
299
- render: renderFunctions.renderStatus("split"),
300
- sorter: true,
301
- position: 3,
302
- isHidable: false
303
- }, {
304
- title: i18next.t("neetoPayments.common.transferTime"),
305
- key: "splitTime",
306
- dataIndex: "paymentAt",
307
- width: "220px",
308
- render: renderSplitDate,
309
- sorter: true,
310
- position: 7
311
- }, {
312
- title: i18next.t("neetoPayments.common.paymentIdentifier"),
313
- key: "refundPaymentIdentifier",
314
- dataIndex: "transaction",
315
- width: "300px",
316
- render: renderTransferIdentifier,
317
- position: 8
318
- }, {
319
- title: i18next.t("neetoPayments.common.connectedTransaction"),
320
- dataIndex: "connectedPayment",
321
- key: "connectedPayment",
322
- width: "300px",
323
- render: renderTransferIdentifier,
324
- position: 9
325
- }, {
326
- title: i18next.t("neetoPayments.common.accountIdentifier"),
327
- dataIndex: "account",
328
- key: "destinationAccount",
329
- width: "160px",
330
- render: renderAccountIdentifier,
331
- position: 10
332
- }];
333
- var COLUMN_METADATA = {
334
- identifier: {
335
- isHidden: {
336
- split: true,
337
- transfer: true,
338
- refund: true
339
- }
340
- },
341
- amount: {
342
- isHidden: {
343
- refund: true
344
- }
345
- },
346
- paymentTime: {
347
- isHidden: {
348
- refund: true,
349
- split: true
350
- }
351
- },
352
- splitIdentifier: {
353
- isHidden: {
354
- platform: true,
355
- refund: true,
356
- connected: true,
357
- transfer: true,
358
- pending: true
359
- }
360
- },
361
- transferIdentifier: {
362
- isHidden: {
363
- platform: true,
364
- split: true,
365
- connected: true,
366
- refund: true
367
- }
368
- },
369
- platformShare: {
370
- isHidden: {
371
- platform: true,
372
- connected: true,
373
- transfer: true,
374
- refund: true
375
- }
376
- },
377
- status: {
378
- isHidden: {
379
- refund: true,
380
- split: true,
381
- declined: true,
382
- pending: true,
383
- successful: true,
384
- refunded: true
385
- }
386
- },
387
- refundStatus: {
388
- isHidden: {
389
- platform: true,
390
- split: true,
391
- connected: true,
392
- transfer: true,
393
- failed: true,
394
- pending: true,
395
- successful: true
396
- }
397
- },
398
- refundAmount: {
399
- isHidden: {
400
- platform: true,
401
- split: true,
402
- connected: true,
403
- transfer: true
404
- }
405
- },
406
- refundTime: {
407
- isHidden: {
408
- platform: true,
409
- split: true,
410
- connected: true,
411
- transfer: true
412
- }
413
- },
414
- splitStatus: {
415
- isHidden: {
416
- platform: true,
417
- refund: true,
418
- connected: true,
419
- transfer: true,
420
- declined: true,
421
- pending: true,
422
- successful: true,
423
- cancelled: true
424
- }
425
- },
426
- splitTime: {
427
- isHidden: {
428
- platform: true,
429
- refund: true,
430
- connected: true,
431
- transfer: true
432
- }
433
- },
434
- paymentIntent: {
435
- isHidden: {
436
- platform: true,
437
- refund: true,
438
- connected: true,
439
- transfer: true
440
- }
441
- },
442
- connectedPayment: {
443
- isHidden: {
444
- platform: true,
445
- refund: true,
446
- connected: true,
447
- transfer: true,
448
- pending: true
449
- }
450
- },
451
- refundPaymentIdentifier: {
452
- isHidden: {
453
- platform: true,
454
- split: true,
455
- connected: true,
456
- transfer: true
457
- }
458
- },
459
- refundIdentifier: {
460
- isHidden: {
461
- platform: true,
462
- split: true,
463
- connected: true,
464
- transfer: true
465
- }
466
- },
467
- destinationAccount: {
468
- isHidden: {
469
- platform: true,
470
- refund: true,
471
- connected: true,
472
- transfer: true
473
- }
474
- },
475
- paymentAmount: {
476
- isHidden: {
477
- platform: true,
478
- split: true,
479
- connected: true,
480
- transfer: true
481
- }
482
- },
483
- refundsTime: {
484
- isHidden: {
485
- split: true,
486
- all: true,
487
- declined: true,
488
- pending: true,
489
- successful: true
490
- }
491
- }
492
- };
493
- var FILTER_COLUMNS = [{
494
- key: "amount",
495
- label: i18next.t("neetoPayments.common.amount"),
496
- node: "amount",
497
- type: "decimal",
498
- showRuleSelector: true
499
- }, {
500
- key: "payment_amount",
501
- label: i18next.t("neetoPayments.common.paymentAmount"),
502
- node: "payment.amount",
503
- model: "NeetoPaymentsEngine::Payment",
504
- type: "decimal",
505
- showRuleSelector: true
506
- }, {
507
- key: "refund_amount",
508
- label: i18next.t("neetoPayments.common.refundAmount"),
509
- node: "amount",
510
- type: "decimal",
511
- showRuleSelector: true
512
- }, {
513
- key: "payment_time",
514
- label: i18next.t("neetoPayments.common.paymentTime"),
515
- node: "payment_at",
516
- type: "date",
517
- showRuleSelector: true
518
- }, {
519
- key: "refund_time",
520
- label: i18next.t("neetoPayments.common.refundTime"),
521
- node: "updated_at",
522
- type: "date",
523
- showRuleSelector: true
524
- }, {
525
- key: "split_time",
526
- label: i18next.t("neetoPayments.common.transferTime"),
527
- node: "payment_at",
528
- type: "date",
529
- showRuleSelector: true
530
- }];
531
-
532
- var isPlatformKind = ramda.equals(index.KIND.platform);
533
- var isConnectedKind = ramda.equals(index.KIND.connected);
534
- var isSplitKind = ramda.equals(index.KIND.split);
535
- var isTransferKind = ramda.equals(index.KIND.transfer);
536
- var isRefundKind = ramda.equals(index.KIND.refund);
537
- var buildPaymentColumns = function buildPaymentColumns(_ref) {
538
- var tab = _ref.tab,
539
- kind = _ref.kind,
540
- _ref$payableEntityCol = _ref.payableEntityColumns,
541
- payableEntityColumns = _ref$payableEntityCol === void 0 ? [] : _ref$payableEntityCol,
542
- _ref$specialColumnArg = _ref.specialColumnArguments,
543
- specialColumnArguments = _ref$specialColumnArg === void 0 ? {} : _ref$specialColumnArg;
544
- return ramda.sortBy(ramda.prop("position"), COLUMNS.concat(generateSpecialColumns(specialColumnArguments)).filter(function (_ref2) {
545
- var _COLUMN_METADATA$key, _COLUMN_METADATA$key$, _COLUMN_METADATA$key2, _COLUMN_METADATA$key3;
546
- var key = _ref2.key;
547
- return !((_COLUMN_METADATA$key = COLUMN_METADATA[key]) !== null && _COLUMN_METADATA$key !== void 0 && (_COLUMN_METADATA$key$ = _COLUMN_METADATA$key.isHidden) !== null && _COLUMN_METADATA$key$ !== void 0 && _COLUMN_METADATA$key$[kind] || (_COLUMN_METADATA$key2 = COLUMN_METADATA[key]) !== null && _COLUMN_METADATA$key2 !== void 0 && (_COLUMN_METADATA$key3 = _COLUMN_METADATA$key2.isHidden) !== null && _COLUMN_METADATA$key3 !== void 0 && _COLUMN_METADATA$key3[tab]);
548
- }).concat(payableEntityColumns.filter(function (_ref3) {
549
- var isHidden = _ref3.isHidden;
550
- return !(isHidden !== null && isHidden !== void 0 && isHidden[tab] || isHidden !== null && isHidden !== void 0 && isHidden[kind]);
551
- })));
552
- };
553
- var buildFilterColumns = function buildFilterColumns(tab, kind) {
554
- var payableEntityColumns = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
555
- var filterColumns = FILTER_COLUMNS.filter(function (_ref4) {
556
- var _COLUMN_METADATA$snak, _COLUMN_METADATA$snak2;
557
- var key = _ref4.key;
558
- return !((_COLUMN_METADATA$snak = COLUMN_METADATA[neetoCist.snakeToCamelCase(key)]) !== null && _COLUMN_METADATA$snak !== void 0 && (_COLUMN_METADATA$snak2 = _COLUMN_METADATA$snak.isHidden) !== null && _COLUMN_METADATA$snak2 !== void 0 && _COLUMN_METADATA$snak2[kind]);
559
- });
560
- return ramda.concat(filterColumns, ramda.map(ramda.prop("filterProps"), neetoCist.filterBy({
561
- isFilterable: true,
562
- isHidden: function isHidden(_isHidden) {
563
- return !(_isHidden !== null && _isHidden !== void 0 && _isHidden[tab] || _isHidden !== null && _isHidden !== void 0 && _isHidden[kind]);
564
- }
565
- }, payableEntityColumns)));
566
- };
567
- var processResponse = function processResponse(data, kind) {
568
- if (isSplitKind(kind)) return data === null || data === void 0 ? void 0 : data.splits;
569
- if (isRefundKind(kind)) return data === null || data === void 0 ? void 0 : data.refunds;
570
- return data === null || data === void 0 ? void 0 : data.transactions;
571
- };
572
- var modifySearchProps = function modifySearchProps(_ref5) {
573
- var _APPENDABLE_SEARCH_PR, _APPENDABLE_SEARCH_PR2;
574
- var searchProps = _ref5.searchProps,
575
- kind = _ref5.kind;
576
- return ramda.evolve({
577
- node: ramda.concat((_APPENDABLE_SEARCH_PR = index.APPENDABLE_SEARCH_PROPS[kind]) === null || _APPENDABLE_SEARCH_PR === void 0 ? void 0 : _APPENDABLE_SEARCH_PR.node),
578
- model: ramda.concat((_APPENDABLE_SEARCH_PR2 = index.APPENDABLE_SEARCH_PROPS[kind]) === null || _APPENDABLE_SEARCH_PR2 === void 0 ? void 0 : _APPENDABLE_SEARCH_PR2.model)
579
- }, searchProps);
580
- };
581
-
582
- 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; }
583
- 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; }
584
- var ExportModal = function ExportModal(_ref) {
585
- var showExportModal = _ref.showExportModal,
586
- setShowExportModal = _ref.setShowExportModal,
587
- kind = _ref.kind,
588
- tab = _ref.tab,
589
- filters = _ref.filters,
590
- holdableId = _ref.holdableId,
591
- _ref$sortProperties = _ref.sortProperties,
592
- sortProperties = _ref$sortProperties === void 0 ? {} : _ref$sortProperties;
593
- var _useTranslation = reactI18next.useTranslation(),
594
- t = _useTranslation.t;
595
- var _useState = React.useState(""),
596
- _useState2 = _slicedToArray(_useState, 2),
597
- downloadUrl = _useState2[0],
598
- setDownloadUrl = _useState2[1];
599
- var _useState3 = React.useState(false),
600
- _useState4 = _slicedToArray(_useState3, 2),
601
- isGenerating = _useState4[0],
602
- setIsGenerating = _useState4[1];
603
- var _useExportRazorpayDat = useExportRazorpayData(),
604
- exportRazorpayPaymentsCsv = _useExportRazorpayDat.mutate,
605
- isRazorpayLoading = _useExportRazorpayDat.isPending;
606
- var _useExportData = useExportsApi.useExportData(),
607
- exportCsv = _useExportData.mutate,
608
- isPending = _useExportData.isPending;
609
- var isFileLoading = isPending || isGenerating || isRazorpayLoading;
610
- var token = React.useMemo(function () {
611
- return "".concat(kind, "-report-").concat(constants.uuidV4());
612
- }, [kind]);
613
- var receivedCallback = function receivedCallback(data) {
614
- if (!data.download_url) return;
615
- setDownloadUrl(data.download_url);
616
- setIsGenerating(false);
617
- };
618
- var handleGenerateClick = function handleGenerateClick() {
619
- var payload = _objectSpread({
620
- kind: isTransferKind(kind) ? "connected" : kind,
621
- token: token,
622
- filters: filters,
623
- tab: tab,
624
- holdableId: holdableId
625
- }, sortProperties);
626
- if (kind === "razorpayPayment") {
627
- return exportRazorpayPaymentsCsv(payload, {
628
- onSuccess: function onSuccess() {
629
- setDownloadUrl("");
630
- setIsGenerating(true);
631
- }
632
- });
633
- }
634
- return exportCsv(payload, {
635
- onSuccess: function onSuccess() {
636
- setDownloadUrl("");
637
- setIsGenerating(true);
638
- }
639
- });
640
- };
641
- React.useEffect(function () {
642
- if (showExportModal) {
643
- var channel = exportChannel.exportChannel(token, receivedCallback);
644
- setDownloadUrl("");
645
- setIsGenerating(false);
646
- return function () {
647
- channel.disconnected();
648
- };
649
- }
650
- return undefined;
651
- }, [showExportModal, token]);
652
- var onClose = function onClose() {
653
- return setShowExportModal(false);
654
- };
655
- return /*#__PURE__*/jsxRuntime.jsxs(Modal, {
656
- onClose: onClose,
657
- isOpen: showExportModal,
658
- children: [/*#__PURE__*/jsxRuntime.jsx(Modal.Header, {
659
- children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
660
- style: "h2",
661
- children: t("neetoPayments.export.title.".concat(kind))
662
- })
663
- }), /*#__PURE__*/jsxRuntime.jsx(Modal.Body, {
664
- children: isFileLoading ? /*#__PURE__*/jsxRuntime.jsx(Typography, {
665
- style: "body2",
666
- children: t("neetoPayments.export.pleaseWait")
667
- }) : /*#__PURE__*/jsxRuntime.jsx(Typography, {
668
- style: "body2",
669
- children: downloadUrl ? t("neetoPayments.export.fileReady") : t("neetoPayments.export.download.".concat(kind))
670
- })
671
- }), /*#__PURE__*/jsxRuntime.jsx(Modal.Footer, {
672
- className: "space-x-2",
673
- children: downloadUrl ? /*#__PURE__*/jsxRuntime.jsx(Button, {
674
- href: downloadUrl,
675
- icon: Download,
676
- label: t("neetoPayments.common.download"),
677
- onClick: onClose
678
- }) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
679
- children: [/*#__PURE__*/jsxRuntime.jsx(Button, {
680
- disabled: isFileLoading,
681
- label: t("neetoPayments.common.cancel"),
682
- style: "tertiary",
683
- onClick: onClose
684
- }), /*#__PURE__*/jsxRuntime.jsx(Button, {
685
- disabled: isFileLoading,
686
- label: t("neetoPayments.common.export"),
687
- loading: isFileLoading,
688
- onClick: handleGenerateClick
689
- })]
690
- })
691
- })]
692
- });
693
- };
694
-
695
- exports.ExportModal = ExportModal;
696
- exports.buildFilterColumns = buildFilterColumns;
697
- exports.buildPaymentColumns = buildPaymentColumns;
698
- exports.isConnectedKind = isConnectedKind;
699
- exports.isPlatformKind = isPlatformKind;
700
- exports.isRefundKind = isRefundKind;
701
- exports.isSplitKind = isSplitKind;
702
- exports.isTransferKind = isTransferKind;
703
- exports.modifySearchProps = modifySearchProps;
704
- exports.processResponse = processResponse;
705
- exports.renderIdentifier = renderIdentifier;
706
- exports.renderRefundIdentifier = renderRefundIdentifier;
707
- exports.renderSplitIdentifier = renderSplitIdentifier;
708
- //# sourceMappingURL=ExportModal-hUc8sq24.js.map