@opencrvs/mosip 1.7.0-alpha.3 → 1.7.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/forms.d.ts +67 -0
- package/build/forms.js +65 -12
- package/package.json +1 -1
- package/src/forms.ts +82 -24
package/build/forms.d.ts
CHANGED
|
@@ -119,3 +119,70 @@ export declare const idReader: (event: string, sectionId: string, conditionals:
|
|
|
119
119
|
export declare const qr: () => {
|
|
120
120
|
type: string;
|
|
121
121
|
};
|
|
122
|
+
export declare const verified: (event: string, sectionId: string) => {
|
|
123
|
+
name: string;
|
|
124
|
+
fieldId: string;
|
|
125
|
+
customQuestionMappingId: string;
|
|
126
|
+
type: string;
|
|
127
|
+
custom: boolean;
|
|
128
|
+
label: {
|
|
129
|
+
id: string;
|
|
130
|
+
defaultMessage: string;
|
|
131
|
+
};
|
|
132
|
+
initialValue: {
|
|
133
|
+
dependsOn: string[];
|
|
134
|
+
expression: string;
|
|
135
|
+
};
|
|
136
|
+
validator: never[];
|
|
137
|
+
};
|
|
138
|
+
export declare const idPendingVerificationBanner: (event: string, sectionId: string) => {
|
|
139
|
+
name: string;
|
|
140
|
+
type: string;
|
|
141
|
+
fieldId: string;
|
|
142
|
+
hideInPreview: boolean;
|
|
143
|
+
custom: boolean;
|
|
144
|
+
bannerType: string;
|
|
145
|
+
idFieldName: string;
|
|
146
|
+
label: {
|
|
147
|
+
id: string;
|
|
148
|
+
defaultMessage: string;
|
|
149
|
+
};
|
|
150
|
+
validator: never[];
|
|
151
|
+
conditionals: {
|
|
152
|
+
action: string;
|
|
153
|
+
expression: string;
|
|
154
|
+
}[];
|
|
155
|
+
};
|
|
156
|
+
export declare const idVerificationFields: (event: string, sectionId: string) => ({
|
|
157
|
+
name: string;
|
|
158
|
+
fieldId: string;
|
|
159
|
+
customQuestionMappingId: string;
|
|
160
|
+
type: string;
|
|
161
|
+
custom: boolean;
|
|
162
|
+
label: {
|
|
163
|
+
id: string;
|
|
164
|
+
defaultMessage: string;
|
|
165
|
+
};
|
|
166
|
+
initialValue: {
|
|
167
|
+
dependsOn: string[];
|
|
168
|
+
expression: string;
|
|
169
|
+
};
|
|
170
|
+
validator: never[];
|
|
171
|
+
} | {
|
|
172
|
+
name: string;
|
|
173
|
+
type: string;
|
|
174
|
+
fieldId: string;
|
|
175
|
+
hideInPreview: boolean;
|
|
176
|
+
custom: boolean;
|
|
177
|
+
bannerType: string;
|
|
178
|
+
idFieldName: string;
|
|
179
|
+
label: {
|
|
180
|
+
id: string;
|
|
181
|
+
defaultMessage: string;
|
|
182
|
+
};
|
|
183
|
+
validator: never[];
|
|
184
|
+
conditionals: {
|
|
185
|
+
action: string;
|
|
186
|
+
expression: string;
|
|
187
|
+
}[];
|
|
188
|
+
})[];
|
package/build/forms.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// @TODO: Yet to be implemented! Placeholders for NPM publish.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.qr = exports.idReader = exports.esignetHidden = exports.returnExpression = exports.esignetCallback = exports.popupButton = exports.esignet = void 0;
|
|
4
|
+
exports.idVerificationFields = exports.idPendingVerificationBanner = exports.verified = exports.qr = exports.idReader = exports.esignetHidden = exports.returnExpression = exports.esignetCallback = exports.popupButton = exports.esignet = void 0;
|
|
5
5
|
/**
|
|
6
6
|
* E-Signet popup button and hidden field form definitions
|
|
7
7
|
* @example
|
|
@@ -48,7 +48,7 @@ const esignet = (esignetAuthUrl, openIdProviderClientId, openIdProviderClaims, f
|
|
|
48
48
|
desktop: 'Globe',
|
|
49
49
|
mobile: 'Fingerprint'
|
|
50
50
|
},
|
|
51
|
-
type:
|
|
51
|
+
type: 'LINK_BUTTON',
|
|
52
52
|
custom: true,
|
|
53
53
|
label: {
|
|
54
54
|
id: 'views.idReader.label.eSignet',
|
|
@@ -57,19 +57,19 @@ const esignet = (esignetAuthUrl, openIdProviderClientId, openIdProviderClaims, f
|
|
|
57
57
|
hideInPreview: true,
|
|
58
58
|
conditionals: [
|
|
59
59
|
{
|
|
60
|
-
action:
|
|
61
|
-
expression:
|
|
62
|
-
}
|
|
60
|
+
action: 'disable',
|
|
61
|
+
expression: '!!$form.redirectCallbackFetch'
|
|
62
|
+
}
|
|
63
63
|
],
|
|
64
64
|
options: {
|
|
65
65
|
url: esignetAuthUrl,
|
|
66
66
|
callback: {
|
|
67
67
|
params: {
|
|
68
|
-
code:
|
|
68
|
+
code: 'esignet-mock-code'
|
|
69
69
|
},
|
|
70
70
|
trigger: callbackFieldName
|
|
71
|
-
}
|
|
72
|
-
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
73
|
};
|
|
74
74
|
};
|
|
75
75
|
exports.esignet = esignet;
|
|
@@ -103,9 +103,9 @@ const esignetCallback = ({ fieldName, getOIDPUserInfoUrl, openIdProviderClientId
|
|
|
103
103
|
'Content-type': 'application/json'
|
|
104
104
|
},
|
|
105
105
|
body: {
|
|
106
|
-
code:
|
|
106
|
+
code: 'esignet-mock-code',
|
|
107
107
|
clientId: openIdProviderClientId,
|
|
108
|
-
redirectUri:
|
|
108
|
+
redirectUri: ''
|
|
109
109
|
},
|
|
110
110
|
method: 'POST'
|
|
111
111
|
}
|
|
@@ -113,8 +113,8 @@ const esignetCallback = ({ fieldName, getOIDPUserInfoUrl, openIdProviderClientId
|
|
|
113
113
|
exports.esignetCallback = esignetCallback;
|
|
114
114
|
const returnExpression = (fieldName) => {
|
|
115
115
|
return {
|
|
116
|
-
dependsOn: [
|
|
117
|
-
expression: `$form.redirectCallbackFetch?.data?.${fieldName}
|
|
116
|
+
dependsOn: ['redirectCallbackFetch'],
|
|
117
|
+
expression: `$form.redirectCallbackFetch?.data?.${fieldName}`
|
|
118
118
|
};
|
|
119
119
|
};
|
|
120
120
|
exports.returnExpression = returnExpression;
|
|
@@ -163,3 +163,56 @@ const qr = () => ({
|
|
|
163
163
|
type: 'QR'
|
|
164
164
|
});
|
|
165
165
|
exports.qr = qr;
|
|
166
|
+
const verified = (event, sectionId) => {
|
|
167
|
+
const fieldName = 'verified';
|
|
168
|
+
const fieldId = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
|
|
169
|
+
return {
|
|
170
|
+
name: 'verified',
|
|
171
|
+
fieldId,
|
|
172
|
+
customQuestionMappingId: fieldId,
|
|
173
|
+
type: 'HIDDEN',
|
|
174
|
+
custom: true,
|
|
175
|
+
label: {
|
|
176
|
+
id: 'messages.empty',
|
|
177
|
+
defaultMessage: ''
|
|
178
|
+
},
|
|
179
|
+
initialValue: {
|
|
180
|
+
dependsOn: ['idReader'],
|
|
181
|
+
expression: 'Boolean($form?.idReader)? "pending":""'
|
|
182
|
+
},
|
|
183
|
+
validator: []
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
exports.verified = verified;
|
|
187
|
+
const idPendingVerificationBanner = (event, sectionId) => {
|
|
188
|
+
const fieldName = 'verified';
|
|
189
|
+
const fieldId = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
|
|
190
|
+
return {
|
|
191
|
+
name: 'idPending',
|
|
192
|
+
type: 'ID_VERIFICATION_BANNER',
|
|
193
|
+
fieldId,
|
|
194
|
+
hideInPreview: true,
|
|
195
|
+
custom: true,
|
|
196
|
+
bannerType: 'pending',
|
|
197
|
+
idFieldName: 'idReader',
|
|
198
|
+
label: {
|
|
199
|
+
id: 'messages.empty',
|
|
200
|
+
defaultMessage: ''
|
|
201
|
+
},
|
|
202
|
+
validator: [],
|
|
203
|
+
conditionals: [
|
|
204
|
+
{
|
|
205
|
+
action: 'hide',
|
|
206
|
+
expression: '$form?.verified !== "pending"'
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
exports.idPendingVerificationBanner = idPendingVerificationBanner;
|
|
212
|
+
const idVerificationFields = (event, sectionId) => {
|
|
213
|
+
return [
|
|
214
|
+
(0, exports.verified)(event, sectionId),
|
|
215
|
+
(0, exports.idPendingVerificationBanner)(event, sectionId)
|
|
216
|
+
];
|
|
217
|
+
};
|
|
218
|
+
exports.idVerificationFields = idVerificationFields;
|
package/package.json
CHANGED
package/src/forms.ts
CHANGED
|
@@ -16,19 +16,24 @@
|
|
|
16
16
|
* @description E-Signet REDIRECT button form definition. Calls E-Signet /authorize (this field may not be supported in the latest release of OpenCRVS yet)
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
|
-
export const esignet = (
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
export const esignet = (
|
|
20
|
+
esignetAuthUrl: string,
|
|
21
|
+
openIdProviderClientId: string,
|
|
22
|
+
openIdProviderClaims: string,
|
|
23
|
+
fieldName: string,
|
|
24
|
+
callbackFieldName: string
|
|
25
|
+
) => {
|
|
26
|
+
const url = new URL(esignetAuthUrl);
|
|
22
27
|
|
|
23
28
|
url.searchParams.append(
|
|
24
29
|
'client_id',
|
|
25
30
|
openIdProviderClientId || 'mock-client_id'
|
|
26
|
-
)
|
|
27
|
-
url.searchParams.append('response_type', 'code')
|
|
28
|
-
url.searchParams.append('scope', 'openid profile')
|
|
29
|
-
url.searchParams.append('acr_values', 'mosip:idp:acr:static-code')
|
|
30
|
-
url.searchParams.append('claims', openIdProviderClaims || 'mock-claims')
|
|
31
|
-
url.searchParams.append('state', 'trigger-onmount')
|
|
31
|
+
);
|
|
32
|
+
url.searchParams.append('response_type', 'code');
|
|
33
|
+
url.searchParams.append('scope', 'openid profile');
|
|
34
|
+
url.searchParams.append('acr_values', 'mosip:idp:acr:static-code');
|
|
35
|
+
url.searchParams.append('claims', openIdProviderClaims || 'mock-claims');
|
|
36
|
+
url.searchParams.append('state', 'trigger-onmount');
|
|
32
37
|
|
|
33
38
|
/*
|
|
34
39
|
|
|
@@ -45,7 +50,7 @@ export const esignet = (esignetAuthUrl: string, openIdProviderClientId: string,
|
|
|
45
50
|
}
|
|
46
51
|
url.searchParams.append('state', JSON.stringify(stateToBeSent))
|
|
47
52
|
*/
|
|
48
|
-
window.location.href = url.toString()
|
|
53
|
+
window.location.href = url.toString();
|
|
49
54
|
|
|
50
55
|
return {
|
|
51
56
|
name: fieldName,
|
|
@@ -54,28 +59,28 @@ export const esignet = (esignetAuthUrl: string, openIdProviderClientId: string,
|
|
|
54
59
|
desktop: 'Globe',
|
|
55
60
|
mobile: 'Fingerprint'
|
|
56
61
|
},
|
|
57
|
-
type:
|
|
62
|
+
type: 'LINK_BUTTON',
|
|
58
63
|
custom: true,
|
|
59
|
-
label: {
|
|
64
|
+
label: {
|
|
60
65
|
id: 'views.idReader.label.eSignet',
|
|
61
66
|
defaultMessage: 'E-signet'
|
|
62
67
|
},
|
|
63
68
|
hideInPreview: true,
|
|
64
69
|
conditionals: [
|
|
65
70
|
{
|
|
66
|
-
action:
|
|
67
|
-
expression:
|
|
68
|
-
}
|
|
71
|
+
action: 'disable',
|
|
72
|
+
expression: '!!$form.redirectCallbackFetch'
|
|
73
|
+
}
|
|
69
74
|
],
|
|
70
75
|
options: {
|
|
71
76
|
url: esignetAuthUrl,
|
|
72
77
|
callback: {
|
|
73
78
|
params: {
|
|
74
|
-
code:
|
|
75
|
-
},
|
|
79
|
+
code: 'esignet-mock-code'
|
|
80
|
+
},
|
|
76
81
|
trigger: callbackFieldName
|
|
77
|
-
}
|
|
78
|
-
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
79
84
|
};
|
|
80
85
|
};
|
|
81
86
|
|
|
@@ -101,7 +106,7 @@ export const popupButton = ({
|
|
|
101
106
|
export const esignetCallback = ({
|
|
102
107
|
fieldName,
|
|
103
108
|
getOIDPUserInfoUrl,
|
|
104
|
-
openIdProviderClientId
|
|
109
|
+
openIdProviderClientId
|
|
105
110
|
}: {
|
|
106
111
|
fieldName: string;
|
|
107
112
|
getOIDPUserInfoUrl: string;
|
|
@@ -121,9 +126,9 @@ export const esignetCallback = ({
|
|
|
121
126
|
'Content-type': 'application/json'
|
|
122
127
|
},
|
|
123
128
|
body: {
|
|
124
|
-
code:
|
|
129
|
+
code: 'esignet-mock-code',
|
|
125
130
|
clientId: openIdProviderClientId,
|
|
126
|
-
redirectUri:
|
|
131
|
+
redirectUri: ''
|
|
127
132
|
},
|
|
128
133
|
method: 'POST'
|
|
129
134
|
}
|
|
@@ -131,8 +136,8 @@ export const esignetCallback = ({
|
|
|
131
136
|
|
|
132
137
|
export const returnExpression = (fieldName: string) => {
|
|
133
138
|
return {
|
|
134
|
-
dependsOn: [
|
|
135
|
-
expression: `$form.redirectCallbackFetch?.data?.${fieldName}
|
|
139
|
+
dependsOn: ['redirectCallbackFetch'],
|
|
140
|
+
expression: `$form.redirectCallbackFetch?.data?.${fieldName}`
|
|
136
141
|
};
|
|
137
142
|
};
|
|
138
143
|
|
|
@@ -187,5 +192,58 @@ export const qr = () => ({
|
|
|
187
192
|
type: 'QR'
|
|
188
193
|
});
|
|
189
194
|
|
|
195
|
+
export const verified = (event: string, sectionId: string) => {
|
|
196
|
+
const fieldName = 'verified';
|
|
197
|
+
const fieldId = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
|
|
198
|
+
return {
|
|
199
|
+
name: 'verified',
|
|
200
|
+
fieldId,
|
|
201
|
+
customQuestionMappingId: fieldId,
|
|
202
|
+
type: 'HIDDEN',
|
|
203
|
+
custom: true,
|
|
204
|
+
label: {
|
|
205
|
+
id: 'messages.empty',
|
|
206
|
+
defaultMessage: ''
|
|
207
|
+
},
|
|
208
|
+
initialValue: {
|
|
209
|
+
dependsOn: ['idReader'],
|
|
210
|
+
expression: 'Boolean($form?.idReader)? "pending":""'
|
|
211
|
+
},
|
|
212
|
+
validator: []
|
|
213
|
+
};
|
|
214
|
+
};
|
|
190
215
|
|
|
216
|
+
export const idPendingVerificationBanner = (
|
|
217
|
+
event: string,
|
|
218
|
+
sectionId: string
|
|
219
|
+
) => {
|
|
220
|
+
const fieldName = 'verified';
|
|
221
|
+
const fieldId = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
|
|
222
|
+
return {
|
|
223
|
+
name: 'idPending',
|
|
224
|
+
type: 'ID_VERIFICATION_BANNER',
|
|
225
|
+
fieldId,
|
|
226
|
+
hideInPreview: true,
|
|
227
|
+
custom: true,
|
|
228
|
+
bannerType: 'pending',
|
|
229
|
+
idFieldName: 'idReader',
|
|
230
|
+
label: {
|
|
231
|
+
id: 'messages.empty',
|
|
232
|
+
defaultMessage: ''
|
|
233
|
+
},
|
|
234
|
+
validator: [],
|
|
235
|
+
conditionals: [
|
|
236
|
+
{
|
|
237
|
+
action: 'hide',
|
|
238
|
+
expression: '$form?.verified !== "pending"'
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
};
|
|
242
|
+
};
|
|
191
243
|
|
|
244
|
+
export const idVerificationFields = (event: string, sectionId: string) => {
|
|
245
|
+
return [
|
|
246
|
+
verified(event, sectionId),
|
|
247
|
+
idPendingVerificationBanner(event, sectionId)
|
|
248
|
+
];
|
|
249
|
+
};
|