Skip to content

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

Open
lohanidamodar wants to merge 34 commits into
mainfrom
feat/project-premium-geo-db-addon
Open

feat: add Premium Geo DB addon to project settings#2981
lohanidamodar wants to merge 34 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 cloud project settings page, supporting the full enable → pending → active → scheduled-for-removal lifecycle, and bumps the @appwrite.io/console SDK pin to expose the new project-scoped addon APIs.

  • The premiumGeoDB.svelte component now includes an onMount handler that processes the ?type=confirm-addon return URL after a Stripe redirect, and handleReEnable correctly branches on clientSecret to trigger 3DS when needed — both gaps from the prior review round are addressed.
  • planSummary.svelte extends the billingAddonNamesFallback map with addon_premiumGeoDB / addon_premiumGeoDBOrg and appends per-project addon rows to each project's child list; whether those charges also appear in the top-level addons section depends on how the cloud billing API populates currentAggregation.resources vs projectData.resources.
  • The enable modal and handleReEnable still call confirmPayment without redirectIfRequired: true and without inspecting the returned outcome, and the pending-state UI exposes only a Refresh button with no cancel path.

Confidence Score: 3/5

Safe to demo but not ready to ship: the enable modal silently discards payment errors and always forces a full Stripe redirect, and the addon key used to detect active state may not match the API's actual key casing.

The enable modal calls confirmPayment without redirectIfRequired:true and discards the outcome object, so payment failures surface no user-visible error. The addon detection uses camelCase key 'premiumGeoDB' while the BAA pattern uses lowercase 'baa' — a key mismatch would cause premiumGeoDBAddon to always be undefined, making the component permanently show the Enable CTA regardless of actual addon state.

premiumGeoDBEnableModal.svelte and premiumGeoDB.svelte — the 3DS payment result handling and the addon key string both need verification before shipping to production cloud users.

Important Files Changed

Filename Overview
src/routes/(console)/project-[region]-[project]/settings/premiumGeoDB.svelte New component managing the Premium Geo DB addon lifecycle; includes an onMount 3DS return-URL handler and handleReEnable now checks for 3DS, but confirm-payment path and addon key casing still carry risks.
src/routes/(console)/project-[region]-[project]/settings/premiumGeoDBEnableModal.svelte Enable modal handles immediate-success and 3DS-redirect branches, but calls confirmPayment without inspecting the outcome and without redirectIfRequired:true, so payment errors are silently dropped.
src/routes/(console)/project-[region]-[project]/settings/premiumGeoDBDisableModal.svelte Straightforward disable modal: calls deleteAddon, invalidates dependencies, shows notification, surfaces errors inline.
src/routes/(console)/project-[region]-[project]/settings/+page.ts Addon list and price fetches added via Promise.allSettled with .catch(()=>null) to prevent page-load failures; wires up ADDONS dependency.
src/routes/(console)/project-[region]-[project]/settings/+page.svelte Mounts PremiumGeoDB behind isCloud && $canWriteProjects guard; correct and minimal change.
src/routes/(console)/organization-[organization]/billing/planSummary.svelte Fallback name map extended and per-project addon rows appended to each project's children array; double-counting risk with top-level addons section remains unconfirmed.
package.json SDK pin bumped from 4b3ae78 to 68c295a to add listAddons, createPremiumGeoDBAddon, getAddonPrice, and deleteAddon project-scoped methods.

Reviews (29): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | 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 6 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.
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