Member Junction
    Preparing search index...

    Service for managing user avatar operations across the application.

    NOTE: This service does NOT depend on any Explorer-specific packages to remain usable across different Angular applications. All auth provider logic should be handled by the calling code.

    Index

    Constructors

    Methods

    • Converts a File to a Base64 data URI string Used for file uploads in settings UI

      Parameters

      • file: File

      Returns Promise<string>

    • Gets the display URL for an avatar based on user settings Priority: UserImageURL > UserImageIconClass > default

      Parameters

      • user: MJUserEntity

        The MJUserEntity

      • defaultUrl: string = 'assets/user.png'

        Optional default URL if no avatar is set

      Returns string | null

      The URL to display, or null if using an icon

    • Gets the icon class for an avatar if using icon mode

      Parameters

      Returns string | null

    • Validates if a string is a valid Base64 data URI

      Parameters

      • dataUri: string

      Returns boolean

    • Validates if a string is a valid URL

      Parameters

      • url: string

      Returns boolean

    • Syncs the signed-in user's avatar from an image URL (typically from the auth provider profile). Downloads the image, converts it to a Base64 data URI and saves it through UpdateMyAvatar, then reloads user so it is clean and current.

      Parameters

      • user: MJUserEntity

        the signed-in user's MJUserEntity; any other user is refused

      • imageUrl: string

        URL to the image (can be from Microsoft Graph, Google, etc.)

      • OptionalauthHeaders: Record<string, string>

        Optional headers for authenticated requests (e.g., { 'Authorization': 'Bearer token' })

      Returns Promise<boolean>

      Promise - true if avatar was synced and saved, false otherwise

    • Sets the SIGNED-IN user's avatar through the server's self-service UpdateMyAvatar mutation.

      Use this rather than saving the MJ: Users row: the mutation needs no Update permission on MJ: Users, which locked-down deployments do not grant, and it writes only the two avatar columns. The server validates the values and always acts on the caller's own row.

      Parameters

      • imageURL: string | null

        a base64 image data URI or an http(s) URL; null clears it

      • iconClass: string | null

        a Font Awesome class list; null clears it

      • Optionalprovider: IMetadataProvider | IEntityDataProvider

        the GraphQL provider to call; defaults to the global provider

      Returns Promise<UpdateMyAvatarResult>

      the server's outcome; never throws