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

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
@@ -1,31 +1,188 @@
1
1
  /**
2
- * E-Signet popup button form definition
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
- export declare const popupButton: ({ url, }: {
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
- export declare const hidden: () => {
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
- * E-Signet popup button and hidden field form definitions
17
- * @example
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 esignet: ({ url, }: {
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[]) => {
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: () => {
120
+ type: string;
121
+ };
122
+ export declare const verified: (event: string, sectionId: string) => {
123
+ name: string;
124
+ fieldId: string;
125
+ customQuestionMappingId: string;
126
+ type: string;
127
+ custom: boolean;
128
+ label: {
129
+ id: string;
130
+ defaultMessage: string;
131
+ };
132
+ initialValue: {
133
+ dependsOn: string[];
134
+ expression: string;
135
+ };
136
+ validator: never[];
137
+ };
138
+ export declare const idPendingVerificationBanner: (event: string, sectionId: string) => {
139
+ name: string;
140
+ type: string;
141
+ fieldId: string;
142
+ hideInPreview: boolean;
143
+ custom: boolean;
144
+ bannerType: string;
145
+ idFieldName: string;
146
+ label: {
147
+ id: string;
148
+ defaultMessage: string;
149
+ };
150
+ validator: never[];
151
+ conditionals: {
152
+ action: string;
153
+ expression: string;
154
+ }[];
155
+ };
156
+ export declare const idVerificationFields: (event: string, sectionId: string) => ({
157
+ name: string;
158
+ fieldId: string;
159
+ customQuestionMappingId: string;
160
+ type: string;
161
+ custom: boolean;
162
+ label: {
163
+ id: string;
164
+ defaultMessage: string;
165
+ };
166
+ initialValue: {
167
+ dependsOn: string[];
168
+ expression: string;
169
+ };
170
+ validator: never[];
171
+ } | {
29
172
  name: string;
30
173
  type: string;
31
- }[];
174
+ fieldId: string;
175
+ hideInPreview: boolean;
176
+ custom: boolean;
177
+ bannerType: string;
178
+ idFieldName: string;
179
+ label: {
180
+ id: string;
181
+ defaultMessage: string;
182
+ };
183
+ validator: never[];
184
+ conditionals: {
185
+ action: string;
186
+ expression: string;
187
+ }[];
188
+ })[];
package/build/forms.js CHANGED
@@ -1,37 +1,218 @@
1
1
  "use strict";
2
- // @TODO: we could start building these definitions to core tbh
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.esignet = exports.hidden = exports.popupButton = void 0;
4
+ exports.idVerificationFields = exports.idPendingVerificationBanner = exports.verified = exports.qr = exports.idReader = exports.esignetHidden = exports.returnExpression = exports.esignetCallback = exports.popupButton = exports.esignet = void 0;
6
5
  /**
7
- * E-Signet popup button form definition
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
+ * ```
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
+ *
8
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: 'LINK_BUTTON',
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: "INFORMANT_AUTHENTICATION_POPUP_BUTTON",
14
- type: "POPUP_BUTTON",
15
- url,
80
+ name: 'INFORMANT_AUTHENTICATION_POPUP_BUTTON',
81
+ type: 'POPUP_BUTTON',
82
+ url
16
83
  };
17
84
  };
18
85
  exports.popupButton = popupButton;
19
- const hidden = () => {
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) => {
115
+ return {
116
+ dependsOn: ['redirectCallbackFetch'],
117
+ expression: `$form.redirectCallbackFetch?.data?.${fieldName}`
118
+ };
119
+ };
120
+ exports.returnExpression = returnExpression;
121
+ const esignetHidden = () => {
20
122
  return {
21
- name: "INFORMANT_PSUT_TOKEN",
22
- type: "HIDDEN",
123
+ name: 'INFORMANT_PSUT_TOKEN',
124
+ type: 'HIDDEN'
23
125
  };
24
126
  };
25
- exports.hidden = hidden;
127
+ exports.esignetHidden = esignetHidden;
26
128
  /**
27
- * E-Signet popup button and hidden field form definitions
28
- * @example
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 esignet = ({ url, }) => [(0, exports.popupButton)({ url }), (0, exports.hidden)()];
37
- exports.esignet = esignet;
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;
166
+ const verified = (event, sectionId) => {
167
+ const fieldName = 'verified';
168
+ const fieldId = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
169
+ return {
170
+ name: 'verified',
171
+ fieldId,
172
+ customQuestionMappingId: fieldId,
173
+ type: 'HIDDEN',
174
+ custom: true,
175
+ label: {
176
+ id: 'messages.empty',
177
+ defaultMessage: ''
178
+ },
179
+ initialValue: {
180
+ dependsOn: ['idReader'],
181
+ expression: 'Boolean($form?.idReader)? "pending":""'
182
+ },
183
+ validator: []
184
+ };
185
+ };
186
+ exports.verified = verified;
187
+ const idPendingVerificationBanner = (event, sectionId) => {
188
+ const fieldName = 'verified';
189
+ const fieldId = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
190
+ return {
191
+ name: 'idPending',
192
+ type: 'ID_VERIFICATION_BANNER',
193
+ fieldId,
194
+ hideInPreview: true,
195
+ custom: true,
196
+ bannerType: 'pending',
197
+ idFieldName: 'idReader',
198
+ label: {
199
+ id: 'messages.empty',
200
+ defaultMessage: ''
201
+ },
202
+ validator: [],
203
+ conditionals: [
204
+ {
205
+ action: 'hide',
206
+ expression: '$form?.verified !== "pending"'
207
+ }
208
+ ]
209
+ };
210
+ };
211
+ exports.idPendingVerificationBanner = idPendingVerificationBanner;
212
+ const idVerificationFields = (event, sectionId) => {
213
+ return [
214
+ (0, exports.verified)(event, sectionId),
215
+ (0, exports.idPendingVerificationBanner)(event, sectionId)
216
+ ];
217
+ };
218
+ exports.idVerificationFields = idVerificationFields;
package/package.json CHANGED
@@ -1,20 +1,18 @@
1
1
  {
2
2
  "name": "@opencrvs/mosip",
3
- "version": "1.7.0-alpha.2",
3
+ "version": "1.7.0-alpha.4",
4
4
  "license": "MPL-2.0",
5
5
  "main": "./build/index.js",
6
6
  "exports": {
7
7
  ".": "./build/index.js",
8
- "./form-definitions": "./build/form-definitions.js",
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,249 @@
1
- // @TODO: we could start building these definitions to core tbh
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 definition
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 = (
20
+ esignetAuthUrl: string,
21
+ openIdProviderClientId: string,
22
+ openIdProviderClaims: string,
23
+ fieldName: string,
24
+ callbackFieldName: string
25
+ ) => {
26
+ const url = new URL(esignetAuthUrl);
27
+
28
+ url.searchParams.append(
29
+ 'client_id',
30
+ openIdProviderClientId || 'mock-client_id'
31
+ );
32
+ url.searchParams.append('response_type', 'code');
33
+ url.searchParams.append('scope', 'openid profile');
34
+ 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
+
42
+ url.searchParams.append(
43
+ 'redirect_uri',
44
+ `${window.location.origin}${OIDP_VERIFICATION_CALLBACK}`
45
+ )
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();
54
+
55
+ return {
56
+ name: fieldName,
57
+ validator: [],
58
+ icon: {
59
+ desktop: 'Globe',
60
+ mobile: 'Fingerprint'
61
+ },
62
+ type: 'LINK_BUTTON',
63
+ custom: true,
64
+ label: {
65
+ id: 'views.idReader.label.eSignet',
66
+ defaultMessage: 'E-signet'
67
+ },
68
+ hideInPreview: true,
69
+ conditionals: [
70
+ {
71
+ action: 'disable',
72
+ expression: '!!$form.redirectCallbackFetch'
73
+ }
74
+ ],
75
+ options: {
76
+ url: esignetAuthUrl,
77
+ callback: {
78
+ params: {
79
+ code: 'esignet-mock-code'
80
+ },
81
+ trigger: callbackFieldName
82
+ }
83
+ }
84
+ };
85
+ };
86
+
7
87
  export const popupButton = ({
8
88
  /** URL to OpenCRVS-MOSIP gateway (e.g. https://opencrvs-mosip-gateway.farajaland.opencrvs.org) */
9
- url,
89
+ url
10
90
  }: {
11
91
  url: string;
12
92
  }) => {
13
93
  return {
14
- name: "INFORMANT_AUTHENTICATION_POPUP_BUTTON",
15
- type: "POPUP_BUTTON",
16
- url,
94
+ name: 'INFORMANT_AUTHENTICATION_POPUP_BUTTON',
95
+ type: 'POPUP_BUTTON',
96
+ url
97
+ };
98
+ };
99
+
100
+ /**
101
+ *
102
+ * @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)
103
+ *
104
+ */
105
+
106
+ export const esignetCallback = ({
107
+ fieldName,
108
+ getOIDPUserInfoUrl,
109
+ openIdProviderClientId
110
+ }: {
111
+ fieldName: string;
112
+ getOIDPUserInfoUrl: string;
113
+ openIdProviderClientId: string;
114
+ }) => ({
115
+ name: fieldName,
116
+ type: 'HTTP',
117
+ custom: true,
118
+ label: {
119
+ id: 'form.field.label.empty',
120
+ defaultMessage: ''
121
+ },
122
+ validator: [],
123
+ options: {
124
+ getOIDPUserInfoUrl,
125
+ headers: {
126
+ 'Content-type': 'application/json'
127
+ },
128
+ body: {
129
+ code: 'esignet-mock-code',
130
+ clientId: openIdProviderClientId,
131
+ redirectUri: ''
132
+ },
133
+ method: 'POST'
134
+ }
135
+ });
136
+
137
+ export const returnExpression = (fieldName: string) => {
138
+ return {
139
+ dependsOn: ['redirectCallbackFetch'],
140
+ expression: `$form.redirectCallbackFetch?.data?.${fieldName}`
17
141
  };
18
142
  };
19
143
 
20
- export const hidden = () => {
144
+ export const esignetHidden = () => {
21
145
  return {
22
- name: "INFORMANT_PSUT_TOKEN",
23
- type: "HIDDEN",
146
+ name: 'INFORMANT_PSUT_TOKEN',
147
+ type: 'HIDDEN'
24
148
  };
25
149
  };
26
150
 
27
151
  /**
28
- * E-Signet popup button and hidden field form definitions
29
- * @example
30
- * ```
31
- * [
32
- * // ...other fields
33
- * ...esignet({ url: "https://opencrvs-mosip-gateway.farajaland.opencrvs.org" })
34
- * ]
35
- * ```
152
+ *
153
+ * @description QR reader type definition (this field may not be supported in the latest release of OpenCRVS yet)
154
+ *
36
155
  */
37
- export const esignet = ({
38
- url,
39
- }: {
40
- /** URL to OpenCRVS-MOSIP gateway (e.g. https://opencrvs-mosip-gateway.farajaland.opencrvs.org) */
41
- url: string;
42
- }) => [popupButton({ url }), hidden()];
156
+
157
+ export const idReader = (
158
+ event: string,
159
+ sectionId: string,
160
+ conditionals: any[],
161
+ readers: any[]
162
+ ) => {
163
+ const fieldName: string = 'idReader';
164
+ const fieldId: string = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
165
+ return {
166
+ name: fieldName,
167
+ customQuestionMappingId: fieldId,
168
+ custom: true,
169
+ required: false,
170
+ type: 'ID_READER',
171
+ label: {
172
+ id: 'form.field.label.empty',
173
+ defaultMessage: ''
174
+ },
175
+ hideInPreview: true,
176
+ initialValue: '',
177
+ validator: [],
178
+ conditionals,
179
+ dividerLabel: {
180
+ id: 'views.idReader.label.or',
181
+ defaultMessage: 'Or'
182
+ },
183
+ manualInputInstructionLabel: {
184
+ id: 'views.idReader.label.manualInput',
185
+ defaultMessage: 'Complete fields below'
186
+ },
187
+ readers
188
+ };
189
+ };
190
+
191
+ export const qr = () => ({
192
+ type: 'QR'
193
+ });
194
+
195
+ export const verified = (event: string, sectionId: string) => {
196
+ const fieldName = 'verified';
197
+ const fieldId = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
198
+ return {
199
+ name: 'verified',
200
+ fieldId,
201
+ customQuestionMappingId: fieldId,
202
+ type: 'HIDDEN',
203
+ custom: true,
204
+ label: {
205
+ id: 'messages.empty',
206
+ defaultMessage: ''
207
+ },
208
+ initialValue: {
209
+ dependsOn: ['idReader'],
210
+ expression: 'Boolean($form?.idReader)? "pending":""'
211
+ },
212
+ validator: []
213
+ };
214
+ };
215
+
216
+ export const idPendingVerificationBanner = (
217
+ event: string,
218
+ sectionId: string
219
+ ) => {
220
+ const fieldName = 'verified';
221
+ const fieldId = `${event}.${sectionId}.${sectionId}-view-group.${fieldName}`;
222
+ return {
223
+ name: 'idPending',
224
+ type: 'ID_VERIFICATION_BANNER',
225
+ fieldId,
226
+ hideInPreview: true,
227
+ custom: true,
228
+ bannerType: 'pending',
229
+ idFieldName: 'idReader',
230
+ label: {
231
+ id: 'messages.empty',
232
+ defaultMessage: ''
233
+ },
234
+ validator: [],
235
+ conditionals: [
236
+ {
237
+ action: 'hide',
238
+ expression: '$form?.verified !== "pending"'
239
+ }
240
+ ]
241
+ };
242
+ };
243
+
244
+ export const idVerificationFields = (event: string, sectionId: string) => {
245
+ return [
246
+ verified(event, sectionId),
247
+ idPendingVerificationBanner(event, sectionId)
248
+ ];
249
+ };