@lysaab/lysa-pep 1.0.2-0 → 1.0.3-0
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/lib/Exports.d.ts +7 -7
- package/lib/Exports.js +7 -7
- package/lib/components/CountrySelect.d.ts +15 -15
- package/lib/components/CountrySelect.js +30 -30
- package/lib/components/PepAnswers.d.ts +8 -8
- package/lib/components/PepAnswers.js +131 -131
- package/lib/components/PepAnswers.scss +7 -7
- package/lib/model/Countries.d.ts +4 -4
- package/lib/model/Countries.js +1002 -1002
- package/lib/model/PepModel.d.ts +7 -7
- package/lib/model/PepModel.js +40 -40
- package/lib/model/PepTexts.d.ts +380 -322
- package/lib/model/PepTexts.js +552 -467
- package/lib/pages/IsPep/IsPepMessages.d.ts +32 -32
- package/lib/pages/IsPep/IsPepMessages.js +66 -66
- package/lib/pages/IsPep/IsPepPage.d.ts +14 -14
- package/lib/pages/IsPep/IsPepPage.js +59 -59
- package/lib/pages/PepContext.d.ts +80 -80
- package/lib/pages/PepContext.js +88 -88
- package/lib/pages/PepIsPepPage.d.ts +15 -6
- package/lib/pages/PepIsPepPage.js +59 -57
- package/lib/pages/PepRelationPage.d.ts +6 -6
- package/lib/pages/PepRelationPage.js +79 -83
- package/lib/pages/PepRolePage.d.ts +10 -9
- package/lib/pages/PepRolePage.js +127 -127
- package/lib/pages/PepStatusPage.d.ts +6 -6
- package/lib/pages/PepStatusPage.js +58 -57
- package/lib/pages/RelationPage/RelationMessages.d.ts +105 -105
- package/lib/pages/RelationPage/RelationMessages.js +283 -283
- package/lib/pages/RelationPage/RelationPage.d.ts +6 -6
- package/lib/pages/RelationPage/RelationPage.js +153 -153
- package/lib/pages/RolePage/RoleMessages.d.ts +185 -185
- package/lib/pages/RolePage/RoleMessages.js +385 -385
- package/lib/pages/RolePage/RolePage.d.ts +11 -11
- package/lib/pages/RolePage/RolePage.js +220 -220
- package/lib/pages/StatusPage/StatusMessages.d.ts +72 -72
- package/lib/pages/StatusPage/StatusMessages.js +266 -266
- package/lib/pages/StatusPage/StatusPage.d.ts +6 -6
- package/lib/pages/StatusPage/StatusPage.js +95 -95
- package/lib/utils/Possession.d.ts +1 -1
- package/lib/utils/Possession.js +18 -18
- package/package.json +57 -57
- package/src/Exports.ts +12 -12
- package/src/components/CountrySelect.tsx +47 -47
- package/src/components/PepAnswers.scss +7 -7
- package/src/components/PepAnswers.tsx +252 -252
- package/src/demo/Done.tsx +16 -16
- package/src/demo/Pep.tsx +112 -112
- package/src/model/PepModel.ts +52 -52
- package/src/pages/IsPep/IsPepMessages.ts +67 -67
- package/src/pages/IsPep/IsPepPage.tsx +115 -114
- package/src/pages/PepContext.tsx +144 -144
- package/src/pages/RelationPage/RelationMessages.ts +288 -288
- package/src/pages/RelationPage/RelationPage.tsx +299 -299
- package/src/pages/RolePage/RoleMessages.ts +393 -393
- package/src/pages/RolePage/RolePage.tsx +356 -356
- package/src/pages/StatusPage/StatusMessages.ts +272 -272
- package/src/pages/StatusPage/StatusPage.tsx +207 -207
- package/.vscode/settings.json +0 -4
|
@@ -1,356 +1,356 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
FunctionComponent,
|
|
3
|
-
useRef,
|
|
4
|
-
useCallback,
|
|
5
|
-
useContext,
|
|
6
|
-
} from "react";
|
|
7
|
-
import { Alternative } from "@lysaab/ui-2/components/input/InputAPI";
|
|
8
|
-
import {
|
|
9
|
-
LysaFormRef,
|
|
10
|
-
Form,
|
|
11
|
-
PrimaryButton,
|
|
12
|
-
RequiredValidator,
|
|
13
|
-
TextInput,
|
|
14
|
-
Select,
|
|
15
|
-
} from "@lysaab/ui-2";
|
|
16
|
-
import {
|
|
17
|
-
PepContext,
|
|
18
|
-
Role,
|
|
19
|
-
MilitaryRank,
|
|
20
|
-
PepType,
|
|
21
|
-
EntityType,
|
|
22
|
-
} from "../PepContext";
|
|
23
|
-
import { CountrySelect } from "../../components/CountrySelect";
|
|
24
|
-
import { useIntl, IntlShape, FormattedMessage } from "react-intl";
|
|
25
|
-
import {
|
|
26
|
-
roleMessages,
|
|
27
|
-
ambassadorMessages,
|
|
28
|
-
governmentCompanyMessages,
|
|
29
|
-
intCompanyMessages,
|
|
30
|
-
militaryMessages,
|
|
31
|
-
} from "./RoleMessages";
|
|
32
|
-
import { formatPossessive } from "../../utils/Possession";
|
|
33
|
-
|
|
34
|
-
interface Props {
|
|
35
|
-
next: () => void;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const RolePage: FunctionComponent<Props> = ({ next }) => {
|
|
39
|
-
const pepContext = useContext(PepContext);
|
|
40
|
-
const formRef = useRef<LysaFormRef>();
|
|
41
|
-
const intl = useIntl();
|
|
42
|
-
const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
|
|
43
|
-
const type = pepContext.state.type;
|
|
44
|
-
|
|
45
|
-
const roleAlternatives: Alternative<Role>[] = getRoleAlts(intl);
|
|
46
|
-
const militaryAlternatives: Alternative<MilitaryRank>[] = getMilitaryAlts(
|
|
47
|
-
intl
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
const nextPage = useCallback(() => {
|
|
51
|
-
if (formRef.current && formRef.current.isValid) {
|
|
52
|
-
next();
|
|
53
|
-
}
|
|
54
|
-
}, [formRef, next]);
|
|
55
|
-
|
|
56
|
-
const resetRoleFields = useCallback(() => {
|
|
57
|
-
pepContext.setState({
|
|
58
|
-
ambassadorCountry: undefined,
|
|
59
|
-
governmentCompany: undefined,
|
|
60
|
-
governmentCompanyRole: undefined,
|
|
61
|
-
internationalOrganisation: undefined,
|
|
62
|
-
internationalOrganisationRole: undefined,
|
|
63
|
-
militaryRank: undefined,
|
|
64
|
-
});
|
|
65
|
-
}, [pepContext]);
|
|
66
|
-
|
|
67
|
-
if (!type || type === PepType.NOT_PEP) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
<Form onSubmit={() => nextPage()} lysaFormRef={formRef}>
|
|
73
|
-
<Select
|
|
74
|
-
label={intl.formatMessage(roleMessages.header, {
|
|
75
|
-
entityType,
|
|
76
|
-
pepType: type,
|
|
77
|
-
relation:
|
|
78
|
-
pepContext.state.type === PepType.COLLEAGUE
|
|
79
|
-
? pepContext.state.businessRelation
|
|
80
|
-
: pepContext.state.relationToPEP,
|
|
81
|
-
name: pepContext.state.ownerName,
|
|
82
|
-
possessiveName: formatPossessive(
|
|
83
|
-
pepContext.state.ownerName,
|
|
84
|
-
intl.locale
|
|
85
|
-
),
|
|
86
|
-
})}
|
|
87
|
-
placeholder={intl.formatMessage(roleMessages.placeholder)}
|
|
88
|
-
alternatives={roleAlternatives}
|
|
89
|
-
value={roleAlternatives.find(
|
|
90
|
-
(alt) => alt.value === pepContext.state.role
|
|
91
|
-
)}
|
|
92
|
-
onChange={(event) => {
|
|
93
|
-
pepContext.setState({ role: event.value as Role });
|
|
94
|
-
resetRoleFields();
|
|
95
|
-
}}
|
|
96
|
-
validators={[
|
|
97
|
-
new RequiredValidator(intl.formatMessage(roleMessages.required)),
|
|
98
|
-
]}
|
|
99
|
-
/>
|
|
100
|
-
|
|
101
|
-
{pepContext.state.role && pepContext.state.role === Role.AMBASSADOR ? (
|
|
102
|
-
<CountrySelect
|
|
103
|
-
label={intl.formatMessage(ambassadorMessages.header, {
|
|
104
|
-
entityType,
|
|
105
|
-
pepType: type,
|
|
106
|
-
relation:
|
|
107
|
-
pepContext.state.type === PepType.COLLEAGUE
|
|
108
|
-
? pepContext.state.businessRelation
|
|
109
|
-
: pepContext.state.relationToPEP,
|
|
110
|
-
name: pepContext.state.ownerName,
|
|
111
|
-
})}
|
|
112
|
-
onChange={(event) =>
|
|
113
|
-
pepContext.setState({
|
|
114
|
-
ambassadorCountry: event.value
|
|
115
|
-
? event.value.toString()
|
|
116
|
-
: undefined,
|
|
117
|
-
})
|
|
118
|
-
}
|
|
119
|
-
value={pepContext.state.ambassadorCountry}
|
|
120
|
-
validators={[
|
|
121
|
-
new RequiredValidator(
|
|
122
|
-
intl.formatMessage(ambassadorMessages.required)
|
|
123
|
-
),
|
|
124
|
-
]}
|
|
125
|
-
/>
|
|
126
|
-
) : null}
|
|
127
|
-
|
|
128
|
-
{pepContext.state.role &&
|
|
129
|
-
pepContext.state.role === Role.GOVERNMENT_COMPANY ? (
|
|
130
|
-
<React.Fragment>
|
|
131
|
-
<TextInput
|
|
132
|
-
label={intl.formatMessage(governmentCompanyMessages.nameHeader, {
|
|
133
|
-
entityType,
|
|
134
|
-
pepType: type,
|
|
135
|
-
relation:
|
|
136
|
-
pepContext.state.type === PepType.COLLEAGUE
|
|
137
|
-
? pepContext.state.businessRelation
|
|
138
|
-
: pepContext.state.relationToPEP,
|
|
139
|
-
name: pepContext.state.ownerName,
|
|
140
|
-
})}
|
|
141
|
-
value={pepContext.state.governmentCompany || ""}
|
|
142
|
-
onChange={(value) => {
|
|
143
|
-
pepContext.setState({ governmentCompany: value });
|
|
144
|
-
}}
|
|
145
|
-
validators={[
|
|
146
|
-
new RequiredValidator(
|
|
147
|
-
intl.formatMessage(governmentCompanyMessages.nameRequired)
|
|
148
|
-
),
|
|
149
|
-
]}
|
|
150
|
-
/>
|
|
151
|
-
<TextInput
|
|
152
|
-
label={intl.formatMessage(governmentCompanyMessages.roleHeader, {
|
|
153
|
-
entityType,
|
|
154
|
-
pepType: type,
|
|
155
|
-
relation:
|
|
156
|
-
pepContext.state.type === PepType.COLLEAGUE
|
|
157
|
-
? pepContext.state.businessRelation
|
|
158
|
-
: pepContext.state.relationToPEP,
|
|
159
|
-
name: pepContext.state.ownerName,
|
|
160
|
-
})}
|
|
161
|
-
value={pepContext.state.governmentCompanyRole || ""}
|
|
162
|
-
onChange={(value) => {
|
|
163
|
-
pepContext.setState({
|
|
164
|
-
governmentCompanyRole: value,
|
|
165
|
-
});
|
|
166
|
-
}}
|
|
167
|
-
validators={[
|
|
168
|
-
new RequiredValidator(
|
|
169
|
-
intl.formatMessage(governmentCompanyMessages.roleRequired)
|
|
170
|
-
),
|
|
171
|
-
]}
|
|
172
|
-
/>
|
|
173
|
-
</React.Fragment>
|
|
174
|
-
) : null}
|
|
175
|
-
|
|
176
|
-
{pepContext.state.role &&
|
|
177
|
-
pepContext.state.role ===
|
|
178
|
-
Role.HIGH_RANKING_POSITION_INTERNALTIONAL_CORP ? (
|
|
179
|
-
<React.Fragment>
|
|
180
|
-
<TextInput
|
|
181
|
-
label={intl.formatMessage(intCompanyMessages.nameHeader, {
|
|
182
|
-
entityType,
|
|
183
|
-
pepType: type,
|
|
184
|
-
relation:
|
|
185
|
-
pepContext.state.type === PepType.COLLEAGUE
|
|
186
|
-
? pepContext.state.businessRelation
|
|
187
|
-
: pepContext.state.relationToPEP,
|
|
188
|
-
name: pepContext.state.ownerName,
|
|
189
|
-
})}
|
|
190
|
-
value={pepContext.state.internationalOrganisation || ""}
|
|
191
|
-
onChange={(value) => {
|
|
192
|
-
pepContext.setState({ internationalOrganisation: value });
|
|
193
|
-
}}
|
|
194
|
-
validators={[
|
|
195
|
-
new RequiredValidator(
|
|
196
|
-
intl.formatMessage(intCompanyMessages.nameRequired)
|
|
197
|
-
),
|
|
198
|
-
]}
|
|
199
|
-
/>
|
|
200
|
-
<TextInput
|
|
201
|
-
label={intl.formatMessage(intCompanyMessages.roleHeader, {
|
|
202
|
-
entityType,
|
|
203
|
-
pepType: type,
|
|
204
|
-
relation:
|
|
205
|
-
pepContext.state.type === PepType.COLLEAGUE
|
|
206
|
-
? pepContext.state.businessRelation
|
|
207
|
-
: pepContext.state.relationToPEP,
|
|
208
|
-
name: pepContext.state.ownerName,
|
|
209
|
-
})}
|
|
210
|
-
value={pepContext.state.internationalOrganisationRole || ""}
|
|
211
|
-
onChange={(value) => {
|
|
212
|
-
pepContext.setState({
|
|
213
|
-
internationalOrganisationRole: value,
|
|
214
|
-
});
|
|
215
|
-
}}
|
|
216
|
-
validators={[
|
|
217
|
-
new RequiredValidator(
|
|
218
|
-
intl.formatMessage(intCompanyMessages.roleRequired)
|
|
219
|
-
),
|
|
220
|
-
]}
|
|
221
|
-
/>
|
|
222
|
-
</React.Fragment>
|
|
223
|
-
) : null}
|
|
224
|
-
|
|
225
|
-
{pepContext.state.role &&
|
|
226
|
-
pepContext.state.role === Role.MILITARY_OFFICER ? (
|
|
227
|
-
<Select
|
|
228
|
-
label={intl.formatMessage(militaryMessages.header, {
|
|
229
|
-
entityType,
|
|
230
|
-
pepType: type,
|
|
231
|
-
relation:
|
|
232
|
-
pepContext.state.type === PepType.COLLEAGUE
|
|
233
|
-
? pepContext.state.businessRelation
|
|
234
|
-
: pepContext.state.relationToPEP,
|
|
235
|
-
name: pepContext.state.ownerName,
|
|
236
|
-
possessiveName: formatPossessive(
|
|
237
|
-
pepContext.state.ownerName,
|
|
238
|
-
intl.locale
|
|
239
|
-
),
|
|
240
|
-
})}
|
|
241
|
-
placeholder={intl.formatMessage(militaryMessages.placeholder)}
|
|
242
|
-
alternatives={militaryAlternatives}
|
|
243
|
-
value={militaryAlternatives.find(
|
|
244
|
-
(alt) => alt.value === pepContext.state.militaryRank
|
|
245
|
-
)}
|
|
246
|
-
onChange={(event) => {
|
|
247
|
-
pepContext.setState({ militaryRank: event.value as MilitaryRank });
|
|
248
|
-
}}
|
|
249
|
-
validators={[
|
|
250
|
-
new RequiredValidator(
|
|
251
|
-
intl.formatMessage(militaryMessages.required)
|
|
252
|
-
),
|
|
253
|
-
]}
|
|
254
|
-
/>
|
|
255
|
-
) : null}
|
|
256
|
-
|
|
257
|
-
<PrimaryButton type="submit">
|
|
258
|
-
<FormattedMessage
|
|
259
|
-
id="pep.role.next"
|
|
260
|
-
description="Next button"
|
|
261
|
-
defaultMessage="Gå vidare"
|
|
262
|
-
/>
|
|
263
|
-
</PrimaryButton>
|
|
264
|
-
</Form>
|
|
265
|
-
);
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
export function getRoleAlts(intl: IntlShape): Alternative<Role>[] {
|
|
269
|
-
return [
|
|
270
|
-
{
|
|
271
|
-
text: intl.formatMessage(roleMessages[Role.HEAD_OF_GOVERNMENT]),
|
|
272
|
-
value: Role.HEAD_OF_GOVERNMENT,
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
text: intl.formatMessage(roleMessages[Role.MINISTER]),
|
|
276
|
-
value: Role.MINISTER,
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
text: intl.formatMessage(roleMessages[Role.PARLIMENT_MEMBER]),
|
|
280
|
-
value: Role.PARLIMENT_MEMBER,
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
text: intl.formatMessage(roleMessages[Role.CENTRAL_BANK_MEMBER]),
|
|
284
|
-
value: Role.CENTRAL_BANK_MEMBER,
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
text: intl.formatMessage(roleMessages[Role.BOARD_MEMBER_POLITICAL_PARTY]),
|
|
288
|
-
value: Role.BOARD_MEMBER_POLITICAL_PARTY,
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
text: intl.formatMessage(roleMessages[Role.JUDGE_SUPREME_COURT]),
|
|
292
|
-
value: Role.JUDGE_SUPREME_COURT,
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
text: intl.formatMessage(roleMessages[Role.JUDGE_OTHER_HIGH_COURT]),
|
|
296
|
-
value: Role.JUDGE_OTHER_HIGH_COURT,
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
text: intl.formatMessage(roleMessages[Role.REVISION_INSTITUTE]),
|
|
300
|
-
value: Role.REVISION_INSTITUTE,
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
text: intl.formatMessage(roleMessages[Role.AMBASSADOR]),
|
|
304
|
-
value: Role.AMBASSADOR,
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
text: intl.formatMessage(roleMessages[Role.MILITARY_OFFICER]),
|
|
308
|
-
value: Role.MILITARY_OFFICER,
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
text: intl.formatMessage(roleMessages[Role.GOVERNMENT_COMPANY]),
|
|
312
|
-
value: Role.GOVERNMENT_COMPANY,
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
text: intl.formatMessage(roleMessages[Role.EU_HIGH_RANKING_POSITION]),
|
|
316
|
-
value: Role.EU_HIGH_RANKING_POSITION,
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
text: intl.formatMessage(
|
|
320
|
-
roleMessages[Role.HIGH_RANKING_POSITION_INTERNALTIONAL_CORP]
|
|
321
|
-
),
|
|
322
|
-
value: Role.HIGH_RANKING_POSITION_INTERNALTIONAL_CORP,
|
|
323
|
-
},
|
|
324
|
-
];
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
export function getMilitaryAlts(intl: IntlShape): Alternative<MilitaryRank>[] {
|
|
328
|
-
return [
|
|
329
|
-
{
|
|
330
|
-
text: intl.formatMessage(militaryMessages[MilitaryRank.GENERAL]),
|
|
331
|
-
value: MilitaryRank.GENERAL,
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
text: intl.formatMessage(
|
|
335
|
-
militaryMessages[MilitaryRank.LIEUTENANT_GENERAL]
|
|
336
|
-
),
|
|
337
|
-
value: MilitaryRank.LIEUTENANT_GENERAL,
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
text: intl.formatMessage(militaryMessages[MilitaryRank.MAJOR_GENERAL]),
|
|
341
|
-
value: MilitaryRank.MAJOR_GENERAL,
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
text: intl.formatMessage(militaryMessages[MilitaryRank.ADMIRAL]),
|
|
345
|
-
value: MilitaryRank.ADMIRAL,
|
|
346
|
-
},
|
|
347
|
-
{
|
|
348
|
-
text: intl.formatMessage(militaryMessages[MilitaryRank.VICE_ADMIRAL]),
|
|
349
|
-
value: MilitaryRank.VICE_ADMIRAL,
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
text: intl.formatMessage(militaryMessages[MilitaryRank.REAR_ADMIRAL]),
|
|
353
|
-
value: MilitaryRank.REAR_ADMIRAL,
|
|
354
|
-
},
|
|
355
|
-
];
|
|
356
|
-
}
|
|
1
|
+
import React, {
|
|
2
|
+
FunctionComponent,
|
|
3
|
+
useRef,
|
|
4
|
+
useCallback,
|
|
5
|
+
useContext,
|
|
6
|
+
} from "react";
|
|
7
|
+
import { Alternative } from "@lysaab/ui-2/components/input/InputAPI";
|
|
8
|
+
import {
|
|
9
|
+
LysaFormRef,
|
|
10
|
+
Form,
|
|
11
|
+
PrimaryButton,
|
|
12
|
+
RequiredValidator,
|
|
13
|
+
TextInput,
|
|
14
|
+
Select,
|
|
15
|
+
} from "@lysaab/ui-2";
|
|
16
|
+
import {
|
|
17
|
+
PepContext,
|
|
18
|
+
Role,
|
|
19
|
+
MilitaryRank,
|
|
20
|
+
PepType,
|
|
21
|
+
EntityType,
|
|
22
|
+
} from "../PepContext";
|
|
23
|
+
import { CountrySelect } from "../../components/CountrySelect";
|
|
24
|
+
import { useIntl, IntlShape, FormattedMessage } from "react-intl";
|
|
25
|
+
import {
|
|
26
|
+
roleMessages,
|
|
27
|
+
ambassadorMessages,
|
|
28
|
+
governmentCompanyMessages,
|
|
29
|
+
intCompanyMessages,
|
|
30
|
+
militaryMessages,
|
|
31
|
+
} from "./RoleMessages";
|
|
32
|
+
import { formatPossessive } from "../../utils/Possession";
|
|
33
|
+
|
|
34
|
+
interface Props {
|
|
35
|
+
next: () => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const RolePage: FunctionComponent<Props> = ({ next }) => {
|
|
39
|
+
const pepContext = useContext(PepContext);
|
|
40
|
+
const formRef = useRef<LysaFormRef>();
|
|
41
|
+
const intl = useIntl();
|
|
42
|
+
const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
|
|
43
|
+
const type = pepContext.state.type;
|
|
44
|
+
|
|
45
|
+
const roleAlternatives: Alternative<Role>[] = getRoleAlts(intl);
|
|
46
|
+
const militaryAlternatives: Alternative<MilitaryRank>[] = getMilitaryAlts(
|
|
47
|
+
intl
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const nextPage = useCallback(() => {
|
|
51
|
+
if (formRef.current && formRef.current.isValid) {
|
|
52
|
+
next();
|
|
53
|
+
}
|
|
54
|
+
}, [formRef, next]);
|
|
55
|
+
|
|
56
|
+
const resetRoleFields = useCallback(() => {
|
|
57
|
+
pepContext.setState({
|
|
58
|
+
ambassadorCountry: undefined,
|
|
59
|
+
governmentCompany: undefined,
|
|
60
|
+
governmentCompanyRole: undefined,
|
|
61
|
+
internationalOrganisation: undefined,
|
|
62
|
+
internationalOrganisationRole: undefined,
|
|
63
|
+
militaryRank: undefined,
|
|
64
|
+
});
|
|
65
|
+
}, [pepContext]);
|
|
66
|
+
|
|
67
|
+
if (!type || type === PepType.NOT_PEP) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<Form onSubmit={() => nextPage()} lysaFormRef={formRef}>
|
|
73
|
+
<Select
|
|
74
|
+
label={intl.formatMessage(roleMessages.header, {
|
|
75
|
+
entityType,
|
|
76
|
+
pepType: type,
|
|
77
|
+
relation:
|
|
78
|
+
pepContext.state.type === PepType.COLLEAGUE
|
|
79
|
+
? pepContext.state.businessRelation
|
|
80
|
+
: pepContext.state.relationToPEP,
|
|
81
|
+
name: pepContext.state.ownerName,
|
|
82
|
+
possessiveName: formatPossessive(
|
|
83
|
+
pepContext.state.ownerName,
|
|
84
|
+
intl.locale
|
|
85
|
+
),
|
|
86
|
+
})}
|
|
87
|
+
placeholder={intl.formatMessage(roleMessages.placeholder)}
|
|
88
|
+
alternatives={roleAlternatives}
|
|
89
|
+
value={roleAlternatives.find(
|
|
90
|
+
(alt) => alt.value === pepContext.state.role
|
|
91
|
+
)}
|
|
92
|
+
onChange={(event) => {
|
|
93
|
+
pepContext.setState({ role: event.value as Role });
|
|
94
|
+
resetRoleFields();
|
|
95
|
+
}}
|
|
96
|
+
validators={[
|
|
97
|
+
new RequiredValidator(intl.formatMessage(roleMessages.required)),
|
|
98
|
+
]}
|
|
99
|
+
/>
|
|
100
|
+
|
|
101
|
+
{pepContext.state.role && pepContext.state.role === Role.AMBASSADOR ? (
|
|
102
|
+
<CountrySelect
|
|
103
|
+
label={intl.formatMessage(ambassadorMessages.header, {
|
|
104
|
+
entityType,
|
|
105
|
+
pepType: type,
|
|
106
|
+
relation:
|
|
107
|
+
pepContext.state.type === PepType.COLLEAGUE
|
|
108
|
+
? pepContext.state.businessRelation
|
|
109
|
+
: pepContext.state.relationToPEP,
|
|
110
|
+
name: pepContext.state.ownerName,
|
|
111
|
+
})}
|
|
112
|
+
onChange={(event) =>
|
|
113
|
+
pepContext.setState({
|
|
114
|
+
ambassadorCountry: event.value
|
|
115
|
+
? event.value.toString()
|
|
116
|
+
: undefined,
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
value={pepContext.state.ambassadorCountry}
|
|
120
|
+
validators={[
|
|
121
|
+
new RequiredValidator(
|
|
122
|
+
intl.formatMessage(ambassadorMessages.required)
|
|
123
|
+
),
|
|
124
|
+
]}
|
|
125
|
+
/>
|
|
126
|
+
) : null}
|
|
127
|
+
|
|
128
|
+
{pepContext.state.role &&
|
|
129
|
+
pepContext.state.role === Role.GOVERNMENT_COMPANY ? (
|
|
130
|
+
<React.Fragment>
|
|
131
|
+
<TextInput
|
|
132
|
+
label={intl.formatMessage(governmentCompanyMessages.nameHeader, {
|
|
133
|
+
entityType,
|
|
134
|
+
pepType: type,
|
|
135
|
+
relation:
|
|
136
|
+
pepContext.state.type === PepType.COLLEAGUE
|
|
137
|
+
? pepContext.state.businessRelation
|
|
138
|
+
: pepContext.state.relationToPEP,
|
|
139
|
+
name: pepContext.state.ownerName,
|
|
140
|
+
})}
|
|
141
|
+
value={pepContext.state.governmentCompany || ""}
|
|
142
|
+
onChange={(value) => {
|
|
143
|
+
pepContext.setState({ governmentCompany: value });
|
|
144
|
+
}}
|
|
145
|
+
validators={[
|
|
146
|
+
new RequiredValidator(
|
|
147
|
+
intl.formatMessage(governmentCompanyMessages.nameRequired)
|
|
148
|
+
),
|
|
149
|
+
]}
|
|
150
|
+
/>
|
|
151
|
+
<TextInput
|
|
152
|
+
label={intl.formatMessage(governmentCompanyMessages.roleHeader, {
|
|
153
|
+
entityType,
|
|
154
|
+
pepType: type,
|
|
155
|
+
relation:
|
|
156
|
+
pepContext.state.type === PepType.COLLEAGUE
|
|
157
|
+
? pepContext.state.businessRelation
|
|
158
|
+
: pepContext.state.relationToPEP,
|
|
159
|
+
name: pepContext.state.ownerName,
|
|
160
|
+
})}
|
|
161
|
+
value={pepContext.state.governmentCompanyRole || ""}
|
|
162
|
+
onChange={(value) => {
|
|
163
|
+
pepContext.setState({
|
|
164
|
+
governmentCompanyRole: value,
|
|
165
|
+
});
|
|
166
|
+
}}
|
|
167
|
+
validators={[
|
|
168
|
+
new RequiredValidator(
|
|
169
|
+
intl.formatMessage(governmentCompanyMessages.roleRequired)
|
|
170
|
+
),
|
|
171
|
+
]}
|
|
172
|
+
/>
|
|
173
|
+
</React.Fragment>
|
|
174
|
+
) : null}
|
|
175
|
+
|
|
176
|
+
{pepContext.state.role &&
|
|
177
|
+
pepContext.state.role ===
|
|
178
|
+
Role.HIGH_RANKING_POSITION_INTERNALTIONAL_CORP ? (
|
|
179
|
+
<React.Fragment>
|
|
180
|
+
<TextInput
|
|
181
|
+
label={intl.formatMessage(intCompanyMessages.nameHeader, {
|
|
182
|
+
entityType,
|
|
183
|
+
pepType: type,
|
|
184
|
+
relation:
|
|
185
|
+
pepContext.state.type === PepType.COLLEAGUE
|
|
186
|
+
? pepContext.state.businessRelation
|
|
187
|
+
: pepContext.state.relationToPEP,
|
|
188
|
+
name: pepContext.state.ownerName,
|
|
189
|
+
})}
|
|
190
|
+
value={pepContext.state.internationalOrganisation || ""}
|
|
191
|
+
onChange={(value) => {
|
|
192
|
+
pepContext.setState({ internationalOrganisation: value });
|
|
193
|
+
}}
|
|
194
|
+
validators={[
|
|
195
|
+
new RequiredValidator(
|
|
196
|
+
intl.formatMessage(intCompanyMessages.nameRequired)
|
|
197
|
+
),
|
|
198
|
+
]}
|
|
199
|
+
/>
|
|
200
|
+
<TextInput
|
|
201
|
+
label={intl.formatMessage(intCompanyMessages.roleHeader, {
|
|
202
|
+
entityType,
|
|
203
|
+
pepType: type,
|
|
204
|
+
relation:
|
|
205
|
+
pepContext.state.type === PepType.COLLEAGUE
|
|
206
|
+
? pepContext.state.businessRelation
|
|
207
|
+
: pepContext.state.relationToPEP,
|
|
208
|
+
name: pepContext.state.ownerName,
|
|
209
|
+
})}
|
|
210
|
+
value={pepContext.state.internationalOrganisationRole || ""}
|
|
211
|
+
onChange={(value) => {
|
|
212
|
+
pepContext.setState({
|
|
213
|
+
internationalOrganisationRole: value,
|
|
214
|
+
});
|
|
215
|
+
}}
|
|
216
|
+
validators={[
|
|
217
|
+
new RequiredValidator(
|
|
218
|
+
intl.formatMessage(intCompanyMessages.roleRequired)
|
|
219
|
+
),
|
|
220
|
+
]}
|
|
221
|
+
/>
|
|
222
|
+
</React.Fragment>
|
|
223
|
+
) : null}
|
|
224
|
+
|
|
225
|
+
{pepContext.state.role &&
|
|
226
|
+
pepContext.state.role === Role.MILITARY_OFFICER ? (
|
|
227
|
+
<Select
|
|
228
|
+
label={intl.formatMessage(militaryMessages.header, {
|
|
229
|
+
entityType,
|
|
230
|
+
pepType: type,
|
|
231
|
+
relation:
|
|
232
|
+
pepContext.state.type === PepType.COLLEAGUE
|
|
233
|
+
? pepContext.state.businessRelation
|
|
234
|
+
: pepContext.state.relationToPEP,
|
|
235
|
+
name: pepContext.state.ownerName,
|
|
236
|
+
possessiveName: formatPossessive(
|
|
237
|
+
pepContext.state.ownerName,
|
|
238
|
+
intl.locale
|
|
239
|
+
),
|
|
240
|
+
})}
|
|
241
|
+
placeholder={intl.formatMessage(militaryMessages.placeholder)}
|
|
242
|
+
alternatives={militaryAlternatives}
|
|
243
|
+
value={militaryAlternatives.find(
|
|
244
|
+
(alt) => alt.value === pepContext.state.militaryRank
|
|
245
|
+
)}
|
|
246
|
+
onChange={(event) => {
|
|
247
|
+
pepContext.setState({ militaryRank: event.value as MilitaryRank });
|
|
248
|
+
}}
|
|
249
|
+
validators={[
|
|
250
|
+
new RequiredValidator(
|
|
251
|
+
intl.formatMessage(militaryMessages.required)
|
|
252
|
+
),
|
|
253
|
+
]}
|
|
254
|
+
/>
|
|
255
|
+
) : null}
|
|
256
|
+
|
|
257
|
+
<PrimaryButton type="submit">
|
|
258
|
+
<FormattedMessage
|
|
259
|
+
id="pep.role.next"
|
|
260
|
+
description="Next button"
|
|
261
|
+
defaultMessage="Gå vidare"
|
|
262
|
+
/>
|
|
263
|
+
</PrimaryButton>
|
|
264
|
+
</Form>
|
|
265
|
+
);
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
export function getRoleAlts(intl: IntlShape): Alternative<Role>[] {
|
|
269
|
+
return [
|
|
270
|
+
{
|
|
271
|
+
text: intl.formatMessage(roleMessages[Role.HEAD_OF_GOVERNMENT]),
|
|
272
|
+
value: Role.HEAD_OF_GOVERNMENT,
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
text: intl.formatMessage(roleMessages[Role.MINISTER]),
|
|
276
|
+
value: Role.MINISTER,
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
text: intl.formatMessage(roleMessages[Role.PARLIMENT_MEMBER]),
|
|
280
|
+
value: Role.PARLIMENT_MEMBER,
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
text: intl.formatMessage(roleMessages[Role.CENTRAL_BANK_MEMBER]),
|
|
284
|
+
value: Role.CENTRAL_BANK_MEMBER,
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
text: intl.formatMessage(roleMessages[Role.BOARD_MEMBER_POLITICAL_PARTY]),
|
|
288
|
+
value: Role.BOARD_MEMBER_POLITICAL_PARTY,
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
text: intl.formatMessage(roleMessages[Role.JUDGE_SUPREME_COURT]),
|
|
292
|
+
value: Role.JUDGE_SUPREME_COURT,
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
text: intl.formatMessage(roleMessages[Role.JUDGE_OTHER_HIGH_COURT]),
|
|
296
|
+
value: Role.JUDGE_OTHER_HIGH_COURT,
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
text: intl.formatMessage(roleMessages[Role.REVISION_INSTITUTE]),
|
|
300
|
+
value: Role.REVISION_INSTITUTE,
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
text: intl.formatMessage(roleMessages[Role.AMBASSADOR]),
|
|
304
|
+
value: Role.AMBASSADOR,
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
text: intl.formatMessage(roleMessages[Role.MILITARY_OFFICER]),
|
|
308
|
+
value: Role.MILITARY_OFFICER,
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
text: intl.formatMessage(roleMessages[Role.GOVERNMENT_COMPANY]),
|
|
312
|
+
value: Role.GOVERNMENT_COMPANY,
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
text: intl.formatMessage(roleMessages[Role.EU_HIGH_RANKING_POSITION]),
|
|
316
|
+
value: Role.EU_HIGH_RANKING_POSITION,
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
text: intl.formatMessage(
|
|
320
|
+
roleMessages[Role.HIGH_RANKING_POSITION_INTERNALTIONAL_CORP]
|
|
321
|
+
),
|
|
322
|
+
value: Role.HIGH_RANKING_POSITION_INTERNALTIONAL_CORP,
|
|
323
|
+
},
|
|
324
|
+
];
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export function getMilitaryAlts(intl: IntlShape): Alternative<MilitaryRank>[] {
|
|
328
|
+
return [
|
|
329
|
+
{
|
|
330
|
+
text: intl.formatMessage(militaryMessages[MilitaryRank.GENERAL]),
|
|
331
|
+
value: MilitaryRank.GENERAL,
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
text: intl.formatMessage(
|
|
335
|
+
militaryMessages[MilitaryRank.LIEUTENANT_GENERAL]
|
|
336
|
+
),
|
|
337
|
+
value: MilitaryRank.LIEUTENANT_GENERAL,
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
text: intl.formatMessage(militaryMessages[MilitaryRank.MAJOR_GENERAL]),
|
|
341
|
+
value: MilitaryRank.MAJOR_GENERAL,
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
text: intl.formatMessage(militaryMessages[MilitaryRank.ADMIRAL]),
|
|
345
|
+
value: MilitaryRank.ADMIRAL,
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
text: intl.formatMessage(militaryMessages[MilitaryRank.VICE_ADMIRAL]),
|
|
349
|
+
value: MilitaryRank.VICE_ADMIRAL,
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
text: intl.formatMessage(militaryMessages[MilitaryRank.REAR_ADMIRAL]),
|
|
353
|
+
value: MilitaryRank.REAR_ADMIRAL,
|
|
354
|
+
},
|
|
355
|
+
];
|
|
356
|
+
}
|