mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
feat(cli): add polar as better-auth plugin (#578)
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import { Polar } from "@polar-sh/sdk";
|
||||
|
||||
export const polarClient = new Polar({
|
||||
accessToken: process.env.POLAR_ACCESS_TOKEN,
|
||||
server: "sandbox",
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
const route = useRoute()
|
||||
const checkout_id = route.query.checkout_id as string
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="container mx-auto px-4 py-8">
|
||||
<h1 class="text-2xl font-bold mb-4">Payment Successful!</h1>
|
||||
<p v-if="checkout_id">Checkout ID: \{{ checkout_id }}</p>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,15 @@
|
||||
export default async function SuccessPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ checkout_id: string }>
|
||||
}) {
|
||||
const params = await searchParams;
|
||||
const checkout_id = params.checkout_id;
|
||||
|
||||
return (
|
||||
<div className="px-4 py-8">
|
||||
<h1>Payment Successful!</h1>
|
||||
{checkout_id && <p>Checkout ID: {checkout_id}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { useSearchParams } from "react-router";
|
||||
|
||||
export default function SuccessPage() {
|
||||
const [searchParams] = useSearchParams();
|
||||
const checkout_id = searchParams.get("checkout_id");
|
||||
|
||||
return (
|
||||
<div className="container mx-auto px-4 py-8">
|
||||
<h1>Payment Successful!</h1>
|
||||
{checkout_id && <p>Checkout ID: {checkout_id}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { createFileRoute, useSearch } from "@tanstack/react-router";
|
||||
|
||||
export const Route = createFileRoute("/success")({
|
||||
component: SuccessPage,
|
||||
validateSearch: (search) => ({
|
||||
checkout_id: search.checkout_id as string,
|
||||
}),
|
||||
});
|
||||
|
||||
function SuccessPage() {
|
||||
const { checkout_id } = useSearch({ from: "/success" });
|
||||
|
||||
return (
|
||||
<div className="container mx-auto px-4 py-8">
|
||||
<h1>Payment Successful!</h1>
|
||||
{checkout_id && <p>Checkout ID: {checkout_id}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { createFileRoute, useSearch } from "@tanstack/react-router";
|
||||
|
||||
export const Route = createFileRoute("/success")({
|
||||
component: SuccessPage,
|
||||
validateSearch: (search) => ({
|
||||
checkout_id: search.checkout_id as string,
|
||||
}),
|
||||
});
|
||||
|
||||
function SuccessPage() {
|
||||
const { checkout_id } = useSearch({ from: "/success" });
|
||||
|
||||
return (
|
||||
<div className="container mx-auto px-4 py-8">
|
||||
<h1>Payment Successful!</h1>
|
||||
{checkout_id && <p>Checkout ID: {checkout_id}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { createFileRoute } from "@tanstack/solid-router";
|
||||
import { Show } from "solid-js";
|
||||
|
||||
export const Route = createFileRoute("/success")({
|
||||
component: SuccessPage,
|
||||
validateSearch: (search) => ({
|
||||
checkout_id: search.checkout_id as string,
|
||||
}),
|
||||
});
|
||||
|
||||
function SuccessPage() {
|
||||
const searchParams = Route.useSearch();
|
||||
const checkout_id = searchParams().checkout_id;
|
||||
|
||||
return (
|
||||
<div class="container mx-auto px-4 py-8">
|
||||
<h1>Payment Successful!</h1>
|
||||
<Show when={checkout_id}>
|
||||
<p>Checkout ID: {checkout_id}</p>
|
||||
</Show>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
|
||||
const checkout_id = $page.url.searchParams.get('checkout_id');
|
||||
</script>
|
||||
|
||||
<div class="container mx-auto px-4 py-8">
|
||||
<h1>Payment Successful!</h1>
|
||||
{#if checkout_id}
|
||||
<p>Checkout ID: {checkout_id}</p>
|
||||
{/if}
|
||||
</div>
|
||||
Reference in New Issue
Block a user