From 42a02913452bd96f47c8fc51f145e3f3bdfb85ee Mon Sep 17 00:00:00 2001 From: Harsh Mahajan <127186841+HarshMN2345@users.noreply.github.com> Date: Wed, 23 Jul 2025 16:46:19 +0530 Subject: [PATCH 01/27] fix: Enable Update button for any field change in all OAuth provider modals --- .../auth/(providers)/appleOAuth.svelte | 5 ++--- .../auth/(providers)/auth0OAuth.svelte | 5 ++--- .../auth/(providers)/authentikOAuth.svelte | 5 ++--- .../auth/(providers)/gitlabOAuth.svelte | 5 ++--- .../auth/(providers)/googleOAuth.svelte | 8 +++----- .../auth/(providers)/mainOAuth.svelte | 8 +++----- .../auth/(providers)/microsoftOAuth.svelte | 10 ++++------ .../auth/(providers)/oidcOAuth.svelte | 5 ++--- .../auth/(providers)/oktaOAuth.svelte | 16 ++++++++++------ 9 files changed, 30 insertions(+), 37 deletions(-) diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/appleOAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/appleOAuth.svelte index f953c690e..2d0bb767d 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/appleOAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/appleOAuth.svelte @@ -73,10 +73,9 @@ diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/auth0OAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/auth0OAuth.svelte index 510359bc3..364a8e156 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/auth0OAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/auth0OAuth.svelte @@ -77,10 +77,9 @@ diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/authentikOAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/authentikOAuth.svelte index 0c986847f..3ce0bf928 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/authentikOAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/authentikOAuth.svelte @@ -81,10 +81,9 @@ diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/gitlabOAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/gitlabOAuth.svelte index 5c54a1942..20a314618 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/gitlabOAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/gitlabOAuth.svelte @@ -76,10 +76,9 @@ diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/googleOAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/googleOAuth.svelte index c56d54ff5..380bd5f76 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/googleOAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/googleOAuth.svelte @@ -72,11 +72,9 @@ diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/mainOAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/mainOAuth.svelte index 85fcdb91d..8fcf41ce4 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/mainOAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/mainOAuth.svelte @@ -71,11 +71,9 @@ diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/microsoftOAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/microsoftOAuth.svelte index 253c7b429..20dcd49c0 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/microsoftOAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/microsoftOAuth.svelte @@ -42,9 +42,8 @@ clientSecret && tenantID ? JSON.stringify({ clientSecret, tenantID }) : provider.secret; - - {provider.name} OAuth2 settings -

+ +

To use {provider.name} authentication in your application, first fill in this form. For more info you can @@ -78,10 +77,9 @@ diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/oidcOAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/oidcOAuth.svelte index 90a61e14f..aca98bbf9 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/oidcOAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/oidcOAuth.svelte @@ -115,10 +115,9 @@ diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/oktaOAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/oktaOAuth.svelte index f1c7a30be..06b23759c 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/oktaOAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/oktaOAuth.svelte @@ -47,9 +47,14 @@ : provider.secret; - - {provider.name} OAuth2 settings -

+ +

To use {provider.name} authentication in your application, first fill in this form. For more info you can From 907b101d58d2f3e9e6edb22ced527881a2bb94d9 Mon Sep 17 00:00:00 2001 From: Harsh Mahajan <127186841+HarshMN2345@users.noreply.github.com> Date: Wed, 23 Jul 2025 17:53:27 +0530 Subject: [PATCH 02/27] fix:Require App ID and App Secret, update button logic for all --- .../auth/(providers)/appleOAuth.svelte | 19 +++++++++------ .../auth/(providers)/auth0OAuth.svelte | 24 ++++++++++++------- .../auth/(providers)/authentikOAuth.svelte | 18 +++++++++----- .../auth/(providers)/gitlabOAuth.svelte | 20 ++++++++-------- .../auth/(providers)/googleOAuth.svelte | 14 +++++++---- .../auth/(providers)/mainOAuth.svelte | 14 +++++++---- .../auth/(providers)/microsoftOAuth.svelte | 14 +++++++---- .../auth/(providers)/oidcOAuth.svelte | 18 +++++++++----- .../auth/(providers)/oktaOAuth.svelte | 22 +++++++++++------ 9 files changed, 103 insertions(+), 60 deletions(-) diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/appleOAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/appleOAuth.svelte index 2d0bb767d..788922eb4 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/appleOAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/appleOAuth.svelte @@ -60,10 +60,11 @@ label="Services ID" autofocus={true} placeholder="com.company.appname" - bind:value={appId} /> - - - + bind:value={appId} + required /> + + + To complete set up, add this OAuth2 redirect URI to your {provider.name} app configuration. @@ -73,9 +74,13 @@ diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/auth0OAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/auth0OAuth.svelte index 364a8e156..aec1fa327 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/auth0OAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/auth0OAuth.svelte @@ -52,22 +52,25 @@ + bind:value={appId} + required /> + bind:value={clientSecret} + required /> + placeholder="your-tenant.auth0.com" + bind:value={auth0Domain} + required /> To complete set up, add this OAuth2 redirect URI to your {provider.name} app configuration. @@ -77,9 +80,12 @@ diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/authentikOAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/authentikOAuth.svelte index 3ce0bf928..d367dbd77 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/authentikOAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/authentikOAuth.svelte @@ -60,18 +60,21 @@ label="Client ID" autofocus={true} placeholder="Enter ID" - bind:value={appId} /> + bind:value={appId} + required /> + bind:value={clientSecret} + required /> + bind:value={authentikDomain} + required /> To complete set up, add this OAuth2 redirect URI to your {provider.name} app configuration. @@ -81,9 +84,12 @@ diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/gitlabOAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/gitlabOAuth.svelte index 20a314618..c434ebd5a 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/gitlabOAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/gitlabOAuth.svelte @@ -55,18 +55,16 @@ label="App ID" autofocus={true} placeholder="Enter ID" - bind:value={appId} /> + bind:value={appId} + required /> - + bind:value={clientSecret} + required /> + To complete set up, add this OAuth2 redirect URI to your {provider.name} app configuration. @@ -76,9 +74,11 @@ diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/googleOAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/googleOAuth.svelte index 380bd5f76..cf01f41a9 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/googleOAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/googleOAuth.svelte @@ -54,13 +54,15 @@ label="App ID" autofocus={true} placeholder="Enter ID" - bind:value={appId} /> + bind:value={appId} + required /> + bind:value={secret} + required /> To complete the setup, create an OAuth2 client ID with "Web application" as the application type, then add this redirect URI to your {provider.name} configuration. @@ -72,9 +74,11 @@ diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/mainOAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/mainOAuth.svelte index 8fcf41ce4..8e33f1022 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/mainOAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/mainOAuth.svelte @@ -55,13 +55,15 @@ label="App ID" autofocus={true} placeholder="Enter ID" - bind:value={appId} /> + bind:value={appId} + required /> + bind:value={secret} + required /> To complete set up, add this OAuth2 redirect URI to your {provider.name} app configuration. @@ -71,9 +73,11 @@ diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/microsoftOAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/microsoftOAuth.svelte index 20dcd49c0..782df6879 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/microsoftOAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/microsoftOAuth.svelte @@ -56,13 +56,15 @@ label="Application (client) ID" autofocus={true} placeholder="Enter ID" - bind:value={appId} /> + bind:value={appId} + required /> + bind:value={clientSecret} + required /> diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/oidcOAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/oidcOAuth.svelte index aca98bbf9..bb8849411 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/oidcOAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/oidcOAuth.svelte @@ -78,18 +78,21 @@ label="Client ID" autofocus={true} placeholder="Enter ID" - bind:value={appId} /> + bind:value={appId} + required /> + bind:value={clientSecret} + required /> + bind:value={wellKnownEndpoint} + required /> diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/oktaOAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/oktaOAuth.svelte index 06b23759c..65e832d3b 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/oktaOAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/oktaOAuth.svelte @@ -66,23 +66,27 @@ label="Client ID" autofocus={true} placeholder="Enter ID" - bind:value={appId} /> + bind:value={appId} + required /> + bind:value={clientSecret} + required /> + bind:value={oktaDomain} + required /> + bind:value={authorizationServerId} + required /> To complete set up, add this OAuth2 redirect URI to your {provider.name} app configuration. @@ -93,9 +97,13 @@ From 1bd6836b995c75f9e6c2ade0299c8ce773709561 Mon Sep 17 00:00:00 2001 From: Harsh Mahajan <127186841+HarshMN2345@users.noreply.github.com> Date: Wed, 23 Jul 2025 17:56:42 +0530 Subject: [PATCH 03/27] fix:changed id back --- .../auth/(providers)/auth0OAuth.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/auth0OAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/auth0OAuth.svelte index aec1fa327..5f97318c8 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/auth0OAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/auth0OAuth.svelte @@ -52,7 +52,7 @@ Date: Thu, 24 Jul 2025 17:08:28 +0530 Subject: [PATCH 04/27] fix: added chnages --- .../auth/(providers)/oidcOAuth.svelte | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/routes/(console)/project-[region]-[project]/auth/(providers)/oidcOAuth.svelte b/src/routes/(console)/project-[region]-[project]/auth/(providers)/oidcOAuth.svelte index bb8849411..40637fb91 100644 --- a/src/routes/(console)/project-[region]-[project]/auth/(providers)/oidcOAuth.svelte +++ b/src/routes/(console)/project-[region]-[project]/auth/(providers)/oidcOAuth.svelte @@ -92,22 +92,25 @@ label="Well-Known Endpoint" placeholder="https://example.com/.well-known/openid-configuration" bind:value={wellKnownEndpoint} - required /> + required={!authorizationEndpoint && !tokenEndpoint && !userinfoEndpoint} /> + bind:value={authorizationEndpoint} + required={!wellKnownEndpoint} /> + bind:value={tokenEndpoint} + required={!wellKnownEndpoint} /> + bind:value={userinfoEndpoint} + required={!wellKnownEndpoint} /> To complete set up, add this OAuth2 redirect URI to your {provider.name} app configuration. @@ -120,7 +123,8 @@ diff --git a/src/lib/components/billing/statePicker.svelte b/src/lib/components/billing/statePicker.svelte index 553397d0c..d84d5c39d 100644 --- a/src/lib/components/billing/statePicker.svelte +++ b/src/lib/components/billing/statePicker.svelte @@ -2,41 +2,50 @@ import { states } from './states.js'; import { InputSelect } from '$lib/elements/forms'; import type { PaymentMethod } from '@stripe/stripe-js'; - import Card from '../card.svelte'; - import { Alert, Layout, Typography } from '@appwrite.io/pink-svelte'; + import { Alert, Card, Layout, Typography } from '@appwrite.io/pink-svelte'; import { CreditCardBrandImage } from '../index.js'; export let state: string = ''; export let card: PaymentMethod | null = null; -{#if card} - - - - ending in {card.card?.last4} - +

+ {#if card} + + + + ending in {card.card?.last4} + + + {card.card.country} + {card.billing_details.address.postal_code} + + + {/if} + + - {card.card.country} - {card.billing_details.address.postal_code} + To complete the billing information, select your state so we can apply the correct taxes + and meet U.S. legal requirements. - -{/if} + - - - To complete the billing information, select your state so we can apply the correct taxes and - meet U.S. legal requirements. - - + ({ + label: state.name, + value: state.abbreviation, + id: state.abbreviation.toLowerCase() + }))} /> +
- ({ - label: state.name, - value: state.abbreviation, - id: state.abbreviation.toLowerCase() - }))} /> + From 37b3b7262c09930f2b6ce6a858203cc445e1ac67 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 31 Jul 2025 04:53:59 +0000 Subject: [PATCH 07/27] updated to use Layout --- src/lib/components/billing/paymentModal.svelte | 6 ++---- src/lib/components/billing/statePicker.svelte | 13 +++---------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/lib/components/billing/paymentModal.svelte b/src/lib/components/billing/paymentModal.svelte index 9c47b2b2f..0ab20511a 100644 --- a/src/lib/components/billing/paymentModal.svelte +++ b/src/lib/components/billing/paymentModal.svelte @@ -102,10 +102,8 @@ onSubmit={handleSubmit}> {#if showState} -
- - -
+ + {:else} -
+ {#if card} @@ -32,6 +32,7 @@ -
- - + From 783d503c63145eea83832e6267b5e0f6a5076acd Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 31 Jul 2025 04:55:03 +0000 Subject: [PATCH 08/27] update gap --- src/lib/components/billing/paymentModal.svelte | 8 -------- src/lib/components/billing/statePicker.svelte | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/lib/components/billing/paymentModal.svelte b/src/lib/components/billing/paymentModal.svelte index 0ab20511a..ef8e298ef 100644 --- a/src/lib/components/billing/paymentModal.svelte +++ b/src/lib/components/billing/paymentModal.svelte @@ -138,14 +138,6 @@ display: flex; min-height: 245px; - .state-element { - width: 100%; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - } - .stripe-element { width: 100%; } diff --git a/src/lib/components/billing/statePicker.svelte b/src/lib/components/billing/statePicker.svelte index 9123e6522..6419c5470 100644 --- a/src/lib/components/billing/statePicker.svelte +++ b/src/lib/components/billing/statePicker.svelte @@ -9,7 +9,7 @@ export let card: PaymentMethod | null = null; - + {#if card} From ed04bbe5b61a06ae3cfb281cfa8569ce8ad8a72a Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 31 Jul 2025 04:55:13 +0000 Subject: [PATCH 09/27] remove comment --- src/lib/components/billing/paymentModal.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/components/billing/paymentModal.svelte b/src/lib/components/billing/paymentModal.svelte index ef8e298ef..06f14cde1 100644 --- a/src/lib/components/billing/paymentModal.svelte +++ b/src/lib/components/billing/paymentModal.svelte @@ -102,7 +102,6 @@ onSubmit={handleSubmit}> {#if showState} - {:else} Date: Thu, 31 Jul 2025 04:56:26 +0000 Subject: [PATCH 10/27] remove log --- src/lib/stores/stripe.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/stores/stripe.ts b/src/lib/stores/stripe.ts index 162d6129b..3fab2e59a 100644 --- a/src/lib/stores/stripe.ts +++ b/src/lib/stores/stripe.ts @@ -89,7 +89,6 @@ export async function submitStripeCard(name: string, organizationId?: string) { redirect: 'if_required' }); - console.log(setupIntent); if (error) { const e = new Error(error.message); trackError(e, Submit.PaymentMethodCreate); From bfc64944aa72768dcd11cb4f0a291dff75501d5c Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 31 Jul 2025 04:58:19 +0000 Subject: [PATCH 11/27] fixes --- src/lib/components/billing/{states.js => state.ts} | 2 +- src/lib/components/billing/statePicker.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename src/lib/components/billing/{states.js => state.ts} (98%) diff --git a/src/lib/components/billing/states.js b/src/lib/components/billing/state.ts similarity index 98% rename from src/lib/components/billing/states.js rename to src/lib/components/billing/state.ts index b8ca0ec88..faa3f0786 100644 --- a/src/lib/components/billing/states.js +++ b/src/lib/components/billing/state.ts @@ -1,4 +1,4 @@ -export const states = [ +export const states: Array<{ name: string; abbreviation: string }> = [ { "name": "Alabama", "abbreviation": "AL" diff --git a/src/lib/components/billing/statePicker.svelte b/src/lib/components/billing/statePicker.svelte index 6419c5470..125487bcb 100644 --- a/src/lib/components/billing/statePicker.svelte +++ b/src/lib/components/billing/statePicker.svelte @@ -1,5 +1,5 @@ From 757289a47e921bdf7276dd5f7e410de3053c559e Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 4 Aug 2025 09:44:28 +0530 Subject: [PATCH 21/27] fix: realtime import status on csv not shown on other regions. --- src/lib/components/csvImportBox.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/csvImportBox.svelte b/src/lib/components/csvImportBox.svelte index 60f93abf6..7b3fcc920 100644 --- a/src/lib/components/csvImportBox.svelte +++ b/src/lib/components/csvImportBox.svelte @@ -154,7 +154,7 @@ migrations.migrations.forEach(updateOrAddItem); }); - return sdk.forConsole.client.subscribe('console', (response) => { + return sdk.forConsoleIn(page.params.region).client.subscribe('console', (response) => { if (!response.channels.includes(`projects.${getProjectId()}`)) return; if (response.events.includes('migrations.*')) { updateOrAddItem(response.payload as Payload); From b7ab1d70449f7f5c59c76833c3adf0ff0130ae49 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 4 Aug 2025 08:26:03 +0000 Subject: [PATCH 22/27] Fix typos --- .../components/billing/paymentModal.svelte | 2 +- src/lib/components/billing/state.ts | 238 +++++++++--------- src/lib/sdk/billing.ts | 7 +- src/lib/stores/stripe.ts | 19 +- 4 files changed, 139 insertions(+), 127 deletions(-) diff --git a/src/lib/components/billing/paymentModal.svelte b/src/lib/components/billing/paymentModal.svelte index 06f14cde1..72accfd10 100644 --- a/src/lib/components/billing/paymentModal.svelte +++ b/src/lib/components/billing/paymentModal.svelte @@ -41,7 +41,7 @@ } const card = await submitStripeCard(name, page?.params?.organization ?? null); - if (card && typeof card !== 'string') { + if (card && Object.hasOwn(card, 'id')) { if ((card as PaymentMethod).card.country === 'US') { paymentMethod = card as PaymentMethod; showState = true; diff --git a/src/lib/components/billing/state.ts b/src/lib/components/billing/state.ts index faa3f0786..d3f08a113 100644 --- a/src/lib/components/billing/state.ts +++ b/src/lib/components/billing/state.ts @@ -1,238 +1,238 @@ export const states: Array<{ name: string; abbreviation: string }> = [ { - "name": "Alabama", - "abbreviation": "AL" + name: 'Alabama', + abbreviation: 'AL' }, { - "name": "Alaska", - "abbreviation": "AK" + name: 'Alaska', + abbreviation: 'AK' }, { - "name": "American Samoa", - "abbreviation": "AS" + name: 'American Samoa', + abbreviation: 'AS' }, { - "name": "Arizona", - "abbreviation": "AZ" + name: 'Arizona', + abbreviation: 'AZ' }, { - "name": "Arkansas", - "abbreviation": "AR" + name: 'Arkansas', + abbreviation: 'AR' }, { - "name": "California", - "abbreviation": "CA" + name: 'California', + abbreviation: 'CA' }, { - "name": "Colorado", - "abbreviation": "CO" + name: 'Colorado', + abbreviation: 'CO' }, { - "name": "Connecticut", - "abbreviation": "CT" + name: 'Connecticut', + abbreviation: 'CT' }, { - "name": "Delaware", - "abbreviation": "DE" + name: 'Delaware', + abbreviation: 'DE' }, { - "name": "District Of Columbia", - "abbreviation": "DC" + name: 'District Of Columbia', + abbreviation: 'DC' }, { - "name": "Federated States Of Micronesia", - "abbreviation": "FM" + name: 'Federated States Of Micronesia', + abbreviation: 'FM' }, { - "name": "Florida", - "abbreviation": "FL" + name: 'Florida', + abbreviation: 'FL' }, { - "name": "Georgia", - "abbreviation": "GA" + name: 'Georgia', + abbreviation: 'GA' }, { - "name": "Guam", - "abbreviation": "GU" + name: 'Guam', + abbreviation: 'GU' }, { - "name": "Hawaii", - "abbreviation": "HI" + name: 'Hawaii', + abbreviation: 'HI' }, { - "name": "Idaho", - "abbreviation": "ID" + name: 'Idaho', + abbreviation: 'ID' }, { - "name": "Illinois", - "abbreviation": "IL" + name: 'Illinois', + abbreviation: 'IL' }, { - "name": "Indiana", - "abbreviation": "IN" + name: 'Indiana', + abbreviation: 'IN' }, { - "name": "Iowa", - "abbreviation": "IA" + name: 'Iowa', + abbreviation: 'IA' }, { - "name": "Kansas", - "abbreviation": "KS" + name: 'Kansas', + abbreviation: 'KS' }, { - "name": "Kentucky", - "abbreviation": "KY" + name: 'Kentucky', + abbreviation: 'KY' }, { - "name": "Louisiana", - "abbreviation": "LA" + name: 'Louisiana', + abbreviation: 'LA' }, { - "name": "Maine", - "abbreviation": "ME" + name: 'Maine', + abbreviation: 'ME' }, { - "name": "Marshall Islands", - "abbreviation": "MH" + name: 'Marshall Islands', + abbreviation: 'MH' }, { - "name": "Maryland", - "abbreviation": "MD" + name: 'Maryland', + abbreviation: 'MD' }, { - "name": "Massachusetts", - "abbreviation": "MA" + name: 'Massachusetts', + abbreviation: 'MA' }, { - "name": "Michigan", - "abbreviation": "MI" + name: 'Michigan', + abbreviation: 'MI' }, { - "name": "Minnesota", - "abbreviation": "MN" + name: 'Minnesota', + abbreviation: 'MN' }, { - "name": "Mississippi", - "abbreviation": "MS" + name: 'Mississippi', + abbreviation: 'MS' }, { - "name": "Missouri", - "abbreviation": "MO" + name: 'Missouri', + abbreviation: 'MO' }, { - "name": "Montana", - "abbreviation": "MT" + name: 'Montana', + abbreviation: 'MT' }, { - "name": "Nebraska", - "abbreviation": "NE" + name: 'Nebraska', + abbreviation: 'NE' }, { - "name": "Nevada", - "abbreviation": "NV" + name: 'Nevada', + abbreviation: 'NV' }, { - "name": "New Hampshire", - "abbreviation": "NH" + name: 'New Hampshire', + abbreviation: 'NH' }, { - "name": "New Jersey", - "abbreviation": "NJ" + name: 'New Jersey', + abbreviation: 'NJ' }, { - "name": "New Mexico", - "abbreviation": "NM" + name: 'New Mexico', + abbreviation: 'NM' }, { - "name": "New York", - "abbreviation": "NY" + name: 'New York', + abbreviation: 'NY' }, { - "name": "North Carolina", - "abbreviation": "NC" + name: 'North Carolina', + abbreviation: 'NC' }, { - "name": "North Dakota", - "abbreviation": "ND" + name: 'North Dakota', + abbreviation: 'ND' }, { - "name": "Northern Mariana Islands", - "abbreviation": "MP" + name: 'Northern Mariana Islands', + abbreviation: 'MP' }, { - "name": "Ohio", - "abbreviation": "OH" + name: 'Ohio', + abbreviation: 'OH' }, { - "name": "Oklahoma", - "abbreviation": "OK" + name: 'Oklahoma', + abbreviation: 'OK' }, { - "name": "Oregon", - "abbreviation": "OR" + name: 'Oregon', + abbreviation: 'OR' }, { - "name": "Palau", - "abbreviation": "PW" + name: 'Palau', + abbreviation: 'PW' }, { - "name": "Pennsylvania", - "abbreviation": "PA" + name: 'Pennsylvania', + abbreviation: 'PA' }, { - "name": "Puerto Rico", - "abbreviation": "PR" + name: 'Puerto Rico', + abbreviation: 'PR' }, { - "name": "Rhode Island", - "abbreviation": "RI" + name: 'Rhode Island', + abbreviation: 'RI' }, { - "name": "South Carolina", - "abbreviation": "SC" + name: 'South Carolina', + abbreviation: 'SC' }, { - "name": "South Dakota", - "abbreviation": "SD" + name: 'South Dakota', + abbreviation: 'SD' }, { - "name": "Tennessee", - "abbreviation": "TN" + name: 'Tennessee', + abbreviation: 'TN' }, { - "name": "Texas", - "abbreviation": "TX" + name: 'Texas', + abbreviation: 'TX' }, { - "name": "Utah", - "abbreviation": "UT" + name: 'Utah', + abbreviation: 'UT' }, { - "name": "Vermont", - "abbreviation": "VT" + name: 'Vermont', + abbreviation: 'VT' }, { - "name": "Virgin Islands", - "abbreviation": "VI" + name: 'Virgin Islands', + abbreviation: 'VI' }, { - "name": "Virginia", - "abbreviation": "VA" + name: 'Virginia', + abbreviation: 'VA' }, { - "name": "Washington", - "abbreviation": "WA" + name: 'Washington', + abbreviation: 'WA' }, { - "name": "West Virginia", - "abbreviation": "WV" + name: 'West Virginia', + abbreviation: 'WV' }, { - "name": "Wisconsin", - "abbreviation": "WI" + name: 'Wisconsin', + abbreviation: 'WI' }, { - "name": "Wyoming", - "abbreviation": "WY" + name: 'Wyoming', + abbreviation: 'WY' } -]; \ No newline at end of file +]; diff --git a/src/lib/sdk/billing.ts b/src/lib/sdk/billing.ts index b1d3b5809..3dbd0b9f9 100644 --- a/src/lib/sdk/billing.ts +++ b/src/lib/sdk/billing.ts @@ -1111,7 +1111,8 @@ export class Billing { async setPaymentMethod( paymentMethodId: string, providerMethodId: string | PaymentMethod, - name: string + name: string, + state: string | undefined = undefined ): Promise { const path = `/account/payment-methods/${paymentMethodId}/provider`; const params = { @@ -1119,6 +1120,10 @@ export class Billing { providerMethodId, name }; + + if (state !== undefined) { + params['state'] = state; + } const uri = new URL(this.client.config.endpoint + path); return await this.client.call( 'patch', diff --git a/src/lib/stores/stripe.ts b/src/lib/stores/stripe.ts index 3fab2e59a..7e5fc31d6 100644 --- a/src/lib/stores/stripe.ts +++ b/src/lib/stores/stripe.ts @@ -1,4 +1,10 @@ -import type { Appearance, PaymentMethod, Stripe, StripeElement, StripeElements } from '@stripe/stripe-js'; +import type { + Appearance, + PaymentMethod, + Stripe, + StripeElement, + StripeElements +} from '@stripe/stripe-js'; import { sdk } from './sdk'; import { app } from './app'; import { get, writable } from 'svelte/store'; @@ -95,7 +101,6 @@ export async function submitStripeCard(name: string, organizationId?: string) { throw e; } - if (setupIntent && setupIntent.status === 'succeeded') { if ((setupIntent.payment_method as PaymentMethod).card.country === 'US') { // need to get state @@ -122,7 +127,7 @@ export async function submitStripeCard(name: string, organizationId?: string) { } export async function setPaymentMethod(providerMethodId: string, name: string, state: string) { - if(!paymentMethod) { + if (!paymentMethod) { addNotification({ title: 'Error', message: 'No payment method found. Please try again.', @@ -134,7 +139,8 @@ export async function setPaymentMethod(providerMethodId: string, name: string, s const method = await sdk.forConsole.billing.setPaymentMethod( paymentMethod.$id, providerMethodId, - name + name, + state ); paymentElement.destroy(); isStripeInitialized.set(false); @@ -187,8 +193,9 @@ export async function confirmSetup( const { setupIntent, error } = await get(stripe).confirmCardSetup(clientSecret, { payment_method: paymentMethodId, - return_url: `${baseUrl}${urlRoute ?? `organization-${get(organization).$id}/billing?clientSecret=${clientSecret}` - }` + return_url: `${baseUrl}${ + urlRoute ?? `organization-${get(organization).$id}/billing?clientSecret=${clientSecret}` + }` }); if (error) { From 3d89151faf76bd542d2e6e0412cabc48d11ea4f9 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 5 Aug 2025 02:05:29 +0000 Subject: [PATCH 23/27] update test to select state --- e2e/steps/pro-project.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/e2e/steps/pro-project.ts b/e2e/steps/pro-project.ts index 0762132c4..41b411d30 100644 --- a/e2e/steps/pro-project.ts +++ b/e2e/steps/pro-project.ts @@ -20,6 +20,8 @@ export async function enterCreditCard(page: Page) { await stripe.locator('id=Field-cvcInput').fill('123'); await stripe.locator('id=Field-countryInput').selectOption('DE'); await dialog.getByRole('button', { name: 'Add', exact: true }).click(); + await page.locator('id=state-picker').selectOption('AS'); + await page.getByRole('button', { name: 'Add', exact: true }).click(); await dialog.waitFor({ state: 'hidden' }); From 1c929d8723e34dd80f889d9b215ef028ae402928 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 5 Aug 2025 02:31:47 +0000 Subject: [PATCH 24/27] fix dropdown click --- e2e/steps/pro-project.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/e2e/steps/pro-project.ts b/e2e/steps/pro-project.ts index 41b411d30..fcdd6b5cd 100644 --- a/e2e/steps/pro-project.ts +++ b/e2e/steps/pro-project.ts @@ -20,7 +20,8 @@ export async function enterCreditCard(page: Page) { await stripe.locator('id=Field-cvcInput').fill('123'); await stripe.locator('id=Field-countryInput').selectOption('DE'); await dialog.getByRole('button', { name: 'Add', exact: true }).click(); - await page.locator('id=state-picker').selectOption('AS'); + await page.locator('id=state-picker').click(); // open dropdown + await page.getByRole('option', { name: 'Alabama' }).click(); await page.getByRole('button', { name: 'Add', exact: true }).click(); await dialog.waitFor({ state: 'hidden' From bc3b9b56f4150473e17d22c79173e9f5863bb23f Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 5 Aug 2025 02:43:39 +0000 Subject: [PATCH 25/27] fix --- e2e/steps/pro-project.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/steps/pro-project.ts b/e2e/steps/pro-project.ts index fcdd6b5cd..5a9458333 100644 --- a/e2e/steps/pro-project.ts +++ b/e2e/steps/pro-project.ts @@ -22,7 +22,7 @@ export async function enterCreditCard(page: Page) { await dialog.getByRole('button', { name: 'Add', exact: true }).click(); await page.locator('id=state-picker').click(); // open dropdown await page.getByRole('option', { name: 'Alabama' }).click(); - await page.getByRole('button', { name: 'Add', exact: true }).click(); + await page.getByRole('button', { name: 'Add', exact: true }).nth(0).click(); await dialog.waitFor({ state: 'hidden' }); From 56b6346760544b15530cb03a90945ed46bb30bbc Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 5 Aug 2025 03:24:34 +0000 Subject: [PATCH 26/27] correct button --- e2e/steps/pro-project.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/steps/pro-project.ts b/e2e/steps/pro-project.ts index 5a9458333..9021ddbc9 100644 --- a/e2e/steps/pro-project.ts +++ b/e2e/steps/pro-project.ts @@ -22,7 +22,7 @@ export async function enterCreditCard(page: Page) { await dialog.getByRole('button', { name: 'Add', exact: true }).click(); await page.locator('id=state-picker').click(); // open dropdown await page.getByRole('option', { name: 'Alabama' }).click(); - await page.getByRole('button', { name: 'Add', exact: true }).nth(0).click(); + await page.getByRole('button', { name: 'Add', exact: true }).nth(1).click(); await dialog.waitFor({ state: 'hidden' }); From 576365f434cec6fda52bf3e72d13c816d9e7d466 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 5 Aug 2025 03:25:21 +0000 Subject: [PATCH 27/27] get correct button --- e2e/steps/pro-project.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/steps/pro-project.ts b/e2e/steps/pro-project.ts index 9021ddbc9..438caebef 100644 --- a/e2e/steps/pro-project.ts +++ b/e2e/steps/pro-project.ts @@ -22,7 +22,7 @@ export async function enterCreditCard(page: Page) { await dialog.getByRole('button', { name: 'Add', exact: true }).click(); await page.locator('id=state-picker').click(); // open dropdown await page.getByRole('option', { name: 'Alabama' }).click(); - await page.getByRole('button', { name: 'Add', exact: true }).nth(1).click(); + await dialog.getByRole('button', { name: 'Add', exact: true }).click(); await dialog.waitFor({ state: 'hidden' });