Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fix: broken paddle checkout view

Blue Mouse22b9da03c782
diff --git a/web/app/pages/Subscribe/Subscribe.tsx b/web/app/pages/Subscribe/Subscribe.tsx
index c9effcf07..ba3f69d64 100644
--- a/web/app/pages/Subscribe/Subscribe.tsx
+++ b/web/app/pages/Subscribe/Subscribe.tsx
@@ -47,17 +47,14 @@ const Subscribe = () => {
const [showAllPlans, setShowAllPlans] = useState(false)
const [hasCompletedCheckout, setHasCompletedCheckout] = useState(false)
- const [isCheckoutOpen, setIsCheckoutOpen] = useState(false)
const onPaddleEvent = useCallback(
(eventData: any) => {
if (eventData?.event === 'Checkout.Complete') {
setHasCompletedCheckout(true)
- } else if (eventData?.event === 'Checkout.Close') {
- setIsCheckoutOpen(false)
}
},
- [setIsCheckoutOpen, setHasCompletedCheckout],
+ [setHasCompletedCheckout],
)
const { isPaddleLoaded, paddleLoadError, openCheckout } = usePaddle({
@@ -140,11 +137,6 @@ const Subscribe = () => {
const opened = openCheckout({
product,
- method: 'inline',
- frameTarget: 'checkout-container',
- frameInitialHeight: 416,
- frameStyle:
- 'width:100%; min-width:312px; background-color: transparent; border: none; border-radius: 10px;',
email: user?.email,
passthrough: JSON.stringify({ uid: user?.id }),
locale: paddleLanguageMapping[i18n.language] || i18n.language,
@@ -153,18 +145,8 @@ const Subscribe = () => {
})
if (!opened) {
- setIsCheckoutOpen(false)
toast.error(t('apiNotifications.somethingWentWrong'))
- return
}
-
- setIsCheckoutOpen(true)
-
- setTimeout(() => {
- document
- .querySelector('#checkout-container')
- ?.scrollIntoView({ behavior: 'smooth' })
- }, 500)
}
const trialEndDate = user?.trialEndDate
@@ -350,50 +332,44 @@ const Subscribe = () => {
</div>
) : (
<>
- {!isCheckoutOpen && (
- <Button
- className='w-full justify-center'
- onClick={handleStartCheckout}
- primary
- giant
- >
- {t('checkout.next')}
- </Button>
- )}
-
- <div id='checkout-container' className='min-h-0 w-full' />
-
- {!isCheckoutOpen && (
- <Text
- as='p'
- size='xs'
- colour='muted'
- className='mt-4 text-center'
- >
- <Trans
- t={t}
- i18nKey='checkout.termsDesc'
- components={{
- privacy: (
- <a
- href={routes.privacy}
- target='_blank'
- rel='noopener noreferrer'
- className='font-medium underline decoration-dashed hover:decoration-solid'
- />
- ),
- tos: (
- <a
- href={routes.terms}
- target='_blank'
- rel='noopener noreferrer'
- className='font-medium underline decoration-dashed hover:decoration-solid'
- />
- ),
- }}
- />
- </Text>
- )}
+ <Button
+ className='w-full justify-center'
+ onClick={handleStartCheckout}
+ primary
+ giant
+ >
+ {t('checkout.next')}
+ </Button>
+
+ <Text
+ as='p'
+ size='xs'
+ colour='muted'
+ className='mt-4 text-center'
+ >
+ <Trans
+ t={t}
+ i18nKey='checkout.termsDesc'
+ components={{
+ privacy: (
+ <a
+ href={routes.privacy}
+ target='_blank'
+ rel='noopener noreferrer'
+ className='font-medium underline decoration-dashed hover:decoration-solid'
+ />
+ ),
+ tos: (
+ <a
+ href={routes.terms}
+ target='_blank'
+ rel='noopener noreferrer'
+ className='font-medium underline decoration-dashed hover:decoration-solid'
+ />
+ ),
+ }}
+ />
+ </Text>
</>
)}
</div>
diff --git a/web/app/pages/UserSettings/UserSettings.tsx b/web/app/pages/UserSettings/UserSettings.tsx
index 83640098a..37fd93c32 100644
--- a/web/app/pages/UserSettings/UserSettings.tsx
+++ b/web/app/pages/UserSettings/UserSettings.tsx
@@ -1556,7 +1556,7 @@ const UserSettings = () => {
) : null}
</div>
- <div id='checkout-container' className='mt-4' />
+ <div id='checkout-container' className='checkout-container mt-4' />
</SettingsSection>
</>
)}