diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts
index ea24fff916..b79693b10a 100644
--- a/src/lib/stores/billing.ts
+++ b/src/lib/stores/billing.ts
@@ -158,7 +158,7 @@ export function isServiceLimited(serviceId: PlanServices, plan: Tier, total: num
export function calculateTrialDay(org: Organization) {
if (org?.billingPlan === 'tier-0') return false;
- const endDate = new Date(org?.billingTrialEndDate);
+ const endDate = new Date(org?.billingStartDate);
const today = new Date();
const days = diffDays(today, endDate);
daysLeftInTrial.set(days);
@@ -176,7 +176,7 @@ export function checkForTrialEnding(org: Organization) {
tierToPlan(org.billingPlan).name
} plan.
You will be billed on a recurring 30-day cycle after your trial period ends on ${toLocaleDate(
- org.billingTrialEndDate
+ org.billingStartDate
)}`
});
localStorage.setItem('trialEndingNotification', 'true');
diff --git a/src/lib/stores/organization.ts b/src/lib/stores/organization.ts
index f7fadb9bee..38914e5b04 100644
--- a/src/lib/stores/organization.ts
+++ b/src/lib/stores/organization.ts
@@ -14,7 +14,7 @@ export type Organization = Models.Team> & {
billingCurrentInvoiceDate: string;
billingNextInvoiceDate: string;
billingTrialStartDate?: string;
- billingTrialEndDate?: string;
+ billingStartDate?: string;
billingTrialDays?: number;
billingAddressId?: string;
amount: number;
diff --git a/src/routes/console/account/organizations/+page.svelte b/src/routes/console/account/organizations/+page.svelte
index 1a1cf9ac1c..f7eb4272c5 100644
--- a/src/routes/console/account/organizations/+page.svelte
+++ b/src/routes/console/account/organizations/+page.svelte
@@ -86,7 +86,7 @@
class="u-flex u-cross-center"
use:tooltip={{
content: `Your trial ends on ${toLocaleDate(
- organization.billingTrialEndDate
+ organization.billingStartDate
)}. ${$daysLeftInTrial} days remaining.`
}}>
FREE TRIAL
diff --git a/src/routes/console/organization-[organization]/billing/planSummary.svelte b/src/routes/console/organization-[organization]/billing/planSummary.svelte
index a756fa509d..bbd7def2a1 100644
--- a/src/routes/console/organization-[organization]/billing/planSummary.svelte
+++ b/src/routes/console/organization-[organization]/billing/planSummary.svelte
@@ -27,7 +27,7 @@
$: currentPlan = $plansInfo.plans.find((p) => p.$id === $organization?.billingPlan);
$: extraUsage = currentInvoice?.amount - currentPlan?.price;
- $: isTrial = new Date($organization?.billingTrialEndDate).getTime() - today.getTime() > 0;
+ $: isTrial = new Date($organization?.billingStartDate).getTime() - today.getTime() > 0;
{#if $organization}
diff --git a/src/routes/console/organization-[organization]/header.svelte b/src/routes/console/organization-[organization]/header.svelte
index 0a84768677..fbc193c3fc 100644
--- a/src/routes/console/organization-[organization]/header.svelte
+++ b/src/routes/console/organization-[organization]/header.svelte
@@ -97,7 +97,7 @@
class="u-flex u-cross-center"
use:tooltip={{
content: `Your trial ends on ${toLocaleDate(
- $organization.billingTrialEndDate
+ $organization.billingStartDate
)}. ${$daysLeftInTrial} days remaining.`
}}>
FREE TRIAL
diff --git a/src/routes/console/wizard/cloudOrganizationChangeTier/choosePlan.svelte b/src/routes/console/wizard/cloudOrganizationChangeTier/choosePlan.svelte
index e1aea276e0..64d01a71c7 100644
--- a/src/routes/console/wizard/cloudOrganizationChangeTier/choosePlan.svelte
+++ b/src/routes/console/wizard/cloudOrganizationChangeTier/choosePlan.svelte
@@ -64,10 +64,10 @@
$changeOrganizationTier.limitOverflow.members > 0
) {
$changeOrganizationTier.isOverLimit = true;
- $changeTierSteps = updateStepStatus($changeTierSteps, 4, false);
+ $changeTierSteps = updateStepStatus($changeTierSteps, 5, false);
} else {
$changeOrganizationTier.isOverLimit = false;
- $changeTierSteps = updateStepStatus($changeTierSteps, 4, true);
+ $changeTierSteps = updateStepStatus($changeTierSteps, 5, true);
}
}
diff --git a/src/routes/console/wizard/cloudOrganizationChangeTier/inviteMembers.svelte b/src/routes/console/wizard/cloudOrganizationChangeTier/inviteMembers.svelte
index 61a5f1154f..aa83d85ce0 100644
--- a/src/routes/console/wizard/cloudOrganizationChangeTier/inviteMembers.svelte
+++ b/src/routes/console/wizard/cloudOrganizationChangeTier/inviteMembers.svelte
@@ -12,12 +12,26 @@
} from '$lib/elements/table';
import { WizardStep } from '$lib/layout';
import { plansInfo } from '$lib/stores/billing';
+ import { onMount } from 'svelte';
import { changeOrganizationTier } from './store';
+ import { sdk } from '$lib/stores/sdk';
+ import { user } from '$lib/stores/user';
const plan = $plansInfo.plans.find((p) => p.$id === $changeOrganizationTier.billingPlan);
let email: string;
+ onMount(async () => {
+ const members = await sdk.forConsole.teams.listMemberships($changeOrganizationTier.id);
+ if (members.total) {
+ $changeOrganizationTier.collaborators = members.memberships
+ .map((m) => {
+ if (m.userEmail !== $user.email) return m.userEmail;
+ })
+ .filter(Boolean);
+ }
+ });
+
function addCollaborator() {
if (!email) return;
if ($changeOrganizationTier.collaborators.includes(email)) return;