feat: add Premium Geo DB addon to project settings#2981
Conversation
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 SummaryThis 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
Confidence Score: 3/5Safe 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
Reviews (29): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
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>
…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
…DK methods" This reverts commit 304142c.
…geo-db-addon # Conflicts: # src/routes/(console)/project-[region]-[project]/settings/+page.svelte # src/routes/(console)/project-[region]-[project]/settings/+page.ts
…geo-db-addon # Conflicts: # bun.lock # package.json
…geo-db-addon # Conflicts: # bun.lock # package.json
…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.
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
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.
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:
Uses the new project-scoped SDK methods shipped with the cloud update:
listAddons,createPremiumGeoDBAddon, anddeleteAddon. Bumps the@appwrite.io/consoleSDK pin accordingly.Test plan
🤖 Generated with Claude Code