From 1658101fc575cd5dc10ad030680dec96d20b4927 Mon Sep 17 00:00:00 2001 From: Darshan Date: Fri, 6 Jun 2025 14:05:51 +0530 Subject: [PATCH 01/38] fix: alert and alignment issues. --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- src/lib/commandCenter/panels/ai.svelte | 13 +++++++------ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 1462d9839..1408c487e 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@appwrite.io/pink-icons": "0.25.0", "@appwrite.io/pink-icons-svelte": "^2.0.0-RC.1", "@appwrite.io/pink-legacy": "^1.0.3", - "@appwrite.io/pink-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@4e03f34", + "@appwrite.io/pink-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@40bae6b", "@popperjs/core": "^2.11.8", "@sentry/sveltekit": "^8.38.0", "@stripe/stripe-js": "^3.5.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f0c7936b0..d45decef9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -24,8 +24,8 @@ importers: specifier: ^1.0.3 version: 1.0.3 '@appwrite.io/pink-svelte': - specifier: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@4e03f34 - version: https://pkg.vc/-/@appwrite/%40appwrite.io%2Fpink-svelte@4e03f34(svelte@5.25.3) + specifier: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@40bae6b + version: https://pkg.vc/-/@appwrite/%40appwrite.io%2Fpink-svelte@40bae6b(svelte@5.25.3) '@popperjs/core': specifier: ^2.11.8 version: 2.11.8 @@ -281,8 +281,8 @@ packages: '@appwrite.io/pink-legacy@1.0.3': resolution: {integrity: sha512-GGde5fmPhs+s6/3aFeMPc/kKADG/gTFkYQSy6oBN8pK0y0XNCLrZZgBv+EBbdhwdtqVEWXa0X85Mv9w7jcIlwQ==} - '@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/%40appwrite.io%2Fpink-svelte@4e03f34': - resolution: {tarball: https://pkg.vc/-/@appwrite/%40appwrite.io%2Fpink-svelte@4e03f34} + '@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/%40appwrite.io%2Fpink-svelte@40bae6b': + resolution: {tarball: https://pkg.vc/-/@appwrite/%40appwrite.io%2Fpink-svelte@40bae6b} version: 2.0.0-RC.2 peerDependencies: svelte: ^4.0.0 @@ -3654,7 +3654,7 @@ snapshots: '@appwrite.io/pink-icons': 1.0.0 the-new-css-reset: 1.11.3 - '@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/%40appwrite.io%2Fpink-svelte@4e03f34(svelte@5.25.3)': + '@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/%40appwrite.io%2Fpink-svelte@40bae6b(svelte@5.25.3)': dependencies: '@appwrite.io/pink-icons-svelte': 2.0.0-RC.1(svelte@5.25.3) '@floating-ui/dom': 1.6.13 diff --git a/src/lib/commandCenter/panels/ai.svelte b/src/lib/commandCenter/panels/ai.svelte index 9bda77da8..e44d0e28e 100644 --- a/src/lib/commandCenter/panels/ai.svelte +++ b/src/lib/commandCenter/panels/ai.svelte @@ -167,13 +167,10 @@
{ $preferences.hideAiDisclaimer = true; - }}> - - We collect user responses to refine our experimental AI feature. - - + }} />
{/if} @@ -229,8 +226,11 @@
{ handleSubmit(e); }}> @@ -238,6 +238,7 @@ Date: Sat, 7 Jun 2025 15:42:09 +0530 Subject: [PATCH 02/38] fix: unable to add domain if apex already exists! --- .../domains/add-domain/+page.svelte | 17 ++++++++++------- .../settings/domains/add-domain/+page.svelte | 18 +++++++++++------- .../domains/add-domain/+page.svelte | 16 ++++++++++------ 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/add-domain/+page.svelte b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/add-domain/+page.svelte index 3af8bb2e4..4390e1993 100644 --- a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/add-domain/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/add-domain/+page.svelte @@ -48,18 +48,21 @@ async function addDomain() { const apexDomain = getApexDomain(domainName); - let domain = data.domains?.domains.find((d) => d.domain === apexDomain); + let domain = data.domains?.domains.find((d: Models.Domain) => d.domain === apexDomain); if (apexDomain && !domain && isCloud) { try { domain = await sdk.forConsole.domains.create($project.teamId, apexDomain); } catch (error) { - addNotification({ - type: 'error', - message: error.message - }); - - return; + // apex might already be added on organization level, skip. + const alreadyAdded = error?.type === 'domain_already_exists'; + if (!alreadyAdded) { + addNotification({ + type: 'error', + message: error.message + }); + return; + } } } diff --git a/src/routes/(console)/project-[region]-[project]/settings/domains/add-domain/+page.svelte b/src/routes/(console)/project-[region]-[project]/settings/domains/add-domain/+page.svelte index b9e50a3e8..ad574bf26 100644 --- a/src/routes/(console)/project-[region]-[project]/settings/domains/add-domain/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/settings/domains/add-domain/+page.svelte @@ -12,6 +12,7 @@ import { isCloud } from '$lib/system'; import { project } from '$routes/(console)/project-[region]-[project]/store'; import { getApexDomain } from '$lib/helpers/tlds'; + import type { Models } from '@appwrite.io/console'; const routeBase = `${base}/project-${page.params.region}-${page.params.project}/settings/domains`; @@ -29,18 +30,21 @@ async function addDomain() { const apexDomain = getApexDomain(domainName); - let domain = data.domains?.domains.find((d) => d.domain === apexDomain); + let domain = data.domains?.domains.find((d: Models.Domain) => d.domain === apexDomain); if (apexDomain && !domain && isCloud) { try { domain = await sdk.forConsole.domains.create($project.teamId, apexDomain); } catch (error) { - addNotification({ - type: 'error', - message: error.message - }); - - return; + // apex might already be added on organization level, skip. + const alreadyAdded = error?.type === 'domain_already_exists'; + if (!alreadyAdded) { + addNotification({ + type: 'error', + message: error.message + }); + return; + } } } diff --git a/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/add-domain/+page.svelte b/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/add-domain/+page.svelte index ea8388747..fd7e21020 100644 --- a/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/add-domain/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/add-domain/+page.svelte @@ -53,17 +53,21 @@ async function addDomain() { const apexDomain = getApexDomain(domainName); - let domain = data.domains?.domains.find((d) => d.domain === apexDomain); + let domain = data.domains?.domains.find((d: Models.Domain) => d.domain === apexDomain); if (apexDomain && !domain && isCloud) { try { domain = await sdk.forConsole.domains.create($project.teamId, apexDomain); } catch (error) { - addNotification({ - type: 'error', - message: error.message - }); - return; + // apex might already be added on organization level, skip. + const alreadyAdded = error?.type === 'domain_already_exists'; + if (!alreadyAdded) { + addNotification({ + type: 'error', + message: error.message + }); + return; + } } } From dd2aa5fe06fad253b5f889d6c64d08f603705bd2 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 8 Jun 2025 04:38:02 +0000 Subject: [PATCH 03/38] Check for enterprise plan --- src/lib/stores/billing.ts | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts index e9388c8c9..05dde454f 100644 --- a/src/lib/stores/billing.ts +++ b/src/lib/stores/billing.ts @@ -28,12 +28,13 @@ import { Query } from '@appwrite.io/console'; import { derived, get, writable } from 'svelte/store'; import { headerAlert } from './headerAlert'; import { addNotification, notifications } from './notifications'; -import { organization, type Organization, type OrganizationError } from './organization'; +import { currentPlan, organization, type Organization, type OrganizationError } from './organization'; import { canSeeBilling } from './roles'; import { sdk } from './sdk'; import { user } from './user'; import BudgetLimitAlert from '$routes/(console)/organization-[organization]/budgetLimitAlert.svelte'; import TeamReadonlyAlert from '$routes/(console)/organization-[organization]/teamReadonlyAlert.svelte'; +import EnterpriseTrial from '$routes/(console)/organization-[organization]/enterpriseTrial.svelte'; export type Tier = 'tier-0' | 'tier-1' | 'tier-2' | 'auto-1' | 'cont-1' | 'ent-1'; @@ -268,6 +269,35 @@ export function isServiceLimited(serviceId: PlanServices, plan: Tier, total: num return isLimited && total >= limit && !hasUsageFees; } +export function checkForEnterpriseTrial(org: Organization) { + const remaining = calculateEnterpriseTrial(org); + console.log('remaining', remaining); + if(calculateEnterpriseTrial(org) > 0) { + headerAlert.add({ + id: 'temaEnterprieseTrial', + component: EnterpriseTrial, + show: true, + importance: 11 + }); + } +} + +export function calculateEnterpriseTrial(org: Organization) { + const endDate = new Date(org.billingNextInvoiceDate); + const startDate = new Date(org.billingCurrentInvoiceDate); + const today = new Date(); + + let diffCycle = endDate.getTime() - startDate.getTime(); + diffCycle = Math.ceil(diffCycle / (1000 * 60 * 60 * 24)) + 1; + console.log('diffCycle', diffCycle); + if (diffCycle === 15) { + const remaining = endDate.getTime() - today.getTime(); + const days = Math.ceil(remaining / (1000 * 60 * 60 * 24)) + 1; + return days; + } + return 0; +} + export function calculateTrialDay(org: Organization) { if (org?.billingPlan === BillingPlan.FREE) return false; const endDate = new Date(org?.billingStartDate); @@ -323,7 +353,7 @@ export async function checkForUsageLimit(org: Organization) { ]; const members = org.total; - const plan = get(plansInfo)?.get(org.billingPlan); + const plan = get(currentPlan); const membersOverflow = members > plan.addons.seats.limit ? members - (plan.addons.seats.limit || members) : 0; From e8ccbf2f5016a1e11494ddc1482e9c34f7f6c2a3 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 8 Jun 2025 04:48:42 +0000 Subject: [PATCH 04/38] trial banner --- src/routes/(console)/+layout.svelte | 2 + .../enterpriseTrial.svelte | 68 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 src/routes/(console)/organization-[organization]/enterpriseTrial.svelte diff --git a/src/routes/(console)/+layout.svelte b/src/routes/(console)/+layout.svelte index 9d7a72d6d..3c04881a9 100644 --- a/src/routes/(console)/+layout.svelte +++ b/src/routes/(console)/+layout.svelte @@ -13,6 +13,7 @@ import Create from './createOrganization.svelte'; import { calculateTrialDay, + checkForEnterpriseTrial, checkForMandate, checkForMarkedForDeletion, checkForMissingPaymentMethod, @@ -304,6 +305,7 @@ if (currentOrganizationId === org.$id) return; if (isCloud) { currentOrganizationId = org.$id; + await checkForEnterpriseTrial(org); await checkForUsageLimit(org); checkForMarkedForDeletion(org); await checkForNewDevUpgradePro(org); diff --git a/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte b/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte new file mode 100644 index 000000000..8b2630249 --- /dev/null +++ b/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte @@ -0,0 +1,68 @@ + + + +{#if $organization?.$id && remainingDays > 0 && !hideBillingHeaderRoutes.includes(page.url.pathname)} + + + + Your enterprise trial expires in {remainingDays} days. + + + + + + +{/if} From a5160e0c745cdda404c02ab5be26fda418c168cc Mon Sep 17 00:00:00 2001 From: Darshan Date: Sun, 8 Jun 2025 10:23:19 +0530 Subject: [PATCH 05/38] fix: show correct plan name tag/badge. --- src/lib/components/breadcrumbs.svelte | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib/components/breadcrumbs.svelte b/src/lib/components/breadcrumbs.svelte index 0951839d8..01f8c72a2 100644 --- a/src/lib/components/breadcrumbs.svelte +++ b/src/lib/components/breadcrumbs.svelte @@ -12,7 +12,7 @@ import { isCloud } from '$lib/system'; import { goto } from '$app/navigation'; import { base } from '$app/paths'; - import { newOrgModal } from '$lib/stores/organization'; + import { currentPlan, newOrgModal } from '$lib/stores/organization'; import { Click, trackEvent } from '$lib/actions/analytics'; import { page } from '$app/stores'; @@ -182,6 +182,14 @@ projectsBottomSheetOpen = false; } } + + $: correctPlanName = + // the plan names are hardcoded in some cases and are not available locally, + // so we rely on the plan's source of truth - `$currentPlan` + $currentPlan && + $currentPlan?.name.toLocaleLowerCase() !== selectedOrg?.tierName.toLocaleLowerCase() + ? $currentPlan.name + : selectedOrg?.tierName; // fallback @@ -195,9 +203,9 @@ aria-label="Open organizations tab"> {selectedOrg?.name ?? 'Organization'} {#if selectedOrg?.tierName}{#if correctPlanName}{/if} + content={correctPlanName} />{/if} {:else} @@ -211,7 +219,7 @@ {selectedOrg?.name ?? 'Organization'} + > {/if} From e5a29376e6e52ddf3f53de72f4af792bb4d08462 Mon Sep 17 00:00:00 2001 From: Darshan Date: Sun, 8 Jun 2025 10:45:44 +0530 Subject: [PATCH 06/38] add: current plan if not one of the base plans. --- .../components/billing/planSelection.svelte | 27 +++++++++++++++++-- src/lib/constants.ts | 2 ++ src/lib/stores/billing.ts | 15 +++++++---- .../enterpriseTrial.svelte | 7 +---- 4 files changed, 38 insertions(+), 13 deletions(-) diff --git a/src/lib/components/billing/planSelection.svelte b/src/lib/components/billing/planSelection.svelte index d2889d66f..7c1666675 100644 --- a/src/lib/components/billing/planSelection.svelte +++ b/src/lib/components/billing/planSelection.svelte @@ -1,8 +1,8 @@ @@ -72,4 +74,25 @@ {formatCurrency(scalePlan?.price ?? 0)} per month + usage + {#if !isBasePlan} + + + {#if $organization?.billingPlan === $currentPlan.$id && !isNewOrg} + + {/if} + + + {$currentPlan.desc} + + + {@const isZeroPrice = ($currentPlan?.price ?? 0) <= 0} + {@const price = formatCurrency($currentPlan?.price ?? 0)} + {isZeroPrice ? price : `${price} per month + usage`} + + + {/if} diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 067b354dd..cd9dc4364 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -530,6 +530,8 @@ export enum BillingPlan { ENTERPRISE = 'ent-1' } +export const BASE_BILLING_PLANS: string[] = [BillingPlan.FREE, BillingPlan.PRO, BillingPlan.SCALE]; + export const feedbackDowngradeOptions = [ { value: 'availableFeatures', diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts index 05dde454f..38b7be72e 100644 --- a/src/lib/stores/billing.ts +++ b/src/lib/stores/billing.ts @@ -28,7 +28,12 @@ import { Query } from '@appwrite.io/console'; import { derived, get, writable } from 'svelte/store'; import { headerAlert } from './headerAlert'; import { addNotification, notifications } from './notifications'; -import { currentPlan, organization, type Organization, type OrganizationError } from './organization'; +import { + currentPlan, + organization, + type Organization, + type OrganizationError +} from './organization'; import { canSeeBilling } from './roles'; import { sdk } from './sdk'; import { user } from './user'; @@ -270,11 +275,11 @@ export function isServiceLimited(serviceId: PlanServices, plan: Tier, total: num } export function checkForEnterpriseTrial(org: Organization) { - const remaining = calculateEnterpriseTrial(org); + const remaining = calculateEnterpriseTrial(org); console.log('remaining', remaining); - if(calculateEnterpriseTrial(org) > 0) { - headerAlert.add({ - id: 'temaEnterprieseTrial', + if (calculateEnterpriseTrial(org) > 0) { + headerAlert.add({ + id: 'teamEnterpriseTrial', component: EnterpriseTrial, show: true, importance: 11 diff --git a/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte b/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte index 8b2630249..75e27d112 100644 --- a/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte +++ b/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte @@ -55,12 +55,7 @@ Your enterprise trial expires in {remainingDays} days. - - From cc954b899bd3d1f7e9136991788b6a50329a8655 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 8 Jun 2025 05:20:18 +0000 Subject: [PATCH 07/38] fix url --- .../organization-[organization]/enterpriseTrial.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte b/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte index 75e27d112..e7b1a05e3 100644 --- a/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte +++ b/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte @@ -39,7 +39,7 @@ setNavigationHeight(); }); - $: upgradeUrl = `${base}/organization-${$organization?.$id}/billing`; + $: upgradeUrl = `${base}/organization-${$organization?.$id}/change-plan`; $: remainingDays = calculateEnterpriseTrial($organization); From f65942b26690813817dae37e1ce80a570b85ab90 Mon Sep 17 00:00:00 2001 From: Darshan Date: Sun, 8 Jun 2025 10:53:06 +0530 Subject: [PATCH 08/38] fix: nav bar hidden under alert. --- .../enterpriseTrial.svelte | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte b/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte index e7b1a05e3..2115e72e0 100644 --- a/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte +++ b/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte @@ -4,46 +4,14 @@ import { organization } from '$lib/stores/organization'; import { calculateEnterpriseTrial, hideBillingHeaderRoutes } from '$lib/stores/billing'; import { base } from '$app/paths'; - - import { onDestroy, onMount } from 'svelte'; import { isTabletViewport } from '$lib/stores/viewport'; import GradientBanner from '$lib/components/billing/gradientBanner.svelte'; import { Layout, Typography } from '@appwrite.io/pink-svelte'; - let container: HTMLElement | null = null; - - function setNavigationHeight() { - const alertHeight = container ? container.getBoundingClientRect().height : 0; - const header: HTMLHeadingElement = document.querySelector('main > header'); - const sidebar: HTMLElement = document.querySelector('main > div > nav'); - const contentSection: HTMLElement = document.querySelector('main > div > section'); - - if (header) { - header.style.top = `${alertHeight}px`; - } - if (sidebar) { - sidebar.style.top = `${alertHeight + ($isTabletViewport ? 0 : header.getBoundingClientRect().height)}px`; - sidebar.style.height = `calc(100vh - (${alertHeight + ($isTabletViewport ? 0 : header.getBoundingClientRect().height)}px))`; - } - if (contentSection) { - contentSection.style.paddingBlockStart = `${alertHeight}px`; - } - } - - onMount(() => { - setNavigationHeight(); - }); - - onDestroy(() => { - container = null; - setNavigationHeight(); - }); - $: upgradeUrl = `${base}/organization-${$organization?.$id}/change-plan`; $: remainingDays = calculateEnterpriseTrial($organization); - {#if $organization?.$id && remainingDays > 0 && !hideBillingHeaderRoutes.includes(page.url.pathname)} Date: Sun, 8 Jun 2025 12:11:25 +0530 Subject: [PATCH 09/38] add: enterprise trial banner. --- .../components/billing/gradientBanner.svelte | 66 +++++++++++----- src/lib/images/pink-background.svg | 76 +++++++++++++++++++ src/lib/stores/billing.ts | 8 +- src/routes/(console)/+layout.svelte | 2 +- .../enterpriseTrial.svelte | 53 +++++++++---- 5 files changed, 167 insertions(+), 38 deletions(-) create mode 100644 src/lib/images/pink-background.svg diff --git a/src/lib/components/billing/gradientBanner.svelte b/src/lib/components/billing/gradientBanner.svelte index 27c58ce62..86cf1d9ee 100644 --- a/src/lib/components/billing/gradientBanner.svelte +++ b/src/lib/components/billing/gradientBanner.svelte @@ -1,10 +1,13 @@ {#if $organization?.$id && remainingDays > 0 && !hideBillingHeaderRoutes.includes(page.url.pathname)} - - + + {/if} + + From e1d0bcae7cf70c5570fe4f85f122395a4a28512c Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 8 Jun 2025 11:03:30 +0000 Subject: [PATCH 10/38] update height --- src/lib/components/billing/gradientBanner.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/components/billing/gradientBanner.svelte b/src/lib/components/billing/gradientBanner.svelte index 86cf1d9ee..3d3698dd7 100644 --- a/src/lib/components/billing/gradientBanner.svelte +++ b/src/lib/components/billing/gradientBanner.svelte @@ -80,6 +80,7 @@ width: 100%; z-index: 100; position: fixed; + padding: 0.8rem; &.darker { background: var(--bgcolor-neutral-default); From 9454bad856cc9615e8e8082899cb0b742f6a8bf7 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 8 Jun 2025 11:45:16 +0000 Subject: [PATCH 11/38] close handler --- .../enterpriseTrial.svelte | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte b/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte index 5cc94bde5..dff0c9f84 100644 --- a/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte +++ b/src/routes/(console)/organization-[organization]/enterpriseTrial.svelte @@ -6,13 +6,22 @@ import { base } from '$app/paths'; import GradientBanner from '$lib/components/billing/gradientBanner.svelte'; import { Badge, Typography } from '@appwrite.io/pink-svelte'; + import { activeHeaderAlert } from '../store'; $: upgradeUrl = `${base}/organization-${$organization?.$id}/change-plan`; $: remainingDays = calculateEnterpriseTrial($organization); + + let show = true; + + function handleClose() { + show = false; + const now = new Date().getTime(); + localStorage.setItem($activeHeaderAlert.id, now.toString()); + } -{#if $organization?.$id && remainingDays > 0 && !hideBillingHeaderRoutes.includes(page.url.pathname)} - +{#if $organization?.$id && remainingDays > 0 && !hideBillingHeaderRoutes.includes(page.url.pathname) && show} + @@ -405,24 +392,6 @@ } } - .account-container { - position: absolute; - right: var(--space-7); - top: var(--base-44); - width: 244px; - display: flex; - z-index: 1; - } - - .account-backdrop { - position: absolute; - left: 0; - top: 0; - width: 100vw; - height: 100vh; - background-color: transparent; - } - /* The default drop list has a max-inline width of 280px, which squeezes the support modal. */ :global(.extended-width) { max-inline-size: none; From 047c111dc9bc4aa81f35990c0dbcb79f3576227b Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 10 Jun 2025 12:50:10 +0530 Subject: [PATCH 28/38] add: tooltip for comment. --- .../domains/domain-[domain]/table.svelte | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/table.svelte b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/table.svelte index 006738f20..8fde81408 100644 --- a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/table.svelte +++ b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/table.svelte @@ -39,12 +39,11 @@ let showDelete = false; let selectedRecord: Models.DnsRecord = null; - function formatRecordName(name: string) { - const limit = 30; + function formatName(name: string, limit: number = 30) { return { - value: name.length > limit ? `${name.slice(0, limit)}...` : name, - truncated: name.length > limit, - whole: name + value: name ? (name.length > limit ? `${name.slice(0, limit)}...` : name) : '-', + truncated: name ? name.length > limit : undefined, + whole: name ?? '-' }; } @@ -65,7 +64,7 @@ {#each $columns as column} {#if column.id === 'name'} - {@const formatted = formatRecordName(record.name)} + {@const formatted = formatName(record.name)} {formatted.value} {:else if column.id === 'comment'} - {record?.comment ?? '-'} + {@const formatted = formatName(record?.comment)} + + {formatted.value} + + {#if showing} + {formatted.whole} + {/if} + + {:else if column.id === '$createdAt'} From 00a2741647d11dd2c209a682793ca69e918a5048 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 10 Jun 2025 07:22:30 +0000 Subject: [PATCH 29/38] Fix sidebar offset --- src/lib/components/billing/gradientBanner.svelte | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib/components/billing/gradientBanner.svelte b/src/lib/components/billing/gradientBanner.svelte index 9d7d6dfe2..92923bae5 100644 --- a/src/lib/components/billing/gradientBanner.svelte +++ b/src/lib/components/billing/gradientBanner.svelte @@ -22,8 +22,7 @@ const alertHeight = container?.getBoundingClientRect()?.height || 0; const { header, sidebar, content } = queryLayoutElements(); const headerHeight = header?.getBoundingClientRect().height || 0; - const offset = alertHeight + (!isTabletViewport && header ? headerHeight : 0); - + const offset = alertHeight + (!$isTabletViewport && header ? headerHeight : 0); if (header) header.style.top = `${alertHeight}px`; if (sidebar) { sidebar.style.top = `${offset}px`; From 81b4a9deb8eb7a4d0e6dcd04da15a6f38c25dc38 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 10 Jun 2025 07:31:02 +0000 Subject: [PATCH 30/38] fix check failing --- src/lib/stores/billing.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts index 5719023c0..bbc6c07b5 100644 --- a/src/lib/stores/billing.ts +++ b/src/lib/stores/billing.ts @@ -275,6 +275,7 @@ export function isServiceLimited(serviceId: PlanServices, plan: Tier, total: num } export function checkForEnterpriseTrial(org: Organization) { + if (!org || !org.billingNextInvoiceDate) return; if (calculateEnterpriseTrial(org) > 0) { headerAlert.add({ id: 'teamEnterpriseTrial', @@ -533,9 +534,9 @@ export async function checkForNewDevUpgradePro(org: Organization) { const now = new Date().getTime(); const account = get(user); const accountCreated = new Date(account.$createdAt).getTime(); - if (now - accountCreated < 1000 * 60 * 60 * 24 * 7) return; - const isDismissed = !!localStorage.getItem('newDevUpgradePro'); - if (isDismissed) return; + // if (now - accountCreated < 1000 * 60 * 60 * 24 * 7) return; + // const isDismissed = !!localStorage.getItem('newDevUpgradePro'); + // if (isDismissed) return; // check if coupon already applied try { await sdk.forConsole.billing.getCouponAccount(NEW_DEV_PRO_UPGRADE_COUPON); From b8e22816ce9201212cb28fda58855dde42d0f209 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 10 Jun 2025 07:33:32 +0000 Subject: [PATCH 31/38] undo wrong commit --- src/lib/stores/billing.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts index bbc6c07b5..c68f336c1 100644 --- a/src/lib/stores/billing.ts +++ b/src/lib/stores/billing.ts @@ -534,9 +534,9 @@ export async function checkForNewDevUpgradePro(org: Organization) { const now = new Date().getTime(); const account = get(user); const accountCreated = new Date(account.$createdAt).getTime(); - // if (now - accountCreated < 1000 * 60 * 60 * 24 * 7) return; - // const isDismissed = !!localStorage.getItem('newDevUpgradePro'); - // if (isDismissed) return; + if (now - accountCreated < 1000 * 60 * 60 * 24 * 7) return; + const isDismissed = !!localStorage.getItem('newDevUpgradePro'); + if (isDismissed) return; // check if coupon already applied try { await sdk.forConsole.billing.getCouponAccount(NEW_DEV_PRO_UPGRADE_COUPON); From 5c849391b94e3c01e10e4cab0270f19a91fcd0b7 Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 10 Jun 2025 13:13:37 +0530 Subject: [PATCH 32/38] fix: failing e2e test due to custom plan addition in the list. --- src/lib/components/billing/planSelection.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/billing/planSelection.svelte b/src/lib/components/billing/planSelection.svelte index 7c1666675..db11d298f 100644 --- a/src/lib/components/billing/planSelection.svelte +++ b/src/lib/components/billing/planSelection.svelte @@ -74,7 +74,7 @@ {formatCurrency(scalePlan?.price ?? 0)} per month + usage - {#if !isBasePlan} + {#if $currentPlan && !isBasePlan} Date: Tue, 10 Jun 2025 13:36:45 +0530 Subject: [PATCH 33/38] fix: nullable email crashing console on login. --- src/lib/components/navbar.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/navbar.svelte b/src/lib/components/navbar.svelte index 435037fd6..ee1b70df4 100644 --- a/src/lib/components/navbar.svelte +++ b/src/lib/components/navbar.svelte @@ -229,7 +229,7 @@ style:padding-inline-end="8px" style:padding-block="4px"> - {$user.email} + {$user?.email} Date: Tue, 10 Jun 2025 17:42:40 -0700 Subject: [PATCH 34/38] fix: Fix Flutter web platform creation Use `hostname` instead of `key` for Flutter web platform creation. --- .../overview/platforms/createFlutter.svelte | 50 +++++++++++++------ 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/src/routes/(console)/project-[region]-[project]/overview/platforms/createFlutter.svelte b/src/routes/(console)/project-[region]-[project]/overview/platforms/createFlutter.svelte index 59460df7e..8d0aa74df 100644 --- a/src/routes/(console)/project-[region]-[project]/overview/platforms/createFlutter.svelte +++ b/src/routes/(console)/project-[region]-[project]/overview/platforms/createFlutter.svelte @@ -115,9 +115,11 @@ static const String APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject(page.params.reg projectId, platform, $createPlatform.name, - $createPlatform.key || undefined, + platform === PlatformType.Flutterweb ? undefined : $createPlatform.key || undefined, undefined, - undefined + platform === PlatformType.Flutterweb + ? $createPlatform.hostname || undefined + : undefined ); isPlatformCreated = true; @@ -189,19 +191,35 @@ static const String APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject(page.params.reg bind:value={$createPlatform.name} /> - - - - - {placeholder[platform].tooltip} - - - + {#if platform === PlatformType.Flutterweb} + + + + + {placeholder[platform].tooltip} + + + + {:else} + + + + + {placeholder[platform].tooltip} + + + + {/if} - {/if} - - + + {#if $canWriteCollections} + + {/if} + {#if data.collections.total} {#if data.view === 'grid'} diff --git a/src/routes/(console)/project-[region]-[project]/messaging/+page.svelte b/src/routes/(console)/project-[region]-[project]/messaging/+page.svelte index 0ed4c8b4c..12821a0bf 100644 --- a/src/routes/(console)/project-[region]-[project]/messaging/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/messaging/+page.svelte @@ -1,19 +1,11 @@ - - - - - - - - {#if $canWriteMessages} - - {/if} - - + + {#if $canWriteMessages} + + {/if} + {#if data.messages.total} import { page } from '$app/state'; import { Button } from '$lib/elements/forms'; - import { - Empty, - EmptySearch, - SearchQuery, - PaginationWithLimit, - EmptyFilter, - ViewSelector - } from '$lib/components'; + import { Empty, EmptySearch, PaginationWithLimit, EmptyFilter } from '$lib/components'; import Create from './create.svelte'; import { goto } from '$app/navigation'; - import { Container } from '$lib/layout'; + import { Container, ResponsiveContainerHeader } from '$lib/layout'; import { base } from '$app/paths'; import type { Models } from '@appwrite.io/console'; import type { PageData } from './$types'; import { showCreate } from './store'; - import { Filters, hasPageQueries } from '$lib/components/filters'; + import { hasPageQueries } from '$lib/components/filters'; import Table from './table.svelte'; import type { Column } from '$lib/helpers/types'; import { writable } from 'svelte/store'; import { canWriteTopics } from '$lib/stores/roles'; - import { Icon, Layout } from '@appwrite.io/pink-svelte'; + import { Icon } from '@appwrite.io/pink-svelte'; import { View } from '$lib/helpers/load'; import { IconPlus } from '@appwrite.io/pink-icons-svelte'; import { Click, trackEvent } from '$lib/actions/analytics'; @@ -72,26 +65,26 @@ - - - - - - - - {#if $canWriteTopics} - - {/if} - - + + {#if $canWriteTopics} + + {/if} + {#if data.topics.total} From e25f8d11f371eb3bbf6d14db4c188f8b5c53be6c Mon Sep 17 00:00:00 2001 From: ernstmul Date: Thu, 12 Jun 2025 10:30:18 +0200 Subject: [PATCH 37/38] fix popover overflowing page --- package.json | 2 +- pnpm-lock.yaml | 19 ++++---- src/lib/components/columnSelector.svelte | 56 ++++++++++++++++-------- 3 files changed, 48 insertions(+), 29 deletions(-) diff --git a/package.json b/package.json index 0fe8f5a25..6bc1eb196 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@appwrite.io/pink-icons": "0.25.0", "@appwrite.io/pink-icons-svelte": "^2.0.0-RC.1", "@appwrite.io/pink-legacy": "^1.0.3", - "@appwrite.io/pink-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@40bae6b", + "@appwrite.io/pink-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@ee1b778", "@popperjs/core": "^2.11.8", "@sentry/sveltekit": "^8.38.0", "@stripe/stripe-js": "^3.5.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cac4e0adc..5f6146e7c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -24,8 +24,8 @@ importers: specifier: ^1.0.3 version: 1.0.3 '@appwrite.io/pink-svelte': - specifier: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@40bae6b - version: https://pkg.vc/-/@appwrite/%40appwrite.io%2Fpink-svelte@40bae6b(svelte@5.25.3) + specifier: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@ee1b778 + version: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@ee1b778(svelte@5.25.3) '@popperjs/core': specifier: ^2.11.8 version: 2.11.8 @@ -261,8 +261,9 @@ packages: resolution: {tarball: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@a5e5564} version: 1.8.0 - '@appwrite.io/pink-icons-svelte@2.0.0-RC.1': - resolution: {integrity: sha512-iLFlV55hj8mGuAbmxJGenxN5RaZMmVT4GJb9dv/MP1xBAtYibFq7JvBcxm18qV2KU8c31Rntf+Ub4GL7HwqTYg==} + '@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@ee1b7788cd3f877c9aa1b6487976bd63a6196870': + resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@ee1b7788cd3f877c9aa1b6487976bd63a6196870} + version: 2.0.0-RC.1 peerDependencies: svelte: ^4.0.0 @@ -281,8 +282,8 @@ packages: '@appwrite.io/pink-legacy@1.0.3': resolution: {integrity: sha512-GGde5fmPhs+s6/3aFeMPc/kKADG/gTFkYQSy6oBN8pK0y0XNCLrZZgBv+EBbdhwdtqVEWXa0X85Mv9w7jcIlwQ==} - '@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/%40appwrite.io%2Fpink-svelte@40bae6b': - resolution: {tarball: https://pkg.vc/-/@appwrite/%40appwrite.io%2Fpink-svelte@40bae6b} + '@appwrite.io/pink-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@ee1b778': + resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@ee1b778} version: 2.0.0-RC.2 peerDependencies: svelte: ^4.0.0 @@ -3637,7 +3638,7 @@ snapshots: '@appwrite.io/console@https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@a5e5564': {} - '@appwrite.io/pink-icons-svelte@2.0.0-RC.1(svelte@5.25.3)': + '@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@ee1b7788cd3f877c9aa1b6487976bd63a6196870(svelte@5.25.3)': dependencies: svelte: 5.25.3 @@ -3654,9 +3655,9 @@ snapshots: '@appwrite.io/pink-icons': 1.0.0 the-new-css-reset: 1.11.3 - '@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/%40appwrite.io%2Fpink-svelte@40bae6b(svelte@5.25.3)': + '@appwrite.io/pink-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@ee1b778(svelte@5.25.3)': dependencies: - '@appwrite.io/pink-icons-svelte': 2.0.0-RC.1(svelte@5.25.3) + '@appwrite.io/pink-icons-svelte': https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@ee1b7788cd3f877c9aa1b6487976bd63a6196870(svelte@5.25.3) '@floating-ui/dom': 1.6.13 '@melt-ui/pp': 0.3.2(@melt-ui/svelte@0.86.6(svelte@5.25.3))(svelte@5.25.3) '@melt-ui/svelte': 0.86.6(svelte@5.25.3) diff --git a/src/lib/components/columnSelector.svelte b/src/lib/components/columnSelector.svelte index 37c1640ad..c113d5e9c 100644 --- a/src/lib/components/columnSelector.svelte +++ b/src/lib/components/columnSelector.svelte @@ -18,6 +18,19 @@ children: Snippet<[toggle: () => void, selectedColumnsNumber: number]>; } = $props(); + let maxHeight = $state('none'); + let containerRef; + + const calcMaxHeight = () => { + if (containerRef) { + // get parent row element for correct top position + const parent = containerRef.parentElement.parentElement; + const { top } = parent.getBoundingClientRect(); + + maxHeight = `${window.innerHeight - top - 48}px`; + } + }; + onMount(async () => { if (isCustomCollection) { const prefs = preferences.getCustomCollectionColumns(page.params.collection); @@ -50,6 +63,8 @@ preferences.setColumns(columns); } }); + + calcMaxHeight(); }); let selectedColumnsNumber = $derived( @@ -61,29 +76,32 @@ ); + {#if $columns?.length} {@render children(toggle, selectedColumnsNumber)} - - {#each $columns as column} - {#if !column?.exclude} - (column.hide = !column.hide)} - disabled={allowNoColumns - ? false - : selectedColumnsNumber <= 1 && column.hide !== true}> - - (column.hide = !column.hide)} /> - {column.title} - - - {/if} - {/each} - +
+ + {#each $columns as column} + {#if !column?.exclude} + (column.hide = !column.hide)} + disabled={allowNoColumns + ? false + : selectedColumnsNumber <= 1 && column.hide !== true}> + + (column.hide = !column.hide)} /> + {column.title} + + + {/if} + {/each} + +
{/if} From 2bed634c24bbafa0b57b9b9d34db88f14dd1388d Mon Sep 17 00:00:00 2001 From: Darshan Date: Thu, 12 Jun 2025 14:11:35 +0530 Subject: [PATCH 38/38] fix: store null on onboarding. --- src/lib/stores/user.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/stores/user.ts b/src/lib/stores/user.ts index 808dd3877..496da7952 100644 --- a/src/lib/stores/user.ts +++ b/src/lib/stores/user.ts @@ -13,6 +13,10 @@ export type Account = Models.User< >; export const user = derived(page, ($page) => { - if (browser) sessionStorage.setItem('account', JSON.stringify($page.data.account)); - return $page.data.account as Account; + if ($page.data?.account) { + if (browser) { + sessionStorage.setItem('account', JSON.stringify($page.data.account)); + } + return $page.data.account as Account; + } else return null; });