From 9392270bfad5560d13864b5ea5416be3b459bb4a Mon Sep 17 00:00:00 2001 From: isabellaenriquez Date: Thu, 9 Oct 2025 08:21:58 -0400 Subject: [PATCH 1/3] fix(stripe components): Dynamic required region field --- static/gsApp/components/billingDetails/form.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/static/gsApp/components/billingDetails/form.tsx b/static/gsApp/components/billingDetails/form.tsx index 09d5ebcd3acb79..6ee372ca73b48f 100644 --- a/static/gsApp/components/billingDetails/form.tsx +++ b/static/gsApp/components/billingDetails/form.tsx @@ -194,13 +194,7 @@ function BillingDetailsForm({ }; useEffect(() => { - const requiredFields = [ - 'addressLine1', - 'city', - 'region', - 'countryCode', - 'postalCode', - ]; + const requiredFields = ['addressLine1', 'city', 'countryCode', 'postalCode']; requiredFields.forEach(field => { form.setFieldDescriptor(field, { required: true, @@ -214,6 +208,14 @@ function BillingDetailsForm({ }; }, [form]); + useEffect(() => { + if (countryHasRegionChoices(state.countryCode)) { + form.setFieldDescriptor('region', {required: true}); + } else { + form.setFieldDescriptor('region', {required: false}); + } + }, [state.countryCode, form]); + if (!organization.access.includes('org:billing')) { return null; } From 406fd97314949f96f151115a0c76e19bffd6d47a Mon Sep 17 00:00:00 2001 From: isabellaenriquez Date: Thu, 9 Oct 2025 08:32:49 -0400 Subject: [PATCH 2/3] fix this too --- static/gsApp/components/billingDetails/form.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/gsApp/components/billingDetails/form.tsx b/static/gsApp/components/billingDetails/form.tsx index 6ee372ca73b48f..fe4644ff0d4666 100644 --- a/static/gsApp/components/billingDetails/form.tsx +++ b/static/gsApp/components/billingDetails/form.tsx @@ -194,7 +194,7 @@ function BillingDetailsForm({ }; useEffect(() => { - const requiredFields = ['addressLine1', 'city', 'countryCode', 'postalCode']; + const requiredFields = ['addressLine1', 'city', 'countryCode']; requiredFields.forEach(field => { form.setFieldDescriptor(field, { required: true, From 6f7f5395b4ccc8e2b319212befc7a5d1b47e6b84 Mon Sep 17 00:00:00 2001 From: isabellaenriquez Date: Thu, 9 Oct 2025 08:33:41 -0400 Subject: [PATCH 3/3] add cleanup --- static/gsApp/components/billingDetails/form.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/gsApp/components/billingDetails/form.tsx b/static/gsApp/components/billingDetails/form.tsx index fe4644ff0d4666..6bb2f32f95d489 100644 --- a/static/gsApp/components/billingDetails/form.tsx +++ b/static/gsApp/components/billingDetails/form.tsx @@ -214,6 +214,10 @@ function BillingDetailsForm({ } else { form.setFieldDescriptor('region', {required: false}); } + + return () => { + form.removeField('region'); + }; }, [state.countryCode, form]); if (!organization.access.includes('org:billing')) {