@@ -34,10 +34,7 @@ export const esignet = (
34
34
url . searchParams . append ( "acr_values" , "mosip:idp:acr:static-code" ) ;
35
35
url . searchParams . append ( "claims" , openIdProviderClaims ) ;
36
36
url . searchParams . append ( "state" , "fetch-on-mount" ) ;
37
- url . searchParams . append (
38
- "redirect_uri" ,
39
- '${window.location.href}' ,
40
- ) ;
37
+ url . searchParams . append ( "redirect_uri" , "${window.location.href}" ) ;
41
38
42
39
return {
43
40
name : fieldName ,
@@ -115,8 +112,7 @@ export const esignetCallback = ({
115
112
} ,
116
113
body : {
117
114
clientId : openIdProviderClientId ,
118
- redirectUri :
119
- '${window.location.href}' ,
115
+ redirectUri : "${window.location.href}" ,
120
116
} ,
121
117
122
118
method : "POST" ,
@@ -170,8 +166,22 @@ export const idReader = (
170
166
} ;
171
167
} ;
172
168
173
- export const qr = ( ) => ( {
169
+ type MessageDescriptor = {
170
+ id : string ;
171
+ defaultMessage : string ;
172
+ description ?: string ;
173
+ } ;
174
+
175
+ export const qr = ( {
176
+ validation,
177
+ } : {
178
+ validation : {
179
+ rule : Record < string , unknown > ;
180
+ errorMessage : MessageDescriptor ;
181
+ } ;
182
+ } ) => ( {
174
183
type : "QR" ,
184
+ validation,
175
185
} ) ;
176
186
177
187
export const verified = ( event : string , sectionId : string ) => {
@@ -195,19 +205,24 @@ export const verified = (event: string, sectionId: string) => {
195
205
} ;
196
206
} ;
197
207
198
- export const idPendingVerificationBanner = (
208
+ function capitalize ( str : string ) {
209
+ return str . charAt ( 0 ) . toUpperCase ( ) + str . slice ( 1 ) ;
210
+ }
211
+
212
+ export const idVerificationBanner = (
199
213
event : string ,
200
214
sectionId : string ,
215
+ status : "pending" | "verified" | "failed" ,
201
216
) => {
202
217
const fieldName = "verified" ;
203
218
const fieldId = `${ event } .${ sectionId } .${ sectionId } -view-group.${ fieldName } ` ;
204
219
return {
205
- name : "idPending" ,
220
+ name : `id ${ capitalize ( status ) } .` ,
206
221
type : "ID_VERIFICATION_BANNER" ,
207
222
fieldId,
208
223
hideInPreview : true ,
209
224
custom : true ,
210
- bannerType : "pending" ,
225
+ bannerType : status ,
211
226
idFieldName : "idReader" ,
212
227
label : {
213
228
id : "form.field.label.empty" ,
@@ -217,7 +232,7 @@ export const idPendingVerificationBanner = (
217
232
conditionals : [
218
233
{
219
234
action : "hide" ,
220
- expression : ' $form?.verified !== "pending"' ,
235
+ expression : ` $form?.verified !== "${ status } "` ,
221
236
} ,
222
237
] ,
223
238
} ;
@@ -226,6 +241,8 @@ export const idPendingVerificationBanner = (
226
241
export const idVerificationFields = ( event : string , sectionId : string ) => {
227
242
return [
228
243
verified ( event , sectionId ) ,
229
- idPendingVerificationBanner ( event , sectionId ) ,
244
+ idVerificationBanner ( event , sectionId , "pending" ) ,
245
+ idVerificationBanner ( event , sectionId , "verified" ) ,
246
+ idVerificationBanner ( event , sectionId , "failed" ) ,
230
247
] ;
231
248
} ;
0 commit comments