Redesign messenger connection settings

This commit is contained in:
Ruslan Bakiev
2026-04-06 15:51:10 +07:00
parent 824065f852
commit 17b5a87699
6 changed files with 293 additions and 82 deletions

View File

@@ -18,6 +18,7 @@ type MessengerStartInput = {
export function useMessengerStart() {
const pendingChannel = ref<MessengerChannel | null>(null);
const maxMiniApp = useMaxMiniApp();
async function openMessengerBot({ channel, baseUrl, email, redirectPath }: MessengerStartInput) {
pendingChannel.value = channel;
@@ -38,7 +39,17 @@ export function useMessengerStart() {
const startUrl = buildMessengerBotStartUrl(baseUrl, payload.startToken);
if (import.meta.client) {
window.open(startUrl, '_blank', 'noopener,noreferrer');
if (
channel === 'MAX'
&& maxMiniApp.isAvailable.value
&& startUrl.startsWith('https://max.ru/')
&& typeof maxMiniApp.webApp.value?.openMaxLink === 'function'
) {
maxMiniApp.webApp.value.openMaxLink(startUrl);
}
else {
window.open(startUrl, '_blank', 'noopener,noreferrer');
}
}
return payload;