@lysaab/lysa-pep 0.18.0 → 1.0.0-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 +3 -0
- package/README.md +0 -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 +0 -0
- 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/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/RelationPage/RelationMessages.d.ts +105 -0
- package/lib/pages/RelationPage/RelationMessages.js +282 -0
- package/lib/pages/{PepStatusPage.d.ts → RelationPage/RelationPage.d.ts} +6 -6
- 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/{PepRelationPage.d.ts → StatusPage/StatusPage.d.ts} +6 -6
- package/lib/pages/StatusPage/StatusPage.js +75 -0
- package/package.json +12 -9
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -0
- package/public/robots.txt +0 -0
- package/src/App.css +0 -0
- package/src/App.test.tsx +0 -0
- package/src/App.tsx +0 -0
- package/src/Exports.ts +7 -8
- package/src/components/CountrySelect.tsx +14 -10
- package/src/components/PepAnswers.scss +0 -0
- package/src/components/PepAnswers.tsx +166 -34
- package/src/demo/Done.tsx +2 -6
- package/src/demo/Pep.tsx +87 -81
- package/src/index.css +0 -0
- package/src/index.tsx +0 -0
- package/src/logo.svg +0 -0
- package/src/model/Countries.ts +0 -0
- package/src/model/PepModel.ts +0 -0
- package/src/pages/IsPep/IsPepMessages.ts +75 -0
- package/src/pages/IsPep/IsPepPage.tsx +94 -0
- package/src/pages/PepContext.tsx +0 -0
- 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/react-app-env.d.ts +0 -0
- package/src/serviceWorker.ts +0 -0
- package/tsconfig.json +0 -0
- package/tsconfig_build.json +0 -0
- package/lib/model/PepTexts.d.ts +0 -380
- package/lib/model/PepTexts.js +0 -552
- package/lib/pages/PepIsPepPage.d.ts +0 -15
- package/lib/pages/PepIsPepPage.js +0 -59
- package/lib/pages/PepRelationPage.js +0 -79
- package/lib/pages/PepRolePage.d.ts +0 -10
- package/lib/pages/PepRolePage.js +0 -127
- package/lib/pages/PepStatusPage.js +0 -58
- 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
|
@@ -2,104 +2,236 @@ import React, { FunctionComponent } from "react";
|
|
|
2
2
|
import "./PepAnswers.scss";
|
|
3
3
|
import { PepRequest } from "../model/PepModel";
|
|
4
4
|
import { countries } from "../model/Countries";
|
|
5
|
-
import {
|
|
6
|
-
import { roleAlternatives, militaryAlternatives } from "../pages/PepRolePage";
|
|
5
|
+
import { getRoleAlts, getMilitaryAlts } from "../pages/RolePage/RolePage";
|
|
7
6
|
import { EntityType, PepType } from "../pages/PepContext";
|
|
7
|
+
import { useIntl, defineMessages, FormattedMessage } from "react-intl";
|
|
8
|
+
import { messages as isPepMessages } from "../pages/IsPep/IsPepMessages";
|
|
9
|
+
import {
|
|
10
|
+
relationMessages,
|
|
11
|
+
businessRelationMessages
|
|
12
|
+
} from "../pages/RelationPage/RelationMessages";
|
|
8
13
|
|
|
9
14
|
interface Props {
|
|
10
15
|
answer: PepRequest;
|
|
11
16
|
}
|
|
12
17
|
|
|
18
|
+
const messages = defineMessages({
|
|
19
|
+
whoIsPepLabel: {
|
|
20
|
+
id: "pep.anwers.who.label",
|
|
21
|
+
description: "Who is pep label",
|
|
22
|
+
defaultMessage: "Vem är pep"
|
|
23
|
+
},
|
|
24
|
+
relationLabel: {
|
|
25
|
+
id: "pep.anwers.relation.label",
|
|
26
|
+
description: "Relation label",
|
|
27
|
+
defaultMessage: "Relation"
|
|
28
|
+
},
|
|
29
|
+
businessRelationLabel: {
|
|
30
|
+
id: "pep.anwers.businessRelation.label",
|
|
31
|
+
description: "Business relation label",
|
|
32
|
+
defaultMessage: "Vem är pep"
|
|
33
|
+
},
|
|
34
|
+
nameOfPepLabel: {
|
|
35
|
+
id: "pep.anwers.nameOfPep.label",
|
|
36
|
+
description: "Name of pep label",
|
|
37
|
+
defaultMessage: "Namn på personen"
|
|
38
|
+
},
|
|
39
|
+
birthdayOfPEPLabel: {
|
|
40
|
+
id: "pep.anwers.birthdayOfPEP.label",
|
|
41
|
+
description: "Birthday of pep label",
|
|
42
|
+
defaultMessage: "Födelsedag för personen"
|
|
43
|
+
},
|
|
44
|
+
statusLabel: {
|
|
45
|
+
id: "pep.anwers.status.label",
|
|
46
|
+
description: "Status label",
|
|
47
|
+
defaultMessage: "Status"
|
|
48
|
+
},
|
|
49
|
+
statusEndedValue: {
|
|
50
|
+
id: "pep.anwers.statusEnded.value",
|
|
51
|
+
description: "Status ended value",
|
|
52
|
+
defaultMessage: "Avslutad"
|
|
53
|
+
},
|
|
54
|
+
statusOngoingValue: {
|
|
55
|
+
id: "pep.anwers.statusOngoing.value",
|
|
56
|
+
description: "Status ongoing value",
|
|
57
|
+
defaultMessage: "Pågående"
|
|
58
|
+
},
|
|
59
|
+
endedLabel: {
|
|
60
|
+
id: "pep.anwers.endedStatus.label",
|
|
61
|
+
description: "Ended label",
|
|
62
|
+
defaultMessage: "Avslutades"
|
|
63
|
+
},
|
|
64
|
+
roleLabel: {
|
|
65
|
+
id: "pep.anwers.role.label",
|
|
66
|
+
description: "Role label",
|
|
67
|
+
defaultMessage: "Roll"
|
|
68
|
+
},
|
|
69
|
+
countryLabel: {
|
|
70
|
+
id: "pep.anwers.country.label",
|
|
71
|
+
description: "Country label",
|
|
72
|
+
defaultMessage: "Land"
|
|
73
|
+
},
|
|
74
|
+
ambassadorCountryLabel: {
|
|
75
|
+
id: "pep.anwers.ambassadorCountry.label",
|
|
76
|
+
description: "Ambassador country label",
|
|
77
|
+
defaultMessage: "Ambassadörsland"
|
|
78
|
+
},
|
|
79
|
+
governmentCompanyNameLabel: {
|
|
80
|
+
id: "pep.anwers.governmentCompanyName.label",
|
|
81
|
+
description: "Government company name label",
|
|
82
|
+
defaultMessage: "Företags namn"
|
|
83
|
+
},
|
|
84
|
+
governmentCompanyRoleLabel: {
|
|
85
|
+
id: "pep.anwers.governmentCompanyRole.label",
|
|
86
|
+
description: "Government company role label",
|
|
87
|
+
defaultMessage: "Roll på företaget"
|
|
88
|
+
},
|
|
89
|
+
internationalOrganisationNameLabel: {
|
|
90
|
+
id: "pep.anwers.companyName.label",
|
|
91
|
+
description: "International organisation name label",
|
|
92
|
+
defaultMessage: "Organisationens namn"
|
|
93
|
+
},
|
|
94
|
+
internationalOrganisationRoleLabel: {
|
|
95
|
+
id: "pep.anwers.companyRole.label",
|
|
96
|
+
description: "International organisation role label",
|
|
97
|
+
defaultMessage: "Roll i organisationen"
|
|
98
|
+
},
|
|
99
|
+
militaryGradeLabel: {
|
|
100
|
+
id: "pep.anwers.militaryRank.label",
|
|
101
|
+
description: "Military rank label",
|
|
102
|
+
defaultMessage: "Roll i organisationen"
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
13
106
|
export const PepAnswers: FunctionComponent<Props> = ({ answer }) => {
|
|
107
|
+
const intl = useIntl();
|
|
14
108
|
if (!answer.type || answer.type === PepType.NOT_PEP) {
|
|
15
|
-
return
|
|
109
|
+
return (
|
|
110
|
+
<div>
|
|
111
|
+
<p>
|
|
112
|
+
<FormattedMessage
|
|
113
|
+
id="pep.anwers.notpep"
|
|
114
|
+
description="Not pep"
|
|
115
|
+
defaultMessage="Personen är inte PEP"
|
|
116
|
+
/>
|
|
117
|
+
</p>
|
|
118
|
+
</div>
|
|
119
|
+
);
|
|
16
120
|
}
|
|
17
121
|
|
|
18
|
-
const entityType = answer.legalEntityType || EntityType.PERSON;
|
|
19
|
-
const labels = LABELS(answer.ownerName);
|
|
20
122
|
const country = countries.find(country => country.value === answer.country);
|
|
21
|
-
const role =
|
|
22
|
-
const militaryRank =
|
|
123
|
+
const role = getRoleAlts(intl).find(alt => alt.value === answer.role);
|
|
124
|
+
const militaryRank = getMilitaryAlts(intl).find(
|
|
23
125
|
alt => alt.value === answer.militaryRank
|
|
24
126
|
);
|
|
25
127
|
return (
|
|
26
128
|
<div>
|
|
27
129
|
{answer.type && (
|
|
28
130
|
<StaticInput
|
|
29
|
-
label=
|
|
30
|
-
value={
|
|
131
|
+
label={intl.formatMessage(messages.whoIsPepLabel)}
|
|
132
|
+
value={intl.formatMessage(isPepMessages[answer.type], {
|
|
133
|
+
entityType: EntityType.PERSON
|
|
134
|
+
})}
|
|
31
135
|
/>
|
|
32
136
|
)}
|
|
33
137
|
{answer.relationToPEP && (
|
|
34
138
|
<StaticInput
|
|
35
|
-
label=
|
|
36
|
-
value={
|
|
37
|
-
labels[entityType][PepType.RELATIVE].RELATION[
|
|
38
|
-
answer.relationToPEP
|
|
39
|
-
]
|
|
40
|
-
}
|
|
139
|
+
label={intl.formatMessage(messages.relationLabel)}
|
|
140
|
+
value={intl.formatMessage(relationMessages[answer.relationToPEP])}
|
|
41
141
|
/>
|
|
42
142
|
)}
|
|
43
143
|
{answer.businessRelation && (
|
|
44
144
|
<StaticInput
|
|
45
|
-
label=
|
|
46
|
-
value={
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
]
|
|
50
|
-
}
|
|
145
|
+
label={intl.formatMessage(messages.businessRelationLabel)}
|
|
146
|
+
value={intl.formatMessage(
|
|
147
|
+
businessRelationMessages[answer.businessRelation]
|
|
148
|
+
)}
|
|
51
149
|
/>
|
|
52
150
|
)}
|
|
53
151
|
{answer.nameOfPEP && (
|
|
54
|
-
<StaticInput
|
|
152
|
+
<StaticInput
|
|
153
|
+
label={intl.formatMessage(messages.nameOfPepLabel)}
|
|
154
|
+
value={answer.nameOfPEP}
|
|
155
|
+
/>
|
|
55
156
|
)}
|
|
56
157
|
{answer.birthdayOfPEP && (
|
|
57
158
|
<StaticInput
|
|
58
|
-
label=
|
|
159
|
+
label={intl.formatMessage(messages.birthdayOfPEPLabel)}
|
|
59
160
|
value={answer.birthdayOfPEP}
|
|
60
161
|
/>
|
|
61
162
|
)}
|
|
62
163
|
{answer.ended ? (
|
|
63
164
|
<React.Fragment>
|
|
64
|
-
<StaticInput
|
|
65
|
-
|
|
165
|
+
<StaticInput
|
|
166
|
+
label={intl.formatMessage(messages.statusLabel)}
|
|
167
|
+
value={intl.formatMessage(messages.statusEndedValue)}
|
|
168
|
+
/>
|
|
169
|
+
<StaticInput
|
|
170
|
+
label={intl.formatMessage(messages.endedLabel)}
|
|
171
|
+
value={answer.ended}
|
|
172
|
+
/>
|
|
66
173
|
</React.Fragment>
|
|
67
174
|
) : (
|
|
68
|
-
<StaticInput
|
|
175
|
+
<StaticInput
|
|
176
|
+
label={intl.formatMessage(messages.statusLabel)}
|
|
177
|
+
value={intl.formatMessage(messages.statusOngoingValue)}
|
|
178
|
+
/>
|
|
69
179
|
)}
|
|
70
180
|
{answer.country && (
|
|
71
181
|
<StaticInput
|
|
72
|
-
label=
|
|
182
|
+
label={intl.formatMessage(messages.countryLabel)}
|
|
73
183
|
value={country ? country.label : answer.country}
|
|
74
184
|
/>
|
|
75
185
|
)}
|
|
76
|
-
{role &&
|
|
186
|
+
{role && (
|
|
187
|
+
<StaticInput
|
|
188
|
+
label={intl.formatMessage(messages.roleLabel)}
|
|
189
|
+
value={role.text}
|
|
190
|
+
/>
|
|
191
|
+
)}
|
|
77
192
|
{answer.ambassadorCountry && (
|
|
78
|
-
<StaticInput
|
|
193
|
+
<StaticInput
|
|
194
|
+
label={intl.formatMessage(messages.ambassadorCountryLabel)}
|
|
195
|
+
value={
|
|
196
|
+
countries.find(
|
|
197
|
+
country => country.value === answer.ambassadorCountry
|
|
198
|
+
)?.label || answer.ambassadorCountry
|
|
199
|
+
}
|
|
200
|
+
/>
|
|
79
201
|
)}
|
|
80
202
|
{answer.governmentCompany && (
|
|
81
|
-
<StaticInput
|
|
203
|
+
<StaticInput
|
|
204
|
+
label={intl.formatMessage(messages.governmentCompanyNameLabel)}
|
|
205
|
+
value={answer.governmentCompany}
|
|
206
|
+
/>
|
|
82
207
|
)}
|
|
83
208
|
{answer.governmentCompanyRole && (
|
|
84
209
|
<StaticInput
|
|
85
|
-
label=
|
|
210
|
+
label={intl.formatMessage(messages.governmentCompanyRoleLabel)}
|
|
86
211
|
value={answer.governmentCompanyRole}
|
|
87
212
|
/>
|
|
88
213
|
)}
|
|
89
214
|
{answer.internationalOrganisation && (
|
|
90
215
|
<StaticInput
|
|
91
|
-
label=
|
|
216
|
+
label={intl.formatMessage(
|
|
217
|
+
messages.internationalOrganisationNameLabel
|
|
218
|
+
)}
|
|
92
219
|
value={answer.internationalOrganisation}
|
|
93
220
|
/>
|
|
94
221
|
)}
|
|
95
222
|
{answer.internationalOrganisationRole && (
|
|
96
223
|
<StaticInput
|
|
97
|
-
label=
|
|
224
|
+
label={intl.formatMessage(
|
|
225
|
+
messages.internationalOrganisationRoleLabel
|
|
226
|
+
)}
|
|
98
227
|
value={answer.internationalOrganisationRole}
|
|
99
228
|
/>
|
|
100
229
|
)}
|
|
101
230
|
{militaryRank && (
|
|
102
|
-
<StaticInput
|
|
231
|
+
<StaticInput
|
|
232
|
+
label={intl.formatMessage(messages.militaryGradeLabel)}
|
|
233
|
+
value={militaryRank.value}
|
|
234
|
+
/>
|
|
103
235
|
)}
|
|
104
236
|
</div>
|
|
105
237
|
);
|
package/src/demo/Done.tsx
CHANGED
|
@@ -9,12 +9,8 @@ export function Done() {
|
|
|
9
9
|
<div>
|
|
10
10
|
<h2>Taco hej!</h2>
|
|
11
11
|
<p>Leverpastej!</p>
|
|
12
|
-
<PepAnswers
|
|
13
|
-
|
|
14
|
-
...stateToRequest(pepContext.state),
|
|
15
|
-
ownerName: pepContext.state.ownerName,
|
|
16
|
-
}}
|
|
17
|
-
/>
|
|
12
|
+
<PepAnswers answer={stateToRequest(pepContext.state)} />
|
|
13
|
+
<pre>{JSON.stringify(stateToRequest(pepContext.state), null, 2)}</pre>
|
|
18
14
|
</div>
|
|
19
15
|
);
|
|
20
16
|
}
|
package/src/demo/Pep.tsx
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useState, useContext, useEffect, useRef } from "react";
|
|
2
2
|
import { Story } from "@lysaab/ui-2";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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";
|
|
6
7
|
import { PepContext, PepType, EntityType } from "../pages/PepContext";
|
|
7
8
|
import { Done } from "./Done";
|
|
8
|
-
import {
|
|
9
|
+
import { RelationPage } from "../pages/RelationPage/RelationPage";
|
|
9
10
|
|
|
10
11
|
export function Pep() {
|
|
11
12
|
const [page, setPage] = useState(0);
|
|
@@ -14,93 +15,98 @@ export function Pep() {
|
|
|
14
15
|
const loaded = useRef(false);
|
|
15
16
|
|
|
16
17
|
useEffect(() => {
|
|
17
|
-
if(!loaded.current) {
|
|
18
|
-
pepContext.setState({
|
|
18
|
+
if (!loaded.current) {
|
|
19
|
+
pepContext.setState({
|
|
20
|
+
ownerName: "Sean Banan",
|
|
21
|
+
tin: "191212121212",
|
|
22
|
+
legalEntityType: EntityType.PERSON
|
|
23
|
+
});
|
|
19
24
|
loaded.current = true;
|
|
20
25
|
}
|
|
21
26
|
}, [loaded, pepContext]);
|
|
22
27
|
|
|
23
28
|
return (
|
|
24
29
|
<div style={{ maxWidth: "1000px", margin: "0 auto" }}>
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
setPage(
|
|
46
|
-
} else if (type === PepType.NOT_PEP) {
|
|
47
|
-
setPage(4);
|
|
48
|
-
} else {
|
|
49
|
-
setPage(1);
|
|
50
|
-
}
|
|
51
|
-
}}
|
|
52
|
-
/>
|
|
53
|
-
)}
|
|
54
|
-
{page === 1 && <PepRelationPage next={() => setPage(2)} />}
|
|
55
|
-
{page === 2 && <PepStatusPage next={() => setPage(3)} />}
|
|
56
|
-
{page === 3 && <PepRolePage next={() => setPage(4)} />}
|
|
57
|
-
{page === 4 && <Done />}
|
|
58
|
-
</Story>
|
|
59
|
-
<hr />
|
|
60
|
-
<fieldset>
|
|
61
|
-
<legend>Konfig</legend>
|
|
62
|
-
<div>
|
|
63
|
-
<label>
|
|
64
|
-
Entitet
|
|
65
|
-
|
|
66
|
-
<select
|
|
67
|
-
value={pepContext.state.legalEntityType || EntityType.PERSON}
|
|
68
|
-
onChange={event => {
|
|
69
|
-
pepContext.setState({
|
|
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>
|
|
77
|
-
</label>
|
|
78
|
-
</div>
|
|
79
|
-
<div>
|
|
80
|
-
<label>
|
|
81
|
-
Namnet på den verkliga huvudmannen
|
|
82
|
-
<input
|
|
83
|
-
type="text"
|
|
84
|
-
value={pepContext.state.ownerName || ''}
|
|
85
|
-
onChange={event =>
|
|
86
|
-
pepContext.setState({ ownerName: event.currentTarget.value })
|
|
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)
|
|
87
51
|
}
|
|
88
52
|
/>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
<input
|
|
95
|
-
type="text"
|
|
96
|
-
value={pepContext.state.tin || ''}
|
|
97
|
-
onChange={event =>
|
|
98
|
-
pepContext.setState({ tin: event.currentTarget.value })
|
|
53
|
+
) : null}
|
|
54
|
+
{page === 1 ? (
|
|
55
|
+
<StatusPage
|
|
56
|
+
next={() =>
|
|
57
|
+
type === PepType.ME ? setPage(page + 2) : setPage(page + 1)
|
|
99
58
|
}
|
|
100
59
|
/>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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>
|
|
104
110
|
</div>
|
|
105
111
|
);
|
|
106
112
|
}
|
package/src/index.css
CHANGED
|
File without changes
|
package/src/index.tsx
CHANGED
|
File without changes
|
package/src/logo.svg
CHANGED
|
File without changes
|
package/src/model/Countries.ts
CHANGED
|
File without changes
|
package/src/model/PepModel.ts
CHANGED
|
File without changes
|
|
@@ -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
|
+
};
|
package/src/pages/PepContext.tsx
CHANGED
|
File without changes
|