@lysaab/lysa-pep 0.18.0 → 1.0.0-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/.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 +74 -0
- package/lib/pages/IsPep/IsPepPage.d.ts +14 -0
- package/lib/pages/IsPep/IsPepPage.js +39 -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 +282 -0
- package/lib/pages/RelationPage/RelationPage.d.ts +6 -0
- package/lib/pages/RelationPage/RelationPage.js +142 -0
- package/lib/pages/RolePage/RoleMessages.d.ts +185 -0
- package/lib/pages/RolePage/RoleMessages.js +381 -0
- package/lib/pages/RolePage/RolePage.d.ts +11 -0
- package/lib/pages/RolePage/RolePage.js +214 -0
- package/lib/pages/StatusPage/StatusMessages.d.ts +72 -0
- package/lib/pages/StatusPage/StatusMessages.js +74 -0
- package/lib/pages/StatusPage/StatusPage.d.ts +6 -0
- package/lib/pages/StatusPage/StatusPage.js +75 -0
- package/package.json +56 -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 +75 -0
- package/src/pages/IsPep/IsPepPage.tsx +94 -0
- package/src/pages/PepContext.tsx +144 -144
- package/src/pages/RelationPage/RelationMessages.ts +287 -0
- package/src/pages/RelationPage/RelationPage.tsx +269 -0
- package/src/pages/RolePage/RoleMessages.ts +389 -0
- package/src/pages/RolePage/RolePage.tsx +342 -0
- package/src/pages/StatusPage/StatusMessages.ts +80 -0
- package/src/pages/StatusPage/StatusPage.tsx +172 -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
package/src/demo/Pep.tsx
CHANGED
|
@@ -1,106 +1,112 @@
|
|
|
1
|
-
import React, { useState, useContext, useEffect, useRef } from "react";
|
|
2
|
-
import { Story } from "@lysaab/ui-2";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
1
|
+
import React, { useState, useContext, useEffect, useRef } from "react";
|
|
2
|
+
import { Story } from "@lysaab/ui-2";
|
|
3
|
+
import { IntlProvider } from "react-intl";
|
|
4
|
+
import { IsPepPage } from "../pages/IsPep/IsPepPage";
|
|
5
|
+
import { StatusPage } from "../pages/StatusPage/StatusPage";
|
|
6
|
+
import { RolePage } from "../pages/RolePage/RolePage";
|
|
7
|
+
import { PepContext, PepType, EntityType } from "../pages/PepContext";
|
|
8
|
+
import { Done } from "./Done";
|
|
9
|
+
import { RelationPage } from "../pages/RelationPage/RelationPage";
|
|
10
|
+
|
|
11
|
+
export function Pep() {
|
|
12
|
+
const [page, setPage] = useState(0);
|
|
13
|
+
const pepContext = useContext(PepContext);
|
|
14
|
+
const type = pepContext.state.type;
|
|
15
|
+
const loaded = useRef(false);
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!loaded.current) {
|
|
19
|
+
pepContext.setState({
|
|
20
|
+
ownerName: "Sean Banan",
|
|
21
|
+
tin: "191212121212",
|
|
22
|
+
legalEntityType: EntityType.PERSON
|
|
23
|
+
});
|
|
24
|
+
loaded.current = true;
|
|
25
|
+
}
|
|
26
|
+
}, [loaded, pepContext]);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div style={{ maxWidth: "1000px", margin: "0 auto" }}>
|
|
30
|
+
<IntlProvider locale="sv">
|
|
31
|
+
<Story
|
|
32
|
+
header="PEP Lib"
|
|
33
|
+
showBack={page > 0}
|
|
34
|
+
showClose={false}
|
|
35
|
+
onBack={() => {
|
|
36
|
+
if (page === 4 && type === PepType.NOT_PEP) {
|
|
37
|
+
setPage(0);
|
|
38
|
+
} else if (page === 3 && type === PepType.ME) {
|
|
39
|
+
setPage(1);
|
|
40
|
+
} else {
|
|
41
|
+
setPage(page - 1);
|
|
42
|
+
}
|
|
43
|
+
}}
|
|
44
|
+
transitionKey={page.toString()}
|
|
45
|
+
onExit={() => { }}
|
|
46
|
+
>
|
|
47
|
+
{page === 0 ? (
|
|
48
|
+
<IsPepPage
|
|
49
|
+
next={() =>
|
|
50
|
+
type !== PepType.NOT_PEP ? setPage(page + 1) : setPage(4)
|
|
51
|
+
}
|
|
52
|
+
/>
|
|
53
|
+
) : null}
|
|
54
|
+
{page === 1 ? (
|
|
55
|
+
<StatusPage
|
|
56
|
+
next={() =>
|
|
57
|
+
type === PepType.ME ? setPage(page + 2) : setPage(page + 1)
|
|
58
|
+
}
|
|
59
|
+
/>
|
|
60
|
+
) : null}
|
|
61
|
+
{page === 2 ? <RelationPage next={() => setPage(page + 1)} /> : null}
|
|
62
|
+
{page === 3 ? <RolePage next={() => setPage(page + 1)} /> : null}
|
|
63
|
+
{page === 4 ? <Done /> : null}
|
|
64
|
+
</Story>
|
|
65
|
+
<hr />
|
|
66
|
+
<fieldset>
|
|
67
|
+
<legend>Konfig</legend>
|
|
68
|
+
<div>
|
|
69
|
+
<label>
|
|
70
|
+
Verkligen huvudman
|
|
71
|
+
<input
|
|
72
|
+
type="checkbox"
|
|
73
|
+
value={"true"}
|
|
74
|
+
onChange={event =>
|
|
75
|
+
pepContext.setState({
|
|
76
|
+
legalEntityType: event.currentTarget.checked
|
|
77
|
+
? EntityType.CORPORATION
|
|
78
|
+
: EntityType.PERSON
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
/>
|
|
82
|
+
</label>
|
|
83
|
+
</div>
|
|
84
|
+
<div>
|
|
85
|
+
<label>
|
|
86
|
+
Namnet på den verkliga huvudmannen
|
|
87
|
+
<input
|
|
88
|
+
type="text"
|
|
89
|
+
value={pepContext.state.ownerName || ""}
|
|
90
|
+
onChange={event =>
|
|
91
|
+
pepContext.setState({ ownerName: event.currentTarget.value })
|
|
92
|
+
}
|
|
93
|
+
/>
|
|
94
|
+
</label>
|
|
95
|
+
</div>
|
|
96
|
+
<div>
|
|
97
|
+
<label>
|
|
98
|
+
Personnummer på huvudmannen
|
|
99
|
+
<input
|
|
100
|
+
type="text"
|
|
101
|
+
value={pepContext.state.tin || ""}
|
|
102
|
+
onChange={event =>
|
|
103
|
+
pepContext.setState({ tin: event.currentTarget.value })
|
|
104
|
+
}
|
|
105
|
+
/>
|
|
106
|
+
</label>
|
|
107
|
+
</div>
|
|
108
|
+
</fieldset>
|
|
109
|
+
</IntlProvider>
|
|
110
|
+
</div>
|
|
111
|
+
);
|
|
112
|
+
}
|
package/src/model/PepModel.ts
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { PepState, PepType, EntityType, PepStatus } from "../pages/PepContext";
|
|
2
|
-
import { DateTime } from "luxon";
|
|
3
|
-
|
|
4
|
-
export interface PepRequest
|
|
5
|
-
extends Omit<PepState, "isSweden" | "isOngoing" | "ended" | "birthdayOfPEP"> {
|
|
6
|
-
ended?: string;
|
|
7
|
-
birthdayOfPEP?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Do some minor preprocessing before we are ready to send everything to the
|
|
12
|
-
* server
|
|
13
|
-
*/
|
|
14
|
-
export function stateToRequest(pepData: PepState): PepRequest {
|
|
15
|
-
const data = { ...pepData };
|
|
16
|
-
delete data.isSweden;
|
|
17
|
-
delete data.isOngoing;
|
|
18
|
-
delete data.ownerName;
|
|
19
|
-
if (data.legalEntityType === EntityType.PERSON) {
|
|
20
|
-
delete data.tin;
|
|
21
|
-
}
|
|
22
|
-
return {
|
|
23
|
-
...data,
|
|
24
|
-
country: data.type !== PepType.NOT_PEP ? data.country || "SE" : undefined,
|
|
25
|
-
ended: data.ended
|
|
26
|
-
? DateTime.fromJSDate(data.ended).toFormat("yyyy-MM")
|
|
27
|
-
: undefined,
|
|
28
|
-
birthdayOfPEP: data.birthdayOfPEP
|
|
29
|
-
? DateTime.fromJSDate(data.birthdayOfPEP).toFormat("yyyy-MM-dd")
|
|
30
|
-
: undefined
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function requestToState({
|
|
35
|
-
ended,
|
|
36
|
-
birthdayOfPEP,
|
|
37
|
-
...serverData
|
|
38
|
-
}: PepRequest): PepState {
|
|
39
|
-
const state: PepState = { ...serverData };
|
|
40
|
-
if (ended) {
|
|
41
|
-
state.ended = DateTime.fromFormat(ended, "yyyy-MM").toJSDate();
|
|
42
|
-
}
|
|
43
|
-
if (birthdayOfPEP) {
|
|
44
|
-
state.birthdayOfPEP = DateTime.fromFormat(
|
|
45
|
-
birthdayOfPEP,
|
|
46
|
-
"yyyy-MM-dd"
|
|
47
|
-
).toJSDate();
|
|
48
|
-
}
|
|
49
|
-
state.isSweden = state.country === "SE" ? "sweden" : "other";
|
|
50
|
-
state.isOngoing = state.ended ? PepStatus.ENDED : PepStatus.ONGOING;
|
|
51
|
-
return state;
|
|
52
|
-
}
|
|
1
|
+
import { PepState, PepType, EntityType, PepStatus } from "../pages/PepContext";
|
|
2
|
+
import { DateTime } from "luxon";
|
|
3
|
+
|
|
4
|
+
export interface PepRequest
|
|
5
|
+
extends Omit<PepState, "isSweden" | "isOngoing" | "ended" | "birthdayOfPEP"> {
|
|
6
|
+
ended?: string;
|
|
7
|
+
birthdayOfPEP?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Do some minor preprocessing before we are ready to send everything to the
|
|
12
|
+
* server
|
|
13
|
+
*/
|
|
14
|
+
export function stateToRequest(pepData: PepState): PepRequest {
|
|
15
|
+
const data = { ...pepData };
|
|
16
|
+
delete data.isSweden;
|
|
17
|
+
delete data.isOngoing;
|
|
18
|
+
delete data.ownerName;
|
|
19
|
+
if (data.legalEntityType === EntityType.PERSON) {
|
|
20
|
+
delete data.tin;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
...data,
|
|
24
|
+
country: data.type !== PepType.NOT_PEP ? data.country || "SE" : undefined,
|
|
25
|
+
ended: data.ended
|
|
26
|
+
? DateTime.fromJSDate(data.ended).toFormat("yyyy-MM")
|
|
27
|
+
: undefined,
|
|
28
|
+
birthdayOfPEP: data.birthdayOfPEP
|
|
29
|
+
? DateTime.fromJSDate(data.birthdayOfPEP).toFormat("yyyy-MM-dd")
|
|
30
|
+
: undefined
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function requestToState({
|
|
35
|
+
ended,
|
|
36
|
+
birthdayOfPEP,
|
|
37
|
+
...serverData
|
|
38
|
+
}: PepRequest): PepState {
|
|
39
|
+
const state: PepState = { ...serverData };
|
|
40
|
+
if (ended) {
|
|
41
|
+
state.ended = DateTime.fromFormat(ended, "yyyy-MM").toJSDate();
|
|
42
|
+
}
|
|
43
|
+
if (birthdayOfPEP) {
|
|
44
|
+
state.birthdayOfPEP = DateTime.fromFormat(
|
|
45
|
+
birthdayOfPEP,
|
|
46
|
+
"yyyy-MM-dd"
|
|
47
|
+
).toJSDate();
|
|
48
|
+
}
|
|
49
|
+
state.isSweden = state.country === "SE" ? "sweden" : "other";
|
|
50
|
+
state.isOngoing = state.ended ? PepStatus.ENDED : PepStatus.ONGOING;
|
|
51
|
+
return state;
|
|
52
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { defineMessages } from "react-intl";
|
|
2
|
+
import { PepType } from "../PepContext";
|
|
3
|
+
|
|
4
|
+
export const messages = defineMessages({
|
|
5
|
+
header: {
|
|
6
|
+
id: 'pep.ispep.header',
|
|
7
|
+
description: 'Not pep',
|
|
8
|
+
defaultMessage: `{
|
|
9
|
+
entityType, select,
|
|
10
|
+
PERSON {
|
|
11
|
+
Är du eller en närstående till dig en person i politisk utsatt ställning? (PEP)
|
|
12
|
+
}
|
|
13
|
+
CORPORATION {
|
|
14
|
+
Är {name} eller en närstående till {name} en person i politisk utsatt ställning? (PEP)
|
|
15
|
+
}
|
|
16
|
+
}`
|
|
17
|
+
},
|
|
18
|
+
required: {
|
|
19
|
+
id: 'pep.ispep.header',
|
|
20
|
+
description: 'Not pep',
|
|
21
|
+
defaultMessage: `{
|
|
22
|
+
entityType, select,
|
|
23
|
+
PERSON {
|
|
24
|
+
Är du eller en närstående till dig en person i politisk utsatt ställning? (PEP)
|
|
25
|
+
}
|
|
26
|
+
CORPORATION {
|
|
27
|
+
Är {name} eller en närstående till {name} en person i politisk utsatt ställning? (PEP)
|
|
28
|
+
}
|
|
29
|
+
}`
|
|
30
|
+
},
|
|
31
|
+
[PepType.NOT_PEP]: {
|
|
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: `{
|
|
40
|
+
entityType, select,
|
|
41
|
+
PERSON {
|
|
42
|
+
Jag har en funktion som gör mig till PEP
|
|
43
|
+
}
|
|
44
|
+
CORPORATION {
|
|
45
|
+
På grund av sin funktion är {name} PEP
|
|
46
|
+
}
|
|
47
|
+
}`
|
|
48
|
+
},
|
|
49
|
+
[PepType.RELATIVE]: {
|
|
50
|
+
id: 'pep.ispep.RELATIVE',
|
|
51
|
+
description: 'Jag har en relation med en person som är PEP',
|
|
52
|
+
defaultMessage: `{
|
|
53
|
+
entityType, select,
|
|
54
|
+
PERSON {
|
|
55
|
+
Jag har en relation med en person som är PEP
|
|
56
|
+
}
|
|
57
|
+
CORPORATION {
|
|
58
|
+
{name} är medarbetare till, eller har en affärsrelation med, en person som är PEP
|
|
59
|
+
}
|
|
60
|
+
}`
|
|
61
|
+
},
|
|
62
|
+
[PepType.COLLEAGUE]: {
|
|
63
|
+
id: 'pep.ispep.COLLEAGUE',
|
|
64
|
+
description: 'The person has a colleague that is pep',
|
|
65
|
+
defaultMessage: `{
|
|
66
|
+
entityType, select,
|
|
67
|
+
PERSON {
|
|
68
|
+
Jag är medarbetare till, eller har en affärsrelation med, en person som är PEP
|
|
69
|
+
}
|
|
70
|
+
CORPORATION {
|
|
71
|
+
På grund av sin funktion är {name} PEP
|
|
72
|
+
}
|
|
73
|
+
}`
|
|
74
|
+
},
|
|
75
|
+
})
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
FunctionComponent,
|
|
3
|
+
useRef,
|
|
4
|
+
useCallback,
|
|
5
|
+
useContext
|
|
6
|
+
} from "react";
|
|
7
|
+
import {
|
|
8
|
+
Form,
|
|
9
|
+
RadioGroup,
|
|
10
|
+
RequiredValidator,
|
|
11
|
+
PrimaryButton,
|
|
12
|
+
LysaFormRef
|
|
13
|
+
} from "@lysaab/ui-2";
|
|
14
|
+
import { PepType, PepContext, EntityType } from "../PepContext";
|
|
15
|
+
import { useIntl, FormattedMessage } from "react-intl";
|
|
16
|
+
import { messages } from "./IsPepMessages";
|
|
17
|
+
|
|
18
|
+
export interface ExternalIsPepState {
|
|
19
|
+
ownerName: string;
|
|
20
|
+
entityType: EntityType;
|
|
21
|
+
type?: PepType;
|
|
22
|
+
onChange: (type: PepType) => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface Props {
|
|
26
|
+
next?: () => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const IsPepRadioGroup: FunctionComponent<ExternalIsPepState> = ({
|
|
30
|
+
ownerName,
|
|
31
|
+
entityType,
|
|
32
|
+
type,
|
|
33
|
+
onChange
|
|
34
|
+
}) => {
|
|
35
|
+
const intl = useIntl();
|
|
36
|
+
|
|
37
|
+
const IsPepAlternatives = [
|
|
38
|
+
{
|
|
39
|
+
text: intl.formatMessage(messages[PepType.NOT_PEP], { entityType, name: ownerName }),
|
|
40
|
+
value: PepType.NOT_PEP
|
|
41
|
+
},
|
|
42
|
+
{ text: intl.formatMessage(messages[PepType.ME], { entityType, name: ownerName }), value: PepType.ME },
|
|
43
|
+
{
|
|
44
|
+
text: intl.formatMessage(messages[PepType.RELATIVE], { entityType, name: ownerName }),
|
|
45
|
+
value: PepType.RELATIVE
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
text: intl.formatMessage(messages[PepType.COLLEAGUE], { entityType, name: ownerName }),
|
|
49
|
+
value: PepType.COLLEAGUE
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<RadioGroup
|
|
55
|
+
alternatives={IsPepAlternatives}
|
|
56
|
+
onChange={alt => onChange(alt.value)}
|
|
57
|
+
value={IsPepAlternatives.find(alt => alt.value === type)}
|
|
58
|
+
header={intl.formatMessage(messages.header, { entityType, name: ownerName })}
|
|
59
|
+
validators={[RequiredValidator(intl.formatMessage(messages.required))]}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const IsPepPage: FunctionComponent<Props> = ({ next }) => {
|
|
65
|
+
const pepContext = useContext(PepContext);
|
|
66
|
+
const formRef = useRef<LysaFormRef>();
|
|
67
|
+
|
|
68
|
+
const nextPage = useCallback(() => {
|
|
69
|
+
if (formRef.current && formRef.current.isValid && next) {
|
|
70
|
+
next();
|
|
71
|
+
}
|
|
72
|
+
}, [formRef, next]);
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<Form onSubmit={nextPage} lysaFormRef={formRef}>
|
|
76
|
+
<IsPepRadioGroup
|
|
77
|
+
entityType={pepContext.state.legalEntityType || EntityType.PERSON}
|
|
78
|
+
ownerName={pepContext.state.ownerName || ""}
|
|
79
|
+
type={pepContext.state.type}
|
|
80
|
+
onChange={type => {
|
|
81
|
+
pepContext.setState({ type });
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
|
|
85
|
+
<PrimaryButton type="submit">
|
|
86
|
+
<FormattedMessage
|
|
87
|
+
id="pep.ispep.next"
|
|
88
|
+
description="Next button"
|
|
89
|
+
defaultMessage='Gå vidare'
|
|
90
|
+
/>
|
|
91
|
+
</PrimaryButton>
|
|
92
|
+
</Form>
|
|
93
|
+
);
|
|
94
|
+
};
|