fix type isssues

This commit is contained in:
Francisco Solla 2026-03-15 17:40:40 -03:00
parent a2ad8f7e20
commit 046f8a539f
4 changed files with 23 additions and 3 deletions

View file

@ -25,6 +25,7 @@ export const submitWhatsapp = async (input: WhatsAppFormInput) => {
collection: 'subscription', collection: 'subscription',
data: { data: {
contact: contact.id, contact: contact.id,
consent: 2,
comment, comment,
}, },
req: { transactionID }, req: { transactionID },

View file

@ -13,7 +13,7 @@ export const Consent: CollectionConfig = {
fields: [ fields: [
{ {
name: 'text', name: 'text',
type: 'text', type: 'richText',
label: 'Texto', label: 'Texto',
required: true, required: true,
}, },

View file

@ -22,6 +22,7 @@ import { PhoneInput } from './PhoneInput'
import { StateSelect } from './StateSelect' import { StateSelect } from './StateSelect'
import { CitySelect } from './CitySelect' import { CitySelect } from './CitySelect'
import { PostalCodeInput } from './PostalCodeInput' import { PostalCodeInput } from './PostalCodeInput'
import { convertLexicalToHTML } from '@payloadcms/richtext-lexical/html'
interface PetitionFormProps { interface PetitionFormProps {
id: string id: string
@ -105,7 +106,11 @@ export const PetitionForm = ({ id, petition }: PetitionFormProps) => {
</Field> </Field>
<Field> <Field>
{typeof petition.form.consent !== 'number' ? ( {typeof petition.form.consent !== 'number' ? (
<FieldDescription>{petition.form.consent.text}</FieldDescription> <FieldDescription
dangerouslySetInnerHTML={{
__html: convertLexicalToHTML({ data: petition.form.consent.text }),
}}
/>
) : null} ) : null}
{methods.formState.errors.root?.message ? ( {methods.formState.errors.root?.message ? (
<FieldDescription className="text-destructive"> <FieldDescription className="text-destructive">

View file

@ -229,7 +229,21 @@ export interface Petition {
*/ */
export interface Consent { export interface Consent {
id: number; id: number;
text: string; text: {
root: {
type: string;
children: {
type: any;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
};
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
} }