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>;
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>({
24 createSharedVault: noop,
26 onInviteResponse: noop,
27 onShareDisabled: noop,
28 respondToInvite: noop,
31 export const useInviteContext = () => useContext(InviteContext);