1 import type { SenderImageMode } from '@proton/shared/lib/api/images';
2 import { getLogo } from '@proton/shared/lib/api/images';
3 import { createUrl } from '@proton/shared/lib/fetch/helpers';
4 import { rootFontSize } from '@proton/shared/lib/helpers/dom';
6 export const getImageSize = () => {
7 if (window.devicePixelRatio >= 4) {
11 if (window.devicePixelRatio > 1) {
16 If the user has changed the default font size
17 (via browser settings or accessibility settings)
18 then increase the image definition
20 const fontSize = rootFontSize();
28 export const getSenderImageUrl = (
33 bimiSelector?: string,
34 mode?: SenderImageMode
36 const cleanedEmailAddress = emailAddress.toLowerCase();
37 const config = getLogo(cleanedEmailAddress, size, bimiSelector, mode, UID);
38 const prefixedUrl = `${apiUrl}/${config.url}`;
39 const url = createUrl(prefixedUrl, config.params, window.location.origin);
40 return url.toString();