@bigbinary/neeto-payments-frontend 3.0.22 → 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 (118) hide show
  1. package/dist/AccountsDashboard.js +8 -6
  2. package/dist/AccountsDashboard.js.map +1 -1
  3. package/dist/{ExportModal-Cdub413T.js → ExportModal-C6-IwFlZ.js} +2 -2
  4. package/dist/{ExportModal-Cdub413T.js.map → ExportModal-C6-IwFlZ.js.map} +1 -1
  5. package/dist/PaymentsDashboard.js +2 -2
  6. package/dist/PayoutsDashboard.js +6 -6
  7. package/dist/PayoutsPage.js +16 -51
  8. package/dist/PayoutsPage.js.map +1 -1
  9. package/dist/RazorpayPaymentButton.js +2 -3
  10. package/dist/RazorpayPaymentButton.js.map +1 -1
  11. package/dist/RefundsDashboard.js +2 -2
  12. package/dist/SplitTransfersDashboard.js +3 -3
  13. package/dist/SplitTransfersDashboard.js.map +1 -1
  14. package/dist/StripeConnect.js +2 -2
  15. package/dist/UpiMarkAsPaidButton.js +2 -2
  16. package/dist/UpiPayment.js +2 -2
  17. package/dist/buildStripeTransactionLink.js +1 -1
  18. package/dist/cjs/AccountsDashboard.js +13 -11
  19. package/dist/cjs/AccountsDashboard.js.map +1 -1
  20. package/dist/cjs/{ExportModal-CVOKc5x3.js → ExportModal-DaLww9x0.js} +2 -2
  21. package/dist/cjs/{ExportModal-CVOKc5x3.js.map → ExportModal-DaLww9x0.js.map} +1 -1
  22. package/dist/cjs/PaymentsDashboard.js +2 -2
  23. package/dist/cjs/PayoutsDashboard.js +11 -11
  24. package/dist/cjs/PayoutsDashboard.js.map +1 -1
  25. package/dist/cjs/PayoutsPage.js +16 -51
  26. package/dist/cjs/PayoutsPage.js.map +1 -1
  27. package/dist/cjs/RazorpayPaymentButton.js +2 -3
  28. package/dist/cjs/RazorpayPaymentButton.js.map +1 -1
  29. package/dist/cjs/RefundsDashboard.js +2 -2
  30. package/dist/cjs/SplitTransfersDashboard.js +3 -3
  31. package/dist/cjs/SplitTransfersDashboard.js.map +1 -1
  32. package/dist/cjs/StripeConnect.js +2 -2
  33. package/dist/cjs/UpiMarkAsPaidButton.js +2 -2
  34. package/dist/cjs/UpiPayment.js +2 -2
  35. package/dist/cjs/buildStripeTransactionLink.js +1 -1
  36. package/dist/cjs/constants.js +1 -1
  37. package/dist/cjs/{renderFunctions-PCwwCeDH.js → dashboard-BAIM4ZLC.js} +19 -60
  38. package/dist/cjs/dashboard-BAIM4ZLC.js.map +1 -0
  39. package/dist/cjs/{index-zFKnsfIq.js → index-Br_ibfWm.js} +1 -17
  40. package/dist/cjs/index-Br_ibfWm.js.map +1 -0
  41. package/dist/cjs/index.js +15 -27
  42. package/dist/cjs/index.js.map +1 -1
  43. package/dist/cjs/renderFunctions-DW0frqfV.js +66 -0
  44. package/dist/cjs/renderFunctions-DW0frqfV.js.map +1 -0
  45. package/dist/cjs/{useConnectApi-DK-vd1fm.js → useConnectApi-C3EpIQ0I.js} +6 -46
  46. package/dist/cjs/useConnectApi-C3EpIQ0I.js.map +1 -0
  47. package/dist/cjs/{usePaymentApi-CrN9sk9a.js → usePaymentApi-lZYye4u0.js} +3 -17
  48. package/dist/cjs/usePaymentApi-lZYye4u0.js.map +1 -0
  49. package/dist/cjs/{usePaymentsApi-QmSQQ00p.js → usePaymentsApi-CDy4nTGr.js} +2 -2
  50. package/dist/cjs/{usePaymentsApi-QmSQQ00p.js.map → usePaymentsApi-CDy4nTGr.js.map} +1 -1
  51. package/dist/cjs/usePlatformApi-BajSo0Hl.js +46 -0
  52. package/dist/cjs/usePlatformApi-BajSo0Hl.js.map +1 -0
  53. package/dist/cjs/useRazorpayPayment.js +2 -3
  54. package/dist/cjs/useRazorpayPayment.js.map +1 -1
  55. package/dist/constants.js +1 -1
  56. package/dist/{renderFunctions-grWPDbgH.js → dashboard-CzHfj-E5.js} +22 -60
  57. package/dist/dashboard-CzHfj-E5.js.map +1 -0
  58. package/dist/{index-CY-RxkbT.js → index-lD18ClWH.js} +2 -15
  59. package/dist/index-lD18ClWH.js.map +1 -0
  60. package/dist/index.js +15 -24
  61. package/dist/index.js.map +1 -1
  62. package/dist/renderFunctions-TxCky_xI.js +61 -0
  63. package/dist/renderFunctions-TxCky_xI.js.map +1 -0
  64. package/dist/{useConnectApi-DKV0_XY2.js → useConnectApi-DzvCFwAu.js} +7 -46
  65. package/dist/useConnectApi-DzvCFwAu.js.map +1 -0
  66. package/dist/{usePaymentApi-D2IDhsBx.js → usePaymentApi-4b6Udgmj.js} +5 -18
  67. package/dist/usePaymentApi-4b6Udgmj.js.map +1 -0
  68. package/dist/{usePaymentsApi-BdNGObVp.js → usePaymentsApi-CwVIUDRp.js} +2 -2
  69. package/dist/{usePaymentsApi-BdNGObVp.js.map → usePaymentsApi-CwVIUDRp.js.map} +1 -1
  70. package/dist/usePlatformApi-X-BDj5nS.js +43 -0
  71. package/dist/usePlatformApi-X-BDj5nS.js.map +1 -0
  72. package/dist/useRazorpayPayment.js +2 -3
  73. package/dist/useRazorpayPayment.js.map +1 -1
  74. package/package.json +9 -9
  75. package/dist/Dashboard.js +0 -696
  76. package/dist/Dashboard.js.map +0 -1
  77. package/dist/ExportModal-cXO0UDiA.js +0 -696
  78. package/dist/ExportModal-cXO0UDiA.js.map +0 -1
  79. package/dist/IdentifierButton-DdXIkdI0.js +0 -19
  80. package/dist/IdentifierButton-DdXIkdI0.js.map +0 -1
  81. package/dist/RazorpayDashboard.js +0 -265
  82. package/dist/RazorpayDashboard.js.map +0 -1
  83. package/dist/V2PaymentsDashboard.js +0 -313
  84. package/dist/V2PaymentsDashboard.js.map +0 -1
  85. package/dist/cjs/Dashboard.js +0 -698
  86. package/dist/cjs/Dashboard.js.map +0 -1
  87. package/dist/cjs/ExportModal-BkXCm3lh.js +0 -710
  88. package/dist/cjs/ExportModal-BkXCm3lh.js.map +0 -1
  89. package/dist/cjs/IdentifierButton-C0gz-cb3.js +0 -21
  90. package/dist/cjs/IdentifierButton-C0gz-cb3.js.map +0 -1
  91. package/dist/cjs/RazorpayDashboard.js +0 -267
  92. package/dist/cjs/RazorpayDashboard.js.map +0 -1
  93. package/dist/cjs/V2PaymentsDashboard.js +0 -315
  94. package/dist/cjs/V2PaymentsDashboard.js.map +0 -1
  95. package/dist/cjs/index-BuNTaf1f.js +0 -88
  96. package/dist/cjs/index-BuNTaf1f.js.map +0 -1
  97. package/dist/cjs/index-zFKnsfIq.js.map +0 -1
  98. package/dist/cjs/renderFunctions-PCwwCeDH.js.map +0 -1
  99. package/dist/cjs/useConnectApi-DK-vd1fm.js.map +0 -1
  100. package/dist/cjs/useExportsApi-Dx1JWvPU.js +0 -23
  101. package/dist/cjs/useExportsApi-Dx1JWvPU.js.map +0 -1
  102. package/dist/cjs/useFiltersAndPagination-Cn3e6dKn.js +0 -308
  103. package/dist/cjs/useFiltersAndPagination-Cn3e6dKn.js.map +0 -1
  104. package/dist/cjs/usePaymentApi-CrN9sk9a.js.map +0 -1
  105. package/dist/cjs/usePlatformApi-CuXnZnd2.js +0 -145
  106. package/dist/cjs/usePlatformApi-CuXnZnd2.js.map +0 -1
  107. package/dist/index-CY-RxkbT.js.map +0 -1
  108. package/dist/index-DFxMGqOe.js +0 -80
  109. package/dist/index-DFxMGqOe.js.map +0 -1
  110. package/dist/renderFunctions-grWPDbgH.js.map +0 -1
  111. package/dist/useConnectApi-DKV0_XY2.js.map +0 -1
  112. package/dist/useExportsApi-ZcbnSlhO.js +0 -21
  113. package/dist/useExportsApi-ZcbnSlhO.js.map +0 -1
  114. package/dist/useFiltersAndPagination-CPG1yICV.js +0 -303
  115. package/dist/useFiltersAndPagination-CPG1yICV.js.map +0 -1
  116. package/dist/usePaymentApi-D2IDhsBx.js.map +0 -1
  117. package/dist/usePlatformApi-vWY5OcFd.js +0 -137
  118. package/dist/usePlatformApi-vWY5OcFd.js.map +0 -1
@@ -1,696 +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-ZcbnSlhO.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
- showToastr: false
28
- });
29
- };
30
- var exportsApi = {
31
- exportData: exportData
32
- };
33
-
34
- var useExportRazorpayData = function useExportRazorpayData() {
35
- return 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__*/jsx(CopyButtonWrapper, {
47
- content: identifier,
48
- children: /*#__PURE__*/jsx(IdentifierButton, {
49
- href: buildStripeTransactionLink(identifier, isLive),
50
- label: identifier
51
- })
52
- });
53
- };
54
- curry(function (type, kind) {
55
- return /*#__PURE__*/jsx(Tooltip, {
56
- content: t("neetoPayments.tooltipContent.".concat(type, ".").concat(kind)),
57
- position: "top",
58
- children: /*#__PURE__*/jsx("div", {
59
- className: "w-fit",
60
- children: /*#__PURE__*/jsx(Tag, {
61
- label: 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__*/jsx(CopyButtonWrapper, {
71
- content: identifier,
72
- children: /*#__PURE__*/jsx(IdentifierButton, {
73
- href: buildStripeSplitLink(identifier, isLive),
74
- label: identifier
75
- })
76
- }) : /*#__PURE__*/jsx(Tooltip, {
77
- content: t("neetoPayments.tooltipContent.identifierUnavailable"),
78
- position: "top",
79
- children: /*#__PURE__*/jsx("div", {
80
- className: "text-center",
81
- children: /*#__PURE__*/jsx(Typography, {
82
- style: "body2",
83
- children: 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__*/jsx(CopyButtonWrapper, {
97
- content: identifier,
98
- children: /*#__PURE__*/jsx(IdentifierButton, {
99
- label: identifier,
100
- href: identifier.startsWith("py") ? buildStripeTransferLink(identifier, account === null || account === void 0 ? void 0 : account.identifier, isLive) : buildStripeTransactionLink(identifier, isLive)
101
- })
102
- }) : /*#__PURE__*/jsx("div", {
103
- className: "text-center",
104
- children: /*#__PURE__*/jsx(Tooltip, {
105
- position: "top",
106
- content: t("neetoPayments.tooltipContent.connectedTransactionUnavailable"),
107
- children: /*#__PURE__*/jsx(Typography, {
108
- style: "body2",
109
- children: t("neetoPayments.common.notAvailable")
110
- })
111
- })
112
- });
113
- };
114
- var renderPlatformIdentifier = curry(function (setPaneStatus, data) {
115
- return /*#__PURE__*/jsx(CopyButtonWrapper, {
116
- content: data === null || data === void 0 ? void 0 : data.identifier,
117
- children: /*#__PURE__*/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__*/jsx(CopyButtonWrapper, {
136
- content: identifier,
137
- children: /*#__PURE__*/jsx(IdentifierButton, {
138
- href: buildStripeAccountLink(identifier, isLive),
139
- label: identifier
140
- })
141
- });
142
- };
143
- var renderSplitDate = function renderSplitDate(date) {
144
- return isPresent(date) ? renderDate(date) : /*#__PURE__*/jsx(Tooltip, {
145
- content: t("neetoPayments.tooltipContent.dateUnavailable"),
146
- position: "top",
147
- children: /*#__PURE__*/jsx("div", {
148
- className: "text-center",
149
- children: /*#__PURE__*/jsx(Typography, {
150
- style: "body2",
151
- children: 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__*/jsx(CopyButtonWrapper, {
163
- content: identifier,
164
- children: /*#__PURE__*/jsx(IdentifierButton, {
165
- href: 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: 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: t("neetoPayments.common.id"),
185
- dataIndex: "id",
186
- key: "id",
187
- width: "85px",
188
- position: 0,
189
- isHidable: false
190
- }, {
191
- title: 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: 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: 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: 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: t("neetoPayments.common.status"),
224
- dataIndex: "status",
225
- key: "status",
226
- width: "150px",
227
- render: renderStatus("transaction"),
228
- sorter: true,
229
- position: 2,
230
- isHidable: false
231
- }, {
232
- title: t("neetoPayments.common.amount"),
233
- dataIndex: "amount",
234
- key: "amount",
235
- width: "150px",
236
- sorter: true,
237
- position: 3
238
- }, {
239
- title: t("neetoPayments.common.platformShare"),
240
- dataIndex: "platformShare",
241
- key: "platformShare",
242
- width: "280px",
243
- position: 3
244
- }, {
245
- title: t("neetoPayments.common.paymentTime"),
246
- dataIndex: "paymentAt",
247
- key: "paymentTime",
248
- width: "220px",
249
- render: renderDate,
250
- sorter: true,
251
- position: 5
252
- }, {
253
- title: 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 renderDate((_refunds$ = refunds[0]) === null || _refunds$ === void 0 ? void 0 : _refunds$.updatedAt);
261
- },
262
- position: 6
263
- }, {
264
- title: t("neetoPayments.common.status"),
265
- dataIndex: "status",
266
- width: "150px",
267
- key: "refundStatus",
268
- render: renderStatus("refund"),
269
- sorter: true,
270
- position: 3,
271
- isHidable: false
272
- }, {
273
- title: t("neetoPayments.common.paymentAmount"),
274
- dataIndex: "paymentAmount",
275
- key: "paymentAmount",
276
- width: "240px",
277
- sorter: true,
278
- position: 4
279
- }, {
280
- title: t("neetoPayments.common.refundAmount"),
281
- dataIndex: "amount",
282
- key: "refundAmount",
283
- width: "200px",
284
- sorter: true,
285
- position: 3
286
- }, {
287
- title: t("neetoPayments.common.refundTime"),
288
- dataIndex: "updatedAt",
289
- key: "refundTime",
290
- width: "220px",
291
- render: renderDate,
292
- sorter: true,
293
- position: 9
294
- }, {
295
- title: t("neetoPayments.common.status"),
296
- dataIndex: "status",
297
- key: "splitStatus",
298
- width: "150px",
299
- render: renderStatus("split"),
300
- sorter: true,
301
- position: 3,
302
- isHidable: false
303
- }, {
304
- title: 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: t("neetoPayments.common.paymentIdentifier"),
313
- key: "refundPaymentIdentifier",
314
- dataIndex: "transaction",
315
- width: "300px",
316
- render: renderTransferIdentifier,
317
- position: 8
318
- }, {
319
- title: t("neetoPayments.common.connectedTransaction"),
320
- dataIndex: "connectedPayment",
321
- key: "connectedPayment",
322
- width: "300px",
323
- render: renderTransferIdentifier,
324
- position: 9
325
- }, {
326
- title: 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: t("neetoPayments.common.amount"),
496
- node: "amount",
497
- type: "decimal",
498
- showRuleSelector: true
499
- }, {
500
- key: "payment_amount",
501
- label: 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: t("neetoPayments.common.refundAmount"),
509
- node: "amount",
510
- type: "decimal",
511
- showRuleSelector: true
512
- }, {
513
- key: "payment_time",
514
- label: t("neetoPayments.common.paymentTime"),
515
- node: "payment_at",
516
- type: "date",
517
- showRuleSelector: true
518
- }, {
519
- key: "refund_time",
520
- label: t("neetoPayments.common.refundTime"),
521
- node: "updated_at",
522
- type: "date",
523
- showRuleSelector: true
524
- }, {
525
- key: "split_time",
526
- label: t("neetoPayments.common.transferTime"),
527
- node: "payment_at",
528
- type: "date",
529
- showRuleSelector: true
530
- }];
531
-
532
- var isPlatformKind = equals(KIND.platform);
533
- var isConnectedKind = equals(KIND.connected);
534
- var isSplitKind = equals(KIND.split);
535
- var isTransferKind = equals(KIND.transfer);
536
- var isRefundKind = equals(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 sortBy(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[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 concat(filterColumns, map(prop("filterProps"), 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 evolve({
577
- node: concat((_APPENDABLE_SEARCH_PR = APPENDABLE_SEARCH_PROPS[kind]) === null || _APPENDABLE_SEARCH_PR === void 0 ? void 0 : _APPENDABLE_SEARCH_PR.node),
578
- model: concat((_APPENDABLE_SEARCH_PR2 = 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 = useTranslation(),
594
- t = _useTranslation.t;
595
- var _useState = useState(""),
596
- _useState2 = _slicedToArray(_useState, 2),
597
- downloadUrl = _useState2[0],
598
- setDownloadUrl = _useState2[1];
599
- var _useState3 = 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 = useExportData(),
607
- exportCsv = _useExportData.mutate,
608
- isPending = _useExportData.isPending;
609
- var isFileLoading = isPending || isGenerating || isRazorpayLoading;
610
- var token = useMemo(function () {
611
- return "".concat(kind, "-report-").concat(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
- useEffect(function () {
642
- if (showExportModal) {
643
- var channel = 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__*/jsxs(Modal, {
656
- onClose: onClose,
657
- isOpen: showExportModal,
658
- children: [/*#__PURE__*/jsx(Modal.Header, {
659
- children: /*#__PURE__*/jsx(Typography, {
660
- style: "h2",
661
- children: t("neetoPayments.export.title.".concat(kind))
662
- })
663
- }), /*#__PURE__*/jsx(Modal.Body, {
664
- children: isFileLoading ? /*#__PURE__*/jsx(Typography, {
665
- style: "body2",
666
- children: t("neetoPayments.export.pleaseWait")
667
- }) : /*#__PURE__*/jsx(Typography, {
668
- style: "body2",
669
- children: downloadUrl ? t("neetoPayments.export.fileReady") : t("neetoPayments.export.download.".concat(kind))
670
- })
671
- }), /*#__PURE__*/jsx(Modal.Footer, {
672
- className: "space-x-2",
673
- children: downloadUrl ? /*#__PURE__*/jsx(Button, {
674
- href: downloadUrl,
675
- icon: Download,
676
- label: t("neetoPayments.common.download"),
677
- onClick: onClose
678
- }) : /*#__PURE__*/jsxs(Fragment, {
679
- children: [/*#__PURE__*/jsx(Button, {
680
- disabled: isFileLoading,
681
- label: t("neetoPayments.common.cancel"),
682
- style: "tertiary",
683
- onClick: onClose
684
- }), /*#__PURE__*/jsx(Button, {
685
- disabled: isFileLoading,
686
- label: t("neetoPayments.common.export"),
687
- loading: isFileLoading,
688
- onClick: handleGenerateClick
689
- })]
690
- })
691
- })]
692
- });
693
- };
694
-
695
- 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 };
696
- //# sourceMappingURL=ExportModal-cXO0UDiA.js.map