@lysaab/lysa-pep 1.0.1-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/lib/pages/IsPep/IsPepMessages.js +18 -26
- package/lib/pages/IsPep/IsPepPage.js +34 -14
- package/lib/pages/RelationPage/RelationMessages.js +40 -39
- package/lib/pages/RelationPage/RelationPage.js +54 -43
- package/lib/pages/RolePage/RoleMessages.js +61 -57
- package/lib/pages/RolePage/RolePage.js +74 -68
- package/lib/pages/StatusPage/StatusMessages.js +196 -4
- package/lib/pages/StatusPage/StatusPage.js +39 -19
- package/lib/utils/Possession.d.ts +1 -0
- package/lib/utils/Possession.js +18 -0
- package/package.json +2 -2
- package/src/demo/Pep.tsx +22 -22
- package/src/pages/IsPep/IsPepMessages.ts +35 -43
- package/src/pages/IsPep/IsPepPage.tsx +37 -17
- package/src/pages/RelationPage/RelationMessages.ts +40 -39
- package/src/pages/RelationPage/RelationPage.tsx +76 -46
- package/src/pages/RolePage/RoleMessages.ts +61 -57
- package/src/pages/RolePage/RolePage.tsx +90 -76
- package/src/pages/StatusPage/StatusMessages.ts +196 -4
- package/src/pages/StatusPage/StatusPage.tsx +59 -24
- package/src/utils/Possession.ts +21 -0
|
@@ -4,7 +4,103 @@ export const isOngoingMessages = defineMessages({
|
|
|
4
4
|
header: {
|
|
5
5
|
id: "pep.status.isongoing.header",
|
|
6
6
|
description: "Is ongoing header",
|
|
7
|
-
defaultMessage:
|
|
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
|
+
}`,
|
|
8
104
|
},
|
|
9
105
|
required: {
|
|
10
106
|
id: "pep.status.isongoing.required",
|
|
@@ -28,7 +124,7 @@ export const isLocalCountryMessages = defineMessages({
|
|
|
28
124
|
header: {
|
|
29
125
|
id: "pep.status.localcountry.sweden.header",
|
|
30
126
|
description: "Is local country header",
|
|
31
|
-
defaultMessage: "
|
|
127
|
+
defaultMessage: "Är befattningen i Sverige?",
|
|
32
128
|
},
|
|
33
129
|
required: {
|
|
34
130
|
id: "pep.status.localcountry.required",
|
|
@@ -40,12 +136,108 @@ export const countrySelectionMessages = defineMessages({
|
|
|
40
136
|
header: {
|
|
41
137
|
id: "pep.status.countryselecton.header",
|
|
42
138
|
description: "Country selection header",
|
|
43
|
-
defaultMessage:
|
|
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
|
+
}`,
|
|
44
236
|
},
|
|
45
237
|
required: {
|
|
46
238
|
id: "pep.status.countryselecton.required",
|
|
47
239
|
description: "Country selection required error",
|
|
48
|
-
defaultMessage: "Du måste välja land",
|
|
240
|
+
defaultMessage: "Du måste välja ett land",
|
|
49
241
|
},
|
|
50
242
|
});
|
|
51
243
|
export const localCountryAltMessages = defineMessages({
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import React, { useRef, useCallback, useContext } from "react";
|
|
2
|
-
import { Form, RadioGroup, RequiredValidator, PrimaryButton, Datepicker } from "@lysaab/ui-2";
|
|
3
|
-
import { PepContext, PepStatus } from "../PepContext";
|
|
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
4
|
import { CountrySelect } from "../../components/CountrySelect";
|
|
5
5
|
import { useIntl, FormattedMessage } from "react-intl";
|
|
6
|
-
import { isOngoingMessages, endedMessages, isLocalCountryMessages, countrySelectionMessages, localCountryAltMessages, stateAltMessages } from "./StatusMessages";
|
|
6
|
+
import { isOngoingMessages, endedMessages, isLocalCountryMessages, countrySelectionMessages, localCountryAltMessages, stateAltMessages, } from "./StatusMessages";
|
|
7
|
+
import { formatPossessive } from "../../utils/Possession";
|
|
7
8
|
export const StatusPage = ({ next }) => {
|
|
8
9
|
const pepContext = useContext(PepContext);
|
|
9
10
|
const formRef = useRef();
|
|
10
11
|
const intl = useIntl();
|
|
11
12
|
const stateAlternatives = getStateAlternatives(intl);
|
|
12
13
|
const isSwedenAlternatives = getIsLocalCountryAlternatives(intl);
|
|
14
|
+
const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
|
|
13
15
|
const nextPage = useCallback(() => {
|
|
14
16
|
if (formRef.current && formRef.current.isValid) {
|
|
15
17
|
next();
|
|
@@ -31,20 +33,38 @@ export const StatusPage = ({ next }) => {
|
|
|
31
33
|
React.createElement(Form, { lysaFormRef: formRef, onSubmit: () => {
|
|
32
34
|
nextPage();
|
|
33
35
|
} },
|
|
34
|
-
React.createElement(RadioGroup, { alternatives: stateAlternatives, header: intl.formatMessage(isOngoingMessages.header
|
|
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)),
|
|
36
46
|
] }),
|
|
37
47
|
pepContext.state.isOngoing &&
|
|
38
|
-
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: [
|
|
39
|
-
RequiredValidator(intl.formatMessage(isOngoingMessages.required))
|
|
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)),
|
|
40
50
|
], showMonthYearPicker: true, dateFormat: "yyyy-MM", maxDate: new Date() })) : null,
|
|
41
|
-
React.createElement(RadioGroup, { alternatives: isSwedenAlternatives, header: intl.formatMessage(isLocalCountryMessages.header
|
|
42
|
-
|
|
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)),
|
|
43
55
|
] }),
|
|
44
|
-
pepContext.state.isSweden && pepContext.state.isSweden === "other" ? (React.createElement(CountrySelect, { label: intl.formatMessage(countrySelectionMessages.header
|
|
45
|
-
|
|
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,
|
|
46
66
|
}), validators: [
|
|
47
|
-
RequiredValidator(intl.formatMessage(countrySelectionMessages.required))
|
|
67
|
+
new RequiredValidator(intl.formatMessage(countrySelectionMessages.required)),
|
|
48
68
|
], value: pepContext.state.country, omitCountries: ["SE"] })) : null,
|
|
49
69
|
React.createElement(PrimaryButton, { type: "submit" },
|
|
50
70
|
React.createElement(FormattedMessage, { id: "pep.status.next", description: "Next button", defaultMessage: "G\u00E5 vidare" })))));
|
|
@@ -53,23 +73,23 @@ function getIsLocalCountryAlternatives(intl) {
|
|
|
53
73
|
return [
|
|
54
74
|
{
|
|
55
75
|
text: intl.formatMessage(localCountryAltMessages.localCountry),
|
|
56
|
-
value: "sweden"
|
|
76
|
+
value: "sweden",
|
|
57
77
|
},
|
|
58
78
|
{
|
|
59
79
|
text: intl.formatMessage(localCountryAltMessages.otherCountry),
|
|
60
|
-
value: "other"
|
|
61
|
-
}
|
|
80
|
+
value: "other",
|
|
81
|
+
},
|
|
62
82
|
];
|
|
63
83
|
}
|
|
64
84
|
function getStateAlternatives(intl) {
|
|
65
85
|
return [
|
|
66
86
|
{
|
|
67
87
|
text: intl.formatMessage(stateAltMessages[PepStatus.ONGOING]),
|
|
68
|
-
value: PepStatus.ONGOING
|
|
88
|
+
value: PepStatus.ONGOING,
|
|
69
89
|
},
|
|
70
90
|
{
|
|
71
91
|
text: intl.formatMessage(stateAltMessages[PepStatus.ENDED]),
|
|
72
|
-
value: PepStatus.ENDED
|
|
73
|
-
}
|
|
92
|
+
value: PepStatus.ENDED,
|
|
93
|
+
},
|
|
74
94
|
];
|
|
75
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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lysaab/lysa-pep",
|
|
3
3
|
"author": "Lysa AB",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2-0",
|
|
5
5
|
"main": "./lib/Exports.js",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@types/luxon": "^1.15.2",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"react-intl": "^4.1.1"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@lysaab/ui-2": "^
|
|
13
|
+
"@lysaab/ui-2": "^18.0.0",
|
|
14
14
|
"@types/jest": "24.0.20",
|
|
15
15
|
"@types/luxon": "^1.15.2",
|
|
16
16
|
"@types/node": "12.11.7",
|
package/src/demo/Pep.tsx
CHANGED
|
@@ -19,7 +19,7 @@ export function Pep() {
|
|
|
19
19
|
pepContext.setState({
|
|
20
20
|
ownerName: "Sean Banan",
|
|
21
21
|
tin: "191212121212",
|
|
22
|
-
legalEntityType: EntityType.PERSON
|
|
22
|
+
legalEntityType: EntityType.PERSON,
|
|
23
23
|
});
|
|
24
24
|
loaded.current = true;
|
|
25
25
|
}
|
|
@@ -35,30 +35,30 @@ export function Pep() {
|
|
|
35
35
|
onBack={() => {
|
|
36
36
|
if (page === 4 && type === PepType.NOT_PEP) {
|
|
37
37
|
setPage(0);
|
|
38
|
-
} else if (page ===
|
|
39
|
-
setPage(
|
|
38
|
+
} else if (page === 2 && type === PepType.ME) {
|
|
39
|
+
setPage(0);
|
|
40
40
|
} else {
|
|
41
41
|
setPage(page - 1);
|
|
42
42
|
}
|
|
43
43
|
}}
|
|
44
44
|
transitionKey={page.toString()}
|
|
45
|
-
onExit={() => {
|
|
45
|
+
onExit={() => {}}
|
|
46
46
|
>
|
|
47
47
|
{page === 0 ? (
|
|
48
48
|
<IsPepPage
|
|
49
|
-
next={() =>
|
|
50
|
-
type
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
49
|
+
next={() => {
|
|
50
|
+
if (type === PepType.NOT_PEP) {
|
|
51
|
+
setPage(4);
|
|
52
|
+
} else if (type === PepType.ME) {
|
|
53
|
+
setPage(page + 2);
|
|
54
|
+
} else {
|
|
55
|
+
setPage(page + 1);
|
|
56
|
+
}
|
|
57
|
+
}}
|
|
59
58
|
/>
|
|
60
59
|
) : null}
|
|
61
|
-
{page ===
|
|
60
|
+
{page === 1 ? <RelationPage next={() => setPage(page + 1)} /> : null}
|
|
61
|
+
{page === 2 ? <StatusPage next={() => setPage(page + 1)} /> : null}
|
|
62
62
|
{page === 3 ? <RolePage next={() => setPage(page + 1)} /> : null}
|
|
63
63
|
{page === 4 ? <Done /> : null}
|
|
64
64
|
</Story>
|
|
@@ -68,14 +68,14 @@ export function Pep() {
|
|
|
68
68
|
<div>
|
|
69
69
|
<label>
|
|
70
70
|
Verkligen huvudman
|
|
71
|
-
|
|
71
|
+
<input
|
|
72
72
|
type="checkbox"
|
|
73
73
|
value={"true"}
|
|
74
|
-
onChange={event =>
|
|
74
|
+
onChange={(event) =>
|
|
75
75
|
pepContext.setState({
|
|
76
76
|
legalEntityType: event.currentTarget.checked
|
|
77
77
|
? EntityType.CORPORATION
|
|
78
|
-
: EntityType.PERSON
|
|
78
|
+
: EntityType.PERSON,
|
|
79
79
|
})
|
|
80
80
|
}
|
|
81
81
|
/>
|
|
@@ -84,10 +84,10 @@ export function Pep() {
|
|
|
84
84
|
<div>
|
|
85
85
|
<label>
|
|
86
86
|
Namnet på den verkliga huvudmannen
|
|
87
|
-
|
|
87
|
+
<input
|
|
88
88
|
type="text"
|
|
89
89
|
value={pepContext.state.ownerName || ""}
|
|
90
|
-
onChange={event =>
|
|
90
|
+
onChange={(event) =>
|
|
91
91
|
pepContext.setState({ ownerName: event.currentTarget.value })
|
|
92
92
|
}
|
|
93
93
|
/>
|
|
@@ -96,10 +96,10 @@ export function Pep() {
|
|
|
96
96
|
<div>
|
|
97
97
|
<label>
|
|
98
98
|
Personnummer på huvudmannen
|
|
99
|
-
|
|
99
|
+
<input
|
|
100
100
|
type="text"
|
|
101
101
|
value={pepContext.state.tin || ""}
|
|
102
|
-
onChange={event =>
|
|
102
|
+
onChange={(event) =>
|
|
103
103
|
pepContext.setState({ tin: event.currentTarget.value })
|
|
104
104
|
}
|
|
105
105
|
/>
|
|
@@ -2,10 +2,10 @@ import { defineMessages } from "react-intl";
|
|
|
2
2
|
import { PepType } from "../PepContext";
|
|
3
3
|
|
|
4
4
|
export const messages = defineMessages({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
header: {
|
|
6
|
+
id: "pep.ispep.header",
|
|
7
|
+
description: "Not pep",
|
|
8
|
+
defaultMessage: `{
|
|
9
9
|
entityType, select,
|
|
10
10
|
PERSON {
|
|
11
11
|
Är du eller en närstående till dig en person i politisk utsatt ställning? (PEP)
|
|
@@ -13,30 +13,22 @@ export const messages = defineMessages({
|
|
|
13
13
|
CORPORATION {
|
|
14
14
|
Är {name} eller en närstående till {name} en person i politisk utsatt ställning? (PEP)
|
|
15
15
|
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
id: 'pep.ispep.NOT_PEP',
|
|
33
|
-
description: 'Not pep',
|
|
34
|
-
defaultMessage: 'Nej'
|
|
35
|
-
},
|
|
36
|
-
[PepType.ME]: {
|
|
37
|
-
id: 'pep.ispep.ME',
|
|
38
|
-
description: 'The person is pep',
|
|
39
|
-
defaultMessage: `{
|
|
16
|
+
}`,
|
|
17
|
+
},
|
|
18
|
+
required: {
|
|
19
|
+
id: "pep.ispep.required",
|
|
20
|
+
description: "Not pep",
|
|
21
|
+
defaultMessage: "Du måste välja ett alternativ",
|
|
22
|
+
},
|
|
23
|
+
[PepType.NOT_PEP]: {
|
|
24
|
+
id: "pep.ispep.NOT_PEP",
|
|
25
|
+
description: "Not pep",
|
|
26
|
+
defaultMessage: "Nej",
|
|
27
|
+
},
|
|
28
|
+
[PepType.ME]: {
|
|
29
|
+
id: "pep.ispep.ME",
|
|
30
|
+
description: "The person is pep",
|
|
31
|
+
defaultMessage: `{
|
|
40
32
|
entityType, select,
|
|
41
33
|
PERSON {
|
|
42
34
|
Jag har en funktion som gör mig till PEP
|
|
@@ -44,12 +36,12 @@ export const messages = defineMessages({
|
|
|
44
36
|
CORPORATION {
|
|
45
37
|
På grund av sin funktion är {name} PEP
|
|
46
38
|
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
39
|
+
}`,
|
|
40
|
+
},
|
|
41
|
+
[PepType.RELATIVE]: {
|
|
42
|
+
id: "pep.ispep.RELATIVE",
|
|
43
|
+
description: "Jag har en relation med en person som är PEP",
|
|
44
|
+
defaultMessage: `{
|
|
53
45
|
entityType, select,
|
|
54
46
|
PERSON {
|
|
55
47
|
Jag har en relation med en person som är PEP
|
|
@@ -57,12 +49,12 @@ export const messages = defineMessages({
|
|
|
57
49
|
CORPORATION {
|
|
58
50
|
{name} är medarbetare till, eller har en affärsrelation med, en person som är PEP
|
|
59
51
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
}`,
|
|
53
|
+
},
|
|
54
|
+
[PepType.COLLEAGUE]: {
|
|
55
|
+
id: "pep.ispep.COLLEAGUE",
|
|
56
|
+
description: "The person has a colleague that is pep",
|
|
57
|
+
defaultMessage: `{
|
|
66
58
|
entityType, select,
|
|
67
59
|
PERSON {
|
|
68
60
|
Jag är medarbetare till, eller har en affärsrelation med, en person som är PEP
|
|
@@ -70,6 +62,6 @@ export const messages = defineMessages({
|
|
|
70
62
|
CORPORATION {
|
|
71
63
|
På grund av sin funktion är {name} PEP
|
|
72
64
|
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
})
|
|
65
|
+
}`,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
@@ -2,14 +2,14 @@ import React, {
|
|
|
2
2
|
FunctionComponent,
|
|
3
3
|
useRef,
|
|
4
4
|
useCallback,
|
|
5
|
-
useContext
|
|
5
|
+
useContext,
|
|
6
6
|
} from "react";
|
|
7
7
|
import {
|
|
8
8
|
Form,
|
|
9
9
|
RadioGroup,
|
|
10
10
|
RequiredValidator,
|
|
11
11
|
PrimaryButton,
|
|
12
|
-
LysaFormRef
|
|
12
|
+
LysaFormRef,
|
|
13
13
|
} from "@lysaab/ui-2";
|
|
14
14
|
import { PepType, PepContext, EntityType } from "../PepContext";
|
|
15
15
|
import { useIntl, FormattedMessage } from "react-intl";
|
|
@@ -30,33 +30,53 @@ export const IsPepRadioGroup: FunctionComponent<ExternalIsPepState> = ({
|
|
|
30
30
|
ownerName,
|
|
31
31
|
entityType,
|
|
32
32
|
type,
|
|
33
|
-
onChange
|
|
33
|
+
onChange,
|
|
34
34
|
}) => {
|
|
35
35
|
const intl = useIntl();
|
|
36
36
|
|
|
37
37
|
const IsPepAlternatives = [
|
|
38
38
|
{
|
|
39
|
-
text: intl.formatMessage(messages[PepType.NOT_PEP], {
|
|
40
|
-
|
|
39
|
+
text: intl.formatMessage(messages[PepType.NOT_PEP], {
|
|
40
|
+
entityType,
|
|
41
|
+
name: ownerName,
|
|
42
|
+
}),
|
|
43
|
+
value: PepType.NOT_PEP,
|
|
41
44
|
},
|
|
42
|
-
{ text: intl.formatMessage(messages[PepType.ME], { entityType, name: ownerName }), value: PepType.ME },
|
|
43
45
|
{
|
|
44
|
-
text: intl.formatMessage(messages[PepType.
|
|
45
|
-
|
|
46
|
+
text: intl.formatMessage(messages[PepType.ME], {
|
|
47
|
+
entityType,
|
|
48
|
+
name: ownerName,
|
|
49
|
+
}),
|
|
50
|
+
value: PepType.ME,
|
|
46
51
|
},
|
|
47
52
|
{
|
|
48
|
-
text: intl.formatMessage(messages[PepType.
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
text: intl.formatMessage(messages[PepType.RELATIVE], {
|
|
54
|
+
entityType,
|
|
55
|
+
name: ownerName,
|
|
56
|
+
}),
|
|
57
|
+
value: PepType.RELATIVE,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
text: intl.formatMessage(messages[PepType.COLLEAGUE], {
|
|
61
|
+
entityType,
|
|
62
|
+
name: ownerName,
|
|
63
|
+
}),
|
|
64
|
+
value: PepType.COLLEAGUE,
|
|
65
|
+
},
|
|
51
66
|
];
|
|
52
67
|
|
|
53
68
|
return (
|
|
54
69
|
<RadioGroup
|
|
55
70
|
alternatives={IsPepAlternatives}
|
|
56
|
-
onChange={alt => onChange(alt.value)}
|
|
57
|
-
value={IsPepAlternatives.find(alt => alt.value === type)}
|
|
58
|
-
header={intl.formatMessage(messages.header, {
|
|
59
|
-
|
|
71
|
+
onChange={(alt) => onChange(alt.value)}
|
|
72
|
+
value={IsPepAlternatives.find((alt) => alt.value === type)}
|
|
73
|
+
header={intl.formatMessage(messages.header, {
|
|
74
|
+
entityType,
|
|
75
|
+
name: ownerName,
|
|
76
|
+
})}
|
|
77
|
+
validators={[
|
|
78
|
+
new RequiredValidator(intl.formatMessage(messages.required)),
|
|
79
|
+
]}
|
|
60
80
|
/>
|
|
61
81
|
);
|
|
62
82
|
};
|
|
@@ -77,7 +97,7 @@ export const IsPepPage: FunctionComponent<Props> = ({ next }) => {
|
|
|
77
97
|
entityType={pepContext.state.legalEntityType || EntityType.PERSON}
|
|
78
98
|
ownerName={pepContext.state.ownerName || ""}
|
|
79
99
|
type={pepContext.state.type}
|
|
80
|
-
onChange={type => {
|
|
100
|
+
onChange={(type) => {
|
|
81
101
|
pepContext.setState({ type });
|
|
82
102
|
}}
|
|
83
103
|
/>
|
|
@@ -86,7 +106,7 @@ export const IsPepPage: FunctionComponent<Props> = ({ next }) => {
|
|
|
86
106
|
<FormattedMessage
|
|
87
107
|
id="pep.ispep.next"
|
|
88
108
|
description="Next button"
|
|
89
|
-
defaultMessage=
|
|
109
|
+
defaultMessage="Gå vidare"
|
|
90
110
|
/>
|
|
91
111
|
</PrimaryButton>
|
|
92
112
|
</Form>
|