@lysaab/lysa-pep 3.0.4 → 4.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/Exports.d.ts +7 -7
- package/Exports.js +7 -7
- package/components/PepAnswers.d.ts +8 -8
- package/components/PepAnswers.js +103 -137
- package/messages/src/components/PepAnswers.json +1 -1
- package/messages/src/pages/IsPep/IsPepMessages.json +1 -1
- package/messages/src/pages/IsPep/IsPepPage.json +1 -1
- package/messages/src/pages/RelationPage/RelationMessages.json +1 -1
- package/messages/src/pages/RelationPage/RelationPage.json +1 -1
- package/messages/src/pages/RolePage/RoleMessages.json +1 -1
- package/messages/src/pages/RolePage/RolePage.json +1 -1
- package/messages/src/pages/StatusPage/StatusMessages.json +1 -1
- package/messages/src/pages/StatusPage/StatusPage.json +1 -1
- package/model/PepModel.d.ts +7 -7
- package/model/PepModel.js +40 -40
- package/package.json +3 -3
- package/pages/IsPep/IsPepMessages.d.ts +20 -32
- package/pages/IsPep/IsPepMessages.js +10 -70
- package/pages/IsPep/IsPepPage.d.ts +15 -15
- package/pages/IsPep/IsPepPage.js +61 -61
- package/pages/PepContext.d.ts +80 -81
- package/pages/PepContext.js +88 -89
- package/pages/RelationPage/RelationMessages.d.ts +67 -105
- package/pages/RelationPage/RelationMessages.js +69 -287
- package/pages/RelationPage/RelationPage.d.ts +6 -6
- package/pages/RelationPage/RelationPage.js +158 -156
- package/pages/RolePage/RoleMessages.d.ts +115 -185
- package/pages/RolePage/RoleMessages.js +117 -385
- package/pages/RolePage/RolePage.d.ts +13 -11
- package/pages/RolePage/RolePage.js +222 -223
- package/pages/StatusPage/StatusMessages.d.ts +48 -72
- package/pages/StatusPage/StatusMessages.js +50 -272
- package/pages/StatusPage/StatusPage.d.ts +10 -8
- package/pages/StatusPage/StatusPage.js +104 -105
- package/utils/Possession.d.ts +1 -1
- package/utils/Possession.js +27 -27
- package/components/CountrySelect.d.ts +0 -11
- package/components/CountrySelect.js +0 -41
- package/messages/src/components/CountrySelect.json +0 -1
|
@@ -1,272 +1,50 @@
|
|
|
1
|
-
import { defineMessages } from "react-intl";
|
|
2
|
-
import { PepStatus } from "../PepContext";
|
|
3
|
-
export const isOngoingMessages = defineMessages({
|
|
4
|
-
header: {
|
|
5
|
-
id: "pep.status.isongoing.header",
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
other {}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
other {}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
CORPORATION {
|
|
58
|
-
{
|
|
59
|
-
pepType, select,
|
|
60
|
-
ME {
|
|
61
|
-
Is the position of {name} ongoing or ended
|
|
62
|
-
}
|
|
63
|
-
RELATIVE {
|
|
64
|
-
{
|
|
65
|
-
relation, select,
|
|
66
|
-
MARRIED_PARTNER {
|
|
67
|
-
Is the position of the spouse of {name} ongoing or ended?
|
|
68
|
-
}
|
|
69
|
-
COLIVING_PARTNER {
|
|
70
|
-
Is the position of the partner of {name} ongoing or ended?
|
|
71
|
-
}
|
|
72
|
-
CHILD {
|
|
73
|
-
Is the position of the parent of {name} ongoing or ended?
|
|
74
|
-
}
|
|
75
|
-
PARENT {
|
|
76
|
-
Is the position of the child of {name} ongoing or ended?
|
|
77
|
-
}
|
|
78
|
-
CHILD_MARRIED_PARTNER {
|
|
79
|
-
Is the position of the parent of the spouse of {name} ongoing or ended?
|
|
80
|
-
}
|
|
81
|
-
CHILD_COLIVING_PARTNER {
|
|
82
|
-
Is the position of the parent of the partner of {name} ongoing or ended?
|
|
83
|
-
}
|
|
84
|
-
other {}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
COLLEAGUE {
|
|
88
|
-
{
|
|
89
|
-
relation, select,
|
|
90
|
-
CO_OWNERSHIP {
|
|
91
|
-
Is the position of the person in a politically exposed position, who is the beneficial owner in a company together with {name}, ongoing or ended?
|
|
92
|
-
}
|
|
93
|
-
CLOSE_CONNECTION {
|
|
94
|
-
Is the position for the person in a politically exposed position, who {name} have or have had a close relationship to, ongoing or ended?
|
|
95
|
-
}
|
|
96
|
-
COMPANY_FOR_PEP {
|
|
97
|
-
Is the position for the person in a politically exposed position, who {name} have a close relationship to, ongoing or ended?
|
|
98
|
-
}
|
|
99
|
-
other {}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
other {}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
other {}
|
|
106
|
-
}`,
|
|
107
|
-
},
|
|
108
|
-
required: {
|
|
109
|
-
id: "pep.status.isongoing.required",
|
|
110
|
-
description: "Is ongoing required error",
|
|
111
|
-
defaultMessage: "You need to choose an alternative",
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
export const endedMessages = defineMessages({
|
|
115
|
-
header: {
|
|
116
|
-
id: "pep.status.ended.header",
|
|
117
|
-
description: "When did it end header",
|
|
118
|
-
defaultMessage: "When did the assignment end?",
|
|
119
|
-
},
|
|
120
|
-
required: {
|
|
121
|
-
id: "pep.status.ended.required",
|
|
122
|
-
description: "When did it end required error",
|
|
123
|
-
defaultMessage: "You need to provide an end date",
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
export const isLocalCountryMessages = defineMessages({
|
|
127
|
-
header: {
|
|
128
|
-
id: "pep.status.localcountry.header",
|
|
129
|
-
description: "What country header",
|
|
130
|
-
defaultMessage: "What country is the position in?",
|
|
131
|
-
},
|
|
132
|
-
required: {
|
|
133
|
-
id: "pep.status.localcountry.required",
|
|
134
|
-
description: "Is local country required error",
|
|
135
|
-
defaultMessage: "You need to choose a country",
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
export const countrySelectionMessages = defineMessages({
|
|
139
|
-
header: {
|
|
140
|
-
id: "pep.status.countryselecton.header",
|
|
141
|
-
description: "Country selection header",
|
|
142
|
-
defaultMessage: `{
|
|
143
|
-
entityType, select,
|
|
144
|
-
PERSON {
|
|
145
|
-
{
|
|
146
|
-
pepType, select,
|
|
147
|
-
ME {
|
|
148
|
-
In what country is/was your position?
|
|
149
|
-
}
|
|
150
|
-
RELATIVE {
|
|
151
|
-
{
|
|
152
|
-
relation, select,
|
|
153
|
-
MARRIED_PARTNER {
|
|
154
|
-
In what country is/was your spouse's position?
|
|
155
|
-
}
|
|
156
|
-
COLIVING_PARTNER {
|
|
157
|
-
In what country is/was your partner's position?
|
|
158
|
-
}
|
|
159
|
-
CHILD {
|
|
160
|
-
In what country is/was your parent's position?
|
|
161
|
-
}
|
|
162
|
-
PARENT {
|
|
163
|
-
In what country is/was your child's position?
|
|
164
|
-
}
|
|
165
|
-
CHILD_MARRIED_PARTNER {
|
|
166
|
-
In what country is/was your spouse's parent's position?
|
|
167
|
-
}
|
|
168
|
-
CHILD_COLIVING_PARTNER {
|
|
169
|
-
In what country is/was your partner's parent's position?
|
|
170
|
-
}
|
|
171
|
-
other {}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
COLLEAGUE {
|
|
175
|
-
{
|
|
176
|
-
relation, select,
|
|
177
|
-
CO_OWNERSHIP {
|
|
178
|
-
In what country is/was the position of the person in a politically exposed position you have or have had a relationship to?
|
|
179
|
-
}
|
|
180
|
-
CLOSE_CONNECTION {
|
|
181
|
-
In what country is/was the position of the person in a politically exposed position you have or have had a relationship to?
|
|
182
|
-
}
|
|
183
|
-
COMPANY_FOR_PEP {
|
|
184
|
-
In what country is/was the position of the person in a politically exposed position you have or have had a relationship to?
|
|
185
|
-
}
|
|
186
|
-
other {}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
other {}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
CORPORATION {
|
|
193
|
-
{
|
|
194
|
-
pepType, select,
|
|
195
|
-
ME {
|
|
196
|
-
In what country is/was the position of {name}
|
|
197
|
-
}
|
|
198
|
-
RELATIVE {
|
|
199
|
-
{
|
|
200
|
-
relation, select,
|
|
201
|
-
MARRIED_PARTNER {
|
|
202
|
-
In what country is/was the position of the spouse of {name}
|
|
203
|
-
}
|
|
204
|
-
COLIVING_PARTNER {
|
|
205
|
-
In what country is/was the position of the partner of {name}
|
|
206
|
-
}
|
|
207
|
-
CHILD {
|
|
208
|
-
In what country is/was the position of the parent of {name}
|
|
209
|
-
}
|
|
210
|
-
PARENT {
|
|
211
|
-
In what country is/was the position of the child of {name}
|
|
212
|
-
}
|
|
213
|
-
CHILD_MARRIED_PARTNER {
|
|
214
|
-
In what country is/was the position of the parent of the spouse of {name}
|
|
215
|
-
}
|
|
216
|
-
CHILD_COLIVING_PARTNER {
|
|
217
|
-
In what country is/was the position of the parent of the partner of {name}
|
|
218
|
-
}
|
|
219
|
-
other {}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
COLLEAGUE {
|
|
223
|
-
{
|
|
224
|
-
relation, select,
|
|
225
|
-
CO_OWNERSHIP {
|
|
226
|
-
In what country is/was the position of the beneficial owner that {name} has a relationship to?
|
|
227
|
-
}
|
|
228
|
-
CLOSE_CONNECTION {
|
|
229
|
-
In what country is/was the position of the person that {name} has/had a relationship to?
|
|
230
|
-
}
|
|
231
|
-
COMPANY_FOR_PEP {
|
|
232
|
-
In what country has/had the person in a politically exposed position, that {name} has a relationship to, his or her position?
|
|
233
|
-
}
|
|
234
|
-
other {}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
other {}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
other {}
|
|
241
|
-
}`,
|
|
242
|
-
},
|
|
243
|
-
required: {
|
|
244
|
-
id: "pep.status.countryselecton.required",
|
|
245
|
-
description: "Country selection required error",
|
|
246
|
-
defaultMessage: "You have to choose a country",
|
|
247
|
-
},
|
|
248
|
-
});
|
|
249
|
-
export const localCountryAltMessages = defineMessages({
|
|
250
|
-
localCountry: {
|
|
251
|
-
id: "pep.status.localcountryalt.local",
|
|
252
|
-
description: "Local country name",
|
|
253
|
-
defaultMessage: "{countryName}",
|
|
254
|
-
},
|
|
255
|
-
otherCountry: {
|
|
256
|
-
id: "pep.status.othercountryalt.other",
|
|
257
|
-
description: "Other country",
|
|
258
|
-
defaultMessage: "Other",
|
|
259
|
-
},
|
|
260
|
-
});
|
|
261
|
-
export const stateAltMessages = defineMessages({
|
|
262
|
-
[PepStatus.ONGOING]: {
|
|
263
|
-
id: "pep.status.state.ONGOING",
|
|
264
|
-
description: "Ongoing alt",
|
|
265
|
-
defaultMessage: "Ongoing",
|
|
266
|
-
},
|
|
267
|
-
[PepStatus.ENDED]: {
|
|
268
|
-
id: "pep.status.state.ENDED",
|
|
269
|
-
description: "Ended alt",
|
|
270
|
-
defaultMessage: "Ended",
|
|
271
|
-
},
|
|
272
|
-
});
|
|
1
|
+
import { defineMessages } from "react-intl";
|
|
2
|
+
import { PepStatus } from "../PepContext";
|
|
3
|
+
export const isOngoingMessages = defineMessages({
|
|
4
|
+
header: {
|
|
5
|
+
id: "pep.status.isongoing.header",
|
|
6
|
+
},
|
|
7
|
+
required: {
|
|
8
|
+
id: "pep.status.isongoing.required",
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
export const endedMessages = defineMessages({
|
|
12
|
+
header: {
|
|
13
|
+
id: "pep.status.ended.header",
|
|
14
|
+
},
|
|
15
|
+
required: {
|
|
16
|
+
id: "pep.status.ended.required",
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
export const isLocalCountryMessages = defineMessages({
|
|
20
|
+
header: {
|
|
21
|
+
id: "pep.status.localcountry.header",
|
|
22
|
+
},
|
|
23
|
+
required: {
|
|
24
|
+
id: "pep.status.localcountry.required",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
export const countrySelectionMessages = defineMessages({
|
|
28
|
+
header: {
|
|
29
|
+
id: "pep.status.countryselecton.header",
|
|
30
|
+
},
|
|
31
|
+
required: {
|
|
32
|
+
id: "pep.status.countryselecton.required",
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
export const localCountryAltMessages = defineMessages({
|
|
36
|
+
localCountry: {
|
|
37
|
+
id: "pep.status.localcountryalt.local",
|
|
38
|
+
},
|
|
39
|
+
otherCountry: {
|
|
40
|
+
id: "pep.status.othercountryalt.other",
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
export const stateAltMessages = defineMessages({
|
|
44
|
+
[PepStatus.ONGOING]: {
|
|
45
|
+
id: "pep.status.state.ONGOING",
|
|
46
|
+
},
|
|
47
|
+
[PepStatus.ENDED]: {
|
|
48
|
+
id: "pep.status.state.ENDED",
|
|
49
|
+
},
|
|
50
|
+
});
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { FunctionComponent } from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { FunctionComponent } from "react";
|
|
2
|
+
import { Language } from "@lysaab/ui-2";
|
|
3
|
+
interface Props {
|
|
4
|
+
countryName: string;
|
|
5
|
+
countryCode: string;
|
|
6
|
+
language: Language;
|
|
7
|
+
next: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const StatusPage: FunctionComponent<Props>;
|
|
10
|
+
export {};
|
|
@@ -1,105 +1,104 @@
|
|
|
1
|
-
import React, { useRef, useCallback, useContext, } from "react";
|
|
2
|
-
import { Form, RadioGroup, RequiredValidator, PrimaryButton, Datepicker, Card, } from "@lysaab/ui-2";
|
|
3
|
-
import { PepContext, PepStatus, EntityType, PepType } from "../PepContext";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
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
|
-
}
|
|
1
|
+
import React, { useRef, useCallback, useContext, } from "react";
|
|
2
|
+
import { Form, RadioGroup, RequiredValidator, PrimaryButton, Datepicker, Card, CountrySelect, } from "@lysaab/ui-2";
|
|
3
|
+
import { PepContext, PepStatus, EntityType, PepType } from "../PepContext";
|
|
4
|
+
import { useIntl, FormattedMessage } from "react-intl";
|
|
5
|
+
import { isOngoingMessages, endedMessages, isLocalCountryMessages, countrySelectionMessages, localCountryAltMessages, stateAltMessages, } from "./StatusMessages";
|
|
6
|
+
import { formatPossessive } from "../../utils/Possession";
|
|
7
|
+
export const StatusPage = ({ countryName, countryCode, language, next, }) => {
|
|
8
|
+
const pepContext = useContext(PepContext);
|
|
9
|
+
const formRef = useRef();
|
|
10
|
+
const intl = useIntl();
|
|
11
|
+
const stateAlternatives = getStateAlternatives(intl);
|
|
12
|
+
const isLocalCountryAlternatives = getIsLocalCountryAlternatives(intl, countryName);
|
|
13
|
+
const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
|
|
14
|
+
const nextPage = useCallback(() => {
|
|
15
|
+
if (formRef.current && formRef.current.isValid) {
|
|
16
|
+
next();
|
|
17
|
+
}
|
|
18
|
+
}, [formRef, next]);
|
|
19
|
+
const updateIsLocalCountry = useCallback((alternative) => {
|
|
20
|
+
pepContext.setState({ isLocalCountry: alternative.value });
|
|
21
|
+
if (alternative.value === "other") {
|
|
22
|
+
pepContext.setState({ country: undefined });
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
pepContext.setState({ country: countryCode });
|
|
26
|
+
}
|
|
27
|
+
}, [pepContext, countryCode]);
|
|
28
|
+
const updateIsOngoing = useCallback((alternative) => {
|
|
29
|
+
pepContext.setState({ isOngoing: alternative.value });
|
|
30
|
+
if (alternative.value === PepStatus.ONGOING) {
|
|
31
|
+
pepContext.setState({ ended: undefined });
|
|
32
|
+
}
|
|
33
|
+
}, [pepContext]);
|
|
34
|
+
return (React.createElement("div", null,
|
|
35
|
+
React.createElement(Form, { lysaFormRef: formRef, onSubmit: () => {
|
|
36
|
+
nextPage();
|
|
37
|
+
} },
|
|
38
|
+
React.createElement(Card, null,
|
|
39
|
+
React.createElement(RadioGroup, { alternatives: stateAlternatives, header: intl.formatMessage(isOngoingMessages.header, {
|
|
40
|
+
entityType,
|
|
41
|
+
name: pepContext.state.ownerName,
|
|
42
|
+
possessiveName: formatPossessive(pepContext.state.ownerName, intl.locale),
|
|
43
|
+
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
44
|
+
? pepContext.state.businessRelation
|
|
45
|
+
: pepContext.state.relationToPEP,
|
|
46
|
+
pepType: pepContext.state.type,
|
|
47
|
+
}), onChange: updateIsOngoing, value: stateAlternatives.find((alt) => alt.value === pepContext.state.isOngoing), validators: [
|
|
48
|
+
new RequiredValidator(intl.formatMessage(isOngoingMessages.required)),
|
|
49
|
+
] }),
|
|
50
|
+
pepContext.state.isOngoing &&
|
|
51
|
+
pepContext.state.isOngoing === PepStatus.ENDED ? (React.createElement(Datepicker, { label: intl.formatMessage(endedMessages.header), selected: pepContext.state.ended, onChange: (event) => {
|
|
52
|
+
pepContext.setState({ ended: event || undefined });
|
|
53
|
+
}, validators: [
|
|
54
|
+
new RequiredValidator(intl.formatMessage(endedMessages.required)),
|
|
55
|
+
], showMonthYearPicker: true, dateFormat: "yyyy-MM", maxDate: new Date() })) : null),
|
|
56
|
+
React.createElement(Card, null,
|
|
57
|
+
React.createElement(RadioGroup, { alternatives: isLocalCountryAlternatives, header: intl.formatMessage(isLocalCountryMessages.header, {
|
|
58
|
+
possessiveName: formatPossessive(pepContext.state.ownerName, intl.locale),
|
|
59
|
+
}), onChange: updateIsLocalCountry, value: isLocalCountryAlternatives.find((alt) => alt.value === pepContext.state.isLocalCountry), validators: [
|
|
60
|
+
new RequiredValidator(intl.formatMessage(isLocalCountryMessages.required)),
|
|
61
|
+
] }),
|
|
62
|
+
pepContext.state.isLocalCountry &&
|
|
63
|
+
pepContext.state.isLocalCountry === "other" ? (React.createElement(CountrySelect, { label: intl.formatMessage(countrySelectionMessages.header, {
|
|
64
|
+
entityType,
|
|
65
|
+
name: pepContext.state.ownerName,
|
|
66
|
+
possessiveName: formatPossessive(pepContext.state.ownerName, intl.locale),
|
|
67
|
+
relation: pepContext.state.type === PepType.COLLEAGUE
|
|
68
|
+
? pepContext.state.businessRelation
|
|
69
|
+
: pepContext.state.relationToPEP,
|
|
70
|
+
pepType: pepContext.state.type,
|
|
71
|
+
}), onChange: (event) => pepContext.setState({
|
|
72
|
+
country: event.value ? event.value.toString() : undefined,
|
|
73
|
+
}), validators: [
|
|
74
|
+
new RequiredValidator(intl.formatMessage(countrySelectionMessages.required)),
|
|
75
|
+
], value: pepContext.state.country, omitList: [countryCode], language: language })) : null),
|
|
76
|
+
React.createElement(PrimaryButton, { block: true, type: "submit" },
|
|
77
|
+
React.createElement(FormattedMessage, { id: "pep.status.next" })))));
|
|
78
|
+
};
|
|
79
|
+
function getIsLocalCountryAlternatives(intl, countryName) {
|
|
80
|
+
return [
|
|
81
|
+
{
|
|
82
|
+
text: intl.formatMessage(localCountryAltMessages.localCountry, {
|
|
83
|
+
countryName,
|
|
84
|
+
}),
|
|
85
|
+
value: "local",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
text: intl.formatMessage(localCountryAltMessages.otherCountry),
|
|
89
|
+
value: "other",
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
function getStateAlternatives(intl) {
|
|
94
|
+
return [
|
|
95
|
+
{
|
|
96
|
+
text: intl.formatMessage(stateAltMessages[PepStatus.ONGOING]),
|
|
97
|
+
value: PepStatus.ONGOING,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
text: intl.formatMessage(stateAltMessages[PepStatus.ENDED]),
|
|
101
|
+
value: PepStatus.ENDED,
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
}
|
package/utils/Possession.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function formatPossessive(text: string | undefined, locale: string): string | undefined;
|
|
1
|
+
export declare function formatPossessive(text: string | undefined, locale: string): string | undefined;
|
package/utils/Possession.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
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
|
-
else if (language === "en") {
|
|
10
|
-
return formatEnglish(text);
|
|
11
|
-
}
|
|
12
|
-
return text;
|
|
13
|
-
}
|
|
14
|
-
function formatSwedish(text) {
|
|
15
|
-
if (text[text.length - 1] !== "s" &&
|
|
16
|
-
text[text.length - 1] !== "z" &&
|
|
17
|
-
text[text.length - 1] !== "x") {
|
|
18
|
-
text += "s";
|
|
19
|
-
}
|
|
20
|
-
return text;
|
|
21
|
-
}
|
|
22
|
-
function formatEnglish(text) {
|
|
23
|
-
if (text[text.length - 1] === "s") {
|
|
24
|
-
return text + "'";
|
|
25
|
-
}
|
|
26
|
-
return text + "'s";
|
|
27
|
-
}
|
|
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
|
+
else if (language === "en") {
|
|
10
|
+
return formatEnglish(text);
|
|
11
|
+
}
|
|
12
|
+
return text;
|
|
13
|
+
}
|
|
14
|
+
function formatSwedish(text) {
|
|
15
|
+
if (text[text.length - 1] !== "s" &&
|
|
16
|
+
text[text.length - 1] !== "z" &&
|
|
17
|
+
text[text.length - 1] !== "x") {
|
|
18
|
+
text += "s";
|
|
19
|
+
}
|
|
20
|
+
return text;
|
|
21
|
+
}
|
|
22
|
+
function formatEnglish(text) {
|
|
23
|
+
if (text[text.length - 1] === "s") {
|
|
24
|
+
return text + "'";
|
|
25
|
+
}
|
|
26
|
+
return text + "'s";
|
|
27
|
+
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { Alternative } from "@lysaab/ui-2";
|
|
3
|
-
import { ValidationProps } from "@lysaab/ui-2/hooks/useValidation";
|
|
4
|
-
interface Props extends ValidationProps {
|
|
5
|
-
value?: string;
|
|
6
|
-
onChange?(value: Alternative<string>): void;
|
|
7
|
-
label: string;
|
|
8
|
-
omitCountries?: string[];
|
|
9
|
-
}
|
|
10
|
-
export declare const CountrySelect: ({ value, omitCountries, ...props }: Props) => JSX.Element;
|
|
11
|
-
export {};
|