@opencrvs/mosip 1.8.0-beta.1 → 1.8.0-beta.11
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 +11 -3
- package/build/forms.js +15 -4
- package/build/transform.d.ts +1 -0
- package/package.json +1 -1
- package/src/forms.ts +45 -4
- package/src/transform.ts +1 -0
package/build/forms.d.ts
CHANGED
|
@@ -93,7 +93,7 @@ export declare const esignetHidden: () => {
|
|
|
93
93
|
name: string;
|
|
94
94
|
type: string;
|
|
95
95
|
};
|
|
96
|
-
export declare const idReader: (event: string, sectionId: string, conditionals: any[], readers: any[]) => {
|
|
96
|
+
export declare const idReader: (event: string, sectionId: string, conditionals: any[], readers: any[], esignetCallbackFieldName?: string) => {
|
|
97
97
|
name: string;
|
|
98
98
|
customQuestionMappingId: string;
|
|
99
99
|
custom: boolean;
|
|
@@ -104,7 +104,10 @@ export declare const idReader: (event: string, sectionId: string, conditionals:
|
|
|
104
104
|
defaultMessage: string;
|
|
105
105
|
};
|
|
106
106
|
hideInPreview: boolean;
|
|
107
|
-
initialValue: string
|
|
107
|
+
initialValue: string | {
|
|
108
|
+
dependsOn: string[];
|
|
109
|
+
expression: string;
|
|
110
|
+
};
|
|
108
111
|
validator: never[];
|
|
109
112
|
conditionals: any[];
|
|
110
113
|
dividerLabel: {
|
|
@@ -210,7 +213,12 @@ export declare const getInitialValueFromIDReader: (fieldNameInReader: string) =>
|
|
|
210
213
|
dependsOn: string[];
|
|
211
214
|
expression: string;
|
|
212
215
|
};
|
|
213
|
-
|
|
216
|
+
type IDReaderParams = {
|
|
217
|
+
(event: "birth" | "death", section: "informant" | "mother" | "father" | "spouse" | "deceased", qrConfig: QRConfig, esignetConfig: ESignetConfig, verifiedCustomFieldMapping: any, conditionals?: any[]): any[];
|
|
218
|
+
(event: "birth" | "death", section: "informant" | "mother" | "father" | "spouse" | "deceased", qrConfig: QRConfig, esignetConfig: undefined, verifiedCustomFieldMapping: any, conditionals?: any[]): any[];
|
|
219
|
+
(event: "birth" | "death", section: "informant" | "mother" | "father" | "spouse" | "deceased", qrConfig: undefined, esignetConfig: ESignetConfig, verifiedCustomFieldMapping: any, conditionals?: any[]): any[];
|
|
220
|
+
};
|
|
221
|
+
export declare const idReaderFields: IDReaderParams;
|
|
214
222
|
export declare const idVerificationFields: (event: string, sectionId: string, mapping: any, conditionals?: any[], esignetConfig?: ESignetConfig) => ({
|
|
215
223
|
name: string;
|
|
216
224
|
fieldId: string;
|
package/build/forms.js
CHANGED
|
@@ -113,9 +113,17 @@ const esignetHidden = () => {
|
|
|
113
113
|
};
|
|
114
114
|
};
|
|
115
115
|
exports.esignetHidden = esignetHidden;
|
|
116
|
-
const idReader = (event, sectionId, conditionals, readers
|
|
116
|
+
const idReader = (event, sectionId, conditionals, readers,
|
|
117
|
+
/** E-Signet callback field name */
|
|
118
|
+
esignetCallbackFieldName) => {
|
|
117
119
|
const fieldName = "idReader";
|
|
118
120
|
const fieldId = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
|
|
121
|
+
const initialValue = esignetCallbackFieldName
|
|
122
|
+
? {
|
|
123
|
+
dependsOn: [esignetCallbackFieldName],
|
|
124
|
+
expression: "''",
|
|
125
|
+
}
|
|
126
|
+
: "";
|
|
119
127
|
return {
|
|
120
128
|
name: fieldName,
|
|
121
129
|
customQuestionMappingId: fieldId,
|
|
@@ -127,7 +135,7 @@ const idReader = (event, sectionId, conditionals, readers) => {
|
|
|
127
135
|
defaultMessage: "ID verification",
|
|
128
136
|
},
|
|
129
137
|
hideInPreview: true,
|
|
130
|
-
initialValue
|
|
138
|
+
initialValue,
|
|
131
139
|
validator: [],
|
|
132
140
|
conditionals,
|
|
133
141
|
dividerLabel: {
|
|
@@ -242,12 +250,15 @@ const getInitialValueFromIDReader = (fieldNameInReader) => ({
|
|
|
242
250
|
});
|
|
243
251
|
exports.getInitialValueFromIDReader = getInitialValueFromIDReader;
|
|
244
252
|
const idReaderFields = (event, section, qrConfig, esignetConfig, verifiedCustomFieldMapping, conditionals = []) => {
|
|
245
|
-
const readers = [
|
|
253
|
+
const readers = [];
|
|
254
|
+
if (qrConfig) {
|
|
255
|
+
readers.push((0, exports.qr)(qrConfig));
|
|
256
|
+
}
|
|
246
257
|
const fields = [
|
|
247
258
|
(0, exports.idReader)(event, section, conditionals.concat({
|
|
248
259
|
action: "hide",
|
|
249
260
|
expression: "$form?.verified === 'verified' || $form?.verified === 'authenticated' || $form?.verified === 'failed' || $form?.verified === 'failedFetchIdDetails' || !!$form?.esignetCallback?.loading",
|
|
250
|
-
}), readers),
|
|
261
|
+
}), readers, esignetConfig?.callback.fieldName),
|
|
251
262
|
];
|
|
252
263
|
if (esignetConfig) {
|
|
253
264
|
readers.push((0, exports.esignet)(esignetConfig.esignetAuthUrl, esignetConfig.openIdProviderClientId, esignetConfig.openIdProviderClaims, esignetConfig.fieldName, esignetConfig.callback.fieldName));
|
package/build/transform.d.ts
CHANGED
package/package.json
CHANGED
package/src/forms.ts
CHANGED
|
@@ -139,9 +139,17 @@ export const idReader = (
|
|
|
139
139
|
sectionId: string,
|
|
140
140
|
conditionals: any[],
|
|
141
141
|
readers: any[],
|
|
142
|
+
/** E-Signet callback field name */
|
|
143
|
+
esignetCallbackFieldName?: string,
|
|
142
144
|
) => {
|
|
143
145
|
const fieldName: string = "idReader";
|
|
144
146
|
const fieldId: string = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
|
|
147
|
+
const initialValue = esignetCallbackFieldName
|
|
148
|
+
? {
|
|
149
|
+
dependsOn: [esignetCallbackFieldName],
|
|
150
|
+
expression: "''",
|
|
151
|
+
}
|
|
152
|
+
: "";
|
|
145
153
|
return {
|
|
146
154
|
name: fieldName,
|
|
147
155
|
customQuestionMappingId: fieldId,
|
|
@@ -153,7 +161,7 @@ export const idReader = (
|
|
|
153
161
|
defaultMessage: "ID verification",
|
|
154
162
|
},
|
|
155
163
|
hideInPreview: true,
|
|
156
|
-
initialValue
|
|
164
|
+
initialValue,
|
|
157
165
|
validator: [],
|
|
158
166
|
conditionals,
|
|
159
167
|
dividerLabel: {
|
|
@@ -323,15 +331,47 @@ export const getInitialValueFromIDReader = (fieldNameInReader: string) => ({
|
|
|
323
331
|
expression: `$form?.idReader?.${fieldNameInReader} || $form?.esignetCallback?.data?.${fieldNameInReader} || ""`,
|
|
324
332
|
});
|
|
325
333
|
|
|
326
|
-
|
|
334
|
+
// Define a type def so that a country implementor cannot
|
|
335
|
+
// provide both QR and E-Signet config undefined at the same time
|
|
336
|
+
type IDReaderParams = {
|
|
337
|
+
(
|
|
338
|
+
event: "birth" | "death",
|
|
339
|
+
section: "informant" | "mother" | "father" | "spouse" | "deceased",
|
|
340
|
+
qrConfig: QRConfig,
|
|
341
|
+
esignetConfig: ESignetConfig,
|
|
342
|
+
verifiedCustomFieldMapping: any,
|
|
343
|
+
conditionals?: any[],
|
|
344
|
+
): any[];
|
|
345
|
+
(
|
|
346
|
+
event: "birth" | "death",
|
|
347
|
+
section: "informant" | "mother" | "father" | "spouse" | "deceased",
|
|
348
|
+
qrConfig: QRConfig,
|
|
349
|
+
esignetConfig: undefined,
|
|
350
|
+
verifiedCustomFieldMapping: any,
|
|
351
|
+
conditionals?: any[],
|
|
352
|
+
): any[];
|
|
353
|
+
(
|
|
354
|
+
event: "birth" | "death",
|
|
355
|
+
section: "informant" | "mother" | "father" | "spouse" | "deceased",
|
|
356
|
+
qrConfig: undefined,
|
|
357
|
+
esignetConfig: ESignetConfig,
|
|
358
|
+
verifiedCustomFieldMapping: any,
|
|
359
|
+
conditionals?: any[],
|
|
360
|
+
): any[];
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
export const idReaderFields: IDReaderParams = (
|
|
327
364
|
event: "birth" | "death",
|
|
328
365
|
section: "informant" | "mother" | "father" | "spouse" | "deceased",
|
|
329
|
-
qrConfig: QRConfig,
|
|
366
|
+
qrConfig: QRConfig | undefined,
|
|
330
367
|
esignetConfig: ESignetConfig | undefined,
|
|
331
368
|
verifiedCustomFieldMapping: any,
|
|
332
369
|
conditionals: any[] = [],
|
|
333
370
|
) => {
|
|
334
|
-
const readers: any[] = [
|
|
371
|
+
const readers: any[] = [];
|
|
372
|
+
if (qrConfig) {
|
|
373
|
+
readers.push(qr(qrConfig));
|
|
374
|
+
}
|
|
335
375
|
const fields: any[] = [
|
|
336
376
|
idReader(
|
|
337
377
|
event,
|
|
@@ -342,6 +382,7 @@ export const idReaderFields = (
|
|
|
342
382
|
"$form?.verified === 'verified' || $form?.verified === 'authenticated' || $form?.verified === 'failed' || $form?.verified === 'failedFetchIdDetails' || !!$form?.esignetCallback?.loading",
|
|
343
383
|
}),
|
|
344
384
|
readers,
|
|
385
|
+
esignetConfig?.callback.fieldName,
|
|
345
386
|
),
|
|
346
387
|
];
|
|
347
388
|
if (esignetConfig) {
|
package/src/transform.ts
CHANGED