Merge pull request #753 from appwrite/chore-remove-grace-period-warning

chore: remove grace period warnings
This commit is contained in:
Torsten Dittmann authored and GitHub committed 2024-02-04 10:36:28 +01:00
commit 0cfca8fac6
12 files changed
+5 -451

No files matched your search

@@ -1,13 +0,0 @@
<script lang="ts">
import { Button } from '$lib/elements/forms';
import { HeaderAlert } from '$lib/layout';
</script>
<HeaderAlert title="You are limited to one free organization per account">
All but one organization will be automatically upgraded to a Pro plan on <b>31 January 2024</b>.
You can add a payment method or transfer projects from your settings.
<svelte:fragment slot="buttons">
<Button secondary href="/console/account/organizations">View organizations</Button>
</svelte:fragment>
</HeaderAlert>
+2 -35
View File
@@ -5,14 +5,13 @@ import { organization, type Organization } from './organization';
import type { InvoiceList, AddressesList, Invoice, PaymentList, PlansMap } from '$lib/sdk/billing';
import { isCloud } from '$lib/system';
import { cachedStore } from '$lib/helpers/cache';
import { Query, type Models } from '@appwrite.io/console';
import { Query } from '@appwrite.io/console';
import { headerAlert } from './headerAlert';
import PaymentAuthRequired from '$lib/components/billing/alerts/paymentAuthRequired.svelte';
import { addNotification, notifications } from './notifications';
import { goto } from '$app/navigation';
import { base } from '$app/paths';
import TooManyFreOrgs from '$lib/components/billing/alerts/tooManyFreeOrgs.svelte';
import { activeHeaderAlert, showPostReleaseModal } from '$routes/console/store';
import { activeHeaderAlert } from '$routes/console/store';
import MarkedForDeletion from '$lib/components/billing/alerts/markedForDeletion.svelte';
import { BillingPlan } from '$lib/constants';
@@ -266,35 +265,3 @@ export function checkForMarkedForDeletion(org: Organization) {
});
}
}
export async function checkForFreeOrgOverflow(orgs: Models.TeamList<Record<string, unknown>>) {
if (orgs?.teams?.length > 1) {
headerAlert.add({
id: 'freeOrgOverflow',
component: TooManyFreOrgs,
show: true,
importance: 10
});
activeHeaderAlert.set(headerAlert.get());
}
}
export async function checkForPostReleaseProModal(orgs: Models.TeamList<Record<string, unknown>>) {
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
if (!modalTime) {
localStorage.setItem('postReleaseProModal', Date.now().toString());
showPostReleaseModal.set(true);
} else {
const interval = 5 * 24 * 60 * 60 * 1000;
const sinceLastModal = now - parseInt(modalTime);
// show the modal if it was shown more than 5 days ago
if (sinceLastModal > interval) {
localStorage.setItem('postReleaseProModal', Date.now().toString());
showPostReleaseModal.set(true);
}
}
}
+1 -1
View File
@@ -23,4 +23,4 @@ export const MODE = VARS.CONSOLE_MODE === Mode.CLOUD ? Mode.CLOUD : Mode.SELF_HO
export const isCloud = MODE === Mode.CLOUD;
export const isSelfHosted = MODE !== Mode.CLOUD;
export const hasStripePublicKey = !!VARS.STRIPE_PUBLIC_KEY;
export const GRACE_PERIOD_OVERRIDE = true;
export const GRACE_PERIOD_OVERRIDE = false;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

@@ -1,242 +0,0 @@
<script lang="ts">
import { Card, Heading } from '$lib/components';
import { Button } from '$lib/elements/forms';
import WizardCover from '$lib/layout/wizardCover.svelte';
import { fade } from 'svelte/transition';
import Hoodie from './hoodie.png';
import { Confetti } from 'svelte-confetti';
import { base } from '$app/paths';
import { app } from '$lib/stores/app';
import { wizard } from '$lib/stores/wizard';
import { organization } from '$lib/stores/organization';
import AppwriteLogoDark from '$lib/images/appwrite-logo-dark.svg';
import AppwriteLogoLight from '$lib/images/appwrite-logo-light.svg';
$: postText = encodeURIComponent(
[
`@appwrite Pro just launched!`,
``,
`I am one of the first to join 🔥`,
``,
`Learn more about Appwrite Pro here: https://apwr.dev/AppwritePro`,
``,
`Ps. Limited edition Appwrite Pro zipper hoodies are up for grabs.`,
``,
`#AppwritePro`
].join('\n')
);
const confettiColors = [
'hsl(var(--color-primary-100))',
'hsl(var(--color-primary-200))',
'hsl(var(--color-primary-300))',
'#F05088',
'#FF86BB',
'#FFFFFF80',
'#FE9567',
'#85DBD8',
'#E5E1FF'
];
$: href = $organization?.$id
? `${base}/console/organization-${$organization.$id}`
: `${base}/console`;
</script>
<WizardCover>
<svelte:fragment slot="header">
<div class="u-flex u-main-space-between">
<a {href}>
<img
src={$app.themeInUse == 'dark' ? AppwriteLogoDark : AppwriteLogoLight}
width="120"
height="22"
alt="Appwrite" />
</a>
<button
on:click={wizard.hide}
class="button is-text is-only-icon"
style:--button-size="1.5rem"
aria-label="close popup">
<span class="icon-x" aria-hidden="true" />
</button>
</div>
</svelte:fragment>
<div class="wizard-container u-flex-vertical">
<div class="u-flex u-cross-center u-main-center hoodie-container">
<Card>
<div class="appwrite-pro">
<span class="text">APPWRITE</span>
<span class="appwrite-pro-text">
<span class="appwrite-pro-text-letter">P</span><span
class="appwrite-pro-text-letter">R</span
><span class="appwrite-pro-text-letter">O</span></span>
</div>
<Heading class="u-margin-block-start-24" tag="h6" size="6">
Your organization has been upgraded 🎉
</Heading>
<p class="text">
Gear up for your new Pro plan! Share online for a chance to win an exclusive
Appwrite Pro hoodie.
</p>
<div class="u-margin-block-start-16 u-flex u-gap-16">
<Button secondary href="https://x.com/intent/tweet?text={postText}" external>
<span class="text">Share on </span>
<svg
xmlns="http://www.w3.org/2000/svg"
width="18"
height="16"
viewBox="0 0 18 16"
fill="none">
<path
d="M13.8885 0.316772H16.4953L10.8002 6.82583L17.5 15.6832H12.2541L8.14539 10.3113L3.44405 15.6832H0.835697L6.92711 8.72103L0.5 0.316772H5.87904L9.59299 5.22694L13.8885 0.316772ZM12.9736 14.1229H14.418L5.09417 1.7951H3.54413L12.9736 14.1229Z"
fill={$app?.themeInUse === 'dark' ? '#C3C3C6' : '#414146'} />
</svg>
</Button>
</div>
<div class="common-section card-separator u-flex u-main-end">
<Button on:click={wizard.hide}>Go to console</Button>
</div>
</Card>
<img
class="hoodie-image"
src={Hoodie}
alt=""
srcset=""
style="aspect-ratio: 1.56 / 1;" />
<div class="cbc-confetti" transition:fade>
<Confetti
x={[-1.75, 1.85]}
y={[-1.875, 1]}
amount={200}
size={10}
infinite
delay={[2000, 7000]}
colorArray={confettiColors}
fallDistance="200px" />
</div>
</div>
</div>
</WizardCover>
<style lang="scss">
@import '@appwrite.io/pink/src/abstract/variables/_common.scss';
@import '@appwrite.io/pink/src/abstract/variables/_devices.scss';
@import '@appwrite.io/pink/src/abstract/functions/_pxToRem.scss';
.wizard-container {
height: 100%;
justify-content: center;
@media #{$break2} {
justify-content: flex-start;
margin-block-start: 2rem;
}
@media #{$break1} {
justify-content: flex-start;
margin-block-start: 2rem;
}
}
.hoodie-container {
height: 350px;
gap: 4rem;
z-index: 1;
@media #{$break2} {
flex-wrap: wrap;
justify-content: start;
align-items: start;
gap: 2rem;
}
@media #{$break1} {
flex-wrap: wrap;
justify-content: start;
align-items: start;
gap: 2rem;
}
}
.hoodie-image {
height: 100%;
object-fit: contain;
@media #{$break2} {
width: 100%;
align-self: start;
height: auto;
}
@media #{$break1} {
align-self: start;
height: auto;
}
}
.appwrite-pro {
position: relative;
z-index: 1;
display: flex;
align-items: baseline;
color: hsl(var(--color-neutral-100));
@media #{$break2open} {
gap: pxToRem(16);
font-size: pxToRem(20);
letter-spacing: pxToRem(8);
line-height: 120%;
}
@media #{$break1} {
gap: pxToRem(8);
font-size: pxToRem(16);
letter-spacing: pxToRem(4);
line-height: 120%;
}
&-text {
padding: pxToRem(9) pxToRem(14);
border: pxToRem(2) solid hsl(343 98% 60% / 0.2);
border-radius: pxToRem(16);
background: rgba(253, 54, 110, 0.1);
box-shadow: 0 -12.173px 20.289px 0px rgba(253, 54, 110, 0.08) inset;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
&-letter {
width: 1rem;
}
@media #{$break1} {
padding: pxToRem(8) pxToRem(12);
border-radius: pxToRem(8);
}
}
}
:global(.theme-dark) .appwrite-pro {
color: hsl(var(--color-neutral-10));
}
.cbc-confetti {
position: absolute;
top: 40%;
right: 25%;
translate: -50% -50%;
z-index: -1;
}
@keyframes shake {
0% {
translate: 0;
}
25% {
translate: 0 -4px;
}
50% {
translate: 0 0px;
}
75% {
translate: 0 0px;
}
100% {
translate: 0 0px;
}
}
</style>
@@ -1,130 +0,0 @@
<script lang="ts">
import { Box, ModalSideCol } from '$lib/components';
import SideLight from './side-light.png';
import SideDark from './side-dark.png';
import { app } from '$lib/stores/app';
import { Button, FormList } from '$lib/elements/forms';
import { trackEvent } from '$lib/actions/analytics';
import { wizard } from '$lib/stores/wizard';
import ChangeOrganizationTierCloud from '../changeOrganizationTierCloud.svelte';
import { user } from '$lib/stores/user';
import { onMount } from 'svelte';
import { sdk } from '$lib/stores/sdk';
import { goto } from '$app/navigation';
import { base } from '$app/paths';
import type { Organization } from '$lib/stores/organization';
import InputSelect from '$lib/elements/forms/inputSelect.svelte';
export let show = false;
let orgs: { teams: Organization[]; total: number };
let selectedOrg: string;
onMount(async () => {
orgs = (await sdk.forConsole.teams.list()) as { teams: Organization[]; total: number };
});
async function handleUpgrade() {
if (selectedOrg) {
await goto(`${base}/console/organization-${selectedOrg}/billing`);
} else {
const freeOrg = orgs.teams.find((o) => o.billingPlan === 'tier-0');
await goto(`${base}/console/organization-${freeOrg.$id}/billing`);
}
show = false;
wizard.start(ChangeOrganizationTierCloud);
trackEvent('click_organization_upgrade', {
source: event
});
}
$: isNewUser = new Date($user.$createdAt) > new Date(2023, 11, 19);
//user creation date after the 19th of December 2023
$: event = isNewUser ? 'billing_new_user_modal' : 'billing_release_modal';
$: freeOrgs = orgs?.teams?.filter((o) => o.billingPlan === 'tier-0');
$: options = freeOrgs?.map((o) => ({ label: o.name, value: o.$id }));
</script>
<ModalSideCol bind:show title="Claim your Pro credit today" style="max-width: min(53rem,95%)">
<svelte:fragment slot="side">
{#if $app.themeInUse === 'dark'}
<img
src={SideDark}
style="object-fit: cover; object-position: 30% 100%; height: 100%; width: 100%; aspect-ratio: 1 / 1;"
alt="appwrite pro"
aria-hidden="true"
width="376" />
{:else}
<img
src={SideLight}
style="object-fit: cover; object-position: 30% 100%; height: 100%; width: 100%; aspect-ratio: 1 / 1;"
alt="appwrite pro"
aria-hidden="true"
width="376" />
{/if}
</svelte:fragment>
<div class="u-flex u-flex-vertical u-gap-16">
<p class="text">
Upgrade now and use the code <span class="inline-tag"
>{isNewUser ? 'PRO15' : 'THANKYOU30'}</span>
to claim ${isNewUser ? '15' : '30'} in credits for a Pro plan. Credits will expire on 31
January 2024.
</p>
</div>
<Box>
<b class="body-text-1">Pro: $15 per member per billing period</b>
<p class="u-margin-block-start-8">
For pro developers and teams that need to scale their products. <Button
link
href="http://appwrite.io/pricing"
external
on:click={() => {
trackEvent('click_open_pricing', {
source: event
});
}}>Learn more on our pricing page.</Button>
</p>
{#if freeOrgs?.length > 1 && options?.length}
<FormList class="u-margin-block-start-24">
<InputSelect
label="Organization to upgrade"
placeholder="Select organization"
id="orgs"
bind:value={selectedOrg}
{options} />
</FormList>
{:else}
<ul class="list u-flex-vertical u-gap-8 u-margin-block-start-24">
<li class="u-flex u-gap-8 u-cross-center">
<span class="icon-check-circle" aria-hidden="true" />
<span class="text">Unlimited org. members</span>
</li>
<li class="u-flex u-gap-8 u-cross-center">
<span class="icon-check-circle" aria-hidden="true" />
<span class="text">300GB bandwidth</span>
</li>
<li class="u-flex u-gap-8 u-cross-center">
<span class="icon-check-circle" aria-hidden="true" />
<span class="text">200,000 monthly active users</span>
</li>
<li class="u-flex u-gap-8 u-cross-center">
<span class="icon-check-circle" aria-hidden="true" />
<span class="text">150GB free strorage</span>
</li>
<li class="u-flex u-gap-8 u-cross-center">
<span class="icon-check-circle" aria-hidden="true" />
<span class="text">7 days rolling logs</span>
</li>
<li class="u-flex u-gap-8 u-cross-center">
<span class="icon-check-circle" aria-hidden="true" />
<span class="text">Email support</span>
</li>
</ul>
{/if}
<Button fullWidth class="u-margin-block-start-24" on:click={handleUpgrade}>
Start your 14 day free trial
</Button>
</Box>
</ModalSideCol>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 619 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 507 KiB

+2 -22
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import { page } from '$app/stores';
import { BillingPlan, INTERVAL } from '$lib/constants';
import { INTERVAL } from '$lib/constants';
import { Logs } from '$lib/layout';
import Footer from '$lib/layout/footer.svelte';
import Header from '$lib/layout/header.svelte';
@@ -19,8 +19,6 @@
checkPaymentAuthorizationRequired,
calculateTrialDay,
paymentExpired,
checkForFreeOrgOverflow,
checkForPostReleaseProModal,
checkForMarkedForDeletion
} from '$lib/stores/billing';
import { goto } from '$app/navigation';
@@ -33,7 +31,6 @@
import { project } from './project-[project]/store';
import { feedback } from '$lib/stores/feedback';
import { VARS, hasStripePublicKey, isCloud } from '$lib/system';
import { sdk } from '$lib/stores/sdk';
import { loadStripe } from '@stripe/stripe-js';
import { stripe } from '$lib/stores/stripe';
import MobileSupportModal from './wizard/support/mobileSupportModal.svelte';
@@ -41,10 +38,8 @@
import ExcesLimitModal from './organization-[organization]/excesLimitModal.svelte';
import { showExcess } from './organization-[organization]/store';
import UsageRates from './wizard/cloudOrganization/usageRates.svelte';
import { activeHeaderAlert, consoleVariables, showPostReleaseModal } from './store';
import { Query } from '@appwrite.io/console';
import { activeHeaderAlert, consoleVariables } from './store';
import { headerAlert } from '$lib/stores/headerAlert';
import PostReleaseModal from './(billing-modal)/postReleaseModal.svelte';
function kebabToSentenceCase(str: string) {
return str
@@ -244,17 +239,6 @@
onMount(async () => {
loading.set(false);
if (isCloud) {
if (!$page.url.pathname.includes('/console/onboarding')) {
const orgs = await sdk.forConsole.teams.list([
Query.equal('billingPlan', BillingPlan.STARTER)
]);
checkForPostReleaseProModal(orgs);
checkForFreeOrgOverflow(orgs);
}
}
setInterval(() => {
checkForFeedback(INTERVAL);
}, INTERVAL);
@@ -346,7 +330,3 @@
{#if isCloud && $showUsageRatesModal}
<UsageRates bind:show={$showUsageRatesModal} tier={$organization?.billingPlan} />
{/if}
{#if isCloud && $showPostReleaseModal && !$page.url.pathname.includes('/console/onboarding')}
<!-- {#if true} -->
<PostReleaseModal show={true} />
{/if}
@@ -25,7 +25,6 @@
import { tierToPlan } from '$lib/stores/billing';
import { user } from '$lib/stores/user';
import { feedback } from '$lib/stores/feedback';
import HoodieCover from './(billing-modal)/hoodieCover.svelte';
const dispatch = createEventDispatcher();
@@ -147,7 +146,6 @@
plan: tierToPlan($changeOrganizationTier.billingPlan)?.name
});
wizard.hide();
wizard.showCover(HoodieCover);
} catch (e) {
addNotification({
type: 'error',
@@ -20,7 +20,6 @@
import { wizard } from '$lib/stores/wizard';
import { tierToPlan } from '$lib/stores/billing';
import AddressDetails from './wizard/cloudOrganization/addressDetails.svelte';
import HoodieCover from './(billing-modal)/hoodieCover.svelte';
async function onFinish() {
await invalidate(Dependencies.ORGANIZATION);
@@ -97,9 +96,6 @@
});
wizard.hide();
if (org.billingPlan === BillingPlan.PRO) {
wizard.showCover(HoodieCover);
}
} catch (e) {
addNotification({
type: 'error',
-2
View File
@@ -9,6 +9,4 @@ export const consoleVariables = derived(
($page) => $page.data.consoleVariables as Models.ConsoleVariables
);
export const showPostReleaseModal = writable(false);
export const activeHeaderAlert = writable<HeaderAlert>(null);