From 86060fa54edb5b2ef88c1b28722e0e210c615ef0 Mon Sep 17 00:00:00 2001 From: 0xTxbi Date: Thu, 16 Jan 2025 17:05:57 +0100 Subject: [PATCH 1/4] update privy provider config --- unlock-app/src/config/PrivyProvider.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/unlock-app/src/config/PrivyProvider.tsx b/unlock-app/src/config/PrivyProvider.tsx index b4212ed64dd..74b470ee3d0 100644 --- a/unlock-app/src/config/PrivyProvider.tsx +++ b/unlock-app/src/config/PrivyProvider.tsx @@ -15,6 +15,7 @@ import { ToastHelper } from '~/components/helpers/toast.helper' import { locksmith } from './locksmith' import AuthenticationContext from '~/contexts/AuthenticationContext' import { MigrationModal } from '~/components/legacy-auth/MigrationNotificationModal' +import { isInIframe } from '~/utils/iframe' // check for legacy account export const checkLegacyAccount = async ( @@ -188,13 +189,21 @@ export const Privy = ({ children }: { children: ReactNode }) => { typeof window !== 'undefined' && window.location.pathname.includes('migrate-user') + // Check if we're in an iframe (paywall context) + const isInPaywall = isInIframe() + return ( Date: Thu, 16 Jan 2025 17:12:52 +0100 Subject: [PATCH 2/4] update check --- unlock-app/src/config/PrivyProvider.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/unlock-app/src/config/PrivyProvider.tsx b/unlock-app/src/config/PrivyProvider.tsx index 74b470ee3d0..860a418a62a 100644 --- a/unlock-app/src/config/PrivyProvider.tsx +++ b/unlock-app/src/config/PrivyProvider.tsx @@ -189,8 +189,9 @@ export const Privy = ({ children }: { children: ReactNode }) => { typeof window !== 'undefined' && window.location.pathname.includes('migrate-user') - // Check if we're in an iframe (paywall context) - const isInPaywall = isInIframe() + // Check if we're in an iframe && not in the Unlock dashboard + const isInPaywall = + isInIframe() && !window.location.href.includes(config.unlockApp) return ( From ddb915f419c254b80d21498bbe2dcc1d48ee9e57 Mon Sep 17 00:00:00 2001 From: 0xTxbi Date: Thu, 16 Jan 2025 17:21:35 +0100 Subject: [PATCH 3/4] fix comment typo --- unlock-app/src/config/PrivyProvider.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unlock-app/src/config/PrivyProvider.tsx b/unlock-app/src/config/PrivyProvider.tsx index 860a418a62a..bdd508d7bc4 100644 --- a/unlock-app/src/config/PrivyProvider.tsx +++ b/unlock-app/src/config/PrivyProvider.tsx @@ -197,7 +197,7 @@ export const Privy = ({ children }: { children: ReactNode }) => { Date: Thu, 16 Jan 2025 17:24:17 +0100 Subject: [PATCH 4/4] improve iframe util --- unlock-app/src/utils/iframe.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/unlock-app/src/utils/iframe.ts b/unlock-app/src/utils/iframe.ts index 1f3651fde85..5ac44ee897c 100644 --- a/unlock-app/src/utils/iframe.ts +++ b/unlock-app/src/utils/iframe.ts @@ -1,3 +1,4 @@ export const isInIframe = () => { + if (typeof window === 'undefined') return false return window !== window.parent || window.top !== window }