chore: update codegen config for enum naming convention (#9751)

Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
This commit is contained in:
Etienne
2025-01-21 11:34:33 +01:00
committed by GitHub
parent d4b038f24a
commit e1731bb31e
222 changed files with 1245 additions and 1235 deletions

View File

@ -33,64 +33,64 @@ import {
import { FieldMetadataType } from '~/generated-metadata/graphql';
const booleanFieldFormSchema = z
.object({ type: z.literal(FieldMetadataType.Boolean) })
.object({ type: z.literal(FieldMetadataType.BOOLEAN) })
.merge(settingsDataModelFieldBooleanFormSchema);
const currencyFieldFormSchema = z
.object({ type: z.literal(FieldMetadataType.Currency) })
.object({ type: z.literal(FieldMetadataType.CURRENCY) })
.merge(settingsDataModelFieldCurrencyFormSchema);
const dateFieldFormSchema = z
.object({ type: z.literal(FieldMetadataType.Date) })
.object({ type: z.literal(FieldMetadataType.DATE) })
.merge(settingsDataModelFieldDateFormSchema);
const dateTimeFieldFormSchema = z
.object({ type: z.literal(FieldMetadataType.DateTime) })
.object({ type: z.literal(FieldMetadataType.DATE_TIME) })
.merge(settingsDataModelFieldDateFormSchema);
const relationFieldFormSchema = z
.object({ type: z.literal(FieldMetadataType.Relation) })
.object({ type: z.literal(FieldMetadataType.RELATION) })
.merge(settingsDataModelFieldRelationFormSchema);
const selectFieldFormSchema = z
.object({ type: z.literal(FieldMetadataType.Select) })
.object({ type: z.literal(FieldMetadataType.SELECT) })
.merge(settingsDataModelFieldSelectFormSchema);
const multiSelectFieldFormSchema = z
.object({ type: z.literal(FieldMetadataType.MultiSelect) })
.object({ type: z.literal(FieldMetadataType.MULTI_SELECT) })
.merge(settingsDataModelFieldMultiSelectFormSchema);
const numberFieldFormSchema = z
.object({ type: z.literal(FieldMetadataType.Number) })
.object({ type: z.literal(FieldMetadataType.NUMBER) })
.merge(settingsDataModelFieldNumberFormSchema);
const textFieldFormSchema = z
.object({ type: z.literal(FieldMetadataType.Text) })
.object({ type: z.literal(FieldMetadataType.TEXT) })
.merge(settingsDataModelFieldtextFormSchema);
const addressFieldFormSchema = z
.object({ type: z.literal(FieldMetadataType.Address) })
.object({ type: z.literal(FieldMetadataType.ADDRESS) })
.merge(settingsDataModelFieldAddressFormSchema);
const phonesFieldFormSchema = z
.object({ type: z.literal(FieldMetadataType.Phones) })
.object({ type: z.literal(FieldMetadataType.PHONES) })
.merge(settingsDataModelFieldPhonesFormSchema);
const otherFieldsFormSchema = z.object({
type: z.enum(
Object.keys(
omit(SETTINGS_FIELD_TYPE_CONFIGS, [
FieldMetadataType.Boolean,
FieldMetadataType.Currency,
FieldMetadataType.Relation,
FieldMetadataType.Select,
FieldMetadataType.MultiSelect,
FieldMetadataType.Date,
FieldMetadataType.DateTime,
FieldMetadataType.Number,
FieldMetadataType.Address,
FieldMetadataType.Phones,
FieldMetadataType.Text,
FieldMetadataType.BOOLEAN,
FieldMetadataType.CURRENCY,
FieldMetadataType.RELATION,
FieldMetadataType.SELECT,
FieldMetadataType.MULTI_SELECT,
FieldMetadataType.DATE,
FieldMetadataType.DATE_TIME,
FieldMetadataType.NUMBER,
FieldMetadataType.ADDRESS,
FieldMetadataType.PHONES,
FieldMetadataType.TEXT,
]),
) as [FieldMetadataType, ...FieldMetadataType[]],
),
@ -127,23 +127,23 @@ const StyledFieldPreviewCard = styled(SettingsDataModelFieldPreviewCard)`
`;
const previewableTypes = [
FieldMetadataType.Array,
FieldMetadataType.Address,
FieldMetadataType.Boolean,
FieldMetadataType.Currency,
FieldMetadataType.Date,
FieldMetadataType.DateTime,
FieldMetadataType.Emails,
FieldMetadataType.FullName,
FieldMetadataType.Links,
FieldMetadataType.MultiSelect,
FieldMetadataType.Number,
FieldMetadataType.Phones,
FieldMetadataType.Rating,
FieldMetadataType.RawJson,
FieldMetadataType.Relation,
FieldMetadataType.Select,
FieldMetadataType.Text,
FieldMetadataType.ARRAY,
FieldMetadataType.ADDRESS,
FieldMetadataType.BOOLEAN,
FieldMetadataType.CURRENCY,
FieldMetadataType.DATE,
FieldMetadataType.DATE_TIME,
FieldMetadataType.EMAILS,
FieldMetadataType.FULL_NAME,
FieldMetadataType.LINKS,
FieldMetadataType.MULTI_SELECT,
FieldMetadataType.NUMBER,
FieldMetadataType.PHONES,
FieldMetadataType.RATING,
FieldMetadataType.RAW_JSON,
FieldMetadataType.RELATION,
FieldMetadataType.SELECT,
FieldMetadataType.TEXT,
];
export const SettingsDataModelFieldSettingsFormCard = ({
@ -154,7 +154,7 @@ export const SettingsDataModelFieldSettingsFormCard = ({
return null;
}
if (fieldMetadataItem.type === FieldMetadataType.Boolean) {
if (fieldMetadataItem.type === FieldMetadataType.BOOLEAN) {
return (
<SettingsDataModelFieldBooleanSettingsFormCard
fieldMetadataItem={fieldMetadataItem}
@ -163,7 +163,7 @@ export const SettingsDataModelFieldSettingsFormCard = ({
);
}
if (fieldMetadataItem.type === FieldMetadataType.Currency) {
if (fieldMetadataItem.type === FieldMetadataType.CURRENCY) {
return (
<SettingsDataModelFieldCurrencySettingsFormCard
fieldMetadataItem={fieldMetadataItem}
@ -173,8 +173,8 @@ export const SettingsDataModelFieldSettingsFormCard = ({
}
if (
fieldMetadataItem.type === FieldMetadataType.Date ||
fieldMetadataItem.type === FieldMetadataType.DateTime
fieldMetadataItem.type === FieldMetadataType.DATE ||
fieldMetadataItem.type === FieldMetadataType.DATE_TIME
) {
return (
<SettingsDataModelFieldDateSettingsFormCard
@ -184,7 +184,7 @@ export const SettingsDataModelFieldSettingsFormCard = ({
);
}
if (fieldMetadataItem.type === FieldMetadataType.Relation) {
if (fieldMetadataItem.type === FieldMetadataType.RELATION) {
return (
<SettingsDataModelFieldRelationSettingsFormCard
fieldMetadataItem={fieldMetadataItem}
@ -193,7 +193,7 @@ export const SettingsDataModelFieldSettingsFormCard = ({
);
}
if (fieldMetadataItem.type === FieldMetadataType.Number) {
if (fieldMetadataItem.type === FieldMetadataType.NUMBER) {
return (
<SettingsDataModelFieldNumberSettingsFormCard
fieldMetadataItem={fieldMetadataItem}
@ -202,7 +202,7 @@ export const SettingsDataModelFieldSettingsFormCard = ({
);
}
if (fieldMetadataItem.type === FieldMetadataType.Text) {
if (fieldMetadataItem.type === FieldMetadataType.TEXT) {
return (
<SettingsDataModelFieldTextSettingsFormCard
fieldMetadataItem={fieldMetadataItem}
@ -211,7 +211,7 @@ export const SettingsDataModelFieldSettingsFormCard = ({
);
}
if (fieldMetadataItem.type === FieldMetadataType.Address) {
if (fieldMetadataItem.type === FieldMetadataType.ADDRESS) {
return (
<SettingsDataModelFieldAddressSettingsFormCard
fieldMetadataItem={fieldMetadataItem}
@ -220,7 +220,7 @@ export const SettingsDataModelFieldSettingsFormCard = ({
);
}
if (fieldMetadataItem.type === FieldMetadataType.Phones) {
if (fieldMetadataItem.type === FieldMetadataType.PHONES) {
return (
<SettingsDataModelFieldPhonesSettingsFormCard
fieldMetadataItem={fieldMetadataItem}
@ -230,8 +230,8 @@ export const SettingsDataModelFieldSettingsFormCard = ({
}
if (
fieldMetadataItem.type === FieldMetadataType.Select ||
fieldMetadataItem.type === FieldMetadataType.MultiSelect
fieldMetadataItem.type === FieldMetadataType.SELECT ||
fieldMetadataItem.type === FieldMetadataType.MULTI_SELECT
) {
return (
<SettingsDataModelFieldSelectSettingsFormCard

View File

@ -85,14 +85,14 @@ export const SettingsObjectNewFieldSelector = ({
const resetDefaultValueField = (nextValue: SettingsFieldType) => {
switch (nextValue) {
case FieldMetadataType.Boolean:
case FieldMetadataType.BOOLEAN:
resetBooleanDefaultValueField();
break;
case FieldMetadataType.Currency:
case FieldMetadataType.CURRENCY:
resetCurrencyDefaultValueField();
break;
case FieldMetadataType.Select:
case FieldMetadataType.MultiSelect:
case FieldMetadataType.SELECT:
case FieldMetadataType.MULTI_SELECT:
resetSelectDefaultValueField();
break;
default:

View File

@ -21,7 +21,7 @@ if (!mockedCompanyObjectMetadataItem) {
}
const fieldMetadataItem = mockedCompanyObjectMetadataItem.fields.find(
({ type }) => type === FieldMetadataType.Text,
({ type }) => type === FieldMetadataType.TEXT,
)!;
const meta: Meta<typeof SettingsDataModelFieldSettingsFormCard> = {
@ -64,7 +64,7 @@ export const WithSelectForm: Story = {
fieldMetadataItem: {
label: 'Industry',
icon: 'IconBuildingFactory2',
type: FieldMetadataType.Select,
type: FieldMetadataType.SELECT,
},
},
};

View File

@ -80,8 +80,8 @@ const StyledInputsContainer = styled.div`
const RELATION_TYPE_OPTIONS = Object.entries(RELATION_TYPES)
.filter(
([value]) =>
RelationDefinitionType.OneToOne !== value &&
RelationDefinitionType.ManyToMany !== value,
RelationDefinitionType.ONE_TO_ONE !== value &&
RelationDefinitionType.MANY_TO_MANY !== value,
)
.map(([value, { label, Icon }]) => ({
label,
@ -168,7 +168,7 @@ export const SettingsDataModelFieldRelationForm = ({
</StyledSelectsContainer>
<StyledInputsLabel>
Field on{' '}
{selectedRelationType === RelationDefinitionType.ManyToOne
{selectedRelationType === RelationDefinitionType.MANY_TO_ONE
? selectedObjectMetadataItem?.labelSingular
: selectedObjectMetadataItem?.labelPlural}
</StyledInputsLabel>

View File

@ -91,7 +91,7 @@ export const SettingsDataModelFieldRelationSettingsFormCard = ({
relationObjectMetadataItem={relationObjectMetadataItem}
pluralizeLabel={
watchFormValue('relation.type') ===
RelationDefinitionType.ManyToOne
RelationDefinitionType.MANY_TO_ONE
}
/>
<StyledRelationImage
@ -112,14 +112,14 @@ export const SettingsDataModelFieldRelationSettingsFormCard = ({
'relation.field.label',
initialRelationFieldMetadataItem.label,
) || 'Field name',
type: FieldMetadataType.Relation,
type: FieldMetadataType.RELATION,
}}
shrink
objectMetadataItem={relationObjectMetadataItem}
relationObjectMetadataItem={objectMetadataItem}
pluralizeLabel={
watchFormValue('relation.type') !==
RelationDefinitionType.ManyToOne
RelationDefinitionType.MANY_TO_ONE
}
/>
</StyledPreviewContent>

View File

@ -40,7 +40,7 @@ export const useRelationSettingsFormInitialValues = ({
);
const initialRelationType =
relationTypeFromFieldMetadata ?? RelationDefinitionType.OneToMany;
relationTypeFromFieldMetadata ?? RelationDefinitionType.ONE_TO_MANY;
return {
disableFieldEdition:
@ -49,8 +49,8 @@ export const useRelationSettingsFormInitialValues = ({
initialRelationFieldMetadataItem: relationFieldMetadataItem ?? {
icon: initialRelationObjectMetadataItem.icon ?? 'IconUsers',
label: [
RelationDefinitionType.ManyToMany,
RelationDefinitionType.ManyToOne,
RelationDefinitionType.MANY_TO_MANY,
RelationDefinitionType.MANY_TO_ONE,
].includes(initialRelationType)
? initialRelationObjectMetadataItem.labelPlural
: initialRelationObjectMetadataItem.labelSingular,

View File

@ -160,7 +160,7 @@ export const SettingsDataModelFieldSelectForm = ({
) => {
if (isOptionDefaultValue(optionValue)) return;
if (fieldMetadataItem.type === FieldMetadataType.Select) {
if (fieldMetadataItem.type === FieldMetadataType.SELECT) {
setFormValue('defaultValue', applySimpleQuotesToString(optionValue), {
shouldDirty: true,
});
@ -170,7 +170,7 @@ export const SettingsDataModelFieldSelectForm = ({
const previousDefaultValue = getValues('defaultValue');
if (
fieldMetadataItem.type === FieldMetadataType.MultiSelect &&
fieldMetadataItem.type === FieldMetadataType.MULTI_SELECT &&
(Array.isArray(previousDefaultValue) || previousDefaultValue === null)
) {
setFormValue(
@ -189,7 +189,7 @@ export const SettingsDataModelFieldSelectForm = ({
) => {
if (!isOptionDefaultValue(optionValue)) return;
if (fieldMetadataItem.type === FieldMetadataType.Select) {
if (fieldMetadataItem.type === FieldMetadataType.SELECT) {
setFormValue('defaultValue', null, { shouldDirty: true });
return;
}
@ -197,7 +197,7 @@ export const SettingsDataModelFieldSelectForm = ({
const previousDefaultValue = getValues('defaultValue');
if (
fieldMetadataItem.type === FieldMetadataType.MultiSelect &&
fieldMetadataItem.type === FieldMetadataType.MULTI_SELECT &&
(Array.isArray(previousDefaultValue) || previousDefaultValue === null)
) {
const nextDefaultValue = previousDefaultValue?.filter(

View File

@ -142,9 +142,9 @@ export const SettingsDataModelFieldPreview = ({
hotkeyScope: 'field-preview',
}}
>
{fieldMetadataItem.type === FieldMetadataType.Boolean ? (
{fieldMetadataItem.type === FieldMetadataType.BOOLEAN ? (
<BooleanFieldInput readonly />
) : fieldMetadataItem.type === FieldMetadataType.Rating ? (
) : fieldMetadataItem.type === FieldMetadataType.RATING ? (
<RatingFieldInput readonly />
) : (
<FieldDisplay />

View File

@ -49,7 +49,7 @@ export const LabelIdentifier: Story = {
args: {
fieldMetadataItem: mockedPersonObjectMetadataItem?.fields.find(
({ name, type }) =>
name === 'name' && type === FieldMetadataType.FullName,
name === 'name' && type === FieldMetadataType.FULL_NAME,
),
},
};
@ -57,7 +57,7 @@ export const LabelIdentifier: Story = {
export const Text: Story = {
args: {
fieldMetadataItem: mockedPersonObjectMetadataItem?.fields.find(
({ name, type }) => name === 'city' && type === FieldMetadataType.Text,
({ name, type }) => name === 'city' && type === FieldMetadataType.TEXT,
),
},
};
@ -66,7 +66,7 @@ export const Boolean: Story = {
args: {
fieldMetadataItem: mockedCompanyObjectMetadataItem?.fields.find(
({ name, type }) =>
name === 'idealCustomerProfile' && type === FieldMetadataType.Boolean,
name === 'idealCustomerProfile' && type === FieldMetadataType.BOOLEAN,
),
objectMetadataItem: mockedCompanyObjectMetadataItem,
},
@ -77,7 +77,7 @@ export const Currency: Story = {
fieldMetadataItem: mockedCompanyObjectMetadataItem?.fields.find(
({ name, type }) =>
name === 'annualRecurringRevenue' &&
type === FieldMetadataType.Currency,
type === FieldMetadataType.CURRENCY,
),
objectMetadataItem: mockedCompanyObjectMetadataItem,
},
@ -86,7 +86,7 @@ export const Currency: Story = {
export const Date: Story = {
args: {
fieldMetadataItem: mockedCompanyObjectMetadataItem?.fields.find(
({ type }) => type === FieldMetadataType.DateTime,
({ type }) => type === FieldMetadataType.DATE_TIME,
),
objectMetadataItem: mockedCompanyObjectMetadataItem,
},
@ -96,7 +96,7 @@ export const Links: Story = {
args: {
fieldMetadataItem: mockedCompanyObjectMetadataItem?.fields.find(
({ name, type }) =>
name === 'linkedinLink' && type === FieldMetadataType.Links,
name === 'linkedinLink' && type === FieldMetadataType.LINKS,
),
objectMetadataItem: mockedCompanyObjectMetadataItem,
},
@ -105,7 +105,7 @@ export const Links: Story = {
export const Number: Story = {
args: {
fieldMetadataItem: mockedCompanyObjectMetadataItem?.fields.find(
({ type }) => type === FieldMetadataType.Number,
({ type }) => type === FieldMetadataType.NUMBER,
),
objectMetadataItem: mockedCompanyObjectMetadataItem,
},
@ -116,7 +116,7 @@ export const Rating: Story = {
fieldMetadataItem: {
icon: 'IconHandClick',
label: 'Engagement',
type: FieldMetadataType.Rating,
type: FieldMetadataType.RATING,
},
},
};
@ -133,7 +133,7 @@ export const Relation: Story = {
export const Select: Story = {
args: {
fieldMetadataItem: mockedOpportunityObjectMetadataItem?.fields.find(
({ name, type }) => name === 'stage' && type === FieldMetadataType.Select,
({ name, type }) => name === 'stage' && type === FieldMetadataType.SELECT,
),
objectMetadataItem: mockedOpportunityObjectMetadataItem,
},
@ -146,7 +146,7 @@ export const MultiSelect: Story = {
...Select.args!.fieldMetadataItem!,
defaultValue: null,
label: 'Stages',
type: FieldMetadataType.MultiSelect,
type: FieldMetadataType.MULTI_SELECT,
},
},
};

View File

@ -30,7 +30,7 @@ describe('useFieldPreviewValue', () => {
const fieldName = 'amount';
const fieldMetadataItem = mockedOpportunityObjectMetadataItem?.fields.find(
({ name, type }) =>
name === fieldName && type === FieldMetadataType.Currency,
name === fieldName && type === FieldMetadataType.CURRENCY,
);
const skip = true;
@ -53,7 +53,7 @@ describe('useFieldPreviewValue', () => {
const fieldName = 'amount';
const fieldMetadataItem = mockedOpportunityObjectMetadataItem?.fields.find(
({ name, type }) =>
name === fieldName && type === FieldMetadataType.Currency,
name === fieldName && type === FieldMetadataType.CURRENCY,
);
if (!fieldMetadataItem) {
@ -77,7 +77,7 @@ describe('useFieldPreviewValue', () => {
// Given
const fieldMetadataItem = {
name: 'people',
type: FieldMetadataType.Relation,
type: FieldMetadataType.RELATION,
};
const relationObjectMetadataItem = mockedPersonObjectMetadataItem;
@ -107,7 +107,7 @@ describe('useFieldPreviewValue', () => {
const fieldName = 'stage';
const fieldMetadataItem = mockedOpportunityObjectMetadataItem?.fields.find(
({ name, type }) =>
name === fieldName && type === FieldMetadataType.Select,
name === fieldName && type === FieldMetadataType.SELECT,
);
if (!fieldMetadataItem) {
@ -151,7 +151,7 @@ describe('useFieldPreviewValue', () => {
];
const fieldMetadataItem = {
name: 'industry',
type: FieldMetadataType.MultiSelect,
type: FieldMetadataType.MULTI_SELECT,
options,
};

View File

@ -32,24 +32,24 @@ export const useFieldPreviewValue = ({
},
skip:
skip ||
fieldMetadataItem.type !== FieldMetadataType.Relation ||
fieldMetadataItem.type !== FieldMetadataType.RELATION ||
!relationObjectMetadataItem,
});
if (skip === true) return null;
switch (fieldMetadataItem.type) {
case FieldMetadataType.Currency:
case FieldMetadataType.CURRENCY:
return getCurrencyFieldPreviewValue({ fieldMetadataItem });
case FieldMetadataType.Relation:
case FieldMetadataType.RELATION:
return relationFieldPreviewValue;
case FieldMetadataType.Select:
case FieldMetadataType.SELECT:
return getSelectFieldPreviewValue({ fieldMetadataItem });
case FieldMetadataType.MultiSelect:
case FieldMetadataType.MULTI_SELECT:
return getMultiSelectFieldPreviewValue({ fieldMetadataItem });
case FieldMetadataType.Address:
case FieldMetadataType.ADDRESS:
return getAddressFieldPreviewValue({ fieldMetadataItem });
case FieldMetadataType.Phones:
case FieldMetadataType.PHONES:
return getPhonesFieldPreviewValue({ fieldMetadataItem });
default:
return getFieldPreviewValue({ fieldMetadataItem });

View File

@ -48,7 +48,7 @@ export const usePreviewRecord = ({
}
const fieldPreviewValue =
labelIdentifierFieldMetadataItem.type === FieldMetadataType.Text
labelIdentifierFieldMetadataItem.type === FieldMetadataType.TEXT
? objectMetadataItem.labelSingular
: getFieldPreviewValue({
fieldMetadataItem: labelIdentifierFieldMetadataItem,

View File

@ -17,7 +17,7 @@ describe('getCurrencyFieldPreviewValue', () => {
it('returns null if the field is not a Currency field', () => {
// Given
const fieldMetadataItem = mockedCompanyObjectMetadataItem?.fields.find(
({ type }) => type !== FieldMetadataType.Currency,
({ type }) => type !== FieldMetadataType.CURRENCY,
);
if (!fieldMetadataItem) {
@ -34,7 +34,7 @@ describe('getCurrencyFieldPreviewValue', () => {
const fieldName = 'amount';
const fieldMetadataItem = mockedOpportunityObjectMetadataItem?.fields.find(
({ name, type }) =>
name === fieldName && type === FieldMetadataType.Currency,
name === fieldName && type === FieldMetadataType.CURRENCY,
);
if (!fieldMetadataItem) {

View File

@ -47,7 +47,7 @@ describe('getFieldPreviewValue', () => {
// Then
expect(result).toBe(2000);
expect(result).toBe(
getSettingsFieldTypeConfig(FieldMetadataType.Number).exampleValue,
getSettingsFieldTypeConfig(FieldMetadataType.NUMBER).exampleValue,
);
});

View File

@ -15,7 +15,7 @@ describe('getMultiSelectFieldPreviewValue', () => {
it('returns null if the field is not a Multi-Select field', () => {
// Given
const fieldMetadataItem = mockedCompanyObjectMetadataItem?.fields.find(
({ type }) => type !== FieldMetadataType.MultiSelect,
({ type }) => type !== FieldMetadataType.MULTI_SELECT,
);
if (!fieldMetadataItem) {
@ -41,7 +41,7 @@ describe('getMultiSelectFieldPreviewValue', () => {
const fieldMetadataItem = {
...selectFieldMetadataItem,
type: FieldMetadataType.MultiSelect,
type: FieldMetadataType.MULTI_SELECT,
};
it("returns the defaultValue as an option value if a valid defaultValue is found in the field's metadata", () => {

View File

@ -16,7 +16,7 @@ describe('getSelectFieldPreviewValue', () => {
it('returns null if the field is not a Select field', () => {
// Given
const fieldMetadataItem = mockedCompanyObjectMetadataItem?.fields.find(
({ type }) => type !== FieldMetadataType.Select,
({ type }) => type !== FieldMetadataType.SELECT,
);
if (!fieldMetadataItem) {

View File

@ -12,10 +12,10 @@ export const getAddressFieldPreviewValue = ({
'defaultValue' | 'options' | 'type'
>;
}): FieldAddressValue | null => {
if (fieldMetadataItem.type !== FieldMetadataType.Address) return null;
if (fieldMetadataItem.type !== FieldMetadataType.ADDRESS) return null;
const addressFieldTypeConfig = getSettingsFieldTypeConfig(
FieldMetadataType.Address,
FieldMetadataType.ADDRESS,
);
const placeholderDefaultValue = addressFieldTypeConfig.exampleValue;

View File

@ -14,10 +14,10 @@ export const getCurrencyFieldPreviewValue = ({
'defaultValue' | 'options' | 'type'
>;
}): FieldCurrencyValue | null => {
if (fieldMetadataItem.type !== FieldMetadataType.Currency) return null;
if (fieldMetadataItem.type !== FieldMetadataType.CURRENCY) return null;
const currencyFieldTypeConfig = getSettingsFieldTypeConfig(
FieldMetadataType.Currency,
FieldMetadataType.CURRENCY,
);
const placeholderDefaultValue = currencyFieldTypeConfig.exampleValue;

View File

@ -17,7 +17,7 @@ export const getMultiSelectFieldPreviewValue = ({
>;
}): FieldMultiSelectValue => {
if (
fieldMetadataItem.type !== FieldMetadataType.MultiSelect ||
fieldMetadataItem.type !== FieldMetadataType.MULTI_SELECT ||
!fieldMetadataItem.options?.length
) {
return null;

View File

@ -32,10 +32,10 @@ export const getPhonesFieldPreviewValue = ({
'defaultValue' | 'options' | 'type'
>;
}): FieldPhonesValue | null => {
if (fieldMetadataItem.type !== FieldMetadataType.Phones) return null;
if (fieldMetadataItem.type !== FieldMetadataType.PHONES) return null;
const phonesFieldTypeConfig = getSettingsFieldTypeConfig(
FieldMetadataType.Phones,
FieldMetadataType.PHONES,
);
const placeholderDefaultValue = phonesFieldTypeConfig.exampleValue;

View File

@ -16,7 +16,7 @@ export const getSelectFieldPreviewValue = ({
>;
}): FieldSelectValue => {
if (
fieldMetadataItem.type !== FieldMetadataType.Select ||
fieldMetadataItem.type !== FieldMetadataType.SELECT ||
!fieldMetadataItem.options?.length
) {
return null;