mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
Merge branch 'main' into fix-932-show-days-for-logs-retention
This commit is contained in:
commit
25cd56784f
22 files changed
+86
-91
No files matched your search
Generated
-6
@@ -19,7 +19,6 @@
|
||||
"deep-equal": "^2.2.2",
|
||||
"dotenv": "^16.3.1",
|
||||
"echarts": "^5.4.3",
|
||||
"logrocket": "^5.0.1",
|
||||
"nanoid": "^4.0.2",
|
||||
"plausible-tracker": "^0.3.8",
|
||||
"pretty-bytes": "^6.1.1",
|
||||
@@ -6919,11 +6918,6 @@
|
||||
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/logrocket": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/logrocket/-/logrocket-5.0.1.tgz",
|
||||
"integrity": "sha512-czWLcDkBJ+V/wooBQtPW76RAS2rszjsfkQumqPO3zPCQka8dcjsuGJxJhcxAuMZf5WDZd/zkvfDZCBJ6zeCQYg=="
|
||||
},
|
||||
"node_modules/loose-envify": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
"deep-equal": "^2.2.2",
|
||||
"dotenv": "^16.3.1",
|
||||
"echarts": "^5.4.3",
|
||||
"logrocket": "^5.0.1",
|
||||
"nanoid": "^4.0.2",
|
||||
"plausible-tracker": "^0.3.8",
|
||||
"pretty-bytes": "^6.1.1",
|
||||
|
||||
@@ -106,6 +106,7 @@
|
||||
<svelte:window on:click={onBlur} on:keydown={onKeyDown} />
|
||||
|
||||
<div
|
||||
class="u-min-width-0"
|
||||
class:drop-wrapper={!noStyle}
|
||||
class:u-cross-child-start={childStart}
|
||||
class:u-width-full-line={wrapperFullWidth}
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
export { classes as class };
|
||||
</script>
|
||||
|
||||
<svelte:element this={tag} class={`heading-level-${size} ${classes}`} class:u-trim-1={trimmed} {id}>
|
||||
<svelte:element
|
||||
this={tag}
|
||||
class={`heading-level-${size} u-min-width-0 ${classes}`}
|
||||
class:u-trim-1={trimmed}
|
||||
{id}>
|
||||
<slot />
|
||||
</svelte:element>
|
||||
@@ -279,6 +279,7 @@ export const paymentMissingMandate = writable<PaymentMethodData>(null);
|
||||
|
||||
export async function checkForMandate(org: Organization) {
|
||||
const paymentId = org.paymentMethodId ?? org.backupPaymentMethodId;
|
||||
if (!paymentId) return;
|
||||
const paymentMethod = await sdk.forConsole.billing.getPaymentMethod(paymentId);
|
||||
if (paymentMethod.mandateId === null && paymentMethod.country === 'in') {
|
||||
headerAlert.add({
|
||||
|
||||
@@ -51,7 +51,7 @@ export async function unmountPaymentElement() {
|
||||
elements = null;
|
||||
}
|
||||
|
||||
export async function submitStripeCard(name: string, urlRoute?: string) {
|
||||
export async function submitStripeCard(name: string, organizationId?: string) {
|
||||
try {
|
||||
// If a payment method was created during initialization, use it, otherwise create a new one
|
||||
if (!paymentMethod) {
|
||||
@@ -62,16 +62,20 @@ export async function submitStripeCard(name: string, urlRoute?: string) {
|
||||
// // Element needs to be submitted before confirming the setup intent
|
||||
elements.submit();
|
||||
|
||||
const baseUrl = 'https://cloud.appwrite.io/console/';
|
||||
const baseUrl = 'https://cloud.appwrite.io/console';
|
||||
const accountUrl = `${baseUrl}/account/payments?clientSecret=${clientSecret}`;
|
||||
const orgUrl = `${baseUrl}/organization-${organizationId}/billing?clientSecret=${clientSecret}`;
|
||||
|
||||
const returnUrl = new URL(organizationId ? orgUrl : accountUrl);
|
||||
|
||||
returnUrl.searchParams.append('clientSecret', clientSecret);
|
||||
returnUrl.searchParams.append('paymentMethodId', paymentMethod.$id);
|
||||
|
||||
const { setupIntent, error } = await get(stripe).confirmSetup({
|
||||
elements,
|
||||
clientSecret,
|
||||
confirmParams: {
|
||||
return_url: `${baseUrl}${
|
||||
urlRoute ??
|
||||
`organization-${get(organization).$id}/billing?clientSecret=${clientSecret}`
|
||||
}`,
|
||||
return_url: returnUrl.toString(),
|
||||
payment_method_data: {
|
||||
billing_details: {
|
||||
name
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
{#if hasInstallations}
|
||||
{#await loadInstallations()}
|
||||
<div class="u-flex u-gap-16">
|
||||
<div class="u-width-full-line">
|
||||
<ul class="u-width-full-line">
|
||||
<InputSelect
|
||||
disabled
|
||||
id="installation"
|
||||
@@ -86,7 +86,7 @@
|
||||
}
|
||||
]}
|
||||
value={null} />
|
||||
</div>
|
||||
</ul>
|
||||
<ul class="u-width-full-line">
|
||||
<InputSearch placeholder="Search repositories" disabled />
|
||||
</ul>
|
||||
|
||||
@@ -3,17 +3,16 @@
|
||||
import { afterNavigate, goto } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { isTrackingAllowed, trackPageView } from '$lib/actions/analytics';
|
||||
import { trackPageView } from '$lib/actions/analytics';
|
||||
import { Notifications, Progress } from '$lib/layout';
|
||||
import { app } from '$lib/stores/app';
|
||||
import { ENV, isCloud } from '$lib/system';
|
||||
import * as Sentry from '@sentry/svelte';
|
||||
import LogRocket from 'logrocket';
|
||||
import { onMount } from 'svelte';
|
||||
import Loading from './loading.svelte';
|
||||
import { loading, requestedMigration } from './store';
|
||||
import { parseIfString } from '$lib/helpers/object';
|
||||
import Consent, { consent } from '$lib/components/consent.svelte';
|
||||
import Consent from '$lib/components/consent.svelte';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
|
||||
onMount(async () => {
|
||||
@@ -31,17 +30,6 @@
|
||||
integrations: [new Sentry.BrowserTracing()],
|
||||
tracesSampleRate: 1.0
|
||||
});
|
||||
|
||||
/**
|
||||
* LogRocket
|
||||
*/
|
||||
if ($consent?.accepted?.analytics && isCloud && isTrackingAllowed()) {
|
||||
LogRocket.init('rgthvf/appwrite', {
|
||||
dom: {
|
||||
inputSanitizer: true
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import '@appwrite.io/pink';
|
||||
import '@appwrite.io/pink-icons';
|
||||
import 'tippy.js/dist/tippy.css';
|
||||
import LogRocket from 'logrocket';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
@@ -21,11 +20,6 @@ export const load: LayoutLoad = async ({ depends, url }) => {
|
||||
try {
|
||||
const account = await sdk.forConsole.account.get<{ organization?: string }>();
|
||||
|
||||
LogRocket.identify(account.$id, {
|
||||
name: account.name,
|
||||
email: account.email
|
||||
});
|
||||
|
||||
return {
|
||||
account,
|
||||
organizations: await sdk.forConsole.teams.list()
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
<Heading size="1" tag="h3">{$page.error.status || 'Invalid Argument'}</Heading>
|
||||
<Heading size="3" tag="h4">{$page.error.message}</Heading>
|
||||
<Button href="/console">Back to the console</Button>
|
||||
<div class="u-flex-vertical u-gap-16">
|
||||
<Heading size="1" tag="h3">{$page.error.status || 'Invalid Argument'}</Heading>
|
||||
<Heading size="4" tag="h4" trimmed={false}>{$page.error.message}</Heading>
|
||||
<Button href="/console">Back to the console</Button>
|
||||
</div>
|
||||
</Container>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { INTERVAL } from '$lib/constants';
|
||||
import { BillingPlan, INTERVAL } from '$lib/constants';
|
||||
import { Logs } from '$lib/layout';
|
||||
import Footer from '$lib/layout/footer.svelte';
|
||||
import Header from '$lib/layout/header.svelte';
|
||||
@@ -258,12 +258,14 @@
|
||||
organization.subscribe(async (org) => {
|
||||
if (!org) return;
|
||||
if (isCloud) {
|
||||
calculateTrialDay(org);
|
||||
await paymentExpired(org);
|
||||
await checkForUsageLimit(org);
|
||||
checkForMarkedForDeletion(org);
|
||||
await checkPaymentAuthorizationRequired(org);
|
||||
await checkForMandate(org);
|
||||
if (org?.billingPlan !== BillingPlan.STARTER) {
|
||||
calculateTrialDay(org);
|
||||
await paymentExpired(org);
|
||||
await checkPaymentAuthorizationRequired(org);
|
||||
await checkForMandate(org);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -3,8 +3,19 @@
|
||||
import { Container } from '$lib/layout';
|
||||
import PaymentMethods from './paymentMethods.svelte';
|
||||
import BillingAddress from './billingAddress.svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { page } from '$app/stores';
|
||||
import { confirmPayment } from '$lib/stores/stripe';
|
||||
|
||||
let showPayment = false;
|
||||
|
||||
onMount(async () => {
|
||||
if ($page.url.searchParams.has('clientSecret')) {
|
||||
const clientSecret = $page.url.searchParams.get('clientSecret');
|
||||
const paymentMethodId = $page.url.searchParams.get('paymentMethodId');
|
||||
await confirmPayment('', clientSecret, paymentMethodId);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { page } from '$app/stores';
|
||||
|
||||
export let show = false;
|
||||
|
||||
@@ -20,7 +21,7 @@
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const card = await submitStripeCard(name);
|
||||
const card = await submitStripeCard(name, $page?.params?.organization ?? null);
|
||||
invalidate(Dependencies.PAYMENT_METHODS);
|
||||
dispatch('submit', card);
|
||||
show = false;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
if (!selectedPaymentMethodId) {
|
||||
const method = await submitStripeCard(name);
|
||||
const method = await submitStripeCard(name, $organization.$id);
|
||||
selectedPaymentMethodId = method.$id;
|
||||
}
|
||||
isBackup
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
try {
|
||||
if (paymentMethodId === null) {
|
||||
try {
|
||||
const method = await submitStripeCard(name);
|
||||
const method = await submitStripeCard(name, $organization.$id);
|
||||
const card = await sdk.forConsole.billing.getPaymentMethod(method.$id);
|
||||
if (card?.last4) {
|
||||
paymentMethodId = card.$id;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { PaymentBoxes } from '$lib/components/billing';
|
||||
import { addCreditWizardStore } from '../store';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
|
||||
let methods: PaymentList;
|
||||
let name: string;
|
||||
@@ -21,7 +22,7 @@
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const method = await submitStripeCard(name);
|
||||
const method = await submitStripeCard(name, $organization.$id);
|
||||
$addCreditWizardStore.paymentMethodId = method.$id;
|
||||
invalidate(Dependencies.PAYMENT_METHODS);
|
||||
} catch (e) {
|
||||
|
||||
@@ -2,7 +2,15 @@
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import { AvatarGroup, DropList, DropListItem, DropListLink, Tab, Tabs } from '$lib/components';
|
||||
import {
|
||||
AvatarGroup,
|
||||
DropList,
|
||||
DropListItem,
|
||||
DropListLink,
|
||||
Heading,
|
||||
Tab,
|
||||
Tabs
|
||||
} from '$lib/components';
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
@@ -41,6 +49,13 @@
|
||||
$: avatars = $members.memberships?.map((m) => m.userName) ?? [];
|
||||
$: organizationId = $page.params.organization;
|
||||
$: path = `/console/organization-${organizationId}`;
|
||||
$: permanentTabSettings = [
|
||||
{
|
||||
href: `${path}/settings`,
|
||||
event: 'settings',
|
||||
title: 'Settings'
|
||||
}
|
||||
];
|
||||
$: permanentTabs = [
|
||||
{
|
||||
href: path,
|
||||
@@ -55,13 +70,7 @@
|
||||
hasChildren: true
|
||||
}
|
||||
];
|
||||
$: permanentTabSettings = [
|
||||
{
|
||||
href: `${path}/settings`,
|
||||
event: 'settings',
|
||||
title: 'Settings'
|
||||
}
|
||||
];
|
||||
|
||||
$: tabs = isCloud
|
||||
? [
|
||||
...permanentTabs,
|
||||
@@ -84,13 +93,15 @@
|
||||
{#if $organization?.$id}
|
||||
<Cover>
|
||||
<svelte:fragment slot="header">
|
||||
<DropList bind:show={showDropdown} placement="bottom-start" noArrow scrollable>
|
||||
<DropList bind:show={showDropdown} placement="bottom-end" noArrow scrollable>
|
||||
<button
|
||||
class="button is-text u-padding-inline-0"
|
||||
class="button is-text u-padding-inline-0 u-max-width-100-percent"
|
||||
on:click={() => (showDropdown = !showDropdown)}>
|
||||
<h1 class="heading-level-4 u-flex u-cross-center u-gap-8">
|
||||
<span class="u-flex u-cross-center u-gap-8">
|
||||
{$organization.name}
|
||||
<Heading tag="h1" size="4" class="u-flex u-cross-center u-gap-8">
|
||||
<span class="u-flex u-cross-center u-gap-8 u-min-width-0">
|
||||
<span class="u-trim">
|
||||
{$organization.name}
|
||||
</span>
|
||||
{#if isCloud && $organization?.billingPlan === BillingPlan.STARTER}
|
||||
<Pill>FREE</Pill>
|
||||
{/if}
|
||||
@@ -109,7 +120,7 @@
|
||||
<span
|
||||
class={`icon-cheveron-${showDropdown ? 'up' : 'down'}`}
|
||||
aria-hidden="true" />
|
||||
</h1>
|
||||
</Heading>
|
||||
</button>
|
||||
<svelte:fragment slot="list">
|
||||
{#each $organizationList.teams as org}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
import { createPlatform } from './wizard/store';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { onboarding } from '../../store';
|
||||
import type { WizardStepsType } from '$lib/layout/wizard.svelte';
|
||||
import Step1 from './wizard/android/step1.svelte';
|
||||
import Step2 from './wizard/android/step2.svelte';
|
||||
@@ -12,10 +11,7 @@
|
||||
import Step4 from './wizard/step4.svelte';
|
||||
|
||||
async function onFinish() {
|
||||
await Promise.all([
|
||||
$onboarding && invalidate(Dependencies.PROJECT),
|
||||
invalidate(Dependencies.PLATFORMS)
|
||||
]);
|
||||
await Promise.all([invalidate(Dependencies.PROJECT), invalidate(Dependencies.PLATFORMS)]);
|
||||
createPlatform.reset();
|
||||
wizard.hide();
|
||||
}
|
||||
|
||||
@@ -9,13 +9,10 @@
|
||||
import Step3 from './wizard/apple/step3.svelte';
|
||||
import Step4 from './wizard/step4.svelte';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { onboarding } from '../../store';
|
||||
|
||||
async function onFinish() {
|
||||
await Promise.all([
|
||||
$onboarding && invalidate(Dependencies.PROJECT),
|
||||
invalidate(Dependencies.PLATFORMS)
|
||||
]);
|
||||
await Promise.all([invalidate(Dependencies.PROJECT), invalidate(Dependencies.PLATFORMS)]);
|
||||
|
||||
createPlatform.reset();
|
||||
wizard.hide();
|
||||
}
|
||||
|
||||
@@ -9,13 +9,10 @@
|
||||
import Step3 from './wizard/flutter/step3.svelte';
|
||||
import Step4 from './wizard/step4.svelte';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { onboarding } from '../../store';
|
||||
|
||||
async function onFinish() {
|
||||
await Promise.all([
|
||||
$onboarding && invalidate(Dependencies.PROJECT),
|
||||
invalidate(Dependencies.PLATFORMS)
|
||||
]);
|
||||
await Promise.all([invalidate(Dependencies.PROJECT), invalidate(Dependencies.PLATFORMS)]);
|
||||
|
||||
createPlatform.reset();
|
||||
wizard.hide();
|
||||
}
|
||||
|
||||
@@ -9,13 +9,10 @@
|
||||
import Step3 from './wizard/web/step3.svelte';
|
||||
import Step4 from './wizard/step4.svelte';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { onboarding } from '../../store';
|
||||
|
||||
async function onFinish() {
|
||||
await Promise.all([
|
||||
$onboarding && invalidate(Dependencies.PROJECT),
|
||||
invalidate(Dependencies.PLATFORMS)
|
||||
]);
|
||||
await Promise.all([invalidate(Dependencies.PROJECT), invalidate(Dependencies.PLATFORMS)]);
|
||||
|
||||
createPlatform.reset();
|
||||
wizard.hide();
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { initializeStripe, isStripeInitialized, submitStripeCard } from '$lib/stores/stripe';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
import { symmetricDifference } from '$lib/helpers/array';
|
||||
import { showUsageRatesModal } from '$lib/stores/billing';
|
||||
import { PaymentBoxes } from '$lib/components/billing';
|
||||
import { page } from '$app/stores';
|
||||
|
||||
let methods: PaymentList;
|
||||
let filteredMethods: PaymentMethodData[];
|
||||
@@ -48,15 +48,10 @@
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
await submitStripeCard(name);
|
||||
const latestMethods = await sdk.forConsole.billing.listPaymentMethods();
|
||||
const paymentMethod = symmetricDifference(
|
||||
methods.paymentMethods,
|
||||
latestMethods.paymentMethods
|
||||
)[0] as PaymentMethodData;
|
||||
const card = await sdk.forConsole.billing.getPaymentMethod(paymentMethod.$id);
|
||||
const method = await submitStripeCard(name, $page?.params?.organization ?? null);
|
||||
const card = await sdk.forConsole.billing.getPaymentMethod(method.$id);
|
||||
if (card?.last4) {
|
||||
$changeOrganizationTier.paymentMethodId = paymentMethod.$id;
|
||||
$changeOrganizationTier.paymentMethodId = method.$id;
|
||||
} else {
|
||||
throw new Error(
|
||||
'The payment method you selected is not valid. Please select a different one.'
|
||||
|
||||
Reference in new issue
Block a user