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
@@ -116,7 +116,7 @@
<div class="relative mb-5">
{#if !isLMS && !isOnLandingPage}
<OverflowMenu
class="absolute right-2 top-2 z-50 rounded-full bg-gray-200 opacity-0 transition-all delay-150 duration-200 ease-in-out group-hover:opacity-100 dark:bg-neutral-800"
class="absolute right-2 top-2 z-40 rounded-full bg-gray-200 opacity-0 transition-all delay-150 duration-200 ease-in-out group-hover:opacity-100 dark:bg-neutral-800"
size="sm"
on:click={(e) => e.stopPropagation()}
>
@@ -1,32 +1,27 @@
<script>
import { Grid, Row, Column } from 'carbon-components-svelte';
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
import { VARIANTS } from '$lib/components/PrimaryButton/constants';
import { currentOrgPlan, isFreePlan } from '$lib/utils/store/org';
import SectionTitle from '../SectionTitle.svelte';
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
import { t } from '$lib/utils/functions/translations';
let isRedirecting = false;
import { currentOrgPlan, isFreePlan } from '$lib/utils/store/org';
import { Column, Grid, Row } from 'carbon-components-svelte';
import SectionTitle from '../SectionTitle.svelte';
async function onOpenBilling() {
console.log({
plan: $currentOrgPlan
});
if ($currentOrgPlan?.subscriptionId) {
isRedirecting = true;
fetch('/api/lmz/subscriptions?subscriptionId=' + $currentOrgPlan?.subscriptionId)
.then((response) => response.json())
.then((res) => {
isRedirecting = false;
window.open(res.customerPortal, '_blank');
});
if ($currentOrgPlan?.customerId) {
const url = new URL('/api/polar/portal', window.location.origin);
url.searchParams.set('customerId', $currentOrgPlan?.customerId);
window.open(url.toString(), '_blank');
}
}
</script>
<Grid class="border-c rounded border-gray-200 dark:border-neutral-600 w-full mt-5">
<Row class="flex lg:flex-row flex-col py-7 border-bottom-c">
<Grid class="border-c mt-5 w-full rounded border-gray-200 dark:border-neutral-600">
<Row class="border-bottom-c flex flex-col py-7 lg:flex-row">
<Column sm={4} md={4} lg={4}
><SectionTitle>{$t('settings.billing.sub_title')}</SectionTitle></Column
>
@@ -35,13 +30,13 @@
{#if $isFreePlan}
{$t('settings.billing.active')}
{:else}
<p class="mb-3">{$t('settings.billing.lemonsqueezy')}</p>
<p class="mb-3">{$t('settings.billing.provider')}</p>
<PrimaryButton
label={$t('settings.billing.open_billing')}
variant={VARIANTS.CONTAINED_DARK}
onClick={onOpenBilling}
isLoading={isRedirecting}
isDisabled={!$currentOrgPlan?.customerId}
/>
{/if}
</Column>
@@ -1,15 +1,12 @@
import { supabase } from '$lib/utils/functions/supabase';
import { getAccessToken } from '$lib/utils/functions/supabase';
export async function queryUnsplash(searchQuery: string) {
const { data } = await supabase.auth.getSession();
const accessToken = data.session?.access_token || '';
try {
const response = await fetch('/api/unsplash', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: accessToken
Authorization: await getAccessToken()
},
body: JSON.stringify({ searchQuery })
});