@@ -19,6 +19,8 @@ import socialLoginButtonComponent from './components/social-login-button.js';
1919import { serverConfigs } from './server-configs.js' ;
2020import singleValueComponent from './components/single-value.js' ;
2121import multiValueComponent from './components/multi-value.js' ;
22+ import labelComponent from './components/label.js' ;
23+ import objectValueComponent from './components/object-value.js' ;
2224
2325const qs = window . location . search ;
2426const searchParams = new URLSearchParams ( qs ) ;
@@ -58,6 +60,7 @@ const urlParams = new URLSearchParams(window.location.search);
5860 // different middleware type than the old legacy config
5961 await Config . setAsync ( config as any ) ;
6062 }
63+
6164 function renderComplete ( ) {
6265 const clientInfo = davinciClient . getClient ( ) ;
6366 const serverInfo = davinciClient . getServer ( ) ;
@@ -164,6 +167,21 @@ const urlParams = new URLSearchParams(window.location.search);
164167 collector , // This is the plain object of the collector
165168 davinciClient . update ( collector ) , // Returns an update function for this collector
166169 ) ;
170+ } else if (
171+ collector . type === 'DeviceRegistrationCollector' ||
172+ collector . type === 'DeviceAuthenticationCollector'
173+ ) {
174+ objectValueComponent (
175+ formEl , // You can ignore this; it's just for rendering
176+ collector , // This is the plain object of the collector
177+ davinciClient . update ( collector ) , // Returns an update function for this collector
178+ submitForm ,
179+ ) ;
180+ } else if ( collector . type === 'ReadOnlyCollector' ) {
181+ labelComponent (
182+ formEl , // You can ignore this; it's just for rendering
183+ collector , // This is the plain object of the collector
184+ ) ;
167185 } else if ( collector . type === 'TextCollector' ) {
168186 textComponent (
169187 formEl , // You can ignore this; it's just for rendering
@@ -184,6 +202,13 @@ const urlParams = new URLSearchParams(window.location.search);
184202 formEl , // You can ignore this; it's just for rendering
185203 collector , // This is the plain object of the collector
186204 ) ;
205+ } else if ( collector . type === 'PhoneNumberCollector' ) {
206+ objectValueComponent (
207+ formEl , // You can ignore this; it's just for rendering
208+ collector , // This is the plain object of the collector
209+ davinciClient . update ( collector ) , // Returns an update function for this collector
210+ submitForm ,
211+ ) ;
187212 } else if ( collector . type === 'IdpCollector' ) {
188213 // eslint-disable-next-line @typescript-eslint/no-unused-expressions
189214 collector ;
@@ -206,17 +231,21 @@ const urlParams = new URLSearchParams(window.location.search);
206231 } ) ;
207232
208233 if ( davinciClient . getCollectors ( ) . find ( ( collector ) => collector . name === 'protectsdk' ) ) {
209- const newNode = await davinciClient . next ( ) ;
210-
211- if ( newNode . status === 'continue' ) {
212- renderForm ( ) ;
213- } else if ( newNode . status === 'success' ) {
214- renderComplete ( ) ;
215- } else if ( newNode . status === 'error' ) {
216- renderForm ( ) ;
217- } else {
218- console . error ( 'Unknown node status' , newNode ) ;
219- }
234+ submitForm ( ) ;
235+ }
236+ }
237+
238+ async function submitForm ( ) {
239+ const newNode = await davinciClient . next ( ) ;
240+
241+ if ( newNode . status === 'continue' ) {
242+ renderForm ( ) ;
243+ } else if ( newNode . status === 'success' ) {
244+ renderComplete ( ) ;
245+ } else if ( newNode . status === 'error' ) {
246+ renderForm ( ) ;
247+ } else {
248+ console . error ( 'Unknown node status' , newNode ) ;
220249 }
221250 }
222251
0 commit comments