@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.
Files changed (39) hide show
  1. package/Exports.d.ts +7 -7
  2. package/Exports.js +7 -7
  3. package/components/PepAnswers.d.ts +8 -8
  4. package/components/PepAnswers.js +103 -137
  5. package/messages/src/components/PepAnswers.json +1 -1
  6. package/messages/src/pages/IsPep/IsPepMessages.json +1 -1
  7. package/messages/src/pages/IsPep/IsPepPage.json +1 -1
  8. package/messages/src/pages/RelationPage/RelationMessages.json +1 -1
  9. package/messages/src/pages/RelationPage/RelationPage.json +1 -1
  10. package/messages/src/pages/RolePage/RoleMessages.json +1 -1
  11. package/messages/src/pages/RolePage/RolePage.json +1 -1
  12. package/messages/src/pages/StatusPage/StatusMessages.json +1 -1
  13. package/messages/src/pages/StatusPage/StatusPage.json +1 -1
  14. package/model/PepModel.d.ts +7 -7
  15. package/model/PepModel.js +40 -40
  16. package/package.json +3 -3
  17. package/pages/IsPep/IsPepMessages.d.ts +20 -32
  18. package/pages/IsPep/IsPepMessages.js +10 -70
  19. package/pages/IsPep/IsPepPage.d.ts +15 -15
  20. package/pages/IsPep/IsPepPage.js +61 -61
  21. package/pages/PepContext.d.ts +80 -81
  22. package/pages/PepContext.js +88 -89
  23. package/pages/RelationPage/RelationMessages.d.ts +67 -105
  24. package/pages/RelationPage/RelationMessages.js +69 -287
  25. package/pages/RelationPage/RelationPage.d.ts +6 -6
  26. package/pages/RelationPage/RelationPage.js +158 -156
  27. package/pages/RolePage/RoleMessages.d.ts +115 -185
  28. package/pages/RolePage/RoleMessages.js +117 -385
  29. package/pages/RolePage/RolePage.d.ts +13 -11
  30. package/pages/RolePage/RolePage.js +222 -223
  31. package/pages/StatusPage/StatusMessages.d.ts +48 -72
  32. package/pages/StatusPage/StatusMessages.js +50 -272
  33. package/pages/StatusPage/StatusPage.d.ts +10 -8
  34. package/pages/StatusPage/StatusPage.js +104 -105
  35. package/utils/Possession.d.ts +1 -1
  36. package/utils/Possession.js +27 -27
  37. package/components/CountrySelect.d.ts +0 -11
  38. package/components/CountrySelect.js +0 -41
  39. 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
- description: "Is ongoing header",
7
- defaultMessage: `{
8
- entityType, select,
9
- PERSON {
10
- {
11
- pepType, select,
12
- ME {
13
- Is your position ongoing or ended?
14
- }
15
- RELATIVE {
16
- {
17
- relation, select,
18
- MARRIED_PARTNER {
19
- Is your spouse's position ongoing or ended?
20
- }
21
- COLIVING_PARTNER {
22
- Is your partner's position ongoing or ended?
23
- }
24
- CHILD {
25
- Is your parent's position ongoing or ended?
26
- }
27
- PARENT {
28
- Is your child's position ongoing or ended?
29
- }
30
- CHILD_MARRIED_PARTNER {
31
- Is your spouse's parent's position ongoing or ended?
32
- }
33
- CHILD_COLIVING_PARTNER {
34
- Is your partner's parent's position ongoing or ended?
35
- }
36
- other {}
37
- }
38
- }
39
- COLLEAGUE {
40
- {
41
- relation, select,
42
- CO_OWNERSHIP {
43
- Is the position for the person in a politically exposed position, who is a beneficial owner in a company together with you, ongoing or ended?
44
- }
45
- CLOSE_CONNECTION {
46
- Is the position for the person in a politically exposed position, who you have or have had a close relationship to, ongoing or ended?
47
- }
48
- COMPANY_FOR_PEP {
49
- Is the position for the person in a politically exposed position, who you have a close relationship to, ongoing or ended?
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
- 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
+ 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 { 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, 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
+ }
@@ -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;
@@ -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 {};