1- import React from "react"
1+ import React , { useContext } from "react"
22import { useFormContext } from "react-hook-form"
3- import { Jurisdiction } from "@bloom-housing/shared-helpers/src/types/backend-swagger"
3+ import {
4+ FeatureFlagEnum ,
5+ Jurisdiction ,
6+ } from "@bloom-housing/shared-helpers/src/types/backend-swagger"
47import { t , Field , SelectOption , Select } from "@bloom-housing/ui-components"
58import { Grid } from "@bloom-housing/ui-seeds"
69import {
@@ -11,6 +14,7 @@ import {
1114} from "../../../../lib/helpers"
1215import SectionWithGrid from "../../../shared/SectionWithGrid"
1316import styles from "../ListingForm.module.scss"
17+ import { AuthContext } from "@bloom-housing/shared-helpers"
1418
1519interface ListingIntroProps {
1620 jurisdictions : Jurisdiction [ ]
@@ -19,9 +23,16 @@ interface ListingIntroProps {
1923
2024const ListingIntro = ( props : ListingIntroProps ) => {
2125 const formMethods = useFormContext ( )
26+ const { doJurisdictionsHaveFeatureFlagOn } = useContext ( AuthContext )
2227
2328 // eslint-disable-next-line @typescript-eslint/unbound-method
24- const { register, clearErrors, errors } = formMethods
29+ const { register, clearErrors, errors, watch } = formMethods
30+ const jurisdiction = watch ( "jurisdictions.id" )
31+
32+ const enableHousingDeveloperOwner = doJurisdictionsHaveFeatureFlagOn (
33+ FeatureFlagEnum . enableHousingDeveloperOwner ,
34+ jurisdiction
35+ )
2536
2637 const jurisdictionOptions : SelectOption [ ] = [
2738 { label : "" , value : "" } ,
@@ -101,7 +112,9 @@ const ListingIntro = (props: ListingIntroProps) => {
101112 register = { register }
102113 { ...defaultFieldProps (
103114 "developer" ,
104- t ( "listings.developer" ) ,
115+ enableHousingDeveloperOwner
116+ ? t ( "listings.housingDeveloperOwner" )
117+ : t ( "listings.developer" ) ,
105118 props . requiredFields ,
106119 errors ,
107120 clearErrors
0 commit comments