|
6 | 6 | import { base } from '$app/paths'; |
7 | 7 | import { Submit, trackError, trackEvent } from '$lib/actions/analytics'; |
8 | 8 | import Upgrade from '$lib/components/roles/upgrade.svelte'; |
9 | | - import { getRoleLabel } from '$lib/stores/billing'; |
| 9 | + import { getServiceLimit, readOnly, getRoleLabel } from '$lib/stores/billing'; |
10 | 10 | import { addNotification } from '$lib/stores/notifications'; |
11 | 11 | import { currentPlan, newMemberModal, organization } from '$lib/stores/organization'; |
12 | 12 | import { isOwner } from '$lib/stores/roles'; |
13 | 13 | import { sdk } from '$lib/stores/sdk'; |
14 | 14 | import type { Models } from '@appwrite.io/console'; |
15 | 15 | import Delete from '../deleteMember.svelte'; |
16 | 16 | import Edit from './edit.svelte'; |
17 | | - import { isCloud } from '$lib/system'; |
| 17 | + import { isCloud, GRACE_PERIOD_OVERRIDE } from '$lib/system'; |
18 | 18 | import { |
19 | 19 | IconDotsHorizontal, |
20 | 20 | IconInfo, |
|
45 | 45 | // Calculate if button should be disabled and tooltip should show |
46 | 46 | $: memberCount = data.organizationMembers?.total ?? 0; |
47 | 47 | $: supportsMembers = $organization?.billingPlanDetails?.addons?.seats; |
48 | | - $: isFreeWithMembers = !supportsMembers && memberCount >= 1; |
49 | | - $: isButtonDisabled = isCloud ? isFreeWithMembers : false; |
| 48 | + $: limit = getServiceLimit('members', null, $currentPlan) || Infinity; |
| 49 | + $: isLimited = limit !== 0 && limit < Infinity; |
| 50 | + $: isButtonDisabled = |
| 51 | + isCloud && (($readOnly && !GRACE_PERIOD_OVERRIDE) || (isLimited && memberCount >= limit)); |
50 | 52 |
|
51 | 53 | const resend = async (member: Models.Membership) => { |
52 | 54 | try { |
|
0 commit comments