Skip to content

Commit ea286e1

Browse files
authored
Feat embedded stripe (#2284)
* wip * cleanup * Add embedded upgrades * fix color * update routes * cleanup * Changes to modals * minor fixes
1 parent f47711a commit ea286e1

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/containers/Subscribtion/Home.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@ import { SignIn } from './SignIn'
1717

1818
export function SubscribeHome({ returnUrl, isTrial }: { returnUrl?: string; isTrial?: boolean }) {
1919
const router = useRouter()
20-
const { isAuthenticated, loaders, user } = useAuthContext()
20+
const { isAuthenticated, loaders, user, resendVerification } = useAuthContext()
21+
const isWalletUser = user?.email?.includes('@defillama.com')
22+
2123
const { subscription, isSubscriptionFetching, apiSubscription, llamafeedSubscription } = useSubscribe()
2224
const [billingInterval, setBillingInterval] = useState<'year' | 'month'>('month')
2325
const isSubscribed = subscription?.status === 'active'
2426
const [isClient, setIsClient] = useState(false)
27+
const [showEmailForm, setShowEmailForm] = useState(false)
2528

2629
const queryClient = useQueryClient()
2730
const [showReturnModal, setShowReturnModal] = useState(false)
@@ -54,6 +57,12 @@ export function SubscribeHome({ returnUrl, isTrial }: { returnUrl?: string; isTr
5457
setHasShownModal(false)
5558
}, [returnUrl])
5659

60+
const handleResendVerification = async () => {
61+
if (user?.email) {
62+
resendVerification(user.email)
63+
}
64+
}
65+
5766
if (
5867
loaders &&
5968
(loaders.userLoading || loaders.userFetching || (isClient && (isSubscriptionFetching || !subscription)))
@@ -291,7 +300,7 @@ export function SubscribeHome({ returnUrl, isTrial }: { returnUrl?: string; isTr
291300
subscription?.provider !== 'trial'
292301
}
293302
billingInterval={billingInterval}
294-
currentBillingInterval={llamafeedSubscription?.billingInterval}
303+
currentBillingInterval={llamafeedSubscription?.billing_interval}
295304
/>
296305
</div>
297306
<div
@@ -304,7 +313,7 @@ export function SubscribeHome({ returnUrl, isTrial }: { returnUrl?: string; isTr
304313
context="page"
305314
isLegacyActive={apiSubscription?.status === 'active' && apiSubscription?.provider === 'legacy'}
306315
billingInterval={billingInterval}
307-
currentBillingInterval={apiSubscription?.billingInterval}
316+
currentBillingInterval={apiSubscription?.billing_interval || 'month'}
308317
active={apiSubscription?.status === 'active' && apiSubscription?.provider !== 'legacy'}
309318
/>
310319
</div>

0 commit comments

Comments
 (0)