@opencrvs/mosip 1.7.0-alpha.4 → 1.7.0-alpha.5

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 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
- code: string;
38
+ state: string;
39
39
  };
40
40
  trigger: string;
41
41
  };
@@ -72,17 +72,11 @@ export declare const esignetCallback: ({ fieldName, getOIDPUserInfoUrl, openIdPr
72
72
  'Content-type': string;
73
73
  };
74
74
  body: {
75
- code: string;
76
75
  clientId: string;
77
- redirectUri: string;
78
76
  };
79
77
  method: string;
80
78
  };
81
79
  };
82
- export declare const returnExpression: (fieldName: string) => {
83
- dependsOn: string[];
84
- expression: string;
85
- };
86
80
  export declare const esignetHidden: () => {
87
81
  name: string;
88
82
  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.returnExpression = exports.esignetCallback = exports.popupButton = exports.esignet = void 0;
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 || '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();
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: esignetAuthUrl,
50
+ url: url.toString(),
66
51
  callback: {
67
52
  params: {
68
- code: 'esignet-mock-code'
53
+ state: 'fetch-on-mount'
69
54
  },
70
55
  trigger: callbackFieldName
71
56
  }
@@ -103,21 +88,12 @@ const esignetCallback = ({ fieldName, getOIDPUserInfoUrl, openIdProviderClientId
103
88
  'Content-type': 'application/json'
104
89
  },
105
90
  body: {
106
- code: 'esignet-mock-code',
107
- clientId: openIdProviderClientId,
108
- redirectUri: ''
91
+ clientId: openIdProviderClientId
109
92
  },
110
93
  method: 'POST'
111
94
  }
112
95
  });
113
96
  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
97
  const esignetHidden = () => {
122
98
  return {
123
99
  name: 'INFORMANT_PSUT_TOKEN',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/mosip",
3
- "version": "1.7.0-alpha.4",
3
+ "version": "1.7.0-alpha.5",
4
4
  "license": "MPL-2.0",
5
5
  "main": "./build/index.js",
6
6
  "exports": {
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 || 'mock-claims');
36
- url.searchParams.append('state', 'trigger-onmount');
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}${OIDP_VERIFICATION_CALLBACK}`
41
+ `${window.location.origin}/drafts/${window.location.pathname.split("/")[2]}/events/${event}/${sectionId}/group/${sectionId}`
45
42
  )
46
- const stateToBeSent: INidCallbackState = {
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: esignetAuthUrl,
66
+ url: url.toString(),
77
67
  callback: {
78
68
  params: {
79
- code: 'esignet-mock-code'
69
+ state: 'fetch-on-mount'
80
70
  },
81
71
  trigger: callbackFieldName
82
72
  }
@@ -126,21 +116,13 @@ export const esignetCallback = ({
126
116
  'Content-type': 'application/json'
127
117
  },
128
118
  body: {
129
- code: 'esignet-mock-code',
130
- clientId: openIdProviderClientId,
131
- redirectUri: ''
119
+ clientId: openIdProviderClientId
132
120
  },
121
+
133
122
  method: 'POST'
134
123
  }
135
124
  });
136
125
 
137
- export const returnExpression = (fieldName: string) => {
138
- return {
139
- dependsOn: ['redirectCallbackFetch'],
140
- expression: `$form.redirectCallbackFetch?.data?.${fieldName}`
141
- };
142
- };
143
-
144
126
  export const esignetHidden = () => {
145
127
  return {
146
128
  name: 'INFORMANT_PSUT_TOKEN',