From 046f8a539f1c8e7b5f45a03df2c43a6b7345f33d Mon Sep 17 00:00:00 2001 From: Francisco Solla Date: Sun, 15 Mar 2026 17:40:40 -0300 Subject: [PATCH] fix type isssues --- src/app/(frontend)/actions/submitWhatsapp.ts | 1 + src/collections/Consent.ts | 2 +- src/components/PetitionForm.tsx | 7 ++++++- src/payload-types.ts | 16 +++++++++++++++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/app/(frontend)/actions/submitWhatsapp.ts b/src/app/(frontend)/actions/submitWhatsapp.ts index 294917c5..75cb1b30 100644 --- a/src/app/(frontend)/actions/submitWhatsapp.ts +++ b/src/app/(frontend)/actions/submitWhatsapp.ts @@ -25,6 +25,7 @@ export const submitWhatsapp = async (input: WhatsAppFormInput) => { collection: 'subscription', data: { contact: contact.id, + consent: 2, comment, }, req: { transactionID }, diff --git a/src/collections/Consent.ts b/src/collections/Consent.ts index 6b1690fb..4e4de000 100644 --- a/src/collections/Consent.ts +++ b/src/collections/Consent.ts @@ -13,7 +13,7 @@ export const Consent: CollectionConfig = { fields: [ { name: 'text', - type: 'text', + type: 'richText', label: 'Texto', required: true, }, diff --git a/src/components/PetitionForm.tsx b/src/components/PetitionForm.tsx index 0511c703..6a4f9280 100644 --- a/src/components/PetitionForm.tsx +++ b/src/components/PetitionForm.tsx @@ -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) => { {typeof petition.form.consent !== 'number' ? ( - {petition.form.consent.text} + ) : null} {methods.formState.errors.root?.message ? ( diff --git a/src/payload-types.ts b/src/payload-types.ts index 072ed988..1abfca4a 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -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; }