Skip to content

Conversation

@HarshMN2345
Copy link
Member

@HarshMN2345 HarshMN2345 commented Jan 22, 2026

What does this PR do?

image

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

Summary by CodeRabbit

  • New Features
    • Added a modal allowing users to update the state for their payment methods.
    • Automatically prompts users to provide state information for US payment methods missing it.
    • Payment methods can now store an optional state value; US-based methods require selecting a state before saving.

✏️ Tip: You can customize this high-level summary in your review settings.

@appwrite
Copy link

appwrite bot commented Jan 22, 2026

Console (appwrite/console)

Project ID: 688b7bf400350cbd60e9

Sites (1)
Site Status Logs Preview QR
 console-stage
688b7cf6003b1842c9dc
Ready Ready View Logs Preview URL QR Code

Tip

Our Discord community has grown to 24K developers, and counting

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 22, 2026

Walkthrough

Adds a new Svelte component src/lib/components/billing/updateStateModal.svelte (UpdateStateModal) with public props show: boolean and paymentMethod: PaymentMethodData. Extends PaymentMethodData in src/lib/sdk/billing.ts with an optional state?: string. Integrates the modal into two pages: src/routes/(console)/account/payments/paymentMethods.svelte and src/routes/(console)/organization-[organization]/billing/paymentMethods.svelte by introducing showUpdateState and paymentMethodNeedingState, adding reactive detection of US payment methods missing state, and wiring modal open/close and reset behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a requirement for US payment methods to have a state selected, which is fully reflected in the new UpdateStateModal component and related changes across payment method pages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/lib/components/billing/updateStateModal.svelte`:
- Around line 22-24: selectedState currently persists between modal opens
causing stale selections; update the component to reset selectedState when the
modal closes (or reinitialize it from paymentMethod when the modal opens).
Specifically, add logic that listens for the modal close/open state (e.g., an
on:close handler or a reactive watcher on the modal `open` prop) and set
selectedState = '' (or selectedState = paymentMethod?.state) and clear
isSubmitting/error as appropriate; reference the existing selectedState,
isSubmitting, error and paymentMethod symbols when adding the reset logic so the
selection is cleared on close or correctly initialized on open.
🧹 Nitpick comments (2)
src/lib/components/billing/updateStateModal.svelte (2)

1-1: Rename component file to PascalCase.

updateStateModal.svelte should be UpdateStateModal.svelte under src/lib/components/billing/ to match the component naming guideline; update imports accordingly. As per coding guidelines.


10-12: Use $lib alias for local imports.

Avoid relative imports from src/lib; use $lib aliases for both the state list and component index. As per coding guidelines.

♻️ Suggested import cleanup
-    import { states } from './state';
-    import { CreditCardBrandImage } from '../index.js';
+    import { states } from '$lib/components/billing/state';
+    import { CreditCardBrandImage } from '$lib/components';

HarshMN2345 and others added 2 commits January 22, 2026 15:55
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
onSubmit={handleSubmit}
bind:show
title="Update payment method state">
<svelte:fragment slot="description">
Copy link
Member

Choose a reason for hiding this comment

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

Maybe move the desc below the separator
its too close to the title

Copy link
Member

@lohanidamodar lohanidamodar left a comment

Choose a reason for hiding this comment

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

Rest looks good, let's fix the description of the modal and merge.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/lib/components/billing/updateStateModal.svelte`:
- Around line 10-12: Update the imports in updateStateModal.svelte to use the
$lib alias instead of relative paths: replace the import of states (currently
from './state') and CreditCardBrandImage (currently from '../index.js') to
import from '$lib/...' equivalents so they resolve from src/lib; ensure the
module names (states and CreditCardBrandImage) remain unchanged and update any
other src/lib relative imports in this file to use the $lib alias for
consistency with repo conventions.
🧹 Nitpick comments (1)
src/lib/components/billing/updateStateModal.svelte (1)

1-1: Rename the component file to PascalCase.

The component lives under src/lib/components/** and should use PascalCase file naming (e.g., UpdateStateModal.svelte). As per coding guidelines, ...

Comment on lines +10 to +12
import { states } from './state';
import { Alert, Card, Layout, Typography } from '@appwrite.io/pink-svelte';
import { CreditCardBrandImage } from '../index.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Use $lib alias for src/lib imports.

Relative imports from src/lib should use the $lib alias. This keeps paths consistent and matches the repo conventions.

🔧 Suggested change
-import { states } from './state';
+import { states } from '$lib/components/billing/state';
@@
-import { CreditCardBrandImage } from '../index.js';
+import { CreditCardBrandImage } from '$lib/components';

As per coding guidelines, ...

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { states } from './state';
import { Alert, Card, Layout, Typography } from '@appwrite.io/pink-svelte';
import { CreditCardBrandImage } from '../index.js';
import { states } from '$lib/components/billing/state';
import { Alert, Card, Layout, Typography } from '@appwrite.io/pink-svelte';
import { CreditCardBrandImage } from '$lib/components';
🤖 Prompt for AI Agents
In `@src/lib/components/billing/updateStateModal.svelte` around lines 10 - 12,
Update the imports in updateStateModal.svelte to use the $lib alias instead of
relative paths: replace the import of states (currently from './state') and
CreditCardBrandImage (currently from '../index.js') to import from '$lib/...'
equivalents so they resolve from src/lib; ensure the module names (states and
CreditCardBrandImage) remain unchanged and update any other src/lib relative
imports in this file to use the $lib alias for consistency with repo
conventions.

@HarshMN2345 HarshMN2345 merged commit 26bcf6f into main Jan 27, 2026
3 of 4 checks passed
@HarshMN2345 HarshMN2345 deleted the feat-CLO-3388-us-state-dialog branch January 27, 2026 06:52
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.

4 participants