@lysaab/lysa-pep 0.16.0 → 0.17.1
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/components/PepAnswers.js +9 -7
- package/lib/model/PepTexts.d.ts +4 -0
- package/lib/model/PepTexts.js +8 -3
- package/lib/pages/PepIsPepPage.d.ts +8 -7
- package/lib/pages/PepIsPepPage.js +16 -18
- package/lib/pages/PepStatusPage.js +6 -3
- package/package.json +3 -2
- package/src/components/PepAnswers.tsx +10 -7
- package/src/demo/Pep.tsx +12 -11
- package/src/model/PepTexts.ts +8 -3
- package/src/pages/PepIsPepPage.tsx +44 -37
- package/src/pages/PepStatusPage.tsx +7 -3
- package/.env.development +0 -1
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
2
|
import "./PepAnswers.scss";
|
|
3
3
|
import { countries } from "../model/Countries";
|
|
4
4
|
import { LABELS } from "../model/PepTexts";
|
|
5
5
|
import { roleAlternatives, militaryAlternatives } from "../pages/PepRolePage";
|
|
6
|
-
import { EntityType, PepType } from "../pages/PepContext";
|
|
6
|
+
import { EntityType, PepType, PepContext } from "../pages/PepContext";
|
|
7
7
|
export const PepAnswers = ({ answer }) => {
|
|
8
|
+
const pepContext = useContext(PepContext);
|
|
8
9
|
if (!answer.type || answer.type === PepType.NOT_PEP) {
|
|
9
10
|
return React.createElement("div", null,
|
|
10
11
|
React.createElement("p", null, "Personen \u00E4r inte PEP"));
|
|
11
12
|
}
|
|
12
|
-
const
|
|
13
|
+
const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
|
|
14
|
+
const labels = LABELS(pepContext.state.ownerName);
|
|
13
15
|
const country = countries.find(country => country.value === answer.country);
|
|
14
16
|
const role = roleAlternatives.find(alt => alt.value === answer.role);
|
|
15
17
|
const militaryRank = militaryAlternatives.find(alt => alt.value === answer.militaryRank);
|
|
16
18
|
return (React.createElement("div", null,
|
|
17
|
-
answer.type && (React.createElement(StaticInput, { label: "Vem \u00E4r pep", value: labels[
|
|
18
|
-
answer.relationToPEP && (React.createElement(StaticInput, { label: "Relation", value: labels[
|
|
19
|
-
answer.businessRelation && (React.createElement(StaticInput, { label: "Relation", value: labels[
|
|
19
|
+
answer.type && (React.createElement(StaticInput, { label: "Vem \u00E4r pep", value: labels[entityType].GENERIC.IS_PEP[answer.type] })),
|
|
20
|
+
answer.relationToPEP && (React.createElement(StaticInput, { label: "Relation", value: labels[entityType][PepType.RELATIVE].RELATION[answer.relationToPEP] })),
|
|
21
|
+
answer.businessRelation && (React.createElement(StaticInput, { label: "Relation", value: labels[entityType][PepType.COLLEAGUE].BUSINESS_RELATION[answer.businessRelation] })),
|
|
20
22
|
answer.nameOfPEP && (React.createElement(StaticInput, { label: "Namn p\u00E5 personen", value: answer.nameOfPEP })),
|
|
21
23
|
answer.birthdayOfPEP && (React.createElement(StaticInput, { label: "F\u00F6delsedag f\u00F6r personen", value: answer.birthdayOfPEP })),
|
|
22
24
|
answer.ended ? (React.createElement(React.Fragment, null,
|
|
@@ -30,7 +32,7 @@ export const PepAnswers = ({ answer }) => {
|
|
|
30
32
|
answer.governmentCompanyRole && (React.createElement(StaticInput, { label: "Roll p\u00E5 f\u00F6retaget", value: answer.governmentCompanyRole })),
|
|
31
33
|
answer.internationalOrganisation && (React.createElement(StaticInput, { label: "Organisationens namn", value: answer.internationalOrganisation })),
|
|
32
34
|
answer.internationalOrganisationRole && (React.createElement(StaticInput, { label: "Roll i organisationen", value: answer.internationalOrganisationRole })),
|
|
33
|
-
militaryRank && (React.createElement(StaticInput, { label: "Milit\u00E4r grad", value: militaryRank.
|
|
35
|
+
militaryRank && (React.createElement(StaticInput, { label: "Milit\u00E4r grad", value: militaryRank.text }))));
|
|
34
36
|
};
|
|
35
37
|
const StaticInput = ({ label, value }) => {
|
|
36
38
|
return (React.createElement("div", { className: "static-input" },
|
package/lib/model/PepTexts.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export declare const LABELS: (name?: string | undefined) => {
|
|
|
9
9
|
[PepType.COLLEAGUE]: string;
|
|
10
10
|
};
|
|
11
11
|
IS_PEP_HEADER: string;
|
|
12
|
+
STATUS_ONGOING_HEADER: string;
|
|
13
|
+
STATUS_COUNTRY_HEADER: string;
|
|
12
14
|
};
|
|
13
15
|
ME: {
|
|
14
16
|
ROLE_LABEL: string;
|
|
@@ -165,6 +167,8 @@ export declare const LABELS: (name?: string | undefined) => {
|
|
|
165
167
|
[PepType.COLLEAGUE]: string;
|
|
166
168
|
};
|
|
167
169
|
IS_PEP_HEADER: string;
|
|
170
|
+
STATUS_ONGOING_HEADER: string;
|
|
171
|
+
STATUS_COUNTRY_HEADER: string;
|
|
168
172
|
};
|
|
169
173
|
ME: {
|
|
170
174
|
ROLE_LABEL: string;
|
package/lib/model/PepTexts.js
CHANGED
|
@@ -16,7 +16,9 @@ export const LABELS = (name) => {
|
|
|
16
16
|
[PepType.RELATIVE]: `Jag har en relation med en person som är PEP`,
|
|
17
17
|
[PepType.COLLEAGUE]: `Jag är medarbetare till, eller har en affärsrelation med, en person som är PEP`
|
|
18
18
|
},
|
|
19
|
-
IS_PEP_HEADER: `Är du eller en närstående till dig en person i politisk utsatt ställning? (PEP)
|
|
19
|
+
IS_PEP_HEADER: `Är du eller en närstående till dig en person i politisk utsatt ställning? (PEP)`,
|
|
20
|
+
STATUS_ONGOING_HEADER: `Är din befattning pågående eller avslutad?`,
|
|
21
|
+
STATUS_COUNTRY_HEADER: `I vilket land är din befattning?`,
|
|
20
22
|
},
|
|
21
23
|
[PepType.ME]: {
|
|
22
24
|
ROLE_LABEL: `Ange din roll`,
|
|
@@ -175,7 +177,10 @@ export const LABELS = (name) => {
|
|
|
175
177
|
"Jag"} är medarbetare till, eller har en affärsrelation med, en person som är PEP`
|
|
176
178
|
},
|
|
177
179
|
IS_PEP_HEADER: `Är ${name || "du"} eller en närstående till ${name ||
|
|
178
|
-
"dig"} en person i politisk utsatt ställning? (PEP)
|
|
180
|
+
"dig"} en person i politisk utsatt ställning? (PEP)`,
|
|
181
|
+
STATUS_ONGOING_HEADER: `Är ${possessiveName ||
|
|
182
|
+
"din"} befattning pågående eller avslutad?`,
|
|
183
|
+
STATUS_COUNTRY_HEADER: `I vilket land är ${possessiveName || "din"} befattning?`,
|
|
179
184
|
},
|
|
180
185
|
[PepType.ME]: {
|
|
181
186
|
ROLE_LABEL: `Ange ${possessiveName || "din"} roll`,
|
|
@@ -317,7 +322,7 @@ export const LABELS = (name) => {
|
|
|
317
322
|
ROLE_LABEL: {
|
|
318
323
|
[BusinessRelation.CO_OWNERSHIP]: `Ange tjänst/roll för personen i politisk utsatt ställning som ${name ||
|
|
319
324
|
"du"} har en relation till`,
|
|
320
|
-
[BusinessRelation.CLOSE_CONNECTION]: `
|
|
325
|
+
[BusinessRelation.CLOSE_CONNECTION]: `Ange tjänst/roll för personen i politisk utsatt ställning som ${name ||
|
|
321
326
|
"du"} har en relation till`,
|
|
322
327
|
[BusinessRelation.COMPANY_FOR_PEP]: `Ange tjänst/roll för personen i politisk utsatt ställning som ${name ||
|
|
323
328
|
"du"} har en relation till`
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { PepType, EntityType } from "./PepContext";
|
|
3
|
-
|
|
4
|
-
ownerName
|
|
5
|
-
|
|
3
|
+
interface QuestionsProps {
|
|
4
|
+
ownerName?: string;
|
|
5
|
+
legalEntityType?: EntityType;
|
|
6
6
|
type?: PepType;
|
|
7
7
|
onChange: (type: PepType) => void;
|
|
8
|
+
resetValues?: () => void;
|
|
8
9
|
}
|
|
10
|
+
export declare const PepIsPepQuestions: React.FC<QuestionsProps>;
|
|
9
11
|
interface Props {
|
|
10
|
-
next
|
|
11
|
-
external?: ExternalIsPepState;
|
|
12
|
+
next: () => void;
|
|
12
13
|
}
|
|
13
|
-
export declare const PepIsPepPage:
|
|
14
|
+
export declare const PepIsPepPage: React.FC<Props>;
|
|
14
15
|
export {};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import React, { useRef, useCallback, useContext
|
|
1
|
+
import React, { useRef, useCallback, useContext } from "react";
|
|
2
2
|
import { Form, RadioGroup, RequiredValidator, PrimaryButton, } from "@lysaab/ui-2";
|
|
3
3
|
import { PepType, PepContext, EntityType } from "./PepContext";
|
|
4
4
|
import { LABELS } from "../model/PepTexts";
|
|
5
|
-
export const
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const formRef = useRef();
|
|
9
|
-
const entityType = ((_a = external) === null || _a === void 0 ? void 0 : _a.entityType) || pepContext.state.legalEntityType || EntityType.PERSON;
|
|
10
|
-
const labels = LABELS(((_b = external) === null || _b === void 0 ? void 0 : _b.ownerName) || pepContext.state.ownerName);
|
|
5
|
+
export const PepIsPepQuestions = ({ ownerName, legalEntityType, type, onChange, resetValues, }) => {
|
|
6
|
+
const labels = LABELS(ownerName);
|
|
7
|
+
const entityType = legalEntityType || EntityType.PERSON;
|
|
11
8
|
const IsPepAlternatives = [
|
|
12
9
|
{
|
|
13
10
|
text: labels[entityType].GENERIC.IS_PEP[PepType.NOT_PEP],
|
|
@@ -23,8 +20,17 @@ export const PepIsPepPage = ({ next, external }) => {
|
|
|
23
20
|
value: PepType.COLLEAGUE,
|
|
24
21
|
},
|
|
25
22
|
];
|
|
23
|
+
return (React.createElement(RadioGroup, { alternatives: IsPepAlternatives, onChange: (alternative) => {
|
|
24
|
+
var _a;
|
|
25
|
+
onChange(alternative.value);
|
|
26
|
+
(_a = resetValues) === null || _a === void 0 ? void 0 : _a();
|
|
27
|
+
}, value: IsPepAlternatives.find((alt) => alt.value === type), header: labels[entityType].GENERIC.IS_PEP_HEADER, validators: [RequiredValidator("Du måste välja ett alternativ")] }));
|
|
28
|
+
};
|
|
29
|
+
export const PepIsPepPage = ({ next }) => {
|
|
30
|
+
const pepContext = useContext(PepContext);
|
|
31
|
+
const formRef = useRef();
|
|
26
32
|
const nextPage = useCallback(() => {
|
|
27
|
-
if (formRef.current && formRef.current.isValid
|
|
33
|
+
if (formRef.current && formRef.current.isValid) {
|
|
28
34
|
next();
|
|
29
35
|
}
|
|
30
36
|
}, [formRef, next]);
|
|
@@ -48,14 +54,6 @@ export const PepIsPepPage = ({ next, external }) => {
|
|
|
48
54
|
});
|
|
49
55
|
}, [pepContext]);
|
|
50
56
|
return (React.createElement(Form, { onSubmit: nextPage, lysaFormRef: formRef },
|
|
51
|
-
React.createElement(
|
|
52
|
-
|
|
53
|
-
external.onChange(alternative.value);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
pepContext.setState({ type: alternative.value });
|
|
57
|
-
resetValues();
|
|
58
|
-
}
|
|
59
|
-
}, value: IsPepAlternatives.find(alt => { var _a; return alt.value === (((_a = external) === null || _a === void 0 ? void 0 : _a.type) || pepContext.state.type); }), header: labels[entityType].GENERIC.IS_PEP_HEADER, validators: [RequiredValidator("Du måste välja ett alternativ")] }),
|
|
60
|
-
next && React.createElement(PrimaryButton, { type: "submit" }, "N\u00E4sta")));
|
|
57
|
+
React.createElement(PepIsPepQuestions, { ownerName: pepContext.state.ownerName, legalEntityType: pepContext.state.legalEntityType, type: pepContext.state.type, onChange: (type) => pepContext.setState({ type }), resetValues: resetValues }),
|
|
58
|
+
React.createElement(PrimaryButton, { type: "submit" }, "N\u00E4sta")));
|
|
61
59
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useRef, useCallback, useContext, } from "react";
|
|
2
2
|
import { Form, RadioGroup, RequiredValidator, PrimaryButton, Datepicker, } from "@lysaab/ui-2";
|
|
3
|
-
import { PepContext, PepStatus } from "./PepContext";
|
|
3
|
+
import { PepContext, PepStatus, EntityType } from "./PepContext";
|
|
4
4
|
import { CountrySelect } from "../components/CountrySelect";
|
|
5
|
+
import { LABELS } from "../model/PepTexts";
|
|
5
6
|
const stateAlternatives = [
|
|
6
7
|
{
|
|
7
8
|
text: "Pågående",
|
|
@@ -36,14 +37,16 @@ export const PepStatusPage = ({ next }) => {
|
|
|
36
37
|
pepContext.setState({ ended: undefined });
|
|
37
38
|
}
|
|
38
39
|
}, [pepContext]);
|
|
40
|
+
const labels = LABELS(pepContext.state.ownerName);
|
|
41
|
+
const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
|
|
39
42
|
return (React.createElement("div", null,
|
|
40
43
|
React.createElement(Form, { lysaFormRef: formRef, onSubmit: () => {
|
|
41
44
|
nextPage();
|
|
42
45
|
} },
|
|
43
|
-
React.createElement(RadioGroup, { alternatives: stateAlternatives, header:
|
|
46
|
+
React.createElement(RadioGroup, { alternatives: stateAlternatives, header: labels[entityType].GENERIC.STATUS_ONGOING_HEADER, onChange: updateIsOngoing, value: stateAlternatives.find(alt => alt.value === pepContext.state.isOngoing), validators: [RequiredValidator("Du måste välja ett alternativ")] }),
|
|
44
47
|
pepContext.state.isOngoing &&
|
|
45
48
|
pepContext.state.isOngoing === PepStatus.ENDED ? (React.createElement(Datepicker, { label: "N\u00E4r avslutades uppdraget?", selected: pepContext.state.ended, onChange: event => pepContext.setState({ ended: event || undefined }), validators: [RequiredValidator("Du måste ange fördelsedag")], showMonthYearPicker: true, dateFormat: "yyyy-MM", maxDate: new Date() })) : null,
|
|
46
|
-
React.createElement(RadioGroup, { alternatives: isSwedenAlternatives, header:
|
|
49
|
+
React.createElement(RadioGroup, { alternatives: isSwedenAlternatives, header: labels[entityType].GENERIC.STATUS_COUNTRY_HEADER, onChange: updateIsSweden, value: isSwedenAlternatives.find(alt => alt.value === pepContext.state.isSweden), validators: [RequiredValidator("Du måste välja ett alternativ")] }),
|
|
47
50
|
pepContext.state.isSweden && pepContext.state.isSweden === "other" ? (React.createElement(CountrySelect, { label: "V\u00E4lj i vilket land befattningen \u00E4r", onChange: event => pepContext.setState({
|
|
48
51
|
country: event.value ? event.value.toString() : undefined,
|
|
49
52
|
}), validators: [RequiredValidator("Du måste välja land")], value: pepContext.state.country, removeSweden: true })) : null,
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lysaab/lysa-pep",
|
|
3
3
|
"author": "Lysa AB",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.17.1",
|
|
5
5
|
"main": "./lib/Exports.js",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@types/luxon": "^1.15.2",
|
|
8
8
|
"luxon": "^1.21.1"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
|
+
"@lysaab/ui-2": "^16.13.1",
|
|
11
12
|
"@types/jest": "24.0.20",
|
|
12
13
|
"@types/luxon": "^1.15.2",
|
|
13
14
|
"@types/node": "12.11.7",
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
"luxon": "^1.21.1",
|
|
18
19
|
"react": "^16.11.0",
|
|
19
20
|
"react-dom": "^16.11.0",
|
|
20
|
-
"react-scripts": "3.
|
|
21
|
+
"react-scripts": "^3.4.1",
|
|
21
22
|
"typescript": "^3.7.2"
|
|
22
23
|
},
|
|
23
24
|
"peerDependencies": {
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import React, { FunctionComponent } from "react";
|
|
1
|
+
import React, { FunctionComponent, useContext } from "react";
|
|
2
2
|
import "./PepAnswers.scss";
|
|
3
3
|
import { PepRequest } from "../model/PepModel";
|
|
4
4
|
import { countries } from "../model/Countries";
|
|
5
5
|
import { LABELS } from "../model/PepTexts";
|
|
6
6
|
import { roleAlternatives, militaryAlternatives } from "../pages/PepRolePage";
|
|
7
|
-
import { EntityType, PepType } from "../pages/PepContext";
|
|
7
|
+
import { EntityType, PepType, PepContext } from "../pages/PepContext";
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
10
|
answer: PepRequest;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const PepAnswers: FunctionComponent<Props> = ({ answer }) => {
|
|
14
|
+
const pepContext = useContext(PepContext);
|
|
15
|
+
|
|
14
16
|
if (!answer.type || answer.type === PepType.NOT_PEP) {
|
|
15
17
|
return <div><p>Personen är inte PEP</p></div>;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
const
|
|
20
|
+
const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
|
|
21
|
+
const labels = LABELS(pepContext.state.ownerName);
|
|
19
22
|
const country = countries.find(country => country.value === answer.country);
|
|
20
23
|
const role = roleAlternatives.find(alt => alt.value === answer.role);
|
|
21
24
|
const militaryRank = militaryAlternatives.find(
|
|
@@ -26,14 +29,14 @@ export const PepAnswers: FunctionComponent<Props> = ({ answer }) => {
|
|
|
26
29
|
{answer.type && (
|
|
27
30
|
<StaticInput
|
|
28
31
|
label="Vem är pep"
|
|
29
|
-
value={labels[
|
|
32
|
+
value={labels[entityType].GENERIC.IS_PEP[answer.type]}
|
|
30
33
|
/>
|
|
31
34
|
)}
|
|
32
35
|
{answer.relationToPEP && (
|
|
33
36
|
<StaticInput
|
|
34
37
|
label="Relation"
|
|
35
38
|
value={
|
|
36
|
-
labels[
|
|
39
|
+
labels[entityType][PepType.RELATIVE].RELATION[
|
|
37
40
|
answer.relationToPEP
|
|
38
41
|
]
|
|
39
42
|
}
|
|
@@ -43,7 +46,7 @@ export const PepAnswers: FunctionComponent<Props> = ({ answer }) => {
|
|
|
43
46
|
<StaticInput
|
|
44
47
|
label="Relation"
|
|
45
48
|
value={
|
|
46
|
-
labels[
|
|
49
|
+
labels[entityType][PepType.COLLEAGUE].BUSINESS_RELATION[
|
|
47
50
|
answer.businessRelation
|
|
48
51
|
]
|
|
49
52
|
}
|
|
@@ -101,7 +104,7 @@ export const PepAnswers: FunctionComponent<Props> = ({ answer }) => {
|
|
|
101
104
|
/>
|
|
102
105
|
)}
|
|
103
106
|
{militaryRank && (
|
|
104
|
-
<StaticInput label="Militär grad" value={militaryRank.
|
|
107
|
+
<StaticInput label="Militär grad" value={militaryRank.text} />
|
|
105
108
|
)}
|
|
106
109
|
</div>
|
|
107
110
|
);
|
package/src/demo/Pep.tsx
CHANGED
|
@@ -61,18 +61,19 @@ export function Pep() {
|
|
|
61
61
|
<legend>Konfig</legend>
|
|
62
62
|
<div>
|
|
63
63
|
<label>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
value={
|
|
68
|
-
onChange={event =>
|
|
64
|
+
Entitet
|
|
65
|
+
|
|
66
|
+
<select
|
|
67
|
+
value={pepContext.state.legalEntityType || EntityType.PERSON}
|
|
68
|
+
onChange={event => {
|
|
69
69
|
pepContext.setState({
|
|
70
|
-
legalEntityType: event.currentTarget.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
70
|
+
legalEntityType: event.currentTarget.value as EntityType,
|
|
71
|
+
});
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
<option value={EntityType.PERSON}>Person</option>
|
|
75
|
+
<option value={EntityType.CORPORATION}>Företag</option>
|
|
76
|
+
</select>
|
|
76
77
|
</label>
|
|
77
78
|
</div>
|
|
78
79
|
<div>
|
package/src/model/PepTexts.ts
CHANGED
|
@@ -25,7 +25,9 @@ export const LABELS = (name?: string) => {
|
|
|
25
25
|
[PepType.RELATIVE]: `Jag har en relation med en person som är PEP`,
|
|
26
26
|
[PepType.COLLEAGUE]: `Jag är medarbetare till, eller har en affärsrelation med, en person som är PEP`
|
|
27
27
|
},
|
|
28
|
-
IS_PEP_HEADER: `Är du eller en närstående till dig en person i politisk utsatt ställning? (PEP)
|
|
28
|
+
IS_PEP_HEADER: `Är du eller en närstående till dig en person i politisk utsatt ställning? (PEP)`,
|
|
29
|
+
STATUS_ONGOING_HEADER: `Är din befattning pågående eller avslutad?`,
|
|
30
|
+
STATUS_COUNTRY_HEADER: `I vilket land är din befattning?`,
|
|
29
31
|
},
|
|
30
32
|
[PepType.ME]: {
|
|
31
33
|
ROLE_LABEL: `Ange din roll`,
|
|
@@ -184,7 +186,10 @@ export const LABELS = (name?: string) => {
|
|
|
184
186
|
"Jag"} är medarbetare till, eller har en affärsrelation med, en person som är PEP`
|
|
185
187
|
},
|
|
186
188
|
IS_PEP_HEADER: `Är ${name || "du"} eller en närstående till ${name ||
|
|
187
|
-
"dig"} en person i politisk utsatt ställning? (PEP)
|
|
189
|
+
"dig"} en person i politisk utsatt ställning? (PEP)`,
|
|
190
|
+
STATUS_ONGOING_HEADER: `Är ${possessiveName ||
|
|
191
|
+
"din"} befattning pågående eller avslutad?`,
|
|
192
|
+
STATUS_COUNTRY_HEADER: `I vilket land är ${possessiveName || "din"} befattning?`,
|
|
188
193
|
},
|
|
189
194
|
[PepType.ME]: {
|
|
190
195
|
ROLE_LABEL: `Ange ${possessiveName || "din"} roll`,
|
|
@@ -326,7 +331,7 @@ export const LABELS = (name?: string) => {
|
|
|
326
331
|
ROLE_LABEL: {
|
|
327
332
|
[BusinessRelation.CO_OWNERSHIP]: `Ange tjänst/roll för personen i politisk utsatt ställning som ${name ||
|
|
328
333
|
"du"} har en relation till`,
|
|
329
|
-
[BusinessRelation.CLOSE_CONNECTION]: `
|
|
334
|
+
[BusinessRelation.CLOSE_CONNECTION]: `Ange tjänst/roll för personen i politisk utsatt ställning som ${name ||
|
|
330
335
|
"du"} har en relation till`,
|
|
331
336
|
[BusinessRelation.COMPANY_FOR_PEP]: `Ange tjänst/roll för personen i politisk utsatt ställning som ${name ||
|
|
332
337
|
"du"} har en relation till`
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
FunctionComponent,
|
|
3
|
-
useRef,
|
|
4
|
-
useCallback,
|
|
5
|
-
useContext,
|
|
6
|
-
} from "react";
|
|
1
|
+
import React, { useRef, useCallback, useContext } from "react";
|
|
7
2
|
import {
|
|
8
3
|
Form,
|
|
9
4
|
RadioGroup,
|
|
@@ -14,24 +9,23 @@ import {
|
|
|
14
9
|
import { PepType, PepContext, EntityType } from "./PepContext";
|
|
15
10
|
import { LABELS } from "../model/PepTexts";
|
|
16
11
|
|
|
17
|
-
|
|
18
|
-
ownerName
|
|
19
|
-
|
|
12
|
+
interface QuestionsProps {
|
|
13
|
+
ownerName?: string;
|
|
14
|
+
legalEntityType?: EntityType;
|
|
20
15
|
type?: PepType;
|
|
21
16
|
onChange: (type: PepType) => void;
|
|
17
|
+
resetValues?: () => void;
|
|
22
18
|
}
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
const entityType =
|
|
33
|
-
external?.entityType || pepContext.state.legalEntityType || EntityType.PERSON;
|
|
34
|
-
const labels = LABELS(external?.ownerName || pepContext.state.ownerName);
|
|
20
|
+
export const PepIsPepQuestions: React.FC<QuestionsProps> = ({
|
|
21
|
+
ownerName,
|
|
22
|
+
legalEntityType,
|
|
23
|
+
type,
|
|
24
|
+
onChange,
|
|
25
|
+
resetValues,
|
|
26
|
+
}) => {
|
|
27
|
+
const labels = LABELS(ownerName);
|
|
28
|
+
const entityType = legalEntityType || EntityType.PERSON;
|
|
35
29
|
|
|
36
30
|
const IsPepAlternatives = [
|
|
37
31
|
{
|
|
@@ -49,8 +43,30 @@ export const PepIsPepPage: FunctionComponent<Props> = ({ next, external }) => {
|
|
|
49
43
|
},
|
|
50
44
|
];
|
|
51
45
|
|
|
46
|
+
return (
|
|
47
|
+
<RadioGroup
|
|
48
|
+
alternatives={IsPepAlternatives}
|
|
49
|
+
onChange={(alternative) => {
|
|
50
|
+
onChange(alternative.value);
|
|
51
|
+
resetValues?.();
|
|
52
|
+
}}
|
|
53
|
+
value={IsPepAlternatives.find((alt) => alt.value === type)}
|
|
54
|
+
header={labels[entityType].GENERIC.IS_PEP_HEADER}
|
|
55
|
+
validators={[RequiredValidator("Du måste välja ett alternativ")]}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
interface Props {
|
|
61
|
+
next: () => void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const PepIsPepPage: React.FC<Props> = ({ next }) => {
|
|
65
|
+
const pepContext = useContext(PepContext);
|
|
66
|
+
const formRef = useRef<LysaFormRef>();
|
|
67
|
+
|
|
52
68
|
const nextPage = useCallback(() => {
|
|
53
|
-
if (formRef.current && formRef.current.isValid
|
|
69
|
+
if (formRef.current && formRef.current.isValid) {
|
|
54
70
|
next();
|
|
55
71
|
}
|
|
56
72
|
}, [formRef, next]);
|
|
@@ -77,24 +93,15 @@ export const PepIsPepPage: FunctionComponent<Props> = ({ next, external }) => {
|
|
|
77
93
|
|
|
78
94
|
return (
|
|
79
95
|
<Form onSubmit={nextPage} lysaFormRef={formRef}>
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
pepContext.setState({ type: alternative.value });
|
|
87
|
-
resetValues();
|
|
88
|
-
}
|
|
89
|
-
}}
|
|
90
|
-
value={IsPepAlternatives.find(
|
|
91
|
-
alt => alt.value === (external?.type || pepContext.state.type)
|
|
92
|
-
)}
|
|
93
|
-
header={labels[entityType].GENERIC.IS_PEP_HEADER}
|
|
94
|
-
validators={[RequiredValidator("Du måste välja ett alternativ")]}
|
|
96
|
+
<PepIsPepQuestions
|
|
97
|
+
ownerName={pepContext.state.ownerName}
|
|
98
|
+
legalEntityType={pepContext.state.legalEntityType}
|
|
99
|
+
type={pepContext.state.type}
|
|
100
|
+
onChange={(type) => pepContext.setState({ type })}
|
|
101
|
+
resetValues={resetValues}
|
|
95
102
|
/>
|
|
96
103
|
|
|
97
|
-
|
|
104
|
+
<PrimaryButton type="submit">Nästa</PrimaryButton>
|
|
98
105
|
</Form>
|
|
99
106
|
);
|
|
100
107
|
};
|
|
@@ -13,8 +13,9 @@ import {
|
|
|
13
13
|
Datepicker,
|
|
14
14
|
} from "@lysaab/ui-2";
|
|
15
15
|
import { Alternative } from "@lysaab/ui-2/components/input/InputAPI";
|
|
16
|
-
import { PepContext, PepStatus } from "./PepContext";
|
|
16
|
+
import { PepContext, PepStatus, EntityType } from "./PepContext";
|
|
17
17
|
import { CountrySelect } from "../components/CountrySelect";
|
|
18
|
+
import { LABELS } from "../model/PepTexts";
|
|
18
19
|
|
|
19
20
|
const stateAlternatives: Alternative<PepStatus>[] = [
|
|
20
21
|
{
|
|
@@ -68,6 +69,9 @@ export const PepStatusPage: FunctionComponent<Props> = ({ next }) => {
|
|
|
68
69
|
[pepContext]
|
|
69
70
|
);
|
|
70
71
|
|
|
72
|
+
const labels = LABELS(pepContext.state.ownerName);
|
|
73
|
+
const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
|
|
74
|
+
|
|
71
75
|
return (
|
|
72
76
|
<div>
|
|
73
77
|
<Form
|
|
@@ -78,7 +82,7 @@ export const PepStatusPage: FunctionComponent<Props> = ({ next }) => {
|
|
|
78
82
|
>
|
|
79
83
|
<RadioGroup
|
|
80
84
|
alternatives={stateAlternatives}
|
|
81
|
-
header=
|
|
85
|
+
header={labels[entityType].GENERIC.STATUS_ONGOING_HEADER}
|
|
82
86
|
onChange={updateIsOngoing}
|
|
83
87
|
value={stateAlternatives.find(
|
|
84
88
|
alt => alt.value === pepContext.state.isOngoing
|
|
@@ -103,7 +107,7 @@ export const PepStatusPage: FunctionComponent<Props> = ({ next }) => {
|
|
|
103
107
|
|
|
104
108
|
<RadioGroup
|
|
105
109
|
alternatives={isSwedenAlternatives}
|
|
106
|
-
header=
|
|
110
|
+
header={labels[entityType].GENERIC.STATUS_COUNTRY_HEADER}
|
|
107
111
|
onChange={updateIsSweden}
|
|
108
112
|
value={isSwedenAlternatives.find(
|
|
109
113
|
alt => alt.value === pepContext.state.isSweden
|
package/.env.development
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
PORT=3007
|