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