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