@bigbinary/neeto-payments-frontend 1.5.0-beta1 → 1.6.0-beta2

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