From 8af24fe79251c533302db9b0241abe2aeebe43a1 Mon Sep 17 00:00:00 2001 From: Tudor Morar Date: Thu, 28 Mar 2024 12:39:35 +0200 Subject: [PATCH] Fix missing safari consentPopups --- src/helpers/signAndSendTransactions.ts | 3 +-- src/localConstants/session/index.ts | 4 ++++ .../BatchTransactions/helpers/sendBatchTransactions.ts | 5 +++-- .../helpers/signAndAutoSendBatchTransactions.ts | 5 +++-- .../widgets/BatchTransactions/helpers/swapAndLockTokens.ts | 5 +++-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/helpers/signAndSendTransactions.ts b/src/helpers/signAndSendTransactions.ts index 5f8e8938..d98f165b 100644 --- a/src/helpers/signAndSendTransactions.ts +++ b/src/helpers/signAndSendTransactions.ts @@ -1,6 +1,7 @@ import { Transaction, TransactionsDisplayInfoType } from 'types'; import { refreshAccount, sendTransactions } from './sdkDappHelpers'; +import { isSafari } from 'localConstants'; type SignAndSendTransactionsProps = { transactions: Transaction[]; @@ -8,8 +9,6 @@ type SignAndSendTransactionsProps = { transactionsDisplayInfo: TransactionsDisplayInfoType; }; -const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); - export const signAndSendTransactions = async ({ transactions, callbackRoute, diff --git a/src/localConstants/session/index.ts b/src/localConstants/session/index.ts index 47728968..82def9ba 100644 --- a/src/localConstants/session/index.ts +++ b/src/localConstants/session/index.ts @@ -1 +1,5 @@ export * from './session.enums'; + +export const isSafari = /^((?!chrome|android).)*safari/i.test( + navigator.userAgent +); diff --git a/src/pages/Dashboard/widgets/BatchTransactions/helpers/sendBatchTransactions.ts b/src/pages/Dashboard/widgets/BatchTransactions/helpers/sendBatchTransactions.ts index 491b319b..52e67900 100644 --- a/src/pages/Dashboard/widgets/BatchTransactions/helpers/sendBatchTransactions.ts +++ b/src/pages/Dashboard/widgets/BatchTransactions/helpers/sendBatchTransactions.ts @@ -1,6 +1,6 @@ import { getBatchTransactions } from '../helpers'; import { sendTransactions } from 'helpers/sdkDappHelpers'; -import { SessionEnum } from 'localConstants/session'; +import { SessionEnum, isSafari } from 'localConstants/session'; import { SendTransactionProps } from '../types'; export const sendBatchTransactions = async ({ @@ -19,7 +19,8 @@ export const sendBatchTransactions = async ({ transactions, signWithoutSending: true, customTransactionInformation: { redirectAfterSign: true }, - callbackRoute + callbackRoute, + hasConsentPopup: isSafari }); if (error) { diff --git a/src/pages/Dashboard/widgets/BatchTransactions/helpers/signAndAutoSendBatchTransactions.ts b/src/pages/Dashboard/widgets/BatchTransactions/helpers/signAndAutoSendBatchTransactions.ts index 423eb9e2..416fcdb6 100644 --- a/src/pages/Dashboard/widgets/BatchTransactions/helpers/signAndAutoSendBatchTransactions.ts +++ b/src/pages/Dashboard/widgets/BatchTransactions/helpers/signAndAutoSendBatchTransactions.ts @@ -1,4 +1,4 @@ -import { SessionEnum } from 'localConstants/session'; +import { SessionEnum, isSafari } from 'localConstants/session'; import { getBatchTransactions } from '../helpers'; import { refreshAccount } from 'utils/sdkDappUtils'; import { sendBatchTransactions } from 'services/sdkDappServices'; @@ -34,7 +34,8 @@ export const signAndAutoSendBatchTransactions = async ({ errorMessage: 'An error has occurred during transaction execution', successMessage: 'Batch transactions successful' }, - callbackRoute + callbackRoute, + hasConsentPopup: isSafari }); if (error) { console.error('Could not execute transactions', error); diff --git a/src/pages/Dashboard/widgets/BatchTransactions/helpers/swapAndLockTokens.ts b/src/pages/Dashboard/widgets/BatchTransactions/helpers/swapAndLockTokens.ts index 98e7ebe4..045e6b0d 100644 --- a/src/pages/Dashboard/widgets/BatchTransactions/helpers/swapAndLockTokens.ts +++ b/src/pages/Dashboard/widgets/BatchTransactions/helpers/swapAndLockTokens.ts @@ -1,4 +1,4 @@ -import { SessionEnum } from 'localConstants/session'; +import { SessionEnum, isSafari } from 'localConstants/session'; import { getSwapAndLockTransactions } from '../helpers'; import { sendBatchTransactions } from 'services/sdkDappServices'; import { refreshAccount } from 'utils/sdkDappUtils'; @@ -32,7 +32,8 @@ export const swapAndLockTokens = async ({ errorMessage: 'An error has occurred during transaction execution', successMessage: 'Batch transactions successful' }, - callbackRoute + callbackRoute, + hasConsentPopup: isSafari }); if (error) {