@tap-payments/os-micro-frontend-shared 0.0.24 → 0.0.26
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/FlagDetails/FlagDetails.d.ts +12 -0
- package/build/components/FlagDetails/FlagDetails.js +31 -0
- package/build/components/FlagDetails/index.d.ts +2 -0
- package/build/components/FlagDetails/index.js +2 -0
- package/build/components/TableCells/CustomCells/DestinationCell/index.d.ts +1 -0
- package/build/components/TableCells/CustomCells/DestinationCell/index.js +1 -0
- package/build/components/TableCells/CustomCells/PayoutStatusCell/index.d.ts +1 -0
- package/build/components/TableCells/CustomCells/PayoutStatusCell/index.js +1 -0
- package/build/components/TableCells/CustomCells/SegmentsCell/constant.d.ts +1 -0
- package/build/components/TableCells/CustomCells/SegmentsCell/constant.js +2 -1
- package/build/components/TableCells/CustomCells/SegmentsCell/type.d.ts +1 -0
- package/build/components/index.d.ts +1 -0
- package/build/components/index.js +1 -0
- package/build/constants/assets.d.ts +1 -0
- package/build/constants/assets.js +1 -0
- package/build/types/invoice.d.ts +1 -1
- package/build/types/merchant.d.ts +13 -0
- package/build/utils/flag.d.ts +21 -0
- package/build/utils/flag.js +13 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface FlagDetailsProps {
|
|
2
|
+
flags?: Array<{
|
|
3
|
+
id: string;
|
|
4
|
+
status: 'OPEN' | 'CLEARED';
|
|
5
|
+
amount: number;
|
|
6
|
+
created: number;
|
|
7
|
+
note: string;
|
|
8
|
+
ishold: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
declare function FlagDetails({ flags }: FlagDetailsProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default FlagDetails;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import { RefundTooltipView } from '../TableCells';
|
|
4
|
+
import { formatFlagDate, formatPayoutDate } from '../../utils/index.js';
|
|
5
|
+
function FlagDetails({ flags }) {
|
|
6
|
+
const isAllFlagsClosed = flags === null || flags === void 0 ? void 0 : flags.every((flag) => flag.status === 'CLEARED');
|
|
7
|
+
const openedFlags = (flags === null || flags === void 0 ? void 0 : flags.filter((flag) => flag.status === 'OPEN')) || [];
|
|
8
|
+
const holdFlags = (openedFlags === null || openedFlags === void 0 ? void 0 : openedFlags.filter((flag) => flag.ishold)) || [];
|
|
9
|
+
const firstOpenFlag = openedFlags === null || openedFlags === void 0 ? void 0 : openedFlags[0];
|
|
10
|
+
const firstHoldFlag = holdFlags === null || holdFlags === void 0 ? void 0 : holdFlags[0];
|
|
11
|
+
const renderFlagTooltip = () => {
|
|
12
|
+
var _a;
|
|
13
|
+
if (isAllFlagsClosed) {
|
|
14
|
+
return _jsx("div", { children: "Previously Flagged & Closed" });
|
|
15
|
+
}
|
|
16
|
+
if (openedFlags.length === 1 && ((_a = openedFlags === null || openedFlags === void 0 ? void 0 : openedFlags[0]) === null || _a === void 0 ? void 0 : _a.ishold)) {
|
|
17
|
+
return _jsx("div", { children: `Flagged & Balance Held ${formatPayoutDate(firstHoldFlag === null || firstHoldFlag === void 0 ? void 0 : firstHoldFlag.created)}` });
|
|
18
|
+
}
|
|
19
|
+
if (openedFlags.length > 1 && (holdFlags === null || holdFlags === void 0 ? void 0 : holdFlags.length) > 0) {
|
|
20
|
+
const isTheSameFlag = (firstOpenFlag === null || firstOpenFlag === void 0 ? void 0 : firstOpenFlag.id) === (firstHoldFlag === null || firstHoldFlag === void 0 ? void 0 : firstHoldFlag.id);
|
|
21
|
+
const isSameDay = dayjs(firstOpenFlag === null || firstOpenFlag === void 0 ? void 0 : firstOpenFlag.created).isSame(firstHoldFlag === null || firstHoldFlag === void 0 ? void 0 : firstHoldFlag.created);
|
|
22
|
+
return isTheSameFlag ? (_jsx("div", { children: `Flagged & Balance Held ${formatFlagDate(firstHoldFlag === null || firstHoldFlag === void 0 ? void 0 : firstHoldFlag.created)}` })) : (_jsxs("div", { children: [_jsx("div", { children: `Flagged ${formatFlagDate(firstOpenFlag === null || firstOpenFlag === void 0 ? void 0 : firstOpenFlag.created)}` }), _jsxs("div", { children: ["& Balance Held ", formatFlagDate(firstHoldFlag === null || firstHoldFlag === void 0 ? void 0 : firstHoldFlag.created, isSameDay)] })] }));
|
|
23
|
+
}
|
|
24
|
+
if (!isAllFlagsClosed && openedFlags.length > 1) {
|
|
25
|
+
return (_jsxs("div", { children: [`Flagged ${formatFlagDate(firstOpenFlag === null || firstOpenFlag === void 0 ? void 0 : firstOpenFlag.created)}`, " - ", _jsx(RefundTooltipView, { children: "View" })] }));
|
|
26
|
+
}
|
|
27
|
+
return _jsx("div", { children: `Flagged ${formatFlagDate(firstOpenFlag === null || firstOpenFlag === void 0 ? void 0 : firstOpenFlag.created)}` });
|
|
28
|
+
};
|
|
29
|
+
return renderFlagTooltip();
|
|
30
|
+
}
|
|
31
|
+
export default FlagDetails;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { segmentTechnologyIcon, segmentInstitutionIcon, segmentDevelopmentHouseIcon, transactionIcon } from '../../../../constants/index.js';
|
|
1
|
+
import { segmentTechnologyIcon, segmentInstitutionIcon, segmentDevelopmentHouseIcon, transactionIcon, lightPlatformSegmentIcon } from '../../../../constants/index.js';
|
|
2
2
|
export const segmentsIcons = {
|
|
3
3
|
technology: segmentTechnologyIcon,
|
|
4
4
|
institution: segmentInstitutionIcon,
|
|
5
5
|
payment: transactionIcon,
|
|
6
6
|
developmentHouse: segmentDevelopmentHouseIcon,
|
|
7
|
+
platform: lightPlatformSegmentIcon,
|
|
7
8
|
};
|
|
@@ -81,3 +81,4 @@ export { default as ControlPanelContainer } from './ControlPanelContainer';
|
|
|
81
81
|
export { default as CopyImage } from './CopyImage';
|
|
82
82
|
export { default as AccountDropdown } from './AccountDropdown';
|
|
83
83
|
export { default as OTPInput } from './OTPInput';
|
|
84
|
+
export { default as FlagDetails } from './FlagDetails';
|
|
@@ -81,3 +81,4 @@ export { default as ControlPanelContainer } from './ControlPanelContainer';
|
|
|
81
81
|
export { default as CopyImage } from './CopyImage';
|
|
82
82
|
export { default as AccountDropdown } from './AccountDropdown';
|
|
83
83
|
export { default as OTPInput } from './OTPInput';
|
|
84
|
+
export { default as FlagDetails } from './FlagDetails';
|
|
@@ -160,6 +160,7 @@ export declare const providerSegmentIcon: string;
|
|
|
160
160
|
export declare const financialSegmentIcon: string;
|
|
161
161
|
export declare const developmentSegmentIcon: string;
|
|
162
162
|
export declare const platformSegmentIcon: string;
|
|
163
|
+
export declare const lightPlatformSegmentIcon: string;
|
|
163
164
|
export declare const grayBrandIcon: string;
|
|
164
165
|
export declare const jsonIcon: string;
|
|
165
166
|
export declare const jsonBlackIcon: string;
|
|
@@ -161,6 +161,7 @@ export const providerSegmentIcon = `${lightUrl}/other/provider.svg`;
|
|
|
161
161
|
export const financialSegmentIcon = `${lightUrl}/other/financial.svg`;
|
|
162
162
|
export const developmentSegmentIcon = `${lightUrl}/other/development.svg`;
|
|
163
163
|
export const platformSegmentIcon = `${lightUrl}/other/platform.svg`;
|
|
164
|
+
export const lightPlatformSegmentIcon = `${lightUrl}/other/light_platform.svg`;
|
|
164
165
|
export const grayBrandIcon = `${lightUrl}/other/brandGray.svg`;
|
|
165
166
|
export const jsonIcon = `${lightUrl}/other/json.svg`;
|
|
166
167
|
export const jsonBlackIcon = `${lightUrl}/other/jsonBlackIcon.svg`;
|
package/build/types/invoice.d.ts
CHANGED
|
@@ -36,9 +36,13 @@ export interface BusinessMerchant {
|
|
|
36
36
|
entity: {
|
|
37
37
|
id: string;
|
|
38
38
|
status: VerificationStatus;
|
|
39
|
+
legal_name: {
|
|
40
|
+
en: string;
|
|
41
|
+
};
|
|
39
42
|
merchant: {
|
|
40
43
|
id: string;
|
|
41
44
|
status: MerchantStatus;
|
|
45
|
+
marketplace: boolean;
|
|
42
46
|
commerceplatform: {
|
|
43
47
|
id: string;
|
|
44
48
|
name: {
|
|
@@ -47,6 +51,15 @@ export interface BusinessMerchant {
|
|
|
47
51
|
logo: string;
|
|
48
52
|
operator_id: string;
|
|
49
53
|
};
|
|
54
|
+
platforms: Array<{
|
|
55
|
+
id: string;
|
|
56
|
+
brand: {
|
|
57
|
+
name: Array<{
|
|
58
|
+
lang: string;
|
|
59
|
+
text: string;
|
|
60
|
+
}>;
|
|
61
|
+
};
|
|
62
|
+
}>;
|
|
50
63
|
wallet: {
|
|
51
64
|
id: string;
|
|
52
65
|
status: MerchantStatus;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type FlagType = 'GRAY' | 'ORANGE' | 'RED';
|
|
2
|
+
export declare function getFlagDetails(flags?: Array<{
|
|
3
|
+
id: string;
|
|
4
|
+
status: 'OPEN' | 'CLEARED';
|
|
5
|
+
amount: number;
|
|
6
|
+
created: number;
|
|
7
|
+
note: string;
|
|
8
|
+
ishold: boolean;
|
|
9
|
+
}>): {
|
|
10
|
+
statusFlag: string;
|
|
11
|
+
holdFlag: FlagType;
|
|
12
|
+
openedFlags: {
|
|
13
|
+
id: string;
|
|
14
|
+
status: 'OPEN' | 'CLEARED';
|
|
15
|
+
amount: number;
|
|
16
|
+
created: number;
|
|
17
|
+
note: string;
|
|
18
|
+
ishold: boolean;
|
|
19
|
+
}[];
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function getFlagDetails(flags) {
|
|
2
|
+
const isAllFlagsClosed = flags === null || flags === void 0 ? void 0 : flags.every((flag) => flag.status === 'CLEARED');
|
|
3
|
+
const openedFlags = (flags === null || flags === void 0 ? void 0 : flags.filter((flag) => flag.status === 'OPEN')) || [];
|
|
4
|
+
const holdFlags = (openedFlags === null || openedFlags === void 0 ? void 0 : openedFlags.filter((flag) => flag.ishold)) || [];
|
|
5
|
+
const hasAnyHoldFlag = (holdFlags === null || holdFlags === void 0 ? void 0 : holdFlags.length) > 0;
|
|
6
|
+
const statusFlag = isAllFlagsClosed ? 'GRAY' : 'ORANGE';
|
|
7
|
+
const holdFlag = hasAnyHoldFlag && !isAllFlagsClosed ? 'RED' : statusFlag;
|
|
8
|
+
return {
|
|
9
|
+
statusFlag,
|
|
10
|
+
holdFlag,
|
|
11
|
+
openedFlags,
|
|
12
|
+
};
|
|
13
|
+
}
|
package/build/utils/index.d.ts
CHANGED
package/build/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.0.
|
|
4
|
+
"version": "0.0.26",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|
|
7
7
|
"module": "build/index.js",
|
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
"import": "./build/theme/index.js",
|
|
37
37
|
"require": "./build/theme/index.js",
|
|
38
38
|
"types": "./build/theme/index.d.ts"
|
|
39
|
+
},
|
|
40
|
+
"./types": {
|
|
41
|
+
"import": "./build/types/index.js",
|
|
42
|
+
"require": "./build/types/index.js",
|
|
43
|
+
"types": "./build/types/index.d.ts"
|
|
39
44
|
}
|
|
40
45
|
},
|
|
41
46
|
"license": "MIT",
|