@lysaab/lysa-pep 3.0.3 → 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 (40) hide show
  1. package/components/PepAnswers.js +1 -35
  2. package/messages/src/components/PepAnswers.json +1 -1
  3. package/messages/src/pages/IsPep/IsPepMessages.json +1 -1
  4. package/messages/src/pages/IsPep/IsPepPage.json +1 -1
  5. package/messages/src/pages/RelationPage/RelationMessages.json +1 -1
  6. package/messages/src/pages/RelationPage/RelationPage.json +1 -1
  7. package/messages/src/pages/RolePage/RoleMessages.json +1 -1
  8. package/messages/src/pages/RolePage/RolePage.json +1 -1
  9. package/messages/src/pages/StatusPage/StatusMessages.json +1 -1
  10. package/messages/src/pages/StatusPage/StatusPage.json +1 -1
  11. package/package.json +3 -3
  12. package/pages/IsPep/IsPepMessages.d.ts +0 -12
  13. package/pages/IsPep/IsPepMessages.js +6 -66
  14. package/pages/IsPep/IsPepPage.js +1 -1
  15. package/pages/RelationPage/RelationMessages.d.ts +0 -38
  16. package/pages/RelationPage/RelationMessages.js +0 -218
  17. package/pages/RelationPage/RelationPage.js +4 -2
  18. package/pages/RolePage/RoleMessages.d.ts +0 -70
  19. package/pages/RolePage/RoleMessages.js +0 -268
  20. package/pages/RolePage/RolePage.d.ts +2 -0
  21. package/pages/RolePage/RolePage.js +4 -5
  22. package/pages/StatusPage/StatusMessages.d.ts +0 -24
  23. package/pages/StatusPage/StatusMessages.js +0 -222
  24. package/pages/StatusPage/StatusPage.d.ts +2 -0
  25. package/pages/StatusPage/StatusPage.js +4 -5
  26. package/components/CountrySelect.d.ts +0 -11
  27. package/components/CountrySelect.js +0 -41
  28. package/messages/src/components/CountrySelect.json +0 -1
  29. package/model/Countries.d.ts +0 -4
  30. package/model/Countries.js +0 -1002
  31. package/model/PepTexts.d.ts +0 -380
  32. package/model/PepTexts.js +0 -552
  33. package/pages/PepIsPepPage.d.ts +0 -15
  34. package/pages/PepIsPepPage.js +0 -59
  35. package/pages/PepRelationPage.d.ts +0 -6
  36. package/pages/PepRelationPage.js +0 -79
  37. package/pages/PepRolePage.d.ts +0 -10
  38. package/pages/PepRolePage.js +0 -127
  39. package/pages/PepStatusPage.d.ts +0 -6
  40. package/pages/PepStatusPage.js +0 -58
@@ -3,270 +3,48 @@ import { PepStatus } from "../PepContext";
3
3
  export const isOngoingMessages = defineMessages({
4
4
  header: {
5
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
6
  },
108
7
  required: {
109
8
  id: "pep.status.isongoing.required",
110
- description: "Is ongoing required error",
111
- defaultMessage: "You need to choose an alternative",
112
9
  },
113
10
  });
114
11
  export const endedMessages = defineMessages({
115
12
  header: {
116
13
  id: "pep.status.ended.header",
117
- description: "When did it end header",
118
- defaultMessage: "When did the assignment end?",
119
14
  },
120
15
  required: {
121
16
  id: "pep.status.ended.required",
122
- description: "When did it end required error",
123
- defaultMessage: "You need to provide an end date",
124
17
  },
125
18
  });
126
19
  export const isLocalCountryMessages = defineMessages({
127
20
  header: {
128
21
  id: "pep.status.localcountry.header",
129
- description: "What country header",
130
- defaultMessage: "What country is the position in?",
131
22
  },
132
23
  required: {
133
24
  id: "pep.status.localcountry.required",
134
- description: "Is local country required error",
135
- defaultMessage: "You need to choose a country",
136
25
  },
137
26
  });
138
27
  export const countrySelectionMessages = defineMessages({
139
28
  header: {
140
29
  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
30
  },
243
31
  required: {
244
32
  id: "pep.status.countryselecton.required",
245
- description: "Country selection required error",
246
- defaultMessage: "You have to choose a country",
247
33
  },
248
34
  });
249
35
  export const localCountryAltMessages = defineMessages({
250
36
  localCountry: {
251
37
  id: "pep.status.localcountryalt.local",
252
- description: "Local country name",
253
- defaultMessage: "{countryName}",
254
38
  },
255
39
  otherCountry: {
256
40
  id: "pep.status.othercountryalt.other",
257
- description: "Other country",
258
- defaultMessage: "Other",
259
41
  },
260
42
  });
261
43
  export const stateAltMessages = defineMessages({
262
44
  [PepStatus.ONGOING]: {
263
45
  id: "pep.status.state.ONGOING",
264
- description: "Ongoing alt",
265
- defaultMessage: "Ongoing",
266
46
  },
267
47
  [PepStatus.ENDED]: {
268
48
  id: "pep.status.state.ENDED",
269
- description: "Ended alt",
270
- defaultMessage: "Ended",
271
49
  },
272
50
  });
@@ -1,7 +1,9 @@
1
1
  import { FunctionComponent } from "react";
2
+ import { Language } from "@lysaab/ui-2";
2
3
  interface Props {
3
4
  countryName: string;
4
5
  countryCode: string;
6
+ language: Language;
5
7
  next: () => void;
6
8
  }
7
9
  export declare const StatusPage: FunctionComponent<Props>;
@@ -1,11 +1,10 @@
1
1
  import React, { useRef, useCallback, useContext, } from "react";
2
- import { Form, RadioGroup, RequiredValidator, PrimaryButton, Datepicker, Card, } from "@lysaab/ui-2";
2
+ import { Form, RadioGroup, RequiredValidator, PrimaryButton, Datepicker, Card, CountrySelect, } from "@lysaab/ui-2";
3
3
  import { PepContext, PepStatus, EntityType, PepType } from "../PepContext";
4
- import { CountrySelect } from "../../components/CountrySelect";
5
4
  import { useIntl, FormattedMessage } from "react-intl";
6
5
  import { isOngoingMessages, endedMessages, isLocalCountryMessages, countrySelectionMessages, localCountryAltMessages, stateAltMessages, } from "./StatusMessages";
7
6
  import { formatPossessive } from "../../utils/Possession";
8
- export const StatusPage = ({ countryName, countryCode, next, }) => {
7
+ export const StatusPage = ({ countryName, countryCode, language, next, }) => {
9
8
  const pepContext = useContext(PepContext);
10
9
  const formRef = useRef();
11
10
  const intl = useIntl();
@@ -73,9 +72,9 @@ export const StatusPage = ({ countryName, countryCode, next, }) => {
73
72
  country: event.value ? event.value.toString() : undefined,
74
73
  }), validators: [
75
74
  new RequiredValidator(intl.formatMessage(countrySelectionMessages.required)),
76
- ], value: pepContext.state.country, omitCountries: [countryCode] })) : null),
75
+ ], value: pepContext.state.country, omitList: [countryCode], language: language })) : null),
77
76
  React.createElement(PrimaryButton, { block: true, type: "submit" },
78
- React.createElement(FormattedMessage, { id: "pep.status.next", description: "Next button", defaultMessage: "Next" })))));
77
+ React.createElement(FormattedMessage, { id: "pep.status.next" })))));
79
78
  };
80
79
  function getIsLocalCountryAlternatives(intl, countryName) {
81
80
  return [
@@ -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 {};
@@ -1,41 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import React, { useState, useEffect } from "react";
13
- import { Select } from "@lysaab/ui-2";
14
- import countries from "@lysaab/countries";
15
- import { defineMessages, useIntl } from "react-intl";
16
- const messages = defineMessages({
17
- placeholder: {
18
- id: "component.select.country",
19
- description: "Select a country placeholder",
20
- defaultMessage: "Select a country",
21
- },
22
- });
23
- function getCountries(lang, omitCountries) {
24
- return (countries[lang] || countries["en"])
25
- .filter((country) => !omitCountries.includes(country.value))
26
- .map((country) => ({
27
- text: country.label,
28
- value: country.value,
29
- }));
30
- }
31
- const EMPTY_OMIT_COUNTRIES = [];
32
- export const CountrySelect = (_a) => {
33
- var { value, omitCountries = EMPTY_OMIT_COUNTRIES } = _a, props = __rest(_a, ["value", "omitCountries"]);
34
- const intl = useIntl();
35
- const lang = intl.locale.slice(0, 2);
36
- const [countryAlternatives, setCountryAlternatives] = useState(getCountries(lang, omitCountries));
37
- useEffect(() => {
38
- setCountryAlternatives(getCountries(lang, omitCountries));
39
- }, [lang, omitCountries]);
40
- return (React.createElement(Select, Object.assign({ alternatives: countryAlternatives, placeholder: intl.formatMessage(messages.placeholder), value: countryAlternatives.find((country) => country.value === value) }, props)));
41
- };
@@ -1 +0,0 @@
1
- [{"id":"component.select.country","description":"Select a country placeholder","defaultMessage":"Select a country"}]
@@ -1,4 +0,0 @@
1
- export declare const countries: {
2
- label: string;
3
- value: string;
4
- }[];