2
0

🚸 (bot) Show a popup when the redirect is blocked by browser

Allows us to show a link button to redirect the user anyway
This commit is contained in:
Baptiste Arnaud
2023-02-20 08:36:48 +01:00
parent e6ec84b77b
commit b2d1235f1b
9 changed files with 148 additions and 34 deletions

View File

@ -7,20 +7,20 @@ import type { ChatReply } from 'models'
export const executeClientSideAction = async (
clientSideAction: NonNullable<ChatReply['clientSideActions']>[0]
) => {
): Promise<{ blockedPopupUrl: string } | void> => {
if ('chatwoot' in clientSideAction) {
executeChatwoot(clientSideAction.chatwoot)
return executeChatwoot(clientSideAction.chatwoot)
}
if ('googleAnalytics' in clientSideAction) {
executeGoogleAnalyticsBlock(clientSideAction.googleAnalytics)
return executeGoogleAnalyticsBlock(clientSideAction.googleAnalytics)
}
if ('scriptToExecute' in clientSideAction) {
await executeScript(clientSideAction.scriptToExecute)
return executeScript(clientSideAction.scriptToExecute)
}
if ('redirect' in clientSideAction) {
executeRedirect(clientSideAction.redirect)
return executeRedirect(clientSideAction.redirect)
}
if ('wait' in clientSideAction) {
await executeWait(clientSideAction.wait)
return executeWait(clientSideAction.wait)
}
}