Skip to content

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

Open
lohanidamodar wants to merge 11 commits intomainfrom
feat/project-premium-geo-db-addon
Open

feat: add Premium Geo DB addon to project settings#2981
lohanidamodar wants to merge 11 commits intomainfrom
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
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 18, 2026

Greptile Summary

This PR adds a Premium Geo DB addon section to project settings, mirroring the existing BAA pattern at the organization level. The load function, UI lifecycle states, enable/disable modals, and plan-summary billing rows are all correctly wired. The two new P2 findings are: a potential duplicate addon row in the billing plan summary (if the API populates the same addon_* charge in both org-level and project-level resource arrays), and mixed Svelte 4/5 syntax in the new runes-mode modals.

Confidence Score: 4/5

Safe to merge after confirming the open issues from previous review threads are addressed; new findings are P2 only

All new findings in this pass are P2 (style/verification). The previously-flagged P1 issues (missing onMount 3DS handler, handleReEnable discarding 3DS result) from prior threads still need resolution before this is production-ready, which caps the score.

premiumGeoDB.svelte — onMount 3DS handler and handleReEnable 3DS path; planSummary.svelte — verify no duplicate addon rows

Important Files Changed

Filename Overview
src/routes/(console)/project-[region]-[project]/settings/premiumGeoDB.svelte New component implementing the Premium Geo DB addon lifecycle; mirrors BAA.svelte but is missing the onMount 3DS return handler and handleReEnable drops the 3DS result
src/routes/(console)/project-[region]-[project]/settings/premiumGeoDBEnableModal.svelte Enable modal correctly checks for clientSecret and calls confirmPayment; returns without closing when 3DS is required, relying on the parent's onMount to complete the flow
src/routes/(console)/project-[region]-[project]/settings/premiumGeoDBDisableModal.svelte Straightforward disable modal that deletes the addon and invalidates dependencies; uses Svelte 5 runes syntax while the parent uses Svelte 4 (compatible but inconsistent)
src/routes/(console)/project-[region]-[project]/settings/+page.ts Adds listAddons and getAddonPrice calls behind isCloud guard with .catch(() => null) fallback; clean and correct
src/routes/(console)/project-[region]-[project]/settings/+page.svelte Minimal change to mount PremiumGeoDB component inside an isCloud guard; correct integration
src/routes/(console)/organization-[organization]/billing/planSummary.svelte Removes billingAddonNames map in favour of addon.name, and adds per-project addon rows to project breakdown children; addon rows could duplicate if org-level resources already include per-project addon charges

Reviews (8): Last reviewed commit: "Revert "chore: keep @appwrite.io/console..." | Re-trigger Greptile

Comment on lines +64 to +83
async function handleReEnable() {
reEnabling = true;
try {
await sdk.forConsoleIn(page.params.region).projects.createPremiumGeoDBAddon({
projectId: page.params.project
});
await Promise.all([invalidate(Dependencies.ADDONS), invalidate(Dependencies.PROJECT)]);
addNotification({
message: 'Premium Geo DB addon has been re-enabled',
type: 'success'
});
} catch (e) {
addNotification({
message: e.message,
type: 'error'
});
} finally {
reEnabling = false;
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 handleReEnable silently drops 3DS response

createPremiumGeoDBAddon can return either a Models.Addon (immediate success) or a Models.PaymentAuthentication (3DS required). handleReEnable discards the return value entirely, so if re-enabling requires 3DS the payment challenge is never initiated — the notification fires as "re-enabled" while the addon actually sits in pending state waiting for a payment that will never complete.

The enable modal handles this correctly via the 'clientSecret' in result check and subsequent confirmPayment call. handleReEnable should mirror that same pattern, exactly as BAA.svelte's handleReEnable does.

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 on lines +268 to +269
: addon.name ||
`${addon.resourceId} overage (${formatNum(addon.value)})`,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 BAA label regression if API omits name

The hardcoded billingAddonNames map (addon_baa → 'HIPAA BAA') has been removed in favour of addon.name. If the billing-aggregation API response doesn't populate name on existing BAA resources, BAA will display as addon_baa overage (1) in the plan summary for current BAA subscribers. Make sure the cloud API (and the new SDK pin) actually includes name on billing resource objects, or keep a fallback map alongside the API-provided name as a safety net.

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.

1 participant