@tap-payments/os-micro-frontend-shared 0.1.222 → 0.1.224

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 (24) hide show
  1. package/build/components/RangeCalender/RangeCalender.d.ts +2 -26
  2. package/build/components/RangeCalender/RangeCalender.js +2 -2
  3. package/build/components/RangeCalender/components/Timezone/Timezone.d.ts +3 -2
  4. package/build/components/RangeCalender/components/Timezone/Timezone.js +4 -4
  5. package/build/components/RangeCalender/components/Timezone/components/EntitiesTimezone.d.ts +3 -6
  6. package/build/components/RangeCalender/components/Timezone/components/EntitiesTimezone.js +7 -6
  7. package/build/components/RangeCalender/type.d.ts +26 -0
  8. package/build/components/TableCells/CustomCells/BalanceCell/BalanceCell.js +1 -1
  9. package/build/components/TableCells/CustomCells/BalanceCell/BalanceCellSheet.d.ts +1 -1
  10. package/build/components/TableCells/CustomCells/BalanceCell/BalanceCellSheet.js +2 -4
  11. package/build/components/TableCells/CustomCells/BalanceCell/index.d.ts +0 -1
  12. package/build/components/TableCells/CustomCells/BalanceCell/index.js +0 -1
  13. package/build/components/TableCells/CustomCells/BalanceCell/type.d.ts +1 -1
  14. package/build/constants/table/cell/authorizationTableCellWidth.d.ts +1 -1
  15. package/build/constants/table/cell/authorizationTableCellWidth.js +1 -1
  16. package/build/constants/table/cell/refundTableCellWidth.d.ts +1 -1
  17. package/build/constants/table/cell/refundTableCellWidth.js +1 -1
  18. package/build/utils/index.d.ts +1 -0
  19. package/build/utils/index.js +1 -0
  20. package/build/utils/timezone.d.ts +2 -0
  21. package/build/utils/timezone.js +3 -0
  22. package/package.json +1 -1
  23. package/build/components/TableCells/CustomCells/BalanceCell/BalanceCellText.d.ts +0 -3
  24. package/build/components/TableCells/CustomCells/BalanceCell/BalanceCellText.js +0 -44
@@ -1,27 +1,3 @@
1
- import { MouseEvent } from 'react';
2
- import { PopperProps } from '@mui/material/Popper';
3
- import { SxProps } from '@mui/system';
4
- import type { CalenderMode, Timezone } from '../../types/index.js';
5
- import { RangeDatepickerProps } from './components/RangeDatepicker';
6
- interface RangeCalendarProps {
7
- defaultDate: [Date, Date];
8
- onDateChange: (date: [Date, Date]) => void;
9
- mode?: CalenderMode;
10
- onCalendarModeSwitch?: (mode: CalenderMode) => void;
11
- numberOfMonths?: number;
12
- noTimezone?: boolean;
13
- noQuickFilter?: boolean;
14
- maxDateRange?: number;
15
- onCalendarGroupChange?: (value: string) => void;
16
- groupBy?: string;
17
- timezone: Timezone | null;
18
- onChangeTimezone?: (timezone: Timezone) => void;
19
- defaultTimezone: Timezone;
20
- browserTimezone: string;
21
- renderCalendarButton?: (open: boolean, onOpenCalender: (event: MouseEvent<HTMLElement>) => void) => React.ReactNode;
22
- mainSx?: SxProps;
23
- popperProps?: Partial<PopperProps>;
24
- rangeDatePickerProps?: Partial<RangeDatepickerProps>;
25
- }
26
- declare function RangeCalender({ defaultDate, onDateChange, mode, onCalendarModeSwitch, numberOfMonths, noTimezone, noQuickFilter, maxDateRange, onCalendarGroupChange, groupBy, timezone, onChangeTimezone, defaultTimezone, browserTimezone, renderCalendarButton, mainSx, popperProps, rangeDatePickerProps, }: RangeCalendarProps): import("react/jsx-runtime").JSX.Element;
1
+ import { RangeCalendarProps } from './type';
2
+ declare function RangeCalender({ defaultDate, onDateChange, mode, onCalendarModeSwitch, numberOfMonths, noTimezone, noQuickFilter, maxDateRange, onCalendarGroupChange, groupBy, timezone, onChangeTimezone, browserTimezone, renderCalendarButton, mainSx, popperProps, rangeDatePickerProps, defaultCountryTimezone, timezoneCountriesCodes, }: RangeCalendarProps): import("react/jsx-runtime").JSX.Element;
27
3
  export default RangeCalender;
@@ -15,7 +15,7 @@ import CustomTimezone from './components/Timezone';
15
15
  import { ButtonsWrapper, CalenderWrapper, CancelButton, FiltersArea, Footer, Main, OkayButton, SelectedDate, TimeZone, Settings } from './style';
16
16
  import CustomTimePicker from './components/CustomTimepicker';
17
17
  import { getDateRange, getEndOfDate, getStartOfDate } from './utils';
18
- function RangeCalender({ defaultDate, onDateChange, mode = 'gregorian', onCalendarModeSwitch, numberOfMonths, noTimezone, noQuickFilter, maxDateRange, onCalendarGroupChange, groupBy, timezone, onChangeTimezone, defaultTimezone, browserTimezone, renderCalendarButton, mainSx, popperProps, rangeDatePickerProps, }) {
18
+ function RangeCalender({ defaultDate, onDateChange, mode = 'gregorian', onCalendarModeSwitch, numberOfMonths, noTimezone, noQuickFilter, maxDateRange, onCalendarGroupChange, groupBy, timezone, onChangeTimezone, browserTimezone, renderCalendarButton, mainSx, popperProps, rangeDatePickerProps, defaultCountryTimezone, timezoneCountriesCodes, }) {
19
19
  const [dates, setDates] = useState(getDateRange(defaultDate));
20
20
  const [values, setValues] = useState(dates);
21
21
  const [selectedTimezone, setSelectedTimezone] = useState(timezone);
@@ -90,6 +90,6 @@ function RangeCalender({ defaultDate, onDateChange, mode = 'gregorian', onCalend
90
90
  onCloseCalender();
91
91
  } })), _jsx(Popper, Object.assign({ open: open, anchorEl: anchorEl, placement: "bottom-end" }, popperProps, { children: _jsxs(CalenderWrapper, { children: [!noQuickFilter && (_jsxs(FiltersArea, { children: [_jsx(QuickFilters, { onChange: onChangeQuickFilter, isHijri: isHijri }), _jsxs(Settings, { children: [groupBy && (_jsx(GroupBy, { groupBy: selectedGroupBy, isCalenderOpen: open, onUpdate: (group) => {
92
92
  setSelectedGroupBy(group);
93
- } })), _jsx(Hijri, { isHijri: isHijri, onCalendarModeSwitch: onCalendarModeSwitch })] })] })), _jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', justifyContent: 'space-between' } }, { children: [_jsx(RangeDatePicker, Object.assign({ values: values, onChange: onChange, isHijri: isHijri, ref: calendarRef, numberOfMonths: numberOfMonths }, rangeDatePickerProps)), _jsx(Collapse, Object.assign({ in: isError && Boolean(maxDateRange) }, { children: _jsx(Error, { error: t('dateRangeError', { number: maxDateRange }), sx: { marginInline: '16px', marginBottom: '16px' } }) })), _jsxs(Footer, Object.assign({ sx: { borderBottomLeftRadius: '8px' } }, { children: [!noTimezone ? (_jsx(TimeZone, { children: _jsx(CustomTimezone, { onChange: setSelectedTimezone, selectedTimezone: selectedTimezone, defaultTimezone: defaultTimezone, browserTimezone: browserTimezone }, String(open)) })) : (_jsx("div", {})), new DateObject(values[0]).dayOfYear === new DateObject(values[1]).dayOfYear && (_jsx(CustomTimePicker, { values: values, setValues: setValues })), _jsxs(ButtonsWrapper, { children: [_jsx(CancelButton, Object.assign({ variant: "contained", onClick: onCloseCalender }, { children: t('cancel') })), _jsx(OkayButton, Object.assign({ variant: "contained", onClick: submitDate }, { children: t('okay') }))] })] }))] }))] }) }))] })));
93
+ } })), _jsx(Hijri, { isHijri: isHijri, onCalendarModeSwitch: onCalendarModeSwitch })] })] })), _jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', justifyContent: 'space-between' } }, { children: [_jsx(RangeDatePicker, Object.assign({ values: values, onChange: onChange, isHijri: isHijri, ref: calendarRef, numberOfMonths: numberOfMonths }, rangeDatePickerProps)), _jsx(Collapse, Object.assign({ in: isError && Boolean(maxDateRange) }, { children: _jsx(Error, { error: t('dateRangeError', { number: maxDateRange }), sx: { marginInline: '16px', marginBottom: '16px' } }) })), _jsxs(Footer, Object.assign({ sx: { borderBottomLeftRadius: '8px' } }, { children: [!noTimezone ? (_jsx(TimeZone, { children: _jsx(CustomTimezone, { onChange: setSelectedTimezone, selectedTimezone: selectedTimezone, browserTimezone: browserTimezone, defaultCountryTimezone: defaultCountryTimezone, timezoneCountriesCodes: timezoneCountriesCodes }, String(open)) })) : (_jsx("div", {})), new DateObject(values[0]).dayOfYear === new DateObject(values[1]).dayOfYear && (_jsx(CustomTimePicker, { values: values, setValues: setValues })), _jsxs(ButtonsWrapper, { children: [_jsx(CancelButton, Object.assign({ variant: "contained", onClick: onCloseCalender }, { children: t('cancel') })), _jsx(OkayButton, Object.assign({ variant: "contained", onClick: submitDate }, { children: t('okay') }))] })] }))] }))] }) }))] })));
94
94
  }
95
95
  export default RangeCalender;
@@ -3,9 +3,10 @@ import type { Timezone } from '../../../../types/index.js';
3
3
  interface CustomTimezoneProps {
4
4
  onChange: (timezone: Timezone) => void;
5
5
  selectedTimezone: Timezone | null;
6
- defaultTimezone: Timezone;
6
+ defaultCountryTimezone: Timezone;
7
7
  browserTimezone: string;
8
+ timezoneCountriesCodes: string[];
8
9
  }
9
- declare function CustomTimezone({ onChange, selectedTimezone, defaultTimezone, browserTimezone }: CustomTimezoneProps): import("react/jsx-runtime").JSX.Element;
10
+ declare function CustomTimezone({ onChange, selectedTimezone, browserTimezone, defaultCountryTimezone, timezoneCountriesCodes }: CustomTimezoneProps): import("react/jsx-runtime").JSX.Element;
10
11
  declare const _default: import("react").MemoExoticComponent<typeof CustomTimezone>;
11
12
  export default _default;
@@ -7,7 +7,7 @@ import { CountryFlag } from '../../../index.js';
7
7
  import { TimezoneWrapper, TimezoneDropdown, SelectedTimezone } from './style';
8
8
  import EntitiesTimezone from './components/EntitiesTimezone';
9
9
  import UserTimezone from './components/UserTimezone';
10
- function CustomTimezone({ onChange, selectedTimezone, defaultTimezone, browserTimezone }) {
10
+ function CustomTimezone({ onChange, selectedTimezone, browserTimezone, defaultCountryTimezone, timezoneCountriesCodes }) {
11
11
  const [anchorEl, setAnchorEl] = useState(null);
12
12
  const open = Boolean(anchorEl);
13
13
  const onClose = () => {
@@ -23,10 +23,10 @@ function CustomTimezone({ onChange, selectedTimezone, defaultTimezone, browserTi
23
23
  const selectedTimezoneIcon = useMemo(() => {
24
24
  if (browserTimezone === (selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.timezone))
25
25
  return userTimezoneIcon;
26
- if ((selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.timezone) === defaultTimezone.timezone)
26
+ if ((selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.timezone) === defaultCountryTimezone.timezone)
27
27
  return entityTimezoneIcon;
28
28
  return savedTimezoneIcon;
29
- }, [browserTimezone, defaultTimezone.timezone, selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.timezone]);
30
- return (_jsx(ClickAwayListener, Object.assign({ onClickAway: onClose }, { children: _jsxs(TimezoneWrapper, Object.assign({ "data-testid": "CustomTimezone" }, { children: [_jsxs(SelectedTimezone, Object.assign({ open: open, onClick: onOpen }, { children: [_jsx("img", { src: selectedTimezoneIcon, alt: "timezone-icon" }), _jsx(CountryFlag, { code: selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.countryCode }), _jsx("span", { children: selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.label })] })), _jsx(Popper, Object.assign({ open: open, anchorEl: anchorEl, placement: "top-start", sx: { zIndex: 1400 } }, { children: _jsxs(TimezoneDropdown, Object.assign({ "data-testid": "CustomTimezone_dropdown" }, { children: [_jsx(EntitiesTimezone, { onChange: updateTimezone, selectedTimezone: selectedTimezone, defaultTimezone: defaultTimezone }), _jsx(UserTimezone, { onChange: updateTimezone, selectedTimezone: selectedTimezone, browserTimezone: browserTimezone })] })) }))] })) })));
29
+ }, [browserTimezone, defaultCountryTimezone.timezone, selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.timezone]);
30
+ return (_jsx(ClickAwayListener, Object.assign({ onClickAway: onClose }, { children: _jsxs(TimezoneWrapper, Object.assign({ "data-testid": "CustomTimezone" }, { children: [_jsxs(SelectedTimezone, Object.assign({ open: open, onClick: onOpen }, { children: [_jsx("img", { src: selectedTimezoneIcon, alt: "timezone-icon" }), _jsx(CountryFlag, { code: selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.countryCode }), _jsx("span", { children: selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.label })] })), _jsx(Popper, Object.assign({ open: open, anchorEl: anchorEl, placement: "top-start", sx: { zIndex: 1400 } }, { children: _jsxs(TimezoneDropdown, Object.assign({ "data-testid": "CustomTimezone_dropdown" }, { children: [_jsx(EntitiesTimezone, { onChange: updateTimezone, selectedTimezone: selectedTimezone, defaultCountryTimezone: defaultCountryTimezone, timezoneCountriesCodes: timezoneCountriesCodes }), _jsx(UserTimezone, { onChange: updateTimezone, selectedTimezone: selectedTimezone, browserTimezone: browserTimezone })] })) }))] })) })));
31
31
  }
32
32
  export default memo(CustomTimezone);
@@ -2,11 +2,8 @@ import type { Timezone } from '../../../../../types/index.js';
2
2
  interface EntitiesTimezoneProps {
3
3
  selectedTimezone: Timezone | null;
4
4
  onChange: (selected: Timezone) => void;
5
- defaultTimezone: Timezone;
6
- getTimezoneByCountryCode?: (countryCode: string) => Timezone;
7
- segmentCountries?: {
8
- code: string;
9
- }[];
5
+ timezoneCountriesCodes?: string[];
6
+ defaultCountryTimezone: Timezone;
10
7
  }
11
- export default function EntitiesTimezone({ selectedTimezone, onChange, defaultTimezone, getTimezoneByCountryCode, segmentCountries, }: EntitiesTimezoneProps): import("react/jsx-runtime").JSX.Element;
8
+ export default function EntitiesTimezone({ selectedTimezone, onChange, timezoneCountriesCodes, defaultCountryTimezone }: EntitiesTimezoneProps): import("react/jsx-runtime").JSX.Element;
12
9
  export {};
@@ -3,8 +3,9 @@ import { useMemo, useState } from 'react';
3
3
  import Popper from '@mui/material/Popper';
4
4
  import { entityTimezoneIcon, smallBlueCheckIcon } from '../../../../../constants/index.js';
5
5
  import { CountryFlag } from '../../../../index.js';
6
+ import { getTimezoneByCountryCode } from '../../../../../utils/index.js';
6
7
  import { Label, Space, TimezoneDropdown, TimezoneElement } from '../style';
7
- export default function EntitiesTimezone({ selectedTimezone, onChange, defaultTimezone, getTimezoneByCountryCode, segmentCountries, }) {
8
+ export default function EntitiesTimezone({ selectedTimezone, onChange, timezoneCountriesCodes, defaultCountryTimezone }) {
8
9
  const [entitiesEl, setEntitiesEl] = useState(null);
9
10
  const onMouseEnter = (e) => {
10
11
  if (!entitiesEl)
@@ -18,17 +19,17 @@ export default function EntitiesTimezone({ selectedTimezone, onChange, defaultTi
18
19
  e.stopPropagation();
19
20
  onChange(tz);
20
21
  };
21
- const availableTimezones = useMemo(() => segmentCountries === null || segmentCountries === void 0 ? void 0 : segmentCountries.map(({ code }) => getTimezoneByCountryCode === null || getTimezoneByCountryCode === void 0 ? void 0 : getTimezoneByCountryCode(code)), [segmentCountries]);
22
+ const availableTimezones = useMemo(() => timezoneCountriesCodes === null || timezoneCountriesCodes === void 0 ? void 0 : timezoneCountriesCodes.map((code) => getTimezoneByCountryCode(code)), [timezoneCountriesCodes]);
22
23
  const isSelectedTimezoneOneOFTheAvailable = useMemo(() => availableTimezones === null || availableTimezones === void 0 ? void 0 : availableTimezones.some((item) => (selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.timezone) === (item === null || item === void 0 ? void 0 : item.timezone)), [availableTimezones, selectedTimezone]);
23
24
  const entityTimezone = useMemo(() => {
24
25
  if (!selectedTimezone)
25
- return defaultTimezone;
26
- return isSelectedTimezoneOneOFTheAvailable ? selectedTimezone : defaultTimezone;
27
- }, [selectedTimezone, defaultTimezone, isSelectedTimezoneOneOFTheAvailable]);
26
+ return defaultCountryTimezone;
27
+ return isSelectedTimezoneOneOFTheAvailable ? selectedTimezone : defaultCountryTimezone;
28
+ }, [selectedTimezone, defaultCountryTimezone, isSelectedTimezoneOneOFTheAvailable]);
28
29
  return (_jsxs(TimezoneElement, Object.assign({ onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onClick: () => {
29
30
  if (selectedTimezone)
30
31
  onChange(entityTimezone);
31
- } }, { children: [isSelectedTimezoneOneOFTheAvailable ? _jsx("img", { src: smallBlueCheckIcon, alt: "icon" }) : _jsx(Space, {}), _jsx("img", { src: entityTimezoneIcon, alt: "entity-timezone" }), _jsx(CountryFlag, { code: entityTimezone === null || entityTimezone === void 0 ? void 0 : entityTimezone.countryCode }), _jsx(Label, Object.assign({ className: isSelectedTimezoneOneOFTheAvailable ? 'selected' : '' }, { children: isSelectedTimezoneOneOFTheAvailable ? selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.label : defaultTimezone.label })), _jsx(Popper, Object.assign({ open: Boolean(entitiesEl), anchorEl: entitiesEl, placement: "right-start", sx: { zIndex: 3 }, disablePortal: true }, { children: _jsx(TimezoneDropdown, Object.assign({ sx: { maxHeight: 300 } }, { children: availableTimezones === null || availableTimezones === void 0 ? void 0 : availableTimezones.map((timeZone, idx) => {
32
+ } }, { children: [isSelectedTimezoneOneOFTheAvailable ? _jsx("img", { src: smallBlueCheckIcon, alt: "icon" }) : _jsx(Space, {}), _jsx("img", { src: entityTimezoneIcon, alt: "entity-timezone" }), _jsx(CountryFlag, { code: entityTimezone === null || entityTimezone === void 0 ? void 0 : entityTimezone.countryCode }), _jsx(Label, Object.assign({ className: isSelectedTimezoneOneOFTheAvailable ? 'selected' : '' }, { children: isSelectedTimezoneOneOFTheAvailable ? selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.label : defaultCountryTimezone === null || defaultCountryTimezone === void 0 ? void 0 : defaultCountryTimezone.label })), _jsx(Popper, Object.assign({ open: Boolean(entitiesEl), anchorEl: entitiesEl, placement: "right-start", sx: { zIndex: 3 }, disablePortal: true }, { children: _jsx(TimezoneDropdown, Object.assign({ sx: { maxHeight: 300 } }, { children: availableTimezones === null || availableTimezones === void 0 ? void 0 : availableTimezones.map((timeZone, idx) => {
32
33
  const isActive = (timeZone === null || timeZone === void 0 ? void 0 : timeZone.timezone) === (selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.timezone);
33
34
  return (_jsxs(TimezoneElement, Object.assign({ onClick: (e) => {
34
35
  onSelectTimezone(e, timeZone);
@@ -1,2 +1,28 @@
1
+ import { MouseEvent } from 'react';
2
+ import { PopperProps } from '@mui/material/Popper';
3
+ import { SxProps } from '@mui/system';
1
4
  import type { DateObject } from 'react-multi-date-picker';
5
+ import type { CalenderMode, Timezone } from '../../types/index.js';
6
+ import { RangeDatepickerProps } from './components/RangeDatepicker';
2
7
  export type Dates = [DateObject, DateObject];
8
+ export interface RangeCalendarProps {
9
+ defaultDate: [Date, Date];
10
+ onDateChange: (date: [Date, Date]) => void;
11
+ mode?: CalenderMode;
12
+ onCalendarModeSwitch?: (mode: CalenderMode) => void;
13
+ numberOfMonths?: number;
14
+ noTimezone?: boolean;
15
+ noQuickFilter?: boolean;
16
+ maxDateRange?: number;
17
+ onCalendarGroupChange?: (value: string) => void;
18
+ groupBy?: string;
19
+ timezone: Timezone | null;
20
+ onChangeTimezone?: (timezone: Timezone) => void;
21
+ defaultCountryTimezone: Timezone;
22
+ browserTimezone: string;
23
+ renderCalendarButton?: (open: boolean, onOpenCalender: (event: MouseEvent<HTMLElement>) => void) => React.ReactNode;
24
+ mainSx?: SxProps;
25
+ popperProps?: Partial<PopperProps>;
26
+ rangeDatePickerProps?: Partial<RangeDatepickerProps>;
27
+ timezoneCountriesCodes: string[];
28
+ }
@@ -21,7 +21,7 @@ import { BalanceCellContainer, PercentageContainer } from './style';
21
21
  import { formatPercentage } from './utils';
22
22
  import { PiePercentage } from '../style';
23
23
  function BalanceCell(_a) {
24
- var { percentage, days, remainingAmount, currency } = _a, props = __rest(_a, ["percentage", "days", "remainingAmount", "currency"]);
24
+ var { percentage = 0, days, remainingAmount, currency } = _a, props = __rest(_a, ["percentage", "days", "remainingAmount", "currency"]);
25
25
  const theme = useTheme();
26
26
  const currencyIcon = _jsx(CurrencyIcon, { currency: currency });
27
27
  const { integerAmount, decimalAmount } = formatAmountWithCurrency(remainingAmount, currency);
@@ -1,3 +1,3 @@
1
1
  import { BalanceCellSheetProps } from './type';
2
- declare function BalanceCellSheet({ percentage, remainingAmount, currency, selectionProps }: BalanceCellSheetProps): import("react/jsx-runtime").JSX.Element | null;
2
+ declare function BalanceCellSheet({ remainingAmount, currency, selectionProps }: BalanceCellSheetProps): import("react/jsx-runtime").JSX.Element;
3
3
  export default BalanceCellSheet;
@@ -1,12 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { CurrencyIcon, StatusChipWithCopy } from '../../../index.js';
3
3
  import { formatAmountWithCurrency } from '../../../../utils/index.js';
4
- function BalanceCellSheet({ percentage, remainingAmount, currency, selectionProps }) {
4
+ function BalanceCellSheet({ remainingAmount, currency, selectionProps }) {
5
5
  const currencyIcon = _jsx(CurrencyIcon, { currency: currency });
6
6
  const { integerAmount, decimalAmount } = formatAmountWithCurrency(remainingAmount, currency);
7
7
  const amount = `${integerAmount}.${decimalAmount}`;
8
- if (percentage === 0)
9
- return null;
10
- return (_jsxs(StatusChipWithCopy, Object.assign({ chipIndex: 0, copyText: `${integerAmount}.${decimalAmount}`, selectionProps: selectionProps }, { children: [percentage, "% | Remaining balance - ", currencyIcon, " ", amount] })));
8
+ return (_jsxs(StatusChipWithCopy, Object.assign({ chipIndex: 0, copyText: `${integerAmount}.${decimalAmount}`, selectionProps: selectionProps }, { children: [currencyIcon, " ", amount] })));
11
9
  }
12
10
  export default BalanceCellSheet;
@@ -1,4 +1,3 @@
1
1
  export { default as BalanceCell } from './BalanceCell';
2
2
  export { default as BalanceCellSheet } from './BalanceCellSheet';
3
- export { default as BalanceCellText } from './BalanceCellText';
4
3
  export * from './type';
@@ -1,4 +1,3 @@
1
1
  export { default as BalanceCell } from './BalanceCell';
2
2
  export { default as BalanceCellSheet } from './BalanceCellSheet';
3
- export { default as BalanceCellText } from './BalanceCellText';
4
3
  export * from './type';
@@ -1,7 +1,7 @@
1
1
  import { TableCellProps } from '@mui/material';
2
2
  import { SelectionProps } from '../../../../types/index.js';
3
3
  export interface BalanceCellCommonProps {
4
- percentage: number;
4
+ percentage?: number;
5
5
  remainingAmount?: number;
6
6
  currency?: string;
7
7
  }
@@ -17,7 +17,7 @@ export declare const authorizationTableCellWidth: {
17
17
  readonly balance: {
18
18
  readonly default: "60px";
19
19
  readonly text: "60px";
20
- readonly sheet: "250px";
20
+ readonly sheet: "150px";
21
21
  };
22
22
  readonly product: {
23
23
  readonly default: "85px";
@@ -17,7 +17,7 @@ export const authorizationTableCellWidth = {
17
17
  balance: {
18
18
  default: '60px',
19
19
  text: '60px',
20
- sheet: '250px',
20
+ sheet: '150px',
21
21
  },
22
22
  product: {
23
23
  default: '85px',
@@ -132,7 +132,7 @@ export declare const refundTableCellWidth: {
132
132
  readonly balance: {
133
133
  readonly default: "120px";
134
134
  readonly text: "150px";
135
- readonly sheet: "280px";
135
+ readonly sheet: "150px";
136
136
  };
137
137
  readonly status: {
138
138
  readonly default: "100px";
@@ -132,7 +132,7 @@ export const refundTableCellWidth = {
132
132
  balance: {
133
133
  default: '120px',
134
134
  text: '150px',
135
- sheet: '280px',
135
+ sheet: '150px',
136
136
  },
137
137
  status: {
138
138
  default: '100px',
@@ -43,3 +43,4 @@ export * from './day';
43
43
  export * from './style';
44
44
  export * from './boolean';
45
45
  export * from './columnResizeStorage';
46
+ export * from './timezone';
@@ -43,3 +43,4 @@ export * from './day';
43
43
  export * from './style';
44
44
  export * from './boolean';
45
45
  export * from './columnResizeStorage';
46
+ export * from './timezone';
@@ -0,0 +1,2 @@
1
+ export declare const getTimezoneByCountryCode: (code: string) => import("..").Timezone;
2
+ export declare const getTimezoneByTimezone: (timezone: string) => import("..").Timezone;
@@ -0,0 +1,3 @@
1
+ import { COUNTRIES_TIMEZONES } from '../constants/index.js';
2
+ export const getTimezoneByCountryCode = (code) => { var _a; return (_a = COUNTRIES_TIMEZONES.find((country) => country.countryCode === code)) !== null && _a !== void 0 ? _a : COUNTRIES_TIMEZONES[0]; };
3
+ export const getTimezoneByTimezone = (timezone) => { var _a; return (_a = COUNTRIES_TIMEZONES.find((country) => country.timezone === timezone)) !== null && _a !== void 0 ? _a : COUNTRIES_TIMEZONES[0]; };
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.1.222",
4
+ "version": "0.1.224",
5
5
  "testVersion": 0,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
@@ -1,3 +0,0 @@
1
- import { BalanceCellProps } from './type';
2
- declare function BalanceCellText({ percentage, days, remainingAmount, currency, ...props }: BalanceCellProps): import("react/jsx-runtime").JSX.Element | null;
3
- export default BalanceCellText;
@@ -1,44 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { useMemo } from 'react';
14
- import { useTheme } from '@mui/material/styles';
15
- import Tooltip from '../../../Tooltip';
16
- import { TableCell } from '../../../TableCells';
17
- import { CurrencyIcon } from '../../../index.js';
18
- import { formatAmountWithCurrency } from '../../../../utils/index.js';
19
- import { BalanceCellContainer } from './style';
20
- import { TextLabel } from '../style';
21
- function BalanceCellText(_a) {
22
- var { percentage, days, remainingAmount, currency } = _a, props = __rest(_a, ["percentage", "days", "remainingAmount", "currency"]);
23
- const theme = useTheme();
24
- const currencyIcon = _jsx(CurrencyIcon, { currency: currency });
25
- const { integerAmount, decimalAmount } = formatAmountWithCurrency(remainingAmount, currency);
26
- const amount = `${integerAmount}.${decimalAmount}`;
27
- const generatedTooltip = useMemo(() => {
28
- return (_jsxs(_Fragment, { children: ["Remaining Authorized Balance - ", currencyIcon, " ", amount] }));
29
- }, [remainingAmount, currency]);
30
- if (percentage === 0)
31
- return null;
32
- return (_jsx(TableCell, Object.assign({}, props, { children: _jsx("div", Object.assign({ style: {
33
- display: 'flex',
34
- alignItems: 'center',
35
- justifyContent: 'flex-start',
36
- gap: '8px',
37
- } }, { children: _jsx(Tooltip, Object.assign({ title: generatedTooltip }, { children: _jsx(BalanceCellContainer, Object.assign({ whileHover: ['animate', 'fadeIn'], animate: "start", sx: {
38
- zIndex: 22,
39
- height: 'auto',
40
- padding: '0',
41
- backgroundColor: `${theme.palette.grey.A700}1a`,
42
- } }, { children: _jsxs(TextLabel, { children: [percentage, "%"] }) })) })) })) })));
43
- }
44
- export default BalanceCellText;