@bigbinary/neeto-payments-frontend 2.2.3 → 2.2.4

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 (50) hide show
  1. package/app/javascript/src/translations/en.json +14 -0
  2. package/dist/AccountsDashboard.js +1 -1
  3. package/dist/Dashboard.js +3 -3
  4. package/dist/PaymentsDashboard.js +1 -1
  5. package/dist/PayoutsDashboard.js +3 -3
  6. package/dist/PayoutsPage.js +3 -3
  7. package/dist/RazorpayDashboard.js +2 -2
  8. package/dist/RazorpayPaymentButton.js +2 -2
  9. package/dist/RefundsDashboard.js +1 -1
  10. package/dist/SplitTransfersDashboard.js +469 -0
  11. package/dist/SplitTransfersDashboard.js.map +1 -0
  12. package/dist/StripeConnect.js +2 -2
  13. package/dist/V2PaymentsDashboard.js +1 -1
  14. package/dist/cjs/AccountsDashboard.js +1 -1
  15. package/dist/cjs/Dashboard.js +3 -3
  16. package/dist/cjs/PaymentsDashboard.js +1 -1
  17. package/dist/cjs/PayoutsDashboard.js +3 -3
  18. package/dist/cjs/PayoutsPage.js +3 -3
  19. package/dist/cjs/RazorpayDashboard.js +2 -2
  20. package/dist/cjs/RazorpayPaymentButton.js +2 -2
  21. package/dist/cjs/RefundsDashboard.js +1 -1
  22. package/dist/cjs/SplitTransfersDashboard.js +487 -0
  23. package/dist/cjs/SplitTransfersDashboard.js.map +1 -0
  24. package/dist/cjs/StripeConnect.js +2 -2
  25. package/dist/cjs/V2PaymentsDashboard.js +1 -1
  26. package/dist/cjs/index.js +10 -8
  27. package/dist/cjs/index.js.map +1 -1
  28. package/dist/cjs/{queryConstants-cb79f600.js → queryConstants-d80b151c.js} +3 -2
  29. package/dist/cjs/queryConstants-d80b151c.js.map +1 -0
  30. package/dist/cjs/{useConnectApi-461efc99.js → useConnectApi-4797829f.js} +2 -2
  31. package/dist/cjs/{useConnectApi-461efc99.js.map → useConnectApi-4797829f.js.map} +1 -1
  32. package/dist/cjs/{usePaymentApi-43379fc8.js → usePaymentApi-1a8e6623.js} +2 -2
  33. package/dist/cjs/{usePaymentApi-43379fc8.js.map → usePaymentApi-1a8e6623.js.map} +1 -1
  34. package/dist/cjs/{usePlatformApi-58333b71.js → usePlatformApi-662f51cd.js} +3 -3
  35. package/dist/cjs/{usePlatformApi-58333b71.js.map → usePlatformApi-662f51cd.js.map} +1 -1
  36. package/dist/cjs/useRazorpayPayment.js +2 -2
  37. package/dist/index.js +7 -6
  38. package/dist/index.js.map +1 -1
  39. package/dist/{queryConstants-fada3549.js → queryConstants-65ca40bc.js} +3 -2
  40. package/dist/queryConstants-65ca40bc.js.map +1 -0
  41. package/dist/{useConnectApi-810f227f.js → useConnectApi-cf9948b8.js} +2 -2
  42. package/dist/{useConnectApi-810f227f.js.map → useConnectApi-cf9948b8.js.map} +1 -1
  43. package/dist/{usePaymentApi-62ed9caf.js → usePaymentApi-38cda648.js} +2 -2
  44. package/dist/{usePaymentApi-62ed9caf.js.map → usePaymentApi-38cda648.js.map} +1 -1
  45. package/dist/{usePlatformApi-7bed6a63.js → usePlatformApi-08dd26c1.js} +3 -3
  46. package/dist/{usePlatformApi-7bed6a63.js.map → usePlatformApi-08dd26c1.js.map} +1 -1
  47. package/dist/useRazorpayPayment.js +2 -2
  48. package/package.json +11 -11
  49. package/dist/cjs/queryConstants-cb79f600.js.map +0 -1
  50. package/dist/queryConstants-fada3549.js.map +0 -1
@@ -7,6 +7,7 @@
7
7
  "id": "ID",
8
8
  "identifier": "Identifier",
9
9
  "amount": "Amount",
10
+ "currency": "Currency",
10
11
  "platformShare": "Platform share",
11
12
  "status": "Status",
12
13
  "paymentTime": "Payment time",
@@ -74,6 +75,7 @@
74
75
  "connected": "Stripe transactions",
75
76
  "platform": "Stripe transactions",
76
77
  "split": "Stripe split transfers",
78
+ "splitTransfers": "Split transfers",
77
79
  "transfer": "Stripe standard transactions",
78
80
  "refund": "Stripe refunds",
79
81
  "account": "Standard accounts",
@@ -88,6 +90,8 @@
88
90
  "connectedWithStatus": "There are no {{status}} transactions.",
89
91
  "platform": "There are no transactions.",
90
92
  "platformWithStatus": "There are no {{status}} transactions.",
93
+ "splitTransfers": "There are no split transfers.",
94
+ "splitTransfersWithStatus": "There are no {{status}} split transfers.",
91
95
  "split": "There are no split transfers.",
92
96
  "splitWithStatus": "There are no {{status}} split transfers.",
93
97
  "transfer": "There are no transactions.",
@@ -166,6 +170,12 @@
166
170
  "pending": "pending",
167
171
  "cancelled": "cancelled",
168
172
  "initiated": "initiated"
173
+ },
174
+ "splitTransfers": {
175
+ "successful": "successful",
176
+ "pending": "pending",
177
+ "cancelled": "cancelled",
178
+ "initiated": "initiated"
169
179
  }
170
180
  },
171
181
  "tooltipContent": {
@@ -250,6 +260,10 @@
250
260
  "split_other": "{{count}} split transfers",
251
261
  "splitWithStatus": "{{count}} {{status}} split transfer",
252
262
  "splitWithStatus_other": "{{count}} {{status}} split transfers",
263
+ "splitTransfer": "{{count}} split transfer",
264
+ "splitTransfer_other": "{{count}} split transfers",
265
+ "splitTransferWithStatus": "{{count}} {{status}} split transfer",
266
+ "splitTransferWithStatus_other": "{{count}} {{status}} split transfers",
253
267
  "transfer": "{{count}} transaction",
254
268
  "transfer_other": "{{count}} transactions",
255
269
  "transferWithStatus": "{{count}} {{status}} transaction",
@@ -32,7 +32,7 @@ import Table from '@bigbinary/neetoui/Table';
32
32
  import NoData from '@bigbinary/neetoui/NoData';
33
33
  import { useQuery } from '@tanstack/react-query';
34
34
  import axios from 'axios';
35
- import { Q as QUERY_KEYS } from './queryConstants-fada3549.js';
35
+ import { Q as QUERY_KEYS } from './queryConstants-65ca40bc.js';
36
36
  import '@tanstack/react-query-devtools';
37
37
  import '@bigbinary/neeto-molecules/DateFormat';
38
38
  import '@bigbinary/neetoui/Tag';
package/dist/Dashboard.js CHANGED
@@ -25,8 +25,8 @@ import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
25
25
  import TableWrapper from '@bigbinary/neeto-molecules/TableWrapper';
26
26
  import Table from '@bigbinary/neetoui/Table';
27
27
  import NoData from '@bigbinary/neetoui/NoData';
28
- import { u as useFetchStripeTransactions, a as useFetchConnectedStripeAccount } from './useConnectApi-810f227f.js';
29
- import { u as useFetchStripeRefunds, a as useFetchStripePlatformTransactions, b as useFetchStripePlatformSplits, c as useFetchStripePlatformTransaction, d as useFetchStripePlatformAccount } from './usePlatformApi-7bed6a63.js';
28
+ import { u as useFetchStripeTransactions, a as useFetchConnectedStripeAccount } from './useConnectApi-cf9948b8.js';
29
+ import { u as useFetchStripeRefunds, a as useFetchStripePlatformTransactions, b as useFetchStripePlatformSplits, c as useFetchStripePlatformTransaction, d as useFetchStripePlatformAccount } from './usePlatformApi-08dd26c1.js';
30
30
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
31
31
  import Down from '@bigbinary/neeto-icons/Down';
32
32
  import Right from '@bigbinary/neeto-icons/Right';
@@ -47,7 +47,7 @@ import './exportChannel-6c2f46b6.js';
47
47
  import './IdentifierButton-350fcc55.js';
48
48
  import './_commonjsHelpers-ae89b920.js';
49
49
  import 'util';
50
- import './queryConstants-fada3549.js';
50
+ import './queryConstants-65ca40bc.js';
51
51
 
52
52
  function ownKeys$4(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; }
53
53
  function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -8,7 +8,7 @@ import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
8
8
  import { useQuery } from '@tanstack/react-query';
9
9
  import axios from 'axios';
10
10
  import { BASE_URL, PAYMENT_PROVIDERS, DEFAULT_TAG_STYLE, SORT_DIRECTIONS, DEFAULT_SORT_PROPERTIES, UN_HIDEABLE_COLUMNS, DEFAULT_PAGE_VALUES } from './constants.js';
11
- import { Q as QUERY_KEYS } from './queryConstants-fada3549.js';
11
+ import { Q as QUERY_KEYS } from './queryConstants-65ca40bc.js';
12
12
  import { t } from 'i18next';
13
13
  import { toLabelAndValue, snakeToCamelCase, humanize, removeBy, isNotPresent, isPresent, camelToSnakeCase } from '@bigbinary/neeto-cist';
14
14
  import { map, curry, mergeDeepWith, concat, mergeLeft, reject, isNil, prop, sortBy, isEmpty, modify } from 'ramda';
@@ -29,8 +29,8 @@ import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
29
29
  import TableWrapper from '@bigbinary/neeto-molecules/TableWrapper';
30
30
  import Table from '@bigbinary/neetoui/Table';
31
31
  import NoData from '@bigbinary/neetoui/NoData';
32
- import { b as useFetchStripePayouts } from './useConnectApi-810f227f.js';
33
- import { e as useFetchStripePlatformPayouts } from './usePlatformApi-7bed6a63.js';
32
+ import { b as useFetchStripePayouts } from './useConnectApi-cf9948b8.js';
33
+ import { e as useFetchStripePlatformPayouts } from './usePlatformApi-08dd26c1.js';
34
34
  import '@tanstack/react-query';
35
35
  import '@tanstack/react-query-devtools';
36
36
  import '@bigbinary/neeto-molecules/DateFormat';
@@ -40,7 +40,7 @@ import 'axios';
40
40
  import '@bigbinary/neeto-molecules/CopyToClipboardButton';
41
41
  import './_commonjsHelpers-ae89b920.js';
42
42
  import 'util';
43
- import './queryConstants-fada3549.js';
43
+ import './queryConstants-65ca40bc.js';
44
44
 
45
45
  var TAB = {
46
46
  all: "all",
@@ -7,8 +7,8 @@ import Typography from '@bigbinary/neetoui/Typography';
7
7
  import { useTranslation } from 'react-i18next';
8
8
  import { useParams } from 'react-router-dom/cjs/react-router-dom';
9
9
  import { r as renderStatus, c as renderDate } from './renderFunctions-3b5b070e.js';
10
- import { c as useShowStripePayout } from './useConnectApi-810f227f.js';
11
- import { f as useShowStripePlatformPayout } from './usePlatformApi-7bed6a63.js';
10
+ import { c as useShowStripePayout } from './useConnectApi-cf9948b8.js';
11
+ import { f as useShowStripePlatformPayout } from './usePlatformApi-08dd26c1.js';
12
12
  import { C as CopyButtonWrapper } from './CopyButtonWrapper-54c5e270.js';
13
13
  import { I as IdentifierButton } from './IdentifierButton-350fcc55.js';
14
14
  import { f as buildStripePayoutLink } from './index-bb5e255a.js';
@@ -28,7 +28,7 @@ import '@bigbinary/neeto-commons-frontend/react-utils';
28
28
  import 'axios';
29
29
  import './_commonjsHelpers-ae89b920.js';
30
30
  import 'util';
31
- import './queryConstants-fada3549.js';
31
+ import './queryConstants-65ca40bc.js';
32
32
  import '@bigbinary/neeto-molecules/CopyToClipboardButton';
33
33
  import 'react';
34
34
  import './slicedToArray-b4278ecd.js';
@@ -19,8 +19,8 @@ import { useHistory } from 'react-router-dom';
19
19
  import { useQuery } from '@tanstack/react-query';
20
20
  import axios from 'axios';
21
21
  import { BASE_URL, SORT_DIRECTIONS, DEFAULT_SORT_PROPERTIES } from './constants.js';
22
- import { Q as QUERY_KEYS } from './queryConstants-fada3549.js';
23
- import { u as useFetchRazorpayPayments } from './usePaymentApi-62ed9caf.js';
22
+ import { Q as QUERY_KEYS } from './queryConstants-65ca40bc.js';
23
+ import { u as useFetchRazorpayPayments } from './usePaymentApi-38cda648.js';
24
24
  import { p as processDataIndex } from './index-bb5e255a.js';
25
25
  import { jsx, jsxs } from 'react/jsx-runtime';
26
26
  import '@bigbinary/neeto-filters-frontend';
@@ -3,14 +3,14 @@ import { noop, findBy, isNotPresent } from '@bigbinary/neeto-cist';
3
3
  import Button from '@bigbinary/neetoui/Button';
4
4
  import { mergeDeepLeft } from 'ramda';
5
5
  import { useTranslation } from 'react-i18next';
6
- import { a as useCreateRazorpayPayment } from './usePaymentApi-62ed9caf.js';
6
+ import { a as useCreateRazorpayPayment } from './usePaymentApi-38cda648.js';
7
7
  import { RAZORPAY_PAYMENT_BUTTON_OPTIONS } from './constants.js';
8
8
  import { jsx } from 'react/jsx-runtime';
9
9
  import './_commonjsHelpers-ae89b920.js';
10
10
  import './defineProperty-e90a259c.js';
11
11
  import '@tanstack/react-query';
12
12
  import 'axios';
13
- import './queryConstants-fada3549.js';
13
+ import './queryConstants-65ca40bc.js';
14
14
  import 'i18next';
15
15
  import '@bigbinary/neeto-commons-frontend/constants';
16
16
 
@@ -8,7 +8,7 @@ import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
8
8
  import { useQuery } from '@tanstack/react-query';
9
9
  import axios from 'axios';
10
10
  import { BASE_URL, PAYMENT_PROVIDERS, DEFAULT_TAG_STYLE, SORT_DIRECTIONS, DEFAULT_SORT_PROPERTIES, UN_HIDEABLE_COLUMNS, DEFAULT_PAGE_VALUES } from './constants.js';
11
- import { Q as QUERY_KEYS } from './queryConstants-fada3549.js';
11
+ import { Q as QUERY_KEYS } from './queryConstants-65ca40bc.js';
12
12
  import { t } from 'i18next';
13
13
  import { toLabelAndValue, snakeToCamelCase, humanize, removeBy, isNotPresent, isPresent, camelToSnakeCase } from '@bigbinary/neeto-cist';
14
14
  import { map, curry, mergeDeepWith, concat, mergeLeft, reject, isNil, prop, sortBy, isEmpty, modify } from 'ramda';
@@ -0,0 +1,469 @@
1
+ import { _ as _defineProperty } from './defineProperty-e90a259c.js';
2
+ import { _ as _toConsumableArray } from './toConsumableArray-1cc38429.js';
3
+ import { _ as _slicedToArray } from './slicedToArray-b4278ecd.js';
4
+ import { useState, startTransition } from 'react';
5
+ import { getQueryParams, buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
6
+ import { Bar, buildFiltersFromURL } from '@bigbinary/neeto-filters-frontend';
7
+ import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
8
+ import { useQuery } from '@tanstack/react-query';
9
+ import axios from 'axios';
10
+ import { BASE_URL, DEFAULT_TAG_STYLE, SORT_DIRECTIONS, DEFAULT_SORT_PROPERTIES, UN_HIDEABLE_COLUMNS, DEFAULT_PAGE_VALUES } from './constants.js';
11
+ import { Q as QUERY_KEYS } from './queryConstants-65ca40bc.js';
12
+ import { t } from 'i18next';
13
+ import { snakeToCamelCase, removeBy, isNotPresent, isPresent, camelToSnakeCase } from '@bigbinary/neeto-cist';
14
+ import { useHiddenColumns } from '@bigbinary/neeto-molecules/Columns';
15
+ import TableWrapper from '@bigbinary/neeto-molecules/TableWrapper';
16
+ import Table from '@bigbinary/neetoui/Table';
17
+ import NoData from '@bigbinary/neetoui/NoData';
18
+ import { curry, mergeDeepWith, concat, mergeLeft, reject, isNil, map, prop, sortBy, isEmpty, modify } from 'ramda';
19
+ import { useTranslation } from 'react-i18next';
20
+ import { useHistory } from 'react-router-dom';
21
+ import { p as processDataIndex } from './index-bb5e255a.js';
22
+ import DateFormat from '@bigbinary/neeto-molecules/DateFormat';
23
+ import Button from '@bigbinary/neetoui/Button';
24
+ import Tag from '@bigbinary/neetoui/Tag';
25
+ import Tooltip from '@bigbinary/neetoui/Tooltip';
26
+ import Typography from '@bigbinary/neetoui/Typography';
27
+ import { C as CopyButtonWrapper } from './CopyButtonWrapper-54c5e270.js';
28
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
29
+ import { DEFAULT_PAGE_INDEX, DEFAULT_PAGE_SIZE } from '@bigbinary/neeto-commons-frontend/constants';
30
+ import Header from '@bigbinary/neeto-molecules/Header';
31
+ import SubHeader from '@bigbinary/neeto-molecules/SubHeader';
32
+ import Tab from '@bigbinary/neetoui/Tab';
33
+ import '@bigbinary/neeto-molecules/CopyToClipboardButton';
34
+
35
+ var list = function list(payload) {
36
+ return axios.get("".concat(BASE_URL, "/api/v1/split_transfers"), {
37
+ params: payload
38
+ });
39
+ };
40
+ var splitTransfersApi = {
41
+ list: list
42
+ };
43
+
44
+ function ownKeys$2(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; }
45
+ function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
46
+ var useFetchSplitTransfers = function useFetchSplitTransfers() {
47
+ var payload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
48
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
49
+ return useQuery(_objectSpread$2({
50
+ queryKey: [QUERY_KEYS.SPLIT_TRANSFERS_LIST, payload],
51
+ queryFn: function queryFn() {
52
+ return splitTransfersApi.list(payload);
53
+ }
54
+ }, options));
55
+ };
56
+
57
+ var COLUMNS_STORAGE_KEY = "splitTransfersDashboard";
58
+ var SPLIT_TRANSFERS_DASHBOARD_TAB = {
59
+ all: "all",
60
+ successful: "successful",
61
+ cancelled: "cancelled",
62
+ pending: "pending"
63
+ };
64
+ var SEARCH_PROPS = {
65
+ node: "identifier,",
66
+ key: "search_term",
67
+ model: "NeetoPaymentsEngine::Payments::Split,",
68
+ placeholder: t("neetoPayments.common.search")
69
+ };
70
+ var FILTER_COLUMNS = [{
71
+ key: "amount",
72
+ label: t("neetoPayments.common.amount"),
73
+ node: "amount",
74
+ type: "decimal"
75
+ }, {
76
+ key: "payment_at",
77
+ label: t("neetoPayments.common.transferTime"),
78
+ node: "payment_at",
79
+ type: "date"
80
+ }];
81
+ var TAG_STYLE = {
82
+ successful: "success",
83
+ cancelled: "secondary",
84
+ pending: "warning"
85
+ };
86
+
87
+ var renderIdentifier = function renderIdentifier(identifier, _ref) {
88
+ var receiptUrl = _ref.receiptUrl;
89
+ var isTemporaryIdentifier = identifier === null || identifier === void 0 ? void 0 : identifier.startsWith("temp_");
90
+ if (isTemporaryIdentifier) {
91
+ return /*#__PURE__*/jsx(Tooltip, {
92
+ content: t("neetoPayments.tooltipContent.paymentIdentifierUnavailable"),
93
+ position: "top",
94
+ children: /*#__PURE__*/jsx("div", {
95
+ className: "text-center",
96
+ children: /*#__PURE__*/jsx(Typography, {
97
+ style: "body2",
98
+ children: t("neetoPayments.common.notAvailable")
99
+ })
100
+ })
101
+ });
102
+ }
103
+ return /*#__PURE__*/jsx(CopyButtonWrapper, {
104
+ content: identifier,
105
+ children: /*#__PURE__*/jsx(Button, {
106
+ href: receiptUrl,
107
+ label: identifier,
108
+ size: "small",
109
+ style: "link",
110
+ target: "_blank"
111
+ })
112
+ });
113
+ };
114
+ var getTagStyle = function getTagStyle(status) {
115
+ return TAG_STYLE[status] || DEFAULT_TAG_STYLE;
116
+ };
117
+ var preProcessStatus = function preProcessStatus(type, status) {
118
+ var record = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
119
+ if (type === "payment") {
120
+ return record.isRefunded ? "refunded" : status;
121
+ }
122
+ return snakeToCamelCase(status);
123
+ };
124
+ var renderStatus = curry(function (type, status, record) {
125
+ var processedStatus = preProcessStatus(type, status, record);
126
+ return /*#__PURE__*/jsx(Tooltip, {
127
+ content: t("neetoPayments.tooltipContent.".concat(type, ".").concat(processedStatus)),
128
+ position: "top",
129
+ children: /*#__PURE__*/jsx("div", {
130
+ className: "w-fit",
131
+ children: /*#__PURE__*/jsx(Tag, {
132
+ label: t("neetoPayments.tagLabels.".concat(type, ".").concat(processedStatus)),
133
+ style: getTagStyle(processedStatus)
134
+ })
135
+ })
136
+ });
137
+ });
138
+ var renderDate = function renderDate(date) {
139
+ return /*#__PURE__*/jsx(DateFormat.DateTime, {
140
+ date: date
141
+ });
142
+ };
143
+ var renderCurrency = function renderCurrency(currency) {
144
+ return currency === null || currency === void 0 ? void 0 : currency.toUpperCase();
145
+ };
146
+ var getDefaultColumns = function getDefaultColumns() {
147
+ return [{
148
+ title: t("neetoPayments.common.id"),
149
+ dataIndex: "id",
150
+ key: "id",
151
+ width: 70,
152
+ position: 0,
153
+ isHidable: false
154
+ }, {
155
+ title: t("neetoPayments.common.identifier"),
156
+ dataIndex: "identifier",
157
+ key: "identifier",
158
+ width: 300,
159
+ render: renderIdentifier,
160
+ position: 1,
161
+ isHidable: false
162
+ }, {
163
+ title: t("neetoPayments.common.status"),
164
+ dataIndex: "status",
165
+ key: "status",
166
+ width: 150,
167
+ render: renderStatus("splitTransfers"),
168
+ sorter: true,
169
+ position: 2,
170
+ isHidable: false
171
+ }, {
172
+ title: t("neetoPayments.common.amount"),
173
+ dataIndex: "amount",
174
+ key: "amount",
175
+ width: 150,
176
+ sorter: true,
177
+ position: 3
178
+ }, {
179
+ title: t("neetoPayments.common.currency"),
180
+ dataIndex: "currency",
181
+ key: "currency",
182
+ width: 160,
183
+ sorter: true,
184
+ render: renderCurrency,
185
+ position: 3
186
+ }, {
187
+ title: t("neetoPayments.common.platformShare"),
188
+ dataIndex: "platformShare",
189
+ key: "platformShare",
190
+ width: 205,
191
+ sorter: true,
192
+ position: 3
193
+ }, {
194
+ title: t("neetoPayments.common.transferTime"),
195
+ dataIndex: "paymentAt",
196
+ key: "paymentAt",
197
+ width: 190,
198
+ render: renderDate,
199
+ sorter: true,
200
+ position: 10
201
+ }];
202
+ };
203
+
204
+ function ownKeys$1(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; }
205
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
206
+ var buildSearchProps = function buildSearchProps(searchProps, searchTerm) {
207
+ return mergeDeepWith(concat, SEARCH_PROPS, mergeLeft({
208
+ value: searchTerm.trim()
209
+ }, searchProps));
210
+ };
211
+ var buildFilterColumns = function buildFilterColumns() {
212
+ var payableEntityColumns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
213
+ return reject(isNil, concat(FILTER_COLUMNS, map(prop("filterProps"), payableEntityColumns)));
214
+ };
215
+ var buildTableColumns = function buildTableColumns(tab, hiddenColumns) {
216
+ var payableEntityColumns = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
217
+ var filteredColumns = sortBy(prop("position"), concat(getDefaultColumns(), payableEntityColumns)).filter(function (_ref) {
218
+ var dataIndex = _ref.dataIndex;
219
+ return !hiddenColumns.includes(processDataIndex(dataIndex));
220
+ });
221
+ if (tab === SPLIT_TRANSFERS_DASHBOARD_TAB.all) return filteredColumns;
222
+ return removeBy({
223
+ key: "status"
224
+ }, filteredColumns);
225
+ };
226
+ var buildRowData = function buildRowData(_ref2) {
227
+ var splitTransfers = _ref2.splitTransfers,
228
+ _ref2$pageProperties = _ref2.pageProperties,
229
+ pageProperties = _ref2$pageProperties === void 0 ? {} : _ref2$pageProperties;
230
+ return splitTransfers === null || splitTransfers === void 0 ? void 0 : splitTransfers.map(function (element, index) {
231
+ return _objectSpread$1(_objectSpread$1({}, element), {}, {
232
+ id: isEmpty(pageProperties) ? index + 1 : pageProperties.pageSize * (pageProperties.page - 1) + index + 1
233
+ });
234
+ });
235
+ };
236
+
237
+ var List = function List(_ref) {
238
+ var splitTransfers = _ref.splitTransfers,
239
+ views = _ref.views,
240
+ payableEntityColumns = _ref.payableEntityColumns,
241
+ setPageProperties = _ref.setPageProperties,
242
+ setSortProperties = _ref.setSortProperties,
243
+ pageProperties = _ref.pageProperties;
244
+ var _useTranslation = useTranslation(),
245
+ t = _useTranslation.t;
246
+ var history = useHistory();
247
+ var _getQueryParams = getQueryParams(),
248
+ _getQueryParams$tab = _getQueryParams.tab,
249
+ tab = _getQueryParams$tab === void 0 ? SPLIT_TRANSFERS_DASHBOARD_TAB.all : _getQueryParams$tab;
250
+ var _useHiddenColumns = useHiddenColumns(COLUMNS_STORAGE_KEY),
251
+ hideColumn = _useHiddenColumns.hideColumn,
252
+ _useHiddenColumns$hid = _useHiddenColumns.hiddenColumns,
253
+ hiddenColumns = _useHiddenColumns$hid === void 0 ? [] : _useHiddenColumns$hid;
254
+ var splitTransfersCount = views[tab];
255
+ var visibleColumns = buildTableColumns(tab, hiddenColumns, payableEntityColumns);
256
+ var handleColumnHiding = function handleColumnHiding(column) {
257
+ hideColumn(processDataIndex(column.dataIndex));
258
+ };
259
+ var handleTablePaginaton = function handleTablePaginaton(page, pageSize) {
260
+ var queryParams = getQueryParams({
261
+ toCamelCase: false
262
+ });
263
+ history.push(buildUrl(window.location.pathname, mergeLeft({
264
+ page: page,
265
+ page_size: pageSize
266
+ }, queryParams)));
267
+ setPageProperties({
268
+ page: page,
269
+ pageSize: pageSize
270
+ });
271
+ };
272
+ var handleTableChange = function handleTableChange(_, __, sorter) {
273
+ setSortProperties(isPresent(sorter === null || sorter === void 0 ? void 0 : sorter.column) ? {
274
+ sortBy: camelToSnakeCase(processDataIndex(sorter.field)),
275
+ orderBy: sorter.order === "ascend" ? "ASC" : "DESC"
276
+ } : DEFAULT_SORT_PROPERTIES);
277
+ };
278
+ if (isNotPresent(splitTransfers)) {
279
+ return /*#__PURE__*/jsx("div", {
280
+ className: "flex h-full w-full items-center justify-center",
281
+ children: /*#__PURE__*/jsx(NoData, {
282
+ title: tab === SPLIT_TRANSFERS_DASHBOARD_TAB.all ? t("neetoPayments.emptyState.splitTransfers") : t("neetoPayments.emptyState.splitTransfersWithStatus", {
283
+ status: tab
284
+ })
285
+ })
286
+ });
287
+ }
288
+ return /*#__PURE__*/jsx(TableWrapper, {
289
+ hasPagination: splitTransfersCount > (pageProperties === null || pageProperties === void 0 ? void 0 : pageProperties.pageSize),
290
+ children: /*#__PURE__*/jsx(Table, {
291
+ fixedHeight: true,
292
+ allowRowClick: false,
293
+ columnData: visibleColumns,
294
+ currentPageNumber: pageProperties === null || pageProperties === void 0 ? void 0 : pageProperties.page,
295
+ handlePageChange: handleTablePaginaton,
296
+ rowData: buildRowData({
297
+ splitTransfers: splitTransfers,
298
+ pageProperties: pageProperties,
299
+ tab: tab
300
+ }),
301
+ rowSelection: false,
302
+ sortDirections: SORT_DIRECTIONS,
303
+ totalCount: splitTransfersCount,
304
+ paginationProps: {
305
+ showSizeChanger: true,
306
+ hideOnSinglePage: true,
307
+ pageSize: pageProperties === null || pageProperties === void 0 ? void 0 : pageProperties.pageSize,
308
+ total: splitTransfersCount
309
+ },
310
+ onChange: handleTableChange,
311
+ onColumnHide: handleColumnHiding
312
+ })
313
+ });
314
+ };
315
+
316
+ var TopSection = function TopSection(_ref) {
317
+ var views = _ref.views,
318
+ filters = _ref.filters,
319
+ setFilters = _ref.setFilters,
320
+ filterableColumns = _ref.filterableColumns,
321
+ searchKeywordProps = _ref.searchKeywordProps,
322
+ payableEntityColumns = _ref.payableEntityColumns;
323
+ var _useState = useState(false),
324
+ _useState2 = _slicedToArray(_useState, 2),
325
+ isFilterPaneOpen = _useState2[0],
326
+ setIsFilterPaneOpen = _useState2[1];
327
+ var _useTranslation = useTranslation(),
328
+ t = _useTranslation.t;
329
+ var history = useHistory();
330
+ var _getQueryParams = getQueryParams(),
331
+ _getQueryParams$tab = _getQueryParams.tab,
332
+ tab = _getQueryParams$tab === void 0 ? SPLIT_TRANSFERS_DASHBOARD_TAB.all : _getQueryParams$tab;
333
+ var splitTransfersCount = views[tab];
334
+ var splitTransfersCountVisible = splitTransfersCount > 0;
335
+ var isFilterButtonVisible = splitTransfersCount || isPresent(filters);
336
+ var handleFiltersChange = function handleFiltersChange(filters) {
337
+ startTransition(function () {
338
+ setFilters(filters);
339
+ });
340
+ };
341
+ var handleTabChange = function handleTabChange(tab) {
342
+ var queryParams = getQueryParams({
343
+ toCamelCase: false
344
+ });
345
+ var newParams = {
346
+ tab: tab,
347
+ page: DEFAULT_PAGE_INDEX,
348
+ page_size: DEFAULT_PAGE_SIZE
349
+ };
350
+ history.push(buildUrl(window.location.pathname, mergeLeft(newParams, queryParams)));
351
+ };
352
+ return /*#__PURE__*/jsxs(Fragment, {
353
+ children: [/*#__PURE__*/jsx(Header, {
354
+ title: t("neetoPayments.title.splitTransfers"),
355
+ searchProps: {
356
+ placeholder: searchKeywordProps.placeholder,
357
+ className: "w-80"
358
+ }
359
+ }), /*#__PURE__*/jsx(Tab, {
360
+ children: Object.keys(SPLIT_TRANSFERS_DASHBOARD_TAB).map(function (item) {
361
+ return /*#__PURE__*/jsx(Tab.Item, {
362
+ active: tab === item,
363
+ onClick: function onClick() {
364
+ return handleTabChange(item);
365
+ },
366
+ children: t("neetoPayments.common.".concat(item))
367
+ }, item);
368
+ })
369
+ }), /*#__PURE__*/jsx(SubHeader, {
370
+ className: "mt-4",
371
+ leftActionBlock: splitTransfersCountVisible && /*#__PURE__*/jsx(Typography, {
372
+ className: "neeto-ui-gray-800 mr-2 font-semibold",
373
+ component: "h4",
374
+ children: tab === SPLIT_TRANSFERS_DASHBOARD_TAB.all ? t("neetoPayments.countOf.splitTransfer", {
375
+ count: splitTransfersCount
376
+ }) : t("neetoPayments.countOf.splitTransferWithStatus", {
377
+ count: splitTransfersCount,
378
+ status: tab
379
+ })
380
+ }),
381
+ rightActionBlock: /*#__PURE__*/jsxs(Fragment, {
382
+ children: [/*#__PURE__*/jsx(Bar, {
383
+ columns: filterableColumns,
384
+ keyword: searchKeywordProps,
385
+ setIsPaneOpen: setIsFilterPaneOpen,
386
+ onChange: handleFiltersChange
387
+ }), isFilterButtonVisible && /*#__PURE__*/jsx(SubHeader.RightBlock, {
388
+ columnsButtonProps: {
389
+ columnData: concat(getDefaultColumns(), payableEntityColumns).map(modify("dataIndex", processDataIndex)),
390
+ fixedColumns: UN_HIDEABLE_COLUMNS,
391
+ localStorageKey: COLUMNS_STORAGE_KEY
392
+ },
393
+ filterProps: {
394
+ columns: filterableColumns,
395
+ isOpen: isFilterPaneOpen,
396
+ keyword: searchKeywordProps,
397
+ setIsOpen: setIsFilterPaneOpen,
398
+ onChange: handleFiltersChange
399
+ }
400
+ })]
401
+ })
402
+ })]
403
+ });
404
+ };
405
+
406
+ 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; }
407
+ 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; }
408
+ var SplitTransfersDashboard = function SplitTransfersDashboard(_ref) {
409
+ var searchProps = _ref.searchProps,
410
+ payableEntityColumns = _ref.payableEntityColumns;
411
+ var _getQueryParams = getQueryParams(),
412
+ _getQueryParams$searc = _getQueryParams.searchTerm,
413
+ searchTerm = _getQueryParams$searc === void 0 ? "" : _getQueryParams$searc;
414
+ var filterableColumns = buildFilterColumns(payableEntityColumns);
415
+ var searchKeywordProps = buildSearchProps(searchProps, searchTerm);
416
+ var _useState = useState(DEFAULT_SORT_PROPERTIES),
417
+ _useState2 = _slicedToArray(_useState, 2),
418
+ sortProperties = _useState2[0],
419
+ setSortProperties = _useState2[1];
420
+ var _useState3 = useState(DEFAULT_PAGE_VALUES),
421
+ _useState4 = _slicedToArray(_useState3, 2),
422
+ pageProperties = _useState4[0],
423
+ setPageProperties = _useState4[1];
424
+ var _useState5 = useState(buildFiltersFromURL([].concat(_toConsumableArray(filterableColumns), [searchKeywordProps]))),
425
+ _useState6 = _slicedToArray(_useState5, 2),
426
+ filters = _useState6[0],
427
+ setFilters = _useState6[1];
428
+ var _getQueryParams2 = getQueryParams(),
429
+ _getQueryParams2$tab = _getQueryParams2.tab,
430
+ tab = _getQueryParams2$tab === void 0 ? SPLIT_TRANSFERS_DASHBOARD_TAB.all : _getQueryParams2$tab;
431
+ var payload = _objectSpread(_objectSpread({
432
+ tab: tab,
433
+ filters: filters
434
+ }, pageProperties), sortProperties);
435
+ var _useFetchSplitTransfe = useFetchSplitTransfers(payload, {
436
+ enabled: true
437
+ }),
438
+ _useFetchSplitTransfe2 = _useFetchSplitTransfe.data,
439
+ _useFetchSplitTransfe3 = _useFetchSplitTransfe2 === void 0 ? {} : _useFetchSplitTransfe2,
440
+ splitTransfers = _useFetchSplitTransfe3.splitTransfers,
441
+ views = _useFetchSplitTransfe3.views,
442
+ isSplitTransfersLoading = _useFetchSplitTransfe.isLoading;
443
+ if (isSplitTransfersLoading) {
444
+ return /*#__PURE__*/jsx(PageLoader, {});
445
+ }
446
+ return /*#__PURE__*/jsxs(Fragment, {
447
+ children: [/*#__PURE__*/jsx(TopSection, {
448
+ filterableColumns: filterableColumns,
449
+ filters: filters,
450
+ pageProperties: pageProperties,
451
+ payableEntityColumns: payableEntityColumns,
452
+ searchKeywordProps: searchKeywordProps,
453
+ setFilters: setFilters,
454
+ setPageProperties: setPageProperties,
455
+ setSortProperties: setSortProperties,
456
+ views: views
457
+ }), /*#__PURE__*/jsx(List, {
458
+ pageProperties: pageProperties,
459
+ payableEntityColumns: payableEntityColumns,
460
+ setPageProperties: setPageProperties,
461
+ setSortProperties: setSortProperties,
462
+ splitTransfers: splitTransfers,
463
+ views: views
464
+ })]
465
+ });
466
+ };
467
+
468
+ export { SplitTransfersDashboard as default };
469
+ //# sourceMappingURL=SplitTransfersDashboard.js.map