feat: enable subscription via yearly plan
This commit is contained in:
@@ -64,7 +64,7 @@ export interface OrgLandingPageJson {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export let landingPageSettings: Writable<OrgLandingPageJson> = writable({
|
export const landingPageSettings: Writable<OrgLandingPageJson> = writable({
|
||||||
header: {
|
header: {
|
||||||
title: 'Web Development Courses for',
|
title: 'Web Development Courses for',
|
||||||
titleHighlight: 'Everyone',
|
titleHighlight: 'Everyone',
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
let orgPlanChannel: RealtimeChannel;
|
let orgPlanChannel: RealtimeChannel;
|
||||||
let open = false;
|
let open = false;
|
||||||
let upgraded = false;
|
let upgraded = false;
|
||||||
|
let isYearlyPlan = false;
|
||||||
|
|
||||||
async function handleClick(plan, planName: string) {
|
async function handleClick(plan, planName: string) {
|
||||||
if (plan.CTA.IS_DISABLED || !$profile.id) {
|
if (plan.CTA.IS_DISABLED || !$profile.id) {
|
||||||
@@ -41,7 +42,7 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const { checkoutURL } = await subscribeToProduct({
|
const { checkoutURL } = await subscribeToProduct({
|
||||||
productId: plan.CTA.PRODUCT_ID,
|
productId: isYearlyPlan ? plan.CTA.PRODUCT_ID_YEARLY : plan.CTA.PRODUCT_ID,
|
||||||
email: $profile.email,
|
email: $profile.email,
|
||||||
name: $profile.fullname,
|
name: $profile.fullname,
|
||||||
triggeredBy: $currentOrg.memberId,
|
triggeredBy: $currentOrg.memberId,
|
||||||
@@ -89,6 +90,9 @@
|
|||||||
function onLearnMore() {
|
function onLearnMore() {
|
||||||
window.open('https://classroomio.com/blog/early-adopter', '_blank');
|
window.open('https://classroomio.com/blog/early-adopter', '_blank');
|
||||||
}
|
}
|
||||||
|
function toggleIsYearlyPlan() {
|
||||||
|
isYearlyPlan = !isYearlyPlan;
|
||||||
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
orgPlanChannel = supabase
|
orgPlanChannel = supabase
|
||||||
@@ -124,6 +128,7 @@
|
|||||||
width="w-4/5"
|
width="w-4/5"
|
||||||
maxWidth={upgraded ? 'max-w-[600px]' : undefined}
|
maxWidth={upgraded ? 'max-w-[600px]' : undefined}
|
||||||
modalHeading={$t('pricing.modal.heading')}
|
modalHeading={$t('pricing.modal.heading')}
|
||||||
|
containerClass="pt-4"
|
||||||
>
|
>
|
||||||
{#if upgraded}
|
{#if upgraded}
|
||||||
<div class="flex flex-col items-center justify-center mb-4 w-full relative">
|
<div class="flex flex-col items-center justify-center mb-4 w-full relative">
|
||||||
@@ -147,6 +152,29 @@
|
|||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="flex flex-col items-center justify-center">
|
<div class="flex flex-col items-center justify-center">
|
||||||
|
<div class="relative mb-2 flex items-center rounded-[30px] border-[2px] p-[2px] lg:scale-100">
|
||||||
|
<button
|
||||||
|
style="background-color: {isYearlyPlan ? 'initial' : '#1D4EE2'}; color: {isYearlyPlan
|
||||||
|
? '#5e636b'
|
||||||
|
: '#fff'}"
|
||||||
|
class="rounded-[30px] bg-blue-700 px-3 py-1 text-xs text-white lg:px-4 lg:py-2"
|
||||||
|
on:click={toggleIsYearlyPlan}>{$t('pricing.modal.monthly')}</button
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
style="background-color: {isYearlyPlan ? '#1D4EE2' : ''}; color: {isYearlyPlan
|
||||||
|
? '#fff'
|
||||||
|
: '#5e636b'}"
|
||||||
|
class="relative rounded-[30px] px-3 py-1 text-xs text-white lg:px-4 lg:py-2"
|
||||||
|
on:click={toggleIsYearlyPlan}
|
||||||
|
>
|
||||||
|
{$t('pricing.modal.annually')}
|
||||||
|
<div
|
||||||
|
class="absolute right-[-40%] -top-4 scale-[90%] rounded-full bg-[#006600] px-1.5 py-1 text-[0.7rem] text-white"
|
||||||
|
>
|
||||||
|
Save 2 months
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<div class="isolate grid grid-cols-1 gap-3 lg:grid-cols-3">
|
<div class="isolate grid grid-cols-1 gap-3 lg:grid-cols-3">
|
||||||
{#each planNames as planName}
|
{#each planNames as planName}
|
||||||
<div
|
<div
|
||||||
@@ -167,10 +195,7 @@
|
|||||||
: 'text-black'} dark:text-gray-300"
|
: 'text-black'} dark:text-gray-300"
|
||||||
>
|
>
|
||||||
{PLANS[planName].PRICE.CURRENCY}
|
{PLANS[planName].PRICE.CURRENCY}
|
||||||
{PLANS[planName].PRICE.MONTHLY}
|
{isYearlyPlan ? PLANS[planName].PRICE.YEARLY : PLANS[planName].PRICE.MONTHLY}
|
||||||
{#if !PLANS[planName].PRICE.IS_PREMIUM}
|
|
||||||
/month
|
|
||||||
{/if}
|
|
||||||
</p>
|
</p>
|
||||||
<p
|
<p
|
||||||
class=" mt-4 text-sm font-light leading-6 {planName === 'EARLY_ADOPTER'
|
class=" mt-4 text-sm font-light leading-6 {planName === 'EARLY_ADOPTER'
|
||||||
|
|||||||
@@ -1069,7 +1069,9 @@
|
|||||||
"plan": "Ihr Plan beinhaltet coole Vergünstigungen und Vorteile, einschließlich Zugriff auf alle zukünftigen Funktionen, die wir veröffentlichen.",
|
"plan": "Ihr Plan beinhaltet coole Vergünstigungen und Vorteile, einschließlich Zugriff auf alle zukünftigen Funktionen, die wir veröffentlichen.",
|
||||||
"close": "Schließen",
|
"close": "Schließen",
|
||||||
"learn": "Erfahren Sie mehr",
|
"learn": "Erfahren Sie mehr",
|
||||||
"month": "Monat"
|
"month": "Monat",
|
||||||
|
"monthly": "Monatlich",
|
||||||
|
"annually": "Jährlich"
|
||||||
},
|
},
|
||||||
"plan_names": {
|
"plan_names": {
|
||||||
"free": "Frei",
|
"free": "Frei",
|
||||||
|
|||||||
@@ -219,7 +219,9 @@
|
|||||||
"plan": "Your plan comes with cool perks and benefits including access to all future features we release.",
|
"plan": "Your plan comes with cool perks and benefits including access to all future features we release.",
|
||||||
"close": "Close",
|
"close": "Close",
|
||||||
"learn": "Learn more",
|
"learn": "Learn more",
|
||||||
"month": "month"
|
"month": "month",
|
||||||
|
"monthly": "Monthly",
|
||||||
|
"annually": "Annually"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1336,8 +1338,8 @@
|
|||||||
"validations": {
|
"validations": {
|
||||||
"user_profile": {
|
"user_profile": {
|
||||||
"email": "Invalid email address",
|
"email": "Invalid email address",
|
||||||
"username":"Username cannot be empty",
|
"username": "Username cannot be empty",
|
||||||
"fullname":"Name should be minimum of 5 characters"
|
"fullname": "Name should be minimum of 5 characters"
|
||||||
},
|
},
|
||||||
"organization_name": {
|
"organization_name": {
|
||||||
"min_char": "Organization must contain 5 or more characters",
|
"min_char": "Organization must contain 5 or more characters",
|
||||||
|
|||||||
@@ -1069,7 +1069,9 @@
|
|||||||
"plan": "Su plan viene con ventajas y beneficios interesantes, incluido el acceso a todas las funciones futuras que lancemos.",
|
"plan": "Su plan viene con ventajas y beneficios interesantes, incluido el acceso a todas las funciones futuras que lancemos.",
|
||||||
"close": "Cerca",
|
"close": "Cerca",
|
||||||
"learn": "Aprende más",
|
"learn": "Aprende más",
|
||||||
"month": "mes"
|
"month": "mes",
|
||||||
|
"monthly": "Mensual",
|
||||||
|
"annually": "Anualmente"
|
||||||
},
|
},
|
||||||
"plan_names": {
|
"plan_names": {
|
||||||
"free": "Gratis",
|
"free": "Gratis",
|
||||||
|
|||||||
@@ -1069,7 +1069,9 @@
|
|||||||
"plan": "Votre forfait s'accompagne d'avantages et d'avantages intéressants, notamment l'accès à toutes les futures fonctionnalités que nous publions.",
|
"plan": "Votre forfait s'accompagne d'avantages et d'avantages intéressants, notamment l'accès à toutes les futures fonctionnalités que nous publions.",
|
||||||
"close": "Fermer",
|
"close": "Fermer",
|
||||||
"learn": "Apprendre encore plus",
|
"learn": "Apprendre encore plus",
|
||||||
"month": "mois"
|
"month": "mois",
|
||||||
|
"monthly": "Mensuel",
|
||||||
|
"annually": "Annuellement"
|
||||||
},
|
},
|
||||||
"plan_names": {
|
"plan_names": {
|
||||||
"free": "Gratuit",
|
"free": "Gratuit",
|
||||||
|
|||||||
@@ -1069,7 +1069,9 @@
|
|||||||
"plan": "आपकी योजना हमारे द्वारा जारी की जाने वाली सभी भविष्य की सुविधाओं तक पहुंच सहित शानदार सुविधाओं और लाभों के साथ आती है।",
|
"plan": "आपकी योजना हमारे द्वारा जारी की जाने वाली सभी भविष्य की सुविधाओं तक पहुंच सहित शानदार सुविधाओं और लाभों के साथ आती है।",
|
||||||
"close": "बंद करना",
|
"close": "बंद करना",
|
||||||
"learn": "और अधिक जानें",
|
"learn": "और अधिक जानें",
|
||||||
"month": "महीना"
|
"month": "महीना",
|
||||||
|
"monthly": "महीने के",
|
||||||
|
"annually": "हर साल"
|
||||||
},
|
},
|
||||||
"plan_names": {
|
"plan_names": {
|
||||||
"free": "मुक्त",
|
"free": "मुक्त",
|
||||||
|
|||||||
@@ -1069,7 +1069,9 @@
|
|||||||
"plan": "Seu plano vem com vantagens e benefícios interessantes, incluindo acesso a todos os recursos futuros que lançaremos.",
|
"plan": "Seu plano vem com vantagens e benefícios interessantes, incluindo acesso a todos os recursos futuros que lançaremos.",
|
||||||
"close": "Fechar",
|
"close": "Fechar",
|
||||||
"learn": "Saber mais",
|
"learn": "Saber mais",
|
||||||
"month": "mês"
|
"month": "mês",
|
||||||
|
"monthly": "Por mês",
|
||||||
|
"annually": "Anualmente"
|
||||||
},
|
},
|
||||||
"plan_names": {
|
"plan_names": {
|
||||||
"free": "Livre",
|
"free": "Livre",
|
||||||
|
|||||||
@@ -1069,7 +1069,9 @@
|
|||||||
"plan": "Ваш план включает в себя интересные привилегии и преимущества, включая доступ ко всем будущим функциям, которые мы выпустим.",
|
"plan": "Ваш план включает в себя интересные привилегии и преимущества, включая доступ ко всем будущим функциям, которые мы выпустим.",
|
||||||
"close": "Закрывать",
|
"close": "Закрывать",
|
||||||
"learn": "Узнать больше",
|
"learn": "Узнать больше",
|
||||||
"month": "месяц"
|
"month": "месяц",
|
||||||
|
"monthly": "Ежемесячно",
|
||||||
|
"annually": "Ежегодно"
|
||||||
},
|
},
|
||||||
"plan_names": {
|
"plan_names": {
|
||||||
"free": "Бесплатно",
|
"free": "Бесплатно",
|
||||||
|
|||||||
@@ -1069,7 +1069,9 @@
|
|||||||
"plan": "Gói của bạn đi kèm với các đặc quyền và lợi ích thú vị, bao gồm quyền truy cập vào tất cả các tính năng trong tương lai mà chúng tôi sẽ phát hành.",
|
"plan": "Gói của bạn đi kèm với các đặc quyền và lợi ích thú vị, bao gồm quyền truy cập vào tất cả các tính năng trong tương lai mà chúng tôi sẽ phát hành.",
|
||||||
"close": "Đóng",
|
"close": "Đóng",
|
||||||
"learn": "Tìm hiểu thêm",
|
"learn": "Tìm hiểu thêm",
|
||||||
"month": "tháng"
|
"month": "tháng",
|
||||||
|
"monthly": "hàng tháng",
|
||||||
|
"annually": "Hàng năm"
|
||||||
},
|
},
|
||||||
"plan_names": {
|
"plan_names": {
|
||||||
"free": "Miễn phí",
|
"free": "Miễn phí",
|
||||||
|
|||||||
@@ -47,7 +47,8 @@
|
|||||||
"DASHBOARD_LABEL": "Support us 😍",
|
"DASHBOARD_LABEL": "Support us 😍",
|
||||||
"DASHBOARD_LINK": "",
|
"DASHBOARD_LINK": "",
|
||||||
"IS_DISABLED": false,
|
"IS_DISABLED": false,
|
||||||
"PRODUCT_ID": "331121"
|
"PRODUCT_ID": "331121",
|
||||||
|
"PRODUCT_ID_YEARLY": "331122"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ENTERPRISE": {
|
"ENTERPRISE": {
|
||||||
|
|||||||
Reference in New Issue
Block a user