@lysaab/lysa-pep 3.0.3 → 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/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 +34 -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 +107 -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 +74 -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 {
|
|
@@ -103,42 +103,42 @@ export const isOngoingMessages = defineMessages({
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
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",
|
|
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
142
|
defaultMessage: `{
|
|
143
143
|
entityType, select,
|
|
144
144
|
PERSON {
|
|
@@ -238,35 +238,35 @@ export const countrySelectionMessages = defineMessages({
|
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
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
|
-
});
|
|
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