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',
data: {
contact: contact.id,
consent: 2,
comment,
},
req: { transactionID },

View file

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

View file

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

View file

@ -229,7 +229,21 @@ export interface Petition {
*/
export interface Consent {
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;
createdAt: string;
}