File

libs/core-forms/src/lib/turnstile-component-plugin/turnstile-config.model.ts

Description

The config a TurnstileComponent field carries in a CoreForms form-config, and the Cloudflare widget options it is a subset of.

Kept apart from turnstile.component.ts so that reading the shape does not mean loading the component: apps/cmx-coreforms-editor generates the controls that author this object from the types below, and it is a React app whose TypeScript program has no Angular in it. Nothing here may import — that is what makes the file readable from both sides.

Index

Properties

Properties

action (Optional)
Type string
appearance (Optional)
Type "always" | "execute" | "interaction-only"
callback (Optional)
Type function
cData (Optional)
Type string
error-callback (Optional)
Type function
expired-callback (Optional)
Type function
language (Optional)
Type string
sitekey
Type string
tabindex (Optional)
Type number
theme (Optional)
Type "light" | "dark" | "auto"
export interface TurnstileOptions {
  sitekey: string;
  action?: string;
  cData?: string;
  callback?: (token: string) => void;
  'error-callback'?: (errorCode: string) => void;
  'expired-callback'?: () => void;
  theme?: 'light' | 'dark' | 'auto';
  language?: string;
  tabindex?: number;
  appearance?: 'always' | 'execute' | 'interaction-only';
}

/**
 * Everything of the widget the form-config decides. The rest of `TurnstileOptions` is the
 * component's own business: the site key comes from the journey's state, and the callbacks are how
 * the component feeds the form control.
 */
export type TurnstileConfig = Pick<TurnstileOptions, 'action'>;

results matching ""

    No results matching ""