import { IMetadataProvider } from '@memberjunction/core'; import { MJUserEntity, MJRoleEntity } from '@memberjunction/core-entities'; import { Observable } from 'rxjs'; import { ListShareInfo, ListPermissionLevel, ShareRecipient, ListShareResult } from '../models/list-sharing.models'; import * as i0 from "@angular/core"; /** * Service for managing list sharing using the existing ResourcePermission system. * Lists are already registered as a ResourceType, so we use ResourcePermissions * to share lists with users and roles. * * Multi-provider note: callers under a non-default provider should set * `service.Provider = component.ProviderToUse` before invoking any methods. */ export declare class ListSharingService { private loadingSubject; loading$: Observable; private usersCache; private rolesCache; private _provider; get Provider(): IMetadataProvider; set Provider(value: IMetadataProvider | null); constructor(); /** * Resolve the `MJ: Resource Types.ID` for the row named "Lists" via the * shared `ResourceTypeEngine`. Throws if missing — that indicates a * misconfigured environment (seed data never pushed) and we'd rather fail * loud than write `MJResourcePermission` rows with an undefined * `ResourceTypeID`. `Engine.Config()` is idempotent (BaseEngine semantics) * so calling this on every method that needs it is cheap. */ private resolveListResourceTypeId; /** * Get all shares for a specific list */ getListShares(listId: string): Promise; /** * Get permission level for a specific user on a specific list */ getUserPermissionLevel(listId: string, userId: string): Promise; /** * Share a list with a user */ shareListWithUser(listId: string, userId: string, permissionLevel: ListPermissionLevel, sharedByUserId: string): Promise; /** * Share a list with a role */ shareListWithRole(listId: string, roleId: string, permissionLevel: ListPermissionLevel, sharedByUserId: string): Promise; /** * Update permission level for an existing share */ updateSharePermission(shareId: string, newPermissionLevel: ListPermissionLevel): Promise; /** * Remove a share (revoke access) */ removeShare(shareId: string): Promise; /** * Get lists shared with the current user (that they don't own) */ getListsSharedWithUser(userId: string): Promise; /** * Get lists that the user has shared with others */ getListsSharedByUser(userId: string): Promise>; /** * Check if user can share a list (must be owner or have Owner permission) */ canUserShareList(listId: string, userId: string): Promise; /** * Search users for sharing autocomplete */ searchUsers(searchTerm: string, limit?: number): Promise; /** * Search roles for sharing autocomplete */ searchRoles(searchTerm: string, limit?: number): Promise; /** * Get all available users (cached) */ getAllUsers(forceRefresh?: boolean): Promise; /** * Get all available roles (cached) */ getAllRoles(forceRefresh?: boolean): Promise; /** * Helper to find existing share */ private findExistingShare; /** * Convert MJResourcePermissionEntity to ListShareInfo */ private convertToListShareInfo; /** * Get sharing summary for a single list */ getListSharingSummary(listId: string): Promise<{ listId: string; totalShares: number; userShares: number; roleShares: number; isSharedWithMe: boolean; isSharedByMe: boolean; }>; /** * Clear internal caches */ clearCache(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } //# sourceMappingURL=list-sharing.service.d.ts.map