@opencrvs/mosip 1.7.0-alpha.2 → 1.7.0-alpha.3
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 +106 -16
- package/build/forms.js +150 -22
- package/package.json +3 -5
- package/src/forms.ts +173 -24
package/build/forms.d.ts
CHANGED
|
@@ -1,31 +1,121 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* E-Signet popup button form
|
|
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
|
+
* ```
|
|
3
10
|
*/
|
|
4
|
-
|
|
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, 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
|
+
options: {
|
|
35
|
+
url: string;
|
|
36
|
+
callback: {
|
|
37
|
+
params: {
|
|
38
|
+
code: string;
|
|
39
|
+
};
|
|
40
|
+
trigger: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export declare const popupButton: ({ url }: {
|
|
5
45
|
url: string;
|
|
6
46
|
}) => {
|
|
7
47
|
name: string;
|
|
8
48
|
type: string;
|
|
9
49
|
url: string;
|
|
10
50
|
};
|
|
11
|
-
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @description esignet callback button form definition. Calls server/esignet-api /esignet/get-oidp-user-info (this field may not be supported in the latest release of OpenCRVS yet)
|
|
54
|
+
*
|
|
55
|
+
*/
|
|
56
|
+
export declare const esignetCallback: ({ fieldName, getOIDPUserInfoUrl, openIdProviderClientId }: {
|
|
57
|
+
fieldName: string;
|
|
58
|
+
getOIDPUserInfoUrl: string;
|
|
59
|
+
openIdProviderClientId: string;
|
|
60
|
+
}) => {
|
|
61
|
+
name: string;
|
|
62
|
+
type: string;
|
|
63
|
+
custom: boolean;
|
|
64
|
+
label: {
|
|
65
|
+
id: string;
|
|
66
|
+
defaultMessage: string;
|
|
67
|
+
};
|
|
68
|
+
validator: never[];
|
|
69
|
+
options: {
|
|
70
|
+
getOIDPUserInfoUrl: string;
|
|
71
|
+
headers: {
|
|
72
|
+
'Content-type': string;
|
|
73
|
+
};
|
|
74
|
+
body: {
|
|
75
|
+
code: string;
|
|
76
|
+
clientId: string;
|
|
77
|
+
redirectUri: string;
|
|
78
|
+
};
|
|
79
|
+
method: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
export declare const returnExpression: (fieldName: string) => {
|
|
83
|
+
dependsOn: string[];
|
|
84
|
+
expression: string;
|
|
85
|
+
};
|
|
86
|
+
export declare const esignetHidden: () => {
|
|
12
87
|
name: string;
|
|
13
88
|
type: string;
|
|
14
89
|
};
|
|
15
90
|
/**
|
|
16
|
-
*
|
|
17
|
-
* @
|
|
18
|
-
*
|
|
19
|
-
* [
|
|
20
|
-
* // ...other fields
|
|
21
|
-
* ...esignet({ url: "https://opencrvs-mosip-gateway.farajaland.opencrvs.org" })
|
|
22
|
-
* ]
|
|
23
|
-
* ```
|
|
91
|
+
*
|
|
92
|
+
* @description QR reader type definition (this field may not be supported in the latest release of OpenCRVS yet)
|
|
93
|
+
*
|
|
24
94
|
*/
|
|
25
|
-
export declare const
|
|
26
|
-
/** URL to OpenCRVS-MOSIP gateway (e.g. https://opencrvs-mosip-gateway.farajaland.opencrvs.org) */
|
|
27
|
-
url: string;
|
|
28
|
-
}) => {
|
|
95
|
+
export declare const idReader: (event: string, sectionId: string, conditionals: any[], readers: any[]) => {
|
|
29
96
|
name: string;
|
|
97
|
+
customQuestionMappingId: string;
|
|
98
|
+
custom: boolean;
|
|
99
|
+
required: boolean;
|
|
100
|
+
type: string;
|
|
101
|
+
label: {
|
|
102
|
+
id: string;
|
|
103
|
+
defaultMessage: string;
|
|
104
|
+
};
|
|
105
|
+
hideInPreview: boolean;
|
|
106
|
+
initialValue: string;
|
|
107
|
+
validator: never[];
|
|
108
|
+
conditionals: any[];
|
|
109
|
+
dividerLabel: {
|
|
110
|
+
id: string;
|
|
111
|
+
defaultMessage: string;
|
|
112
|
+
};
|
|
113
|
+
manualInputInstructionLabel: {
|
|
114
|
+
id: string;
|
|
115
|
+
defaultMessage: string;
|
|
116
|
+
};
|
|
117
|
+
readers: any[];
|
|
118
|
+
};
|
|
119
|
+
export declare const qr: () => {
|
|
30
120
|
type: string;
|
|
31
|
-
}
|
|
121
|
+
};
|
package/build/forms.js
CHANGED
|
@@ -1,37 +1,165 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// @TODO:
|
|
3
|
-
// @TODO: add renovate or something to listen for core updates and create a PRs, then we get an error message if we have broken this
|
|
2
|
+
// @TODO: Yet to be implemented! Placeholders for NPM publish.
|
|
4
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
4
|
+
exports.qr = exports.idReader = exports.esignetHidden = exports.returnExpression = exports.esignetCallback = exports.popupButton = exports.esignet = void 0;
|
|
6
5
|
/**
|
|
7
|
-
* E-Signet popup button form
|
|
6
|
+
* E-Signet popup button and hidden field form definitions
|
|
7
|
+
* @example
|
|
8
|
+
* ```
|
|
9
|
+
* [
|
|
10
|
+
* // ...other fields
|
|
11
|
+
* ...esignet({ url: "https://opencrvs-mosip-gateway.farajaland.opencrvs.org" })
|
|
12
|
+
* ]
|
|
13
|
+
* ```
|
|
8
14
|
*/
|
|
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, 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 || 'mock-claims');
|
|
27
|
+
url.searchParams.append('state', 'trigger-onmount');
|
|
28
|
+
/*
|
|
29
|
+
|
|
30
|
+
TODO: Understand from Tahmid about how to handle this:
|
|
31
|
+
|
|
32
|
+
url.searchParams.append(
|
|
33
|
+
'redirect_uri',
|
|
34
|
+
`${window.location.origin}${OIDP_VERIFICATION_CALLBACK}`
|
|
35
|
+
)
|
|
36
|
+
const stateToBeSent: INidCallbackState = {
|
|
37
|
+
pathname: currentPathname,
|
|
38
|
+
declarationId: declarationId,
|
|
39
|
+
section: currentSection
|
|
40
|
+
}
|
|
41
|
+
url.searchParams.append('state', JSON.stringify(stateToBeSent))
|
|
42
|
+
*/
|
|
43
|
+
window.location.href = url.toString();
|
|
44
|
+
return {
|
|
45
|
+
name: fieldName,
|
|
46
|
+
validator: [],
|
|
47
|
+
icon: {
|
|
48
|
+
desktop: 'Globe',
|
|
49
|
+
mobile: 'Fingerprint'
|
|
50
|
+
},
|
|
51
|
+
type: "REDIRECT",
|
|
52
|
+
custom: true,
|
|
53
|
+
label: {
|
|
54
|
+
id: 'views.idReader.label.eSignet',
|
|
55
|
+
defaultMessage: 'E-signet'
|
|
56
|
+
},
|
|
57
|
+
hideInPreview: true,
|
|
58
|
+
conditionals: [
|
|
59
|
+
{
|
|
60
|
+
action: "disable",
|
|
61
|
+
expression: "!!$form.redirectCallbackFetch",
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
options: {
|
|
65
|
+
url: esignetAuthUrl,
|
|
66
|
+
callback: {
|
|
67
|
+
params: {
|
|
68
|
+
code: "esignet-mock-code",
|
|
69
|
+
},
|
|
70
|
+
trigger: callbackFieldName
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
exports.esignet = esignet;
|
|
9
76
|
const popupButton = ({
|
|
10
77
|
/** URL to OpenCRVS-MOSIP gateway (e.g. https://opencrvs-mosip-gateway.farajaland.opencrvs.org) */
|
|
11
|
-
url
|
|
78
|
+
url }) => {
|
|
12
79
|
return {
|
|
13
|
-
name:
|
|
14
|
-
type:
|
|
15
|
-
url
|
|
80
|
+
name: 'INFORMANT_AUTHENTICATION_POPUP_BUTTON',
|
|
81
|
+
type: 'POPUP_BUTTON',
|
|
82
|
+
url
|
|
16
83
|
};
|
|
17
84
|
};
|
|
18
85
|
exports.popupButton = popupButton;
|
|
19
|
-
|
|
86
|
+
/**
|
|
87
|
+
*
|
|
88
|
+
* @description esignet callback button form definition. Calls server/esignet-api /esignet/get-oidp-user-info (this field may not be supported in the latest release of OpenCRVS yet)
|
|
89
|
+
*
|
|
90
|
+
*/
|
|
91
|
+
const esignetCallback = ({ fieldName, getOIDPUserInfoUrl, openIdProviderClientId }) => ({
|
|
92
|
+
name: fieldName,
|
|
93
|
+
type: 'HTTP',
|
|
94
|
+
custom: true,
|
|
95
|
+
label: {
|
|
96
|
+
id: 'form.field.label.empty',
|
|
97
|
+
defaultMessage: ''
|
|
98
|
+
},
|
|
99
|
+
validator: [],
|
|
100
|
+
options: {
|
|
101
|
+
getOIDPUserInfoUrl,
|
|
102
|
+
headers: {
|
|
103
|
+
'Content-type': 'application/json'
|
|
104
|
+
},
|
|
105
|
+
body: {
|
|
106
|
+
code: "esignet-mock-code",
|
|
107
|
+
clientId: openIdProviderClientId,
|
|
108
|
+
redirectUri: ""
|
|
109
|
+
},
|
|
110
|
+
method: 'POST'
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
exports.esignetCallback = esignetCallback;
|
|
114
|
+
const returnExpression = (fieldName) => {
|
|
20
115
|
return {
|
|
21
|
-
|
|
22
|
-
|
|
116
|
+
dependsOn: ["redirectCallbackFetch"],
|
|
117
|
+
expression: `$form.redirectCallbackFetch?.data?.${fieldName}`,
|
|
23
118
|
};
|
|
24
119
|
};
|
|
25
|
-
exports.
|
|
120
|
+
exports.returnExpression = returnExpression;
|
|
121
|
+
const esignetHidden = () => {
|
|
122
|
+
return {
|
|
123
|
+
name: 'INFORMANT_PSUT_TOKEN',
|
|
124
|
+
type: 'HIDDEN'
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
exports.esignetHidden = esignetHidden;
|
|
26
128
|
/**
|
|
27
|
-
*
|
|
28
|
-
* @
|
|
29
|
-
*
|
|
30
|
-
* [
|
|
31
|
-
* // ...other fields
|
|
32
|
-
* ...esignet({ url: "https://opencrvs-mosip-gateway.farajaland.opencrvs.org" })
|
|
33
|
-
* ]
|
|
34
|
-
* ```
|
|
129
|
+
*
|
|
130
|
+
* @description QR reader type definition (this field may not be supported in the latest release of OpenCRVS yet)
|
|
131
|
+
*
|
|
35
132
|
*/
|
|
36
|
-
const
|
|
37
|
-
|
|
133
|
+
const idReader = (event, sectionId, conditionals, readers) => {
|
|
134
|
+
const fieldName = 'idReader';
|
|
135
|
+
const fieldId = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
|
|
136
|
+
return {
|
|
137
|
+
name: fieldName,
|
|
138
|
+
customQuestionMappingId: fieldId,
|
|
139
|
+
custom: true,
|
|
140
|
+
required: false,
|
|
141
|
+
type: 'ID_READER',
|
|
142
|
+
label: {
|
|
143
|
+
id: 'form.field.label.empty',
|
|
144
|
+
defaultMessage: ''
|
|
145
|
+
},
|
|
146
|
+
hideInPreview: true,
|
|
147
|
+
initialValue: '',
|
|
148
|
+
validator: [],
|
|
149
|
+
conditionals,
|
|
150
|
+
dividerLabel: {
|
|
151
|
+
id: 'views.idReader.label.or',
|
|
152
|
+
defaultMessage: 'Or'
|
|
153
|
+
},
|
|
154
|
+
manualInputInstructionLabel: {
|
|
155
|
+
id: 'views.idReader.label.manualInput',
|
|
156
|
+
defaultMessage: 'Complete fields below'
|
|
157
|
+
},
|
|
158
|
+
readers
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
exports.idReader = idReader;
|
|
162
|
+
const qr = () => ({
|
|
163
|
+
type: 'QR'
|
|
164
|
+
});
|
|
165
|
+
exports.qr = qr;
|
package/package.json
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencrvs/mosip",
|
|
3
|
-
"version": "1.7.0-alpha.
|
|
3
|
+
"version": "1.7.0-alpha.3",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./build/index.js",
|
|
8
|
-
"./
|
|
8
|
+
"./forms": "./build/forms.js",
|
|
9
9
|
"./events": "./build/events.js"
|
|
10
10
|
},
|
|
11
11
|
"typings": "build/index.d.ts",
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "tsc"
|
|
14
14
|
},
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"@hapi/hapi": "^20.0.1"
|
|
17
|
-
},
|
|
15
|
+
"dependencies": {},
|
|
18
16
|
"devDependencies": {
|
|
19
17
|
"@types/hapi__hapi": "^20.0.0",
|
|
20
18
|
"@types/node-fetch": "^2.6.11",
|
package/src/forms.ts
CHANGED
|
@@ -1,42 +1,191 @@
|
|
|
1
|
-
// @TODO:
|
|
2
|
-
// @TODO: add renovate or something to listen for core updates and create a PRs, then we get an error message if we have broken this
|
|
1
|
+
// @TODO: Yet to be implemented! Placeholders for NPM publish.
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
|
-
* E-Signet popup button form
|
|
4
|
+
* E-Signet popup button and hidden field form definitions
|
|
5
|
+
* @example
|
|
6
|
+
* ```
|
|
7
|
+
* [
|
|
8
|
+
* // ...other fields
|
|
9
|
+
* ...esignet({ url: "https://opencrvs-mosip-gateway.farajaland.opencrvs.org" })
|
|
10
|
+
* ]
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
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
|
+
*
|
|
6
18
|
*/
|
|
19
|
+
export const esignet = (esignetAuthUrl: string, openIdProviderClientId: string, openIdProviderClaims: string, fieldName: string, callbackFieldName: string) => {
|
|
20
|
+
|
|
21
|
+
const url = new URL(esignetAuthUrl)
|
|
22
|
+
|
|
23
|
+
url.searchParams.append(
|
|
24
|
+
'client_id',
|
|
25
|
+
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')
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
|
|
35
|
+
TODO: Understand from Tahmid about how to handle this:
|
|
36
|
+
|
|
37
|
+
url.searchParams.append(
|
|
38
|
+
'redirect_uri',
|
|
39
|
+
`${window.location.origin}${OIDP_VERIFICATION_CALLBACK}`
|
|
40
|
+
)
|
|
41
|
+
const stateToBeSent: INidCallbackState = {
|
|
42
|
+
pathname: currentPathname,
|
|
43
|
+
declarationId: declarationId,
|
|
44
|
+
section: currentSection
|
|
45
|
+
}
|
|
46
|
+
url.searchParams.append('state', JSON.stringify(stateToBeSent))
|
|
47
|
+
*/
|
|
48
|
+
window.location.href = url.toString()
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
name: fieldName,
|
|
52
|
+
validator: [],
|
|
53
|
+
icon: {
|
|
54
|
+
desktop: 'Globe',
|
|
55
|
+
mobile: 'Fingerprint'
|
|
56
|
+
},
|
|
57
|
+
type: "REDIRECT",
|
|
58
|
+
custom: true,
|
|
59
|
+
label: {
|
|
60
|
+
id: 'views.idReader.label.eSignet',
|
|
61
|
+
defaultMessage: 'E-signet'
|
|
62
|
+
},
|
|
63
|
+
hideInPreview: true,
|
|
64
|
+
conditionals: [
|
|
65
|
+
{
|
|
66
|
+
action: "disable",
|
|
67
|
+
expression: "!!$form.redirectCallbackFetch",
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
options: {
|
|
71
|
+
url: esignetAuthUrl,
|
|
72
|
+
callback: {
|
|
73
|
+
params: {
|
|
74
|
+
code: "esignet-mock-code",
|
|
75
|
+
},
|
|
76
|
+
trigger: callbackFieldName
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
|
|
7
82
|
export const popupButton = ({
|
|
8
83
|
/** URL to OpenCRVS-MOSIP gateway (e.g. https://opencrvs-mosip-gateway.farajaland.opencrvs.org) */
|
|
9
|
-
url
|
|
84
|
+
url
|
|
10
85
|
}: {
|
|
11
86
|
url: string;
|
|
12
87
|
}) => {
|
|
13
88
|
return {
|
|
14
|
-
name:
|
|
15
|
-
type:
|
|
16
|
-
url
|
|
89
|
+
name: 'INFORMANT_AUTHENTICATION_POPUP_BUTTON',
|
|
90
|
+
type: 'POPUP_BUTTON',
|
|
91
|
+
url
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
*
|
|
97
|
+
* @description esignet callback button form definition. Calls server/esignet-api /esignet/get-oidp-user-info (this field may not be supported in the latest release of OpenCRVS yet)
|
|
98
|
+
*
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
export const esignetCallback = ({
|
|
102
|
+
fieldName,
|
|
103
|
+
getOIDPUserInfoUrl,
|
|
104
|
+
openIdProviderClientId
|
|
105
|
+
}: {
|
|
106
|
+
fieldName: string;
|
|
107
|
+
getOIDPUserInfoUrl: string;
|
|
108
|
+
openIdProviderClientId: string;
|
|
109
|
+
}) => ({
|
|
110
|
+
name: fieldName,
|
|
111
|
+
type: 'HTTP',
|
|
112
|
+
custom: true,
|
|
113
|
+
label: {
|
|
114
|
+
id: 'form.field.label.empty',
|
|
115
|
+
defaultMessage: ''
|
|
116
|
+
},
|
|
117
|
+
validator: [],
|
|
118
|
+
options: {
|
|
119
|
+
getOIDPUserInfoUrl,
|
|
120
|
+
headers: {
|
|
121
|
+
'Content-type': 'application/json'
|
|
122
|
+
},
|
|
123
|
+
body: {
|
|
124
|
+
code: "esignet-mock-code",
|
|
125
|
+
clientId: openIdProviderClientId,
|
|
126
|
+
redirectUri: ""
|
|
127
|
+
},
|
|
128
|
+
method: 'POST'
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
export const returnExpression = (fieldName: string) => {
|
|
133
|
+
return {
|
|
134
|
+
dependsOn: ["redirectCallbackFetch"],
|
|
135
|
+
expression: `$form.redirectCallbackFetch?.data?.${fieldName}`,
|
|
17
136
|
};
|
|
18
137
|
};
|
|
19
138
|
|
|
20
|
-
export const
|
|
139
|
+
export const esignetHidden = () => {
|
|
21
140
|
return {
|
|
22
|
-
name:
|
|
23
|
-
type:
|
|
141
|
+
name: 'INFORMANT_PSUT_TOKEN',
|
|
142
|
+
type: 'HIDDEN'
|
|
24
143
|
};
|
|
25
144
|
};
|
|
26
145
|
|
|
27
146
|
/**
|
|
28
|
-
*
|
|
29
|
-
* @
|
|
30
|
-
*
|
|
31
|
-
* [
|
|
32
|
-
* // ...other fields
|
|
33
|
-
* ...esignet({ url: "https://opencrvs-mosip-gateway.farajaland.opencrvs.org" })
|
|
34
|
-
* ]
|
|
35
|
-
* ```
|
|
147
|
+
*
|
|
148
|
+
* @description QR reader type definition (this field may not be supported in the latest release of OpenCRVS yet)
|
|
149
|
+
*
|
|
36
150
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
151
|
+
|
|
152
|
+
export const idReader = (
|
|
153
|
+
event: string,
|
|
154
|
+
sectionId: string,
|
|
155
|
+
conditionals: any[],
|
|
156
|
+
readers: any[]
|
|
157
|
+
) => {
|
|
158
|
+
const fieldName: string = 'idReader';
|
|
159
|
+
const fieldId: string = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
|
|
160
|
+
return {
|
|
161
|
+
name: fieldName,
|
|
162
|
+
customQuestionMappingId: fieldId,
|
|
163
|
+
custom: true,
|
|
164
|
+
required: false,
|
|
165
|
+
type: 'ID_READER',
|
|
166
|
+
label: {
|
|
167
|
+
id: 'form.field.label.empty',
|
|
168
|
+
defaultMessage: ''
|
|
169
|
+
},
|
|
170
|
+
hideInPreview: true,
|
|
171
|
+
initialValue: '',
|
|
172
|
+
validator: [],
|
|
173
|
+
conditionals,
|
|
174
|
+
dividerLabel: {
|
|
175
|
+
id: 'views.idReader.label.or',
|
|
176
|
+
defaultMessage: 'Or'
|
|
177
|
+
},
|
|
178
|
+
manualInputInstructionLabel: {
|
|
179
|
+
id: 'views.idReader.label.manualInput',
|
|
180
|
+
defaultMessage: 'Complete fields below'
|
|
181
|
+
},
|
|
182
|
+
readers
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export const qr = () => ({
|
|
187
|
+
type: 'QR'
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|