feat: add @polar-sh/sveltekit (#539)

* feat add @polar-sh/sveltekit

* remove all lemonsqueezy text
This commit is contained in:
Rotimi Best
2025-01-09 01:30:01 +01:00
committed by GitHub
parent 4d4b1f12e2
commit 13fb58176f
46 changed files with 12475 additions and 10197 deletions
@@ -0,0 +1,9 @@
import { dev } from '$app/environment';
import { env } from '$env/dynamic/private';
import { CustomerPortal } from '@polar-sh/sveltekit';
export const GET = CustomerPortal({
accessToken: env.POLAR_ACCESS_TOKEN,
getCustomerId: async (e) => e.url.searchParams.get('customerId')!,
server: dev ? 'sandbox' : 'production'
});
@@ -1,5 +1,6 @@
import { dev } from '$app/environment';
import { env } from '$env/dynamic/private';
import { Checkout } from 'polar-sveltekit';
import { Checkout } from '@polar-sh/sveltekit';
export const GET = ({ ...params }) => {
const metadata = JSON.parse(params.url.searchParams.get('metadata') ?? '{}');
@@ -7,7 +8,8 @@ export const GET = ({ ...params }) => {
const request = Checkout({
accessToken: env.POLAR_ACCESS_TOKEN,
successUrl
successUrl,
server: dev ? 'sandbox' : 'production'
});
return request(params);
@@ -2,7 +2,7 @@ import { env } from '$env/dynamic/private';
import { getServerSupabase } from '$lib/utils/functions/supabase.server';
import { cancelOrgPlan, createOrgPlan, updateOrgPlan } from '$lib/utils/services/org';
import type { PolarWebhookPayload } from '$lib/utils/types/polar';
import { Webhooks } from 'polar-sveltekit';
import { Webhooks } from '@polar-sh/sveltekit';
import { PLAN } from 'shared/src/plans/constants';
export const POST = Webhooks({