Use same lock values as mobile clients
[ProtonMail-WebClient.git] / packages / shared / lib / calendar / crypto / keys / setupHolidaysCalendarHelper.ts
blob58fff6e140cf82407c716ef767b7236261c9d208
1 import { joinHolidaysCalendar } from '../../../api/calendars';
2 import type { Address, Api } from '../../../interfaces';
3 import type {
4     CalendarNotificationSettings,
5     HolidaysDirectoryCalendar,
6     JoinHolidayCalendarResponse,
7 } from '../../../interfaces/calendar';
8 import type { GetAddressKeys } from '../../../interfaces/hooks/GetAddressKeys';
9 import { getJoinHolidaysCalendarData } from '../../holidaysCalendar/holidaysCalendar';
11 interface Props {
12     holidaysCalendar: HolidaysDirectoryCalendar;
13     color: string;
14     notifications: CalendarNotificationSettings[];
15     addresses: Address[];
16     getAddressKeys: GetAddressKeys;
17     priority?: number;
18     api: Api;
20 const setupHolidaysCalendarHelper = async ({
21     holidaysCalendar,
22     color,
23     notifications,
24     addresses,
25     getAddressKeys,
26     priority,
27     api,
28 }: Props) => {
29     const { calendarID, addressID, payload } = await getJoinHolidaysCalendarData({
30         holidaysCalendar,
31         addresses,
32         getAddressKeys,
33         color,
34         notifications,
35         priority,
36     });
37     return api<JoinHolidayCalendarResponse>(joinHolidaysCalendar(calendarID, addressID, payload));
40 export default setupHolidaysCalendarHelper;