fix(plugin-form-builder): allow overrides to the payment fields group (#9522)
Co-authored-by: mikecebul <mikecebul@gmail.com>
This commit is contained in:
@@ -3,7 +3,7 @@ import path from 'path'
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
const dirname = path.dirname(filename)
|
||||
import type { BeforeEmail } from '@payloadcms/plugin-form-builder/types'
|
||||
import type { Block } from 'payload'
|
||||
import type { Block, Field } from 'payload'
|
||||
|
||||
//import { nodemailerAdapter } from '@payloadcms/email-nodemailer'
|
||||
import { formBuilderPlugin, fields as formFields } from '@payloadcms/plugin-form-builder'
|
||||
@@ -104,8 +104,25 @@ export default buildConfigWithDefaults({
|
||||
},
|
||||
formSubmissionOverrides: {
|
||||
fields: ({ defaultFields }) => {
|
||||
const modifiedFields: Field[] = defaultFields.map((field) => {
|
||||
if ('name' in field && field.type === 'group' && field.name === 'payment') {
|
||||
return {
|
||||
...field,
|
||||
fields: [
|
||||
...field.fields, // comment this out to override payments group entirely
|
||||
{
|
||||
name: 'stripeCheckoutSession',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
return field
|
||||
})
|
||||
|
||||
return [
|
||||
...defaultFields,
|
||||
...modifiedFields,
|
||||
{
|
||||
name: 'custom',
|
||||
type: 'text',
|
||||
|
||||
@@ -301,7 +301,6 @@ export interface FormSubmission {
|
||||
id?: string | null;
|
||||
}[]
|
||||
| null;
|
||||
custom?: string | null;
|
||||
payment?: {
|
||||
field?: string | null;
|
||||
status?: string | null;
|
||||
@@ -312,7 +311,9 @@ export interface FormSubmission {
|
||||
brand?: string | null;
|
||||
number?: string | null;
|
||||
};
|
||||
stripeCheckoutSession?: string | null;
|
||||
};
|
||||
custom?: string | null;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
@@ -584,7 +585,6 @@ export interface FormSubmissionsSelect<T extends boolean = true> {
|
||||
value?: T;
|
||||
id?: T;
|
||||
};
|
||||
custom?: T;
|
||||
payment?:
|
||||
| T
|
||||
| {
|
||||
@@ -599,7 +599,9 @@ export interface FormSubmissionsSelect<T extends boolean = true> {
|
||||
brand?: T;
|
||||
number?: T;
|
||||
};
|
||||
stripeCheckoutSession?: T;
|
||||
};
|
||||
custom?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user