@opencrvs/mosip 1.7.0-alpha.4 → 1.7.0-alpha.6
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 +5 -8
- package/build/forms.js +9 -32
- package/package.json +1 -1
- package/src/forms.ts +15 -28
package/build/forms.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
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
14
|
*
|
|
15
15
|
*/
|
|
16
|
-
export declare const esignet: (esignetAuthUrl: string, openIdProviderClientId: string, openIdProviderClaims: string, fieldName: string, callbackFieldName: string) => {
|
|
16
|
+
export declare const esignet: (event: string, sectionId: string, esignetAuthUrl: string, openIdProviderClientId: string, openIdProviderClaims: string | undefined, fieldName: string, callbackFieldName: string) => {
|
|
17
17
|
name: string;
|
|
18
18
|
validator: never[];
|
|
19
19
|
icon: {
|
|
@@ -35,7 +35,7 @@ export declare const esignet: (esignetAuthUrl: string, openIdProviderClientId: s
|
|
|
35
35
|
url: string;
|
|
36
36
|
callback: {
|
|
37
37
|
params: {
|
|
38
|
-
|
|
38
|
+
state: string;
|
|
39
39
|
};
|
|
40
40
|
trigger: string;
|
|
41
41
|
};
|
|
@@ -53,8 +53,10 @@ export declare const popupButton: ({ url }: {
|
|
|
53
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
54
|
*
|
|
55
55
|
*/
|
|
56
|
-
export declare const esignetCallback: ({ fieldName, getOIDPUserInfoUrl, openIdProviderClientId }: {
|
|
56
|
+
export declare const esignetCallback: ({ fieldName, event, sectionId, getOIDPUserInfoUrl, openIdProviderClientId }: {
|
|
57
57
|
fieldName: string;
|
|
58
|
+
event: string;
|
|
59
|
+
sectionId: string;
|
|
58
60
|
getOIDPUserInfoUrl: string;
|
|
59
61
|
openIdProviderClientId: string;
|
|
60
62
|
}) => {
|
|
@@ -72,17 +74,12 @@ export declare const esignetCallback: ({ fieldName, getOIDPUserInfoUrl, openIdPr
|
|
|
72
74
|
'Content-type': string;
|
|
73
75
|
};
|
|
74
76
|
body: {
|
|
75
|
-
code: string;
|
|
76
77
|
clientId: string;
|
|
77
78
|
redirectUri: string;
|
|
78
79
|
};
|
|
79
80
|
method: string;
|
|
80
81
|
};
|
|
81
82
|
};
|
|
82
|
-
export declare const returnExpression: (fieldName: string) => {
|
|
83
|
-
dependsOn: string[];
|
|
84
|
-
expression: string;
|
|
85
|
-
};
|
|
86
83
|
export declare const esignetHidden: () => {
|
|
87
84
|
name: string;
|
|
88
85
|
type: string;
|
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.idVerificationFields = exports.idPendingVerificationBanner = exports.verified = exports.qr = exports.idReader = exports.esignetHidden = exports.
|
|
4
|
+
exports.idVerificationFields = exports.idPendingVerificationBanner = exports.verified = exports.qr = exports.idReader = exports.esignetHidden = exports.esignetCallback = exports.popupButton = exports.esignet = void 0;
|
|
5
5
|
/**
|
|
6
6
|
* E-Signet popup button and hidden field form definitions
|
|
7
7
|
* @example
|
|
@@ -17,30 +17,15 @@ exports.idVerificationFields = exports.idPendingVerificationBanner = exports.ver
|
|
|
17
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
18
|
*
|
|
19
19
|
*/
|
|
20
|
-
const esignet = (esignetAuthUrl, openIdProviderClientId, openIdProviderClaims, fieldName, callbackFieldName) => {
|
|
20
|
+
const esignet = (event, sectionId, esignetAuthUrl, openIdProviderClientId, openIdProviderClaims = "name,family_name,given_name,middle_name,birthdate,address", fieldName, callbackFieldName) => {
|
|
21
21
|
const url = new URL(esignetAuthUrl);
|
|
22
22
|
url.searchParams.append('client_id', openIdProviderClientId || 'mock-client_id');
|
|
23
23
|
url.searchParams.append('response_type', 'code');
|
|
24
24
|
url.searchParams.append('scope', 'openid profile');
|
|
25
25
|
url.searchParams.append('acr_values', 'mosip:idp:acr:static-code');
|
|
26
|
-
url.searchParams.append('claims', openIdProviderClaims
|
|
27
|
-
url.searchParams.append('state', '
|
|
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();
|
|
26
|
+
url.searchParams.append('claims', openIdProviderClaims);
|
|
27
|
+
url.searchParams.append('state', 'fetch-on-mount');
|
|
28
|
+
url.searchParams.append('redirect_uri', `${window.location.origin}/drafts/${window.location.pathname.split("/")[2]}/events/${event}/${sectionId}/group/${sectionId}`);
|
|
44
29
|
return {
|
|
45
30
|
name: fieldName,
|
|
46
31
|
validator: [],
|
|
@@ -62,10 +47,10 @@ const esignet = (esignetAuthUrl, openIdProviderClientId, openIdProviderClaims, f
|
|
|
62
47
|
}
|
|
63
48
|
],
|
|
64
49
|
options: {
|
|
65
|
-
url:
|
|
50
|
+
url: url.toString(),
|
|
66
51
|
callback: {
|
|
67
52
|
params: {
|
|
68
|
-
|
|
53
|
+
state: 'fetch-on-mount'
|
|
69
54
|
},
|
|
70
55
|
trigger: callbackFieldName
|
|
71
56
|
}
|
|
@@ -88,7 +73,7 @@ exports.popupButton = popupButton;
|
|
|
88
73
|
* @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
74
|
*
|
|
90
75
|
*/
|
|
91
|
-
const esignetCallback = ({ fieldName, getOIDPUserInfoUrl, openIdProviderClientId }) => ({
|
|
76
|
+
const esignetCallback = ({ fieldName, event, sectionId, getOIDPUserInfoUrl, openIdProviderClientId }) => ({
|
|
92
77
|
name: fieldName,
|
|
93
78
|
type: 'HTTP',
|
|
94
79
|
custom: true,
|
|
@@ -103,21 +88,13 @@ const esignetCallback = ({ fieldName, getOIDPUserInfoUrl, openIdProviderClientId
|
|
|
103
88
|
'Content-type': 'application/json'
|
|
104
89
|
},
|
|
105
90
|
body: {
|
|
106
|
-
code: 'esignet-mock-code',
|
|
107
91
|
clientId: openIdProviderClientId,
|
|
108
|
-
redirectUri:
|
|
92
|
+
redirectUri: `${window.location.origin}/drafts/${window.location.pathname.split("/")[2]}/events/${event}/${sectionId}/group/${sectionId}`
|
|
109
93
|
},
|
|
110
94
|
method: 'POST'
|
|
111
95
|
}
|
|
112
96
|
});
|
|
113
97
|
exports.esignetCallback = esignetCallback;
|
|
114
|
-
const returnExpression = (fieldName) => {
|
|
115
|
-
return {
|
|
116
|
-
dependsOn: ['redirectCallbackFetch'],
|
|
117
|
-
expression: `$form.redirectCallbackFetch?.data?.${fieldName}`
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
exports.returnExpression = returnExpression;
|
|
121
98
|
const esignetHidden = () => {
|
|
122
99
|
return {
|
|
123
100
|
name: 'INFORMANT_PSUT_TOKEN',
|
package/package.json
CHANGED
package/src/forms.ts
CHANGED
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
export const esignet = (
|
|
20
|
+
event: string,
|
|
21
|
+
sectionId: string,
|
|
20
22
|
esignetAuthUrl: string,
|
|
21
23
|
openIdProviderClientId: string,
|
|
22
|
-
openIdProviderClaims: string,
|
|
24
|
+
openIdProviderClaims: string = "name,family_name,given_name,middle_name,birthdate,address",
|
|
23
25
|
fieldName: string,
|
|
24
26
|
callbackFieldName: string
|
|
25
27
|
) => {
|
|
@@ -32,25 +34,13 @@ export const esignet = (
|
|
|
32
34
|
url.searchParams.append('response_type', 'code');
|
|
33
35
|
url.searchParams.append('scope', 'openid profile');
|
|
34
36
|
url.searchParams.append('acr_values', 'mosip:idp:acr:static-code');
|
|
35
|
-
url.searchParams.append('claims', openIdProviderClaims
|
|
36
|
-
url.searchParams.append('state', '
|
|
37
|
-
|
|
38
|
-
/*
|
|
39
|
-
|
|
40
|
-
TODO: Understand from Tahmid about how to handle this:
|
|
41
|
-
|
|
37
|
+
url.searchParams.append('claims', openIdProviderClaims);
|
|
38
|
+
url.searchParams.append('state', 'fetch-on-mount');
|
|
42
39
|
url.searchParams.append(
|
|
43
40
|
'redirect_uri',
|
|
44
|
-
`${window.location.origin}
|
|
41
|
+
`${window.location.origin}/drafts/${window.location.pathname.split("/")[2]}/events/${event}/${sectionId}/group/${sectionId}`
|
|
45
42
|
)
|
|
46
|
-
|
|
47
|
-
pathname: currentPathname,
|
|
48
|
-
declarationId: declarationId,
|
|
49
|
-
section: currentSection
|
|
50
|
-
}
|
|
51
|
-
url.searchParams.append('state', JSON.stringify(stateToBeSent))
|
|
52
|
-
*/
|
|
53
|
-
window.location.href = url.toString();
|
|
43
|
+
|
|
54
44
|
|
|
55
45
|
return {
|
|
56
46
|
name: fieldName,
|
|
@@ -73,10 +63,10 @@ export const esignet = (
|
|
|
73
63
|
}
|
|
74
64
|
],
|
|
75
65
|
options: {
|
|
76
|
-
url:
|
|
66
|
+
url: url.toString(),
|
|
77
67
|
callback: {
|
|
78
68
|
params: {
|
|
79
|
-
|
|
69
|
+
state: 'fetch-on-mount'
|
|
80
70
|
},
|
|
81
71
|
trigger: callbackFieldName
|
|
82
72
|
}
|
|
@@ -105,10 +95,14 @@ export const popupButton = ({
|
|
|
105
95
|
|
|
106
96
|
export const esignetCallback = ({
|
|
107
97
|
fieldName,
|
|
98
|
+
event,
|
|
99
|
+
sectionId,
|
|
108
100
|
getOIDPUserInfoUrl,
|
|
109
101
|
openIdProviderClientId
|
|
110
102
|
}: {
|
|
111
103
|
fieldName: string;
|
|
104
|
+
event: string;
|
|
105
|
+
sectionId: string;
|
|
112
106
|
getOIDPUserInfoUrl: string;
|
|
113
107
|
openIdProviderClientId: string;
|
|
114
108
|
}) => ({
|
|
@@ -126,21 +120,14 @@ export const esignetCallback = ({
|
|
|
126
120
|
'Content-type': 'application/json'
|
|
127
121
|
},
|
|
128
122
|
body: {
|
|
129
|
-
code: 'esignet-mock-code',
|
|
130
123
|
clientId: openIdProviderClientId,
|
|
131
|
-
redirectUri:
|
|
124
|
+
redirectUri: `${window.location.origin}/drafts/${window.location.pathname.split("/")[2]}/events/${event}/${sectionId}/group/${sectionId}`
|
|
132
125
|
},
|
|
126
|
+
|
|
133
127
|
method: 'POST'
|
|
134
128
|
}
|
|
135
129
|
});
|
|
136
130
|
|
|
137
|
-
export const returnExpression = (fieldName: string) => {
|
|
138
|
-
return {
|
|
139
|
-
dependsOn: ['redirectCallbackFetch'],
|
|
140
|
-
expression: `$form.redirectCallbackFetch?.data?.${fieldName}`
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
|
|
144
131
|
export const esignetHidden = () => {
|
|
145
132
|
return {
|
|
146
133
|
name: 'INFORMANT_PSUT_TOKEN',
|