Merge branch 'feat/inda-383-daily-stat' into 'main'
[ProtonMail-WebClient.git] / packages / pass / components / Invite / InviteContext.tsx
blobc263ec1a2c22f57e0d2f76b4fffb4300462359b2
1 import { createContext, useContext } from 'react';
3 import type { MaybeNull } from '@proton/pass/types';
4 import type { Invite } from '@proton/pass/types/data/invites';
5 import noop from '@proton/utils/noop';
7 import { type VaultInviteCreateValues } from './VaultInviteCreate';
9 export type InviteContextValue = {
10     latestInvite: MaybeNull<Invite>;
11     close: () => void;
12     createInvite: (props: VaultInviteCreateValues<false>) => void;
13     createSharedVault: (props: VaultInviteCreateValues<true>) => void;
14     manageAccess: (shareId: string) => void;
15     onInviteResponse: () => void;
16     onShareDisabled: (disabledShareId: string) => void;
17     respondToInvite: (invite: Invite) => void;
20 export const InviteContext = createContext<InviteContextValue>({
21     latestInvite: null,
22     close: noop,
23     createInvite: noop,
24     createSharedVault: noop,
25     manageAccess: noop,
26     onInviteResponse: noop,
27     onShareDisabled: noop,
28     respondToInvite: noop,
29 });
31 export const useInviteContext = () => useContext(InviteContext);