fix: email after broken sdk, plan history, overview

This commit is contained in:
Arman
2023-12-14 11:14:34 +01:00
parent 544709a411
commit fb620dc8c8
8 changed files with 41 additions and 28 deletions
@@ -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}`
);
});
}
@@ -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}`
);
});
}
@@ -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}
<TableScroll noMargin transparent>
<TableHeader>
<TableCellHead width={100}>Invoice #</TableCellHead>
<TableCellHead width={100}>Due Date</TableCellHead>
<TableCellHead width={80}>Status</TableCellHead>
<TableCellHead width={100}>Amount Due</TableCellHead>
<TableCellHead width={100}>Due Date</TableCellHead>
<TableCellHead width={40} />
</TableHeader>
<TableBody>
@@ -76,8 +73,8 @@
{@const status = invoice.status}
{#if i !== 0}
<TableRow>
<TableCellText title="invoice number">
{invoice.$id}
<TableCellText title="date">
{toLocaleDate(invoice.dueAt)}
</TableCellText>
<TableCell title="status">
@@ -90,10 +87,7 @@
{status === 'requires_authentication' ? 'failed' : status}
</Pill>
</TableCell>
<TableCellText title="due">{invoice.amount}</TableCellText>
<TableCellText title="date">
{toLocaleDate(invoice.dueAt)}
</TableCellText>
<TableCellText title="due">${invoice.amount}</TableCellText>
<TableCell showOverflow>
<DropList
bind:show={showDropdown[i]}
@@ -43,14 +43,14 @@
href="https://appwrite.io/pricing"
target="_blank"
rel="noopener noreferrer">
view our pricing guide.
view our pricing page.
</a>
</p>
<svelte:fragment slot="aside">
<Box class="u-flex-vertical u-gap-8">
<div class="u-flex u-main-space-between u-cross-center">
<div class="u-flex u-gap-8 u-cross-center">
<h6 class="u-bold u-trim-1">
<h6 class="body-text-1 u-bold u-trim-1">
{tierToPlan($organization?.billingPlan)?.name} plan
</h6>
{#if $organization?.billingPlan !== 'tier-0' && isTrial}
@@ -62,12 +62,29 @@
{#if !extraUsage}
<span class="text u-color-text-gray">Total to-date:</span>
{/if}
${isTrial ? 0 : currentPlan?.price}
<span class="body-text-1">
${isTrial ? 0 : currentPlan?.price}
</span>
</p>
</div>
{#if currentInvoice?.usage?.length && $organization?.billingPlan !== 'tier-0' && !isTrial}
{@const extraMembers = currentInvoice.usage.find((u) => u.name === 'members')}
{#if extraMembers}
<div class="u-margin-block-start-24">
<EyebrowHeading tag="h6" size={3}>Additional members</EyebrowHeading>
<ul>
<li class="u-flex u-main-space-between u-margin-block-start-8">
<p class="text u-color-text-gray">
<span> {extraMembers.value}</span>
{extraMembers.name}
</p>
<p class="text">${extraMembers.amount}</p>
</li>
</ul>
</div>
{/if}
<div class="u-margin-block-start-24">
<EyebrowHeading tag="h6" size={3}>Excess</EyebrowHeading>
<EyebrowHeading tag="h6" size={3}>Addons</EyebrowHeading>
<ul>
{#each currentInvoice.usage as excess}
{#if ['storage', 'bandwidth'].includes(excess.name)}
@@ -96,8 +113,8 @@
{/if}
{/each}
<li class="u-flex u-main-space-between u-margin-block-start-16">
<Heading tag="h6" size="7">Total to-date:</Heading>
<Heading tag="h6" size="7">${currentInvoice?.amount}</Heading>
<p class="body-text-1 u-bold">Total to-date:</p>
<p class="body-text-1 u-bold">${currentInvoice?.amount}</p>
</li>
</ul>
</div>
@@ -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);
@@ -34,10 +34,10 @@
await sdk.forConsole.teams.createMembership(
$organization.$id,
member.roles,
url,
member.userEmail,
undefined,
undefined,
url,
member.userName || undefined
);
addNotification({
@@ -22,10 +22,10 @@
const user = await sdk.forProject.teams.createMembership(
teamId,
roles,
url,
email || undefined,
undefined,
undefined,
url,
name || undefined
);
addNotification({
@@ -31,8 +31,6 @@
}
const plan = $plansInfo.plans.find((p) => p.$id === $createOrganization.billingPlan);
$: console.log(plan);
</script>
<WizardStep>