@tap-payments/os-micro-frontend-shared 0.0.23 → 0.0.25
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/OTPInput/OTPInput.d.ts +1 -1
- package/build/components/OTPInput/OTPInput.js +4 -3
- 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/index.d.ts +1 -0
- package/build/components/index.js +1 -0
- package/build/types/invoice.d.ts +1 -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 +1 -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;
|
|
@@ -5,6 +5,6 @@ interface OTPInputProps extends Omit<OtpInputProps, 'numInputs' | 'onChange'> {
|
|
|
5
5
|
onChange?: (otp: string) => void;
|
|
6
6
|
onSubmitOtp?: (otp: string) => void;
|
|
7
7
|
}
|
|
8
|
-
declare function OTPInput({ numInputs, separateAfter, isInputSecure, isInputNum, onSubmitOtp, ...props }: OTPInputProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function OTPInput({ numInputs, separateAfter, isInputSecure, isInputNum, onSubmitOtp, onChange, ...props }: OTPInputProps): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
declare const _default: import("react").MemoExoticComponent<typeof OTPInput>;
|
|
10
10
|
export default _default;
|
|
@@ -12,13 +12,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { useState, memo } from 'react';
|
|
14
14
|
import Box from '@mui/material/Box';
|
|
15
|
-
import
|
|
15
|
+
import Input from 'react18-input-otp';
|
|
16
16
|
import { inputFocusStyle, inputStyle, inputErrorStyle, Separator } from './style';
|
|
17
17
|
function OTPInput(_a) {
|
|
18
|
-
var { numInputs = 6, separateAfter = 3, isInputSecure = true, isInputNum = true, onSubmitOtp } = _a, props = __rest(_a, ["numInputs", "separateAfter", "isInputSecure", "isInputNum", "onSubmitOtp"]);
|
|
18
|
+
var { numInputs = 6, separateAfter = 3, isInputSecure = true, isInputNum = true, onSubmitOtp, onChange } = _a, props = __rest(_a, ["numInputs", "separateAfter", "isInputSecure", "isInputNum", "onSubmitOtp", "onChange"]);
|
|
19
19
|
const [otp, setOtp] = useState('');
|
|
20
20
|
const handleChange = (enteredOtp) => {
|
|
21
21
|
setOtp(enteredOtp);
|
|
22
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(enteredOtp);
|
|
22
23
|
if (enteredOtp.length === numInputs) {
|
|
23
24
|
onSubmitOtp === null || onSubmitOtp === void 0 ? void 0 : onSubmitOtp(enteredOtp);
|
|
24
25
|
}
|
|
@@ -27,6 +28,6 @@ function OTPInput(_a) {
|
|
|
27
28
|
'::selection': {
|
|
28
29
|
background: 'transparent',
|
|
29
30
|
},
|
|
30
|
-
} }, { children: _jsx(
|
|
31
|
+
} }, { children: _jsx(Input, Object.assign({ inputStyle: Object.assign(Object.assign({}, inputStyle), props.inputProps), focusStyle: inputFocusStyle, errorStyle: inputErrorStyle, value: otp, separator: _jsx(Separator, { children: "-" }), isInputNum: isInputNum, isInputSecure: isInputSecure, numInputs: numInputs, separateAfter: separateAfter, shouldAutoFocus: true, onChange: handleChange }, props)) })));
|
|
31
32
|
}
|
|
32
33
|
export default memo(OTPInput);
|
|
@@ -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';
|
package/build/types/invoice.d.ts
CHANGED
|
@@ -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