From fb620dc8c820acd495bb8fbae51331df49aaef4a Mon Sep 17 00:00:00 2001 From: Arman Date: Thu, 14 Dec 2023 11:14:34 +0100 Subject: [PATCH] fix: email after broken sdk, plan history, overview --- .../changeOrganizationTierCloud.svelte | 8 +++-- .../console/createOrganizationCloud.svelte | 8 +++-- .../billing/paymentHistory.svelte | 16 ++++------ .../billing/planSummary.svelte | 29 +++++++++++++++---- .../createMember.svelte | 2 +- .../members/+page.svelte | 2 +- .../teams/team-[team]/createMembership.svelte | 2 +- .../cloudOrganization/inviteMembers.svelte | 2 -- 8 files changed, 41 insertions(+), 28 deletions(-) diff --git a/src/routes/console/changeOrganizationTierCloud.svelte b/src/routes/console/changeOrganizationTierCloud.svelte index c295b3bf3..44d28677b 100644 --- a/src/routes/console/changeOrganizationTierCloud.svelte +++ b/src/routes/console/changeOrganizationTierCloud.svelte @@ -127,9 +127,11 @@ $changeOrganizationTier.collaborators.forEach(async (collaborator) => { await sdk.forConsole.teams.createMembership( org.$id, - ['collaborator'], - `${$page.url.origin}/console/organization-${org.$id}`, - collaborator + ['owner'], + collaborator, + undefined, + undefined, + `${$page.url.origin}/console/organization-${org.$id}` ); }); } diff --git a/src/routes/console/createOrganizationCloud.svelte b/src/routes/console/createOrganizationCloud.svelte index 2084a52a6..9efef8f17 100644 --- a/src/routes/console/createOrganizationCloud.svelte +++ b/src/routes/console/createOrganizationCloud.svelte @@ -72,9 +72,11 @@ $createOrganization.collaborators.forEach(async (collaborator) => { await sdk.forConsole.teams.createMembership( org.$id, - ['collaborator'], - `${$page.url.origin}/console/organization-${org.$id}`, - collaborator + ['owner'], + collaborator, + undefined, + undefined, + `${$page.url.origin}/console/organization-${org.$id}` ); }); } diff --git a/src/routes/console/organization-[organization]/billing/paymentHistory.svelte b/src/routes/console/organization-[organization]/billing/paymentHistory.svelte index 13ac33925..d0b628c72 100644 --- a/src/routes/console/organization-[organization]/billing/paymentHistory.svelte +++ b/src/routes/console/organization-[organization]/billing/paymentHistory.svelte @@ -37,9 +37,7 @@ const limit = 5; const endpoint = VARS.APPWRITE_ENDPOINT ?? `${$page.url.origin}/v1`; - onMount(async () => { - request(); - }); + onMount(request); async function request() { invoiceList = await sdk.forConsole.billing.listInvoices($page.params.organization, [ @@ -65,10 +63,9 @@ {#if invoiceList.total - 1 > 0} - Invoice # + Due Date Status Amount Due - Due Date @@ -76,8 +73,8 @@ {@const status = invoice.status} {#if i !== 0} - - {invoice.$id} + + {toLocaleDate(invoice.dueAt)} @@ -90,10 +87,7 @@ {status === 'requires_authentication' ? 'failed' : status} - {invoice.amount} - - {toLocaleDate(invoice.dueAt)} - + ${invoice.amount} - view our pricing guide. + view our pricing page.

-
+
{tierToPlan($organization?.billingPlan)?.name} plan
{#if $organization?.billingPlan !== 'tier-0' && isTrial} @@ -62,12 +62,29 @@ {#if !extraUsage} Total to-date: {/if} - ${isTrial ? 0 : currentPlan?.price} + + ${isTrial ? 0 : currentPlan?.price} +

{#if currentInvoice?.usage?.length && $organization?.billingPlan !== 'tier-0' && !isTrial} + {@const extraMembers = currentInvoice.usage.find((u) => u.name === 'members')} + {#if extraMembers} +
+ Additional members +
    +
  • +

    + {extraMembers.value} + {extraMembers.name} +

    +

    ${extraMembers.amount}

    +
  • +
+
+ {/if}
- Excess + Addons
    {#each currentInvoice.usage as excess} {#if ['storage', 'bandwidth'].includes(excess.name)} @@ -96,8 +113,8 @@ {/if} {/each}
  • - Total to-date: - ${currentInvoice?.amount} +

    Total to-date:

    +

    ${currentInvoice?.amount}

diff --git a/src/routes/console/organization-[organization]/createMember.svelte b/src/routes/console/organization-[organization]/createMember.svelte index 9ac9aca18..a1cf2b682 100644 --- a/src/routes/console/organization-[organization]/createMember.svelte +++ b/src/routes/console/organization-[organization]/createMember.svelte @@ -26,10 +26,10 @@ const team = await sdk.forConsole.teams.createMembership( $organization.$id, ['owner'], - url, email, undefined, undefined, + url, name || undefined ); await invalidate(Dependencies.ACCOUNT); diff --git a/src/routes/console/organization-[organization]/members/+page.svelte b/src/routes/console/organization-[organization]/members/+page.svelte index 1f12c8b30..c769fe3f7 100644 --- a/src/routes/console/organization-[organization]/members/+page.svelte +++ b/src/routes/console/organization-[organization]/members/+page.svelte @@ -34,10 +34,10 @@ await sdk.forConsole.teams.createMembership( $organization.$id, member.roles, - url, member.userEmail, undefined, undefined, + url, member.userName || undefined ); addNotification({ diff --git a/src/routes/console/project-[project]/auth/teams/team-[team]/createMembership.svelte b/src/routes/console/project-[project]/auth/teams/team-[team]/createMembership.svelte index 295910ba3..4d4fab614 100644 --- a/src/routes/console/project-[project]/auth/teams/team-[team]/createMembership.svelte +++ b/src/routes/console/project-[project]/auth/teams/team-[team]/createMembership.svelte @@ -22,10 +22,10 @@ const user = await sdk.forProject.teams.createMembership( teamId, roles, - url, email || undefined, undefined, undefined, + url, name || undefined ); addNotification({ diff --git a/src/routes/console/wizard/cloudOrganization/inviteMembers.svelte b/src/routes/console/wizard/cloudOrganization/inviteMembers.svelte index 7748c33ce..4c3dda396 100644 --- a/src/routes/console/wizard/cloudOrganization/inviteMembers.svelte +++ b/src/routes/console/wizard/cloudOrganization/inviteMembers.svelte @@ -31,8 +31,6 @@ } const plan = $plansInfo.plans.find((p) => p.$id === $createOrganization.billingPlan); - - $: console.log(plan);