@opencrvs/mosip 1.9.2-mock.1 → 2.0.0-rc.2
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/api.d.ts +48 -29
- package/build/api.js +42 -5
- package/build/index.d.ts +1 -3
- package/build/index.js +1 -3
- package/package.json +5 -5
- package/src/api.ts +55 -32
- package/src/index.ts +1 -3
- package/build/events.d.ts +0 -30
- package/build/events.js +0 -80
- package/build/forms.d.ts +0 -253
- package/build/forms.js +0 -298
- package/build/transform.d.ts +0 -77
- package/build/transform.js +0 -19
- package/src/events.ts +0 -105
- package/src/forms.ts +0 -455
- package/src/transform.ts +0 -100
package/build/forms.d.ts
DELETED
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* E-Signet popup button and hidden field form definitions
|
|
3
|
-
* @example
|
|
4
|
-
* ```
|
|
5
|
-
* [
|
|
6
|
-
* // ...other fields
|
|
7
|
-
* ...esignet({ url: "https://opencrvs-mosip-gateway.farajaland.opencrvs.org" })
|
|
8
|
-
* ]
|
|
9
|
-
* ```
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @description E-Signet REDIRECT button form definition. Calls E-Signet /authorize (this field may not be supported in the latest release of OpenCRVS yet)
|
|
14
|
-
*
|
|
15
|
-
*/
|
|
16
|
-
export declare const esignet: (esignetAuthUrl: string, openIdProviderClientId: string, openIdProviderClaims: string | undefined, fieldName: string, callbackFieldName: string) => {
|
|
17
|
-
name: string;
|
|
18
|
-
validator: never[];
|
|
19
|
-
icon: {
|
|
20
|
-
desktop: string;
|
|
21
|
-
mobile: string;
|
|
22
|
-
};
|
|
23
|
-
type: string;
|
|
24
|
-
custom: boolean;
|
|
25
|
-
label: {
|
|
26
|
-
id: string;
|
|
27
|
-
defaultMessage: string;
|
|
28
|
-
};
|
|
29
|
-
hideInPreview: boolean;
|
|
30
|
-
conditionals: {
|
|
31
|
-
action: string;
|
|
32
|
-
expression: string;
|
|
33
|
-
}[];
|
|
34
|
-
mapping: {
|
|
35
|
-
mutation: {
|
|
36
|
-
operation: string;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
options: {
|
|
40
|
-
url: string;
|
|
41
|
-
callback: {
|
|
42
|
-
params: {
|
|
43
|
-
state: string;
|
|
44
|
-
};
|
|
45
|
-
trigger: string;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
export declare const popupButton: ({ url, }: {
|
|
50
|
-
url: string;
|
|
51
|
-
}) => {
|
|
52
|
-
name: string;
|
|
53
|
-
type: string;
|
|
54
|
-
url: string;
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
58
|
-
* @description esignet callback button form definition. Calls https://mosip-api.{{hostname}}/esignet/get-oidp-user-info
|
|
59
|
-
*
|
|
60
|
-
*/
|
|
61
|
-
export declare const esignetCallback: ({ fieldName, mosipAPIUserInfoUrl, openIdProviderClientId, }: {
|
|
62
|
-
fieldName: string;
|
|
63
|
-
mosipAPIUserInfoUrl: string;
|
|
64
|
-
openIdProviderClientId: string;
|
|
65
|
-
}) => {
|
|
66
|
-
name: string;
|
|
67
|
-
type: string;
|
|
68
|
-
custom: boolean;
|
|
69
|
-
label: {
|
|
70
|
-
id: string;
|
|
71
|
-
defaultMessage: string;
|
|
72
|
-
};
|
|
73
|
-
validator: never[];
|
|
74
|
-
hideInPreview: boolean;
|
|
75
|
-
mapping: {
|
|
76
|
-
mutation: {
|
|
77
|
-
operation: string;
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
options: {
|
|
81
|
-
url: string;
|
|
82
|
-
headers: {
|
|
83
|
-
"Content-type": string;
|
|
84
|
-
};
|
|
85
|
-
body: {
|
|
86
|
-
clientId: string;
|
|
87
|
-
redirectUri: string;
|
|
88
|
-
};
|
|
89
|
-
method: string;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
export declare const esignetHidden: () => {
|
|
93
|
-
name: string;
|
|
94
|
-
type: string;
|
|
95
|
-
};
|
|
96
|
-
export declare const idReader: (event: string, sectionId: string, conditionals: any[], readers: any[], esignetCallbackFieldName?: string) => {
|
|
97
|
-
name: string;
|
|
98
|
-
customQuestionMappingId: string;
|
|
99
|
-
custom: boolean;
|
|
100
|
-
required: boolean;
|
|
101
|
-
type: string;
|
|
102
|
-
label: {
|
|
103
|
-
id: string;
|
|
104
|
-
defaultMessage: string;
|
|
105
|
-
};
|
|
106
|
-
hideInPreview: boolean;
|
|
107
|
-
initialValue: string | {
|
|
108
|
-
dependsOn: string[];
|
|
109
|
-
expression: string;
|
|
110
|
-
};
|
|
111
|
-
validator: never[];
|
|
112
|
-
conditionals: any[];
|
|
113
|
-
dividerLabel: {
|
|
114
|
-
id: string;
|
|
115
|
-
defaultMessage: string;
|
|
116
|
-
};
|
|
117
|
-
manualInputInstructionLabel: {
|
|
118
|
-
id: string;
|
|
119
|
-
defaultMessage: string;
|
|
120
|
-
};
|
|
121
|
-
mapping: {
|
|
122
|
-
mutation: {
|
|
123
|
-
operation: string;
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
readers: any[];
|
|
127
|
-
};
|
|
128
|
-
type MessageDescriptor = {
|
|
129
|
-
id: string;
|
|
130
|
-
defaultMessage: string;
|
|
131
|
-
description?: string;
|
|
132
|
-
};
|
|
133
|
-
interface QRValidation {
|
|
134
|
-
rule: Record<string, unknown>;
|
|
135
|
-
errorMessage: MessageDescriptor;
|
|
136
|
-
}
|
|
137
|
-
interface QRConfig {
|
|
138
|
-
validation: QRValidation;
|
|
139
|
-
}
|
|
140
|
-
export declare const qr: ({ validation }: QRConfig) => {
|
|
141
|
-
type: string;
|
|
142
|
-
validation: QRValidation;
|
|
143
|
-
};
|
|
144
|
-
interface ESignetConfig {
|
|
145
|
-
esignetAuthUrl: string;
|
|
146
|
-
openIdProviderClientId: string;
|
|
147
|
-
openIdProviderClaims: string | undefined;
|
|
148
|
-
fieldName: string;
|
|
149
|
-
callback: {
|
|
150
|
-
fieldName: string;
|
|
151
|
-
mosipAPIUserInfoUrl: string;
|
|
152
|
-
};
|
|
153
|
-
loaderFieldName?: string;
|
|
154
|
-
}
|
|
155
|
-
export declare const verified: (event: string, sectionId: string, mapping: any, esignetConfig?: ESignetConfig) => {
|
|
156
|
-
name: string;
|
|
157
|
-
fieldId: string;
|
|
158
|
-
customQuestionMappingId: string;
|
|
159
|
-
type: string;
|
|
160
|
-
custom: boolean;
|
|
161
|
-
label: {
|
|
162
|
-
id: string;
|
|
163
|
-
defaultMessage: string;
|
|
164
|
-
};
|
|
165
|
-
initialValue: {
|
|
166
|
-
dependsOn: string[];
|
|
167
|
-
expression: string;
|
|
168
|
-
};
|
|
169
|
-
validator: never[];
|
|
170
|
-
mapping: any;
|
|
171
|
-
};
|
|
172
|
-
type VerificationStatus = "verified" | "failed" | "authenticated" | "failedFetchIdDetails";
|
|
173
|
-
export declare const idVerificationBanner: (event: string, sectionId: string, status: VerificationStatus, conditionals?: any[]) => {
|
|
174
|
-
name: string;
|
|
175
|
-
type: string;
|
|
176
|
-
fieldId: string;
|
|
177
|
-
hideInPreview: boolean;
|
|
178
|
-
custom: boolean;
|
|
179
|
-
bannerType: VerificationStatus;
|
|
180
|
-
idFieldName: string;
|
|
181
|
-
label: {
|
|
182
|
-
id: string;
|
|
183
|
-
defaultMessage: string;
|
|
184
|
-
};
|
|
185
|
-
validator: never[];
|
|
186
|
-
conditionals: any[];
|
|
187
|
-
};
|
|
188
|
-
export declare function esignetLoaderField({ event, section, fieldName, esignetCallbackFieldName, }: {
|
|
189
|
-
event: "birth" | "death";
|
|
190
|
-
section: "informant" | "mother" | "father" | "spouse" | "deceased";
|
|
191
|
-
fieldName: string;
|
|
192
|
-
esignetCallbackFieldName: string;
|
|
193
|
-
}): {
|
|
194
|
-
name: string;
|
|
195
|
-
type: string;
|
|
196
|
-
fieldId: string;
|
|
197
|
-
hideInPreview: boolean;
|
|
198
|
-
custom: boolean;
|
|
199
|
-
label: {
|
|
200
|
-
id: string;
|
|
201
|
-
defaultMessage: string;
|
|
202
|
-
};
|
|
203
|
-
loadingText: {
|
|
204
|
-
id: string;
|
|
205
|
-
defaultMessage: string;
|
|
206
|
-
};
|
|
207
|
-
conditionals: {
|
|
208
|
-
action: string;
|
|
209
|
-
expression: string;
|
|
210
|
-
}[];
|
|
211
|
-
};
|
|
212
|
-
export declare const getInitialValueFromIDReader: (fieldNameInReader: string) => {
|
|
213
|
-
dependsOn: string[];
|
|
214
|
-
expression: string;
|
|
215
|
-
};
|
|
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;
|
|
222
|
-
export declare const idVerificationFields: (event: string, sectionId: string, mapping: any, conditionals?: any[], esignetConfig?: ESignetConfig) => ({
|
|
223
|
-
name: string;
|
|
224
|
-
fieldId: string;
|
|
225
|
-
customQuestionMappingId: string;
|
|
226
|
-
type: string;
|
|
227
|
-
custom: boolean;
|
|
228
|
-
label: {
|
|
229
|
-
id: string;
|
|
230
|
-
defaultMessage: string;
|
|
231
|
-
};
|
|
232
|
-
initialValue: {
|
|
233
|
-
dependsOn: string[];
|
|
234
|
-
expression: string;
|
|
235
|
-
};
|
|
236
|
-
validator: never[];
|
|
237
|
-
mapping: any;
|
|
238
|
-
} | {
|
|
239
|
-
name: string;
|
|
240
|
-
type: string;
|
|
241
|
-
fieldId: string;
|
|
242
|
-
hideInPreview: boolean;
|
|
243
|
-
custom: boolean;
|
|
244
|
-
bannerType: VerificationStatus;
|
|
245
|
-
idFieldName: string;
|
|
246
|
-
label: {
|
|
247
|
-
id: string;
|
|
248
|
-
defaultMessage: string;
|
|
249
|
-
};
|
|
250
|
-
validator: never[];
|
|
251
|
-
conditionals: any[];
|
|
252
|
-
})[];
|
|
253
|
-
export {};
|
package/build/forms.js
DELETED
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* E-Signet popup button and hidden field form definitions
|
|
4
|
-
* @example
|
|
5
|
-
* ```
|
|
6
|
-
* [
|
|
7
|
-
* // ...other fields
|
|
8
|
-
* ...esignet({ url: "https://opencrvs-mosip-gateway.farajaland.opencrvs.org" })
|
|
9
|
-
* ]
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.idVerificationFields = exports.idReaderFields = exports.getInitialValueFromIDReader = exports.idVerificationBanner = exports.verified = exports.qr = exports.idReader = exports.esignetHidden = exports.esignetCallback = exports.popupButton = exports.esignet = void 0;
|
|
14
|
-
exports.esignetLoaderField = esignetLoaderField;
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* @description E-Signet REDIRECT button form definition. Calls E-Signet /authorize (this field may not be supported in the latest release of OpenCRVS yet)
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
const esignet = (esignetAuthUrl, openIdProviderClientId, openIdProviderClaims = "name,family_name,given_name,middle_name,birthdate,address", fieldName, callbackFieldName) => {
|
|
21
|
-
const url = new URL(esignetAuthUrl);
|
|
22
|
-
url.searchParams.append("client_id", openIdProviderClientId || "mock-client_id");
|
|
23
|
-
url.searchParams.append("response_type", "code");
|
|
24
|
-
url.searchParams.append("scope", "openid profile");
|
|
25
|
-
url.searchParams.append("acr_values", "mosip:idp:acr:static-code");
|
|
26
|
-
url.searchParams.append("claims", openIdProviderClaims);
|
|
27
|
-
url.searchParams.append("state", "fetch-on-mount");
|
|
28
|
-
url.searchParams.append("redirect_uri", "${window.location.href}");
|
|
29
|
-
return {
|
|
30
|
-
name: fieldName,
|
|
31
|
-
validator: [],
|
|
32
|
-
icon: {
|
|
33
|
-
desktop: "Globe",
|
|
34
|
-
mobile: "Fingerprint",
|
|
35
|
-
},
|
|
36
|
-
type: "LINK_BUTTON",
|
|
37
|
-
custom: true,
|
|
38
|
-
label: {
|
|
39
|
-
id: "views.idReader.label.eSignet",
|
|
40
|
-
defaultMessage: "E-signet",
|
|
41
|
-
},
|
|
42
|
-
hideInPreview: true,
|
|
43
|
-
conditionals: [
|
|
44
|
-
{
|
|
45
|
-
action: "disable",
|
|
46
|
-
expression: "!!$form.redirectCallbackFetch",
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
mapping: {
|
|
50
|
-
mutation: {
|
|
51
|
-
operation: "ignoreFieldTransformer",
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
options: {
|
|
55
|
-
url: url.toString(),
|
|
56
|
-
callback: {
|
|
57
|
-
params: {
|
|
58
|
-
state: "fetch-on-mount",
|
|
59
|
-
},
|
|
60
|
-
trigger: callbackFieldName,
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
exports.esignet = esignet;
|
|
66
|
-
const popupButton = ({
|
|
67
|
-
/** URL to OpenCRVS-MOSIP gateway (e.g. https://opencrvs-mosip-gateway.farajaland.opencrvs.org) */
|
|
68
|
-
url, }) => {
|
|
69
|
-
return {
|
|
70
|
-
name: "INFORMANT_AUTHENTICATION_POPUP_BUTTON",
|
|
71
|
-
type: "POPUP_BUTTON",
|
|
72
|
-
url,
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
exports.popupButton = popupButton;
|
|
76
|
-
/**
|
|
77
|
-
*
|
|
78
|
-
* @description esignet callback button form definition. Calls https://mosip-api.{{hostname}}/esignet/get-oidp-user-info
|
|
79
|
-
*
|
|
80
|
-
*/
|
|
81
|
-
const esignetCallback = ({ fieldName, mosipAPIUserInfoUrl, openIdProviderClientId, }) => ({
|
|
82
|
-
name: fieldName,
|
|
83
|
-
type: "HTTP",
|
|
84
|
-
custom: true,
|
|
85
|
-
label: {
|
|
86
|
-
id: "form.field.label.empty",
|
|
87
|
-
defaultMessage: "",
|
|
88
|
-
},
|
|
89
|
-
validator: [],
|
|
90
|
-
hideInPreview: true,
|
|
91
|
-
mapping: {
|
|
92
|
-
mutation: {
|
|
93
|
-
operation: "ignoreFieldTransformer",
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
options: {
|
|
97
|
-
url: mosipAPIUserInfoUrl,
|
|
98
|
-
headers: {
|
|
99
|
-
"Content-type": "application/json",
|
|
100
|
-
},
|
|
101
|
-
body: {
|
|
102
|
-
clientId: openIdProviderClientId,
|
|
103
|
-
redirectUri: "${window.location.href}",
|
|
104
|
-
},
|
|
105
|
-
method: "POST",
|
|
106
|
-
},
|
|
107
|
-
});
|
|
108
|
-
exports.esignetCallback = esignetCallback;
|
|
109
|
-
const esignetHidden = () => {
|
|
110
|
-
return {
|
|
111
|
-
name: "INFORMANT_PSUT_TOKEN",
|
|
112
|
-
type: "HIDDEN",
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
exports.esignetHidden = esignetHidden;
|
|
116
|
-
const idReader = (event, sectionId, conditionals, readers,
|
|
117
|
-
/** E-Signet callback field name */
|
|
118
|
-
esignetCallbackFieldName) => {
|
|
119
|
-
const fieldName = "idReader";
|
|
120
|
-
const fieldId = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
|
|
121
|
-
const initialValue = esignetCallbackFieldName
|
|
122
|
-
? {
|
|
123
|
-
dependsOn: [esignetCallbackFieldName],
|
|
124
|
-
expression: "''",
|
|
125
|
-
}
|
|
126
|
-
: "";
|
|
127
|
-
return {
|
|
128
|
-
name: fieldName,
|
|
129
|
-
customQuestionMappingId: fieldId,
|
|
130
|
-
custom: true,
|
|
131
|
-
required: false,
|
|
132
|
-
type: "ID_READER",
|
|
133
|
-
label: {
|
|
134
|
-
id: "form.field.label.idReader",
|
|
135
|
-
defaultMessage: "ID verification",
|
|
136
|
-
},
|
|
137
|
-
hideInPreview: true,
|
|
138
|
-
initialValue,
|
|
139
|
-
validator: [],
|
|
140
|
-
conditionals,
|
|
141
|
-
dividerLabel: {
|
|
142
|
-
id: "views.idReader.label.or",
|
|
143
|
-
defaultMessage: "Or",
|
|
144
|
-
},
|
|
145
|
-
manualInputInstructionLabel: {
|
|
146
|
-
id: "views.idReader.label.manualInput",
|
|
147
|
-
defaultMessage: "Complete fields below",
|
|
148
|
-
},
|
|
149
|
-
mapping: {
|
|
150
|
-
mutation: {
|
|
151
|
-
operation: "ignoreFieldTransformer",
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
readers,
|
|
155
|
-
};
|
|
156
|
-
};
|
|
157
|
-
exports.idReader = idReader;
|
|
158
|
-
const qr = ({ validation }) => ({
|
|
159
|
-
type: "QR",
|
|
160
|
-
validation,
|
|
161
|
-
});
|
|
162
|
-
exports.qr = qr;
|
|
163
|
-
const verified = (event, sectionId, mapping, esignetConfig) => {
|
|
164
|
-
const fieldName = "verified";
|
|
165
|
-
const fieldId = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
|
|
166
|
-
return {
|
|
167
|
-
name: "verified",
|
|
168
|
-
fieldId,
|
|
169
|
-
customQuestionMappingId: fieldId,
|
|
170
|
-
type: "HIDDEN",
|
|
171
|
-
custom: true,
|
|
172
|
-
label: {
|
|
173
|
-
id: "form.field.label.empty",
|
|
174
|
-
defaultMessage: "",
|
|
175
|
-
},
|
|
176
|
-
initialValue: esignetConfig
|
|
177
|
-
? {
|
|
178
|
-
dependsOn: ["idReader", esignetConfig.callback.fieldName],
|
|
179
|
-
expression: `Boolean($form?.idReader)? "pending"
|
|
180
|
-
: Boolean($form?.${esignetConfig.callback.fieldName}?.data)? "authenticated"
|
|
181
|
-
: Boolean($form?.${esignetConfig.callback.fieldName}?.error)? "failedFetchIdDetails"
|
|
182
|
-
: ""`,
|
|
183
|
-
}
|
|
184
|
-
: {
|
|
185
|
-
dependsOn: ["idReader"],
|
|
186
|
-
expression: 'Boolean($form?.idReader)? "pending":""',
|
|
187
|
-
},
|
|
188
|
-
validator: [],
|
|
189
|
-
mapping,
|
|
190
|
-
};
|
|
191
|
-
};
|
|
192
|
-
exports.verified = verified;
|
|
193
|
-
function capitalize(str) {
|
|
194
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
195
|
-
}
|
|
196
|
-
const idVerificationBanner = (event, sectionId, status, conditionals = []) => {
|
|
197
|
-
const fieldName = "verified";
|
|
198
|
-
const fieldId = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
|
|
199
|
-
return {
|
|
200
|
-
name: `id${capitalize(status)}.`,
|
|
201
|
-
type: "ID_VERIFICATION_BANNER",
|
|
202
|
-
fieldId,
|
|
203
|
-
hideInPreview: true,
|
|
204
|
-
custom: true,
|
|
205
|
-
bannerType: status,
|
|
206
|
-
idFieldName: status === "authenticated" || "failedFetchIdDetails"
|
|
207
|
-
? "esignetCallback"
|
|
208
|
-
: "idReader",
|
|
209
|
-
label: {
|
|
210
|
-
id: "form.field.label.empty",
|
|
211
|
-
defaultMessage: "",
|
|
212
|
-
},
|
|
213
|
-
validator: [],
|
|
214
|
-
conditionals: conditionals.concat([
|
|
215
|
-
{
|
|
216
|
-
action: "hide",
|
|
217
|
-
expression: `$form?.verified !== "${status}"`,
|
|
218
|
-
},
|
|
219
|
-
]),
|
|
220
|
-
};
|
|
221
|
-
};
|
|
222
|
-
exports.idVerificationBanner = idVerificationBanner;
|
|
223
|
-
function esignetLoaderField({ event, section, fieldName, esignetCallbackFieldName, }) {
|
|
224
|
-
const fieldId = `${event}.${section}.${section}-view-group.${fieldName}`;
|
|
225
|
-
return {
|
|
226
|
-
name: fieldName,
|
|
227
|
-
type: "LOADER",
|
|
228
|
-
fieldId,
|
|
229
|
-
hideInPreview: true,
|
|
230
|
-
custom: true,
|
|
231
|
-
label: {
|
|
232
|
-
id: "form.field.label.idReader",
|
|
233
|
-
defaultMessage: "ID verification",
|
|
234
|
-
},
|
|
235
|
-
loadingText: {
|
|
236
|
-
id: "form.field.label.authenticating.nid",
|
|
237
|
-
defaultMessage: "Fetching the person's data from E-Signet",
|
|
238
|
-
},
|
|
239
|
-
conditionals: [
|
|
240
|
-
{
|
|
241
|
-
action: "hide",
|
|
242
|
-
expression: `!$form?.${esignetCallbackFieldName}?.loading`,
|
|
243
|
-
},
|
|
244
|
-
],
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
const getInitialValueFromIDReader = (fieldNameInReader) => ({
|
|
248
|
-
dependsOn: ["idReader", "esignetCallback"],
|
|
249
|
-
expression: `$form?.idReader?.${fieldNameInReader} || $form?.esignetCallback?.data?.${fieldNameInReader} || ""`,
|
|
250
|
-
});
|
|
251
|
-
exports.getInitialValueFromIDReader = getInitialValueFromIDReader;
|
|
252
|
-
const idReaderFields = (event, section, qrConfig, esignetConfig, verifiedCustomFieldMapping, conditionals = []) => {
|
|
253
|
-
const readers = [];
|
|
254
|
-
if (qrConfig) {
|
|
255
|
-
readers.push((0, exports.qr)(qrConfig));
|
|
256
|
-
}
|
|
257
|
-
const fields = [
|
|
258
|
-
(0, exports.idReader)(event, section, conditionals.concat({
|
|
259
|
-
action: "hide",
|
|
260
|
-
expression: "$form?.verified === 'verified' || $form?.verified === 'authenticated' || $form?.verified === 'failed' || $form?.verified === 'failedFetchIdDetails' || !!$form?.esignetCallback?.loading",
|
|
261
|
-
}), readers, esignetConfig?.callback.fieldName),
|
|
262
|
-
];
|
|
263
|
-
if (esignetConfig) {
|
|
264
|
-
readers.push((0, exports.esignet)(esignetConfig.esignetAuthUrl, esignetConfig.openIdProviderClientId, esignetConfig.openIdProviderClaims, esignetConfig.fieldName, esignetConfig.callback.fieldName));
|
|
265
|
-
fields.push((0, exports.esignetCallback)({
|
|
266
|
-
fieldName: esignetConfig.callback.fieldName,
|
|
267
|
-
mosipAPIUserInfoUrl: esignetConfig.callback.mosipAPIUserInfoUrl,
|
|
268
|
-
openIdProviderClientId: esignetConfig.openIdProviderClientId,
|
|
269
|
-
}));
|
|
270
|
-
if (esignetConfig.loaderFieldName) {
|
|
271
|
-
fields.push(esignetLoaderField({
|
|
272
|
-
event,
|
|
273
|
-
section,
|
|
274
|
-
fieldName: esignetConfig.loaderFieldName,
|
|
275
|
-
esignetCallbackFieldName: esignetConfig.callback.fieldName,
|
|
276
|
-
}));
|
|
277
|
-
}
|
|
278
|
-
return [
|
|
279
|
-
...fields,
|
|
280
|
-
...(0, exports.idVerificationFields)(event, section, verifiedCustomFieldMapping, conditionals, esignetConfig),
|
|
281
|
-
];
|
|
282
|
-
}
|
|
283
|
-
return [
|
|
284
|
-
...fields,
|
|
285
|
-
...(0, exports.idVerificationFields)(event, section, verifiedCustomFieldMapping, conditionals),
|
|
286
|
-
];
|
|
287
|
-
};
|
|
288
|
-
exports.idReaderFields = idReaderFields;
|
|
289
|
-
const idVerificationFields = (event, sectionId, mapping, conditionals = [], esignetConfig) => {
|
|
290
|
-
return [
|
|
291
|
-
(0, exports.verified)(event, sectionId, mapping, esignetConfig),
|
|
292
|
-
(0, exports.idVerificationBanner)(event, sectionId, "verified", conditionals),
|
|
293
|
-
(0, exports.idVerificationBanner)(event, sectionId, "failed", conditionals),
|
|
294
|
-
(0, exports.idVerificationBanner)(event, sectionId, "authenticated", conditionals),
|
|
295
|
-
(0, exports.idVerificationBanner)(event, sectionId, "failedFetchIdDetails", conditionals),
|
|
296
|
-
];
|
|
297
|
-
};
|
|
298
|
-
exports.idVerificationFields = idVerificationFields;
|
package/build/transform.d.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
type IdentityInfo = {
|
|
2
|
-
value: string;
|
|
3
|
-
language: string;
|
|
4
|
-
};
|
|
5
|
-
export interface MOSIPPayload {
|
|
6
|
-
compositionId: string;
|
|
7
|
-
trackingId: string;
|
|
8
|
-
notification: {
|
|
9
|
-
recipientFullName: string;
|
|
10
|
-
recipientEmail: string;
|
|
11
|
-
recipientPhone: string;
|
|
12
|
-
};
|
|
13
|
-
requestFields: {
|
|
14
|
-
fullName: string;
|
|
15
|
-
dateOfBirth: string;
|
|
16
|
-
gender: string;
|
|
17
|
-
guardianOrParentName: string;
|
|
18
|
-
nationalIdNumber: string;
|
|
19
|
-
passportNumber: string;
|
|
20
|
-
drivingLicenseNumber: string;
|
|
21
|
-
deceasedStatus: boolean;
|
|
22
|
-
residenceStatus: string;
|
|
23
|
-
vid: string;
|
|
24
|
-
email: string;
|
|
25
|
-
phone: string;
|
|
26
|
-
guardianOrParentBirthCertificateNumber: string;
|
|
27
|
-
deathCertificateNumber: string;
|
|
28
|
-
birthCertificateNumber: string;
|
|
29
|
-
addressLine1: string;
|
|
30
|
-
addressLine2: string;
|
|
31
|
-
addressLine3: string;
|
|
32
|
-
district: string;
|
|
33
|
-
village: string;
|
|
34
|
-
birthRegistrationCertificate: string;
|
|
35
|
-
passportId: string;
|
|
36
|
-
nationalId: string;
|
|
37
|
-
drivingLicenseId: string;
|
|
38
|
-
addressProof: string;
|
|
39
|
-
selectedHandles: string;
|
|
40
|
-
UIN: string;
|
|
41
|
-
deathDeclared: string;
|
|
42
|
-
dateOfDeath: string;
|
|
43
|
-
};
|
|
44
|
-
metaInfo: {
|
|
45
|
-
metaData: string;
|
|
46
|
-
registrationId: string;
|
|
47
|
-
operationsData: string;
|
|
48
|
-
capturedRegisteredDevices: string;
|
|
49
|
-
creationDate: string;
|
|
50
|
-
};
|
|
51
|
-
audit: {
|
|
52
|
-
uuid: string;
|
|
53
|
-
createdAt: string;
|
|
54
|
-
eventId: string;
|
|
55
|
-
eventName: string;
|
|
56
|
-
eventType: string;
|
|
57
|
-
hostName: string;
|
|
58
|
-
hostIp: string;
|
|
59
|
-
applicationId: string;
|
|
60
|
-
applicationName: string;
|
|
61
|
-
sessionUserId: string;
|
|
62
|
-
sessionUserName: string;
|
|
63
|
-
id: string;
|
|
64
|
-
idType: string;
|
|
65
|
-
createdBy: string;
|
|
66
|
-
moduleName: string;
|
|
67
|
-
moduleId: string;
|
|
68
|
-
description: string;
|
|
69
|
-
actionTimeStamp: string;
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
type Resolver<T> = (bundle: fhir3.Bundle) => T;
|
|
73
|
-
type ResolverMap<T> = {
|
|
74
|
-
[K in keyof T]?: T[K] extends IdentityInfo[] | string | boolean | number ? Resolver<T[K]> : ResolverMap<T[K]>;
|
|
75
|
-
};
|
|
76
|
-
export declare function fhirBundleToMOSIPPayload(bundle: fhir3.Bundle, resolverMap: ResolverMap<MOSIPPayload>): MOSIPPayload;
|
|
77
|
-
export {};
|
package/build/transform.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fhirBundleToMOSIPPayload = fhirBundleToMOSIPPayload;
|
|
4
|
-
function fhirBundleToMOSIPPayload(bundle, resolverMap) {
|
|
5
|
-
const assignResolvers = (resolvers) => {
|
|
6
|
-
const result = {};
|
|
7
|
-
for (const key in resolvers) {
|
|
8
|
-
const resolver = resolvers[key];
|
|
9
|
-
if (typeof resolver === "function") {
|
|
10
|
-
result[key] = resolver(bundle);
|
|
11
|
-
}
|
|
12
|
-
else if (resolver && typeof resolver === "object") {
|
|
13
|
-
result[key] = assignResolvers(resolver);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return result;
|
|
17
|
-
};
|
|
18
|
-
return assignResolvers(resolverMap);
|
|
19
|
-
}
|