Skip to content

Commit

Permalink
✨ [open-formulieren/open-forms#3257] Update cosign V2 type
Browse files Browse the repository at this point in the history
  • Loading branch information
SilviaAmAm committed Feb 7, 2024
1 parent 610e66d commit 268a408
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/formio/components/cosign.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {OFExtensions, StrictComponentSchema} from '..';
import {EmailInputSchema} from './email';
import {InputComponentSchema, OFExtensions, StrictComponentSchema} from '..';

type TranslatableKeys = 'label' | 'description';

Expand Down Expand Up @@ -43,7 +42,20 @@ export interface CosignV1ComponentSchema extends Omit<CosignV1InputSchema, KeysT
authPlugin: string; // plugin identifiers in the backend are dynamic
}

type V2KeysToOmit = 'hideLabel' | 'disabled' | 'placeholder';
type Validator = 'required';

export interface CosignData {
email: string;
bsn?: string;
}

type TranslatableKeysCosignV2 = TranslatableKeys | 'tooltip';

export type CosignV2InputSchema = InputComponentSchema<
CosignData,
Validator,
TranslatableKeysCosignV2
>;

/**
* The cosign component type, otherwise known as 'Cosign'.
Expand All @@ -57,9 +69,8 @@ type V2KeysToOmit = 'hideLabel' | 'disabled' | 'placeholder';
* @group Form.io components
* @category Concrete types
*/
export interface CosignV2ComponentSchema extends Omit<EmailInputSchema, V2KeysToOmit> {
export interface CosignV2ComponentSchema
extends Omit<CosignV2InputSchema, 'hideLabel' | 'placeholder' | 'disabled' | 'validateOn'> {
type: 'cosign';
validateOn: 'blur';
defaultValue?: string; // no multiple support, so must always be a single string
autocomplete?: string;
checkBsn: boolean;
}

0 comments on commit 268a408

Please sign in to comment.