Skip to content

feat: add Premium Geo DB addon to project settings#2981

Merged
lohanidamodar merged 37 commits into
mainfrom
feat/project-premium-geo-db-addon
Jul 16, 2026
Merged

feat: add Premium Geo DB addon to project settings#2981
lohanidamodar merged 37 commits into
mainfrom
feat/project-premium-geo-db-addon

Conversation

@lohanidamodar

Copy link
Copy Markdown
Member

Summary

Adds a Premium Geo DB section to the project settings page so users can enable and disable the premium geolocation addon per-project on cloud.

The section supports the full addon lifecycle, mirroring the BAA pattern at the organization level:

  • Upgrade prompt when the current plan does not support the addon
  • Enable flow with optional 3DS payment authentication
  • Pending state with cancel & retry option (if payment was interrupted)
  • Active state with disable action
  • Scheduled-for-removal state with re-enable action

Uses the new project-scoped SDK methods shipped with the cloud update: listAddons, createPremiumGeoDBAddon, and deleteAddon. Bumps the @appwrite.io/console SDK pin accordingly.

Test plan

  • Navigate to a cloud project's settings as an org owner on a plan that supports Premium Geo DB → section appears with Enable CTA
  • Click Enable → modal confirms and enables the addon (3DS where required); section transitions to Active
  • Click Disable → confirms removal at end of billing cycle; section transitions to Scheduled-for-removal
  • Click Keep Premium Geo DB while Scheduled-for-removal → returns to Active
  • On a plan that doesn't support the addon → shows Upgrade plan CTA / "not available" copy
  • On self-hosted mode → section is hidden

🤖 Generated with Claude Code

Adds a Premium Geo DB section to the project settings page so users
can enable and disable the premium geolocation addon per-project on
cloud. The section supports the full addon lifecycle:

- Upgrade prompt when the current plan does not support the addon
- Enable flow with optional 3DS payment authentication
- Pending state with cancel & retry option
- Active state with disable action
- Scheduled-for-removal state with re-enable action

Uses the new project-scoped SDK methods: listAddons, createPremiumGeoDBAddon,
and deleteAddon. Bumps the @appwrite.io/console SDK pin accordingly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a Premium Geo DB addon section to the project settings page, mirroring the existing BAA pattern with full lifecycle support: upgrade prompt, enable (with 3DS), pending/refresh, active, scheduled-for-removal, and re-enable flows. It also adds per-project addon rows to the billing plan summary table and bumps the SDK pin.

  • premiumGeoDB.svelte implements the lifecycle UI including an onMount handler for the ?type=confirm-addon Stripe redirect, handleRefresh for the pending state, and handleReEnable for cancelling a scheduled removal — the enable modal correctly uses redirectIfRequired: true but handleReEnable does not, causing unnecessary full-page redirects for non-3DS re-enable flows.
  • planSummary.svelte adds addon_premiumGeoDB/addon_premiumGeoDBOrg to the name-fallback map and appends per-project addon rows to the project breakdown table.
  • +page.ts loads addon state and price in parallel with existing settings data, returning null on error to prevent page-load failures.

Confidence Score: 5/5

Safe to merge; the core enable/disable/re-enable flows all complete correctly, and the one inconsistency in handleReEnable produces a suboptimal UX (unnecessary redirect) rather than a broken flow.

The addon lifecycle is well-structured and the critical 3DS handling in the enable modal is correct. The only new finding is that handleReEnable omits redirectIfRequired: true, so non-3DS re-enable always triggers a full page redirect via the onMount handler instead of resolving inline — the end result is the same, just with an avoidable page reload.

premiumGeoDB.svelte — specifically the handleReEnable function's confirmPayment call

Important Files Changed

Filename Overview
playwright.config.ts Updates the staging API endpoint URL — straightforward environment config change
src/routes/(console)/project-[region]-[project]/settings/+page.ts Adds listAddons and getAddonPrice calls (cloud-only, guarded by isCloud), silently returning null on error so page load never breaks; uses Dependencies.ADDONS for cache invalidation
src/routes/(console)/project-[region]-[project]/settings/+page.svelte Mounts PremiumGeoDB component behind isCloud && $canWriteProjects guard — minimal change, correctly scoped
src/routes/(console)/project-[region]-[project]/settings/premiumGeoDB.svelte Full addon lifecycle component with onMount 3DS handler and handleReEnable; handleReEnable calls confirmPayment without redirectIfRequired: true, causing unnecessary full-page redirects for non-3DS re-enable flows
src/routes/(console)/project-[region]-[project]/settings/premiumGeoDBEnableModal.svelte Enable modal with correct redirectIfRequired: true, full outcome inspection, and 409 conflict handling; matches the BAA pattern
src/routes/(console)/project-[region]-[project]/settings/premiumGeoDBDisableModal.svelte Straightforward disable modal using Svelte 5 runes; calls deleteAddon and invalidates ADDONS/PROJECT dependencies correctly
src/routes/(console)/organization-[organization]/billing/planSummary.svelte Adds addon_premiumGeoDB/addon_premiumGeoDBOrg to the name-fallback map and appends per-project addon rows to the breakdown table; shares row-ID prefix with the top-level addons section

Reviews (32): Last reviewed commit: "fix(premiumGeoDB): inspect payment outco..." | Re-trigger Greptile

lohanidamodar and others added 4 commits April 19, 2026 11:13
Mirrors the BAA addon UX by fetching the addon price via
organizations.getAddonPrice(Addon.Premiumgeodb) from the settings
page loader, passing it through to the Premium Geo DB card and
enable modal, and rendering the monthly/prorated breakdown with
formatCurrency alongside the Enable CTA.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…name

- Each project row in the organization billing breakdown now iterates
  its resources for addon_* entries (amount > 0) and renders them as
  child rows (e.g. Premium Geo DB under the project it was enabled on).
  The backend already filters project-scoped addons out of the
  team-level resources response, so the org "Addons" section shows only
  org-scoped addons (BAA, premiumGeoDBOrg) while project-scoped ones
  surface where they belong.
- Org-level addon labels now read addon.name from the UsageResource
  payload that the getAggregation endpoint populates from billingAddons
  config. Dropped the hard-coded billingAddonNames map so new addons
  surface with their proper name without a console update.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread src/routes/(console)/organization-[organization]/billing/planSummary.svelte Outdated
…geo-db-addon

# Conflicts:
#	bun.lock
#	package.json
#	src/routes/(console)/project-[region]-[project]/settings/+page.svelte
…geo-db-addon

# Conflicts:
#	bun.lock
#	package.json
…geo-db-addon

# Conflicts:
#	src/routes/(console)/project-[region]-[project]/settings/+page.svelte
#	src/routes/(console)/project-[region]-[project]/settings/+page.ts
…h for premium geoDB

Two missing pieces vs the BAA addon flow:

1. After Stripe redirects back from 3DS with ?type=confirm-addon&addonId=...,
   the page didn't read the query params or call the confirmations endpoint,
   so the addon stayed pending forever. Port the onMount handler from BAA.svelte.

2. The pending-state action was "Cancel & retry" which deleted the addon and
   forced a fresh 3DS flow. That's wasteful when the payment just needs a
   server-side status sync. Replace with "Refresh" — calls the confirmations
   endpoint, which live-queries Stripe and activates the addon if the
   PaymentIntent has transitioned to succeeded. Backend cleans up on 402.
The console SDK bump in this PR renamed Locale to CloudLocale,
breaking svelte-check with 7 errors across billing/Soc2/address
components.
lohanidamodar and others added 5 commits May 19, 2026 03:35
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…geo-db-addon

# Conflicts:
#	bun.lock
#	package.json
#	src/routes/(console)/organization-[organization]/billing/planSummary.svelte
#	src/routes/(console)/project-[region]-[project]/settings/+page.svelte
…geo-db-addon

# Conflicts:
#	bun.lock
#	package.json
@lohanidamodar lohanidamodar requested a review from HarshMN2345 July 7, 2026 10:08
lohanidamodar and others added 7 commits July 7, 2026 16:01
handleReEnable discarded the createPremiumGeoDBAddon return value and always
reported success. If the endpoint returns a PaymentAuthentication (payment/3DS
required) instead of an Addon, the challenge was never initiated — the addon
would sit in `pending` while the UI claimed it was re-enabled.

Mirror the enable modal: detect the `clientSecret` branch and drive confirmPayment
(which redirects to ?type=confirm-addon so the existing onMount handler completes
the payment). Matches BAA.svelte's handleReEnable pattern.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Project-scoped addon resources (addon_premiumGeoDB) are rebuilt by the cloud
project aggregator without a `name` field, so the per-project breakdown rows —
which used `addon.name || addon.resourceId` — rendered the raw resourceId.

Add premium geo entries to billingAddonNamesFallback and apply the map in the
breakdown rows too (previously only the top-level addons section used it), so
the label degrades to "Premium Geo DB" instead of "addon_premiumGeoDB".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Latest console SDK build with the project-level premium geo DB addon
methods (createPremiumGeoDBAddon, confirmAddonPayment) resolving to the
correct /projects/{projectId}/addons/... endpoints.
…geo-db-addon

# Conflicts:
#	bun.lock
#	package.json
Latest console SDK build; project premium geo DB addon methods
(createPremiumGeoDBAddon, confirmAddonPayment) resolve to the correct
/projects/{projectId}/addons/... endpoints.
…geo-db-addon

# Conflicts:
#	bun.lock
#	package.json
@lohanidamodar lohanidamodar merged commit 241dde8 into main Jul 16, 2026
3 of 4 checks passed
@lohanidamodar lohanidamodar deleted the feat/project-premium-geo-db-addon branch July 16, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants