@tap-payments/os-micro-frontend-shared 0.1.366 → 0.1.367-test.1-test.2-test.3
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.
- package/build/components/AnimatedSpinnerIcon/style.d.ts +0 -1
- package/build/components/Chip/style.d.ts +0 -1
- package/build/components/CountBadge/style.d.ts +0 -1
- package/build/components/Dialog/style.d.ts +0 -1
- package/build/components/FlippingCard/style.d.ts +0 -1
- package/build/components/ImageWrapper/ImageWrapper.d.ts +0 -1
- package/build/components/JSONViewer/style.d.ts +0 -1
- package/build/components/LeftPeekRightExpandingChip/style.d.ts +0 -1
- package/build/components/RightLeftExpandingCenterChip/style.d.ts +0 -1
- package/build/components/SearchButton/styles.d.ts +0 -1
- package/build/components/StatusIcons/AuthIcons/style.d.ts +0 -1
- package/build/components/StatusIcons/AuthorizationAutoIcons/style.d.ts +0 -1
- package/build/components/StatusIcons/ChargeStatusIcon/style.d.ts +0 -1
- package/build/components/StatusIcons/SourceIcons/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/ActionCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/AgreementCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/ApplicationStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/AuthenticationCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/AuthenticationStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/AuthenticationTypeCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/BalanceCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/ChannelsCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/CheckoutStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/DestinationStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/DueDateCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/IDButton/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/IntentsStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/InvoiceStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/PayoutReportCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/PayoutStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/ProductsCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/ReferenceCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/RefundChargeCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/RefundStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/SalesChannelCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/SegmentsCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/StatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/TokenStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/style.d.ts +0 -1
- package/build/components/TableHeader/FiltersRow.d.ts +1 -1
- package/build/components/TableHeader/FiltersRow.js +4 -2
- package/build/components/TableHeader/TableHeader.d.ts +1 -1
- package/build/components/TableHeader/TableHeader.js +2 -2
- package/build/components/TableHeader/TableView/CreateViewDialog.d.ts +3 -0
- package/build/components/TableHeader/TableView/CreateViewDialog.js +98 -0
- package/build/components/TableHeader/TableView/CustomViews.js +1 -1
- package/build/components/TableHeader/TableView/ViewsDropdown.d.ts +22 -0
- package/build/components/TableHeader/TableView/ViewsDropdown.js +137 -0
- package/build/components/TableHeader/TableView/ViewsManager.d.ts +29 -0
- package/build/components/TableHeader/TableView/ViewsManager.js +108 -0
- package/build/components/TableHeader/TableView/constants.d.ts +10 -0
- package/build/components/TableHeader/TableView/constants.js +10 -0
- package/build/components/TableHeader/TableView/data.d.ts +5 -0
- package/build/components/TableHeader/TableView/data.js +54 -0
- package/build/components/TableHeader/TableView/hooks.d.ts +25 -0
- package/build/components/TableHeader/TableView/hooks.js +79 -0
- package/build/components/TableHeader/TableView/index.d.ts +12 -3
- package/build/components/TableHeader/TableView/index.js +11 -3
- package/build/components/TableHeader/TableView/styles.d.ts +114 -0
- package/build/components/TableHeader/TableView/styles.js +399 -0
- package/build/components/TableHeader/TableView/types.d.ts +52 -0
- package/build/components/TableHeader/TableView/types.js +1 -0
- package/build/components/TableHeader/TableView/utils.d.ts +74 -0
- package/build/components/TableHeader/TableView/utils.js +234 -0
- package/build/components/TableHeader/type.d.ts +16 -0
- package/build/components/TableReports/components/DownloadButton/style.d.ts +0 -1
- package/build/components/TableReports/style.d.ts +0 -1
- package/build/components/VirtualTables/components/style.d.ts +0 -1
- package/build/constants/assets.d.ts +1 -0
- package/build/constants/assets.js +1 -0
- package/build/constants/reports.d.ts +18 -1
- package/build/constants/reports.js +77 -27
- package/build/types/apps.d.ts +9 -9
- package/build/utils/navigation.d.ts +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { advancedColumns, sheetColumns } from './data';
|
|
2
|
+
/**
|
|
3
|
+
* Transform API layout response to internal ColumnViewProps format
|
|
4
|
+
*/
|
|
5
|
+
export const transformLayoutToColumns = (layout, lang = 'en') => {
|
|
6
|
+
const columns = [];
|
|
7
|
+
layout.forEach((section) => {
|
|
8
|
+
section.columns.forEach((col) => {
|
|
9
|
+
var _a, _b, _c, _d;
|
|
10
|
+
const label = ((_a = col.name.find((n) => n.lang === lang)) === null || _a === void 0 ? void 0 : _a.text) || ((_b = col.name[0]) === null || _b === void 0 ? void 0 : _b.text) || col.code;
|
|
11
|
+
const menuItems = (_c = col.fields) === null || _c === void 0 ? void 0 : _c.map((field) => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
return ({
|
|
14
|
+
name: field.code,
|
|
15
|
+
label: ((_a = field.name.find((n) => n.lang === lang || n.lang === '')) === null || _a === void 0 ? void 0 : _a.text) || field.code,
|
|
16
|
+
selected: (_b = field.default) !== null && _b !== void 0 ? _b : false,
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
columns.push({
|
|
20
|
+
name: col.code,
|
|
21
|
+
label,
|
|
22
|
+
selected: (_d = col.default) !== null && _d !== void 0 ? _d : false,
|
|
23
|
+
menuItems: (menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) ? menuItems : undefined,
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return columns;
|
|
28
|
+
};
|
|
29
|
+
export const getColumnsByMode = (mode) => {
|
|
30
|
+
return mode === 'advanced' ? [...advancedColumns] : [...sheetColumns];
|
|
31
|
+
};
|
|
32
|
+
export const isDateColumn = (name) => {
|
|
33
|
+
return name.toLowerCase() === 'date';
|
|
34
|
+
};
|
|
35
|
+
export const getColumnCheckState = (column) => {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
if (!((_a = column.menuItems) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
38
|
+
return { checked: (_b = column.selected) !== null && _b !== void 0 ? _b : false, indeterminate: false };
|
|
39
|
+
}
|
|
40
|
+
const selectedCount = column.menuItems.filter((item) => item.selected).length;
|
|
41
|
+
return {
|
|
42
|
+
checked: selectedCount > 0,
|
|
43
|
+
indeterminate: selectedCount > 0 && selectedCount < column.menuItems.length,
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export const createCustomViewMenuItem = (name, selectedColumns) => ({
|
|
47
|
+
label: name,
|
|
48
|
+
id: `custom_${Date.now()}`,
|
|
49
|
+
columns: selectedColumns.map((col) => col.name),
|
|
50
|
+
submenu: selectedColumns,
|
|
51
|
+
isCustom: true,
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* Initialize columns for editing mode
|
|
55
|
+
*/
|
|
56
|
+
export const initializeEditingColumns = (editingColumns, availableColumns) => {
|
|
57
|
+
return availableColumns
|
|
58
|
+
.filter((col) => !isDateColumn(col.name))
|
|
59
|
+
.map((col) => {
|
|
60
|
+
var _a;
|
|
61
|
+
const savedCol = editingColumns.find((ec) => ec.name === col.name);
|
|
62
|
+
return (savedCol || Object.assign(Object.assign({}, col), { selected: false, menuItems: (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign(Object.assign({}, item), { selected: false }))) }));
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Initialize columns for create mode (all unchecked except date)
|
|
67
|
+
*/
|
|
68
|
+
export const initializeCreateColumns = (availableColumns) => {
|
|
69
|
+
return availableColumns
|
|
70
|
+
.filter((col) => !isDateColumn(col.name))
|
|
71
|
+
.map((col) => {
|
|
72
|
+
var _a;
|
|
73
|
+
return (Object.assign(Object.assign({}, col), { selected: false, menuItems: (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign(Object.assign({}, item), { selected: false }))) }));
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Reset columns to their default selection state
|
|
78
|
+
*/
|
|
79
|
+
export const resetColumnsToDefault = (columns) => {
|
|
80
|
+
return columns
|
|
81
|
+
.filter((col) => !isDateColumn(col.name))
|
|
82
|
+
.map((col) => {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
return (Object.assign(Object.assign({}, col), { selected: (_a = col.selected) !== null && _a !== void 0 ? _a : false, menuItems: (_b = col.menuItems) === null || _b === void 0 ? void 0 : _b.map((item) => { var _a; return (Object.assign(Object.assign({}, item), { selected: (_a = item.selected) !== null && _a !== void 0 ? _a : false })); }) }));
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Toggle a column's selection (including all children if present)
|
|
89
|
+
*/
|
|
90
|
+
export const toggleColumn = (columns, columnName) => {
|
|
91
|
+
return columns.map((col) => {
|
|
92
|
+
var _a;
|
|
93
|
+
if (col.name !== columnName)
|
|
94
|
+
return col;
|
|
95
|
+
const newSelected = !col.selected;
|
|
96
|
+
const updatedMenuItems = (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign(Object.assign({}, item), { selected: newSelected })));
|
|
97
|
+
return Object.assign(Object.assign({}, col), { selected: newSelected, menuItems: updatedMenuItems });
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Toggle a sub-item's selection and update parent state
|
|
102
|
+
*/
|
|
103
|
+
export const toggleSubItem = (columns, columnName, subItemName) => {
|
|
104
|
+
return columns.map((col) => {
|
|
105
|
+
var _a, _b;
|
|
106
|
+
if (col.name !== columnName)
|
|
107
|
+
return col;
|
|
108
|
+
const updatedMenuItems = (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (item.name === subItemName ? Object.assign(Object.assign({}, item), { selected: !item.selected }) : item));
|
|
109
|
+
const hasSelectedChildren = (_b = updatedMenuItems === null || updatedMenuItems === void 0 ? void 0 : updatedMenuItems.some((item) => item.selected)) !== null && _b !== void 0 ? _b : false;
|
|
110
|
+
return Object.assign(Object.assign({}, col), { menuItems: updatedMenuItems, selected: hasSelectedChildren });
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Select or deselect all columns (except date)
|
|
115
|
+
*/
|
|
116
|
+
export const toggleAllColumns = (columns, selectAll) => {
|
|
117
|
+
return columns.map((col) => {
|
|
118
|
+
var _a;
|
|
119
|
+
if (isDateColumn(col.name))
|
|
120
|
+
return col;
|
|
121
|
+
const updatedMenuItems = (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign(Object.assign({}, item), { selected: selectAll })));
|
|
122
|
+
return Object.assign(Object.assign({}, col), { selected: selectAll, menuItems: updatedMenuItems });
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Check if all non-date columns are selected
|
|
127
|
+
*/
|
|
128
|
+
export const areAllColumnsSelected = (columns) => {
|
|
129
|
+
const nonDateColumns = columns.filter((col) => !isDateColumn(col.name));
|
|
130
|
+
return (nonDateColumns.length > 0 &&
|
|
131
|
+
nonDateColumns.every((col) => {
|
|
132
|
+
var _a;
|
|
133
|
+
if ((_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.length) {
|
|
134
|
+
return col.menuItems.some((item) => item.selected);
|
|
135
|
+
}
|
|
136
|
+
return col.selected;
|
|
137
|
+
}));
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Check if some (but not all) non-date columns are selected
|
|
141
|
+
*/
|
|
142
|
+
export const areSomeColumnsSelected = (columns, allSelected) => {
|
|
143
|
+
const nonDateColumns = columns.filter((col) => !isDateColumn(col.name));
|
|
144
|
+
const hasAnySelected = nonDateColumns.some((col) => {
|
|
145
|
+
var _a;
|
|
146
|
+
if ((_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.length) {
|
|
147
|
+
return col.menuItems.some((item) => item.selected);
|
|
148
|
+
}
|
|
149
|
+
return col.selected;
|
|
150
|
+
});
|
|
151
|
+
return hasAnySelected && !allSelected;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Validate template name
|
|
155
|
+
*/
|
|
156
|
+
export const isValidTemplateName = (name, maxLength) => {
|
|
157
|
+
return name.trim().length > 0 && name.length <= maxLength;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Deep clone columns array with all nested properties
|
|
161
|
+
*/
|
|
162
|
+
export const deepCloneColumns = (columns) => {
|
|
163
|
+
return columns.map((col) => {
|
|
164
|
+
var _a, _b;
|
|
165
|
+
return (Object.assign(Object.assign({}, col), { selected: (_a = col.selected) !== null && _a !== void 0 ? _a : false, menuItems: (_b = col.menuItems) === null || _b === void 0 ? void 0 : _b.map((item) => {
|
|
166
|
+
var _a;
|
|
167
|
+
return (Object.assign(Object.assign({}, item), { selected: (_a = item.selected) !== null && _a !== void 0 ? _a : false }));
|
|
168
|
+
}) }));
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Toggle a single column's selection state
|
|
173
|
+
*/
|
|
174
|
+
export const toggleSingleColumn = (columns, columnName) => {
|
|
175
|
+
return columns.map((col) => (col.name === columnName ? Object.assign(Object.assign({}, col), { selected: !col.selected }) : col));
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Get submenu items for a view menu item
|
|
179
|
+
*/
|
|
180
|
+
export const getSubmenuItems = (item, defaultColumns) => {
|
|
181
|
+
var _a;
|
|
182
|
+
if (item.isCustom && ((_a = item.submenu) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
183
|
+
return item.submenu;
|
|
184
|
+
}
|
|
185
|
+
if (item.id === 'default') {
|
|
186
|
+
return defaultColumns;
|
|
187
|
+
}
|
|
188
|
+
return item.submenu || [];
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* Check if a view menu item has submenu
|
|
192
|
+
*/
|
|
193
|
+
export const hasSubmenu = (item, defaultColumns) => {
|
|
194
|
+
return getSubmenuItems(item, defaultColumns).length > 0;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Check if all columns in current state are selected
|
|
198
|
+
*/
|
|
199
|
+
export const areAllCurrentColumnsSelected = (columns) => {
|
|
200
|
+
if (columns.length === 0)
|
|
201
|
+
return false;
|
|
202
|
+
return columns.every((col) => {
|
|
203
|
+
var _a;
|
|
204
|
+
if ((_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.length) {
|
|
205
|
+
return col.menuItems.some((item) => item.selected);
|
|
206
|
+
}
|
|
207
|
+
return col.selected;
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* Check if some (but not all) columns in current state are selected
|
|
212
|
+
*/
|
|
213
|
+
export const areSomeCurrentColumnsSelected = (columns, allSelected) => {
|
|
214
|
+
if (columns.length === 0)
|
|
215
|
+
return false;
|
|
216
|
+
const hasAny = columns.some((col) => {
|
|
217
|
+
var _a;
|
|
218
|
+
if ((_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.length) {
|
|
219
|
+
return col.menuItems.some((item) => item.selected);
|
|
220
|
+
}
|
|
221
|
+
return col.selected;
|
|
222
|
+
});
|
|
223
|
+
return hasAny && !allSelected;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Toggle all columns selection (select all or unselect all)
|
|
227
|
+
*/
|
|
228
|
+
export const toggleAllCurrentColumns = (columns, shouldSelect) => {
|
|
229
|
+
return columns.map((col) => {
|
|
230
|
+
var _a;
|
|
231
|
+
const updatedMenuItems = (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign(Object.assign({}, item), { selected: shouldSelect })));
|
|
232
|
+
return Object.assign(Object.assign({}, col), { selected: shouldSelect, menuItems: updatedMenuItems });
|
|
233
|
+
});
|
|
234
|
+
};
|
|
@@ -2,6 +2,7 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import type { CalenderMode, TableHeaderStatus, ColumnViewProps, TableMode, Timezone, SegmentCountry } from '../../types/index.js';
|
|
3
3
|
import { AvailableStatus } from '../StatusBar/type';
|
|
4
4
|
import { PartialExcept } from '../../types/index.js';
|
|
5
|
+
import type { ViewMenuItem } from './TableView/types';
|
|
5
6
|
type ViewsOptions = {
|
|
6
7
|
default: {};
|
|
7
8
|
developer: {};
|
|
@@ -44,6 +45,21 @@ export interface TableHeaderProps<IStatus extends TableHeaderStatus | TableHeade
|
|
|
44
45
|
id: string;
|
|
45
46
|
label: string;
|
|
46
47
|
}) => void;
|
|
48
|
+
customViews?: ViewMenuItem[];
|
|
49
|
+
onCreateCustomView?: (data: {
|
|
50
|
+
name: string;
|
|
51
|
+
selectedColumns: ColumnViewProps[];
|
|
52
|
+
}) => Promise<void>;
|
|
53
|
+
onEditCustomView?: (viewId: string, data: {
|
|
54
|
+
name: string;
|
|
55
|
+
selectedColumns: ColumnViewProps[];
|
|
56
|
+
}) => Promise<void>;
|
|
57
|
+
onDeleteCustomView?: (viewId: string) => Promise<void>;
|
|
58
|
+
viewMode?: 'advanced' | 'sheet';
|
|
59
|
+
onTableViewsChange?: (tableViews: ColumnViewProps[]) => void;
|
|
60
|
+
initialTableViews?: ColumnViewProps[];
|
|
61
|
+
onCustomViewsChange?: (customViews: ViewMenuItem[]) => void;
|
|
62
|
+
initialCustomViews?: ViewMenuItem[];
|
|
47
63
|
onToggleTextButtonClick?: () => void;
|
|
48
64
|
children?: ReactNode;
|
|
49
65
|
calendarGroupBy?: string;
|
|
@@ -338,6 +338,7 @@ export declare const TAP3DSPROVIDERIcon: string;
|
|
|
338
338
|
export declare const greyPlusIcon: string;
|
|
339
339
|
export declare const greyMinusIcon: string;
|
|
340
340
|
export declare const noPreviewIcon: string;
|
|
341
|
+
export declare const editIcon: string;
|
|
341
342
|
export declare const viewInvoiceIcon: string;
|
|
342
343
|
export declare const checkoutStatusIcon: string;
|
|
343
344
|
export declare const checkoutStatusBlueIcon: string;
|
|
@@ -344,6 +344,7 @@ export const TAP3DSPROVIDERIcon = `${lightUrl}/provider/TAP3DS.svg`;
|
|
|
344
344
|
export const greyPlusIcon = `${lightUrl}/greyPlusIcon.svg`;
|
|
345
345
|
export const greyMinusIcon = `${lightUrl}/greyMinusIcon.svg`;
|
|
346
346
|
export const noPreviewIcon = `${lightUrl}/noPreviewIcon.svg`;
|
|
347
|
+
export const editIcon = `${lightUrl}/other/editIcon.svg`;
|
|
347
348
|
export const viewInvoiceIcon = `${appBaseUrl}/viewInvoice.svg`;
|
|
348
349
|
export const checkoutStatusIcon = `${appBaseUrl}/checkoutStatus.svg`;
|
|
349
350
|
export const checkoutStatusBlueIcon = `${appBaseUrl}/checkStatusOutBlue.svg`;
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Maps report **source codes** (app or service)
|
|
3
|
+
* to the corresponding **backend report filter types**.
|
|
4
|
+
*
|
|
5
|
+
* Used as a translation layer between UI report grouping
|
|
6
|
+
* and backend report filtering.
|
|
7
|
+
*
|
|
8
|
+
* - Key: App code or service code
|
|
9
|
+
* - Value: One or more backend filter types
|
|
10
|
+
*/
|
|
11
|
+
export declare const reportFilterTypesMap: {
|
|
2
12
|
[x: string]: string[];
|
|
3
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Reports apps
|
|
16
|
+
*
|
|
17
|
+
* Defines apps shown in the reports app, with each service linked
|
|
18
|
+
* to its backend filter type (REPORT_FILTER_TYPES).
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
4
21
|
export declare const REPORTS_APPS: {
|
|
5
22
|
code: string;
|
|
6
23
|
name: string;
|
|
@@ -1,39 +1,89 @@
|
|
|
1
1
|
import { APP_CODES } from './apps';
|
|
2
2
|
import { acceptanceAppIcon, billingAppIcon, payoutsAppIcon, walletAppIcon } from './assets';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Backend report filter types (used by reports APIs)
|
|
5
|
+
*
|
|
6
|
+
* Maps frontend report identifiers to the backend API filter types.
|
|
7
|
+
* Acts as the source of truth for all report types across apps/services
|
|
8
|
+
*/
|
|
9
|
+
const REPORT_FILTER_TYPES = {
|
|
10
|
+
// Acceptance
|
|
11
|
+
CHARGE: 'CHARGE',
|
|
12
|
+
AUTHORIZE: 'AUTHORIZE',
|
|
13
|
+
REFUND: 'REFUND',
|
|
14
|
+
CHARGEBACKS: 'CHARGEBACKS',
|
|
15
|
+
DESTINATIONS: 'DESTINATIONS',
|
|
16
|
+
// Wallet
|
|
17
|
+
STATEMENT: 'STATEMENT',
|
|
18
|
+
STATEMENT_SUMMARY: 'STATEMENT_SUMMARY',
|
|
19
|
+
// Billing
|
|
20
|
+
INVOICE: 'INVOICE',
|
|
21
|
+
// Payouts
|
|
22
|
+
PAYOUT: 'PAYOUT',
|
|
23
|
+
MERCHANT_PAYOUT: 'MERCHANT_PAYOUT',
|
|
24
|
+
RETAILER_PAYOUT: 'RETAILER_PAYOUT',
|
|
19
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Maps report **source codes** (app or service)
|
|
28
|
+
* to the corresponding **backend report filter types**.
|
|
29
|
+
*
|
|
30
|
+
* Used as a translation layer between UI report grouping
|
|
31
|
+
* and backend report filtering.
|
|
32
|
+
*
|
|
33
|
+
* - Key: App code or service code
|
|
34
|
+
* - Value: One or more backend filter types
|
|
35
|
+
*/
|
|
36
|
+
export const reportFilterTypesMap = {
|
|
37
|
+
// Acceptance
|
|
38
|
+
[APP_CODES.acceptance.services.charges.code]: [REPORT_FILTER_TYPES.CHARGE],
|
|
39
|
+
[APP_CODES.acceptance.services.authorization.code]: [REPORT_FILTER_TYPES.AUTHORIZE],
|
|
40
|
+
[APP_CODES.acceptance.services.refunds.code]: [REPORT_FILTER_TYPES.REFUND],
|
|
41
|
+
[APP_CODES.acceptance.services.chargeback.code]: [REPORT_FILTER_TYPES.CHARGEBACKS],
|
|
42
|
+
[APP_CODES.acceptance.services.destinations.code]: [REPORT_FILTER_TYPES.DESTINATIONS],
|
|
43
|
+
[APP_CODES.acceptance.code]: [
|
|
44
|
+
REPORT_FILTER_TYPES.CHARGE,
|
|
45
|
+
REPORT_FILTER_TYPES.AUTHORIZE,
|
|
46
|
+
REPORT_FILTER_TYPES.REFUND,
|
|
47
|
+
REPORT_FILTER_TYPES.CHARGEBACKS,
|
|
48
|
+
REPORT_FILTER_TYPES.DESTINATIONS,
|
|
49
|
+
],
|
|
50
|
+
// Wallet
|
|
51
|
+
[APP_CODES.wallet.services.merchants.functions.statement.code]: [REPORT_FILTER_TYPES.STATEMENT],
|
|
52
|
+
[APP_CODES.wallet.services.merchants.functions.summary.code]: [REPORT_FILTER_TYPES.STATEMENT_SUMMARY],
|
|
53
|
+
[APP_CODES.wallet.code]: [REPORT_FILTER_TYPES.STATEMENT, REPORT_FILTER_TYPES.STATEMENT_SUMMARY],
|
|
54
|
+
// Billing
|
|
55
|
+
[APP_CODES.billing.services.invoices.code]: [REPORT_FILTER_TYPES.INVOICE],
|
|
56
|
+
[APP_CODES.billing.code]: [REPORT_FILTER_TYPES.INVOICE],
|
|
57
|
+
// Payouts
|
|
58
|
+
[APP_CODES.payouts.services.payouts.code]: [REPORT_FILTER_TYPES.PAYOUT],
|
|
59
|
+
[APP_CODES.payouts.services.merchantPayout.code]: [REPORT_FILTER_TYPES.MERCHANT_PAYOUT],
|
|
60
|
+
[APP_CODES.payouts.services.retailerPayout.code]: [REPORT_FILTER_TYPES.RETAILER_PAYOUT],
|
|
61
|
+
[APP_CODES.payouts.code]: [REPORT_FILTER_TYPES.PAYOUT, REPORT_FILTER_TYPES.MERCHANT_PAYOUT, REPORT_FILTER_TYPES.RETAILER_PAYOUT],
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Reports apps
|
|
65
|
+
*
|
|
66
|
+
* Defines apps shown in the reports app, with each service linked
|
|
67
|
+
* to its backend filter type (REPORT_FILTER_TYPES).
|
|
68
|
+
*
|
|
69
|
+
*/
|
|
20
70
|
export const REPORTS_APPS = [
|
|
21
71
|
{
|
|
22
72
|
code: APP_CODES.billing.code,
|
|
23
73
|
name: 'Billing',
|
|
24
74
|
icon: billingAppIcon,
|
|
25
|
-
services: [{ name: 'Invoices', code:
|
|
75
|
+
services: [{ name: 'Invoices', code: REPORT_FILTER_TYPES.INVOICE }],
|
|
26
76
|
},
|
|
27
77
|
{
|
|
28
78
|
code: APP_CODES.acceptance.code,
|
|
29
79
|
name: 'Acceptance',
|
|
30
80
|
icon: acceptanceAppIcon,
|
|
31
81
|
services: [
|
|
32
|
-
{ name: 'Authorisations', code:
|
|
33
|
-
{ name: 'Charges', code:
|
|
34
|
-
{ name: 'Refunds', code:
|
|
35
|
-
{ name: 'Chargebacks', code:
|
|
36
|
-
{ name: 'Destinations', code:
|
|
82
|
+
{ name: 'Authorisations', code: REPORT_FILTER_TYPES.AUTHORIZE },
|
|
83
|
+
{ name: 'Charges', code: REPORT_FILTER_TYPES.CHARGE },
|
|
84
|
+
{ name: 'Refunds', code: REPORT_FILTER_TYPES.REFUND },
|
|
85
|
+
{ name: 'Chargebacks', code: REPORT_FILTER_TYPES.CHARGEBACKS },
|
|
86
|
+
{ name: 'Destinations', code: REPORT_FILTER_TYPES.DESTINATIONS },
|
|
37
87
|
],
|
|
38
88
|
},
|
|
39
89
|
{
|
|
@@ -41,8 +91,8 @@ export const REPORTS_APPS = [
|
|
|
41
91
|
name: 'Wallet',
|
|
42
92
|
icon: walletAppIcon,
|
|
43
93
|
services: [
|
|
44
|
-
{ name: 'Aggregated Statement', code:
|
|
45
|
-
{ name: 'Detailed Statement', code:
|
|
94
|
+
{ name: 'Aggregated Statement', code: REPORT_FILTER_TYPES.STATEMENT_SUMMARY },
|
|
95
|
+
{ name: 'Detailed Statement', code: REPORT_FILTER_TYPES.STATEMENT },
|
|
46
96
|
],
|
|
47
97
|
},
|
|
48
98
|
{
|
|
@@ -50,9 +100,9 @@ export const REPORTS_APPS = [
|
|
|
50
100
|
name: 'Payouts',
|
|
51
101
|
icon: payoutsAppIcon,
|
|
52
102
|
services: [
|
|
53
|
-
{ name: 'Payouts', code:
|
|
54
|
-
{ name: 'Merchant Payouts', code:
|
|
55
|
-
{ name: 'Retailer Payouts', code:
|
|
103
|
+
{ name: 'Payouts', code: REPORT_FILTER_TYPES.PAYOUT },
|
|
104
|
+
{ name: 'Merchant Payouts', code: REPORT_FILTER_TYPES.MERCHANT_PAYOUT },
|
|
105
|
+
{ name: 'Retailer Payouts', code: REPORT_FILTER_TYPES.RETAILER_PAYOUT },
|
|
56
106
|
],
|
|
57
107
|
},
|
|
58
108
|
];
|
package/build/types/apps.d.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { ColumnsView } from './column';
|
|
2
2
|
import { Segment, SegmentCountry, SegmentUser, SelectedBrand, SelectedCountry, User } from './user';
|
|
3
|
-
import { BusinessMerchant } from './merchant';
|
|
4
3
|
import type { i18n } from 'i18next';
|
|
5
4
|
import { Theme } from '@mui/material';
|
|
6
5
|
import { CalenderMode } from './theme';
|
|
7
6
|
import { Timezone } from './appConfig';
|
|
8
7
|
import { Brand, Entity, TableMode } from './index.js';
|
|
9
8
|
import { TextAndLang } from './common';
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
export interface
|
|
9
|
+
export type AppPayload<TServiceCodes extends string = string> = {
|
|
10
|
+
services: {
|
|
11
|
+
[key in TServiceCodes]?: ServicePayload;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export interface ServicePayload {
|
|
16
15
|
columnFilters?: Record<string, any>;
|
|
17
16
|
filteredIds?: string[];
|
|
18
17
|
dateRange?: [Date, Date];
|
|
@@ -21,6 +20,7 @@ export interface AppPayload extends Partial<AccountAppPayload> {
|
|
|
21
20
|
isTextShown?: boolean;
|
|
22
21
|
tableViews?: ColumnsView[];
|
|
23
22
|
calendarTimezone?: number;
|
|
23
|
+
reportTypes?: string[];
|
|
24
24
|
}
|
|
25
25
|
export interface AppDetails {
|
|
26
26
|
id: string;
|
|
@@ -43,7 +43,7 @@ export interface AppDetails {
|
|
|
43
43
|
minWidth: number | string;
|
|
44
44
|
minHeight: number | string;
|
|
45
45
|
};
|
|
46
|
-
payload?: Record<string, any> &
|
|
46
|
+
payload?: Record<string, any> & ServicePayload;
|
|
47
47
|
toolbarIconUrl?: string;
|
|
48
48
|
hideMaximizedApp?: boolean;
|
|
49
49
|
hideMinimizeApp?: boolean;
|
|
@@ -99,7 +99,7 @@ export type MFWidgetBaseProps = {
|
|
|
99
99
|
hasHeader: boolean;
|
|
100
100
|
sandboxMode: boolean;
|
|
101
101
|
initialServiceCode?: string;
|
|
102
|
-
|
|
102
|
+
initialAppPayload?: AppPayload;
|
|
103
103
|
};
|
|
104
104
|
user: User;
|
|
105
105
|
segment: {
|
|
@@ -6,7 +6,7 @@ export declare const openNewAppAttrs: ({ appCode, serviceCode, sandboxMode, payl
|
|
|
6
6
|
numberOfOpenedApps: number;
|
|
7
7
|
segmentId: string;
|
|
8
8
|
}) => {
|
|
9
|
-
payload?: (Record<string, any> & import("../types/index.js").
|
|
9
|
+
payload?: (Record<string, any> & import("../types/index.js").ServicePayload) | undefined;
|
|
10
10
|
segmentId: string;
|
|
11
11
|
appCode: string;
|
|
12
12
|
serviceCode: string;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
3
|
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.367-test.1-test.2-test.3",
|
|
5
|
+
"testVersion": 3,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|
|
@@ -164,4 +164,4 @@
|
|
|
164
164
|
"publishConfig": {
|
|
165
165
|
"registry": "https://registry.npmjs.org/"
|
|
166
166
|
}
|
|
167
|
-
}
|
|
167
|
+
}
|