export const redirectToLinkOnClick = async (redirectInfo, getAccessToken, user) => {
    if (redirectInfo) {
        if (getAccessToken) {
            const accessToken = await getAccessToken();
            const form = document.createElement('form');
            form.setAttribute('method', 'post');
            form.setAttribute('target', '_blank');
            form.setAttribute('action', redirectInfo);
            const params = { _tau: accessToken, unityuser: user === null || user === void 0 ? void 0 : user.email };
            for (const key in params) {
                if (params.hasOwnProperty(key)) {
                    const hiddenField = document.createElement('input');
                    hiddenField.type = 'hidden';
                    hiddenField.name = key;
                    hiddenField.value = params[key];
                    form.appendChild(hiddenField);
                }
            }
            document.body.appendChild(form);
            form.submit();
            form.remove();
        }
        else {
            let ulrEndpoint = `${redirectInfo}`;
            window.open(ulrEndpoint, '_blank');
        }
    }
};
//# sourceMappingURL=redirectToLink.js.map