import { ShareRight, ShareRightAction, ShareRightActionDisplayName, ShareRightWithVisibles, ShareUrls } from '@edifice.io/client'; import { ShareOptions, ShareResourceMutation } from '../ShareResources'; interface UseShareResourceModalProps { /** * Resource ID (assetId) */ resourceId: ShareOptions['resourceId']; /** * Resource Rights (based on the new rights array) */ resourceRights: ShareOptions['resourceRights']; /** * Resource Creator Id: Id of the user who created the resource */ resourceCreatorId: ShareOptions['resourceCreatorId']; shareResource?: ShareResourceMutation; onSuccess: () => void; setIsLoading?: (value: boolean) => void; resourceShareRights?: ShareRightWithVisibles; resourceShareRightActions?: ShareRightAction[]; filteredActions?: ShareRightActionDisplayName[]; shareUrls?: ShareUrls; } type State = { isSharing: boolean; isDirty?: boolean; shareRights: ShareRightWithVisibles; shareRightActions: ShareRightAction[]; }; export type ShareAction = { type: 'init'; payload: Partial; } | { type: 'updateShareRights'; payload: ShareRightWithVisibles; } | { type: 'toggleRight'; payload: ShareRightWithVisibles; } | { type: 'deleteRow'; payload: ShareRightWithVisibles; } | { type: 'isSharing'; payload: boolean; }; export default function useShare({ resourceId, resourceRights, resourceCreatorId, shareResource, setIsLoading, onSuccess, filteredActions, shareUrls, }: UseShareResourceModalProps): { state: { isSharing: boolean; isDirty?: boolean; shareRights: ShareRightWithVisibles; shareRightActions: ShareRightAction[]; }; dispatch: import('react').Dispatch; currentIsAuthor: () => boolean; myAvatar: string; handleDeleteRow: (shareRight: ShareRight) => void; handleShare: (notify?: boolean) => Promise; toggleRight: (shareRight: ShareRight, actionName: ShareRightActionDisplayName) => void; isDirty: boolean; }; export {};