@bigbinary/neeto-payments-frontend 2.2.0 → 2.2.2

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 (190) hide show
  1. package/app/javascript/src/translations/en.json +11 -2
  2. package/dist/AccountsDashboard.js +368 -302
  3. package/dist/AccountsDashboard.js.map +1 -1
  4. package/dist/CopyButtonWrapper-54c5e270.js +27 -0
  5. package/dist/CopyButtonWrapper-54c5e270.js.map +1 -0
  6. package/dist/Dashboard.js +532 -440
  7. package/dist/Dashboard.js.map +1 -1
  8. package/dist/ExportModal-e95e0af1.js +694 -0
  9. package/dist/ExportModal-e95e0af1.js.map +1 -0
  10. package/dist/IdentifierButton-350fcc55.js +19 -0
  11. package/dist/IdentifierButton-350fcc55.js.map +1 -0
  12. package/dist/PaymentKindRestrictionAlert.js +18 -12
  13. package/dist/PaymentKindRestrictionAlert.js.map +1 -1
  14. package/dist/PaymentsDashboard.js +474 -0
  15. package/dist/PaymentsDashboard.js.map +1 -0
  16. package/dist/PayoutsDashboard.js +373 -315
  17. package/dist/PayoutsDashboard.js.map +1 -1
  18. package/dist/PayoutsPage.js +136 -112
  19. package/dist/PayoutsPage.js.map +1 -1
  20. package/dist/RazorpayDashboard.js +184 -172
  21. package/dist/RazorpayDashboard.js.map +1 -1
  22. package/dist/RazorpayPaymentButton.js +92 -66
  23. package/dist/RazorpayPaymentButton.js.map +1 -1
  24. package/dist/StripeConnect.js +359 -318
  25. package/dist/StripeConnect.js.map +1 -1
  26. package/dist/UpiConnect.js +128 -106
  27. package/dist/UpiConnect.js.map +1 -1
  28. package/dist/UpiMarkAsPaidButton.js +22 -21
  29. package/dist/UpiMarkAsPaidButton.js.map +1 -1
  30. package/dist/UpiPayment.js +75 -63
  31. package/dist/UpiPayment.js.map +1 -1
  32. package/dist/V2PaymentsDashboard.js +185 -176
  33. package/dist/V2PaymentsDashboard.js.map +1 -1
  34. package/dist/_commonjsHelpers-ae89b920.js +6 -0
  35. package/dist/_commonjsHelpers-ae89b920.js.map +1 -0
  36. package/dist/buildStripeTransactionLink.js +2 -2
  37. package/dist/cjs/AccountsDashboard.js +369 -303
  38. package/dist/cjs/AccountsDashboard.js.map +1 -1
  39. package/dist/cjs/CopyButtonWrapper-57331e1c.js +34 -0
  40. package/dist/cjs/CopyButtonWrapper-57331e1c.js.map +1 -0
  41. package/dist/cjs/Dashboard.js +533 -441
  42. package/dist/cjs/Dashboard.js.map +1 -1
  43. package/dist/cjs/ExportModal-730a91b8.js +718 -0
  44. package/dist/cjs/ExportModal-730a91b8.js.map +1 -0
  45. package/dist/cjs/IdentifierButton-3162ff10.js +25 -0
  46. package/dist/cjs/IdentifierButton-3162ff10.js.map +1 -0
  47. package/dist/cjs/PaymentKindRestrictionAlert.js +18 -12
  48. package/dist/cjs/PaymentKindRestrictionAlert.js.map +1 -1
  49. package/dist/cjs/PaymentsDashboard.js +492 -0
  50. package/dist/cjs/PaymentsDashboard.js.map +1 -0
  51. package/dist/cjs/PayoutsDashboard.js +374 -316
  52. package/dist/cjs/PayoutsDashboard.js.map +1 -1
  53. package/dist/cjs/PayoutsPage.js +136 -112
  54. package/dist/cjs/PayoutsPage.js.map +1 -1
  55. package/dist/cjs/RazorpayDashboard.js +185 -173
  56. package/dist/cjs/RazorpayDashboard.js.map +1 -1
  57. package/dist/cjs/RazorpayPaymentButton.js +92 -66
  58. package/dist/cjs/RazorpayPaymentButton.js.map +1 -1
  59. package/dist/cjs/StripeConnect.js +356 -315
  60. package/dist/cjs/StripeConnect.js.map +1 -1
  61. package/dist/cjs/UpiConnect.js +129 -107
  62. package/dist/cjs/UpiConnect.js.map +1 -1
  63. package/dist/cjs/UpiMarkAsPaidButton.js +22 -21
  64. package/dist/cjs/UpiMarkAsPaidButton.js.map +1 -1
  65. package/dist/cjs/UpiPayment.js +75 -63
  66. package/dist/cjs/UpiPayment.js.map +1 -1
  67. package/dist/cjs/V2PaymentsDashboard.js +186 -177
  68. package/dist/cjs/V2PaymentsDashboard.js.map +1 -1
  69. package/dist/cjs/_commonjsHelpers-755157d3.js +8 -0
  70. package/dist/cjs/_commonjsHelpers-755157d3.js.map +1 -0
  71. package/dist/cjs/buildStripeTransactionLink.js +1 -1
  72. package/dist/cjs/constants.js +12 -12
  73. package/dist/cjs/constants.js.map +1 -1
  74. package/dist/cjs/defineProperty-f3094d6c.js +45 -0
  75. package/dist/cjs/defineProperty-f3094d6c.js.map +1 -0
  76. package/dist/cjs/exportChannel-2d528a51.js +45 -0
  77. package/dist/cjs/{exportChannel-1c3103ef.js.map → exportChannel-2d528a51.js.map} +1 -1
  78. package/dist/cjs/{index-b7badf96.js → index-1ce7ebb8.js} +8 -8
  79. package/dist/cjs/{index-b7badf96.js.map → index-1ce7ebb8.js.map} +1 -1
  80. package/dist/cjs/index-6f9eb83b.js +387 -0
  81. package/dist/cjs/index-6f9eb83b.js.map +1 -0
  82. package/dist/cjs/index-8a575dd1.js +47 -0
  83. package/dist/cjs/index-8a575dd1.js.map +1 -0
  84. package/dist/cjs/index.js +31 -22
  85. package/dist/cjs/index.js.map +1 -1
  86. package/dist/cjs/objectWithoutProperties-2fed2d7d.js +33 -0
  87. package/dist/cjs/objectWithoutProperties-2fed2d7d.js.map +1 -0
  88. package/dist/cjs/{queryConstants-45f84f3e.js → queryConstants-cb79f600.js} +4 -3
  89. package/dist/cjs/queryConstants-cb79f600.js.map +1 -0
  90. package/dist/cjs/renderFunctions-0284d0cb.js +159 -0
  91. package/dist/cjs/renderFunctions-0284d0cb.js.map +1 -0
  92. package/dist/cjs/slicedToArray-f320d9e7.js +61 -0
  93. package/dist/cjs/slicedToArray-f320d9e7.js.map +1 -0
  94. package/dist/cjs/toConsumableArray-9abb3858.js +22 -0
  95. package/dist/cjs/toConsumableArray-9abb3858.js.map +1 -0
  96. package/dist/cjs/{useConnectApi-a80cbf88.js → useConnectApi-67c912ae.js} +106 -85
  97. package/dist/cjs/useConnectApi-67c912ae.js.map +1 -0
  98. package/dist/cjs/useFiltersAndPagination-cd8bd491.js +316 -0
  99. package/dist/cjs/useFiltersAndPagination-cd8bd491.js.map +1 -0
  100. package/dist/cjs/usePaymentApi-7c41a34a.js +57 -0
  101. package/dist/cjs/usePaymentApi-7c41a34a.js.map +1 -0
  102. package/dist/cjs/usePaymentsApi-f53c5543.js +45 -0
  103. package/dist/cjs/usePaymentsApi-f53c5543.js.map +1 -0
  104. package/dist/cjs/usePlatformApi-365cf2dc.js +149 -0
  105. package/dist/cjs/usePlatformApi-365cf2dc.js.map +1 -0
  106. package/dist/cjs/useRazorpayPayment.js +70 -48
  107. package/dist/cjs/useRazorpayPayment.js.map +1 -1
  108. package/dist/cjs/useStripePromise.js +41 -16
  109. package/dist/cjs/useStripePromise.js.map +1 -1
  110. package/dist/constants.js +12 -12
  111. package/dist/constants.js.map +1 -1
  112. package/dist/defineProperty-e90a259c.js +43 -0
  113. package/dist/defineProperty-e90a259c.js.map +1 -0
  114. package/dist/exportChannel-e33c4c66.js +38 -0
  115. package/dist/{exportChannel-23e4628c.js.map → exportChannel-e33c4c66.js.map} +1 -1
  116. package/dist/index-1fdfa272.js +384 -0
  117. package/dist/index-1fdfa272.js.map +1 -0
  118. package/dist/{index-1aedc364.js → index-adf12baa.js} +8 -8
  119. package/dist/{index-1aedc364.js.map → index-adf12baa.js.map} +1 -1
  120. package/dist/index-f03e9537.js +38 -0
  121. package/dist/index-f03e9537.js.map +1 -0
  122. package/dist/index.js +29 -21
  123. package/dist/index.js.map +1 -1
  124. package/dist/objectWithoutProperties-a0edb288.js +31 -0
  125. package/dist/objectWithoutProperties-a0edb288.js.map +1 -0
  126. package/dist/{queryConstants-7d91832f.js → queryConstants-fada3549.js} +4 -3
  127. package/dist/queryConstants-fada3549.js.map +1 -0
  128. package/dist/renderFunctions-3640a4cf.js +143 -0
  129. package/dist/renderFunctions-3640a4cf.js.map +1 -0
  130. package/dist/slicedToArray-b4278ecd.js +57 -0
  131. package/dist/slicedToArray-b4278ecd.js.map +1 -0
  132. package/dist/toConsumableArray-1cc38429.js +20 -0
  133. package/dist/toConsumableArray-1cc38429.js.map +1 -0
  134. package/dist/{useConnectApi-36a92bd8.js → useConnectApi-b4fc32db.js} +107 -86
  135. package/dist/useConnectApi-b4fc32db.js.map +1 -0
  136. package/dist/useFiltersAndPagination-d14df27d.js +302 -0
  137. package/dist/useFiltersAndPagination-d14df27d.js.map +1 -0
  138. package/dist/usePaymentApi-433482f2.js +50 -0
  139. package/dist/usePaymentApi-433482f2.js.map +1 -0
  140. package/dist/usePaymentsApi-e95b2517.js +38 -0
  141. package/dist/usePaymentsApi-e95b2517.js.map +1 -0
  142. package/dist/usePlatformApi-9711698e.js +137 -0
  143. package/dist/usePlatformApi-9711698e.js.map +1 -0
  144. package/dist/useRazorpayPayment.js +70 -48
  145. package/dist/useRazorpayPayment.js.map +1 -1
  146. package/dist/useStripePromise.js +41 -16
  147. package/dist/useStripePromise.js.map +1 -1
  148. package/package.json +1 -1
  149. package/dist/ExportModal-23f4fa34.js +0 -645
  150. package/dist/ExportModal-23f4fa34.js.map +0 -1
  151. package/dist/IdentifierButton-81450a91.js +0 -20
  152. package/dist/IdentifierButton-81450a91.js.map +0 -1
  153. package/dist/cjs/ExportModal-b94a33bf.js +0 -669
  154. package/dist/cjs/ExportModal-b94a33bf.js.map +0 -1
  155. package/dist/cjs/IdentifierButton-c5f8ded9.js +0 -26
  156. package/dist/cjs/IdentifierButton-c5f8ded9.js.map +0 -1
  157. package/dist/cjs/exportChannel-1c3103ef.js +0 -39
  158. package/dist/cjs/extends-1b35a664.js +0 -19
  159. package/dist/cjs/extends-1b35a664.js.map +0 -1
  160. package/dist/cjs/index-e317e851.js +0 -41
  161. package/dist/cjs/index-e317e851.js.map +0 -1
  162. package/dist/cjs/queryConstants-45f84f3e.js.map +0 -1
  163. package/dist/cjs/renderFunctions-621282bb.js +0 -165
  164. package/dist/cjs/renderFunctions-621282bb.js.map +0 -1
  165. package/dist/cjs/useConnectApi-a80cbf88.js.map +0 -1
  166. package/dist/cjs/useFiltersAndPagination-98eb45d6.js +0 -276
  167. package/dist/cjs/useFiltersAndPagination-98eb45d6.js.map +0 -1
  168. package/dist/cjs/usePaymentApi-77803596.js +0 -48
  169. package/dist/cjs/usePaymentApi-77803596.js.map +0 -1
  170. package/dist/cjs/usePaymentsApi-239e8d8a.js +0 -36
  171. package/dist/cjs/usePaymentsApi-239e8d8a.js.map +0 -1
  172. package/dist/cjs/usePlatformApi-6740cf80.js +0 -117
  173. package/dist/cjs/usePlatformApi-6740cf80.js.map +0 -1
  174. package/dist/exportChannel-23e4628c.js +0 -32
  175. package/dist/extends-093996c9.js +0 -17
  176. package/dist/extends-093996c9.js.map +0 -1
  177. package/dist/index-385083ef.js +0 -32
  178. package/dist/index-385083ef.js.map +0 -1
  179. package/dist/queryConstants-7d91832f.js.map +0 -1
  180. package/dist/renderFunctions-ac5ef9d0.js +0 -146
  181. package/dist/renderFunctions-ac5ef9d0.js.map +0 -1
  182. package/dist/useConnectApi-36a92bd8.js.map +0 -1
  183. package/dist/useFiltersAndPagination-8813cdb2.js +0 -262
  184. package/dist/useFiltersAndPagination-8813cdb2.js.map +0 -1
  185. package/dist/usePaymentApi-edc45d99.js +0 -41
  186. package/dist/usePaymentApi-edc45d99.js.map +0 -1
  187. package/dist/usePaymentsApi-663c4058.js +0 -29
  188. package/dist/usePaymentsApi-663c4058.js.map +0 -1
  189. package/dist/usePlatformApi-3faabc82.js +0 -105
  190. package/dist/usePlatformApi-3faabc82.js.map +0 -1
@@ -1,645 +0,0 @@
1
- import { useState, useMemo, useEffect } from 'react';
2
- import Download from '@bigbinary/neeto-icons/Download';
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 { useMutation } from '@tanstack/react-query';
8
- import axios from 'axios';
9
- import { BASE_URL } from './constants.js';
10
- import { u as useExportData, e as exportChannel } from './exportChannel-23e4628c.js';
11
- import { a as buildStripeTransactionLink, c as buildStripeSplitLink, d as buildStripeTransferLink, b as buildStripeAccountLink, e as buildStripeRefundLink, u as uuidV4 } from './index-385083ef.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-ac5ef9d0.js';
18
- import { I as IdentifierButton } from './IdentifierButton-81450a91.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.createElement(CopyButtonWrapper, {
36
- content: identifier
37
- }, /*#__PURE__*/React.createElement(IdentifierButton, {
38
- href: buildStripeTransactionLink(identifier, isLive),
39
- label: identifier
40
- }));
41
- };
42
- curry((type, kind) => /*#__PURE__*/React.createElement(Tooltip, {
43
- content: t(`neetoPayments.tooltipContent.${type}.${kind}`),
44
- position: "top"
45
- }, /*#__PURE__*/React.createElement("div", {
46
- className: "w-fit"
47
- }, /*#__PURE__*/React.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.createElement(CopyButtonWrapper, {
57
- content: identifier
58
- }, /*#__PURE__*/React.createElement(IdentifierButton, {
59
- href: buildStripeSplitLink(identifier, isLive),
60
- label: identifier
61
- })) : /*#__PURE__*/React.createElement(Tooltip, {
62
- content: t("neetoPayments.tooltipContent.identifierUnavailable"),
63
- position: "top"
64
- }, /*#__PURE__*/React.createElement("div", {
65
- className: "text-center"
66
- }, /*#__PURE__*/React.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.createElement(CopyButtonWrapper, {
77
- content: identifier
78
- }, /*#__PURE__*/React.createElement(IdentifierButton, {
79
- label: identifier,
80
- href: identifier.startsWith("py") ? buildStripeTransferLink(identifier, account?.identifier, isLive) : buildStripeTransactionLink(identifier, isLive)
81
- })) : /*#__PURE__*/React.createElement("div", {
82
- className: "text-center"
83
- }, /*#__PURE__*/React.createElement(Tooltip, {
84
- position: "top",
85
- content: t("neetoPayments.tooltipContent.connectedTransactionUnavailable")
86
- }, /*#__PURE__*/React.createElement(Typography, {
87
- style: "body2"
88
- }, t("neetoPayments.common.notAvailable"))));
89
- };
90
- const renderPlatformIdentifier = curry((setPaneStatus, data) => /*#__PURE__*/React.createElement(CopyButtonWrapper, {
91
- content: data?.identifier
92
- }, /*#__PURE__*/React.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.createElement(CopyButtonWrapper, {
107
- content: identifier
108
- }, /*#__PURE__*/React.createElement(IdentifierButton, {
109
- href: buildStripeAccountLink(identifier, isLive),
110
- label: identifier
111
- }));
112
- };
113
- const renderSplitDate = date => isPresent(date) ? renderDate(date) : /*#__PURE__*/React.createElement(Tooltip, {
114
- content: t("neetoPayments.tooltipContent.dateUnavailable"),
115
- position: "top"
116
- }, /*#__PURE__*/React.createElement("div", {
117
- className: "text-center"
118
- }, /*#__PURE__*/React.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.createElement(CopyButtonWrapper, {
127
- content: identifier
128
- }, /*#__PURE__*/React.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.platformShare"),
205
- dataIndex: "platformShare",
206
- key: "platformShare",
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
- platformShare: {
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
- isPending: isRazorpayLoading
567
- } = useExportRazorpayData();
568
- const {
569
- mutate: exportCsv,
570
- isPending
571
- } = useExportData();
572
- const isFileLoading = isPending || 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.createElement(Modal, {
616
- onClose,
617
- isOpen: showExportModal
618
- }, /*#__PURE__*/React.createElement(Modal.Header, null, /*#__PURE__*/React.createElement(Typography, {
619
- style: "h2"
620
- }, t(`neetoPayments.export.title.${kind}`))), /*#__PURE__*/React.createElement(Modal.Body, null, isFileLoading ? /*#__PURE__*/React.createElement(Typography, {
621
- style: "body2"
622
- }, t("neetoPayments.export.pleaseWait")) : /*#__PURE__*/React.createElement(Typography, {
623
- style: "body2"
624
- }, downloadUrl ? t("neetoPayments.export.fileReady") : t(`neetoPayments.export.download.${kind}`))), /*#__PURE__*/React.createElement(Modal.Footer, {
625
- className: "space-x-2"
626
- }, downloadUrl ? /*#__PURE__*/React.createElement(Button, {
627
- href: downloadUrl,
628
- icon: Download,
629
- label: t("neetoPayments.common.download"),
630
- onClick: onClose
631
- }) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
632
- disabled: isFileLoading,
633
- label: t("neetoPayments.common.cancel"),
634
- style: "tertiary",
635
- onClick: onClose
636
- }), /*#__PURE__*/React.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-23f4fa34.js.map