import {
CLOSE_BUTTON_SVG,
POPUP_BLOCKED_SVG,
IMMUTABLE_LOGO_SVG,
PASSPORT_OVERLAY_CLOSE_ID,
PASSPORT_OVERLAY_ID,
PASSPORT_OVERLAY_TRY_AGAIN_ID,
PASSPORT_OVERLAY_CONTENTS_ID,
} from './constants';
const getCloseButton = (): string => `
`;
const getTryAgainButton = () => `
`;
const getBlockedContents = () => `
${IMMUTABLE_LOGO_SVG}
${POPUP_BLOCKED_SVG}
Pop-up blocked
Please try again below.
If the problem continues, adjust your
browser settings.
${getTryAgainButton()}
`;
const getGenericContents = () => `
${IMMUTABLE_LOGO_SVG}
Secure pop-up not showing?
We'll help you re-launch
${getTryAgainButton()}
`;
export const getOverlay = (contents: string): string => `
${getCloseButton()}
${contents ?? ''}
`;
export const getEmbeddedLoginPromptOverlay = (): string => `
`;
type LinkParams = {
id: string;
href: string;
rel?: string;
crossOrigin?: string;
};
export function addLink({
id,
href,
rel,
crossOrigin,
}: LinkParams): void {
const fullId = `${PASSPORT_OVERLAY_ID}-${id}`;
if (!document.getElementById(fullId)) {
const link: HTMLLinkElement = document.createElement('link');
link.id = fullId;
link.href = href;
if (rel) link.rel = rel;
if (crossOrigin) link.crossOrigin = crossOrigin;
document.head.appendChild(link);
}
}
export const getBlockedOverlay = () => getOverlay(getBlockedContents());
export const getGenericOverlay = () => getOverlay(getGenericContents());