@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
@@ -0,0 +1,694 @@
1
+ import { _ as _defineProperty } from './defineProperty-e90a259c.js';
2
+ import { _ as _slicedToArray } from './slicedToArray-b4278ecd.js';
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 { BASE_URL } from './constants.js';
12
+ import { u as useExportData, e as exportChannel } from './exportChannel-e33c4c66.js';
13
+ import { a as buildStripeTransactionLink, c as buildStripeSplitLink, d as buildStripeTransferLink, b as buildStripeAccountLink, e as buildStripeRefundLink, u as uuidV4 } from './index-f03e9537.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-54c5e270.js';
20
+ import { c as renderDate, r as renderStatus } from './renderFunctions-3640a4cf.js';
21
+ import { I as IdentifierButton } from './IdentifierButton-350fcc55.js';
22
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
23
+ import { K as KIND, A as APPENDABLE_SEARCH_PROPS } from './index-adf12baa.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: "72px",
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_intent.amount",
501
+ model: "NeetoPaymentsEngine::Stripe::Transaction",
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$key2;
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$key2 = _COLUMN_METADATA$key2.isHidden) !== null && _COLUMN_METADATA$key2 !== void 0 && _COLUMN_METADATA$key2[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;
555
+ var key = _ref4.key;
556
+ return !((_COLUMN_METADATA$snak = COLUMN_METADATA[snakeToCamelCase(key)]) !== null && _COLUMN_METADATA$snak !== void 0 && (_COLUMN_METADATA$snak = _COLUMN_METADATA$snak.isHidden) !== null && _COLUMN_METADATA$snak !== void 0 && _COLUMN_METADATA$snak[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-e95e0af1.js.map