| 1 |
/** |
| 2 |
* Field Constants |
| 3 |
* |
| 4 |
* Shared field type constants used across the application. |
| 5 |
* Centralised here so the list is defined once and imported wherever needed |
| 6 |
* (form builder, integrations, entry manager, etc.). |
| 7 |
*/ |
| 8 |
|
| 9 |
/** |
| 10 |
* Field types that are used for bot/spam protection. |
| 11 |
* These fields should be excluded from stored entries, integration payloads, |
| 12 |
* placeholder lists, and any other processing that targets user-submitted data. |
| 13 |
*/ |
| 14 |
export const SECURITY_FIELD_TYPES = ['recaptcha', 'turnstile', 'hcaptcha'] as const |
| 15 |
|
| 16 |
export type SecurityFieldType = (typeof SECURITY_FIELD_TYPES)[number] |
| 17 |
|
| 18 |
/** |
| 19 |
* Returns true when the given field type is a security/CAPTCHA field. |
| 20 |
* |
| 21 |
* @example |
| 22 |
* isSecurityField('recaptcha') // true |
| 23 |
* isSecurityField('email') // false |
| 24 |
*/ |
| 25 |
export const isSecurityField = (fieldType: string): boolean => |
| 26 |
(SECURITY_FIELD_TYPES as readonly string[]).includes(fieldType) |
| 27 |
|