@tap-payments/os-micro-frontend-shared 0.1.214 → 0.1.216

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.
@@ -32,7 +32,7 @@ function SelectBase(_a, ref) {
32
32
  (options === null || options === void 0 ? void 0 : options.map((option, idx) => {
33
33
  var _a;
34
34
  const isSelected = isOptionEqualToValue ? isOptionEqualToValue(option, value) : (option === null || option === void 0 ? void 0 : option.id) === (value === null || value === void 0 ? void 0 : value.id);
35
- return (_jsx(MenuItem, Object.assign({ value: (_a = (getOptionValue ? getOptionValue(option) : option === null || option === void 0 ? void 0 : option.id)) !== null && _a !== void 0 ? _a : '', onClick: () => {
35
+ return (_jsx(MenuItem, Object.assign({ disabled: !!option.disabled, value: (_a = (getOptionValue ? getOptionValue(option) : option === null || option === void 0 ? void 0 : option.id)) !== null && _a !== void 0 ? _a : '', onClick: () => {
36
36
  handleChange(option);
37
37
  }, sx: {
38
38
  fontSize: '12px',
@@ -5,7 +5,7 @@ import type { CalenderMode, Timezone } from '../../types/index.js';
5
5
  import { RangeDatepickerProps } from './components/RangeDatepicker';
6
6
  interface RangeCalendarProps {
7
7
  defaultDate: [Date, Date];
8
- onDateChange: (date: [Date, Date], timezoneOffset?: number) => void;
8
+ onDateChange: (date: [Date, Date]) => void;
9
9
  mode?: CalenderMode;
10
10
  onCalendarModeSwitch?: (mode: CalenderMode) => void;
11
11
  numberOfMonths?: number;
@@ -15,7 +15,6 @@ interface RangeCalendarProps {
15
15
  onCalendarGroupChange?: (value: string) => void;
16
16
  groupBy?: string;
17
17
  timezone: Timezone | null;
18
- onChangeTimezoneHistory?: (timezone: Timezone) => void;
19
18
  onChangeTimezone?: (timezone: Timezone) => void;
20
19
  defaultTimezone: Timezone;
21
20
  browserTimezone: string;
@@ -24,5 +23,5 @@ interface RangeCalendarProps {
24
23
  popperProps?: Partial<PopperProps>;
25
24
  rangeDatePickerProps?: Partial<RangeDatepickerProps>;
26
25
  }
27
- declare function RangeCalender({ defaultDate, onDateChange, mode, onCalendarModeSwitch, numberOfMonths, noTimezone, noQuickFilter, maxDateRange, onCalendarGroupChange, groupBy, timezone, onChangeTimezoneHistory, onChangeTimezone, defaultTimezone, browserTimezone, renderCalendarButton, mainSx, popperProps, rangeDatePickerProps, }: RangeCalendarProps): import("react/jsx-runtime").JSX.Element;
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;
28
27
  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, onChangeTimezoneHistory, onChangeTimezone, defaultTimezone, browserTimezone, renderCalendarButton, mainSx, popperProps, rangeDatePickerProps, }) {
18
+ function RangeCalender({ defaultDate, onDateChange, mode = 'gregorian', onCalendarModeSwitch, numberOfMonths, noTimezone, noQuickFilter, maxDateRange, onCalendarGroupChange, groupBy, timezone, onChangeTimezone, defaultTimezone, browserTimezone, renderCalendarButton, mainSx, popperProps, rangeDatePickerProps, }) {
19
19
  const [dates, setDates] = useState(getDateRange(defaultDate));
20
20
  const [values, setValues] = useState(dates);
21
21
  const [selectedTimezone, setSelectedTimezone] = useState(timezone);
@@ -43,26 +43,19 @@ function RangeCalender({ defaultDate, onDateChange, mode = 'gregorian', onCalend
43
43
  useEffect(() => {
44
44
  setSelectedTimezone(timezone);
45
45
  }, [timezone, open]);
46
- const updateTimezone = (newTimezone) => {
47
- onChangeTimezone === null || onChangeTimezone === void 0 ? void 0 : onChangeTimezone(newTimezone);
48
- onChangeTimezoneHistory === null || onChangeTimezoneHistory === void 0 ? void 0 : onChangeTimezoneHistory(newTimezone);
49
- };
50
- const formatDate = (date) => new Date(date.toDate().toLocaleString('en-us', {
51
- timeZone: selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.timezone,
52
- }));
53
46
  const submitDate = () => {
54
47
  setDates(values);
55
48
  onCloseCalender();
56
49
  let newDates;
57
50
  if (values[0].dayOfYear === values[1].dayOfYear) {
58
- newDates = [formatDate(values[0]), formatDate(values[1])];
51
+ newDates = [values[0], values[1]];
59
52
  }
60
53
  else {
61
- newDates = [formatDate(getStartOfDate(values[0])), formatDate(getEndOfDate(values[1]))];
54
+ newDates = [getStartOfDate(values[0]), getEndOfDate(values[1])];
62
55
  }
63
- onDateChange([newDates[0], newDates[1]], timezone === null || timezone === void 0 ? void 0 : timezone.offset);
56
+ onDateChange([newDates[0].toDate(), newDates[1].toDate()]);
64
57
  onCalendarGroupChange === null || onCalendarGroupChange === void 0 ? void 0 : onCalendarGroupChange(selectedGroupBy || 'day');
65
- updateTimezone(selectedTimezone);
58
+ onChangeTimezone === null || onChangeTimezone === void 0 ? void 0 : onChangeTimezone(selectedTimezone);
66
59
  };
67
60
  const getSelectedDate = () => {
68
61
  const startSelectedTime = dates[0].format('MMM D');
@@ -19,19 +19,19 @@ export default function EntitiesTimezone({ selectedTimezone, onChange, defaultTi
19
19
  onChange(tz);
20
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 isSelectedTimezoneOneOFTheAvailable = useMemo(() => availableTimezones === null || availableTimezones === void 0 ? void 0 : availableTimezones.find((item) => (selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.timezone) === (item === null || item === void 0 ? void 0 : item.timezone)), [availableTimezones, selectedTimezone]);
22
+ 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
23
  const entityTimezone = useMemo(() => {
24
24
  if (!selectedTimezone)
25
25
  return defaultTimezone;
26
26
  return isSelectedTimezoneOneOFTheAvailable ? selectedTimezone : defaultTimezone;
27
- }, [selectedTimezone, defaultTimezone]);
27
+ }, [selectedTimezone, defaultTimezone, isSelectedTimezoneOneOFTheAvailable]);
28
28
  return (_jsxs(TimezoneElement, Object.assign({ onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onClick: () => {
29
29
  if (selectedTimezone)
30
30
  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, { children: availableTimezones === null || availableTimezones === void 0 ? void 0 : availableTimezones.map((timeZone, idx) => {
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
32
  const isActive = (timeZone === null || timeZone === void 0 ? void 0 : timeZone.timezone) === (selectedTimezone === null || selectedTimezone === void 0 ? void 0 : selectedTimezone.timezone);
33
33
  return (_jsxs(TimezoneElement, Object.assign({ onClick: (e) => {
34
34
  onSelectTimezone(e, timeZone);
35
35
  }, sx: { gap: '4px' } }, { children: [isActive ? _jsx("img", { src: smallBlueCheckIcon, alt: "icon" }) : _jsx(Space, {}), _jsx(CountryFlag, { code: timeZone === null || timeZone === void 0 ? void 0 : timeZone.countryCode }), _jsx(Label, Object.assign({ className: isActive ? 'selected' : '' }, { children: timeZone === null || timeZone === void 0 ? void 0 : timeZone.label }))] }), `timezone-item-${idx}`));
36
- }) }) }))] })));
36
+ }) })) }))] })));
37
37
  }
@@ -554,3 +554,4 @@ export declare const exclamationOutlinedOrangeCircle: string;
554
554
  export declare const activeGreenIcon: string;
555
555
  export declare const inActiveGreyIcon: string;
556
556
  export declare const terminalLinkVideo: string;
557
+ export declare const bluePlusIcon: string;
@@ -562,3 +562,4 @@ export const exclamationOutlinedOrangeCircle = `${lightUrl}/exclamationOutlinedO
562
562
  export const activeGreenIcon = `${lightUrl}/activeGreenIcon.svg`;
563
563
  export const inActiveGreyIcon = `${lightUrl}/inActiveGreyIcon.svg`;
564
564
  export const terminalLinkVideo = `${videosUrl}/terminal_link.mp4`;
565
+ export const bluePlusIcon = `${lightUrl}/bluePlusIcon.svg`;
@@ -26,7 +26,7 @@ export const ACCEPTANCE_TIMEZONE = TIMEZONES.UTC;
26
26
  export const COUNTRIES_TIMEZONES = [
27
27
  { countryCode: 'SA', label: '(GMT:+0300) Saudi Arabia', timezone: 'Asia/Riyadh', offset: 3 },
28
28
  { countryCode: 'BH', label: '(GMT:+0300) Bahrain', timezone: 'Asia/Bahrain', offset: 3 },
29
- { countryCode: 'EG', label: '(GMT:+0200) Egypt', timezone: 'Africa/Cairo', offset: 2 },
29
+ { countryCode: 'EG', label: '(GMT:+0300) Egypt', timezone: 'Africa/Cairo', offset: 3 },
30
30
  { countryCode: 'LB', label: '(GMT:+0200) Lebanon', timezone: 'Asia/Beirut', offset: 2 },
31
31
  { countryCode: 'JO', label: '(GMT:+0300) Jordan', timezone: 'Asia/Amman', offset: 3 },
32
32
  { countryCode: 'KW', label: '(GMT:+0300) Kuwait', timezone: 'Asia/Kuwait', offset: 3 },
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.214",
4
+ "version": "0.1.216",
5
5
  "testVersion": 11,
6
6
  "type": "module",
7
7
  "main": "build/index.js",