1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-08-04 20:37:29 +02:00

add working pro modal n checkout

This commit is contained in:
Kushagra Gour
2024-03-05 13:49:52 +05:30
parent e89c2348e4
commit 4c4dc1f2e0
7 changed files with 112 additions and 23 deletions

35
src/components/Pro.jsx Normal file
View File

@@ -0,0 +1,35 @@
import { useEffect, useState } from 'preact/hooks';
import { ProBadge } from './ProBadge';
import { HStack, Stack, VStack } from './Stack';
import Switch from './Switch';
import { alertsService } from '../notifications';
import { A, Button } from './common';
import { useCheckout } from '../hooks/useCheckout';
export function Pro({ user }) {
const hasCheckoutLoaded = useCheckout();
useEffect(() => {
if (hasCheckoutLoaded) {
window.LemonSqueezy.Setup({
eventHandler: e => {
console.log('eventHandler', e);
if (e.event === 'Checkout.Success') {
window.location.reload();
}
}
});
window.LemonSqueezy.Refresh();
}
}, [hasCheckoutLoaded]);
return (
<VStack gap={4} align="stretch">
<A
class="btn lemonsqueezy-button"
href={`https://web-maker.lemonsqueezy.com/checkout/buy/1601bc00-9623-435b-b1de-2a70a2445c13?embed=1&checkout[custom][userId]=${user.uid}`}
>
Go <ProBadge />
</A>
</VStack>
);
}