import { getPortalUrl } from "../urls/get-portal-url";
/**
 * Construct a the full url to a portal thumbnail
 *
 * - If the portal has a thumbnail, construct the full url
 * - If the portal is not public, append on the token
 * @param portal
 * @param token
 * @returns
 */
export function getOrgThumbnailUrl(portal, token) {
    let thumbnailUrl = null;
    if (portal === null || portal === void 0 ? void 0 : portal.thumbnail) {
        const portalUrl = getPortalUrl(portal);
        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
        thumbnailUrl = `${portalUrl}/sharing/rest/portals/${portal.id}/resources/${portal.thumbnail}`;
        if (token && portal.access !== "public") {
            thumbnailUrl = `${thumbnailUrl}?token=${token}`;
        }
    }
    return thumbnailUrl;
}
//# sourceMappingURL=get-org-thumbnail-url.js.map