Redesign messenger connection settings
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user