feat: dashboard billing (#193)

* feat: move plans into sharable json

* remove unused code

* update pnpm lock

* update plans.json

* implement early adopter pricing

* docs: update meta title and description

* Finished the UI for upgrading plans

* Updated the pricing plans

* Updated the cards ui

* use relative import

* improve styling of upgrade plan card

* styling improvements, lemonsqueezy setup

* trigger lemonsqueezy payment and add webhook

* update pnpm lock

* add logout route

* feat: complete billing functionality

* generate lock file

* make crypto false on browser

* feat: adding upgrade prompts to org

* chore: add upgrade icon to upload video

* feat: add upgrade prompt to certificate and settings

* feat: implement onboarding setup page (#229)

* working on the onboarding setup

* working on the onboarding page

* Almost done with the onboarding UI

* finished the UI of the onBoarding setup

* finished the UI of the onBoarding setup

* Implementing the functions to carryout the logic of updating the UI onmount if a user has carried out a certain step or not

* Implementing the functions to carryout the logic of updating the UI onmount if a user has carried out a certain step or not

* making some chnages

* finished the onBoarding task

* updated some logic

* Removed the uneeded svg from the static folder

* fixed isCoursePublished not returning a boolean

* improved the setup link protection

* chore: make menuItems reactive

* improve formatting

* format supabase queries

---------

Co-authored-by: Rotimi Best <[email protected]>

* revamp setup

* improve the upgrade experience

* migration

* feat: add lemonsqueezy customer portal

---------

Co-authored-by: emmanuel <[email protected]>
This commit is contained in:
Rotimi Best
2024-04-07 06:08:34 +01:00
committed by GitHub
co-authored by emmanuel
parent 136e057954
commit fcd0bcc656
105 changed files with 1743 additions and 463 deletions
+21 -1
View File
@@ -5,6 +5,7 @@ import type { Writable } from 'svelte/store';
import type { CurrentOrg, OrgTeamMember, OrgAudience } from '../types/org';
import { ROLE } from '$lib/utils/constants/roles';
import type { UserLessonDataType } from '$lib/utils/types';
import { PLAN } from 'shared-constants/src/plans/constants';
export const defaultCurrentOrgState: CurrentOrg = {
id: '',
@@ -15,7 +16,8 @@ export const defaultCurrentOrgState: CurrentOrg = {
memberId: '',
role_id: '',
landingpage: {},
theme: ''
theme: '',
organization_plan: []
};
export const orgs = writable<CurrentOrg[]>([]);
@@ -26,6 +28,9 @@ export const isOrgAdmin = derived(
currentOrg,
($currentOrg) => parseInt($currentOrg.role_id) === ROLE.ADMIN
);
export const currentOrgPlan = derived(currentOrg, ($currentOrg) =>
$currentOrg.organization_plan.find((p) => p.is_active)
);
export const currentOrgPath = derived(currentOrg, ($currentOrg) =>
$currentOrg.siteName ? `/org/${$currentOrg.siteName}` : ''
);
@@ -38,6 +43,21 @@ export const currentOrgDomain = derived(currentOrg, ($currentOrg) => {
: '';
});
// Utility org store
export const isFreePlan = derived(
currentOrgPlan,
($plan) => !$plan || $plan.plan_name === PLAN.BASIC
);
export const currentOrgMaxAudience = derived(currentOrgPlan, ($plan) =>
!$plan
? 50
: $plan.plan_name === PLAN.EARLY_ADOPTER
? 10000
: $plan.plan_name === PLAN.ENTERPRISE
? Number.MAX_SAFE_INTEGER
: 50
);
// Quiz
export const createQuizModal = writable({
open: false,