mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
Merge branch 'billing' of https://github.com/appwrite/console into billing
This commit is contained in:
commit
a3f6638bce
28 files changed
+405
-211
No files matched your search
@@ -61,7 +61,7 @@
|
||||
required
|
||||
autofocus={true} />
|
||||
|
||||
<div class="aw-stripe-container">
|
||||
<div class="aw-stripe-container" data-private>
|
||||
<div class="loader-container" bind:this={loader}>
|
||||
<div class="loader"></div>
|
||||
</div>
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
export let isButton = false;
|
||||
export let danger = false;
|
||||
export let href: string = null;
|
||||
let classes = '';
|
||||
export { classes as class };
|
||||
|
||||
function getElement() {
|
||||
switch (true) {
|
||||
@@ -39,7 +41,7 @@
|
||||
|
||||
<svelte:element
|
||||
this={getElement()}
|
||||
class="card"
|
||||
class="card {classes}"
|
||||
class:common-section={!isTile}
|
||||
class:is-border-dashed={isDashed}
|
||||
class:is-danger={danger}
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
|
||||
let backdrop: HTMLDivElement;
|
||||
|
||||
onMount(async () => {
|
||||
document.body.appendChild(backdrop);
|
||||
});
|
||||
onMount(async () => {});
|
||||
|
||||
function handleBLur(event: MouseEvent) {
|
||||
if (event.target === backdrop) {
|
||||
@@ -33,10 +31,8 @@
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
if (show) {
|
||||
show = false;
|
||||
document.documentElement.classList.remove('u-overflow-hidden');
|
||||
}
|
||||
document.documentElement.classList.remove('u-overflow-hidden');
|
||||
show = false;
|
||||
}
|
||||
|
||||
function handleKeydown(event: KeyboardEvent) {
|
||||
@@ -49,6 +45,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
$: if (backdrop) {
|
||||
document.body.appendChild(backdrop);
|
||||
}
|
||||
|
||||
$: if (show) {
|
||||
document.documentElement.classList.add('u-overflow-hidden');
|
||||
} else {
|
||||
@@ -58,81 +58,84 @@
|
||||
</script>
|
||||
|
||||
<svelte:window on:keydown={handleKeydown} />
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<div
|
||||
class="payment-modal-backdrop"
|
||||
on:keyup={clickOnEnter}
|
||||
on:click={handleBLur}
|
||||
bind:this={backdrop}>
|
||||
|
||||
{#if show}
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<div
|
||||
class="modal payment-modal"
|
||||
class:is-small={size === 'small'}
|
||||
class:is-big={size === 'big'}
|
||||
class:is-separate-header={headerDivider}>
|
||||
<Form isModal {onSubmit}>
|
||||
<header class="modal-header">
|
||||
<div class="u-flex u-main-space-between u-cross-center u-gap-16">
|
||||
<div class="u-flex u-cross-center u-gap-16">
|
||||
{#if icon}
|
||||
<div
|
||||
class="avatar is-medium"
|
||||
class:is-success={state === 'success'}
|
||||
class:is-warning={state === 'warning'}
|
||||
class:is-danger={state === 'error'}
|
||||
class:is-info={state === 'info'}>
|
||||
<span class={`icon-${icon}`} aria-hidden="true" />
|
||||
</div>
|
||||
class="payment-modal-backdrop"
|
||||
on:keyup={clickOnEnter}
|
||||
on:click={handleBLur}
|
||||
bind:this={backdrop}>
|
||||
<div
|
||||
class="modal payment-modal"
|
||||
class:is-small={size === 'small'}
|
||||
class:is-big={size === 'big'}
|
||||
class:is-separate-header={headerDivider}>
|
||||
<Form isModal {onSubmit} class="payment-form">
|
||||
<header class="modal-header">
|
||||
<div class="u-flex u-main-space-between u-cross-center u-gap-16">
|
||||
<div class="u-flex u-cross-center u-gap-16">
|
||||
{#if icon}
|
||||
<div
|
||||
class="avatar is-medium"
|
||||
class:is-success={state === 'success'}
|
||||
class:is-warning={state === 'warning'}
|
||||
class:is-danger={state === 'error'}
|
||||
class:is-info={state === 'info'}>
|
||||
<span class={`icon-${icon}`} aria-hidden="true" />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<h4 class="modal-title heading-level-5">
|
||||
<slot name="title">
|
||||
{title}
|
||||
</slot>
|
||||
</h4>
|
||||
</div>
|
||||
{#if closable}
|
||||
<button
|
||||
type="button"
|
||||
class="button is-text is-only-icon"
|
||||
style="--button-size:1.5rem;"
|
||||
aria-label="Close Modal"
|
||||
title="Close Modal"
|
||||
on:click={() =>
|
||||
trackEvent('click_close_modal', {
|
||||
from: 'button'
|
||||
})}
|
||||
on:click={closeModal}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<h4 class="modal-title heading-level-5">
|
||||
<slot name="title">
|
||||
{title}
|
||||
</slot>
|
||||
</h4>
|
||||
</div>
|
||||
{#if closable}
|
||||
<button
|
||||
type="button"
|
||||
class="button is-text is-only-icon"
|
||||
style="--button-size:1.5rem;"
|
||||
aria-label="Close Modal"
|
||||
title="Close Modal"
|
||||
on:click={() =>
|
||||
trackEvent('click_close_modal', {
|
||||
from: 'button'
|
||||
})}
|
||||
on:click={closeModal}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</button>
|
||||
</header>
|
||||
<div class="modal-content">
|
||||
{#if error}
|
||||
<Alert
|
||||
dismissible
|
||||
type="warning"
|
||||
on:dismiss={() => {
|
||||
error = null;
|
||||
}}>
|
||||
{error}
|
||||
</Alert>
|
||||
{/if}
|
||||
<slot />
|
||||
</div>
|
||||
</header>
|
||||
<div class="modal-content">
|
||||
{#if error}
|
||||
<Alert
|
||||
dismissible
|
||||
type="warning"
|
||||
on:dismiss={() => {
|
||||
error = null;
|
||||
}}>
|
||||
{error}
|
||||
</Alert>
|
||||
{/if}
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
{#if $$slots.footer}
|
||||
<div class="modal-footer">
|
||||
<div class="u-flex u-main-end u-gap-16">
|
||||
<slot name="footer" />
|
||||
{#if $$slots.footer}
|
||||
<div class="modal-footer">
|
||||
<div class="u-flex u-main-end u-gap-16">
|
||||
<slot name="footer" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</Form>
|
||||
{/if}
|
||||
</Form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style lang="scss">
|
||||
<style lang="scss" global>
|
||||
.payment-modal-backdrop {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
@@ -148,4 +151,14 @@
|
||||
background-color: hsl(240 5% 8% / 0.6);
|
||||
}
|
||||
}
|
||||
|
||||
.payment-modal {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.payment-form {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
@@ -6,8 +6,10 @@
|
||||
export let size: Size;
|
||||
export let trimmed = true;
|
||||
export let id: string = null;
|
||||
let classes = '';
|
||||
export { classes as class };
|
||||
</script>
|
||||
|
||||
<svelte:element this={tag} class={`heading-level-${size}`} class:u-trim-1={trimmed} {id}>
|
||||
<svelte:element this={tag} class={`heading-level-${size} ${classes}`} class:u-trim-1={trimmed} {id}>
|
||||
<slot />
|
||||
</svelte:element>
|
||||
@@ -14,6 +14,8 @@
|
||||
export let noStyle = false;
|
||||
export let isModal = false;
|
||||
export let onSubmit: (e: SubmitEvent) => Promise<void> | void;
|
||||
let classes = '';
|
||||
export { classes as class };
|
||||
|
||||
const { isSubmitting } = setContext<FormContext>('form', {
|
||||
isSubmitting: writable(false)
|
||||
@@ -27,6 +29,7 @@
|
||||
</script>
|
||||
|
||||
<form
|
||||
class={classes}
|
||||
class:form={!noStyle}
|
||||
class:common-section={!noMargin}
|
||||
class:modal-form={isModal}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<footer class="main-footer u-cross-center">
|
||||
<div class="main-footer-start">
|
||||
<ul class="inline-links is-no-padding-first-and-last u-x-small">
|
||||
<li class="inline-links-item" style="line-height: 1.01;">
|
||||
<li class="inline-links-item" style="line-height: 1.02;">
|
||||
<div class="u-flex u-cross-center u-gap-8">
|
||||
{#if isCloud}
|
||||
<span class="icon-cloud" />
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import LoginLight from '$lib/images/login/login-light-mode.png';
|
||||
import { app } from '$lib/stores/app';
|
||||
import { user } from '$lib/stores/user';
|
||||
//import { isCloud } from '$lib/system';
|
||||
|
||||
export let imgLight = LoginLight;
|
||||
export let imgDark = LoginDark;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 196 KiB |
@@ -0,0 +1,178 @@
|
||||
<script lang="ts">
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
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';
|
||||
|
||||
$: twitterText = encodeURIComponent(
|
||||
[
|
||||
`Appwrite Pro is now available! `,
|
||||
``,
|
||||
`Why did I upgrade?`,
|
||||
``,
|
||||
`Because`,
|
||||
``,
|
||||
`Discover Appwrite Pro and get started at https://appwrite.io/pro`
|
||||
].join('\n')
|
||||
);
|
||||
|
||||
const confettiColors = [
|
||||
'hsl(var(--color-primary-100))',
|
||||
'hsl(var(--color-primary-200))',
|
||||
'hsl(var(--color-primary-300))',
|
||||
'#F05088',
|
||||
'#FF86BB',
|
||||
'#FFFFFF80'
|
||||
];
|
||||
</script>
|
||||
|
||||
<WizardCover>
|
||||
<svelte:fragment slot="title">Win an Appwrite Pro hoodie</svelte:fragment>
|
||||
<div class="wizard-container container">
|
||||
<div class="u-grid-1-1 u-gap-24">
|
||||
<Card class="u-grid-1-1-col-1">
|
||||
<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>
|
||||
|
||||
<p class="eyebrow-heading-3 u-margin-block-start-24">
|
||||
{'Share on social media'.toUpperCase()}
|
||||
</p>
|
||||
<div class="u-margin-block-start-16 u-flex u-gap-16">
|
||||
<Button
|
||||
secondary
|
||||
round
|
||||
href="https://twitter.com/intent/tweet?text={twitterText}"
|
||||
external>
|
||||
<span class="icon-twitter" aria-label="Share on X" />
|
||||
</Button>
|
||||
<Button
|
||||
secondary
|
||||
round
|
||||
href="https://twitter.com/intent/tweet?text={twitterText}">
|
||||
<span class="icon-linkedin" aria-label="Share on linkedin" />
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div class="common-section card-separator u-flex u-main-end">
|
||||
<Button
|
||||
on:click={() => {
|
||||
trackEvent('click_create_function_manual', {
|
||||
from: 'cover'
|
||||
});
|
||||
}}
|
||||
on:click>
|
||||
Go to console
|
||||
</Button>
|
||||
</div>
|
||||
</Card>
|
||||
<div class="u-grid-1-1-col-2">
|
||||
<img class="hoodie-image" src={Hoodie} alt="" srcset="" />
|
||||
</div>
|
||||
<div class="cbc-confetti" transition:fade>
|
||||
<Confetti
|
||||
x={[-1.75, 1.85]}
|
||||
y={[-1.875, 1]}
|
||||
amount={100}
|
||||
size={10}
|
||||
infinite
|
||||
delay={[2000, 7000]}
|
||||
colorArray={confettiColors}
|
||||
fallDistance="400px" />
|
||||
</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';
|
||||
|
||||
.hoodie-image {
|
||||
border-radius: 1rem;
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
height: auto;
|
||||
object-fit: contain;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.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%;
|
||||
}
|
||||
|
||||
&-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: 20%;
|
||||
right: 10%;
|
||||
translate: -50% -50%;
|
||||
}
|
||||
|
||||
@keyframes shake {
|
||||
0% {
|
||||
translate: 0;
|
||||
}
|
||||
25% {
|
||||
translate: 0 -4px;
|
||||
}
|
||||
50% {
|
||||
translate: 0 0px;
|
||||
}
|
||||
75% {
|
||||
translate: 0 0px;
|
||||
}
|
||||
100% {
|
||||
translate: 0 0px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,91 +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 } from '$lib/elements/forms';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
|
||||
export let show = false;
|
||||
</script>
|
||||
|
||||
<ModalSideCol bind:show title="Get ready for Appwrite Pro" 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">
|
||||
Appwrite will enable billing before the end of the year, which means access to our long
|
||||
awaited Pro plan. It also means you will be limited to <b
|
||||
>one free organization per account</b
|
||||
>.
|
||||
</p>
|
||||
<p class="text">
|
||||
Consider upgrading and take advantage of the extra resources that come with the Pro
|
||||
plan. You can also use Migrations to self-host some of your projects instead. Learn more
|
||||
in our <a
|
||||
class="link"
|
||||
href="https://appwrite.io/docs/advanced/migrations"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
on:click={() =>
|
||||
trackEvent('click_open_website', {
|
||||
source: 'pre_billing_release_modal',
|
||||
destination: 'docs_migration'
|
||||
})}>documentation</a
|
||||
>.
|
||||
</p>
|
||||
</div>
|
||||
<Box>
|
||||
<b class="body-text-1">Pro - $15 per member per billing period</b>
|
||||
|
||||
<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">Email support</span>
|
||||
</li>
|
||||
<li class="u-flex u-gap-8 u-cross-center">
|
||||
<span class="icon-check-circle" aria-hidden="true" />
|
||||
<span class="text">And more</span>
|
||||
</li>
|
||||
</ul>
|
||||
<Button
|
||||
fullWidth
|
||||
class="u-margin-block-start-24"
|
||||
href="https://appwrite.io/pricing"
|
||||
on:click={() =>
|
||||
trackEvent('click_open_website', {
|
||||
source: 'pre_billing_release_modal',
|
||||
destination: 'pricing'
|
||||
})}>
|
||||
Learn more about Pro
|
||||
</Button>
|
||||
</Box>
|
||||
</ModalSideCol>
|
||||
@@ -2,12 +2,13 @@ import { base } from '$app/paths';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ parent }) => {
|
||||
export const load: PageLoad = async ({ parent, url }) => {
|
||||
const { organizations, account } = await parent();
|
||||
|
||||
if (organizations.total) {
|
||||
const teamId = account.prefs.organization ?? organizations.teams[0].$id;
|
||||
throw redirect(303, `${base}/console/organization-${teamId}`);
|
||||
throw redirect(303, `${base}/console/organization-${teamId}${url.search ?? ''}`);
|
||||
} else {
|
||||
throw redirect(303, `${base}/console/onboarding`);
|
||||
throw redirect(303, `${base}/console/onboarding${url.search ?? ''}`);
|
||||
}
|
||||
};
|
||||
@@ -30,7 +30,6 @@
|
||||
});
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
console.log(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +61,7 @@
|
||||
|
||||
onDestroy(() => {
|
||||
observer.disconnect();
|
||||
document.documentElement.classList.remove('u-overflow-hidden');
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
required
|
||||
autofocus={true}
|
||||
hideRequired />
|
||||
<div class="aw-stripe-container">
|
||||
<div class="aw-stripe-container" data-private>
|
||||
<div class="loader-container" bind:this={loader}>
|
||||
<div class="loader"></div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Card } from '$lib/components';
|
||||
import CustomId from '$lib/components/customId.svelte';
|
||||
@@ -10,13 +11,27 @@
|
||||
import { Container } from '$lib/layout';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { ID } from '@appwrite.io/console';
|
||||
import { onMount } from 'svelte';
|
||||
import CreateOrganizationCloud from '../createOrganizationCloud.svelte';
|
||||
|
||||
let name: string;
|
||||
let id: string;
|
||||
let showCustomId = false;
|
||||
|
||||
onMount(() => {
|
||||
if (isCloud) {
|
||||
if ($page.url.searchParams.has('type')) {
|
||||
const paramType = $page.url.searchParams.get('type');
|
||||
if (paramType === 'createPro') {
|
||||
wizard.start(CreateOrganizationCloud);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
async function createProject() {
|
||||
try {
|
||||
const org = await createOrganization();
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
import { readOnly } from '$lib/stores/billing';
|
||||
import type { RegionList } from '$lib/sdk/billing';
|
||||
import { onMount } from 'svelte';
|
||||
import CreateOrganizationCloud from '../createOrganizationCloud.svelte';
|
||||
|
||||
export let data;
|
||||
|
||||
@@ -118,7 +119,15 @@
|
||||
|
||||
let regions: RegionList;
|
||||
onMount(async () => {
|
||||
if (isCloud) regions = await sdk.forConsole.billing.listRegions();
|
||||
if (isCloud) {
|
||||
regions = await sdk.forConsole.billing.listRegions();
|
||||
if ($page.url.searchParams.has('type')) {
|
||||
const paramType = $page.url.searchParams.get('type');
|
||||
if (paramType === 'createPro') {
|
||||
wizard.start(CreateOrganizationCloud);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { toLocaleDate } from '$lib/helpers/date';
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
import ChangeOrganizationTierCloud from '$routes/console/changeOrganizationTierCloud.svelte';
|
||||
|
||||
$: defaultPaymentMethod = $paymentMethods?.paymentMethods?.find(
|
||||
(method: PaymentMethodData) => method.$id === $organization?.paymentMethodId
|
||||
@@ -28,6 +30,12 @@
|
||||
);
|
||||
|
||||
onMount(async () => {
|
||||
if (
|
||||
$page.url.searchParams.has('type') &&
|
||||
$page.url.searchParams.get('type') === 'upgrade'
|
||||
) {
|
||||
wizard.start(ChangeOrganizationTierCloud);
|
||||
}
|
||||
if (
|
||||
($page.url.searchParams.has('invoice') &&
|
||||
$page.url.searchParams.has('type') &&
|
||||
@@ -39,7 +47,6 @@
|
||||
}
|
||||
try {
|
||||
const invoiceId = $page.url.searchParams.get('invoice');
|
||||
console.log(invoiceId);
|
||||
const invoice = await sdk.forConsole.billing.getInvoice(
|
||||
$page.params.organization,
|
||||
invoiceId
|
||||
@@ -49,7 +56,6 @@
|
||||
);
|
||||
const url = `${window.location.origin}/console/organization-${$organization.$id}/billing`;
|
||||
|
||||
console.log(invoice);
|
||||
const { error } = await $stripe.confirmPayment({
|
||||
clientSecret: invoice.clientSecret,
|
||||
confirmParams: {
|
||||
|
||||
@@ -316,7 +316,7 @@
|
||||
selectedPaymentMethod={isSelectedBackup ? backupPaymentMethod : defaultPaymentMethod}
|
||||
bind:show={showEdit} />
|
||||
{/if}
|
||||
{#if showReplace && isCloud && hasStripePublicKey}
|
||||
{#if isCloud && hasStripePublicKey}
|
||||
<ReplaceCard bind:show={showReplace} isBackup={isSelectedBackup} />
|
||||
{/if}
|
||||
{#if showDelete && isCloud && hasStripePublicKey}
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
required
|
||||
autofocus={true} />
|
||||
|
||||
<div id="payment-element">
|
||||
<div id="payment-element" data-private>
|
||||
<!-- Stripe will create form elements here -->
|
||||
</div>
|
||||
</FormList>
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
async function validateCoupon() {
|
||||
if (couponData?.status === 'active') return;
|
||||
console.log(couponData);
|
||||
try {
|
||||
const response = await sdk.forConsole.billing.getCoupon(coupon);
|
||||
couponData = response;
|
||||
|
||||
@@ -59,6 +59,11 @@
|
||||
<svelte:fragment slot="title">
|
||||
Your usage exceeds the {tierToPlan($organization.billingPlan).name} plan limits
|
||||
</svelte:fragment>
|
||||
|
||||
Appwrite Pro is now available. To facilitate a smooth transition for your projects, Starter plan
|
||||
will maintain its current state of unlimited resource usage. This extension will be in effect
|
||||
until January 15th, 2024.
|
||||
|
||||
{#if $organization.billingPlan === 'tier-0'}
|
||||
<p class="text">
|
||||
Usage for <b>{$organization.name}</b> organization has reached the limits of the {tierToPlan(
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
</p>
|
||||
{:else if $organization.billingPlan === 'tier-1'}
|
||||
<p class="text">
|
||||
On the Scale plan, you'll be charged only for any usage that exceeds the thresholds
|
||||
On the Pro plan, you'll be charged only for any usage that exceeds the thresholds
|
||||
per resource listed below. <button
|
||||
on:click={() => ($showUsageRatesModal = true)}
|
||||
class="link"
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
import { app } from '$lib/stores/app';
|
||||
import type { PageData } from './$types';
|
||||
import { ContainerHeader } from '$lib/layout';
|
||||
import { getServiceLimit, readOnly } from '$lib/stores/billing';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
@@ -74,12 +73,14 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<ContainerHeader title="Platforms" titleTag="h3" titleSize="7" total={data?.platforms?.total}>
|
||||
<ContainerHeader
|
||||
title="Platforms"
|
||||
titleTag="h3"
|
||||
titleSize="7"
|
||||
total={data?.platforms?.total}
|
||||
let:isButtonDisabled>
|
||||
<DropList bind:show={showDropdown} placement="bottom-start">
|
||||
<Button
|
||||
on:click={() => (showDropdown = !showDropdown)}
|
||||
disabled={data?.platforms?.platforms?.length >= getServiceLimit('platforms') ||
|
||||
$readOnly}>
|
||||
<Button on:click={() => (showDropdown = !showDropdown)} disabled={isButtonDisabled}>
|
||||
<span class="icon-plus" aria-hidden="true" />
|
||||
<span class="text">Add platform</span>
|
||||
</Button>
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
const projectId = $page.params.project;
|
||||
const bucketId = $page.params.bucket;
|
||||
const usedStorage = bytesToSize(data.oraganizationUsage.storage, 'MB');
|
||||
const usedStorage = bytesToSize(data.organizationUsage.storage, 'MB');
|
||||
const getPreview = (fileId: string) =>
|
||||
sdk.forProject.storage.getFilePreview(bucketId, fileId, 32, 32).toString() + '&mode=admin';
|
||||
|
||||
|
||||
@@ -5,19 +5,17 @@ import { Dependencies, PAGE_LIMIT } from '$lib/constants';
|
||||
import type { PageLoad } from './$types';
|
||||
import { isCloud } from '$lib/system';
|
||||
import type { OrganizationUsage } from '$lib/sdk/billing';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
import { get } from 'svelte/store';
|
||||
|
||||
export const load: PageLoad = async ({ params, depends, url, route }) => {
|
||||
export const load: PageLoad = async ({ params, depends, url, route, parent }) => {
|
||||
const { organization } = await parent();
|
||||
depends(Dependencies.FILES);
|
||||
const page = getPage(url);
|
||||
const search = getSearch(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
let oraganizationUsage: OrganizationUsage = null;
|
||||
const org = get(organization);
|
||||
if (isCloud && org) {
|
||||
oraganizationUsage = await sdk.forConsole.billing.listUsage(org.$id);
|
||||
let organizationUsage: OrganizationUsage = null;
|
||||
if (isCloud && organization?.$id) {
|
||||
organizationUsage = await sdk.forConsole.billing.listUsage(organization.$id);
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -29,6 +27,6 @@ export const load: PageLoad = async ({ params, depends, url, route }) => {
|
||||
[Query.limit(limit), Query.offset(offset), Query.orderDesc('')],
|
||||
search
|
||||
),
|
||||
oraganizationUsage
|
||||
organizationUsage
|
||||
};
|
||||
};
|
||||
+35
-3
@@ -1,18 +1,50 @@
|
||||
<script lang="ts">
|
||||
import { CustomId } from '$lib/components';
|
||||
import { Alert, CustomId } from '$lib/components';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { FormList, InputFile } from '$lib/elements/forms';
|
||||
import { Button, FormList, InputFile } from '$lib/elements/forms';
|
||||
import { humanFileSize, sizeToBytes } from '$lib/helpers/sizeConvertion';
|
||||
import WizardStep from '$lib/layout/wizardStep.svelte';
|
||||
import { getServiceLimit, tierToPlan } from '$lib/stores/billing';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
import { isCloud } from '$lib/system';
|
||||
import ChangeOrganizationTierCloud from '$routes/console/changeOrganizationTierCloud.svelte';
|
||||
import { bucket } from '../store';
|
||||
import { createFile } from './store';
|
||||
|
||||
let showCustomId = false;
|
||||
const service = getServiceLimit('fileSize');
|
||||
</script>
|
||||
|
||||
<WizardStep>
|
||||
<svelte:fragment slot="title">Create file</svelte:fragment>
|
||||
<svelte:fragment slot="subtitle">Upload a file to add it to your bucket.</svelte:fragment>
|
||||
<FormList>
|
||||
|
||||
{#if isCloud}
|
||||
{@const size = humanFileSize(sizeToBytes(service, 'MB', 1000))}
|
||||
{@const plan = tierToPlan($organization?.billingPlan)}
|
||||
<Alert type="info">
|
||||
<p class="text">
|
||||
The {plan.name} plan has a maximum upload file size limit of {Math.floor(
|
||||
parseInt(size.value)
|
||||
)}{size.unit}.
|
||||
{#if $organization?.billingPlan === 'tier-0'}
|
||||
Upgrade to allow files of a larger size.
|
||||
{/if}
|
||||
</p>
|
||||
<svelte:fragment slot="action">
|
||||
{#if $organization?.billingPlan === 'tier-0'}
|
||||
<div class="alert-buttons u-flex">
|
||||
<Button text on:click={() => wizard.start(ChangeOrganizationTierCloud)}>
|
||||
Upgrade plan
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
</Alert>
|
||||
{/if}
|
||||
|
||||
<FormList class="u-margin-block-start-24">
|
||||
<div class="u-width-full-line u-overflow-hidden">
|
||||
<InputFile
|
||||
required
|
||||
|
||||
+16
-9
@@ -12,6 +12,7 @@
|
||||
import { bucket } from '../store';
|
||||
import { updateBucket } from './+page.svelte';
|
||||
|
||||
const service = getServiceLimit('fileSize');
|
||||
const { value, unit, baseValue, units } = createByteUnitPair($bucket.maximumFileSize);
|
||||
const options = units.map((v) => ({ label: v.name, value: v.name }));
|
||||
|
||||
@@ -26,8 +27,6 @@
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
const service = getServiceLimit('fileSize');
|
||||
</script>
|
||||
|
||||
<Form onSubmit={updateMaxSize}>
|
||||
@@ -40,15 +39,23 @@
|
||||
{@const plan = tierToPlan($organization?.billingPlan)}
|
||||
<Alert type="info">
|
||||
<p class="text">
|
||||
The {plan.name} plan has a maximum upload file size limit of {size.value}{size.unit}.
|
||||
Upgrade to allow files of a larger size.
|
||||
The {plan.name} plan has a maximum upload file size limit of {Math.floor(
|
||||
parseInt(size.value)
|
||||
)}{size.unit}.
|
||||
{#if $organization?.billingPlan === 'tier-0'}
|
||||
Upgrade to allow files of a larger size.
|
||||
{/if}
|
||||
</p>
|
||||
<svelte:fragment slot="action">
|
||||
<div class="alert-buttons u-flex">
|
||||
<Button text on:click={() => wizard.start(ChangeOrganizationTierCloud)}>
|
||||
Upgrade plan
|
||||
</Button>
|
||||
</div>
|
||||
{#if $organization?.billingPlan === 'tier-0'}
|
||||
<div class="alert-buttons u-flex">
|
||||
<Button
|
||||
text
|
||||
on:click={() => wizard.start(ChangeOrganizationTierCloud)}>
|
||||
Upgrade plan
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
</Alert>
|
||||
{/if}
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
{/if}
|
||||
</TableRow>
|
||||
{:else}
|
||||
{@const addon = plan[`${usage.id}Addon`]}
|
||||
{@const addon = plan.addons[usage.id]}
|
||||
<TableRow>
|
||||
<TableCellText title="resource">{usage.resource}</TableCellText>
|
||||
<TableCellText title="limit">
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
let mail: string, pass: string, disabled: boolean;
|
||||
|
||||
$: console.log($page.url.search);
|
||||
|
||||
async function login() {
|
||||
try {
|
||||
disabled = true;
|
||||
@@ -112,7 +114,9 @@
|
||||
<a href={`${base}/recover`}><span class="text">Forgot Password?</span></a>
|
||||
</li>
|
||||
<li class="inline-links-item">
|
||||
<a href={`${base}/register`}><span class="text">Sign Up</span></a>
|
||||
<a href={`${base}/register${$page?.url?.search ?? ''}`}>
|
||||
<span class="text">Sign Up</span>
|
||||
</a>
|
||||
</li>
|
||||
</svelte:fragment>
|
||||
</Unauthenticated>
|
||||
@@ -18,6 +18,7 @@
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { ID } from '@appwrite.io/console';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { page } from '$app/stores';
|
||||
|
||||
let name: string, mail: string, pass: string, disabled: boolean;
|
||||
let terms = false;
|
||||
@@ -28,7 +29,17 @@
|
||||
await sdk.forConsole.account.create(ID.unique(), mail, pass, name ?? '');
|
||||
await sdk.forConsole.account.createEmailSession(mail, pass);
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
await goto(`${base}/console`);
|
||||
if ($page.url.searchParams) {
|
||||
const redirect = $page.url.searchParams.get('redirect');
|
||||
$page.url.searchParams.delete('redirect');
|
||||
if (redirect) {
|
||||
await goto(`${base}${redirect}${$page.url.search}`);
|
||||
} else {
|
||||
await goto(`${base}/console${$page.url.search ?? ''}`);
|
||||
}
|
||||
} else {
|
||||
await goto(`${base}/console`);
|
||||
}
|
||||
trackEvent(Submit.AccountCreate);
|
||||
} catch (error) {
|
||||
disabled = false;
|
||||
|
||||
Reference in new issue
Block a user