Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(application-system): Remove phone input feature flag #16372

Merged
merged 3 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libs/application/core/src/lib/fieldBuilders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ export const buildPhoneField = (
readOnly,
rightAlign,
allowedCountryCodes,
disableDropdown,
enableCountrySelector,
} = data
return {
...extractCommonFields(data),
Expand All @@ -326,7 +326,7 @@ export const buildPhoneField = (
required,
readOnly,
allowedCountryCodes,
disableDropdown,
enableCountrySelector,
rightAlign,
type: FieldTypes.PHONE,
component: FieldComponents.PHONE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const announcerInfo = buildSection({
title: m.phone,
width: 'half',
required: true,
disableDropdown: false,
enableCountrySelector: true,
defaultValue: (application: Application) => {
const phone =
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export const representative = buildSection({
title: m.phone,
width: 'half',
required: true,
disableDropdown: true,
allowedCountryCodes: ['IS'],
}),
buildTextField({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const applicant = buildSection({
title: m.phone,
width: 'half',
required: true,
disableDropdown: false,
enableCountrySelector: true,
Toti91 marked this conversation as resolved.
Show resolved Hide resolved
defaultValue: (application: Application) => {
const phone =
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const prePaidApplicant = buildSection({
title: m.phone,
width: 'half',
required: true,
disableDropdown: false,
enableCountrySelector: true,
}),
buildTextField({
id: 'prePaidApplicant.email',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const inheritanceExecutor = buildSection({
title: m.phone,
width: 'half',
required: true,
disableDropdown: false,
enableCountrySelector: true,
}),
buildDescriptionField({
id: 'description_empty',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ export const Draft: Form = buildForm({
title: m.phone,
width: 'half',
required: true,
disableDropdown: true,
allowedCountryCodes: ['IS'],
defaultValue: (application: Application) => {
const phone =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export const Draft: Form = buildForm({
title: m.phone,
width: 'half',
required: true,
disableDropdown: true,
allowedCountryCodes: ['IS'],
defaultValue: (application: Application) => {
const phone =
Expand Down
2 changes: 1 addition & 1 deletion libs/application/types/src/lib/Fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ export interface PhoneField extends BaseField {
placeholder?: FormText
backgroundColor?: InputBackgroundColor
allowedCountryCodes?: string[]
disableDropdown?: boolean
enableCountrySelector?: boolean
Toti91 marked this conversation as resolved.
Show resolved Hide resolved
required?: boolean
onChange?: (...event: any[]) => void
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
} from '@island.is/shared/form-fields'
import { useLocale } from '@island.is/localization'
import { getDefaultValue } from '../../getDefaultValue'
import { useFeatureFlag } from '@island.is/react/feature-flags'

interface Props extends FieldBaseProps {
field: PhoneField
Expand All @@ -33,15 +32,11 @@ export const PhoneFormField: FC<React.PropsWithChildren<Props>> = ({
readOnly,
dataTestId,
allowedCountryCodes,
disableDropdown,
enableCountrySelector = false,
onChange = () => undefined,
} = field
const { control, clearErrors } = useFormContext()
const { formatMessage } = useLocale()
const { value: isPhoneInputV2Enabled } = useFeatureFlag(
'isPhoneInputV2Enabled',
false,
)

return (
<div>
Expand Down Expand Up @@ -71,7 +66,7 @@ export const PhoneFormField: FC<React.PropsWithChildren<Props>> = ({
autoFocus={autoFocus}
error={error}
control={control}
disableDropdown={disableDropdown || !isPhoneInputV2Enabled}
disableDropdown={!enableCountrySelector}
onChange={(e) => {
if (error) {
clearErrors(id)
Expand Down
Loading