Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type definition to support e-mail verification #53

Merged
merged 2 commits into from
Aug 20, 2024

Conversation

sergei-maertens
Copy link
Member

@sergei-maertens sergei-maertens commented Aug 19, 2024

Partially closes open-formulieren/open-forms#4542

  • Refactored some typing utilities
  • Used refactor to define email component extension requireVerification, which we'll expose in the formio builder after this is merged.

I checked that formio-builder still builds with npm pack and installing the tarball locally.

@sergei-maertens sergei-maertens marked this pull request as draft August 19, 2024 14:35
…ions are defined for a component type

Instead of having to re-define the openForms key itself and re-compose
it with the translatable keys, we can instead use a type variable to
specify the extensions to add via the OFExtensions helper type.

This removes the amount of possible errors and repetition w/r to the
translation keys that need to be passed, and the re-use of the generic
types is greater.
…cation email extension

The extension is added under the openForms namespace to prevent
possible future collissions, and to make it explicit this is an
additional feature added by Open Forms.

The property is optional so that existing email components do not
require a data migration - not specifying it is falsy, which is the
default behaviour.

The property is not added under the 'validate' namespace, because it's
something that can only be properly validated server-side - it does not
make sense to configure client-side validation error messages for this
validation step because of that reason. We can still emit validation
errors server-side in a way that they will probably be displayed with
the component as if it was client-side validation.
@sergei-maertens sergei-maertens force-pushed the feature/4542-support-email-verification branch from 564f811 to 58edc62 Compare August 19, 2024 14:55
@sergei-maertens sergei-maertens marked this pull request as ready for review August 19, 2024 14:56
src/formio/components/addressNL.ts Show resolved Hide resolved
Comment on lines +44 to +47
export type RadioComponentSchema = Require<
RadioManualValuesSchema | RadioVariableValuesSchema,
'openForms'
>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the Require here mean that the openForms key is required for RadioComponentSchema?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed! I found it a bit weird that there's no built-in utility type for it (Required makes everything required). Without this, the formio builder doesn't build properly, and for select, selectboxes and radio the dataSrc must be specified.

@sergei-maertens sergei-maertens merged commit da09769 into main Aug 20, 2024
6 checks passed
@sergei-maertens sergei-maertens deleted the feature/4542-support-email-verification branch August 20, 2024 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement email verification procedure for the email component
2 participants