feat: add @polar-sh/sveltekit (#539)
* feat add @polar-sh/sveltekit * remove all lemonsqueezy text
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
import { env } from '$env/dynamic/private';
|
||||
import { lemonSqueezySetup } from '@lemonsqueezy/lemonsqueezy.js';
|
||||
|
||||
export function configureLemonSqueezy() {
|
||||
return lemonSqueezySetup({
|
||||
apiKey: env.LEMON_SQUEEZY_API_KEY,
|
||||
onError: (error) => {
|
||||
throw new Error(`Lemon Squeezy API error: ${error.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import axios from 'axios';
|
||||
|
||||
interface SubscriptionData {
|
||||
productId: string;
|
||||
email: string;
|
||||
name: string;
|
||||
triggeredBy: string;
|
||||
orgId: string;
|
||||
}
|
||||
|
||||
interface SubscriptionResponse {
|
||||
success: boolean;
|
||||
checkoutURL: string;
|
||||
}
|
||||
|
||||
export async function subscribeToProduct(data: SubscriptionData): Promise<SubscriptionResponse> {
|
||||
const response = await axios({
|
||||
method: 'POST',
|
||||
url: '/api/lmz/subscribe',
|
||||
data
|
||||
});
|
||||
|
||||
return response.data;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { getServerSupabase } from '$lib/utils/functions/supabase.server';
|
||||
|
||||
const supabase = getServerSupabase();
|
||||
|
||||
export const validateUser = async (accessToken: string) => {
|
||||
let user;
|
||||
|
||||
try {
|
||||
const { data } = await supabase.auth.getUser(accessToken);
|
||||
user = data.user;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
throw new Error('Unauthenticated user');
|
||||
}
|
||||
|
||||
return user;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
export * from './authentication.server';
|
||||
@@ -1,4 +0,0 @@
|
||||
1. Welcome new user into classroomio
|
||||
2. Sends teacher welcome to course
|
||||
3. Notify teacher someone wants to buy course
|
||||
4
|
||||
@@ -77,7 +77,7 @@ export async function getOrganizations(userId: string, isOrgSite?: boolean, orgS
|
||||
organization_plan(
|
||||
plan_name,
|
||||
is_active,
|
||||
subscriptionId:payload->id
|
||||
customerId:payload->customerId
|
||||
)
|
||||
)
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user