@lysaab/lysa-pep 1.0.0 → 1.0.2-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/.vscode/settings.json +4 -0
- package/lib/Exports.d.ts +7 -8
- package/lib/Exports.js +7 -8
- package/lib/components/CountrySelect.d.ts +15 -22
- package/lib/components/CountrySelect.js +30 -21
- package/lib/components/PepAnswers.d.ts +8 -8
- package/lib/components/PepAnswers.js +131 -39
- 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 +322 -380
- package/lib/model/PepTexts.js +467 -552
- package/lib/pages/IsPep/IsPepMessages.d.ts +32 -0
- package/lib/pages/IsPep/IsPepMessages.js +66 -0
- package/lib/pages/IsPep/IsPepPage.d.ts +14 -0
- package/lib/pages/IsPep/IsPepPage.js +59 -0
- package/lib/pages/PepContext.d.ts +80 -80
- package/lib/pages/PepContext.js +88 -88
- package/lib/pages/PepIsPepPage.d.ts +6 -15
- package/lib/pages/PepIsPepPage.js +57 -59
- package/lib/pages/PepRelationPage.d.ts +6 -6
- package/lib/pages/PepRelationPage.js +83 -79
- package/lib/pages/PepRolePage.d.ts +9 -10
- package/lib/pages/PepRolePage.js +127 -127
- package/lib/pages/PepStatusPage.d.ts +6 -6
- package/lib/pages/PepStatusPage.js +57 -58
- package/lib/pages/RelationPage/RelationMessages.d.ts +105 -0
- package/lib/pages/RelationPage/RelationMessages.js +283 -0
- package/lib/pages/RelationPage/RelationPage.d.ts +6 -0
- package/lib/pages/RelationPage/RelationPage.js +153 -0
- package/lib/pages/RolePage/RoleMessages.d.ts +185 -0
- package/lib/pages/RolePage/RoleMessages.js +385 -0
- package/lib/pages/RolePage/RolePage.d.ts +11 -0
- package/lib/pages/RolePage/RolePage.js +220 -0
- package/lib/pages/StatusPage/StatusMessages.d.ts +72 -0
- package/lib/pages/StatusPage/StatusMessages.js +266 -0
- package/lib/pages/StatusPage/StatusPage.d.ts +6 -0
- package/lib/pages/StatusPage/StatusPage.js +95 -0
- package/lib/utils/Possession.d.ts +1 -0
- package/lib/utils/Possession.js +18 -0
- package/package.json +57 -53
- package/src/Exports.ts +12 -13
- package/src/components/CountrySelect.tsx +47 -43
- package/src/components/PepAnswers.scss +7 -7
- package/src/components/PepAnswers.tsx +252 -120
- package/src/demo/Done.tsx +16 -20
- package/src/demo/Pep.tsx +112 -106
- package/src/model/PepModel.ts +52 -52
- package/src/pages/IsPep/IsPepMessages.ts +67 -0
- package/src/pages/IsPep/IsPepPage.tsx +114 -0
- package/src/pages/PepContext.tsx +144 -144
- package/src/pages/RelationPage/RelationMessages.ts +288 -0
- package/src/pages/RelationPage/RelationPage.tsx +299 -0
- package/src/pages/RolePage/RoleMessages.ts +393 -0
- package/src/pages/RolePage/RolePage.tsx +356 -0
- package/src/pages/StatusPage/StatusMessages.ts +272 -0
- package/src/pages/StatusPage/StatusPage.tsx +207 -0
- package/src/utils/Possession.ts +21 -0
- package/src/model/PepTexts.ts +0 -607
- package/src/pages/PepIsPepPage.tsx +0 -107
- package/src/pages/PepRelationPage.tsx +0 -188
- package/src/pages/PepRolePage.tsx +0 -272
- package/src/pages/PepStatusPage.tsx +0 -157
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import React, { useRef, useCallback, useContext, } from "react";
|
|
2
|
+
import { Form, PrimaryButton, RequiredValidator, TextInput, Select, } from "@lysaab/ui-2";
|
|
3
|
+
import { PepContext, Role, MilitaryRank, PepType, EntityType, } from "../PepContext";
|
|
4
|
+
import { CountrySelect } from "../../components/CountrySelect";
|
|
5
|
+
import { useIntl, FormattedMessage } from "react-intl";
|
|
6
|
+
import { roleMessages, ambassadorMessages, governmentCompanyMessages, intCompanyMessages, militaryMessages, } from "./RoleMessages";
|
|
7
|
+
import { formatPossessive } from "../../utils/Possession";
|
|
8
|
+
export const RolePage = ({ next }) => {
|
|
9
|
+
const pepContext = useContext(PepContext);
|
|
10
|
+
const formRef = useRef();
|
|
11
|
+
const intl = useIntl();
|
|
12
|
+
const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
|
|
13
|
+
const type = pepContext.state.type;
|
|
14
|
+
const roleAlternatives = getRoleAlts(intl);
|
|
15
|
+
const militaryAlternatives = getMilitaryAlts(intl);
|
|
16
|
+
const nextPage = useCallback(() => {
|
|
17
|
+
if (formRef.current && formRef.current.isValid) {
|
|
18
|
+
next();
|
|
19
|
+
}
|
|
20
|
+
}, [formRef, next]);
|
|
21
|
+
const resetRoleFields = useCallback(() => {
|
|
22
|
+
pepContext.setState({
|
|
23
|
+
ambassadorCountry: undefined,
|
|
24
|
+
governmentCompany: undefined,
|
|
25
|
+
governmentCompanyRole: undefined,
|
|
26
|
+
internationalOrganisation: undefined,
|
|
27
|
+
internationalOrganisationRole: undefined,
|
|
28
|
+
militaryRank: undefined,
|
|
29
|
+
});
|
|
30
|
+
}, [pepContext]);
|
|
31
|
+
if (!type || type === PepType.NOT_PEP) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return (React.createElement(Form, { onSubmit: () => nextPage(), lysaFormRef: formRef },
|
|
35
|
+
React.createElement(Select, { label: intl.formatMessage(roleMessages.header, {
|
|
36
|
+
entityType,
|
|
37
|
+
pepType: type,
|
|
38
|
+
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
39
|
+
? pepContext.state.businessRelation
|
|
40
|
+
: pepContext.state.relationToPEP,
|
|
41
|
+
name: pepContext.state.ownerName,
|
|
42
|
+
possessiveName: formatPossessive(pepContext.state.ownerName, intl.locale),
|
|
43
|
+
}), placeholder: intl.formatMessage(roleMessages.placeholder), alternatives: roleAlternatives, value: roleAlternatives.find((alt) => alt.value === pepContext.state.role), onChange: (event) => {
|
|
44
|
+
pepContext.setState({ role: event.value });
|
|
45
|
+
resetRoleFields();
|
|
46
|
+
}, validators: [
|
|
47
|
+
new RequiredValidator(intl.formatMessage(roleMessages.required)),
|
|
48
|
+
] }),
|
|
49
|
+
pepContext.state.role && pepContext.state.role === Role.AMBASSADOR ? (React.createElement(CountrySelect, { label: intl.formatMessage(ambassadorMessages.header, {
|
|
50
|
+
entityType,
|
|
51
|
+
pepType: type,
|
|
52
|
+
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
53
|
+
? pepContext.state.businessRelation
|
|
54
|
+
: pepContext.state.relationToPEP,
|
|
55
|
+
name: pepContext.state.ownerName,
|
|
56
|
+
}), onChange: (event) => pepContext.setState({
|
|
57
|
+
ambassadorCountry: event.value
|
|
58
|
+
? event.value.toString()
|
|
59
|
+
: undefined,
|
|
60
|
+
}), value: pepContext.state.ambassadorCountry, validators: [
|
|
61
|
+
new RequiredValidator(intl.formatMessage(ambassadorMessages.required)),
|
|
62
|
+
] })) : null,
|
|
63
|
+
pepContext.state.role &&
|
|
64
|
+
pepContext.state.role === Role.GOVERNMENT_COMPANY ? (React.createElement(React.Fragment, null,
|
|
65
|
+
React.createElement(TextInput, { label: intl.formatMessage(governmentCompanyMessages.nameHeader, {
|
|
66
|
+
entityType,
|
|
67
|
+
pepType: type,
|
|
68
|
+
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
69
|
+
? pepContext.state.businessRelation
|
|
70
|
+
: pepContext.state.relationToPEP,
|
|
71
|
+
name: pepContext.state.ownerName,
|
|
72
|
+
}), value: pepContext.state.governmentCompany || "", onChange: (value) => {
|
|
73
|
+
pepContext.setState({ governmentCompany: value });
|
|
74
|
+
}, validators: [
|
|
75
|
+
new RequiredValidator(intl.formatMessage(governmentCompanyMessages.nameRequired)),
|
|
76
|
+
] }),
|
|
77
|
+
React.createElement(TextInput, { label: intl.formatMessage(governmentCompanyMessages.roleHeader, {
|
|
78
|
+
entityType,
|
|
79
|
+
pepType: type,
|
|
80
|
+
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
81
|
+
? pepContext.state.businessRelation
|
|
82
|
+
: pepContext.state.relationToPEP,
|
|
83
|
+
name: pepContext.state.ownerName,
|
|
84
|
+
}), value: pepContext.state.governmentCompanyRole || "", onChange: (value) => {
|
|
85
|
+
pepContext.setState({
|
|
86
|
+
governmentCompanyRole: value,
|
|
87
|
+
});
|
|
88
|
+
}, validators: [
|
|
89
|
+
new RequiredValidator(intl.formatMessage(governmentCompanyMessages.roleRequired)),
|
|
90
|
+
] }))) : null,
|
|
91
|
+
pepContext.state.role &&
|
|
92
|
+
pepContext.state.role ===
|
|
93
|
+
Role.HIGH_RANKING_POSITION_INTERNALTIONAL_CORP ? (React.createElement(React.Fragment, null,
|
|
94
|
+
React.createElement(TextInput, { label: intl.formatMessage(intCompanyMessages.nameHeader, {
|
|
95
|
+
entityType,
|
|
96
|
+
pepType: type,
|
|
97
|
+
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
98
|
+
? pepContext.state.businessRelation
|
|
99
|
+
: pepContext.state.relationToPEP,
|
|
100
|
+
name: pepContext.state.ownerName,
|
|
101
|
+
}), value: pepContext.state.internationalOrganisation || "", onChange: (value) => {
|
|
102
|
+
pepContext.setState({ internationalOrganisation: value });
|
|
103
|
+
}, validators: [
|
|
104
|
+
new RequiredValidator(intl.formatMessage(intCompanyMessages.nameRequired)),
|
|
105
|
+
] }),
|
|
106
|
+
React.createElement(TextInput, { label: intl.formatMessage(intCompanyMessages.roleHeader, {
|
|
107
|
+
entityType,
|
|
108
|
+
pepType: type,
|
|
109
|
+
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
110
|
+
? pepContext.state.businessRelation
|
|
111
|
+
: pepContext.state.relationToPEP,
|
|
112
|
+
name: pepContext.state.ownerName,
|
|
113
|
+
}), value: pepContext.state.internationalOrganisationRole || "", onChange: (value) => {
|
|
114
|
+
pepContext.setState({
|
|
115
|
+
internationalOrganisationRole: value,
|
|
116
|
+
});
|
|
117
|
+
}, validators: [
|
|
118
|
+
new RequiredValidator(intl.formatMessage(intCompanyMessages.roleRequired)),
|
|
119
|
+
] }))) : null,
|
|
120
|
+
pepContext.state.role &&
|
|
121
|
+
pepContext.state.role === Role.MILITARY_OFFICER ? (React.createElement(Select, { label: intl.formatMessage(militaryMessages.header, {
|
|
122
|
+
entityType,
|
|
123
|
+
pepType: type,
|
|
124
|
+
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
125
|
+
? pepContext.state.businessRelation
|
|
126
|
+
: pepContext.state.relationToPEP,
|
|
127
|
+
name: pepContext.state.ownerName,
|
|
128
|
+
possessiveName: formatPossessive(pepContext.state.ownerName, intl.locale),
|
|
129
|
+
}), placeholder: intl.formatMessage(militaryMessages.placeholder), alternatives: militaryAlternatives, value: militaryAlternatives.find((alt) => alt.value === pepContext.state.militaryRank), onChange: (event) => {
|
|
130
|
+
pepContext.setState({ militaryRank: event.value });
|
|
131
|
+
}, validators: [
|
|
132
|
+
new RequiredValidator(intl.formatMessage(militaryMessages.required)),
|
|
133
|
+
] })) : null,
|
|
134
|
+
React.createElement(PrimaryButton, { type: "submit" },
|
|
135
|
+
React.createElement(FormattedMessage, { id: "pep.role.next", description: "Next button", defaultMessage: "G\u00E5 vidare" }))));
|
|
136
|
+
};
|
|
137
|
+
export function getRoleAlts(intl) {
|
|
138
|
+
return [
|
|
139
|
+
{
|
|
140
|
+
text: intl.formatMessage(roleMessages[Role.HEAD_OF_GOVERNMENT]),
|
|
141
|
+
value: Role.HEAD_OF_GOVERNMENT,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
text: intl.formatMessage(roleMessages[Role.MINISTER]),
|
|
145
|
+
value: Role.MINISTER,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
text: intl.formatMessage(roleMessages[Role.PARLIMENT_MEMBER]),
|
|
149
|
+
value: Role.PARLIMENT_MEMBER,
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
text: intl.formatMessage(roleMessages[Role.CENTRAL_BANK_MEMBER]),
|
|
153
|
+
value: Role.CENTRAL_BANK_MEMBER,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
text: intl.formatMessage(roleMessages[Role.BOARD_MEMBER_POLITICAL_PARTY]),
|
|
157
|
+
value: Role.BOARD_MEMBER_POLITICAL_PARTY,
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
text: intl.formatMessage(roleMessages[Role.JUDGE_SUPREME_COURT]),
|
|
161
|
+
value: Role.JUDGE_SUPREME_COURT,
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
text: intl.formatMessage(roleMessages[Role.JUDGE_OTHER_HIGH_COURT]),
|
|
165
|
+
value: Role.JUDGE_OTHER_HIGH_COURT,
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
text: intl.formatMessage(roleMessages[Role.REVISION_INSTITUTE]),
|
|
169
|
+
value: Role.REVISION_INSTITUTE,
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
text: intl.formatMessage(roleMessages[Role.AMBASSADOR]),
|
|
173
|
+
value: Role.AMBASSADOR,
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
text: intl.formatMessage(roleMessages[Role.MILITARY_OFFICER]),
|
|
177
|
+
value: Role.MILITARY_OFFICER,
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
text: intl.formatMessage(roleMessages[Role.GOVERNMENT_COMPANY]),
|
|
181
|
+
value: Role.GOVERNMENT_COMPANY,
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
text: intl.formatMessage(roleMessages[Role.EU_HIGH_RANKING_POSITION]),
|
|
185
|
+
value: Role.EU_HIGH_RANKING_POSITION,
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
text: intl.formatMessage(roleMessages[Role.HIGH_RANKING_POSITION_INTERNALTIONAL_CORP]),
|
|
189
|
+
value: Role.HIGH_RANKING_POSITION_INTERNALTIONAL_CORP,
|
|
190
|
+
},
|
|
191
|
+
];
|
|
192
|
+
}
|
|
193
|
+
export function getMilitaryAlts(intl) {
|
|
194
|
+
return [
|
|
195
|
+
{
|
|
196
|
+
text: intl.formatMessage(militaryMessages[MilitaryRank.GENERAL]),
|
|
197
|
+
value: MilitaryRank.GENERAL,
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
text: intl.formatMessage(militaryMessages[MilitaryRank.LIEUTENANT_GENERAL]),
|
|
201
|
+
value: MilitaryRank.LIEUTENANT_GENERAL,
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
text: intl.formatMessage(militaryMessages[MilitaryRank.MAJOR_GENERAL]),
|
|
205
|
+
value: MilitaryRank.MAJOR_GENERAL,
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
text: intl.formatMessage(militaryMessages[MilitaryRank.ADMIRAL]),
|
|
209
|
+
value: MilitaryRank.ADMIRAL,
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
text: intl.formatMessage(militaryMessages[MilitaryRank.VICE_ADMIRAL]),
|
|
213
|
+
value: MilitaryRank.VICE_ADMIRAL,
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
text: intl.formatMessage(militaryMessages[MilitaryRank.REAR_ADMIRAL]),
|
|
217
|
+
value: MilitaryRank.REAR_ADMIRAL,
|
|
218
|
+
},
|
|
219
|
+
];
|
|
220
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export declare const isOngoingMessages: {
|
|
2
|
+
header: {
|
|
3
|
+
id: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defaultMessage: string;
|
|
6
|
+
};
|
|
7
|
+
required: {
|
|
8
|
+
id: string;
|
|
9
|
+
description: string;
|
|
10
|
+
defaultMessage: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const endedMessages: {
|
|
14
|
+
header: {
|
|
15
|
+
id: string;
|
|
16
|
+
description: string;
|
|
17
|
+
defaultMessage: string;
|
|
18
|
+
};
|
|
19
|
+
required: {
|
|
20
|
+
id: string;
|
|
21
|
+
description: string;
|
|
22
|
+
defaultMessage: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare const isLocalCountryMessages: {
|
|
26
|
+
header: {
|
|
27
|
+
id: string;
|
|
28
|
+
description: string;
|
|
29
|
+
defaultMessage: string;
|
|
30
|
+
};
|
|
31
|
+
required: {
|
|
32
|
+
id: string;
|
|
33
|
+
description: string;
|
|
34
|
+
defaultMessage: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export declare const countrySelectionMessages: {
|
|
38
|
+
header: {
|
|
39
|
+
id: string;
|
|
40
|
+
description: string;
|
|
41
|
+
defaultMessage: string;
|
|
42
|
+
};
|
|
43
|
+
required: {
|
|
44
|
+
id: string;
|
|
45
|
+
description: string;
|
|
46
|
+
defaultMessage: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export declare const localCountryAltMessages: {
|
|
50
|
+
localCountry: {
|
|
51
|
+
id: string;
|
|
52
|
+
description: string;
|
|
53
|
+
defaultMessage: string;
|
|
54
|
+
};
|
|
55
|
+
otherCountry: {
|
|
56
|
+
id: string;
|
|
57
|
+
description: string;
|
|
58
|
+
defaultMessage: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export declare const stateAltMessages: {
|
|
62
|
+
ONGOING: {
|
|
63
|
+
id: string;
|
|
64
|
+
description: string;
|
|
65
|
+
defaultMessage: string;
|
|
66
|
+
};
|
|
67
|
+
ENDED: {
|
|
68
|
+
id: string;
|
|
69
|
+
description: string;
|
|
70
|
+
defaultMessage: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { defineMessages } from "react-intl";
|
|
2
|
+
import { PepStatus } from "../PepContext";
|
|
3
|
+
export const isOngoingMessages = defineMessages({
|
|
4
|
+
header: {
|
|
5
|
+
id: "pep.status.isongoing.header",
|
|
6
|
+
description: "Is ongoing header",
|
|
7
|
+
defaultMessage: `{
|
|
8
|
+
entityType, select,
|
|
9
|
+
PERSON {
|
|
10
|
+
{
|
|
11
|
+
pepType, select,
|
|
12
|
+
ME {
|
|
13
|
+
Är din befattning pågående eller avslutad?
|
|
14
|
+
}
|
|
15
|
+
RELATIVE {
|
|
16
|
+
{
|
|
17
|
+
relation, select,
|
|
18
|
+
MARRIED_PARTNER {
|
|
19
|
+
Är din make/maka/registrerade partners befattning pågående eller avslutad?
|
|
20
|
+
}
|
|
21
|
+
COLIVING_PARTNER {
|
|
22
|
+
Är din sambos befattning pågående eller avslutad?
|
|
23
|
+
}
|
|
24
|
+
CHILD {
|
|
25
|
+
Är din förälders befattning pågående eller avslutad?
|
|
26
|
+
}
|
|
27
|
+
PARENT {
|
|
28
|
+
Är ditt barns befattning pågående eller avslutad?
|
|
29
|
+
}
|
|
30
|
+
CHILD_MARRIED_PARTNER {
|
|
31
|
+
Är din make/makas förälders befattning pågående eller avslutad?
|
|
32
|
+
}
|
|
33
|
+
CHILD_COLIVING_PARTNER {
|
|
34
|
+
Är din sambos förälders befattning pågående eller avslutad?
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
COLLEAGUE {
|
|
39
|
+
{
|
|
40
|
+
relation, select,
|
|
41
|
+
CO_OWNERSHIP {
|
|
42
|
+
Är befattningen för personen i politisk utsatt ställning, som är verklig huvudman till ett företag tillsammans med dig, pågående eller avslutad?
|
|
43
|
+
}
|
|
44
|
+
CLOSE_CONNECTION {
|
|
45
|
+
Är befattningen för personen i politisk utsatt ställning, som du har eller har haft nära förbindelse med, pågående eller avslutad?
|
|
46
|
+
}
|
|
47
|
+
COMPANY_FOR_PEP {
|
|
48
|
+
Är befattningen för personen i politisk utsatt ställning, som du har en relation till, pågående eller avslutad?
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
other {}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
CORPORATION {
|
|
56
|
+
{
|
|
57
|
+
pepType, select,
|
|
58
|
+
ME {
|
|
59
|
+
Är {possessiveName} befattning pågående eller avslutad?
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
RELATIVE {
|
|
63
|
+
{
|
|
64
|
+
relation, select,
|
|
65
|
+
MARRIED_PARTNER {
|
|
66
|
+
Är {possessiveName} make/maka/registrerade partners befattning pågående eller avslutad?
|
|
67
|
+
}
|
|
68
|
+
COLIVING_PARTNER {
|
|
69
|
+
Är {possessiveName} sambos befattning pågående eller avslutad?
|
|
70
|
+
}
|
|
71
|
+
CHILD {
|
|
72
|
+
Är {possessiveName} förälders befattning pågående eller avslutad?
|
|
73
|
+
}
|
|
74
|
+
PARENT {
|
|
75
|
+
Är {possessiveName} barns befattning pågående eller avslutad?
|
|
76
|
+
}
|
|
77
|
+
CHILD_MARRIED_PARTNER {
|
|
78
|
+
Är {possessiveName} make/makas förälders befattning pågående eller avslutad?
|
|
79
|
+
}
|
|
80
|
+
CHILD_COLIVING_PARTNER {
|
|
81
|
+
Är {possessiveName} sambos förälders befattning pågående eller avslutad?
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
COLLEAGUE {
|
|
86
|
+
{
|
|
87
|
+
relation, select,
|
|
88
|
+
CO_OWNERSHIP {
|
|
89
|
+
Är befattningen för personen i politisk utsatt ställning, som är verklig huvudman till ett företag tillsammans med {name}, pågående eller avslutad?
|
|
90
|
+
}
|
|
91
|
+
CLOSE_CONNECTION {
|
|
92
|
+
Är befattningen för personen i politisk utsatt ställning, som {name} har eller har haft nära förbindelse med, pågående eller avslutad?
|
|
93
|
+
}
|
|
94
|
+
COMPANY_FOR_PEP {
|
|
95
|
+
Är befattningen för personen i politisk utsatt ställning, som {name} har en relation till, pågående eller avslutad?
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
other {}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
other {}
|
|
103
|
+
}`,
|
|
104
|
+
},
|
|
105
|
+
required: {
|
|
106
|
+
id: "pep.status.isongoing.required",
|
|
107
|
+
description: "Is ongoing required error",
|
|
108
|
+
defaultMessage: "Du måste välja ett alternativ",
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
export const endedMessages = defineMessages({
|
|
112
|
+
header: {
|
|
113
|
+
id: "pep.status.ended.header",
|
|
114
|
+
description: "When did it end header",
|
|
115
|
+
defaultMessage: "När avslutades uppdraget?",
|
|
116
|
+
},
|
|
117
|
+
required: {
|
|
118
|
+
id: "pep.status.ended.required",
|
|
119
|
+
description: "When did it end required error",
|
|
120
|
+
defaultMessage: "Du måste ange ett slutdatum",
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
export const isLocalCountryMessages = defineMessages({
|
|
124
|
+
header: {
|
|
125
|
+
id: "pep.status.localcountry.sweden.header",
|
|
126
|
+
description: "Is local country header",
|
|
127
|
+
defaultMessage: "Är befattningen i Sverige?",
|
|
128
|
+
},
|
|
129
|
+
required: {
|
|
130
|
+
id: "pep.status.localcountry.required",
|
|
131
|
+
description: "Is local country required error",
|
|
132
|
+
defaultMessage: "Du måste välja ett alternativ",
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
export const countrySelectionMessages = defineMessages({
|
|
136
|
+
header: {
|
|
137
|
+
id: "pep.status.countryselecton.header",
|
|
138
|
+
description: "Country selection header",
|
|
139
|
+
defaultMessage: `{
|
|
140
|
+
entityType, select,
|
|
141
|
+
PERSON {
|
|
142
|
+
{
|
|
143
|
+
pepType, select,
|
|
144
|
+
ME {
|
|
145
|
+
I vilket land är/var din befattning?
|
|
146
|
+
}
|
|
147
|
+
RELATIVE {
|
|
148
|
+
{
|
|
149
|
+
relation, select,
|
|
150
|
+
MARRIED_PARTNER {
|
|
151
|
+
I vilket land är/var din make/maka/registrerade partners befattning?
|
|
152
|
+
}
|
|
153
|
+
COLIVING_PARTNER {
|
|
154
|
+
I vilket land är/var din sambos befattning?
|
|
155
|
+
}
|
|
156
|
+
CHILD {
|
|
157
|
+
I vilket land är/var din förälders befattning?
|
|
158
|
+
}
|
|
159
|
+
PARENT {
|
|
160
|
+
I vilket land är/var ditt barns befattning?
|
|
161
|
+
}
|
|
162
|
+
CHILD_MARRIED_PARTNER {
|
|
163
|
+
I vilket land är/var din make/makas förälders befattning?
|
|
164
|
+
}
|
|
165
|
+
CHILD_COLIVING_PARTNER {
|
|
166
|
+
I vilket land är/var din sambos förälders befattning?
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
COLLEAGUE {
|
|
171
|
+
{
|
|
172
|
+
relation, select,
|
|
173
|
+
CO_OWNERSHIP {
|
|
174
|
+
I vilket land har/hade personen som har bestämmande rätt över företaget som du har en relation till sin befattning?
|
|
175
|
+
}
|
|
176
|
+
CLOSE_CONNECTION {
|
|
177
|
+
I vilket land har/hade personen som du har eller har haft nära förbindelse med sin befattning?
|
|
178
|
+
}
|
|
179
|
+
COMPANY_FOR_PEP {
|
|
180
|
+
I vilket land har/hade personen i politisk utsatt ställning som du har en relation till sin befattning?
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
other {}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
CORPORATION {
|
|
188
|
+
{
|
|
189
|
+
pepType, select,
|
|
190
|
+
ME {
|
|
191
|
+
I vilket land är/var {possessiveName} befattning?
|
|
192
|
+
|
|
193
|
+
}
|
|
194
|
+
RELATIVE {
|
|
195
|
+
{
|
|
196
|
+
relation, select,
|
|
197
|
+
MARRIED_PARTNER {
|
|
198
|
+
I vilket land är/var {possessiveName} make/maka/registrerade partners befattning?
|
|
199
|
+
}
|
|
200
|
+
COLIVING_PARTNER {
|
|
201
|
+
I vilket land är/var {possessiveName} sambos befattning?
|
|
202
|
+
}
|
|
203
|
+
CHILD {
|
|
204
|
+
I vilket land är/var {possessiveName} förälders befattning?
|
|
205
|
+
}
|
|
206
|
+
PARENT {
|
|
207
|
+
I vilket land är/var {possessiveName} barns befattning?
|
|
208
|
+
}
|
|
209
|
+
CHILD_MARRIED_PARTNER {
|
|
210
|
+
I vilket land är/var {possessiveName} make/makas förälders befattning?
|
|
211
|
+
}
|
|
212
|
+
CHILD_COLIVING_PARTNER {
|
|
213
|
+
I vilket land är/var {possessiveName} sambos förälders befattning?
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
COLLEAGUE {
|
|
218
|
+
{
|
|
219
|
+
relation, select,
|
|
220
|
+
CO_OWNERSHIP {
|
|
221
|
+
I vilket land har/hade personen som har bestämmande rätt över företaget som {name} har en relation till sin befattning?
|
|
222
|
+
}
|
|
223
|
+
CLOSE_CONNECTION {
|
|
224
|
+
I vilket land har/hade personen som {name} har eller har haft nära förbindelse med sin befattning?
|
|
225
|
+
}
|
|
226
|
+
COMPANY_FOR_PEP {
|
|
227
|
+
I vilket land har/hade personen i politisk utsatt ställning som {name} har en relation till sin befattning?
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
other {}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
other {}
|
|
235
|
+
}`,
|
|
236
|
+
},
|
|
237
|
+
required: {
|
|
238
|
+
id: "pep.status.countryselecton.required",
|
|
239
|
+
description: "Country selection required error",
|
|
240
|
+
defaultMessage: "Du måste välja ett land",
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
export const localCountryAltMessages = defineMessages({
|
|
244
|
+
localCountry: {
|
|
245
|
+
id: "pep.status.localcountryalt.required",
|
|
246
|
+
description: "Local country name",
|
|
247
|
+
defaultMessage: "Sverige",
|
|
248
|
+
},
|
|
249
|
+
otherCountry: {
|
|
250
|
+
id: "pep.status.othercountryalt.required",
|
|
251
|
+
description: "Other country",
|
|
252
|
+
defaultMessage: "Annat",
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
export const stateAltMessages = defineMessages({
|
|
256
|
+
[PepStatus.ONGOING]: {
|
|
257
|
+
id: "pep.status.state.ONGOING",
|
|
258
|
+
description: "Ongoing alt",
|
|
259
|
+
defaultMessage: "Pågående",
|
|
260
|
+
},
|
|
261
|
+
[PepStatus.ENDED]: {
|
|
262
|
+
id: "pep.status.state.ENDED",
|
|
263
|
+
description: "Ended alt",
|
|
264
|
+
defaultMessage: "Avslutad",
|
|
265
|
+
},
|
|
266
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React, { useRef, useCallback, useContext, } from "react";
|
|
2
|
+
import { Form, RadioGroup, RequiredValidator, PrimaryButton, Datepicker, } from "@lysaab/ui-2";
|
|
3
|
+
import { PepContext, PepStatus, EntityType, PepType } from "../PepContext";
|
|
4
|
+
import { CountrySelect } from "../../components/CountrySelect";
|
|
5
|
+
import { useIntl, FormattedMessage } from "react-intl";
|
|
6
|
+
import { isOngoingMessages, endedMessages, isLocalCountryMessages, countrySelectionMessages, localCountryAltMessages, stateAltMessages, } from "./StatusMessages";
|
|
7
|
+
import { formatPossessive } from "../../utils/Possession";
|
|
8
|
+
export const StatusPage = ({ next }) => {
|
|
9
|
+
const pepContext = useContext(PepContext);
|
|
10
|
+
const formRef = useRef();
|
|
11
|
+
const intl = useIntl();
|
|
12
|
+
const stateAlternatives = getStateAlternatives(intl);
|
|
13
|
+
const isSwedenAlternatives = getIsLocalCountryAlternatives(intl);
|
|
14
|
+
const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
|
|
15
|
+
const nextPage = useCallback(() => {
|
|
16
|
+
if (formRef.current && formRef.current.isValid) {
|
|
17
|
+
next();
|
|
18
|
+
}
|
|
19
|
+
}, [formRef, next]);
|
|
20
|
+
const updateIsSweden = useCallback((alternative) => {
|
|
21
|
+
pepContext.setState({ isSweden: alternative.value });
|
|
22
|
+
if (alternative.value === "other") {
|
|
23
|
+
pepContext.setState({ country: undefined });
|
|
24
|
+
}
|
|
25
|
+
}, [pepContext]);
|
|
26
|
+
const updateIsOngoing = useCallback((alternative) => {
|
|
27
|
+
pepContext.setState({ isOngoing: alternative.value });
|
|
28
|
+
if (alternative.value === PepStatus.ONGOING) {
|
|
29
|
+
pepContext.setState({ ended: undefined });
|
|
30
|
+
}
|
|
31
|
+
}, [pepContext]);
|
|
32
|
+
return (React.createElement("div", null,
|
|
33
|
+
React.createElement(Form, { lysaFormRef: formRef, onSubmit: () => {
|
|
34
|
+
nextPage();
|
|
35
|
+
} },
|
|
36
|
+
React.createElement(RadioGroup, { alternatives: stateAlternatives, header: intl.formatMessage(isOngoingMessages.header, {
|
|
37
|
+
entityType,
|
|
38
|
+
name: pepContext.state.ownerName,
|
|
39
|
+
possessiveName: formatPossessive(pepContext.state.ownerName, intl.locale),
|
|
40
|
+
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
41
|
+
? pepContext.state.businessRelation
|
|
42
|
+
: pepContext.state.relationToPEP,
|
|
43
|
+
pepType: pepContext.state.type,
|
|
44
|
+
}), onChange: updateIsOngoing, value: stateAlternatives.find((alt) => alt.value === pepContext.state.isOngoing), validators: [
|
|
45
|
+
new RequiredValidator(intl.formatMessage(isOngoingMessages.required)),
|
|
46
|
+
] }),
|
|
47
|
+
pepContext.state.isOngoing &&
|
|
48
|
+
pepContext.state.isOngoing === PepStatus.ENDED ? (React.createElement(Datepicker, { label: intl.formatMessage(endedMessages.header), selected: pepContext.state.ended, onChange: (event) => pepContext.setState({ ended: event || undefined }), validators: [
|
|
49
|
+
new RequiredValidator(intl.formatMessage(isOngoingMessages.required)),
|
|
50
|
+
], showMonthYearPicker: true, dateFormat: "yyyy-MM", maxDate: new Date() })) : null,
|
|
51
|
+
React.createElement(RadioGroup, { alternatives: isSwedenAlternatives, header: intl.formatMessage(isLocalCountryMessages.header, {
|
|
52
|
+
possessiveName: formatPossessive(pepContext.state.ownerName, intl.locale),
|
|
53
|
+
}), onChange: updateIsSweden, value: isSwedenAlternatives.find((alt) => alt.value === pepContext.state.isSweden), validators: [
|
|
54
|
+
new RequiredValidator(intl.formatMessage(isLocalCountryMessages.required)),
|
|
55
|
+
] }),
|
|
56
|
+
pepContext.state.isSweden && pepContext.state.isSweden === "other" ? (React.createElement(CountrySelect, { label: intl.formatMessage(countrySelectionMessages.header, {
|
|
57
|
+
entityType,
|
|
58
|
+
name: pepContext.state.ownerName,
|
|
59
|
+
possessiveName: formatPossessive(pepContext.state.ownerName, intl.locale),
|
|
60
|
+
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
61
|
+
? pepContext.state.businessRelation
|
|
62
|
+
: pepContext.state.relationToPEP,
|
|
63
|
+
pepType: pepContext.state.type,
|
|
64
|
+
}), onChange: (event) => pepContext.setState({
|
|
65
|
+
country: event.value ? event.value.toString() : undefined,
|
|
66
|
+
}), validators: [
|
|
67
|
+
new RequiredValidator(intl.formatMessage(countrySelectionMessages.required)),
|
|
68
|
+
], value: pepContext.state.country, omitCountries: ["SE"] })) : null,
|
|
69
|
+
React.createElement(PrimaryButton, { type: "submit" },
|
|
70
|
+
React.createElement(FormattedMessage, { id: "pep.status.next", description: "Next button", defaultMessage: "G\u00E5 vidare" })))));
|
|
71
|
+
};
|
|
72
|
+
function getIsLocalCountryAlternatives(intl) {
|
|
73
|
+
return [
|
|
74
|
+
{
|
|
75
|
+
text: intl.formatMessage(localCountryAltMessages.localCountry),
|
|
76
|
+
value: "sweden",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
text: intl.formatMessage(localCountryAltMessages.otherCountry),
|
|
80
|
+
value: "other",
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
function getStateAlternatives(intl) {
|
|
85
|
+
return [
|
|
86
|
+
{
|
|
87
|
+
text: intl.formatMessage(stateAltMessages[PepStatus.ONGOING]),
|
|
88
|
+
value: PepStatus.ONGOING,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
text: intl.formatMessage(stateAltMessages[PepStatus.ENDED]),
|
|
92
|
+
value: PepStatus.ENDED,
|
|
93
|
+
},
|
|
94
|
+
];
|
|
95
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatPossessive(text: string | undefined, locale: string): string | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function formatPossessive(text, locale) {
|
|
2
|
+
if (!text) {
|
|
3
|
+
return;
|
|
4
|
+
}
|
|
5
|
+
const language = locale.substr(0, 2);
|
|
6
|
+
if (language === "sv") {
|
|
7
|
+
return formatSwedish(text);
|
|
8
|
+
}
|
|
9
|
+
return text;
|
|
10
|
+
}
|
|
11
|
+
function formatSwedish(text) {
|
|
12
|
+
if (text[text.length - 1] !== "s" &&
|
|
13
|
+
text[text.length - 1] !== "z" &&
|
|
14
|
+
text[text.length - 1] !== "x") {
|
|
15
|
+
text += "s";
|
|
16
|
+
}
|
|
17
|
+
return text;
|
|
18
|
+
}
|