@@ -5,16 +5,15 @@ import { davinci } from '@forgerock/davinci-client';
55
66import type { DaVinciConfig , RequestMiddleware } from '@forgerock/davinci-client/types' ;
77
8- import usernameComponent from './components/text.js' ;
8+ import textComponent from './components/text.js' ;
99import passwordComponent from './components/password.js' ;
1010import submitButtonComponent from './components/submit-button.js' ;
1111import protect from './components/protect.js' ;
1212import flowLinkComponent from './components/flow-link.js' ;
1313import socialLoginButtonComponent from './components/social-login-button.js' ;
1414import { serverConfigs } from './server-configs.js' ;
15- import dropdownComponent from './components/dropdown.js' ;
16- import comboboxComponent from './components/combobox.js' ;
17- import radioComponent from './components/radio.js' ;
15+ import singleValueComponent from './components/single-value.js' ;
16+ import multiValueComponent from './components/multi-value.js' ;
1817
1918const qs = window . location . search ;
2019const searchParams = new URLSearchParams ( qs ) ;
@@ -150,7 +149,6 @@ const urlParams = new URLSearchParams(window.location.search);
150149
151150 const collectors = davinciClient . getCollectors ( ) ;
152151 collectors . forEach ( ( collector ) => {
153- console . log ( collector ) ;
154152 if ( collector . type === 'TextCollector' && collector . name === 'protectsdk' ) {
155153 // eslint-disable-next-line @typescript-eslint/no-unused-expressions
156154 collector ;
@@ -160,10 +158,11 @@ const urlParams = new URLSearchParams(window.location.search);
160158 davinciClient . update ( collector ) , // Returns an update function for this collector
161159 ) ;
162160 } else if ( collector . type === 'TextCollector' ) {
163- usernameComponent (
161+ textComponent (
164162 formEl , // You can ignore this; it's just for rendering
165163 collector , // This is the plain object of the collector
166164 davinciClient . update ( collector ) , // Returns an update function for this collector
165+ davinciClient . validate ( collector ) , // Returns a validate function for this collector
167166 ) ;
168167 } else if ( collector . type === 'PasswordCollector' ) {
169168 // eslint-disable-next-line @typescript-eslint/no-unused-expressions
@@ -192,15 +191,10 @@ const urlParams = new URLSearchParams(window.location.search);
192191 } ) ,
193192 renderForm , // Ignore this; it's just for re-rendering the form
194193 ) ;
195- } else if (
196- collector . type === 'SingleSelectCollector' &&
197- collector . input . type === 'DROPDOWN'
198- ) {
199- dropdownComponent ( formEl , collector , davinciClient . update ( collector ) ) ;
200- } else if ( collector . type === 'SingleSelectCollector' && collector . input . type === 'RADIO' ) {
201- radioComponent ( formEl , collector , davinciClient . update ( collector ) ) ;
202- } else if ( collector . type === 'MultiSelectCollector' && collector . input . type === 'COMBOBOX' ) {
203- comboboxComponent ( formEl , collector , davinciClient . update ( collector ) ) ;
194+ } else if ( collector . type === 'SingleSelectCollector' ) {
195+ singleValueComponent ( formEl , collector , davinciClient . update ( collector ) ) ;
196+ } else if ( collector . type === 'MultiSelectCollector' ) {
197+ multiValueComponent ( formEl , collector , davinciClient . update ( collector ) ) ;
204198 }
205199 } ) ;
206200
0 commit comments