From 203bd6dc4ec47b28524a2287225e1d5d4047ae4f Mon Sep 17 00:00:00 2001 From: Arman Date: Fri, 29 Dec 2023 10:38:12 +0100 Subject: [PATCH] fix: remove trial ending notification --- src/lib/stores/billing.ts | 21 ++------------------- src/routes/console/+layout.svelte | 2 -- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts index 032dddf3b..190db1234 100644 --- a/src/lib/stores/billing.ts +++ b/src/lib/stores/billing.ts @@ -8,7 +8,7 @@ import { cachedStore } from '$lib/helpers/cache'; import { Query, type Models } from '@appwrite.io/console'; import { headerAlert } from './headerAlert'; import PaymentAuthRequired from '$lib/components/billing/alerts/paymentAuthRequired.svelte'; -import { diffDays, toLocaleDate } from '$lib/helpers/date'; +import { diffDays } from '$lib/helpers/date'; import { addNotification, notifications } from './notifications'; import { goto } from '$app/navigation'; import { base } from '$app/paths'; @@ -166,24 +166,6 @@ export function calculateTrialDay(org: Organization) { return days; } -export function checkForTrialEnding(org: Organization) { - const days = calculateTrialDay(org); - if (localStorage.getItem('trialEndingNotification') === 'true' || !days) return; - else if (days <= 5) { - addNotification({ - type: 'info', - isHtml: true, - message: `We hope you've been enjoying the ${ - tierToPlan(org.billingPlan).name - } plan. - You will be billed on a recurring 30-day cycle after your trial period ends on ${toLocaleDate( - org.billingStartDate - )}` - }); - localStorage.setItem('trialEndingNotification', 'true'); - } -} - export async function checkForUsageLimit(org: Organization) { if (!org?.billingLimits) { readOnly.set(false); @@ -295,6 +277,7 @@ export async function checkForFreeOrgOverflow(orgs: Models.TeamList>) { if (!orgs?.teams?.length) return; + if (orgs.total > orgs.teams.length) return; // if the total is greater that the free orgs it means that there are pro orgs const modalTime = localStorage.getItem('postReleaseProModal'); const now = Date.now(); // show the modal if it was never shown diff --git a/src/routes/console/+layout.svelte b/src/routes/console/+layout.svelte index 49fcfde5f..e6cdd038c 100644 --- a/src/routes/console/+layout.svelte +++ b/src/routes/console/+layout.svelte @@ -18,7 +18,6 @@ checkForUsageLimit, checkPaymentAuthorizationRequired, calculateTrialDay, - checkForTrialEnding, paymentExpired, checkForFreeOrgOverflow, checkForPostReleaseProModal, @@ -282,7 +281,6 @@ if (!org) return; if (isCloud) { calculateTrialDay(org); - checkForTrialEnding(org); await paymentExpired(org); await checkForUsageLimit(org); checkForMarkedForDeletion(org);